diff --git a/public/build/core/devtools.min.js b/public/build/core/devtools.min.js index 4ba3df17..66ccd681 100644 --- a/public/build/core/devtools.min.js +++ b/public/build/core/devtools.min.js @@ -1558,3 +1558,4 @@ details[open] > .g7dt-summary::before { } `,ve=()=>{const d="g7-devtools-styles";if(document.getElementById(d))return;const t=document.createElement("style");t.id=d,t.textContent=be,document.head.appendChild(t)},le={state:"상태",actions:"액션",cache:"캐시",diagnose:"진단",performance:"성능",lifecycle:"라이프사이클",network:"네트워크",form:"Form",conditional:"조건부",expression:"표현식",handlers:"핸들러",events:"이벤트",datasources:"데이터소스",renders:"렌더링",styles:"스타일",auth:"인증",logs:"로그",layout:"레이아웃",changedetection:"변경감지",staleclosure:"Stale Closure",nestedcontext:"Context",modalscope:"모달스코프",namedactions:"Named Actions"},Ne=700,ue=500,re=400,ce=300,ne="g7-devtools-panel",te=d=>d===null||d===void 0?"g7dt-text-gray":typeof d=="string"?"g7dt-text-yellow":typeof d=="number"?"g7dt-text-cyan":typeof d=="boolean"?"g7dt-text-pink":Array.isArray(d)?"g7dt-text-orange":typeof d=="object"?"g7dt-text-blue":"g7dt-text-white",ye=d=>d===null?"null":d===void 0?"undefined":Array.isArray(d)?`Array(${d.length})`:typeof d=="object"?`Object(${Object.keys(d).length})`:typeof d,we=d=>d===null?"null":d===void 0?"undefined":typeof d=="string"?d.length>50?`"${d.substring(0,50)}..."`:`"${d}"`:typeof d=="boolean"?d?"true":"false":typeof d=="number"?String(d):"",oe=()=>{try{const d=localStorage.getItem(ne);if(d)return JSON.parse(d)}catch(d){console.warn("[G7DevTools] 설정 로드 실패:",d)}return{}},ie=d=>{try{const s={...oe(),...d};localStorage.setItem(ne,JSON.stringify(s))}catch(t){console.warn("[G7DevTools] 설정 저장 실패:",t)}},W=({keyName:d,value:t,path:s,expandedPaths:a,onToggle:g,searchTerm:r,depth:o=0})=>{const p=t!==null&&typeof t=="object",v=a.has(s),l=Array.isArray(t),f=r&&(d.toLowerCase().includes(r.toLowerCase())||typeof t=="string"&&t.toLowerCase().includes(r.toLowerCase())||typeof t=="number"&&String(t).includes(r)),c=y=>{y.stopPropagation(),p&&g(s)},h=p?Object.entries(t):[];return e.jsxs("div",{style:{marginLeft:o>0?"16px":"0"},children:[e.jsxs("div",{className:`g7dt-tree-node g7dt-flex g7dt-items-center g7dt-gap-1 ${f?"g7dt-ring-highlight":""}`,onClick:c,children:[p?e.jsx("span",{className:"g7dt-text-gray g7dt-w-4 g7dt-text-xs g7dt-select-none",style:{textAlign:"center"},children:v?"▼":"▶"}):e.jsx("span",{className:"g7dt-w-4"}),e.jsx("span",{className:"g7dt-text-purple g7dt-text-xs",children:d}),e.jsx("span",{className:"g7dt-text-gray-dark g7dt-text-xs",children:":"}),p?e.jsxs("span",{className:`g7dt-text-xs ${te(t)}`,children:[l?"[":"{",!v&&e.jsx("span",{className:"g7dt-text-gray",style:{margin:"0 4px"},children:ye(t)}),!v&&(l?"]":"}")]}):e.jsx("span",{className:`g7dt-text-xs ${te(t)}`,children:we(t)}),!p&&e.jsxs("span",{className:"g7dt-text-gray-dark g7dt-text-xs g7dt-ml-1",children:["(",typeof t,")"]})]}),p&&v&&e.jsxs("div",{className:"g7dt-border-l",style:{marginLeft:"8px"},children:[h.map(([y,n])=>e.jsx(W,{keyName:l?`[${y}]`:y,value:n,path:`${s}.${y}`,expandedPaths:a,onToggle:g,searchTerm:r,depth:o+1},`${s}.${y}`)),e.jsx("div",{className:"g7dt-ml-4 g7dt-text-xs",children:e.jsx("span",{className:te(t),children:l?"]":"}"})})]})]})},ke=({state:d,devTools:t})=>{const[s,a]=x.useState(new Set(["_global","_local","_computed","_isolated","$parent"])),[g,r]=x.useState(""),[o,p]=x.useState(!1),[v,l]=x.useState(!1),[f,c]=x.useState(null),h=x.useCallback(()=>{t&&c(t.getComputedDependencyTrackingInfo())},[t]);x.useEffect(()=>{if(v&&t){h();const w=setInterval(h,2e3);return()=>clearInterval(w)}},[v,t,h]);const y=w=>{switch(w){case"state-change":return"📊";case"prop-change":return"📥";case"dependency-change":return"🔗";case"manual":return"👆";case"initial":return"🚀";default:return"❓"}},n=x.useCallback(w=>{a(S=>{const z=new Set(S);return z.has(w)?z.delete(w):z.add(w),z})},[]),i=x.useCallback((w,S)=>{const z=[S];if(w!==null&&typeof w=="object")for(const[O,K]of Object.entries(w))z.push(...i(K,`${S}.${O}`));return z},[]),u=x.useCallback(()=>{if(o)a(new Set(["_global","_local","_computed","_isolated","$parent"]));else{const w=new Set;i(d._global,"_global").forEach(S=>w.add(S)),i(d._local,"_local").forEach(S=>w.add(S)),i(d._computed,"_computed").forEach(S=>w.add(S)),i(d._isolated,"_isolated").forEach(S=>w.add(S)),d.$parent&&i(d.$parent,"$parent").forEach(S=>w.add(S)),a(w)}p(!o)},[o,d,i]),m=Object.keys(d._global||{}).length,k=Object.keys(d._local||{}).length,b=Object.keys(d._computed||{}).length,N=Object.keys(d._isolated||{}).length,C=Object.keys(d.$parent||{}).length;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-items-center g7dt-flex-shrink-0",children:[e.jsx("input",{type:"text",placeholder:"키 또는 값 검색...",value:g,onChange:w=>r(w.target.value),className:"g7dt-input g7dt-flex-1"}),e.jsx("button",{onClick:u,className:"g7dt-btn g7dt-bg-gray-700",children:o?"모두 접기":"모두 펼치기"})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-3 g7dt-text-xs g7dt-text-gray g7dt-flex-wrap g7dt-flex-shrink-0",children:[e.jsxs("span",{children:[e.jsx("span",{className:"g7dt-text-yellow",children:"●"})," string"]}),e.jsxs("span",{children:[e.jsx("span",{className:"g7dt-text-cyan",children:"●"})," number"]}),e.jsxs("span",{children:[e.jsx("span",{className:"g7dt-text-pink",children:"●"})," boolean"]}),e.jsxs("span",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"●"})," null"]}),e.jsxs("span",{children:[e.jsx("span",{className:"g7dt-text-orange",children:"●"})," array"]}),e.jsxs("span",{children:[e.jsx("span",{className:"g7dt-text-blue",children:"●"})," object"]})]}),e.jsxs("div",{className:"g7dt-bg-gray-800 g7dt-rounded g7dt-p-2 g7dt-overflow-auto g7dt-border",style:{flex:1,minHeight:0},children:[e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-green g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>n("_global"),children:[e.jsx("span",{children:s.has("_global")?"▼":"▶"}),e.jsx("span",{children:"_global"}),e.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",m,"개 키)"]})]}),s.has("_global")&&e.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(d._global||{}).map(([w,S])=>e.jsx(W,{keyName:w,value:S,path:`_global.${w}`,expandedPaths:s,onToggle:n,searchTerm:g},`_global.${w}`))})]}),e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-blue g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>n("_local"),children:[e.jsx("span",{children:s.has("_local")?"▼":"▶"}),e.jsx("span",{children:"_local"}),e.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",k,"개 키)"]})]}),s.has("_local")&&e.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(d._local||{}).map(([w,S])=>e.jsx(W,{keyName:w,value:S,path:`_local.${w}`,expandedPaths:s,onToggle:n,searchTerm:g},`_local.${w}`))})]}),e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-purple g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>n("_computed"),children:[e.jsx("span",{children:s.has("_computed")?"▼":"▶"}),e.jsx("span",{children:"_computed"}),e.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",b,"개 키)"]})]}),s.has("_computed")&&e.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(d._computed||{}).map(([w,S])=>e.jsx(W,{keyName:w,value:S,path:`_computed.${w}`,expandedPaths:s,onToggle:n,searchTerm:g},`_computed.${w}`))})]}),N>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-orange g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>n("_isolated"),children:[e.jsx("span",{children:s.has("_isolated")?"▼":"▶"}),e.jsx("span",{children:"_isolated"}),e.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",N,"개 스코프)"]})]}),s.has("_isolated")&&e.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(d._isolated||{}).map(([w,S])=>e.jsx(W,{keyName:w,value:S,path:`_isolated.${w}`,expandedPaths:s,onToggle:n,searchTerm:g},`_isolated.${w}`))})]}),C>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-sm g7dt-font-bold g7dt-text-cyan g7dt-mb-1 g7dt-cursor-pointer",onClick:()=>n("$parent"),children:[e.jsx("span",{children:s.has("$parent")?"▼":"▶"}),e.jsx("span",{children:"$parent"}),e.jsxs("span",{className:"g7dt-text-gray g7dt-text-xs",style:{fontWeight:"normal"},children:["(",C,"개 키)"]})]}),s.has("$parent")&&e.jsx("div",{className:"g7dt-ml-2 g7dt-border-l",children:Object.entries(d.$parent||{}).map(([w,S])=>e.jsx(W,{keyName:w,value:S,path:`$parent.${w}`,expandedPaths:s,onToggle:n,searchTerm:g},`$parent.${w}`))})]})]}),t&&e.jsx("div",{className:"g7dt-flex g7dt-justify-end g7dt-mt-2",children:e.jsx("button",{onClick:()=>l(!v),className:`g7dt-tab-button ${v?"g7dt-tab-active":""}`,children:"🧮 Computed 추적"})}),v&&f&&e.jsxs("div",{className:"g7dt-card g7dt-mt-2",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["Computed 의존성 추적 (",f.properties.length,"개)"]}),e.jsxs("div",{className:"g7dt-stats-grid g7dt-mb-3",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-purple",children:f.stats.totalComputed}),e.jsx("div",{className:"g7dt-stat-label",children:"Computed"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:f.stats.totalRecalculations}),e.jsx("div",{className:"g7dt-stat-label",children:"재계산"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-yellow",children:f.stats.unnecessaryRecalculations}),e.jsx("div",{className:"g7dt-stat-label",children:"불필요"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsxs("div",{className:"g7dt-stat-value g7dt-text-green",children:[f.stats.avgComputationTime.toFixed(1),"ms"]}),e.jsx("div",{className:"g7dt-stat-label",children:"평균시간"})]})]}),f.stats.cycleDetectionCount>0&&e.jsxs("div",{className:"g7dt-text-xs g7dt-text-red g7dt-mb-3 g7dt-p-2 g7dt-bg-red-900 g7dt-rounded",children:["⚠️ 순환 의존성 감지: ",f.stats.cycleDetectionCount,"건"]}),f.stats.topRecalculated.length>0&&e.jsxs("div",{className:"g7dt-mb-3",children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"자주 재계산되는 속성"}),e.jsx("div",{className:"g7dt-space-y-1",children:f.stats.topRecalculated.slice(0,3).map((w,S)=>e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[e.jsx("span",{className:"g7dt-text-purple g7dt-font-mono",children:w.name}),e.jsxs("span",{className:"g7dt-text-muted",children:[w.count,"회"]})]},S))})]}),f.recalcLogs.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"재계산 로그가 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-40 g7dt-overflow-y-auto",children:f.recalcLogs.slice().reverse().slice(0,20).map(w=>e.jsxs("div",{className:`g7dt-list-item ${w.valueChanged?"":"g7dt-border-yellow"}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:y(w.trigger)}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-purple g7dt-font-mono",children:w.computedName}),!w.valueChanged&&e.jsx("span",{className:"g7dt-badge g7dt-text-xs g7dt-text-yellow",children:"값 변경 없음"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[w.computationTime.toFixed(1),"ms"]})]}),w.triggeredBy&&e.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["트리거: ",e.jsx("span",{className:"g7dt-text-blue",children:w.triggeredBy.path})]})]},w.id))})]})]})},Ce=({actions:d,devTools:t})=>{const[s,a]=x.useState(""),[g,r]=x.useState("actions"),[o,p]=x.useState(null),[v,l]=x.useState(null),f=x.useCallback(()=>{t&&p(t.getSequenceTrackingInfo())},[t]);x.useEffect(()=>{if(g==="sequences"&&t){f();const i=setInterval(f,2e3);return()=>clearInterval(i)}},[g,t,f]);const c=s?d.filter(i=>i.type.toLowerCase().includes(s.toLowerCase())||i.status===s):d,h=i=>{switch(i){case"success":return"g7dt-status-success";case"error":return"g7dt-status-error";case"started":return"g7dt-status-started";default:return"g7dt-status-default"}},y=i=>{switch(i){case"success":return"g7dt-badge-success";case"error":return"g7dt-badge-error";default:return"g7dt-badge-warning"}},n=v&&o?o.executions.find(i=>i.id===v):null;return e.jsxs("div",{className:"g7dt-space-y-4",children:[t&&e.jsx("div",{className:"g7dt-card",children:e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsxs("button",{className:`g7dt-tab-button ${g==="actions"?"g7dt-tab-active":""}`,onClick:()=>r("actions"),children:["📋 액션 (",d.length,")"]}),e.jsxs("button",{className:`g7dt-tab-button ${g==="sequences"?"g7dt-tab-active":""}`,onClick:()=>r("sequences"),children:["🔗 Sequence (",o?.executions.length||0,")"]})]})}),g==="actions"&&e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-flex-shrink-0",children:[e.jsx("input",{type:"text",placeholder:"액션 타입 또는 상태로 필터...",value:s,onChange:i=>a(i.target.value),className:"g7dt-input g7dt-flex-1"}),e.jsx("button",{onClick:()=>a(""),className:"g7dt-btn-text",children:"초기화"})]}),g==="sequences"&&o&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Sequence 통계"}),e.jsxs("div",{className:"g7dt-stats-grid-3",children:[e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-blue",children:o.stats.totalSequences}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 실행"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-green",children:o.stats.successCount}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"성공"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:o.stats.errorCount}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"실패"})]})]})]}),e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Sequence 실행 목록"}),o.executions.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"실행된 Sequence가 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-40 g7dt-overflow-y-auto",children:o.executions.slice().reverse().map(i=>e.jsx("div",{className:`g7dt-list-item g7dt-cursor-pointer ${v===i.id?"g7dt-selected":""} ${i.status==="error"?"g7dt-border-red":""}`,onClick:()=>l(v===i.id?null:i.id),children:e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:i.status==="completed"?"✅":i.status==="error"?"❌":"⏳"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-white",children:[i.actions.length,"개 액션"]}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[i.totalDuration.toFixed(0),"ms"]})]})},i.id))})]}),n&&e.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["🔗 Sequence 상세 (",n.actions.length,"개 액션)"]}),e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:n.actions.map((i,u)=>e.jsxs("div",{className:`g7dt-list-item ${i.status==="error"?"g7dt-border-red":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted",children:["#",i.index+1]}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-font-mono",children:i.handler}),e.jsx("span",{className:`g7dt-text-xs ${i.status==="success"?"g7dt-text-green":"g7dt-text-red"}`,children:i.status==="success"?"✓":"✕"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[i.duration.toFixed(0),"ms"]})]}),i.stateChanges&&i.stateChanges.length>0&&e.jsxs("div",{className:"g7dt-mt-1",children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 변경:"}),i.stateChanges.slice(0,3).map((m,k)=>e.jsx("div",{className:"g7dt-text-xs g7dt-text-yellow g7dt-ml-2",children:m.path},k)),i.stateChanges.length>3&&e.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-2",children:["...외 ",i.stateChanges.length-3,"개"]})]})]},u))})]})]}),g==="actions"&&e.jsx("div",{className:"g7dt-section",children:e.jsx("div",{className:"g7dt-scroll-list g7dt-space-y-2-flat g7dt-action-list",children:c.length===0?e.jsx("div",{className:"g7dt-empty-message",children:"액션 이력이 없습니다"}):c.slice(-30).reverse().map((i,u)=>e.jsxs("div",{className:`g7dt-action-item ${h(i.status)}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-start",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-font-mono g7dt-font-bold",children:i.type}),e.jsx("span",{className:`g7dt-status-badge ${y(i.status)}`,children:i.status})]}),e.jsx("span",{className:"g7dt-text-gray",children:i.duration?`${i.duration.toFixed(2)}ms`:"-"})]}),i.error&&e.jsx("div",{className:"g7dt-error-box",children:i.error.message}),i.params&&Object.keys(i.params).length>0&&e.jsxs("details",{className:"g7dt-details",children:[e.jsx("summary",{className:"g7dt-summary",children:"파라미터"}),e.jsx("pre",{className:"g7dt-pre",children:JSON.stringify(i.params,null,2)})]})]},`${i.id}-${u}`))})})]})},Se=({stats:d,devTools:t})=>{const[s,a]=x.useState(null),[g,r]=x.useState(!1),o=x.useCallback(()=>{a(t.getCacheDecisionTrackingInfo())},[t]);x.useEffect(()=>{if(g){o();const l=setInterval(o,2e3);return()=>clearInterval(l)}},[g,o]);const p=()=>{t.resetCacheStats(),console.log("[G7DevTools] 캐시 통계 초기화")},v=l=>{switch(l){case"use_cache":return"✅";case"skip_cache":return"⏭️";case"invalidate":return"🗑️";default:return"❓"}};return e.jsxs("div",{className:"g7dt-space-y-6",children:[e.jsxs("div",{className:"g7dt-stats-grid",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-green",children:d.hits}),e.jsx("div",{className:"g7dt-stat-label",children:"Cache Hits"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-red",children:d.misses}),e.jsx("div",{className:"g7dt-stat-label",children:"Cache Misses"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:d.entries}),e.jsx("div",{className:"g7dt-stat-label",children:"Entries"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsxs("div",{className:"g7dt-stat-value g7dt-text-purple",children:[(d.hitRate*100).toFixed(1),"%"]}),e.jsx("div",{className:"g7dt-stat-label",children:"Hit Rate"})]})]}),e.jsxs("div",{className:"g7dt-space-y-2",children:[e.jsx("div",{className:"g7dt-text-sm g7dt-text-gray",children:"캐시 히트율"}),e.jsx("div",{className:"g7dt-progress-bar",children:e.jsx("div",{className:"g7dt-progress-fill",style:{width:`${d.hitRate*100}%`}})})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsx("button",{onClick:p,className:"g7dt-btn-danger",children:"캐시 통계 초기화"}),e.jsx("button",{onClick:()=>r(!g),className:`g7dt-tab-button ${g?"g7dt-tab-active":""}`,children:"📋 Decision Log"})]}),g&&s&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["캐시 결정 로그 (",s.decisions.length,"개)"]}),s.decisions.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"캐시 결정 기록이 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:s.decisions.slice().reverse().slice(0,50).map(l=>e.jsxs("div",{className:`g7dt-list-item ${l.decision==="skip_cache"?"g7dt-border-yellow":l.decision==="invalidate"?"g7dt-border-red":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:v(l.decision)}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-font-mono g7dt-truncate",style:{maxWidth:"200px"},children:l.expression}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:l.decision})]}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:l.reason}),l.context&&e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-mt-1",children:[l.context.isInIteration&&e.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"🔄 iteration"}),l.context.isInAction&&e.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"⚡ action"})]})]},l.id))})]})]})},Ie=()=>{const[d,t]=x.useState([]),[s,a]=x.useState([]),[g,r]=x.useState(""),o=["이전 값이 전송됨","모든 행이 같은 값","상태가 업데이트 안됨","API 호출이 안됨","초기값이 없음","무한 로딩","Form 값이 저장 안됨","iteration 데이터 중복"],p=f=>{t(c=>c.includes(f)?c.filter(h=>h!==f):[...c,f])},v=()=>{g&&!d.includes(g)&&(t(f=>[...f,g]),r(""))},l=async()=>{const{DiagnosticEngine:f}=await Promise.resolve().then(()=>pe),h=new f().analyze(d);a(h)};return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"증상 선택"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:o.map(f=>e.jsx("button",{onClick:()=>p(f),className:d.includes(f)?"g7dt-symptom-btn g7dt-symptom-active":"g7dt-symptom-btn",children:f},f))})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsx("input",{type:"text",placeholder:"직접 증상 입력...",value:g,onChange:f=>r(f.target.value),onKeyDown:f=>f.key==="Enter"&&v(),className:"g7dt-input g7dt-flex-1"}),e.jsx("button",{onClick:v,className:"g7dt-btn-secondary",children:"추가"})]}),e.jsxs("button",{onClick:l,disabled:d.length===0,className:d.length===0?"g7dt-btn-primary g7dt-btn-disabled g7dt-w-full":"g7dt-btn-primary g7dt-w-full",children:["진단 실행 (",d.length,"개 증상)"]}),s.length>0&&e.jsxs("div",{className:"g7dt-space-y-3",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"진단 결과"}),s.slice(0,5).map((f,c)=>e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("span",{className:"g7dt-font-bold g7dt-text-yellow",children:f.rule.name}),e.jsxs("span",{className:"g7dt-confidence-badge",children:[(f.confidence*100).toFixed(0),"%"]})]}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-lightgray",children:f.rule.solution}),f.rule.codeExample&&e.jsx("pre",{className:"g7dt-pre g7dt-mt-2",children:f.rule.codeExample})]},c))]})]})},Te=({devTools:d})=>{const t=d.getPerformanceInfo();return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-stats-grid-2",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:t.bindingEvalCount}),e.jsx("div",{className:"g7dt-stat-label",children:"바인딩 평가 횟수"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-purple",children:t.renderCounts.size}),e.jsx("div",{className:"g7dt-stat-label",children:"렌더링된 컴포넌트"})]})]}),t.memoryWarnings.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-red g7dt-mb-2",children:"메모리 경고"}),e.jsx("div",{className:"g7dt-space-y-2",children:t.memoryWarnings.map((s,a)=>e.jsxs("div",{className:"g7dt-warning-card",children:[e.jsx("div",{className:"g7dt-font-bold",children:s.type}),e.jsx("div",{className:"g7dt-text-lightgray",children:s.message}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-gray g7dt-mt-1",children:s.suggestion})]},a))})]}),t.renderCounts.size>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"컴포넌트별 렌더링"}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list",children:Array.from(t.renderCounts.entries()).sort((s,a)=>a[1]-s[1]).slice(0,10).map(([s,a])=>e.jsxs("div",{className:"g7dt-list-item",children:[e.jsx("span",{className:"g7dt-text-lightgray g7dt-truncate",children:s}),e.jsxs("span",{className:a>50?"g7dt-text-red":"g7dt-text-gray",children:[a,"회"]})]},s))})]})]})},De=({devTools:d})=>{const t=d.getLifecycleInfo();return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-section",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-green g7dt-mb-2 g7dt-flex-shrink-0",children:["마운트된 컴포넌트 (",t.mountedComponents.length,")"]}),e.jsx("div",{className:"g7dt-scroll-list",children:t.mountedComponents.length===0?e.jsx("div",{className:"g7dt-empty-message",children:"추적된 컴포넌트 없음"}):t.mountedComponents.map(s=>e.jsxs("div",{className:"g7dt-list-item g7dt-text-xs",children:[e.jsx("span",{className:"g7dt-text-lightgray",children:s.name}),e.jsx("span",{className:"g7dt-text-gray",children:s.id})]},s.id))})]}),t.orphanedListeners.length>0&&e.jsxs("div",{className:"g7dt-section",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-red g7dt-mb-2 g7dt-flex-shrink-0",children:["정리되지 않은 리스너 (",t.orphanedListeners.length,")"]}),e.jsx("div",{className:"g7dt-scroll-list",children:t.orphanedListeners.map((s,a)=>e.jsxs("div",{className:"g7dt-warning-card g7dt-text-xs",children:[e.jsx("span",{className:"g7dt-text-lightgray",children:s.type}),e.jsxs("span",{className:"g7dt-text-gray g7dt-ml-2",children:["on ",s.target]})]},a))})]})]})},Le=({devTools:d})=>{const t=d.getNetworkInfo(),s=o=>{switch(o){case"success":return"g7dt-text-green";case"error":return"g7dt-text-red";case"pending":return"g7dt-text-yellow";default:return"g7dt-text-gray"}},a=o=>o.queryParams&&Object.keys(o.queryParams).length>0,g=o=>Object.entries(o).map(([p,v])=>e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-text-xs",children:[e.jsxs("span",{className:"g7dt-text-purple",children:[p,":"]}),e.jsx("span",{className:"g7dt-text-lightgray",children:Array.isArray(v)?JSON.stringify(v):v})]},p)),r=(o,p=5e3)=>{try{const v=JSON.stringify(o,null,2);return v.length>p?v.substring(0,p)+` ... (truncated)`:v}catch{return"(직렬화 불가)"}};return e.jsxs("div",{className:"g7dt-space-y-4",children:[t.activeRequests.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:["진행 중 (",t.activeRequests.length,")"]}),e.jsx("div",{className:"g7dt-space-y-1",children:t.activeRequests.map(o=>e.jsxs("details",{className:"g7dt-details",children:[e.jsxs("summary",{className:"g7dt-summary g7dt-pending-request",children:[e.jsx("span",{className:"g7dt-font-bold",children:o.method}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-lightgray g7dt-truncate",children:o.fullUrl||o.url})]}),e.jsxs("div",{className:"g7dt-card g7dt-mt-1 g7dt-text-xs",children:[a(o)&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("div",{className:"g7dt-text-blue g7dt-font-bold g7dt-mb-1",children:"쿼리 파라미터"}),e.jsx("div",{className:"g7dt-pl-2 g7dt-border-l-2 g7dt-border-blue",children:g(o.queryParams)})]}),o.requestBody&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-orange g7dt-font-bold g7dt-mb-1",children:"요청 본문"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs",children:r(o.requestBody,2e3)})]})]})]},o.id))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"요청 이력"}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list-lg",children:t.requestHistory.length===0?e.jsx("div",{className:"g7dt-empty-message",children:"요청 이력 없음"}):t.requestHistory.slice(-20).reverse().map(o=>e.jsxs("details",{className:"g7dt-details",children:[e.jsxs("summary",{className:"g7dt-summary g7dt-card g7dt-text-xs",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-w-full",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-font-bold",children:o.method}),e.jsx("span",{className:`g7dt-ml-2 ${s(o.status)}`,children:o.statusCode||o.status})]}),e.jsxs("span",{className:"g7dt-text-gray",children:[o.duration,"ms"]})]}),e.jsx("div",{className:"g7dt-text-gray g7dt-truncate g7dt-mt-1",children:o.fullUrl||o.url})]}),e.jsxs("div",{className:"g7dt-card g7dt-mt-1 g7dt-text-xs g7dt-ml-2 g7dt-border-l-2 g7dt-border-gray",children:[e.jsx("div",{className:"g7dt-mb-2",children:e.jsxs("div",{className:"g7dt-text-xs g7dt-space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"URL:"})," ",e.jsx("span",{className:"g7dt-text-lightgray",children:o.fullUrl||o.url})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"상태:"})," ",e.jsx("span",{className:s(o.status),children:o.statusCode||o.status})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"소요시간:"})," ",e.jsxs("span",{className:"g7dt-text-lightgray",children:[o.duration,"ms"]})]}),o.dataSourceId&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"데이터소스:"})," ",e.jsx("span",{className:"g7dt-text-blue",children:o.dataSourceId})]}),o.error&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"에러:"})," ",e.jsx("span",{className:"g7dt-text-red",children:o.error})]})]})}),a(o)&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("div",{className:"g7dt-text-blue g7dt-font-bold g7dt-mb-1",children:"쿼리 파라미터"}),e.jsx("div",{className:"g7dt-pl-2 g7dt-border-l-2 g7dt-border-blue",children:g(o.queryParams)})]}),o.requestBody&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("div",{className:"g7dt-text-orange g7dt-font-bold g7dt-mb-1",children:"요청 본문"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-max-h-40 g7dt-overflow-auto",children:r(o.requestBody,2e3)})]}),o.response!==void 0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-green g7dt-font-bold g7dt-mb-1",children:"응답 내용"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-max-h-60 g7dt-overflow-auto",children:r(o.response,5e3)})]})]})]},o.id))})]}),t.pendingDataSources.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-blue g7dt-mb-2",children:["대기 중인 데이터소스 (",t.pendingDataSources.length,")"]}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:t.pendingDataSources.map(o=>e.jsx("span",{className:"g7dt-tag-blue",children:o},o))})]})]})},Ee=({devTools:d})=>{const t=d.getFormInfo(),[s,a]=x.useState(!1),[g,r]=x.useState(null),o=x.useCallback(()=>{r(d.getFormBindingValidationTrackingInfo())},[d]);x.useEffect(()=>{if(s){o();const l=setInterval(o,2e3);return()=>clearInterval(l)}},[s,o]);const p=l=>{switch(l){case"missing-datakey":return"🔑";case"missing-input-name":return"📝";case"context-not-propagated":return"🔗";case"sortable-context-break":return"📊";case"modal-context-isolation":return"🪟";case"duplicate-input-name":return"👯";case"value-type-mismatch":return"⚠️";case"binding-path-invalid":return"❌";default:return"❓"}},v=l=>{switch(l){case"error":return"g7dt-text-red";case"warning":return"g7dt-text-yellow";case"info":return"g7dt-text-blue";default:return"g7dt-text-gray"}};return e.jsxs("div",{className:"g7dt-space-y-4",children:[t.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-py-8",children:"추적된 Form이 없습니다"}):t.map(l=>e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("span",{className:"g7dt-font-bold g7dt-text-blue",children:l.dataKey||"(no dataKey)"}),!l.dataKey&&e.jsx("span",{className:"g7dt-text-red g7dt-text-xs",children:"dataKey 필요"})]}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-mb-2",children:l.inputs.map((f,c)=>e.jsxs("div",{className:"g7dt-text-xs g7dt-flex g7dt-justify-between",children:[e.jsx("span",{children:f.name||e.jsx("span",{className:"g7dt-text-red",children:"name 없음"})}),e.jsx("span",{className:"g7dt-text-gray",children:f.type})]},c))}),e.jsxs("details",{className:"g7dt-details",children:[e.jsx("summary",{className:"g7dt-summary",children:"현재 값 보기"}),e.jsx("pre",{className:"g7dt-pre",children:JSON.stringify(l,null,2)})]})]},l.id)),e.jsx("div",{className:"g7dt-flex g7dt-justify-end",children:e.jsx("button",{onClick:()=>a(!s),className:`g7dt-tab-button ${s?"g7dt-tab-active":""}`,children:"🔍 Auto-Binding Check"})}),s&&g&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Form 바인딩 검증 결과"}),e.jsxs("div",{className:"g7dt-stats-grid g7dt-mb-3",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:g.stats.totalFormsValidated}),e.jsx("div",{className:"g7dt-stat-label",children:"검증된 Form"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-green",children:g.stats.validForms}),e.jsx("div",{className:"g7dt-stat-label",children:"유효"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-red",children:g.stats.formsWithIssues}),e.jsx("div",{className:"g7dt-stat-label",children:"문제 있음"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-yellow",children:g.stats.totalIssues}),e.jsx("div",{className:"g7dt-stat-label",children:"총 이슈"})]})]}),g.stats.topIssues.length>0&&e.jsxs("div",{className:"g7dt-mb-3",children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"자주 발생하는 이슈"}),e.jsx("div",{className:"g7dt-space-y-1",children:g.stats.topIssues.slice(0,3).map((l,f)=>e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[e.jsx("span",{children:p(l.type)}),e.jsx("span",{className:"g7dt-text-white",children:l.description}),e.jsxs("span",{className:"g7dt-text-muted",children:["(",l.count,")"]})]},f))})]}),g.issues.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"바인딩 이슈가 없습니다 ✅"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:g.issues.slice().reverse().slice(0,30).map(l=>e.jsxs("div",{className:`g7dt-list-item ${l.severity==="error"?"g7dt-border-red":l.severity==="warning"?"g7dt-border-yellow":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:p(l.type)}),e.jsx("span",{className:`g7dt-text-xs g7dt-font-bold ${v(l.severity)}`,children:l.type}),l.formDataKey&&e.jsx("span",{className:"g7dt-text-xs g7dt-text-blue g7dt-font-mono",children:l.formDataKey})]}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-white g7dt-mt-1",children:l.description}),e.jsxs("div",{className:"g7dt-text-xs g7dt-text-green g7dt-mt-1",children:["💡 ",l.suggestion]}),l.contextInfo&&e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-mt-1",children:[l.contextInfo.isInsideModal&&e.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"🪟 modal"}),l.contextInfo.isInsideSortable&&e.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:"📊 sortable"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted",children:["depth: ",l.contextInfo.depth]})]})]},l.id))})]})]})},$e=({devTools:d})=>{const t=d.getConditionalInfo();return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-purple g7dt-mb-2",children:["if 조건 (",t.ifConditions.length,")"]}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list",children:t.ifConditions.length===0?e.jsx("div",{className:"g7dt-empty-message",children:"추적된 if 조건 없음"}):t.ifConditions.map(s=>e.jsx("div",{className:`g7dt-condition-item ${s.evaluatedValue?"g7dt-condition-true":"g7dt-condition-false"}`,children:e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsx("span",{className:"g7dt-font-mono g7dt-text-lightgray g7dt-truncate-60",children:s.expression}),e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:s.evaluatedValue?"g7dt-badge-success":"g7dt-badge-error",children:s.evaluatedValue?"true":"false"}),e.jsxs("span",{className:"g7dt-text-gray",children:[s.evaluationCount,"회"]})]})]})},s.id))})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-cyan g7dt-mb-2",children:["iteration (",t.iterations.length,")"]}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-scroll-list",children:t.iterations.length===0?e.jsx("div",{className:"g7dt-empty-message",children:"추적된 iteration 없음"}):t.iterations.map(s=>e.jsxs("div",{className:"g7dt-card g7dt-text-xs",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-1",children:[e.jsx("span",{className:"g7dt-font-mono g7dt-text-lightgray g7dt-truncate-60",children:s.source}),e.jsxs("span",{className:s.sourceLength>0?"g7dt-badge-blue":"g7dt-badge-warning",children:[s.sourceLength,"개 항목"]})]}),e.jsxs("div",{className:"g7dt-text-gray",children:[e.jsxs("span",{className:"g7dt-mr-2",children:["item_var: ",s.itemVar]}),s.indexVar&&e.jsxs("span",{children:["index_var: ",s.indexVar]})]})]},s.id))})]}),(t.ifConditions.some(s=>s.evaluatedValue===!1&&s.evaluationCount>5)||t.iterations.some(s=>s.sourceLength===0))&&e.jsxs("div",{className:"g7dt-warning-box",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:"잠재적 문제"}),e.jsxs("div",{className:"g7dt-space-y-1 g7dt-text-xs",children:[t.ifConditions.filter(s=>s.evaluatedValue===!1&&s.evaluationCount>5).map(s=>e.jsxs("div",{className:"g7dt-text-lightgray",children:["⚠️ if 조건 항상 false: ",s.expression]},s.id)),t.iterations.filter(s=>s.sourceLength===0).map(s=>e.jsxs("div",{className:"g7dt-text-lightgray",children:["⚠️ iteration 소스 비어있음: ",s.source]},s.id))]})]})]})},ze=({devTools:d})=>{const[t,s]=x.useState([]),[a,g]=x.useState({totalEvaluations:0,uniqueExpressions:0,warningCount:0,cacheHitRate:0,averageDuration:0,byType:{},byWarning:{}}),[r,o]=x.useState(""),[p,v]=x.useState(!1),[l,f]=x.useState(null),c=x.useCallback(()=>{const m=d.getExpressionInfo();s(m.expressions),g(m.stats)},[d]);x.useEffect(()=>{c();const m=d.watchExpressions(()=>{c()}),k=setInterval(c,2e3);return()=>{m(),clearInterval(k)}},[d,c]);const h=t.filter(m=>{if(p&&!m.warning)return!1;if(r){const k=r.toLowerCase();return m.expression.toLowerCase().includes(k)||m.componentName?.toLowerCase().includes(k)||m.propName?.toLowerCase().includes(k)||m.resultType.toLowerCase().includes(k)}return!0}),y=m=>{switch(m){case"string":return"g7dt-text-green";case"number":return"g7dt-text-blue";case"boolean":return"g7dt-text-purple";case"array":return"g7dt-text-cyan";case"object":return"g7dt-text-yellow";case"undefined":case"null":return"g7dt-text-red";default:return"g7dt-text-gray"}},n=m=>{switch(m){case"undefined-result":return"undefined 결과";case"null-result":return"null 결과";case"array-to-string":return"배열→문자열";case"object-to-string":return"객체→문자열";case"missing-optional-chain":return"?. 누락 의심";case"wrong-iteration-var":return"잘못된 반복 변수";case"type-mismatch":return"타입 불일치";case"cache-stale":return"캐시 오래됨";case"slow-evaluation":return"느린 평가";default:return m}},i=(m,k)=>k==="undefined"?"undefined":k==="null"?"null":k==="string"?`"${String(m).substring(0,50)}${String(m).length>50?"...":""}"`:k==="array"?`Array(${Array.isArray(m)?m.length:"?"})`:k==="object"?"Object{...}":String(m),u=()=>{d.clearExpressions(),s([]),f(null)};return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-stats-grid-5",children:[e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-blue",children:a.totalEvaluations}),e.jsx("div",{className:"g7dt-stat-label-xs",children:"총 평가"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-green",children:a.uniqueExpressions}),e.jsx("div",{className:"g7dt-stat-label-xs",children:"고유 표현식"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-yellow",children:a.warningCount}),e.jsx("div",{className:"g7dt-stat-label-xs",children:"경고"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsxs("div",{className:"g7dt-stat-value-lg g7dt-text-purple",children:[(a.cacheHitRate*100).toFixed(0),"%"]}),e.jsx("div",{className:"g7dt-stat-label-xs",children:"캐시 히트"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsxs("div",{className:"g7dt-stat-value-lg g7dt-text-cyan",children:[a.averageDuration.toFixed(1),"ms"]}),e.jsx("div",{className:"g7dt-stat-label-xs",children:"평균 시간"})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-items-center",children:[e.jsx("input",{type:"text",placeholder:"표현식, 컴포넌트, prop 검색...",value:r,onChange:m=>o(m.target.value),className:"g7dt-input g7dt-flex-1"}),e.jsxs("label",{className:"g7dt-checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:m=>v(m.target.checked),className:"g7dt-checkbox"}),"경고만"]}),e.jsx("button",{onClick:u,className:"g7dt-btn-danger-sm",children:"초기화"})]}),Object.keys(a.byType).length>0&&e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:Object.entries(a.byType).map(([m,k])=>e.jsxs("span",{className:`g7dt-type-tag ${y(m)}`,children:[m,": ",k]},m))}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-expr-list",children:h.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:r||p?"조건에 맞는 표현식이 없습니다":"추적된 표현식이 없습니다"}):h.slice(-50).reverse().map(m=>e.jsx("div",{onClick:()=>f(m),className:`g7dt-expr-item ${l?.id===m.id?"g7dt-expr-selected":m.warning?"g7dt-expr-warning":""}`,children:e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-start g7dt-gap-2",children:[e.jsxs("div",{className:"g7dt-flex-1 g7dt-min-w-0",children:[e.jsx("div",{className:"g7dt-font-mono g7dt-text-white g7dt-truncate",title:m.expression,children:m.expression}),e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-mt-1 g7dt-text-xxs",children:[m.componentName&&e.jsxs("span",{className:"g7dt-text-gray",children:[m.componentName,m.propName&&`.${m.propName}`]}),e.jsx("span",{className:y(m.resultType),children:i(m.result,m.resultType)})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-flex-col g7dt-items-end g7dt-gap-1",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-1",children:[m.fromCache&&e.jsx("span",{className:"g7dt-mini-badge g7dt-badge-success",children:"캐시"}),m.warning&&e.jsx("span",{className:"g7dt-mini-badge g7dt-badge-warning",children:n(m.warning.type)})]}),m.duration!==void 0&&e.jsxs("span",{className:"g7dt-text-xxs g7dt-text-gray",children:[m.duration.toFixed(2),"ms"]})]})]})},m.id))}),l&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"표현식 상세"}),e.jsx("button",{onClick:()=>f(null),className:"g7dt-btn-close",children:"✕"})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"표현식:"}),e.jsx("code",{className:"g7dt-code g7dt-text-green",children:l.expression})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"결과:"}),e.jsx("span",{className:`g7dt-ml-2 ${y(l.resultType)}`,children:JSON.stringify(l.result,null,2)?.substring(0,200)}),e.jsxs("span",{className:"g7dt-ml-2 g7dt-text-darkgray",children:["(",l.resultType,")"]})]}),l.componentName&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"컴포넌트:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-blue",children:l.componentName}),l.propName&&e.jsxs("span",{className:"g7dt-text-gray",children:[".",l.propName]})]}),l.method&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"메서드:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-purple",children:l.method})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"캐시:"}),e.jsxs("span",{className:`g7dt-ml-2 ${l.fromCache?"g7dt-text-green":"g7dt-text-gray"}`,children:[l.fromCache?"캐시에서 로드":"새로 평가",l.skipCache&&" (skipCache)"]})]}),l.duration!==void 0&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"소요 시간:"}),e.jsxs("span",{className:`g7dt-ml-2 ${l.duration>10?"g7dt-text-red":"g7dt-text-lightgray"}`,children:[l.duration.toFixed(3),"ms"]})]}),l.warning&&e.jsxs("div",{className:"g7dt-warning-box-light",children:[e.jsxs("div",{className:"g7dt-text-yellow g7dt-font-bold",children:["⚠️ ",n(l.warning.type)]}),e.jsx("div",{className:"g7dt-text-lightgray g7dt-mt-1",children:l.warning.message}),l.warning.suggestion&&e.jsxs("div",{className:"g7dt-text-gray g7dt-mt-1 g7dt-text-xxs",children:["💡 ",l.warning.suggestion]})]}),l.steps&&l.steps.length>0&&e.jsxs("details",{className:"g7dt-details",children:[e.jsxs("summary",{className:"g7dt-summary",children:["평가 단계 (",l.steps.length,")"]}),e.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1 g7dt-pl-2 g7dt-border-l",children:l.steps.map((m,k)=>e.jsxs("div",{className:"g7dt-text-xxs",children:[e.jsx("span",{className:"g7dt-text-purple",children:m.step}),m.path&&e.jsx("span",{className:"g7dt-text-gray g7dt-ml-1",children:m.path}),m.fromCache&&e.jsx("span",{className:"g7dt-text-green g7dt-ml-1",children:"(cached)"}),m.error&&e.jsx("span",{className:"g7dt-text-red g7dt-ml-1",children:m.error})]},k))})]})]})]}),Object.keys(a.byWarning).length>0&&e.jsxs("div",{className:"g7dt-warning-box-light",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-text-yellow g7dt-mb-2",children:"경고 요약"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:Object.entries(a.byWarning).map(([m,k])=>e.jsxs("span",{className:"g7dt-warning-tag",children:[n(m),": ",k]},m))})]})]})},_e=({devTools:d})=>{const t=d.getHandlers(),[s,a]=x.useState(""),[g,r]=x.useState("all"),o={"built-in":t.filter(l=>l.category==="built-in"),custom:t.filter(l=>l.category==="custom"),module:t.filter(l=>l.category==="module"),plugin:t.filter(l=>l.category==="plugin")},p={all:t.length,"built-in":o["built-in"].length,custom:o.custom.length,module:o.module.length,plugin:o.plugin.length},v=t.filter(l=>g!=="all"&&l.category!==g?!1:s?l.name.toLowerCase().includes(s.toLowerCase())||l.description?.toLowerCase().includes(s.toLowerCase()):!0);return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsx("div",{className:"g7dt-flex g7dt-gap-2",children:["all","built-in","custom","module","plugin"].map(l=>e.jsxs("button",{onClick:()=>r(l),className:g===l?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:[l==="all"?"전체":l," (",p[l],")"]},l))}),e.jsx("input",{type:"text",placeholder:"핸들러 이름 검색...",value:s,onChange:l=>a(l.target.value),className:"g7dt-input g7dt-w-full"}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-handler-list",children:v.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"등록된 핸들러가 없습니다"}):v.map(l=>e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsx("span",{className:"g7dt-font-mono g7dt-text-blue",children:l.name}),e.jsx("span",{className:l.category==="built-in"?"g7dt-mini-badge g7dt-badge-success":l.category==="module"?"g7dt-mini-badge g7dt-badge-purple":l.category==="plugin"?"g7dt-mini-badge g7dt-badge-info":"g7dt-mini-badge g7dt-badge-warning",children:l.category})]}),l.description&&e.jsx("div",{className:"g7dt-text-xs g7dt-text-gray g7dt-mt-1",children:l.description})]},l.name))}),e.jsxs("div",{className:"g7dt-text-xs g7dt-text-gray",children:["총 ",t.length,"개 핸들러 | 빌트인 ",p["built-in"]," | 커스텀 ",p.custom," | 모듈 ",p.module," | 플러그인 ",p.plugin]})]})},je=({devTools:d})=>{const[t,s]=x.useState(d.getComponentEventInfo()),[a,g]=x.useState(null),r=x.useCallback(()=>{s(d.getComponentEventInfo())},[d]);x.useEffect(()=>{r();const p=setInterval(r,2e3);return()=>clearInterval(p)},[r]);const o=a?t.emitHistory.filter(p=>p.eventName===a):t.emitHistory;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-stats-grid-3",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-blue",children:t.subscriptions.length}),e.jsx("div",{className:"g7dt-stat-label",children:"이벤트 타입"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-green",children:t.totalSubscribers}),e.jsx("div",{className:"g7dt-stat-label",children:"총 구독자"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value-lg g7dt-text-purple",children:t.totalEmits}),e.jsx("div",{className:"g7dt-stat-label",children:"총 발행"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"구독된 이벤트"}),e.jsxs("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:[e.jsx("button",{onClick:()=>g(null),className:a===null?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:"전체"}),t.subscriptions.map(p=>e.jsxs("button",{onClick:()=>g(p.eventName),className:a===p.eventName?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:[p.eventName," (",p.subscriberCount,")"]},p.eventName))]})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:["발행 이력 ",a&&`(${a})`]}),e.jsx("div",{className:"g7dt-space-y-1 g7dt-event-list",children:o.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"이벤트 발행 이력이 없습니다"}):o.slice(-30).reverse().map(p=>e.jsxs("div",{className:`g7dt-card g7dt-text-xs ${p.hasError?"g7dt-card-error":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsx("span",{className:"g7dt-font-mono g7dt-text-green",children:p.eventName}),e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsxs("span",{className:"g7dt-text-gray",children:[p.listenerCount," listeners"]}),p.hasError&&e.jsx("span",{className:"g7dt-text-red g7dt-text-xxs",children:"에러"})]})]}),p.data!==void 0&&e.jsxs("details",{className:"g7dt-details g7dt-mt-1",children:[e.jsx("summary",{className:"g7dt-summary",children:"데이터"}),e.jsx("pre",{className:"g7dt-pre",children:JSON.stringify(p.data,null,2)})]}),p.hasError&&p.errorMessage&&e.jsx("div",{className:"g7dt-error-inline",children:p.errorMessage})]},p.id))})]}),e.jsx("button",{onClick:r,className:"g7dt-btn-secondary",children:"새로고침"})]})},Ae=({devTools:d})=>{const t=d.getDataSources(),[s,a]=x.useState("all"),[g,r]=x.useState(null),[o,p]=x.useState(!1),[v,l]=x.useState(null),f=x.useCallback(()=>{l(d.getDataPathTransformTrackingInfo())},[d]);x.useEffect(()=>{if(o){f();const u=setInterval(f,2e3);return()=>clearInterval(u)}},[o,f]);const c=u=>{switch(u){case"api_response":return"📥";case"extract_data":return"📄";case"apply_path":return"🔗";case"init_global":return"🌐";case"init_local":return"📌";default:return"❓"}},h=t.filter(u=>s==="all"?!0:u.status===s),y={all:t.length,idle:t.filter(u=>u.status==="idle").length,loading:t.filter(u=>u.status==="loading").length,loaded:t.filter(u=>u.status==="loaded").length,error:t.filter(u=>u.status==="error").length},n=u=>{switch(u){case"loaded":return"g7dt-badge-success";case"loading":return"g7dt-badge-warning";case"error":return"g7dt-badge-error";default:return"g7dt-badge-gray"}},i=g?t.find(u=>u.id===g):null;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsx("div",{className:"g7dt-flex g7dt-gap-2",children:["all","idle","loading","loaded","error"].map(u=>e.jsxs("button",{onClick:()=>a(u),className:s===u?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:[u==="all"?"전체":u," (",y[u],")"]},u))}),e.jsx("div",{className:"g7dt-ds-grid",children:h.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-col-span-2 g7dt-py-4",children:"데이터소스가 없습니다"}):h.map(u=>e.jsxs("div",{onClick:()=>r(u.id),className:`g7dt-ds-item ${g===u.id?"g7dt-ds-selected":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsx("span",{className:"g7dt-font-mono g7dt-text-blue g7dt-truncate",children:u.id}),e.jsx("span",{className:`g7dt-mini-badge ${n(u.status)}`,children:u.status})]}),e.jsx("div",{className:"g7dt-text-gray g7dt-mt-1 g7dt-truncate",children:u.endpoint||"(endpoint 없음)"}),u.itemCount!==void 0&&e.jsxs("div",{className:"g7dt-text-lightgray g7dt-mt-1",children:[u.itemCount,"개 항목"]})]},u.id))}),i&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:i.id}),e.jsx("button",{onClick:()=>r(null),className:"g7dt-btn-close",children:"✕"})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"엔드포인트:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-green",children:i.endpoint||"-"})]}),i.dataPath&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"데이터 경로:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:i.dataPath})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"상태:"}),e.jsx("span",{className:`g7dt-ml-2 g7dt-mini-badge ${n(i.status)}`,children:i.status})]}),i.itemCount!==void 0&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"항목 수:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-blue",children:i.itemCount})]}),i.keys&&i.keys.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"키:"}),e.jsxs("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:[i.keys.slice(0,10).map(u=>e.jsx("span",{className:"g7dt-key-tag",children:u},u)),i.keys.length>10&&e.jsxs("span",{className:"g7dt-text-gray",children:["+",i.keys.length-10,"개"]})]})]}),i.dependencies&&i.dependencies.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-gray",children:"의존성:"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:i.dependencies.map(u=>e.jsx("span",{className:"g7dt-dep-tag",children:u},u))})]})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("div",{className:"g7dt-text-xs g7dt-text-gray",children:["총 ",t.length,"개 데이터소스 | 로드됨 ",y.loaded," | 로딩중 ",y.loading," | 에러 ",y.error]}),e.jsx("button",{onClick:()=>p(!o),className:`g7dt-tab-button ${o?"g7dt-tab-active":""}`,children:"🔀 Path Transform"})]}),o&&v&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:["데이터 경로 변환 추적 (",v.transforms.length,"개)"]}),e.jsxs("div",{className:"g7dt-stats-grid-3 g7dt-mb-3",children:[e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-xl g7dt-font-bold g7dt-text-blue",children:v.stats.totalTransforms}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 변환"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-xl g7dt-font-bold g7dt-text-purple",children:Object.keys(v.stats.byDataSource).length}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"데이터소스"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-xl g7dt-font-bold g7dt-text-yellow",children:v.stats.warningsCount}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"경고"})]})]}),v.transforms.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"변환 기록이 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:v.transforms.slice().reverse().slice(0,20).map((u,m)=>e.jsxs("div",{className:`g7dt-list-item ${u.warnings.length>0?"g7dt-border-yellow":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:"g7dt-text-xs g7dt-text-blue g7dt-font-mono",children:u.dataSourceId}),u.warnings.length>0&&e.jsxs("span",{className:"g7dt-badge g7dt-text-xs g7dt-text-yellow",children:["⚠️ ",u.warnings.length]})]}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:u.transformSteps.map((k,b)=>e.jsxs("span",{className:"g7dt-badge g7dt-text-xs",title:`${k.inputPath} → ${k.outputPath}`,children:[c(k.step)," ",k.step]},b))}),u.finalBinding&&e.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["최종: ",e.jsx("span",{className:"g7dt-text-green",children:u.finalBinding.expression}),"→ ",e.jsx("span",{className:"g7dt-text-blue",children:u.finalBinding.resolvedPath})]}),u.warnings.length>0&&e.jsx("div",{className:"g7dt-text-xs g7dt-text-yellow g7dt-mt-1",children:u.warnings[0]})]},`${u.dataSourceId}-${m}`))}),v.stats.commonWarnings.length>0&&e.jsxs("div",{className:"g7dt-mt-3",children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-1",children:"자주 발생하는 경고"}),e.jsx("div",{className:"g7dt-space-y-1",children:v.stats.commonWarnings.slice(0,5).map((u,m)=>e.jsxs("div",{className:"g7dt-text-xs g7dt-text-yellow",children:[u.warning," (",u.count,"회)"]},m))})]})]})]})},Oe=({devTools:d})=>{const[t,s]=x.useState(d.getStateRenderingInfo()),[a,g]=x.useState(null),[r,o]=x.useState(!1),[p,v]=x.useState(""),l=x.useCallback(()=>{s(d.getStateRenderingInfo())},[d]);x.useEffect(()=>{l();const n=setInterval(l,2e3);return()=>clearInterval(n)},[l]);const f=t.logs.filter(n=>!(r&&n.renderedComponents.length>0||p&&!n.statePath.toLowerCase().includes(p.toLowerCase()))),c=a?t.logs.find(n=>n.setStateId===a):null,h=t.stats,y=t.logs.filter(n=>n.renderedComponents.length===0).length;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-stats-grid",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:h.totalStateChanges}),e.jsx("div",{className:"g7dt-stat-label",children:"상태 변경"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-green",children:h.totalRenders}),e.jsx("div",{className:"g7dt-stat-label",children:"총 렌더링"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsxs("div",{className:"g7dt-stat-value g7dt-text-purple",children:[h.avgRenderDuration.toFixed(1),"ms"]}),e.jsx("div",{className:"g7dt-stat-label",children:"평균 렌더 시간"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:`g7dt-stat-value ${y>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:y}),e.jsx("div",{className:"g7dt-stat-label",children:"렌더링 없음"})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsx("input",{type:"text",placeholder:"상태 경로 필터 (예: _global.user)",value:p,onChange:n=>v(n.target.value),className:"g7dt-input g7dt-flex-1"}),e.jsx("button",{onClick:()=>o(!r),className:r?"g7dt-filter-btn-active-yellow":"g7dt-filter-btn",children:"렌더링 없음만"})]}),e.jsx("div",{className:"g7dt-scroll-list",children:f.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"상태-렌더링 로그가 없습니다"}):f.slice(-30).reverse().map(n=>{const i=n.renderedComponents.length>0,u=i?"✅":"⚠️",m=new Date(n.timestamp).toLocaleTimeString();return e.jsxs("div",{onClick:()=>g(n.setStateId),className:`g7dt-render-log-item ${a===n.setStateId?"g7dt-selected":i?"":"g7dt-warning"}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("span",{className:"g7dt-mono g7dt-text-blue",children:[u," ",n.statePath]}),e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[i?e.jsxs("span",{className:"g7dt-text-green",children:[n.renderedComponents.length,"개 렌더"]}):e.jsx("span",{className:"g7dt-text-yellow",children:"렌더링 없음"}),e.jsx("span",{className:"g7dt-text-muted",children:m})]})]}),n.triggeredBy?.handlerType&&e.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1",children:["트리거: ",n.triggeredBy.handlerType]})]},n.setStateId)})}),c&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:c.statePath}),e.jsx("button",{onClick:()=>g(null),className:"g7dt-close-btn",children:"✕"})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"setStateId:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-purple g7dt-mono",children:c.setStateId})]}),c.triggeredBy&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"트리거:"}),e.jsxs("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:[c.triggeredBy.handlerType,c.triggeredBy.actionId&&` (${c.triggeredBy.actionId})`]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"이전 값:"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-red",children:JSON.stringify(c.oldValue,null,2)?.slice(0,200)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"새 값:"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-green",children:JSON.stringify(c.newValue,null,2)?.slice(0,200)})]}),c.renderedComponents.length>0?e.jsxs("div",{children:[e.jsxs("span",{className:"g7dt-text-muted",children:["렌더링된 컴포넌트 (",c.renderedComponents.length,"개):"]}),e.jsxs("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:[c.renderedComponents.slice(0,10).map((n,i)=>e.jsxs("div",{className:"g7dt-render-comp-item",children:[e.jsx("span",{className:"g7dt-text-blue",children:n.componentName}),e.jsxs("span",{className:"g7dt-text-muted",children:[n.renderDuration.toFixed(2),"ms"]})]},i)),c.renderedComponents.length>10&&e.jsxs("div",{className:"g7dt-text-muted g7dt-text-center",children:["... 외 ",c.renderedComponents.length-10,"개"]})]}),e.jsxs("div",{className:"g7dt-mt-2 g7dt-text-muted",children:["총 렌더 시간: ",c.totalRenderDuration.toFixed(2),"ms"]})]}):e.jsxs("div",{className:"g7dt-warning-box",children:[e.jsx("span",{className:"g7dt-text-yellow",children:"⚠️ 렌더링이 발생하지 않았습니다"}),e.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-text-xxs",children:["가능한 원인:",e.jsxs("ul",{className:"g7dt-list g7dt-mt-1",children:[e.jsx("li",{children:"해당 상태를 바인딩하는 컴포넌트가 없음"}),e.jsx("li",{children:"컴포넌트가 마운트되지 않은 상태"}),e.jsx("li",{children:"동일한 값으로 상태 설정"})]})]})]})]})]}),h.topRenderedComponents.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"가장 많이 렌더링된 컴포넌트"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:h.topRenderedComponents.slice(0,5).map((n,i)=>e.jsxs("span",{className:"g7dt-tag",children:[n.name,": ",e.jsx("span",{className:"g7dt-text-blue",children:n.count})]},i))})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsx("button",{onClick:l,className:"g7dt-btn-secondary",children:"새로고침"}),e.jsx("button",{onClick:()=>{d.clearStateRenderingLogs(),l()},className:"g7dt-btn-danger",children:"로그 초기화"})]})]})},Me=({devTools:d})=>{const[t,s]=x.useState(null),[a,g]=x.useState(null),[r,o]=x.useState("all"),p=x.useCallback(()=>{s(d.getStyleValidationInfo())},[d]);if(x.useEffect(()=>{p();const c=setInterval(p,2e3);return()=>clearInterval(c)},[p]),!t)return e.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const v=t.issues.filter(c=>r==="all"?!0:c.type===r),l=a?t.issues.find(c=>c.componentId===a):null,f=t.stats;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-stats-grid",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value g7dt-text-blue",children:f.totalComponents}),e.jsx("div",{className:"g7dt-stat-label",children:"총 컴포넌트"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:`g7dt-stat-value ${f.invisibleCount>0?"g7dt-text-red":"g7dt-text-green"}`,children:f.invisibleCount}),e.jsx("div",{className:"g7dt-stat-label",children:"숨겨진 요소"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:`g7dt-stat-value ${f.tailwindIssueCount>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:f.tailwindIssueCount}),e.jsx("div",{className:"g7dt-stat-label",children:"Tailwind 이슈"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:`g7dt-stat-value ${f.darkModeIssueCount>0?"g7dt-text-purple":"g7dt-text-green"}`,children:f.darkModeIssueCount}),e.jsx("div",{className:"g7dt-stat-label",children:"다크모드 이슈"})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsxs("select",{value:r,onChange:c=>o(c.target.value),className:"g7dt-select",children:[e.jsx("option",{value:"all",children:"모든 이슈"}),e.jsx("option",{value:"invisible-element",children:"숨겨진 요소"}),e.jsx("option",{value:"tailwind-purging",children:"Tailwind 퍼징"}),e.jsx("option",{value:"dark-mode-missing",children:"다크모드 누락"})]}),e.jsx("button",{onClick:p,className:"g7dt-btn-secondary",children:"새로고침"})]}),e.jsx("div",{className:"g7dt-scroll-list",children:v.length===0?e.jsx("div",{className:"g7dt-empty-state",children:t.issues.length===0?"스타일 이슈가 없습니다 ✓":"필터에 맞는 이슈가 없습니다"}):v.map(c=>{const h=c.type==="invisible-element"?"👁️":c.type==="tailwind-purging"?"🎨":"🌙",y=c.severity==="error"?"g7dt-severity-error":c.severity==="warning"?"g7dt-severity-warning":"g7dt-severity-info";return e.jsxs("div",{onClick:()=>g(c.componentId),className:`g7dt-style-issue-item ${y} ${a===c.componentId?"g7dt-selected":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("span",{className:"g7dt-mono g7dt-text-blue",children:[h," ",c.componentName]}),e.jsx("span",{className:c.severity==="error"?"g7dt-badge-error":c.severity==="warning"?"g7dt-badge-warning":"g7dt-badge-info",children:c.type})]}),e.jsx("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:c.description})]},c.componentId)})}),l&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:l.componentName}),e.jsx("button",{onClick:()=>g(null),className:"g7dt-close-btn",children:"✕"})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"이슈 타입:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-yellow",children:l.type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"설명:"}),e.jsx("div",{className:"g7dt-mt-1 g7dt-text-white",children:l.description})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"CSS 속성:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-purple",children:l.property}),e.jsxs("span",{className:"g7dt-ml-2 g7dt-text-muted",children:["= ",l.currentValue]}),l.expectedValue&&e.jsxs("span",{className:"g7dt-ml-2 g7dt-text-green",children:["(예상: ",l.expectedValue,")"]})]}),l.suggestion&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"해결 방법:"}),e.jsx("div",{className:"g7dt-mt-1 g7dt-text-green",children:l.suggestion})]})]})]}),t.componentStyles.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:["컴포넌트 스타일 (",t.componentStyles.length,")"]}),e.jsx("div",{className:"g7dt-scroll-list-sm",children:t.componentStyles.slice(0,20).map((c,h)=>e.jsxs("div",{className:"g7dt-list-item",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-blue",children:c.componentName}),e.jsxs("span",{className:"g7dt-text-muted",children:[c.classes.length," classes"]})]}),c.classes.length>0&&e.jsxs("div",{className:"g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:[c.classes.slice(0,5).join(" "),c.classes.length>5&&"..."]})]},h))})]})]})},Pe=({devTools:d})=>{const[t,s]=x.useState(null),[a,g]=x.useState(null),[r,o]=x.useState("all"),p=x.useCallback(()=>{s(d.getAuthDebugInfo())},[d]);if(x.useEffect(()=>{p();const h=setInterval(p,2e3);return()=>clearInterval(h)},[p]),!t)return e.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const v=t.events.filter(h=>r==="all"?!0:h.type===r),l=a?t.events.find(h=>h.id===a):null,f=t.stats,c=t.state;return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-justify-between g7dt-mb-3",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"현재 인증 상태"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted",children:["소스: ",c.source||"unknown"]})]}),e.jsxs("div",{className:"g7dt-stats-grid-3 g7dt-mb-3",children:[e.jsx("div",{className:"g7dt-text-center",children:e.jsx("div",{className:`g7dt-text-lg g7dt-font-bold ${c.isAuthenticated?"g7dt-text-green":"g7dt-text-red"}`,children:c.isAuthenticated?"✓ 인증됨":"✕ 미인증"})}),e.jsx("div",{className:"g7dt-text-center",children:e.jsx("div",{className:`g7dt-text-lg g7dt-font-bold ${c.tokens.hasAccessToken?"g7dt-text-green":"g7dt-text-yellow"}`,children:c.tokens.hasAccessToken?"✓ 토큰 유효":"⚠ 토큰 없음"})}),e.jsx("div",{className:"g7dt-text-center",children:e.jsx("div",{className:"g7dt-text-lg g7dt-font-bold g7dt-text-blue",children:c.user?.name||c.user?.email||"익명"})})]}),c.user&&e.jsxs("div",{className:"g7dt-border-t g7dt-pt-3 g7dt-mt-3",children:[e.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"ID:"}),e.jsx("span",{className:"g7dt-text-white g7dt-mono",children:c.user.id})]}),e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"이메일:"}),e.jsx("span",{className:"g7dt-text-white g7dt-truncate g7dt-ml-2",title:c.user.email,children:c.user.email})]}),c.user.name&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"이름:"}),e.jsx("span",{className:"g7dt-text-white",children:c.user.name})]}),c.user.nickname&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"닉네임:"}),e.jsx("span",{className:"g7dt-text-white",children:c.user.nickname})]}),c.user.phone&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"전화번호:"}),e.jsx("span",{className:"g7dt-text-white",children:c.user.phone})]}),c.user.status&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"상태:"}),e.jsx("span",{className:c.user.status==="active"?"g7dt-text-green":"g7dt-text-yellow",children:c.user.status})]}),c.user.locale&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"언어:"}),e.jsx("span",{className:"g7dt-text-white",children:c.user.locale})]})]}),c.user.roles&&c.user.roles.length>0&&e.jsxs("div",{className:"g7dt-mt-2",children:[e.jsx("span",{className:"g7dt-text-muted g7dt-text-xs",children:"역할: "}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:c.user.roles.map((h,y)=>e.jsx("span",{className:"g7dt-role-tag",title:h.guard_name?`guard: ${h.guard_name}`:void 0,children:typeof h=="string"?h:h.name},y))})]}),c.user.permissions&&c.user.permissions.length>0&&e.jsxs("div",{className:"g7dt-mt-2",children:[e.jsx("span",{className:"g7dt-text-muted g7dt-text-xs",children:"권한: "}),e.jsxs("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1 g7dt-max-h-16 g7dt-overflow-auto",children:[c.user.permissions.slice(0,10).map((h,y)=>e.jsx("span",{className:"g7dt-perm-tag",title:h.guard_name?`guard: ${h.guard_name}`:void 0,children:typeof h=="string"?h:h.name},y)),c.user.permissions.length>10&&e.jsxs("span",{className:"g7dt-text-muted g7dt-text-xs",children:["+",c.user.permissions.length-10,"개"]})]})]}),e.jsxs("div",{className:"g7dt-mt-2 g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[c.user.created_at&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"가입일:"}),e.jsx("span",{className:"g7dt-text-muted",children:new Date(c.user.created_at).toLocaleDateString()})]}),c.user.last_login_at&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"마지막 로그인:"}),e.jsx("span",{className:"g7dt-text-muted",children:new Date(c.user.last_login_at).toLocaleString()})]}),c.user.email_verified_at&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"이메일 인증:"}),e.jsx("span",{className:"g7dt-text-green",children:"✓ 인증됨"})]})]})]}),e.jsx("div",{className:"g7dt-border-t g7dt-pt-3 g7dt-mt-3",children:e.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-2 g7dt-text-xs",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"저장소:"}),e.jsx("span",{className:"g7dt-text-white",children:c.tokens.storage})]}),c.tokens.accessTokenPreview&&e.jsxs("div",{className:"g7dt-flex g7dt-justify-between",children:[e.jsx("span",{className:"g7dt-text-muted",children:"토큰:"}),e.jsx("span",{className:"g7dt-text-muted g7dt-mono",children:c.tokens.accessTokenPreview})]})]})}),c.tokens.accessTokenExpiresAt&&e.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-2 g7dt-text-center",children:["토큰 만료: ",new Date(c.tokens.accessTokenExpiresAt).toLocaleString()]})]}),e.jsxs("div",{className:"g7dt-stats-grid-5",children:[e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-blue",children:f.loginAttempts}),e.jsx("div",{className:"g7dt-stat-label",children:"로그인 시도"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-green",children:f.successfulLogins}),e.jsx("div",{className:"g7dt-stat-label",children:"성공"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:`g7dt-stat-value-sm ${f.failedLogins>0?"g7dt-text-red":"g7dt-text-muted"}`,children:f.failedLogins}),e.jsx("div",{className:"g7dt-stat-label",children:"실패"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-purple",children:f.tokenRefreshes}),e.jsx("div",{className:"g7dt-stat-label",children:"토큰 갱신"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:`g7dt-stat-value-sm ${f.unauthorizedResponses>0?"g7dt-text-red":"g7dt-text-muted"}`,children:f.unauthorizedResponses}),e.jsx("div",{className:"g7dt-stat-label",children:"401 응답"})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsxs("select",{value:r,onChange:h=>o(h.target.value),className:"g7dt-select",children:[e.jsx("option",{value:"all",children:"모든 이벤트"}),e.jsx("option",{value:"login",children:"로그인"}),e.jsx("option",{value:"logout",children:"로그아웃"}),e.jsx("option",{value:"token-refresh",children:"토큰 갱신"}),e.jsx("option",{value:"token-expired",children:"토큰 만료"}),e.jsx("option",{value:"api-unauthorized",children:"401 응답"})]}),e.jsx("button",{onClick:p,className:"g7dt-btn-secondary",children:"새로고침"})]}),e.jsx("div",{className:"g7dt-scroll-list-sm",children:v.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"인증 이벤트가 없습니다"}):v.slice(-20).reverse().map(h=>{const y=h.success?"✅":"❌",n=new Date(h.timestamp).toLocaleTimeString();return e.jsxs("div",{onClick:()=>g(h.id),className:`g7dt-auth-event-item ${a===h.id?"g7dt-selected":h.success?"":"g7dt-error"}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("span",{className:"g7dt-mono",children:[y," ",h.type]}),e.jsx("span",{className:"g7dt-text-muted",children:n})]}),h.error&&e.jsx("div",{className:"g7dt-text-red g7dt-mt-1 g7dt-truncate",children:h.error})]},h.id)})}),l&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:l.type}),e.jsx("button",{onClick:()=>g(null),className:"g7dt-close-btn",children:"✕"})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"결과:"}),e.jsx("span",{className:`g7dt-ml-2 ${l.success?"g7dt-text-green":"g7dt-text-red"}`,children:l.success?"성공":"실패"})]}),l.error&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"에러:"}),e.jsx("div",{className:"g7dt-mt-1 g7dt-text-red",children:l.error})]}),l.details&&Object.keys(l.details).length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"상세:"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-green",children:JSON.stringify(l.details,null,2)})]})]})]}),t.headerAnalysis.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"최근 API 인증 헤더"}),e.jsx("div",{className:"g7dt-scroll-list-xs",children:t.headerAnalysis.slice(-10).reverse().map((h,y)=>e.jsxs("div",{className:"g7dt-header-item",children:[e.jsx("span",{className:"g7dt-text-blue g7dt-truncate g7dt-flex-1",children:h.url}),e.jsx("span",{className:`g7dt-ml-2 ${h.hasAuthHeader?"g7dt-text-green":"g7dt-text-yellow"}`,children:h.hasAuthHeader?`✓ ${h.headerType}`:"✕ 헤더 없음"}),h.responseStatus&&e.jsx("span",{className:`g7dt-ml-2 ${h.responseStatus<400?"g7dt-text-muted":"g7dt-text-red"}`,children:h.responseStatus})]},y))})]})]})},He=({devTools:d})=>{const[t,s]=x.useState([]),[a,g]=x.useState(null),[r,o]=x.useState(null),[p,v]=x.useState("all"),[l,f]=x.useState(""),[c,h]=x.useState(""),y=x.useCallback(()=>{const b=d.getLogInfo();s(b.entries),g(b.stats)},[d]);x.useEffect(()=>{y();const b=setInterval(y,1e3);return()=>clearInterval(b)},[y]);const n=t.filter(b=>!(p!=="all"&&b.level!==p||l&&!b.prefix.toLowerCase().includes(l.toLowerCase())||c&&!b.message.toLowerCase().includes(c.toLowerCase()))),i=r?t.find(b=>b.id===r):null,u=()=>{d.clearLogs(),y(),o(null)},m=b=>{switch(b){case"error":return"g7dt-text-red";case"warn":return"g7dt-text-yellow";case"info":return"g7dt-text-blue";case"debug":return"g7dt-text-muted";default:return"g7dt-text-white"}},k=b=>{switch(b){case"error":return"g7dt-log-error";case"warn":return"g7dt-log-warn";case"info":return"g7dt-log-info";case"debug":return"g7dt-log-debug";default:return"g7dt-log-default"}};return e.jsxs("div",{className:"g7dt-space-y-4",children:[a&&e.jsxs("div",{className:"g7dt-stats-grid-6",children:[e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-white",children:a.totalLogs}),e.jsx("div",{className:"g7dt-stat-label",children:"전체"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-red",children:a.byLevel.error}),e.jsx("div",{className:"g7dt-stat-label",children:"에러"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-yellow",children:a.byLevel.warn}),e.jsx("div",{className:"g7dt-stat-label",children:"경고"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:"g7dt-stat-value-sm g7dt-text-blue",children:a.byLevel.info}),e.jsx("div",{className:"g7dt-stat-label",children:"정보"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:`g7dt-stat-value-sm ${a.recentErrors>0?"g7dt-text-red":"g7dt-text-green"}`,children:a.recentErrors}),e.jsx("div",{className:"g7dt-stat-label",children:"최근 에러"})]}),e.jsxs("div",{className:"g7dt-stat-card-sm",children:[e.jsx("div",{className:`g7dt-stat-value-sm ${a.recentWarnings>0?"g7dt-text-yellow":"g7dt-text-green"}`,children:a.recentWarnings}),e.jsx("div",{className:"g7dt-stat-label",children:"최근 경고"})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-flex-wrap",children:[e.jsxs("select",{value:p,onChange:b=>v(b.target.value),className:"g7dt-select",children:[e.jsx("option",{value:"all",children:"모든 레벨"}),e.jsx("option",{value:"error",children:"에러"}),e.jsx("option",{value:"warn",children:"경고"}),e.jsx("option",{value:"info",children:"정보"}),e.jsx("option",{value:"log",children:"로그"}),e.jsx("option",{value:"debug",children:"디버그"})]}),e.jsx("input",{type:"text",placeholder:"prefix 필터",value:l,onChange:b=>f(b.target.value),className:"g7dt-input g7dt-w-32"}),e.jsx("input",{type:"text",placeholder:"메시지 검색",value:c,onChange:b=>h(b.target.value),className:"g7dt-input g7dt-flex-1"}),e.jsx("button",{onClick:y,className:"g7dt-btn-secondary",children:"새로고침"}),e.jsx("button",{onClick:u,className:"g7dt-btn-danger",children:"초기화"})]}),e.jsx("div",{className:"g7dt-scroll-list-lg",children:n.length===0?e.jsx("div",{className:"g7dt-empty-state",children:t.length===0?"로그가 없습니다":"필터에 맞는 로그가 없습니다"}):n.slice(-50).reverse().map(b=>{const N=new Date(b.timestamp).toLocaleTimeString();return e.jsxs("div",{onClick:()=>o(b.id),className:`g7dt-log-item ${r===b.id?"g7dt-selected":k(b.level)}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:`g7dt-font-bold g7dt-uppercase ${m(b.level)}`,children:b.level}),e.jsxs("span",{className:"g7dt-text-purple",children:["[",b.prefix,"]"]})]}),e.jsx("span",{className:"g7dt-text-muted",children:N})]}),e.jsx("div",{className:"g7dt-text-white g7dt-mt-1 g7dt-truncate",children:b.message})]},b.id)})}),i&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold",children:[e.jsx("span",{className:m(i.level),children:i.level.toUpperCase()})," ",e.jsxs("span",{className:"g7dt-text-purple",children:["[",i.prefix,"]"]})]}),e.jsx("button",{onClick:()=>o(null),className:"g7dt-close-btn",children:"✕"})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"시간:"}),e.jsx("span",{className:"g7dt-ml-2 g7dt-text-white",children:new Date(i.timestamp).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"메시지:"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-white g7dt-whitespace-pre-wrap",children:i.message})]}),i.args.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"인수:"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-green",children:JSON.stringify(i.args,null,2)})]}),i.stack&&e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"스택 트레이스:"}),e.jsx("pre",{className:"g7dt-pre-stack g7dt-text-red",children:i.stack})]})]})]}),a&&Object.keys(a.byPrefix).length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"Prefix별 로그 수"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-2",children:Object.entries(a.byPrefix).sort((b,N)=>N[1]-b[1]).slice(0,10).map(([b,N])=>e.jsxs("button",{onClick:()=>f(b),className:l===b?"g7dt-prefix-btn-active":"g7dt-prefix-btn",children:[b,": ",e.jsx("span",{className:"g7dt-text-blue",children:N})]},b))})]})]})},Fe=({devTools:d})=>{const[t,s]=x.useState(d.getLayoutDebugInfo()),[a,g]=x.useState(!1),[r,o]=x.useState(null),[p,v]=x.useState(!1),[l,f]=x.useState({});x.useEffect(()=>{const m=setInterval(()=>{s(d.getLayoutDebugInfo())},1e3);return()=>clearInterval(m)},[d]),x.useEffect(()=>{(async()=>{try{const k=await fetch("/api/admin/permissions",{headers:{Authorization:`Bearer ${localStorage.getItem("auth_token")}`,Accept:"application/json"}});if(k.ok){const b=await k.json(),N={},C=w=>{w.forEach(S=>{N[S.identifier]=S.name,S.children?.length&&C(S.children)})};Object.values(b.data?.permissions||{}).forEach(w=>{w.permissions&&C(w.permissions)}),f(N)}}catch(k){console.warn("[G7DevTools] 권한 목록 조회 실패:",k)}})()},[]);const c=t.current,h=c?.layoutJson,y=t.history,n=t.stats,i=h?[{key:"components",label:"컴포넌트",count:Array.isArray(h.components)?h.components.length:0},{key:"data_sources",label:"데이터소스",count:Array.isArray(h.data_sources)?h.data_sources.length:0},{key:"computed",label:"Computed",count:h.computed?Object.keys(h.computed).length:0},{key:"defines",label:"Defines",count:h.defines?Object.keys(h.defines).length:0},{key:"slots",label:"Slots",count:h.slots?Object.keys(h.slots).length:0},{key:"modals",label:"Modals",count:h.modals?Object.keys(h.modals).length:0},{key:"init_actions",label:"초기화 액션",count:Array.isArray(h.init_actions)?h.init_actions.length:0},{key:"scripts",label:"스크립트",count:Array.isArray(h.scripts)?h.scripts.length:0},{key:"meta",label:"메타데이터",count:h.meta?Object.keys(h.meta).length:0},{key:"errorHandling",label:"에러핸들링",count:h.errorHandling?Object.keys(h.errorHandling).length:0},{key:"permissions",label:"권한",count:Array.isArray(h.permissions)?h.permissions.length:0}]:[],u=m=>{navigator.clipboard.writeText(JSON.stringify(m,null,2))};return c?e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"📊 로드 통계"}),e.jsxs("div",{className:"g7dt-grid-3",children:[e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"총 로드:"}),e.jsx("span",{className:"g7dt-text-blue",children:n.totalLoads})]}),e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"캐시 히트:"}),e.jsx("span",{className:"g7dt-text-green",children:n.cacheHits})]}),e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"API 로드:"}),e.jsx("span",{className:"g7dt-text-yellow",children:n.apiLoads})]})]})]}),e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"📋 현재 레이아웃"}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsx("button",{onClick:()=>u(h),className:"g7dt-btn-small",title:"전체 JSON 복사",children:"📋 복사"}),e.jsx("button",{onClick:()=>g(!a),className:"g7dt-btn-small",children:a?"요약 보기":"전체 보기"})]})]}),e.jsxs("div",{className:"g7dt-space-y-2 g7dt-text-xs",children:[e.jsxs("div",{className:"g7dt-flex g7dt-gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"경로:"}),e.jsx("span",{className:"g7dt-ml-1 g7dt-text-white g7dt-font-mono",children:c.layoutPath})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"템플릿:"}),e.jsx("span",{className:"g7dt-ml-1 g7dt-text-blue",children:c.templateId})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"버전:"}),e.jsx("span",{className:"g7dt-ml-1 g7dt-text-white",children:c.version||"-"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"소스:"}),e.jsx("span",{className:`g7dt-ml-1 ${c.source==="cache"?"g7dt-text-green":"g7dt-text-yellow"}`,children:c.source==="cache"?"💾 캐시":"🌐 API"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"로드 시간:"}),e.jsx("span",{className:"g7dt-ml-1 g7dt-text-white",children:c.loadedAt?new Date(c.loadedAt).toLocaleTimeString():"-"})]})]}),e.jsx("div",{className:"g7dt-flex g7dt-gap-4 g7dt-mt-2",children:e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-text-muted",children:"권한:"}),h.permissions&&h.permissions.length>0?e.jsxs("span",{className:"g7dt-ml-1 g7dt-text-yellow",children:["🔒 ",h.permissions.map(m=>l[m]||m).join(", ")]}):h.permissions&&h.permissions.length===0?e.jsx("span",{className:"g7dt-ml-1 g7dt-text-green",children:"🌐 공개"}):e.jsx("span",{className:"g7dt-ml-1 g7dt-text-muted",children:"미정의 (부모 상속)"})]})})]})]}),!a&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"🏗️ 레이아웃 구조"}),e.jsx("div",{className:"g7dt-grid-2",children:i.map(m=>e.jsxs("button",{onClick:()=>o(r===m.key?null:m.key),className:`g7dt-section-btn ${r===m.key?"g7dt-selected":""}`,children:[e.jsx("span",{children:m.label}),e.jsxs("span",{className:"g7dt-text-blue",children:[m.count,"개"]})]},m.key))})]}),(a||r)&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:a?"📄 전체 레이아웃 JSON":`📎 ${r} 섹션`}),e.jsx("button",{onClick:()=>{a?u(h):r&&h&&u(h[r])},className:"g7dt-btn-small",children:"복사"})]}),r==="permissions"&&!a?e.jsx("div",{className:"g7dt-text-xs",children:h.permissions&&h.permissions.length>0?e.jsxs("table",{className:"g7dt-table g7dt-w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"g7dt-border-b g7dt-border-gray-700",children:[e.jsx("th",{className:"g7dt-text-left g7dt-p-2 g7dt-text-muted",children:"권한 ID"}),e.jsx("th",{className:"g7dt-text-left g7dt-p-2 g7dt-text-muted",children:"명칭"})]})}),e.jsx("tbody",{children:h.permissions.map(m=>e.jsxs("tr",{className:"g7dt-border-b g7dt-border-gray-800",children:[e.jsx("td",{className:"g7dt-p-2 g7dt-font-mono g7dt-text-blue",children:m}),e.jsx("td",{className:"g7dt-p-2 g7dt-text-white",children:l[m]||e.jsx("span",{className:"g7dt-text-muted",children:"-"})})]},m))})]}):h.permissions&&h.permissions.length===0?e.jsx("p",{className:"g7dt-text-muted g7dt-p-2",children:"🌐 공개 레이아웃 (permissions: [])"}):e.jsx("p",{className:"g7dt-text-muted g7dt-p-2",children:"권한 미정의 (부모 레이아웃 상속)"})}):e.jsx("pre",{className:"g7dt-pre g7dt-text-green g7dt-max-h-96 g7dt-overflow-auto",children:JSON.stringify(a?h:r&&h?h[r]:null,null,2)})]}),y.length>0&&e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-cursor-pointer",onClick:()=>v(!p),children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold",children:["📜 로드 이력 (",y.length,")"]}),e.jsx("span",{className:"g7dt-text-muted",children:p?"▼":"▶"})]}),p&&e.jsx("div",{className:"g7dt-mt-2 g7dt-space-y-1",children:y.slice(-20).reverse().map(m=>e.jsxs("div",{className:"g7dt-history-item",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsx("span",{className:"g7dt-font-mono g7dt-text-xs",children:m.layoutPath}),e.jsx("span",{className:`g7dt-text-xs ${m.source==="cache"?"g7dt-text-green":"g7dt-text-yellow"}`,children:m.source==="cache"?"💾":"🌐"})]}),e.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted",children:[m.templateId," · ",m.loadedAt?new Date(m.loadedAt).toLocaleTimeString():"-"]})]},m.id))})]}),e.jsxs("div",{className:"g7dt-card g7dt-text-xs g7dt-text-muted",children:["💡 레이아웃 캐시 문제가 의심되면:",e.jsxs("ul",{className:"g7dt-ml-4 g7dt-list-disc",children:[e.jsx("li",{children:'"소스" 항목이 💾 캐시인지 🌐 API인지 확인'}),e.jsx("li",{children:"캐시에서 로드된 경우, JSON 내용이 최신인지 확인"}),e.jsxs("li",{children:["문제가 있으면 ",e.jsx("code",{className:"g7dt-code",children:"php artisan template:refresh-layout"})," 실행"]})]})]})]}):e.jsx("div",{className:"g7dt-space-y-4",children:e.jsxs("div",{className:"g7dt-empty-state",children:["현재 로드된 레이아웃이 없습니다.",e.jsx("br",{}),"페이지를 새로고침하거나 라우트를 변경해보세요."]})})},We=({devTools:d})=>{const[t,s]=x.useState(d.getChangeDetectionInfo()),[a,g]=x.useState(null),[r,o]=x.useState(!1),[p,v]=x.useState(new Set);x.useEffect(()=>{const b=setInterval(()=>{s(d.getChangeDetectionInfo())},500);return()=>clearInterval(b)},[d]);const{executionDetails:l,alerts:f,stats:c}=t,h=r?l.filter(b=>b.alerts.length>0||b.stateChanges.length===0):l,y=a?l.find(b=>b.executionId===a):null,n=b=>{v(N=>{const C=new Set(N);return C.has(b)?C.delete(b):C.add(b),C})},i=b=>{switch(b){case"normal":return"✅";case"early-return-condition":return"⏎";case"early-return-validation":return"❌";case"error":return"💥";default:return"❓"}},u=b=>{switch(b){case"no-state-change":return"⚠️";case"no-datasource-change":return"📊";case"expected-not-fulfilled":return"❗";case"object-reference-same":return"🔄";case"early-return-detected":return"⏎";case"async-timing-issue":return"⏱️";default:return"📢"}},m=b=>{switch(b){case"error":return"g7dt-text-red";case"warning":return"g7dt-text-yellow";case"info":return"g7dt-text-blue";default:return"g7dt-text-white"}},k=b=>new Date(b).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3});return e.jsxs("div",{className:"g7dt-space-y-4",children:[f.filter(b=>b.severity==="error"||b.severity==="warning").length>0&&e.jsx("div",{className:"g7dt-card",style:{backgroundColor:"#7f1d1d",borderColor:"#991b1b"},children:e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("span",{className:"g7dt-font-bold",children:["⚠️ 변경 감지 알림: ",f.filter(b=>b.severity==="error").length,"개 에러,"," ",f.filter(b=>b.severity==="warning").length,"개 경고"]}),e.jsx("button",{onClick:()=>d.clearChangeDetectionData(),className:"g7dt-btn-small",children:"초기화"})]})}),e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"📊 변경 감지 통계"}),e.jsxs("div",{className:"g7dt-grid-3",children:[e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"총 실행:"}),e.jsx("span",{className:"g7dt-text-blue",children:c.totalExecutions})]}),e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"상태 변경 있음:"}),e.jsx("span",{className:"g7dt-text-green",children:c.executionsWithStateChange})]}),e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"상태 변경 없음:"}),e.jsx("span",{className:c.executionsWithoutStateChange>0?"g7dt-text-yellow":"g7dt-text-gray",children:c.executionsWithoutStateChange})]}),e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"Early Return:"}),e.jsx("span",{className:"g7dt-text-orange",children:c.earlyReturnCount})]}),e.jsxs("div",{className:"g7dt-stat-item",children:[e.jsx("span",{className:"g7dt-text-muted",children:"알림:"}),e.jsx("span",{className:c.alertCount>0?"g7dt-text-red":"g7dt-text-gray",children:c.alertCount})]})]})]}),f.length>0&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"🔔 최근 알림"}),e.jsx("div",{className:"g7dt-space-y-2",style:{maxHeight:"200px",overflowY:"auto"},children:f.slice(-10).reverse().map(b=>e.jsxs("div",{className:"g7dt-list-item",onClick:()=>n(b.id),style:{cursor:"pointer"},children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-start",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:u(b.type)}),e.jsx("span",{className:`g7dt-text-xs ${m(b.severity)}`,children:b.message})]}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:k(b.timestamp)})]}),p.has(b.id)&&e.jsxs("div",{className:"g7dt-mt-2 g7dt-text-xs g7dt-text-muted g7dt-pl-6",children:[e.jsx("p",{children:b.description}),b.statePath&&e.jsxs("p",{className:"g7dt-mt-1",children:[e.jsx("span",{className:"g7dt-text-cyan",children:"경로:"})," ",b.statePath]}),b.suggestion&&e.jsxs("p",{className:"g7dt-mt-1",children:[e.jsx("span",{className:"g7dt-text-green",children:"제안:"})," ",b.suggestion]}),b.docLink&&e.jsxs("p",{className:"g7dt-mt-1",children:[e.jsx("span",{className:"g7dt-text-blue",children:"문서:"})," ",e.jsx("code",{className:"g7dt-code",children:b.docLink})]})]})]},b.id))})]}),e.jsxs("div",{className:"g7dt-card",children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center g7dt-mb-2",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold",children:"🔧 핸들러 실행 이력"}),e.jsxs("label",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:b=>o(b.target.checked)}),e.jsx("span",{children:"경고만 표시"})]})]}),h.length===0?e.jsxs("div",{className:"g7dt-empty-state",children:["핸들러 실행 이력이 없습니다.",e.jsx("br",{}),"액션을 실행하면 여기에 표시됩니다."]}):e.jsx("div",{className:"g7dt-space-y-1",style:{maxHeight:"300px",overflowY:"auto"},children:h.slice(-20).reverse().map(b=>e.jsxs("div",{className:`g7dt-list-item ${a===b.executionId?"g7dt-selected":""}`,onClick:()=>g(a===b.executionId?null:b.executionId),style:{cursor:"pointer"},children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:i(b.exitReason)}),e.jsx("span",{className:"g7dt-text-white g7dt-font-mono g7dt-text-xs",children:b.handlerName}),b.alerts.length>0&&e.jsx("span",{className:"g7dt-badge g7dt-badge-warning",children:b.alerts.length})]}),e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[e.jsxs("span",{className:"g7dt-text-muted",children:["상태: ",b.stateChanges.length]}),e.jsx("span",{className:"g7dt-text-muted",children:b.duration?`${b.duration}ms`:"-"}),e.jsx("span",{className:"g7dt-text-muted",children:k(b.startTime)})]})]}),a===b.executionId&&y&&e.jsxs("div",{className:"g7dt-mt-3 g7dt-pt-3 g7dt-border-t g7dt-border-gray-700",children:[e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:"종료 사유: "}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:y.exitReason||"unknown"}),y.exitLocation&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-2",children:"위치: "}),e.jsx("code",{className:"g7dt-code g7dt-text-xs",children:y.exitLocation})]})]}),y.exitDescription&&e.jsx("div",{className:"g7dt-mb-2 g7dt-text-xs g7dt-text-muted",children:y.exitDescription}),y.stateChanges.length>0&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsxs("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-green",children:["상태 변경 (",y.stateChanges.length,")"]}),e.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:y.stateChanges.map(N=>e.jsxs("div",{className:"g7dt-text-xs g7dt-pl-2",children:[e.jsx("span",{className:"g7dt-text-cyan",children:N.path}),e.jsxs("span",{className:"g7dt-text-muted",children:[" (",N.changeType,")"]}),N.comparison.changedKeys&&e.jsxs("span",{className:"g7dt-text-muted g7dt-ml-1",children:["[변경: ",N.comparison.changedKeys.join(", "),"]"]})]},N.id))})]}),y.dataSourceChanges.length>0&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsxs("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-blue",children:["데이터소스 변경 (",y.dataSourceChanges.length,")"]}),e.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:y.dataSourceChanges.map((N,C)=>e.jsxs("div",{className:"g7dt-text-xs g7dt-pl-2",children:[e.jsx("span",{className:"g7dt-text-cyan",children:N.dataSourceId}),e.jsxs("span",{className:"g7dt-text-muted",children:[" ","(",N.changeType,": ",N.previousStatus," → ",N.newStatus,")"]})]},C))})]}),y.expectedChanges&&e.jsxs("div",{className:"g7dt-mb-2",children:[e.jsx("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-yellow",children:"기대 변경"}),e.jsxs("div",{className:"g7dt-mt-1 g7dt-text-xs g7dt-pl-2 g7dt-text-muted",children:["상태: ",y.expectedChanges.expectedStatePaths.join(", ")||"없음",e.jsx("br",{}),"데이터소스: ",y.expectedChanges.expectedDataSources.join(", ")||"없음"]})]}),y.alerts.length>0&&e.jsxs("div",{children:[e.jsxs("span",{className:"g7dt-text-xs g7dt-font-bold g7dt-text-red",children:["알림 (",y.alerts.length,")"]}),e.jsx("div",{className:"g7dt-mt-1 g7dt-space-y-1",children:y.alerts.map(N=>e.jsxs("div",{className:"g7dt-text-xs g7dt-pl-2",children:[e.jsx("span",{children:u(N.type)}),e.jsx("span",{className:`g7dt-ml-1 ${m(N.severity)}`,children:N.message})]},N.id))})]})]})]},b.executionId))})]}),e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-2",children:"💡 변경 감지 가이드"}),e.jsxs("ul",{className:"g7dt-help-list",children:[e.jsx("li",{children:"핸들러 실행 후 상태 변경이 없으면 ⚠️ 경고가 표시됩니다"}),e.jsx("li",{children:"early return으로 종료된 경우 ⏎ 아이콘으로 표시됩니다"}),e.jsx("li",{children:"객체 변경 시 참조가 동일하면 🔄 경고가 발생합니다"}),e.jsx("li",{children:"문제 해결: exitLocation 확인 → 조건문 검토 → 불변성 확인"})]})]})]})},Ve=({devTools:d})=>{const[t,s]=x.useState(null),[a,g]=x.useState(null),[r,o]=x.useState("all"),p=x.useCallback(()=>{s(d.getStaleClosureTrackingInfo())},[d]);if(x.useEffect(()=>{p();const n=setInterval(p,2e3);return()=>clearInterval(n)},[p]),!t)return e.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const{warnings:v,stats:l}=t,f=v.filter(n=>r==="all"?!0:n.severity===r),c=a?v.find(n=>n.id===a):null,h=n=>{switch(n){case"error":return"❌";case"warning":return"⚠️";default:return"❓"}},y=n=>{switch(n){case"state-changed-during-async":return"⏳";case"captured-in-callback":return"📸";case"stale-in-handler":return"🔄";default:return"❓"}};return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Stale Closure 통계"}),e.jsxs("div",{className:"g7dt-stats-grid-3",children:[e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-yellow",children:l.totalWarnings||0}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 경고"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:l.warningsBySeverity?.error||0}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"에러"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-orange",children:l.warningsBySeverity?.warning||0}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"경고"})]})]})]}),l.warningsByType&&Object.keys(l.warningsByType).length>0&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"타입별 분포"}),e.jsx("div",{className:"g7dt-space-y-2",children:Object.entries(l.warningsByType).map(([n,i])=>e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[e.jsxs("span",{className:"g7dt-text-muted",children:[y(n)," ",n]}),e.jsx("span",{className:"g7dt-text-white g7dt-font-mono",children:i})]},n))})]}),e.jsx("div",{className:"g7dt-card",children:e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:"심각도:"}),e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"g7dt-select",children:[e.jsx("option",{value:"all",children:"전체"}),e.jsx("option",{value:"error",children:"에러"}),e.jsx("option",{value:"warning",children:"경고"})]}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[f.length,"개 표시"]})]})}),e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Stale Closure 경고"}),f.length===0?e.jsx("div",{className:"g7dt-empty-state g7dt-text-green",children:"✅ Stale Closure 경고가 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:f.slice().reverse().map(n=>e.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${a===n.id?"g7dt-selected":""}`,onClick:()=>g(a===n.id?null:n.id),children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:h(n.severity)}),e.jsx("span",{children:y(n.type)}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white g7dt-truncate",children:n.location}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:new Date(n.timestamp).toLocaleTimeString()})]}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:n.statePath})]},n.id))})]}),c&&e.jsxs("div",{className:"g7dt-card g7dt-border-yellow",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[h(c.severity)," 경고 상세"]}),e.jsxs("div",{className:"g7dt-space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"위치"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white g7dt-mono",children:c.location})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"타입"}),e.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[y(c.type)," ",c.type]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 경로"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-yellow g7dt-mono",children:c.statePath})]}),e.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"캡처된 값"}),e.jsx("pre",{className:"g7dt-code-block g7dt-text-red",children:JSON.stringify(c.capturedValue,null,2)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"현재 값"}),e.jsx("pre",{className:"g7dt-code-block g7dt-text-green",children:JSON.stringify(c.currentValue,null,2)})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"시간 차이"}),e.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[c.timeDiff,"ms"]})]}),c.suggestion&&e.jsxs("div",{className:"g7dt-bg-blue-dark g7dt-p-2 g7dt-rounded",children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-blue",children:"💡 제안"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white g7dt-mt-1",children:c.suggestion})]})]})]})]})},Be=({devTools:d})=>{const[t,s]=x.useState(null),[a,g]=x.useState(null),[r,o]=x.useState("all"),p=x.useCallback(()=>{s(d.getNestedContextTrackingInfo())},[d]);if(x.useEffect(()=>{p();const n=setInterval(p,2e3);return()=>clearInterval(n)},[p]),!t)return e.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const{contexts:v,stats:l}=t,f=v.filter(n=>r==="all"?!0:n.componentType===r),c=a?v.find(n=>n.id===a):null,h=n=>{switch(n){case"expandChildren":return"📂";case"cellChildren":return"📊";case"iteration":return"🔄";case"modal":return"🪟";case"slot":return"🔲";default:return"❓"}},y=n=>"│".repeat(Math.max(0,n-1))+(n>0?"├─":"");return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"Nested Context 통계"}),e.jsxs("div",{className:"g7dt-stats-grid-3",children:[e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-blue",children:l.totalContexts||0}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 컨텍스트"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-purple",children:l.maxDepth||0}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"최대 깊이"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:l.failedAccessCount||0}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"접근 오류"})]})]})]}),l.byType&&Object.keys(l.byType).length>0&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"타입별 분포"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-3",children:Object.entries(l.byType).map(([n,i])=>e.jsxs("div",{className:`g7dt-badge g7dt-cursor-pointer ${r===n?"g7dt-badge-selected":""}`,onClick:()=>o(r===n?"all":n),children:[h(n)," ",n,": ",i]},n))})]}),e.jsx("div",{className:"g7dt-card",children:e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:"타입:"}),e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"g7dt-select",children:[e.jsx("option",{value:"all",children:"전체"}),e.jsx("option",{value:"expandChildren",children:"expandChildren"}),e.jsx("option",{value:"cellChildren",children:"cellChildren"}),e.jsx("option",{value:"iteration",children:"iteration"}),e.jsx("option",{value:"modal",children:"modal"}),e.jsx("option",{value:"slot",children:"slot"})]}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:[f.length,"개 표시"]})]})}),e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"컨텍스트 목록"}),f.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"추적된 Nested Context가 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:f.slice().reverse().map(n=>{const i=n.accessAttempts?.some(m=>!m.found),u=n.mergedContext?.all||[];return e.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${a===n.id?"g7dt-selected":""} ${i?"g7dt-border-red":""}`,onClick:()=>g(a===n.id?null:n.id),children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:"g7dt-text-muted g7dt-mono g7dt-text-xs",children:y(n.depth)}),e.jsx("span",{children:h(n.componentType)}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:n.componentId||n.componentType}),i&&e.jsx("span",{className:"g7dt-text-red g7dt-text-xs",children:"⚠️ 오류"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:["깊이: ",n.depth]})]}),e.jsxs("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1",children:["변수: ",u.slice(0,5).join(", "),u.length>5&&"..."]})]},n.id)})})]}),c&&e.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[h(c.componentType)," 컨텍스트 상세"]}),e.jsxs("div",{className:"g7dt-space-y-3",children:[e.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"타입"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:c.componentType})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"깊이"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:c.depth})]})]}),c.componentId&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"컴포넌트 ID"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-blue g7dt-mono",children:c.componentId})]}),c.parentId&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"부모 컨텍스트"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-purple g7dt-mono",children:c.parentId})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"사용 가능한 변수"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:(c.mergedContext?.all||[]).map(n=>e.jsx("span",{className:"g7dt-badge g7dt-badge-blue g7dt-text-xs",children:n},n))})]}),c.ownContext?.added&&c.ownContext.added.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"추가된 변수 (이 컨텍스트에서)"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:c.ownContext.added.map(n=>e.jsxs("span",{className:"g7dt-badge g7dt-badge-green g7dt-text-xs",children:["+ ",n]},n))})]}),c.accessAttempts&&c.accessAttempts.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"접근 시도"}),e.jsx("div",{className:"g7dt-space-y-1",children:c.accessAttempts.slice(0,10).map((n,i)=>e.jsxs("div",{className:`g7dt-flex g7dt-justify-between g7dt-text-xs ${n.found?"":"g7dt-text-red"}`,children:[e.jsx("span",{className:"g7dt-mono",children:n.path}),e.jsx("span",{children:n.found?"✓":"✕"})]},i))})]})]})]})]})},Ge=({devTools:d})=>{const[t,s]=x.useState(null),[a,g]=x.useState(null),[r,o]=x.useState(null),[p,v]=x.useState("modals"),l=x.useCallback(()=>{s(d.getModalStateScopeTrackingInfo())},[d]);if(x.useEffect(()=>{l();const N=setInterval(l,2e3);return()=>clearInterval(N)},[l]),!t)return e.jsx("div",{className:"g7dt-empty-state",children:"로딩 중..."});const{modals:f,issues:c,relations:h,changeLogs:y,stats:n}=t,i=a?f.find(N=>N.modalId===a):null,u=r?c.find(N=>N.id===r):null,m=N=>{switch(N){case"isolated":return"🔒";case"shared":return"🔓";case"inherited":return"📥";default:return"❓"}},k=N=>{switch(N){case"state-leakage":return"💧";case"isolation-violation":return"🔓";case"parent-mutation":return"👆";case"orphaned-state":return"👻";case"scope-mismatch":return"🔀";case"cleanup-failure":return"🧹";case"missing-definition":return"🚫";default:return"❓"}},b=N=>{switch(N){case"error":return"❌";case"warning":return"⚠️";default:return"❓"}};return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"모달 상태 스코프 통계"}),e.jsxs("div",{className:"g7dt-stats-grid-3",children:[e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-blue",children:n.totalModals}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"총 모달"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-green",children:n.openModals}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"열린 모달"})]}),e.jsxs("div",{className:"g7dt-text-center",children:[e.jsx("div",{className:"g7dt-text-2xl g7dt-font-bold g7dt-text-red",children:n.totalIssues}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"이슈"})]})]})]}),e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"스코프별 / 이슈별"}),e.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"스코프 타입"}),e.jsx("div",{className:"g7dt-space-y-1",children:Object.entries(n.byScope).map(([N,C])=>e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[e.jsxs("span",{children:[m(N)," ",N]}),e.jsx("span",{className:"g7dt-font-mono",children:C})]},N))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-2",children:"이슈 타입"}),e.jsxs("div",{className:"g7dt-space-y-1",children:[Object.entries(n.issuesByType).filter(([N,C])=>C>0).map(([N,C])=>e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-text-xs",children:[e.jsxs("span",{children:[k(N)," ",N]}),e.jsx("span",{className:"g7dt-font-mono g7dt-text-red",children:C})]},N)),Object.values(n.issuesByType).every(N=>N===0)&&e.jsx("div",{className:"g7dt-text-xs g7dt-text-green",children:"✅ 이슈 없음"})]})]})]})]}),e.jsx("div",{className:"g7dt-card",children:e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsxs("button",{className:`g7dt-tab-button ${p==="modals"?"g7dt-tab-active":""}`,onClick:()=>v("modals"),children:["🪟 모달 (",f.length,")"]}),e.jsxs("button",{className:`g7dt-tab-button ${p==="issues"?"g7dt-tab-active":""}`,onClick:()=>v("issues"),children:["⚠️ 이슈 (",c.length,")"]}),e.jsxs("button",{className:`g7dt-tab-button ${p==="logs"?"g7dt-tab-active":""}`,onClick:()=>v("logs"),children:["📝 로그 (",y.length,")"]})]})}),p==="modals"&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"모달 목록"}),f.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"추적된 모달이 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:f.map(N=>{const C=c.some(w=>w.modalId===N.modalId);return e.jsx("div",{className:`g7dt-list-item g7dt-cursor-pointer ${a===N.modalId?"g7dt-selected":""} ${C?"g7dt-border-red":""}`,onClick:()=>g(a===N.modalId?null:N.modalId),children:e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:N.closedAt===null?"📭":"📪"}),e.jsx("span",{children:m(N.scopeType)}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:N.modalName}),C&&e.jsx("span",{className:"g7dt-text-red",children:"⚠️"}),e.jsxs("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:["변경: ",N.stateChangeCount]})]})},N.modalId)})})]}),p==="issues"&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"이슈 목록"}),c.length===0?e.jsx("div",{className:"g7dt-empty-state g7dt-text-green",children:"✅ 모달 상태 이슈가 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:c.slice().reverse().map(N=>e.jsxs("div",{className:`g7dt-list-item g7dt-cursor-pointer ${r===N.id?"g7dt-selected":""}`,onClick:()=>o(r===N.id?null:N.id),children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{children:b(N.severity)}),e.jsx("span",{children:k(N.type)}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:N.modalName}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:new Date(N.timestamp).toLocaleTimeString()})]}),e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mt-1 g7dt-truncate",children:N.description})]},N.id))})]}),p==="logs"&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"상태 변경 로그"}),y.length===0?e.jsx("div",{className:"g7dt-empty-state",children:"상태 변경 로그가 없습니다"}):e.jsx("div",{className:"g7dt-space-y-2 g7dt-max-h-60 g7dt-overflow-y-auto",children:y.slice().reverse().slice(0,50).map(N=>e.jsxs("div",{className:`g7dt-list-item ${N.violatesIsolation?"g7dt-border-red":""}`,children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2",children:[e.jsx("span",{className:"g7dt-text-xs g7dt-text-white",children:N.modalName}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-blue g7dt-mono",children:N.stateKey}),N.violatesIsolation&&e.jsx("span",{className:"g7dt-text-red",children:"⚠️ 격리 위반"}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted g7dt-ml-auto",children:new Date(N.timestamp).toLocaleTimeString()})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2 g7dt-text-xs g7dt-mt-1",children:[e.jsx("span",{className:"g7dt-text-red g7dt-truncate",style:{maxWidth:"45%"},children:JSON.stringify(N.previousValue)}),e.jsx("span",{className:"g7dt-text-muted",children:"→"}),e.jsx("span",{className:"g7dt-text-green g7dt-truncate",style:{maxWidth:"45%"},children:JSON.stringify(N.newValue)})]})]},N.id))})]}),i&&p==="modals"&&e.jsxs("div",{className:"g7dt-card g7dt-border-blue",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[m(i.scopeType)," 모달 상세: ",i.modalName]}),e.jsxs("div",{className:"g7dt-space-y-3",children:[e.jsxs("div",{className:"g7dt-grid-2 g7dt-gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"스코프"}),e.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[m(i.scopeType)," ",i.scopeType]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:i.closedAt===null?"📭 열림":"📪 닫힘"})]})]}),i.parentModalId&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"부모 모달"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-purple g7dt-mono",children:i.parentModalId})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"상태 변경 횟수"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:i.stateChangeCount})]}),i.isolatedStateKeys.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-1",children:"격리된 상태 키"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:i.isolatedStateKeys.map(N=>e.jsxs("span",{className:"g7dt-badge g7dt-badge-red g7dt-text-xs",children:["🔒 ",N]},N))})]}),i.sharedStateKeys.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted g7dt-mb-1",children:"공유된 상태 키"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1",children:i.sharedStateKeys.map(N=>e.jsxs("span",{className:"g7dt-badge g7dt-badge-blue g7dt-text-xs",children:["🔓 ",N]},N))})]})]})]}),u&&p==="issues"&&e.jsxs("div",{className:"g7dt-card g7dt-border-red",children:[e.jsxs("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:[b(u.severity)," 이슈 상세"]}),e.jsxs("div",{className:"g7dt-space-y-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"타입"}),e.jsxs("div",{className:"g7dt-text-sm g7dt-text-white",children:[k(u.type)," ",u.type]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"설명"}),e.jsx("div",{className:"g7dt-text-sm g7dt-text-white",children:u.description})]}),u.affectedStateKeys.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"영향 받는 상태 키"}),e.jsx("div",{className:"g7dt-flex g7dt-flex-wrap g7dt-gap-1 g7dt-mt-1",children:u.affectedStateKeys.map(N=>e.jsx("span",{className:"g7dt-badge g7dt-text-xs",children:N},N))})]}),u.leakedValue!==void 0&&e.jsxs("div",{children:[e.jsx("div",{className:"g7dt-text-xs g7dt-text-muted",children:"유출된 값"}),e.jsx("pre",{className:"g7dt-code-block g7dt-text-red",children:JSON.stringify(u.leakedValue,null,2)})]})]})]}),h.length>0&&e.jsxs("div",{className:"g7dt-card",children:[e.jsx("h3",{className:"g7dt-text-sm g7dt-font-bold g7dt-mb-3",children:"모달 관계"}),e.jsx("div",{className:"g7dt-space-y-2",children:h.map((N,C)=>e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-gap-2 g7dt-text-xs",children:[e.jsx("span",{className:"g7dt-text-purple",children:N.parentModalId}),e.jsx("span",{className:"g7dt-text-muted",children:"→"}),e.jsx("span",{className:"g7dt-text-blue",children:N.childModalId}),e.jsx("span",{className:"g7dt-badge g7dt-text-xs g7dt-ml-auto",children:N.relationType})]},C))})]})]})},Je=({devTools:d})=>{const[t,s]=x.useState("definitions"),[a,g]=x.useState(null),[r,o]=x.useState(""),p=x.useCallback(()=>{d&&g(d.getNamedActionTrackingInfo())},[d]);if(x.useEffect(()=>{p();const n=setInterval(p,2e3);return()=>clearInterval(n)},[p]),!a)return e.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:"데이터 로딩 중..."});const{definitions:v,refLogs:l,stats:f}=a,c=Object.keys(v),h=c.filter(n=>!r||n.toLowerCase().includes(r.toLowerCase())||v[n]?.handler?.toLowerCase().includes(r.toLowerCase())),y=l.filter(n=>!r||n.actionRefName.toLowerCase().includes(r.toLowerCase())||n.resolvedHandler.toLowerCase().includes(r.toLowerCase()));return e.jsxs("div",{className:"g7dt-space-y-4",children:[e.jsxs("div",{className:"g7dt-grid g7dt-grid-cols-3 g7dt-gap-2",children:[e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value",children:f.totalDefinitions}),e.jsx("div",{className:"g7dt-stat-label",children:"정의"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value",children:f.totalRefs}),e.jsx("div",{className:"g7dt-stat-label",children:"참조"})]}),e.jsxs("div",{className:"g7dt-stat-card",children:[e.jsx("div",{className:"g7dt-stat-value",style:{color:f.unusedDefinitions.length>0?"#f59e0b":"#10b981"},children:f.unusedDefinitions.length}),e.jsx("div",{className:"g7dt-stat-label",children:"미사용"})]})]}),e.jsxs("div",{className:"g7dt-flex g7dt-gap-2",children:[e.jsxs("button",{onClick:()=>s("definitions"),className:t==="definitions"?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:["정의 목록 (",c.length,")"]}),e.jsxs("button",{onClick:()=>s("refs"),className:t==="refs"?"g7dt-filter-btn g7dt-filter-active":"g7dt-filter-btn",children:["참조 이력 (",l.length,")"]}),e.jsx("button",{onClick:p,className:"g7dt-filter-btn",title:"새로고침",children:"↻"})]}),e.jsx("input",{type:"text",placeholder:t==="definitions"?"액션 이름 검색...":"actionRef 검색...",value:r,onChange:n=>o(n.target.value),className:"g7dt-input g7dt-w-full"}),t==="definitions"&&e.jsx("div",{className:"g7dt-space-y-1",children:h.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:c.length===0?"정의된 named_actions가 없습니다":"검색 결과 없음"}):h.map(n=>{const i=v[n],u=f.refCountByName[n]||0,m=f.unusedDefinitions.includes(n);return e.jsxs("div",{className:"g7dt-card",style:{borderLeft:m?"3px solid #f59e0b":"3px solid #10b981"},children:[e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-font-bold",children:n}),e.jsxs("span",{className:"g7dt-text-muted g7dt-ml-2",children:["→ ",i.handler]})]}),e.jsxs("span",{className:"g7dt-badge",title:"참조 횟수",children:[u,"회"]})]}),i.params&&e.jsxs("details",{className:"g7dt-mt-1",children:[e.jsx("summary",{className:"g7dt-text-xs g7dt-text-muted g7dt-cursor-pointer",children:"params"}),e.jsx("pre",{className:"g7dt-pre g7dt-text-xs g7dt-mt-1",style:{maxHeight:"200px",overflow:"auto"},children:JSON.stringify(i.params,null,2)})]}),m&&e.jsx("div",{className:"g7dt-text-xs",style:{color:"#f59e0b",marginTop:"4px"},children:"⚠ 미사용 정의"})]},n)})}),t==="refs"&&e.jsx("div",{className:"g7dt-space-y-1",children:y.length===0?e.jsx("div",{className:"g7dt-empty-message g7dt-py-4",children:l.length===0?"actionRef 해석 이력이 없습니다":"검색 결과 없음"}):[...y].reverse().map(n=>e.jsx("div",{className:"g7dt-card",children:e.jsxs("div",{className:"g7dt-flex g7dt-justify-between g7dt-items-center",children:[e.jsxs("div",{children:[e.jsx("span",{className:"g7dt-font-bold",children:n.actionRefName}),e.jsxs("span",{className:"g7dt-text-muted g7dt-ml-2",children:["→ ",n.resolvedHandler]})]}),e.jsx("span",{className:"g7dt-text-xs g7dt-text-muted",children:new Date(n.timestamp).toLocaleTimeString()})]})},n.id))})]})},ge=()=>{x.useEffect(()=>{ve()},[]);const d=x.useRef(oe()),[t,s]=x.useState(d.current.isOpen??!1),[a,g]=x.useState(!1),[r,o]=x.useState("state"),[p,v]=x.useState({_global:{},_local:{},_computed:{}}),[l,f]=x.useState([]),[c,h]=x.useState({hits:0,misses:0,entries:0,hitRate:0}),[y,n]=x.useState(!1),[i,u]=x.useState(d.current.position??{x:-1,y:-1}),[m,k]=x.useState(!1),b=x.useRef(null),N=x.useRef(null),[C,w]=x.useState(d.current.size??{width:Ne,height:ue}),[S,z]=x.useState(!1),[O,K]=x.useState(null),L=x.useRef(null),[V,he]=x.useState(!1),q=x.useRef(null),I=G.getInstance(),se=R();x.useEffect(()=>{if(i.x===-1&&i.y===-1){const T=window.innerWidth-C.width-16;u({x:T,y:16})}},[i,C.width]),x.useEffect(()=>{if(i.x===-1&&i.y===-1||m||S)return;const T=setTimeout(()=>{ie({position:i,size:C})},300);return()=>clearTimeout(T)},[i,C,m,S]),x.useEffect(()=>{ie({isOpen:t})},[t]);const Ke=x.useCallback(T=>{T.target.tagName!=="BUTTON"&&(k(!0),b.current={x:T.clientX,y:T.clientY,posX:i.x,posY:i.y},T.preventDefault())},[i]);x.useEffect(()=>{if(!m)return;const T=_=>{if(!b.current)return;const Y=_.clientX-b.current.x,X=_.clientY-b.current.y;let j=b.current.posX+Y,A=b.current.posY+X;const H=window.innerWidth-C.width,F=window.innerHeight-C.height;j=Math.max(0,Math.min(j,H)),A=Math.max(0,Math.min(A,F)),u({x:j,y:A})},D=()=>{k(!1),b.current=null};return document.addEventListener("mousemove",T),document.addEventListener("mouseup",D),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",D)}},[m,C.width,C.height]);const M=x.useCallback(T=>D=>{D.preventDefault(),D.stopPropagation(),z(!0),K(T),L.current={x:D.clientX,y:D.clientY,width:C.width,height:C.height,posX:i.x,posY:i.y}},[C,i]);x.useEffect(()=>{if(!S||!O)return;const T=_=>{if(!L.current)return;const Y=_.clientX-L.current.x,X=_.clientY-L.current.y;let j=L.current.width,A=L.current.height,H=L.current.posX,F=L.current.posY;if(O.includes("e")&&(j=Math.max(re,L.current.width+Y)),O.includes("w")){const B=Math.min(Y,L.current.width-re);j=L.current.width-B,H=L.current.posX+B}if(O.includes("s")&&(A=Math.max(ce,L.current.height+X)),O.includes("n")){const B=Math.min(X,L.current.height-ce);A=L.current.height-B,F=L.current.posY+B}j=Math.min(j,window.innerWidth-H),A=Math.min(A,window.innerHeight-F),H=Math.max(0,H),F=Math.max(0,F),w({width:j,height:A}),u({x:H,y:F})},D=()=>{z(!1),K(null),L.current=null};return document.addEventListener("mousemove",T),document.addEventListener("mouseup",D),()=>{document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",D)}},[S,O]);const qe=x.useCallback(()=>{V?(q.current&&(u(q.current.position),w(q.current.size)),he(!1)):(q.current={position:i,size:C},u({x:0,y:0}),w({width:window.innerWidth,height:window.innerHeight}),he(!0))},[V,i,C]),U=x.useCallback(()=>{I.isEnabled()&&(v(I.getState()),f(I.getActionHistory()),h(I.getCacheStats()),n(se.isConnected()))},[I,se]);x.useEffect(()=>{const T=D=>{D.ctrlKey&&D.shiftKey&&D.key==="G"&&(D.preventDefault(),s(_=>!_))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]),x.useEffect(()=>{if(!t||!I.isEnabled())return;U();const T=I.watchState("*",()=>{v(I.getState())}),D=I.watchActions(()=>{f(I.getActionHistory()),h(I.getCacheStats())}),_=setInterval(U,5e3);return()=>{T(),D(),clearInterval(_)}},[t,I,U]);const Ue=async()=>{try{const T=await se.dumpState();console.log("[G7DevTools] 상태 덤프 완료:",T),n(!0)}catch(T){console.error("[G7DevTools] 상태 덤프 실패:",T),n(!1)}};return I.isEnabled()?t?a?e.jsx("div",{className:"g7dt-minimized",children:e.jsxs("div",{className:"g7dt-minimized-content",children:[e.jsx("span",{className:"g7dt-font-bold g7dt-text-sm",children:"G7 DevTools"}),e.jsx("button",{onClick:()=>g(!1),className:"g7dt-btn g7dt-text-xs",title:"확장",children:"▲"}),e.jsx("button",{onClick:()=>s(!1),className:"g7dt-btn g7dt-text-xs",children:"✕"})]})}):e.jsxs("div",{ref:N,className:`g7dt-panel ${V?"maximized":""} ${S?"g7dt-resizing":""}`,style:{left:`${i.x>=0?i.x:0}px`,top:`${i.y>=0?i.y:0}px`,width:`${C.width}px`,height:`${C.height}px`},children:[!V&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-nw",onMouseDown:M("nw")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-ne",onMouseDown:M("ne")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-sw",onMouseDown:M("sw")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-corner g7dt-resize-se",onMouseDown:M("se")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-h g7dt-resize-n",onMouseDown:M("n")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-h g7dt-resize-s",onMouseDown:M("s")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-v g7dt-resize-w",onMouseDown:M("w")}),e.jsx("div",{className:"g7dt-resize-handle g7dt-resize-edge-v g7dt-resize-e",onMouseDown:M("e")})]}),e.jsxs("div",{className:`g7dt-header ${m?"dragging":""}`,onMouseDown:Ke,children:[e.jsxs("div",{className:"g7dt-header-left",children:[e.jsx("span",{className:"g7dt-header-title",children:"G7 DevTools"}),e.jsx("span",{className:`g7dt-header-badge ${y?"connected":""}`,title:y?"서버 덤프 성공":"서버에 덤프되지 않음 (덤프 버튼 클릭)",children:y?"덤프 완료":"로컬 모드"})]}),e.jsxs("div",{className:"g7dt-header-right",children:[e.jsx("button",{onClick:Ue,className:"g7dt-btn g7dt-btn-primary",title:"서버로 상태 덤프",children:"덤프"}),e.jsx("button",{onClick:U,className:"g7dt-btn",title:"새로고침",children:"↻"}),e.jsx("button",{onClick:qe,className:"g7dt-btn",title:V?"복원":"최대화",children:V?"❐":"□"}),e.jsx("button",{onClick:()=>g(!0),className:"g7dt-btn",title:"최소화",children:"▼"}),e.jsx("button",{onClick:()=>s(!1),className:"g7dt-btn",children:"✕"})]})]}),e.jsx("div",{className:"g7dt-tabs",children:Object.keys(le).map(T=>e.jsx("button",{onClick:()=>o(T),className:`g7dt-tab ${r===T?"active":""}`,children:le[T]},T))}),e.jsxs("div",{className:"g7dt-content",children:[r==="state"&&e.jsx(ke,{state:p,devTools:I}),r==="actions"&&e.jsx(Ce,{actions:l,devTools:I}),r==="cache"&&e.jsx(Se,{stats:c,devTools:I}),r==="diagnose"&&e.jsx(Ie,{}),r==="performance"&&e.jsx(Te,{devTools:I}),r==="lifecycle"&&e.jsx(De,{devTools:I}),r==="network"&&e.jsx(Le,{devTools:I}),r==="form"&&e.jsx(Ee,{devTools:I}),r==="conditional"&&e.jsx($e,{devTools:I}),r==="expression"&&e.jsx(ze,{devTools:I}),r==="handlers"&&e.jsx(_e,{devTools:I}),r==="events"&&e.jsx(je,{devTools:I}),r==="datasources"&&e.jsx(Ae,{devTools:I}),r==="renders"&&e.jsx(Oe,{devTools:I}),r==="styles"&&e.jsx(Me,{devTools:I}),r==="auth"&&e.jsx(Pe,{devTools:I}),r==="logs"&&e.jsx(He,{devTools:I}),r==="layout"&&e.jsx(Fe,{devTools:I}),r==="changedetection"&&e.jsx(We,{devTools:I}),r==="staleclosure"&&e.jsx(Ve,{devTools:I}),r==="nestedcontext"&&e.jsx(Be,{devTools:I}),r==="modalscope"&&e.jsx(Ge,{devTools:I}),r==="namedactions"&&e.jsx(Je,{devTools:I})]}),e.jsxs("div",{className:"g7dt-footer",children:[e.jsx("span",{children:"Ctrl+Shift+G 토글 | 헤더 드래그로 이동"}),e.jsxs("span",{children:["액션: ",l.length," | 캐시 히트율: ",(c.hitRate*100).toFixed(1),"%"]})]})]}):e.jsx("button",{onClick:()=>s(!0),className:"g7dt-floating-btn",title:"G7 DevTools (Ctrl+Shift+G)",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}):t?e.jsxs("div",{className:"g7dt-disabled-notice",children:[e.jsxs("div",{className:"g7dt-flex g7dt-items-center g7dt-justify-between g7dt-mb-2",children:[e.jsx("span",{className:"g7dt-font-bold g7dt-text-yellow",children:"G7 DevTools"}),e.jsx("button",{onClick:()=>s(!1),className:"g7dt-btn",children:"✕"})]}),e.jsx("p",{className:"g7dt-text-sm g7dt-text-gray",children:"DevTools가 비활성화되어 있습니다."}),e.jsx("p",{className:"g7dt-text-xs g7dt-text-gray-dark g7dt-mt-2",children:"환경설정 > 고급 설정 > 디버그 모드를 켜세요."})]}):null};if(typeof window<"u"){const d=window.G7Core||(window.G7Core={});if(d.__devtools={DiagnosticEngine:Z,getServerConnector:R,getStyleTracker:ae,DevToolsPanel:ge},typeof d.__onDevToolsReady=="function")try{d.__onDevToolsReady()}catch{}}$.DevToolsPanel=ge,$.DiagnosticEngine=Z,$.getServerConnector=R,$.getStyleTracker=ae,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})})(this.G7DevToolsBundle=this.G7DevToolsBundle||{},ReactJSXRuntime,React); +//# sourceMappingURL=devtools.min.js.map diff --git a/public/build/core/layout-editor.min.js b/public/build/core/layout-editor.min.js index 134f02b3..afea6728 100644 --- a/public/build/core/layout-editor.min.js +++ b/public/build/core/layout-editor.min.js @@ -11,3 +11,4 @@ var iM=Object.defineProperty;var sM=(dn,i,u)=>i in dn?iM(dn,i,{enumerable:!0,con Press space again to drop the item in its new position, or press escape to cancel. `},z7={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function M7(e){let{announcements:t=z7,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=N7}=e;const{announce:s,announcement:a}=A7(),l=ei("DndLiveRegion"),[d,c]=u.useState(!1);if(u.useEffect(()=>{c(!0)},[]),T7(u.useMemo(()=>({onDragStart(f){let{active:y}=f;s(t.onDragStart({active:y}))},onDragMove(f){let{active:y,over:g}=f;t.onDragMove&&s(t.onDragMove({active:y,over:g}))},onDragOver(f){let{active:y,over:g}=f;s(t.onDragOver({active:y,over:g}))},onDragEnd(f){let{active:y,over:g}=f;s(t.onDragEnd({active:y,over:g}))},onDragCancel(f){let{active:y,over:g}=f;s(t.onDragCancel({active:y,over:g}))}}),[s,t])),!d)return null;const p=u.createElement(u.Fragment,null,u.createElement(E7,{id:o,value:r.draggable}),u.createElement(I7,{id:l,announcement:a}));return n?Cn.createPortal(p,n):p}var it;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(it||(it={}));function oi(){}function L7(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function P7(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(o=>o!=null),[...t])}const Ht=Object.freeze({x:0,y:0});function O7(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function B7(e,t){const n=ni(e);if(!n)return"0 0";const o={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return o.x+"% "+o.y+"%"}function W7(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function j7(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function H7(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function F7(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function K7(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=r-o,l=s-n;if(o{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const r=[];for(const s of o){const{id:a}=s,l=n.get(a);if(l){const d=K7(l,t);d>0&&r.push({id:a,data:{droppableContainer:s,value:d}})}}return r.sort(j7)};function U7(e,t){const{top:n,left:o,bottom:r,right:s}=t;return n<=e.y&&e.y<=r&&o<=e.x&&e.x<=s}const q7=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:o}=e;if(!o)return[];const r=[];for(const s of t){const{id:a}=s,l=n.get(a);if(l&&U7(o,l)){const c=H7(l).reduce((f,y)=>f+O7(o,y),0),p=Number((c/4).toFixed(4));r.push({id:a,data:{droppableContainer:s,value:p}})}}return r.sort(W7)};function G7(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function jp(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ht}function Y7(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),s=1;s({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const X7=Y7(1);function Hp(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function J7(e,t,n){const o=Hp(t);if(!o)return e;const{scaleX:r,scaleY:s,x:a,y:l}=o,d=e.left-a-(1-r)*parseFloat(n),c=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),p=r?e.width/r:e.width,f=s?e.height/s:e.height;return{width:p,height:f,top:c,right:d+p,bottom:c+f,left:d}}const Z7={ignoreTransform:!1};function jo(e,t){t===void 0&&(t=Z7);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:p}=_t(e).getComputedStyle(e);c&&(n=J7(n,c,p))}const{top:o,left:r,width:s,height:a,bottom:l,right:d}=n;return{top:o,left:r,width:s,height:a,bottom:l,right:d}}function Fp(e){return jo(e,{ignoreTransform:!0})}function Q7(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function R7(e,t){return t===void 0&&(t=_t(e).getComputedStyle(e)),t.position==="fixed"}function e2(e,t){t===void 0&&(t=_t(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const s=t[r];return typeof s=="string"?n.test(s):!1})}function da(e,t){const n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(sa(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Po(r)||Pp(r)||n.includes(r))return n;const s=_t(e).getComputedStyle(r);return r!==e&&e2(r,s)&&n.push(r),R7(r,s)?n:o(r.parentNode)}return e?o(e):n}function Kp(e){const[t]=da(e,1);return t??null}function ca(e){return!Jr||!e?null:lo(e)?e:ia(e)?sa(e)||e===co(e).scrollingElement?window:Po(e)?e:null:null}function Vp(e){return lo(e)?e.scrollX:e.scrollLeft}function Up(e){return lo(e)?e.scrollY:e.scrollTop}function ua(e){return{x:Vp(e),y:Up(e)}}var lt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(lt||(lt={}));function qp(e){return!Jr||!e?!1:e===document.scrollingElement}function Gp(e){const t={x:0,y:0},n=qp(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=o.y,l=e.scrollLeft>=o.x;return{isTop:r,isLeft:s,isBottom:a,isRight:l,maxScroll:o,minScroll:t}}const t2={x:.2,y:.2};function n2(e,t,n,o,r){let{top:s,left:a,right:l,bottom:d}=n;o===void 0&&(o=10),r===void 0&&(r=t2);const{isTop:c,isBottom:p,isLeft:f,isRight:y}=Gp(e),g={x:0,y:0},m={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!c&&s<=t.top+h.height?(g.y=lt.Backward,m.y=o*Math.abs((t.top+h.height-s)/h.height)):!p&&d>=t.bottom-h.height&&(g.y=lt.Forward,m.y=o*Math.abs((t.bottom-h.height-d)/h.height)),!y&&l>=t.right-h.width?(g.x=lt.Forward,m.x=o*Math.abs((t.right-h.width-l)/h.width)):!f&&a<=t.left+h.width&&(g.x=lt.Backward,m.x=o*Math.abs((t.left+h.width-a)/h.width)),{direction:g,speed:m}}function o2(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Yp(e){return e.reduce((t,n)=>uo(t,ua(n)),Ht)}function r2(e){return e.reduce((t,n)=>t+Vp(n),0)}function i2(e){return e.reduce((t,n)=>t+Up(n),0)}function Xp(e,t){if(t===void 0&&(t=jo),!e)return;const{top:n,left:o,bottom:r,right:s}=t(e);Kp(e)&&(r<=0||s<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const s2=[["x",["left","right"],r2],["y",["top","bottom"],i2]];class pa{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=da(n),r=Yp(o);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,l]of s2)for(const d of a)Object.defineProperty(this,d,{get:()=>{const c=l(o),p=r[s]-c;return this.rect[d]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ho{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}}function a2(e){const{EventTarget:t}=_t(e);return e instanceof t?e:co(e)}function fa(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var At;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(At||(At={}));function Jp(e){e.preventDefault()}function l2(e){e.stopPropagation()}var Ke;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ke||(Ke={}));const Zp={start:[Ke.Space,Ke.Enter],cancel:[Ke.Esc],end:[Ke.Space,Ke.Enter,Ke.Tab]},d2=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ke.Right:return{...n,x:n.x+25};case Ke.Left:return{...n,x:n.x-25};case Ke.Down:return{...n,y:n.y+25};case Ke.Up:return{...n,y:n.y-25}}};class Qp{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ho(co(n)),this.windowListeners=new Ho(_t(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(At.Resize,this.handleCancel),this.windowListeners.add(At.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(At.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&Xp(o),n(Ht)}handleKeyDown(t){if(la(t)){const{active:n,context:o,options:r}=this.props,{keyboardCodes:s=Zp,coordinateGetter:a=d2,scrollBehavior:l="smooth"}=r,{code:d}=t;if(s.end.includes(d)){this.handleEnd(t);return}if(s.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:c}=o.current,p=c?{x:c.left,y:c.top}:Ht;this.referenceCoordinates||(this.referenceCoordinates=p);const f=a(t,{active:n,context:o.current,currentCoordinates:p});if(f){const y=ti(f,p),g={x:0,y:0},{scrollableAncestors:m}=o.current;for(const h of m){const v=t.code,{isTop:b,isRight:x,isLeft:k,isBottom:w,maxScroll:_,minScroll:S}=Gp(h),E=o2(h),C={x:Math.min(v===Ke.Right?E.right-E.width/2:E.right,Math.max(v===Ke.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(v===Ke.Down?E.bottom-E.height/2:E.bottom,Math.max(v===Ke.Down?E.top:E.top+E.height/2,f.y))},N=v===Ke.Right&&!x||v===Ke.Left&&!k,$=v===Ke.Down&&!w||v===Ke.Up&&!b;if(N&&C.x!==f.x){const A=h.scrollLeft+y.x,z=v===Ke.Right&&A<=_.x||v===Ke.Left&&A>=S.x;if(z&&!y.y){h.scrollTo({left:A,behavior:l});return}z?g.x=h.scrollLeft-A:g.x=v===Ke.Right?h.scrollLeft-_.x:h.scrollLeft-S.x,g.x&&h.scrollBy({left:-g.x,behavior:l});break}else if($&&C.y!==f.y){const A=h.scrollTop+y.y,z=v===Ke.Down&&A<=_.y||v===Ke.Up&&A>=S.y;if(z&&!y.x){h.scrollTo({top:A,behavior:l});return}z?g.y=h.scrollTop-A:g.y=v===Ke.Down?h.scrollTop-_.y:h.scrollTop-S.y,g.y&&h.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,uo(ti(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Qp.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=Zp,onActivation:r}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(o.start.includes(a)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function Rp(e){return!!(e&&"distance"in e)}function ef(e){return!!(e&&"delay"in e)}class ga{constructor(t,n,o){var r;o===void 0&&(o=a2(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=co(a),this.documentListeners=new Ho(this.document),this.listeners=new Ho(o),this.windowListeners=new Ho(_t(a)),this.initialCoordinates=(r=ni(s))!=null?r:Ht,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(At.Resize,this.handleCancel),this.windowListeners.add(At.DragStart,Jp),this.windowListeners.add(At.VisibilityChange,this.handleCancel),this.windowListeners.add(At.ContextMenu,Jp),this.documentListeners.add(At.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ef(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Rp(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(At.Click,l2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(At.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:o,initialCoordinates:r,props:s}=this,{onMove:a,options:{activationConstraint:l}}=s;if(!r)return;const d=(n=ni(t))!=null?n:Ht,c=ti(r,d);if(!o&&l){if(Rp(l)){if(l.tolerance!=null&&fa(c,l.tolerance))return this.handleCancel();if(fa(c,l.distance))return this.handleStart()}if(ef(l)&&fa(c,l.tolerance))return this.handleCancel();this.handlePending(l,c);return}t.cancelable&&t.preventDefault(),a(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ke.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const c2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ha extends ga{constructor(t){const{event:n}=t,o=co(n.target);super(t,c2,o)}}ha.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];const u2={move:{name:"mousemove"},end:{name:"mouseup"}};var ya;(function(e){e[e.RightClick=2]="RightClick"})(ya||(ya={}));class p2 extends ga{constructor(t){super(t,u2,co(t.event.target))}}p2.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===ya.RightClick?!1:(o?.({event:n}),!0)}}];const ba={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class f2 extends ga{constructor(t){super(t,ba)}static setup(){return window.addEventListener(ba.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ba.move.name,t)};function t(){}}}f2.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;const{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var Fo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Fo||(Fo={}));var ri;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ri||(ri={}));function g2(e){let{acceleration:t,activator:n=Fo.Pointer,canScroll:o,draggingRect:r,enabled:s,interval:a=5,order:l=ri.TreeOrder,pointerCoordinates:d,scrollableAncestors:c,scrollableAncestorRects:p,delta:f,threshold:y}=e;const g=y2({delta:f,disabled:!s}),[m,h]=w7(),v=u.useRef({x:0,y:0}),b=u.useRef({x:0,y:0}),x=u.useMemo(()=>{switch(n){case Fo.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Fo.DraggableRect:return r}},[n,r,d]),k=u.useRef(null),w=u.useCallback(()=>{const S=k.current;if(!S)return;const E=v.current.x*b.current.x,C=v.current.y*b.current.y;S.scrollBy(E,C)},[]),_=u.useMemo(()=>l===ri.TreeOrder?[...c].reverse():c,[l,c]);u.useEffect(()=>{if(!s||!c.length||!x){h();return}for(const S of _){if(o?.(S)===!1)continue;const E=c.indexOf(S),C=p[E];if(!C)continue;const{direction:N,speed:$}=n2(S,C,x,t,y);for(const A of["x","y"])g[A][N[A]]||($[A]=0,N[A]=0);if($.x>0||$.y>0){h(),k.current=S,m(w,a),v.current=$,b.current=N;return}}v.current={x:0,y:0},b.current={x:0,y:0},h()},[t,w,o,h,s,a,JSON.stringify(x),JSON.stringify(g),m,c,_,p,JSON.stringify(y)])}const h2={x:{[lt.Backward]:!1,[lt.Forward]:!1},y:{[lt.Backward]:!1,[lt.Forward]:!1}};function y2(e){let{delta:t,disabled:n}=e;const o=Rr(t);return Bo(r=>{if(n||!o||!r)return h2;const s={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[lt.Backward]:r.x[lt.Backward]||s.x===-1,[lt.Forward]:r.x[lt.Forward]||s.x===1},y:{[lt.Backward]:r.y[lt.Backward]||s.y===-1,[lt.Forward]:r.y[lt.Forward]||s.y===1}}},[n,t,o])}function b2(e,t){const n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Bo(r=>{var s;return t==null?null:(s=o??r)!=null?s:null},[o,t])}function m2(e,t){return u.useMemo(()=>e.reduce((n,o)=>{const{sensor:r}=o,s=r.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,o)}));return[...n,...s]},[]),[e,t])}var Ko;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ko||(Ko={}));var ma;(function(e){e.Optimized="optimized"})(ma||(ma={}));const tf=new Map;function v2(e,t){let{dragging:n,dependencies:o,config:r}=t;const[s,a]=u.useState(null),{frequency:l,measure:d,strategy:c}=r,p=u.useRef(e),f=v(),y=Oo(f),g=u.useCallback(function(b){b===void 0&&(b=[]),!y.current&&a(x=>x===null?b:x.concat(b.filter(k=>!x.includes(k))))},[y]),m=u.useRef(null),h=Bo(b=>{if(f&&!n)return tf;if(!b||b===tf||p.current!==e||s!=null){const x=new Map;for(let k of e){if(!k)continue;if(s&&s.length>0&&!s.includes(k.id)&&k.rect.current){x.set(k.id,k.rect.current);continue}const w=k.node.current,_=w?new pa(d(w),w):null;k.rect.current=_,_&&x.set(k.id,_)}return x}return b},[e,s,n,f,d]);return u.useEffect(()=>{p.current=e},[e]),u.useEffect(()=>{f||g()},[n,f]),u.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),u.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},l))},[l,f,g,...o]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:s!=null};function v(){switch(c){case Ko.Always:return!1;case Ko.BeforeDragging:return n;default:return!n}}}function va(e,t){return Bo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function _2(e,t){return va(e,t)}function x2(e){let{callback:t,disabled:n}=e;const o=Zr(t),r=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(o)},[o,n]);return u.useEffect(()=>()=>r?.disconnect(),[r]),r}function ii(e){let{callback:t,disabled:n}=e;const o=Zr(t),r=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(o)},[n]);return u.useEffect(()=>()=>r?.disconnect(),[r]),r}function w2(e){return new pa(jo(e),e)}function nf(e,t,n){t===void 0&&(t=w2);const[o,r]=u.useState(null);function s(){r(d=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=d??n)!=null?c:null}const p=t(e);return JSON.stringify(d)===JSON.stringify(p)?d:p})}const a=x2({callback(d){if(e)for(const c of d){const{type:p,target:f}=c;if(p==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=ii({callback:s});return sn(()=>{s(),e?(l?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[e]),o}function k2(e){const t=va(e);return jp(e,t)}const of=[];function S2(e){const t=u.useRef(e),n=Bo(o=>e?o&&o!==of&&e&&t.current&&e.parentNode===t.current.parentNode?o:da(e):of,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function C2(e){const[t,n]=u.useState(null),o=u.useRef(e),r=u.useCallback(s=>{const a=ca(s.target);a&&n(l=>l?(l.set(a,ua(a)),new Map(l)):null)},[]);return u.useEffect(()=>{const s=o.current;if(e!==s){a(s);const l=e.map(d=>{const c=ca(d);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,ua(c)]):null}).filter(d=>d!=null);n(l.length?new Map(l):null),o.current=e}return()=>{a(e),a(s)};function a(l){l.forEach(d=>{const c=ca(d);c?.removeEventListener("scroll",r)})}},[r,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>uo(s,a),Ht):Yp(e):Ht,[e,t])}function rf(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const o=e!==Ht;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ti(e,n.current):Ht}function $2(e){u.useEffect(()=>{if(!Jr)return;const t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function E2(e,t){return u.useMemo(()=>e.reduce((n,o)=>{let{eventName:r,handler:s}=o;return n[r]=a=>{s(a,t)},n},{}),[e,t])}function sf(e){return u.useMemo(()=>e?Q7(e):null,[e])}const af=[];function I2(e,t){t===void 0&&(t=jo);const[n]=e,o=sf(n?_t(n):null),[r,s]=u.useState(af);function a(){s(()=>e.length?e.map(d=>qp(d)?o:new pa(t(d),d)):af)}const l=ii({callback:a});return sn(()=>{l?.disconnect(),a(),e.forEach(d=>l?.observe(d))},[e]),r}function lf(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Po(t)?t:e}function A2(e){let{measure:t}=e;const[n,o]=u.useState(null),r=u.useCallback(c=>{for(const{target:p}of c)if(Po(p)){o(f=>{const y=t(p);return f?{...f,width:y.width,height:y.height}:y});break}},[t]),s=ii({callback:r}),a=u.useCallback(c=>{const p=lf(c);s?.disconnect(),p&&s?.observe(p),o(p?t(p):null)},[t,s]),[l,d]=Qr(a);return u.useMemo(()=>({nodeRef:l,rect:n,setRef:d}),[n,l,d])}const T2=[{sensor:ha,options:{}},{sensor:Qp,options:{}}],D2={current:{}},si={draggable:{measure:Fp},droppable:{measure:Fp,strategy:Ko.WhileDragging,frequency:ma.Optimized},dragOverlay:{measure:jo}};class Vo extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}}const N2={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:oi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:si,measureDroppableContainers:oi,windowRect:null,measuringScheduled:!1},df={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:oi,draggableNodes:new Map,over:null,measureDroppableContainers:oi},Uo=u.createContext(df),cf=u.createContext(N2);function z2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vo}}}function M2(e,t){switch(t.type){case it.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case it.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case it.DragEnd:case it.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case it.RegisterDroppable:{const{element:n}=t,{id:o}=n,r=new Vo(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case it.SetDroppableDisabled:{const{id:n,key:o,disabled:r}=t,s=e.droppable.containers.get(n);if(!s||o!==s.key)return e;const a=new Vo(e.droppable.containers);return a.set(n,{...s,disabled:r}),{...e,droppable:{...e.droppable,containers:a}}}case it.UnregisterDroppable:{const{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;const s=new Vo(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function L2(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:r}=u.useContext(Uo),s=Rr(o),a=Rr(n?.id);return u.useEffect(()=>{if(!t&&!o&&s&&a!=null){if(!la(s)||document.activeElement===s.target)return;const l=r.get(a);if(!l)return;const{activatorNode:d,node:c}=l;if(!d.current&&!c.current)return;requestAnimationFrame(()=>{for(const p of[d.current,c.current]){if(!p)continue;const f=C7(p);if(f){f.focus();break}}})}},[o,t,r,a,s]),null}function uf(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,s)=>s({transform:r,...o}),n):n}function P2(e){return u.useMemo(()=>({draggable:{...si.draggable,...e?.draggable},droppable:{...si.droppable,...e?.droppable},dragOverlay:{...si.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function O2(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e;const s=u.useRef(!1),{x:a,y:l}=typeof r=="boolean"?{x:r,y:r}:r;sn(()=>{if(!a&&!l||!t){s.current=!1;return}if(s.current||!o)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const p=n(c),f=jp(p,o);if(a||(f.x=0),l||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const y=Kp(c);y&&y.scrollBy({top:f.y,left:f.x})}},[t,a,l,o,n])}const ai=u.createContext({...Ht,scaleX:1,scaleY:1});var hn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(hn||(hn={}));const B2=u.memo(function(t){var n,o,r,s;let{id:a,accessibility:l,autoScroll:d=!0,children:c,sensors:p=T2,collisionDetection:f=V7,measuring:y,modifiers:g,...m}=t;const h=u.useReducer(M2,void 0,z2),[v,b]=h,[x,k]=D7(),[w,_]=u.useState(hn.Uninitialized),S=w===hn.Initialized,{draggable:{active:E,nodes:C,translate:N},droppable:{containers:$}}=v,A=E!=null?C.get(E):null,z=u.useRef({initial:null,translated:null}),D=u.useMemo(()=>{var J;return E!=null?{id:E,data:(J=A?.data)!=null?J:D2,rect:z}:null},[E,A]),O=u.useRef(null),[M,B]=u.useState(null),[T,H]=u.useState(null),L=Oo(m,Object.values(m)),I=ei("DndDescribedBy",a),P=u.useMemo(()=>$.getEnabled(),[$]),F=P2(y),{droppableRects:G,measureDroppableContainers:V,measuringScheduled:Y}=v2(P,{dragging:S,dependencies:[N.x,N.y],config:F.droppable}),Z=b2(C,E),se=u.useMemo(()=>T?ni(T):null,[T]),re=ue(),U=_2(Z,F.draggable.measure);O2({activeNode:E!=null?C.get(E):null,config:re.layoutShiftCompensation,initialRect:U,measure:F.draggable.measure});const ee=nf(Z,F.draggable.measure,U),fe=nf(Z?Z.parentElement:null),K=u.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:$,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=$.getNodeFor((n=K.current.over)==null?void 0:n.id),me=A2({measure:F.dragOverlay.measure}),Ce=(o=me.nodeRef.current)!=null?o:Z,ze=S?(r=me.rect)!=null?r:ee:null,Se=!!(me.nodeRef.current&&me.rect),qe=k2(Se?null:ee),De=sf(Ce?_t(Ce):null),Pe=S2(S?ne??Z:null),Qe=I2(Pe),Me=uf(g,{transform:{x:N.x-qe.x,y:N.y-qe.y,scaleX:1,scaleY:1},activatorEvent:T,active:D,activeNodeRect:ee,containerNodeRect:fe,draggingNodeRect:ze,over:K.current.over,overlayNodeRect:me.rect,scrollableAncestors:Pe,scrollableAncestorRects:Qe,windowRect:De}),Re=se?uo(se,N):null,ve=C2(Pe),te=rf(ve),he=rf(ve,[ee]),Q=uo(Me,te),ie=ze?X7(ze,Me):null,_e=D&&ie?f({active:D,collisionRect:ie,droppableRects:G,droppableContainers:P,pointerCoordinates:Re}):null,ge=F7(_e,"id"),[Ae,Ne]=u.useState(null),Le=Se?Me:uo(Me,he),q=G7(Le,(s=Ae?.rect)!=null?s:null,ee),ae=u.useRef(null),pe=u.useCallback((J,le)=>{let{sensor:Ie,options:dt}=le;if(O.current==null)return;const pt=C.get(O.current);if(!pt)return;const ot=J.nativeEvent,Oe=new Ie({active:O.current,activeNode:pt,event:ot,options:dt,context:K,onAbort(Ye){if(!C.get(Ye))return;const{onDragAbort:Dt}=L.current,Nt={id:Ye};Dt?.(Nt),x({type:"onDragAbort",event:Nt})},onPending(Ye,Tt,Dt,Nt){if(!C.get(Ye))return;const{onDragPending:wn}=L.current,Zt={id:Ye,constraint:Tt,initialCoordinates:Dt,offset:Nt};wn?.(Zt),x({type:"onDragPending",event:Zt})},onStart(Ye){const Tt=O.current;if(Tt==null)return;const Dt=C.get(Tt);if(!Dt)return;const{onDragStart:Nt}=L.current,xn={activatorEvent:ot,active:{id:Tt,data:Dt.data,rect:z}};Cn.unstable_batchedUpdates(()=>{Nt?.(xn),_(hn.Initializing),b({type:it.DragStart,initialCoordinates:Ye,active:Tt}),x({type:"onDragStart",event:xn}),B(ae.current),H(ot)})},onMove(Ye){b({type:it.DragMove,coordinates:Ye})},onEnd:He(it.DragEnd),onCancel:He(it.DragCancel)});ae.current=Oe;function He(Ye){return async function(){const{active:Dt,collisions:Nt,over:xn,scrollAdjustedTranslate:wn}=K.current;let Zt=null;if(Dt&&wn){const{cancelDrop:Hn}=L.current;Zt={activatorEvent:ot,active:Dt,collisions:Nt,delta:wn,over:xn},Ye===it.DragEnd&&typeof Hn=="function"&&await Promise.resolve(Hn(Zt))&&(Ye=it.DragCancel)}O.current=null,Cn.unstable_batchedUpdates(()=>{b({type:Ye}),_(hn.Uninitialized),Ne(null),B(null),H(null),ae.current=null;const Hn=Ye===it.DragEnd?"onDragEnd":"onDragCancel";if(Zt){const ln=L.current[Hn];ln?.(Zt),x({type:Hn,event:Zt})}})}}},[C]),$e=u.useCallback((J,le)=>(Ie,dt)=>{const pt=Ie.nativeEvent,ot=C.get(dt);if(O.current!==null||!ot||pt.dndKit||pt.defaultPrevented)return;const Oe={active:ot};J(Ie,le.options,Oe)===!0&&(pt.dndKit={capturedBy:le.sensor},O.current=dt,pe(Ie,le))},[C,pe]),be=m2(p,$e);$2(p),sn(()=>{ee&&w===hn.Initializing&&_(hn.Initialized)},[ee,w]),u.useEffect(()=>{const{onDragMove:J}=L.current,{active:le,activatorEvent:Ie,collisions:dt,over:pt}=K.current;if(!le||!Ie)return;const ot={active:le,activatorEvent:Ie,collisions:dt,delta:{x:Q.x,y:Q.y},over:pt};Cn.unstable_batchedUpdates(()=>{J?.(ot),x({type:"onDragMove",event:ot})})},[Q.x,Q.y]),u.useEffect(()=>{const{active:J,activatorEvent:le,collisions:Ie,droppableContainers:dt,scrollAdjustedTranslate:pt}=K.current;if(!J||O.current==null||!le||!pt)return;const{onDragOver:ot}=L.current,Oe=dt.get(ge),He=Oe&&Oe.rect.current?{id:Oe.id,rect:Oe.rect.current,data:Oe.data,disabled:Oe.disabled}:null,Ye={active:J,activatorEvent:le,collisions:Ie,delta:{x:pt.x,y:pt.y},over:He};Cn.unstable_batchedUpdates(()=>{Ne(He),ot?.(Ye),x({type:"onDragOver",event:Ye})})},[ge]),sn(()=>{K.current={activatorEvent:T,active:D,activeNode:Z,collisionRect:ie,collisions:_e,droppableRects:G,draggableNodes:C,draggingNode:Ce,draggingNodeRect:ze,droppableContainers:$,over:Ae,scrollableAncestors:Pe,scrollAdjustedTranslate:Q},z.current={initial:ze,translated:ie}},[D,Z,_e,ie,C,Ce,ze,G,$,Ae,Pe,Q]),g2({...re,delta:N,draggingRect:ie,pointerCoordinates:Re,scrollableAncestors:Pe,scrollableAncestorRects:Qe});const j=u.useMemo(()=>({active:D,activeNode:Z,activeNodeRect:ee,activatorEvent:T,collisions:_e,containerNodeRect:fe,dragOverlay:me,draggableNodes:C,droppableContainers:$,droppableRects:G,over:Ae,measureDroppableContainers:V,scrollableAncestors:Pe,scrollableAncestorRects:Qe,measuringConfiguration:F,measuringScheduled:Y,windowRect:De}),[D,Z,ee,T,_e,fe,me,C,$,G,Ae,V,Pe,Qe,F,Y,De]),oe=u.useMemo(()=>({activatorEvent:T,activators:be,active:D,activeNodeRect:ee,ariaDescribedById:{draggable:I},dispatch:b,draggableNodes:C,over:Ae,measureDroppableContainers:V}),[T,be,D,ee,b,I,C,Ae,V]);return u.createElement(Wp.Provider,{value:k},u.createElement(Uo.Provider,{value:oe},u.createElement(cf.Provider,{value:j},u.createElement(ai.Provider,{value:q},c)),u.createElement(L2,{disabled:l?.restoreFocus===!1})),u.createElement(M7,{...l,hiddenTextDescribedById:I}));function ue(){const J=M?.autoScrollEnabled===!1,le=typeof d=="object"?d.enabled===!1:d===!1,Ie=S&&!J&&!le;return typeof d=="object"?{...d,enabled:Ie}:{enabled:Ie}}}),W2=u.createContext(null),pf="button",j2="Draggable";function H2(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e;const s=ei(j2),{activators:a,activatorEvent:l,active:d,activeNodeRect:c,ariaDescribedById:p,draggableNodes:f,over:y}=u.useContext(Uo),{role:g=pf,roleDescription:m="draggable",tabIndex:h=0}=r??{},v=d?.id===t,b=u.useContext(v?ai:W2),[x,k]=Qr(),[w,_]=Qr(),S=E2(a,t),E=Oo(n);sn(()=>(f.set(t,{id:t,key:s,node:x,activatorNode:w,data:E}),()=>{const N=f.get(t);N&&N.key===s&&f.delete(t)}),[f,t]);const C=u.useMemo(()=>({role:g,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&g===pf?!0:void 0,"aria-roledescription":m,"aria-describedby":p.draggable}),[o,g,h,v,m,p.draggable]);return{active:d,activatorEvent:l,activeNodeRect:c,attributes:C,isDragging:v,listeners:o?void 0:S,node:x,over:y,setNodeRef:k,setActivatorNodeRef:_,transform:b}}function F2(){return u.useContext(cf)}const K2="Droppable",V2={timeout:25};function U2(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e;const s=ei(K2),{active:a,dispatch:l,over:d,measureDroppableContainers:c}=u.useContext(Uo),p=u.useRef({disabled:n}),f=u.useRef(!1),y=u.useRef(null),g=u.useRef(null),{disabled:m,updateMeasurementsFor:h,timeout:v}={...V2,...r},b=Oo(h??o),x=u.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},v)},[v]),k=ii({callback:x,disabled:m||!a}),w=u.useCallback((C,N)=>{k&&(N&&(k.unobserve(N),f.current=!1),C&&k.observe(C))},[k]),[_,S]=Qr(w),E=Oo(t);return u.useEffect(()=>{!k||!_.current||(k.disconnect(),f.current=!1,k.observe(_.current))},[_,k]),u.useEffect(()=>(l({type:it.RegisterDroppable,element:{id:o,key:s,disabled:n,node:_,rect:y,data:E}}),()=>l({type:it.UnregisterDroppable,key:s,id:o})),[o]),u.useEffect(()=>{n!==p.current.disabled&&(l({type:it.SetDroppableDisabled,id:o,key:s,disabled:n}),p.current.disabled=n)},[o,s,n,l]),{active:a,rect:y,isOver:d?.id===o,node:_,over:d,setNodeRef:S}}function q2(e){let{animation:t,children:n}=e;const[o,r]=u.useState(null),[s,a]=u.useState(null),l=Rr(n);return!n&&!o&&l&&r(l),sn(()=>{if(!s)return;const d=o?.key,c=o?.props.id;if(d==null||c==null){r(null);return}Promise.resolve(t(c,s)).then(()=>{r(null)})},[t,o,s]),u.createElement(u.Fragment,null,n,o?u.cloneElement(o,{ref:a}):null)}const G2={x:0,y:0,scaleX:1,scaleY:1};function Y2(e){let{children:t}=e;return u.createElement(Uo.Provider,{value:df},u.createElement(ai.Provider,{value:G2},t))}const X2={position:"fixed",touchAction:"none"},J2=e=>la(e)?"transform 250ms ease":void 0,Z2=u.forwardRef((e,t)=>{let{as:n,activatorEvent:o,adjustScale:r,children:s,className:a,rect:l,style:d,transform:c,transition:p=J2}=e;if(!l)return null;const f=r?c:{...c,scaleX:1,scaleY:1},y={...X2,width:l.width,height:l.height,top:l.top,left:l.left,transform:Wo.Transform.toString(f),transformOrigin:r&&o?B7(o,l):void 0,transition:typeof p=="function"?p(o):p,...d};return u.createElement(n,{className:a,style:y,ref:t},s)}),Q2={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Wo.Transform.toString(t)},{transform:Wo.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:o}=t;const r={},{styles:s,className:a}=e;if(s!=null&&s.active)for(const[l,d]of Object.entries(s.active))d!==void 0&&(r[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,d));if(s!=null&&s.dragOverlay)for(const[l,d]of Object.entries(s.dragOverlay))d!==void 0&&o.node.style.setProperty(l,d);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&o.node.classList.add(a.dragOverlay),function(){for(const[d,c]of Object.entries(r))n.node.style.setProperty(d,c);a!=null&&a.active&&n.node.classList.remove(a.active)}})({styles:{active:{opacity:"0"}}})};function R2(e){let{config:t,draggableNodes:n,droppableContainers:o,measuringConfiguration:r}=e;return Zr((s,a)=>{if(t===null)return;const l=n.get(s);if(!l)return;const d=l.node.current;if(!d)return;const c=lf(a);if(!c)return;const{transform:p}=_t(a).getComputedStyle(a),f=Hp(p);if(!f)return;const y=typeof t=="function"?t:eI(t);return Xp(d,r.draggable.measure),y({active:{id:s,data:l.data,node:d,rect:r.draggable.measure(d)},draggableNodes:n,dragOverlay:{node:a,rect:r.dragOverlay.measure(c)},droppableContainers:o,measuringConfiguration:r,transform:f})})}function eI(e){const{duration:t,easing:n,sideEffects:o,keyframes:r}={...Q2,...e};return s=>{let{active:a,dragOverlay:l,transform:d,...c}=s;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},f={scaleX:d.scaleX!==1?a.rect.width*d.scaleX/l.rect.width:1,scaleY:d.scaleY!==1?a.rect.height*d.scaleY/l.rect.height:1},y={x:d.x-p.x,y:d.y-p.y,...f},g=r({...c,active:a,dragOverlay:l,transform:{initial:d,final:y}}),[m]=g,h=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(h))return;const v=o?.({active:a,dragOverlay:l,...c}),b=l.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(x=>{b.onfinish=()=>{v?.(),x()}})}}let ff=0;function tI(e){return u.useMemo(()=>{if(e!=null)return ff++,ff},[e])}const nI=u.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:o,style:r,transition:s,modifiers:a,wrapperElement:l="div",className:d,zIndex:c=999}=e;const{activatorEvent:p,active:f,activeNodeRect:y,containerNodeRect:g,draggableNodes:m,droppableContainers:h,dragOverlay:v,over:b,measuringConfiguration:x,scrollableAncestors:k,scrollableAncestorRects:w,windowRect:_}=F2(),S=u.useContext(ai),E=tI(f?.id),C=uf(a,{activatorEvent:p,active:f,activeNodeRect:y,containerNodeRect:g,draggingNodeRect:v.rect,over:b,overlayNodeRect:v.rect,scrollableAncestors:k,scrollableAncestorRects:w,transform:S,windowRect:_}),N=va(y),$=R2({config:o,draggableNodes:m,droppableContainers:h,measuringConfiguration:x}),A=N?v.setRef:void 0;return u.createElement(Y2,null,u.createElement(q2,{animation:$},f&&E?u.createElement(Z2,{key:E,id:f.id,ref:A,as:l,activatorEvent:p,adjustScale:t,className:d,transition:s,rect:N,style:{zIndex:c,...r},transform:C},n):null))});function qo(e,t){return!t||!Array.isArray(t.draggable)?!1:t.draggable.includes(e)}function oI({draggedComponentName:e,targetContainerName:t,nesting:n}){if(!n||!qo(e,n))return!1;const o=n.containers;if(!o||typeof o!="object")return!1;const r=o[t];return!r||!Array.isArray(r.accepts)?!1:r.accepts.includes(e)}function gf(e,t){if(!t?.containers)return!1;const n=t.containers[e];return!!(n&&Array.isArray(n.accepts)&&n.accepts.length>0)}function rI(e,t,n,o,r){if(!n||n.length===0)return{parentPath:[],index:r};if(e&&gf(e,o))return{parentPath:n,index:t};const s=n.slice(0,-1),a=n[n.length-1]??0;return{parentPath:s,index:a+1}}function hf(e,t){return e===t||e.startsWith(`${t}.`)}function yf(e,t){if(e==="")return/^\d+$/.test(t)?Number(t):null;const n=`${e}.children.`;if(!t.startsWith(n))return null;const o=t.slice(n.length);return/^\d+$/.test(o)?Number(o):null}function iI(e,t){const n=[];return e.querySelectorAll("[data-editor-path]").forEach(o=>{if(o.hasAttribute("data-dnd-placeholder")||o.closest("[data-dnd-placeholder]"))return;const r=o.dataset.editorPath;typeof r=="string"&&n.push({path:t(r),domPath:r,rect:o.getBoundingClientRect()})}),n}const sI=16;function aI(e){const{frameEl:t,draggedPath:n,acceptsContainer:o,allowsNestSlot:r,includeContainer:s}=e,a=e.normalizeContainerPath??(g=>g),l=t.getBoundingClientRect(),d=iI(t,a),c=new Map;for(const g of d)c.has(g.path)||c.set(g.path,g.domPath);const p=a(n),f=new Set([""]);for(const g of d){const m=dI(g.path);m!==null&&f.add(m)}for(const g of d)f.add(g.path);const y=[];for(const g of f){const m=g==="",h=m?null:c.get(g)??g,v=m?t:t.querySelector(`[data-editor-path="${vf(h)}"]`);if(!v&&!m||!m&&hf(g,p))continue;const b=g;if(!m&&s&&!s(b))continue;const x=S=>{const E=c.get(S);if(!E||typeof window>"u")return!1;const C=t.querySelector(`[data-editor-path="${vf(E)}"]`);return C?(window.getComputedStyle(C).display??"").toLowerCase()==="contents":!1},k=d.filter(S=>yf(g,S.path)!==null).filter(S=>!hf(S.path,p)).filter(S=>!x(S.path)).map(S=>({origIndex:yf(g,S.path),rect:lI(S.rect,S.path,d)})).filter(S=>S.rect.width>0||S.rect.height>0).sort((S,E)=>S.origIndex-E.origIndex),w=Ip(m?t:v).kind,_=w==="flex_row_single"||w==="flex_row_wrap"||w==="grid_single_row"||w==="grid_2d";if(k.length>0){if(o(b)){k.forEach(E=>{y.push(bf(b,E.origIndex,E.rect,l,_,"before"))});const S=k[k.length-1];y.push(bf(b,S.origIndex+1,S.rect,l,_,"after"))}}else if(!m&&r(b)&&v){const S=v.getBoundingClientRect();S.width>0&&S.height>0&&y.push({id:`slot:${b}:0`,kind:"nest",containerPath:b,index:0,box:mf(S,l),orientation:"area"})}else m&&y.push({id:"slot::0",kind:"gap",containerPath:"",index:0,box:mf(l,l),orientation:"area"})}return y.filter(g=>ao(g.box,t))}function bf(e,t,n,o,r,s){const a=sI;let l;if(r)l={left:(s==="before"?n.left:n.right)-a/2,top:n.top,width:a,height:n.height};else{const d=s==="before"?n.top:n.bottom;l={left:n.left,top:d-a/2,width:n.width,height:a}}return{id:`slot:${e}:${t}`,kind:"gap",containerPath:e,index:t,box:{left:l.left-o.left,top:l.top-o.top,width:l.width,height:l.height,scale:1},orientation:r?"vertical":"horizontal"}}function lI(e,t,n){if(e.width>0||e.height>0)return e;const o=`${t}.children.`;let r=1/0,s=1/0,a=-1/0,l=-1/0;for(const d of n)d.path.startsWith(o)&&(d.rect.width===0&&d.rect.height===0||(r=Math.min(r,d.rect.left),s=Math.min(s,d.rect.top),a=Math.max(a,d.rect.right),l=Math.max(l,d.rect.bottom)));return r===1/0?e:{left:r,top:s,width:a-r,height:l-s,right:a,bottom:l,x:r,y:s,toJSON:()=>({})}}function mf(e,t){return{left:e.left-t.left,top:e.top-t.top,width:e.width,height:e.height,scale:1}}function dI(e){if(e==="")return null;const t=e.lastIndexOf(".children.");return t<0?"":e.slice(0,t)}function cI(e){if(!e.startsWith("slot:"))return null;const t=e.slice(5),n=t.lastIndexOf(":");if(n<0)return null;const o=t.slice(0,n),r=Number(t.slice(n+1));return Number.isFinite(r)?{containerPath:o,index:r}:null}function vf(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[^a-zA-Z0-9_\-.]/g,t=>`\\${t}`)}function _a(e){return typeof e=="string"&&e.length>0?e:null}function xa(e,t){return t&&e.startsWith(`${t}.`)?t:e}function _f(e){if(typeof e!="string")return null;const t=cI(e);return t?{containerPath:t.containerPath,index:t.index}:null}function wa(e,t){return t?e.startsWith(`${t}.iteration.`):!1}function ka(e,t,n){return t?n==="iteration_item"?wa(e,t):e===t||e.startsWith(`${t}.`):!1}function uI(e){const{frameEl:t,nesting:n,editMode:o,currentExtensionId:r,editableRootPath:s,components:a,patchLayout:l,pushHistory:d,onMovePath:c,selectedPath:p,showBranchBoundaryHint:f}=e,y=(o==="iteration_item"||o==="modal")&&s&&s.length>0?at(s):null,[g,m]=u.useState(null),[h,v]=u.useState(null),[b,x]=u.useState(null),k=u.useRef({components:a,nesting:n,editMode:o,currentExtensionId:r,selectedPath:p,editableRootSourcePath:y});k.current={components:a,nesting:n,editMode:o,currentExtensionId:r,selectedPath:p,editableRootSourcePath:y};const w=u.useRef(null),_=u.useCallback(M=>({children:M}),[]),S=u.useCallback((M,B)=>{const T=We(_(M),B);return T?typeof T.name=="string"?T.name:typeof T.type=="string"?T.type:null:null},[_]),E=u.useCallback(M=>B=>{const T=k.current;if(B==="")return qo(M,T.nesting);const H=Ze(B),L=We(_(T.components),H);if(!L)return!1;const I=typeof L.name=="string"?L.name:typeof L.type=="string"?L.type:"";if(!I)return!1;const P=!!T.editableRootSourcePath&&(B===T.editableRootSourcePath||B.startsWith(`${T.editableRootSourcePath}.`));if(T.editableRootSourcePath&&!P)return!1;if(!P){const F=Sa(_(T.components),H);if(gn(L,T.editMode,T.currentExtensionId,F)!=="none")return!1}return gf(I,T.nesting)?oI({draggedComponentName:M,targetContainerName:I,nesting:T.nesting}):!1},[_]),C=u.useCallback(M=>{if(M==="")return!0;const B=k.current,T=Ze(M),H=w.current;if(H&&H.length>0){const P=H.slice(0,-1);if(li(T,P))return!0}const L=We(_(B.components),T);return L?(typeof L.name=="string"?L.name:typeof L.type=="string"?L.type:"").length>0:!1},[_]),N=u.useCallback(M=>{const B=E(M),T=k.current,H=w.current,L=H?H.slice(0,-1):null,I=new Set;if(L)for(let V=L.length;V>=0;V--)I.add(di(L.slice(0,V)));const P=di(H??[]),F=V=>!!H&&(V===P||V.startsWith(`${P}.`)),G=(V,Y)=>{for(let Z=0;ZV===""?!0:F(V)?!1:I.has(V),allowsNestSlot:V=>{if(!B(V))return!1;if(L){const Y=Ze(V);if(li(Y,L))return!1}return C(V)}}},[E,C,_]),$=u.useCallback(M=>{const B=_a(M.active.id),T=k.current;if(!B)return;const H=xa(B,T.selectedPath),L=Ze(H),I=We(_(T.components),L),P=I&&typeof I.name=="string"?I.name:I&&typeof I.type=="string"?I.type:null;m(H),v(P),x(null),w.current=I?L:null;let F="allowed";if(!P||!qo(P,T.nesting))F="denied_no_draggable";else if(I){const G=Sa(_(T.components),L),V=gn(I,T.editMode,T.currentExtensionId,G);T.editableRootSourcePath&&!ka(H,T.editableRootSourcePath,T.editMode)||Xi(G)&&!wa(H,T.editableRootSourcePath)?F="denied_data_bound":V==="base"||V==="partial"?F="denied_base_locked":(V==="extension"||V==="extension_point")&&(F="denied_extension_locked")}$n({source:"drag",draggedComponentName:P,targetContainerName:null,targetContainerPath:null,decision:F,result:F==="allowed"?"completed":"denied",timestamp:Date.now()})},[_]),A=u.useCallback(M=>{if(!t)return;const B=_a(M.active.id);if(!B)return;const T=h;if(!T){x(null);return}const H=k.current,L=xa(B,H.selectedPath),I=Ze(L),P=We(_(H.components),I);if(!P||!qo(T,H.nesting)){x(null);return}const F=Sa(_(H.components),I);if(H.editableRootSourcePath&&!ka(L,H.editableRootSourcePath,H.editMode)){x(null);return}const G=gn(P,H.editMode,H.currentExtensionId,F),V=wa(L,H.editableRootSourcePath);if(Xi(F)&&!V||G!=="none"&&G!=="data_bound"&&!V){x(null);return}x(_f(M.over?.id))},[t,h,_]),z=u.useCallback(()=>{m(null),v(null),x(null),w.current=null},[]),D=u.useCallback(M=>{const B=_a(M.active.id),T=h,H=k.current,L=B?xa(B,H.selectedPath):null;if(!t||!L||!T){z();return}const I=_f(M.over?.id),P=Ze(L);if(!I){$n({source:"drag",draggedComponentName:T,targetContainerName:null,targetContainerPath:null,decision:"denied_no_accepts",result:"cancelled",timestamp:Date.now()}),z();return}const F=I.containerPath===""?[]:Ze(I.containerPath),G=I.containerPath===""?null:S(H.components,F);if(!pI(P.slice(0,-1),F)){$n({source:"drag",draggedComponentName:T,targetContainerName:G,targetContainerPath:I.containerPath||null,decision:"denied_responsive_branch_boundary",result:"denied",timestamp:Date.now()}),f?.(),z();return}if(H.editableRootSourcePath&&!ka(I.containerPath,H.editableRootSourcePath,H.editMode)){$n({source:"drag",draggedComponentName:T,targetContainerName:G,targetContainerPath:I.containerPath||null,decision:"denied_data_bound",result:"denied",timestamp:Date.now()}),z();return}const V=P.slice(0,-1),Y=P[P.length-1]??-1;if(li(V,F)&&(I.index===Y||I.index===Y+1)){$n({source:"drag",draggedComponentName:T,targetContainerName:G,targetContainerPath:I.containerPath||null,decision:"allowed",insertionIndex:I.index,result:"cancelled",timestamp:Date.now()}),z();return}const re=li(V,F),U=I.index;let ee=[];l(me=>{const Se=Ib({children:me},P,F,U).children??[];return ee=Se,Se}),d(ee,`move ${T}`);const fe=id(F,P),K=re&&Y{z()},[z]);return{activeDragPath:g,activeDragName:h,activeDropZone:b,onDragStart:$,onDragMove:A,onDragEnd:D,onDragCancel:O,buildSlotPredicates:N}}function Sa(e,t){const n=[];let o=e,r=Array.isArray(e.children)?e.children:[];for(let s=0;s0?at(s):null,{t:m}=tt(),[h,v]=u.useState(!1),b=u.useRef(null),x=u.useCallback(()=>{v(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>v(!1),2600)},[]);u.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const k=uI({frameEl:t,nesting:n,editMode:o,currentExtensionId:r,editableRootPath:s,components:a,patchLayout:l,pushHistory:d,onMovePath:p,selectedPath:y,showBranchBoundaryHint:x}),w=P7(L7(ha,{activationConstraint:{distance:8}})),[_,S]=u.useState([]),E=u.useCallback(()=>{if(!t){S([]);return}if(k.activeDragPath!==null)return;const L={children:a},I=t.querySelectorAll("[data-editor-path]"),P=[],F=new Map;I.forEach(G=>{const V=G.dataset.editorPath;if(typeof V!="string"||o!=="iteration_item"&&g&&!hI(V,g,o))return;const Y=fI(V);if(Y!==null&&!Go(V,g)){if(/\.iteration\.\d+$/.test(V)){const K=so(G,t);if(K&&ao(K,t)){const ne=F.get(Y)??[];ne.push(K),F.set(Y,ne)}}return}if(Go(V,g)&&/\.iteration\.\d+$/.test(V))return;const Z=Ze(V),se=We(L,Z);if(!se||se.iteration&&se.iteration.source!==void 0)return;const re=typeof se.name=="string"?se.name:typeof se.type=="string"?se.type:null;if(!re||!qo(re,n))return;const U=wf(L,Z);if(Xi(U)&&!Go(V,g))return;const ee=gn(se,o,r,U);if(ee!=="none"&&ee!=="data_bound"&&!Go(V,g))return;const fe=so(G,t);fe&&ao(fe,t)&&P.push({path:V,name:re,box:fe})});for(const[G,V]of F){const Y=Ze(G),Z=We(L,Y);if(!Z)continue;const se=typeof Z.name=="string"?Z.name:typeof Z.type=="string"?Z.type:null;if(!se)continue;const re=wf(L,Y),U=gn(Z,o,r,re);if(U!=="none"&&U!=="data_bound")continue;const ee=yI(V);ee&&ao(ee,t)&&P.push({path:G,name:se,box:ee,isIterationGroup:!0})}S(P)},[t,a,n,o,r,g,k.activeDragPath]);u.useEffect(()=>{E()},[E]),u.useEffect(()=>{if(t)return kp(E,t)},[t,E]);const C=k.activeDragPath!==null,N=k.activeDragName,$=k.activeDragPath,[A,z]=u.useState(null),D=u.useRef(null);u.useEffect(()=>{if(!$||!t){$||(D.current=null,z(null));return}if(D.current===$)return;D.current=$;const L=t.querySelector(`[data-editor-path="${xf($)}"]`);if(L){const re=L.getBoundingClientRect();z({node:L.cloneNode(!0),width:re.width,height:re.height});return}const I=Array.from(t.querySelectorAll(`[data-editor-path^="${xf($)}.iteration."]`)).filter(re=>/\.iteration\.\d+$/.test(re.dataset.editorPath??""));if(I.length===0){z(null);return}let P=1/0,F=1/0,G=-1/0,V=-1/0;for(const re of I){const U=re.getBoundingClientRect();P=Math.min(P,U.left),F=Math.min(F,U.top),G=Math.max(G,U.right),V=Math.max(V,U.bottom)}const Y=G-P,Z=V-F,se=document.createElement("div");se.style.position="relative",se.style.width=`${Y}px`,se.style.height=`${Z}px`;for(const re of I){const U=re.getBoundingClientRect(),ee=re.cloneNode(!0);ee.style.position="absolute",ee.style.left=`${U.left-P}px`,ee.style.top=`${U.top-F}px`,ee.style.width=`${U.width}px`,ee.style.height=`${U.height}px`,ee.style.margin="0",se.appendChild(ee)}z({node:se,width:Y,height:Z})},[$,t]);const[O,M]=u.useState([]),B=u.useRef(null),T=u.useRef(k.buildSlotPredicates);if(T.current=k.buildSlotPredicates,u.useEffect(()=>{if(!$||!N||!t){B.current=null,M(F=>F.length===0?F:[]);return}if(B.current===$)return;B.current=$;const{acceptsContainer:L,allowsNestSlot:I,includeContainer:P}=T.current(N);M(aI({frameEl:t,draggedPath:$,acceptsContainer:L,allowsNestSlot:I,includeContainer:P,normalizeContainerPath:F=>gI(F)}))},[$,N,t]),!t)return null;const H=k.activeDropZone?`slot:${k.activeDropZone.containerPath}:${k.activeDropZone.index}`:null;return i.jsxs(B2,{sensors:w,collisionDetection:q7,onDragStart:k.onDragStart,onDragMove:k.onDragMove,onDragEnd:k.onDragEnd,onDragCancel:k.onDragCancel,children:[_.map(L=>i.jsx(_I,{path:L.path,name:L.name,box:L.box,dimmed:C&&k.activeDragPath!==L.path,isIterationGroup:L.isIterationGroup,onSelect:c,onRequestInlineEdit:f},L.path)),C&&O.map(L=>i.jsx(vI,{slot:L,active:L.id===H},L.id)),Cn.createPortal(i.jsx(nI,{dropAnimation:null,zIndex:zp,children:N?A?i.jsx(mI,{name:N,node:A.node,width:A.width,height:A.height}):i.jsx("div",{className:"g7le-dnd-drag-ghost","data-testid":"g7le-dnd-drag-ghost",style:{padding:"4px 10px",background:"rgba(79,70,229,0.95)",color:"#fff",fontSize:12,fontWeight:600,borderRadius:4,pointerEvents:"none",whiteSpace:"nowrap"},children:`<${N}>`}):null}),document.body),h&&Cn.createPortal(i.jsxs("div",{"data-testid":"g7le-branch-boundary-hint",role:"status",style:{position:"absolute",left:"50%",top:12,transform:"translateX(-50%)",background:"rgba(245,158,11,0.97)",color:"#fff",fontSize:13,fontWeight:600,padding:"8px 16px",borderRadius:8,boxShadow:"0 4px 14px rgba(0,0,0,0.2)",pointerEvents:"none",whiteSpace:"nowrap",zIndex:zp},children:["⚠️ ",m("layout_editor.overlay.branch_boundary_denied")]}),t)]})}function mI(e){const{node:t,width:n,height:o}=e,r=u.useRef(null);return u.useEffect(()=>{const s=r.current;if(s)return s.replaceChildren(),s.appendChild(t.cloneNode(!0)),()=>{s.replaceChildren()}},[t]),i.jsx("div",{ref:r,className:"g7le-dnd-drag-ghost","data-testid":"g7le-dnd-drag-ghost",style:{width:n,height:o,opacity:.7,pointerEvents:"none",boxShadow:"0 6px 18px rgba(0,0,0,0.25)",borderRadius:4,overflow:"hidden",cursor:"grabbing"}})}function vI(e){const{slot:t,active:n}=e,{setNodeRef:o}=U2({id:t.id}),r=t.orientation!=="area";return i.jsx("div",{ref:o,"data-testid":`g7le-dnd-slot-${t.id}`,"data-dnd-slot-id":t.id,style:{position:"absolute",left:t.box.left,top:t.box.top,width:t.box.width,height:t.box.height,pointerEvents:"auto",zIndex:u7,boxSizing:"border-box",...r?{background:n?"rgba(79,70,229,0.15)":"transparent",...n?t.orientation==="vertical"?{borderLeft:"2px solid #4f46e5"}:{borderTop:"2px solid #4f46e5"}:{}}:{border:n?"2px dashed #4f46e5":"1px dashed transparent",background:n?"rgba(79,70,229,0.08)":"transparent",borderRadius:4}}})}function xf(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[^a-zA-Z0-9_\-.]/g,t=>`\\${t}`)}function _I(e){const{path:t,box:n,dimmed:o,isIterationGroup:r,onSelect:s,onRequestInlineEdit:a}=e,{attributes:l,listeners:d,setNodeRef:c,isDragging:p}=H2({id:t}),f=(t.match(/\.children\./g)||[]).length,y=p7(f);return i.jsx("div",{ref:c,"data-testid":`g7le-dnd-handle-${t}`,"data-dnd-handle-path":t,"data-dnd-iteration-group":r?"true":void 0,...d,...l,onClick:g=>{if(g.stopPropagation(),!r&&typeof document<"u"&&typeof document.elementsFromPoint=="function"){const m=document.elementsFromPoint(g.clientX,g.clientY);for(const h of m){const b=h.closest?.("[data-editor-path]")?.dataset?.editorPath;if(typeof b=="string"&&(b===t||b.startsWith(`${t}.`))){s(b);return}}}s(t)},onDoubleClick:g=>{g.stopPropagation(),g.preventDefault(),a?.(t)},style:{position:"absolute",left:n.left,top:n.top,width:n.width,height:n.height,cursor:"grab",pointerEvents:"auto",background:p?"rgba(79,70,229,0.06)":"transparent",...r?{border:"1px dashed rgba(79,70,229,0.5)",borderRadius:4}:{},opacity:o?.6:1,zIndex:y,touchAction:"none"}})}function wf(e,t){const n=[];let o=e,r=Array.isArray(e.children)?e.children:[];for(let s=0;s0?[o]:[];const r=[],s=(a,l)=>{a.forEach((d,c)=>{const p=[...l,c];if(!Ji(d,t,n)){r.push(p);return}const y=Array.isArray(d.children)?d.children:[];y.length>0&&s(y,p)})};return s(e,[]),r}function wI(e){return at(e)}function ci(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}function kI({frameEl:e,components:t,editMode:n,currentExtensionId:o,editableRootPath:r}){const[s,a]=u.useState(null),[l]=u.useState(()=>`g7le-dim-mask-${Math.floor(Math.random()*1e9)}`);if(u.useEffect(()=>{if(!e){a(null);return}let g=0;const m=()=>{const x=xI(t,n,o,r);if(x.length===0){a(null);return}const k=e.getBoundingClientRect(),w={left:0,top:0,width:k.width,height:k.height},_=[];for(const S of x){const E=wI(S),C=e.querySelector(`[data-editor-path="${ci(E)}"]`);let N=null;if(C){const $=C.getBoundingClientRect();$.width>0&&$.height>0&&(N={left:$.left,top:$.top,width:$.width,height:$.height})}if(!N){const $=Array.from(e.querySelectorAll(`[data-editor-path^="${ci(E)}.iteration."], [data-editor-path^="${ci(E)}.sortable."], [data-editor-path^="${ci(E)}.children."]`));let A=1/0,z=1/0,D=-1/0,O=-1/0;for(const M of $){const B=M.getBoundingClientRect();B.width<=0||B.height<=0||(A=Math.min(A,B.left),z=Math.min(z,B.top),D=Math.max(D,B.right),O=Math.max(O,B.bottom))}if(D>A&&O>z&&(N={left:A,top:z,width:D-A,height:O-z}),N&&$.length>0){const M=$[0].closest('[role="dialog"]');if(M&&e.contains(M)){const B=M.getBoundingClientRect();B.width>0&&B.height>0&&(N={left:B.left,top:B.top,width:B.width,height:B.height})}}}N&&_.push({left:N.left-k.left,top:N.top-k.top,width:N.width,height:N.height})}if(_.length===0){a(null);return}a({frame:w,holes:_})},h=()=>{g&&cancelAnimationFrame(g),g=requestAnimationFrame(m)};h();const v=typeof ResizeObserver<"u"?new ResizeObserver(h):null;v?.observe(e);const b=typeof MutationObserver<"u"?new MutationObserver(h):null;return b?.observe(e,{childList:!0,subtree:!0,attributes:!0}),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{g&&cancelAnimationFrame(g),v?.disconnect(),b?.disconnect(),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[e,t,n,o,r?.join(".")??""]),!s||s.holes.length===0)return null;const{frame:d,holes:c}=s,p=n==="modal"||n==="iteration_item";let f=[];if(p){let g=1/0,m=1/0,h=-1/0,v=-1/0;for(const S of c)g=Math.min(g,S.left),m=Math.min(m,S.top),h=Math.max(h,S.left+S.width),v=Math.max(v,S.top+S.height);const b=(S,E,C)=>Math.max(E,Math.min(C,S)),x=b(g,0,d.width),k=b(m,0,d.height),w=b(h,0,d.width),_=b(v,0,d.height);f=[{left:0,top:0,width:d.width,height:k},{left:0,top:_,width:d.width,height:d.height-_},{left:0,top:k,width:x,height:_-k},{left:w,top:k,width:d.width-w,height:_-k}].filter(S=>S.width>0&&S.height>0)}const y=g=>{g.preventDefault(),g.stopPropagation()};return i.jsxs(i.Fragment,{children:[f.map((g,m)=>i.jsx("div",{className:"g7le-source-lock-block","data-testid":"g7le-source-lock-block",onClickCapture:y,onPointerDownCapture:y,onMouseDownCapture:y,onDragStartCapture:y,style:{position:"absolute",left:g.left,top:g.top,width:g.width,height:g.height,zIndex:Np,pointerEvents:"auto",cursor:"not-allowed",background:"transparent"}},m)),i.jsxs("svg",{className:"g7le-source-lock-dim","data-testid":"g7le-source-lock-dim",width:d.width,height:d.height,style:{position:"absolute",left:0,top:0,width:d.width,height:d.height,zIndex:Np,pointerEvents:"none"},children:[i.jsx("defs",{children:i.jsxs("mask",{id:l,children:[i.jsx("rect",{x:0,y:0,width:d.width,height:d.height,fill:"white"}),c.map((g,m)=>i.jsx("rect",{"data-testid":"g7le-source-lock-dim-hole",x:g.left,y:g.top,width:g.width,height:g.height,rx:4,fill:"black"},m))]})}),i.jsx("rect",{"data-testid":"g7le-source-lock-dim-box",x:0,y:0,width:d.width,height:d.height,fill:"rgba(15, 23, 42, 0.45)",mask:`url(#${l})`})]})]})}function kf(e){const t={type:e.type??"basic",name:e.name},n={};if(e.props)for(const[o,r]of Object.entries(e.props))o!=="children"&&r?.default!==void 0&&(n[o]=r.default);return Object.keys(n).length>0&&(t.props=n),t}function SI(e){if(!e?.components)return[];const t=[];for(const[n,o]of Object.entries(e.components))if(Array.isArray(o))for(const r of o)t.push({...r,type:r.type??n});return t}function CI(e,t,n,o,r){const s=SI(e);let a=null;if(n&&t?.containers){const l=t.containers[n];l&&Array.isArray(l.accepts)?a=new Set(l.accepts):a=new Set}else!n&&t?.draggable&&(a=new Set(t.draggable));return s.filter(l=>{if(a&&!a.has(l.name))return!1;if(o){const d=o.toLowerCase(),c=r(l).toLowerCase(),p=l.name.toLowerCase();if(!c.includes(d)&&!p.includes(d)&&!`<${p}>`.includes(d)&&!(l.description??"").toLowerCase().includes(d))return!1}return!0})}function $I(e,t){const n={key:"all",label:"layout_editor.palette.category.all",entries:e,isI18nKey:!0};if(t?.groups&&t.groups.length>0){const a=new Map(e.map(p=>[p.name,p])),l=new Set,d=[];for(const p of t.groups){const f=[];for(const y of p.components??[]){const g=a.get(y);g&&(f.push(g),l.add(y))}f.length!==0&&d.push({key:p.kind??p.label,label:p.label,entries:f,isI18nKey:p.label.startsWith("$t:")||/^[a-z_.]+$/i.test(p.label)})}const c=e.filter(p=>!l.has(p.name));return c.length>0&&d.push({key:"other",label:"layout_editor.palette.category.other",entries:c,isI18nKey:!0}),[n,...d]}const o=new Map;for(const a of e){const l=(a.type??"basic").toLowerCase(),d=o.get(l)??[];d.push(a),o.set(l,d)}const r=["basic","composite","layout"],s=[];for(const a of r){const l=o.get(a);l&&l.length>0&&(s.push({key:a,label:`layout_editor.palette.category.fallback.${a}`,entries:l,isI18nKey:!0}),o.delete(a))}for(const[a,l]of o.entries())s.push({key:a,label:a,entries:l,isI18nKey:!1});return[n,...s]}function Sf(e){const{manifest:t,nesting:n,componentPalette:o,targetParentPath:r,targetContainerName:s,onInsert:a,insertionIndex:l,onClose:d,editorTemplateId:c,editorLocale:p}=e,{t:f,translationEngine:y}=tt(),g=u.useMemo(()=>{if(!c||!y)return f;const A=p??null;return z=>{const D={templateId:c,locale:A??"ko"},O=y.translate(z,D);return O!==z?O:f(z)}},[c,p,y,f]),[m,h]=u.useState(""),[v,b]=u.useState("all"),x=o?.entries??null,k=u.useMemo(()=>A=>{const z=x?.[A.name];return z?.label?ui(z.label,g):A.description??A.name},[x,g]),w=u.useMemo(()=>CI(t,n,s,m,k),[t,n,s,m,k]),_=u.useMemo(()=>$I(w,o??null),[w,o]),S=_.find(A=>A.key===v)??_[0]??null,E=!n||!n.draggable&&!n.containers,C=w.length===0,N=S?.entries??[],$=A=>{const z=x?.[A.name],D=!!z?.defaultNode&&typeof z.defaultNode=="object";if(z?.requiresDefaultNode&&!D)return;const O=D?JSON.parse(JSON.stringify(z.defaultNode)):kf(A),M=r??[];a(O,M,l),$n({source:"palette",draggedComponentName:A.name,targetContainerName:s,targetContainerPath:M.length===0?null:M.join("/"),decision:"allowed",insertionIndex:l,result:"completed",timestamp:Date.now()}),d()};return i.jsxs("div",{className:"g7le-palette","data-testid":"g7le-palette",style:TI,children:[i.jsxs("div",{style:DI,children:[i.jsx("strong",{style:{fontSize:16},children:f("layout_editor.palette.title")}),i.jsx("button",{type:"button",onClick:d,"aria-label":"close","data-testid":"g7le-palette-close",style:NI,children:"×"})]}),i.jsxs("div",{style:zI,children:[i.jsx("aside",{style:MI,"data-testid":"g7le-palette-sidebar",children:i.jsx("nav",{children:i.jsx("ul",{style:LI,children:_.map(A=>{const z=S?.key===A.key,D=A.isI18nKey?ui(A.label,g):A.label;return i.jsx("li",{children:i.jsxs("button",{type:"button","data-testid":`g7le-palette-category-${A.key}`,"data-active":z?"true":"false",onClick:()=>b(A.key),style:{...PI,background:z?"#eff6ff":"transparent",color:z?"#1d4ed8":"#334155",fontWeight:z?600:500},children:[i.jsx("span",{children:D}),i.jsx("span",{style:jI,children:A.entries.length})]})},A.key)})})})}),i.jsxs("main",{style:OI,children:[i.jsx("input",{type:"text",placeholder:f("layout_editor.palette.search_placeholder"),value:m,onChange:A=>h(A.target.value),"data-testid":"g7le-palette-search",style:BI}),i.jsx("div",{style:WI,children:E?i.jsx("div",{style:Cf,"data-testid":"g7le-palette-spec-missing",children:f("layout_editor.palette.spec_missing")}):C||N.length===0?i.jsx("div",{style:Cf,"data-testid":"g7le-palette-empty",children:f("layout_editor.palette.empty")}):i.jsx("div",{"data-testid":`g7le-palette-group-${S?.key??"all"}`,style:{marginBottom:16},children:i.jsx("div",{style:HI,children:N.map(A=>i.jsx(EI,{entry:A,entrySpec:x?.[A.name]??null,onClick:$,t:f,entryT:g},A.name))})})})]})]})]})}function EI(e){const{entry:t,entrySpec:n,onClick:o,t:r,entryT:s}=e,a=n?.label?ui(n.label,s):t.description??t.name,l=(t.type??"").toLowerCase(),d=l==="basic"||l==="composite"||l==="layout",c=!!n?.defaultNode&&typeof n.defaultNode=="object",p=!!n?.requiresDefaultNode&&!c,f=!c,y=p?r("layout_editor.palette.requires_default_node_missing"):n?.label?ui(n.label,s):t.name;return i.jsxs("button",{type:"button",onClick:()=>o(t),disabled:p,"aria-disabled":p||void 0,"data-testid":`g7le-palette-item-${t.name}`,"data-component-type":l||void 0,"data-blocked":p?"true":void 0,"data-default-node-missing":f?"true":void 0,title:y,style:p?KI:FI,children:[i.jsx("div",{style:UI,"aria-hidden":"true",children:AI(t)}),i.jsx("div",{style:qI,children:a}),i.jsx("div",{"data-testid":`g7le-palette-item-${t.name}-tag`,style:GI,children:`<${t.name}>`}),d&&i.jsx("div",{"data-testid":`g7le-palette-item-${t.name}-badge`,style:II(l),children:l}),f&&i.jsx("div",{"data-testid":`g7le-palette-item-${t.name}-default-missing-badge`,style:VI,children:r("layout_editor.palette.default_node_missing_badge")})]})}function ui(e,t){return e.startsWith("$t:")?t(e.slice(3)):t(e)}function II(e){const n={basic:{bg:"#dbeafe",fg:"#1e40af"},composite:{bg:"#dcfce7",fg:"#14532d"},layout:{bg:"#fef3c7",fg:"#854d0e"}}[e]??{bg:"#e2e8f0",fg:"#334155"};return{fontSize:9,fontWeight:600,color:n.fg,background:n.bg,padding:"1px 6px",borderRadius:999,textTransform:"uppercase",letterSpacing:.4,lineHeight:1.6}}function AI(e){const t=e.name;return{Button:"🔘",A:"🔗",Img:"🖼",Icon:"✨",Hr:"➖",P:"📄",Span:"T",H1:"H₁",H2:"H₂",H3:"H₃",H4:"H₄",Ul:"☰",Li:"•",Nav:"🧭",Div:"▢",Container:"▢",Flex:"⇆",Grid:"▦",SectionLayout:"▤",ThreeColumnLayout:"⫼",Form:"📝",Input:"⎕",Textarea:"▭",Select:"⏷",Checkbox:"☑",PasswordInput:"🔒",Label:"🏷",DataGrid:"▦",Pagination:"↔",SearchBar:"🔍",ProductCard:"🛍",ImageGallery:"🖼",Avatar:"👤",UserInfo:"👥",HtmlContent:"⟨/⟩",HtmlEditor:"✏",RichTextEditor:"✏",TabNavigation:"◰",QuantitySelector:"#",ProductImageViewer:"🖼",FileUploader:"📎",AvatarUploader:"📷",SocialLoginButtons:"🌐",PostReactions:"❤"}[t]??"◻"}const TI={display:"flex",flexDirection:"column",width:"100%",height:"100%",minHeight:0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif'},DI={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"14px 20px",borderBottom:"1px solid #e2e8f0",flexShrink:0},NI={background:"transparent",border:"none",fontSize:24,cursor:"pointer",lineHeight:1,color:"#64748b",padding:"0 4px"},zI={display:"flex",flex:1,minHeight:0},MI={width:180,flexShrink:0,borderRight:"1px solid #e2e8f0",padding:"14px 8px",background:"#f8fafc",overflowY:"auto"},LI={listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},PI={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",textAlign:"left",padding:"8px 12px",border:"none",borderRadius:6,fontSize:13,cursor:"pointer",transition:"background-color 120ms"},OI={flex:1,display:"flex",flexDirection:"column",minHeight:0,padding:"14px 20px"},BI={width:"100%",padding:"8px 10px",border:"1px solid #cbd5e1",borderRadius:6,marginBottom:12,fontSize:13,flexShrink:0,boxSizing:"border-box"},WI={flex:1,overflowY:"auto",minHeight:0},jI={fontSize:11,color:"#94a3b8",marginLeft:8,fontWeight:500},HI={display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:10},FI={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:"14px 6px",background:"#fff",border:"1px solid #e2e8f0",borderRadius:8,cursor:"pointer",fontSize:12,minHeight:84,transition:"border-color 120ms, box-shadow 120ms"},KI={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,padding:"14px 6px",background:"#f8fafc",border:"1px dashed #cbd5e1",borderRadius:8,cursor:"not-allowed",fontSize:12,minHeight:84,color:"#94a3b8",opacity:.65},VI={fontSize:9,fontWeight:600,color:"#92400e",background:"#fef3c7",padding:"1px 6px",borderRadius:999,textTransform:"none",letterSpacing:0,lineHeight:1.6},UI={fontSize:22,lineHeight:1,color:"#475569"},qI={fontSize:12,fontWeight:500,color:"#0f172a",textAlign:"center",wordBreak:"break-word"},GI={fontFamily:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontSize:10,color:"#64748b",textAlign:"center",wordBreak:"break-all"},Cf={padding:24,color:"#64748b",fontSize:13,textAlign:"center"};function YI(e){const t=[],n=r=>{if(Array.isArray(r))for(const s of r)s&&typeof s=="object"&&t.push(s)};n(e.children);const o=e.responsive;if(o&&typeof o=="object")for(const r of Object.values(o))r&&typeof r=="object"&&n(r.children);return t}function $f(e){const t=[],n=o=>{const r="isolatedState"in o&&o.isolatedState!=null,s=o.isolatedScopeId;(r||typeof s=="string"&&s.length>0)&&t.push({scopeId:typeof s=="string"?s:void 0,initialState:o.isolatedState&&typeof o.isolatedState=="object"?o.isolatedState:void 0});for(const a of YI(o))n(a)};if(Array.isArray(e))for(const o of e)o&&typeof o=="object"&&n(o);return t}const XI=["scroll","selector","wizard","slider"];function JI(e,t){const n=new Set;for(const o of e)o.scopeId&&n.add(o.scopeId);for(const o of t){n.add(o);for(const r of XI)n.add(`${o}-${r}`)}return Array.from(n)}function ZI(e,t,n){const o=t.label;return typeof o=="string"?o.startsWith("$t:")?n(o.slice(3)):o:e}function pi({controlKey:e,control:t,node:n,t:o,onPatch:r,candidates:s,bindingCandidates:a,scope:l=Wt}){const d=Tn(t.widget),c=ZI(e,t,o),p=u.useMemo(()=>To(n,t,l),[n,t,l]),f=t.widget==="i18n-text"&&t.apply?.type==="propValue",y=t.widget==="text"&&t.apply?.type==="propValue",g=p.darkReadonly===!0||l.colorScheme==="dark"&&t.apply!==void 0&&!Us(t.apply),m=t.apply,h=l.colorScheme==="dark"&&!g&&m?.type==="classToken"&&typeof m.tokenTemplate=="string"&&m.tokenTemplate.includes("{value}"),v=p.scopedValue===void 0&&p.baseFallback!==void 0,b=u.useCallback(x=>{if(g)return;const k=fn(n,t,x,l);r(k)},[n,t,r,l,g]);return i.jsxs("div",{className:"g7le-control-row","data-testid":`g7le-control-${e}`,style:QI,children:[i.jsxs("span",{className:"g7le-control-label",style:RI,children:[c,p.conflict&&i.jsx("span",{"data-testid":`g7le-control-conflict-${e}`,title:o("layout_editor.property_modal.value_conflict"),style:eA,children:"!"})]}),i.jsx("div",{className:"g7le-control-widget",style:{flex:1,minWidth:0,opacity:v?.45:1},"data-placeholder":v?"true":void 0,children:f?i.jsx(vt,{value:typeof p.value=="string"?p.value:"",onChange:x=>b(x),t:o,testidPrefix:`g7le-prop-i18n-${e}`,candidates:a,enableExpressionTree:!0,expressionTreeCollapsible:!0}):y?i.jsx(Ve,{value:typeof p.value=="string"?p.value:"",onChange:x=>b(x===""?void 0:x),t:o,testidPrefix:`g7le-prop-value-${e}`,candidates:a}):g?i.jsx("span",{"data-testid":`g7le-control-dark-readonly-${e}`,style:nA,children:o("layout_editor.property_modal.dark_code_only")}):d?i.jsx(d,{control:t,value:p.value,onChange:b,t:o,candidates:s,bindingCandidates:a,freeValueDisabled:h}):i.jsx("span",{"data-testid":`g7le-control-unsupported-${e}`,style:tA,children:o("layout_editor.property_modal.unsupported_widget")})})]})}const QI={display:"flex",alignItems:"center",gap:12,padding:"6px 0",minHeight:32,minWidth:0},RI={fontSize:12,color:"#475569",minWidth:88,display:"inline-flex",alignItems:"center",gap:4},eA={display:"inline-flex",width:14,height:14,borderRadius:7,background:"#f59e0b",color:"#fff",fontSize:10,alignItems:"center",justifyContent:"center",fontWeight:700},tA={fontSize:11,color:"#94a3b8",fontStyle:"italic"},nA={fontSize:11,color:"#94a3b8",fontStyle:"italic"};function fi(e,t,n){return typeof e=="string"?e.startsWith("$t:")?n(e.slice(3)):e:t}function oA(e,t){const n=e.props??{};return t.key in n?n[t.key]:t.default}function rA({spec:e,node:t,t:n,onPatchProp:o}){const r=e.groups??[];return i.jsx("div",{className:"g7le-composite-settings","data-testid":"g7le-composite-settings",style:sA,children:r.map((s,a)=>i.jsxs("div",{className:"g7le-settings-group",style:aA,children:[i.jsx("div",{style:lA,children:fi(s.label,n("layout_editor.property_modal.settings_group",{index:a+1}),n)}),(s.fields??[]).map(l=>i.jsxs("div",{className:"g7le-settings-field","data-testid":`g7le-setting-${l.key}`,style:dA,children:[i.jsx("span",{style:cA,children:fi(l.label,l.key,n)}),i.jsx("div",{style:{flex:1},children:iA(l,t,n,o)})]},l.key))]},a))})}function iA(e,t,n,o){const r=oA(t,e);switch(e.type){case"number":return i.jsx("input",{type:"number","data-testid":`g7le-setting-input-${e.key}`,value:typeof r=="number"?r:"",min:e.min,max:e.max,onChange:s=>o(e.key,s.target.value===""?void 0:Number(s.target.value)),style:Ca});case"text":return i.jsx("input",{type:"text","data-testid":`g7le-setting-input-${e.key}`,value:typeof r=="string"?r:"",onChange:s=>o(e.key,s.target.value===""?void 0:s.target.value),style:Ca});case"toggle":return i.jsx("input",{type:"checkbox","data-testid":`g7le-setting-input-${e.key}`,checked:r===!0,onChange:s=>o(e.key,s.target.checked)});case"checkbox-group":{const s=Array.isArray(r)?r:[];return i.jsx("div",{style:uA,"data-testid":`g7le-setting-input-${e.key}`,children:(e.options??[]).map(a=>{const l=s.includes(a.value);return i.jsxs("label",{style:pA,children:[i.jsx("input",{type:"checkbox",checked:l,onChange:d=>{const c=d.target.checked?[...s,a.value]:s.filter(p=>p!==a.value);o(e.key,c)}}),fi(a.label,String(a.value),n)]},String(a.value))})})}default:return i.jsxs("select",{"data-testid":`g7le-setting-input-${e.key}`,value:r==null?"":String(r),onChange:s=>{const a=s.target.value;if(a===""){o(e.key,void 0);return}const l=(e.options??[]).find(d=>String(d.value)===a);o(e.key,l?l.value:a)},style:Ca,children:[i.jsx("option",{value:"",children:"—"}),(e.options??[]).map(s=>i.jsx("option",{value:String(s.value),children:fi(s.label,String(s.value),n)},String(s.value)))]})}}const sA={display:"flex",flexDirection:"column",gap:16},aA={display:"flex",flexDirection:"column",gap:6},lA={fontSize:12,fontWeight:700,color:"#0f172a",borderBottom:"1px solid #e2e8f0",paddingBottom:4},dA={display:"flex",alignItems:"center",gap:12,minHeight:30},cA={fontSize:12,color:"#475569",minWidth:96},Ca={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%",boxSizing:"border-box"},uA={display:"flex",flexWrap:"wrap",gap:10},pA={display:"inline-flex",alignItems:"center",gap:4,fontSize:12,color:"#0f172a"},fA=["data_binding","isolatedScopeId","parentFormContextProp","skipBindingKeys","isolatedState","component_layout","sortable","itemTemplate"],gA=/\{\{|\$switch|\$get|\|\s*(date|number|truncate|currency|relative)\b/;function gi(e,t=0){return t>6?!1:typeof e=="string"?gA.test(e):Array.isArray(e)?e.some(n=>gi(n,t+1)):e&&typeof e=="object"?Object.values(e).some(n=>gi(n,t+1)):!1}function hA(e){if(Zl(e))return!1;const t=Fl(e);return t.length===0?!1:t.some(n=>n.isComplex)}function Ef(e){const t=[],n=e.props??{};for(const o of fA)o in e&&e[o]!==void 0?t.push({key:o,kind:"developer_prop"}):o in n&&n[o]!==void 0&&t.push({key:`props.${o}`,kind:"developer_prop"});typeof e.text=="string"?hA(e.text)&&t.push({key:"text",kind:"complex_expression"}):gi(e.text)&&t.push({key:"text",kind:"complex_expression"});for(const[o,r]of Object.entries(n))o==="style"||o==="className"||gi(r)&&t.push({key:`props.${o}`,kind:"complex_expression"});return t}function yA(e){return Ef(e).length>0}const bA=new Set(["permissions","blur_until_loaded","comment"]);function mA({node:e,advanced:t,t:n,onPatch:o,permissionCandidates:r}){const s=u.useMemo(()=>Ef(e),[e]),a=(l,d)=>{const c={...e};d===void 0?delete c[l]:c[l]=d,o(c)};return i.jsxs("div",{className:"g7le-advanced-props","data-testid":"g7le-advanced-props",style:vA,children:[t.map(l=>{if(!bA.has(l))return i.jsxs("div",{"data-testid":`g7le-advanced-deferred-${l}`,style:xA,children:[n("layout_editor.property_modal.advanced_deferred"),":",l]},l);if(l==="permissions")return i.jsxs("div",{className:"g7le-advanced-group","data-testid":"g7le-advanced-permissions",style:$a,children:[i.jsx("div",{style:Ea,children:n("layout_editor.property_modal.advanced.permissions")}),i.jsx(ys,{control:{widget:"tag-input"},value:e.permissions,onChange:d=>a("permissions",d),t:n,candidates:r})]},l);if(l==="blur_until_loaded"){const d=e.blur_until_loaded===!0||e.blur_until_loaded!=null&&e.blur_until_loaded!==!1;return i.jsxs("div",{className:"g7le-advanced-group","data-testid":"g7le-advanced-blur",style:$a,children:[i.jsx("div",{style:Ea,children:n("layout_editor.property_modal.advanced.blur_until_loaded")}),i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12},children:[i.jsx("input",{type:"checkbox","data-testid":"g7le-advanced-blur-toggle",checked:!!d,onChange:c=>a("blur_until_loaded",c.target.checked?!0:void 0)}),n("layout_editor.property_modal.advanced.blur_hint")]})]},l)}return i.jsxs("div",{className:"g7le-advanced-group","data-testid":"g7le-advanced-comment",style:$a,children:[i.jsx("div",{style:Ea,children:n("layout_editor.property_modal.advanced.comment")}),i.jsx("input",{type:"text","data-testid":"g7le-advanced-comment-input",value:typeof e.comment=="string"?e.comment:"",onChange:d=>a("comment",d.target.value===""?void 0:d.target.value),style:_A})]},l)}),s.length>0&&i.jsxs("div",{className:"g7le-advanced-preserved","data-testid":"g7le-advanced-preserved",style:wA,children:[i.jsx("div",{style:kA,children:n("layout_editor.property_modal.advanced_preserved_title",{count:s.length})}),i.jsx("ul",{style:SA,children:s.map(l=>i.jsxs("li",{"data-testid":`g7le-advanced-preserved-${l.key}`,style:CA,children:[i.jsx("code",{style:{fontSize:11},children:l.key}),i.jsx("span",{style:{fontSize:11,color:"#94a3b8"},children:l.kind==="developer_prop"?n("layout_editor.property_modal.advanced_kind_developer"):n("layout_editor.property_modal.advanced_kind_expression")})]},l.key))})]})]})}const vA={display:"flex",flexDirection:"column",gap:14},$a={display:"flex",flexDirection:"column",gap:6},Ea={fontSize:12,fontWeight:700,color:"#0f172a"},_A={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%",boxSizing:"border-box"},xA={fontSize:11,color:"#94a3b8",fontStyle:"italic"},wA={borderTop:"1px dashed #cbd5e1",paddingTop:10,marginTop:4},kA={fontSize:11,color:"#b45309",marginBottom:6},SA={listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},CA={display:"flex",justifyContent:"space-between",gap:8,padding:"3px 0"},$A={onClick:"click",onHover:"mouseenter",onChange:"change",onSubmit:"submit",onMount:"mount",onUnmount:"unmount",onFocus:"focus",onBlur:"blur"};function Ia(e){return $A[e]??e.replace(/^on/,"").toLowerCase()}function If(e){const t=e.actions;if(Array.isArray(t))return t.filter(r=>!!r&&typeof r=="object");const n=e.props??{};if(Array.isArray(n.actions))return n.actions.filter(r=>!!r&&typeof r=="object");const o=n.events;if(o&&typeof o=="object"){const r=[];for(const[s,a]of Object.entries(o)){if(!Array.isArray(a))continue;const l=Ia(s);for(const d of a)d&&typeof d=="object"&&r.push("type"in d?d:{type:l,...d})}return r}return[]}function EA(e,t){const n=Ia(t);return If(e).filter(o=>o.type===n||t==="onClick"&&o.type===void 0)}function IA(e,t,n){const o=Ia(t),r=If(e).filter(d=>!(d.type===o||t==="onClick"&&d.type===void 0)),s=n.map(d=>"type"in d?d:{type:o,...d}),a={...e};if(a.props&&typeof a.props=="object"){const d={...a.props};let c=!1;"actions"in d&&(delete d.actions,c=!0),"events"in d&&(delete d.events,c=!0),c&&(a.props=d)}const l=[...r,...s];return l.length===0?delete a.actions:a.actions=l,a}function AA({node:e,spec:t,capability:n,t:o,onPatchNode:r,pageCandidates:s,dataSourceCandidates:a,stateKeyCandidates:l,bindingCandidates:d}){const c=t?.actionRecipes,p=u.useMemo(()=>({pageCandidates:s,dataSourceCandidates:a,stateKeyCandidates:l,bindingCandidates:d}),[s,a,l,d]),f=Array.isArray(n?.events)?n.events:[];return f.length===0?i.jsx("div",{"data-testid":"g7le-action-no-events",style:Af,children:o("layout_editor.action.no_events")}):!c||Object.keys(c).length===0?i.jsx("div",{"data-testid":"g7le-action-no-recipes",style:Af,children:o("layout_editor.action.no_recipes")}):i.jsx("div",{className:"g7le-action-editor","data-testid":"g7le-action-editor",style:{display:"flex",flexDirection:"column",gap:14},children:f.map(y=>i.jsxs("div",{className:"g7le-action-event-slot","data-testid":`g7le-action-event-${y}`,children:[i.jsx("div",{style:TA,children:o(`layout_editor.action.event.${y}`)}),i.jsx(Gt,{actions:EA(e,y),onChange:g=>r(IA(e,y,g)),t:o,recipes:c,candidatePools:p,actionChipCandidates:t?.actionChipCandidates??null,addContext:"component",showSourceBadge:!0,testIdPrefix:`g7le-action-slot-${y}`})]},y))})}const Af={fontSize:12,color:"#94a3b8",padding:"16px 0",textAlign:"center"},TA={fontSize:12,fontWeight:700,color:"#475569",marginBottom:6};function Aa(e,t,n){if(!t)return n;const o=e(t);return!o||o===t||o.startsWith("$t:")?n:o}function DA(e,t){return Aa(t,e.labelKey,e.path||e.sourceId)}function NA({node:e,spec:t,candidates:n,t:o,onPatchNode:r}){const a=(e.props??{})[t.propKey],l=typeof a=="string"?a:void 0,d=u.useMemo(()=>Kt(a),[a]),c=l!==void 0&&l!==""&&d===null,[p,f]=u.useState(!1),[y,g]=u.useState(""),m=Aa(o,t.label,t.propKey),h=o(t.shape==="array"?"layout_editor.binding.shape_array":t.shape==="object"?"layout_editor.binding.shape_object":"layout_editor.binding.shape_scalar"),v=u.useMemo(()=>Fi(n,t.shape).map(_=>({..._,resolvedLabel:DA(_,o)})),[n,t.shape,o]),b=u.useMemo(()=>Ki(v,y),[v,y]),x=w=>{const _={...e.props??{}};w===void 0?delete _[t.propKey]:_[t.propKey]=w,r({...e,props:_})},k=w=>{x(En(w.sourceId,w.path,t.shape)),f(!1),g("")};return i.jsxs("div",{"data-testid":`g7le-binding-row-${t.propKey}`,style:PA,children:[i.jsxs("div",{style:OA,children:[i.jsx("span",{style:{fontWeight:600,fontSize:12},children:m}),i.jsx("span",{style:BA,children:h}),t.required&&i.jsx("span",{"data-testid":`g7le-binding-required-${t.propKey}`,style:WA,children:o("layout_editor.binding.required")})]}),c?i.jsxs("div",{"data-testid":`g7le-binding-complex-${t.propKey}`,style:KA,children:[o("layout_editor.binding.complex"),i.jsx("code",{style:Tf,children:l})]}):d?i.jsxs("div",{style:jA,children:[i.jsx("code",{"data-testid":`g7le-binding-expr-${t.propKey}`,style:Tf,children:l}),i.jsx("button",{type:"button","data-testid":`g7le-binding-clear-${t.propKey}`,onClick:()=>x(void 0),style:FA,children:o("layout_editor.binding.clear")})]}):i.jsx("div",{"data-testid":`g7le-binding-empty-${t.propKey}`,style:HA,children:o("layout_editor.binding.not_connected")}),d&&(t.shape==="array"||t.shape==="object")&&t.itemFields&&t.itemFields.length>0&&i.jsxs("div",{style:VA,children:[o("layout_editor.binding.item_fields"),": ",t.itemFields.join(", ")]}),!c&&i.jsxs("div",{style:{marginTop:4},children:[i.jsxs("button",{type:"button","data-testid":`g7le-binding-search-toggle-${t.propKey}`,onClick:()=>f(w=>!w),style:UA,children:["🔍 ",o("layout_editor.binding.search")]}),p&&i.jsxs("div",{"data-testid":`g7le-binding-picker-${t.propKey}`,style:qA,children:[i.jsx("input",{type:"text",autoFocus:!0,"data-testid":`g7le-binding-search-input-${t.propKey}`,value:y,placeholder:o("layout_editor.binding.search_placeholder"),onChange:w=>g(w.target.value),style:GA}),i.jsx("div",{style:YA,children:b.length===0?i.jsx("div",{style:XA,children:o("layout_editor.binding.no_results")}):b.map(w=>i.jsxs("button",{type:"button","data-testid":`g7le-binding-candidate-${w.expression}`,onClick:()=>k(w),style:JA,children:[i.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[i.jsx("span",{style:{fontSize:12},children:w.resolvedLabel}),i.jsxs("span",{style:ZA,children:[Aa(o,w.groupLabelKey,w.sourceId)," · ",w.path||w.sourceId]})]}),i.jsx("span",{style:QA,children:w.preview})]},w.expression))})]})]})]})}function zA({node:e,dataProps:t,candidates:n,t:o,onPatchNode:r}){return!Array.isArray(t)||t.length===0?null:i.jsxs("div",{"data-testid":"g7le-data-binding-section",style:MA,children:[i.jsxs("div",{style:LA,children:["🔗 ",o("layout_editor.binding.section_title")]}),t.map(s=>i.jsx(NA,{node:e,spec:s,candidates:n,t:o,onPatchNode:r},s.propKey)),i.jsx("div",{style:RA})]})}const MA={display:"flex",flexDirection:"column",marginBottom:8},LA={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:6},PA={display:"flex",flexDirection:"column",gap:4,padding:"8px 0"},OA={display:"flex",alignItems:"center",gap:6},BA={fontSize:10,padding:"1px 6px",borderRadius:4,background:"#e0e7ff",color:"#3730a3"},WA={fontSize:10,padding:"1px 6px",borderRadius:4,background:"#fef3c7",color:"#92400e"},jA={display:"flex",alignItems:"center",gap:6},HA={fontSize:11,color:"#94a3b8"},Tf={fontSize:11,fontFamily:"monospace",background:"#f1f5f9",padding:"2px 6px",borderRadius:4,color:"#0f172a",wordBreak:"break-all"},FA={fontSize:11,border:"1px solid #e2e8f0",borderRadius:4,background:"#fff",color:"#dc2626",padding:"2px 8px",cursor:"pointer"},KA={display:"flex",flexDirection:"column",gap:2,fontSize:11,color:"#64748b"},VA={fontSize:10,color:"#94a3b8"},UA={fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#334155",padding:"4px 10px",cursor:"pointer",textAlign:"left",width:"100%"},qA={marginTop:4,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",padding:6},GA={width:"100%",padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,boxSizing:"border-box"},YA={marginTop:4,maxHeight:200,overflowY:"auto",display:"flex",flexDirection:"column",gap:2},XA={fontSize:11,color:"#94a3b8",padding:"8px 0",textAlign:"center"},JA={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,border:"none",background:"transparent",cursor:"pointer",padding:"6px 8px",borderRadius:4,textAlign:"left"},ZA={fontSize:10,color:"#94a3b8"},QA={fontSize:10,color:"#64748b",fontFamily:"monospace",whiteSpace:"nowrap"},RA={borderTop:"1px solid #e2e8f0",marginTop:4};function e6({node:e,candidates:t,t:n,onPatchNode:o,templateIdentifier:r}){const s=typeof e.text=="string"?e.text:"",{state:a}=Je(),l=r??a.templateIdentifier,d=a.selectedRoute?.layoutName??null,c=a.locale,[p,f]=u.useState(!1),y=/^\s*\$t:custom\.[A-Za-z0-9._-]+\s*$/.test(s),m=Zl(s)&&(mt(s)?.key.startsWith("custom.")??!1)||y,h=u.useMemo(()=>m?mt(s):null,[m,s]),v=u.useMemo(()=>m?[]:Fl(s),[m,s]),b=N=>{o({...e,text:N})},x=()=>{if(!(typeof window>"u"))try{window.dispatchEvent(new CustomEvent(kt,{detail:{templateIdentifier:l,locale:c}}))}catch{}},k=(N,$)=>{const A=En($.sourceId,$.path,"scalar");b(vb(s,N,A))},w=N=>{const $=mt(s);b(bo(s,N));const A=$?.key;l&&A&&Hd(l,A,N).then(x)},_=N=>{const $=n(N);return $&&$!==N&&!$.startsWith("$t:")?$:""},S=N=>N.replace(/\$t:[a-zA-Z0-9._-]+/g,$=>_($.slice(3))).replace(/\s+/g," ").trim(),E=N=>{p||(f(!0),ls(l,d,c,s,s.length,N.sourceId,N.path,"scalar",S,$=>n($)).then($=>{$.kind==="ok"&&(b($.text),x())}).finally(()=>f(!1)))},C=N=>{p||!h&&!y||(f(!0),wr(l,c,s,Number.MAX_SAFE_INTEGER,N.sourceId,N.path,"scalar").then($=>{$.kind==="ok"&&(b($.text),x())}).finally(()=>f(!1)))};if(m){const N=h?.params??[];return i.jsxs("div",{"data-testid":"g7le-inline-binding-section",style:Df,children:[i.jsxs("div",{style:Nf,children:["🔗 ",n("layout_editor.inline_binding.section_title")]}),N.length===0?i.jsx("div",{"data-testid":"g7le-inline-binding-none",style:Lf,children:n("layout_editor.inline_binding.none")}):N.map($=>i.jsx("div",{"data-testid":`g7le-inline-binding-param-${$.name}`,style:zf,children:$.parsed===null?i.jsxs("div",{"data-testid":`g7le-inline-binding-param-complex-${$.name}`,style:n6,children:[n("layout_editor.inline_binding.complex"),i.jsx("code",{style:Ta,children:$.expression})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:Mf,children:[i.jsx("code",{"data-testid":`g7le-inline-binding-param-expr-${$.name}`,style:Ta,children:$.expression}),i.jsx("button",{type:"button","data-testid":`g7le-inline-binding-param-clear-${$.name}`,onClick:()=>w($.name),style:t6,children:n("layout_editor.inline_binding.clear")})]}),i.jsx($t,{candidates:t,t:n,onSelect:A=>k($.name,A),testIdSuffix:`param-${$.name}`})]})},$.name)),i.jsxs("div",{"data-testid":"g7le-inline-binding-param-append",style:Pf,children:[i.jsx("div",{style:Da,children:n("layout_editor.inline_binding.append_hint")}),i.jsx($t,{candidates:t,t:n,onSelect:C,testIdSuffix:"param-append"})]}),i.jsx("div",{"data-testid":"g7le-inline-binding-param-hint",style:Da,children:n("layout_editor.inline_binding.param_hint")}),i.jsx("div",{style:Of})]})}return i.jsxs("div",{"data-testid":"g7le-inline-binding-section",style:Df,children:[i.jsxs("div",{style:Nf,children:["🔗 ",n("layout_editor.inline_binding.section_title")]}),v.length===0?i.jsx("div",{"data-testid":"g7le-inline-binding-none",style:Lf,children:n("layout_editor.inline_binding.none")}):v.map(N=>i.jsx("div",{"data-testid":`g7le-inline-binding-row-${N.bindingIndex}`,style:zf,children:i.jsx("div",{style:Mf,children:i.jsx("code",{"data-testid":`g7le-inline-binding-expr-${N.bindingIndex}`,style:Ta,children:N.expression})})},N.bindingIndex)),i.jsxs("div",{"data-testid":"g7le-inline-binding-append",style:Pf,children:[i.jsx("div",{style:Da,children:n("layout_editor.inline_binding.append_hint")}),i.jsx($t,{candidates:t,t:n,onSelect:E,testIdSuffix:"append"})]}),i.jsx("div",{style:Of})]})}const Df={display:"flex",flexDirection:"column",marginBottom:8},Nf={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:6},zf={display:"flex",flexDirection:"column",gap:4,padding:"8px 0"},Mf={display:"flex",alignItems:"center",gap:6},Lf={fontSize:11,color:"#94a3b8"},Ta={fontSize:11,fontFamily:"monospace",background:"#f1f5f9",padding:"2px 6px",borderRadius:4,color:"#0f172a",wordBreak:"break-all"},t6={fontSize:11,border:"1px solid #e2e8f0",borderRadius:4,background:"#fff",color:"#dc2626",padding:"2px 8px",cursor:"pointer"},n6={display:"flex",flexDirection:"column",gap:2,fontSize:11,color:"#64748b"},Pf={display:"flex",flexDirection:"column",gap:2,padding:"8px 0 0"},Da={fontSize:11,color:"#475569",fontWeight:600},Of={borderTop:"1px solid #e2e8f0",marginTop:4};function Bf(e,t,n){if(!t)return n;const o=e(t);return!o||o===t||o.startsWith("$t:")?n:o}function o6(e,t){return Bf(t,e.labelKey,e.path||e.sourceId)}function r6(e){const t=e.iteration;return t&&typeof t=="object"?t:null}function i6({node:e,candidates:t,t:n,onPatchNode:o}){const r=r6(e),s=r?.source,a=typeof s=="string"?s:void 0,l=u.useMemo(()=>Kt(s),[s]),d=a!==void 0&&a!==""&&l===null,[c,p]=u.useState(!1),[f,y]=u.useState(""),g=u.useMemo(()=>Fi(t,"array").map(w=>({...w,resolvedLabel:o6(w,n)})),[t,n]),m=u.useMemo(()=>Ki(g,f),[g,f]);if(!r)return null;const h=typeof r.item_var=="string"?r.item_var:void 0,v=typeof r.index_var=="string"?r.index_var:void 0,b=k=>{const w={...r};k===void 0?delete w.source:w.source=k,o({...e,iteration:w})},x=k=>{b(En(k.sourceId,k.path,"array")),p(!1),y("")};return i.jsxs("div",{"data-testid":"g7le-iteration-binding-section",style:s6,children:[i.jsxs("div",{style:a6,children:["🔁 ",n("layout_editor.binding.iteration_title")]}),i.jsx("div",{style:l6,children:n("layout_editor.binding.iteration_hint")}),i.jsxs("div",{style:d6,children:[i.jsxs("div",{style:c6,children:[i.jsx("span",{style:{fontWeight:600,fontSize:12},children:n("layout_editor.binding.iteration_label")}),i.jsx("span",{style:u6,children:n("layout_editor.binding.shape_array")})]}),d?i.jsxs("div",{"data-testid":"g7le-iteration-binding-complex",style:h6,children:[n("layout_editor.binding.complex"),i.jsx("code",{style:Wf,children:a})]}):l?i.jsxs("div",{style:p6,children:[i.jsx("code",{"data-testid":"g7le-iteration-binding-expr",style:Wf,children:a}),i.jsx("button",{type:"button","data-testid":"g7le-iteration-binding-clear",onClick:()=>b(void 0),style:g6,children:n("layout_editor.binding.clear")})]}):i.jsx("div",{"data-testid":"g7le-iteration-binding-empty",style:f6,children:n("layout_editor.binding.not_connected")}),(h||v)&&i.jsxs("div",{"data-testid":"g7le-iteration-vars",style:y6,children:[h&&i.jsxs("span",{children:[n("layout_editor.binding.iteration_item_var"),": ",i.jsx("code",{style:jf,children:h})]}),v&&i.jsxs("span",{children:[n("layout_editor.binding.iteration_index_var"),": ",i.jsx("code",{style:jf,children:v})]})]}),!d&&i.jsxs("div",{style:{marginTop:4},children:[i.jsxs("button",{type:"button","data-testid":"g7le-iteration-binding-search-toggle",onClick:()=>p(k=>!k),style:b6,children:["🔍 ",n("layout_editor.binding.search")]}),c&&i.jsxs("div",{"data-testid":"g7le-iteration-binding-picker",style:m6,children:[i.jsx("input",{type:"text",autoFocus:!0,"data-testid":"g7le-iteration-binding-search-input",value:f,placeholder:n("layout_editor.binding.search_placeholder"),onChange:k=>y(k.target.value),style:v6}),i.jsx("div",{style:_6,children:m.length===0?i.jsx("div",{style:x6,children:n("layout_editor.binding.no_results")}):m.map(k=>i.jsxs("button",{type:"button","data-testid":`g7le-iteration-binding-candidate-${k.expression}`,onClick:()=>x(k),style:w6,children:[i.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[i.jsx("span",{style:{fontSize:12},children:k.resolvedLabel}),i.jsxs("span",{style:k6,children:[Bf(n,k.groupLabelKey,k.sourceId)," · ",k.path||k.sourceId]})]}),i.jsx("span",{style:S6,children:k.preview})]},k.expression))})]})]})]}),i.jsx("div",{style:C6})]})}const s6={display:"flex",flexDirection:"column",marginBottom:8},a6={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:4},l6={fontSize:10,color:"#94a3b8",marginBottom:6,lineHeight:1.4},d6={display:"flex",flexDirection:"column",gap:4,padding:"8px 0"},c6={display:"flex",alignItems:"center",gap:6},u6={fontSize:10,padding:"1px 6px",borderRadius:4,background:"#e0e7ff",color:"#3730a3"},p6={display:"flex",alignItems:"center",gap:6},f6={fontSize:11,color:"#94a3b8"},Wf={fontSize:11,fontFamily:"monospace",background:"#f1f5f9",padding:"2px 6px",borderRadius:4,color:"#0f172a",wordBreak:"break-all"},g6={fontSize:11,border:"1px solid #e2e8f0",borderRadius:4,background:"#fff",color:"#dc2626",padding:"2px 8px",cursor:"pointer"},h6={display:"flex",flexDirection:"column",gap:2,fontSize:11,color:"#64748b"},y6={display:"flex",gap:12,fontSize:10,color:"#94a3b8",marginTop:2},jf={fontSize:10,fontFamily:"monospace",background:"#f1f5f9",padding:"1px 4px",borderRadius:3,color:"#475569"},b6={fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#334155",padding:"4px 10px",cursor:"pointer",textAlign:"left",width:"100%"},m6={marginTop:4,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",padding:6},v6={width:"100%",padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,boxSizing:"border-box"},_6={marginTop:4,maxHeight:200,overflowY:"auto",display:"flex",flexDirection:"column",gap:2},x6={fontSize:11,color:"#94a3b8",padding:"8px 0",textAlign:"center"},w6={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,border:"none",background:"transparent",cursor:"pointer",padding:"6px 8px",borderRadius:4,textAlign:"left"},k6={fontSize:10,color:"#94a3b8"},S6={fontSize:10,color:"#64748b",fontFamily:"monospace",whiteSpace:"nowrap"},C6={borderTop:"1px solid #e2e8f0",marginTop:4},$6=new Set(["Span","P","H1","H2","H3","H4","H5","H6","A","Button","Li","Label"]);function E6(e,t){if(!e||e.iteration&&typeof e.iteration=="object")return!1;const n=t?.textBinding;if(n===!1)return!1;if(n===!0)return!0;const o=typeof e.name=="string"?e.name:"";return $6.has(o)?!0:typeof e.text=="string"}const yn={direction:"flexDirection",justify:"flexJustify",align:"flexAlign",wrap:"flexWrap",gap:"flexGap",enable:"flexEnable"},hi={grow:"flexItemGrow",selfAlign:"flexItemAlign",order:"flexItemOrder"};function Hf(e){const t=e?.flexEditor;return t==="container"||t==="item"||t==="auto"?t:null}function I6(e){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return!1;const t=(window.getComputedStyle(e).display??"").toLowerCase();return t==="flex"||t==="inline-flex"}function A6(e,t,n=Wt){if(!e||!t)return!1;const o=To(e,t,n),r=t.options,s=Array.isArray(r)?t.onValue??r[0]?.value:void 0,a=l=>s!==void 0?l===s:l!==void 0&&l!==!1;return n.breakpoint!=="base"?a(o.scopedRawValue):o.matched&&a(o.value)}function T6(e,t,n=!1,o=!1,r=Wt){if(e==="container")return{showContainer:!0,showEnableButton:!1,showDisableButton:!1};if(e==="item")return{showContainer:!1,showEnableButton:!1,showDisableButton:!1};if(e==="auto"){const s=r.breakpoint==="base";return!o&&!s?{showContainer:!1,showEnableButton:!1,showDisableButton:!1}:(o?n:I6(t))?{showContainer:!0,showEnableButton:!1,showDisableButton:o}:{showContainer:!1,showEnableButton:!0,showDisableButton:!1}}return{showContainer:!1,showEnableButton:!1,showDisableButton:!1}}const D6={[yn.direction]:"layout_editor.flex.direction",[yn.justify]:"layout_editor.flex.justify",[yn.align]:"layout_editor.flex.align",[yn.wrap]:"layout_editor.flex.wrap",[yn.gap]:"layout_editor.flex.gap"},N6={[hi.grow]:"layout_editor.flex.item_grow",[hi.selfAlign]:"layout_editor.flex.item_align",[hi.order]:"layout_editor.flex.item_order"};function z6({node:e,spec:t,capability:n,t:o,onPatchNode:r,liveElement:s,scope:a=Wt}){const l=Hf(n),d=Ct(t,yn.enable),c=A6(e,d,a),{showContainer:p,showEnableButton:f,showDisableButton:y}=T6(l,s,c,!!d,a),g=Object.values(yn).filter(_=>_!==yn.enable&&Ct(t,_)),m=Object.values(hi).filter(_=>Ct(t,_)),h=d?.options,v=d?.onValue??h?.[0]?.value??!0,b=Array.isArray(h)&&h.length>=2?h[1].value:void 0,x=()=>{if(!d)return;const _=fn(e,d,v,a);r(_)},k=()=>{if(!d)return;const _=a.breakpoint!=="base"&&b!==void 0?b:void 0,S=fn(e,d,_,a);r(S)},w=(_,S,E)=>i.jsx("div",{"data-testid":E,style:{display:"flex",flexDirection:"column"},children:_.map(C=>{const N=Ct(t,C);if(!N)return null;const $=N.label?N:{...N,label:`$t:${S[C]}`};return i.jsx(pi,{controlKey:C,control:$,node:e,t:o,onPatch:r,scope:a},C)})});return i.jsxs("div",{className:"g7le-flex-editor","data-testid":"g7le-flex-editor",style:{display:"flex",flexDirection:"column",gap:12},children:[f&&i.jsx("button",{type:"button","data-testid":"g7le-flex-enable",onClick:x,style:M6,children:o("layout_editor.flex.make_flex")}),p&&g.length>0&&i.jsxs("div",{className:"g7le-flex-container-section","data-testid":"g7le-flex-container-section",children:[i.jsx("div",{style:Ff,children:o("layout_editor.flex.container_title")}),w(g,D6,"g7le-flex-container-controls"),y&&i.jsx("button",{type:"button","data-testid":"g7le-flex-disable",onClick:k,style:L6,children:o("layout_editor.flex.unmake_flex")})]}),l==="item"&&m.length>0&&i.jsxs("div",{className:"g7le-flex-item-section","data-testid":"g7le-flex-item-section",children:[i.jsx("div",{style:Ff,children:o("layout_editor.flex.item_title")}),w(m,N6,"g7le-flex-item-controls")]}),!p&&!f&&l!=="item"&&i.jsx("div",{"data-testid":"g7le-flex-empty",style:P6,children:o("layout_editor.flex.not_flex")})]})}const Ff={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:6},M6={padding:"8px 12px",fontSize:12,border:"1px dashed #2563eb",borderRadius:6,background:"#eff6ff",color:"#2563eb",cursor:"pointer"},L6={marginTop:8,padding:"6px 10px",fontSize:12,border:"1px solid #e2e8f0",borderRadius:6,background:"#f8fafc",color:"#64748b",cursor:"pointer"},P6={fontSize:12,color:"#94a3b8",padding:"16px 0",textAlign:"center"},Kf=["desktop","tablet","mobile","portable"],Na=1280,O6=820,B6=390,W6=1920,j6=320;function H6(e){const t=[],n=new Set,o=r=>{if(!r||typeof r!="object")return;const s=r.responsive;if(s&&typeof s=="object")for(const a of Object.keys(s)){n.has(a)||(n.add(a),t.push(a));const l=s[a]?.children;if(Array.isArray(l))for(const d of l)o(d)}if(Array.isArray(r.children))for(const a of r.children)o(a)};if(Array.isArray(e))for(const r of e)o(r);return t}function F6(e){const t=[...Kf],n=new Set(Kf);for(const o of H6(e))!n.has(o)&&!t.includes(o)&&t.push(o);return t}function K6(e,t){const n=e?.responsive;if(!n||typeof n!="object")return[];const o=[];for(const r of Object.keys(n)){const s=n[r];!s||!Array.isArray(s.children)||r!==t&&o.push(r)}return o}function V6(e){switch(e){case"desktop":return Na;case"tablet":return O6;case"mobile":return B6}const t=e in Ao?Ao[e]:Mn.parseRange(e);return!t||!Number.isFinite(t.max)?Na:Math.round(Math.max(j6,Math.min(W6,t.max)))}function Vf(){const t=Ft()?.document?.raw?.components;return u.useMemo(()=>F6(t??null),[t])}const U6={desktop:"layout_editor.property_modal.scope.device_desktop",tablet:"layout_editor.property_modal.scope.device_tablet",mobile:"layout_editor.property_modal.scope.device_mobile",portable:"layout_editor.property_modal.scope.device_portable"},q6=[{key:"base",labelKey:"layout_editor.property_modal.scope.scheme_light"},{key:"dark",labelKey:"layout_editor.property_modal.scope.scheme_dark"}];function Uf({scope:e,onChange:t,node:n,t:o,showColorScheme:r=!0,onClearScope:s}){const[a,l]=u.useState(!1),[d,c]=u.useState(""),[p,f]=u.useState(""),[y,g]=u.useState(null),m=Vf(),h=u.useMemo(()=>{const k=["base",...m],w=new Set(k);for(const _ of Object.keys(n.responsive??{}))_!=="base"&&!w.has(_)&&(w.add(_),k.push(_));return e.breakpoint!=="base"&&!w.has(e.breakpoint)&&k.push(e.breakpoint),k},[m,n.responsive,e.breakpoint]),v=k=>t({...e,colorScheme:k}),b=k=>t({...e,breakpoint:k}),x=()=>{const k=d.trim(),w=p.trim();if(k===""&&w===""){g(o("layout_editor.property_modal.scope.custom_invalid"));return}const _=`${k}-${w}`;if(!uC(_)){g(o("layout_editor.property_modal.scope.custom_invalid"));return}g(null),l(!1),c(""),f(""),b(_)};return i.jsxs("div",{className:"g7le-style-scope-tabs","data-testid":"g7le-style-scope-tabs",style:G6,children:[r&&i.jsx("div",{className:"g7le-style-scope-scheme","data-testid":"g7le-style-scope-scheme",role:"tablist","aria-label":o("layout_editor.property_modal.scope.scheme_light"),style:qf,children:q6.map(k=>{const w=e.colorScheme===k.key;return i.jsxs("button",{type:"button",role:"tab","aria-selected":w,"data-testid":`g7le-style-scheme-${k.key}`,"data-active":w?"true":"false",onClick:()=>v(k.key),style:Gf(w),children:[o(k.labelKey),k.key==="dark"&&Gs(n,{colorScheme:"dark",breakpoint:e.breakpoint})&&i.jsx("span",{"data-testid":"g7le-style-scheme-dark-dot",style:Yf})]},k.key)})}),i.jsxs("div",{className:"g7le-style-scope-device","data-testid":"g7le-style-scope-device",role:"tablist","aria-label":o("layout_editor.property_modal.scope.device_base"),style:qf,children:[h.map(k=>{const w=e.breakpoint===k,_=k==="base"||xu(k),S=k==="base"?"layout_editor.property_modal.scope.device_base":U6[k],E=S?o(S):k,C=_?`g7le-style-bp-${k}`:`g7le-style-bp-custom-${k}`;return i.jsxs("button",{type:"button",role:"tab","aria-selected":w,"data-testid":C,"data-active":w?"true":"false",onClick:()=>b(k),style:Gf(w),children:[E,Gs(n,{colorScheme:"base",breakpoint:k})&&i.jsx("span",{"data-testid":`${C}-dot`,style:Yf})]},String(k))}),i.jsxs("button",{type:"button","data-testid":"g7le-style-bp-add-custom",onClick:()=>l(k=>!k),style:J6,children:["+ ",o("layout_editor.property_modal.scope.add_custom")]})]}),a&&i.jsxs("div",{className:"g7le-style-scope-custom-input","data-testid":"g7le-style-scope-custom-input",style:Y6,children:[i.jsx("input",{type:"number","data-testid":"g7le-style-custom-min",placeholder:o("layout_editor.property_modal.scope.custom_min"),value:d,onChange:k=>c(k.target.value),style:Xf}),i.jsx("span",{style:{color:"#94a3b8"},children:"—"}),i.jsx("input",{type:"number","data-testid":"g7le-style-custom-max",placeholder:o("layout_editor.property_modal.scope.custom_max"),value:p,onChange:k=>f(k.target.value),style:Xf}),i.jsx("button",{type:"button","data-testid":"g7le-style-custom-confirm",onClick:x,style:Z6,children:o("layout_editor.property_modal.scope.add_custom")})]}),y&&i.jsx("div",{"data-testid":"g7le-style-custom-error",style:Q6,children:y}),e.breakpoint!=="base"&&!xu(e.breakpoint)&&i.jsx("div",{"data-testid":"g7le-style-custom-priority-note",style:R6,children:o("layout_editor.property_modal.scope.custom_priority_note")}),s&&Gs(n,e)&&i.jsxs("button",{type:"button","data-testid":"g7le-style-scope-reset",onClick:s,style:X6,children:["↺ ",o("layout_editor.property_modal.scope.reset_to_base")]})]})}const G6={display:"flex",flexDirection:"column",gap:0,padding:"0 0 8px",borderBottom:"1px solid #e2e8f0",marginBottom:8},Y6={display:"flex",gap:6,alignItems:"center",marginTop:4},qf={display:"flex",gap:2,flexWrap:"wrap",borderBottom:"1px solid #e2e8f0",margin:"0 -16px",padding:"0 12px"};function Gf(e){return{display:"inline-flex",alignItems:"center",gap:4,padding:"6px 12px",fontSize:12,border:"none",borderBottom:`2px solid ${e?"#2563eb":"transparent"}`,background:"transparent",color:e?"#2563eb":"#64748b",cursor:"pointer",fontWeight:e?700:500,marginBottom:-1}}const Yf={display:"inline-block",width:5,height:5,borderRadius:3,background:"#f59e0b"},X6={alignSelf:"flex-start",marginTop:2,padding:"3px 8px",fontSize:10,border:"1px solid #cbd5e1",borderRadius:6,background:"#f8fafc",color:"#475569",cursor:"pointer"},J6={padding:"6px 12px",fontSize:11,border:"none",borderBottom:"2px dashed #cbd5e1",background:"transparent",color:"#475569",cursor:"pointer",marginBottom:-1},Xf={width:70,padding:"4px 6px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6},Z6={padding:"4px 10px",fontSize:11,border:"none",borderRadius:6,background:"#2563eb",color:"#fff",cursor:"pointer"},Q6={fontSize:11,color:"#dc2626"},R6={fontSize:10,color:"#94a3b8"},Jf=new Map;function Pn(e,t){Jf.set(e,t)}function eT(e){return e?Jf.get(e)??null:null}const za={id:{label:"$t:layout_editor.core_props.id.label",widget:"core-id",placeholder:"$t:layout_editor.core_props.id.placeholder",apply:{type:"propValue",propKey:"id"}},dataKey:{label:"$t:layout_editor.core_props.dataKey.label",widget:"core-datakey",placeholder:"$t:layout_editor.core_props.dataKey.placeholder",apply:{type:"nodeKey",nodeKey:"dataKey"}},isolatedState:{label:"$t:layout_editor.core_props.isolatedState.label",widget:"toggle",apply:{type:"nodeKey",nodeKey:"isolatedState"}},isolatedScopeId:{label:"$t:layout_editor.core_props.isolatedScopeId.label",widget:"core-scopeid",placeholder:"$t:layout_editor.core_props.isolatedScopeId.placeholder",apply:{type:"nodeKey",nodeKey:"isolatedScopeId"}}},tT=["id"];function nT(e){return e===!1?[]:Array.isArray(e)?e.filter(t=>t in za):[...tT]}function Zf(e){const t=e.props?.id??e.id;return typeof t=="string"&&t.length>0?`${t}-scope`:"scope"}function oT({node:e,onPatchNode:t,t:n,scopeIdCandidates:o=[],usedScopeIds:r=[]}){const s=e,a="isolatedState"in s&&s.isolatedState!=null,l=typeof s.isolatedScopeId=="string"?s.isolatedScopeId:"",[d,c]=u.useState(""),p=()=>{const h={...e};a?(delete h.isolatedState,delete h.isolatedScopeId):(h.isolatedState={},h.isolatedScopeId=Zf(e)),t(h)},f=h=>{const v={...e};v.isolatedScopeId=h.trim()===""?Zf(e):h,t(v)},y=h=>{const v={...e};v.isolatedState=h,t(v)},g=u.useMemo(()=>{const h=d.trim().toLowerCase();return o.filter(v=>!h||v.toLowerCase().includes(h))},[o,d]),m=l!==""&&r.includes(l);return i.jsxs("div",{className:"g7le-isolated-scope","data-testid":"g7le-isolated-scope-control",style:rT,children:[i.jsx("div",{style:iT,children:n("layout_editor.core_props.isolatedState.label")}),i.jsxs("div",{style:sT,children:[i.jsx("button",{type:"button","data-testid":"g7le-isolated-toggle",role:"switch","aria-checked":a,onClick:p,style:aT(a),children:n(a?"layout_editor.overlay.on":"layout_editor.overlay.off")}),a?null:i.jsx("span",{"data-testid":"g7le-isolated-off-hint",style:lT,children:n("layout_editor.core_props.isolatedState.off_hint")})]}),a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:Qf,children:[i.jsx("label",{style:Rf,children:n("layout_editor.core_props.isolatedScopeId.label")}),i.jsx("input",{type:"text","data-testid":"g7le-isolated-scopeid-input",value:l,placeholder:n("layout_editor.core_props.isolatedScopeId.placeholder"),onChange:h=>f(h.target.value),style:dT}),g.length>0?i.jsxs("div",{"data-testid":"g7le-isolated-scopeid-picker",style:cT,children:[i.jsx("input",{type:"text","data-testid":"g7le-isolated-scopeid-search",value:d,placeholder:n("layout_editor.core_props.isolatedScopeId.search"),onChange:h=>c(h.target.value),style:uT}),i.jsx("div",{style:pT,children:g.map(h=>i.jsx("button",{type:"button","data-testid":`g7le-isolated-scopeid-candidate-${h}`,onClick:()=>{f(h),c("")},style:fT,children:h},h))})]}):null,m?i.jsxs("p",{"data-testid":"g7le-isolated-scopeid-dup",style:gT,children:["ⓘ ",n("layout_editor.core_props.isolatedScopeId.duplicate")]}):null]}),i.jsxs("div",{style:Qf,children:[i.jsx("label",{style:Rf,children:n("layout_editor.core_props.isolatedState.initial_label")}),i.jsx("div",{"data-testid":"g7le-isolated-initial-value",children:i.jsx(Nn,{value:s.isolatedState??{},onChange:y,t:n,path:"isolatedState",scope:"isolated-node"})})]})]}):null]})}const rT={display:"flex",flexDirection:"column",gap:8,padding:10,border:"1px solid #e2e8f0",borderRadius:8,minWidth:0},iT={fontSize:12,fontWeight:700,color:"#0f172a"},sT={display:"flex",gap:8,alignItems:"center"},aT=e=>({padding:"4px 12px",fontSize:11,border:`1px solid ${e?"#3b82f6":"#cbd5e1"}`,borderRadius:14,background:e?"#eff6ff":"#fff",color:e?"#1d4ed8":"#64748b",cursor:"pointer"}),lT={fontSize:11,color:"#94a3b8"},Qf={display:"flex",flexDirection:"column",gap:4,minWidth:0},Rf={fontSize:11,color:"#64748b"},dT={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,boxSizing:"border-box",width:"100%"},cT={border:"1px solid #e2e8f0",borderRadius:6,padding:4,background:"#fff"},uT={width:"100%",padding:"4px 6px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,marginBottom:4,boxSizing:"border-box"},pT={display:"flex",flexDirection:"column",maxHeight:120,overflowY:"auto"},fT={textAlign:"left",padding:"4px 6px",fontSize:12,border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"#0f172a"},gT={margin:0,fontSize:11,color:"#64748b"},hT={borderTop:"2px solid #c7d2fe",background:"#eef2ff",padding:"10px 12px",display:"flex",flexDirection:"column",gap:8},eg={fontSize:13,fontWeight:700,color:"#3730a3",display:"flex",alignItems:"center",gap:6},yT={fontSize:11,fontWeight:600,color:"#4338ca",background:"#e0e7ff",border:"1px solid #c7d2fe",borderRadius:4,padding:"1px 6px"},Ma={fontSize:11,color:"#6366f1"},bT={alignSelf:"flex-start",fontSize:12,fontWeight:600,color:"#fff",background:"#4f46e5",border:"none",borderRadius:4,padding:"4px 10px",cursor:"pointer"},mT={opacity:.5,cursor:"not-allowed"},vT={fontSize:11,color:"#dc2626"};function _T({entry:e,t,onSave:n}){const[o,r]=u.useState(()=>e.props),[s,a]=u.useState(!0),[l,d]=u.useState(null),[c,p]=u.useState(!1),[f,y]=u.useState(!1),g=e.extensionName??e.extensionIdentifier??`#${e.extensionId}`,m=async()=>{if(!s){d(t("layout_editor.property_modal.injected_props.invalid_json"));return}d(null),p(!0),y(!1);try{await n(o),y(!0)}catch(h){d(h instanceof Error?h.message:String(h))}finally{p(!1)}};return i.jsxs("div",{"data-testid":`g7le-injected-props-entry-${e.extensionId}`,style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("div",{style:eg,children:i.jsx("span",{style:yT,"data-testid":"g7le-injected-props-origin-badge",children:t("layout_editor.property_modal.injected_props.origin",{source:g})})}),i.jsx(Bs,{value:o,shape:"object",emptyValue:{},testidPrefix:"g7le-injected-props-json",minHeight:80,invalidErrorKey:"layout_editor.property_modal.injected_props.invalid_json",shapeErrorKey:"layout_editor.property_modal.injected_props.invalid_json",t,onChange:h=>{r(h??{}),y(!1)},onValidityChange:h=>{a(h),h&&d(null),y(!1)}}),l&&i.jsx("div",{style:vT,"data-testid":"g7le-injected-props-error",children:l}),f&&i.jsx("div",{style:{...Ma,color:"#16a34a"},"data-testid":"g7le-injected-props-saved",children:t("layout_editor.property_modal.injected_props.saved")}),i.jsx("div",{style:Ma,children:t("layout_editor.property_modal.injected_props.save_target")}),i.jsx("button",{type:"button","data-testid":"g7le-injected-props-save",style:{...bT,...c||!s?mT:null},disabled:c||!s,onClick:m,children:c?t("layout_editor.property_modal.injected_props.saving"):t("layout_editor.property_modal.injected_props.save_button",{source:g})})]})}function xT({injectedProps:e,t,onSaveInjectedProps:n}){return!Array.isArray(e)||e.length===0?null:i.jsxs("div",{style:hT,"data-testid":"g7le-injected-props-section",children:[i.jsxs("div",{style:eg,children:["🧩 ",t("layout_editor.property_modal.injected_props.title")]}),i.jsx("div",{style:Ma,children:t("layout_editor.property_modal.injected_props.help")}),e.map(o=>i.jsx(_T,{entry:o,t,onSave:r=>n(o.extensionId,r)},o.extensionId))]})}function wT(e,t){const n=e?.components??{};for(const o of Object.values(n)){const r=o?.find(s=>s.name===t);if(r)return r}return null}function kT({node:e,spec:t,manifest:n,t:o,onPatchNode:r,onClose:s,onDelete:a,permissionCandidates:l,pageCandidates:d,dataSourceCandidates:c,stateKeyCandidates:p,bindingCandidates:f,liveElement:y,scope:g=Wt,onScopeChange:m,templateIdentifier:h,initialTab:v,onSaveInjectedProps:b,branchLabel:x,isolatedScopeIdCandidates:k,usedScopeIds:w}){const _=e.__injectedProps,S=Array.isArray(_)&&_.length>0&&!!b,E=ve=>{m?.(ve)},C=()=>{r(mC(e,g))},N=typeof e.name=="string"?e.name:"",$=Oi(t,N),z=wT(n,N)?.settings,D=!!(z?.groups&&z.groups.length>0),O=Array.isArray($?.propControls)?$.propControls:[],M=nT($?.coreProps),B=new Set(M.map(ve=>za[ve].apply?.propKey)),T=O.filter(ve=>{const he=Ct(t,ve)?.apply?.propKey;return!(he!==void 0&&B.has(he))}),H=typeof $?.nodeEditor?.kind=="string"?$.nodeEditor.kind:void 0,L=$?.nodeEditor?.params,I=H?eT(H):null,P=!!I,F=Array.isArray($?.dataProps)?$.dataProps:[],G=F.length>0,V=!!(e.iteration&&typeof e.iteration=="object"),Y=E6(e,$),Z=M.length>0||T.length>0||P||G||Y||V,se=Array.isArray($?.styleControls)?$.styleControls:[],re=Array.isArray($?.advanced)?$.advanced:[],ee=(Array.isArray($?.events)?$.events:[]).length>0,fe=Hf($),K=se.length>0||fe!==null,me=!($?.visibilityCondition===!1)&&(Z||K||ee||D||re.length>0),Ce=u.useMemo(()=>{const ve=[];return D&&ve.push("settings"),Z&&ve.push("props"),K&&ve.push("style"),ee&&ve.push("action"),me&&ve.push("visibility"),ve.push("translation"),re.length>0&&ve.push("advanced"),ve},[D,Z,K,ee,me,re.length]),ze=T.length>0||P||G||V,[Se,qe]=u.useState(v&&Ce.includes(v)?v:D?"settings":ze?"props":K?"style":Z?"props":Ce[0]??"style"),De=yA(e),Pe=!Z&&!K&&!D&&!ee&&!me&&re.length===0,Qe=$?.label?$.label.startsWith("$t:")?o($.label.slice(3)):$.label:N||o("layout_editor.property_modal.element"),Me=(ve,te)=>{const he={...e.props??{}};te===void 0?delete he[ve]:he[ve]=te,r({...e,props:he})},Re={settings:o("layout_editor.property_modal.tab.settings"),props:o("layout_editor.property_modal.tab.props"),style:o("layout_editor.property_modal.tab.style"),action:o("layout_editor.property_modal.tab.action"),visibility:o("layout_editor.property_modal.tab.visibility"),translation:o("layout_editor.property_modal.tab.translation"),advanced:o("layout_editor.property_modal.tab.advanced")};return i.jsxs("div",{className:"g7le-property-modal","data-testid":"g7le-property-modal",style:ST,children:[i.jsxs("div",{"data-modal-drag-handle":!0,"data-testid":"g7le-property-modal-header",style:CT,children:[i.jsx("span",{"data-testid":"g7le-property-modal-title",style:{fontSize:14,fontWeight:700},children:D&&Se==="settings"?o("layout_editor.property_modal.settings_title",{name:Qe}):o("layout_editor.property_modal.title",{name:Qe})}),i.jsx("button",{type:"button","data-testid":"g7le-property-modal-close","aria-label":"close",onClick:s,style:$T,children:"✕"})]}),De&&i.jsx("div",{"data-testid":"g7le-property-modal-advanced-badge",style:ET,children:o("layout_editor.property_modal.advanced_badge")}),x&&i.jsx("div",{"data-testid":"g7le-property-modal-branch-badge",style:IT,children:o("layout_editor.property_modal.branch_badge",{device:x})}),i.jsx("div",{style:AT,role:"tablist",children:Ce.map(ve=>i.jsx("button",{type:"button",role:"tab","aria-selected":Se===ve,"data-testid":`g7le-property-tab-${ve}`,"data-active":Se===ve?"true":"false",onClick:()=>qe(ve),style:{...TT,color:Se===ve?"#2563eb":"#64748b",borderBottomColor:Se===ve?"#2563eb":"transparent"},children:Re[ve]},ve))}),i.jsxs("div",{style:DT,"data-testid":"g7le-property-modal-body",children:[Pe&&!S&&i.jsx("div",{"data-testid":"g7le-property-modal-no-editable",style:ng,children:o("layout_editor.property_modal.no_editable_props")}),S&&i.jsx(xT,{injectedProps:_,t:o,onSaveInjectedProps:b}),Se==="settings"&&z&&i.jsx(rA,{spec:z,node:e,t:o,onPatchProp:Me}),Se==="props"&&i.jsxs("div",{"data-testid":"g7le-property-props-tab",style:{display:"flex",flexDirection:"column"},children:[V&&i.jsx(i6,{node:e,candidates:f??[],t:o,onPatchNode:r}),G&&i.jsx(zA,{node:e,dataProps:F,candidates:f??[],t:o,onPatchNode:r}),Y&&i.jsx(e6,{node:e,candidates:f??[],t:o,onPatchNode:r,templateIdentifier:h}),P&&I&&i.jsx(I,{node:e,params:L,spec:t,manifest:n,t:o,onPatchNode:r,templateIdentifier:h,candidates:f}),M.map(ve=>i.jsx(pi,{controlKey:`core-${ve}`,control:za[ve],node:e,t:o,onPatch:r,scope:Wt,bindingCandidates:f},`core-${ve}`)),T.map(ve=>{const te=Ct(t,ve);return te?i.jsx(pi,{controlKey:ve,control:te,node:e,t:o,onPatch:r,scope:Wt,bindingCandidates:f},ve):null}),i.jsx(oT,{node:e,onPatchNode:r,t:o,scopeIdCandidates:k,usedScopeIds:w})]}),Se==="style"&&i.jsxs("div",{"data-testid":"g7le-property-style-tab",style:{display:"flex",flexDirection:"column"},children:[i.jsx("div",{style:tg,children:i.jsx(Uf,{scope:g,onChange:E,node:e,t:o,onClearScope:C})}),fe!==null&&i.jsx(z6,{node:e,spec:t,capability:$,t:o,onPatchNode:r,liveElement:y,scope:g}),se.map(ve=>{const te=Ct(t,ve);return te?i.jsx(pi,{controlKey:ve,control:te,node:e,t:o,onPatch:r,scope:g},ve):null})]}),Se==="action"&&i.jsx(AA,{node:e,spec:t,capability:$,t:o,onPatchNode:r,pageCandidates:d,dataSourceCandidates:c,stateKeyCandidates:p,bindingCandidates:f}),Se==="visibility"&&i.jsxs("div",{"data-testid":"g7le-property-visibility-tab",style:{display:"flex",flexDirection:"column"},children:[i.jsx("div",{style:tg,children:i.jsx(Uf,{scope:g,onChange:E,node:e,t:o,showColorScheme:!1})}),i.jsx($u,{node:e,spec:t,t:o,onPatchNode:r,dataSourceCandidates:c,stateKeyCandidates:p,scope:g})]}),Se==="translation"&&(h?i.jsx(Vd,{customKey:Kd(e),templateIdentifier:h,t:o,paramLabels:pv(e),onRemoveParam:ve=>{const te=typeof e.text=="string"?e.text:"";r({...e,text:bo(te,ve)});const he=Kd(e);h&&he&&kr(h,he,ve)}}):i.jsx("div",{"data-testid":"g7le-property-translation-deferred",style:ng,children:o("layout_editor.translation.not_a_key")})),Se==="advanced"&&i.jsx(mA,{node:e,advanced:re,t:o,onPatch:r,permissionCandidates:l})]}),i.jsxs("div",{style:NT,children:[i.jsx("span",{"data-testid":"g7le-property-modal-node-id",style:{fontSize:11,color:"#94a3b8"},children:typeof e.id=="string"||typeof e.id=="number"?`ID: ${e.id}`:""}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{type:"button","data-testid":"g7le-property-modal-delete",onClick:a,style:zT,children:o("layout_editor.property_modal.delete_element")}),i.jsx("button",{type:"button","data-testid":"g7le-property-modal-done",onClick:s,style:MT,children:o("layout_editor.property_modal.close")})]})]})]})}const ST={display:"flex",flexDirection:"column",width:420,maxWidth:"92vw"},CT={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #e2e8f0",cursor:"move",userSelect:"none"},$T={border:"none",background:"transparent",fontSize:14,cursor:"pointer",color:"#64748b"},ET={margin:"8px 16px 0",padding:"6px 10px",fontSize:11,background:"#fef3c7",color:"#92400e",borderRadius:6},IT={margin:"8px 16px 0",padding:"6px 10px",fontSize:11,background:"#dbeafe",color:"#1e40af",borderRadius:6},AT={display:"flex",gap:2,padding:"0 12px",borderBottom:"1px solid #e2e8f0",overflowX:"auto"},TT={padding:"8px 10px",fontSize:12,border:"none",borderBottom:"2px solid transparent",background:"transparent",cursor:"pointer",whiteSpace:"nowrap"},DT={padding:16,overflowY:"auto",maxHeight:"60vh"},tg={position:"sticky",top:-16,zIndex:2,background:"#fff",margin:"-16px -16px 0",padding:"6px 16px 0"},ng={fontSize:12,color:"#94a3b8",padding:"16px 0",textAlign:"center"},NT={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderTop:"1px solid #e2e8f0"},zT={padding:"6px 12px",fontSize:12,border:"1px solid #fecaca",borderRadius:6,background:"#fff",color:"#dc2626",cursor:"pointer"},MT={padding:"6px 12px",fontSize:12,border:"none",borderRadius:6,background:"#2563eb",color:"#fff",cursor:"pointer"},La="g7le:component-target-picked",Pa="g7le:component-target-pick-request";let LT=1;function PT({value:e,onChange:t,t:n,control:o}){const r=yo(),s=e==null?"":String(e),a=o?.allowManualInput!==!1,l=u.useCallback(()=>{if(typeof window>"u")return;const d=`pick-${LT++}`,p=r.stack[r.stack.length-1]?.id;p&&r.minimize(p,n("layout_editor.target_picker.minimized_hint"));const f=y=>{const g=y.detail;g?.requestId===d&&(window.removeEventListener(La,f),p&&r.restore(p),!g.cancelled&&typeof g.id=="string"&&t(g.id))};window.addEventListener(La,f),window.dispatchEvent(new CustomEvent(Pa,{detail:{requestId:d}}))},[r,t,n]);return i.jsx("div",{className:"g7le-component-target-picker","data-testid":"g7le-component-target-picker",children:i.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[a?i.jsx("input",{type:"text",className:"g7le-widget g7le-widget--text","data-testid":"g7le-component-target-input",value:s,placeholder:n("layout_editor.target_picker.id_placeholder"),onChange:d=>t(d.target.value===""?void 0:d.target.value),style:{flex:1,minWidth:0,padding:"6px 8px",border:"1px solid #cbd5e1",borderRadius:6,fontSize:13}}):i.jsx("span",{"data-testid":"g7le-component-target-value",style:{flex:1,minWidth:0},children:s||n("layout_editor.target_picker.none")}),i.jsxs("button",{type:"button","data-testid":"g7le-component-target-pick",onClick:l,style:{display:"flex",alignItems:"center",gap:4,padding:"6px 10px",background:"#1e293b",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontSize:13,whiteSpace:"nowrap"},children:[i.jsx("span",{"aria-hidden":"true",children:"🎯"}),n("layout_editor.target_picker.select_area")]})]})})}async function OT(e,t,n,o,r=fetch){const s=`/api/admin/templates/${encodeURIComponent(e)}/layout-extensions/${t}`;let a;try{a=await r(s,{headers:je(),credentials:"same-origin"})}catch(b){return{kind:"error",message:b instanceof Error?b.message:String(b)}}if(a.status===404)return{kind:"not_found"};if(!a.ok)return{kind:"error",message:`HTTP ${a.status}`};const l=await a.json().catch(()=>null),d=(l&&(l.data||l))??{};let c={};const p=d.content;if(typeof p=="string")try{c=JSON.parse(p)}catch{return{kind:"error",message:"invalid extension content"}}else p&&typeof p=="object"&&(c=p);const f=typeof d.lock_version=="number"?d.lock_version:0,y=Array.isArray(c.injections)?[...c.injections]:[],g=y.findIndex(b=>b&&b.position==="inject_props"&&b.target_id===n);if(g<0)return{kind:"injection_not_found"};y[g]={...y[g],props:o};const m={...c,injections:y};let h;try{h=await r(s,{method:"PUT",headers:je({"Content-Type":"application/json"}),credentials:"same-origin",body:JSON.stringify({content:m,expected_lock_version:f})})}catch(b){return{kind:"error",message:b instanceof Error?b.message:String(b)}}const v=await h.json().catch(()=>null);return h.ok?{kind:"success",newLockVersion:typeof v?.data?.lock_version=="number"?v.data.lock_version:f+1}:h.status===409?{kind:"conflict",currentVersion:v?.current_version??-1,yourVersion:v?.your_version??f}:{kind:"error",message:v?.message??`HTTP ${h.status}`}}const og=new Map;function Oa(e,t){og.set(e,t)}function BT(e){return e?og.get(e)??null:null}const rg="g7le.clipboard";function ig(){try{return typeof window>"u"||!window.sessionStorage?null:window.sessionStorage}catch{return null}}function WT(e){const t=JSON.parse(JSON.stringify(e)),n=o=>{for(const r of Object.keys(o))r.startsWith("__")&&delete o[r];Array.isArray(o.children)&&o.children.forEach(n)};return n(t),t}function sg(e,t=0){const n=ig();if(!n)return!1;try{const o={node:WT(e),copiedAt:t};return n.setItem(rg,JSON.stringify(o)),!0}catch{return!1}}function jT(){const e=ig();if(!e)return null;try{const t=e.getItem(rg);if(!t)return null;const n=JSON.parse(t);return!n||typeof n.node!="object"||n.node===null?null:JSON.parse(JSON.stringify(n.node))}catch{return null}}const Yo={nw:{width:-1,height:-1},n:{width:0,height:-1},ne:{width:1,height:-1},e:{width:1,height:0},se:{width:1,height:1},s:{width:0,height:1},sw:{width:-1,height:1},w:{width:-1,height:0}};function Ba(e){if(typeof e=="number")return e;if(typeof e=="string"){const t=e.match(/^(-?\d+(?:\.\d+)?)px$/);if(t)return Number(t[1])}return null}function HT(e,t){const n=Array.isArray(e.options)?e.options:[],o=Array.isArray(e.scale)?e.scale:[],r=n.length>0?n.map(l=>l.value):o;if(r.length===0)return;let s=r[0],a=1/0;return r.forEach((l,d)=>{const c=Ba(l)??d*40,p=Math.abs(c-t);p{if(!t)return;const m=Yo[y];if(m.width!==0&&!n||m.height!==0&&!o)return;const h=t.props?.style??{},v=s?.()??null,b=Ba(h.width)??(v?Math.round(v.width):0),x=Ba(h.height)??(v?Math.round(v.height):0);p.current={handle:y,startX:g.clientX,startY:g.clientY,startW:b,startH:x,node:t};const k=m.width!==0&&m.height!==0?"both":m.width!==0?"width":"height";d?.(k);let w=null;const _=E=>{const C=p.current;if(!C)return;const N=r||1,$=(E.clientX-C.startX)/N*Yo[C.handle].width,A=(E.clientY-C.startY)/N*Yo[C.handle].height;let z=C.node;if(Yo[C.handle].width!==0&&n){const D=ag(n,C.startW+$);z=fn(z,n,D)}if(Yo[C.handle].height!==0&&o){const D=ag(o,C.startH+A);z=fn(z,o,D)}w=z,a(z,k)},S=()=>{p.current=null,d?.(null),window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",S),w&&l?.(w,k)};window.addEventListener("pointermove",_),window.addEventListener("pointerup",S)},[t,n,o,r,a,l,d]);return{enabledAxes:c,onHandlePointerDown:f}}const lg=320,dg=1920,VT=1024;function Wa(e){return Number.isFinite(e)?Math.round(Math.max(lg,Math.min(dg,e))):VT}function ja(e={}){const{state:t,dispatch:n}=Je(),{previewDevice:o,previewZoom:r,previewCustomWidth:s,previewColorScheme:a}=t,l=o==="custom"?Wa(s):V6(o),d=u.useMemo(()=>{const g=e.availableWidth??l,m=l*r;return r>=1||m<=g?r:Math.min(r,g/l)},[l,r,e.availableWidth]),c=u.useCallback(g=>{n({type:"SET_PREVIEW_DEVICE",device:g})},[n]),p=u.useCallback(g=>{const m=Math.max(.5,Math.min(1,g));n({type:"SET_PREVIEW_ZOOM",zoom:m})},[n]),f=u.useCallback(g=>{n({type:"SET_PREVIEW_CUSTOM_WIDTH",width:Wa(g)})},[n]),y=u.useCallback(g=>{n({type:"SET_PREVIEW_COLOR_SCHEME",scheme:g})},[n]);return{device:o,deviceWidth:l,zoom:r,scale:d,customWidth:Wa(s),setDevice:c,setZoom:p,setCustomWidth:f,colorScheme:a,setColorScheme:y}}const yi="g7le-dnd-handle-";function UT(e){if(typeof e!="string"||!e.startsWith(yi))return null;const t=e.slice(yi.length);return t.length>0?t:null}function qT(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\\]]/g,"\\$&")}function GT(e,t,n,o){const r=o?.handleFallback??!1;if(e instanceof HTMLElement){const s=e.closest("[data-editor-path]");if(s)return s;const a=e.closest('[data-testid^="g7le-"]');if(a&&!(a.getAttribute("data-testid")??"").startsWith(yi))return null;if(r){const l=e.closest(`[data-testid^="${yi}"]`);if(l&&t){const d=UT(l.getAttribute("data-testid"));if(d){const c=t.querySelector(`[data-editor-path="${qT(d)}"]`);if(c)return c}}}}if(r&&n&&typeof document<"u"&&typeof document.elementsFromPoint=="function")for(const s of document.elementsFromPoint(n.x,n.y)){const a=s.closest?.("[data-editor-path]");if(a)return a}return null}function YT(e,t,n){if(typeof e=="string"&&e.trim().length>0)return{color:e};const o=typeof n?.color=="string"&&n.color.length>0,r=typeof t=="string"&&t.trim().length>0;return o||r?{}:{color:"#0f172a"}}const XT="#ffffff",JT="#0f172a";function ZT(e){const t=e.trim(),n=t.match(/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i);if(n)return[Number(n[1]),Number(n[2]),Number(n[3])];const o=t.replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(o)?[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)]:/^[0-9a-f]{6}$/i.test(o)?[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16)]:null}function QT(e){if(!e||/transparent/i.test(e))return!1;const t=e.trim().match(/^oklch\(\s*([\d.]+)(%?)/i);if(t)return(t[2]==="%"?Number(t[1])/100:Number(t[1]))>=.62;const n=ZT(e);if(!n)return!1;const[o,r,s]=n;return .299*o+.587*r+.114*s>=180}function RT(e,t,n){const o=typeof n?.color=="string"?n.color:null;return QT(e??o??t)?JT:XT}function e4({box:e,initialValue:t,isCustomKey:n,t:o,onCommit:r,onCancel:s,mirrorClassName:a,mirrorStyle:l,nodeEffectiveColor:d,onOpenTranslations:c}){const p=u.useRef(null),f=u.useRef(!1),[y,g]=u.useState(t.trim().length>0),[m,h]=u.useState(null);u.useEffect(()=>{const w=p.current;if(w){w.textContent=t,w.focus();try{const _=window.document.createRange();_.selectNodeContents(w);const S=window.getSelection();S?.removeAllRanges(),S?.addRange(_)}catch{}f.current=!1}},[t]),u.useEffect(()=>{const w=p.current;if(!w||typeof window.getComputedStyle!="function"){h(null);return}try{h(window.getComputedStyle(w).color||null)}catch{h(null)}},[a,l]);const v=()=>(p.current?.textContent??"").trim(),b=()=>{f.current||(f.current=!0,r(v()))},x=()=>{f.current||(f.current=!0,s())},k=w=>{w.key==="Enter"&&!w.shiftKey?(w.preventDefault(),b()):w.key==="Escape"&&(w.preventDefault(),x())};return i.jsxs("div",{className:"g7le-inline-text-editor","data-testid":"g7le-inline-text-editor","data-custom-key":n?"true":"false",style:{position:"absolute",left:e.left,top:e.top,minWidth:Math.max(e.width,60),minHeight:e.height,pointerEvents:"auto",zIndex:1e4},children:[i.jsx("div",{ref:p,role:"textbox","aria-label":o("layout_editor.inline_edit.aria_label"),"aria-multiline":"false","data-testid":"g7le-inline-text-editable",className:a,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,onInput:()=>g(v().length>0),onKeyDown:k,onBlur:b,style:{outline:"2px solid #2563eb",outlineOffset:1,borderRadius:3,background:RT(d,m,l),padding:"2px 4px",minHeight:e.height,whiteSpace:"pre-wrap",wordBreak:"break-word",boxShadow:"0 2px 8px rgba(37, 99, 235, 0.25)",...l??{},...YT(d,a,l)}}),i.jsxs("div",{className:"g7le-inline-text-editor__hint","data-testid":"g7le-inline-text-editor-hint",style:{marginTop:2,display:"inline-flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[c?i.jsxs("button",{type:"button","data-testid":"g7le-inline-text-editor-open-translations",onMouseDown:w=>w.preventDefault(),onClick:w=>{w.preventDefault(),w.stopPropagation(),c()},title:o("layout_editor.inline_edit.open_translations"),style:{padding:"2px 8px",fontSize:11,background:n?"#eff6ff":"#f0fdf4",color:n?"#1d4ed8":"#15803d",border:`1px solid ${n?"#bfdbfe":"#bbf7d0"}`,borderRadius:4,display:"inline-flex",alignItems:"center",gap:4,cursor:"pointer",whiteSpace:"nowrap"},children:[i.jsx("span",{"aria-hidden":"true",children:"🌐"}),i.jsx("span",{children:o(n?"layout_editor.inline_edit.existing_key_hint":"layout_editor.inline_edit.new_key_hint")}),i.jsxs("span",{"aria-hidden":"true",style:{opacity:.7},children:["· ",o("layout_editor.inline_edit.open_translations")," ›"]})]}):i.jsx("span",{style:{padding:"2px 6px",fontSize:11,background:n?"#eff6ff":"#f0fdf4",color:n?"#1d4ed8":"#15803d",border:`1px solid ${n?"#bfdbfe":"#bbf7d0"}`,borderRadius:4,display:"inline-flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:n?i.jsxs(i.Fragment,{children:["⌐ ",o("layout_editor.inline_edit.existing_key_hint")]}):i.jsxs(i.Fragment,{children:["✎ ",o("layout_editor.inline_edit.new_key_hint")]})}),!y&&i.jsx("span",{"data-testid":"g7le-inline-text-editor-empty-warn",style:{color:"#b91c1c",marginLeft:4},children:o("layout_editor.inline_edit.empty_warning")})]})]})}function t4({box:e,node:t,customKey:n,initialChipValue:o,chipParamLabels:r,onKeyify:s,templateIdentifier:a,locale:l,t:d,candidates:c,onInsertBinding:p,onRemoveBinding:f,onCommit:y,onCancel:g}){const[m,h]=u.useState(null),v=u.useRef(""),[b,x]=u.useState(!1),k=u.useRef(!1),w=u.useRef(null),_=Ft(),S=u.useRef(()=>{}),[E,C]=u.useState(null),[N,$]=u.useState(!1),A=u.useRef(n??null);u.useEffect(()=>{n&&A.current!==n&&(A.current=n)},[n]);const z=u.useMemo(()=>{if(!n&&r)return r;const L={},I=mt(typeof t.text=="string"?t.text:"");for(const P of I?.params??[])L[P.name]=Vt(P.expression);return L},[t.text,n,r]);u.useEffect(()=>{let L=!1;if(!n){const I=o??"";return v.current=I,h(I),()=>{L=!0}}return(async()=>{const I=It(n,l);if(I!==void 0){v.current=I,h(I);return}const P=await cn(a,n);if(L)return;const F=P?.values?.[l]??"";v.current=F,h(F)})(),()=>{L=!0}},[a,n,l,o]);const D=async()=>{if(k.current)return;k.current=!0;const L=m??"";if(L===v.current){y();return}x(!0);let I=A.current;if(!I){if(!s){x(!1),k.current=!1;return}if(I=await s(L),x(!1),!I){k.current=!1;return}A.current=I,y();return}const P=await wo(a,I,l,L);if(x(!1),P.kind==="error"){k.current=!1;return}_?.markDirty?.(),y()},O=()=>{k.current||(k.current=!0,g())},M=L=>{C(L)},B=async L=>{if(!(E===null||!p||N)){$(!0);try{const I=A.current;I&&m!==null&&m!==v.current&&(await wo(a,I,l,m),v.current=m);const P=await p(E,L);P!==null&&(h(P),v.current=P,_?.markDirty?.())}finally{$(!1),C(null)}}},T=async L=>{if(!(!f||N)){$(!0);try{const I=A.current;I&&m!==null&&m!==v.current&&(await wo(a,I,l,m),v.current=m);const P=await f(L);P!==null&&(h(P),v.current=P,_?.markDirty?.())}finally{$(!1)}}},H=L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),D()):L.key==="Escape"&&(L.preventDefault(),O())};return S.current=()=>{D()},u.useEffect(()=>{const L=P=>{const F=w.current;if(!F)return;const G=P.target;if(G&&F.contains(G))return;const V=G;V&&V.closest&&V.closest('[data-testid="g7le-inline-toolbar"], .g7le-inline-toolbar')||S.current()},I=w.current?.ownerDocument??document;return I.addEventListener("pointerdown",L,!0),()=>I.removeEventListener("pointerdown",L,!0)},[]),i.jsxs("div",{ref:w,className:"g7le-inline-param-chip-editor","data-testid":"g7le-inline-param-chip-editor",onKeyDown:H,style:{position:"absolute",left:e.left,top:e.top,minWidth:Math.max(e.width,120),pointerEvents:"auto",zIndex:1e4,background:"#fff",border:"2px solid #2563eb",borderRadius:4,boxShadow:"0 2px 8px rgba(37,99,235,0.25)",padding:4},children:[m===null?i.jsx("div",{"data-testid":"g7le-inline-param-chip-loading",style:{fontSize:12,color:"#94a3b8",padding:4},children:d("layout_editor.translation.loading")}):i.jsx(mr,{value:m,onChange:h,t:d,paramLabels:z,testIdSuffix:"inline",onRequestInsert:p?M:void 0,onRemoveChip:f?L=>{T(L)}:void 0}),E!==null&&p&&i.jsx("div",{"data-testid":"g7le-inline-param-chip-insert-picker",style:{marginTop:4},children:i.jsx($t,{candidates:c??[],t:d,onSelect:L=>{B(L)},testIdSuffix:"inline-insert",defaultOpen:!0,floating:!1})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[i.jsx("button",{type:"button","data-testid":"g7le-inline-param-chip-save",disabled:b,onMouseDown:L=>L.preventDefault(),onClick:()=>{D()},style:{fontSize:11,border:"none",borderRadius:6,background:"#2563eb",color:"#fff",padding:"4px 12px",cursor:"pointer"},children:d(b?"layout_editor.translation.saving":"layout_editor.translation.save")}),i.jsx("span",{style:{fontSize:10,color:"#94a3b8"},children:d("layout_editor.translation.placeholder_locked")})]})]})}const n4=["fontWeight","fontBold","fontStyle","fontItalic","textDecoration","textUnderline","textAlign","fontSize","textColor"],o4={fontWeight:"B",fontBold:"B",fontStyle:"I",fontItalic:"I",textDecoration:"U",textUnderline:"U",textAlign:"≡",fontSize:"T",textColor:"A"},r4=[["fontWeight","fontBold"],["fontItalic","fontStyle"],["textUnderline","textDecoration"]];function cg({node:e,spec:t,t:n,onApplyControl:o,box:r,scope:s=Wt}){const a=typeof e.name=="string"?e.name:"",l=Oi(t,a),d=Array.isArray(l?.styleControls)?l.styleControls:[];let c=n4.filter(p=>d.includes(p)&&Ct(t,p)!==null);for(const p of r4){const f=p.filter(y=>c.includes(y));if(f.length>1){const y=f[0];c=c.filter(g=>!p.includes(g)||g===y)}}return c.length===0?null:i.jsx("div",{className:"g7le-inline-toolbar","data-testid":"g7le-inline-toolbar",role:"toolbar","aria-label":n("layout_editor.inline_edit.toolbar_label"),style:{position:"absolute",left:r.left,top:r.top-40,display:"inline-flex",gap:2,padding:4,background:"#0f172a",borderRadius:8,boxShadow:"0 4px 12px rgba(15, 23, 42, 0.35)",pointerEvents:"auto",zIndex:10001},children:c.map(p=>i.jsx(s4,{controlKey:p,node:e,spec:t,t:n,scope:s,onApplyControl:o},p))})}const i4={fontWeight:"bold",fontBold:"bold",fontStyle:"italic",fontItalic:"italic",textDecoration:"underline",textUnderline:"underline"};function ug(e,t){const n=r=>(r.split(/[-\s]/).pop()??r)===t||r===t;return e.find(r=>{const s=typeof r.value=="string"?r.value:"",a=Array.isArray(r.apply?.tokens)?r.apply.tokens:[];return n(s)||a.some(n)})?.value}function s4({controlKey:e,node:t,spec:n,t:o,scope:r,onApplyControl:s}){const[a,l]=u.useState(!1),d=Ct(n,e);if(!d)return null;const c=d.options,p=Array.isArray(c),f=To(t,d,r),y=i4[e],g=y&&Array.isArray(c)?ug(c,y):void 0,m=!y,h=g!==void 0?f.value===g:p&&f.matched&&f.value!==void 0&&f.value!=="",v=o(`layout_editor.inline_edit.format.${e}`),b=_=>typeof _.label=="string"?_.label.startsWith("$t:")?o(_.label.slice(3)):_.label:String(_.value??""),x=()=>{s(e,_=>{const S=To(_,d,r),E=Array.isArray(c)?ug(c,y):void 0,C=E!==void 0&&S.value===E?void 0:E;return fn(_,d,C,r)})},k=_=>{s(e,S=>{const C=To(S,d,r).value===_?void 0:_;return fn(S,d,C,r)}),l(!1)},w=_=>{if(_.preventDefault(),_.stopPropagation(),!m&&Array.isArray(c)){x();return}l(S=>!S)};return i.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[i.jsxs("button",{type:"button","data-testid":`g7le-inline-format-${e}`,"data-active":h?"true":"false","aria-label":v,"aria-pressed":p?h:void 0,title:v,onMouseDown:_=>_.preventDefault(),onClick:w,style:{display:"inline-flex",alignItems:"center",gap:5,height:28,padding:"0 9px",fontSize:12,border:"none",borderRadius:5,cursor:"pointer",background:h?"#2563eb":"transparent",color:"#ffffff",whiteSpace:"nowrap"},children:[i.jsx("span",{"aria-hidden":"true",style:{fontWeight:e==="fontWeight"||e==="fontBold"?700:600,fontStyle:e==="fontStyle"||e==="fontItalic"?"italic":"normal",textDecoration:e==="textDecoration"||e==="textUnderline"?"underline":"none"},children:o4[e]}),i.jsx("span",{children:v}),m&&i.jsx("span",{"aria-hidden":"true",style:{fontSize:9,opacity:.8},children:"▾"})]}),m&&a&&i.jsx("div",{"data-testid":`g7le-inline-popover-${e}`,role:"listbox",onMouseDown:_=>_.preventDefault(),style:{position:"absolute",top:32,left:0,minWidth:140,maxHeight:240,overflowY:"auto",background:"#0f172a",border:"1px solid #334155",borderRadius:8,boxShadow:"0 8px 24px rgba(15,23,42,0.45)",padding:4,zIndex:10002},children:Array.isArray(c)&&c.length>0?c.map((_,S)=>{const E=f.value===_.value;return i.jsxs("button",{type:"button",role:"option","aria-selected":E,"data-testid":`g7le-inline-option-${e}-${String(_.value??S)}`,onMouseDown:C=>C.preventDefault(),onClick:C=>{C.preventDefault(),C.stopPropagation(),k(_.value)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",fontSize:12,textAlign:"left",border:"none",borderRadius:5,cursor:"pointer",background:E?"#2563eb":"transparent",color:"#ffffff"},children:[typeof _.swatch=="string"&&i.jsx("span",{"aria-hidden":"true",style:{width:14,height:14,borderRadius:3,background:_.swatch,border:"1px solid rgba(255,255,255,0.3)"}}),i.jsx("span",{children:b(_)}),E&&i.jsx("span",{"aria-hidden":"true",style:{marginLeft:"auto"},children:"✓"})]},String(_.value??S))}):i.jsx(a4,{testid:`g7le-inline-freeinput-${e}`,placeholder:o(`layout_editor.inline_edit.prompt.${e}`),initial:typeof f.value=="string"?f.value:"",onSubmit:_=>{s(e,S=>fn(S,d,_,r)),l(!1)}})})]})}function a4({testid:e,placeholder:t,initial:n,onSubmit:o}){const[r,s]=u.useState(n);return i.jsx("input",{type:"text","data-testid":e,value:r,placeholder:t,autoFocus:!0,onMouseDown:a=>a.stopPropagation(),onChange:a=>s(a.currentTarget.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),o(r.trim()))},style:{width:130,padding:"6px 8px",fontSize:12,border:"1px solid #334155",borderRadius:5,background:"#1e293b",color:"#ffffff"}})}function l4(e){const{frameEl:t,manifest:n,nesting:o,componentPalette:r,spec:s=null,permissionCandidates:a,resolveRouteMatch:l,onNavigateToDestination:d,onSessionAddedPathsChange:c,onEditProps:p}=e,{state:f,dispatch:y}=Je(),{t:g}=tt(),m=ja(),h=u.useCallback((W,X)=>{const R=window.G7Core;if(R&&typeof R.t=="function"){const de=R.t(W,X);if(de&&de!==W&&!de.startsWith("$t:"))return de}return g(W,X)},[g]),v=Ft(),b=i7(50),x=yo(),k=u.useRef([]),w=u.useMemo(()=>v?.document?.raw?.components??[],[v?.document?.raw?.components]),_=u.useMemo(()=>w.length===0?null:{children:w},[w]),S=u.useMemo(()=>{if(f.editMode!=="extension")return;const W=/^__extension__\/(\d+)/.exec(f.selectedRoute?.path??"");return W?Number(W[1]):void 0},[f.editMode,f.selectedRoute?.path]),E=u.useMemo(()=>{if(f.editMode==="iteration_item"){const W=v?.document?.iterationContext?.sourceIndexPath;return Array.isArray(W)&&W.length>0?W:null}if(f.editMode==="modal"){const W=v?.document?.modalContext?.editIndexPath;return Array.isArray(W)&&W.length>0?W:null}return null},[f.editMode,v?.document?.iterationContext?.sourceIndexPath,v?.document?.modalContext?.editIndexPath]),C=JE({rootNode:_,editMode:f.editMode,currentExtensionId:S,editableRootPath:E,pathParser:Ze,resolveRouteMatch:l}),[N,$]=u.useState(null),[A,z]=u.useState(null),[D,O]=u.useState(null),M=u.useRef(null);M.current=D;const[B,T]=u.useState(null),H=u.useRef(null),L=u.useRef(null);L.current=C.selectedPath;const I=Pb(),[P,F]=u.useState(null),G=u.useCallback(W=>{if(!t)return;const X=Ze(W);if(!X)return;const R={children:Me.current.components},de=We(R,X),ye=I.classify(de);if(!ye.editable){Et({op:"inline_edit_blocked_binding",sourceState:ye.sourceState,componentPath:at(X),timestamp:Date.now()});return}const we=po(t,W);if(!we)return;const Te=de?.props??{},ke=fg(t,W);F({path:X,domPath:W,box:we,initialValue:ye.displayValue,isCustomKey:ye.sourceState==="custom_key",isParamKey:ye.isParamKey===!0,customKey:ye.customKey,chipValue:ye.chipValue,chipParamLabels:ye.chipParamLabels,mirrorClassName:typeof Te.className=="string"?Te.className:void 0,mirrorStyle:Te.style??void 0,nodeEffectiveColor:ke}),Et({op:"inline_edit_enter",sourceState:ye.sourceState,componentPath:at(X),timestamp:Date.now()})},[t,I]),V=u.useCallback(()=>{if(!t){$(null),z(null);return}z(po(t,C.selectedPath)),$(po(t,C.hoverPath))},[t,C.selectedPath,C.hoverPath,w]);u.useEffect(()=>{if(V(),typeof window<"u"&&typeof window.requestAnimationFrame=="function"){const W=window.requestAnimationFrame(()=>V());return()=>window.cancelAnimationFrame(W)}},[V]),u.useEffect(()=>{if(t)return kp(V,t)},[t,V]);const Y=u.useCallback((W,X)=>{if(typeof window>"u")return;window.dispatchEvent(new CustomEvent(La,{detail:X===null?{requestId:W,cancelled:!0}:{requestId:W,id:X}})),O(null),T(null);const R=H.current;R?C.handleSelect("",{dataset:{editorPath:R}}):C.clearSelection(),H.current=null},[C]);u.useEffect(()=>{if(typeof window>"u")return;const W=X=>{const R=X.detail;if(typeof R?.requestId!="string")return;const de=M.current;de&&de!==R.requestId&&Y(de,null),H.current=L.current,O(R.requestId)};return window.addEventListener(Pa,W),()=>window.removeEventListener(Pa,W)},[Y]),u.useEffect(()=>{if(!D)return;const W=X=>{X.key==="Escape"&&(X.preventDefault(),Y(D,null))};return window.addEventListener("keydown",W,!0),()=>window.removeEventListener("keydown",W,!0)},[D,Y]),u.useEffect(()=>{if(!t)return;const W=f.editMode==="iteration_item"||f.editMode==="modal",X=(xe,Ee)=>GT(xe,t,Ee?{x:Ee.clientX,y:Ee.clientY}:void 0,{handleFallback:W}),R=xe=>{const Ee=xe.dataset.editorPath??"",Fe=Ee?Ze(Ee):null,zt={children:Me.current.components},gt=Fe?We(zt,Fe):null,Mt=gt&&typeof gt.props?.id=="string"?gt.props.id:typeof gt?.id=="string"?gt.id:"";return Mt.startsWith("auto_")?"":Mt},de=xe=>{const Ee=X(xe.target,xe);if(!Ee)return;const Fe=M.current;if(Fe){xe.preventDefault(),xe.stopPropagation();const zt=R(Ee);zt&&Y(Fe,zt);return}xe.preventDefault(),xe.stopPropagation(),C.handleSelect(Ee.dataset.editorId??"",{currentTarget:Ee,dataset:Ee.dataset})},ye=xe=>{const Ee=X(xe.target,xe);if(M.current){if(!Ee){T(null);return}const Fe=po(t,Ee.dataset.editorPath??null);if(!Fe){T(null);return}T({box:Fe,hasId:R(Ee)!==""});return}if(!Ee){C.handleHover(null,{});return}C.handleHover(Ee.dataset.editorId??"",{currentTarget:Ee,dataset:Ee.dataset})},we=()=>{if(M.current){T(null);return}C.handleHover(null,{})},Te=xe=>{const Ee=X(xe.target,xe);if(!Ee)return;const Fe=Ee.dataset.editorPath??"";Fe&&(xe.preventDefault(),xe.stopPropagation(),G(Fe))},ke=t.parentElement??t;return ke.addEventListener("click",de,!0),ke.addEventListener("mousemove",ye,!0),ke.addEventListener("mouseleave",we,!0),ke.addEventListener("dblclick",Te,!0),()=>{ke.removeEventListener("click",de,!0),ke.removeEventListener("mousemove",ye,!0),ke.removeEventListener("mouseleave",we,!0),ke.removeEventListener("dblclick",Te,!0)}},[t,C,G,f.editMode,Y]);const Z=u.useMemo(()=>{const W=C.selectedPath;if(!W)return null;const X=W.match(/^(.*)\.children\.\d+$/);return X?X[1]:null},[C.selectedPath]),se=u.useCallback(()=>{Z&&C.handleSelect("",{dataset:{editorPath:Z}})},[Z,C]),re=u.useMemo(()=>!t||!C.selectedPath?null:t.querySelector(`[data-editor-path="${an(C.selectedPath)}"]`),[t,C.selectedPath]),U=u.useMemo(()=>C.selectedPath?Ze(C.selectedPath):null,[C.selectedPath]),ee=u.useMemo(()=>{if(!U)return null;const W=U.find(et);if(!W)return null;const{i18nKey:X,raw:R}=gC(W.responsive);return X?g(X):g("layout_editor.overlay.branch_custom",{range:R})},[U,g]),fe=u.useMemo(()=>C.selectedPath?C.selectedIsIteration&&C.selectedIterationSourcePath?C.selectedIterationSourcePath:C.selectedPath:null,[C.selectedPath,C.selectedIsIteration,C.selectedIterationSourcePath]),K=u.useMemo(()=>fe?Ze(fe):null,[fe]),ne=u.useMemo(()=>!t||!fe?null:t.querySelector(`[data-editor-path="${an(fe)}"]`),[t,fe]),me=u.useMemo(()=>{if(ne?.parentElement)return ne.parentElement;if(!t||!fe)return null;const W=fe.match(/^(.*)\.children\.\d+$/);return W?t.querySelector(`[data-editor-path="${an(W[1])}"]`):null},[ne,t,fe]),Ce=u.useMemo(()=>{const W=C.selectedNode;return W&&(typeof W.name=="string"?W.name:typeof W.type=="string"?W.type:"")||null},[C.selectedNode]),ze=u.useMemo(()=>{if(C.selectedLockKind!=="extension")return null;const W=C.selectedNode?.__source;if(!W||W.kind!=="extension")return null;const X=W.extensionName?.trim(),R=W.extensionIdentifier?.trim();return X&&R?`${X} (${R})`:X||R||W.extensionSourceType||null},[C.selectedLockKind,C.selectedNode]),Se=n7({parentEl:me,selectedPath:K,selectedEl:ne}),qe=u.useMemo(()=>!t||!fe||fe===C.selectedPath?A:po(t,fe),[t,fe,A,C.selectedPath,w]),De=u.useRef(null),Pe=u.useCallback(()=>{const W=De.current;W&&(x.close(W),De.current=null)},[x]),Qe=u.useRef(()=>{}),Me=u.useRef({manifest:n,nesting:o,componentPalette:r,components:w});Me.current={manifest:n,nesting:o,componentPalette:r,components:w};const Re=u.useCallback(W=>{const X=W.insertion?.parentPath??[],R=W.insertion?.index??0,de=Me.current,ye=pg(de.components,X);Pe();const we=x.open({ariaLabel:h("layout_editor.palette.title"),width:880,maxHeightRatio:.82,content:u.createElement(Sf,{manifest:de.manifest,nesting:de.nesting,componentPalette:de.componentPalette??null,targetParentPath:X,targetContainerName:ye,onInsert:(Te,ke,xe)=>{Qe.current(Te,ke,xe)},insertionIndex:R,onClose:()=>Pe(),editorTemplateId:f.templateIdentifier,editorLocale:f.locale}),onClose:()=>{De.current=null}});De.current=we},[x,Pe]),ve=u.useMemo(()=>{if(!f.isPaletteOpen)return null;if(!U)return{parentPath:[],index:w.length};if(C.selectedLockKind!=="none"){const de=K;return!de||de.length===0?{parentPath:[],index:w.length}:{parentPath:de.slice(0,-1),index:(de[de.length-1]??0)+1}}const X=C.selectedNode,R=Array.isArray(X?.children)?X.children.length:0;return rI(X?.name,R,U,o,w.length)},[f.isPaletteOpen,U,K,C.selectedLockKind,C.selectedNode,w.length,o]),te=u.useCallback(()=>{y({type:"SET_PALETTE_OPEN",open:!1})},[y]),he=u.useRef(null);u.useEffect(()=>{if(!f.isPaletteOpen){const ye=he.current;ye&&(x.close(ye),he.current=null);return}if(!ve||he.current)return;const W=ve,X=Me.current,R=pg(X.components,W.parentPath),de=x.open({ariaLabel:h("layout_editor.palette.title"),width:880,maxHeightRatio:.82,content:u.createElement(Sf,{manifest:X.manifest,nesting:X.nesting,componentPalette:X.componentPalette??null,targetParentPath:W.parentPath,targetContainerName:R,onInsert:(ye,we,Te)=>{Qe.current(ye,we,Te),te()},insertionIndex:W.index,onClose:()=>te(),editorTemplateId:f.templateIdentifier,editorLocale:f.locale}),onClose:()=>{he.current=null,y({type:"SET_PALETTE_OPEN",open:!1})}});he.current=de},[f.isPaletteOpen,ve,x,te,y]);const Q=u.useRef({layoutName:null,pushed:!1});u.useEffect(()=>{const W=v?.document?.layoutName??null;if(!W){Q.current={layoutName:null,pushed:!1};return}Q.current.layoutName!==W&&(b.clear(),b.push({actionKind:"inline_text_edit",label:"baseline",snapshot:w}),Q.current={layoutName:W,pushed:!0})},[v?.document?.layoutName,w,b]);const ie=u.useRef(0);u.useEffect(()=>{const W=v?.saveSuccessCounter??0;W!==ie.current&&(ie.current=W,W!==0&&(b.clear(),b.push({actionKind:"inline_text_edit",label:"save_baseline",snapshot:w}),k.current=[],c?.([])))},[v?.saveSuccessCounter,w,b,c]);const _e=u.useRef(0);u.useEffect(()=>{const W=v?.reloadCounter??0;W!==_e.current&&(_e.current=W,W!==0&&(Q.current={layoutName:null,pushed:!1},k.current=[],c?.([])))},[v?.reloadCounter,c]);const ge=u.useCallback((W,X,R)=>{if(!v)return;let de=[];v.patchLayout(ke=>{const xe={children:ke},Ee=Ha(xe,X),Fe=R<0?Array.isArray(Ee?.children)?Ee.children.length:0:R,gt=Qi(xe,X,Fe,W).children??[];return de=gt,gt}),b.push({actionKind:"insert",label:`insert ${W.name??W.type??""}`,snapshot:de});const ye=Ha({children:de},X),we=R<0?Array.isArray(ye?.children)?ye.children.length-1:0:R,Te=at([...X,we]);if(k.current=[...k.current,Te],c?.(k.current),t){const ke=`[data-editor-path="${an(Te)}"]`,xe=()=>{const Ee=t.querySelector(ke);Ee&&typeof Ee.scrollIntoView=="function"&&Ee.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(()=>window.requestAnimationFrame(xe)):setTimeout(xe,32)}},[v,b,c,t]);Qe.current=ge;const Ae=u.useCallback(()=>{if(!v||!C.selectedNode||!U)return;const W=es(C.selectedNode);let X=[];v.patchLayout(R=>{const de={children:R},ye=U.slice(0,-1),we=U[U.length-1]??0,ke=Qi(de,ye,we+1,W).children??[];return X=ke,ke}),b.push({actionKind:"insert",label:"duplicate",snapshot:X})},[v,C.selectedNode,U,b]),Ne=u.useCallback(()=>{if(!v||!U)return;let W=[];v.patchLayout(X=>{const ye=Ri({children:X},U).children??[];return W=ye,ye}),b.push({actionKind:"remove",label:"remove",snapshot:W}),C.clearSelection()},[v,U,b,C]),Le=u.useMemo(()=>{if(!C.selectedNode||!U||U.some(et))return null;const W=C.selectedNode;if(!Array.isArray(W.children))return null;const X=fC(f.previewDevice,W,f.previewCustomWidth);return{mode:X.mode,key:X.key,sourceKey:X.sourceKey}},[C.selectedNode,U,f.previewDevice,f.previewCustomWidth]),q=u.useCallback(()=>{if(!v||!U||Le?.mode!=="separate")return;const W=Le.key,X=Le.sourceKey;let R=[];v.patchLayout(de=>(R=$b({children:de},U,W,X).children??[],R)),b.push({actionKind:"insert",label:"separate_branch",snapshot:R})},[v,U,Le,b]),ae=u.useCallback(()=>{if(!v||!U||Le?.mode!=="merge")return;const W=Le.key;let X=[];v.patchLayout(R=>(X=Eb({children:R},U,W).children??[],X)),b.push({actionKind:"remove",label:"merge_branch",snapshot:X})},[v,U,Le,b]),pe=u.useCallback(W=>{switch(W){case"mobile":return g("layout_editor.context_menu.device_mobile");case"portable":return g("layout_editor.context_menu.device_portable");case"tablet":return g("layout_editor.context_menu.device_tablet");case"desktop":return g("layout_editor.context_menu.device_desktop");default:return g("layout_editor.context_menu.device_custom",{range:W})}},[g]),$e=u.useMemo(()=>{if(!Le)return null;const W=pe(Le.key);return{separate:g("layout_editor.context_menu.separate_branch_device",{device:W}),merge:g("layout_editor.context_menu.merge_branch_device",{device:W})}},[Le,g,pe]),be=u.useMemo(()=>{if(!C.selectedNode||!U)return[];if(U.some(et))return[];const W=Ur(f.previewDevice,C.selectedNode,f.previewCustomWidth);return K6(C.selectedNode,W).map(X=>({key:X,label:pe(X)}))},[C.selectedNode,U,f.previewDevice,f.previewCustomWidth,pe]),j=u.useCallback(W=>{if(W==="desktop"||W==="tablet"||W==="mobile"||W==="portable"){m.setDevice(W);return}m.setDevice(W)},[m]),oe=u.useCallback(()=>{C.selectedNode&&sg(C.selectedNode)},[C.selectedNode]),ue=u.useCallback(()=>{C.selectedNode&&(sg(C.selectedNode),Ne())},[C.selectedNode,Ne]),J=u.useCallback(()=>{if(!v)return;const W=jT();if(!W)return;const X=es(W);if(U&&U.length>0){const R=U.slice(0,-1),de=(U[U.length-1]??0)+1;ge(X,R,de)}else ge(X,[],w.length)},[v,U,ge,w.length]),le=u.useCallback((W,X)=>{b.push({actionKind:"move",label:X,snapshot:W})},[b]),Ie=u.useCallback(()=>{if(C.selectedNavAffordance==="route_in_tree"&&C.selectedNavTargetPath){if(d){d(C.selectedNavTargetPath);return}y({type:"SELECT_ROUTE",route:{path:C.selectedNavTargetPath,layoutName:null}})}},[C.selectedNavAffordance,C.selectedNavTargetPath,d,y]),dt=u.useCallback(()=>{const W=Sb(C.selectedBaseLayout,f.selectedRoute?.layoutName);W&&y({type:"ENTER_BASE_EDIT",layoutName:W})},[C.selectedBaseLayout,f.selectedRoute?.layoutName,y]),pt=u.useCallback(()=>{const W=C.selectedNode?.__source?.extensionId;W!=null&&y({type:"ENTER_EXTENSION_EDIT",extensionId:String(W)})},[C.selectedNode,y]),ot=u.useCallback(()=>{const W=C.selectedIterationSourcePath;W&&y({type:"ENTER_ITERATION_ITEM_EDIT",sourcePath:W})},[C.selectedIterationSourcePath,y]),Oe=u.useRef(null),He=u.useRef(null),Ye=u.useRef(null),Tt=u.useRef({colorScheme:"base",breakpoint:"base"}),Dt=Oe.current!==null?x.stack.some(W=>W.id===Oe.current):!1,Nt=u.useMemo(()=>Nd(f.routeTree,h),[f.routeTree,h]),xn=u.useMemo(()=>zd(v?.document?.raw),[v?.document?.raw]),wn=u.useMemo(()=>Md(s),[s?.states]),Zt=u.useMemo(()=>{const W=v?.document?.raw,X=$f(W?.components),R=W?.initIsolated,de=R&&typeof R=="object"&&!Array.isArray(R)?Object.keys(R):[];return JI(X,de)},[v?.document?.raw]),Hn=u.useMemo(()=>{const W=v?.document?.raw;return $f(W?.components).map(X=>X.scopeId).filter(X=>typeof X=="string"&&X.length>0)},[v?.document?.raw]),ln=Dd({raw:v?.document?.raw,spec:s}),Ii=u.useCallback((W,X)=>{if(!v)return;const R={children:Me.current.components},de=We(R,W);if(!de)return;Tt.current={colorScheme:f.previewColorScheme==="dark"?"dark":"base",breakpoint:Ur(f.previewDevice,de,f.previewCustomWidth)};const ye=t?.getBoundingClientRect(),we=A&&ye?{left:ye.left+A.left,top:ye.top+A.top,width:A.width,height:A.height}:void 0,Te=re,ke=W.find(et),xe=ke?pe(ke.responsive):null,Ee=W.filter(kn=>typeof kn=="number"),Fe=ab({children:Me.current.components},Ee,lb(ln)),zt=Fe.length>0?[...ji({iterationVars:Fe}),...ln]:ln,gt=(kn,rM)=>u.createElement(kT,{key:`pem-${at(He.current??[])}`,node:kn,spec:s,manifest:Me.current.manifest,t:h,permissionCandidates:a,pageCandidates:Nt,dataSourceCandidates:xn,stateKeyCandidates:wn,bindingCandidates:zt,liveElement:Te,templateIdentifier:f.templateIdentifier,initialTab:rM,branchLabel:xe,isolatedScopeIdCandidates:Zt,usedScopeIds:Hn,onSaveInjectedProps:async(bt,Sn)=>{const Ai=typeof kn.id=="string"?kn.id:"",Fn=await OT(f.templateIdentifier,bt,Ai,Sn);if(st({op:"save",layoutName:`extension:${bt}`,editMode:f.editMode,saveTarget:"layout_extension",endpoint:`/api/admin/templates/${f.templateIdentifier}/layout-extensions/${bt}`,isDirty:!0,timestamp:Date.now()}),Fn.kind!=="success")throw new Error(Fn.kind==="conflict"?h("layout_editor.save.conflict"):Fn.kind==="injection_not_found"?"injection not found":Fn.kind==="not_found"?"extension not found":Fn.message??"save failed")},scope:Tt.current,onScopeChange:bt=>{Tt.current=bt;const Sn=Oe.current;Sn&&x.open({id:Sn,ariaLabel:h("layout_editor.property_modal.title"),width:420,draggable:!0,avoidRect:we,content:gt(kn),onClose:()=>{Oe.current=null,He.current=null}})},onPatchNode:bt=>{let Sn=[];v.patchLayout(Fn=>(Sn=Ot({children:Fn},W,()=>bt).children??[],Sn)),b.push({actionKind:"inline_text_edit",label:"edit_props",snapshot:Sn}),ir({source:"style_control",componentPath:at(W),componentName:typeof bt.name=="string"?bt.name:null,patchKey:null,timestamp:Date.now()});const Ai=Oe.current;Ai&&x.open({id:Ai,ariaLabel:h("layout_editor.property_modal.title"),width:420,draggable:!0,avoidRect:we,content:gt(bt),onClose:()=>{Oe.current=null,He.current=null}})},onDelete:()=>{const bt=Oe.current;bt&&x.close(bt),Ne()},onClose:()=>{const bt=Oe.current;bt&&x.close(bt)}});He.current=W;const Mt=x.open({ariaLabel:h("layout_editor.property_modal.title"),width:420,draggable:!0,avoidRect:we,content:gt(de,X),onClose:()=>{Oe.current=null,He.current=null,Ye.current=null}});Oe.current=Mt,Ye.current=kn=>{x.open({id:Mt,ariaLabel:h("layout_editor.property_modal.title"),width:420,draggable:!0,avoidRect:we,content:gt(kn),onClose:()=>{Oe.current=null,He.current=null,Ye.current=null}})}},[v,s,h,a,Nt,xn,wn,ln,re,b,x,Ne,t,A,f.previewColorScheme,f.previewDevice,f.previewCustomWidth,pe]);u.useEffect(()=>{const W=Ye.current,X=He.current;if(!W||!X)return;const R={children:Me.current.components},de=We(R,X);de?W(de):Oe.current&&x.close(Oe.current)},[w]);const Hz=()=>{if(!Dt)return null;const X={position:"absolute",background:"rgba(15, 23, 42, 0.45)",pointerEvents:"auto",zIndex:d7},R=ke=>{ke.preventDefault(),ke.stopPropagation()};if(!A)return i.jsx("div",{"data-testid":"g7le-edit-lock-full",onClick:R,onMouseMove:R,style:{...X,inset:0}});const{left:de,top:ye,width:we,height:Te}=A;return i.jsxs("div",{"data-testid":"g7le-edit-lock",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[i.jsx("div",{"data-testid":"g7le-edit-lock-top",onClick:R,onMouseMove:R,style:{...X,left:0,top:0,right:0,height:Math.max(0,ye)}}),i.jsx("div",{"data-testid":"g7le-edit-lock-bottom",onClick:R,onMouseMove:R,style:{...X,left:0,top:ye+Te,right:0,bottom:0}}),i.jsx("div",{"data-testid":"g7le-edit-lock-left",onClick:R,onMouseMove:R,style:{...X,left:0,top:ye,width:Math.max(0,de),height:Te}}),i.jsx("div",{"data-testid":"g7le-edit-lock-right",onClick:R,onMouseMove:R,style:{...X,left:de+we,top:ye,right:0,height:Te}})]})},ml=u.useCallback(()=>{if(U&&bp(C.selectedLockKind)){if(p&&C.selectedPath){p(C.selectedPath);return}Ii(U)}},[U,C.selectedPath,C.selectedLockKind,p,Ii]),{scale:vl}=m,_l=typeof C.selectedNode?.name=="string"?C.selectedNode.name:"",Lh=s?.componentCapabilities?.[_l]??null,Ph=Array.isArray(Lh?.styleControls)?Lh.styleControls:[],Fz=Ph.includes("width")?Ct(s,"width"):null,Kz=Ph.includes("height")?Ct(s,"height"):null,Vz=u.useCallback((W,X)=>{if(!v||!U)return;let R=[];v.patchLayout(de=>(R=Ot({children:de},U,()=>W).children??[],R)),ir({source:"resize",componentPath:at(U),componentName:_l||null,patchKey:X==="height"?"height":"width",resizeAxis:X,timestamp:Date.now()})},[v,U,_l]),Uz=u.useCallback((W,X)=>{if(!v||!U)return;let R=[];v.patchLayout(de=>(R=Ot({children:de},U,()=>W).children??[],R)),b.push({actionKind:"inline_text_edit",label:`resize ${X}`,snapshot:R})},[v,U,b]),qz=u.useCallback(()=>{if(!re)return null;const W=re.getBoundingClientRect(),X=vl||1;return{width:W.width/X,height:W.height/X}},[re,vl]),rr=KT({node:C.selectedNode,widthControl:Fz,heightControl:Kz,scale:vl,measureStartSize:qz,onResize:Vz,onResizeEnd:Uz}),Gz=u.useCallback((W,X)=>{rr.onHandlePointerDown(W,X)},[rr]),xl=u.useCallback(()=>{const W=b.undo();!W||!v||v.setLayoutComponents(W.snapshot)},[b,v]),wl=u.useCallback(()=>{const W=b.redo();!W||!v||v.setLayoutComponents(W.snapshot)},[b,v]);a7({onUndo:xl,onRedo:wl});const Yz=u.useMemo(()=>({copy:oe,cut:ue,paste:J,delete:Ne,openProps:ml,selectParent:Z?se:void 0,deselect:C.clearSelection}),[oe,ue,J,Ne,ml,Z,se,C.clearSelection]);Ru({handlers:Yz,hasSelection:!!C.selectedPath}),u.useEffect(()=>(window.__g7LayoutEditorHasSelection=!!C.selectedPath,()=>{try{delete window.__g7LayoutEditorHasSelection}catch{}}),[C.selectedPath]),u.useEffect(()=>(window.__g7LayoutEditorHistory={undo:xl,redo:wl,canUndo:b.canUndo,canRedo:b.canRedo},()=>{try{delete window.__g7LayoutEditorHistory}catch{}}),[xl,wl,b.canUndo,b.canRedo]);const Xz=u.useCallback(W=>{const X=P;F(null),X&&(async()=>{if((await I.commit(X.path,W)).kind==="created"&&v){const de=v.document?.raw?.components??[];b.push({actionKind:"inline_text_edit",label:"inline_create_key",snapshot:de})}})()},[P,I,v,b]),Oh=u.useCallback(()=>{const W=P;F(null),I.trackCancel(W?.path??null)},[P,I]),Jz=u.useCallback(()=>{F(null)},[]),Zz=u.useCallback(async W=>{const X=P;if(!X)return null;const R=await I.keyifyChipValue(X.path,W);if(R.kind!=="created"||!R.translationKey)return null;const de=v?.document?.raw?.components??[];return b.push({actionKind:"inline_text_edit",label:"inline_keyify_chip",snapshot:de}),R.translationKey},[P,I,v,b]),Qz=u.useCallback(()=>{const W=P;W&&(F(null),C.handleSelect("",{dataset:{editorPath:W.domPath}}),Ii(W.path,"translation"))},[P,C,Ii]),xt=u.useMemo(()=>{if(!P)return null;const W=v?.document?.raw?.components??w;return We({children:W},P.path)},[P,v?.document,w]),Rz=u.useCallback(async(W,X)=>{const R=P;if(!v||!R)return null;const de=typeof xt?.text=="string"?xt.text:"";let ye;if(R.isParamKey)ye=await wr(f.templateIdentifier,f.locale,de,W,X.sourceId,X.path,"scalar");else{const Fe=zt=>zt.replace(/\$t:[a-zA-Z0-9._-]+/g,gt=>{const Mt=h(gt.slice(3));return Mt&&Mt!==gt.slice(3)&&!Mt.startsWith("$t:")?Mt:""}).replace(/\s+/g," ").trim();ye=await ls(f.templateIdentifier,f.selectedRoute?.layoutName??null,f.locale,de,W,X.sourceId,X.path,"scalar",Fe,h)}if(ye.kind==="error")return null;const we=R.path;let Te=[];v.patchLayout(Fe=>(Te=Ot({children:Fe},we,Mt=>({...Mt,text:ye.text})).children??[],Te)),b.push({actionKind:"inline_text_edit",label:"inline_insert_binding",snapshot:Te});const ke=ye.kind==="ok"&&"key"in ye?ye.key:void 0;!R.isParamKey&&ke&&F(Fe=>Fe&&Fe.path===we?{...Fe,isParamKey:!0,customKey:ke,chipValue:void 0,chipParamLabels:void 0}:Fe);try{window.dispatchEvent(new CustomEvent(kt,{detail:{templateIdentifier:f.templateIdentifier,locale:f.locale}}))}catch{}const xe=mt(ye.text),Ee=R.customKey??xe?.key??"";return Ee?It(Ee,f.locale)??null:null},[v,P,xt,f.templateIdentifier,f.locale,f.selectedRoute,b,h]),eM=u.useCallback(async W=>{const X=P;if(!v||!X)return null;const R=typeof xt?.text=="string"?xt.text:"",de=mt(R),ye=X.customKey??de?.key??null,we=bo(R,W),Te=X.path;let ke=[];return v.patchLayout(xe=>(ke=Ot({children:xe},Te,zt=>({...zt,text:we})).children??[],ke)),b.push({actionKind:"inline_text_edit",label:"inline_remove_binding",snapshot:ke}),ye&&await kr(f.templateIdentifier,ye,W,f.locale),ye?It(ye,f.locale)??null:null},[v,P,xt,f.templateIdentifier,f.locale,b]),[kl,Bh]=u.useState({}),tM=["fontSize","color","fontStyle","textDecoration","textAlign","letterSpacing","lineHeight","fontFamily"];u.useEffect(()=>{if(!P||!t||typeof MutationObserver>"u"){Bh({});return}const W=`[data-editor-path="${an(P.domPath)}"]`,X=()=>{const ye=t.querySelector(W);if(!ye)return;const we={};for(const ke of tM){const xe=ye.style.getPropertyValue(ke.replace(/([A-Z])/g,"-$1").toLowerCase());xe&&(we[ke]=xe)}const Te=fg(t,P.domPath)??void 0;Bh({className:ye.className,style:we,effectiveColor:Te})};X();const R=t.querySelector(W);if(!R)return;const de=new MutationObserver(X);return de.observe(R,{attributes:!0,attributeFilter:["class","style"]}),de.observe(t,{childList:!0,subtree:!0}),()=>de.disconnect()},[P?.path?at(P.path):null,t]);const Wh=u.useCallback((W,X)=>{if(!v||!P)return;const R=P.path;let de=[],ye=null;v.patchLayout(we=>(de=Ot({children:we},R,xe=>{const Ee=X(xe);return ye=typeof Ee.name=="string"?Ee.name:null,Ee}).children??[],de)),b.push({actionKind:"inline_text_edit",label:`inline_format ${W}`,snapshot:de}),ir({source:"style_control",componentPath:at(R),componentName:ye,patchKey:W,timestamp:Date.now()})},[v,P,b]),ft=u.useMemo(()=>{const W=C.selectedPath;if(!W||!_)return null;const X=[];let R=W;for(;R;){X.push(R);const de=R.match(/^(.*)\.children\.\d+$/);R=de?de[1]:null}for(const de of X){const ye=Ze(de);if(!ye)continue;const we=We(_,ye),Te=typeof we?.name=="string"?we.name:null;if(!Te)continue;const ke=Oi(s,Te),xe=ke?.canvasOverlay?.kind;if(typeof xe!="string"||!xe||!we)continue;const Ee=ke.canvasOverlay.params&&typeof ke.canvasOverlay.params=="object"?ke.canvasOverlay.params:void 0,Fe=de===W?null:W.slice(de.length+1);return{kind:xe,params:Ee,tablePath:de,tableNode:we,selectedCellRel:Fe}}return null},[C.selectedPath,_,s]),ho=ft?BT(ft.kind):null,jh=u.useMemo(()=>!ho||!t||!ft?null:po(t,ft.tablePath),[ho,t,ft,A,w]),nM=u.useMemo(()=>{if(!ho||!t||!ft)return[];const W=ft.tablePath,X=an(W),R=[];return t.querySelectorAll(`[data-editor-path^="${X}.children."]`).forEach(we=>{const Te=we.dataset.editorPath??"";if(!Te.startsWith(W+"."))return;const ke=Te.slice(W.length+1),xe=so(we,t);xe&&R.push({path:ke,top:xe.top,left:xe.left,width:xe.width,height:xe.height})}),t.querySelectorAll(`[data-editor-item-path^="${X}."]`).forEach(we=>{const Te=we.dataset.editorItemPath??"";if(!Te.startsWith(W+"."))return;const ke=Te.slice(W.length+1),xe=so(we,t);xe&&R.push({path:ke,top:xe.top,left:xe.left,width:xe.width,height:xe.height})}),R},[ho,t,ft,A,w]),oM=u.useCallback(W=>{const X=ft?Ze(ft.tablePath):null;if(!v||!X)return;let R=[];v.patchLayout(de=>(R=Ot({children:de},X,()=>W).children??[],R)),b.push({actionKind:"inline_text_edit",label:"inplace_edit",snapshot:R}),ir({source:"style_control",componentPath:ft?.tablePath??"",componentName:typeof W.name=="string"?W.name:null,patchKey:"canvas_inplace",timestamp:Date.now()})},[v,U,b]);return t?i.jsxs("div",{className:"g7le-editor-canvas-overlay","data-testid":"g7le-editor-canvas-overlay",style:{position:"absolute",inset:0,pointerEvents:"none"},children:[!D&&Hz(),D&&i.jsxs("div",{"data-testid":"g7le-canvas-pick-banner",style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",zIndex:9999,display:"flex",alignItems:"center",gap:12,padding:"8px 14px",background:"#1e293b",color:"#fff",borderRadius:8,fontSize:13,boxShadow:"0 4px 12px rgba(0,0,0,0.25)",pointerEvents:"auto"},children:[i.jsxs("span",{children:["🎯 ",h("layout_editor.target_picker.canvas_pick_hint")]}),i.jsx("button",{type:"button","data-testid":"g7le-canvas-pick-cancel",onClick:()=>Y(D,null),style:{border:"1px solid #475569",borderRadius:6,background:"transparent",color:"#cbd5e1",cursor:"pointer",fontSize:12,padding:"3px 10px"},children:h("layout_editor.target_picker.cancel")})]}),f.editMode!=="route"&&i.jsx(kI,{frameEl:t,components:w,editMode:f.editMode,currentExtensionId:S,editableRootPath:E}),P&&((P.isParamKey&&P.customKey||P.chipValue)&&xt?i.jsxs(i.Fragment,{children:[xt&&i.jsx(cg,{node:xt,spec:s,t:h,onApplyControl:Wh,box:P.box,scope:{colorScheme:f.previewColorScheme==="dark"?"dark":"base",breakpoint:Ur(f.previewDevice,xt,f.previewCustomWidth)}}),i.jsx(t4,{box:P.box,node:xt,customKey:P.customKey??null,initialChipValue:P.chipValue,chipParamLabels:P.chipParamLabels,onKeyify:Zz,templateIdentifier:f.templateIdentifier,locale:f.locale,t:h,candidates:ln,onInsertBinding:Rz,onRemoveBinding:eM,onCommit:Jz,onCancel:Oh})]}):i.jsxs(i.Fragment,{children:[xt&&i.jsx(cg,{node:xt,spec:s,t:h,onApplyControl:Wh,box:P.box,scope:{colorScheme:f.previewColorScheme==="dark"?"dark":"base",breakpoint:xt?Ur(f.previewDevice,xt,f.previewCustomWidth):"base"}}),i.jsx(e4,{box:P.box,initialValue:P.initialValue,isCustomKey:P.isCustomKey,t:h,onCommit:Xz,onCancel:Oh,mirrorClassName:kl.className,mirrorStyle:kl.style,nodeEffectiveColor:kl.effectiveColor??P.nodeEffectiveColor,onOpenTranslations:Qz})]})),!D&&i.jsx(h7,{hoverBox:N,selectedBox:A,lockKind:C.selectedLockKind,navAffordance:C.selectedNavAffordance,onEditProps:ml,onDuplicate:Ae,onDelete:Ne,onSeparateBranch:Le?.mode==="separate"?q:void 0,separateBranchLabel:$e?.separate,onMergeBranch:Le?.mode==="merge"?ae:void 0,mergeBranchLabel:$e?.merge,definedDeviceBranches:be,onJumpToDevice:be.length>0?j:void 0,onLinkEditDestination:Ie,onEditBase:dt,onEditExtension:pt,extensionLabel:ze,baseLayoutLabel:C.selectedBaseLayout,dataSourceLabel:C.selectedDataSourceId,branchLabel:ee,onEditIteration:C.selectedIsIteration&&f.editMode!=="iteration_item"?ot:void 0,resizeEnabledAxes:rr.enabledAxes,onResizeHandlePointerDown:rr.enabledAxes.width||rr.enabledAxes.height?Gz:void 0,selectedName:Ce,onSelectParent:Z?se:void 0}),D&&B&&i.jsx("div",{"data-testid":"g7le-canvas-pick-hover","data-pick-has-id":B.hasId?"true":"false",style:{position:"absolute",left:B.box.left,top:B.box.top,width:B.box.width,height:B.box.height,pointerEvents:"none",zIndex:9998,boxSizing:"border-box",border:B.hasId?"2px solid #2563eb":"2px dashed #94a3b8",background:B.hasId?"rgba(37,99,235,0.10)":"repeating-linear-gradient(45deg, rgba(148,163,184,0.18) 0, rgba(148,163,184,0.18) 6px, transparent 6px, transparent 12px)",cursor:B.hasId?"pointer":"not-allowed"},children:!B.hasId&&i.jsx("span",{"data-testid":"g7le-canvas-pick-hover-hint",style:{position:"absolute",top:0,left:0,transform:"translateY(-100%)",background:"#475569",color:"#fff",fontSize:11,lineHeight:1.4,padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap"},children:h("layout_editor.target_picker.needs_id")})}),!D&&i.jsx(x7,{selectedBox:qe,points:Se.points,onAddRequest:Re}),ho&&ft&&jh&&C.selectedLockKind==="none"&&i.jsx(ho,{node:ft.tableNode,params:ft.params,nodeBox:jh,cellBoxes:nM,selectedCellPath:ft.selectedCellRel??void 0,colorScheme:f.previewColorScheme==="dark"?"dark":"light",t:h,onPatchNode:oM,onInsertChild:ge,onRemoveChild:W=>{const X=Ze(W);if(!v||!X)return;let R=[];v.patchLayout(de=>(R=Ri({children:de},X).children??[],R)),b.push({actionKind:"remove",label:"inplace_remove",snapshot:R})},onRequestInlineEdit:W=>{ft&&G(`${ft.tablePath}.${W}`)}}),v&&i.jsx(bI,{frameEl:t,nesting:o,editMode:f.editMode,currentExtensionId:S,editableRootPath:E,components:w,patchLayout:v.patchLayout,pushHistory:le,selectedPath:C.selectedPath,onSelectPath:W=>C.handleSelect("",{dataset:{editorPath:W}}),onMovePath:W=>C.handleSelect("",{dataset:{editorPath:W}}),onRequestInlineEdit:G})]}):null}function pg(e,t){if(t.length===0)return null;const o=Ha({children:e},t);return o&&typeof o.name=="string"?o.name:null}function Ha(e,t){return We(e,t)}function an(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[^a-zA-Z0-9_\-.]/g,t=>`\\${t}`)}function fg(e,t){if(!t)return null;const n=e.querySelector(`[data-editor-path="${an(t)}"]`);if(!n||typeof window.getComputedStyle!="function")return null;let o=n;const r=n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_TEXT);let s=r.nextNode();for(;s;){if((s.textContent??"").trim().length>0){const a=s.parentElement;if(a&&n.contains(a)){o=a;break}}s=r.nextNode()}try{return window.getComputedStyle(o).color||null}catch{return null}}function po(e,t){if(!t)return null;const n=e.querySelector(`[data-editor-path="${an(t)}"]`);if(n){const c=so(n,e);return c&&ao(c,e)?c:null}const o=e.querySelectorAll(`[data-editor-path^="${an(t)}.iteration."]`);let r=1/0,s=1/0,a=-1/0,l=-1/0,d=!1;return o.forEach(c=>{const p=c.dataset.editorPath??"";if(!new RegExp("\\.iteration\\.\\d+$").test(p))return;const f=so(c,e);f&&ao(f,e)&&(d=!0,r=Math.min(r,f.left),s=Math.min(s,f.top),a=Math.max(a,f.left+f.width),l=Math.max(l,f.top+f.height))}),d?{left:r,top:s,width:a-r,height:l-s,scale:1}:null}function d4({isEditMode:e,editorSpec:t,sampleOverride:n}){const o=t?.sampleData;return u.useMemo(()=>zm({spec:o,overrideSpec:n,onMatch:r=>{Fh(r)}}),[e,o,n])}const c4=Lt().ComponentRegistry;function u4(e){return e.split(/[-_]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}async function p4(e){const t=typeof window<"u"?window.localStorage?.getItem("auth_token"):null,n={Accept:"application/json"};t&&(n.Authorization=`Bearer ${t}`);const o=await fetch(`/api/admin/templates/${encodeURIComponent(e)}/editor-assets`,{headers:n,credentials:"same-origin"});if(!o.ok){const s=await o.json().catch(()=>null);throw Gr(o.status,s,"assets")}const r=await o.json();return r.data||r}async function f4(e){try{if(typeof fetch!="function")return 0;const t=await fetch(en(`/api/templates/${encodeURIComponent(e)}/config`,"json"),{credentials:"same-origin",headers:{Accept:"application/json"}});if(!t.ok)return 0;const n=await t.json().catch(()=>null),o=n?.data?.cache_version??n?.cache_version;return typeof o=="number"&&o>0?o:0}catch{return 0}}function g4(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("document undefined"));return}if(document.querySelector(`script[data-g7le-asset="${e}"]`)){t();return}const r=document.createElement("script");r.src=e,r.async=!1,r.setAttribute("data-g7le-asset",e),r.addEventListener("load",()=>t()),r.addEventListener("error",()=>n(new Error(`script load failed: ${e}`))),document.head.appendChild(r)})}async function h4(e){if(typeof document>"u")return;const t=`[data-g7le-asset="${e}"]`;if(document.querySelector(`link${t}, style${t}`))return;if(e.includes("/api/admin/"))try{const r=typeof window<"u"?window.localStorage?.getItem("auth_token"):null,s={Accept:"text/css"};r&&(s.Authorization=`Bearer ${r}`);const a=await fetch(e,{headers:s,credentials:"same-origin"});if(a.ok){const l=await a.text(),d=document.createElement("style");d.textContent=l,d.setAttribute("data-g7le-asset",e),document.head.appendChild(d);return}}catch{}const o=document.createElement("link");o.rel="stylesheet",o.href=e,o.setAttribute("data-g7le-asset",e),document.head.appendChild(o)}function y4(e,t,n="user"){const[o,r]=u.useState({componentRegistry:null,translationEngine:null,isReady:!1,error:null});return u.useEffect(()=>{let s=!1;return(async()=>{r(a=>({...a,isReady:!1,error:null}));try{const a=await p4(e);if(s)return;for(const y of a.css??[])if(await h4(y),s)return;const l=u4(e);if(!(typeof window<"u"&&typeof window[l]=="object")){for(const y of a.js??[])if(await g4(y),s)return}const c=c4.createIsolatedInstance();if(await c.loadComponents(e,n),s)return;const p=await f4(e);if(s)return;const f=new Pt({defaultLocale:t});if(p>0&&f.setCacheVersion(p),await f.loadTranslations(e,t),s)return;cd(f,e);try{const y=Pt.getInstance();p>y.getCacheVersion()&&y.setCacheVersion(p),await y.loadTranslations(e,t),cd(y,e)}catch{}if(s)return;r({componentRegistry:c,translationEngine:f,isReady:!0,error:null})}catch(a){if(s)return;const l=pp(a)?a:io(a,"assets");r({componentRegistry:null,translationEngine:null,isReady:!1,error:l})}})(),()=>{s=!0}},[e,t,n]),o}const gg=Lt().AuthManager;function b4(e){switch(e){case"unauthorized":return{icon:"🔒",tone:"blue",titleKey:"layout_editor.access_error.unauthorized.title",messageKey:"layout_editor.access_error.unauthorized.message",showRequiredPermissions:!0};case"forbidden":return{icon:"⛔",tone:"rose",titleKey:"layout_editor.access_error.forbidden.title",messageKey:"layout_editor.access_error.forbidden.message",showRequiredPermissions:!0};case"not_found":return{icon:"🗂️",tone:"slate",titleKey:"layout_editor.access_error.not_found.title",messageKey:"layout_editor.access_error.not_found.message",showRequiredPermissions:!1};case"server_error":return{icon:"🛠️",tone:"amber",titleKey:"layout_editor.access_error.server_error.title",messageKey:"layout_editor.access_error.server_error.message",showRequiredPermissions:!1};case"network":return{icon:"📡",tone:"amber",titleKey:"layout_editor.access_error.network.title",messageKey:"layout_editor.access_error.network.message",showRequiredPermissions:!1};default:return{icon:"⚠️",tone:"slate",titleKey:"layout_editor.access_error.unknown.title",messageKey:"layout_editor.access_error.unknown.message",showRequiredPermissions:!1}}}const m4={blue:{bg:"#eff6ff",border:"#bfdbfe",iconBg:"#dbeafe"},rose:{bg:"#fff1f2",border:"#fecdd3",iconBg:"#ffe4e6"},amber:{bg:"#fffbeb",border:"#fde68a",iconBg:"#fef3c7"},slate:{bg:"#f8fafc",border:"#e2e8f0",iconBg:"#f1f5f9"}};function v4({error:e}){return u.useEffect(()=>{if(e.kind!=="unauthorized"||typeof window>"u")return;const t=gg.getInstance(),n=`${window.location.pathname}${window.location.search}`,o=t.getLoginRedirectUrl("admin",n,"session_expired"),r=window.setTimeout(()=>{window.location.href=o},600);return()=>window.clearTimeout(r)},[e.kind]),null}function Fa({error:e}){const{t}=tt(),n=b4(e.kind),o=m4[n.tone],r=()=>{typeof window<"u"&&(window.location.href="/admin")},s=()=>{typeof window<"u"&&window.location.reload()},a=()=>{if(typeof window>"u")return;const l=gg.getInstance(),d=`${window.location.pathname}${window.location.search}`;window.location.href=l.getLoginRedirectUrl("admin",d)};return i.jsxs("div",{className:"g7le-access-error","data-testid":"g7le-access-error","data-error-kind":e.kind,style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f1f5f9"},children:[i.jsx(v4,{error:e}),i.jsxs("div",{style:{maxWidth:480,width:"100%",background:o.bg,border:`1px solid ${o.border}`,borderRadius:12,padding:"28px 32px",boxShadow:"0 2px 8px rgba(15, 23, 42, 0.05)",textAlign:"center"},children:[i.jsx("div",{style:{width:64,height:64,margin:"0 auto 16px",borderRadius:"50%",background:o.iconBg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,lineHeight:1},"aria-hidden":"true",children:n.icon}),i.jsx("h2",{"data-testid":"g7le-access-error-title",style:{margin:"0 0 8px",fontSize:18,fontWeight:700,color:"#0f172a"},children:t(n.titleKey)}),i.jsx("p",{"data-testid":"g7le-access-error-message",style:{margin:"0 0 16px",fontSize:13,lineHeight:1.6,color:"#475569"},children:t(n.messageKey)}),n.showRequiredPermissions&&e.requiredPermissions&&i.jsxs("div",{"data-testid":"g7le-access-error-permissions",style:{display:"inline-flex",flexWrap:"wrap",gap:6,justifyContent:"center",padding:"8px 12px",marginBottom:16,background:"rgba(15, 23, 42, 0.04)",borderRadius:8,fontSize:12,color:"#475569"},children:[i.jsx("span",{style:{fontWeight:600},children:t("layout_editor.access_error.required_permission_label")}),e.requiredPermissions.split(/[,\s]+/).filter(Boolean).map(l=>i.jsx("code",{style:{padding:"2px 6px",background:"#fff",border:"1px solid #e2e8f0",borderRadius:4,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:11,color:"#1e293b"},children:l},l))]}),e.message&&i.jsxs("details",{"data-testid":"g7le-access-error-detail",style:{marginBottom:16,fontSize:11,color:"#94a3b8"},children:[i.jsx("summary",{style:{cursor:"pointer"},children:t("layout_editor.access_error.detail_summary")}),i.jsxs("pre",{style:{marginTop:8,padding:8,background:"#fff",border:"1px solid #e2e8f0",borderRadius:6,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word",textAlign:"left",fontSize:11,color:"#475569"},children:[e.status>0?`HTTP ${e.status} `:"",e.message]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:8,flexWrap:"wrap"},children:[e.kind==="unauthorized"&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-signin",onClick:a,style:Ka,children:t("layout_editor.access_error.action.sign_in")}),e.kind==="forbidden"&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-home",onClick:r,style:Ka,children:t("layout_editor.access_error.action.go_home")}),(e.kind==="not_found"||e.kind==="server_error"||e.kind==="network"||e.kind==="unknown")&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-retry",onClick:s,style:Ka,children:t("layout_editor.access_error.action.retry")}),e.kind!=="unauthorized"&&i.jsx("button",{type:"button","data-testid":"g7le-access-error-action-home-secondary",onClick:r,style:_4,children:t("layout_editor.access_error.action.go_admin_home")})]})]})]})}const Ka={padding:"8px 16px",background:"#2563eb",color:"#fff",border:"1px solid #1d4ed8",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer"},_4={padding:"8px 16px",background:"#fff",color:"#475569",border:"1px solid #cbd5e1",borderRadius:6,fontSize:13,fontWeight:500,cursor:"pointer"};function x4(e){const t=window;if(typeof t>"u")return{getSnapshot:()=>({globalState:{},localState:{}}),restore:()=>{}};const n=t.G7Core||{},o={templateApp:t.__templateApp,g7CoreState:n.state,g7CoreDispatch:n.dispatch,g7CoreData:n.data,g7CoreModal:n.modal,g7CoreToast:n.toast};let r={...e.initialGlobalState??{}};r._local||(r._local={});const s=[],a=()=>{const c={globalState:{...r},localState:{...r._local??{}}};for(const p of s)try{p(r)}catch{}e.onChange?.(c)},l={},d={getGlobalState:()=>r,setGlobalState:(c,p)=>{typeof c=="function"?r=c(r):r={...r,...c},a()},onGlobalStateChange:c=>(s.push(c),()=>{const p=s.indexOf(c);p>=0&&s.splice(p,1)}),get globalState(){return r},getActionDispatcher:()=>e.actionDispatcher,getDataSource:c=>l[c]??null,setDataSource:(c,p)=>{l[c]=p},refetchDataSource:async c=>null,updateDataSourceItem:(c,p,f)=>l[c]??null,getLocale:()=>e.locale,changeLocale:c=>{},getRouter:()=>({navigate:()=>{},replace:()=>{},push:()=>{}}),updateQueryParams:()=>{}};return t.__templateApp=d,n&&typeof n.dispatch=="function"&&(n.dispatch=(c,p)=>{try{return e.actionDispatcher.executeAction(c,p??{})}catch{return}}),n&&typeof n.modal=="object"&&n.modal!==null&&(n.modal={...n.modal,open:()=>{},close:()=>{},closeAll:()=>{}}),n&&typeof n.toast=="object"&&n.toast!==null&&(n.toast={...n.toast,push:()=>{},dismiss:()=>{}}),{getSnapshot:()=>({globalState:{...r},localState:{...r._local??{}}}),restore:()=>{t.__templateApp===d&&(t.__templateApp=o.templateApp),t.G7Core&&(o.g7CoreState!==void 0&&(t.G7Core.state=o.g7CoreState),o.g7CoreDispatch!==void 0&&(t.G7Core.dispatch=o.g7CoreDispatch),o.g7CoreData!==void 0&&(t.G7Core.data=o.g7CoreData),o.g7CoreModal!==void 0&&(t.G7Core.modal=o.g7CoreModal),o.g7CoreToast!==void 0&&(t.G7Core.toast=o.g7CoreToast)),s.length=0}}}const w4=new Set(["id","userId","postId","orderId","productId","categoryId","commentId","noticeId","inquiryId","addressId","wishlistId","notificationId","roleId","menuId"]);function k4(e){if(!e)return{};const t={},n=/:([a-zA-Z_][a-zA-Z0-9_]*)/g;let o;for(;(o=n.exec(e))!==null;){const r=o[1];t[r]=S4(r)}return t}function S4(e){return w4.has(e)||/Id$|_id$/.test(e)?"1":"sample"}const C4=dr("LayoutEditor");function Xo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bi(e){if(Array.isArray(e))return e.map(t=>bi(t));if(Xo(e)){const t={};for(const[n,o]of Object.entries(e))t[n]=bi(o);return t}return e}function hg(e,t="",n=new Set){for(const[o,r]of Object.entries(e)){const s=t?`${t}.${o}`:o;Xo(r)?hg(r,s,n):n.add(s)}return n}function yg(e,t,n,o,r,s=""){for(const[a,l]of Object.entries(t)){const d=s?`${s}.${a}`:a;if(n.has(d)){r(`[LayoutEditor] sampleGlobal key conflict: extension '${o}' override of core key '${d}' ignored`);continue}const c=e[a];Xo(l)&&Xo(c)?yg(c,l,n,o,r,d):e[a]=bi(l)}}function Va(e){const t=e.warn??(r=>C4.warn(r)),n=bi(e.coreSeed??{});e.isGuestOnly&&"currentUser"in n&&delete n.currentUser;const o=hg(n);for(const r of e.sources)Xo(r.sampleGlobal)&&yg(n,r.sampleGlobal,o,r.id,t);return e.isGuestOnly&&"currentUser"in n&&delete n.currentUser,n}function $4(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;for(const[n,o]of Object.entries(e))n.startsWith("$")&&(t[n]=o);return t}function E4(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;for(const[n,o]of Object.entries(e))n.startsWith("$")||(t[n]=o);return t}function I4(e){if(typeof e!="string")return null;const t=/^\s*\{\{\s*([\s\S]*?)\s*\}\}\s*$/.exec(e);if(!t)return null;let n=t[1];const o=n.indexOf("??");return o>=0&&(n=n.slice(0,o)),n=n.replace(/\?\./g,".").replace(/\s+/g,""),n===""||!/^[A-Za-z_$][A-Za-z0-9_$]*(\.[A-Za-z_$][A-Za-z0-9_$]*)*$/.test(n)?null:n.split(".")}function A4(e,t){const n=I4(t);if(!n||n.length===0)return e;let o=e;for(let a=0;ao.map(r=>{if(!r||typeof r!="object")return r;const s=r;let a=s;if(typeof s.slot=="string"&&!t.has(s.slot)){const{slot:l,...d}=s;a={...d,__editorSlotName:l}}if(Array.isArray(a.children)){const l=n(a.children);l!==a.children&&(a={...a,children:l})}return a});return n(e)}function St(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Xt(e){if(Array.isArray(e))return e.map(t=>Xt(t));if(St(e)){const t={};for(const[n,o]of Object.entries(e))t[n]=Xt(o);return t}return e}function mi(e,t){for(const[n,o]of Object.entries(t)){const r=e[n];St(o)&&St(r)?mi(r,o):e[n]=Xt(o)}}function N4(e){const t=[];let n="";for(let o=0;o0&&(t.push(n),n="");const s=e[o+1];if(s==="'"||s==='"'){const l=e.indexOf(`${s}]`,o+2);if(l!==-1){t.push(e.slice(o+2,l)),o=l+1;continue}}const a=e.indexOf("]",o+1);if(a!==-1){t.push(e.slice(o+1,a)),o=a;continue}n+=r}else r==="."?n.length>0&&(t.push(n),n=""):n+=r}return n.length>0&&t.push(n),t.filter(o=>o.length>0)}function Ua(e,t,n){const o=N4(t);if(o.length===0)return;let r=e;for(let s=0;s0?t:void 0}const Ga="g7le:editor-t-ready",vg="data-g7le-vh-expanded";function M4(e,t){if(!e||!t)return;const n=t;e.querySelectorAll("*").forEach(r=>{const s=window.getComputedStyle(r),a=parseFloat(s.height),l=Number.isFinite(a)&&Math.abs(a-n)<=2,d=parseFloat(s.minHeight),c=Number.isFinite(d)&&Math.abs(d-n)<=2,p=s.overflowY==="auto"||s.overflowY==="scroll"||s.overflowY==="hidden"||s.overflow==="auto"||s.overflow==="scroll"||s.overflow==="hidden";l&&p?(r.style.setProperty("height","auto","important"),c&&r.style.setProperty("min-height","0","important"),r.style.setProperty("overflow","visible","important"),r.setAttribute(vg,"1")):(s.overflowY==="auto"||s.overflowY==="scroll")&&r.scrollHeight>r.clientHeight+4&&r.clientHeight>120&&(r.style.setProperty("overflow","visible","important"),r.style.setProperty("height","auto","important"),r.setAttribute(vg,"1"))})}const L4=[];function P4(e={}){const{manifest:t=null,nesting:n=null,componentPalette:o=null,spec:r=null,permissionCandidates:s,sampleGlobalSources:a=L4,resolveRouteMatch:l,onNavigateToDestination:d,onSessionAddedPathsChange:c}=e,{state:p}=Je(),f=Ft(),y=wp(),{document:g,isLoading:m,error:h}=f??y,v=u.useRef(null),[b,x]=u.useState(null),{deviceWidth:k,scale:w,colorScheme:_}=ja(),S=u.useMemo(()=>p.activeStateId?p.availableStates.find(Q=>Q.id===p.activeStateId)??null:null,[p.activeStateId,p.availableStates]),E=u.useMemo(()=>mg(S),[S]),C=d4({isEditMode:!0,editorSpec:r??void 0,sampleOverride:E}),{t:N}=tt(),{componentRegistry:$,translationEngine:A,isReady:z,error:D}=y4(p.templateIdentifier,p.locale),O=u.useRef(null);O.current===null&&(O.current=new vd);const M=u.useRef(null);if(M.current===null){M.current=new jE({navigate:()=>{}}),M.current.setPreviewMode(!0);try{const ie=window.__templateApp?.getActionDispatcher?.();if(ie&&typeof ie.getRegisteredHandlers=="function"){const _e=ie.getRegisteredHandlers();for(const ge of _e){if(!ge.includes("."))continue;const Ae=typeof ie.getHandler=="function"?ie.getHandler(ge):void 0;typeof Ae=="function"&&M.current.registerHandler(ge,Ae,{category:"plugin",source:"preview-canvas-cloned-from-host"})}}}catch{}}u.useEffect(()=>{if(!z)return;const Q=M.current;if(Q)try{const ie=window.G7Core?.getActionDispatcher?.();if(!ie||typeof ie.getRegisteredHandlers!="function")return;const _e=ie.getRegisteredHandlers();for(const ge of _e){if(!ge.includes(".")||typeof Q.getHandler=="function"&&Q.getHandler(ge))continue;const Ae=typeof ie.getHandler=="function"?ie.getHandler(ge):void 0;typeof Ae=="function"&&Q.registerHandler(ge,Ae,{category:"plugin",source:"preview-canvas-iife-reclone"})}}catch{}},[z]);const B=u.useMemo(()=>new HE({sampleProvider:C,actionDispatcher:M.current}),[C]),T=u.useMemo(()=>g?.raw?.meta?.guest_only===!0,[g]),H=u.useMemo(()=>Va({sources:a,isGuestOnly:T}),[a,T]),L=u.useMemo(()=>{const Q=O4(qa(S),A,{templateId:p.templateIdentifier,locale:p.locale}),ie=H._local,{global:_e,local:ge}=z4({globalBaseline:H,localBaseline:ie??{},patch:S?.initialState??null,formErrors:Q});return{..._e,_local:ge}},[H,S,A,p.templateIdentifier,p.locale]),I=u.useMemo(()=>!S||!(!!S.initialState?.local||!!qa(S))?null:{...L._local??{},_forceLocalInit:S.id,_merge:"deep"},[S,L]),P=Q=>typeof Q=="object"&&Q!==null&&!Array.isArray(Q),F=u.useMemo(()=>P(S?.initialState?.query)?S.initialState.query:null,[S]),G=u.useMemo(()=>P(S?.initialState?.route)?S.initialState.route:null,[S]),[V,Y]=u.useState(()=>Va({sources:[],isGuestOnly:!1})),Z=u.useRef(null);u.useEffect(()=>{const Q={...L},ie=x4({actionDispatcher:M.current,locale:p.locale,initialGlobalState:Q,onChange:ge=>{Y(ge.globalState)}});Z.current=ie;const _e=window.__templateApp;return _e?.setGlobalState&&M.current.setGlobalStateUpdater((ge,Ae)=>{_e.setGlobalState(ge,Ae)}),Y(Q),$l({kind:"applyPatch",activeStateId:p.activeStateId,routePath:p.selectedRoute?.path??null,hasInitialPatch:!!S?.initialState,hasFormErrors:!!qa(S),hasSampleOverride:!!mg(S)}),()=>{ie.restore(),Z.current=null}},[p.locale,L]),u.useEffect(()=>{if(!A)return;const Q=window.G7Core;if(!Q||typeof Q.t!="function")return;const ie=Q.t,_e=p.templateIdentifier,ge=p.locale;return Q.t=(Ae,Ne)=>{try{const Le=Ne?"|"+Object.entries(Ne).map(([ae,pe])=>`${ae}=${pe}`).join("|"):void 0,q=A.translate(Ae,{templateId:_e,locale:ge},Le);if(q!==Ae&&!q.startsWith("$t:"))return q}catch{}return ie(Ae,Ne)},typeof window<"u"&&window.dispatchEvent(new CustomEvent(Ga)),()=>{window.G7Core?.t&&window.G7Core.t!==ie&&(window.G7Core.t=ie)}},[A,p.templateIdentifier,p.locale]);const se=u.useMemo(()=>{const Q=g?.raw?.components??[];return p.editMode!=="base"?Q:D4(Q)},[g,p.editMode]),re=g?.raw?.__editability,U=g?.raw?.__extensionId,ee=u.useMemo(()=>p.editMode!=="extension"||re!=="ok"?[]:typeof U!="number"?[]:B4(se,U),[p.editMode,re,U,se]),[fe,K]=u.useState(null),[ne,me]=u.useState(!1),Ce=g?.layoutName??null,ze=u.useMemo(()=>{const Q=g?.raw?.scripts??[];return Array.isArray(Q)?Q.map(ie=>ie&&typeof ie.src=="string"?ie.src:"").join("|"):""},[g]);u.useEffect(()=>{me(!1)},[Ce,ze]),u.useEffect(()=>{let Q=!1;const ie=g?.raw?.scripts??[];if(!Array.isArray(ie)||ie.length===0){me(!0);return}const _e=[];for(const ge of ie){if(!ge?.src||typeof ge.src!="string")continue;const Ae=ge.id?`script#${CSS.escape(ge.id)}, script[data-g7le-canvas-script="${ge.src}"]`:`script[data-g7le-canvas-script="${ge.src}"], script[src="${ge.src}"]`,Ne=window.document.querySelector(Ae);if(Ne){const Le=Ne.hasAttribute("data-g7le-canvas-script");if(Ne.hasAttribute("data-g7le-script-loaded")||!Le)continue;_e.push(new Promise(ae=>{if(Ne.hasAttribute("data-g7le-script-loaded")){ae();return}Ne.addEventListener("load",()=>ae()),Ne.addEventListener("error",()=>ae())}));continue}_e.push(new Promise(Le=>{const q=window.document.createElement("script");q.src=ge.src,q.async=!1,ge.id&&(q.id=ge.id),q.setAttribute("data-g7le-canvas-script",ge.src);const ae=()=>{q.setAttribute("data-g7le-script-loaded","1"),Le()};q.addEventListener("load",ae),q.addEventListener("error",ae),window.document.head.appendChild(q)}))}if(_e.length===0){me(!0);return}return Promise.all(_e).then(()=>{Q||requestAnimationFrame(()=>{requestAnimationFrame(()=>{Q||me(!0)})})}),()=>{Q=!0}},[g]);const Se=u.useMemo(()=>g?.raw?.data_sources??[],[g]),qe=u.useMemo(()=>g?.raw?.computed??{},[g]),[De,Pe]=u.useState({}),Qe=u.useMemo(()=>{if(p.editMode!=="iteration_item")return De;const Q=g?.iterationContext;if(!Q)return De;const ie=g?.raw?.components??[],_e=We({children:ie},Q.sourceIndexPath),ge=_e&&_e.iteration&&typeof _e.iteration.source=="string"?_e.iteration.source:null;return ge?A4(De,ge):De},[p.editMode,De,g]),[Me,Re]=u.useState(0);u.useEffect(()=>{if(typeof window>"u")return;const Q=()=>Re(ie=>ie+1);return window.addEventListener(kt,Q),()=>window.removeEventListener(kt,Q)},[]);const ve=u.useMemo(()=>k4(p.selectedRoute?.path??null),[p.selectedRoute?.path]);if(u.useEffect(()=>{let Q=!1;return(async()=>{if(Se.length===0){Q||Pe({});return}try{const ie=await B.fetchDataSources(Se,ve,new URLSearchParams,void 0,void 0);Q||Pe(ie)}catch{Q||Pe({})}})(),()=>{Q=!0}},[Se,B,ve]),u.useEffect(()=>{const Q=b;if(!Q||typeof window>"u")return;let ie=0,_e=0,ge=0;const Ae=()=>M4(Q,window.innerHeight);ie=window.requestAnimationFrame(()=>{_e=window.requestAnimationFrame(Ae)});let Ne=null;return typeof MutationObserver<"u"&&(Ne=new MutationObserver(()=>{ge||(ge=window.requestAnimationFrame(()=>{ge=0,Ae()}))}),Ne.observe(Q,{childList:!0,subtree:!0})),()=>{window.cancelAnimationFrame(ie),window.cancelAnimationFrame(_e),ge&&window.cancelAnimationFrame(ge),Ne&&Ne.disconnect()}},[b,se,ne,k,De]),u.useEffect(()=>{const Q=b;if(!Q||typeof window>"u"||p.editMode!=="extension"||re!=="ok"||ee.length===0){K(null);return}let ie=0,_e=0;const ge=ae=>{if(!ae)return!1;const pe=ae.getBoundingClientRect();return pe.width>0&&pe.height>0},Ae=ae=>{const pe=Q.querySelector(`[data-editor-path="${ae}"]`);if(ge(pe))return!0;const $e=Q.querySelectorAll(`[data-editor-path^="${ae}.children."]`);for(const be of Array.from($e))if(ge(be))return!0;return!1},Ne=()=>{K(ee.some(Ae))};ie=window.requestAnimationFrame(()=>{_e=window.requestAnimationFrame(Ne)});let Le=null,q=0;return typeof MutationObserver<"u"&&(Le=new MutationObserver(()=>{q||(q=window.requestAnimationFrame(()=>{q=0,Ne()}))}),Le.observe(Q,{childList:!0,subtree:!0})),()=>{window.cancelAnimationFrame(ie),window.cancelAnimationFrame(_e),q&&window.cancelAnimationFrame(q),Le&&Le.disconnect()}},[b,p.editMode,re,ee,ne,De]),u.useEffect(()=>{if(typeof window>"u"||p.editMode!=="base")return;const Q=window.document,ie="g7le-base-slot-style";if(Q.getElementById(ie))return;const _e=Q.createElement("style");_e.id=ie;const ge=N("layout_editor.preview.slot_area_label");return _e.textContent=`.g7le-preview-frame [data-editor-slot]{position:relative;min-height:96px;outline:2px dashed #94a3b8;outline-offset:-2px;}.g7le-preview-frame [data-editor-slot]::after{content:'${ge.replace(/'/g,"\\'")} · ' attr(data-editor-slot);position:absolute;top:8px;left:50%;transform:translateX(-50%);font-size:12px;line-height:1;color:#64748b;background:rgba(241,245,249,0.92);border:1px solid #cbd5e1;border-radius:9999px;padding:4px 12px;pointer-events:none;white-space:nowrap;}`,Q.head.appendChild(_e),()=>{Q.getElementById(ie)?.remove()}},[p.editMode,N]),!(p.editMode==="extension"||p.editMode==="iteration_item")&&(p.selectedRoute?.layoutName===null||p.selectedRoute===null))return i.jsx("div",{className:"g7le-preview-canvas g7le-preview-canvas--empty","data-testid":"g7le-preview-empty",style:Jo,children:N("layout_editor.preview.empty")});if(m)return i.jsx("div",{className:"g7le-preview-canvas g7le-preview-canvas--loading","data-testid":"g7le-preview-loading",style:Jo,children:N("layout_editor.preview.loading")});if(h)return i.jsx(Fa,{error:h});if(D)return i.jsx(Fa,{error:D});if(!z||$===null||A===null)return i.jsx("div",{className:"g7le-preview-canvas g7le-preview-canvas--assets-loading","data-testid":"g7le-preview-assets-loading",style:Jo,children:N("layout_editor.preview.assets_loading")});if(se.length===0)return i.jsx("div",{className:"g7le-preview-canvas g7le-preview-canvas--empty-layout","data-testid":"g7le-preview-empty-layout",style:Jo,children:N("layout_editor.preview.empty_layout")});const he=p.editMode==="extension"?re==="no-injection"?"no-injection":re==="ok"&&ee.length>0&&fe!==!0?"gated-no-state":null:null;return ne?i.jsx("div",{className:"g7le-preview-canvas","data-testid":"g7le-preview-canvas",style:{overflow:"visible",background:"#f1f5f9",padding:24,display:"flex",justifyContent:"center",alignItems:"flex-start",minHeight:"calc(100vh - var(--g7le-header-h, 0px))",boxSizing:"border-box"},children:i.jsxs("div",{className:"g7le-preview-frame-wrapper","data-testid":"g7le-preview-frame-wrapper",style:{position:"relative",width:k,transform:`scale(${w})`,transformOrigin:"top center"},children:[i.jsx("div",{className:_==="dark"?"g7le-preview-frame g7le-preview-dark":"g7le-preview-frame","data-testid":"g7le-preview-frame","data-color-scheme":_,ref:Q=>{v.current=Q,x(Q)},style:{width:k,background:"#fff",border:"1px solid #cbd5e1",boxShadow:"0 1px 3px rgba(0,0,0,0.05)",minHeight:400,position:"relative",transform:"translateZ(0)",overflow:"hidden"},children:i.jsx(WE,{overrideWidth:k,children:se.map((Q,ie)=>i.jsx(BE,{componentDef:Q,dataContext:{...Qe,...$4(V),_global:E4(V),_computedDefinitions:qe,...I?{_localInit:I,_local:{...De._local??{},...V._local??{}}}:{},route:W4({...De.route??{},...ve,path:p.selectedRoute?.path??""},G),query:{...De.query??{},...F??{}}},translationContext:{templateId:p.templateIdentifier,locale:p.locale},registry:$,bindingEngine:O.current,translationEngine:Pt.getInstance(),actionDispatcher:M.current,isEditMode:!0,isRootRenderer:ie===0,componentPath:`${ie}`,onComponentSelect:(_e,ge)=>{},onComponentHover:(_e,ge)=>{}},`${Q.id??`preview-${ie}`}:t${Me}${p.editMode==="extension"?`:s${ne?1:0}`:""}`))})}),i.jsx("div",{className:"g7le-overlay-layer","data-testid":"g7le-overlay-layer",style:{position:"absolute",left:0,top:0,width:k,height:b?b.getBoundingClientRect().height/(w||1):"100%",overflow:"visible",pointerEvents:"none"},children:i.jsx(l4,{frameEl:b,manifest:t,nesting:n,componentPalette:o,spec:r,permissionCandidates:s,resolveRouteMatch:l,onNavigateToDestination:d,onSessionAddedPathsChange:c})}),he!==null&&i.jsx("div",{className:"g7le-preview-canvas--extension-fallback","data-testid":"g7le-preview-extension-fallback","data-fallback-reason":he,style:{position:"absolute",left:0,top:0,right:0,bottom:0,minHeight:b?b.getBoundingClientRect().height/(w||1):400,background:"#f1f5f9",display:"flex",alignItems:"flex-start",justifyContent:"center",padding:24,boxSizing:"border-box",pointerEvents:"auto",zIndex:50},children:i.jsxs("div",{className:"g7le-extension-fallback-card",style:{maxWidth:440,textAlign:"center",position:"sticky",top:"calc(40vh - var(--g7le-header-h, 0px))"},children:[i.jsx("p",{className:"g7le-extension-fallback-title",style:{fontWeight:600,marginBottom:8,color:"#0f172a"},children:N(he==="no-injection"?"layout_editor.preview.extension_no_injection_title":"layout_editor.preview.extension_gated_title")}),i.jsx("p",{className:"g7le-extension-fallback-desc",style:{color:"#475569",lineHeight:1.6},children:he==="no-injection"?N("layout_editor.preview.extension_no_injection_desc"):p.availableStates.length>1?N("layout_editor.preview.extension_gated_desc_with_states"):N("layout_editor.preview.extension_gated_desc")})]})})]})}):i.jsx("div",{className:"g7le-preview-canvas g7le-preview-canvas--scripts-loading","data-testid":"g7le-preview-scripts-loading",style:Jo,children:N("layout_editor.preview.loading")})}function O4(e,t,n){if(!e)return;if(!t)return e;const o=s=>{if(typeof s=="string"&&s.startsWith("$t:"))try{const a=s.slice(3),l=a.indexOf("|");if(l===-1)return t.translate(a,n);const d=a.slice(0,l),c=a.slice(l);return t.translate(d,n,c)}catch{return s}return Array.isArray(s)?s.map(o):s},r={};for(const[s,a]of Object.entries(e))r[s]=o(a);return r}function B4(e,t){const n=[],o=(r,s)=>{Array.isArray(r)&&r.forEach((a,l)=>{if(!a||typeof a!="object")return;const d=s?`${s}.children.${l}`:`${l}`,c=a.__source;if(c?.kind==="extension"&&c.extensionId===t){n.push(d);return}Array.isArray(a.children)&&o(a.children,d)})};return o(e,""),n}function W4(e,t){if(!t)return e;const n={...e};for(const[o,r]of Object.entries(t))r===null?delete n[o]:n[o]=r;return n}const Jo={flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"#f1f5f9",color:"#64748b",fontSize:13},j4={desktop:"layout_editor.device.desktop",tablet:"layout_editor.device.tablet",mobile:"layout_editor.device.mobile",portable:"layout_editor.device.portable"};function H4(){const{device:e,zoom:t,customWidth:n,setDevice:o,setZoom:r,setCustomWidth:s,colorScheme:a,setColorScheme:l}=ja(),{t:d}=tt(),c=Vf();return i.jsxs("div",{className:"g7le-device-toolbar","data-testid":"g7le-device-toolbar",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"4px 8px",background:"#fff",border:"1px solid #cbd5e1",borderRadius:6},children:[i.jsxs("div",{role:"group","aria-label":d("layout_editor.device.group_label"),children:[c.map(p=>{const f=e===p,y=j4[p],g=y?d(y):p;return i.jsx("button",{type:"button","data-testid":`g7le-device-${p}`,"aria-pressed":f,onClick:()=>o(p),style:{padding:"2px 8px",marginRight:2,fontSize:12,cursor:"pointer",background:f?"#0f172a":"#f8fafc",color:f?"#fff":"#0f172a",border:"1px solid #cbd5e1",borderRadius:4},children:g},p)}),(()=>{const p=e==="custom";return i.jsx("button",{type:"button","data-testid":"g7le-device-custom","aria-pressed":p,onClick:()=>o("custom"),style:{padding:"2px 8px",marginRight:2,fontSize:12,cursor:"pointer",background:p?"#0f172a":"#f8fafc",color:p?"#fff":"#0f172a",border:"1px solid #cbd5e1",borderRadius:4},children:d("layout_editor.device.custom")})})()]}),e==="custom"&&i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[i.jsx("label",{htmlFor:"g7le-custom-width-input",style:{fontSize:11,color:"#475569"},children:d("layout_editor.device.custom_width_label")}),i.jsx("input",{id:"g7le-custom-width-input",type:"number",min:lg,max:dg,step:10,value:n,"data-testid":"g7le-custom-width-input","aria-label":d("layout_editor.device.custom_width_label"),onChange:p=>{const f=parseInt(p.currentTarget.value,10);Number.isFinite(f)&&s(f)},style:{width:72,padding:"2px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:4}}),i.jsx("span",{style:{fontSize:11,color:"#475569"},children:"px"})]}),i.jsx("div",{role:"group","aria-label":d("layout_editor.toolbar.color_scheme_group"),style:{display:"inline-flex",gap:2},children:["light","dark"].map(p=>{const f=a===p;return i.jsx("button",{type:"button","data-testid":`g7le-toolbar-scheme-${p}`,"aria-pressed":f,onClick:()=>l(p),style:{padding:"2px 8px",fontSize:12,cursor:"pointer",background:f?"#0f172a":"#f8fafc",color:f?"#fff":"#0f172a",border:"1px solid #cbd5e1",borderRadius:4},children:d(p==="light"?"layout_editor.toolbar.color_scheme_light":"layout_editor.toolbar.color_scheme_dark")},p)})}),i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[i.jsx("span",{style:{fontSize:11,color:"#475569"},children:d("layout_editor.zoom.label")}),i.jsx("input",{type:"range",min:.5,max:1,step:.05,value:t,"data-testid":"g7le-zoom-slider","aria-label":d("layout_editor.zoom.aria_label"),onChange:p=>r(parseFloat(p.currentTarget.value)),style:{width:100}}),i.jsxs("span",{style:{fontSize:11,color:"#475569",minWidth:36,textAlign:"right"},children:[Math.round(t*100),"%"]})]}),i.jsx(jb,{})]})}function F4(){const{t:e}=tt(),{state:t,dispatch:n}=Je(),{availableStates:o,activeStateId:r}=t,[,s]=u.useState(0);u.useEffect(()=>{if(typeof window>"u")return;const p=()=>s(y=>y+1),f=window.requestAnimationFrame(p);return window.addEventListener(Ga,p),()=>{window.cancelAnimationFrame(f),window.removeEventListener(Ga,p)}},[]);const a=u.useCallback((p,f)=>{if(!p)return f;if(!p.startsWith("$t:"))return p;const y=p.slice(3),g=window.G7Core;if(g&&typeof g.t=="function"){const h=g.t(y);if(h&&h!==y&&!h.startsWith("$t:"))return h}const m=e(y);return m&&m!==y?m:f},[e]);if(!Array.isArray(o)||o.length<=1)return null;const l=p=>{const f=p.target.value;n({type:"SET_ACTIVE_STATE",activeStateId:f}),$l({kind:"change",activeStateId:f,routePath:t.selectedRoute?.path??null,availableCount:o.length})},d=o.find(p=>p.id===r)??o[0],c=d?.description?a(d.description,""):"";return i.jsxs("div",{className:"g7le-state-switcher","data-testid":"g7le-state-switcher","data-active-state":r??"",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 8px",background:"#fff",border:"1px solid #cbd5e1",borderRadius:6},children:[i.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#475569",whiteSpace:"nowrap"},children:e("layout_editor.toolbar.state")}),i.jsx("select",{"data-testid":"g7le-state-switcher-select","aria-label":e("layout_editor.toolbar.state"),value:r??o[0].id,onChange:l,style:{fontSize:12,padding:"2px 6px",border:"1px solid #cbd5e1",borderRadius:4,background:"#fff",color:"#0f172a",cursor:"pointer",outline:"none"},children:o.map(p=>i.jsx("option",{value:p.id,children:a(p.label,p.id)},p.id))}),c&&i.jsx("span",{"data-testid":"g7le-state-switcher-description",style:{fontSize:11,color:"#94a3b8",whiteSpace:"nowrap"},children:c})]})}function K4(e,t,n){if(e==="extension"){if(typeof n=="string"&&n.length>0){const o=Ya(n,"__base__/");return o?{kind:"base",match:o}:{kind:"route",match:n}}return null}if(!t)return null;switch(e){case"route":return{kind:"route",match:t};case"base":{const o=Ya(t,"__base__/");return o?{kind:"base",match:o}:null}case"modal":{const o=Ya(t,"__modal__/");return o?{kind:"modal",match:o}:null}default:return null}}function V4(e,t){if(!t||!Array.isArray(e)||e.length===0)return[];const n=[];for(const o of e)if(q4(o.scope,t))for(const r of o.items??[])r&&typeof r.id=="string"&&r.id.length>0&&n.push(r);return n}function U4(e){if(e.length===0)return null;const t=e.find(n=>n.default===!0);return t?t.id:e[0].id}function q4(e,t){if(!e||e.kind!==t.kind)return!1;const n=e.match;return typeof n!="string"||n.length===0?!1:t.kind==="route"?G4(t.match,n):n===t.match}function G4(e,t){if(t===e)return!0;if(!t.includes("*"))return!1;const n=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]+");return new RegExp(`^${n}$`).test(e)}function Ya(e,t){return e.startsWith(t)?e.slice(t.length):""}const Y4="__conngroup__/modals/",X4="__conngroup__/extensions/";function J4(e){return e.meta?.editor_label?{label:e.meta.editor_label,labelSource:"editor_label"}:e.meta?.title?{label:e.meta.title,labelSource:"title"}:{label:e.path,labelSource:"path"}}function Z4(e){switch(e.source.kind){case"template":return"template";case"module":return`module:${e.source.identifier??""}`;case"plugin":return`plugin:${e.source.identifier??""}`;case"core":return null;default:return null}}function Q4(e,t){if(e.meta?.parent&&t.has(e.meta.parent))return e.meta.parent;const n=e.path.split("/").filter(Boolean);for(let o=n.length-1;o>=1;o--){const r="/"+n.slice(0,o).join("/");if(r!==e.path&&t.has(r))return r}return null}function R4(e){const t=new Map;for(const n of e)n.layout&&t.set(n.layout,(t.get(n.layout)??0)+1);return t}function eD(e){const t=new Map;for(const n of e){if(!n.hostLayout)continue;const o=t.get(n.hostLayout)??[];o.push(n),t.set(n.hostLayout,o)}return t}function tD(e){const t=new Map;for(const n of e)for(const o of n.extensions)for(const r of o.hostLayouts??[]){if(!r)continue;const s=t.get(r)??[];s.push({extension:o,group:n}),t.set(r,s)}return t}function nD(e,t){return{path:`__modal__/${e.hostLayout}/${e.modalId}`,layoutName:e.hostLayout,label:e.label??e.modalId,labelSource:e.label?"editor_label":"path",source:{kind:"core",identifier:null},kind:"modal",modalId:e.modalId,modalHostLayout:e.hostLayout,connectedHostRoutePath:t,children:[]}}function oD(e,t){const{extension:n,group:o}=e,r=o.sourceType==="plugin"?"🔌":"🧩";return{path:`__extension__/${n.id}`,layoutName:null,label:`${r} ${o.sourceLabel} · ${n.targetName}`,labelSource:"path",source:{kind:o.sourceType,identifier:o.sourceIdentifier},kind:"extension",extensionId:String(n.id),extensionType:n.extensionType,extensionPriority:n.priority,extensionTargetName:n.targetName,isModified:n.isModified,isInactive:!n.isActive,connectedHostRoutePath:t,children:[]}}function _g(e,t,n){if(e.kind!=="route"&&e.kind!=="base"||!e.layoutName)return;const o=[],r=t.get(e.layoutName)??[];r.length>0&&o.push({path:`${Y4}${e.path}`,layoutName:null,label:`$t:layout_editor.chrome.route_tree.connected.modals|count=${r.length}`,labelSource:"editor_label",source:{kind:"core",identifier:null},kind:"route",children:r.map(a=>nD(a,e.path))});const s=n.get(e.layoutName)??[];s.length>0&&o.push({path:`${X4}${e.path}`,layoutName:null,label:`$t:layout_editor.chrome.route_tree.connected.extensions|count=${s.length}`,labelSource:"editor_label",source:{kind:"core",identifier:null},kind:"route",children:s.map(a=>oD(a,e.path))}),o.length>0&&(e.children=[...o,...e.children??[]])}function rD(e){const t=[],n=new Set(e.routes.map(o=>o.path));for(const o of e.routes){const r=Z4(o);if(!r)continue;const{label:s,labelSource:a}=J4(o),l=Q4(o,n),d={path:o.path,layoutName:o.layout??null,label:s,labelSource:a,icon:o.meta?.icon??null,source:o.source,isRedirect:!!o.redirect,isHidden:!!o.meta?.hidden,kind:"route",children:[]};t.push({node:d,parentKey:l,groupKey:r})}return t}function iD(e,t){if(e==="template")return"$t:layout_editor.chrome.route_tree.group.template";if(e.startsWith("module:")){const n=e.slice(7);return`$t:layout_editor.chrome.route_tree.group.module|name=${t.moduleDisplayNames[n]??n}`}if(e.startsWith("plugin:")){const n=e.slice(7);return`$t:layout_editor.chrome.route_tree.group.plugin|name=${t.pluginDisplayNames[n]??n}`}return e}function sD(e,t){R4(e.routes);const n=eD(e.modals),o=tD(e.extensionGroups??[]),r=new Map;for(const d of t)r.has(d.groupKey)||r.set(d.groupKey,[]),r.get(d.groupKey).push(d);const s=Array.from(r.keys()).sort((d,c)=>{const p=g=>g==="template"?1:g.startsWith("module:")?2:g.startsWith("plugin:")?3:4,f=p(d),y=p(c);return f!==y?f-y:d.localeCompare(c)}),a=[];if(e.baseLayouts.length>0){const d=e.baseLayouts.map(c=>({path:`__base__/${c.layoutName}`,layoutName:c.layoutName,label:c.label??c.layoutName,labelSource:c.label?"editor_label":"path",source:{kind:"core",identifier:null},kind:"base",children:[]}));for(const c of d)_g(c,n,o);a.push({path:"__group__/base",layoutName:null,label:"$t:layout_editor.chrome.route_tree.group.base",labelSource:"editor_label",source:{kind:"core",identifier:null},kind:"route",children:d})}for(const d of s){const c=r.get(d),p=new Map;for(const y of c)p.set(y.node.path,y);const f=[];for(const y of c)if(y.parentKey&&p.has(y.parentKey)){const g=p.get(y.parentKey);g.node.children=g.node.children??[],g.node.children.push(y.node)}else f.push(y.node);for(const y of c)_g(y.node,n,o);a.push({path:`__group__/${d}`,layoutName:null,label:iD(d,e),labelSource:"editor_label",source:{kind:"core",identifier:null},kind:"route",children:f})}if(e.modals.length>0){const d=e.modals.map(c=>({path:`__modal__/${c.hostLayout}/${c.modalId}`,layoutName:c.hostLayout,label:c.label??c.modalId,labelSource:c.label?"editor_label":"path",source:{kind:"core",identifier:null},kind:"modal",modalId:c.modalId,modalHostLayout:c.hostLayout,children:[]}));a.push({path:"__group__/modal",layoutName:null,label:"$t:layout_editor.chrome.route_tree.group.modal",labelSource:"editor_label",source:{kind:"core",identifier:null},kind:"route",children:d})}const l=e.extensionGroups??[];if(l.length>0){const d=l.map(c=>{const p=c.sourceType==="plugin"?"🔌":"🧩",f=c.extensions.map(y=>({path:`__extension__/${y.id}`,layoutName:null,label:`${c.sourceLabel} · ${y.targetName}`,labelSource:"path",source:{kind:c.sourceType,identifier:c.sourceIdentifier},kind:"extension",extensionId:String(y.id),extensionType:y.extensionType,extensionPriority:y.priority,extensionTargetName:y.targetName,isModified:y.isModified,isInactive:!y.isActive,children:[]}));return{path:`__extgroup__/${c.sourceType}/${c.sourceIdentifier}`,layoutName:null,label:`${p} ${c.sourceLabel}`,labelSource:"path",source:{kind:c.sourceType,identifier:c.sourceIdentifier},kind:"route",children:f}});a.push({path:"__group__/extension",layoutName:null,label:"$t:layout_editor.chrome.route_tree.group.extension",labelSource:"editor_label",source:{kind:"core",identifier:null},kind:"route",children:d})}return a}function aD(e){const t=rD(e);return sD(e,t)}const On=dr("useEditorRoutes");function lD(e,t){if(typeof e=="string")return e.length>0?e:null;if(e&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n.length>0)return n;if(typeof e.en=="string"&&e.en.length>0)return e.en;for(const o of Object.values(e))if(typeof o=="string"&&o.length>0)return o}return null}function xg(e,t){const n={};if(typeof window>"u")return n;const r=window.G7Config?.[e];if(!Array.isArray(r))return n;for(const s of r)s&&typeof s.identifier=="string"&&(n[s.identifier]=lD(s.display_name,t)??s.identifier);return n}function dD(e){const t=new vd,n=typeof window<"u"?window.G7Config:void 0,o={_global:{settings:n?.settings??{},plugins:n?.plugins??{},modules:n?.modules??{},appConfig:n?.appConfig??{}}};return e.map(r=>{const s={...r};if(typeof s.path=="string"&&s.path.includes("{{")){const a=s.path;let l=t.resolveBindings(s.path,o);l=l.replace(/\/\/+/g,"/")||"/",l.includes("{{")&&(On.warn("편집기 route path 표현식 평가 실패 — fallback 적용",{originalPath:a}),l=a.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/"),s.path=l}if(typeof s.redirect=="string"&&s.redirect.includes("{{")){const a=s.redirect;let l=t.resolveBindings(a,o);l=l.replace(/\/\/+/g,"/")||"/",l.includes("{{")&&(On.warn("편집기 route redirect 표현식 평가 실패 — fallback 적용",{originalRedirect:a}),l=a.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/"),s.redirect=l}return s})}function cD(e){const{dispatch:t}=Je(),{translationEngine:n,translationContext:o}=tt(),{templateIdentifier:r,cacheVersion:s}=e;u.useEffect(()=>{let a=!1;const l=s??(typeof window<"u"?window.G7Config?.cache_version:void 0)??"",d=l!==""?`?v=${encodeURIComponent(String(l))}`:"",c=en(`/api/admin/templates/${encodeURIComponent(r)}/editor/routes`,"json",null,d.replace(/^[?&]+/,"")),p=o?.locale??"ko",f=n&&r!==o?.templateId?n.loadTranslations(r,p).then(()=>{On.log("편집 대상 lang 로드 완료",{targetTemplate:r,locale:p})}).catch(h=>{On.warn("편집 대상 lang 로드 실패 — 라우트 라벨 fallback 사용",h)}):Promise.resolve(),y=(()=>{if(typeof fetch!="function")return Promise.reject(io(new Error("fetch unavailable"),"routes"));try{const h=fetch(c,{credentials:"same-origin",headers:je()});return!h||typeof h.then!="function"?Promise.reject(io(new Error("fetch returned non-Promise (test stub?)"),"routes")):h.then(async v=>{if(!v.ok){const b=await v.json().catch(()=>null);throw Gr(v.status,b,"routes")}return v.json()})}catch(h){return Promise.reject(h)}})(),g=`/api/admin/templates/${encodeURIComponent(r)}/layout-extensions${d}`,m=(()=>{if(typeof fetch!="function")return Promise.resolve(null);try{const h=fetch(g,{credentials:"same-origin",headers:je()});return!h||typeof h.then!="function"?Promise.resolve(null):h.then(async v=>v.ok?await v.json():null).catch(()=>null)}catch{return Promise.resolve(null)}})();return Promise.all([y,f,m]).then(([h,,v])=>{if(a)return;if(!h||!h.success||!Array.isArray(h.data?.routes)){On.warn("routes 응답 형식이 비정상 — empty tree 로 둠",h),t({type:"SET_ROUTES_ERROR",error:{kind:"unknown",status:200,message:"routes 응답 형식이 비정상입니다.",source:"routes"}});return}const b=dD(h.data.routes),x=xg("activeModules",p),k=xg("activePlugins",p),w=(h.data.base_layouts??[]).map(A=>({layoutName:A.layout_name,label:A.label??void 0})),_=(h.data.modals??[]).map(A=>({modalId:A.modal_id,hostLayout:A.host_layout,label:A.label??void 0})),S=(v?.success&&Array.isArray(v.data)?v.data:[]).map(A=>({sourceIdentifier:A.source_identifier,sourceType:A.source_type,sourceLabel:A.source_label,extensions:(A.extensions??[]).map(z=>({id:z.id,extensionType:z.extension_type,targetName:z.target_name,priority:z.priority,isActive:z.is_active,isModified:z.is_modified,hostLayouts:Array.isArray(z.host_layouts)?z.host_layouts:[],currentVersion:typeof z.current_version=="number"?z.current_version:void 0}))})),E=aD({routes:b,modals:_,baseLayouts:w,extensionGroups:S,moduleDisplayNames:x,pluginDisplayNames:k});t({type:"SET_ROUTE_TREE",tree:E});const C=h.data.layout_versions,N={};if(C&&typeof C=="object"&&!Array.isArray(C))for(const[A,z]of Object.entries(C))typeof z=="number"&&Number.isFinite(z)&&(N[A]=z);t({type:"SET_LAYOUT_VERSIONS",versions:N});const $={};for(const A of S)for(const z of A.extensions){const D=z.currentVersion;typeof D=="number"&&Number.isFinite(D)&&($[String(z.id)]=D)}t({type:"SET_EXTENSION_VERSIONS",versions:$}),On.log("routes 로드 완료",{count:b.length,groups:E.length})}).catch(h=>{if(a)return;On.error("routes 로드 실패",h);const v=pp(h)?h:io(h,"routes");t({type:"SET_ROUTES_ERROR",error:v})}),()=>{a=!0}},[r,s,t,n,o?.locale,o?.templateId])}function wg(e,t,n,o=[]){const r=t?kg(o,t):null,s=r!==null?{path:r.path,layoutName:r.layoutName}:void 0;if(e.startsWith("__base__/")){const a=e.slice(9);if(a)return n({type:"ENTER_BASE_EDIT",layoutName:a,returnRoute:s}),!0}else if(e.startsWith("__modal__/")){const a=e.slice(10);return a&&!a.includes("/")&&t?(n({type:"ENTER_MODAL_EDIT",modalId:a,hostLayout:t,returnRoute:s}),!0):!1}else if(e.startsWith("__extension__/")){const a=e.slice(14);if(a&&!a.includes("/"))return n({type:"ENTER_EXTENSION_EDIT",extensionId:a,returnRoute:s}),!0}else if(e.startsWith("__iteration__/")){const a=e.slice(14);return a&&t?(n({type:"ENTER_ITERATION_ITEM_EDIT",sourcePath:a,hostLayout:t,returnRoute:s}),!0):!1}return!1}function kg(e,t){for(const n of e){if(n.kind==="route"&&n.layoutName===t)return n;if(n.children&&n.children.length>0){const o=kg(n.children,t);if(o)return o}}return null}function Xa(e,t){for(const n of e){if(n.kind==="route"&&n.path===t)return n;if(n.children&&n.children.length>0){const o=Xa(n.children,t);if(o)return o}}return null}function uD(e){const{state:t,dispatch:n}=Je(),o=u.useRef(!1),r=u.useRef(t.editMode);r.current=t.editMode,u.useEffect(()=>{if(o.current||t.routeTree.length===0||typeof window>"u")return;const a=rp(window.location.search);if(a){const c=op(window.location.search),p=wg(a,c,n,t.routeTree);if(o.current=!0,p)return}const l=np(window.location.search);if(!l){o.current=!0;return}const d=Xa(t.routeTree,l);d&&n({type:"SELECT_ROUTE",route:{path:d.path,layoutName:d.layoutName}}),o.current=!0},[t.routeTree,n]),u.useEffect(()=>{if(typeof window>"u")return;const a=()=>{const l=rp(window.location.search);if(l){const p=op(window.location.search);if(wg(l,p,n,t.routeTree))return}if(r.current!=="route")switch(r.current){case"base":n({type:"EXIT_BASE_EDIT"});return;case"modal":n({type:"EXIT_MODAL_EDIT"});return;case"extension":n({type:"EXIT_EXTENSION_EDIT"});return;case"iteration_item":n({type:"EXIT_ITERATION_ITEM_EDIT"});return}const d=np(window.location.search);if(!d){n({type:"SELECT_ROUTE",route:null});return}const c=Xa(t.routeTree,d);c&&n({type:"SELECT_ROUTE",route:{path:c.path,layoutName:c.layoutName}})};return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[t.routeTree,n]);const s=u.useRef("route");u.useEffect(()=>{if(typeof window>"u"||!window.history?.replaceState||t.routeTree.length===0)return;const a=Zs(e,t.selectedRoute?.path??null,t.selectedRoute?.layoutName??null),l=`${window.location.pathname}${window.location.search}`,d=s.current;if(s.current=t.editMode,l===a)return;d==="route"&&t.editMode!=="route"&&window.history.pushState?window.history.pushState(window.history.state,"",a):window.history.replaceState(window.history.state,"",a)},[t.selectedRoute,t.editMode,t.routeTree,e])}function pD(){u.useEffect(()=>{if(typeof document>"u")return;const e=document.documentElement;let t=e.classList.contains("dark");const n=()=>{e.classList.contains("dark")&&(t=!0,e.classList.remove("dark"))};n();let o=null;return typeof MutationObserver<"u"&&(o=new MutationObserver(n),o.observe(e,{attributes:!0,attributeFilter:["class"]})),()=>{o?.disconnect(),t&&e.classList.add("dark")}},[])}function fD(){u.useEffect(()=>{if(typeof document>"u"||!document.body)return;const e=document.body,t=()=>{e.style.overflow==="hidden"&&(e.style.overflow=""),e.style.overflowY==="hidden"&&(e.style.overflowY="")};t();let n=null;return typeof MutationObserver<"u"&&(n=new MutationObserver(t),n.observe(e,{attributes:!0,attributeFilter:["style"]})),()=>{n?.disconnect()}},[])}function gD(e){if(typeof e!="string")return null;const t="__extension__/";if(!e.startsWith(t))return null;const n=e.slice(t.length);return n===""||n.includes("/")?null:n}function hD(e){if(Array.isArray(e.components))return e.components;if(Array.isArray(e.injections)){const t=[];return e.injections.forEach((n,o)=>{if(n&&Array.isArray(n.components))for(const r of n.components)t.push({...r,__injectionIndex:o})}),t}return[]}function yD(e,t){if(Array.isArray(e.components)){const n=t.map(o=>Ja(o));return{...e,components:n}}if(Array.isArray(e.injections)){const n=e.injections.map(o=>({...o}));n.forEach(o=>{Array.isArray(o.components)&&(o.components=[])});for(const o of t){const r=o.__injectionIndex,s=typeof r=="number"&&r>=0&&rJa(n))),t}function Sg(e,t){const n=[],o=r=>{if(Array.isArray(r))for(const s of r){if(!s||typeof s!="object")continue;const a=s.__source;if(a?.kind==="extension"&&a.extensionId===t){n.push(s);continue}Array.isArray(s.children)&&o(s.children)}};return o(e),n}function Cg(e,t){const o=Sg(e,t)[0]?.__source;return o&&o.kind==="extension"&&o.extensionId===t?o:{kind:"extension",extensionId:t}}function Za(e,t){for(const n of e){const o=n?.__source;if(o?.kind==="extension"&&o.extensionId===t||Array.isArray(n.children)&&Za(n.children,t))return!0}return!1}function bD(){const{state:e}=Je(),t=e.templateIdentifier,n=e.editMode==="extension"?gD(e.selectedRoute?.path):null,o=e.editMode==="extension"&&typeof e.selectedRoute?.layoutName=="string"?e.selectedRoute.layoutName:null,[r,s]=u.useState(null),[a,l]=u.useState(!1),[d,c]=u.useState(null),[p,f]=u.useState(!1),[y,g]=u.useState(0),[m,h]=u.useState(null),v=u.useRef({}),b=u.useRef({kind:"extension",extensionId:0}),x=u.useRef(null);u.useEffect(()=>{x.current=r},[r]),u.useEffect(()=>{h(null)},[n]);const k=u.useCallback(async A=>{const z=window.G7Config?.cache_version??0,D=en(`/api/layouts/${encodeURIComponent(t)}/${A}`,"json",`${z}.${xp()}`,"with_source_meta=1"),O=sr(),M={Accept:"application/json"};O&&(M.Authorization=`Bearer ${O}`);const B=await fetch(D,{headers:M,credentials:"same-origin"});if(!B.ok)return null;const T=await B.json().catch(()=>null);return(T&&(T.data||T))??{}},[t]),w=u.useCallback(async()=>{if(!n){s(null),c(null),f(!1);return}l(!0),c(null);try{const A=window.G7Config?.cache_version??0,z=`/api/admin/templates/${encodeURIComponent(t)}/layout-extensions/${encodeURIComponent(n)}?v=${A}`,D=await fetch(z,{headers:je(),credentials:"same-origin"}),O=await D.json().catch(()=>null);if(!D.ok){c(Gr(D.status,O,"layout")),s(null),f(!1);return}const M=(O&&(O.data||O))??{};let B={};const T=M.content;if(typeof T=="string")try{B=JSON.parse(T)}catch{B={}}else T&&typeof T=="object"&&(B=T);const H=M.extension_type==="overlay"?"overlay":"extension_point",L=typeof M.lock_version=="number"?M.lock_version:0,I=Array.isArray(M?.host_layouts)?M.host_layouts.filter(re=>typeof re=="string"):[],P=o??(I.length===1?I[0]:m&&I.includes(m)?m:null),F=Number(n);v.current=B;let V=hD(B),Y={},Z="pending";const se={kind:"extension",extensionId:F};if(b.current=se,P){const re=await k(P);if(re){Y=re;const U=Array.isArray(re.components)?re.components:[],ee=Cg(U,F);if(b.current=ee,Za(U,F))V=U,Z="ok";else{const K=(Array.isArray(re.modals)?re.modals:[]).filter(ne=>ne&&typeof ne=="object"&&Za([ne],F));if(K.length>0){const ne=K.map(me=>({...me,props:{...me.props??{},isOpen:!0}}));V=[...U,...ne],b.current=Cg(K,F),Z="ok"}else V=U,Z="no-injection"}}}s({extensionId:F,content:B,extensionType:H,components:V,lockVersion:L,hostLayouts:I,hostLayoutName:P,hostRaw:Y,editability:Z}),f(!1),st({op:"load",layoutName:`extension:${n}`,editMode:"extension",statusCode:D.status,timestamp:Date.now()})}catch(A){c(io(A,"layout")),s(null),f(!1)}finally{l(!1)}},[t,n,m,o,k]);u.useEffect(()=>{w()},[w]);const _=u.useCallback(A=>{h(A)},[]),S=u.useCallback(A=>{s(z=>z&&{...z,components:A}),f(!0),st({op:"patch",layoutName:`extension:${x.current?.extensionId??""}`,editMode:"extension",isDirty:!0,timestamp:Date.now()})},[]),E=u.useCallback(A=>{s(z=>z&&{...z,components:A(z.components)}),f(!0)},[]),C=u.useCallback(async()=>{const A=x.current;if(!A)return{kind:"guard_no_document"};const z=`/api/admin/templates/${encodeURIComponent(t)}/layout-extensions/${A.extensionId}`,D=Sg(A.components,A.extensionId),O=D.length>0?D:A.components,M=yD(v.current,O);st({op:"save",layoutName:`extension:${A.extensionId}`,editMode:"extension",saveTarget:"layout_extension",endpoint:z,isDirty:p,timestamp:Date.now()});let B;try{B=await fetch(z,{method:"PUT",headers:je({"Content-Type":"application/json"}),credentials:"same-origin",body:JSON.stringify({content:M,expected_lock_version:A.lockVersion})})}catch(H){return{kind:"network_error",message:H instanceof Error?H.message:"network error"}}const T=await B.json().catch(()=>null);if(st({op:"save_response",layoutName:`extension:${A.extensionId}`,editMode:"extension",endpoint:z,statusCode:B.status,conflict:B.status===409?{currentVersion:T?.errors?.current_version??T?.current_version,yourVersion:T?.errors?.your_version??T?.your_version}:void 0,timestamp:Date.now()}),B.ok){const H=T?.data??{},L=typeof H.lock_version=="number"?H.lock_version:A.lockVersion+1;s(P=>P&&{...P,lockVersion:L}),f(!1),g(P=>P+1);const I=typeof H.current_version=="number"?H.current_version:void 0;return{kind:"success",newLockVersion:L,newContentVersion:I,savedExtensionId:String(A.extensionId)}}return B.status===409?{kind:"concurrent_modification",currentVersion:T?.current_version??-1,yourVersion:T?.your_version??A.lockVersion}:B.status===422?{kind:"validation_failed",status:422,errors:T?.errors??null}:{kind:"network_error",message:T?.message??`HTTP ${B.status}`}},[t,p]),N=u.useCallback(async()=>{na(),await w()},[w]),$=!!r&&r.hostLayouts.length>1&&r.hostLayoutName===null;return{document:r,isLoading:a,error:d,isDirty:p,saveSuccessCounter:y,setLayoutComponents:S,patchLayout:E,save:C,reload:N,needsHostPicker:$,selectHost:_}}const $g=new Set;function mD(e,t,n){const r=e&&Object.keys(e).length>0?e:t,s=Array.isArray(r.data_sources)?r.data_sources:[],a=Array.isArray(t.data_sources)?t.data_sources:[],l=new Set,d=[];for(const c of[...s,...a]){const p=c&&typeof c=="object"?c.id:void 0,f=typeof p=="string"?p:`__anon_${d.length}`;l.has(f)||(l.add(f),d.push(c))}return{...r,components:n,...d.length>0?{data_sources:d}:{},lock_version:void 0}}function vD(e){return{document:e.document?{layoutName:`extension:${e.document.extensionId}`,raw:{...mD(e.document.hostRaw,e.document.content,e.document.components),__editability:e.document.editability,__extensionId:e.document.extensionId},lockVersion:e.document.lockVersion}:null,isLoading:e.isLoading,error:e.error,isDirty:e.isDirty,saveSuccessCounter:e.saveSuccessCounter,reload:e.reload,patchLayout:e.patchLayout,setLayoutComponents:e.setLayoutComponents,patchDocumentRaw:()=>{},dirtyKeys:$g,dirtyLayoutNames:$g,invalidateCurrentCache:()=>{},reloadCounter:0,save:()=>e.save(),markDirty:()=>{}}}function _D({hostLayouts:e,extensionLabel:t,onSelect:n}){const{t:o}=tt();return i.jsx("div",{className:"g7le-host-picker__backdrop","data-testid":"g7le-host-picker",role:"dialog","aria-modal":"true","aria-label":o("layout_editor.host_picker.title"),style:{position:"fixed",inset:0,zIndex:9500,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(15, 23, 42, 0.55)"},children:i.jsxs("div",{className:"g7le-host-picker__panel",style:{width:"min(520px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"#ffffff",color:"#0f172a",borderRadius:12,boxShadow:"0 20px 48px rgba(15, 23, 42, 0.28)",padding:"20px 22px"},children:[i.jsx("h2",{className:"g7le-host-picker__title",style:{margin:"0 0 6px",fontSize:16,fontWeight:700},children:o("layout_editor.host_picker.title")}),i.jsx("p",{className:"g7le-host-picker__desc",style:{margin:"0 0 16px",fontSize:13,color:"#475569",lineHeight:1.6},children:t?o("layout_editor.host_picker.description_with_label",{label:t}):o("layout_editor.host_picker.description")}),i.jsx("ul",{className:"g7le-host-picker__list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:8},children:e.map(r=>i.jsx("li",{children:i.jsxs("button",{type:"button",className:"g7le-host-picker__item","data-testid":"g7le-host-picker-item","data-host":r,onClick:()=>n(r),style:{width:"100%",textAlign:"left",padding:"12px 14px",border:"1px solid #e2e8f0",borderRadius:8,background:"#f8fafc",cursor:"pointer",fontSize:13,fontWeight:600,color:"#0f172a",display:"flex",alignItems:"center",gap:8},children:[i.jsx("span",{"aria-hidden":!0,style:{fontSize:14},children:"🖼"}),i.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:r}),i.jsx("span",{"aria-hidden":!0,style:{color:"#94a3b8"},children:"→"})]})},r))})]})})}function xD(e,t){const[n,o]=u.useState(!1),[r,s]=u.useState(null),a=u.useCallback(async l=>{if(!t||!l)return{kind:"no_document"};o(!0),s(null);try{const d=mo(l),c=`/api/admin/templates/${encodeURIComponent(e)}/layouts/${t}/preview`,p=await fetch(c,{method:"POST",credentials:"same-origin",headers:je({"Content-Type":"application/json"}),body:JSON.stringify({content:JSON.stringify(d)})}),f=await p.json().catch(()=>null);if(!p.ok){const h=f?.message??`HTTP ${p.status}`;return s(h),{kind:"network_error",message:h}}const y=f?.data,g=typeof y?.token=="string"?y.token:"",m=typeof y?.preview_url=="string"&&y.preview_url?y.preview_url:g?`/preview/${g}`:"";return m?(window.G7Core?.dispatch?.({handler:"openWindow",params:{path:m}}),{kind:"success",previewUrl:m,token:g}):(s("invalid preview response"),{kind:"network_error",message:"invalid preview response"})}catch(d){const c=d instanceof Error?d.message:"network error";return s(c),{kind:"network_error",message:c}}finally{o(!1)}},[e,t]);return{isCreating:n,error:r,createPreview:a}}const ce="layout_editor.action_recipe",bn={setState:{label:`$t:${ce}.set_state.label`,params:[{key:"target",label:`$t:${ce}.set_state.param_target`,widget:"select",options:[{value:"local"},{value:"global"}]},{key:"state",label:`$t:${ce}.set_state.param_state`,widget:"state-key-value"},{key:"merge",label:`$t:${ce}.set_state.param_merge`,widget:"toggle"}],build:{handler:"setState",params:{target:"{{target}}",merge:"{{merge}}","...":"{{state}}"}}},loadFromLocalStorage:{label:`$t:${ce}.load_local.label`,params:[{key:"key",label:`$t:${ce}.load_local.param_key`,widget:"text",required:!0},{key:"stateKey",label:`$t:${ce}.load_local.param_state_key`,widget:"state-key-picker"},{key:"defaultValue",label:`$t:${ce}.load_local.param_default`,widget:"text"}],build:{handler:"loadFromLocalStorage",params:{key:"{{key}}",stateKey:"{{stateKey}}",defaultValue:"{{defaultValue}}"}}},saveToLocalStorage:{label:`$t:${ce}.save_local.label`,params:[{key:"key",label:`$t:${ce}.save_local.param_key`,widget:"text",required:!0},{key:"value",label:`$t:${ce}.save_local.param_value`,widget:"data-chip"}],build:{handler:"saveToLocalStorage",params:{key:"{{key}}",value:"{{value}}"}}},navigate:{label:`$t:${ce}.navigate.label`,params:[{key:"path",label:`$t:${ce}.navigate.param_path`,widget:"page-picker",required:!0},{key:"query",label:`$t:${ce}.navigate.param_query`,widget:"key-value"},{key:"mergeQuery",label:`$t:${ce}.navigate.param_merge_query`,widget:"toggle"},{key:"scroll",label:`$t:${ce}.navigate.param_scroll`,widget:"select",options:[{value:"top"},{value:"preserve"},{value:"none"}]},{key:"replace",label:`$t:${ce}.navigate.param_replace`,widget:"toggle"},{key:"transition_overlay_target",label:`$t:${ce}.navigate.param_overlay_target`,widget:"component-target-picker",dependsOn:{param:"replace",equals:!0}}],build:{handler:"navigate",params:{path:"{{path}}",query:"{{query}}",mergeQuery:"{{mergeQuery}}",scroll:"{{scroll}}",replace:"{{replace}}",transition_overlay_target:"{{transition_overlay_target}}"}}},openWindow:{label:`$t:${ce}.open_window.label`,params:[{key:"target",label:`$t:${ce}.open_window.param_target`,widget:"page-picker",required:!0},{key:"windowTarget",label:`$t:${ce}.open_window.param_window_target`,widget:"select",options:[{value:"_blank"},{value:"_self"}]}],build:{handler:"openWindow",target:"{{target}}",params:{windowTarget:"{{windowTarget}}"}}},navigateBack:{label:`$t:${ce}.navigate_back.label`,params:[],build:{handler:"navigateBack"}},navigateForward:{label:`$t:${ce}.navigate_forward.label`,params:[],build:{handler:"navigateForward"}},replaceUrl:{label:`$t:${ce}.replace_url.label`,params:[{key:"path",label:`$t:${ce}.replace_url.param_path`,widget:"page-picker"},{key:"query",label:`$t:${ce}.replace_url.param_query`,widget:"key-value"}],build:{handler:"replaceUrl",params:{path:"{{path}}",query:"{{query}}"}}},toast:{label:`$t:${ce}.toast.label`,params:[{key:"message",label:`$t:${ce}.toast.param_message`,widget:"i18n-text",required:!0},{key:"type",label:`$t:${ce}.toast.param_type`,widget:"select",options:[{value:"info"},{value:"success"},{value:"warning"},{value:"error"}]},{key:"duration",label:`$t:${ce}.toast.param_duration`,widget:"number"},{key:"icon",label:`$t:${ce}.toast.param_icon`,widget:"text"}],build:{handler:"toast",params:{message:"{{message}}",type:"{{type}}",duration:"{{duration}}",icon:"{{icon}}"}}},openModal:{label:`$t:${ce}.open_modal.label`,params:[{key:"target",label:`$t:${ce}.open_modal.param_target`,widget:"modal-picker",required:!0}],build:{handler:"openModal",target:"{{target}}"}},closeModal:{label:`$t:${ce}.close_modal.label`,params:[],build:{handler:"closeModal"}},showAlert:{label:`$t:${ce}.show_alert.label`,params:[{key:"target",label:`$t:${ce}.show_alert.param_message`,widget:"i18n-text",required:!0}],build:{handler:"showAlert",target:"{{target}}"}},setError:{label:`$t:${ce}.set_error.label`,params:[{key:"target",label:`$t:${ce}.set_error.param_message`,widget:"i18n-text"},{key:"stateTarget",label:`$t:${ce}.set_error.param_state_target`,widget:"select",options:[{value:"local"},{value:"global"}]}],build:{handler:"setError",target:"{{target}}",params:{stateTarget:"{{stateTarget}}"}}},refetchDataSource:{label:`$t:${ce}.refetch.label`,params:[{key:"dataSourceId",label:`$t:${ce}.refetch.param_data_source`,widget:"datasource-picker",required:!0},{key:"sync",label:`$t:${ce}.refetch.param_sync`,widget:"toggle"}],build:{handler:"refetchDataSource",params:{dataSourceId:"{{dataSourceId}}",sync:"{{sync}}"}}},appendDataSource:{label:`$t:${ce}.append_data.label`,params:[{key:"dataSourceId",label:`$t:${ce}.append_data.param_data_source`,widget:"datasource-picker",required:!0},{key:"dataPath",label:`$t:${ce}.append_data.param_data_path`,widget:"text"},{key:"newData",label:`$t:${ce}.append_data.param_new_data`,widget:"data-chip"}],build:{handler:"appendDataSource",params:{dataSourceId:"{{dataSourceId}}",dataPath:"{{dataPath}}",newData:"{{newData}}"}}},updateDataSource:{label:`$t:${ce}.update_data.label`,params:[{key:"dataSourceId",label:`$t:${ce}.update_data.param_data_source`,widget:"datasource-picker",required:!0},{key:"data",label:`$t:${ce}.update_data.param_data`,widget:"data-chip"},{key:"merge",label:`$t:${ce}.update_data.param_merge`,widget:"toggle"}],build:{handler:"updateDataSource",params:{dataSourceId:"{{dataSourceId}}",data:"{{data}}",merge:"{{merge}}"}}},scrollIntoView:{label:`$t:${ce}.scroll.label`,params:[{key:"selector",label:`$t:${ce}.scroll.param_selector`,widget:"text",required:!0},{key:"behavior",label:`$t:${ce}.scroll.param_behavior`,widget:"select",options:[{value:"smooth"},{value:"auto"}]},{key:"block",label:`$t:${ce}.scroll.param_block`,widget:"select",options:[{value:"start"},{value:"center"},{value:"end"},{value:"nearest"}]}],build:{handler:"scrollIntoView",params:{selector:"{{selector}}",behavior:"{{behavior}}",block:"{{block}}"}}},login:{label:`$t:${ce}.login.label`,params:[{key:"body",label:`$t:${ce}.login.param_body`,widget:"key-value"}],build:{handler:"login",params:{body:"{{body}}"}}},logout:{label:`$t:${ce}.logout.label`,params:[{key:"target",label:`$t:${ce}.logout.param_target`,widget:"text"}],build:{handler:"logout",target:"{{target}}"}},setLocale:{label:`$t:${ce}.set_locale.label`,params:[{key:"target",label:`$t:${ce}.set_locale.param_target`,widget:"locale-picker",required:!0}],build:{handler:"setLocale",target:"{{target}}"}},emitEvent:{label:`$t:${ce}.emit_event.label`,params:[{key:"event",label:`$t:${ce}.emit_event.param_event`,widget:"text",required:!0},{key:"data",label:`$t:${ce}.emit_event.param_data`,widget:"data-chip"}],build:{handler:"emitEvent",params:{event:"{{event}}",data:"{{data}}"}}},apiCall:{label:`$t:${ce}.api_call.label`,params:[{key:"target",label:`$t:${ce}.api_call.param_target`,widget:"page-picker",required:!0},{key:"method",label:`$t:${ce}.api_call.param_method`,widget:"select",options:[{value:"GET"},{value:"POST"},{value:"PUT"},{value:"PATCH"},{value:"DELETE"}]},{key:"body",label:`$t:${ce}.api_call.param_body`,widget:"key-value"},{key:"query",label:`$t:${ce}.api_call.param_query`,widget:"key-value"},{key:"identity_target_email",label:`$t:${ce}.api_call.param_identity_target_email`,widget:"data-chip"},{key:"identity_target_phone",label:`$t:${ce}.api_call.param_identity_target_phone`,widget:"data-chip"},{key:"onSuccess",label:`$t:${ce}.api_call.param_on_success`,widget:"action-list"},{key:"onError",label:`$t:${ce}.api_call.param_on_error`,widget:"action-list"}],build:{handler:"apiCall",target:"{{target}}",identity_target:{email:"{{identity_target_email}}",phone:"{{identity_target_phone}}"},onSuccess:"{{onSuccess}}",onError:"{{onError}}",params:{method:"{{method}}",body:"{{body}}",query:"{{query}}"}}},conditions:{label:`$t:${ce}.conditions.label`,params:[{key:"branches",label:`$t:${ce}.conditions.param_branches`,widget:"branch-list"}],build:{handler:"conditions",conditions:"{{branches}}"}},sequence:{label:`$t:${ce}.sequence.label`,params:[{key:"actions",label:`$t:${ce}.sequence.param_actions`,widget:"action-list"}],build:{handler:"sequence",params:{actions:"{{actions}}"}}},parallel:{label:`$t:${ce}.parallel.label`,params:[{key:"actions",label:`$t:${ce}.parallel.param_actions`,widget:"action-list"}],build:{handler:"parallel",params:{actions:"{{actions}}"}}},switch:{label:`$t:${ce}.switch.label`,params:[{key:"value",label:`$t:${ce}.switch.param_value`,widget:"data-chip"},{key:"cases",label:`$t:${ce}.switch.param_cases`,widget:"action-list",advanced:!0}],build:{handler:"switch",params:{value:"{{value}}",cases:"{{cases}}"}}},suppress:{label:`$t:${ce}.suppress.label`,params:[],build:{handler:"suppress"}}};function wD(){return{actionRecipes:bn,initActionRecipes:bn,errorRecipes:{navigate:bn.navigate,openModal:bn.openModal,toast:bn.toast,setState:bn.setState,sequence:bn.sequence,parallel:bn.parallel,showErrorPage:{label:`$t:${ce}.show_error_page.label`,params:[{key:"target",label:`$t:${ce}.show_error_page.param_target`,widget:"select",options:[{value:"content"},{value:"full"}]}],build:{handler:"showErrorPage",params:{target:"{{target}}"}}}}}}function Qa(e,t){return typeof e.label=="string"?e.label.startsWith("$t:")?t(e.label.slice(3)):e.label:String(e.value)}function vi(e){return Array.isArray(e.options)?e.options:[]}function kD({control:e,value:t,onChange:n,t:o}){const r=vi(e);return i.jsx("div",{className:"g7le-widget g7le-widget--segmented","data-testid":"g7le-widget-segmented",style:LD,children:r.map(s=>{const a=s.value===t;return i.jsx("button",{type:"button","data-testid":`g7le-segment-${String(s.value)}`,"data-active":a?"true":"false",onClick:()=>n(a?void 0:s.value),style:{...KD,background:a?"#2563eb":"#fff",color:a?"#fff":"#0f172a",borderColor:a?"#2563eb":"#cbd5e1"},children:Qa(s,o)},String(s.value))})})}function SD({control:e,value:t,onChange:n,t:o}){const r=Array.isArray(e.scale)?e.scale:[],s=r.findIndex(l=>l===t),a=t!=null;return i.jsxs("div",{className:"g7le-widget g7le-widget--slider","data-testid":"g7le-widget-slider",style:Ig,children:[i.jsxs("label",{style:Ra,children:[i.jsx("input",{type:"checkbox","data-testid":"g7le-slider-enabled",checked:a,onChange:l=>{l.target.checked?n(r.length>0?r[Math.max(0,s===-1?0:s)]:void 0):n(void 0)}}),i.jsx("span",{style:{fontSize:12,color:"#64748b"},children:o("layout_editor.control.use")})]}),i.jsx("input",{type:"range","data-testid":"g7le-slider-range",min:0,max:Math.max(0,r.length-1),step:1,disabled:!a||r.length===0,value:s===-1?0:s,onChange:l=>{const d=Number(l.target.value);n(r[d])},style:{flex:1}}),i.jsx("span",{"data-testid":"g7le-slider-value",style:{fontSize:12,color:"#0f172a",minWidth:48,textAlign:"right"},children:a?String(t):o("layout_editor.control.default")})]})}function CD({control:e,value:t,onChange:n,t:o}){const r=vi(e);return i.jsxs("select",{className:"g7le-widget g7le-widget--select","data-testid":"g7le-widget-select",value:t==null?"":String(t),onChange:s=>{const a=s.target.value;if(a===""){n(void 0);return}const l=r.find(d=>String(d.value)===a);n(l?l.value:a)},style:VD,children:[i.jsx("option",{value:"",children:o("layout_editor.control.default")}),r.map(s=>i.jsx("option",{value:String(s.value),children:Qa(s,o)},String(s.value)))]})}function $D({control:e,value:t,onChange:n}){const o=vi(e),r=o[1]?.value??!0,s=o[0]?.value??void 0,a=t===r;return i.jsx("button",{type:"button",className:"g7le-widget g7le-widget--toggle","data-testid":"g7le-widget-toggle",role:"switch","aria-checked":a,onClick:()=>n(a?s:r),style:{...UD,background:a?"#2563eb":"#cbd5e1"},children:i.jsx("span",{style:{...qD,transform:a?"translateX(18px)":"translateX(0)"}})})}function ED({control:e,value:t,onChange:n,t:o,freeValueDisabled:r}){const s=vi(e),a=t==null?"":String(t),[l,d]=u.useState(a);u.useEffect(()=>{d(a)},[a]);const c=p=>{const f=p.trim();if(f===""){n(void 0);return}n(f)};return i.jsxs("div",{className:"g7le-widget g7le-widget--dimension","data-testid":"g7le-widget-dimension",style:PD,children:[r?i.jsx("div",{"data-testid":"g7le-dimension-free-disabled",style:HD,children:o("layout_editor.property_modal.dark_preset_only")}):i.jsxs("div",{style:OD,children:[i.jsx("input",{type:"text","data-testid":"g7le-dimension-input",value:l,placeholder:o("layout_editor.control.dimension.placeholder"),onChange:p=>d(p.target.value),onBlur:p=>c(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),c(p.target.value))},style:BD}),i.jsx("button",{type:"button","data-testid":"g7le-dimension-clear",title:o("layout_editor.control.default"),onClick:()=>{d(""),n(void 0)},style:WD,children:o("layout_editor.control.default")})]}),s.length>0&&i.jsx("div",{style:jD,"data-testid":"g7le-dimension-chips",children:s.map(p=>{const f=String(p.value),y=f===a;return i.jsx("button",{type:"button","data-testid":`g7le-dimension-chip-${f}`,"data-active":y?"true":"false",onClick:()=>{d(f),n(f)},style:{...FD,background:y?"#2563eb":"#fff",color:y?"#fff":"#0f172a",borderColor:y?"#2563eb":"#cbd5e1"},children:Qa(p,o)},f)})})]})}function ID(e){return[{key:"t",infix:`${e}t-`,labelKey:"layout_editor.control.spacing.top"},{key:"r",infix:`${e}r-`,labelKey:"layout_editor.control.spacing.right"},{key:"b",infix:`${e}b-`,labelKey:"layout_editor.control.spacing.bottom"},{key:"l",infix:`${e}l-`,labelKey:"layout_editor.control.spacing.left"}]}function AD(e,t,n,o){const r={all:-1,sides:{}};if(typeof e!="string"||e.trim()==="")return r;const s=e.split(/\s+/).filter(a=>a.length>0);for(const a of s){const l=n.find(d=>a.startsWith(d.infix));if(l){r.sides[l.key]=o.indexOf(a.slice(l.infix.length));continue}if(a.startsWith(`${t}x-`)){const d=o.indexOf(a.slice(`${t}x-`.length));r.sides.l=d,r.sides.r=d;continue}if(a.startsWith(`${t}y-`)){const d=o.indexOf(a.slice(`${t}y-`.length));r.sides.t=d,r.sides.b=d;continue}a.startsWith(`${t}-`)&&(r.all=o.indexOf(a.slice(`${t}-`.length)))}return r}function TD({control:e,value:t,onChange:n,t:o}){const r=typeof e.spacingPrefix=="string"?e.spacingPrefix:"p",s=(Array.isArray(e.scale)?e.scale:[]).map(b=>String(b)),a=ID(r),l=AD(t,r,a,s),d=Object.values(l.sides).some(b=>b>=0),c=l.all>=0||d,[p,f]=u.useState(d);u.useEffect(()=>{d&&f(!0)},[d]);const y=Math.min(4,Math.max(0,s.length-1)),g=b=>{const x=[];for(const k of a){const w=b[k.key];w!==void 0&&w>=0&&x.push(`${k.infix}${s[w]}`)}n(x.length>0?x.join(" "):void 0)},m=b=>{n(b>=0?`${r}-${s[Math.max(0,Math.min(b,s.length-1))]}`:void 0)},h=()=>({...l.sides}),v=(b,x,k,w,_)=>{const S=k>=0;return i.jsxs("div",{style:MD,"data-testid":b,children:[i.jsxs("label",{style:{...Ra,minWidth:64},children:[i.jsx("input",{type:"checkbox","data-testid":`${b}-enabled`,checked:S,onChange:E=>_(E.target.checked)}),i.jsx("span",{style:{fontSize:12,color:"#0f172a"},children:o(x)})]}),i.jsx("input",{type:"range","data-testid":`${b}-range`,min:0,max:Math.max(0,s.length-1),step:1,disabled:!S||s.length===0,value:k<0?0:k,onChange:E=>w(Number(E.target.value)),style:{flex:1}}),i.jsx("span",{"data-testid":`${b}-value`,style:{fontSize:12,color:S?"#0f172a":"#94a3b8",minWidth:28,textAlign:"right"},children:S?s[k]:"–"})]},b)};return i.jsxs("div",{className:"g7le-widget g7le-widget--spacing","data-testid":"g7le-widget-spacing",style:DD,children:[i.jsxs("div",{style:ND,children:[i.jsxs("div",{style:zD,"data-testid":"g7le-spacing-mode",children:[i.jsx("button",{type:"button","data-testid":"g7le-spacing-mode-all","data-active":p?"false":"true",onClick:()=>{f(!1),d&&n(void 0)},style:{...Eg,background:p?"#fff":"#2563eb",color:p?"#0f172a":"#fff",borderColor:p?"#cbd5e1":"#2563eb"},children:o("layout_editor.control.spacing.mode_all")}),i.jsx("button",{type:"button","data-testid":"g7le-spacing-mode-sides","data-active":p?"true":"false",onClick:()=>{if(f(!0),l.all>=0){const b={};for(const x of a)b[x.key]=l.all;g(b)}},style:{...Eg,background:p?"#2563eb":"#fff",color:p?"#fff":"#0f172a",borderColor:p?"#2563eb":"#cbd5e1"},children:o("layout_editor.control.spacing.mode_sides")})]}),i.jsx("span",{"data-testid":"g7le-spacing-value",style:{fontSize:11,color:"#64748b",minWidth:80,textAlign:"right"},children:c?String(t):o("layout_editor.control.default")})]}),p?i.jsx("div",{"data-testid":"g7le-spacing-sides",style:{display:"flex",flexDirection:"column",gap:4},children:a.map(b=>v(`g7le-spacing-side-${b.key}`,b.labelKey,l.sides[b.key]??-1,x=>{const k=h();k[b.key]=x,g(k)},x=>{const k=h();x?k[b.key]=l.sides[b.key]>=0?l.sides[b.key]:y:delete k[b.key],g(k)}))}):i.jsxs("div",{style:Ig,children:[i.jsxs("label",{style:{...Ra,minWidth:64},children:[i.jsx("input",{type:"checkbox","data-testid":"g7le-spacing-all-enabled",checked:l.all>=0,onChange:b=>m(b.target.checked?y:-1)}),i.jsx("span",{style:{fontSize:12,color:"#64748b"},children:o("layout_editor.control.spacing.all")})]}),i.jsx("input",{type:"range","data-testid":"g7le-spacing-all-range",min:0,max:Math.max(0,s.length-1),step:1,disabled:l.all<0||s.length===0,value:l.all<0?0:l.all,onChange:b=>m(Number(b.target.value)),style:{flex:1}}),i.jsx("span",{"data-testid":"g7le-spacing-all-value",style:{fontSize:12,color:l.all>=0?"#0f172a":"#94a3b8",minWidth:28,textAlign:"right"},children:l.all>=0?s[l.all]:"–"})]})]})}const DD={display:"flex",flexDirection:"column",gap:6,width:"100%"},ND={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},zD={display:"inline-flex",gap:0,border:"1px solid #cbd5e1",borderRadius:6,overflow:"hidden"},Eg={padding:"3px 10px",fontSize:11,border:"none",borderRight:"1px solid #e2e8f0",cursor:"pointer"},MD={display:"flex",alignItems:"center",gap:8,width:"100%"},LD={display:"inline-flex",gap:0,border:"1px solid #cbd5e1",borderRadius:6,overflow:"hidden"},PD={display:"flex",flexDirection:"column",gap:6,width:"100%"},OD={display:"flex",gap:6,alignItems:"center"},BD={flex:1,padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,minWidth:80},WD={padding:"4px 8px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#64748b",cursor:"pointer",whiteSpace:"nowrap"},jD={display:"flex",flexWrap:"wrap",gap:4},HD={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"2px 0"},FD={padding:"3px 9px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:999,background:"#fff",cursor:"pointer"},KD={padding:"4px 10px",fontSize:12,border:"none",borderRight:"1px solid #e2e8f0",cursor:"pointer"},Ig={display:"flex",alignItems:"center",gap:8,width:"100%"},Ra={display:"inline-flex",alignItems:"center",gap:4},VD={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",minWidth:120},UD={position:"relative",width:38,height:20,borderRadius:10,border:"none",cursor:"pointer",padding:2,display:"inline-flex",alignItems:"center",transition:"background 120ms ease"},qD={display:"block",width:16,height:16,borderRadius:8,background:"#fff",transition:"transform 120ms ease"},GD=["#0f172a","#334155","#64748b","#94a3b8","#e2e8f0","#ffffff","#dc2626","#ea580c","#d97706","#16a34a","#0891b2","#2563eb","#7c3aed","#db2777"],Ag=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function YD(e){return Array.isArray(e.options)?e.options.filter(t=>typeof t.value=="string").map(t=>({value:t.value,swatch:typeof t.swatch=="string"?t.swatch:void 0,label:typeof t.label=="string"?t.label:void 0})):[]}function XD({control:e,value:t,onChange:n,t:o,freeValueDisabled:r}){const s=YD(e),a=s.length>0,l=typeof t=="string"&&s.some(g=>g.value===t)?t:"",d=typeof t=="string"&&Ag.test(t)?t:"",[c,p]=u.useState(d);u.useEffect(()=>{p(d)},[d]);const f=g=>{const m=g.trim();if(m===""){n(void 0);return}const h=m.startsWith("#")?m:`#${m}`;Ag.test(h)&&n(h)},y=GD;return i.jsxs("div",{className:"g7le-widget g7le-widget--color","data-testid":"g7le-widget-color",style:JD,children:[r?i.jsx("div",{"data-testid":"g7le-color-free-disabled",style:nN,children:o("layout_editor.property_modal.dark_preset_only")}):i.jsxs("div",{style:ZD,children:[i.jsxs("label",{style:QD,children:[i.jsx("span",{"data-testid":"g7le-color-swatch",style:{...RD,background:d||"transparent",backgroundImage:d?void 0:"linear-gradient(45deg,#e2e8f0 25%,transparent 25%,transparent 75%,#e2e8f0 75%),linear-gradient(45deg,#e2e8f0 25%,#fff 25%,#fff 75%,#e2e8f0 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px"}}),i.jsx("input",{type:"color","data-testid":"g7le-color-native",value:d||"#000000",onChange:g=>n(g.target.value),style:{width:0,height:0,opacity:0,position:"absolute"}})]}),i.jsx("input",{type:"text","data-testid":"g7le-color-hex",value:c,placeholder:o("layout_editor.control.color_hex_placeholder"),onChange:g=>p(g.target.value),onBlur:g=>f(g.target.value),onKeyDown:g=>{g.key==="Enter"&&f(g.target.value)},style:eN}),i.jsx("button",{type:"button","data-testid":"g7le-color-clear",onClick:()=>n(void 0),style:tN,children:o("layout_editor.control.default")})]}),a?i.jsx("div",{style:Tg,"data-testid":"g7le-color-token-presets",children:s.map(g=>{const m=l===g.value,h=g.label?g.label.startsWith("$t:")?o(g.label.slice(3)):g.label:g.value;return i.jsx("button",{type:"button","aria-label":h,title:h,"data-testid":`g7le-color-token-${g.value}`,"data-active":m?"true":"false",onClick:()=>n(m?void 0:g.value),style:{...Dg,background:g.swatch||"#e2e8f0",outline:m?"2px solid #2563eb":"none"}},g.value)})}):!r&&i.jsx("div",{style:Tg,"data-testid":"g7le-color-presets",children:y.map(g=>i.jsx("button",{type:"button","aria-label":g,"data-testid":`g7le-color-preset-${g}`,onClick:()=>n(g),style:{...Dg,background:g,outline:d.toLowerCase()===g.toLowerCase()?"2px solid #2563eb":"none"}},g))})]})}const JD={display:"flex",flexDirection:"column",gap:8},ZD={display:"flex",alignItems:"center",gap:6},QD={position:"relative",display:"inline-flex",cursor:"pointer"},RD={width:24,height:24,borderRadius:4,border:"1px solid #cbd5e1",display:"inline-block"},eN={flex:1,padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,fontFamily:"monospace"},tN={padding:"4px 8px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",color:"#64748b"},Tg={display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:4},Dg={width:"100%",height:18,borderRadius:4,border:"1px solid #cbd5e1",cursor:"pointer",padding:0},nN={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"2px 0"},Zo=[{value:"fill",labelKey:"layout_editor.control.background_image.mode_fill",size:"cover",repeat:"no-repeat"},{value:"fit",labelKey:"layout_editor.control.background_image.mode_fit",size:"contain",repeat:"no-repeat"},{value:"tile",labelKey:"layout_editor.control.background_image.mode_tile",size:"auto",repeat:"repeat"}];function oN(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Ng(e){return Zo.find(n=>n.size===e.size&&n.repeat===e.repeat)?.value??"fill"}function rN({value:e,onChange:t,t:n}){const o=oN(e),{state:r}=Je(),s=yo(),[a,l]=u.useState(!1),[d,c]=u.useState(null),[p,f]=u.useState(o.url??""),[y,g]=u.useState([]),m=u.useRef(null),h=r.templateIdentifier,v=r.selectedRoute?.layoutName??"";u.useEffect(()=>{f(o.url??"")},[o.url]);const b=u.useCallback(async()=>{if(!h||!v){g([]);return}const E=await Dl(h,v);E.ok&&g(E.data)},[h,v]);u.useEffect(()=>{b()},[b]);const x=E=>{if(!E){t(void 0);return}const C=Zo.find(N=>N.value===Ng(o))??Zo[0];t({url:E,size:o.size??C.size,repeat:o.repeat??C.repeat,position:o.position??"center"})},k=E=>{const C=Zo.find(N=>N.value===E);!C||!o.url||t({url:o.url,size:C.size,repeat:C.repeat,position:o.position??"center"})},w=async E=>{const C=E.target.files?.[0];if(!C)return;l(!0),c(null);const N=await Nl(h,v,C);N.ok?(x(N.data.url),b()):c(n("layout_editor.control.background_image.upload_failed")),l(!1),m.current&&(m.current.value="")},_=async E=>{(await zl(E.id)).ok&&g(N=>N.filter($=>$.id!==E.id))},S=()=>{const E=s.open({ariaLabel:n("layout_editor.attachment_manager.title"),width:720,maxHeightRatio:.82,content:u.createElement(Ml,{templateIdentifier:h,layoutName:v,t:n,onSelect:C=>{x(C),s.close(E)},onChanged:()=>{b()},onClose:()=>s.close(E)})})};return i.jsxs("div",{className:"g7le-widget g7le-widget--image","data-testid":"g7le-widget-image",style:iN,children:[o.url&&i.jsx("div",{"data-testid":"g7le-image-preview",style:{...sN,backgroundImage:`url(${o.url})`,backgroundSize:o.size??"cover",backgroundRepeat:o.repeat??"no-repeat",backgroundPosition:o.position??"center"}}),i.jsxs("div",{style:aN,children:[i.jsxs("label",{style:lN,children:[a?"…":n("layout_editor.control.background_image.upload"),i.jsx("input",{ref:m,type:"file",accept:"image/*","data-testid":"g7le-image-file",onChange:w,disabled:a,style:{display:"none"}})]}),i.jsx("button",{type:"button","data-testid":"g7le-image-clear",onClick:()=>t(void 0),style:dN,children:n("layout_editor.control.background_image.clear")})]}),i.jsx("input",{type:"text","data-testid":"g7le-image-url",placeholder:"https://… / URL",value:p,onChange:E=>f(E.target.value),onBlur:E=>x(E.target.value.trim()||void 0),style:cN}),i.jsx("div",{style:uN,"data-testid":"g7le-image-modes",children:Zo.map(E=>{const C=Ng(o)===E.value;return i.jsx("button",{type:"button","data-testid":`g7le-image-mode-${E.value}`,"data-active":C?"true":"false",disabled:!o.url,onClick:()=>k(E.value),style:{...pN,background:C&&o.url?"#2563eb":"#fff",color:C&&o.url?"#fff":"#0f172a"},children:n(E.labelKey)},E.value)})}),i.jsxs("div",{style:fN,"data-testid":"g7le-image-gallery",children:[i.jsxs("div",{style:gN,children:[i.jsx("span",{style:{fontSize:11,color:"#64748b"},children:n("layout_editor.attachment_manager.recent")}),i.jsxs("button",{type:"button","data-testid":"g7le-image-manage",onClick:S,style:hN,children:["🖼 ",n("layout_editor.attachment_manager.manage_link")]})]}),y.length>0?i.jsx("div",{style:yN,"data-testid":"g7le-image-thumbs",children:y.slice(0,8).map(E=>i.jsxs("div",{style:bN,"data-testid":`g7le-image-thumb-${E.id}`,children:[i.jsx("button",{type:"button",title:E.original_name,onClick:()=>x(E.url),style:{...mN,backgroundImage:`url(${E.url})`},"data-testid":`g7le-image-thumb-use-${E.id}`}),i.jsx("button",{type:"button",title:n("layout_editor.attachment_manager.delete"),onClick:()=>_(E),style:vN,"data-testid":`g7le-image-thumb-del-${E.id}`,children:"✕"})]},E.id))}):i.jsx("span",{style:{fontSize:11,color:"#94a3b8"},children:n("layout_editor.attachment_manager.empty")})]}),d&&i.jsx("span",{"data-testid":"g7le-image-error",style:{fontSize:11,color:"#dc2626"},children:d})]})}const iN={display:"flex",flexDirection:"column",gap:6},sN={width:"100%",height:80,borderRadius:6,border:"1px solid #cbd5e1"},aN={display:"flex",gap:6},lN={padding:"5px 10px",fontSize:12,border:"1px solid #2563eb",borderRadius:6,background:"#fff",color:"#2563eb",cursor:"pointer",display:"inline-flex",alignItems:"center"},dN={padding:"5px 10px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#64748b",cursor:"pointer"},cN={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6},uN={display:"inline-flex",border:"1px solid #cbd5e1",borderRadius:6,overflow:"hidden"},pN={padding:"4px 10px",fontSize:12,border:"none",borderRight:"1px solid #e2e8f0",cursor:"pointer"},fN={display:"flex",flexDirection:"column",gap:4,border:"1px solid #e2e8f0",borderRadius:6,padding:6,marginTop:2},gN={display:"flex",alignItems:"center",justifyContent:"space-between"},hN={fontSize:11,color:"#2563eb",background:"transparent",border:"none",cursor:"pointer",padding:0},yN={display:"flex",gap:6,flexWrap:"wrap"},bN={position:"relative",width:44,height:44},mN={width:44,height:44,borderRadius:6,border:"1px solid #cbd5e1",backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",padding:0},vN={position:"absolute",top:-6,right:-6,width:16,height:16,borderRadius:"50%",border:"none",background:"#dc2626",color:"#fff",fontSize:9,lineHeight:"16px",cursor:"pointer",padding:0};function _N(e){return Array.isArray(e)&&e.every(t=>t!==null&&typeof t=="object"&&!Array.isArray(t))}function xN(e){return typeof e=="string"&&/\{\{.*\}\}/.test(e)}function wN({value:e,onChange:t,t:n,bindingCandidates:o}){if(xN(e))return i.jsx("div",{className:"g7le-widget g7le-widget--options-list","data-testid":"g7le-widget-options-list-bound",style:TN,children:n("layout_editor.list_editor.bound_degraded")});const r=_N(e)?e:[],s=y=>{t(y.length===0?void 0:y)},a=(y,g)=>{const m=r.map((h,v)=>v===y?{...h,...g}:h);s(m)},l=y=>{s(r.filter((g,m)=>m!==y))},d=(y,g)=>{const m=y+g;if(m<0||m>=r.length)return;const h=[...r];[h[y],h[m]]=[h[m],h[y]],s(h)},c=()=>{s([...r,{value:"",label:""}])},p=y=>typeof y.label=="string"?y.label:y.label==null?"":String(y.label),f=y=>y.value===void 0||y.value===null?"":String(y.value);return i.jsxs("div",{className:"g7le-widget g7le-widget--options-list","data-testid":"g7le-widget-options-list",style:kN,children:[r.length===0&&i.jsx("div",{"data-testid":"g7le-options-empty",style:AN,children:n("layout_editor.list_editor.empty")}),r.map((y,g)=>i.jsxs("div",{"data-testid":`g7le-options-row-${g}`,style:SN,children:[i.jsxs("div",{style:zg,children:[i.jsx("span",{style:Mg,children:n("layout_editor.list_editor.option_value")}),i.jsx("input",{type:"text","data-testid":`g7le-options-value-${g}`,value:f(y),placeholder:n("layout_editor.list_editor.option_value"),onChange:m=>a(g,{value:m.target.value}),style:$N})]}),i.jsxs("div",{style:zg,children:[i.jsx("span",{style:Mg,children:n("layout_editor.list_editor.option_label")}),i.jsx("div",{"data-testid":`g7le-options-label-${g}`,style:{flex:1,minWidth:0},children:i.jsx(vt,{value:p(y),onChange:m=>a(g,{label:m??""}),t:n,placeholder:n("layout_editor.list_editor.option_label"),testidPrefix:`g7le-options-label-i18n-${g}`,candidates:o,enableExpressionTree:!0,expressionTreeCollapsible:!0})})]}),i.jsxs("div",{style:CN,children:[i.jsx("button",{type:"button","data-testid":`g7le-options-up-${g}`,title:n("layout_editor.list_editor.move_up"),disabled:g===0,onClick:()=>d(g,-1),style:Lg,children:"↑"}),i.jsx("button",{type:"button","data-testid":`g7le-options-down-${g}`,title:n("layout_editor.list_editor.move_down"),disabled:g===r.length-1,onClick:()=>d(g,1),style:Lg,children:"↓"}),i.jsx("button",{type:"button","data-testid":`g7le-options-remove-${g}`,title:n("layout_editor.list_editor.remove"),onClick:()=>l(g),style:EN,children:"✕"})]})]},g)),i.jsx("button",{type:"button","data-testid":"g7le-options-add",onClick:c,style:IN,children:n("layout_editor.list_editor.add")})]})}const kN={display:"flex",flexDirection:"column",gap:8,width:"100%"},SN={display:"flex",flexDirection:"column",gap:4,width:"100%",minWidth:0,paddingBottom:6,borderBottom:"1px solid #f1f5f9"},zg={display:"flex",gap:6,alignItems:"center",width:"100%",minWidth:0},Mg={flexShrink:0,width:36,fontSize:11,color:"#94a3b8",textAlign:"right"},CN={display:"flex",gap:4,alignItems:"center",justifyContent:"flex-end"},$N={flex:1,minWidth:0,padding:"4px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6},Lg={padding:"2px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},EN={padding:"2px 6px",fontSize:12,border:"1px solid #fecaca",borderRadius:6,background:"#fff",color:"#dc2626",cursor:"pointer"},IN={padding:"4px 8px",fontSize:12,border:"1px dashed #94a3b8",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer",alignSelf:"flex-start"},AN={fontSize:11,color:"#94a3b8",fontStyle:"italic"},TN={fontSize:11,color:"#b45309",fontStyle:"italic",padding:"4px 2px"},Pg=/[^A-Za-z0-9\-_:.]/g;function DN(e){return typeof e=="string"&&Ui(e)}function Og(e){return Ui(e)?In(e).map(t=>t.kind==="binding"?t.raw:t.raw.replace(Pg,"")).join(""):e.replace(Pg,"")}const NN={width:"100%",padding:"6px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:4,fontFamily:"monospace"},zN={marginTop:4,fontSize:11,color:"#94a3b8"},MN={display:"flex",gap:6,alignItems:"center"},LN={flexShrink:0,padding:"5px 8px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:4,background:"#f8fafc",cursor:"pointer",whiteSpace:"nowrap"};function PN({value:e,onChange:t,t:n,bindingCandidates:o}){const r=e==null?"":String(e),s=DN(e),a=!!o&&o.length>0,[l,d]=u.useState(!1),c=p=>{const f=Og(p);t(f===""?void 0:f)};return s||l?i.jsxs("div",{"data-testid":"g7le-core-id-chip",children:[i.jsx(bs,{value:r,onChange:c,t:n,candidates:o,onDone:()=>d(!1),testidPrefix:"g7le-core-id-chip-input"}),i.jsx("div",{style:zN,children:n("layout_editor.core_props.id.binding_hint")})]}):i.jsx("div",{children:i.jsxs("div",{style:MN,children:[i.jsx("input",{type:"text",className:"g7le-widget g7le-widget--core-id","data-testid":"g7le-widget-core-id",value:r,onChange:p=>{const f=Og(p.target.value);t(f===""?void 0:f)},spellCheck:!1,autoComplete:"off",style:NN}),a&&i.jsxs("button",{type:"button","data-testid":"g7le-core-id-add-data",onClick:()=>d(!0),style:LN,title:n("layout_editor.core_props.id.add_data"),children:["🔗 ",n("layout_editor.core_props.id.add_data")]})]})})}const ON=/[^A-Za-z0-9.\-_]/g;function BN(e){return typeof e=="string"&&/\{\{[\s\S]*?\}\}/.test(e)}function WN(e){return e.replace(ON,"")}const Bg={width:"100%",padding:"6px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:4,fontFamily:"monospace",boxSizing:"border-box"},jN={...Bg,background:"#f1f5f9",color:"#64748b",cursor:"not-allowed"},Wg={marginTop:4,fontSize:11,color:"#94a3b8"};function HN({value:e,onChange:t,t:n}){const o=e==null?"":String(e);return BN(e)?i.jsxs("div",{"data-testid":"g7le-core-datakey-bound",children:[i.jsx("input",{type:"text",className:"g7le-widget g7le-widget--core-datakey-bound","data-testid":"g7le-widget-core-datakey",value:o,readOnly:!0,disabled:!0,style:jN}),i.jsx("div",{style:Wg,children:n("layout_editor.core_props.dataKey.bound_degraded")})]}):i.jsxs("div",{children:[i.jsx("input",{type:"text",className:"g7le-widget g7le-widget--core-datakey","data-testid":"g7le-widget-core-datakey",value:o,placeholder:n("layout_editor.core_props.dataKey.placeholder"),onChange:s=>{const a=WN(s.target.value);t(a===""?void 0:a)},spellCheck:!1,autoComplete:"off",style:Bg}),i.jsx("div",{style:Wg,children:n("layout_editor.core_props.dataKey.hint")})]})}let jg=!1;function FN(){jg||(Xe("segmented",kD),Xe("slider",SD),Xe("select",CD),Xe("dimension",ED),Xe("spacing",TD),Xe("toggle",$D),Xe("color",XD),Xe("image",rN),Xe("tag-input",ys),Xe("page-picker",$w),Xe("datasource-picker",Oc),Xe("binding-picker",Oc),Xe("binding-list",Aw),Xe("state-key-picker",Es),Xe("modal-picker",Ew),Xe("i18n-text",Iw),Xe("text",Tw),Xe("options-list",wN),Xe("core-id",PN),Xe("core-datakey",HN),Xe("component-target-picker",PT),jg=!0)}function Qo(e){return Array.isArray(e.children)?e.children:[]}function Ro(e){if(typeof e.text=="string")return[];let t=null;const n=(o,r)=>{const s=Qo(o);for(let a=0;ad===o?er(l,r,n):l);return{...e,children:a}}function Hg(e,t){const n=r=>typeof r.props?.[t]=="string";if(n(e))return[];const o=(r,s)=>{const a=Qo(r);for(let l=0;lc===r?Fg(d,s,n,o):d);return{...e,children:l}}function KN(e){return Array.isArray(e.children)?e.children:[]}function VN(e){const t=e?.itemFields;if(!Array.isArray(t))return[{kind:"text"}];const n=[];for(const o of t){if(!o||typeof o!="object")continue;const r=o;r.kind==="text"?n.push({kind:"text",label:typeof r.label=="string"?r.label:void 0}):r.kind==="prop"&&typeof r.prop=="string"&&r.prop.length>0&&n.push({kind:"prop",prop:r.prop,label:typeof r.label=="string"?r.label:void 0})}return n.length>0?n:[{kind:"text"}]}function el(e,t){if(!(typeof e!="string"||e.length===0))return e.startsWith("$t:")?t(e.slice(3)):e}function Kg({node:e,params:t,spec:n,manifest:o,t:r,onPatchNode:s,templateIdentifier:a,candidates:l}){const d=typeof t?.childComponent=="string"?t.childComponent:null,c=t?.childTemplate&&typeof t.childTemplate=="object"?t.childTemplate:null,p=VN(t),f=el(typeof t?.childLabel=="string"?t.childLabel:void 0,r)??d??"",y=KN(e),g=u.useCallback(_=>{s({...e,children:_})},[e,s]),m=u.useCallback(()=>{if(c)return JSON.parse(JSON.stringify(c));if(!d)return null;const _=n?.componentPalette?.entries?.[d];if(_?.defaultNode&&typeof _.defaultNode=="object")return JSON.parse(JSON.stringify(_.defaultNode));const S=o?.components??{};let E=null;for(const C of Object.values(S))if(Array.isArray(C)){const N=C.find($=>$.name===d);if(N){E=N;break}}return E?kf(E):{type:"basic",name:d}},[c,d,n,o]),h=u.useCallback(()=>{const _=m();if(_){if(_.text==="")_.text=r("layout_editor.list_editor.new_item");else{const S=Ro(_);if(S!==null&&S.length>0){const E=_i(_,S);if(E&&E.text===""){const C=er(_,S,r("layout_editor.list_editor.new_item"));g([...y,C]);return}}}g([...y,_])}},[m,g,y,r]),v=u.useCallback(_=>{g(y.filter((S,E)=>E!==_))},[g,y]),b=u.useCallback((_,S)=>{const E=_+S;if(E<0||E>=y.length)return;const C=[...y];[C[_],C[E]]=[C[E],C[_]],g(C)},[g,y]),x=u.useCallback((_,S)=>{if(typeof S!="string"||S.length===0)return;const E=y[_];if(!E)return;const C=Ro(E);if(C===null)return;const N=y.map(($,A)=>A===_?er($,C,S):$);g(N)},[y,g]),k=u.useCallback((_,S,E)=>{if(typeof E!="string"||E.length===0)return;const C=y[_];if(!C)return;const N=Hg(C,S);if(N===null)return;const $=y.map((A,z)=>z===_?Fg(A,N,S,E):A);g($)},[y,g]);if(!d&&!c)return i.jsx("div",{className:"g7le-node-editor g7le-node-editor--children","data-testid":"g7le-children-editor-misconfigured",style:qg,children:r("layout_editor.list_editor.no_child_component")});const w=p.length>1||p.some(_=>_.label);return i.jsxs("div",{className:"g7le-node-editor g7le-node-editor--children","data-testid":"g7le-children-editor",style:UN,children:[i.jsx("div",{style:qN,children:r("layout_editor.list_editor.items_title")}),y.length===0&&i.jsx("div",{"data-testid":"g7le-children-empty",style:qg,children:r("layout_editor.list_editor.empty")}),y.map((_,S)=>{const E=[];for(const N of p)if(N.kind==="text"){const $=Ro(_),A=$!==null?_i(_,$):null;A&&typeof A.text=="string"&&E.push({key:"text",caption:el(N.label,r)??(w?r("layout_editor.list_editor.item_label"):void 0),value:A.text,onChange:z=>x(S,z),testid:`g7le-children-i18n-${S}`})}else if(N.kind==="prop"&&N.prop){const $=Hg(_,N.prop);if($!==null){const z=_i(_,$)?.props?.[N.prop];E.push({key:`prop-${N.prop}`,caption:el(N.label,r)??N.prop,value:typeof z=="string"?z:"",onChange:D=>k(S,N.prop,D),testid:`g7le-children-prop-${N.prop}-${S}`})}}const C=typeof _?.name=="string"?_.name:r("layout_editor.list_editor.item");return i.jsxs("div",{"data-testid":`g7le-children-row-${S}`,style:GN,children:[E.length>0?E.map(N=>i.jsx("div",{style:Vg,children:i.jsxs("div",{"data-testid":N.key==="text"?`g7le-children-text-${S}`:`g7le-children-field-${N.key}-${S}`,style:YN,children:[N.caption!==void 0&&i.jsx("div",{"data-testid":`g7le-children-caption-${N.key}-${S}`,style:XN,children:N.caption}),i.jsx(vt,{value:N.value,onChange:N.onChange,t:r,placeholder:r("layout_editor.list_editor.item_text"),testidPrefix:N.testid,candidates:l,enableExpressionTree:!0,expressionTreeCollapsible:!0})]})},N.key)):i.jsx("div",{style:Vg,children:i.jsx("span",{"data-testid":`g7le-children-label-${S}`,style:ZN,children:C})}),i.jsxs("div",{style:JN,children:[i.jsx("button",{type:"button","data-testid":`g7le-children-up-${S}`,title:r("layout_editor.list_editor.move_up"),disabled:S===0,onClick:()=>b(S,-1),style:Ug,children:"↑"}),i.jsx("button",{type:"button","data-testid":`g7le-children-down-${S}`,title:r("layout_editor.list_editor.move_down"),disabled:S===y.length-1,onClick:()=>b(S,1),style:Ug,children:"↓"}),i.jsx("button",{type:"button","data-testid":`g7le-children-remove-${S}`,title:r("layout_editor.list_editor.remove"),onClick:()=>v(S),style:QN,children:"✕"})]})]},S)}),i.jsx("button",{type:"button","data-testid":"g7le-children-add",onClick:h,style:RN,children:r("layout_editor.list_editor.add_child",{component:f})})]})}const UN={display:"flex",flexDirection:"column",gap:6,width:"100%",marginBottom:12},qN={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:2},GN={display:"flex",flexDirection:"column",gap:4,width:"100%",minWidth:0,paddingBottom:6,borderBottom:"1px solid #f1f5f9"},Vg={display:"flex",gap:4,alignItems:"flex-start",width:"100%",minWidth:0},YN={flex:1,minWidth:0},XN={fontSize:11,color:"#64748b",marginBottom:2},JN={display:"flex",gap:4,alignItems:"center",justifyContent:"flex-end"},ZN={flex:1,minWidth:0,padding:"4px 6px",fontSize:12,color:"#475569",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ug={padding:"2px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},QN={padding:"2px 6px",fontSize:12,border:"1px solid #fecaca",borderRadius:6,background:"#fff",color:"#dc2626",cursor:"pointer"},RN={padding:"4px 8px",fontSize:12,border:"1px dashed #94a3b8",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer",alignSelf:"flex-start"},qg={fontSize:11,color:"#94a3b8",fontStyle:"italic"},fo={rowContainer:"Tbody",row:"Tr",cell:"Td",headerCell:"Th",colSpanProp:"colSpan",rowSpanProp:"rowSpan"};function ht(e){return{rowContainer:e?.rowContainer??fo.rowContainer,row:e?.row??fo.row,cell:e?.cell??fo.cell,headerCell:e?.headerCell??fo.headerCell,colSpanProp:e?.colSpanProp??fo.colSpanProp,rowSpanProp:e?.rowSpanProp??fo.rowSpanProp}}function Bn(e){return e?Array.isArray(e.children)?e.children:[]:[]}function Gg(e,t){const n=e.props?.[t],o=typeof n=="number"?n:typeof n=="string"?parseInt(n,10):NaN;return Number.isFinite(o)&&o>=1?Math.floor(o):1}function Be(e,t){const n=ht(t),o=[],r=Bn(e),s=[];r.forEach((f,y)=>{(Bn(f).some(h=>h.name===n.row)||f.name===n.rowContainer||f.name==="Thead"||f.name==="Tfoot")&&s.push({container:f,containerIndex:y,isHeader:f.name==="Thead"})}),s.length===0&&r.some(f=>f.name===n.row)&&s.push({container:e,containerIndex:-1,isHeader:!1});const a=[],l=[];let d=0,c=0;const p=f=>{for(;a.length<=f;)a.push([]);return a[f]};s.forEach((f,y)=>{Bn(f.container).filter(m=>m.name===n.row).forEach((m,h)=>{const v=[],b=p(d);let x=0;Bn(m).filter(w=>w.name===n.cell||w.name===n.headerCell).forEach((w,_)=>{for(;b[x];)x++;const S=Gg(w,n.colSpanProp),E=Gg(w,n.rowSpanProp),C={cell:w,sectionIndex:y,rowIndexInSection:h,cellIndexInRow:_,gridRow:d,gridCol:x,colSpan:S,rowSpan:E,isHeader:w.name===n.headerCell};v.push(C);for(let N=0;N=0?(a.push(s.containerIndex),l=Bn(e)[s.containerIndex]??e):l=e;let d=-1,c=-1,p=null;const f=Bn(l);for(let m=0;m=r.gridRow&&t=r.gridCol&&nr){s=!0;break}if(s)break}s||t.add(r)}const n=Array.from(t).sort((r,s)=>r-s),o=[];for(let r=0;re.rows.find(l=>(l.cells[0]?.gridRow??-1)===a)?.sectionIndex??e.rows[a]?.sectionIndex??0,o=new Set([0,t]);for(let a=1;aa){l=!0;break}if(l)break}l||o.add(a)}const r=Array.from(o).sort((a,l)=>a-l),s=[];for(let a=0;at>=a.start&&t=o.length?{ok:!1,reason:"boundary"}:o[r].sectionIndex!==o[s].sectionIndex?{ok:!1,reason:"section"}:{ok:!0}}function wi(e,t,n){const o=Yg(e),r=o.findIndex(a=>t>=a.start&&t=o.length?{ok:!1,reason:"boundary"}:{ok:!0}}function Ge(e){return e?Array.isArray(e.children)?e.children:[]:[]}function mn(e,t,n){const o={...e.props??{}};n<=1?delete o[t]:o[t]=n;const r={...e,props:o};return Object.keys(o).length===0&&delete r.props,r}function ki(e,t,n=!1){const o={type:"basic",name:n?e.headerCell:e.cell},r=t?.props?.className;return typeof r=="string"&&r&&(o.props={className:r}),o.text="",o}function tr(e,t){return e.name===t.cell||e.name===t.headerCell}function nt(e,t,n,o){const r=t.sections[n];if(!r)return e;if(r.containerIndex===-1)return o(e);const s=Ge(e).map((a,l)=>l===r.containerIndex?o(a):a);return{...e,children:s}}function yt(e,t,n,o){let r=-1;const s=Ge(e).map(a=>a.name===t&&(r++,r===n)?o(a):a);return{...e,children:s}}function Si(e,t,n){let o=-1;const r=Ge(e);for(let s=0;s0?nt(e,r,r.sections.length-1,x=>({...x,children:[...Ge(x),b]})):{...e,children:[...Ge(e),b]}}const s=Math.max(-1,Math.min(n,r.rows.length-1)),a=s<0?r.rows[0]:r.rows[s],l=a.cells[0]?.gridRow??s,d=s<0?0:l+1,c=a.sectionIndex,p=s<0?0:a.rowIndexInSection+1,f=[],y=[];let g=0;for(;g0?Ue(r,d-1,g):null;b&&b.gridRow+b.rowSpan>d&&b.rowSpan>1?(y.push(b),g+=b.colSpan):(f.push(ki(o)),g+=1)}let m=e;for(const b of y)m=nt(m,r,b.sectionIndex,x=>yt(x,o.row,b.rowIndexInSection,k=>({...k,children:Ge(k).map((w,_)=>_===b.cellIndexInRow?mn(w,o.rowSpanProp,b.rowSpan+1):w)})));const h={type:"basic",name:o.row,children:f},v=Be(m,t);return m=nt(m,v,c,b=>{const x=Ge(b);let k=0,w=x.length;for(let _=0;_=r.rows.length||r.rows.length<=1)return e;const s=r.rows[n],a=s.cells[0]?.gridRow??n;let l=e;const d=new Set;for(let p=0;pyt(y,o.row,f.rowIndexInSection,g=>({...g,children:Ge(g).map((m,h)=>h===f.cellIndexInRow?mn(m,o.rowSpanProp,f.rowSpan-1):m)})))),p+=f?f.colSpan:1}const c=Be(l,t);return l=nt(l,c,s.sectionIndex,p=>{let f=-1;const y=Ge(p).filter(g=>g.name===o.row?(f++,f!==s.rowIndexInSection):!0);return{...p,children:y}}),l}function Zg(e,t,n,o){const r=ht(t),s=Be(e,t);if(!xi(s,n,o).ok)return e;const a=Xg(s),l=a.findIndex(h=>n>=h.start&&ns.rows.filter(v=>{const b=v.cells[0]?.gridRow??-1;return v.sectionIndex===f&&b>=h.start&&bv.rowIndexInSection),g=y(c),m=y(p);return g.length===0||m.length===0?e:nt(e,s,f,h=>{const v=[...Ge(h)],b=[];v.forEach((M,B)=>{M.name===r.row&&b.push(B)});const x=g.map(M=>b[M]).filter(M=>M!==void 0),k=m.map(M=>b[M]).filter(M=>M!==void 0);if(x.length===0||k.length===0)return h;const w=x.map(M=>v[M]),_=k.map(M=>v[M]),S=Math.min(...x)n>=m.start&&nw.gridCol>=f.start&&w.gridColw.gridCol>=y.start&&w.gridColw.cellIndexInRow),x=v.map(w=>w.cellIndexInRow),k=Be(g,t);g=nt(g,k,m.sectionIndex,w=>yt(w,r.row,m.rowIndexInSection,_=>{const S=[...Ge(_)],E=b.map(M=>Si(_,r,M)).filter(M=>M>=0),C=x.map(M=>Si(_,r,M)).filter(M=>M>=0);if(E.length===0||C.length===0)return _;const N=E.map(M=>S[M]),$=C.map(M=>S[M]),A=Math.min(...E,...C),z=Math.max(...E,...C),D=[...$,...N],O=[...S.slice(0,A),...D,...S.slice(z+1)];return{..._,children:O}}))}return g}function Rg(e,t,n){const o=ht(t),r=Be(e,t);if(r.rows.length===0||r.colCount===0)return nl(e,t,-1);const s=Math.max(0,Math.min(n+1,r.colCount));let a=e;const l=new Set;for(const d of r.rows){const c=d.cells[0]?.gridRow??0,p=s>0?Ue(r,c,s-1):null,f=s1){if(!l.has(p.cell)){l.add(p.cell);const h=Be(a,t);a=nt(a,h,p.sectionIndex,v=>yt(v,o.row,p.rowIndexInSection,b=>({...b,children:Ge(b).map((x,k)=>k===p.cellIndexInRow?mn(x,o.colSpanProp,p.colSpan+1):x)})))}continue}if(p&&p.gridRow0&&d.cells.every(h=>h.isHeader),m=Be(a,t);a=nt(a,m,d.sectionIndex,h=>yt(h,o.row,d.rowIndexInSection,v=>{const b=[...Ge(v)];let x;if(y<0)x=b.findIndex(k=>tr(k,o)),x<0&&(x=b.length);else{const k=Si(v,o,y);x=k<0?b.length:k+1}return b.splice(x,0,ki(o,void 0,g)),{...v,children:b}}))}return a}function eh(e,t,n){const o=ht(t),r=Be(e,t);if(n<0||n>=r.colCount||r.colCount<=1)return e;let s=e;const a=new Set;for(const l of r.rows){const d=l.cells[0]?.gridRow??0,c=Ue(r,d,n);if(!(!c||a.has(c.cell)||c.gridRow1){const p=Be(s,t);s=nt(s,p,c.sectionIndex,f=>yt(f,o.row,c.rowIndexInSection,y=>({...y,children:Ge(y).map((g,m)=>m===c.cellIndexInRow?mn(g,o.colSpanProp,c.colSpan-1):g)})))}else{const p=Be(s,t);s=nt(s,p,c.sectionIndex,f=>yt(f,o.row,c.rowIndexInSection,y=>{let g=-1;const m=Ge(y).filter(h=>tr(h,o)?(g++,g!==c.cellIndexInRow):!0);return{...y,children:m}}))}}return s}function ol(e,t,n,o,r,s){const a=ht(t),l=Be(e,t),d=Math.min(n,r),c=Math.max(n,r),p=Math.min(o,s),f=Math.max(o,s);if(d===c&&p===f)return{table:e,ok:!1,reason:"single"};if(!l.valid)return{table:e,ok:!1,reason:"invalid-grid"};const y=new Set;for(let b=d;b<=c;b++)for(let x=p;x<=f;x++){const k=Ue(l,b,x);if(!k)return{table:e,ok:!1,reason:"hole"};if(k.gridRowc||k.gridCol+k.colSpan-1>f)return{table:e,ok:!1,reason:"not-rectangular"};y.add(k)}const g=Ue(l,d,p),m=Array.from(y).filter(b=>b!==g);let h=nt(e,l,g.sectionIndex,b=>yt(b,a.row,g.rowIndexInSection,x=>({...x,children:Ge(x).map((k,w)=>{if(w!==g.cellIndexInRow)return k;let _=mn(k,a.colSpanProp,f-p+1);return _=mn(_,a.rowSpanProp,c-d+1),_})})));const v=new Map;for(const b of m){const x=`${b.sectionIndex}:${b.rowIndexInSection}`,k=v.get(x)??[];k.push(b),v.set(x,k)}for(const[b,x]of v){const k=parseInt(b.split(":")[0],10),w=x[0].rowIndexInSection,_=new Set(x.map(E=>E.cellIndexInRow)),S=Be(h,t);h=nt(h,S,k,E=>yt(E,a.row,w,C=>{let N=-1;const $=Ge(C).filter(A=>tr(A,a)?(N++,!_.has(N)):!0);return{...C,children:$}}))}return{table:h,ok:!0}}function th(e,t,n,o){const r=ht(t),s=Be(e,t),a=Ue(s,n,o);if(!a||a.colSpan<=1&&a.rowSpan<=1)return e;const l=a.gridRow,d=a.gridCol,c=a.gridRow+a.rowSpan-1,p=a.gridCol+a.colSpan-1,f=a.isHeader,y=typeof a.cell.props?.className=="string"?a.cell.props.className:void 0;let g=nt(e,s,a.sectionIndex,m=>yt(m,r.row,a.rowIndexInSection,h=>({...h,children:Ge(h).map((v,b)=>{if(b!==a.cellIndexInRow)return v;let x=mn(v,r.colSpanProp,1);return x=mn(x,r.rowSpanProp,1),x})})));for(let m=l;m<=c;m++)for(let h=d;h<=p;h++){if(m===l&&h===d)continue;const v=Be(g,t),b=v.rows.find(w=>w.cells.some(_=>_.gridRow===m))??v.rows[m];if(!b)continue;let x=-1;for(const w of b.cells)w.gridRow===m&&w.gridColyt(w,r.row,b.rowIndexInSection,_=>{const S=[...Ge(_)];let E;if(x<0)E=S.findIndex(C=>tr(C,r)),E<0&&(E=S.length);else{const C=Si(_,r,x);E=C<0?S.length:C+1}return S.splice(E,0,ki(r,k,f)),{..._,children:S}}))}return g}function Ci(e,t,n,o,r){const s=ht(t),a=Be(e,t),l=Ue(a,n,o);return l?nt(e,a,l.sectionIndex,d=>yt(d,s.row,l.rowIndexInSection,c=>({...c,children:Ge(c).map((p,f)=>{if(f!==l.cellIndexInRow)return p;const y={...p.props??{}};r.trim()===""?delete y.className:y.className=r;const g={...p,props:y};return Object.keys(y).length===0&&delete g.props,g})}))):e}function Jt(e,t,n,o,r,s){const a=ht(t),l=Be(e,t),d=Ue(l,n,o);return d?nt(e,l,d.sectionIndex,c=>yt(c,a.row,d.rowIndexInSection,p=>({...p,children:Ge(p).map((f,y)=>{if(y!==d.cellIndexInRow)return f;const g={...f.props??{}},m={...g.style??{}};!s||s.trim()===""?delete m[r]:m[r]=s,Object.keys(m).length===0?delete g.style:g.style=m;const h={...f,props:g};return Object.keys(g).length===0&&delete h.props,h})}))):e}function go(e,t,n,o,r,s,a){const l=ht(t),d=Be(e,t),c=Ue(d,n,o);if(!c)return e;const p=a==="dark";return nt(e,d,c.sectionIndex,f=>yt(f,l.row,c.rowIndexInSection,y=>({...y,children:Ge(y).map((g,m)=>{if(m!==c.cellIndexInRow)return g;const h={...g.props??{}},v=typeof h.className=="string"?h.className:"",b=lC(v,s,r,p);b===""?delete h.className:h.className=b;const x={...g,props:h};return Object.keys(h).length===0&&delete x.props,x})})))}function nh(e,t,n,o,r){const s=ht(t),a=Be(e,t),l=Ue(a,n,o);return l?nt(e,a,l.sectionIndex,d=>yt(d,s.row,l.rowIndexInSection,c=>({...c,children:Ge(c).map((p,f)=>f===l.cellIndexInRow?{...p,text:r}:p)}))):e}function oh(e,t,n,o,r){const s=ht(t),a=Be(e,t),l=Ue(a,n,o);return l?nt(e,a,l.sectionIndex,d=>yt(d,s.row,l.rowIndexInSection,c=>({...c,children:Ge(c).map((p,f)=>f===l.cellIndexInRow?r:p)}))):e}const rh=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function e8(e){return e.split(/\s+/).filter(Boolean)}function ih(e,t){for(const n of t)if(e===n||/^-?\d+$/.test(e.slice(n.length+1))&&e.startsWith(n+"-"))return!0;return!1}function sh({className:e,catalog:t,t:n,onChange:o,colorScheme:r="light",onPresetToken:s,colorStyle:a,onColorStyle:l,disabled:d}){const c=t?.sides??[],p=t?.widths??[],f=t?.colors??[],y=r==="dark",g=u.useMemo(()=>c.map($=>$.prefix),[c]),m=u.useMemo(()=>new Set(f.map($=>$.token)),[f]),h=u.useMemo(()=>e8(e),[e]),v=u.useMemo(()=>Vr(e,y),[e,y]),b=u.useMemo(()=>v.find($=>m.has($))??null,[v,m]),x=u.useMemo(()=>{const $=new Set;for(const A of c)h.some(D=>D===A.prefix||D.startsWith(A.prefix+"-")&&/^-?\d+$/.test(D.slice(A.prefix.length+1)))&&$.add(A.value);return $},[h,c]),k=u.useMemo(()=>{const $=h.find(z=>ih(z,g));if(!$)return"none";const A=p.filter(z=>z.value!=="none");for(const z of c){if($===z.prefix)return A.find(D=>(D.suffix??"")==="")?.value??"thin";if($.startsWith(z.prefix+"-")){const D=$.slice(z.prefix.length),O=A.find(M=>(M.suffix??"")===D);if(O)return O.value}}return"thin"},[h,g,c,p]);if(!t||c.length===0||p.length===0)return null;function w($){return $.filter(A=>!ih(A,g))}function _($,A){const z=w(h),D=p.find(B=>B.value===A);if(!D||A==="none"||$.size===0)return z.join(" ").trim();const O=D.suffix??"",M=[...z];for(const B of c)$.has(B.value)&&M.push(O?`${B.prefix}${O}`:B.prefix);return M.join(" ").trim()}const S=$=>{const A=new Set(x);A.has($)?A.delete($):($==="all"?A.clear():A.delete("all"),A.add($));const z=k==="none"?p.find(D=>D.value!=="none")?.value??"thin":k;o(_(A,z))},E=$=>{const A=x.size===0?new Set(["all"]):x;o(_(A,$))},C=$=>{s?.($)},N=($,A)=>$&&$.startsWith("$t:")?n($.slice(3)):$||A;return i.jsxs("div",{className:"g7le-cell-border","data-testid":"g7le-cell-border",style:t8,children:[i.jsx("div",{style:n8,children:i.jsx("span",{style:o8,children:n("layout_editor.table_editor.cell_border")})}),i.jsx("div",{style:rl,"data-testid":"g7le-cell-border-widths",children:p.map($=>i.jsx("button",{type:"button",disabled:d,"data-testid":`g7le-cell-border-width-${$.value}`,"aria-pressed":k===$.value,onClick:()=>E($.value),style:k===$.value?ah:il,children:N($.label,$.value)},$.value))}),k!=="none"&&i.jsx("div",{style:rl,"data-testid":"g7le-cell-border-sides",children:c.map($=>i.jsx("button",{type:"button",disabled:d,"data-testid":`g7le-cell-border-side-${$.value}`,"aria-pressed":x.has($.value),onClick:()=>S($.value),style:x.has($.value)?ah:il,children:N($.label,$.value)},$.value))}),k!=="none"&&(f.length>0||l)&&i.jsx(i.Fragment,{children:i.jsxs("div",{style:rl,"data-testid":"g7le-cell-border-colors",children:[f.map($=>{const A=b===$.token;return i.jsx("button",{type:"button",disabled:d,title:N($.label,$.value),"data-testid":`g7le-cell-border-color-${$.value}`,"aria-pressed":A,onClick:()=>C($.token),style:{...lh,background:$.swatch??"#fff",outline:A?"2px solid #2563eb":"1px solid #cbd5e1"}},$.value)}),l&&(()=>{const $=!!a&&f.some(z=>z.swatch&&z.swatch.toLowerCase()===a.toLowerCase()),A=!y&&!!a&&!$;return i.jsx("label",{title:n(y?"layout_editor.table_editor.dark_free_color_hint":"layout_editor.table_inplace.custom_color"),"data-testid":"g7le-cell-border-color-custom",style:{...lh,position:"relative",overflow:"hidden",display:"inline-flex",alignItems:"center",justifyContent:"center",background:A&&rh.test(a)?a:"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)",outline:A?"2px solid #2563eb":"1px solid #cbd5e1",opacity:y?.4:1,cursor:y?"not-allowed":"pointer"},children:i.jsx("input",{type:"color",disabled:d||y,"data-testid":"g7le-cell-border-color-picker",value:a&&rh.test(a)?a:"#000000",onChange:z=>l(z.target.value),style:{position:"absolute",width:0,height:0,opacity:0}})})})()]})})]})}const t8={display:"flex",flexDirection:"column",gap:6},n8={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},o8={fontSize:12,fontWeight:600,color:"#475569"},rl={display:"flex",gap:4,flexWrap:"wrap",alignItems:"center"},il={padding:"3px 8px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},ah={...il,border:"1px solid #2563eb",background:"#eff6ff",color:"#1d4ed8",fontWeight:600},lh={width:22,height:22,borderRadius:5,padding:0,cursor:"pointer",boxSizing:"border-box"},dh=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function ch({colorStyle:e,className:t,catalog:n,t:o,colorScheme:r="light",onPresetToken:s,onCustomColor:a,onClear:l,disabled:d}){const c=n?.colors??[],p=r==="dark",f=e??"",y=Vr(t??"",p),g=c.find(x=>x.token&&y.includes(x.token))?.token??null,m=(x,k)=>x&&x.startsWith("$t:")?o(x.slice(3)):x||k,h=!g&&(p||f.trim()===""),v=!!f&&c.some(x=>x.swatch&&x.swatch.toLowerCase()===f.toLowerCase()),b=!p&&!!f&&!v;return i.jsxs("div",{className:"g7le-cell-fill","data-testid":"g7le-cell-fill",style:r8,children:[i.jsx("div",{style:i8,children:i.jsx("span",{style:s8,children:o("layout_editor.table_editor.cell_fill")})}),i.jsxs("div",{style:a8,"data-testid":"g7le-cell-fill-colors",children:[i.jsx("button",{type:"button",disabled:d,title:o("layout_editor.table_editor.cell_fill_none"),"data-testid":"g7le-cell-fill-none","aria-pressed":h,onClick:()=>l?.(),style:{...sl,background:"repeating-conic-gradient(#e2e8f0 0% 25%, #ffffff 0% 50%) 50% / 10px 10px",outline:h?"2px solid #2563eb":"1px solid #cbd5e1"}}),c.map(x=>{const k=!!x.token&&g===x.token,w=!p&&!!x.swatch&&f.toLowerCase()===(x.swatch??"").toLowerCase(),_=k||w,S=d||p&&!x.token;return i.jsx("button",{type:"button",disabled:S,title:m(x.label,x.value),"data-testid":`g7le-cell-fill-color-${x.value}`,"aria-pressed":_,onClick:()=>{x.token&&s?s(x.token):!p&&x.swatch&&a&&a(x.swatch)},style:{...sl,background:x.swatch??"#fff",outline:_?"2px solid #2563eb":"1px solid #cbd5e1",opacity:S?.4:1,cursor:S?"not-allowed":"pointer"}},x.value)}),a&&i.jsx("label",{title:o(p?"layout_editor.table_editor.dark_free_color_hint":"layout_editor.table_editor.cell_fill_custom"),"data-testid":"g7le-cell-fill-custom",style:{...sl,position:"relative",overflow:"hidden",display:"inline-flex",alignItems:"center",justifyContent:"center",background:b&&dh.test(f)?f:"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)",outline:b?"2px solid #2563eb":"1px solid #cbd5e1",opacity:p?.4:1,cursor:p?"not-allowed":"pointer"},children:i.jsx("input",{type:"color",disabled:d||p,"data-testid":"g7le-cell-fill-color-picker",value:f&&dh.test(f)?f:"#ffffff",onChange:x=>a(x.target.value),style:{position:"absolute",width:0,height:0,opacity:0}})})]})]})}const r8={display:"flex",flexDirection:"column",gap:6},i8={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},s8={fontSize:12,fontWeight:600,color:"#475569"},a8={display:"flex",gap:4,flexWrap:"wrap",alignItems:"center"},sl={width:22,height:22,borderRadius:5,padding:0,cursor:"pointer",boxSizing:"border-box"};function l8(e){const t=/^(\d+)px$/.exec(e.trim());return t?parseInt(t[1],10):null}function uh({paddingStyle:e,catalog:t,t:n,onChange:o,disabled:r}){const s=t?.steps??[],a=e??"",l=l8(a),d=(h,v)=>h&&h.startsWith("$t:")?n(h.slice(3)):h||v,c=s.some(h=>(h.px??0)===(l??-1)),p=l!==null&&!c?String(l):"",[f,y]=u.useState(p);u.useEffect(()=>{y(p)},[e]);const g=h=>{o(h&&h>0?`${h}px`:""),y("")},m=h=>{const v=parseInt(h,10);Number.isFinite(v)&&v>=0&&o(v>0?`${v}px`:"")};return i.jsxs("div",{className:"g7le-cell-padding","data-testid":"g7le-cell-padding",style:d8,children:[i.jsx("div",{style:c8,children:n("layout_editor.table_editor.cell_padding")}),i.jsxs("div",{style:u8,"data-testid":"g7le-cell-padding-steps",children:[s.map(h=>{const v=(h.px??0)===(l??-1)||!h.px&&a.trim()==="";return i.jsx("button",{type:"button",disabled:r,"data-testid":`g7le-cell-padding-step-${h.value}`,"aria-pressed":v,onClick:()=>g(h.px),style:v?p8:ph,children:d(h.label,h.value)},h.value)}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[i.jsx("input",{type:"number",min:0,disabled:r,"data-testid":"g7le-cell-padding-free",value:f,placeholder:n("layout_editor.table_editor.cell_padding_custom"),onChange:h=>y(h.target.value),onBlur:()=>f.trim()!==""&&m(f),onKeyDown:h=>{h.key==="Enter"&&f.trim()!==""&&m(f)},style:f8}),i.jsx("span",{style:{fontSize:11,color:"#94a3b8"},children:"px"})]})]})]})}const d8={display:"flex",flexDirection:"column",gap:6},c8={fontSize:12,fontWeight:600,color:"#475569"},u8={display:"flex",gap:4,flexWrap:"wrap",alignItems:"center"},ph={padding:"3px 8px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},p8={...ph,border:"1px solid #2563eb",background:"#eff6ff",color:"#1d4ed8",fontWeight:600},f8={width:48,padding:"3px 5px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,boxSizing:"border-box"};function fh({colorScheme:e,onChange:t,t:n,disabled:o}){const r=e==="dark";return i.jsxs("div",{className:"g7le-color-scheme-tabs","data-testid":"g7le-color-scheme-tabs",style:g8,children:[i.jsxs("div",{style:h8,children:[i.jsx("span",{style:y8,children:n("layout_editor.table_editor.cell_color")}),i.jsxs("div",{style:b8,children:[i.jsx("button",{type:"button",disabled:o,"data-testid":"g7le-color-scheme-light","aria-pressed":!r,onClick:()=>t("light"),style:r?al:gh,children:n("layout_editor.property_modal.scope.scheme_light")}),i.jsx("button",{type:"button",disabled:o,"data-testid":"g7le-color-scheme-dark","aria-pressed":r,onClick:()=>t("dark"),style:r?gh:al,children:n("layout_editor.property_modal.scope.scheme_dark")})]})]}),r&&i.jsx("div",{style:m8,"data-testid":"g7le-color-scheme-dark-hint",children:n("layout_editor.table_editor.dark_free_color_hint")})]})}const g8={display:"flex",flexDirection:"column",gap:3},h8={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},y8={fontSize:12,fontWeight:700,color:"#0f172a"},b8={display:"flex",gap:2},al={padding:"2px 9px",fontSize:11,border:"none",borderBottom:"2px solid transparent",background:"transparent",color:"#94a3b8",cursor:"pointer"},gh={...al,color:"#1d4ed8",borderBottom:"2px solid #2563eb",fontWeight:600},m8={fontSize:10,color:"#94a3b8",fontStyle:"italic"},ll="dark:";function hh(e){return typeof e=="string"?e.split(/\s+/).filter(Boolean):[]}function yh(e,t){return t==="dark"?e.filter(n=>n.startsWith(ll)).map(n=>n.slice(ll.length)):e.filter(n=>!n.startsWith(ll))}const v8={none:0,thin:1,medium:2,thick:4},bh={top:{w:"borderTopWidth",s:"borderTopStyle",c:"borderTopColor"},bottom:{w:"borderBottomWidth",s:"borderBottomStyle",c:"borderBottomColor"},left:{w:"borderLeftWidth",s:"borderLeftStyle",c:"borderLeftColor"},right:{w:"borderRightWidth",s:"borderRightStyle",c:"borderRightColor"}},mh=["top","bottom","left","right"];function _8(e,t,n="light"){if(!e||!t)return{};const o=t.sides??[],r=t.widths??[],s=t.colors??[],a=hh(e.props?.className);if(a.length===0&&!e.props?.style)return{};const l=[...r].filter(b=>b.value!=="none").sort((b,x)=>(x.suffix??"").length-(b.suffix??"").length),d={};for(const b of o)for(const x of l){const k=x.suffix?`${b.prefix}${x.suffix}`:b.prefix;if(a.includes(k)){d[b.value]=x.value;break}}const c=e.props?.style??{},p=yh(a,n),f=s.find(b=>p.includes(b.token))?.swatch??"",g=(n==="light"&&typeof c.borderColor=="string"?c.borderColor:"")||f||"#94a3b8",m=b=>{const x=bh[b]?.c,k=x?c[x]:void 0;return typeof k=="string"&&k?k:g},h={},v=(b,x)=>{const k=bh[b];if(!k)return;const w=v8[x]??1;h[k.w]=`${w}px`,h[k.s]=w>0?"solid":"none",w>0&&(h[k.c]=m(b))};if(d.all)for(const b of mh)v(b,d.all);for(const b of mh)d[b]&&v(b,d[b]);return h}function x8(e,t,n="light"){if(!e?.props)return{};const o=e.props.style??{},r={},s=hh(e.props.className),a=t?.colors?.find(c=>c.token&&yh(s,n).includes(c.token))?.swatch??"",d=(n==="light"&&typeof o.backgroundColor=="string"?o.backgroundColor:"")||a;return d&&(r.backgroundColor=d),typeof o.padding=="string"&&o.padding&&(r.padding=o.padding),r}const w8=/^\s*\$t:(custom\.[a-zA-Z0-9._-]+)\s*$/,k8=/^\s*\$t:([a-zA-Z0-9._-]+)\s*$/,S8=/\{\{.*?\}\}/;function vh(e,t,n){const o=e?.text;if(typeof o!="string")return{display:"",editable:!1,isKey:!1};const r=mt(o);if(r&&r.key.startsWith("custom.")){let a="";try{const l=Pt.getInstance().translate(r.key,{templateId:t,locale:n});a=l&&l!==r.key?l:""}catch{a=""}return{display:a,editable:!0,isKey:!0}}if(S8.test(o))return{display:o,editable:!1,isKey:!1};const s=k8.exec(o);if(s){const a=s[1];let l="";try{const d=Pt.getInstance().translate(a,{templateId:t,locale:n});l=d&&d!==a?d:""}catch{l=""}return{display:l,editable:!0,isKey:!0}}return{display:o,editable:!0,isKey:!1}}function dl(e){const t=Ro(e);return t===null?{node:null,path:null}:{node:_i(e,t),path:t}}function C8(e){if(!e||typeof e.text!="string")return null;const t=w8.exec(e.text);if(t)return t[1];const n=mt(e.text);return n&&n.key.startsWith("custom.")?n.key:null}function $8({node:e,params:t,t:n,onPatchNode:o,templateIdentifier:r,candidates:s}){const{state:a}=Je(),l=a.selectedRoute?.layoutName??null,d=a.locale,c=r??a.templateIdentifier,p=u.useMemo(()=>t&&typeof t=="object"?t:null,[t]);u.useMemo(()=>ht(p),[p]);const f=u.useMemo(()=>Be(e,p),[e,p]),y=u.useMemo(()=>{const q=p?.cellBorder;return q&&typeof q=="object"?q:null},[p]),g=u.useMemo(()=>{const q=p?.cellBackground;return q&&typeof q=="object"?q:null},[p]),m=u.useMemo(()=>{const q=p?.cellPadding;return q&&typeof q=="object"?q:null},[p]),[h,v]=u.useState(null),[b,x]=u.useState(null),[k,w]=u.useState({}),[_,S]=u.useState(!1),[E,C]=u.useState(null),[N,$]=u.useState(null),[A,z]=u.useState("light"),D=u.useCallback(q=>o(q),[o]),O=u.useMemo(()=>h?Ue(f,h.r,h.c):null,[f,h]),M=N!==null?N:h?.c??null,B=E!==null?E:h?.r??null,T=u.useMemo(()=>{const q=(y?.sides??[]).find($e=>$e.value==="all")??(y?.sides??[])[0],ae=(y?.widths??[]).find($e=>$e.value!=="none");if(!q||!ae)return[];const pe=ae.suffix??"";return[pe?`${q.prefix}${pe}`:q.prefix]},[y]),H=u.useCallback((q,ae,pe)=>{if(T.length===0)return q;const $e=(y?.sides??[]).map(J=>J.prefix),be=Ue(Be(q,p),ae,pe),oe=(typeof be?.cell?.props?.className=="string"?be.cell.props.className:"").split(/\s+/).filter(Boolean);return oe.some(J=>$e.some(le=>J===le||J.startsWith(le+"-")&&/^-?\d+$/.test(J.slice(le.length+1))))?q:Ci(q,p,ae,pe,[...oe,...T].join(" ").trim())},[T,y,p]),L=u.useCallback(q=>{if(!h)return;const ae=Math.min(h.r,b?.r??h.r),pe=Math.max(h.r,b?.r??h.r),$e=Math.min(h.c,b?.c??h.c),be=Math.max(h.c,b?.c??h.c),j=new Set,oe=[];for(let J=ae;J<=pe;J++)for(let le=$e;le<=be;le++)j.add(`${J}:${le}`),oe.push({r:J,c:le});let ue=e;for(const J of oe){if(ue=H(ue,J.r,J.c),ue=Jt(ue,p,J.r,J.c,"borderColor",q),J.r>0&&!j.has(`${J.r-1}:${J.c}`)){const le=Ue(Be(ue,p),J.r-1,J.c);le&&(ue=Jt(ue,p,le.gridRow,le.gridCol,"borderBottomColor",q))}if(J.c>0&&!j.has(`${J.r}:${J.c-1}`)){const le=Ue(Be(ue,p),J.r,J.c-1);le&&(ue=Jt(ue,p,le.gridRow,le.gridCol,"borderRightColor",q))}}D(ue)},[h,b,e,p,D,H]),I=u.useCallback(q=>L(q),[L]),P=u.useMemo(()=>(y?.colors??[]).map(q=>q.token).filter(Boolean),[y]),F=u.useCallback(q=>{if(!h||P.length===0)return;const ae=Math.min(h.r,b?.r??h.r),pe=Math.max(h.r,b?.r??h.r),$e=Math.min(h.c,b?.c??h.c),be=Math.max(h.c,b?.c??h.c);let j=e;for(let oe=ae;oe<=pe;oe++)for(let ue=$e;ue<=be;ue++)j=H(j,oe,ue),j=go(j,p,oe,ue,q,P,A);D(j)},[h,b,e,p,D,H,P,A]),G=u.useMemo(()=>{if(A==="dark")return"";const q=O?.cell.props?.style;return typeof q?.borderColor=="string"?q.borderColor:""},[O,A]),V=u.useCallback((q,ae)=>{if(!h)return;const pe=Math.min(h.r,b?.r??h.r),$e=Math.max(h.r,b?.r??h.r),be=Math.min(h.c,b?.c??h.c),j=Math.max(h.c,b?.c??h.c);let oe=e;for(let ue=pe;ue<=$e;ue++)for(let J=be;J<=j;J++)oe=Jt(oe,p,ue,J,q,ae);D(oe)},[h,b,e,p,D]),Y=u.useMemo(()=>(g?.colors??[]).map(q=>q.token).filter(q=>!!q),[g]),Z=u.useCallback(()=>h?{r0:Math.min(h.r,b?.r??h.r),r1:Math.max(h.r,b?.r??h.r),c0:Math.min(h.c,b?.c??h.c),c1:Math.max(h.c,b?.c??h.c)}:null,[h,b]),se=u.useCallback(q=>{const ae=Z();if(!ae||Y.length===0)return;let pe=e;for(let $e=ae.r0;$e<=ae.r1;$e++)for(let be=ae.c0;be<=ae.c1;be++)pe=go(pe,p,$e,be,q,Y,A);D(pe)},[Z,e,p,D,Y,A]),re=u.useCallback(q=>V("backgroundColor",q),[V]),U=u.useCallback(()=>{const q=Z();if(!q)return;let ae=e;for(let pe=q.r0;pe<=q.r1;pe++)for(let $e=q.c0;$e<=q.c1;$e++)ae=go(ae,p,pe,$e,void 0,Y,A),A==="light"&&(ae=Jt(ae,p,pe,$e,"backgroundColor",void 0));D(ae)},[Z,e,p,D,Y,A]),ee=u.useCallback(q=>V("padding",q),[V]),fe=u.useMemo(()=>{if(A==="dark")return"";const q=O?.cell.props?.style;return typeof q?.backgroundColor=="string"?q.backgroundColor:""},[O,A]),K=u.useMemo(()=>typeof O?.cell.props?.className=="string"?O.cell.props.className:"",[O]),ne=u.useMemo(()=>{const q=O?.cell.props?.style;return typeof q?.padding=="string"?q.padding:""},[O]),me=u.useCallback(q=>q==="section"?n("layout_editor.table_editor.move_blocked_section"):"",[n]),Ce=u.useCallback((q,ae)=>xi(f,q,ae),[f]),ze=u.useCallback((q,ae)=>wi(f,q,ae),[f]),Se=u.useCallback(q=>D(nl(e,p,q)),[e,p,D]),qe=u.useCallback(q=>{D(Jg(e,p,q)),v(null),x(null)},[e,p,D]),De=u.useCallback((q,ae)=>D(Zg(e,p,q,ae)),[e,p,D]),Pe=u.useCallback(q=>D(Rg(e,p,q)),[e,p,D]),Qe=u.useCallback(q=>{D(eh(e,p,q)),v(null),x(null)},[e,p,D]),Me=u.useCallback((q,ae)=>D(Qg(e,p,q,ae)),[e,p,D]),Re=u.useCallback(()=>{if(!h||!b)return;const q=ol(e,p,h.r,h.c,b.r,b.c);q.ok&&(D(q.table),v({r:Math.min(h.r,b.r),c:Math.min(h.c,b.c)}),x(null))},[e,p,h,b,D]),ve=u.useCallback(()=>{h&&(D(th(e,p,h.r,h.c)),x(null))},[e,p,h,D]),te=u.useCallback(q=>{if(!h)return;const ae=Math.min(h.r,b?.r??h.r),pe=Math.max(h.r,b?.r??h.r),$e=Math.min(h.c,b?.c??h.c),be=Math.max(h.c,b?.c??h.c);let j=e;for(let oe=ae;oe<=pe;oe++)for(let ue=$e;ue<=be;ue++)j=Ci(j,p,oe,ue,q);D(j)},[e,p,h,b,D]),he=u.useCallback(async(q,ae)=>{const pe=`${q}:${ae}`,$e=k[pe];if($e===void 0)return;const be=Ue(f,q,ae);if(!be)return;const{node:j,path:oe}=dl(be.cell);if(oe===null)return;const ue=vh(j,c,d);if(ue.editable){if($e===ue.display){w(J=>{const le={...J};return delete le[pe],le});return}S(!0);try{const J=C8(j);if(J)await yr(c,J,d,$e),await tn(c,d);else{const le=await qn(c,l,d,$e);if(le.kind==="ok"&&le.resource){const Ie=`$t:${le.resource.translation_key}`;if(oe.length===0)D(nh(e,p,q,ae,Ie));else{const dt=er(be.cell,oe,Ie);D(oh(e,p,q,ae,dt))}await tn(c,d)}}}finally{S(!1),w(J=>{const le={...J};return delete le[pe],le})}}},[k,f,c,d,l,e,p,D]),Q=u.useMemo(()=>{if(!O)return null;const{node:q,path:ae}=dl(O.cell);return ae===null?null:{value:typeof q?.text=="string"?q.text:"",editable:!0}},[O]),ie=u.useCallback(q=>{if(typeof q!="string"||q.length===0||!h)return;const ae=Ue(f,h.r,h.c);if(!ae)return;const pe=Ro(ae.cell);if(pe!==null)if(pe.length===0)D(nh(e,p,h.r,h.c,q));else{const $e=er(ae.cell,pe,q);D(oh(e,p,h.r,h.c,$e))}},[h,f,e,p,D]),_e=u.useCallback((q,ae,pe)=>{pe?x({r:q,c:ae}):(v({r:q,c:ae}),x(null))},[]),ge=u.useMemo(()=>Array.from({length:f.colCount},(q,ae)=>ae),[f.colCount]),Ae=!!(h&&b&&(h.r!==b.r||h.c!==b.c)),Ne=!!(O&&(O.colSpan>1||O.rowSpan>1)),Le=O&&typeof O.cell.props?.className=="string"?O.cell.props.className:"";return i.jsxs("div",{className:"g7le-node-editor g7le-node-editor--table","data-testid":"g7le-table-editor",style:E8,children:[i.jsx("div",{style:I8,children:n("layout_editor.table_editor.title")}),i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{"data-testid":"g7le-table-editor-grid",style:A8,children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{style:T8}),ge.map(q=>{const ae=ze(q,-1),pe=ze(q,1),$e=M===q;return i.jsx("th",{style:D8,"data-testid":`g7le-table-colgutter-${q}`,onMouseEnter:()=>$(q),onMouseLeave:()=>$(be=>be===q?null:be),children:i.jsxs("div",{style:{...z8,visibility:$e?"visible":"hidden"},children:[i.jsx("button",{type:"button",title:ae.ok?n("layout_editor.table_editor.move_col_left"):me(ae.reason)||n("layout_editor.table_editor.move_col_left"),disabled:!ae.ok||_,onClick:()=>Me(q,-1),"data-testid":`g7le-table-col-left-${q}`,style:ae.ok?vn:$i,children:"←"}),i.jsx("button",{type:"button",title:n("layout_editor.table_editor.add_col"),disabled:_,onClick:()=>Pe(q),"data-testid":`g7le-table-col-add-${q}`,style:vn,children:"+"}),i.jsx("button",{type:"button",title:n("layout_editor.table_editor.remove_col"),disabled:f.colCount<=1||_,onClick:()=>Qe(q),"data-testid":`g7le-table-col-remove-${q}`,style:_h,children:"✕"}),i.jsx("button",{type:"button",title:pe.ok?n("layout_editor.table_editor.move_col_right"):me(pe.reason)||n("layout_editor.table_editor.move_col_right"),disabled:!pe.ok||_,onClick:()=>Me(q,1),"data-testid":`g7le-table-col-right-${q}`,style:pe.ok?vn:$i,children:"→"})]})},q)})]})}),i.jsx("tbody",{children:f.rows.map((q,ae)=>{const pe=q.cells[0]?.gridRow??ae,$e=B===pe;return i.jsxs("tr",{"data-testid":`g7le-table-row-${pe}`,onMouseEnter:()=>C(pe),onMouseLeave:()=>C(be=>be===pe?null:be),children:[i.jsx("td",{style:N8,"data-testid":`g7le-table-rowgutter-${pe}`,children:(()=>{const be=Ce(pe,-1),j=Ce(pe,1);return i.jsxs("div",{style:{...M8,visibility:$e?"visible":"hidden"},children:[i.jsx("button",{type:"button",title:be.ok?n("layout_editor.table_editor.move_row_up"):me(be.reason)||n("layout_editor.table_editor.move_row_up"),disabled:!be.ok||_,onClick:()=>De(pe,-1),"data-testid":`g7le-table-row-up-${pe}`,style:be.ok?vn:$i,children:"↑"}),i.jsx("button",{type:"button",title:n("layout_editor.table_editor.add_row"),disabled:_,onClick:()=>Se(pe),"data-testid":`g7le-table-row-add-${pe}`,style:vn,children:"+"}),i.jsx("button",{type:"button",title:n("layout_editor.table_editor.remove_row"),disabled:f.rows.length<=1||_,onClick:()=>qe(pe),"data-testid":`g7le-table-row-remove-${pe}`,style:_h,children:"✕"}),i.jsx("button",{type:"button",title:j.ok?n("layout_editor.table_editor.move_row_down"):me(j.reason)||n("layout_editor.table_editor.move_row_down"),disabled:!j.ok||_,onClick:()=>De(pe,1),"data-testid":`g7le-table-row-down-${pe}`,style:j.ok?vn:$i,children:"↓"})]})})()}),q.cells.map(be=>{const j=`${be.gridRow}:${be.gridCol}`,{node:oe,path:ue}=dl(be.cell),J=vh(oe,c,d),le=ue!==null&&J.editable,Ie=ue===null,dt=k[j],pt=dt!==void 0?dt:J.display,ot=h&&h.r===be.gridRow&&h.c===be.gridCol,Oe=h&&b&&be.gridRow>=Math.min(h.r,b.r)&&be.gridRow<=Math.max(h.r,b.r)&&be.gridCol>=Math.min(h.c,b.c)&&be.gridCol<=Math.max(h.c,b.c);return i.jsx("td",{colSpan:be.colSpan,rowSpan:be.rowSpan,"data-testid":`g7le-table-cell-${be.gridRow}-${be.gridCol}`,onClick:He=>_e(be.gridRow,be.gridCol,He.shiftKey),style:{...L8,..._8(be.cell,y,A),...x8(be.cell,g,A),...be.isHeader?P8:{},...ot?O8:{},...Oe&&!ot?B8:{}},children:le?i.jsx("input",{type:"text","data-testid":`g7le-table-cell-input-${be.gridRow}-${be.gridCol}`,value:pt,placeholder:n("layout_editor.table_editor.cell_text"),disabled:_,onMouseDown:He=>{He.shiftKey&&He.preventDefault(),_e(be.gridRow,be.gridCol,He.shiftKey)},onClick:He=>He.stopPropagation(),onChange:He=>w(Ye=>({...Ye,[j]:He.target.value})),onBlur:()=>{he(be.gridRow,be.gridCol)},style:W8}):Ie?i.jsx("span",{"data-testid":`g7le-table-cell-struct-${be.gridRow}-${be.gridCol}`,style:xh,children:n("layout_editor.table_editor.structural_cell")}):i.jsx("span",{style:xh,children:J.display})},j)})]},ae)})})]})}),i.jsxs("button",{type:"button","data-testid":"g7le-table-add-row-bottom",onClick:()=>Se(f.rows.length-1),disabled:_,style:j8,children:["+ ",n("layout_editor.table_editor.add_row")]}),i.jsxs("div",{style:H8,"data-testid":"g7le-table-cell-tools",children:[i.jsx("button",{type:"button","data-testid":"g7le-table-merge",onClick:Re,disabled:!Ae||_,style:wh,children:n("layout_editor.table_editor.merge_cells")}),i.jsx("button",{type:"button","data-testid":"g7le-table-unmerge",onClick:ve,disabled:!Ne||_,style:wh,children:n("layout_editor.table_editor.unmerge_cells")})]}),O&&Q&&i.jsxs("div",{style:K8,"data-testid":"g7le-table-cell-i18n-section",children:[i.jsx("div",{style:V8,children:n("layout_editor.table_editor.cell_i18n_label")}),i.jsx(vt,{value:Q.value,onChange:ie,t:n,placeholder:n("layout_editor.table_editor.cell_text"),testidPrefix:"g7le-table-cell-i18n",candidates:s,enableExpressionTree:!0,expressionTreeCollapsible:!0})]}),O&&i.jsxs("div",{style:F8,"data-testid":"g7le-table-cell-color-section",children:[i.jsx(fh,{colorScheme:A,onChange:z,t:n,disabled:_}),y&&i.jsx("div",{style:cl,"data-testid":"g7le-table-cell-border-row",children:i.jsx(sh,{className:Le,catalog:y,t:n,onChange:te,colorScheme:A,onPresetToken:F,colorStyle:G,onColorStyle:I,disabled:_})}),i.jsx("div",{style:cl,"data-testid":"g7le-table-cell-fill-row",children:i.jsx(ch,{colorStyle:fe,className:K,catalog:g,t:n,colorScheme:A,onPresetToken:se,onCustomColor:re,onClear:U,disabled:_})})]}),O&&i.jsx("div",{style:cl,"data-testid":"g7le-table-cell-padding-row",children:i.jsx(uh,{paddingStyle:ne,catalog:m,t:n,onChange:ee,disabled:_})}),O&&!y&&i.jsxs("label",{style:U8,"data-testid":"g7le-table-cell-border-row",children:[i.jsx("span",{style:q8,children:n("layout_editor.table_editor.cell_border")}),i.jsx("input",{type:"text","data-testid":"g7le-table-cell-border-input",value:Le,placeholder:n("layout_editor.table_editor.cell_class_placeholder"),onChange:q=>te(q.target.value),disabled:_,style:G8})]}),!f.valid&&i.jsx("div",{"data-testid":"g7le-table-grid-warning",style:Y8,children:n("layout_editor.table_editor.grid_invalid")}),i.jsx("div",{style:X8,children:n("layout_editor.table_editor.select_hint")})]})}const E8={display:"flex",flexDirection:"column",gap:8,width:"100%",marginBottom:12},I8={fontSize:12,fontWeight:700,color:"#0f172a"},A8={borderCollapse:"collapse",width:"auto"},T8={width:28,background:"transparent",border:"none"},D8={padding:2,border:"none",background:"transparent"},N8={padding:2,border:"none",background:"transparent",verticalAlign:"middle"},z8={display:"flex",gap:2,justifyContent:"center"},M8={display:"grid",gridTemplateColumns:"repeat(2, 16px)",gap:2,justifyContent:"center"},vn={width:16,height:16,lineHeight:"14px",padding:0,fontSize:10,border:"1px solid #cbd5e1",borderRadius:4,background:"#fff",color:"#475569",cursor:"pointer"},_h={...vn,border:"1px solid #fecaca",color:"#dc2626"},$i={...vn,cursor:"not-allowed",opacity:.4,color:"#94a3b8",borderColor:"#e2e8f0"},L8={border:"1px solid #cbd5e1",padding:0,width:64,minWidth:64,maxWidth:120,height:24,background:"#fff",cursor:"pointer"},P8={background:"#f1f5f9",fontWeight:600},O8={outline:"2px solid #2563eb",outlineOffset:-2},B8={background:"#dbeafe"},W8={width:"100%",boxSizing:"border-box",padding:"2px 5px",fontSize:11,height:22,lineHeight:"18px",border:"none",background:"transparent",outline:"none"},xh={display:"block",padding:"2px 5px",fontSize:10,color:"#64748b",fontStyle:"italic",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},j8={padding:"4px 8px",fontSize:12,border:"1px dashed #94a3b8",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer",alignSelf:"flex-start"},H8={display:"flex",gap:6},wh={padding:"4px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},F8={display:"flex",flexDirection:"column",gap:8,borderTop:"1px solid #f1f5f9",paddingTop:8},K8={display:"flex",flexDirection:"column",gap:6,borderTop:"1px solid #f1f5f9",paddingTop:8},V8={fontSize:12,fontWeight:700,color:"#0f172a"},cl={display:"flex",flexDirection:"column",gap:6},U8={display:"flex",alignItems:"center",gap:6},q8={fontSize:12,color:"#475569",minWidth:60},G8={flex:1,minWidth:0,padding:"4px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6},Y8={fontSize:11,color:"#b45309",background:"#fffbeb",border:"1px solid #fde68a",borderRadius:6,padding:"4px 6px"},X8={fontSize:11,color:"#94a3b8"},J8=/\{\{.*?\}\}/;function Z8(e,t,n){const r=(e.props??{})[t];return Array.isArray(r)?r:r===void 0&&n?JSON.parse(JSON.stringify(n)):[]}function Q8(e){return typeof e=="string"&&J8.test(e)}function ul(e,t,n){return e?e.startsWith("$t:")?t(e.slice(3)):e:n}function R8(e,t,n){return typeof e=="object"&&e!==null?e[t.key]:n?e:void 0}function ez(e,t,n,o){if(typeof e=="object"&&e!==null){const r={...e};return o===void 0?delete r[t.key]:r[t.key]=o,r}return n?o:{[t.key]:o}}function kh({node:e,params:t,t:n,onPatchNode:o,templateIdentifier:r,candidates:s}){const a=typeof t?.arrayProp=="string"?t.arrayProp:null,l=Array.isArray(t?.fields)?t.fields:[],d=ul(typeof t?.itemLabel=="string"?t.itemLabel:void 0,n,n("layout_editor.array_editor.item")),c=t?.newItem,p=c&&typeof c=="object"?c:null,f=typeof c=="string"||typeof c=="number"?c:null,y=(l.find(S=>S.primary)??l[0])?.key,g=(e.props??{})[a??""],m=Array.isArray(t?.defaultItems)?t.defaultItems:null,h=a?Z8(e,a,m):[],v=u.useCallback(S=>{if(!a)return;const E={...e.props??{}};E[a]=S,o({...e,props:E})},[a,e,o]),b=u.useCallback(()=>{if(p)return JSON.parse(JSON.stringify(p));if(f!==null)return f;const S={};for(const E of l)(E.widget??"text")==="boolean"?S[E.key]=!1:S[E.key]="";return S},[p,f,l]),x=u.useCallback(()=>{v([...h,b()])},[v,h,b]),k=u.useCallback(S=>{v(h.filter((E,C)=>C!==S))},[v,h]),w=u.useCallback((S,E)=>{const C=S+E;if(C<0||C>=h.length)return;const N=[...h];[N[S],N[C]]=[N[C],N[S]],v(N)},[v,h]),_=u.useCallback((S,E,C)=>{const N=E.key===y,$=h.map((A,z)=>z===S?ez(A,E,N,C):A);v($)},[h,v,y]);return a?Q8(g)||g!==void 0&&!Array.isArray(g)?i.jsx("div",{className:"g7le-node-editor g7le-node-editor--array","data-testid":"g7le-array-editor-bound",style:dz,children:n("layout_editor.array_editor.bound_degraded")}):i.jsxs("div",{className:"g7le-node-editor g7le-node-editor--array","data-testid":"g7le-array-editor",style:tz,children:[i.jsx("div",{style:nz,children:n("layout_editor.array_editor.items_title")}),h.length===0&&i.jsx("div",{"data-testid":"g7le-array-empty",style:Ch,children:n("layout_editor.array_editor.empty")}),h.map((S,E)=>i.jsxs("div",{"data-testid":`g7le-array-row-${E}`,style:oz,children:[i.jsxs("div",{style:rz,children:[i.jsxs("span",{style:iz,children:["#",E+1]}),i.jsx("div",{style:{flex:1}}),i.jsx("button",{type:"button","data-testid":`g7le-array-up-${E}`,title:n("layout_editor.array_editor.move_up"),disabled:E===0,onClick:()=>w(E,-1),style:Sh,children:"↑"}),i.jsx("button",{type:"button","data-testid":`g7le-array-down-${E}`,title:n("layout_editor.array_editor.move_down"),disabled:E===h.length-1,onClick:()=>w(E,1),style:Sh,children:"↓"}),i.jsx("button",{type:"button","data-testid":`g7le-array-remove-${E}`,title:n("layout_editor.array_editor.remove"),onClick:()=>k(E),style:az,children:"✕"})]}),l.map(C=>{const N=C.widget??"text",$=C.key===y,A=ul(C.label,n,C.key),z=R8(S,C,$),D=`g7le-array-field-${E}-${C.key}`;if(N==="boolean")return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsx("input",{type:"checkbox","data-testid":D,checked:z===!0,onChange:M=>_(E,C,M.target.checked)})]},C.key);if(N==="select"){const M=Array.isArray(C.options)?C.options:[];return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsxs("select",{"data-testid":D,value:z==null?"":String(z),onChange:B=>_(E,C,B.target.value===""?void 0:B.target.value),style:nr,children:[i.jsx("option",{value:"",children:"—"}),M.map((B,T)=>i.jsx("option",{value:String(B.value),children:ul(B.label,n,String(B.value))},T))]})]},C.key)}if(N==="i18n-text"){const M=typeof z=="string"?z:z==null?"":String(z);return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsx("div",{"data-testid":D,style:{flex:1,minWidth:0},children:i.jsx(vt,{value:M,onChange:B=>_(E,C,B===""?void 0:B),t:n,placeholder:A,testidPrefix:`${D}-i18n`,candidates:s,enableExpressionTree:!0,expressionTreeCollapsible:!0})})]},C.key)}if(N==="number"){const M=z==null?"":String(z);return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsx("input",{type:"number","data-testid":D,value:M,onChange:B=>{const T=B.target.value;_(E,C,T===""?void 0:Number(T))},style:nr})]},C.key)}if(N==="color"){const M=typeof z=="string"?z:"",B=/^#[0-9a-fA-F]{6}$/.test(M)?M:"#000000";return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsx("input",{type:"color","data-testid":`${D}-swatch`,value:B,onChange:T=>_(E,C,T.target.value),style:sz}),i.jsx("input",{type:"text","data-testid":D,value:M,placeholder:"#7C3AED",onChange:T=>_(E,C,T.target.value===""?void 0:T.target.value),style:nr})]},C.key)}if(N==="number-list"){const M=Array.isArray(z)?z.join(", "):"";return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsx("input",{type:"text","data-testid":D,value:M,placeholder:n("layout_editor.array_editor.number_list_placeholder"),onChange:B=>{const T=B.target.value.split(",").map(H=>H.trim()).filter(H=>H!=="").map(H=>Number(H)).filter(H=>!Number.isNaN(H));_(E,C,T)},style:nr})]},C.key)}const O=z==null?"":String(z);return i.jsxs("label",{style:Wn,children:[i.jsx("span",{style:jn,children:A}),i.jsx("input",{type:"text","data-testid":D,value:O,placeholder:N==="icon"?n("layout_editor.array_editor.icon_placeholder"):A,onChange:M=>_(E,C,M.target.value===""?void 0:M.target.value),style:nr})]},C.key)})]},E)),i.jsx("button",{type:"button","data-testid":"g7le-array-add",onClick:x,style:lz,children:n("layout_editor.array_editor.add",{item:d})})]}):i.jsx("div",{className:"g7le-node-editor g7le-node-editor--array","data-testid":"g7le-array-editor-misconfigured",style:Ch,children:n("layout_editor.array_editor.no_array_prop")})}const tz={display:"flex",flexDirection:"column",gap:8,width:"100%",marginBottom:12},nz={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:2},oz={display:"flex",flexDirection:"column",gap:4,padding:8,border:"1px solid #e2e8f0",borderRadius:8,background:"#f8fafc"},rz={display:"flex",gap:4,alignItems:"center"},iz={fontSize:11,fontWeight:700,color:"#64748b"},Wn={display:"flex",flexWrap:"wrap",gap:6,alignItems:"center"},jn={fontSize:11,color:"#475569",minWidth:64,flexShrink:0},nr={flex:1,minWidth:0,padding:"4px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6},sz={width:32,height:28,padding:0,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",flexShrink:0},Sh={padding:"2px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},az={padding:"2px 6px",fontSize:12,border:"1px solid #fecaca",borderRadius:6,background:"#fff",color:"#dc2626",cursor:"pointer"},lz={padding:"4px 8px",fontSize:12,border:"1px dashed #94a3b8",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer",alignSelf:"flex-start"},Ch={fontSize:11,color:"#94a3b8",fontStyle:"italic"},dz={fontSize:11,color:"#b45309",fontStyle:"italic",padding:"4px 2px"};function cz(e,t){return e?e.startsWith("$t:")?t(e.slice(3)):e:null}function uz(e){const{params:t,t:n}=e,o=Array.isArray(t?.groups)?t.groups:[];return o.length===0?i.jsx("div",{className:"g7le-node-editor g7le-node-editor--array-group","data-testid":"g7le-array-group-misconfigured",style:hz,children:n("layout_editor.array_editor.no_array_prop")}):i.jsx("div",{className:"g7le-node-editor g7le-node-editor--array-group","data-testid":"g7le-array-group-editor",style:pz,children:o.map((r,s)=>{const a=cz(r.title,n),{title:l,...d}=r;return i.jsxs("div",{"data-testid":`g7le-array-group-${r.arrayProp??s}`,style:fz,children:[a&&i.jsx("div",{style:gz,children:a}),i.jsx(kh,{...e,params:d})]},r.arrayProp??s)})})}const pz={display:"flex",flexDirection:"column",gap:16,width:"100%",marginBottom:12},fz={display:"flex",flexDirection:"column",gap:4},gz={fontSize:12,fontWeight:700,color:"#1e293b",borderBottom:"1px solid #e2e8f0",paddingBottom:4},hz={fontSize:11,color:"#94a3b8",fontStyle:"italic"},yz=/\{\{.*?\}\}/;function bz(e){return typeof e=="string"&&yz.test(e)}function mz(e,t,n){return e?e.startsWith("$t:")?t(e.slice(3)):e:n}function vz(e){const{node:t,params:n,t:o,onPatchNode:r}=e,s=typeof n?.arrayProp=="string"?n.arrayProp:null,a=typeof n?.idField=="string"?n.idField:"id",l=typeof n?.cellChildrenProp=="string"?n.cellChildrenProp:"cellChildren",d=typeof n?.cellChildComponent=="string"?n.cellChildComponent:"Div",c=mz(typeof n?.itemLabel=="string"?n.itemLabel:void 0,o,o("layout_editor.array_editor.item")),[p,f]=u.useState(null),y=s?(t.props??{})[s]:void 0,g=Array.isArray(y)?y:[],m=u.useCallback(S=>{if(!s)return;const E={...t.props??{}};E[s]=S,r({...t,props:E})},[s,t,r]),h=u.useCallback(()=>{const S=n?.newItem;return S&&typeof S=="object"?JSON.parse(JSON.stringify(S)):{[a]:"",[l]:[]}},[n,a,l]),v=u.useCallback(()=>{m([...g,h()])},[m,g,h]),b=u.useCallback(S=>{m(g.filter((E,C)=>C!==S)),f(null)},[m,g]),x=u.useCallback((S,E)=>{const C=S+E;if(C<0||C>=g.length)return;const N=[...g];[N[S],N[C]]=[N[C],N[S]],m(N)},[m,g]),k=u.useCallback((S,E)=>{const C=g.map((N,$)=>$===S?{...N,[a]:E}:N);m(C)},[g,m,a]),w=u.useCallback(S=>({type:"composite",name:"CardGridCell",children:Array.isArray(S[l])?S[l]:[]}),[l]),_=u.useCallback(S=>E=>{const C=Array.isArray(E.children)?E.children:[],N=g.map(($,A)=>A===S?{...$,[l]:C}:$);m(N)},[g,m,l]);return s?bz(y)||y!==void 0&&!Array.isArray(y)?i.jsx("div",{className:"g7le-node-editor g7le-node-editor--cell-tree","data-testid":"g7le-cell-tree-bound",style:Tz,children:o("layout_editor.array_editor.bound_degraded")}):i.jsxs("div",{className:"g7le-node-editor g7le-node-editor--cell-tree","data-testid":"g7le-cell-tree-editor",style:_z,children:[i.jsx("div",{style:xz,children:o("layout_editor.cell_tree_editor.columns_title")}),g.length===0&&i.jsx("div",{"data-testid":"g7le-cell-tree-empty",style:Eh,children:o("layout_editor.array_editor.empty")}),g.map((S,E)=>{const C=typeof S[a]=="string"?S[a]:"",N=p===E;return i.jsxs("div",{"data-testid":`g7le-cell-tree-row-${E}`,style:wz,children:[i.jsxs("div",{style:kz,children:[i.jsxs("span",{style:Sz,children:["#",E+1]}),i.jsx("input",{type:"text","data-testid":`g7le-cell-tree-id-${E}`,value:C,placeholder:o("layout_editor.cell_tree_editor.id_placeholder"),onChange:$=>k(E,$.target.value),style:Cz}),i.jsx("button",{type:"button","data-testid":`g7le-cell-tree-up-${E}`,title:o("layout_editor.array_editor.move_up"),disabled:E===0,onClick:()=>x(E,-1),style:$h,children:"↑"}),i.jsx("button",{type:"button","data-testid":`g7le-cell-tree-down-${E}`,title:o("layout_editor.array_editor.move_down"),disabled:E===g.length-1,onClick:()=>x(E,1),style:$h,children:"↓"}),i.jsx("button",{type:"button","data-testid":`g7le-cell-tree-remove-${E}`,title:o("layout_editor.array_editor.remove"),onClick:()=>b(E),style:$z,children:"✕"})]}),i.jsx("button",{type:"button","data-testid":`g7le-cell-tree-toggle-${E}`,onClick:()=>f(N?null:E),style:Ez,children:o(N?"layout_editor.cell_tree_editor.collapse_cells":"layout_editor.cell_tree_editor.expand_cells")}),N&&i.jsx("div",{"data-testid":`g7le-cell-tree-cells-${E}`,style:Iz,children:i.jsx(Kg,{...e,node:w(S),params:{childComponent:d},onPatchNode:_(E)})})]},E)}),i.jsx("button",{type:"button","data-testid":"g7le-cell-tree-add",onClick:v,style:Az,children:o("layout_editor.cell_tree_editor.add_column",{item:c})})]}):i.jsx("div",{className:"g7le-node-editor g7le-node-editor--cell-tree","data-testid":"g7le-cell-tree-misconfigured",style:Eh,children:o("layout_editor.array_editor.no_array_prop")})}const _z={display:"flex",flexDirection:"column",gap:8,width:"100%",marginBottom:12},xz={fontSize:12,fontWeight:700,color:"#0f172a",marginBottom:2},wz={display:"flex",flexDirection:"column",gap:6,padding:8,border:"1px solid #e2e8f0",borderRadius:8,background:"#f8fafc"},kz={display:"flex",gap:4,alignItems:"center"},Sz={fontSize:11,fontWeight:700,color:"#64748b",flexShrink:0},Cz={flex:1,minWidth:0,padding:"4px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6},$h={padding:"2px 6px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"},$z={padding:"2px 6px",fontSize:12,border:"1px solid #fecaca",borderRadius:6,background:"#fff",color:"#dc2626",cursor:"pointer"},Ez={padding:"3px 8px",fontSize:11,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#2563eb",cursor:"pointer",alignSelf:"flex-start"},Iz={paddingLeft:8,borderLeft:"2px solid #e2e8f0"},Az={padding:"4px 8px",fontSize:12,border:"1px dashed #94a3b8",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer",alignSelf:"flex-start"},Eh={fontSize:11,color:"#94a3b8",fontStyle:"italic"},Tz={fontSize:11,color:"#b45309",fontStyle:"italic",padding:"4px 2px"};function Dz(e,t,n){const o=Be(e,t);if(!n||n.length===0)return{measured:[],grid:o};const r=[];for(const s of o.rows)for(const a of s.cells){const d=tl(e,a,t).map(p=>`children.${p}`).join("."),c=n.find(p=>p.path===d||p.path.endsWith("."+d));c&&r.push({ref:a,box:{top:c.top,left:c.left,width:c.width,height:c.height}})}return{measured:r,grid:o}}const pl=26,fl=50,gl=6,Ih=44,Ah=18,Th="g7le-table-inplace-empty-cell-style";function Nz(){if(typeof document>"u"||document.getElementById(Th))return;const e=document.createElement("style");e.id=Th,e.textContent=".g7le-preview-frame td[data-editor-name],.g7le-preview-frame th[data-editor-name]{min-width:56px;height:38px;}.g7le-preview-frame table[data-editor-name]{min-width:120px;}",document.head.appendChild(e)}function zz({node:e,params:t,nodeBox:n,cellBoxes:o,selectedCellPath:r,colorScheme:s,t:a,onPatchNode:l,onRequestInlineEdit:d}){const c=u.useMemo(()=>t&&typeof t=="object"?t:null,[t]),{measured:p,grid:f}=u.useMemo(()=>Dz(e,c,o),[e,c,o]),[y,g]=u.useState(null),[m,h]=u.useState(null),v=u.useMemo(()=>{if(!r)return null;for(const j of f.rows)for(const oe of j.cells){const ue=tl(e,oe,c).map(J=>`children.${J}`).join(".");if(r===ue||r.startsWith(ue+"."))return{r:oe.gridRow,c:oe.gridCol}}return null},[r,f,e,c]),b=u.useMemo(()=>y&&Ue(f,y.r,y.c)?y:v,[y,v,f]),[x,k]=u.useState(!1),[w,_]=u.useState(s==="dark"?"dark":"light"),[S,E]=u.useState(null),[C,N]=u.useState(null),$=u.useRef(null),A=u.useCallback(()=>{$.current!==null&&(clearTimeout($.current),$.current=null)},[]),z=u.useCallback(()=>{A(),$.current=setTimeout(()=>{E(null),N(null),$.current=null},240)},[A]);u.useEffect(()=>()=>A(),[A]),u.useEffect(()=>{Nz()},[]);const D=u.useCallback(j=>l(j),[l]),O=u.useMemo(()=>b?Ue(f,b.r,b.c):null,[f,b]),M=u.useMemo(()=>O&&typeof O.cell.props?.className=="string"?O.cell.props.className:"",[O]),B=u.useCallback(j=>D(nl(e,c,j)),[e,c,D]),T=u.useCallback(j=>D(Jg(e,c,j)),[e,c,D]),H=u.useCallback((j,oe)=>D(Zg(e,c,j,oe)),[e,c,D]),L=u.useCallback(j=>D(Rg(e,c,j)),[e,c,D]),I=u.useCallback(j=>D(eh(e,c,j)),[e,c,D]),P=u.useCallback((j,oe)=>D(Qg(e,c,j,oe)),[e,c,D]),F=u.useCallback(j=>{if(!O)return;const oe=O.gridRow,ue=O.gridCol,J=j==="down"?oe+O.rowSpan:oe+O.rowSpan-1,le=j==="right"?ue+O.colSpan:ue+O.colSpan-1;if(J>=f.rows.length||le>=f.colCount)return;const Ie=ol(e,c,oe,ue,J,le);Ie.ok&&D(Ie.table)},[O,f,e,c,D]),G=!!(O&&O.gridCol+O.colSpan!b||!m||!Ue(f,m.r,m.c)?null:{r0:Math.min(b.r,m.r),c0:Math.min(b.c,m.c),r1:Math.max(b.r,m.r),c1:Math.max(b.c,m.c)},[b,m,f]),Z=u.useMemo(()=>{if(!Y)return[];const j=new Set,oe=[];for(const ue of f.rows)for(const J of ue.cells)if(J.gridRow>=Y.r0&&J.gridRow<=Y.r1&&J.gridCol>=Y.c0&&J.gridCol<=Y.c1){const le=`${J.gridRow}:${J.gridCol}`;j.has(le)||(j.add(le),oe.push({r:J.gridRow,c:J.gridCol}))}return oe},[Y,f]),se=Z.length>1,re=u.useCallback(()=>{if(!Y)return;const j=ol(e,c,Y.r0,Y.c0,Y.r1,Y.c1);j.ok&&(D(j.table),h(null))},[Y,e,c,D]),U=u.useCallback(()=>{b&&D(th(e,c,b.r,b.c))},[e,c,b,D]),ee=u.useMemo(()=>{const j=c?.cellBorder;return j&&typeof j=="object"?j:null},[c]),fe=u.useMemo(()=>{const j=c?.cellBackground;return j&&typeof j=="object"?j:null},[c]),K=u.useMemo(()=>{const j=c?.cellPadding;return j&&typeof j=="object"?j:null},[c]),ne=u.useMemo(()=>{if(x){const j=new Set,oe=[];for(const ue of f.rows)for(const J of ue.cells){const le=`${J.gridRow}:${J.gridCol}`;j.has(le)||(j.add(le),oe.push({r:J.gridRow,c:J.gridCol}))}return oe}return se?Z:b?[{r:b.r,c:b.c}]:[]},[x,se,Z,b,f]),me=u.useCallback(j=>{if(ne.length===0)return;let oe=e;for(const ue of ne){const J=(ee?.colors??[]).map(Ie=>Ie.token),le=j.split(/\s+/).filter(Ie=>Ie&&!J.includes(Ie)).join(" ");oe=Ci(oe,c,ue.r,ue.c,le)}D(oe)},[e,c,ne,ee,D]),Ce=u.useMemo(()=>{const j=(ee?.sides??[]).find(J=>J.value==="all")??(ee?.sides??[])[0],oe=(ee?.widths??[]).find(J=>J.value!=="none");if(!j||!oe)return[];const ue=oe.suffix??"";return[ue?`${j.prefix}${ue}`:j.prefix]},[ee]),ze=u.useCallback((j,oe,ue)=>{if(Ce.length===0)return j;const J=(ee?.sides??[]).map(Oe=>Oe.prefix),le=Ue(Be(j,c),oe,ue),dt=(typeof le?.cell?.props?.className=="string"?le.cell.props.className:"").split(/\s+/).filter(Boolean);if(dt.some(Oe=>J.some(He=>Oe===He||Oe.startsWith(He+"-")&&/^-?\d+$/.test(Oe.slice(He.length+1)))))return j;const ot=[...dt,...Ce].join(" ").trim();return Ci(j,c,oe,ue,ot)},[Ce,ee,c]),Se=u.useCallback((j,oe)=>{if(j.length===0)return;const ue=new Set(j.map(le=>`${le.r}:${le.c}`));let J=e;for(const le of j){if(J=ze(J,le.r,le.c),J=Jt(J,c,le.r,le.c,"borderColor",oe),le.r>0&&!ue.has(`${le.r-1}:${le.c}`)){const Ie=Ue(Be(J,c),le.r-1,le.c);Ie&&(J=Jt(J,c,Ie.gridRow,Ie.gridCol,"borderBottomColor",oe))}if(le.c>0&&!ue.has(`${le.r}:${le.c-1}`)){const Ie=Ue(Be(J,c),le.r,le.c-1);Ie&&(J=Jt(J,c,Ie.gridRow,Ie.gridCol,"borderRightColor",oe))}}D(J)},[e,c,D,ze]),qe=u.useMemo(()=>(ee?.colors??[]).map(j=>j.token).filter(Boolean),[ee]),De=u.useCallback(j=>{if(ne.length===0||qe.length===0)return;let oe=e;for(const ue of ne)oe=ze(oe,ue.r,ue.c),oe=go(oe,c,ue.r,ue.c,j,qe,w);D(oe)},[ne,e,c,D,ze,qe,w]),Pe=u.useCallback(j=>Se(ne,j),[Se,ne]),Qe=u.useMemo(()=>{if(w==="dark")return"";const j=O?.cell.props?.style;return typeof j?.borderColor=="string"?j.borderColor:""},[O,w]),Me=u.useCallback((j,oe)=>{if(ne.length===0)return;let ue=e;for(const J of ne)ue=Jt(ue,c,J.r,J.c,j,oe);D(ue)},[ne,e,c,D]),Re=u.useMemo(()=>(fe?.colors??[]).map(j=>j.token).filter(j=>!!j),[fe]),ve=u.useCallback(j=>{if(ne.length===0||Re.length===0)return;let oe=e;for(const ue of ne)oe=go(oe,c,ue.r,ue.c,j,Re,w);D(oe)},[ne,e,c,D,Re,w]),te=u.useCallback(j=>Me("backgroundColor",j),[Me]),he=u.useCallback(()=>{if(ne.length===0)return;let j=e;for(const oe of ne)j=go(j,c,oe.r,oe.c,void 0,Re,w),w==="light"&&(j=Jt(j,c,oe.r,oe.c,"backgroundColor",void 0));D(j)},[ne,e,c,D,Re,w]),Q=u.useCallback(j=>Me("padding",j),[Me]),ie=u.useMemo(()=>{if(w==="dark")return"";const j=O?.cell.props?.style;return typeof j?.backgroundColor=="string"?j.backgroundColor:""},[O,w]),_e=u.useMemo(()=>typeof O?.cell.props?.className=="string"?O.cell.props.className:"",[O]),ge=u.useMemo(()=>{const j=O?.cell.props?.style;return typeof j?.padding=="string"?j.padding:""},[O]),Ae=u.useCallback(j=>{const oe=j.currentTarget,ue=oe.style.pointerEvents;oe.style.pointerEvents="none";const J=document.elementFromPoint(j.clientX,j.clientY);oe.style.pointerEvents=ue;const le=J?.closest?.("[data-dnd-handle-path]");le&&le.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,clientX:j.clientX,clientY:j.clientY,pointerId:j.pointerId,pointerType:j.pointerType,button:j.button,isPrimary:!0}))},[]),Ne=u.useMemo(()=>{const j=new Map;for(const oe of p)j.has(oe.ref.gridCol)||j.set(oe.ref.gridCol,oe.box);return j},[p]),Le=u.useMemo(()=>{const j=new Map;for(const oe of p)j.has(oe.ref.gridRow)||j.set(oe.ref.gridRow,oe.box);return j},[p]);if(p.length===0)return null;const q=!!(O&&(O.colSpan>1||O.rowSpan>1)),ae=C!==null?C:b?.c??null,pe=S!==null?S:b?.r??null,$e=n.top-pl-gl-Ih,be=n.left-fl-gl-Ih;return i.jsxs("div",{className:"g7le-table-inplace","data-testid":"g7le-table-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:c7},children:[p.map(j=>{const oe=b&&b.r===j.ref.gridRow&&b.c===j.ref.gridCol,ue=Y&&j.ref.gridRow>=Y.r0&&j.ref.gridRow<=Y.r1&&j.ref.gridCol>=Y.c0&&j.ref.gridCol<=Y.c1;return i.jsx("div",{"data-testid":`g7le-inplace-cell-${j.ref.gridRow}-${j.ref.gridCol}`,role:"button",tabIndex:-1,"aria-label":a("layout_editor.table_inplace.select_cell"),onMouseEnter:()=>{A(),E(j.ref.gridRow),N(j.ref.gridCol)},onMouseLeave:()=>{z()},onPointerDown:J=>Ae(J),onClick:J=>{if(J.stopPropagation(),J.shiftKey&&(y||b))h({r:j.ref.gridRow,c:j.ref.gridCol});else{g({r:j.ref.gridRow,c:j.ref.gridCol}),h(null);const le=tl(e,j.ref,c).map(Ie=>`children.${Ie}`).join(".");d?.(le)}},style:{position:"absolute",top:j.box.top,left:j.box.left,width:j.box.width,height:j.box.height,minWidth:Ah,minHeight:Ah,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",outline:oe?"2px solid #2563eb":"none",outlineOffset:-2,background:ue&&!oe?"rgba(37,99,235,0.14)":"transparent"}},`cell-${j.ref.gridRow}-${j.ref.gridCol}`)}),i.jsx("div",{"data-testid":"g7le-inplace-col-rail",onMouseEnter:A,onMouseLeave:z,style:{position:"absolute",top:$e,left:n.left,width:n.width,height:pl,pointerEvents:"none"},children:ae!==null&&Ne.has(ae)&&(()=>{const j=ae,oe=Ne.get(j),ue=wi(f,j,-1),J=wi(f,j,1),le=oe.left-n.left;return i.jsxs("div",{"data-testid":`g7le-inplace-colgutter-${j}`,onMouseEnter:()=>{A(),N(j)},onMouseLeave:z,style:{position:"absolute",top:0,left:le,width:oe.width,minWidth:96,height:pl,display:"flex",gap:3,justifyContent:"center",alignItems:"center",pointerEvents:"auto"},children:[i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.move_col_left"),disabled:!ue.ok,onClick:()=>P(j,-1),"data-testid":`g7le-inplace-col-left-${j}`,style:ue.ok?_n:Ei,children:"←"}),i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.add_col"),onClick:()=>L(j),"data-testid":`g7le-inplace-col-add-${j}`,style:_n,children:"+"}),i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.remove_col"),disabled:f.colCount<=1,onClick:()=>I(j),"data-testid":`g7le-inplace-col-remove-${j}`,style:Dh,children:"✕"}),i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.move_col_right"),disabled:!J.ok,onClick:()=>P(j,1),"data-testid":`g7le-inplace-col-right-${j}`,style:J.ok?_n:Ei,children:"→"})]},`colgut-${j}`)})()}),i.jsx("div",{"data-testid":"g7le-inplace-row-rail",style:{position:"absolute",top:n.top,left:be,width:fl,height:n.height,pointerEvents:"none"},children:pe!==null&&Le.has(pe)&&(()=>{const j=pe,oe=Le.get(j),ue=xi(f,j,-1),J=xi(f,j,1),le=oe.top-n.top;return i.jsxs("div",{"data-testid":`g7le-inplace-rowgutter-${j}`,onMouseEnter:()=>{A(),E(j)},onMouseLeave:z,style:{position:"absolute",top:le,left:0,width:fl,height:oe.height,minHeight:48,display:"grid",gridTemplateColumns:"repeat(2, 22px)",gridAutoRows:"22px",gap:3,justifyContent:"center",alignContent:"center",pointerEvents:"auto"},children:[i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.move_row_up"),disabled:!ue.ok,onClick:()=>H(j,-1),"data-testid":`g7le-inplace-row-up-${j}`,style:ue.ok?_n:Ei,children:"↑"}),i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.add_row"),onClick:()=>B(j),"data-testid":`g7le-inplace-row-add-${j}`,style:_n,children:"+"}),i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.remove_row"),disabled:f.rows.length<=1,onClick:()=>T(j),"data-testid":`g7le-inplace-row-remove-${j}`,style:Dh,children:"✕"}),i.jsx("button",{type:"button",title:a("layout_editor.table_inplace.move_row_down"),disabled:!J.ok,onClick:()=>H(j,1),"data-testid":`g7le-inplace-row-down-${j}`,style:J.ok?_n:Ei,children:"↓"})]},`rowgut-${j}`)})()}),i.jsxs("div",{"data-testid":"g7le-inplace-corner-add",style:{position:"absolute",top:n.top+n.height+gl,left:n.left,display:"flex",flexDirection:"column",gap:6,pointerEvents:"auto",minWidth:200,maxWidth:Math.max(240,n.width),background:"#fff",border:"1px solid #e2e8f0",borderRadius:8,padding:8,boxShadow:"0 2px 8px rgba(0,0,0,0.12)"},children:[i.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[i.jsxs("button",{type:"button","data-testid":"g7le-inplace-add-row-bottom",onClick:()=>B(f.rows.length-1),style:Nh,children:["+ ",a("layout_editor.table_inplace.add_row")]}),i.jsxs("button",{type:"button","data-testid":"g7le-inplace-add-col-right",onClick:()=>L(f.colCount-1),style:Nh,children:["+ ",a("layout_editor.table_inplace.add_col")]})]}),!b&&i.jsx("div",{"data-testid":"g7le-inplace-select-hint",style:{fontSize:11,color:"#94a3b8",borderTop:"1px solid #f1f5f9",paddingTop:6},children:a("layout_editor.table_inplace.select_cell_hint")}),b&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,borderTop:"1px solid #f1f5f9",paddingTop:6},children:[se&&i.jsx("div",{"data-testid":"g7le-inplace-range-count",style:{fontSize:11,color:"#2563eb"},children:a("layout_editor.table_inplace.range_selected",{count:Z.length})}),i.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",alignItems:"center"},children:[se?i.jsx("button",{type:"button","data-testid":"g7le-inplace-merge-range",onClick:re,style:or,children:a("layout_editor.table_inplace.merge_range")}):i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button","data-testid":"g7le-inplace-merge-right",disabled:!G,onClick:()=>F("right"),style:G?or:hl,children:a("layout_editor.table_inplace.merge_right")}),i.jsx("button",{type:"button","data-testid":"g7le-inplace-merge-down",disabled:!V,onClick:()=>F("down"),style:V?or:hl,children:a("layout_editor.table_inplace.merge_down")})]}),i.jsx("button",{type:"button","data-testid":"g7le-inplace-unmerge",disabled:!q,onClick:U,style:q?or:hl,children:a("layout_editor.table_inplace.unmerge")})]}),i.jsxs("div",{"data-testid":"g7le-inplace-cell-color",style:{borderTop:"1px solid #f1f5f9",paddingTop:6,display:"flex",flexDirection:"column",gap:6},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"#475569",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox","data-testid":"g7le-inplace-border-all-toggle",checked:x,onChange:j=>k(j.target.checked)}),a("layout_editor.table_inplace.border_apply_all")]}),i.jsx(fh,{colorScheme:w,onChange:_,t:a}),ee&&i.jsx("div",{"data-testid":"g7le-inplace-cell-border",children:i.jsx(sh,{className:x?"":M,catalog:ee,t:a,onChange:me,colorScheme:w,onPresetToken:De,colorStyle:x?"":Qe,onColorStyle:Pe})}),i.jsx("div",{"data-testid":"g7le-inplace-cell-fill",children:i.jsx(ch,{colorStyle:x?"":ie,className:x?"":_e,catalog:fe,t:a,colorScheme:w,onPresetToken:ve,onCustomColor:te,onClear:he})})]}),i.jsx("div",{"data-testid":"g7le-inplace-cell-padding",style:{borderTop:"1px solid #f1f5f9",paddingTop:6},children:i.jsx(uh,{paddingStyle:x?"":ge,catalog:K,t:a,onChange:Q})})]})]})]})}const _n={width:22,height:22,lineHeight:"20px",padding:0,fontSize:13,border:"1px solid #cbd5e1",borderRadius:5,background:"#fff",color:"#475569",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.18)"},Dh={..._n,border:"1px solid #fecaca",color:"#dc2626"},Ei={..._n,cursor:"not-allowed",opacity:.4,color:"#94a3b8",borderColor:"#e2e8f0"},or={padding:"4px 10px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.12)"},hl={...or,cursor:"not-allowed",opacity:.4},Nh={padding:"3px 8px",fontSize:11,border:"1px dashed #94a3b8",borderRadius:6,background:"#fff",color:"#475569",cursor:"pointer"};let zh=!1;function Mz(){zh||(Pn("children",Kg),Pn("table",$8),Pn("array",kh),Pn("array-group",uz),Pn("array-cell-tree",vz),Oa("table",zz),zh=!0)}function Lz(){if(typeof window>"u")return;const e=window.G7Core;if(!e)return;const t=e.layoutEditor,n=Array.isArray(t?.__queue)?t.__queue:[],o=Array.isArray(t?.__readyCallbacks)?t.__readyCallbacks:[];e.layoutEditor={registerWidget:Xe,registerNodeEditor:Pn,registerCanvasOverlay:Oa,onReady:r=>{typeof r=="function"&&r()}};for(const r of n){const[s,...a]=r;try{s==="widget"?Xe(a[0],a[1]):s==="nodeEditor"?Pn(a[0],a[1]):s==="canvasOverlay"&&Oa(a[0],a[1])}catch{}}for(const r of o)try{r()}catch{}}const Pz=1280;FN(),Mz(),Lz();async function Oz(e){if(typeof fetch!="function")return[];try{const t=await fetch(en(`/api/admin/templates/${encodeURIComponent(e)}/editor/permission-candidates`,"json"),{credentials:"same-origin",headers:je()});if(!t.ok)return[];const o=(await t.json().catch(()=>null))?.data?.permissions;if(!Array.isArray(o))return[];const r=[];for(const s of o)if(s&&typeof s=="object"){const a=s.key,l=s.name;typeof a=="string"&&a.length>0&&r.push({value:a,label:typeof l=="string"&&l?l:a})}return r}catch{return[]}}function Bz({templateIdentifier:e}){cD({templateIdentifier:e}),uD(e);const{state:t,dispatch:n}=Je(),{t:o}=tt(),r=yo(),s=wp(),a=bD(),l=t.selectedRoute?.layoutName??null,d=xD(e,l),c=t.editMode==="extension",p=u.useMemo(()=>c?vD(a):s,[c,a,s]),[f,y]=u.useState(null),[g,m]=u.useState(null),[h,v]=u.useState([]),[b,x]=u.useState("user"),[k,w]=u.useState(null),[_,S]=u.useState(null),[E,C]=u.useState([]);u.useEffect(()=>{let te=!1;return(async()=>{try{const he=await fetch(en(`/api/templates/${encodeURIComponent(e)}/components`,"json"),{credentials:"same-origin",headers:{Accept:"application/json"}});if(!he.ok)return;const Q=await he.json().catch(()=>null);!te&&Q&&typeof Q=="object"&&y(Q)}catch{}})(),()=>{te=!0}},[e]),u.useEffect(()=>{let te=!1;return(async()=>{const{spec:he,sampleGlobalSources:Q}=await Zy({templateIdentifier:e,coreSeed:wD()});te||(m(he),v(Q),jz(e,he,Q))})(),()=>{te=!0}},[e]),u.useEffect(()=>{let te=!1;return(async()=>{if(typeof fetch=="function")try{const he=await fetch(`/api/admin/templates/${encodeURIComponent(e)}`,{credentials:"same-origin",headers:je()});if(!he.ok)return;const ie=(await he.json().catch(()=>null))?.data,_e=ie?.type;te||((_e==="admin"||_e==="user")&&x(_e),typeof ie?.name=="string"&&ie.name&&w(ie.name),typeof ie?.version=="string"&&ie.version&&S(ie.version))}catch{}})(),()=>{te=!0}},[e]),u.useEffect(()=>{let te=!1;return(async()=>{if(typeof fetch=="function")try{const he=await fetch("/api/admin/templates/?per_page=100&page=1",{credentials:"same-origin",headers:je()});if(!he.ok)return;const ie=(await he.json().catch(()=>null))?.data?.data;if(!te&&Array.isArray(ie)){const _e=[];for(const ge of ie){if(!ge||typeof ge!="object")continue;const Ae=ge.identifier;if(typeof Ae!="string"||!Ae||ge.is_pending===!0)continue;const Le=ge.type==="admin"?"admin":"user",q=ge.name,ae=ge.version;_e.push({identifier:Ae,name:typeof q=="string"?q:Ae,version:typeof ae=="string"?ae:"",type:Le})}C(_e)}}catch{}})(),()=>{te=!0}},[e]);const N=g?.nesting??null,$=t.selectedRoute?.path??null,A=t.editMode,z=t.selectedRoute?.layoutName??(c?a.document?.hostLayoutName??null:null),D=t.routeTree,O=u.useMemo(()=>{if(A!=="extension"||!z)return null;const te=bl(D,z);return te||`__base__/${z}`},[A,z,D]),M=c&&t.returnRoute===null&&!!z;u.useEffect(()=>{if(!M||!z)return;const te=bl(D,z);te&&n({type:"SET_RETURN_ROUTE",route:{path:te,layoutName:z}})},[M,z,D,n]),u.useEffect(()=>{const te=K4(A,$,O),he=V4(g?.states?.groups,te);n({type:"SET_AVAILABLE_STATES",states:he,activeStateId:U4(he)})},[g,A,$,O,n]);const[B,T]=u.useState([]);u.useEffect(()=>{let te=!1;return(async()=>{const he=await Oz(e);te||T(he)})(),()=>{te=!0}},[e]),pD(),fD();const H=u.useCallback(te=>{const he=t.routeTree,Q=te.split("?")[0]?.split("#")[0]??te;return Wz(he,Q)?"route_in_tree":"route_not_in_tree"},[t.routeTree]),L=u.useCallback(te=>{const he=te.split("?")[0]?.split("#")[0]??te,Q=yl(t.routeTree,he);Q&&(p.isDirty&&!(!(typeof window<"u")||window.confirm(o("layout_editor.chrome.dirty_guard.message")))||n({type:"SELECT_ROUTE",route:{path:Q.path,layoutName:Q.layoutName}}))},[t.routeTree,p.isDirty,n]),I=u.useRef([]),P=u.useCallback(te=>{I.current=te},[]),[F,G]=u.useState(null),V=u.useCallback(()=>G(null),[]),Y=u.useRef(null),Z=u.useRef(null);u.useEffect(()=>{const te=Z.current,he=Y.current;if(!te||!he||typeof ResizeObserver>"u")return;const Q=()=>{he.style.setProperty("--g7le-header-h",`${Math.round(te.getBoundingClientRect().height)}px`)};Q();const ie=new ResizeObserver(Q);return ie.observe(te),()=>ie.disconnect()},[]);const se=u.useCallback(()=>{p.reload()},[p]),re=u.useCallback(()=>{p.isDirty&&!(!(typeof window<"u")||window.confirm(o("layout_editor.chrome.dirty_guard.message")))||window.G7Core?.dispatch?.({handler:"openWindow",params:{path:`/admin/templates/${b}`,target:"_self"}})},[p.isDirty,o,b]),U=u.useCallback(te=>{if(!te||te===e||p.isDirty&&!(typeof window<"u"?window.confirm(o("layout_editor.chrome.dirty_guard.message")):!0))return;const he=Zs(te);window.G7Core?.dispatch?.({handler:"openWindow",params:{path:he,target:"_self"}})},[e,p.isDirty,o]),ee=u.useCallback(()=>{const te=TE(e,t.selectedRoute?.path??null);window.G7Core?.dispatch?.({handler:"openWindow",params:{path:te}})},[e,t.selectedRoute]),fe=u.useCallback(()=>{const te=t.selectedRoute?.layoutName??"";if(!te)return;const he=r.open({ariaLabel:o("layout_editor.attachment_manager.title"),width:720,maxHeightRatio:.82,content:u.createElement(Ml,{templateIdentifier:e,layoutName:te,t:o,onClose:()=>r.close(he)})})},[r,e,t.selectedRoute,o]),K=u.useCallback(()=>{const te=t.selectedRoute?.layoutName??"";if(!te)return;const he=By(s.document?.raw??{}),Q=r.open({ariaLabel:o("layout_editor.translation_manager.title"),width:720,maxHeightRatio:.82,content:u.createElement(sm,{templateIdentifier:e,layoutName:te,t:o,referencedKeys:he,onClose:()=>r.close(Q)})})},[r,e,t.selectedRoute,o,s.document]),ne=u.useCallback((te,he)=>{const Q=window.G7Core;if(Q&&typeof Q.t=="function"){const ie=Q.t(te,he);if(ie&&ie!==te&&!ie.startsWith("$t:"))return ie}return o(te,he)},[o]),me=u.useCallback(()=>{if(!t.selectedRoute||t.editMode==="extension"||t.editMode==="iteration_item")return;const te=r.open({ariaLabel:o("layout_editor.page_settings.title",{name:t.selectedRoute.path??""}),width:1080,maxHeightRatio:.88,closeOnEscape:!1,content:u.createElement(l$,{templateIdentifier:e,spec:g,t:o,resolveLabel:ne,permissionCandidates:B,onClose:()=>r.close(te)})})},[r,t.selectedRoute,t.editMode,o,ne,e,g,B]),Ce=u.useCallback(async()=>{const te=await d.createPreview(s.document?.raw??null);if(te.kind!=="success"){const he=te.kind==="network_error"?te.message:o("layout_editor.preview_action.no_document");typeof window<"u"&&window.alert(he)}},[d,s.document,o]),ze=u.useCallback(()=>{const te=t.selectedRoute?.layoutName??"",he=t.selectedRoute?.path??"",Q=t.editMode==="extension"&&he.startsWith("__extension__/")?he.slice(14):null,ie=Q?{kind:"extension",extensionId:Q}:te?{kind:"layout",layoutName:te}:null;if(!ie)return;const _e=r.open({ariaLabel:o("layout_editor.version_history.title"),width:640,maxHeightRatio:.82,content:u.createElement(q$,{templateIdentifier:e,target:ie,t:o,onRestored:async ge=>{typeof ge=="number"&&(ie.kind==="extension"?n({type:"SET_EXTENSION_VERSION",extensionId:ie.extensionId,version:ge}):n({type:"SET_LAYOUT_VERSION",layoutName:ie.layoutName,version:ge})),await p.reload()},onClose:()=>r.close(_e)})})},[r,e,t.selectedRoute,t.editMode,o,p,n]),Se=p.dirtyKeys.size>0||p.isDirty;u.useEffect(()=>{if(!Se)return;const te=he=>{he.preventDefault(),he.returnValue=""};return window.addEventListener("beforeunload",te),()=>window.removeEventListener("beforeunload",te)},[Se]);const qe=u.useCallback(()=>{!p.isDirty||!(!(typeof window<"u")||window.confirm(o("layout_editor.chrome.reset_guard.message")))||p.reload()},[p,o]),De=u.useCallback(async()=>{const te=await p.save({sessionAddedPaths:I.current});G(te),te.kind==="success"&&typeof te.newContentVersion=="number"&&(te.savedExtensionId?n({type:"SET_EXTENSION_VERSION",extensionId:te.savedExtensionId,version:te.newContentVersion}):te.savedLayoutName&&n({type:"SET_LAYOUT_VERSION",layoutName:te.savedLayoutName,version:te.newContentVersion}))},[p,n]),Pe=u.useCallback(()=>{const te=r.open({ariaLabel:o("layout_editor.shortcuts.title"),width:560,maxHeightRatio:.85,content:u.createElement(tE,{t:o,onClose:()=>r.close(te)})})},[r,o]),Qe=u.useMemo(()=>({save:()=>{De()},exit:re,editCode:ee,reset:qe,translations:K,addElement:()=>{t.selectedRoute&&n({type:"TOGGLE_PALETTE"})},help:Pe,preview:()=>{t.selectedRoute?.layoutName&&Ce()}}),[De,re,ee,qe,K,t.selectedRoute,n,Pe,Ce]),[Me,Re]=u.useState(!1);u.useEffect(()=>{const te=window.setInterval(()=>{Re(!!window.__g7LayoutEditorHasSelection)},200);return()=>window.clearInterval(te)},[]),Ru({handlers:Qe,hasSelection:Me});const ve=p;return t.routesError?i.jsx("div",{className:"g7le-chrome g7le-chrome--routes-error","data-testid":"g7le-chrome-routes-error",style:{position:"fixed",inset:0,display:"flex",background:"#f8fafc",color:"#0f172a",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif',fontSize:13,lineHeight:1.5,zIndex:9e3},children:i.jsx(Fa,{error:t.routesError})}):i.jsx("div",{className:"g7le-chrome","data-testid":"g7le-chrome",ref:Y,style:{position:"static",minHeight:"100vh",minWidth:Pz,background:"#f8fafc",color:"#0f172a",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif',fontSize:13,lineHeight:1.5,zIndex:9e3},children:i.jsxs(sy,{value:ve,children:[c&&a.needsHostPicker&&a.document&&i.jsx(_D,{hostLayouts:a.document.hostLayouts,extensionLabel:null,onSelect:a.selectHost}),i.jsxs("div",{className:"g7le-chrome__header","data-testid":"g7le-chrome-header",ref:Z,style:{position:"sticky",top:0,zIndex:20,background:"#f8fafc"},children:[i.jsx(gy,{onSave:()=>{De()},isDirty:p.isDirty,onExit:re,onEditCode:ee,onManageImages:fe,onManageTranslations:K,onPageSettings:me,onReset:qe,onShowShortcuts:Pe,onPreview:Ce,onShowVersions:ze,templateName:k,templateVersion:_,templateList:E,onSwitchTemplate:U}),i.jsx(bE,{result:F,onDismiss:V,onLoadLatest:se}),i.jsxs("div",{className:"g7le-chrome__device-toolbar","data-testid":"g7le-chrome-device-toolbar",style:{display:"flex",justifyContent:"center",padding:"6px 12px",background:"#f1f5f9",borderBottom:"1px solid #e2e8f0"},children:[i.jsx(H4,{}),i.jsx(F4,{})]})]}),i.jsxs("div",{className:"g7le-chrome__body",style:{display:"grid",gridTemplateColumns:"auto 1fr",alignItems:"stretch"},children:[i.jsx(OE,{}),i.jsx(P4,{manifest:f,nesting:N,componentPalette:g?.componentPalette??null,spec:g,permissionCandidates:B,sampleGlobalSources:h,resolveRouteMatch:H,onNavigateToDestination:L,onSessionAddedPathsChange:P})]}),i.jsx(dy,{})]})})}function yl(e,t){for(const n of e){if(n.kind==="route"&&n.path===t)return n;if(n.children&&n.children.length>0){const o=yl(n.children,t);if(o)return o}}return null}function Wz(e,t){return yl(e,t)!==null}function bl(e,t){for(const n of e){if(n.kind==="route"&&n.layoutName===t&&typeof n.path=="string")return n.path;if(n.children&&n.children.length>0){const o=bl(n.children,t);if(o)return o}}return null}function jz(e,t,n){const o=[];Va({sources:n,isGuestOnly:!1,warn:s=>{const a=/extension '([^']+)' override of core key '([^']+)'/.exec(s);a&&o.push(`${a[1]}:${a[2]}`)}});const r=t?.sampleData?.byDataSourceId?Object.keys(t.sampleData.byDataSourceId).length:0;Xh({templateIdentifier:e,mergedSources:[...n.map(s=>({kind:s.kind,id:s.id}))],blockCounts:{controls:t?.controls?Object.keys(t.controls).length:0,componentCapabilities:t?.componentCapabilities?Object.keys(t.componentCapabilities).length:0,actionRecipes:t?.actionRecipes?Object.keys(t.actionRecipes).length:0,conditionRecipes:t?.conditionRecipes?Object.keys(t.conditionRecipes).length:0,paletteGroups:t?.componentPalette?.groups?.length??0,stateGroups:t?.states?.groups?.length??0,sampleDataIds:r},sampleGlobalSourceCount:n.length,sampleGlobalConflicts:o,timestamp:Date.now()})}function Mh({templateIdentifier:e,initialLocale:t}){return u.useEffect(()=>()=>{Hh(),Kh(),Uh(),qh(),Gh(),Yh(),Jh(),Zh(),Qh()},[]),i.jsx(iy,{templateIdentifier:e,initialLocale:t,children:i.jsx(ly,{children:i.jsx(Bz,{templateIdentifier:e})})})}if(typeof window<"u"){const e=window.G7Core||(window.G7Core={});if(e.__LayoutEditorChrome=Mh,typeof e.__onChromeReady=="function")try{e.__onChromeReady()}catch{}}dn.LayoutEditorChrome=Mh,Object.defineProperty(dn,Symbol.toStringTag,{value:"Module"})})(this.G7LayoutEditor=this.G7LayoutEditor||{},ReactJSXRuntime,React,ReactDOM); +//# sourceMappingURL=layout-editor.min.js.map diff --git a/public/build/core/template-engine.min.js b/public/build/core/template-engine.min.js index b3fe992f..08642004 100644 --- a/public/build/core/template-engine.min.js +++ b/public/build/core/template-engine.min.js @@ -241,3 +241,4 @@ Error generating stack: `+c.message+` } } `)(a)}catch(r){B.warn(`Expression evaluation failed: ${e}`,r);return}}async executeInitActions(e,a={}){const{getActionDispatcher:r}=await Promise.resolve().then(()=>za),i=r();if(!i){B.warn("ActionDispatcher not available for init_actions");return}B.log("Executing init_actions:",e.map(d=>d.handler)),B.log("Init actions dataContext:",a),B.log("Init actions dataContext._global:",a._global);const l=e.map(d=>d.handler).filter(d=>d.includes("."));l.length>0&&await this.waitForHandlers(i,l);let u={...a};for(const d of e)try{const f={type:"click",handler:d.handler,target:d.target,params:d.params,resultTo:d.resultTo,onSuccess:d.onSuccess,onError:d.onError,if:d.if,conditions:d.conditions,auth_mode:d.auth_mode,auth_required:d.auth_required},g=i.createHandler(f,u),m=new Event("init");await g(m),B.log(`Init action executed: ${d.handler}`);const b=this.globalState;u={...u,_global:{...b},_local:b._local||u._local||{}},B.log(`Data context refreshed after ${d.handler}:`,{cartKey:u._global?.cartKey})}catch(f){B.error(`Failed to execute init action: ${d.handler}`,f)}}async waitForHandlers(e,a,r=5e3){const i=Date.now(),l=50,u=()=>a.every(f=>e.customHandlers?.has(f));if(u()){B.log("All module handlers already registered");return}const d=uf().getFailedJsAssets();if(d.length>0){const f=d.some(b=>b==="module"||b==="plugin"),g=a.filter(b=>!e.customHandlers?.has(b)),m=g.length>0&&g.every(b=>d.some(v=>b.startsWith(`${v}.`)));if(f||m){B.warn("Extension asset load failed — not waiting for handlers that will never register:",{pending:g,failedAssets:d});return}}return B.log("Waiting for module handlers:",a),new Promise(f=>{const g=()=>{if(u()){B.log("All module handlers now registered"),f();return}if(Date.now()-i>=r){const m=a.filter(b=>!e.customHandlers?.has(b));B.warn("Timeout waiting for handlers:",m),f();return}setTimeout(g,l)};g()})}};$(Ca,"LOCALE_STORAGE_KEY","g7_locale"),$(Ca,"CACHE_VERSION_STORAGE_KEY","g7_cache_version");let vo=Ca;function ff(o){const e=new vo(o);return o.websocket&&(fc.configure(o.websocket),B.log("WebSocket 설정 완료")),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{e.init(),window.__templateApp=e}):(e.init(),window.__templateApp=e),e}typeof window<"u"&&(window.G7Core=window.G7Core||{},window.G7Core.initTemplateApp=ff,window.G7Core.dataSource={refetch:async(o,e)=>{const a=window.__templateApp;if(!a){B.warn("TemplateApp not initialized (G7Core.dataSource.refetch)");return}return a.refetchDataSource(o,e)},get:o=>{const e=window.__templateApp;if(!e){B.warn("TemplateApp not initialized (G7Core.dataSource.get)");return}return e.getDataSource(o)}});function K_(o={}){const{checked:e,value:a,name:r,type:i="checkbox"}=o,u=a!==void 0?a:i==="checkbox"||i==="radio"?e??!1:String(e??""),d={checked:e??!1,value:u,name:r??"",type:i};return{target:d,currentTarget:d,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("change"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"change",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{}}}function W_(o={}){const{button:e=0,clientX:a=0,clientY:r=0}=o;return{button:e,clientX:a,clientY:r,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new MouseEvent("click"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"click",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div")}}function Y_(){return{preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("submit"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"submit",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("form"),currentTarget:document.createElement("form")}}function X_(o,e="keydown"){return{key:o,code:o.length===1?`Key${o.toUpperCase()}`:o,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new KeyboardEvent(e,{key:o}),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:e,isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div"),altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,repeat:!1}}const J_={justify:/^justify-(start|end|center|between|around|evenly)$/,items:/^items-(start|end|center|baseline|stretch)$/,content:/^content-(start|end|center|between|around|evenly|stretch)$/,self:/^self-(auto|start|end|center|stretch|baseline)$/,flex:/^flex-(row|row-reverse|col|col-reverse|wrap|wrap-reverse|nowrap|1|auto|initial|none)$/,grow:/^(grow|grow-0)$/,shrink:/^(shrink|shrink-0)$/,basis:/^basis-/,order:/^(order-|-)order-/,gap:/^gap(-x|-y)?-/,gridCols:/^grid-cols-/,gridRows:/^grid-rows-/,colSpan:/^col-(span-|start-|end-)/,rowSpan:/^row-(span-|start-|end-)/,display:/^(block|inline-block|inline|flex|inline-flex|table|inline-table|table-caption|table-cell|table-column|table-column-group|table-footer-group|table-header-group|table-row-group|table-row|flow-root|grid|inline-grid|contents|list-item|hidden)$/,position:/^(static|fixed|absolute|relative|sticky)$/,inset:/^(inset|top|right|bottom|left)-/,zIndex:/^z-/,width:/^w-/,minWidth:/^min-w-/,maxWidth:/^max-w-/,height:/^h-/,minHeight:/^min-h-/,maxHeight:/^max-h-/,padding:/^p[xytblr]?-/,margin:/^-?m[xytblr]?-/,space:/^space-(x|y)-/,fontSize:/^text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/,fontWeight:/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/,fontStyle:/^(italic|not-italic)$/,fontFamily:/^font-(sans|serif|mono)/,textAlign:/^text-(left|center|right|justify|start|end)$/,textColor:/^text-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,textDecoration:/^(underline|overline|line-through|no-underline)$/,textTransform:/^(uppercase|lowercase|capitalize|normal-case)$/,lineHeight:/^leading-/,letterSpacing:/^tracking-/,textOverflow:/^(truncate|text-ellipsis|text-clip)$/,whitespace:/^whitespace-/,wordBreak:/^break-/,bgColor:/^bg-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,bgGradient:/^bg-gradient-/,bgSize:/^bg-(auto|cover|contain)$/,bgPosition:/^bg-(bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)$/,bgRepeat:/^bg-(repeat|no-repeat|repeat-x|repeat-y|repeat-round|repeat-space)$/,bgAttachment:/^bg-(fixed|local|scroll)$/,bgClip:/^bg-clip-/,bgOrigin:/^bg-origin-/,borderWidth:/^border(-[xytblr])?(-0|-2|-4|-8)?$/,borderColor:/^border-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,borderStyle:/^border-(solid|dashed|dotted|double|hidden|none)$/,borderRadius:/^rounded(-[tblrse]{1,2})?(-none|-sm|-md|-lg|-xl|-2xl|-3xl|-full)?$/,ringWidth:/^ring(-0|-1|-2|-4|-8|-inset)?$/,ringColor:/^ring-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,ringOffset:/^ring-offset-/,shadow:/^shadow(-sm|-md|-lg|-xl|-2xl|-inner|-none)?$/,opacity:/^opacity-/,mixBlend:/^mix-blend-/,bgBlend:/^bg-blend-/,blur:/^blur(-none|-sm|-md|-lg|-xl|-2xl|-3xl)?$/,brightness:/^brightness-/,contrast:/^contrast-/,grayscale:/^grayscale(-0)?$/,hueRotate:/^-?hue-rotate-/,invert:/^invert(-0)?$/,saturate:/^saturate-/,sepia:/^sepia(-0)?$/,backdropBlur:/^backdrop-blur-/,backdropBrightness:/^backdrop-brightness-/,backdropContrast:/^backdrop-contrast-/,backdropGrayscale:/^backdrop-grayscale-/,backdropHueRotate:/^backdrop-hue-rotate-/,backdropInvert:/^backdrop-invert-/,backdropOpacity:/^backdrop-opacity-/,backdropSaturate:/^backdrop-saturate-/,backdropSepia:/^backdrop-sepia-/,scale:/^scale(-x|-y)?-/,rotate:/^-?rotate-/,translate:/^-?translate-[xy]-/,skew:/^-?skew-[xy]-/,transformOrigin:/^origin-/,transition:/^transition(-none|-all|-colors|-opacity|-shadow|-transform)?$/,duration:/^duration-/,ease:/^ease-(linear|in|out|in-out)$/,delay:/^delay-/,animate:/^animate-/,cursor:/^cursor-/,userSelect:/^select-/,pointerEvents:/^pointer-events-/,resize:/^resize(-none|-x|-y)?$/,scrollBehavior:/^scroll-(auto|smooth)$/,touchAction:/^touch-/,overflow:/^overflow(-x|-y)?-(auto|hidden|clip|visible|scroll)$/,overscroll:/^overscroll(-x|-y)?-(auto|contain|none)$/,visibility:/^(visible|invisible|collapse)$/,aspectRatio:/^aspect-/,columns:/^columns-/,breakAfter:/^break-after-/,breakBefore:/^break-before-/,breakInside:/^break-inside-/,boxDecorationBreak:/^box-decoration-/,boxSizing:/^box-(border|content)$/,float:/^float-(right|left|none)$/,clear:/^clear-(left|right|both|none)$/,isolation:/^(isolate|isolation-auto)$/,objectFit:/^object-(contain|cover|fill|none|scale-down)$/,objectPosition:/^object-/};function oy(o){const e=o.replace(/^(dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+/,"");for(const[a,r]of Object.entries(J_))if(r.test(e))return a;return null}function ly(o){const e=o.match(/^((dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+)/);return e?e[1]:""}function Q_(o,e){if(!e||e.trim()==="")return o;if(!o||o.trim()==="")return e;const a=o.split(/\s+/).filter(Boolean),r=e.split(/\s+/).filter(Boolean),i=new Map;for(const u of r){const d=oy(u);if(d){const f=ly(u),g=`${d}:${f}`;i.set(g,u)}}return[...a.filter(u=>{const d=oy(u);if(!d)return!0;const f=ly(u),g=`${d}:${f}`;return!i.has(g)}),...r].join(" ")}function Z_(o){return Object.entries(o).filter(([,e])=>e).map(([e])=>e).join(" ")}function eA(...o){return o.filter(e=>typeof e=="string"&&e.length>0).join(" ")}const we=ct("G7CoreGlobals");function tA(){window.React=Ye,window.ReactDOM={...Ju,createPortal:Ar.createPortal,unstable_batchedUpdates:o=>o()},window.ReactJSXRuntime=J0,we.log("전역 객체 window.React, window.ReactDOM, window.ReactJSXRuntime에 노출됨")}function nA(o){const e=new Map,a=Tr.getInstance();o.componentEvent={on:(r,i)=>(e.has(r)||e.set(r,new Set),e.get(r).add(i),a.trackEventSubscribe(r),()=>{e.get(r)?.delete(i),a.trackEventUnsubscribe(r)}),emit:async(r,i)=>{const l=e.get(r),u=l?.size??0;if(!l||l.size===0)return a.trackEventEmit(r,i,0),[];let d,f=[];try{f=await Promise.all(Array.from(l).map(async g=>{try{return await g(i)}catch(m){throw we.error(`componentEvent: Error in listener for "${r}":`,m),m}}))}catch(g){d=g instanceof Error?g:new Error(String(g))}if(a.trackEventEmit(r,i,u,f,d),d)throw d;return f},off:r=>{e.delete(r),a.trackEventOff(r)},clear:()=>{e.clear(),a.trackEventClear()}},we.log("전역 객체 window.G7Core.componentEvent에 노출됨")}function aA(o){o.__runtime||(o.__runtime={DynamicRenderer:Ha,ComponentRegistry:da,TranslationEngine:Cr,DataSourceManager:va,dataSourceManager:I_,DataBindingEngine:wn,dataBindingEngine:XS,ActionDispatcher:oo,TranslationReactContext:tf,TranslationProvider:cc,useTranslation:Fm,ResponsiveContext:Ld,ResponsiveProvider:Xl,useResponsive:Md,responsiveManager:ci,BREAKPOINT_PRESETS:kl,AuthManager:ha,createLogger:ct,G7DevToolsCore:Tr},we.log("전역 객체 window.G7Core.__runtime(코어 런타임 표면)에 노출됨"))}function rA(o){if(o.layoutEditor&&o.layoutEditor.__isStub!==!0||o.layoutEditor&&o.layoutEditor.__isStub===!0)return;const e=[],a=[];o.layoutEditor={__isStub:!0,__queue:e,__readyCallbacks:a,registerWidget:(r,i)=>e.push(["widget",r,i]),registerNodeEditor:(r,i)=>e.push(["nodeEditor",r,i]),registerCanvasOverlay:(r,i)=>e.push(["canvasOverlay",r,i]),onReady:r=>{typeof r=="function"&&a.push(r)}},we.log("전역 객체 window.G7Core.layoutEditor 예약 접수함(stub) 노출됨")}function iA(o,e){o.useTranslation=Fm,o.t=(a,r)=>{const i=e.getState();if(!i.translationEngine||!i.translationContext)return a;if(r){const l="|"+Object.entries(r).map(([u,d])=>`${u}=${d}`).join("|");return i.translationEngine.translate(a,i.translationContext,l)}return i.translationEngine.translate(a,i.translationContext)},we.log("전역 객체 window.G7Core.useTranslation에 노출됨")}function sA(o,e){o.createChangeEvent=K_,o.createClickEvent=W_,o.createSubmitEvent=Y_,o.createKeyboardEvent=X_,o.uuid=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)}),o.createLogger=ct,we.log("전역 객체 window.G7Core.createLogger에 노출됨"),o.renderItemChildren=(a,r,i,l,u)=>{const d=e.getState(),m={_global:window.__templateApp?.getGlobalState?.()||{},_local:r._local||{},_computed:r._computed||{},...r},b=new Set,v=(E,A)=>{const T=m._global?._remountKeys;return E&&T?.[E]&&!b.has(E)?(b.add(E),`${E}-remount-${T[E]}`):E||A},S={translationContext:d.translationContext,translationEngine:d.translationEngine,bindingEngine:d.bindingEngine,actionDispatcher:d.actionDispatcher,getRemountKey:v,...u};return Qs(a,m,i,l,S)},o.getComponentMap=()=>da.getInstance().getComponentMap(),o.renderComponentLayout=(a,r,i)=>{if(!a||!Array.isArray(a)||a.length===0)return null;const l=da.getInstance().getComponentMap(),u=e.getState(),f=window.__templateApp?.getGlobalState?.()||{},g={_global:f._global||{},_local:f._local||{},_computed:f._computed||{},...r},m=new Set,b=(v,S)=>{const E=g._global?._remountKeys;return v&&E?.[v]&&!m.has(v)?(m.add(v),`${v}-remount-${E[v]}`):v||S};return Qs(a,g,l,i,{translationContext:u.translationContext,translationEngine:u.translationEngine,bindingEngine:u.bindingEngine,actionDispatcher:u.actionDispatcher,getRemountKey:b})},o.renderExpandContent=a=>{const{children:r,row:i,expandContext:l,componentContext:u,keyPrefix:d}=a;if(!r||!Array.isArray(r)||r.length===0)return null;const f=a.componentMap||da.getInstance().getComponentMap(),g=e.getState(),m=o.state?.get?.()||{},b=u?.stateRef?.current??u?.state??{},v={...m._local||{},...b},S=u?.computedRef?.current??m._computed??{},E=g.bindingEngine??o.getDataBindingEngine?.(),A={...m,_local:v,_computed:S,row:i,item:i,$item:i};let T={};if(l&&typeof l=="object"&&E)try{for(const[D,U]of Object.entries(l))if(typeof U=="string"){const j=U.match(/^\{\{([^}]+)\}\}$/);if(j){const P=j[1].trim();try{T[D]=E.evaluateExpression(P,A,{skipCache:!0})}catch{T[D]=void 0}}else T[D]=E.resolveBindings(U,A,{skipCache:!0})}else T[D]=U}catch(D){we.warn("renderExpandContent: expandContext 평가 오류:",D)}const L={row:i,item:i,$item:i,_local:v,_global:m._global||{},_computed:m._computed||{},...T},M=new Set,R=(D,U)=>{const j=L._global?._remountKeys;return D&&j?.[D]&&!M.has(D)?(M.add(D),`${D}-remount-${j[D]}`):D||U};return Qs(r,L,f,d,{translationContext:g.translationContext,translationEngine:g.translationEngine??void 0,bindingEngine:g.bindingEngine??void 0,actionDispatcher:g.actionDispatcher,componentContext:u,getRemountKey:R})},o.$get=function(r,i,l=void 0){if(r==null)return l;const u=Array.isArray(i)?i:[i];if(u.length===0)return r;let d=r;for(const f of u){if(d==null||f==null)return l;d=d[f]}return d??l},we.log("전역 객체 window.G7Core.renderItemChildren에 노출됨"),we.log("전역 객체 window.G7Core.renderComponentLayout에 노출됨"),we.log("전역 객체 window.G7Core.renderExpandContent에 노출됨"),we.log("전역 객체 window.G7Core.$get에 노출됨")}function oA(o){o.dispatch=async(e,a)=>{const r=window.__templateApp;if(!r)return we.warn("G7Core.dispatch: TemplateApp이 초기화되지 않았습니다."),{success:!1,error:new Error("TemplateApp이 초기화되지 않았습니다.")};const i=r.getActionDispatcher?.();if(!i)return we.warn("G7Core.dispatch: ActionDispatcher를 찾을 수 없습니다."),{success:!1,error:new Error("ActionDispatcher를 찾을 수 없습니다.")};const l=r.getRouter?.(),u=r.getGlobalState?.(),d=r.setGlobalState?.bind(r),g=a?.componentContext||window.__g7ActionContext,m=window.__g7PendingLocalState;let b=g?.state??u;m&&g&&(b=m,we.log("[dispatch] Using __g7PendingLocalState for context.state:",m));let v=g?.data??u;m&&g?.data?._local&&(v={...g.data,_local:m},we.log("[dispatch] Updated context.data._local with pendingLocalState"));const S={navigate:l?(E,A)=>l.navigate(E,A):void 0,setState:g?.setState??d,state:b,data:v,_isDispatchFallbackContext:!g?.setState};if(e.debounce){const E=e.debounceKey||`dispatch-${e.handler}`,A=typeof e.debounce=="number"?e.debounce:e.debounce.delay;return i.debouncedCall(E,A,()=>{const{debounce:T,debounceKey:L,...M}=e;i.dispatchAction(M,S)}),{success:!0,debounced:!0}}try{return await i.dispatchAction(e,S)}catch(E){return we.error("G7Core.dispatch: 액션 실행 오류:",E),{success:!1,error:E instanceof Error?E:new Error(String(E))}}},we.log("전역 객체 window.G7Core.dispatch에 노출됨")}function So(o){const e={};for(const[a,r]of Object.entries(o))if(a.includes(".")){const i=a.split(".");let l=e;for(let u=0;u0&&e.every(a=>/^\d+$/.test(a))}function uy(o,e){const a={...o};for(const r of Object.keys(e))r in a?a[r]!==null&&typeof a[r]=="object"&&!Array.isArray(a[r])&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])&&(a[r]=uy(a[r],e[r])):a[r]=e[r];return a}function Zn(o,e){if(Array.isArray(o)&&!Array.isArray(e)&&lA(e)){const r=Object.keys(e).map(l=>parseInt(l,10));if(!((r.length>0?Math.max(...r):0)>=o.length+r.length+10)){const l=[...o];for(const[u,d]of Object.entries(e)){const f=parseInt(u,10);f>=0&&f=l.length&&(l[f]=d)}return l}}const a={...o};for(const[r,i]of Object.entries(e))i!==null&&typeof i=="object"&&!Array.isArray(i)?a[r]!==null&&typeof a[r]=="object"?a[r]=Zn(a[r],i):a[r]={...i}:a[r]=i;return a}function cA(o){o.state={get:()=>window.__templateApp?.getGlobalState?.()||{},set:(e,a)=>{const r=window.__templateApp;if(r?.setGlobalState&&r?.getGlobalState){const i=a?.merge||"deep",l=So(e);let u;if(i==="replace")u=l;else if(i==="shallow")u={...r.getGlobalState(),...l};else{const d=r.getGlobalState();u=Zn(d,l)}r.setGlobalState(u,{render:a?.render})}else we.warn("G7Core.state.set: TemplateApp이 초기화되지 않았습니다.")},setLocal:(e,a)=>{const r=window.__templateApp;if(a?.render===!1&&!a?.selfManaged){const T=window.__g7AutoBindingPaths;T&&T.size>0&&cy(So(e)).some(M=>T.has(M))&&(we.log("[setLocal] render:false + 자동바인딩 경로 겹침 감지 → render:true 자동 승격 (engine-v1.43.0)"),a={...a,render:!0})}if(a?.debounce){const T=r?.getActionDispatcher?.();if(T){const L=a.debounceKey||`setLocal-${Object.keys(e).join(",")}`,{debounce:M,debounceKey:R,...D}=a;T.debouncedCall(L,a.debounce,()=>{o.state.setLocal(e,D)});return}}const i=a?.scope??"current",l=a?.merge||"deep",u=window.__g7ActionContext,d=So(e);if(i==="parent"||i==="root"){const T=window.__g7LayoutContextStack||[];if(T.length>0){const L=i==="parent"?T[T.length-1]:T[0];if(L?.setState){L.setState(M=>l==="replace"?d:l==="shallow"?{...M||{},...d}:Zn(M||{},d)),we.log(`[setLocal] scope=${i}: 타겟 컨텍스트에 상태 업데이트 (mergeMode=${l})`,d);return}}we.warn(`[setLocal] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const f=window.__g7PendingLocalState,g=r?.getGlobalState?.()?._local||{},v=!((window.__g7LayoutContextStack||[]).length>0)&&u?.state?u.state:void 0,S=v?uy(g,v):g,E=f||S;let A;if(l==="replace"?A=d:l==="shallow"?A={...E,...d}:A=Zn(E,d),r?.setGlobalState&&(r.setGlobalState({_local:A},{render:a?.render}),we.log(`[setLocal] globalLocal updated via setGlobalState (mergeMode=${l}, render=${a?.render??!0}):`,d)),window.__g7PendingLocalState=A,we.log("[setLocal] __g7PendingLocalState updated:",A),window.__g7SequenceLocalSync=A,window.__g7LastSetLocalSnapshot=A,l==="replace")window.__g7ForcedLocalFields=d;else{const T=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Zn(T,d)}if(we.log("[setLocal] __g7ForcedLocalFields updated:",d),l==="replace")window.__g7SetLocalOverrideKeys=d;else{const T=window.__g7SetLocalOverrideKeys||{};window.__g7SetLocalOverrideKeys=Zn(T,d)}we.log("[setLocal] __g7SetLocalOverrideKeys updated:",d),u?.setState&&u.setState(T=>l==="replace"?d:l==="shallow"?{...T||{},...d}:Zn(T||{},d)),r?.setGlobalState||we.warn("G7Core.state.setLocal: TemplateApp이 없습니다.")},getLocal:()=>{const r=(window.__templateApp?.getGlobalState?.()||{})._local||{},i=window.__g7PendingLocalState;if(i)return Zn(r,i);const l=window.__g7LastSetLocalSnapshot;return l&&l!==r?Zn(r,l):r},update:e=>{const a=window.__templateApp;if(a?.getGlobalState&&a?.setGlobalState){const r=a.getGlobalState(),i=e(r);a.setGlobalState(i)}else we.warn("G7Core.state.update: TemplateApp이 초기화되지 않았습니다.")},subscribe:e=>{const a=window.__templateApp;return a?.onGlobalStateChange?a.onGlobalStateChange(e):(we.warn("G7Core.state.subscribe: TemplateApp이 초기화되지 않았습니다."),()=>{})},getDataSource:e=>window.__templateApp?.getDataSource?.(e),getIsolated:e=>e?window.__g7IsolatedStates?.[e]?.state??null:window.__g7ActionContext?.isolatedContext?.state??null,setIsolated:(e,a,r)=>{let i,l,u;typeof e=="string"?(i=e,l=a||{},u=r):(l=e,u=a&&typeof a=="object"&&"merge"in a?a:r);const d=u?.merge||"deep",f=So(l);if(i){const b=window.__g7IsolatedStates?.[i];b?.mergeState?b.mergeState(f,d):we.warn(`G7Core.state.setIsolated: scopeId '${i}'를 찾을 수 없습니다.`);return}const g=window.__g7ActionContext;g?.isolatedContext?.mergeState?g.isolatedContext.mergeState(f,d):we.warn("G7Core.state.setIsolated: 액션 컨텍스트에 isolatedContext가 없습니다.")},getParent:()=>{const e=window.__g7LayoutContextStack||[];if(e.length===0)return we.log("[getParent] 레이아웃 컨텍스트 스택이 비어있습니다."),null;const a=e[e.length-1];if(!a)return null;const r=a.dataContext||{};return{_local:a.state||r._local||{},_global:r._global||o.state.get()||{},setState:a.setState}},setParentLocal:(e,a,r)=>{const i=window.__g7LayoutContextStack||[];if(i.length===0){we.warn("[setParentLocal] 레이아웃 컨텍스트 스택이 비어있습니다.");return}const l=i[i.length-1];if(!l?.setState){we.warn("[setParentLocal] 부모 컨텍스트에 setState가 없습니다.");return}let u,d;typeof e=="string"?(u={[e]:a},d=r):(u=e,d=a&&typeof a=="object"&&"merge"in a?a:r);const f=d?.merge||"deep",g=So(u),m=l.state?._local!==void 0,b=m?l.state._local:l.state||{};let v;f==="replace"?v=g:f==="shallow"?v={...b,...g}:v=Zn(b,g),window.__g7PendingLocalState=v;const S=window.__templateApp;if(S?.setGlobalState&&S.setGlobalState({_local:v}),l.setState(v),m?l.state._local=v:l.state=v,l.dataContext&&(l.dataContext._local=v),f==="replace")window.__g7ForcedLocalFields=g;else{const E=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Zn(E,g)}kd()},setParentGlobal:(e,a)=>{let r;typeof e=="string"?r={[e]:a}:r=e,o.state.set(r),we.log("[setParentGlobal] 전역 상태 업데이트:",r)}},window.__g7IsolatedStates||(window.__g7IsolatedStates={}),o.state.getGlobal=o.state.get,o.state.setGlobal=o.state.set,we.log("전역 객체 window.G7Core.state에 노출됨")}function uA(o){o.dataSource={get:e=>window.__templateApp?.getDataSource?.(e),set:(e,a,r)=>{const i=window.__templateApp;i?.setDataSource?i.setDataSource(e,a,r):we.warn("G7Core.dataSource.set: TemplateApp이 초기화되지 않았습니다.")},refetch:async(e,a)=>{const r=window.__templateApp;if(r?.refetchDataSource)return r.refetchDataSource(e,a);we.warn("G7Core.dataSource.refetch: TemplateApp이 초기화되지 않았습니다.")},updateItem:(e,a,r,i,l)=>{const u=window.__templateApp;return u?.updateDataSourceItem?u.updateDataSourceItem(e,a,r,i,l):(we.warn("G7Core.dataSource.updateItem: TemplateApp이 초기화되지 않았습니다."),!1)},updateData:(e,a,r,i="append")=>{const l=window.__templateApp;if(!l?.getDataSource||!l?.setDataSource)return we.warn("G7Core.dataSource.updateData: TemplateApp이 초기화되지 않았습니다."),!1;const u=l.getDataSource(e);if(!u)return we.warn(`G7Core.dataSource.updateData: 데이터 소스 '${e}'를 찾을 수 없습니다.`),!1;let d,f=u,g=null;if(a){const b=a.split(".");g=b.pop();for(const v of b)if(f&&typeof f=="object"&&v in f)f=f[v];else return we.warn(`G7Core.dataSource.updateData: 경로 '${a}'를 찾을 수 없습니다.`),!1;d=f[g]}else d=u;if(!Array.isArray(d))return we.warn("G7Core.dataSource.updateData: 대상 경로의 데이터가 배열이 아닙니다."),!1;if(!Array.isArray(r))return we.warn("G7Core.dataSource.updateData: newData가 배열이 아닙니다."),!1;const m=i==="prepend"?[...r,...d]:[...d,...r];return a&&g?(f[g]=m,l.setDataSource(e,u,{merge:!1})):l.setDataSource(e,m,{merge:!1}),we.log(`G7Core.dataSource.updateData: '${e}'에 ${r.length}개 항목 ${i==="prepend"?"앞에":"뒤에"} 추가됨`),!0}},we.log("전역 객체 window.G7Core.dataSource에 노출됨")}function dA(o,e){o.locale={current:()=>window.__templateApp?.getLocale?.()||"ko",supported:()=>{const r=window.__templateApp?.globalState?.appConfig?.supportedLocales;return Array.isArray(r)&&r.length>0?r:e.getState().templateMetadata?.locales||["ko","en"]},change:async a=>{const r=window.__templateApp;r?.changeLocale?await r.changeLocale(a):we.warn("G7Core.locale.change: TemplateApp이 초기화되지 않았습니다.")}},we.log("전역 객체 window.G7Core.locale에 노출됨")}function fA(o){o.toast={show:(e,a)=>{o.dispatch({handler:"toast",params:{message:e,type:a?.type||"info",...a?.duration&&{duration:a.duration}}})},success:(e,a)=>{o.toast.show(e,{type:"success",duration:a})},error:(e,a)=>{o.toast.show(e,{type:"error",duration:a})},warning:(e,a)=>{o.toast.show(e,{type:"warning",duration:a})},info:(e,a)=>{o.toast.show(e,{type:"info",duration:a})}},we.log("전역 객체 window.G7Core.toast에 노출됨")}function hA(o){o.modal={open:e=>{o.dispatch({handler:"openModal",target:e})},close:e=>{o.dispatch({handler:"closeModal",...e&&{target:e}})},closeAll:()=>{o.dispatch({handler:"closeAllModals"})},isOpen:e=>{const a=o.state.get();return a._global?.activeModal===e||a._global?.modalStack?.includes(e)||!1},getStack:()=>o.state.get()._global?.modalStack||[]},we.log("전역 객체 window.G7Core.modal에 노출됨")}function gA(o){o.style={mergeClasses:Q_,conditionalClass:Z_,joinClasses:eA},we.log("전역 객체 window.G7Core.style에 노출됨")}function pA(o,e){const{webSocketManager:a}=e;o.websocket={manager:a,subscribe:(r,i,l,u)=>a.subscribe(r,i,l,u),unsubscribe:r=>a.unsubscribe(r),leaveChannel:r=>a.leaveChannel(r),disconnect:()=>a.disconnect(),isInitialized:()=>a.isInitialized(),getSubscriptionCount:()=>a.getSubscriptionCount()},we.log("전역 객체 window.G7Core.websocket에 노출됨")}function mA(o,e){const{transitionManager:a}=e;o.navigation={isPending:()=>a?.getIsPending?.()||!1,onComplete:r=>{if(!a)return r(),()=>{};let i=a.getIsPending();const l=a.subscribe(u=>{u?i=!0:i&&(r(),l())});return l}},we.log("전역 객체 window.G7Core.navigation에 노출됨")}function yA(o){o.plugin={getSettings:e=>window.G7Config?.plugins?.[e],get:(e,a,r)=>window.G7Config?.plugins?.[e]?.[a]??r,getAll:()=>window.G7Config?.plugins??{}},we.log("전역 객체 window.G7Core.plugin에 노출됨")}function bA(o){o.module={getSettings:e=>window.G7Config?.modules?.[e],get:(e,a,r)=>window.G7Config?.modules?.[e]?.[a]??r,getAll:()=>window.G7Config?.modules??{}},we.log("전역 객체 window.G7Core.module에 노출됨")}function vA(o,e){const{transitionManager:a,responsiveManager:r}=e;o.AuthManager=ha,o.api=$a(),o.TransitionManager=a,o.useTransitionState=nm,o.ResponsiveManager=r,o.useResponsive=Md,o.useControllableState=lC,o.shallowArrayEqual=cC,o.shallowObjectEqual=rm,o.updateQueryParams=async(i,l)=>{const u=window.__templateApp;if(u?.updateQueryParams)return u.updateQueryParams(i,l);we.warn("G7Core.updateQueryParams: TemplateApp이 초기화되지 않았습니다.")},we.log("전역 객체 window.G7Core.AuthManager에 노출됨"),we.log("전역 객체 window.G7Core.api에 노출됨"),we.log("전역 객체 window.G7Core.ResponsiveManager에 노출됨"),we.log("전역 객체 window.G7Core.useResponsive에 노출됨"),we.log("전역 객체 window.G7Core.useControllableState에 노출됨"),we.log("전역 객체 window.G7Core.updateQueryParams에 노출됨")}function SA(o,e){o.getSlotContext=()=>window.__slotContextValue??null,o.getDynamicRenderer=()=>window.__DynamicRenderer??null,o.getComponentRegistry=()=>e.getComponentRegistry?.()??da.getInstance(),o.getDataBindingEngine=()=>e.getDataBindingEngine?.()??e.getState().bindingEngine,o.getTranslationEngine=()=>e.getTranslationEngine?.()??e.getState().translationEngine,o.getActionDispatcher=()=>e.getActionDispatcher?.()??e.getState().actionDispatcher,we.log("전역 객체 window.G7Core 슬롯 API에 노출됨 (getSlotContext, getDynamicRenderer 등)")}function wA(o){o.identity={setLauncher:St.setLauncher.bind(St),handle:St.handle.bind(St),isIdentityRequired:St.isIdentityRequired.bind(St),hasLauncher:St.hasLauncher.bind(St),markDomainNoticeShown:St.markDomainNoticeShown.bind(St),redirectExternally:St.redirectExternally.bind(St),createDeferred:St.createDeferred.bind(St),resolveDeferred:St.resolveDeferred.bind(St),reset:St.reset.bind(St),redirectStashKey:Ed},we.log("전역 객체 window.G7Core 본인인증(IDV) API에 노출됨 (identity)")}function CA(o){if(typeof window>"u")return;tA(),window.G7Core||(window.G7Core={});const e=window.G7Core;aA(e),nA(e),rA(e),vA(e,o),iA(e,o),sA(e,o),oA(e),cA(e),uA(e),dA(e,o),fA(e),hA(e),gA(e),pA(e,o),mA(e,o),yA(e),bA(e),SA(e,o),wA(e),we.log("G7Core 전역 객체 초기화 완료")}function EA(){const o=window.G7Core;if(!o){we.warn("G7Core가 초기화되지 않았습니다.");return}const e=()=>Tr.getInstance(),a={isEnabled:()=>{try{return e().isEnabled()}catch{return!1}},trackRender:r=>{try{e().isEnabled()&&e().trackRender(r)}catch{}},trackIteration:(r,i,l,u,d)=>{try{e().isEnabled()&&e().trackIteration(r,{source:i,itemVar:l,indexVar:u,sourceLength:d})}catch{}},trackIfCondition:(r,i,l,u)=>{try{e().isEnabled()&&e().trackIfCondition(r,i,l)}catch{}},trackMount:(r,i)=>{try{e().isEnabled()&&e().trackMount(r,{...i,id:r})}catch{}},trackUnmount:r=>{try{e().isEnabled()&&e().trackUnmount(r)}catch{}},trackExpressionEval:r=>{try{e().isEnabled()&&e().trackExpressionEval(r)}catch{}},trackBindingEval:r=>{try{e().isEnabled()&&e().trackBindingEval(r)}catch{}},recordCacheHit:()=>{try{e().isEnabled()&&e().recordCacheHit()}catch{}},recordCacheMiss:()=>{try{e().isEnabled()&&e().recordCacheMiss()}catch{}},trackHandlerRegistration:(r,i,l,u)=>{try{e().isEnabled()&&e().trackHandlerRegistration(r,i,l,u)}catch{}},trackHandlerUnregistration:r=>{try{e().isEnabled()&&e().trackHandlerUnregistration(r)}catch{}},logAction:r=>{try{e().isEnabled()&&e().logAction(r)}catch{}},trackRequest:(r,i)=>{try{return e().isEnabled()?e().trackRequest(r,i):""}catch{return""}},completeRequest:(r,i,l)=>{try{e().isEnabled()&&e().completeRequest(r,i,l)}catch{}},failRequest:(r,i)=>{try{e().isEnabled()&&e().failRequest(r,i)}catch{}},trackDataSourceDefinition:r=>{try{e().isEnabled()&&e().trackDataSourceDefinition(r)}catch{}},trackDataSourceLoading:r=>{try{e().isEnabled()&&e().trackDataSourceLoading(r)}catch{}},trackDataSourceLoaded:(r,i,l)=>{try{e().isEnabled()&&e().trackDataSourceLoaded(r,i,l)}catch{}},trackDataSourceError:(r,i)=>{try{e().isEnabled()&&e().trackDataSourceError(r,i)}catch{}},trackForm:(r,i,l)=>{try{e().isEnabled()&&e().trackForm(r,i,l)}catch{}},untrackForm:r=>{try{e().isEnabled()&&e().untrackForm(r)}catch{}},startStateChange:(r,i,l,u)=>{try{return e().isEnabled()?e().startStateChange(r,i,l,u):""}catch{return""}},completeStateChange:r=>{try{e().isEnabled()&&e().completeStateChange(r)}catch{}},trackComponentRender:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().trackComponentRender(r,i,l,u,d,f)}catch{}},updateLocalState:r=>{try{e().isEnabled()&&e().updateLocalState(r)}catch{}},updateComputedState:r=>{try{e().isEnabled()&&e().updateComputedState(r)}catch{}},updateParentContext:r=>{try{e().isEnabled()&&e().updateParentContext(r)}catch{}},trackComponentStateSource:(r,i,l,u)=>{try{e().isEnabled()&&e().trackComponentStateSource(r,i,l,u)}catch{}},trackDynamicState:(r,i)=>{try{e().isEnabled()&&e().trackDynamicState(r,i)}catch{}},trackContextFlow:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().trackContextFlow(r,i,l,u,d,f)}catch{}},trackComponentStyle:(r,i,l,u)=>{try{e().isEnabled()&&e().trackComponentStyle(r,i,l,u)}catch{}},trackAuthEvent:(r,i,l,u)=>{try{e().isEnabled()&&e().trackAuthEvent(r,i,l,u)}catch{}},trackAuthHeader:(r,i,l,u,d)=>{try{e().isEnabled()&&e().trackAuthHeader(r,i,l,u,d)}catch{}},trackLog:(r,i,l)=>{try{e().isEnabled()&&e().trackLog(r,i,l)}catch{}},trackAction:r=>{try{e().isEnabled()&&e().trackAction?.(r)}catch{}},trackDataSourceUpdate:r=>{try{e().isEnabled()&&e().trackDataSourceUpdate?.(r)}catch{}},startSequenceExecution:r=>{try{return e().isEnabled()?e().startSequenceExecution(r):""}catch{return""}},captureSequenceActionBefore:(r,i,l,u,d)=>{try{e().isEnabled()&&e().captureSequenceActionBefore(r,i,l,u,d)}catch{}},captureSequenceActionAfter:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().captureSequenceActionAfter(r,i,l,u,d,f)}catch{}},endSequenceExecution:(r,i)=>{try{e().isEnabled()&&e().endSequenceExecution(r,i)}catch{}},registerStateCaptureForHandler:(r,i,l)=>{try{e().isEnabled()&&e().registerStateCaptureForHandler(r,i,l)}catch{}},detectStaleClosure:(r,i,l,u,d)=>{try{return e().isEnabled()?e().detectStaleClosure(r,i,l,u,d):[]}catch{return[]}},trackStaleClosureWarning:r=>{try{e().isEnabled()&&e().trackStaleClosureWarning(r)}catch{}},trackModalOpen:r=>{try{e().isEnabled()&&e().trackModalOpen(r)}catch{}},trackModalClose:(r,i)=>{try{e().isEnabled()&&e().trackModalClose(r,i)}catch{}},trackModalStateChange:r=>{try{e().isEnabled()&&e().trackModalStateChange(r)}catch{}},trackNestedContext:r=>{try{return e().isEnabled()?e().trackNestedContext(r):""}catch{return""}},trackNestedContextAccess:(r,i)=>{try{e().isEnabled()&&e().trackNestedContextAccess(r,i)}catch{}},trackComputedProperty:(r,i,l,u,d,f,g)=>{try{e().isEnabled()&&e().trackComputedProperty(r,i,l,u,d,f,g)}catch{}},trackComputedRecalc:(r,i,l,u,d,f,g)=>{try{e().isEnabled()&&e().trackComputedRecalc(r,i,l,u,d,f,g)}catch{}},setNamedActionDefinitions:r=>{try{e().isEnabled()&&e().setNamedActionDefinitions(r)}catch{}},trackNamedActionRef:r=>{try{e().isEnabled()&&e().trackNamedActionRef(r)}catch{}}};o.devTools=a,we.log("G7Core.devTools 인터페이스 초기화 완료")}let wo=null;function _A(){const o=window.G7Core;return o?.__devtools?Promise.resolve(o.__devtools):wo||(wo=new Promise((e,a)=>{const r=window.G7Config?.coreDevToolsAsset||"/build/core/devtools.min.js",i="g7-devtools-bundle",l=()=>{const f=window.G7Core?.__devtools;f?e(f):a(new Error("DevTools 번들 로드됨 — 그러나 __devtools 미노출"))};window.G7Core=window.G7Core||{},window.G7Core.__onDevToolsReady=l;const u=document.getElementById(i);if(u){u.addEventListener("load",l,{once:!0}),u.addEventListener("error",()=>a(new Error(`DevTools 번들 로드 실패: ${r}`)),{once:!0});return}const d=document.createElement("script");d.id=i,d.src=r,d.async=!1,d.addEventListener("load",l,{once:!0}),d.addEventListener("error",()=>{wo=null,a(new Error(`DevTools 번들 로드 실패: ${r}`))},{once:!0}),document.head.appendChild(d)}),wo)}function AA(){const o=window.G7Core;if(!o){we.warn("G7Core가 초기화되지 않았습니다.");return}const e=Tr.getInstance();if(e.initialize(),!e.isEnabled()){window.G7DevTools={isEnabled:()=>!1,enable:()=>{we.log("환경설정 > 고급 설정 > 디버그 모드를 켜세요")}},Zu(),we.log("G7DevTools 비활성화됨 (디버그 모드 꺼짐)");return}xA(o,e)}async function xA(o,e){let a;try{a=await _A()}catch(g){we.warn("DevTools 번들 로드 실패 — 최소 API 로 폴백:",g),window.G7DevTools={isEnabled:()=>!1,enable:()=>{}},Zu();return}const{DiagnosticEngine:r,getServerConnector:i,getStyleTracker:l}=a;EA(),Zu();try{l().enable(),we.log("StyleTracker 활성화됨")}catch(g){we.warn("StyleTracker 활성화 실패:",g)}const u=new r,d=i(),f={isEnabled:()=>e.isEnabled(),state:{get:()=>e.getState(),getHistory:()=>e.getStateHistory(),watch:(g,m)=>e.watchState(g,m)},actions:{getHistory:()=>e.getActionHistory(),watch:g=>e.watchActions(g),getMetrics:()=>e.getActionMetrics()},binding:{evaluate:g=>{const m=o.getDataBindingEngine?.();if(!m){we.warn("DataBindingEngine이 없습니다.");return}return m.evaluateExpression(g,e.getState())},getCacheStats:()=>e.getCacheStats(),clearStats:()=>{e.resetCacheStats(),we.log("캐시 통계 초기화됨")}},diagnose:{analyze:g=>u.analyze(g),suggestFix:g=>u.suggestFix(g),getCommonIssues:()=>u.getCommonIssues(),getRulesByCategory:g=>u.getRulesByCategory(g)},server:{dumpState:g=>d.dumpState(g),sendLog:g=>d.sendLog(g),sendError:(g,m)=>d.sendError(g,m),isConnected:()=>d.isConnected(),testConnection:()=>d.testConnection()},config:{isDebugMode:()=>e.isEnabled(),setLogLevel:g=>e.setLogLevel(g),setMaxHistory:g=>e.setMaxHistory(g)},lifecycle:{getMountedComponents:()=>e.getLifecycleInfo().mountedComponents,getOrphanedListeners:()=>e.getLifecycleInfo().orphanedListeners},performance:{getRenderCount:()=>e.getPerformanceInfo().renderCounts,getBindingEvalCount:()=>e.getPerformanceInfo().bindingEvalCount,getMemoryWarnings:()=>e.getPerformanceInfo().memoryWarnings,startProfiling:()=>e.startProfiling(),stopProfiling:()=>e.stopProfiling()},network:{getActiveRequests:()=>e.getNetworkInfo().activeRequests,getRequestHistory:()=>e.getNetworkInfo().requestHistory,getPendingDataSources:()=>e.getNetworkInfo().pendingDataSources},conditional:{getIfConditions:()=>e.getConditionalInfo().ifConditions,getIterations:()=>e.getConditionalInfo().iterations},form:{getForms:()=>e.getFormInfo()},websocket:{getInfo:()=>e.getWebSocketInfo()}};window.G7DevTools=f,o.devtools=f,we.log("G7DevTools 전역 객체 초기화 완료 (window.G7DevTools)"),TA(a.DevToolsPanel)}function TA(o){if(document.getElementById("g7-devtools-root")){we.log("DevToolsPanel 이미 렌더링됨");return}const e=document.createElement("div");e.id="g7-devtools-root",document.body.appendChild(e);try{Ju.createRoot(e).render(Ye.createElement(o)),we.log("DevToolsPanel UI 렌더링 완료")}catch(a){we.error("DevToolsPanel UI 렌더링 실패:",a)}}const Ze=ct("TemplateEngine"),ie={templateId:null,locale:"ko",isInitialized:!1,reactRoot:null,containerId:null,currentLayoutJson:null,currentDataContext:{},translationContext:{templateId:"",locale:"ko"},registry:null,bindingEngine:null,translationEngine:null,actionDispatcher:null,templateMetadata:null};let Co=!1;const Eo=[];async function RA(o){try{Ze.log("템플릿 메타데이터 로드 중...",o);const e=o.split("-").map(r=>r.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")).join(""),a=window[e];return a?.templateMetadata?(Ze.log("템플릿 메타데이터 로드 완료 (전역 변수)",a.templateMetadata),a.templateMetadata):(Ze.warn(`템플릿 번들에 메타데이터가 없습니다. 전역 변수: ${e}`),{identifier:o,locales:["ko","en"],name:{ko:o,en:o},description:{ko:"",en:""},version:"1.0.0",type:"admin"})}catch(e){return Ze.error("템플릿 메타데이터 로드 실패",e),{identifier:o,locales:["ko","en"],name:{ko:o,en:o},description:{ko:"",en:""},version:"1.0.0",type:"admin"}}}function dy(){const e=(typeof window<"u"?window.__templateApp:void 0)?.globalState?.appConfig?.supportedLocales,a=ie.templateMetadata?.locales;return{$locale:ie.locale,$locales:Array.isArray(e)&&e.length>0?e:a||["ko","en"],$templateLocales:a||["ko","en"],$templateId:ie.templateId}}async function _o(o){try{if(Ze.log("템플릿 엔진 초기화 시작",o),ie.isInitialized)throw new Error("템플릿 엔진이 이미 초기화되었습니다. destroyTemplate()을 먼저 호출하세요.");if(!o.templateId)throw new z_;Co=o.debug??!1,typeof window<"u"&&(window.G7Config||(window.G7Config={}),window.G7Config.debug=Co),AA(),ie.templateId=o.templateId,ie.locale=o.locale||"ko",Ze.log("엔진 인스턴스 생성 중..."),ie.registry=da.getInstance(),ie.bindingEngine=new wn,ie.translationEngine=Cr.getInstance(),o.cacheVersion!==void 0&&o.cacheVersion>0&&ie.translationEngine.setCacheVersion(o.cacheVersion),ie.translationContext={templateId:o.templateId,locale:ie.locale},ie.actionDispatcher=new oo({},ie.translationEngine,ie.translationContext),eC(ie.actionDispatcher),Ze.log("다국어 파일 로드 중...",o.templateId,ie.locale);const e="en",a=[ie.translationEngine.loadTranslations(o.templateId,ie.locale).then(()=>{Ze.log(`다국어 파일 로드 완료: ${ie.locale}`)}).catch(r=>{Ze.warn(`다국어 파일 로드 실패 (${ie.locale}):`,r instanceof Error?r.message:r)})];ie.locale!==e&&a.push(ie.translationEngine.loadTranslations(o.templateId,e).then(()=>{Ze.log(`폴백 다국어 파일 로드 완료: ${e}`)}).catch(r=>{Ze.warn(`폴백 다국어 파일 로드 실패 (${e}):`,r instanceof Error?r.message:r)})),await Promise.allSettled(a),Ze.log("템플릿 메타데이터 로드 중...",o.templateId),ie.templateMetadata=await RA(o.templateId),ie.isInitialized=!0,Ze.log("템플릿 엔진 초기화 완료 (ComponentRegistry는 별도 로드)")}catch(e){throw Ze.error("템플릿 엔진 초기화 실패",e),ie.isInitialized=!1,ie.registry=null,ie.bindingEngine=null,ie.translationEngine=null,ie.actionDispatcher=null,e}}let Ao=null;function hf(){const o=window.G7Core;return o?.__LayoutEditorChrome?Promise.resolve(o.__LayoutEditorChrome):Ao||(Ao=new Promise((e,a)=>{const r=window.G7Config?.coreEditorAsset||"/build/core/layout-editor.min.js",i="g7-layout-editor-bundle",l=document.getElementById(i),u=()=>{const f=window.G7Core?.__LayoutEditorChrome;f?e(f):a(new Error("편집기 번들 로드됨 — 그러나 __LayoutEditorChrome 미노출"))};if(window.G7Core=window.G7Core||{},window.G7Core.__onChromeReady=u,l){l.addEventListener("load",u,{once:!0}),l.addEventListener("error",()=>a(new Error(`편집기 번들 로드 실패: ${r}`)),{once:!0});return}const d=document.createElement("script");d.id=i,d.src=r,d.async=!1,d.addEventListener("load",u,{once:!0}),d.addEventListener("error",()=>{Ao=null,a(new Error(`편집기 번들 로드 실패: ${r}`))},{once:!0}),document.head.appendChild(d)}),Ao)}async function os(o){try{if(Ze.log("템플릿 렌더링 시작",o),!ie.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다. initTemplateEngine()을 먼저 호출하세요.");if(!o.containerId)throw new Error("containerId는 필수입니다.");if(!o.layoutJson)throw new Error("layoutJson은 필수입니다.");const e=document.getElementById(o.containerId);if(!e)throw new Error(`컨테이너를 찾을 수 없습니다: #${o.containerId}`);const a=dy();if(ie.containerId=o.containerId,ie.currentLayoutJson=o.layoutJson,ie.currentDataContext={...a,...o.dataContext||{}},ie.translationContext=o.translationContext||{templateId:ie.templateId||"",locale:ie.locale},ie.reactRoot||(Ze.log("React Root 생성"),ie.reactRoot=Ju.createRoot(e)),typeof window<"u"){const l=iy(window.location.pathname);if(l){Ze.log("레이아웃 편집기 모드 진입",l);let u;try{u=await hf()}catch(f){Ze.error("레이아웃 편집기 번들 로드 실패",f),lf.render(o.containerId,{title:"레이아웃 편집기 로드 실패",message:f instanceof Error?f.message:"편집기 번들을 불러오지 못했습니다.",icon:"fas fa-triangle-exclamation",showStack:!1,showReloadButton:!0,debug:Co});return}const d=Ye.createElement(u,{templateIdentifier:l.templateIdentifier,initialLocale:ie.locale});ie.reactRoot.render(Ye.createElement(cc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext,children:Ye.createElement(Dd,{children:Ye.createElement(Xl,{children:Ye.createElement(nf,{children:d})})})}));return}}const r=o.layoutJson.components||[];if(r.length===0){Ze.warn("렌더링할 컴포넌트가 없습니다.");return}const i=o.layoutJson.modals||[];if(Ze.log("modals 배열:",i),Ze.log("modals 개수:",i.length),Ze.log("DynamicRenderer로 렌더링 시작"),ie.reactRoot.render(Ye.createElement(cc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext},Ye.createElement(Dd,null,Ye.createElement(Xl,null,Ye.createElement(nf,null,[...r.map((l,u)=>{const d=ie.currentLayoutJson?.layout_name||"";return Ye.createElement(Ha,{key:d&&!l._fromBase?`${l.id}_${d}`:l.id,componentDef:l,dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,isRootRenderer:u===0,layoutKey:d})}),Ye.createElement(Jp,{key:"__modal_parent_context_provider"},i.map(l=>{const u=ie.currentDataContext._global?.modalStack||[],f=u.includes(l.id)||ie.currentDataContext._global?.activeModal===l.id,g=u.indexOf(l.id),m=g>=0?50+g:50,b=window.__g7LayoutContextStack||[],S=b[b.length-1]?.dataContext,E=Ye.createElement(Ha,{key:`modal_${l.id}_renderer`,componentDef:{...l,props:{...l.props,isOpen:f,style:{...l.props?.style,zIndex:m},onClose:ie.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ie.currentDataContext)}},dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,parentDataContext:S});return l.data_sources&&l.data_sources.length>0?Ye.createElement(ay,{key:`modal_${l.id}`,isOpen:f,modalId:l.id,dataSources:l.data_sources,dataContext:ie.currentDataContext,globalStateUpdater:ie.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ie.bindingEngine,debug:Co,children:E}):E}))]))))),Ze.log("템플릿 렌더링 완료"),Eo.length>0){Ze.log(`대기 중인 데이터 업데이트 ${Eo.length}건 적용`);const l=[...Eo];Eo.length=0;for(const{data:u,options:d}of l)ls(u,d)}}catch(e){throw Ze.error("템플릿 렌더링 실패",e),e}}function ls(o,e){try{if(Ze.log("템플릿 데이터 업데이트 시작",Object.keys(o)),!ie.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다.");if(!ie.reactRoot||!ie.currentLayoutJson){Ze.log("React 미준비 - 데이터 업데이트 큐잉:",Object.keys(o)),Eo.push({data:o,options:e});return}const a=dy(),r={...ie.currentDataContext._global||{},...o._global||{}},i=sC(ie.currentDataContext._localInit,o._localInit);ie.currentDataContext={...a,...ie.currentDataContext,...o,_global:r,_localInit:i},r._local!==void 0&&(ie.currentDataContext._local=r._local),r._computed!==void 0&&(ie.currentDataContext._computed=r._computed);const l=ie.currentLayoutJson.components||[],u=ie.currentLayoutJson.modals||[];Ze.log("updateTemplateData - modals 배열:",u),Ze.log("updateTemplateData - modals 개수:",u.length),Ze.log("updateTemplateData - activeModal:",ie.currentDataContext._global?.activeModal);const d=()=>{ie.reactRoot.render(Ye.createElement(cc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext},Ye.createElement(Dd,null,Ye.createElement(Xl,null,Ye.createElement(nf,null,[...l.map((f,g)=>{const m=ie.currentLayoutJson?.layout_name||"";return Ye.createElement(Ha,{key:m&&!f._fromBase?`${f.id}_${m}`:f.id,componentDef:f,dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,isRootRenderer:g===0,layoutKey:m})}),Ye.createElement(Jp,{key:"__modal_parent_context_provider_update"},u.map(f=>{const g=ie.currentDataContext._global?.modalStack||[],b=g.includes(f.id)||ie.currentDataContext._global?.activeModal===f.id,v=g.indexOf(f.id),S=v>=0?50+v:50,E=window.__g7LayoutContextStack||[],T=E[E.length-1]?.dataContext,L=Ye.createElement(Ha,{key:`modal_${f.id}_renderer`,componentDef:{...f,props:{...f.props,isOpen:b,style:{...f.props?.style,zIndex:S},onClose:ie.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ie.currentDataContext)}},dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,parentDataContext:T});return f.data_sources&&f.data_sources.length>0?Ye.createElement(ay,{key:`modal_${f.id}`,isOpen:b,modalId:f.id,dataSources:f.data_sources,dataContext:ie.currentDataContext,globalStateUpdater:ie.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ie.bindingEngine,debug:Co,children:L}):L}))])))))};e?.sync?(Ze.log("재렌더링 시작 (sync mode - 즉시 렌더링)"),d()):(Ze.log("재렌더링 시작 (with startTransition)"),N.startTransition(()=>{d()})),Ze.log("템플릿 데이터 업데이트 완료")}catch(a){throw Ze.error("템플릿 데이터 업데이트 실패",a),a}}function mc(){try{Ze.log("템플릿 정리 시작"),ie.reactRoot&&(Ze.log("React Root 언마운트"),ie.reactRoot.unmount(),ie.reactRoot=null),ie.templateId=null,ie.locale="ko",ie.isInitialized=!1,ie.containerId=null,ie.currentLayoutJson=null,ie.currentDataContext={},ie.translationContext={templateId:"",locale:"ko"},ie.registry=null,ie.bindingEngine=null,ie.translationEngine=null,ie.actionDispatcher=null,ie.templateMetadata=null,Ze.log("템플릿 정리 완료")}catch(o){throw Ze.error("템플릿 정리 실패",o),o}}function Za(){return Object.freeze({...ie})}function fy(){return ie.actionDispatcher}const xo={initTemplateEngine:_o,renderTemplate:os,updateTemplateData:ls,destroyTemplate:mc,getState:Za};typeof window<"u"&&(window.G7Core||(window.G7Core={}),window.G7Core.TemplateEngine=xo,CA({getState:()=>({translationEngine:ie.translationEngine,translationContext:ie.translationContext,bindingEngine:ie.bindingEngine,actionDispatcher:ie.actionDispatcher,templateMetadata:ie.templateMetadata}),transitionManager:Na,responsiveManager:ci,webSocketManager:fc}),Ze.log("전역 객체 window.G7Core.TemplateEngine에 노출됨"));const za=Object.freeze(Object.defineProperty({__proto__:null,DataSourceManager:va,LayoutLoader:ef,TemplateApp:vo,TemplateEngine:xo,default:xo,destroyTemplate:mc,getActionDispatcher:fy,getState:Za,initTemplateApp:ff,initTemplateEngine:_o,loadLayoutEditorBundle:hf,renderTemplate:os,updateTemplateData:ls},Symbol.toStringTag,{value:"Module"}));Vt.DataSourceManager=va,Vt.LayoutLoader=ef,Vt.TemplateApp=vo,Vt.TemplateEngine=xo,Vt.default=xo,Vt.destroyTemplate=mc,Vt.getActionDispatcher=fy,Vt.getState=Za,Vt.initTemplateApp=ff,Vt.initTemplateEngine=_o,Vt.loadLayoutEditorBundle=hf,Vt.renderTemplate=os,Vt.updateTemplateData=ls,Object.defineProperties(Vt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.G7Core=this.G7Core||{}); +//# sourceMappingURL=template-engine.min.js.map diff --git a/resources/js/core/support/__tests__/assetUrlRecovery.test.ts b/resources/js/core/support/__tests__/assetUrlRecovery.test.ts index 86f3e53f..39b35380 100644 --- a/resources/js/core/support/__tests__/assetUrlRecovery.test.ts +++ b/resources/js/core/support/__tests__/assetUrlRecovery.test.ts @@ -1,3 +1,4 @@ +// e2e:allow 테스트 전용 수정 — 프로브 판정 함수 추출 리팩토링 후 stale 앵커(detect→probe) 정정. 런타임 동작 무변경이며 대상 기능 E2E 는 tests/Playwright/specs/asset-url-mode.spec.ts 로 이미 커버됨. /** * 자산 URL 자가 복구 불변식 가드 — 이슈 #486 단위 D (§12 L1~L9). * @@ -176,8 +177,8 @@ describe('자산 URL 자가 복구 불변식 (§12)', () => { ); const source = readFileSync(installerPath, 'utf-8'); - const start = source.indexOf('async function detectAssetUrlMode('); - expect(start, 'installer.js 에서 detectAssetUrlMode 를 찾지 못했다').toBeGreaterThan(-1); + const start = source.indexOf('async function probeAssetUrlMode('); + expect(start, 'installer.js 에서 probeAssetUrlMode 를 찾지 못했다').toBeGreaterThan(-1); // 주석은 제거하고 실행 코드만 본다 — 주석에 남은 "Content-Type" 문구가 // 검사 삭제를 가려주면 가드가 무력해진다(실제로 겪은 오탐). diff --git a/resources/js/core/template-engine/__tests__/TranslationEngine.test.ts b/resources/js/core/template-engine/__tests__/TranslationEngine.test.ts index 24f4cf2a..c880458d 100644 --- a/resources/js/core/template-engine/__tests__/TranslationEngine.test.ts +++ b/resources/js/core/template-engine/__tests__/TranslationEngine.test.ts @@ -1,3 +1,4 @@ +// e2e:allow 테스트 전용 수정 — suffixed 헬퍼 일원화(#486)로 바뀐 쿼리 파라미터 순서를 순서 무관 단언으로 정정. 런타임 동작 무변경이며 대상 기능 E2E 는 tests/Playwright/specs/asset-url-mode.spec.ts 로 이미 커버됨. import { describe, it, expect, beforeEach, vi } from 'vitest'; import { TranslationEngine, @@ -1211,9 +1212,13 @@ describe('TranslationEngine', () => { await engine.loadTranslations('template-1', 'ko', '/api', true); - // bustCache가 true이면 타임스탬프 쿼리 파라미터도 추가됨 + // bustCache가 true이면 타임스탬프 쿼리 파라미터도 추가됨. + // 두 파라미터의 순서는 기능상 무의미하다 — #486 에서 URL 조립이 suffixed 헬퍼로 + // 일원화되며 v=/_= 순서가 바뀌었다. 순서에 의존하지 말고 둘 다 존재하는지만 검증한다. expect(global.fetch).toHaveBeenCalledWith( - expect.stringMatching(/\/api\/templates\/template-1\/lang\/ko\.json\?v=1735000000&_=\d+/) + expect.stringMatching( + /\/api\/templates\/template-1\/lang\/ko\.json\?(?=.*\bv=1735000000\b)(?=.*\b_=\d+\b)/ + ) ); }); diff --git a/resources/js/core/template-engine/layout-editor/__tests__/spec/dataBuiltinCapabilityShape.test.ts b/resources/js/core/template-engine/layout-editor/__tests__/spec/dataBuiltinCapabilityShape.test.ts index a9399c37..82eedc47 100644 --- a/resources/js/core/template-engine/layout-editor/__tests__/spec/dataBuiltinCapabilityShape.test.ts +++ b/resources/js/core/template-engine/layout-editor/__tests__/spec/dataBuiltinCapabilityShape.test.ts @@ -150,7 +150,7 @@ const NON_TARGET: Record> = { 'Card', 'Badge', 'StatusBadge', 'Alert', 'EmptyState', 'LoadingSpinner', 'FormField', 'Label', 'FileInput', 'FileUploader', 'HtmlContent', 'HtmlEditor', 'Accordion', 'IconButton', 'StatCard', 'ProductCard', 'TemplateCard', 'ExtensionBadge', 'Toggle', 'Checkbox', - 'ChipCheckbox', 'MultilingualTagInput', + 'ChipCheckbox', 'MultilingualTagInput', 'SectionHeader', 'ThemeToggle', ]), basic: new Set([ 'Div', 'Span', 'P', 'H1', 'H2', 'H3', 'H4', 'A', 'Button', 'Img', 'Icon', 'Hr', diff --git a/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js b/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js index a60824a6..1b934356 100644 --- a/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js +++ b/templates/_bundled/sirsoft-admin_basic/dist/js/components.iife.js @@ -1,4 +1,4 @@ -var SirsoftAdminBasic=(function(R,h,v,On){"use strict";var T5=Object.defineProperty;var A5=(R,h,v)=>h in R?T5(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var Fe=(R,h,v)=>A5(R,typeof h!="symbol"?h+"":h,v);var Oa,ur;function Qm(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const P=Qm(v),Jm=()=>window.G7Core,oe=v.forwardRef(({children:t,variant:e="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=Jm()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:t})});oe.displayName="Button";const Ed=v.forwardRef(({accept:t,maxSize:e,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,E])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=E:p[x]=E});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const E=x.target.files?.[0]||null;if(!E){g(""),n?.({target:{value:null,name:""}});return}if(e&&E.size>e*1024*1024){const k=`File size exceeds ${e}MB limit`;r?.(k),u.current&&(u.current.value=""),g("");return}g(E.name),n?.({target:{value:E,name:E.name}})},[e,n,r,u]),S=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:t,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:S,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Ed.displayName="FileInput";const Rm=t=>t==="checkbox"?"checkbox":t==="radio"?"radio":"input",eb=(t,e)=>{const n=Rm(t);return e?e.split(/\s+/).filter(Boolean).includes(n)?e:`${n} ${e}`:n},wt=v.forwardRef(({label:t,error:e,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=eb(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const S=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(M=>{if(m.current=!1,r){const O=M.target.value;b(O);const L=new Event("change",{bubbles:!0});Object.defineProperty(L,"target",{writable:!1,value:{value:O}}),Object.defineProperty(L,"currentTarget",{writable:!1,value:{value:O}}),r(L)}},[r]),E=v.useCallback(M=>{const O=M.target.value;b(O),!m.current&&r&&r(M)},[r]),k=v.useCallback(M=>{m.current||s&&s(M)},[s]),{loadingactions:C,formdata:N,..._}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,..._});const w=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:E,onKeyPress:k,onCompositionStart:S,onCompositionEnd:x,...w,..._})});wt.displayName="Input";const Zn=({label:t,error:e,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(E=>{if(a.current=!1,r){const k=E.target.value;d(k);const C=new Event("change",{bubbles:!0});Object.defineProperty(C,"target",{writable:!1,value:{value:k}}),Object.defineProperty(C,"currentTarget",{writable:!1,value:{value:k}}),r(C)}},[r]),g=v.useCallback(E=>{const k=E.target.value;d(k),!a.current&&r&&r(E)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},rn=({children:t,className:e="",...n})=>h.jsx("label",{className:e,...n,children:t}),I=v.forwardRef(({children:t,className:e="",...n},r)=>h.jsx("div",{ref:r,className:e,...n,children:t})),Q=({children:t,className:e="",...n})=>h.jsx("span",{className:e,...n,children:t}),bt=({children:t,className:e="",...n})=>h.jsx("p",{className:e,...n,children:t}),yn=({className:t="",alt:e="",...n})=>h.jsx("img",{className:t,alt:e,...n}),Aa=({children:t,className:e="",...n})=>h.jsx("h1",{className:e,...n,children:t}),Qn=({children:t,className:e="",...n})=>h.jsx("h2",{className:e,...n,children:t}),Ir=({children:t,className:e="",...n})=>h.jsx("h3",{className:e,...n,children:t}),Md=({children:t,className:e="",...n})=>h.jsx("h4",{className:e,...n,children:t}),Da=({children:t,className:e="",...n})=>h.jsx("ul",{className:e,...n,children:t}),tb=({children:t,className:e="",...n})=>h.jsx("ol",{className:e,...n,children:t}),Ia=({children:t,className:e="",...n})=>h.jsx("li",{className:e,...n,children:t}),Lr=({children:t,className:e="",...n})=>h.jsx("a",{className:e,...n,children:t}),La=({children:t,className:e="",...n})=>h.jsx("form",{className:e,...n,children:t}),Hn=({children:t,className:e="",...n})=>h.jsx("svg",{className:e,...n,children:t}),nb=window.G7Core?.createLogger?.("Comp:Select")??{log:(...t)=>console.log("[Comp:Select]",...t),warn:(...t)=>console.warn("[Comp:Select]",...t),error:(...t)=>console.error("[Comp:Select]",...t)};function rb(t){const e=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[t];return e||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[t]||t}const Pr=({children:t,label:e,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),S=v.useRef(null),x=v.useRef(null),E=v.useRef(null),k=v.useRef(null),C=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(T=>({value:T,label:rb(T)})):r:(nb.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>C&&C.find(z=>String(z.value)===String(o))?.label||"",[C,o]),_=v.useMemo(()=>{if(!C)return null;if(!l||m.trim()==="")return C;const T=m.trim().toLowerCase();return C.filter(z=>z.label.toLowerCase().includes(T)||String(z.value).toLowerCase().includes(T))},[C,l,m]);v.useEffect(()=>{if(f&&l){p("");const T=setTimeout(()=>E.current?.focus(),0);return()=>clearTimeout(T)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const T=x.current.getBoundingClientRect(),z=window.innerHeight-T.bottom,W=z<280&&T.top>z;b(W?{bottom:window.innerHeight-T.top+4,left:T.left,width:T.width}:{top:T.bottom+4,left:T.left,width:T.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,w]),v.useEffect(()=>{const T=z=>{const H=z.target;S.current&&!S.current.contains(H)&&(!k.current||!k.current.contains(H))&&g(!1)};return f&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[f]),v.useEffect(()=>{const T=z=>{z.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f]);const M=()=>{a||g(!f)},O=T=>{i&&i({target:{value:T},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!C){const z=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:z,value:o,onChange:i,disabled:a,...d,...u,children:t})}const L=(s??"").split(/\s+/).filter(T=>T&&!T.includes(":")).join(" "),F=L.includes("bg-"),$=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(L),D=F?`${s}${$?"":" text-gray-700 dark:text-gray-200"}`:`w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,A={...d,...u};return h.jsxs(I,{ref:S,className:"relative",...A,children:[h.jsxs(oe,{ref:x,type:"button",onClick:M,disabled:a,className:`${D} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(Q,{className:"truncate",children:N||" "}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&On.createPortal(h.jsxs(I,{ref:k,className:"fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",style:{top:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(wt,{ref:E,type:"text",value:m,onChange:T=>p(T.target.value),placeholder:c??"Search...",className:"w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none",role:"searchbox","aria-label":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[_&&_.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(_??[]).map(T=>{const z=String(T.value)===String(o);return h.jsxs(oe,{type:"button",onClick:()=>!T.disabled&&O(T.value),disabled:T.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${z?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${T.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":z,children:[h.jsx(Q,{children:T.label}),z&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},T.value)})]})]}),document.body)]})},sb=({children:t,className:e="",...n})=>h.jsx("option",{className:e,...n,children:t}),ob=({children:t,className:e="",...n})=>h.jsx("optgroup",{className:e,...n,children:t}),vn=v.forwardRef(({label:t,className:e="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:e,...r})});vn.displayName="Checkbox";const Pa=({children:t,className:e="",...n})=>h.jsx("table",{className:e,...n,children:t}),$a=({children:t,className:e="",...n})=>h.jsx("thead",{className:e,...n,children:t}),Fa=({children:t,className:e="",...n})=>h.jsx("tbody",{className:e,...n,children:t}),za=({children:t,className:e="",...n})=>h.jsx("tfoot",{className:e,...n,children:t}),Jn=({children:t,className:e="",...n})=>h.jsx("tr",{className:e,...n,children:t}),$r=({children:t,className:e="",...n})=>h.jsx("th",{className:e,...n,children:t}),Kt=({children:t,className:e="",...n})=>h.jsx("td",{className:e,...n,children:t}),Lo=({children:t,className:e="",...n})=>h.jsx("nav",{className:e,...n,children:t}),Nd=({children:t,className:e="",...n})=>h.jsx("section",{className:e,...n,children:t}),re=({name:t,iconStyle:e="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof t=="string"?t:String(t);let m=e,p=g;for(const[S,x]of Object.entries(f))if(g.startsWith(S+" ")){m=x,p=g.substring(S.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},ib={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},Od={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},ab=({icon:t,size:e="md",className:n="",color:r,ariaLabel:s})=>{const o=t.indexOf(":"),i=t.startsWith("fa-")||t.startsWith("fas ")||t.startsWith("far ")||t.startsWith("fab ")||t.startsWith("fal ")||t.startsWith("fad ");let a,l;i?(a="fa",l=t):o>0?(a=t.substring(0,o),l=t.substring(o+1)):(a="fa",l=t);const c=ib[e],d=r||"";switch(a){case"fa":return h.jsx(re,{name:l,size:Od[e],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(re,{name:t,size:Od[e],className:n,color:r,ariaLabel:s})}},lb=({children:t,className:e="",...n})=>h.jsx("code",{className:e,...n,children:t}),cb=({children:t,className:e="",...n})=>h.jsx("pre",{className:e,...n,children:t}),db=({children:t})=>h.jsx(h.Fragment,{children:t}),ub=({className:t="",...e})=>h.jsx("hr",{className:t,...e}),pt=({className:t="",children:e,style:n,...r})=>h.jsx("i",{className:t,style:n,...r,children:e});var de=(t=>(t.User="fa-user",t.Users="fa-users",t.UserCircle="fa-user-circle",t.UserPlus="fa-user-plus",t.UserMinus="fa-user-minus",t.UserShield="fa-user-shield",t.Search="fa-search",t.Edit="fa-edit",t.Pencil="fa-pencil-alt",t.Trash="fa-trash",t.Save="fa-save",t.Plus="fa-plus",t.Minus="fa-minus",t.Check="fa-check",t.Times="fa-times",t.Download="fa-download",t.Upload="fa-upload",t.Copy="fa-copy",t.ExternalLink="fa-external-link-alt",t.Home="fa-home",t.CaretRight="fa-caret-right",t.CaretDown="fa-caret-down",t.ChevronLeft="fa-chevron-left",t.ChevronRight="fa-chevron-right",t.ChevronUp="fa-chevron-up",t.ChevronDown="fa-chevron-down",t.AngleLeft="fa-angle-left",t.AngleRight="fa-angle-right",t.AngleUp="fa-angle-up",t.AngleDown="fa-angle-down",t.ArrowUp="fa-arrow-up",t.ArrowDown="fa-arrow-down",t.ArrowLeft="fa-arrow-left",t.ArrowRight="fa-arrow-right",t.Bars="fa-bars",t.EllipsisVertical="fa-ellipsis-v",t.EllipsisHorizontal="fa-ellipsis-h",t.CheckCircle="fa-check-circle",t.TimesCircle="fa-times-circle",t.ExclamationCircle="fa-exclamation-circle",t.ExclamationTriangle="fa-exclamation-triangle",t.InfoCircle="fa-info-circle",t.QuestionCircle="fa-question-circle",t.XCircle="fa-times-circle",t.ShoppingCart="fa-shopping-cart",t.ShoppingBag="fa-shopping-bag",t.CreditCard="fa-credit-card",t.Tag="fa-tag",t.Tags="fa-tags",t.File="fa-file",t.FileAlt="fa-file-alt",t.Folder="fa-folder",t.FolderOpen="fa-folder-open",t.Envelope="fa-envelope",t.Phone="fa-phone",t.Comment="fa-comment",t.Comments="fa-comments",t.Cog="fa-cog",t.Cogs="fa-cogs",t.Settings="fa-cog",t.Wrench="fa-wrench",t.Sliders="fa-sliders-h",t.Image="fa-image",t.Images="fa-images",t.Video="fa-video",t.Camera="fa-camera",t.Heart="fa-heart",t.Star="fa-star",t.ThumbsUp="fa-thumbs-up",t.ThumbsDown="fa-thumbs-down",t.Share="fa-share",t.Clock="fa-clock",t.Calendar="fa-calendar",t.CalendarAlt="fa-calendar-alt",t.Lock="fa-lock",t.Unlock="fa-unlock",t.Eye="fa-eye",t.EyeSlash="fa-eye-slash",t.Bell="fa-bell",t.Flag="fa-flag",t.Map="fa-map",t.MapMarker="fa-map-marker-alt",t.Globe="fa-globe",t.Link="fa-link",t.Unlink="fa-unlink",t.Sun="fa-sun",t.Moon="fa-moon",t.ChartBar="fa-chart-bar",t.ChartLine="fa-chart-line",t.ChartPie="fa-chart-pie",t.ChartArea="fa-chart-area",t.Spinner="fa-spinner",t.CircleNotch="fa-circle-notch",t.CheckBadge="fa-badge-check",t.Cube="fa-cube",t.Cubes="fa-cubes",t.Plug="fa-plug",t.PuzzlePiece="fa-puzzle-piece",t.Palette="fa-palette",t))(de||{});const fb=({title:t,content:e,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(yn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[t&&h.jsx(Qn,{className:"card-title",children:t}),e&&h.jsx(bt,{className:"card-content",children:e})]})]}),bs=({items:t,triggerLabel:e="작업",triggerIconName:n=de.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),E=224;let k=r==="right"?x.right-E:x.left;const C=x.bottom+8;k<8&&(k=8),k+E>window.innerWidth-8&&(k=window.innerWidth-E-8),g({top:C,left:k})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=E=>{const k=E.target,C=m.current?.contains(k),N=p.current?.contains(k);!C&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},S=d?On.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:t.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const E=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",k=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${E} ${k}`,children:[x.iconName&&h.jsx(re,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(oe,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e&&h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:e}),n&&h.jsx(re,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),S]})},Fr=(t,e)=>window.G7Core?.t?.(t,e)??t,Po=({currentPage:t,totalPages:e,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,className:o="",style:i,prevText:a,nextText:l,id:c,editorAttrs:d})=>{const u=v.useMemo(()=>{const p=[];if(e<=r+2)for(let y=1;y<=e;y++)p.push(y);else{const y=Math.floor(r/2);let b=Math.max(2,t-y),S=Math.min(e-1,t+y);t<=y+1?S=r:t>=e-y&&(b=e-r+1),p.push(1),b>2&&p.push("...");for(let x=b;x<=S;x++)p.push(x);S1&&p.push(e)}return p},[t,e,r]),f=p=>{p<1||p>e||p===t||n(p)},g=()=>{t>1&&n(t-1)},m=()=>{tf(1),disabled:t===1,className:"pagination-btn","aria-label":Fr("common.first_page"),children:"«"}),h.jsx(oe,{onClick:g,disabled:t===1,className:"pagination-btn","aria-label":Fr("common.prev_page"),children:a||h.jsx(h.Fragment,{children:"‹"})}),h.jsx(I,{className:"pagination",children:u.map((p,y)=>{if(p==="...")return h.jsx(Q,{className:"pagination-ellipsis",children:"..."},`ellipsis-${y}`);const b=p,S=b===t;return h.jsx(oe,{onClick:()=>f(b),className:S?"pagination-btn-active":"pagination-btn","aria-label":Fr("common.page_n",{n:b}),"aria-current":S?"page":void 0,children:b},b)})}),h.jsx(oe,{onClick:m,disabled:t===e,className:"pagination-btn","aria-label":Fr("common.next_page"),children:l||h.jsx(h.Fragment,{children:"›"})}),s&&h.jsx(oe,{onClick:()=>f(e),disabled:t===e,className:"pagination-btn","aria-label":Fr("common.last_page"),children:"»"})]})},Td=(t,e)=>window.G7Core?.t?.(t,e)??t,hb=()=>window.G7Core?.locale?.supported?.()??["ko","en"],gb=()=>window.G7Core?.locale?.current?.()??"ko",Ad=t=>{const e=Td(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},pb=()=>hb().map(e=>({code:e,name:Ad(e),nativeName:Ad(e)})),Va=({value:t={},onChange:e,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,S=v.useMemo(()=>s??pb(),[s]),x=v.useMemo(()=>o??gb(),[o]),E=v.useRef(t),[k,C]=v.useState(t),N=v.useRef(JSON.stringify(t));v.useEffect(()=>{const X=JSON.stringify(t);X!==N.current&&(N.current=X,E.current=t,C(t))},[t]);const _=v.useCallback((X,Z)=>{const ee={target:{name:f,value:X}};Z&&(ee._changedKeys=Z),e?.(ee)},[e,f]),[w,M]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ee=S.map(he=>he.code);return[x,...ee.filter(he=>he!==x)]}const X=Object.keys(t).filter(ee=>t[ee]!==void 0);if(X.length===0)return[x];const Z=[];return X.includes(x)&&Z.push(x),X.forEach(ee=>{ee!==x&&Z.push(ee)}),Z}),[O,L]=v.useState(x),F=v.useMemo(()=>S.filter(X=>!w.includes(X.code)),[S,w]),[$,D]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const he=S.map(ae=>ae.code),J=[x,...he.filter(ae=>ae!==x)],ce=w.join(","),ue=J.join(",");ce!==ue&&M(J);return}const X=Object.keys(t).filter(he=>t[he]!==void 0);if(X.length===0){M([x]);return}const Z=[];X.includes(x)&&Z.push(x),X.forEach(he=>{he!==x&&Z.push(he)});const ee=w.join(","),ne=Z.join(",");ee!==ne&&M(Z)},[t,x,r,S]);const A=v.useCallback((X,Z)=>{const ee={...E.current,[X]:Z};E.current=ee,C(ee),_(ee,[X])},[_]),T=v.useCallback(X=>{M(ee=>[...ee,X]),L(X),D(!1);const Z={...E.current,[X]:""};E.current=Z,C(Z),_(Z)},[_]),z=v.useCallback(X=>{if(X===x)return;M(ee=>ee.filter(ne=>ne!==X)),O===X&&L(x);const Z={...E.current};delete Z[X],E.current=Z,C(Z),_(Z)},[O,x,_]),H=v.useCallback(X=>{const Z=S.find(ee=>ee.code===X);return Z?.nativeName||Z?.name||X.toUpperCase()},[S]),W=v.useCallback(X=>!!k[X]?.trim(),[k]),j=v.useCallback(()=>F.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(oe,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>D(!$),disabled:l,children:[h.jsx(re,{name:"plus",className:"w-3 h-3"}),h.jsx(Q,{children:Td("common.add_language")})]}),$&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:F.map(X=>h.jsxs(oe,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>T(X.code),children:[h.jsx(re,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{children:X.nativeName||X.name})]},X.code))})]}),[F,$,l,T]),U=v.useCallback((X,Z=!1)=>{const ee=b?"input input-error":"input",ne=b?"textarea input-error":"textarea",he=X===x,J=`${i}${i?" (":""}${H(X)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(Q,{className:` +var SirsoftAdminBasic=(function(R,h,v,On){"use strict";var F5=Object.defineProperty;var z5=(R,h,v)=>h in R?F5(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var Fe=(R,h,v)=>z5(R,typeof h!="symbol"?h+"":h,v);var Oa,ur;function eb(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const P=eb(v),tb=()=>window.G7Core,oe=v.forwardRef(({children:t,variant:e="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=tb()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:t})});oe.displayName="Button";const Md=v.forwardRef(({accept:t,maxSize:e,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,E])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=E:p[x]=E});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const E=x.target.files?.[0]||null;if(!E){g(""),n?.({target:{value:null,name:""}});return}if(e&&E.size>e*1024*1024){const k=`File size exceeds ${e}MB limit`;r?.(k),u.current&&(u.current.value=""),g("");return}g(E.name),n?.({target:{value:E,name:E.name}})},[e,n,r,u]),S=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:t,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:S,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Md.displayName="FileInput";const nb=t=>t==="checkbox"?"checkbox":t==="radio"?"radio":"input",rb=(t,e)=>{const n=nb(t);return e?e.split(/\s+/).filter(Boolean).includes(n)?e:`${n} ${e}`:n},wt=v.forwardRef(({label:t,error:e,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=rb(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const S=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(M=>{if(m.current=!1,r){const O=M.target.value;b(O);const L=new Event("change",{bubbles:!0});Object.defineProperty(L,"target",{writable:!1,value:{value:O}}),Object.defineProperty(L,"currentTarget",{writable:!1,value:{value:O}}),r(L)}},[r]),E=v.useCallback(M=>{const O=M.target.value;b(O),!m.current&&r&&r(M)},[r]),k=v.useCallback(M=>{m.current||s&&s(M)},[s]),{loadingactions:C,formdata:N,..._}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,..._});const w=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:E,onKeyPress:k,onCompositionStart:S,onCompositionEnd:x,...w,..._})});wt.displayName="Input";const Zn=({label:t,error:e,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(E=>{if(a.current=!1,r){const k=E.target.value;d(k);const C=new Event("change",{bubbles:!0});Object.defineProperty(C,"target",{writable:!1,value:{value:k}}),Object.defineProperty(C,"currentTarget",{writable:!1,value:{value:k}}),r(C)}},[r]),g=v.useCallback(E=>{const k=E.target.value;d(k),!a.current&&r&&r(E)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},rn=({children:t,className:e="",...n})=>h.jsx("label",{className:e,...n,children:t}),I=v.forwardRef(({children:t,className:e="",...n},r)=>h.jsx("div",{ref:r,className:e,...n,children:t})),Q=({children:t,className:e="",...n})=>h.jsx("span",{className:e,...n,children:t}),bt=({children:t,className:e="",...n})=>h.jsx("p",{className:e,...n,children:t}),yn=({className:t="",alt:e="",...n})=>h.jsx("img",{className:t,alt:e,...n}),Aa=({children:t,className:e="",...n})=>h.jsx("h1",{className:e,...n,children:t}),Qn=({children:t,className:e="",...n})=>h.jsx("h2",{className:e,...n,children:t}),Ir=({children:t,className:e="",...n})=>h.jsx("h3",{className:e,...n,children:t}),Nd=({children:t,className:e="",...n})=>h.jsx("h4",{className:e,...n,children:t}),Da=({children:t,className:e="",...n})=>h.jsx("ul",{className:e,...n,children:t}),sb=({children:t,className:e="",...n})=>h.jsx("ol",{className:e,...n,children:t}),Ia=({children:t,className:e="",...n})=>h.jsx("li",{className:e,...n,children:t}),Lr=({children:t,className:e="",...n})=>h.jsx("a",{className:e,...n,children:t}),La=({children:t,className:e="",...n})=>h.jsx("form",{className:e,...n,children:t}),Hn=({children:t,className:e="",...n})=>h.jsx("svg",{className:e,...n,children:t}),ob=window.G7Core?.createLogger?.("Comp:Select")??{log:(...t)=>console.log("[Comp:Select]",...t),warn:(...t)=>console.warn("[Comp:Select]",...t),error:(...t)=>console.error("[Comp:Select]",...t)};function ib(t){const e=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[t];return e||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[t]||t}const Pr=({children:t,label:e,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),S=v.useRef(null),x=v.useRef(null),E=v.useRef(null),k=v.useRef(null),C=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(T=>({value:T,label:ib(T)})):r:(ob.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>C&&C.find(z=>String(z.value)===String(o))?.label||"",[C,o]),_=v.useMemo(()=>{if(!C)return null;if(!l||m.trim()==="")return C;const T=m.trim().toLowerCase();return C.filter(z=>z.label.toLowerCase().includes(T)||String(z.value).toLowerCase().includes(T))},[C,l,m]);v.useEffect(()=>{if(f&&l){p("");const T=setTimeout(()=>E.current?.focus(),0);return()=>clearTimeout(T)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const T=x.current.getBoundingClientRect(),z=window.innerHeight-T.bottom,W=z<280&&T.top>z;b(W?{bottom:window.innerHeight-T.top+4,left:T.left,width:T.width}:{top:T.bottom+4,left:T.left,width:T.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,w]),v.useEffect(()=>{const T=z=>{const H=z.target;S.current&&!S.current.contains(H)&&(!k.current||!k.current.contains(H))&&g(!1)};return f&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[f]),v.useEffect(()=>{const T=z=>{z.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f]);const M=()=>{a||g(!f)},O=T=>{i&&i({target:{value:T},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!C){const z=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:z,value:o,onChange:i,disabled:a,...d,...u,children:t})}const L=(s??"").split(/\s+/).filter(T=>T&&!T.includes(":")).join(" "),F=L.includes("bg-"),$=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(L),D=F?`${s}${$?"":" text-gray-700 dark:text-gray-200"}`:`w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,A={...d,...u};return h.jsxs(I,{ref:S,className:"relative",...A,children:[h.jsxs(oe,{ref:x,type:"button",onClick:M,disabled:a,className:`${D} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(Q,{className:"truncate",children:N||" "}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&On.createPortal(h.jsxs(I,{ref:k,className:"fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",style:{top:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(wt,{ref:E,type:"text",value:m,onChange:T=>p(T.target.value),placeholder:c??"Search...",className:"w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none",role:"searchbox","aria-label":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[_&&_.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(_??[]).map(T=>{const z=String(T.value)===String(o);return h.jsxs(oe,{type:"button",onClick:()=>!T.disabled&&O(T.value),disabled:T.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${z?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${T.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":z,children:[h.jsx(Q,{children:T.label}),z&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},T.value)})]})]}),document.body)]})},ab=({children:t,className:e="",...n})=>h.jsx("option",{className:e,...n,children:t}),lb=({children:t,className:e="",...n})=>h.jsx("optgroup",{className:e,...n,children:t}),vn=v.forwardRef(({label:t,className:e="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:e,...r})});vn.displayName="Checkbox";const Pa=({children:t,className:e="",...n})=>h.jsx("table",{className:e,...n,children:t}),$a=({children:t,className:e="",...n})=>h.jsx("thead",{className:e,...n,children:t}),Fa=({children:t,className:e="",...n})=>h.jsx("tbody",{className:e,...n,children:t}),za=({children:t,className:e="",...n})=>h.jsx("tfoot",{className:e,...n,children:t}),Jn=({children:t,className:e="",...n})=>h.jsx("tr",{className:e,...n,children:t}),$r=({children:t,className:e="",...n})=>h.jsx("th",{className:e,...n,children:t}),Kt=({children:t,className:e="",...n})=>h.jsx("td",{className:e,...n,children:t}),Lo=({children:t,className:e="",...n})=>h.jsx("nav",{className:e,...n,children:t}),Od=({children:t,className:e="",...n})=>h.jsx("section",{className:e,...n,children:t}),re=({name:t,iconStyle:e="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof t=="string"?t:String(t);let m=e,p=g;for(const[S,x]of Object.entries(f))if(g.startsWith(S+" ")){m=x,p=g.substring(S.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},cb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},Td={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},db=({icon:t,size:e="md",className:n="",color:r,ariaLabel:s})=>{const o=t.indexOf(":"),i=t.startsWith("fa-")||t.startsWith("fas ")||t.startsWith("far ")||t.startsWith("fab ")||t.startsWith("fal ")||t.startsWith("fad ");let a,l;i?(a="fa",l=t):o>0?(a=t.substring(0,o),l=t.substring(o+1)):(a="fa",l=t);const c=cb[e],d=r||"";switch(a){case"fa":return h.jsx(re,{name:l,size:Td[e],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(re,{name:t,size:Td[e],className:n,color:r,ariaLabel:s})}},ub=({children:t,className:e="",...n})=>h.jsx("code",{className:e,...n,children:t}),fb=({children:t,className:e="",...n})=>h.jsx("pre",{className:e,...n,children:t}),hb=({children:t})=>h.jsx(h.Fragment,{children:t}),gb=({className:t="",...e})=>h.jsx("hr",{className:t,...e}),pt=({className:t="",children:e,style:n,...r})=>h.jsx("i",{className:t,style:n,...r,children:e});var de=(t=>(t.User="fa-user",t.Users="fa-users",t.UserCircle="fa-user-circle",t.UserPlus="fa-user-plus",t.UserMinus="fa-user-minus",t.UserShield="fa-user-shield",t.Search="fa-search",t.Edit="fa-edit",t.Pencil="fa-pencil-alt",t.Trash="fa-trash",t.Save="fa-save",t.Plus="fa-plus",t.Minus="fa-minus",t.Check="fa-check",t.Times="fa-times",t.Download="fa-download",t.Upload="fa-upload",t.Copy="fa-copy",t.ExternalLink="fa-external-link-alt",t.Home="fa-home",t.CaretRight="fa-caret-right",t.CaretDown="fa-caret-down",t.ChevronLeft="fa-chevron-left",t.ChevronRight="fa-chevron-right",t.ChevronUp="fa-chevron-up",t.ChevronDown="fa-chevron-down",t.AngleLeft="fa-angle-left",t.AngleRight="fa-angle-right",t.AngleUp="fa-angle-up",t.AngleDown="fa-angle-down",t.ArrowUp="fa-arrow-up",t.ArrowDown="fa-arrow-down",t.ArrowLeft="fa-arrow-left",t.ArrowRight="fa-arrow-right",t.Bars="fa-bars",t.EllipsisVertical="fa-ellipsis-v",t.EllipsisHorizontal="fa-ellipsis-h",t.CheckCircle="fa-check-circle",t.TimesCircle="fa-times-circle",t.ExclamationCircle="fa-exclamation-circle",t.ExclamationTriangle="fa-exclamation-triangle",t.InfoCircle="fa-info-circle",t.QuestionCircle="fa-question-circle",t.XCircle="fa-times-circle",t.ShoppingCart="fa-shopping-cart",t.ShoppingBag="fa-shopping-bag",t.CreditCard="fa-credit-card",t.Tag="fa-tag",t.Tags="fa-tags",t.File="fa-file",t.FileAlt="fa-file-alt",t.Folder="fa-folder",t.FolderOpen="fa-folder-open",t.Envelope="fa-envelope",t.Phone="fa-phone",t.Comment="fa-comment",t.Comments="fa-comments",t.Cog="fa-cog",t.Cogs="fa-cogs",t.Settings="fa-cog",t.Wrench="fa-wrench",t.Sliders="fa-sliders-h",t.Image="fa-image",t.Images="fa-images",t.Video="fa-video",t.Camera="fa-camera",t.Heart="fa-heart",t.Star="fa-star",t.ThumbsUp="fa-thumbs-up",t.ThumbsDown="fa-thumbs-down",t.Share="fa-share",t.Clock="fa-clock",t.Calendar="fa-calendar",t.CalendarAlt="fa-calendar-alt",t.Lock="fa-lock",t.Unlock="fa-unlock",t.Eye="fa-eye",t.EyeSlash="fa-eye-slash",t.Bell="fa-bell",t.Flag="fa-flag",t.Map="fa-map",t.MapMarker="fa-map-marker-alt",t.Globe="fa-globe",t.Link="fa-link",t.Unlink="fa-unlink",t.Sun="fa-sun",t.Moon="fa-moon",t.ChartBar="fa-chart-bar",t.ChartLine="fa-chart-line",t.ChartPie="fa-chart-pie",t.ChartArea="fa-chart-area",t.Spinner="fa-spinner",t.CircleNotch="fa-circle-notch",t.CheckBadge="fa-badge-check",t.Cube="fa-cube",t.Cubes="fa-cubes",t.Plug="fa-plug",t.PuzzlePiece="fa-puzzle-piece",t.Palette="fa-palette",t))(de||{});const pb=({title:t,content:e,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(yn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[t&&h.jsx(Qn,{className:"card-title",children:t}),e&&h.jsx(bt,{className:"card-content",children:e})]})]}),bs=({items:t,triggerLabel:e="작업",triggerIconName:n=de.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),E=224;let k=r==="right"?x.right-E:x.left;const C=x.bottom+8;k<8&&(k=8),k+E>window.innerWidth-8&&(k=window.innerWidth-E-8),g({top:C,left:k})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=E=>{const k=E.target,C=m.current?.contains(k),N=p.current?.contains(k);!C&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},S=d?On.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:t.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const E=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",k=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${E} ${k}`,children:[x.iconName&&h.jsx(re,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(oe,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e&&h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:e}),n&&h.jsx(re,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),S]})},Fr=(t,e)=>window.G7Core?.t?.(t,e)??t,Po=({currentPage:t,totalPages:e,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,className:o="",style:i,prevText:a,nextText:l,id:c,editorAttrs:d})=>{const u=v.useMemo(()=>{const p=[];if(e<=r+2)for(let y=1;y<=e;y++)p.push(y);else{const y=Math.floor(r/2);let b=Math.max(2,t-y),S=Math.min(e-1,t+y);t<=y+1?S=r:t>=e-y&&(b=e-r+1),p.push(1),b>2&&p.push("...");for(let x=b;x<=S;x++)p.push(x);S1&&p.push(e)}return p},[t,e,r]),f=p=>{p<1||p>e||p===t||n(p)},g=()=>{t>1&&n(t-1)},m=()=>{tf(1),disabled:t===1,className:"pagination-btn","aria-label":Fr("common.first_page"),children:"«"}),h.jsx(oe,{onClick:g,disabled:t===1,className:"pagination-btn","aria-label":Fr("common.prev_page"),children:a||h.jsx(h.Fragment,{children:"‹"})}),h.jsx(I,{className:"pagination",children:u.map((p,y)=>{if(p==="...")return h.jsx(Q,{className:"pagination-ellipsis",children:"..."},`ellipsis-${y}`);const b=p,S=b===t;return h.jsx(oe,{onClick:()=>f(b),className:S?"pagination-btn-active":"pagination-btn","aria-label":Fr("common.page_n",{n:b}),"aria-current":S?"page":void 0,children:b},b)})}),h.jsx(oe,{onClick:m,disabled:t===e,className:"pagination-btn","aria-label":Fr("common.next_page"),children:l||h.jsx(h.Fragment,{children:"›"})}),s&&h.jsx(oe,{onClick:()=>f(e),disabled:t===e,className:"pagination-btn","aria-label":Fr("common.last_page"),children:"»"})]})},Ad=(t,e)=>window.G7Core?.t?.(t,e)??t,mb=()=>window.G7Core?.locale?.supported?.()??["ko","en"],bb=()=>window.G7Core?.locale?.current?.()??"ko",Dd=t=>{const e=Ad(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},yb=()=>mb().map(e=>({code:e,name:Dd(e),nativeName:Dd(e)})),Va=({value:t={},onChange:e,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,S=v.useMemo(()=>s??yb(),[s]),x=v.useMemo(()=>o??bb(),[o]),E=v.useRef(t),[k,C]=v.useState(t),N=v.useRef(JSON.stringify(t));v.useEffect(()=>{const X=JSON.stringify(t);X!==N.current&&(N.current=X,E.current=t,C(t))},[t]);const _=v.useCallback((X,Z)=>{const ee={target:{name:f,value:X}};Z&&(ee._changedKeys=Z),e?.(ee)},[e,f]),[w,M]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ee=S.map(he=>he.code);return[x,...ee.filter(he=>he!==x)]}const X=Object.keys(t).filter(ee=>t[ee]!==void 0);if(X.length===0)return[x];const Z=[];return X.includes(x)&&Z.push(x),X.forEach(ee=>{ee!==x&&Z.push(ee)}),Z}),[O,L]=v.useState(x),F=v.useMemo(()=>S.filter(X=>!w.includes(X.code)),[S,w]),[$,D]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const he=S.map(ae=>ae.code),J=[x,...he.filter(ae=>ae!==x)],ce=w.join(","),ue=J.join(",");ce!==ue&&M(J);return}const X=Object.keys(t).filter(he=>t[he]!==void 0);if(X.length===0){M([x]);return}const Z=[];X.includes(x)&&Z.push(x),X.forEach(he=>{he!==x&&Z.push(he)});const ee=w.join(","),ne=Z.join(",");ee!==ne&&M(Z)},[t,x,r,S]);const A=v.useCallback((X,Z)=>{const ee={...E.current,[X]:Z};E.current=ee,C(ee),_(ee,[X])},[_]),T=v.useCallback(X=>{M(ee=>[...ee,X]),L(X),D(!1);const Z={...E.current,[X]:""};E.current=Z,C(Z),_(Z)},[_]),z=v.useCallback(X=>{if(X===x)return;M(ee=>ee.filter(ne=>ne!==X)),O===X&&L(x);const Z={...E.current};delete Z[X],E.current=Z,C(Z),_(Z)},[O,x,_]),H=v.useCallback(X=>{const Z=S.find(ee=>ee.code===X);return Z?.nativeName||Z?.name||X.toUpperCase()},[S]),W=v.useCallback(X=>!!k[X]?.trim(),[k]),j=v.useCallback(()=>F.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(oe,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>D(!$),disabled:l,children:[h.jsx(re,{name:"plus",className:"w-3 h-3"}),h.jsx(Q,{children:Ad("common.add_language")})]}),$&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:F.map(X=>h.jsxs(oe,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>T(X.code),children:[h.jsx(re,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{children:X.nativeName||X.name})]},X.code))})]}),[F,$,l,T]),U=v.useCallback((X,Z=!1)=>{const ee=b?"input input-error":"input",ne=b?"textarea input-error":"textarea",he=X===x,J=`${i}${i?" (":""}${H(X)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(Q,{className:` inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium ${he?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"} `,children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),H(X),he&&h.jsx(Q,{className:"text-red-500 dark:text-red-400",children:"*"}),!he&&h.jsx(oe,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>z(X),disabled:l,children:h.jsx(re,{name:"xmark",className:"w-3 h-3"})})]}),he&&Z&&j()]}),n==="textarea"?h.jsx(Zn,{name:`${f}[${X}]`,value:k[X]||"",onChange:ce=>A(X,ce.target.value),placeholder:J,required:a&&he,disabled:l,maxLength:c,rows:d,className:`${ne} resize-vertical`}):h.jsx(wt,{type:"text",name:`${f}[${X}]`,value:k[X]||"",onChange:ce=>A(X,ce.target.value),placeholder:J,required:a&&he,disabled:l,maxLength:c,className:ee})]},X)},[f,k,A,i,a,l,c,d,n,H,x,z,j,b]),B=v.useCallback(X=>{const Z=b?"input input-error":"input",ee=b?"textarea input-error":"textarea",ne=`${i}${i?" (":""}${H(X)}${i?")":""}`;return h.jsx(I,{children:n==="textarea"?h.jsx(Zn,{name:`${f}[${X}]`,value:k[X]||"",onChange:he=>A(X,he.target.value),placeholder:ne,required:a&&X===x,disabled:l,maxLength:c,rows:d,className:`${ee} resize-vertical`}):h.jsx(wt,{type:"text",name:`${f}[${X}]`,value:k[X]||"",onChange:he=>A(X,he.target.value),placeholder:ne,required:a&&X===x,disabled:l,maxLength:c,className:Z})},X)},[f,k,A,i,a,l,c,d,n,x,H,b]),G=()=>h.jsx(I,{className:u,children:h.jsx(I,{className:"space-y-4",children:w.map((X,Z)=>U(X,Z===0))})}),V=()=>h.jsxs(I,{className:u,children:[h.jsxs(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:[w.map(X=>h.jsxs(oe,{type:"button",className:` @@ -7,13 +7,13 @@ var SirsoftAdminBasic=(function(R,h,v,On){"use strict";var T5=Object.definePrope `,onClick:()=>L(X),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),g?h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:H(X)}),h.jsx(Q,{className:"inline md:hidden",children:X.toUpperCase()})]}):H(X),X===x&&h.jsx(Q,{className:"text-red-500 dark:text-red-400",children:"*"}),W(X)&&O!==X&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"}),X!==x&&h.jsx(oe,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors",onClick:Z=>{Z.stopPropagation(),z(X)},disabled:l,children:h.jsx(re,{name:"xmark",className:"w-3 h-3"})})]},X)),j()]}),w.map(X=>h.jsx(I,{className:O===X?"block":"hidden",children:B(X)},X))]}),K=()=>{const X=b?"input input-error":"input",Z=b?"textarea input-error":"textarea";return h.jsx(I,{className:u,children:h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(I,{className:"flex items-center shrink-0",children:w.map(ee=>h.jsxs(oe,{type:"button",className:` px-2 py-1.5 text-xs font-medium border-y border-l first:rounded-l last:rounded-r last:border-r transition-colors ${O===ee?"bg-blue-500 text-white border-blue-500 dark:bg-blue-600 dark:border-blue-600":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700"} - `,onClick:()=>L(ee),title:H(ee),children:[ee.toUpperCase(),ee===x&&h.jsx(Q,{className:"text-red-400 ml-0.5",children:"*"})]},ee))}),h.jsx(I,{className:"flex-1 min-w-0",children:n==="textarea"?h.jsx(Zn,{name:`${f}[${O}]`,value:k[O]||"",onChange:ee=>A(O,ee.target.value),placeholder:i,required:a&&O===x,disabled:l,maxLength:c,rows:d,className:Z}):h.jsx(wt,{type:"text",name:`${f}[${O}]`,value:k[O]||"",onChange:ee=>A(O,ee.target.value),placeholder:i,required:a&&O===x,disabled:l,maxLength:c,className:X})})]})})};return h.jsxs(I,{className:l?"opacity-50 cursor-not-allowed":void 0,id:p,...y,children:[r==="compact"?K():r==="tabs"?V():G(),b&&m&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:m})]})};Va.displayName="MultilingualInput";const mb=()=>window.G7Core,Ha=({checked:t,value:e,onChange:n,disabled:r=!1,label:s,description:o,size:i="md",className:a="",name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(()=>t??e??!1);v.useEffect(()=>{f(t??e??!1)},[t,e]);const g=b=>{const S=b.target.checked;f(S),n&&!r&&n(b)},p={sm:{track:"w-9 h-5",thumb:"after:h-4 after:w-4"},md:{track:"w-11 h-6",thumb:"after:h-5 after:w-5"},lg:{track:"w-14 h-7",thumb:"after:h-6 after:w-6"}}[i],y=()=>{if(!r){const b=!u;if(f(b),n){const S=mb();S?.createChangeEvent&&n(S.createChangeEvent({checked:b,name:l}))}}};return h.jsxs("div",{className:`toggle-container ${a}`,id:c,...d,children:[h.jsxs("div",{className:`toggle-switch-wrapper ${r?"cursor-not-allowed opacity-50":"cursor-pointer"}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),y()},children:[h.jsx("input",{type:"checkbox",id:l,name:l,checked:u,onChange:g,disabled:r,className:"sr-only peer",tabIndex:-1}),h.jsx("div",{className:`toggle-switch-track ${p.track} ${p.thumb}`})]}),s&&h.jsx("span",{className:`toggle-label ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:y,children:s}),o&&h.jsx("p",{className:"toggle-description",children:o})]})},$o=({status:t,label:e,showIcon:n=!0,iconName:r,className:s="",style:o,id:i,editorAttrs:a})=>{const l={success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",pending:"bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-gray-600",default:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600"},c={success:de.CheckCircle,warning:de.ExclamationTriangle,error:de.XCircle,info:de.InfoCircle,pending:de.Clock,default:de.QuestionCircle},d={success:"성공",warning:"경고",error:"오류",info:"정보",pending:"대기 중",default:"기본"},u=r||c[t],f=e||d[t],g=l[t];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border ${g} ${s}`,style:o,id:i,...a,children:[n&&h.jsx(re,{name:u,className:"w-4 h-4"}),h.jsx(Q,{children:f})]})},Dd={blue:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",green:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",red:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",gray:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",yellow:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",purple:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",orange:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",teal:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",cyan:"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300"},bb={success:"green",warning:"yellow",danger:"red",error:"red",info:"blue",primary:"blue",secondary:"gray",text:"gray",default:"gray"},Id={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs",lg:"px-2.5 py-1 text-sm"},Ld=({color:t,variant:e,text:n,size:r="md",className:s="",style:o,children:i,id:a,editorAttrs:l})=>{const c=t||(e?bb[e]:void 0)||"gray",d=Dd[c]||Dd.gray,u=Id[r]||Id.md;return h.jsxs(Q,{className:`inline-flex items-center rounded-full font-medium ${u} ${d} ${s}`,style:o,id:a,...l,children:[n,i]})};const{entries:Pd,setPrototypeOf:$d,isFrozen:yb,getPrototypeOf:vb,getOwnPropertyDescriptor:xb}=Object;let{freeze:jt,seal:cn,create:Fd}=Object,{apply:Ua,construct:Ba}=typeof Reflect<"u"&&Reflect;jt||(jt=function(e){return e}),cn||(cn=function(e){return e}),Ua||(Ua=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o1?n-1:0),s=1;s1?n-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:zo;$d&&$d(t,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const o=n(s);o!==s&&(yb(e)||(e[r]=o),s=o)}t[s]=!0}return t}function Eb(t){for(let e=0;e/gm),Ab=cn(/\$\{[\w\W]*/gm),Db=cn(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ib=cn(/^aria-[\-\w]+$/),jd=cn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lb=cn(/^(?:\w+script|data):/i),Pb=cn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wd=cn(/^html$/i),$b=cn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Gd=Object.freeze({__proto__:null,ARIA_ATTR:Ib,ATTR_WHITESPACE:Pb,CUSTOM_ELEMENT:$b,DATA_ATTR:Db,DOCTYPE_NAME:Wd,ERB_EXPR:Tb,IS_ALLOWED_URI:jd,IS_SCRIPT_OR_DATA:Lb,MUSTACHE_EXPR:Ob,TMPLIT_EXPR:Ab});const ks={element:1,text:3,progressingInstruction:7,comment:8,document:9},Fb=function(){return typeof window>"u"?null:window},zb=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Yd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fb();const e=Ce=>Xd(Ce);if(e.version="3.2.7",e.removed=[],!t||!t.document||t.document.nodeType!==ks.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,s=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:g}=t,m=l.prototype,p=ws(m,"cloneNode"),y=ws(m,"remove"),b=ws(m,"nextSibling"),S=ws(m,"childNodes"),x=ws(m,"parentNode");if(typeof i=="function"){const Ce=n.createElement("template");Ce.content&&Ce.content.ownerDocument&&(n=Ce.content.ownerDocument)}let E,k="";const{implementation:C,createNodeIterator:N,createDocumentFragment:_,getElementsByTagName:w}=n,{importNode:M}=r;let O=Yd();e.isSupported=typeof Pd=="function"&&typeof x=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:L,ERB_EXPR:F,TMPLIT_EXPR:$,DATA_ATTR:D,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:z,CUSTOM_ELEMENT:H}=Gd;let{IS_ALLOWED_URI:W}=Gd,j=null;const U=Ye({},[...Vd,...Ga,...Ya,...Xa,...Hd]);let B=null;const G=Ye({},[...Ud,...Ka,...Bd,...Vo]);let V=Object.seal(Fd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,X=null,Z=!0,ee=!0,ne=!1,he=!0,J=!1,ce=!0,ue=!1,ae=!1,ve=!1,fe=!1,ye=!1,ke=!1,Ue=!0,se=!1;const Oe="user-content-";let Pe=!0,Ie=!1,je={},st=null;const ut=Ye({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let We=null;const et=Ye({},["audio","video","img","source","image","track"]);let Xe=null;const te=Ye({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let be=me,Be=!1,Se=null;const ze=Ye({},[ge,pe,me],ja);let _e=Ye({},["mi","mo","mn","ms","mtext"]),Re=Ye({},["annotation-xml"]);const ot=Ye({},["title","style","font","a","script"]);let $e=null;const Te=["application/xhtml+xml","text/html"],He="text/html";let De=null,Ze=null;const it=n.createElement("form"),gt=function(Y){return Y instanceof RegExp||Y instanceof Function},tn=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ze&&Ze===Y)){if((!Y||typeof Y!="object")&&(Y={}),Y=Un(Y),$e=Te.indexOf(Y.PARSER_MEDIA_TYPE)===-1?He:Y.PARSER_MEDIA_TYPE,De=$e==="application/xhtml+xml"?ja:zo,j=xn(Y,"ALLOWED_TAGS")?Ye({},Y.ALLOWED_TAGS,De):U,B=xn(Y,"ALLOWED_ATTR")?Ye({},Y.ALLOWED_ATTR,De):G,Se=xn(Y,"ALLOWED_NAMESPACES")?Ye({},Y.ALLOWED_NAMESPACES,ja):ze,Xe=xn(Y,"ADD_URI_SAFE_ATTR")?Ye(Un(te),Y.ADD_URI_SAFE_ATTR,De):te,We=xn(Y,"ADD_DATA_URI_TAGS")?Ye(Un(et),Y.ADD_DATA_URI_TAGS,De):et,st=xn(Y,"FORBID_CONTENTS")?Ye({},Y.FORBID_CONTENTS,De):ut,K=xn(Y,"FORBID_TAGS")?Ye({},Y.FORBID_TAGS,De):Un({}),X=xn(Y,"FORBID_ATTR")?Ye({},Y.FORBID_ATTR,De):Un({}),je=xn(Y,"USE_PROFILES")?Y.USE_PROFILES:!1,Z=Y.ALLOW_ARIA_ATTR!==!1,ee=Y.ALLOW_DATA_ATTR!==!1,ne=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,he=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=Y.SAFE_FOR_TEMPLATES||!1,ce=Y.SAFE_FOR_XML!==!1,ue=Y.WHOLE_DOCUMENT||!1,fe=Y.RETURN_DOM||!1,ye=Y.RETURN_DOM_FRAGMENT||!1,ke=Y.RETURN_TRUSTED_TYPE||!1,ve=Y.FORCE_BODY||!1,Ue=Y.SANITIZE_DOM!==!1,se=Y.SANITIZE_NAMED_PROPS||!1,Pe=Y.KEEP_CONTENT!==!1,Ie=Y.IN_PLACE||!1,W=Y.ALLOWED_URI_REGEXP||jd,be=Y.NAMESPACE||me,_e=Y.MATHML_TEXT_INTEGRATION_POINTS||_e,Re=Y.HTML_INTEGRATION_POINTS||Re,V=Y.CUSTOM_ELEMENT_HANDLING||{},Y.CUSTOM_ELEMENT_HANDLING&>(Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Y.CUSTOM_ELEMENT_HANDLING&>(Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(V.allowCustomizedBuiltInElements=Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(ee=!1),ye&&(fe=!0),je&&(j=Ye({},Hd),B=[],je.html===!0&&(Ye(j,Vd),Ye(B,Ud)),je.svg===!0&&(Ye(j,Ga),Ye(B,Ka),Ye(B,Vo)),je.svgFilters===!0&&(Ye(j,Ya),Ye(B,Ka),Ye(B,Vo)),je.mathMl===!0&&(Ye(j,Xa),Ye(B,Bd),Ye(B,Vo))),Y.ADD_TAGS&&(j===U&&(j=Un(j)),Ye(j,Y.ADD_TAGS,De)),Y.ADD_ATTR&&(B===G&&(B=Un(B)),Ye(B,Y.ADD_ATTR,De)),Y.ADD_URI_SAFE_ATTR&&Ye(Xe,Y.ADD_URI_SAFE_ATTR,De),Y.FORBID_CONTENTS&&(st===ut&&(st=Un(st)),Ye(st,Y.FORBID_CONTENTS,De)),Pe&&(j["#text"]=!0),ue&&Ye(j,["html","head","body"]),j.table&&(Ye(j,["tbody"]),delete K.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=Y.TRUSTED_TYPES_POLICY,k=E.createHTML("")}else E===void 0&&(E=zb(g,s)),E!==null&&typeof k=="string"&&(k=E.createHTML(""));jt&&jt(Y),Ze=Y}},mt=Ye({},[...Ga,...Ya,...Mb]),xt=Ye({},[...Xa,...Nb]),Dt=function(Y){let ie=x(Y);(!ie||!ie.tagName)&&(ie={namespaceURI:be,tagName:"template"});const xe=zo(Y.tagName),ft=zo(ie.tagName);return Se[Y.namespaceURI]?Y.namespaceURI===pe?ie.namespaceURI===me?xe==="svg":ie.namespaceURI===ge?xe==="svg"&&(ft==="annotation-xml"||_e[ft]):!!mt[xe]:Y.namespaceURI===ge?ie.namespaceURI===me?xe==="math":ie.namespaceURI===pe?xe==="math"&&Re[ft]:!!xt[xe]:Y.namespaceURI===me?ie.namespaceURI===pe&&!Re[ft]||ie.namespaceURI===ge&&!_e[ft]?!1:!xt[xe]&&(ot[xe]||!mt[xe]):!!($e==="application/xhtml+xml"&&Se[Y.namespaceURI]):!1},Ve=function(Y){ys(e.removed,{element:Y});try{x(Y).removeChild(Y)}catch{y(Y)}},Bt=function(Y,ie){try{ys(e.removed,{attribute:ie.getAttributeNode(Y),from:ie})}catch{ys(e.removed,{attribute:null,from:ie})}if(ie.removeAttribute(Y),Y==="is")if(fe||ye)try{Ve(ie)}catch{}else try{ie.setAttribute(Y,"")}catch{}},ln=function(Y){let ie=null,xe=null;if(ve)Y=""+Y;else{const le=Wa(Y,/^[\r\n\t ]+/);xe=le&&le[0]}$e==="application/xhtml+xml"&&be===me&&(Y=''+Y+"");const ft=E?E.createHTML(Y):Y;if(be===me)try{ie=new f().parseFromString(ft,$e)}catch{}if(!ie||!ie.documentElement){ie=C.createDocument(be,"template",null);try{ie.documentElement.innerHTML=Be?k:ft}catch{}}const q=ie.body||ie.documentElement;return Y&&xe&&q.insertBefore(n.createTextNode(xe),q.childNodes[0]||null),be===me?w.call(ie,ue?"html":"body")[0]:ue?ie.documentElement:q},nn=function(Y){return N.call(Y.ownerDocument||Y,Y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Nn=function(Y){return Y instanceof u&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof d)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},fr=function(Y){return typeof a=="function"&&Y instanceof a};function bn(Ce,Y,ie){Fo(Ce,xe=>{xe.call(e,Y,ie,Ze)})}const To=function(Y){let ie=null;if(bn(O.beforeSanitizeElements,Y,null),Nn(Y))return Ve(Y),!0;const xe=De(Y.nodeName);if(bn(O.uponSanitizeElement,Y,{tagName:xe,allowedTags:j}),ce&&Y.hasChildNodes()&&!fr(Y.firstElementChild)&&Wt(/<[/\w!]/g,Y.innerHTML)&&Wt(/<[/\w!]/g,Y.textContent)||Y.nodeType===ks.progressingInstruction||ce&&Y.nodeType===ks.comment&&Wt(/<[/\w]/g,Y.data))return Ve(Y),!0;if(!j[xe]||K[xe]){if(!K[xe]&&Do(xe)&&(V.tagNameCheck instanceof RegExp&&Wt(V.tagNameCheck,xe)||V.tagNameCheck instanceof Function&&V.tagNameCheck(xe)))return!1;if(Pe&&!st[xe]){const ft=x(Y)||Y.parentNode,q=S(Y)||Y.childNodes;if(q&&ft){const le=q.length;for(let we=le-1;we>=0;--we){const Ke=p(q[we],!0);Ke.__removalCount=(Y.__removalCount||0)+1,ft.insertBefore(Ke,b(Y))}}}return Ve(Y),!0}return Y instanceof l&&!Dt(Y)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&Wt(/<\/no(script|embed|frames)/i,Y.innerHTML)?(Ve(Y),!0):(J&&Y.nodeType===ks.text&&(ie=Y.textContent,Fo([L,F,$],ft=>{ie=vs(ie,ft," ")}),Y.textContent!==ie&&(ys(e.removed,{element:Y.cloneNode()}),Y.textContent=ie)),bn(O.afterSanitizeElements,Y,null),!1)},Ao=function(Y,ie,xe){if(Ue&&(ie==="id"||ie==="name")&&(xe in n||xe in it))return!1;if(!(ee&&!X[ie]&&Wt(D,ie))){if(!(Z&&Wt(A,ie))){if(!B[ie]||X[ie]){if(!(Do(Y)&&(V.tagNameCheck instanceof RegExp&&Wt(V.tagNameCheck,Y)||V.tagNameCheck instanceof Function&&V.tagNameCheck(Y))&&(V.attributeNameCheck instanceof RegExp&&Wt(V.attributeNameCheck,ie)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(ie,Y))||ie==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&Wt(V.tagNameCheck,xe)||V.tagNameCheck instanceof Function&&V.tagNameCheck(xe))))return!1}else if(!Xe[ie]){if(!Wt(W,vs(xe,z,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&Y!=="script"&&Cb(xe,"data:")===0&&We[Y])){if(!(ne&&!Wt(T,vs(xe,z,"")))){if(xe)return!1}}}}}}return!0},Do=function(Y){return Y!=="annotation-xml"&&Wa(Y,H)},Dr=function(Y){bn(O.beforeSanitizeAttributes,Y,null);const{attributes:ie}=Y;if(!ie||Nn(Y))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let ft=ie.length;for(;ft--;){const q=ie[ft],{name:le,namespaceURI:we,value:Ke}=q,Le=De(le),Io=Ke;let Pt=le==="value"?Io:Sb(Io);if(xe.attrName=Le,xe.attrValue=Pt,xe.keepAttr=!0,xe.forceKeepAttr=void 0,bn(O.uponSanitizeAttribute,Y,xe),Pt=xe.attrValue,se&&(Le==="id"||Le==="name")&&(Bt(le,Y),Pt=Oe+Pt),ce&&Wt(/((--!?|])>)|<\/(style|title|textarea)/i,Pt)){Bt(le,Y);continue}if(Le==="attributename"&&Wa(Pt,"href")){Bt(le,Y);continue}if(xe.forceKeepAttr)continue;if(!xe.keepAttr){Bt(le,Y);continue}if(!he&&Wt(/\/>/i,Pt)){Bt(le,Y);continue}J&&Fo([L,F,$],Zm=>{Pt=vs(Pt,Zm," ")});const qm=De(Y.nodeName);if(!Ao(qm,Le,Pt)){Bt(le,Y);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!we)switch(g.getAttributeType(qm,Le)){case"TrustedHTML":{Pt=E.createHTML(Pt);break}case"TrustedScriptURL":{Pt=E.createScriptURL(Pt);break}}if(Pt!==Io)try{we?Y.setAttributeNS(we,le,Pt):Y.setAttribute(le,Pt),Nn(Y)?Ve(Y):zd(e.removed)}catch{Bt(le,Y)}}bn(O.afterSanitizeAttributes,Y,null)},Ta=function Ce(Y){let ie=null;const xe=nn(Y);for(bn(O.beforeSanitizeShadowDOM,Y,null);ie=xe.nextNode();)bn(O.uponSanitizeShadowNode,ie,null),To(ie),Dr(ie),ie.content instanceof o&&Ce(ie.content);bn(O.afterSanitizeShadowDOM,Y,null)};return e.sanitize=function(Ce){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,xe=null,ft=null,q=null;if(Be=!Ce,Be&&(Ce=""),typeof Ce!="string"&&!fr(Ce))if(typeof Ce.toString=="function"){if(Ce=Ce.toString(),typeof Ce!="string")throw xs("dirty is not a string, aborting")}else throw xs("toString is not a function");if(!e.isSupported)return Ce;if(ae||tn(Y),e.removed=[],typeof Ce=="string"&&(Ie=!1),Ie){if(Ce.nodeName){const Ke=De(Ce.nodeName);if(!j[Ke]||K[Ke])throw xs("root node is forbidden and cannot be sanitized in-place")}}else if(Ce instanceof a)ie=ln(""),xe=ie.ownerDocument.importNode(Ce,!0),xe.nodeType===ks.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?ie=xe:ie.appendChild(xe);else{if(!fe&&!J&&!ue&&Ce.indexOf("<")===-1)return E&&ke?E.createHTML(Ce):Ce;if(ie=ln(Ce),!ie)return fe?null:ke?k:""}ie&&ve&&Ve(ie.firstChild);const le=nn(Ie?Ce:ie);for(;ft=le.nextNode();)To(ft),Dr(ft),ft.content instanceof o&&Ta(ft.content);if(Ie)return Ce;if(fe){if(ye)for(q=_.call(ie.ownerDocument);ie.firstChild;)q.appendChild(ie.firstChild);else q=ie;return(B.shadowroot||B.shadowrootmode)&&(q=M.call(r,q,!0)),q}let we=ue?ie.outerHTML:ie.innerHTML;return ue&&j["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&Wt(Wd,ie.ownerDocument.doctype.name)&&(we=" -`+we),J&&Fo([L,F,$],Ke=>{we=vs(we,Ke," ")}),E&&ke?E.createHTML(we):we},e.setConfig=function(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tn(Ce),ae=!0},e.clearConfig=function(){Ze=null,ae=!1},e.isValidAttribute=function(Ce,Y,ie){Ze||tn({});const xe=De(Ce),ft=De(Y);return Ao(xe,ft,ie)},e.addHook=function(Ce,Y){typeof Y=="function"&&ys(O[Ce],Y)},e.removeHook=function(Ce,Y){if(Y!==void 0){const ie=wb(O[Ce],Y);return ie===-1?void 0:kb(O[Ce],ie,1)[0]}return zd(O[Ce])},e.removeHooks=function(Ce){O[Ce]=[]},e.removeAllHooks=function(){O=Yd()},e}var Vb=Xd();const qa=({content:t,text:e,isHtml:n=!0,className:r="",purifyConfig:s,id:o,editorAttrs:i})=>{const a=e??t??"";if(!a||a.trim()==="")return null;if(!n){const u=` + `,onClick:()=>L(ee),title:H(ee),children:[ee.toUpperCase(),ee===x&&h.jsx(Q,{className:"text-red-400 ml-0.5",children:"*"})]},ee))}),h.jsx(I,{className:"flex-1 min-w-0",children:n==="textarea"?h.jsx(Zn,{name:`${f}[${O}]`,value:k[O]||"",onChange:ee=>A(O,ee.target.value),placeholder:i,required:a&&O===x,disabled:l,maxLength:c,rows:d,className:Z}):h.jsx(wt,{type:"text",name:`${f}[${O}]`,value:k[O]||"",onChange:ee=>A(O,ee.target.value),placeholder:i,required:a&&O===x,disabled:l,maxLength:c,className:X})})]})})};return h.jsxs(I,{className:l?"opacity-50 cursor-not-allowed":void 0,id:p,...y,children:[r==="compact"?K():r==="tabs"?V():G(),b&&m&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:m})]})};Va.displayName="MultilingualInput";const vb=()=>window.G7Core,Ha=({checked:t,value:e,onChange:n,disabled:r=!1,label:s,description:o,size:i="md",className:a="",name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(()=>t??e??!1);v.useEffect(()=>{f(t??e??!1)},[t,e]);const g=b=>{const S=b.target.checked;f(S),n&&!r&&n(b)},p={sm:{track:"w-9 h-5",thumb:"after:h-4 after:w-4"},md:{track:"w-11 h-6",thumb:"after:h-5 after:w-5"},lg:{track:"w-14 h-7",thumb:"after:h-6 after:w-6"}}[i],y=()=>{if(!r){const b=!u;if(f(b),n){const S=vb();S?.createChangeEvent&&n(S.createChangeEvent({checked:b,name:l}))}}};return h.jsxs("div",{className:`toggle-container ${a}`,id:c,...d,children:[h.jsxs("div",{className:`toggle-switch-wrapper ${r?"cursor-not-allowed opacity-50":"cursor-pointer"}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),y()},children:[h.jsx("input",{type:"checkbox",id:l,name:l,checked:u,onChange:g,disabled:r,className:"sr-only peer",tabIndex:-1}),h.jsx("div",{className:`toggle-switch-track ${p.track} ${p.thumb}`})]}),s&&h.jsx("span",{className:`toggle-label ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:y,children:s}),o&&h.jsx("p",{className:"toggle-description",children:o})]})},$o=({status:t,label:e,showIcon:n=!0,iconName:r,className:s="",style:o,id:i,editorAttrs:a})=>{const l={success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",pending:"bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-gray-600",default:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600"},c={success:de.CheckCircle,warning:de.ExclamationTriangle,error:de.XCircle,info:de.InfoCircle,pending:de.Clock,default:de.QuestionCircle},d={success:"성공",warning:"경고",error:"오류",info:"정보",pending:"대기 중",default:"기본"},u=r||c[t],f=e||d[t],g=l[t];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border ${g} ${s}`,style:o,id:i,...a,children:[n&&h.jsx(re,{name:u,className:"w-4 h-4"}),h.jsx(Q,{children:f})]})},Id={blue:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",green:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",red:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",gray:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",yellow:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",purple:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",orange:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",teal:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",cyan:"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300"},xb={success:"green",warning:"yellow",danger:"red",error:"red",info:"blue",primary:"blue",secondary:"gray",text:"gray",default:"gray"},Ld={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs",lg:"px-2.5 py-1 text-sm"},Pd=({color:t,variant:e,text:n,size:r="md",className:s="",style:o,children:i,id:a,editorAttrs:l})=>{const c=t||(e?xb[e]:void 0)||"gray",d=Id[c]||Id.gray,u=Ld[r]||Ld.md;return h.jsxs(Q,{className:`inline-flex items-center rounded-full font-medium ${u} ${d} ${s}`,style:o,id:a,...l,children:[n,i]})};const{entries:$d,setPrototypeOf:Fd,isFrozen:wb,getPrototypeOf:kb,getOwnPropertyDescriptor:Cb}=Object;let{freeze:jt,seal:cn,create:zd}=Object,{apply:Ua,construct:Ba}=typeof Reflect<"u"&&Reflect;jt||(jt=function(e){return e}),cn||(cn=function(e){return e}),Ua||(Ua=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o1?n-1:0),s=1;s1?n-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:zo;Fd&&Fd(t,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const o=n(s);o!==s&&(wb(e)||(e[r]=o),s=o)}t[s]=!0}return t}function Ob(t){for(let e=0;e/gm),Lb=cn(/\$\{[\w\W]*/gm),Pb=cn(/^data-[\-\w.\u00B7-\uFFFF]+$/),$b=cn(/^aria-[\-\w]+$/),Wd=cn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Fb=cn(/^(?:\w+script|data):/i),zb=cn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Gd=cn(/^html$/i),Vb=cn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yd=Object.freeze({__proto__:null,ARIA_ATTR:$b,ATTR_WHITESPACE:zb,CUSTOM_ELEMENT:Vb,DATA_ATTR:Pb,DOCTYPE_NAME:Gd,ERB_EXPR:Ib,IS_ALLOWED_URI:Wd,IS_SCRIPT_OR_DATA:Fb,MUSTACHE_EXPR:Db,TMPLIT_EXPR:Lb});const ks={element:1,text:3,progressingInstruction:7,comment:8,document:9},Hb=function(){return typeof window>"u"?null:window},Ub=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Xd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Kd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Hb();const e=Ce=>Kd(Ce);if(e.version="3.2.7",e.removed=[],!t||!t.document||t.document.nodeType!==ks.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,s=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:g}=t,m=l.prototype,p=ws(m,"cloneNode"),y=ws(m,"remove"),b=ws(m,"nextSibling"),S=ws(m,"childNodes"),x=ws(m,"parentNode");if(typeof i=="function"){const Ce=n.createElement("template");Ce.content&&Ce.content.ownerDocument&&(n=Ce.content.ownerDocument)}let E,k="";const{implementation:C,createNodeIterator:N,createDocumentFragment:_,getElementsByTagName:w}=n,{importNode:M}=r;let O=Xd();e.isSupported=typeof $d=="function"&&typeof x=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:L,ERB_EXPR:F,TMPLIT_EXPR:$,DATA_ATTR:D,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:z,CUSTOM_ELEMENT:H}=Yd;let{IS_ALLOWED_URI:W}=Yd,j=null;const U=Ye({},[...Hd,...Ga,...Ya,...Xa,...Ud]);let B=null;const G=Ye({},[...Bd,...Ka,...jd,...Vo]);let V=Object.seal(zd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,X=null,Z=!0,ee=!0,ne=!1,he=!0,J=!1,ce=!0,ue=!1,ae=!1,ve=!1,fe=!1,ye=!1,ke=!1,Ue=!0,se=!1;const Oe="user-content-";let Pe=!0,Ie=!1,je={},st=null;const ut=Ye({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let We=null;const et=Ye({},["audio","video","img","source","image","track"]);let Xe=null;const te=Ye({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let be=me,Be=!1,Se=null;const ze=Ye({},[ge,pe,me],ja);let _e=Ye({},["mi","mo","mn","ms","mtext"]),Re=Ye({},["annotation-xml"]);const ot=Ye({},["title","style","font","a","script"]);let $e=null;const Te=["application/xhtml+xml","text/html"],He="text/html";let De=null,Ze=null;const it=n.createElement("form"),gt=function(Y){return Y instanceof RegExp||Y instanceof Function},tn=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ze&&Ze===Y)){if((!Y||typeof Y!="object")&&(Y={}),Y=Un(Y),$e=Te.indexOf(Y.PARSER_MEDIA_TYPE)===-1?He:Y.PARSER_MEDIA_TYPE,De=$e==="application/xhtml+xml"?ja:zo,j=xn(Y,"ALLOWED_TAGS")?Ye({},Y.ALLOWED_TAGS,De):U,B=xn(Y,"ALLOWED_ATTR")?Ye({},Y.ALLOWED_ATTR,De):G,Se=xn(Y,"ALLOWED_NAMESPACES")?Ye({},Y.ALLOWED_NAMESPACES,ja):ze,Xe=xn(Y,"ADD_URI_SAFE_ATTR")?Ye(Un(te),Y.ADD_URI_SAFE_ATTR,De):te,We=xn(Y,"ADD_DATA_URI_TAGS")?Ye(Un(et),Y.ADD_DATA_URI_TAGS,De):et,st=xn(Y,"FORBID_CONTENTS")?Ye({},Y.FORBID_CONTENTS,De):ut,K=xn(Y,"FORBID_TAGS")?Ye({},Y.FORBID_TAGS,De):Un({}),X=xn(Y,"FORBID_ATTR")?Ye({},Y.FORBID_ATTR,De):Un({}),je=xn(Y,"USE_PROFILES")?Y.USE_PROFILES:!1,Z=Y.ALLOW_ARIA_ATTR!==!1,ee=Y.ALLOW_DATA_ATTR!==!1,ne=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,he=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=Y.SAFE_FOR_TEMPLATES||!1,ce=Y.SAFE_FOR_XML!==!1,ue=Y.WHOLE_DOCUMENT||!1,fe=Y.RETURN_DOM||!1,ye=Y.RETURN_DOM_FRAGMENT||!1,ke=Y.RETURN_TRUSTED_TYPE||!1,ve=Y.FORCE_BODY||!1,Ue=Y.SANITIZE_DOM!==!1,se=Y.SANITIZE_NAMED_PROPS||!1,Pe=Y.KEEP_CONTENT!==!1,Ie=Y.IN_PLACE||!1,W=Y.ALLOWED_URI_REGEXP||Wd,be=Y.NAMESPACE||me,_e=Y.MATHML_TEXT_INTEGRATION_POINTS||_e,Re=Y.HTML_INTEGRATION_POINTS||Re,V=Y.CUSTOM_ELEMENT_HANDLING||{},Y.CUSTOM_ELEMENT_HANDLING&>(Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Y.CUSTOM_ELEMENT_HANDLING&>(Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(V.allowCustomizedBuiltInElements=Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(ee=!1),ye&&(fe=!0),je&&(j=Ye({},Ud),B=[],je.html===!0&&(Ye(j,Hd),Ye(B,Bd)),je.svg===!0&&(Ye(j,Ga),Ye(B,Ka),Ye(B,Vo)),je.svgFilters===!0&&(Ye(j,Ya),Ye(B,Ka),Ye(B,Vo)),je.mathMl===!0&&(Ye(j,Xa),Ye(B,jd),Ye(B,Vo))),Y.ADD_TAGS&&(j===U&&(j=Un(j)),Ye(j,Y.ADD_TAGS,De)),Y.ADD_ATTR&&(B===G&&(B=Un(B)),Ye(B,Y.ADD_ATTR,De)),Y.ADD_URI_SAFE_ATTR&&Ye(Xe,Y.ADD_URI_SAFE_ATTR,De),Y.FORBID_CONTENTS&&(st===ut&&(st=Un(st)),Ye(st,Y.FORBID_CONTENTS,De)),Pe&&(j["#text"]=!0),ue&&Ye(j,["html","head","body"]),j.table&&(Ye(j,["tbody"]),delete K.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=Y.TRUSTED_TYPES_POLICY,k=E.createHTML("")}else E===void 0&&(E=Ub(g,s)),E!==null&&typeof k=="string"&&(k=E.createHTML(""));jt&&jt(Y),Ze=Y}},mt=Ye({},[...Ga,...Ya,...Tb]),xt=Ye({},[...Xa,...Ab]),Dt=function(Y){let ie=x(Y);(!ie||!ie.tagName)&&(ie={namespaceURI:be,tagName:"template"});const xe=zo(Y.tagName),ft=zo(ie.tagName);return Se[Y.namespaceURI]?Y.namespaceURI===pe?ie.namespaceURI===me?xe==="svg":ie.namespaceURI===ge?xe==="svg"&&(ft==="annotation-xml"||_e[ft]):!!mt[xe]:Y.namespaceURI===ge?ie.namespaceURI===me?xe==="math":ie.namespaceURI===pe?xe==="math"&&Re[ft]:!!xt[xe]:Y.namespaceURI===me?ie.namespaceURI===pe&&!Re[ft]||ie.namespaceURI===ge&&!_e[ft]?!1:!xt[xe]&&(ot[xe]||!mt[xe]):!!($e==="application/xhtml+xml"&&Se[Y.namespaceURI]):!1},Ve=function(Y){ys(e.removed,{element:Y});try{x(Y).removeChild(Y)}catch{y(Y)}},Bt=function(Y,ie){try{ys(e.removed,{attribute:ie.getAttributeNode(Y),from:ie})}catch{ys(e.removed,{attribute:null,from:ie})}if(ie.removeAttribute(Y),Y==="is")if(fe||ye)try{Ve(ie)}catch{}else try{ie.setAttribute(Y,"")}catch{}},ln=function(Y){let ie=null,xe=null;if(ve)Y=""+Y;else{const le=Wa(Y,/^[\r\n\t ]+/);xe=le&&le[0]}$e==="application/xhtml+xml"&&be===me&&(Y=''+Y+"");const ft=E?E.createHTML(Y):Y;if(be===me)try{ie=new f().parseFromString(ft,$e)}catch{}if(!ie||!ie.documentElement){ie=C.createDocument(be,"template",null);try{ie.documentElement.innerHTML=Be?k:ft}catch{}}const q=ie.body||ie.documentElement;return Y&&xe&&q.insertBefore(n.createTextNode(xe),q.childNodes[0]||null),be===me?w.call(ie,ue?"html":"body")[0]:ue?ie.documentElement:q},nn=function(Y){return N.call(Y.ownerDocument||Y,Y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Nn=function(Y){return Y instanceof u&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof d)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},fr=function(Y){return typeof a=="function"&&Y instanceof a};function bn(Ce,Y,ie){Fo(Ce,xe=>{xe.call(e,Y,ie,Ze)})}const To=function(Y){let ie=null;if(bn(O.beforeSanitizeElements,Y,null),Nn(Y))return Ve(Y),!0;const xe=De(Y.nodeName);if(bn(O.uponSanitizeElement,Y,{tagName:xe,allowedTags:j}),ce&&Y.hasChildNodes()&&!fr(Y.firstElementChild)&&Wt(/<[/\w!]/g,Y.innerHTML)&&Wt(/<[/\w!]/g,Y.textContent)||Y.nodeType===ks.progressingInstruction||ce&&Y.nodeType===ks.comment&&Wt(/<[/\w]/g,Y.data))return Ve(Y),!0;if(!j[xe]||K[xe]){if(!K[xe]&&Do(xe)&&(V.tagNameCheck instanceof RegExp&&Wt(V.tagNameCheck,xe)||V.tagNameCheck instanceof Function&&V.tagNameCheck(xe)))return!1;if(Pe&&!st[xe]){const ft=x(Y)||Y.parentNode,q=S(Y)||Y.childNodes;if(q&&ft){const le=q.length;for(let we=le-1;we>=0;--we){const Ke=p(q[we],!0);Ke.__removalCount=(Y.__removalCount||0)+1,ft.insertBefore(Ke,b(Y))}}}return Ve(Y),!0}return Y instanceof l&&!Dt(Y)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&Wt(/<\/no(script|embed|frames)/i,Y.innerHTML)?(Ve(Y),!0):(J&&Y.nodeType===ks.text&&(ie=Y.textContent,Fo([L,F,$],ft=>{ie=vs(ie,ft," ")}),Y.textContent!==ie&&(ys(e.removed,{element:Y.cloneNode()}),Y.textContent=ie)),bn(O.afterSanitizeElements,Y,null),!1)},Ao=function(Y,ie,xe){if(Ue&&(ie==="id"||ie==="name")&&(xe in n||xe in it))return!1;if(!(ee&&!X[ie]&&Wt(D,ie))){if(!(Z&&Wt(A,ie))){if(!B[ie]||X[ie]){if(!(Do(Y)&&(V.tagNameCheck instanceof RegExp&&Wt(V.tagNameCheck,Y)||V.tagNameCheck instanceof Function&&V.tagNameCheck(Y))&&(V.attributeNameCheck instanceof RegExp&&Wt(V.attributeNameCheck,ie)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(ie,Y))||ie==="is"&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&Wt(V.tagNameCheck,xe)||V.tagNameCheck instanceof Function&&V.tagNameCheck(xe))))return!1}else if(!Xe[ie]){if(!Wt(W,vs(xe,z,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&Y!=="script"&&Eb(xe,"data:")===0&&We[Y])){if(!(ne&&!Wt(T,vs(xe,z,"")))){if(xe)return!1}}}}}}return!0},Do=function(Y){return Y!=="annotation-xml"&&Wa(Y,H)},Dr=function(Y){bn(O.beforeSanitizeAttributes,Y,null);const{attributes:ie}=Y;if(!ie||Nn(Y))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0};let ft=ie.length;for(;ft--;){const q=ie[ft],{name:le,namespaceURI:we,value:Ke}=q,Le=De(le),Io=Ke;let Pt=le==="value"?Io:Mb(Io);if(xe.attrName=Le,xe.attrValue=Pt,xe.keepAttr=!0,xe.forceKeepAttr=void 0,bn(O.uponSanitizeAttribute,Y,xe),Pt=xe.attrValue,se&&(Le==="id"||Le==="name")&&(Bt(le,Y),Pt=Oe+Pt),ce&&Wt(/((--!?|])>)|<\/(style|title|textarea)/i,Pt)){Bt(le,Y);continue}if(Le==="attributename"&&Wa(Pt,"href")){Bt(le,Y);continue}if(xe.forceKeepAttr)continue;if(!xe.keepAttr){Bt(le,Y);continue}if(!he&&Wt(/\/>/i,Pt)){Bt(le,Y);continue}J&&Fo([L,F,$],Rm=>{Pt=vs(Pt,Rm," ")});const Jm=De(Y.nodeName);if(!Ao(Jm,Le,Pt)){Bt(le,Y);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!we)switch(g.getAttributeType(Jm,Le)){case"TrustedHTML":{Pt=E.createHTML(Pt);break}case"TrustedScriptURL":{Pt=E.createScriptURL(Pt);break}}if(Pt!==Io)try{we?Y.setAttributeNS(we,le,Pt):Y.setAttribute(le,Pt),Nn(Y)?Ve(Y):Vd(e.removed)}catch{Bt(le,Y)}}bn(O.afterSanitizeAttributes,Y,null)},Ta=function Ce(Y){let ie=null;const xe=nn(Y);for(bn(O.beforeSanitizeShadowDOM,Y,null);ie=xe.nextNode();)bn(O.uponSanitizeShadowNode,ie,null),To(ie),Dr(ie),ie.content instanceof o&&Ce(ie.content);bn(O.afterSanitizeShadowDOM,Y,null)};return e.sanitize=function(Ce){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,xe=null,ft=null,q=null;if(Be=!Ce,Be&&(Ce=""),typeof Ce!="string"&&!fr(Ce))if(typeof Ce.toString=="function"){if(Ce=Ce.toString(),typeof Ce!="string")throw xs("dirty is not a string, aborting")}else throw xs("toString is not a function");if(!e.isSupported)return Ce;if(ae||tn(Y),e.removed=[],typeof Ce=="string"&&(Ie=!1),Ie){if(Ce.nodeName){const Ke=De(Ce.nodeName);if(!j[Ke]||K[Ke])throw xs("root node is forbidden and cannot be sanitized in-place")}}else if(Ce instanceof a)ie=ln(""),xe=ie.ownerDocument.importNode(Ce,!0),xe.nodeType===ks.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?ie=xe:ie.appendChild(xe);else{if(!fe&&!J&&!ue&&Ce.indexOf("<")===-1)return E&&ke?E.createHTML(Ce):Ce;if(ie=ln(Ce),!ie)return fe?null:ke?k:""}ie&&ve&&Ve(ie.firstChild);const le=nn(Ie?Ce:ie);for(;ft=le.nextNode();)To(ft),Dr(ft),ft.content instanceof o&&Ta(ft.content);if(Ie)return Ce;if(fe){if(ye)for(q=_.call(ie.ownerDocument);ie.firstChild;)q.appendChild(ie.firstChild);else q=ie;return(B.shadowroot||B.shadowrootmode)&&(q=M.call(r,q,!0)),q}let we=ue?ie.outerHTML:ie.innerHTML;return ue&&j["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&Wt(Gd,ie.ownerDocument.doctype.name)&&(we=" +`+we),J&&Fo([L,F,$],Ke=>{we=vs(we,Ke," ")}),E&&ke?E.createHTML(we):we},e.setConfig=function(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tn(Ce),ae=!0},e.clearConfig=function(){Ze=null,ae=!1},e.isValidAttribute=function(Ce,Y,ie){Ze||tn({});const xe=De(Ce),ft=De(Y);return Ao(xe,ft,ie)},e.addHook=function(Ce,Y){typeof Y=="function"&&ys(O[Ce],Y)},e.removeHook=function(Ce,Y){if(Y!==void 0){const ie=Sb(O[Ce],Y);return ie===-1?void 0:_b(O[Ce],ie,1)[0]}return Vd(O[Ce])},e.removeHooks=function(Ce){O[Ce]=[]},e.removeAllHooks=function(){O=Xd()},e}var Bb=Kd();const qa=({content:t,text:e,isHtml:n=!0,className:r="",purifyConfig:s,id:o,editorAttrs:i})=>{const a=e??t??"";if(!a||a.trim()==="")return null;if(!n){const u=` whitespace-pre-wrap text-gray-900 dark:text-gray-100 font-sans ${r} - `.trim().replace(/\s+/g," ");return h.jsx(I,{className:u,id:o,...i,children:a})}const l={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},c=v.useMemo(()=>{const u=s?{...l,...s,FORBID_TAGS:[...l.FORBID_TAGS,...s.FORBID_TAGS||[]],FORBID_ATTR:[...l.FORBID_ATTR,...s.FORBID_ATTR||[]]}:l;return Vb.sanitize(a,u).replace(/]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,m,p,y)=>(p.startsWith("http://")||p.startsWith("https://"))&&!g.includes("rel=")?``:g)},[a,s]),d=` + `.trim().replace(/\s+/g," ");return h.jsx(I,{className:u,id:o,...i,children:a})}const l={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},c=v.useMemo(()=>{const u=s?{...l,...s,FORBID_TAGS:[...l.FORBID_TAGS,...s.FORBID_TAGS||[]],FORBID_ATTR:[...l.FORBID_ATTR,...s.FORBID_ATTR||[]]}:l;return Bb.sanitize(a,u).replace(/]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,m,p,y)=>(p.startsWith("http://")||p.startsWith("https://"))&&!g.includes("rel=")?``:g)},[a,s]),d=` prose dark:prose-invert max-w-none prose-p:my-2 prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4 @@ -35,22 +35,22 @@ var SirsoftAdminBasic=(function(R,h,v,On){"use strict";var T5=Object.definePrope [&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50 after:content-[''] after:block after:clear-both ${r} - `.trim().replace(/\s+/g," ");return h.jsx(I,{className:d,dangerouslySetInnerHTML:{__html:c},id:o,...i})},Ho=window.G7Core?.createLogger?.("Comp:DataGrid")??{log:(...t)=>console.log("[Comp:DataGrid]",...t),warn:(...t)=>console.warn("[Comp:DataGrid]",...t),error:(...t)=>console.error("[Comp:DataGrid]",...t)},Cs=(t,e)=>window.G7Core?.t?.(t,e)??t,Za={Div:I,Span:Q,Button:oe,Icon:re,Checkbox:vn,P:bt,A:Lr,Label:rn,Input:wt,H1:Aa,H2:Qn,H3:Ir,H4:Md,Img:yn,Select:Pr,Textarea:Zn,Table:Pa,Thead:$a,Tbody:Fa,Tfoot:za,Tr:Jn,Th:$r,Td:Kt,MultilingualInput:Va,Toggle:Ha,StatusBadge:$o,Badge:Ld,HtmlContent:qa,ActionMenu:bs},Qa=t=>{if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(e=>Qa(e)).join(", ");if(typeof t=="object"){if(v.isValidElement(t))return t;if(Object.keys(t).length===0)return"";try{return JSON.stringify(t)}catch{return Ho.warn("객체를 문자열로 변환할 수 없습니다:",t),"[Object]"}}return String(t)},Kd=(t,e)=>{if(!t)return!0;const n=t.match(/^\{\{(.+)\}\}$/);if(!n)return!0;const r=n[1].trim();try{return!!new Function("row",`return ${r}`)(e)}catch(s){return Ho.warn("subRow 조건 평가 실패:",t,s),!0}},Ss=(t,e,n,r="",s)=>{const o=window.G7Core;if(o?.renderItemChildren){const i={row:e,value:n,$value:n};return o.renderItemChildren(t,i,Za,r,s?{componentContext:s}:void 0)}return Ho.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Ja=(t,e,n="",r)=>{const s=window.G7Core;if(s?.renderItemChildren){const o={row:e,$value:e};return s.renderItemChildren(t,o,Za,n,r?{componentContext:r}:void 0)}return Ho.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Hb=({id:t,columns:e,data:n,sortable:r=!0,pagination:s=!1,pageSize:o=10,onRowClick:i,className:a="",style:l,sortField:c,sortDirection:d,onSortChange:u,selectable:f=!1,selectedIds:g=[],onSelectionChange:m,idField:p="id",showColumnSelector:y=!1,visibleColumns:b,onColumnVisibilityChange:S,responsiveBreakpoint:x=768,cardRenderer:E,rowActions:k,onRowAction:C,alwaysShowPagination:N=!1,serverSidePagination:_=!1,serverCurrentPage:w,serverTotalPages:M,onPageChange:O,prevText:L,nextText:F,columnSelectorText:$,emptyMessage:D,actionsColumnHeader:A,requiredText:T,selectedCountText:z,showFirstLast:H=!0,expandable:W=!1,expandedRowIds:j,onExpandChange:U,expandChildren:B,expandedRowRender:G,expandColumnWidth:V="48px",expandIconExpanded:K=de.ChevronDown,expandIconCollapsed:X=de.ChevronRight,expandConditionField:Z,dynamicColumns:ee,dynamicColumnsInsertAfter:ne,expandContext:he,__componentContext:J,subRowChildren:ce,subRowCondition:ue,subRowClassName:ae="px-6 py-2 bg-gray-50 dark:bg-gray-900",subRowRender:ve,footerCells:fe,footerClassName:ye="bg-gray-50 dark:bg-gray-800/50 font-medium",footerCardChildren:ke,editorAttrs:Ue})=>{const se=L||void 0,Oe=F||void 0,Pe=$??Cs("common.column_selector"),Ie=D??Cs("common.no_data"),je=A??Cs("common.actions"),st=T??Cs("common.required"),ut=z??Cs("common.selected_count"),We=window.G7Core,et=We?.useControllableState,Xe=We?.shallowArrayEqual,[te,ge]=et?et(c,null,q=>{q!==null&&u?.(q,pe)}):[c??null,()=>{}],[pe,me]=et?et(d,"asc",q=>{te!==null&&u?.(te,q)}):[d??"asc",()=>{}],[be,Be]=v.useState(1),[Se,ze]=et?et(j,[],U,{isEqual:Xe}):[j??[],()=>{}],[_e,Re]=v.useState(!1),ot=v.useRef(null),$e=We?.useResponsive,Te=$e?.(),He=Te?Te.width{if(!ee||!Array.isArray(ee)||ee.length===0)return e;if(ne){const q=e.findIndex(le=>le.field===ne);if(q!==-1)return[...e.slice(0,q+1),...ee,...e.slice(q+1)]}return[...e,...ee]},[e,ee,ne]),[Ze,it]=v.useState(()=>b&&b.length>0?b:e.filter(q=>!q.hidden).map(q=>q.field));v.useEffect(()=>{b&&b.length>0&&it(b)},[b]);const gt=v.useRef("");v.useEffect(()=>{const q=e.map(le=>le.field).join(",");gt.current&&q!==gt.current&&(!b||b.length===0)&&it(e.filter(le=>!le.hidden).map(le=>le.field)),gt.current=q},[e,b]);const tn=v.useRef([]),mt=v.useRef(null);v.useEffect(()=>{if(ee&&ee.length>0){const q=ee.map(Ke=>Ke.field);if(mt.current===null&&(mt.current=b!==void 0&&b.length>0,mt.current)){tn.current=q;return}const le=tn.current,we=q.filter(Ke=>!le.includes(Ke));if(we.length>0){const Ke=we.filter(Le=>!Ze.includes(Le));if(Ke.length>0){const Le=[...Ze,...Ke];it(Le),S?.(Le)}}tn.current=q}},[ee]),v.useEffect(()=>{_||Be(1)},[n,_]),v.useEffect(()=>{const q=le=>{ot.current&&!ot.current.contains(le.target)&&Re(!1)};return _e&&document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[_e]);const xt=v.useMemo(()=>!y&&(!b||b.length===0)?De.filter(q=>!q.hidden):De.filter(q=>Ze.includes(q.field)),[De,Ze,y,b]),Dt=v.useMemo(()=>!te||!r||!n?n||[]:u?n:[...n].sort((q,le)=>{const we=q[te],Ke=le[te];if(we===Ke)return 0;const Le=we>Ke?1:-1;return pe==="asc"?Le:-Le}),[n,te,pe,r,u]),Ve=v.useMemo(()=>{if(_||!s)return Dt;const q=(be-1)*o,le=q+o;return Dt.slice(q,le)},[Dt,be,o,s,_]),Bt=_?w||1:be,ln=_?M||1:Math.ceil((Dt?.length||0)/o),nn=v.useCallback(q=>{_&&O?O(q):Be(q)},[_,O]),Nn=q=>{if(!r||e.find(Ke=>Ke.field===q)?.sortable===!1)return;const we=te===q&&pe==="asc"?"desc":"asc";et?(ge(q),me(we)):u&&u(q,we)},fr=v.useCallback(()=>{if(!m||!Ve)return;const q=Ve.map(we=>we[p]);if(q.every(we=>g.includes(we)))m(g.filter(we=>!q.includes(we)));else{const we=[...new Set([...g,...q])];m(we)}},[Ve,g,m,p]),bn=v.useCallback(q=>{m&&(g.includes(q)?m(g.filter(le=>le!==q)):m([...g,q]))},[g,m]),To=v.useCallback(q=>{if(De.find(Ke=>Ke.field===q)?.required)return;const we=Ze.includes(q)?Ze.filter(Ke=>Ke!==q):[...Ze,q];it(we),S?.(we)},[De,Ze,S]),Ao=v.useCallback((q,le)=>{C?.(q,le)},[C]),Do=v.useCallback(q=>k?k.map(le=>{let we=le.disabled??!1;if(le.disabledField&&!we){const Ke=le.disabledField.split(".");let Le=q;for(const Io of Ke)Le=Le?.[Io];Le||(we=!0)}return{...le,disabled:we,onClick:()=>Ao(le.id,q)}}):[],[k,Ao]),Dr=v.useCallback(q=>{if(!Z)return!0;const le=q[Z];return Array.isArray(le)?le.length>0:!!le},[Z]),Ta=v.useCallback(q=>{const le=Se.includes(q)?Se.filter(we=>we!==q):[...Se,q];et?ze(le):U&&U(le)},[Se,U,et,ze]),Ce=v.useCallback(q=>Se.includes(q),[Se]),Y=v.useCallback(q=>G?G(q):B&&B.length>0&&We?.renderExpandContent?We.renderExpandContent({children:B,row:q,expandContext:he,componentContext:J,componentMap:Za,keyPrefix:`expand-${q[p]}`}):null,[G,B,p,he,J,J?.state]),ie=v.useMemo(()=>!Ve||Ve.length===0?!1:Ve.every(q=>g.includes(q[p])),[Ve,g,p]),xe=v.useMemo(()=>{if(!Ve||Ve.length===0)return!1;const q=Ve.filter(le=>g.includes(le[p])).length;return q>0&&q{const we=q[p],Ke=Ce(we);return h.jsxs(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[h.jsxs(I,{className:"flex items-start justify-between",children:[W&&Dr(q)&&h.jsx(oe,{onClick:()=>Ta(we),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors mr-2","aria-label":Ke?"Collapse card":"Expand card",children:h.jsx(re,{name:Ke?K:X,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}),f&&h.jsx(vn,{checked:g.includes(q[p]),onChange:()=>bn(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded mr-3 mt-1"}),h.jsx(I,{className:"flex-1",children:h.jsx(I,{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:le.map(Le=>h.jsxs(I,{className:"min-w-0",children:[h.jsx(Q,{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:Le.header}),h.jsx(I,{className:"text-sm text-gray-900 dark:text-gray-200 mt-0.5 break-words",children:Le.cellChildren&&Le.cellChildren.length>0?Ss(Le.cellChildren,q,q[Le.field],`card-${q[p]}-${Le.field}`,J):Le.render?Le.render(q[Le.field],q):Qa(q[Le.field])})]},Le.field))})}),k&&k.length>0&&h.jsx(I,{className:"ml-2",children:h.jsx(bs,{items:Do(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal})})]}),W&&Ke&&Dr(q)&&h.jsx(I,{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Y(q)}),(ce&&ce.length>0||ve)&&Kd(ue,q)&&h.jsx(I,{className:ae?`mt-3 ${ae}`:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:ve?ve(q):Ja(ce,q,`card-subrow-${we}`,J)})]})};return He?h.jsxs(I,{id:t,className:`w-full ${a}`,style:l,...Ue,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:ot,className:"relative",children:[h.jsxs(oe,{onClick:()=>Re(!_e),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Pe})]}),_e&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:De.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&To(q.field),children:[h.jsx(vn,{checked:Ze.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",st,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ut&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:ut.replace("{count}",String(g.length))}),h.jsx(I,{id:t?`${t}__body`:void 0,children:Ve&&Ve.length>0?Ve.map((q,le)=>h.jsx(I,{children:E?E(q,xt):ft(q,xt)},q[p]||le)):h.jsx(I,{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:Ie})}),fe&&fe.length>0&&Ve&&Ve.length>0&&h.jsx(I,{className:`rounded-lg p-4 mt-2 ${ye}`,children:ke&&ke.length>0?Ss(ke,{},null,"footer-card",J):h.jsx(I,{className:"space-y-1",children:fe.filter(q=>q.text||q.children&&q.children.length>0).map((q,le)=>{const we=xt.find(Ke=>Ke.field===q.field);return h.jsxs(I,{className:"flex justify-between text-sm",children:[h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:we?.header||""}),h.jsx(Q,{className:q.className||"text-gray-900 dark:text-gray-100",children:q.children&&q.children.length>0?Ss(q.children,{},null,`footer-mobile-${le}`,J):q.text||""})]},`footer-mobile-${le}`)})})}),s&&(N||ln>1)&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Po,{currentPage:Bt,totalPages:ln,onPageChange:nn,showFirstLast:H,maxVisiblePages:5,prevText:se,nextText:Oe})})]}):h.jsxs(I,{id:t,className:`w-full ${a}`,style:l,...Ue,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:ot,className:"relative",children:[h.jsxs(oe,{onClick:()=>Re(!_e),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Pe})]}),_e&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:De.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&To(q.field),children:[h.jsx(vn,{checked:Ze.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",st,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ut&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:ut.replace("{count}",String(g.length))}),h.jsx(I,{id:t?`${t}__body`:void 0,className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:h.jsxs(Pa,{className:"w-full",children:[h.jsx($a,{className:"bg-gray-50 dark:bg-gray-700",children:h.jsxs(Jn,{children:[W&&h.jsx($r,{className:"px-2 py-3",style:{width:V}}),f&&h.jsx($r,{className:"px-4 py-3 w-10",children:h.jsx(vn,{checked:ie,ref:q=>{q&&(q.indeterminate=xe)},onChange:fr,className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),xt.map(q=>h.jsxs($r,{className:`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider ${r&&q.sortable!==!1?"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600":""}`,style:{width:q.width,minWidth:q.width},onClick:()=>Nn(q.field),children:[q.header,te===q.field&&h.jsx(Q,{className:"ml-1",children:pe==="asc"?"↑":"↓"})]},q.field)),k&&k.length>0&&h.jsx($r,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider w-24",children:je})]})}),h.jsx(Fa,{className:`bg-white dark:bg-gray-800 ${ae?"":"divide-y divide-gray-200 dark:divide-gray-700"}`,children:Ve&&Ve.length>0?Ve.map((q,le)=>{const we=q[p]||le,Ke=Ce(we);return h.jsxs(v.Fragment,{children:[h.jsxs(Jn,{className:`${i?"cursor-pointer":""} hover:bg-gray-50 dark:hover:bg-gray-700 ${g.includes(q[p])?"bg-blue-50 dark:bg-blue-900/20":""} ${ae&&le>0?"border-t border-gray-200 dark:border-gray-700":""}`,onClick:()=>i?.(q),children:[W&&h.jsx(Kt,{className:"px-2 py-4 text-center",onClick:Le=>Le.stopPropagation(),children:Dr(q)?h.jsx(oe,{onClick:()=>Ta(we),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors","aria-label":Ke?"Collapse row":"Expand row",children:h.jsx(re,{name:Ke?K:X,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}):null}),f&&h.jsx(Kt,{className:"px-4 py-4",onClick:Le=>Le.stopPropagation(),children:h.jsx(vn,{checked:g.includes(q[p]),onChange:()=>bn(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),xt.map(Le=>h.jsx(Kt,{className:"px-6 py-4 align-top whitespace-nowrap text-sm text-gray-900 dark:text-gray-200",style:{width:Le.width,minWidth:Le.width},children:Le.cellChildren&&Le.cellChildren.length>0?Ss(Le.cellChildren,q,q[Le.field],`${q[p]}-${Le.field}`,J):Le.render?Le.render(q[Le.field],q):Qa(q[Le.field])},Le.field)),k&&k.length>0&&h.jsx(Kt,{className:"px-6 py-4 text-right",onClick:Le=>Le.stopPropagation(),children:h.jsx(bs,{items:Do(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal,position:"right"})})]}),W&&Ke&&Dr(q)&&h.jsx(Jn,{className:"bg-gray-50 dark:bg-gray-900",children:h.jsx(Kt,{colSpan:xt.length+1+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-4",children:Y(q)})}),(ce&&ce.length>0||ve)&&Kd(ue,q)&&h.jsx(Jn,{className:ae?"!border-t-0":"",children:h.jsx(Kt,{colSpan:xt.length+(W?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:ae?"p-2":ae||"px-6 py-2 bg-gray-50 dark:bg-gray-900",children:ae?h.jsx(I,{className:ae,children:ve?ve(q):Ja(ce,q,`subrow-${we}`,J)}):ve?ve(q):Ja(ce,q,`subrow-${we}`,J)})})]},we)}):h.jsx(Jn,{children:h.jsx(Kt,{colSpan:xt.length+(W?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400",children:Ie})})}),fe&&fe.length>0&&Ve&&Ve.length>0&&h.jsx(za,{children:h.jsxs(Jn,{className:ye,children:[W&&h.jsx(Kt,{className:"px-2 py-4"}),f&&h.jsx(Kt,{className:"px-4 py-4"}),(()=>{const q=new Map(fe.filter(le=>le.field).map(le=>[le.field,le]));return xt.map(le=>{const we=q.get(le.field);return we?h.jsx(Kt,{className:`px-6 py-4 text-sm text-gray-900 dark:text-gray-200 ${we.className||""}`,colSpan:we.colSpan,style:{width:le.width,minWidth:le.width},children:we.children&&we.children.length>0?Ss(we.children,{},null,`footer-${le.field}`,J):we.text||""},`footer-${le.field}`):h.jsx(Kt,{className:"px-6 py-4",style:{width:le.width,minWidth:le.width}},`footer-${le.field}`)})})(),k&&k.length>0&&h.jsx(Kt,{className:"px-6 py-4"})]})})]})}),s&&(N||ln>1)&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Po,{currentPage:Bt,totalPages:ln,onPageChange:nn,showFirstLast:H,maxVisiblePages:5,prevText:se,nextText:Oe})})]})},Ra=window.G7Core?.createLogger?.("Comp:CardGrid")??{log:(...t)=>console.log("[Comp:CardGrid]",...t),warn:(...t)=>console.warn("[Comp:CardGrid]",...t),error:(...t)=>console.error("[Comp:CardGrid]",...t)},Ub=(t,e)=>window.G7Core?.t?.(t,e)??t,Bb=()=>window.G7Core?.getComponentMap?.()||{},jb=(t,e)=>{if(!t)return!0;const n=t.match(/^\{\{(.+)\}\}$/);if(!n)return!0;const r=n[1].trim();if(Ra.log("evaluateCondition:",{condition:t,expr:r,row:e,rowStatus:e?.status}),/[&|<>=!]/.test(r)||r.includes(".length"))try{const o=!!new Function("row",`return ${r}`)(e);return Ra.log("evaluateCondition result:",o),o}catch(s){return Ra.warn("evaluateCondition: 표현식 평가 실패:",r,s),!1}if(r.startsWith("!row.")){const s=r.slice(5);return!e[s]}if(r.startsWith("row.")){const s=r.slice(4);return!!e[s]}return!0},qd=(t,e,n,r,s)=>{const o=window.G7Core;if(t.name==="ActionMenu"){if(r&&r.length>0&&s)return{...t,props:{...t.props,items:r.map(i=>({...i,onClick:()=>s(i.id,e)}))}};if(t.actions&&Array.isArray(t.actions)){const i=t.props?.items||[],a=new Map(t.actions.map(c=>[c.id,c])),l=i.map(c=>{if(typeof c.onClick=="string"){const d=c.onClick,u=a.get(d);if(u&&o?.ActionDispatcher)return{...c,onClick:()=>{const f={...n};o.ActionDispatcher.dispatch(u,f)}}}return c});return{...t,props:{...t.props,items:l}}}}return t.children&&Array.isArray(t.children)?{...t,children:t.children.map(i=>qd(i,e,n,r,s))}:t},Wb=(t,e,n,r="",s,o)=>{const i=window.G7Core;if(i?.renderItemChildren){const a=t.filter(d=>{const u=d.condition||d.if;return u?jb(u,e):!0}),l={row:e,$value:e,index:n},c=a.map(d=>qd(d,e,l,s,o));try{const d=Bb();return i.renderItemChildren(c,l,d,r)}catch{return h.jsxs(I,{className:"text-red-600 dark:text-red-400 p-4",children:[h.jsx(bt,{children:"컴포넌트 로드 실패"}),h.jsx(bt,{className:"text-sm",children:"[CardGrid] 데이터를 표시할 수 없습니다."})]})}}return null},el=(t,e)=>{if(t.name==="Div"&&t.children&&t.children.length>0){const n=t.children.map((r,s)=>el(r,`${e}-child-${s}`)).filter(Boolean);return h.jsx(I,{className:t.props?.className||"",children:n},e)}return h.jsx(I,{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full animate-pulse"},e)},Zd=(t,e="skeleton")=>!t||t.length===0?null:t.map((n,r)=>{const s=`${e}-${n.id||n.name}-${r}`;return n.condition||n.if?null:(n.iteration,el(n,s))}).filter(Boolean),Gb=({data:t,cardColumns:e=[],gridColumns:n=3,gap:r=4,responsiveColumns:s,cardClassName:o="",idField:i="id",pagination:a=!0,pageSize:l=12,serverSidePagination:c=!1,serverCurrentPage:d,serverTotalPages:u,alwaysShowPagination:f=!1,onPageChange:g,paginationInfoText:m,rowActions:p,onRowAction:y,className:b="",style:S,emptyMessage:x,prevText:E,nextText:k,showSkeleton:C=!0,skeletonCount:N,skeletonCellChildren:_,id:w,editorAttrs:M})=>{const O=x??Ub("common.no_data"),L=e[0]?.cellChildren||[],[F,$]=v.useState(1);window.G7Core?.useResponsive?.();const A=c?d??1:F,T=c?u??1:Math.ceil((t?.length??0)/l),z=G=>{c?g?.(G):$(G)},H=v.useCallback((G,V)=>{y?.(G,V)},[y]),W=v.useMemo(()=>{if(!t)return[];if(!a||c)return t;const G=(F-1)*l,V=G+l;return t.slice(G,V)},[t,a,c,F,l]),j=v.useMemo(()=>{const G=[],V=s?.sm??1;G.push(`grid-cols-${V}`),s?.sm&&G.push(`sm:grid-cols-${s.sm}`);const K=s?.md??Math.min(n,2);G.push(`md:grid-cols-${K}`);const X=s?.lg??n;return G.push(`lg:grid-cols-${X}`),s?.xl&&G.push(`xl:grid-cols-${s.xl}`),G.join(" ")},[n,s]),U=v.useMemo(()=>C?_&&_.length>0?Zd(_,"custom-skeleton"):L&&L.length>0?Zd(L,"auto-skeleton"):null:null,[C,_,L]);if(!t){if(!C)return null;const G=N??n;return h.jsx(I,{className:`grid ${j} gap-${r} ${b}`,style:S,id:w,...M,children:Array.from({length:G}).map((V,K)=>h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6 space-y-4",children:U},`skeleton-${K}`))})}if(W.length===0)return h.jsx(I,{className:b,style:S,id:w,...M,children:h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-12",children:h.jsx(bt,{className:"text-center text-gray-600 dark:text-gray-400",children:O})})});const B=a&&(f||T>1);return h.jsxs(I,{className:b,style:S,id:w,...M,children:[h.jsx(I,{className:`grid ${j} gap-${r}`,children:W.map((G,V)=>h.jsx(I,{className:o,children:Wb(L,G,V,`card-${V}`,p,H)},G[i]||V))}),B&&h.jsxs(I,{className:"mt-6 space-y-4 flex flex-col items-center",children:[h.jsx(Po,{currentPage:A,totalPages:T,onPageChange:z,showFirstLast:!1,maxVisiblePages:5,prevText:E,nextText:k}),m&&h.jsx(I,{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:m})]})]})},Yb=(t,e)=>window.G7Core?.t?.(t,e)??t,Uo=({isOpen:t,onClose:e,title:n,titlePrefix:r,titleSuffix:s,closeOnBackdropClick:o=!0,closeOnOverlayClick:i,showCloseButton:a=!0,closeOnEscape:l=!0,children:c,width:d="500px",className:u="",style:f,__dataContext:g,__translationContext:m})=>{const p=i!==void 0?i:o,y=v.useRef(null),b=v.useRef(null);if(v.useEffect(()=>{const E=k=>{k.key==="Escape"&&t&&l&&e()};if(t&&l)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,e,l]),v.useEffect(()=>{if(t&&y.current){b.current=document.activeElement;const E=y.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),k=E[0],C=E[E.length-1];k?.focus();const N=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===k&&(_.preventDefault(),C?.focus()):document.activeElement===C&&(_.preventDefault(),k?.focus()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N),b.current?.focus()}}},[t]),v.useEffect(()=>{if(t)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[t]),!t)return null;const S=f?.zIndex??50,x=(E,k)=>{if(!E||E.length===0)return null;const C=window.G7Core;if(!C)return null;const N=C.getDynamicRenderer?.();return N?E.map((_,w)=>h.jsx(N,{componentDef:_,dataContext:g||{},translationContext:m,registry:C.getComponentRegistry(),bindingEngine:C.getDataBindingEngine(),translationEngine:C.getTranslationEngine(),actionDispatcher:C.getActionDispatcher(),isRootRenderer:!1},`${k}-${w}`)):null};return h.jsxs(I,{className:"modal-wrapper",style:{zIndex:S},onClick:p?e:void 0,children:[h.jsx(I,{className:"modal-backdrop","aria-hidden":"true"}),h.jsxs(I,{ref:y,className:`modal-container ${u}`,style:{width:d,...f?{...f,zIndex:void 0}:{}},onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,children:[(n||r||s||a)&&h.jsxs(I,{className:"modal-header-row",children:[h.jsxs(I,{className:"flex-center gap-sm",children:[x(r,"title-prefix"),n&&h.jsx(I,{id:"modal-title",className:"modal-title",children:n}),x(s,"title-suffix")]}),a&&h.jsx(oe,{onClick:e,className:"modal-close-btn","aria-label":Yb("common.close_modal"),children:h.jsx("svg",{className:"icon-lg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),h.jsx(I,{className:"modal-body-content",children:c})]})]})},Xb=({label:t,items:e,onItemClick:n,position:r="bottom-left",variant:s="default",className:o="",style:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(-1),g=v.useRef(null),m=v.useRef(null),[p,y]=v.useState(r);v.useEffect(()=>{const x=E=>{g.current&&!g.current.contains(E.target)&&(d(!1),f(-1))};if(c)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),v.useEffect(()=>{const x=E=>{if(!c)return;const k=e.map((C,N)=>C.disabled?-1:N).filter(C=>C!==-1);switch(E.key){case"ArrowDown":E.preventDefault(),f(C=>{const _=(k.indexOf(C)+1)%k.length;return k[_]});break;case"ArrowUp":E.preventDefault(),f(C=>{const N=k.indexOf(C),_=N<=0?k.length-1:N-1;return k[_]});break;case"Enter":E.preventDefault(),u>=0&&!e[u].disabled&&b(e[u]);break;case"Escape":E.preventDefault(),d(!1),f(-1);break}};if(c)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,u,e]),v.useEffect(()=>{if(c&&m.current&&g.current){const x=m.current.getBoundingClientRect(),E=g.current.getBoundingClientRect(),k=window.innerWidth,C=window.innerHeight,N=x.width||224,_=x.height||200;let w=r;r.includes("left")?E.left+N>k&&(w=w.replace("left","right")):E.right-N<0&&(w=w.replace("right","left")),r.includes("top")?E.top-_<0&&(w=w.replace("top","bottom")):E.bottom+_>C&&(w=w.replace("bottom","top")),y(w)}},[c,r]);const b=x=>{x.disabled||(x.onClick?.(),n?.(x.value,x),d(!1),f(-1))},S={"bottom-left":"dropdown-menu-bottom-left","bottom-right":"dropdown-menu-bottom-right","top-left":"dropdown-menu-top-left","top-right":"dropdown-menu-top-right"};return h.jsxs(I,{ref:g,className:`dropdown ${o}`,style:i,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:s==="text"?"dropdown-trigger-text":"dropdown-trigger","aria-haspopup":"true","aria-expanded":c,children:[t,s!=="text"&&h.jsx("svg",{className:`inline-block ml-2 w-4 h-4 transition-transform ${c?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&h.jsx(I,{ref:m,className:`dropdown-menu ${S[p]}`,role:"menu","aria-orientation":"vertical",children:h.jsx(I,{className:"py-1",children:e.map((x,E)=>h.jsx(I,{className:`${x.disabled?"dropdown-item-disabled":"dropdown-item"} ${u===E?"dropdown-item-focused":""}`,onClick:()=>b(x),onMouseEnter:()=>!x.disabled&&f(E),role:"menuitem","aria-disabled":x.disabled,tabIndex:x.disabled?-1:0,children:x.label},x.value))})})]})},Kb=({imageUrl:t,imageAlt:e="",title:n,subtitle:r,description:s,price:o,originalPrice:i,discountRate:a,currency:l="₩",buttonText:c="자세히 보기",onButtonClick:d,className:u="",style:f,id:g,editorAttrs:m})=>{const p=a&&a>0,y=(o??0).toLocaleString(),b=i?.toLocaleString();return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md hover:shadow-xl transition-shadow border border-gray-200 dark:border-gray-700 overflow-hidden ${u}`,style:f,id:g,...m,children:[t&&h.jsxs(I,{className:"relative w-full",children:[h.jsx(yn,{src:t,alt:e||n,className:"w-full h-64 object-cover"}),p&&h.jsx(I,{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded-md",children:h.jsxs(Q,{className:"text-sm font-bold",children:["-",a,"%"]})})]}),h.jsxs(I,{className:"p-4",children:[r&&h.jsx(Ir,{className:"text-xs font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2",children:r}),h.jsx(Qn,{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 line-clamp-2",children:n}),s&&h.jsx(bt,{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-3",children:s}),h.jsxs(I,{className:"flex items-center gap-2 mb-4",children:[h.jsxs(Q,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[l,y]}),i&&h.jsxs(Q,{className:"text-sm text-gray-400 dark:text-gray-500 line-through",children:[l,b]})]}),c&&h.jsx(oe,{onClick:d,className:"w-full bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors",children:c})]})]})},qb=({value:t,label:e,change:n,changeLabel:r="전월 대비",iconName:s,trend:o="neutral",className:i="",style:a,id:l,editorAttrs:c})=>{const d=o==="up",u=o==="down",f=n!==void 0?Math.abs(n):0,g=d?"stats-trend-up":u?"stats-trend-down":"stats-trend-neutral",m=d?de.ArrowUp:u?de.ArrowDown:void 0;return h.jsxs(I,{className:`stat-card ${i}`,style:a,id:l,...c,children:[h.jsxs(I,{className:"flex-between mb-md",children:[s&&h.jsx(I,{className:"stats-icon stats-icon-blue",children:h.jsx(re,{name:s,className:"icon-lg"})}),n!==void 0&&h.jsxs(I,{className:`stats-change ${g}`,children:[m&&h.jsx(re,{name:m,className:"icon-sm"}),h.jsxs(Q,{className:"text-sm font-semibold",children:[f,"%"]})]})]}),h.jsx(Ir,{className:"stats-value-lg",children:typeof t=="number"?t.toLocaleString():t}),h.jsx(bt,{className:"stats-label",children:e}),n!==void 0&&r&&h.jsx(I,{className:"stats-sublabel",children:h.jsx(Q,{children:r})})]})},Qd=()=>window.G7Core,Jd=(t,e)=>Qd()?.t?.(t,e)??t,Zb=({name:t="search",placeholder:e,value:n,onChange:r,onSubmit:s,showButton:o=!1,suggestions:i=[],onSuggestionClick:a,showSuggestions:l=!1,className:c="",style:d,id:u,editorAttrs:f})=>{const g=e??Jd("common.search_placeholder"),[m,p]=v.useState(""),[y,b]=v.useState(!1),S=v.useRef(null),x=v.useRef(""),E=n!==void 0?n:m,k=l&&y&&i.length>0&&E.length>0,C="w-64 pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm",N=Qd()?.style?.mergeClasses?.(C,c)??`${C} ${c}`;v.useEffect(()=>{n!==void 0&&(x.current=n)},[n]);const _=O=>{const L=O.target.value;p(L),r?.(O),x.current!==""&&L===""&&!O.nativeEvent.inputType&&setTimeout(()=>{const F=S.current?.querySelector("form");F&&F.requestSubmit()},0),x.current=L},w=O=>{p(O.text);const L={target:{value:O.text,name:t}};r?.(L),a?.(O),b(!1)},M=O=>{O.preventDefault(),s?.(O)};return h.jsxs(I,{ref:S,className:"relative",style:d,id:u,...f,children:[h.jsx(La,{onSubmit:M,className:"relative",children:h.jsxs(I,{className:`relative flex items-center ${o?"gap-2":""}`,children:[h.jsxs(I,{className:"relative flex-1",children:[h.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:h.jsx(re,{name:de.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),h.jsx(wt,{type:"search",name:t,value:E,onChange:_,onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),200),placeholder:g,className:N})]}),o&&h.jsx(oe,{type:"submit",className:"px-4 py-2 bg-gray-800 dark:bg-gray-600 text-white rounded-lg hover:bg-gray-900 dark:hover:bg-gray-500 transition-colors text-sm font-medium cursor-pointer h-[42px]",children:Jd("common.search")})]})}),k&&h.jsx(I,{className:"absolute z-10 w-full mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-64 overflow-y-auto",children:i.map(O=>h.jsx(I,{className:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 transition-colors",onClick:()=>w(O),children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:O.text})]})},O.id))})]})},tl=(t,e)=>window.G7Core?.t?.(t,e)??t,Qb=({title:t,filters:e,onChange:n,onReset:r,showResetButton:s=!0,className:o="",style:i,id:a,editorAttrs:l})=>{const c=t??tl("common.filter"),d=(f,g)=>{n?.(f,g)},u=(f,g,m)=>{const p=e.find(b=>b.id===f);if(!p)return;const y=Array.isArray(p.value)?p.value:[];if(typeof g=="string"){const b=y.filter(x=>typeof x=="string"),S=m?[...b,g]:b.filter(x=>x!==g);n?.(f,S)}else{const b=y.filter(x=>typeof x=="number"),S=m?[...b,g]:b.filter(x=>x!==g);n?.(f,S)}};return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md border border-gray-200 dark:border-gray-700 p-4 ${o}`,style:i,id:a,...l,children:[h.jsxs(I,{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(Q,{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s&&r&&h.jsx(oe,{onClick:r,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:tl("common.reset")})]}),h.jsx(I,{className:"space-y-4",children:e.map(f=>h.jsxs(I,{className:"space-y-2",children:[h.jsx(rn,{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:f.label}),f.type==="select"&&h.jsxs(Pr,{value:f.value,onChange:g=>d(f.id,g.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[h.jsx("option",{value:"",children:tl("common.select_placeholder")}),f.options.map(g=>h.jsx("option",{value:g.value,children:g.label},g.id))]}),f.type==="checkbox"&&h.jsx(I,{className:"space-y-2",children:f.options.map(g=>{const m=Array.isArray(f.value)?f.value.some(p=>p===g.value):!1;return h.jsxs(rn,{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 p-2 rounded-md transition-colors",children:[h.jsx(vn,{checked:m,onChange:p=>u(f.id,g.value,p.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:g.label})]},g.id)})})]},f.id))})]})},Jb=({tabs:t,activeTabId:e,onTabChange:n,variant:r="default",className:s="",style:o,mobileBreakpoint:i=768,id:a,editorAttrs:l})=>{const d=window.G7Core?.useResponsive,u=d?.(),f=u?u.width{!S.disabled&&S.id!==e&&n?.(S.id)},m=S=>{const x=S.target.value,E=Number(x),k=typeof x=="string"&&x!==""&&!Number.isNaN(E)?E:x,C=t.find(N=>String(N.id)===String(k));C&&g(C)};if(f)return h.jsx(I,{className:s,style:o,id:a,...l,children:h.jsx(Pr,{value:e!==void 0?String(e):"",onChange:m,options:t.map(S=>({value:String(S.id),label:S.badge!==void 0?`${S.label} (${S.badge})`:S.label,disabled:S.disabled})),className:"w-full"})});const p=S=>{const x=S.id===e;if(S.disabled)return"tab-btn-base tab-btn-disabled";switch(r){case"pills":return x?"tab-btn-base tab-btn-pills-active":"tab-btn-base tab-btn-pills";case"underline":return x?"tab-btn-base tab-btn-underline-active":"tab-btn-base tab-btn-underline";default:return x?"tab-btn-base tab-btn-default-active":"tab-btn-base tab-btn-default"}},y=r==="underline"?"tab-nav-underline":"tab-nav-default",b=l?.["data-editor-path"];return h.jsx(Lo,{className:`${y} ${s}`,style:o,id:a,...l,children:t.map((S,x)=>h.jsxs(oe,{type:"button",onClick:()=>g(S),disabled:S.disabled,className:p(S),...b?{"data-editor-item-path":`${b}.props.tabs.${x}`}:{},children:[S.iconName&&h.jsx(re,{name:S.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:S.label}),S.badge!==void 0&&h.jsx(I,{className:"flex items-center justify-center min-w-[20px] h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full",children:h.jsx(Q,{children:S.badge})})]},S.id))})},nl=window.G7Core?.createLogger?.("Handler:ScrollToSection")??{log:(...t)=>console.log("[Handler:ScrollToSection]",...t),warn:(...t)=>console.warn("[Handler:ScrollToSection]",...t),error:(...t)=>console.error("[Handler:ScrollToSection]",...t)};async function Rd(t,e){const n=t.params||{},{targetId:r,offset:s=120,delay:o=100,scrollContainerId:i}=n;if(!r){nl.warn("targetId is required");return}const a=await Rb(r,o);if(!a){nl.warn(`Element not found: ${r}`);return}const l=ey(a,i),c=ty(a,l,s);ny(l,c)}async function Rb(t,e){await new Promise(s=>setTimeout(s,e));const n=10,r=50;for(let s=0;ssetTimeout(i,50)),o;await new Promise(i=>setTimeout(i,r))}return null}function ey(t,e){if(e){const o=document.getElementById(e);if(o&&eu(o))return o;nl.warn(`Container '${e}' ${o?"has no scroll":"not found"}, trying auto-detect`)}let n=t.parentElement,r=0;const s=10;for(;n&&n!==document.body&&rt.clientHeight}function ty(t,e,n){if(e===window||!("getBoundingClientRect"in e))return t.getBoundingClientRect().top+window.pageYOffset-n;{const r=e.getBoundingClientRect(),s=t.getBoundingClientRect();return e.scrollTop+(s.top-r.top)-n}}function ny(t,e){t===window||!("scrollTo"in t)?window.scrollTo({top:e,behavior:"smooth"}):t.scrollTo({top:e,behavior:"smooth"})}window.G7Core?.createLogger?.("Comp:TabNavigation");const ry=({tabs:t,activeTabId:e,className:n="bg-white dark:bg-gray-800 flex gap-2 border-b border-gray-200 dark:border-gray-700 px-6",style:r,activeClassName:s="tab-btn-base tab-btn-default-active",inactiveClassName:o="tab-btn-base tab-btn-default",sectionIdPrefix:i="tab_content_",scrollOffset:a=120,scrollDelay:l=100,onTabChange:c,enableScrollSpy:d=!1,scrollSpyOffset:u=80,scrollContainerId:f,id:g,editorAttrs:m})=>{const[p,y]=v.useState(e??(t.length>0?t[0].id:"")),S=window.G7Core?.useResponsive,x=S?.(),E=x?x.width<768:typeof window<"u"&&window.innerWidth<768,k=v.useRef(!1),C=v.useRef(null),N=w=>{if(d&&(k.current=!0,C.current&&clearTimeout(C.current)),w.onClick){if(w.onClick(w.id),!d)return}else if(c){if(c(w.id),!d)return}else y(w.id);const M=w.scrollOffset??a,O=w.scrollDelay??l;Rd({params:{targetId:`${i}${w.id}`,offset:M,delay:O,scrollContainerId:f}}),d&&(C.current=setTimeout(()=>{k.current=!1},O+500))};v.useEffect(()=>{if(!d)return;const w=f?document.getElementById(f):null,M={root:w??null,rootMargin:`-${u}px 0px -30% 0px`,threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},O=new Map,L=()=>{const A=w,T=A?A.scrollTop:window.pageYOffset||document.documentElement.scrollTop,z=A?A.scrollHeight:document.documentElement.scrollHeight,H=A?A.clientHeight:document.documentElement.clientHeight;return T+H>=z-10},F=A=>{if(k.current)return;A.forEach(U=>{const B=U.target.id;U.isIntersecting?O.set(B,U.intersectionRatio):O.delete(B)});let T=0,z="";O.forEach((U,B)=>{U>T&&(T=U,z=B)});const H=t[t.length-1],W=`${i}${H?.id}`,j=O.has(W);if(L()&&j&&H){y(H.id);return}if(z){const U=z.replace(i,""),B=Number(U),G=isNaN(B)?U:B;t.some(K=>K.id===G)&&y(G)}},$=()=>{},D=new IntersectionObserver(F,M);return t.forEach(A=>{const T=document.getElementById(`${i}${A.id}`);T&&D.observe(T)}),window.addEventListener("scroll",$,{passive:!0}),()=>{D.disconnect(),window.removeEventListener("scroll",$),C.current&&clearTimeout(C.current)}},[d,t,i,u,f]);const _=w=>{const M=w.target.value,O=Number(M),L=isNaN(O)?M:O,F=t.find($=>$.id===L);F&&N(F)};return E?h.jsx(I,{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3",id:g,...m,children:h.jsx(Pr,{value:String(p),onChange:_,options:t.map(w=>({value:String(w.id),label:w.label,disabled:w.disabled})),className:"w-full"})}):h.jsx(I,{className:n,style:r,id:g,...m,children:t.map(w=>h.jsxs(oe,{className:p===w.id?s:o,disabled:w.disabled,onClick:()=>N(w),children:[w.iconName&&h.jsx(re,{name:w.iconName,size:"sm"}),h.jsx(Q,{children:w.label})]},w.id))})},sy=()=>window.G7Core,oy=({iconName:t,label:e,onClick:n,variant:r="primary",size:s="md",disabled:o=!1,className:i="",style:a,id:l,editorAttrs:c})=>{const d={sm:e?"px-3 py-1.5 text-sm":"w-8 h-8",md:e?"px-4 py-2 text-base":"w-10 h-10",lg:e?"px-5 py-2.5 text-lg":"w-12 h-12"},u={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},f={primary:"bg-blue-600 hover:bg-blue-700 text-white border-transparent",secondary:"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600",danger:"bg-red-600 hover:bg-red-700 text-white border-transparent",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-transparent",outline:"bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600"},g="inline-flex items-center justify-center gap-2 font-medium rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-blue-400",m=o?"opacity-50 cursor-not-allowed":"",p=`${g} ${d[s]} ${f[r]} ${m}`,y=sy()?.style?.mergeClasses?.(p,i)??`${p} ${i}`;return h.jsxs(oe,{onClick:n,disabled:o,className:y,style:a,id:l,...c,children:[h.jsx(re,{name:t,className:u[s]}),e]})},iy=(t,e)=>window.G7Core?.t?.(t,e)??t,tu=({isOpen:t,onClose:e,title:n,content:r,actions:s=[],width:o="500px",closeOnOverlay:i=!0,showCloseButton:a=!0,className:l="",style:c})=>{const d=()=>{i&&e()},u={primary:"dialog-btn-primary",secondary:"dialog-btn-secondary",danger:"dialog-btn-danger",ghost:"dialog-btn-ghost"};return h.jsxs(Uo,{isOpen:t,onClose:d,width:o,className:l,style:c,children:[h.jsxs(I,{className:"dialog-header",children:[h.jsx(Qn,{className:"dialog-title",children:n}),a&&h.jsx(oe,{onClick:e,className:"dialog-close","aria-label":iy("common.close_dialog"),children:h.jsx(re,{name:de.Times,className:"icon-md"})})]}),h.jsx(I,{className:"dialog-body",children:r}),s.length>0&&h.jsx(I,{className:"dialog-footer",children:s.map((f,g)=>h.jsxs(oe,{onClick:f.onClick,disabled:f.disabled,className:u[f.variant||"primary"],children:[f.iconName&&h.jsx(re,{name:f.iconName,className:"icon-sm mr-2 inline-block"}),f.label]},g))})]})},rl=(t,e)=>window.G7Core?.t?.(t,e)??t,nu=({isOpen:t,onClose:e,title:n,message:r,confirmText:s,cancelText:o,onConfirm:i,onCancel:a,confirmButtonVariant:l="primary",cancelButtonVariant:c="secondary",width:d="500px",closeOnOverlay:u=!0,isLoading:f=!1,loadingText:g})=>{const m=s??rl("common.confirm"),p=o??rl("common.cancel"),y=g??rl("common.loading"),b=()=>{i()},S=()=>{f||(a?.(),e())},x=()=>{f||e()},E={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return h.jsxs(Uo,{isOpen:t,onClose:x,title:n,width:d,children:[h.jsx(I,{className:"py-2",children:typeof r=="string"?h.jsx(bt,{className:"text-gray-700 dark:text-gray-300",children:r}):r}),h.jsxs(I,{className:"flex justify-end gap-3 mt-6",children:[h.jsx(oe,{onClick:S,disabled:f,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:h.jsx(Q,{children:p})}),h.jsxs(oe,{onClick:b,disabled:f,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${E[l]}`,children:[f&&h.jsx(re,{name:de.Spinner,className:"w-4 h-4 animate-spin"}),h.jsx(Q,{children:f?y:m})]})]})]})},ay=(t,e)=>window.G7Core?.t?.(t,e)??t,ly=({isOpen:t,onClose:e,title:n,message:r,confirmText:s,onConfirm:o,confirmButtonVariant:i="primary",width:a="500px",closeOnOverlay:l=!0})=>{const u=[{label:s??ay("common.confirm"),onClick:()=>{o?.(),e()},variant:i}],f=typeof r=="string"?h.jsx(bt,{className:"text-gray-700 dark:text-gray-300",children:r}):r;return h.jsx(tu,{isOpen:t,onClose:e,title:n,content:f,actions:u,width:a,closeOnOverlay:l})},cy=(t,e)=>window.G7Core?.t?.(t,e)??t,dy={success:de.CheckCircle,error:de.XCircle,warning:de.ExclamationTriangle,info:de.InfoCircle},ru={success:{bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800",text:"text-green-800 dark:text-green-300"},error:{bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",text:"text-red-800 dark:text-red-300"},warning:{bg:"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800",text:"text-yellow-800 dark:text-yellow-300"},info:{bg:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",text:"text-blue-800 dark:text-blue-300"}},uy={"top-left":"top-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-center":"bottom-4 left-1/2 -translate-x-1/2","bottom-right":"bottom-4 right-4"},fy=({toasts:t,position:e="bottom-center",duration:n=3e3,onRemove:r})=>{const[s,o]=v.useState(new Map),i=v.useCallback(a=>{o(l=>{const c=new Map(l);return c.set(a,!1),c}),setTimeout(()=>{if(r)r(a);else{const l=window.G7Core;l?.state?.update&&l.state.update(c=>({toasts:(Array.isArray(c.toasts)?c.toasts:[]).filter(u=>u.id!==a)}))}},300)},[r]);return v.useEffect(()=>{!t||t.length===0||t.forEach(a=>{if(s.has(a.id))return;o(c=>{const d=new Map(c);return d.set(a.id,!0),d});const l=a.duration||n;l>0&&setTimeout(()=>{i(a.id)},l)})},[t,n,i,s]),!t||t.length===0?null:h.jsx(I,{className:`fixed z-[9999] flex flex-col gap-2 ${uy[e]}`,"aria-live":"polite","aria-atomic":"true",children:t.map(a=>h.jsx(hy,{toast:a,position:e,isVisible:s.get(a.id)??!0,onClose:()=>i(a.id)},a.id))})},hy=({toast:t,position:e,isVisible:n,onClose:r})=>{const s=ru[t.type]||ru.info,o=t.icon?t.icon:dy[t.type],i=e.startsWith("bottom")?"translate-y-2":"-translate-y-2";return h.jsxs(I,{className:` + `.trim().replace(/\s+/g," ");return h.jsx(I,{className:d,dangerouslySetInnerHTML:{__html:c},id:o,...i})},Ho=window.G7Core?.createLogger?.("Comp:DataGrid")??{log:(...t)=>console.log("[Comp:DataGrid]",...t),warn:(...t)=>console.warn("[Comp:DataGrid]",...t),error:(...t)=>console.error("[Comp:DataGrid]",...t)},Cs=(t,e)=>window.G7Core?.t?.(t,e)??t,Za={Div:I,Span:Q,Button:oe,Icon:re,Checkbox:vn,P:bt,A:Lr,Label:rn,Input:wt,H1:Aa,H2:Qn,H3:Ir,H4:Nd,Img:yn,Select:Pr,Textarea:Zn,Table:Pa,Thead:$a,Tbody:Fa,Tfoot:za,Tr:Jn,Th:$r,Td:Kt,MultilingualInput:Va,Toggle:Ha,StatusBadge:$o,Badge:Pd,HtmlContent:qa,ActionMenu:bs},Qa=t=>{if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(e=>Qa(e)).join(", ");if(typeof t=="object"){if(v.isValidElement(t))return t;if(Object.keys(t).length===0)return"";try{return JSON.stringify(t)}catch{return Ho.warn("객체를 문자열로 변환할 수 없습니다:",t),"[Object]"}}return String(t)},qd=(t,e)=>{if(!t)return!0;const n=t.match(/^\{\{(.+)\}\}$/);if(!n)return!0;const r=n[1].trim();try{return!!new Function("row",`return ${r}`)(e)}catch(s){return Ho.warn("subRow 조건 평가 실패:",t,s),!0}},Ss=(t,e,n,r="",s)=>{const o=window.G7Core;if(o?.renderItemChildren){const i={row:e,value:n,$value:n};return o.renderItemChildren(t,i,Za,r,s?{componentContext:s}:void 0)}return Ho.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Ja=(t,e,n="",r)=>{const s=window.G7Core;if(s?.renderItemChildren){const o={row:e,$value:e};return s.renderItemChildren(t,o,Za,n,r?{componentContext:r}:void 0)}return Ho.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},jb=({id:t,columns:e,data:n,sortable:r=!0,pagination:s=!1,pageSize:o=10,onRowClick:i,className:a="",style:l,sortField:c,sortDirection:d,onSortChange:u,selectable:f=!1,selectedIds:g=[],onSelectionChange:m,idField:p="id",showColumnSelector:y=!1,visibleColumns:b,onColumnVisibilityChange:S,responsiveBreakpoint:x=768,cardRenderer:E,rowActions:k,onRowAction:C,alwaysShowPagination:N=!1,serverSidePagination:_=!1,serverCurrentPage:w,serverTotalPages:M,onPageChange:O,prevText:L,nextText:F,columnSelectorText:$,emptyMessage:D,actionsColumnHeader:A,requiredText:T,selectedCountText:z,showFirstLast:H=!0,expandable:W=!1,expandedRowIds:j,onExpandChange:U,expandChildren:B,expandedRowRender:G,expandColumnWidth:V="48px",expandIconExpanded:K=de.ChevronDown,expandIconCollapsed:X=de.ChevronRight,expandConditionField:Z,dynamicColumns:ee,dynamicColumnsInsertAfter:ne,expandContext:he,__componentContext:J,subRowChildren:ce,subRowCondition:ue,subRowClassName:ae="px-6 py-2 bg-gray-50 dark:bg-gray-900",subRowRender:ve,footerCells:fe,footerClassName:ye="bg-gray-50 dark:bg-gray-800/50 font-medium",footerCardChildren:ke,editorAttrs:Ue})=>{const se=L||void 0,Oe=F||void 0,Pe=$??Cs("common.column_selector"),Ie=D??Cs("common.no_data"),je=A??Cs("common.actions"),st=T??Cs("common.required"),ut=z??Cs("common.selected_count"),We=window.G7Core,et=We?.useControllableState,Xe=We?.shallowArrayEqual,[te,ge]=et?et(c,null,q=>{q!==null&&u?.(q,pe)}):[c??null,()=>{}],[pe,me]=et?et(d,"asc",q=>{te!==null&&u?.(te,q)}):[d??"asc",()=>{}],[be,Be]=v.useState(1),[Se,ze]=et?et(j,[],U,{isEqual:Xe}):[j??[],()=>{}],[_e,Re]=v.useState(!1),ot=v.useRef(null),$e=We?.useResponsive,Te=$e?.(),He=Te?Te.width{if(!ee||!Array.isArray(ee)||ee.length===0)return e;if(ne){const q=e.findIndex(le=>le.field===ne);if(q!==-1)return[...e.slice(0,q+1),...ee,...e.slice(q+1)]}return[...e,...ee]},[e,ee,ne]),[Ze,it]=v.useState(()=>b&&b.length>0?b:e.filter(q=>!q.hidden).map(q=>q.field));v.useEffect(()=>{b&&b.length>0&&it(b)},[b]);const gt=v.useRef("");v.useEffect(()=>{const q=e.map(le=>le.field).join(",");gt.current&&q!==gt.current&&(!b||b.length===0)&&it(e.filter(le=>!le.hidden).map(le=>le.field)),gt.current=q},[e,b]);const tn=v.useRef([]),mt=v.useRef(null);v.useEffect(()=>{if(ee&&ee.length>0){const q=ee.map(Ke=>Ke.field);if(mt.current===null&&(mt.current=b!==void 0&&b.length>0,mt.current)){tn.current=q;return}const le=tn.current,we=q.filter(Ke=>!le.includes(Ke));if(we.length>0){const Ke=we.filter(Le=>!Ze.includes(Le));if(Ke.length>0){const Le=[...Ze,...Ke];it(Le),S?.(Le)}}tn.current=q}},[ee]),v.useEffect(()=>{_||Be(1)},[n,_]),v.useEffect(()=>{const q=le=>{ot.current&&!ot.current.contains(le.target)&&Re(!1)};return _e&&document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[_e]);const xt=v.useMemo(()=>!y&&(!b||b.length===0)?De.filter(q=>!q.hidden):De.filter(q=>Ze.includes(q.field)),[De,Ze,y,b]),Dt=v.useMemo(()=>!te||!r||!n?n||[]:u?n:[...n].sort((q,le)=>{const we=q[te],Ke=le[te];if(we===Ke)return 0;const Le=we>Ke?1:-1;return pe==="asc"?Le:-Le}),[n,te,pe,r,u]),Ve=v.useMemo(()=>{if(_||!s)return Dt;const q=(be-1)*o,le=q+o;return Dt.slice(q,le)},[Dt,be,o,s,_]),Bt=_?w||1:be,ln=_?M||1:Math.ceil((Dt?.length||0)/o),nn=v.useCallback(q=>{_&&O?O(q):Be(q)},[_,O]),Nn=q=>{if(!r||e.find(Ke=>Ke.field===q)?.sortable===!1)return;const we=te===q&&pe==="asc"?"desc":"asc";et?(ge(q),me(we)):u&&u(q,we)},fr=v.useCallback(()=>{if(!m||!Ve)return;const q=Ve.map(we=>we[p]);if(q.every(we=>g.includes(we)))m(g.filter(we=>!q.includes(we)));else{const we=[...new Set([...g,...q])];m(we)}},[Ve,g,m,p]),bn=v.useCallback(q=>{m&&(g.includes(q)?m(g.filter(le=>le!==q)):m([...g,q]))},[g,m]),To=v.useCallback(q=>{if(De.find(Ke=>Ke.field===q)?.required)return;const we=Ze.includes(q)?Ze.filter(Ke=>Ke!==q):[...Ze,q];it(we),S?.(we)},[De,Ze,S]),Ao=v.useCallback((q,le)=>{C?.(q,le)},[C]),Do=v.useCallback(q=>k?k.map(le=>{let we=le.disabled??!1;if(le.disabledField&&!we){const Ke=le.disabledField.split(".");let Le=q;for(const Io of Ke)Le=Le?.[Io];Le||(we=!0)}return{...le,disabled:we,onClick:()=>Ao(le.id,q)}}):[],[k,Ao]),Dr=v.useCallback(q=>{if(!Z)return!0;const le=q[Z];return Array.isArray(le)?le.length>0:!!le},[Z]),Ta=v.useCallback(q=>{const le=Se.includes(q)?Se.filter(we=>we!==q):[...Se,q];et?ze(le):U&&U(le)},[Se,U,et,ze]),Ce=v.useCallback(q=>Se.includes(q),[Se]),Y=v.useCallback(q=>G?G(q):B&&B.length>0&&We?.renderExpandContent?We.renderExpandContent({children:B,row:q,expandContext:he,componentContext:J,componentMap:Za,keyPrefix:`expand-${q[p]}`}):null,[G,B,p,he,J,J?.state]),ie=v.useMemo(()=>!Ve||Ve.length===0?!1:Ve.every(q=>g.includes(q[p])),[Ve,g,p]),xe=v.useMemo(()=>{if(!Ve||Ve.length===0)return!1;const q=Ve.filter(le=>g.includes(le[p])).length;return q>0&&q{const we=q[p],Ke=Ce(we);return h.jsxs(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[h.jsxs(I,{className:"flex items-start justify-between",children:[W&&Dr(q)&&h.jsx(oe,{onClick:()=>Ta(we),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors mr-2","aria-label":Ke?"Collapse card":"Expand card",children:h.jsx(re,{name:Ke?K:X,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}),f&&h.jsx(vn,{checked:g.includes(q[p]),onChange:()=>bn(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded mr-3 mt-1"}),h.jsx(I,{className:"flex-1",children:h.jsx(I,{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:le.map(Le=>h.jsxs(I,{className:"min-w-0",children:[h.jsx(Q,{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:Le.header}),h.jsx(I,{className:"text-sm text-gray-900 dark:text-gray-200 mt-0.5 break-words",children:Le.cellChildren&&Le.cellChildren.length>0?Ss(Le.cellChildren,q,q[Le.field],`card-${q[p]}-${Le.field}`,J):Le.render?Le.render(q[Le.field],q):Qa(q[Le.field])})]},Le.field))})}),k&&k.length>0&&h.jsx(I,{className:"ml-2",children:h.jsx(bs,{items:Do(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal})})]}),W&&Ke&&Dr(q)&&h.jsx(I,{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Y(q)}),(ce&&ce.length>0||ve)&&qd(ue,q)&&h.jsx(I,{className:ae?`mt-3 ${ae}`:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:ve?ve(q):Ja(ce,q,`card-subrow-${we}`,J)})]})};return He?h.jsxs(I,{id:t,className:`w-full ${a}`,style:l,...Ue,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:ot,className:"relative",children:[h.jsxs(oe,{onClick:()=>Re(!_e),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Pe})]}),_e&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:De.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&To(q.field),children:[h.jsx(vn,{checked:Ze.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",st,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ut&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:ut.replace("{count}",String(g.length))}),h.jsx(I,{id:t?`${t}__body`:void 0,children:Ve&&Ve.length>0?Ve.map((q,le)=>h.jsx(I,{children:E?E(q,xt):ft(q,xt)},q[p]||le)):h.jsx(I,{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:Ie})}),fe&&fe.length>0&&Ve&&Ve.length>0&&h.jsx(I,{className:`rounded-lg p-4 mt-2 ${ye}`,children:ke&&ke.length>0?Ss(ke,{},null,"footer-card",J):h.jsx(I,{className:"space-y-1",children:fe.filter(q=>q.text||q.children&&q.children.length>0).map((q,le)=>{const we=xt.find(Ke=>Ke.field===q.field);return h.jsxs(I,{className:"flex justify-between text-sm",children:[h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:we?.header||""}),h.jsx(Q,{className:q.className||"text-gray-900 dark:text-gray-100",children:q.children&&q.children.length>0?Ss(q.children,{},null,`footer-mobile-${le}`,J):q.text||""})]},`footer-mobile-${le}`)})})}),s&&(N||ln>1)&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Po,{currentPage:Bt,totalPages:ln,onPageChange:nn,showFirstLast:H,maxVisiblePages:5,prevText:se,nextText:Oe})})]}):h.jsxs(I,{id:t,className:`w-full ${a}`,style:l,...Ue,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:ot,className:"relative",children:[h.jsxs(oe,{onClick:()=>Re(!_e),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Pe})]}),_e&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:De.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&To(q.field),children:[h.jsx(vn,{checked:Ze.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",st,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ut&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:ut.replace("{count}",String(g.length))}),h.jsx(I,{id:t?`${t}__body`:void 0,className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:h.jsxs(Pa,{className:"w-full",children:[h.jsx($a,{className:"bg-gray-50 dark:bg-gray-700",children:h.jsxs(Jn,{children:[W&&h.jsx($r,{className:"px-2 py-3",style:{width:V}}),f&&h.jsx($r,{className:"px-4 py-3 w-10",children:h.jsx(vn,{checked:ie,ref:q=>{q&&(q.indeterminate=xe)},onChange:fr,className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),xt.map(q=>h.jsxs($r,{className:`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider ${r&&q.sortable!==!1?"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600":""}`,style:{width:q.width,minWidth:q.width},onClick:()=>Nn(q.field),children:[q.header,te===q.field&&h.jsx(Q,{className:"ml-1",children:pe==="asc"?"↑":"↓"})]},q.field)),k&&k.length>0&&h.jsx($r,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider w-24",children:je})]})}),h.jsx(Fa,{className:`bg-white dark:bg-gray-800 ${ae?"":"divide-y divide-gray-200 dark:divide-gray-700"}`,children:Ve&&Ve.length>0?Ve.map((q,le)=>{const we=q[p]||le,Ke=Ce(we);return h.jsxs(v.Fragment,{children:[h.jsxs(Jn,{className:`${i?"cursor-pointer":""} hover:bg-gray-50 dark:hover:bg-gray-700 ${g.includes(q[p])?"bg-blue-50 dark:bg-blue-900/20":""} ${ae&&le>0?"border-t border-gray-200 dark:border-gray-700":""}`,onClick:()=>i?.(q),children:[W&&h.jsx(Kt,{className:"px-2 py-4 text-center",onClick:Le=>Le.stopPropagation(),children:Dr(q)?h.jsx(oe,{onClick:()=>Ta(we),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors","aria-label":Ke?"Collapse row":"Expand row",children:h.jsx(re,{name:Ke?K:X,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}):null}),f&&h.jsx(Kt,{className:"px-4 py-4",onClick:Le=>Le.stopPropagation(),children:h.jsx(vn,{checked:g.includes(q[p]),onChange:()=>bn(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),xt.map(Le=>h.jsx(Kt,{className:"px-6 py-4 align-top whitespace-nowrap text-sm text-gray-900 dark:text-gray-200",style:{width:Le.width,minWidth:Le.width},children:Le.cellChildren&&Le.cellChildren.length>0?Ss(Le.cellChildren,q,q[Le.field],`${q[p]}-${Le.field}`,J):Le.render?Le.render(q[Le.field],q):Qa(q[Le.field])},Le.field)),k&&k.length>0&&h.jsx(Kt,{className:"px-6 py-4 text-right",onClick:Le=>Le.stopPropagation(),children:h.jsx(bs,{items:Do(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal,position:"right"})})]}),W&&Ke&&Dr(q)&&h.jsx(Jn,{className:"bg-gray-50 dark:bg-gray-900",children:h.jsx(Kt,{colSpan:xt.length+1+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-4",children:Y(q)})}),(ce&&ce.length>0||ve)&&qd(ue,q)&&h.jsx(Jn,{className:ae?"!border-t-0":"",children:h.jsx(Kt,{colSpan:xt.length+(W?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:ae?"p-2":ae||"px-6 py-2 bg-gray-50 dark:bg-gray-900",children:ae?h.jsx(I,{className:ae,children:ve?ve(q):Ja(ce,q,`subrow-${we}`,J)}):ve?ve(q):Ja(ce,q,`subrow-${we}`,J)})})]},we)}):h.jsx(Jn,{children:h.jsx(Kt,{colSpan:xt.length+(W?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400",children:Ie})})}),fe&&fe.length>0&&Ve&&Ve.length>0&&h.jsx(za,{children:h.jsxs(Jn,{className:ye,children:[W&&h.jsx(Kt,{className:"px-2 py-4"}),f&&h.jsx(Kt,{className:"px-4 py-4"}),(()=>{const q=new Map(fe.filter(le=>le.field).map(le=>[le.field,le]));return xt.map(le=>{const we=q.get(le.field);return we?h.jsx(Kt,{className:`px-6 py-4 text-sm text-gray-900 dark:text-gray-200 ${we.className||""}`,colSpan:we.colSpan,style:{width:le.width,minWidth:le.width},children:we.children&&we.children.length>0?Ss(we.children,{},null,`footer-${le.field}`,J):we.text||""},`footer-${le.field}`):h.jsx(Kt,{className:"px-6 py-4",style:{width:le.width,minWidth:le.width}},`footer-${le.field}`)})})(),k&&k.length>0&&h.jsx(Kt,{className:"px-6 py-4"})]})})]})}),s&&(N||ln>1)&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Po,{currentPage:Bt,totalPages:ln,onPageChange:nn,showFirstLast:H,maxVisiblePages:5,prevText:se,nextText:Oe})})]})},Ra=window.G7Core?.createLogger?.("Comp:CardGrid")??{log:(...t)=>console.log("[Comp:CardGrid]",...t),warn:(...t)=>console.warn("[Comp:CardGrid]",...t),error:(...t)=>console.error("[Comp:CardGrid]",...t)},Wb=(t,e)=>window.G7Core?.t?.(t,e)??t,Gb=()=>window.G7Core?.getComponentMap?.()||{},Yb=(t,e)=>{if(!t)return!0;const n=t.match(/^\{\{(.+)\}\}$/);if(!n)return!0;const r=n[1].trim();if(Ra.log("evaluateCondition:",{condition:t,expr:r,row:e,rowStatus:e?.status}),/[&|<>=!]/.test(r)||r.includes(".length"))try{const o=!!new Function("row",`return ${r}`)(e);return Ra.log("evaluateCondition result:",o),o}catch(s){return Ra.warn("evaluateCondition: 표현식 평가 실패:",r,s),!1}if(r.startsWith("!row.")){const s=r.slice(5);return!e[s]}if(r.startsWith("row.")){const s=r.slice(4);return!!e[s]}return!0},Zd=(t,e,n,r,s)=>{const o=window.G7Core;if(t.name==="ActionMenu"){if(r&&r.length>0&&s)return{...t,props:{...t.props,items:r.map(i=>({...i,onClick:()=>s(i.id,e)}))}};if(t.actions&&Array.isArray(t.actions)){const i=t.props?.items||[],a=new Map(t.actions.map(c=>[c.id,c])),l=i.map(c=>{if(typeof c.onClick=="string"){const d=c.onClick,u=a.get(d);if(u&&o?.ActionDispatcher)return{...c,onClick:()=>{const f={...n};o.ActionDispatcher.dispatch(u,f)}}}return c});return{...t,props:{...t.props,items:l}}}}return t.children&&Array.isArray(t.children)?{...t,children:t.children.map(i=>Zd(i,e,n,r,s))}:t},Xb=(t,e,n,r="",s,o)=>{const i=window.G7Core;if(i?.renderItemChildren){const a=t.filter(d=>{const u=d.condition||d.if;return u?Yb(u,e):!0}),l={row:e,$value:e,index:n},c=a.map(d=>Zd(d,e,l,s,o));try{const d=Gb();return i.renderItemChildren(c,l,d,r)}catch{return h.jsxs(I,{className:"text-red-600 dark:text-red-400 p-4",children:[h.jsx(bt,{children:"컴포넌트 로드 실패"}),h.jsx(bt,{className:"text-sm",children:"[CardGrid] 데이터를 표시할 수 없습니다."})]})}}return null},el=(t,e)=>{if(t.name==="Div"&&t.children&&t.children.length>0){const n=t.children.map((r,s)=>el(r,`${e}-child-${s}`)).filter(Boolean);return h.jsx(I,{className:t.props?.className||"",children:n},e)}return h.jsx(I,{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full animate-pulse"},e)},Qd=(t,e="skeleton")=>!t||t.length===0?null:t.map((n,r)=>{const s=`${e}-${n.id||n.name}-${r}`;return n.condition||n.if?null:(n.iteration,el(n,s))}).filter(Boolean),Kb=({data:t,cardColumns:e=[],gridColumns:n=3,gap:r=4,responsiveColumns:s,cardClassName:o="",idField:i="id",pagination:a=!0,pageSize:l=12,serverSidePagination:c=!1,serverCurrentPage:d,serverTotalPages:u,alwaysShowPagination:f=!1,onPageChange:g,paginationInfoText:m,rowActions:p,onRowAction:y,className:b="",style:S,emptyMessage:x,prevText:E,nextText:k,showSkeleton:C=!0,skeletonCount:N,skeletonCellChildren:_,id:w,editorAttrs:M})=>{const O=x??Wb("common.no_data"),L=e[0]?.cellChildren||[],[F,$]=v.useState(1);window.G7Core?.useResponsive?.();const A=c?d??1:F,T=c?u??1:Math.ceil((t?.length??0)/l),z=G=>{c?g?.(G):$(G)},H=v.useCallback((G,V)=>{y?.(G,V)},[y]),W=v.useMemo(()=>{if(!t)return[];if(!a||c)return t;const G=(F-1)*l,V=G+l;return t.slice(G,V)},[t,a,c,F,l]),j=v.useMemo(()=>{const G=[],V=s?.sm??1;G.push(`grid-cols-${V}`),s?.sm&&G.push(`sm:grid-cols-${s.sm}`);const K=s?.md??Math.min(n,2);G.push(`md:grid-cols-${K}`);const X=s?.lg??n;return G.push(`lg:grid-cols-${X}`),s?.xl&&G.push(`xl:grid-cols-${s.xl}`),G.join(" ")},[n,s]),U=v.useMemo(()=>C?_&&_.length>0?Qd(_,"custom-skeleton"):L&&L.length>0?Qd(L,"auto-skeleton"):null:null,[C,_,L]);if(!t){if(!C)return null;const G=N??n;return h.jsx(I,{className:`grid ${j} gap-${r} ${b}`,style:S,id:w,...M,children:Array.from({length:G}).map((V,K)=>h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6 space-y-4",children:U},`skeleton-${K}`))})}if(W.length===0)return h.jsx(I,{className:b,style:S,id:w,...M,children:h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-12",children:h.jsx(bt,{className:"text-center text-gray-600 dark:text-gray-400",children:O})})});const B=a&&(f||T>1);return h.jsxs(I,{className:b,style:S,id:w,...M,children:[h.jsx(I,{className:`grid ${j} gap-${r}`,children:W.map((G,V)=>h.jsx(I,{className:o,children:Xb(L,G,V,`card-${V}`,p,H)},G[i]||V))}),B&&h.jsxs(I,{className:"mt-6 space-y-4 flex flex-col items-center",children:[h.jsx(Po,{currentPage:A,totalPages:T,onPageChange:z,showFirstLast:!1,maxVisiblePages:5,prevText:E,nextText:k}),m&&h.jsx(I,{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:m})]})]})},qb=(t,e)=>window.G7Core?.t?.(t,e)??t,Uo=({isOpen:t,onClose:e,title:n,titlePrefix:r,titleSuffix:s,closeOnBackdropClick:o=!0,closeOnOverlayClick:i,showCloseButton:a=!0,closeOnEscape:l=!0,children:c,width:d="500px",className:u="",style:f,__dataContext:g,__translationContext:m})=>{const p=i!==void 0?i:o,y=v.useRef(null),b=v.useRef(null);if(v.useEffect(()=>{const E=k=>{k.key==="Escape"&&t&&l&&e()};if(t&&l)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,e,l]),v.useEffect(()=>{if(t&&y.current){b.current=document.activeElement;const E=y.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),k=E[0],C=E[E.length-1];k?.focus();const N=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===k&&(_.preventDefault(),C?.focus()):document.activeElement===C&&(_.preventDefault(),k?.focus()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N),b.current?.focus()}}},[t]),v.useEffect(()=>{if(t)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[t]),!t)return null;const S=f?.zIndex??50,x=(E,k)=>{if(!E||E.length===0)return null;const C=window.G7Core;if(!C)return null;const N=C.getDynamicRenderer?.();return N?E.map((_,w)=>h.jsx(N,{componentDef:_,dataContext:g||{},translationContext:m,registry:C.getComponentRegistry(),bindingEngine:C.getDataBindingEngine(),translationEngine:C.getTranslationEngine(),actionDispatcher:C.getActionDispatcher(),isRootRenderer:!1},`${k}-${w}`)):null};return h.jsxs(I,{className:"modal-wrapper",style:{zIndex:S},onClick:p?e:void 0,children:[h.jsx(I,{className:"modal-backdrop","aria-hidden":"true"}),h.jsxs(I,{ref:y,className:`modal-container ${u}`,style:{width:d,...f?{...f,zIndex:void 0}:{}},onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,children:[(n||r||s||a)&&h.jsxs(I,{className:"modal-header-row",children:[h.jsxs(I,{className:"flex-center gap-sm",children:[x(r,"title-prefix"),n&&h.jsx(I,{id:"modal-title",className:"modal-title",children:n}),x(s,"title-suffix")]}),a&&h.jsx(oe,{onClick:e,className:"modal-close-btn","aria-label":qb("common.close_modal"),children:h.jsx("svg",{className:"icon-lg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),h.jsx(I,{className:"modal-body-content",children:c})]})]})},Zb=({label:t,items:e,onItemClick:n,position:r="bottom-left",variant:s="default",className:o="",style:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(-1),g=v.useRef(null),m=v.useRef(null),[p,y]=v.useState(r);v.useEffect(()=>{const x=E=>{g.current&&!g.current.contains(E.target)&&(d(!1),f(-1))};if(c)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),v.useEffect(()=>{const x=E=>{if(!c)return;const k=e.map((C,N)=>C.disabled?-1:N).filter(C=>C!==-1);switch(E.key){case"ArrowDown":E.preventDefault(),f(C=>{const _=(k.indexOf(C)+1)%k.length;return k[_]});break;case"ArrowUp":E.preventDefault(),f(C=>{const N=k.indexOf(C),_=N<=0?k.length-1:N-1;return k[_]});break;case"Enter":E.preventDefault(),u>=0&&!e[u].disabled&&b(e[u]);break;case"Escape":E.preventDefault(),d(!1),f(-1);break}};if(c)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,u,e]),v.useEffect(()=>{if(c&&m.current&&g.current){const x=m.current.getBoundingClientRect(),E=g.current.getBoundingClientRect(),k=window.innerWidth,C=window.innerHeight,N=x.width||224,_=x.height||200;let w=r;r.includes("left")?E.left+N>k&&(w=w.replace("left","right")):E.right-N<0&&(w=w.replace("right","left")),r.includes("top")?E.top-_<0&&(w=w.replace("top","bottom")):E.bottom+_>C&&(w=w.replace("bottom","top")),y(w)}},[c,r]);const b=x=>{x.disabled||(x.onClick?.(),n?.(x.value,x),d(!1),f(-1))},S={"bottom-left":"dropdown-menu-bottom-left","bottom-right":"dropdown-menu-bottom-right","top-left":"dropdown-menu-top-left","top-right":"dropdown-menu-top-right"};return h.jsxs(I,{ref:g,className:`dropdown ${o}`,style:i,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:s==="text"?"dropdown-trigger-text":"dropdown-trigger","aria-haspopup":"true","aria-expanded":c,children:[t,s!=="text"&&h.jsx("svg",{className:`inline-block ml-2 w-4 h-4 transition-transform ${c?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&h.jsx(I,{ref:m,className:`dropdown-menu ${S[p]}`,role:"menu","aria-orientation":"vertical",children:h.jsx(I,{className:"py-1",children:e.map((x,E)=>h.jsx(I,{className:`${x.disabled?"dropdown-item-disabled":"dropdown-item"} ${u===E?"dropdown-item-focused":""}`,onClick:()=>b(x),onMouseEnter:()=>!x.disabled&&f(E),role:"menuitem","aria-disabled":x.disabled,tabIndex:x.disabled?-1:0,children:x.label},x.value))})})]})},Qb=({imageUrl:t,imageAlt:e="",title:n,subtitle:r,description:s,price:o,originalPrice:i,discountRate:a,currency:l="₩",buttonText:c="자세히 보기",onButtonClick:d,className:u="",style:f,id:g,editorAttrs:m})=>{const p=a&&a>0,y=(o??0).toLocaleString(),b=i?.toLocaleString();return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md hover:shadow-xl transition-shadow border border-gray-200 dark:border-gray-700 overflow-hidden ${u}`,style:f,id:g,...m,children:[t&&h.jsxs(I,{className:"relative w-full",children:[h.jsx(yn,{src:t,alt:e||n,className:"w-full h-64 object-cover"}),p&&h.jsx(I,{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded-md",children:h.jsxs(Q,{className:"text-sm font-bold",children:["-",a,"%"]})})]}),h.jsxs(I,{className:"p-4",children:[r&&h.jsx(Ir,{className:"text-xs font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2",children:r}),h.jsx(Qn,{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 line-clamp-2",children:n}),s&&h.jsx(bt,{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-3",children:s}),h.jsxs(I,{className:"flex items-center gap-2 mb-4",children:[h.jsxs(Q,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[l,y]}),i&&h.jsxs(Q,{className:"text-sm text-gray-400 dark:text-gray-500 line-through",children:[l,b]})]}),c&&h.jsx(oe,{onClick:d,className:"w-full bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors",children:c})]})]})},Jb=({value:t,label:e,change:n,changeLabel:r="전월 대비",iconName:s,trend:o="neutral",className:i="",style:a,id:l,editorAttrs:c})=>{const d=o==="up",u=o==="down",f=n!==void 0?Math.abs(n):0,g=d?"stats-trend-up":u?"stats-trend-down":"stats-trend-neutral",m=d?de.ArrowUp:u?de.ArrowDown:void 0;return h.jsxs(I,{className:`stat-card ${i}`,style:a,id:l,...c,children:[h.jsxs(I,{className:"flex-between mb-md",children:[s&&h.jsx(I,{className:"stats-icon stats-icon-blue",children:h.jsx(re,{name:s,className:"icon-lg"})}),n!==void 0&&h.jsxs(I,{className:`stats-change ${g}`,children:[m&&h.jsx(re,{name:m,className:"icon-sm"}),h.jsxs(Q,{className:"text-sm font-semibold",children:[f,"%"]})]})]}),h.jsx(Ir,{className:"stats-value-lg",children:typeof t=="number"?t.toLocaleString():t}),h.jsx(bt,{className:"stats-label",children:e}),n!==void 0&&r&&h.jsx(I,{className:"stats-sublabel",children:h.jsx(Q,{children:r})})]})},Jd=()=>window.G7Core,Rd=(t,e)=>Jd()?.t?.(t,e)??t,Rb=({name:t="search",placeholder:e,value:n,onChange:r,onSubmit:s,showButton:o=!1,suggestions:i=[],onSuggestionClick:a,showSuggestions:l=!1,className:c="",style:d,id:u,editorAttrs:f})=>{const g=e??Rd("common.search_placeholder"),[m,p]=v.useState(""),[y,b]=v.useState(!1),S=v.useRef(null),x=v.useRef(""),E=n!==void 0?n:m,k=l&&y&&i.length>0&&E.length>0,C="w-64 pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm",N=Jd()?.style?.mergeClasses?.(C,c)??`${C} ${c}`;v.useEffect(()=>{n!==void 0&&(x.current=n)},[n]);const _=O=>{const L=O.target.value;p(L),r?.(O),x.current!==""&&L===""&&!O.nativeEvent.inputType&&setTimeout(()=>{const F=S.current?.querySelector("form");F&&F.requestSubmit()},0),x.current=L},w=O=>{p(O.text);const L={target:{value:O.text,name:t}};r?.(L),a?.(O),b(!1)},M=O=>{O.preventDefault(),s?.(O)};return h.jsxs(I,{ref:S,className:"relative",style:d,id:u,...f,children:[h.jsx(La,{onSubmit:M,className:"relative",children:h.jsxs(I,{className:`relative flex items-center ${o?"gap-2":""}`,children:[h.jsxs(I,{className:"relative flex-1",children:[h.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:h.jsx(re,{name:de.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),h.jsx(wt,{type:"search",name:t,value:E,onChange:_,onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),200),placeholder:g,className:N})]}),o&&h.jsx(oe,{type:"submit",className:"px-4 py-2 bg-gray-800 dark:bg-gray-600 text-white rounded-lg hover:bg-gray-900 dark:hover:bg-gray-500 transition-colors text-sm font-medium cursor-pointer h-[42px]",children:Rd("common.search")})]})}),k&&h.jsx(I,{className:"absolute z-10 w-full mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-64 overflow-y-auto",children:i.map(O=>h.jsx(I,{className:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 transition-colors",onClick:()=>w(O),children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:O.text})]})},O.id))})]})},tl=(t,e)=>window.G7Core?.t?.(t,e)??t,ey=({title:t,filters:e,onChange:n,onReset:r,showResetButton:s=!0,className:o="",style:i,id:a,editorAttrs:l})=>{const c=t??tl("common.filter"),d=(f,g)=>{n?.(f,g)},u=(f,g,m)=>{const p=e.find(b=>b.id===f);if(!p)return;const y=Array.isArray(p.value)?p.value:[];if(typeof g=="string"){const b=y.filter(x=>typeof x=="string"),S=m?[...b,g]:b.filter(x=>x!==g);n?.(f,S)}else{const b=y.filter(x=>typeof x=="number"),S=m?[...b,g]:b.filter(x=>x!==g);n?.(f,S)}};return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md border border-gray-200 dark:border-gray-700 p-4 ${o}`,style:i,id:a,...l,children:[h.jsxs(I,{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(Q,{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s&&r&&h.jsx(oe,{onClick:r,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:tl("common.reset")})]}),h.jsx(I,{className:"space-y-4",children:e.map(f=>h.jsxs(I,{className:"space-y-2",children:[h.jsx(rn,{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:f.label}),f.type==="select"&&h.jsxs(Pr,{value:f.value,onChange:g=>d(f.id,g.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[h.jsx("option",{value:"",children:tl("common.select_placeholder")}),f.options.map(g=>h.jsx("option",{value:g.value,children:g.label},g.id))]}),f.type==="checkbox"&&h.jsx(I,{className:"space-y-2",children:f.options.map(g=>{const m=Array.isArray(f.value)?f.value.some(p=>p===g.value):!1;return h.jsxs(rn,{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 p-2 rounded-md transition-colors",children:[h.jsx(vn,{checked:m,onChange:p=>u(f.id,g.value,p.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:g.label})]},g.id)})})]},f.id))})]})},ty=({tabs:t,activeTabId:e,onTabChange:n,variant:r="default",className:s="",style:o,mobileBreakpoint:i=768,id:a,editorAttrs:l})=>{const d=window.G7Core?.useResponsive,u=d?.(),f=u?u.width{!S.disabled&&S.id!==e&&n?.(S.id)},m=S=>{const x=S.target.value,E=Number(x),k=typeof x=="string"&&x!==""&&!Number.isNaN(E)?E:x,C=t.find(N=>String(N.id)===String(k));C&&g(C)};if(f)return h.jsx(I,{className:s,style:o,id:a,...l,children:h.jsx(Pr,{value:e!==void 0?String(e):"",onChange:m,options:t.map(S=>({value:String(S.id),label:S.badge!==void 0?`${S.label} (${S.badge})`:S.label,disabled:S.disabled})),className:"w-full"})});const p=S=>{const x=S.id===e;if(S.disabled)return"tab-btn-base tab-btn-disabled";switch(r){case"pills":return x?"tab-btn-base tab-btn-pills-active":"tab-btn-base tab-btn-pills";case"underline":return x?"tab-btn-base tab-btn-underline-active":"tab-btn-base tab-btn-underline";default:return x?"tab-btn-base tab-btn-default-active":"tab-btn-base tab-btn-default"}},y=r==="underline"?"tab-nav-underline":"tab-nav-default",b=l?.["data-editor-path"];return h.jsx(Lo,{className:`${y} ${s}`,style:o,id:a,...l,children:t.map((S,x)=>h.jsxs(oe,{type:"button",onClick:()=>g(S),disabled:S.disabled,className:p(S),...b?{"data-editor-item-path":`${b}.props.tabs.${x}`}:{},children:[S.iconName&&h.jsx(re,{name:S.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:S.label}),S.badge!==void 0&&h.jsx(I,{className:"flex items-center justify-center min-w-[20px] h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full",children:h.jsx(Q,{children:S.badge})})]},S.id))})},nl=window.G7Core?.createLogger?.("Handler:ScrollToSection")??{log:(...t)=>console.log("[Handler:ScrollToSection]",...t),warn:(...t)=>console.warn("[Handler:ScrollToSection]",...t),error:(...t)=>console.error("[Handler:ScrollToSection]",...t)};async function eu(t,e){const n=t.params||{},{targetId:r,offset:s=120,delay:o=100,scrollContainerId:i}=n;if(!r){nl.warn("targetId is required");return}const a=await ny(r,o);if(!a){nl.warn(`Element not found: ${r}`);return}const l=ry(a,i),c=sy(a,l,s);oy(l,c)}async function ny(t,e){await new Promise(s=>setTimeout(s,e));const n=10,r=50;for(let s=0;ssetTimeout(i,50)),o;await new Promise(i=>setTimeout(i,r))}return null}function ry(t,e){if(e){const o=document.getElementById(e);if(o&&tu(o))return o;nl.warn(`Container '${e}' ${o?"has no scroll":"not found"}, trying auto-detect`)}let n=t.parentElement,r=0;const s=10;for(;n&&n!==document.body&&rt.clientHeight}function sy(t,e,n){if(e===window||!("getBoundingClientRect"in e))return t.getBoundingClientRect().top+window.pageYOffset-n;{const r=e.getBoundingClientRect(),s=t.getBoundingClientRect();return e.scrollTop+(s.top-r.top)-n}}function oy(t,e){t===window||!("scrollTo"in t)?window.scrollTo({top:e,behavior:"smooth"}):t.scrollTo({top:e,behavior:"smooth"})}window.G7Core?.createLogger?.("Comp:TabNavigation");const iy=({tabs:t,activeTabId:e,className:n="bg-white dark:bg-gray-800 flex gap-2 border-b border-gray-200 dark:border-gray-700 px-6",style:r,activeClassName:s="tab-btn-base tab-btn-default-active",inactiveClassName:o="tab-btn-base tab-btn-default",sectionIdPrefix:i="tab_content_",scrollOffset:a=120,scrollDelay:l=100,onTabChange:c,enableScrollSpy:d=!1,scrollSpyOffset:u=80,scrollContainerId:f,id:g,editorAttrs:m})=>{const[p,y]=v.useState(e??(t.length>0?t[0].id:"")),S=window.G7Core?.useResponsive,x=S?.(),E=x?x.width<768:typeof window<"u"&&window.innerWidth<768,k=v.useRef(!1),C=v.useRef(null),N=w=>{if(d&&(k.current=!0,C.current&&clearTimeout(C.current)),w.onClick){if(w.onClick(w.id),!d)return}else if(c){if(c(w.id),!d)return}else y(w.id);const M=w.scrollOffset??a,O=w.scrollDelay??l;eu({params:{targetId:`${i}${w.id}`,offset:M,delay:O,scrollContainerId:f}}),d&&(C.current=setTimeout(()=>{k.current=!1},O+500))};v.useEffect(()=>{if(!d)return;const w=f?document.getElementById(f):null,M={root:w??null,rootMargin:`-${u}px 0px -30% 0px`,threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},O=new Map,L=()=>{const A=w,T=A?A.scrollTop:window.pageYOffset||document.documentElement.scrollTop,z=A?A.scrollHeight:document.documentElement.scrollHeight,H=A?A.clientHeight:document.documentElement.clientHeight;return T+H>=z-10},F=A=>{if(k.current)return;A.forEach(U=>{const B=U.target.id;U.isIntersecting?O.set(B,U.intersectionRatio):O.delete(B)});let T=0,z="";O.forEach((U,B)=>{U>T&&(T=U,z=B)});const H=t[t.length-1],W=`${i}${H?.id}`,j=O.has(W);if(L()&&j&&H){y(H.id);return}if(z){const U=z.replace(i,""),B=Number(U),G=isNaN(B)?U:B;t.some(K=>K.id===G)&&y(G)}},$=()=>{},D=new IntersectionObserver(F,M);return t.forEach(A=>{const T=document.getElementById(`${i}${A.id}`);T&&D.observe(T)}),window.addEventListener("scroll",$,{passive:!0}),()=>{D.disconnect(),window.removeEventListener("scroll",$),C.current&&clearTimeout(C.current)}},[d,t,i,u,f]);const _=w=>{const M=w.target.value,O=Number(M),L=isNaN(O)?M:O,F=t.find($=>$.id===L);F&&N(F)};return E?h.jsx(I,{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3",id:g,...m,children:h.jsx(Pr,{value:String(p),onChange:_,options:t.map(w=>({value:String(w.id),label:w.label,disabled:w.disabled})),className:"w-full"})}):h.jsx(I,{className:n,style:r,id:g,...m,children:t.map(w=>h.jsxs(oe,{className:p===w.id?s:o,disabled:w.disabled,onClick:()=>N(w),children:[w.iconName&&h.jsx(re,{name:w.iconName,size:"sm"}),h.jsx(Q,{children:w.label})]},w.id))})},ay=()=>window.G7Core,ly=({iconName:t,label:e,onClick:n,variant:r="primary",size:s="md",disabled:o=!1,className:i="",style:a,id:l,editorAttrs:c})=>{const d={sm:e?"px-3 py-1.5 text-sm":"w-8 h-8",md:e?"px-4 py-2 text-base":"w-10 h-10",lg:e?"px-5 py-2.5 text-lg":"w-12 h-12"},u={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},f={primary:"bg-blue-600 hover:bg-blue-700 text-white border-transparent",secondary:"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600",danger:"bg-red-600 hover:bg-red-700 text-white border-transparent",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-transparent",outline:"bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600"},g="inline-flex items-center justify-center gap-2 font-medium rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-blue-400",m=o?"opacity-50 cursor-not-allowed":"",p=`${g} ${d[s]} ${f[r]} ${m}`,y=ay()?.style?.mergeClasses?.(p,i)??`${p} ${i}`;return h.jsxs(oe,{onClick:n,disabled:o,className:y,style:a,id:l,...c,children:[h.jsx(re,{name:t,className:u[s]}),e]})},cy=(t,e)=>window.G7Core?.t?.(t,e)??t,nu=({isOpen:t,onClose:e,title:n,content:r,actions:s=[],width:o="500px",closeOnOverlay:i=!0,showCloseButton:a=!0,className:l="",style:c})=>{const d=()=>{i&&e()},u={primary:"dialog-btn-primary",secondary:"dialog-btn-secondary",danger:"dialog-btn-danger",ghost:"dialog-btn-ghost"};return h.jsxs(Uo,{isOpen:t,onClose:d,width:o,className:l,style:c,children:[h.jsxs(I,{className:"dialog-header",children:[h.jsx(Qn,{className:"dialog-title",children:n}),a&&h.jsx(oe,{onClick:e,className:"dialog-close","aria-label":cy("common.close_dialog"),children:h.jsx(re,{name:de.Times,className:"icon-md"})})]}),h.jsx(I,{className:"dialog-body",children:r}),s.length>0&&h.jsx(I,{className:"dialog-footer",children:s.map((f,g)=>h.jsxs(oe,{onClick:f.onClick,disabled:f.disabled,className:u[f.variant||"primary"],children:[f.iconName&&h.jsx(re,{name:f.iconName,className:"icon-sm mr-2 inline-block"}),f.label]},g))})]})},rl=(t,e)=>window.G7Core?.t?.(t,e)??t,ru=({isOpen:t,onClose:e,title:n,message:r,confirmText:s,cancelText:o,onConfirm:i,onCancel:a,confirmButtonVariant:l="primary",cancelButtonVariant:c="secondary",width:d="500px",closeOnOverlay:u=!0,isLoading:f=!1,loadingText:g})=>{const m=s??rl("common.confirm"),p=o??rl("common.cancel"),y=g??rl("common.loading"),b=()=>{i()},S=()=>{f||(a?.(),e())},x=()=>{f||e()},E={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return h.jsxs(Uo,{isOpen:t,onClose:x,title:n,width:d,children:[h.jsx(I,{className:"py-2",children:typeof r=="string"?h.jsx(bt,{className:"text-gray-700 dark:text-gray-300",children:r}):r}),h.jsxs(I,{className:"flex justify-end gap-3 mt-6",children:[h.jsx(oe,{onClick:S,disabled:f,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:h.jsx(Q,{children:p})}),h.jsxs(oe,{onClick:b,disabled:f,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${E[l]}`,children:[f&&h.jsx(re,{name:de.Spinner,className:"w-4 h-4 animate-spin"}),h.jsx(Q,{children:f?y:m})]})]})]})},dy=(t,e)=>window.G7Core?.t?.(t,e)??t,uy=({isOpen:t,onClose:e,title:n,message:r,confirmText:s,onConfirm:o,confirmButtonVariant:i="primary",width:a="500px",closeOnOverlay:l=!0})=>{const u=[{label:s??dy("common.confirm"),onClick:()=>{o?.(),e()},variant:i}],f=typeof r=="string"?h.jsx(bt,{className:"text-gray-700 dark:text-gray-300",children:r}):r;return h.jsx(nu,{isOpen:t,onClose:e,title:n,content:f,actions:u,width:a,closeOnOverlay:l})},fy=(t,e)=>window.G7Core?.t?.(t,e)??t,hy={success:de.CheckCircle,error:de.XCircle,warning:de.ExclamationTriangle,info:de.InfoCircle},su={success:{bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800",text:"text-green-800 dark:text-green-300"},error:{bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800",text:"text-red-800 dark:text-red-300"},warning:{bg:"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800",text:"text-yellow-800 dark:text-yellow-300"},info:{bg:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",text:"text-blue-800 dark:text-blue-300"}},gy={"top-left":"top-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-center":"bottom-4 left-1/2 -translate-x-1/2","bottom-right":"bottom-4 right-4"},py=({toasts:t,position:e="bottom-center",duration:n=3e3,onRemove:r})=>{const[s,o]=v.useState(new Map),i=v.useCallback(a=>{o(l=>{const c=new Map(l);return c.set(a,!1),c}),setTimeout(()=>{if(r)r(a);else{const l=window.G7Core;l?.state?.update&&l.state.update(c=>({toasts:(Array.isArray(c.toasts)?c.toasts:[]).filter(u=>u.id!==a)}))}},300)},[r]);return v.useEffect(()=>{!t||t.length===0||t.forEach(a=>{if(s.has(a.id))return;o(c=>{const d=new Map(c);return d.set(a.id,!0),d});const l=a.duration||n;l>0&&setTimeout(()=>{i(a.id)},l)})},[t,n,i,s]),!t||t.length===0?null:h.jsx(I,{className:`fixed z-[9999] flex flex-col gap-2 ${gy[e]}`,"aria-live":"polite","aria-atomic":"true",children:t.map(a=>h.jsx(my,{toast:a,position:e,isVisible:s.get(a.id)??!0,onClose:()=>i(a.id)},a.id))})},my=({toast:t,position:e,isVisible:n,onClose:r})=>{const s=su[t.type]||su.info,o=t.icon?t.icon:hy[t.type],i=e.startsWith("bottom")?"translate-y-2":"-translate-y-2";return h.jsxs(I,{className:` flex items-center gap-3 p-4 rounded-lg border shadow-lg min-w-[300px] max-w-md transition-all duration-300 ${s.bg} ${n?"opacity-100 translate-y-0":`opacity-0 ${i}`} - `,role:"alert",children:[h.jsx(re,{name:o,className:`w-5 h-5 flex-shrink-0 ${s.text}`}),h.jsx(Q,{className:`flex-1 text-sm font-medium ${s.text}`,children:t.message}),h.jsx(oe,{onClick:r,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${s.text} focus:outline-none`,"aria-label":cy("common.close_notification"),children:h.jsx(re,{name:de.Times,className:"w-4 h-4"})})]})},su=({items:t,separator:e=h.jsx(re,{name:de.ChevronRight,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),showHome:n=!1,homeHref:r="/",maxItems:s,className:o="",id:i,editorAttrs:a})=>{let c=n?[{label:"Home",href:r},...t]:t,d=c,u=!1;if(s&&c.length>s){u=!0;const f=c.slice(0,1),g=c.slice(-(s-2));d=[...f,...g]}return h.jsx(Lo,{className:`flex items-center space-x-2 text-sm ${o}`,"aria-label":"Breadcrumb",id:i,...a,children:h.jsx(I,{className:"flex items-center space-x-2",children:d.map((f,g)=>{const m=g===d.length-1,p=g===0;return h.jsxs(v.Fragment,{children:[u&&p&&h.jsxs(h.Fragment,{children:[h.jsx(ou,{item:f,isLast:!1}),h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e}),h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"..."}),d.length>1&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e})]}),(!u||!p)&&h.jsxs(h.Fragment,{children:[h.jsx(ou,{item:f,isLast:m}),!m&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e})]})]},g)})})})},ou=({item:t,isLast:e})=>e||!t.href&&!t.onClick?h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white","aria-current":e?"page":void 0,children:t.label}):t.onClick?h.jsx(Lr,{href:"#",onClick:n=>{n.preventDefault(),t.onClick?.()},className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:t.label}):h.jsx(Lr,{href:t.href,className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:t.label}),gy=({title:t,description:e,iconName:n,illustrationSrc:r,illustrationAlt:s="Empty state illustration",actions:o=[],className:i="",id:a,editorAttrs:l})=>{const c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-gray-500"};return h.jsxs(I,{className:`flex flex-col items-center justify-center p-8 text-center ${i}`,role:"status","aria-live":"polite",id:a,...l,children:[r?h.jsx(yn,{src:r,alt:s,className:"w-48 h-48 mb-6 object-contain"}):n?h.jsx(I,{className:"mb-6 p-4 rounded-full bg-gray-100 dark:bg-gray-700",children:h.jsx(re,{name:n,className:"w-12 h-12 text-gray-400 dark:text-gray-500"})}):null,h.jsx(Qn,{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:t}),e&&h.jsx(bt,{className:"text-gray-600 dark:text-gray-400 mb-6 max-w-md",children:e}),o.length>0&&h.jsx(I,{className:"flex flex-wrap gap-3 justify-center",children:o.map((d,u)=>h.jsxs(oe,{onClick:d.onClick,className:` + `,role:"alert",children:[h.jsx(re,{name:o,className:`w-5 h-5 flex-shrink-0 ${s.text}`}),h.jsx(Q,{className:`flex-1 text-sm font-medium ${s.text}`,children:t.message}),h.jsx(oe,{onClick:r,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${s.text} focus:outline-none`,"aria-label":fy("common.close_notification"),children:h.jsx(re,{name:de.Times,className:"w-4 h-4"})})]})},ou=({items:t,separator:e=h.jsx(re,{name:de.ChevronRight,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),showHome:n=!1,homeHref:r="/",maxItems:s,className:o="",id:i,editorAttrs:a})=>{let c=n?[{label:"Home",href:r},...t]:t,d=c,u=!1;if(s&&c.length>s){u=!0;const f=c.slice(0,1),g=c.slice(-(s-2));d=[...f,...g]}return h.jsx(Lo,{className:`flex items-center space-x-2 text-sm ${o}`,"aria-label":"Breadcrumb",id:i,...a,children:h.jsx(I,{className:"flex items-center space-x-2",children:d.map((f,g)=>{const m=g===d.length-1,p=g===0;return h.jsxs(v.Fragment,{children:[u&&p&&h.jsxs(h.Fragment,{children:[h.jsx(iu,{item:f,isLast:!1}),h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e}),h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"..."}),d.length>1&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e})]}),(!u||!p)&&h.jsxs(h.Fragment,{children:[h.jsx(iu,{item:f,isLast:m}),!m&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e})]})]},g)})})})},iu=({item:t,isLast:e})=>e||!t.href&&!t.onClick?h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white","aria-current":e?"page":void 0,children:t.label}):t.onClick?h.jsx(Lr,{href:"#",onClick:n=>{n.preventDefault(),t.onClick?.()},className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:t.label}):h.jsx(Lr,{href:t.href,className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:t.label}),by=({title:t,description:e,iconName:n,illustrationSrc:r,illustrationAlt:s="Empty state illustration",actions:o=[],className:i="",id:a,editorAttrs:l})=>{const c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-gray-500"};return h.jsxs(I,{className:`flex flex-col items-center justify-center p-8 text-center ${i}`,role:"status","aria-live":"polite",id:a,...l,children:[r?h.jsx(yn,{src:r,alt:s,className:"w-48 h-48 mb-6 object-contain"}):n?h.jsx(I,{className:"mb-6 p-4 rounded-full bg-gray-100 dark:bg-gray-700",children:h.jsx(re,{name:n,className:"w-12 h-12 text-gray-400 dark:text-gray-500"})}):null,h.jsx(Qn,{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:t}),e&&h.jsx(bt,{className:"text-gray-600 dark:text-gray-400 mb-6 max-w-md",children:e}),o.length>0&&h.jsx(I,{className:"flex flex-wrap gap-3 justify-center",children:o.map((d,u)=>h.jsxs(oe,{onClick:d.onClick,className:` px-4 py-2 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${c[d.variant||"primary"]} - `,children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4 mr-2 inline-block"}),d.label]},u))})]})},py=(t,e)=>window.G7Core?.t?.(t,e)??t,my=({id:t,size:e="md",color:n="text-blue-600",fullscreen:r=!1,text:s,className:o="",editorAttrs:i})=>{const a={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-2",lg:"w-12 h-12 border-3",xl:"w-16 h-16 border-4"},l={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"},c=h.jsxs(I,{className:`flex flex-col items-center justify-center gap-3 ${o}`,children:[h.jsx(I,{className:` + `,children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4 mr-2 inline-block"}),d.label]},u))})]})},yy=(t,e)=>window.G7Core?.t?.(t,e)??t,vy=({id:t,size:e="md",color:n="text-blue-600",fullscreen:r=!1,text:s,className:o="",editorAttrs:i})=>{const a={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-2",lg:"w-12 h-12 border-3",xl:"w-16 h-16 border-4"},l={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"},c=h.jsxs(I,{className:`flex flex-col items-center justify-center gap-3 ${o}`,children:[h.jsx(I,{className:` ${a[e]} border-gray-200 dark:border-gray-700 border-t-current rounded-full animate-spin ${n} - `,role:"status","aria-label":py("common.loading")}),s&&h.jsx(Q,{className:`${l[e]} ${n} font-medium`,children:s})]});return r?h.jsx(I,{id:t,className:"fixed inset-0 z-50 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90","aria-live":"polite","aria-busy":"true",...i,children:c}):h.jsx(I,{id:t,className:"flex items-center justify-center p-4","aria-live":"polite","aria-busy":"true",...i,children:c})},zr=()=>window.G7Core,sl=(t,e)=>window.G7Core?.t?.(t,e)??t,by=({logo:t,logoAlt:e="Logo",menu:n=[],collapsed:r=!1,onToggleCollapse:s,className:o="",currentLocale:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(new Set),[u,f]=v.useState(i||zr()?.locale?.current?.()||"ko"),[g,m]=v.useState(window.location.pathname),p=v.useMemo(()=>{const w=[],M=O=>{for(const L of O)L.url&&w.push(L.url),L.children&&M(L.children)};return M(n),w},[n]),y=v.useCallback(w=>{let M=null;for(const O of p)(w===O||w.startsWith(O+"/"))&&(!M||O.length>M.length)&&(M=O);return M},[p]);v.useEffect(()=>{const w=zr();return w?.state?.subscribe?w.state.subscribe(O=>{const L=O?._global?.locale||w?.locale?.current?.()||"ko";f(L);const F=O?._global?.currentPath||window.location.pathname;m(F)}):void 0},[]),v.useEffect(()=>{const w=()=>{m(window.location.pathname)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]),v.useEffect(()=>{i&&f(i)},[i]);const b=(w,M)=>!w||typeof M!="string"?!1:M===w?!0:M.startsWith(w+"/")?y(M)===w:!1,S=(w,M)=>{const O=new Set,L=F=>{for(const $ of F)if($.children&&$.children.length>0){if(L($.children)||b($.url,M))return O.add($.id),!0}else if(b($.url,M))return!0;return!1};return L(w),O};v.useEffect(()=>{if(n.length>0&&g){const w=S(n,g);w.size>0&&d(M=>new Set([...M,...w]))}},[g,n]);const x=w=>b(w,g),E=w=>w.children?w.children.some(M=>x(M.url)||E(M)):!1,k=w=>{d(M=>{const O=new Set(M);return O.has(w)?O.delete(w):O.add(w),O})},C=w=>typeof w=="string"?w:w[u]||w.en||Object.values(w)[0]||"",N=(w,M)=>{zr()?.dispatch?(w.preventDefault(),zr().navigation?.onComplete(()=>{zr().dispatch({handler:"setState",params:{target:"global",sidebarOpen:!1}})}),zr().dispatch({handler:"navigate",params:{path:M}})):window.location.href=M},_=(w,M=0,O=!1)=>{const L=w.children&&w.children.length>0,F=c.has(w.id),$=C(w.name),D=M>0,A=x(w.url),T=E(w),z=D?"admin-sidebar-subitem":"admin-sidebar-item",H="admin-sidebar-item-active",W="admin-sidebar-item-active-parent",j="admin-sidebar-item-default";return h.jsxs(I,{className:D?"relative group":"",children:[D&&h.jsxs(h.Fragment,{children:[!O&&h.jsx(I,{className:"admin-sidebar-tree-line-vertical"}),h.jsx(I,{className:"admin-sidebar-tree-line-curve"})]}),L&&w.url?h.jsxs(I,{className:` + `,role:"status","aria-label":yy("common.loading")}),s&&h.jsx(Q,{className:`${l[e]} ${n} font-medium`,children:s})]});return r?h.jsx(I,{id:t,className:"fixed inset-0 z-50 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90","aria-live":"polite","aria-busy":"true",...i,children:c}):h.jsx(I,{id:t,className:"flex items-center justify-center p-4","aria-live":"polite","aria-busy":"true",...i,children:c})},zr=()=>window.G7Core,sl=(t,e)=>window.G7Core?.t?.(t,e)??t,xy=({logo:t,logoAlt:e="Logo",menu:n=[],collapsed:r=!1,onToggleCollapse:s,className:o="",currentLocale:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(new Set),[u,f]=v.useState(i||zr()?.locale?.current?.()||"ko"),[g,m]=v.useState(window.location.pathname),p=v.useMemo(()=>{const w=[],M=O=>{for(const L of O)L.url&&w.push(L.url),L.children&&M(L.children)};return M(n),w},[n]),y=v.useCallback(w=>{let M=null;for(const O of p)(w===O||w.startsWith(O+"/"))&&(!M||O.length>M.length)&&(M=O);return M},[p]);v.useEffect(()=>{const w=zr();return w?.state?.subscribe?w.state.subscribe(O=>{const L=O?._global?.locale||w?.locale?.current?.()||"ko";f(L);const F=O?._global?.currentPath||window.location.pathname;m(F)}):void 0},[]),v.useEffect(()=>{const w=()=>{m(window.location.pathname)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]),v.useEffect(()=>{i&&f(i)},[i]);const b=(w,M)=>!w||typeof M!="string"?!1:M===w?!0:M.startsWith(w+"/")?y(M)===w:!1,S=(w,M)=>{const O=new Set,L=F=>{for(const $ of F)if($.children&&$.children.length>0){if(L($.children)||b($.url,M))return O.add($.id),!0}else if(b($.url,M))return!0;return!1};return L(w),O};v.useEffect(()=>{if(n.length>0&&g){const w=S(n,g);w.size>0&&d(M=>new Set([...M,...w]))}},[g,n]);const x=w=>b(w,g),E=w=>w.children?w.children.some(M=>x(M.url)||E(M)):!1,k=w=>{d(M=>{const O=new Set(M);return O.has(w)?O.delete(w):O.add(w),O})},C=w=>typeof w=="string"?w:w[u]||w.en||Object.values(w)[0]||"",N=(w,M)=>{zr()?.dispatch?(w.preventDefault(),zr().navigation?.onComplete(()=>{zr().dispatch({handler:"setState",params:{target:"global",sidebarOpen:!1}})}),zr().dispatch({handler:"navigate",params:{path:M}})):window.location.href=M},_=(w,M=0,O=!1)=>{const L=w.children&&w.children.length>0,F=c.has(w.id),$=C(w.name),D=M>0,A=x(w.url),T=E(w),z=D?"admin-sidebar-subitem":"admin-sidebar-item",H="admin-sidebar-item-active",W="admin-sidebar-item-active-parent",j="admin-sidebar-item-default";return h.jsxs(I,{className:D?"relative group":"",children:[D&&h.jsxs(h.Fragment,{children:[!O&&h.jsx(I,{className:"admin-sidebar-tree-line-vertical"}),h.jsx(I,{className:"admin-sidebar-tree-line-curve"})]}),L&&w.url?h.jsxs(I,{className:` ${z} ${A?H:T?W:j} ${r?"justify-center":""} @@ -68,31 +68,31 @@ var SirsoftAdminBasic=(function(R,h,v,On){"use strict";var T5=Object.definePrope admin-sidebar-item-disabled ${r?"justify-center":""} text-left - `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(Q,{children:$})]}),!r&&w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}),L&&!r&&F&&h.jsx(I,{className:"relative ml-2",children:w.children.map((B,G)=>_(B,M+1,G===w.children.length-1))})]},w.id)};return h.jsxs(I,{className:o,id:a,...l,children:[(t||s)&&h.jsxs(I,{className:"admin-sidebar-header",children:[t&&!r&&h.jsx(yn,{src:t,alt:e,className:"h-8"}),s&&h.jsx(oe,{onClick:s,className:"admin-sidebar-collapse-btn","aria-label":sl(r?"common.expand_sidebar":"common.collapse_sidebar"),children:h.jsx(pt,{className:`${r?"fas fa-chevron-right":"fas fa-chevron-left"} w-5 h-5 text-slate-600 dark:text-slate-400`})})]}),h.jsx(I,{className:"admin-sidebar-menu-list",children:n.map((w,M)=>_(w,0,M===n.length-1))})]})},_s=(t,e)=>window.G7Core?.t?.(t,e)??t,yy=({user:t={name:"",email:""},notifications:e=[],onNotificationClick:n,onProfileClick:r,onLogoutClick:s,className:o=""})=>{const[i,a]=v.useState(!1),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),f=e.filter(g=>!g.read).length;return v.useEffect(()=>{const g=m=>{d.current&&!d.current.contains(m.target)&&a(!1),u.current&&!u.current.contains(m.target)&&c(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),h.jsxs(I,{className:` + `,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(Q,{children:$})]}),!r&&w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}),L&&!r&&F&&h.jsx(I,{className:"relative ml-2",children:w.children.map((B,G)=>_(B,M+1,G===w.children.length-1))})]},w.id)};return h.jsxs(I,{className:o,id:a,...l,children:[(t||s)&&h.jsxs(I,{className:"admin-sidebar-header",children:[t&&!r&&h.jsx(yn,{src:t,alt:e,className:"h-8"}),s&&h.jsx(oe,{onClick:s,className:"admin-sidebar-collapse-btn","aria-label":sl(r?"common.expand_sidebar":"common.collapse_sidebar"),children:h.jsx(pt,{className:`${r?"fas fa-chevron-right":"fas fa-chevron-left"} w-5 h-5 text-slate-600 dark:text-slate-400`})})]}),h.jsx(I,{className:"admin-sidebar-menu-list",children:n.map((w,M)=>_(w,0,M===n.length-1))})]})},_s=(t,e)=>window.G7Core?.t?.(t,e)??t,wy=({user:t={name:"",email:""},notifications:e=[],onNotificationClick:n,onProfileClick:r,onLogoutClick:s,className:o=""})=>{const[i,a]=v.useState(!1),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),f=e.filter(g=>!g.read).length;return v.useEffect(()=>{const g=m=>{d.current&&!d.current.contains(m.target)&&a(!1),u.current&&!u.current.contains(m.target)&&c(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),h.jsxs(I,{className:` bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4 flex items-center justify-end gap-4 ${o} `,children:[h.jsxs(I,{ref:d,className:"relative",children:[h.jsxs(oe,{onClick:()=>a(!i),className:"relative p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":_s("common.notifications"),children:[h.jsx(re,{name:de.Bell,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),f>0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:f>9?"9+":f})]}),i&&h.jsxs(I,{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsx(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:_s("common.notifications")})}),h.jsx(I,{className:"max-h-96 overflow-y-auto",children:e.length===0?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:_s("common.no_notifications")})}):e.map(g=>h.jsx(oe,{onClick:()=>{g.onClick?.(),n?.(g.id),a(!1)},className:` w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 transition-colors ${g.read?"":"bg-blue-50 dark:bg-blue-900/20"} - `,children:h.jsxs(I,{className:"flex items-start gap-3",children:[g.iconName&&h.jsx(re,{name:g.iconName,className:"w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5"}),h.jsxs(I,{className:"flex-1",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:g.title}),h.jsx(I,{className:"text-gray-600 dark:text-gray-400 text-sm mt-1",children:g.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1",children:g.time})]}),!g.read&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 rounded-full mt-1.5"})]})},g.id))})]})]}),h.jsxs(I,{ref:u,className:"relative",children:[h.jsxs(oe,{onClick:()=>c(!l),className:"flex items-center gap-3 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t.avatar?h.jsx(yn,{src:t.avatar,alt:t.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"hidden md:block text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:t.name}),t.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:t.role})]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]}),l&&h.jsxs(I,{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:t.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:t.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{r?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors text-gray-900 dark:text-white",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{children:_s("common.profile_settings")})]}),h.jsxs(oe,{onClick:()=>{s?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 text-red-600 dark:text-red-400 transition-colors",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:_s("common.logout")})]})]})]})]})]})},vy=({notifications:t=[],unreadCount:e=0,hasMore:n=!1,loading:r=!1,titleText:s="Notifications",emptyText:o="No notifications",markAllReadText:i="Mark all as read",deleteAllText:a="Delete all",unreadOnlyText:l="Unread only",unreadOnly:c=!1,onNotificationClick:d,onClose:u,onLoadMore:f,onMarkAllRead:g,onDeleteAll:m,onDelete:p,onUnreadOnlyToggle:y,dropdownAlign:b="right",className:S="",id:x,editorAttrs:E})=>{const[k,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),w=v.useRef(null),M=v.useRef(null),O=v.useRef(new Set),L=v.useRef(f),F=v.useRef(n),$=v.useRef(r),D=v.useRef(t.length),A=v.useRef(-1);v.useEffect(()=>{L.current=f,F.current=n,$.current=r,D.current=t.length}),v.useEffect(()=>{if(!M.current||!w.current||!k)return;A.current=-1;const W=new IntersectionObserver(([j])=>{j.isIntersecting&&($.current||!F.current||A.current!==D.current&&(A.current=D.current,L.current?.()))},{root:w.current,threshold:.1});return W.observe(M.current),()=>W.disconnect()},[k]),v.useEffect(()=>{if(!w.current||!k)return;const W=new IntersectionObserver(U=>{U.forEach(B=>{const G=B.target.getAttribute("data-notification-id"),V=B.target.getAttribute("data-unread")==="true";G&&V&&B.isIntersecting&&O.current.add(G)})},{root:w.current,threshold:.5});return w.current.querySelectorAll("[data-notification-id]").forEach(U=>W.observe(U)),()=>W.disconnect()},[k,t]);const T=e>0?e:t.filter(W=>!W.read).length,z=v.useCallback(()=>{if(k){if(T>0){const W=Array.from(O.current).filter(j=>{const U=t.find(B=>String(B.id)===String(j));return U&&!U.read});W.length>0&&u?.(W)}O.current.clear(),C(!1)}},[k,u,T,t]);v.useEffect(()=>{if(!k)return;const W=j=>{N.current&&!N.current.contains(j.target)&&z()};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[k,z]);const H=v.useCallback(()=>{k?z():C(!0)},[k,z]);return v.useLayoutEffect(()=>{const W=_.current;if(!k||!W)return;W.style.transform="";const j=W.getBoundingClientRect(),U=typeof window<"u"?window.innerWidth:0;if(j.width===0&&j.height===0)return;const B=8;let G=0;j.right>U-B?G=-(j.right-(U-B)):j.left0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:T>99?"99+":T})]}),k&&h.jsxs(I,{ref:_,className:`absolute ${b==="left"?"left-0":"right-0"} mt-2 w-80 max-w-[calc(100vw-1rem)] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[h.jsxs(I,{className:"flex items-center gap-3 min-w-0",children:[h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:s}),y&&h.jsxs(I,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>y(!c),children:[h.jsx(wt,{type:"checkbox",checked:c,onChange:W=>{W.stopPropagation(),y(W.target.checked)},onClick:W=>W.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400 cursor-pointer"}),h.jsx(Q,{className:"text-xs text-gray-600 dark:text-gray-400",children:l})]})]}),h.jsxs(I,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&T>0&&h.jsx(oe,{onClick:()=>{g(),O.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer",children:i}),m&&t.length>0&&h.jsx(oe,{onClick:()=>{m()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:a})]})]}),h.jsx(I,{ref:w,className:"max-h-96 overflow-y-auto",children:t.length===0&&!r?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:o})}):h.jsxs(h.Fragment,{children:[t.map(W=>{const j=!W.read;return h.jsxs(I,{"data-notification-id":W.id,"data-unread":j?"true":"false",onClick:()=>{W.onClick?.(),d?.(W),C(!1)},className:`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${j?"bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70"}`,children:[W.iconName&&h.jsx(re,{name:W.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${j?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`text-sm truncate ${j?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:W.title}),h.jsx(I,{className:`text-sm mt-1 line-clamp-2 ${j?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:W.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:W.time})]}),h.jsxs(I,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[j&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),p&&h.jsx(oe,{onClick:U=>{U.stopPropagation(),p(W)},className:"p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Delete notification",children:h.jsx(re,{name:de.Trash,className:"w-4 h-4"})})]})]},W.id)}),n&&h.jsx(I,{ref:M,className:"px-4 py-3 text-center",children:r?h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500"})}),r&&!n&&t.length>0&&h.jsx(I,{className:"px-4 py-2 text-center",children:h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},iu=window.G7Core?.createLogger?.("Comp:UserProfile")??{log:(...t)=>console.log("[Comp:UserProfile]",...t),warn:(...t)=>console.warn("[Comp:UserProfile]",...t),error:(...t)=>console.error("[Comp:UserProfile]",...t)},xy=({user:t={name:"",email:""},profileText:e="Profile Settings",logoutText:n="Logout",onProfileClick:r,onLogoutClick:s,className:o="",logoutEndpoint:i="/api/admin/auth/logout",redirectPath:a="/admin/login",showChevron:l=!0,dropdownDirection:c="up",dropdownOnly:d=!1,id:u,editorAttrs:f})=>{const[g,m]=v.useState(!1),[p,y]=v.useState(!1),b=v.useRef(null);v.useEffect(()=>{const k=C=>{b.current&&!b.current.contains(C.target)&&m(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]);const S=()=>{const C=`; ${document.cookie}`.split("; XSRF-TOKEN=");return C.length===2?decodeURIComponent(C.pop()?.split(";").shift()||""):null},x=()=>localStorage.getItem("auth_token"),E=async()=>{if(!p)try{if(y(!0),m(!1),s){s();return}const k=S(),C=x(),N=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...k&&{"X-XSRF-TOKEN":k},...C&&{Authorization:`Bearer ${C}`}},credentials:"include"});N.ok?(localStorage.removeItem("auth_token"),window.location.href=a):(iu.error("로그아웃 실패:",N.statusText),localStorage.removeItem("auth_token"),window.location.href=a)}catch(k){iu.error("로그아웃 오류:",k),localStorage.removeItem("auth_token"),window.location.href=a}finally{y(!1)}};return h.jsxs(I,{ref:b,className:d?`absolute inset-0 ${o}`:`relative ${o}`,id:u,...f,children:[h.jsx(oe,{onClick:()=>m(!g),className:d?"w-full h-full opacity-0 cursor-pointer":"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors w-full",children:!d&&h.jsxs(h.Fragment,{children:[t.avatar?h.jsx(yn,{src:t.avatar,alt:t.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"flex-1 text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:t.name}),t.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:t.role})]}),l&&h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]})}),g&&h.jsxs(I,{className:`absolute ${c==="down"?"top-full mt-2":"bottom-full mb-2"} ${d?"right-0 w-72":"left-0 w-full"} bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:()=>{m(!1),window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${t.uuid}`}})},children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:t.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:t.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{m(!1),r?r():window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${t.uuid}/edit`}})},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 transition-colors",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:e})]}),h.jsxs(oe,{onClick:E,disabled:p,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:p?"Logging out...":n})]})]})]})]})},Bo=window.G7Core?.createLogger?.("Comp:LanguageSelector")??{log:(...t)=>console.log("[Comp:LanguageSelector]",...t),warn:(...t)=>console.warn("[Comp:LanguageSelector]",...t),error:(...t)=>console.error("[Comp:LanguageSelector]",...t)},au=t=>{const e=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[t];return e||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[t]||t},wy=({availableLocales:t=["ko","en"],languageText:e="Language",apiEndpoint:n="/api/admin/users/me/language",onLanguageChange:r,className:s="",inline:o=!1,showCode:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(!1),[g,m]=v.useState(()=>localStorage.getItem("g7_locale")||"ko"),p=v.useRef(null);v.useEffect(()=>{if(o)return;const x=E=>{p.current&&!p.current.contains(E.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const y=()=>{const E=`; ${document.cookie}`.split("; XSRF-TOKEN=");return E.length===2?decodeURIComponent(E.pop()?.split(";").shift()||""):null},b=()=>localStorage.getItem("auth_token"),S=async x=>{if(!(u||x===g))try{f(!0);const E=y(),k=b();try{const C=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json",...E&&{"X-XSRF-TOKEN":E},...k&&{Authorization:`Bearer ${k}`}},credentials:"include",body:JSON.stringify({language:x})});C.ok||Bo.warn("언어 설정 저장 실패 (UI는 변경됨):",C.statusText)}catch(C){Bo.warn("언어 설정 API 호출 실패 (UI는 변경됨):",C)}m(x),d(!1),r?.(x),window.__templateApp?await window.__templateApp.changeLocale(x):(Bo.warn("TemplateApp not found, reloading page"),window.location.reload())}catch(E){Bo.error("언어 변경 오류:",E)}finally{f(!1)}};return o?h.jsxs(I,{className:`${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),disabled:u,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors",children:[h.jsx(re,{name:de.Globe,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:e}),h.jsx(Q,{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded",children:g.toUpperCase()}),h.jsx(re,{name:de.ChevronDown,className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${c?"rotate-180":""}`})]}),c&&h.jsx(I,{className:"px-4 py-2 flex flex-wrap gap-2",children:t.map(x=>h.jsx(oe,{onClick:()=>S(x),disabled:u,className:` + `,children:h.jsxs(I,{className:"flex items-start gap-3",children:[g.iconName&&h.jsx(re,{name:g.iconName,className:"w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5"}),h.jsxs(I,{className:"flex-1",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:g.title}),h.jsx(I,{className:"text-gray-600 dark:text-gray-400 text-sm mt-1",children:g.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1",children:g.time})]}),!g.read&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 rounded-full mt-1.5"})]})},g.id))})]})]}),h.jsxs(I,{ref:u,className:"relative",children:[h.jsxs(oe,{onClick:()=>c(!l),className:"flex items-center gap-3 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t.avatar?h.jsx(yn,{src:t.avatar,alt:t.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"hidden md:block text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:t.name}),t.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:t.role})]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]}),l&&h.jsxs(I,{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:t.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:t.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{r?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors text-gray-900 dark:text-white",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{children:_s("common.profile_settings")})]}),h.jsxs(oe,{onClick:()=>{s?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 text-red-600 dark:text-red-400 transition-colors",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:_s("common.logout")})]})]})]})]})]})},ky=({notifications:t=[],unreadCount:e=0,hasMore:n=!1,loading:r=!1,titleText:s="Notifications",emptyText:o="No notifications",markAllReadText:i="Mark all as read",deleteAllText:a="Delete all",unreadOnlyText:l="Unread only",unreadOnly:c=!1,onNotificationClick:d,onClose:u,onLoadMore:f,onMarkAllRead:g,onDeleteAll:m,onDelete:p,onUnreadOnlyToggle:y,dropdownAlign:b="right",className:S="",id:x,editorAttrs:E})=>{const[k,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),w=v.useRef(null),M=v.useRef(null),O=v.useRef(new Set),L=v.useRef(f),F=v.useRef(n),$=v.useRef(r),D=v.useRef(t.length),A=v.useRef(-1);v.useEffect(()=>{L.current=f,F.current=n,$.current=r,D.current=t.length}),v.useEffect(()=>{if(!M.current||!w.current||!k)return;A.current=-1;const W=new IntersectionObserver(([j])=>{j.isIntersecting&&($.current||!F.current||A.current!==D.current&&(A.current=D.current,L.current?.()))},{root:w.current,threshold:.1});return W.observe(M.current),()=>W.disconnect()},[k]),v.useEffect(()=>{if(!w.current||!k)return;const W=new IntersectionObserver(U=>{U.forEach(B=>{const G=B.target.getAttribute("data-notification-id"),V=B.target.getAttribute("data-unread")==="true";G&&V&&B.isIntersecting&&O.current.add(G)})},{root:w.current,threshold:.5});return w.current.querySelectorAll("[data-notification-id]").forEach(U=>W.observe(U)),()=>W.disconnect()},[k,t]);const T=e>0?e:t.filter(W=>!W.read).length,z=v.useCallback(()=>{if(k){if(T>0){const W=Array.from(O.current).filter(j=>{const U=t.find(B=>String(B.id)===String(j));return U&&!U.read});W.length>0&&u?.(W)}O.current.clear(),C(!1)}},[k,u,T,t]);v.useEffect(()=>{if(!k)return;const W=j=>{N.current&&!N.current.contains(j.target)&&z()};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[k,z]);const H=v.useCallback(()=>{k?z():C(!0)},[k,z]);return v.useLayoutEffect(()=>{const W=_.current;if(!k||!W)return;W.style.transform="";const j=W.getBoundingClientRect(),U=typeof window<"u"?window.innerWidth:0;if(j.width===0&&j.height===0)return;const B=8;let G=0;j.right>U-B?G=-(j.right-(U-B)):j.left0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:T>99?"99+":T})]}),k&&h.jsxs(I,{ref:_,className:`absolute ${b==="left"?"left-0":"right-0"} mt-2 w-80 max-w-[calc(100vw-1rem)] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[h.jsxs(I,{className:"flex items-center gap-3 min-w-0",children:[h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:s}),y&&h.jsxs(I,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>y(!c),children:[h.jsx(wt,{type:"checkbox",checked:c,onChange:W=>{W.stopPropagation(),y(W.target.checked)},onClick:W=>W.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400 cursor-pointer"}),h.jsx(Q,{className:"text-xs text-gray-600 dark:text-gray-400",children:l})]})]}),h.jsxs(I,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&T>0&&h.jsx(oe,{onClick:()=>{g(),O.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer",children:i}),m&&t.length>0&&h.jsx(oe,{onClick:()=>{m()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:a})]})]}),h.jsx(I,{ref:w,className:"max-h-96 overflow-y-auto",children:t.length===0&&!r?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:o})}):h.jsxs(h.Fragment,{children:[t.map(W=>{const j=!W.read;return h.jsxs(I,{"data-notification-id":W.id,"data-unread":j?"true":"false",onClick:()=>{W.onClick?.(),d?.(W),C(!1)},className:`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${j?"bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70"}`,children:[W.iconName&&h.jsx(re,{name:W.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${j?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`text-sm truncate ${j?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:W.title}),h.jsx(I,{className:`text-sm mt-1 line-clamp-2 ${j?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:W.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:W.time})]}),h.jsxs(I,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[j&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),p&&h.jsx(oe,{onClick:U=>{U.stopPropagation(),p(W)},className:"p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Delete notification",children:h.jsx(re,{name:de.Trash,className:"w-4 h-4"})})]})]},W.id)}),n&&h.jsx(I,{ref:M,className:"px-4 py-3 text-center",children:r?h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500"})}),r&&!n&&t.length>0&&h.jsx(I,{className:"px-4 py-2 text-center",children:h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},au=window.G7Core?.createLogger?.("Comp:UserProfile")??{log:(...t)=>console.log("[Comp:UserProfile]",...t),warn:(...t)=>console.warn("[Comp:UserProfile]",...t),error:(...t)=>console.error("[Comp:UserProfile]",...t)},Cy=({user:t={name:"",email:""},profileText:e="Profile Settings",logoutText:n="Logout",onProfileClick:r,onLogoutClick:s,className:o="",logoutEndpoint:i="/api/admin/auth/logout",redirectPath:a="/admin/login",showChevron:l=!0,dropdownDirection:c="up",dropdownOnly:d=!1,id:u,editorAttrs:f})=>{const[g,m]=v.useState(!1),[p,y]=v.useState(!1),b=v.useRef(null);v.useEffect(()=>{const k=C=>{b.current&&!b.current.contains(C.target)&&m(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]);const S=()=>{const C=`; ${document.cookie}`.split("; XSRF-TOKEN=");return C.length===2?decodeURIComponent(C.pop()?.split(";").shift()||""):null},x=()=>localStorage.getItem("auth_token"),E=async()=>{if(!p)try{if(y(!0),m(!1),s){s();return}const k=S(),C=x(),N=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...k&&{"X-XSRF-TOKEN":k},...C&&{Authorization:`Bearer ${C}`}},credentials:"include"});N.ok?(localStorage.removeItem("auth_token"),window.location.href=a):(au.error("로그아웃 실패:",N.statusText),localStorage.removeItem("auth_token"),window.location.href=a)}catch(k){au.error("로그아웃 오류:",k),localStorage.removeItem("auth_token"),window.location.href=a}finally{y(!1)}};return h.jsxs(I,{ref:b,className:d?`absolute inset-0 ${o}`:`relative ${o}`,id:u,...f,children:[h.jsx(oe,{onClick:()=>m(!g),className:d?"w-full h-full opacity-0 cursor-pointer":"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors w-full",children:!d&&h.jsxs(h.Fragment,{children:[t.avatar?h.jsx(yn,{src:t.avatar,alt:t.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"flex-1 text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:t.name}),t.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:t.role})]}),l&&h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]})}),g&&h.jsxs(I,{className:`absolute ${c==="down"?"top-full mt-2":"bottom-full mb-2"} ${d?"right-0 w-72":"left-0 w-full"} bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:()=>{m(!1),window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${t.uuid}`}})},children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:t.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:t.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{m(!1),r?r():window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${t.uuid}/edit`}})},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 transition-colors",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:e})]}),h.jsxs(oe,{onClick:E,disabled:p,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:p?"Logging out...":n})]})]})]})]})},Bo=window.G7Core?.createLogger?.("Comp:LanguageSelector")??{log:(...t)=>console.log("[Comp:LanguageSelector]",...t),warn:(...t)=>console.warn("[Comp:LanguageSelector]",...t),error:(...t)=>console.error("[Comp:LanguageSelector]",...t)},lu=t=>{const e=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[t];return e||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[t]||t},Sy=({availableLocales:t=["ko","en"],languageText:e="Language",apiEndpoint:n="/api/admin/users/me/language",onLanguageChange:r,className:s="",inline:o=!1,showCode:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(!1),[g,m]=v.useState(()=>localStorage.getItem("g7_locale")||"ko"),p=v.useRef(null);v.useEffect(()=>{if(o)return;const x=E=>{p.current&&!p.current.contains(E.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const y=()=>{const E=`; ${document.cookie}`.split("; XSRF-TOKEN=");return E.length===2?decodeURIComponent(E.pop()?.split(";").shift()||""):null},b=()=>localStorage.getItem("auth_token"),S=async x=>{if(!(u||x===g))try{f(!0);const E=y(),k=b();try{const C=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json",...E&&{"X-XSRF-TOKEN":E},...k&&{Authorization:`Bearer ${k}`}},credentials:"include",body:JSON.stringify({language:x})});C.ok||Bo.warn("언어 설정 저장 실패 (UI는 변경됨):",C.statusText)}catch(C){Bo.warn("언어 설정 API 호출 실패 (UI는 변경됨):",C)}m(x),d(!1),r?.(x),window.__templateApp?await window.__templateApp.changeLocale(x):(Bo.warn("TemplateApp not found, reloading page"),window.location.reload())}catch(E){Bo.error("언어 변경 오류:",E)}finally{f(!1)}};return o?h.jsxs(I,{className:`${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),disabled:u,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors",children:[h.jsx(re,{name:de.Globe,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:e}),h.jsx(Q,{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded",children:g.toUpperCase()}),h.jsx(re,{name:de.ChevronDown,className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${c?"rotate-180":""}`})]}),c&&h.jsx(I,{className:"px-4 py-2 flex flex-wrap gap-2",children:t.map(x=>h.jsx(oe,{onClick:()=>S(x),disabled:u,className:` px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${g===x?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} ${u?"opacity-50 cursor-not-allowed":""} - `,children:au(x)},x))})]}):h.jsxs(I,{ref:p,className:`relative ${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:i?"flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors cursor-pointer":"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors","aria-haspopup":"listbox","aria-expanded":c,"aria-label":e,children:[h.jsx(re,{name:de.Globe,className:i?"w-4 h-4":"w-5 h-5 text-gray-600 dark:text-gray-400"}),i&&h.jsx(Q,{className:"font-medium uppercase",children:g}),i&&h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3"})]}),c&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsx(I,{className:"py-2",children:t.map(x=>h.jsxs(oe,{onClick:()=>S(x),disabled:u,className:` + `,children:lu(x)},x))})]}):h.jsxs(I,{ref:p,className:`relative ${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:i?"flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors cursor-pointer":"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors","aria-haspopup":"listbox","aria-expanded":c,"aria-label":e,children:[h.jsx(re,{name:de.Globe,className:i?"w-4 h-4":"w-5 h-5 text-gray-600 dark:text-gray-400"}),i&&h.jsx(Q,{className:"font-medium uppercase",children:g}),i&&h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3"})]}),c&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsx(I,{className:"py-2",children:t.map(x=>h.jsxs(oe,{onClick:()=>S(x),disabled:u,className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${g===x?"bg-gray-50 dark:bg-gray-700":""} ${u?"opacity-50 cursor-not-allowed":""} - `,children:[h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:au(x)}),g===x&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]},x))})})]})},ky=({copyright:t="© 2026 G7",version:e,quickLinks:n=[],className:r="",changelogModalId:s,copyrightModalId:o,id:i,editorAttrs:a})=>{const l=v.useCallback(()=>{s&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/changelog",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreChangelogContent:"{{response.data.content}}"}},{handler:"openModal",target:s}],onError:[{handler:"openModal",target:s}]}]})},[s]),c=v.useCallback(()=>{o&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/license",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreLicenseContent:"{{response.data.content}}"}},{handler:"openModal",target:o}],onError:[{handler:"openModal",target:o}]}]})},[o]);return h.jsx(I,{className:`admin-footer ${r}`,id:i,...a,children:h.jsxs(I,{className:"admin-footer-row",children:[h.jsxs(I,{className:"admin-footer-group",children:[h.jsx(Q,{className:o?"admin-footer-link-hover":"",onClick:o?c:void 0,children:t}),e&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:"•"}),h.jsxs(Q,{className:`flex-center gap-2 ${s?"admin-footer-link-hover":""}`,onClick:s?l:void 0,children:[h.jsx(re,{name:de.Tag,className:"w-4 h-4"}),h.jsxs(Q,{children:["v",e]})]})]})]}),n.length>0&&h.jsx(I,{className:"flex-center gap-4",children:n.map(d=>h.jsxs(Lr,{href:d.url,className:"admin-footer-link",children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:d.label})]},d.id))})]})})},Cy=({title:t,description:e,breadcrumbItems:n,tabs:r,onTabChange:s,actions:o,className:i="",children:a,id:l,editorAttrs:c})=>{const d=(u="secondary")=>({primary:"page-action-primary",secondary:"page-action-secondary",danger:"page-action-danger",ghost:"page-action-ghost"})[u];return h.jsxs(I,{className:i,id:l,...c,children:[n&&n.length>0&&h.jsx(I,{className:"mb-md",children:h.jsx(su,{items:n})}),h.jsxs(I,{className:"flex-between mb-lg",children:[h.jsxs(I,{children:[h.jsx(Aa,{className:"page-title",children:t}),e&&h.jsx(bt,{className:"page-description",children:e})]}),a?h.jsx(I,{className:"flex-center page-actions",children:a}):o&&o.length>0?h.jsx(I,{className:"page-actions",children:o.map(u=>h.jsxs(oe,{onClick:u.onClick,disabled:u.disabled,className:d(u.variant),children:[u.iconName&&h.jsx(re,{name:u.iconName,className:"icon-md"}),u.variant!=="ghost"&&u.label&&h.jsx(I,{children:u.label})]},u.id))}):null]}),r&&r.length>0&&h.jsx(I,{className:"tab-container",children:r.map(u=>h.jsxs(oe,{onClick:()=>s?.(u.value),className:u.active?"tab-btn-active":"tab-btn",children:[h.jsx(I,{children:u.label}),u.badge!==void 0&&h.jsx(I,{className:u.active?"tab-badge-active":"tab-badge",children:u.badge})]},u.id))})]})},Sy=()=>window.G7Core,_y=({title:t,description:e,className:n="",style:r,children:s,id:o,editorAttrs:i})=>{const a="flex items-center justify-between",l=Sy()?.style?.mergeClasses?.(a,n)??`${a} ${n}`;return h.jsxs(I,{className:l,style:r,id:o,...i,children:[h.jsxs(I,{children:[t&&h.jsx(Qn,{className:"text-base font-semibold text-gray-900 dark:text-white",children:t}),e&&h.jsx(bt,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:e})]}),s&&h.jsx(I,{className:"flex items-center gap-2",children:s})]})},Rn=(t,e)=>window.G7Core?.t?.(t,e)??t,Ey=({image:t,imageAlt:e,vendor:n,name:r,version:s,status:o,updateAvailable:i=!1,latestVersion:a,dependencies:l=[],showLayoutEditButton:c=!1,actions:d=[],onLayoutEditClick:u,className:f="",id:g,editorAttrs:m})=>{const p=b=>({active:"success",inactive:"default",pending:"pending",error:"error"})[b],y=b=>({active:Rn("common.status_active"),inactive:Rn("common.status_inactive"),pending:Rn("common.status_pending"),error:Rn("common.status_error")})[b];return h.jsxs(I,{className:` + `,children:[h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:lu(x)}),g===x&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]},x))})})]})},_y=({copyright:t="© 2026 G7",version:e,quickLinks:n=[],className:r="",changelogModalId:s,copyrightModalId:o,id:i,editorAttrs:a})=>{const l=v.useCallback(()=>{s&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/changelog",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreChangelogContent:"{{response.data.content}}"}},{handler:"openModal",target:s}],onError:[{handler:"openModal",target:s}]}]})},[s]),c=v.useCallback(()=>{o&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/license",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreLicenseContent:"{{response.data.content}}"}},{handler:"openModal",target:o}],onError:[{handler:"openModal",target:o}]}]})},[o]);return h.jsx(I,{className:`admin-footer ${r}`,id:i,...a,children:h.jsxs(I,{className:"admin-footer-row",children:[h.jsxs(I,{className:"admin-footer-group",children:[h.jsx(Q,{className:o?"admin-footer-link-hover":"",onClick:o?c:void 0,children:t}),e&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:"•"}),h.jsxs(Q,{className:`flex-center gap-2 ${s?"admin-footer-link-hover":""}`,onClick:s?l:void 0,children:[h.jsx(re,{name:de.Tag,className:"w-4 h-4"}),h.jsxs(Q,{children:["v",e]})]})]})]}),n.length>0&&h.jsx(I,{className:"flex-center gap-4",children:n.map(d=>h.jsxs(Lr,{href:d.url,className:"admin-footer-link",children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:d.label})]},d.id))})]})})},Ey=({title:t,description:e,breadcrumbItems:n,tabs:r,onTabChange:s,actions:o,className:i="",children:a,id:l,editorAttrs:c})=>{const d=(u="secondary")=>({primary:"page-action-primary",secondary:"page-action-secondary",danger:"page-action-danger",ghost:"page-action-ghost"})[u];return h.jsxs(I,{className:i,id:l,...c,children:[n&&n.length>0&&h.jsx(I,{className:"mb-md",children:h.jsx(ou,{items:n})}),h.jsxs(I,{className:"flex-between mb-lg",children:[h.jsxs(I,{children:[h.jsx(Aa,{className:"page-title",children:t}),e&&h.jsx(bt,{className:"page-description",children:e})]}),a?h.jsx(I,{className:"flex-center page-actions",children:a}):o&&o.length>0?h.jsx(I,{className:"page-actions",children:o.map(u=>h.jsxs(oe,{onClick:u.onClick,disabled:u.disabled,className:d(u.variant),children:[u.iconName&&h.jsx(re,{name:u.iconName,className:"icon-md"}),u.variant!=="ghost"&&u.label&&h.jsx(I,{children:u.label})]},u.id))}):null]}),r&&r.length>0&&h.jsx(I,{className:"tab-container",children:r.map(u=>h.jsxs(oe,{onClick:()=>s?.(u.value),className:u.active?"tab-btn-active":"tab-btn",children:[h.jsx(I,{children:u.label}),u.badge!==void 0&&h.jsx(I,{className:u.active?"tab-badge-active":"tab-badge",children:u.badge})]},u.id))})]})},My=()=>window.G7Core,Ny=({title:t,description:e,className:n="",style:r,children:s,id:o,editorAttrs:i})=>{const a="flex items-center justify-between",l=My()?.style?.mergeClasses?.(a,n)??`${a} ${n}`;return h.jsxs(I,{className:l,style:r,id:o,...i,children:[h.jsxs(I,{children:[t&&h.jsx(Qn,{className:"text-base font-semibold text-gray-900 dark:text-white",children:t}),e&&h.jsx(bt,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:e})]}),s&&h.jsx(I,{className:"flex items-center gap-2",children:s})]})},Rn=(t,e)=>window.G7Core?.t?.(t,e)??t,Oy=({image:t,imageAlt:e,vendor:n,name:r,version:s,status:o,updateAvailable:i=!1,latestVersion:a,dependencies:l=[],showLayoutEditButton:c=!1,actions:d=[],onLayoutEditClick:u,className:f="",id:g,editorAttrs:m})=>{const p=b=>({active:"success",inactive:"default",pending:"pending",error:"error"})[b],y=b=>({active:Rn("common.status_active"),inactive:Rn("common.status_inactive"),pending:Rn("common.status_pending"),error:Rn("common.status_error")})[b];return h.jsxs(I,{className:` bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden hover:shadow-lg transition-shadow ${f} - `,id:g,...m,children:[t&&h.jsxs(I,{className:"relative",children:[h.jsx(yn,{src:t,alt:e||Rn("common.template_preview",{vendor:n,name:r}),className:"w-full h-48 object-cover"}),h.jsx(I,{className:"absolute top-3 right-3",children:h.jsx($o,{status:p(o),label:y(o),showIcon:!0})}),i&&h.jsx(I,{className:"absolute top-3 left-3",children:h.jsxs(Q,{className:"flex items-center gap-1 px-2 py-1 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 rounded-md text-xs font-semibold",children:[h.jsx(re,{name:de.ExclamationTriangle,className:"w-3 h-3"}),h.jsx(Q,{children:Rn("common.update_available")})]})})]}),h.jsxs(I,{className:"p-4",children:[h.jsxs(I,{className:"flex items-start justify-between mb-3",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Ir,{className:"text-lg font-bold text-gray-900 dark:text-white",children:[n,"/",r]}),h.jsxs(I,{className:"flex items-center gap-2 mt-1 text-sm text-gray-600 dark:text-gray-400",children:[h.jsxs(Q,{children:["v",s]}),i&&a&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{children:"→"}),h.jsxs(Q,{className:"text-yellow-600 dark:text-yellow-400 font-semibold",children:["v",a]})]})]}),!t&&h.jsx(I,{className:"mt-2",children:h.jsx($o,{status:p(o),label:y(o),showIcon:!0})})]}),d.length>0&&h.jsx(bs,{items:d,triggerIconName:de.EllipsisVertical,position:"left"})]}),l.length>0&&h.jsxs(I,{className:"mb-3",children:[h.jsxs(bt,{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[Rn("common.dependencies"),":"]}),h.jsx(I,{className:"flex flex-wrap gap-1",children:l.map((b,S)=>h.jsx(Q,{className:"px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:b},S))})]}),c&&u&&h.jsxs(oe,{onClick:u,className:"w-full px-4 py-2 bg-blue-600 dark:bg-blue-500 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-600 transition-colors flex items-center justify-center gap-2 font-medium",children:[h.jsx(re,{name:de.Edit,className:"w-4 h-4"}),h.jsx(Q,{children:Rn("common.edit_layout")})]})]})]})},lu=({type:t,message:e,dismissible:n=!1,onDismiss:r,className:s="",id:o,editorAttrs:i})=>{const a={info:{containerClass:"alert-info",iconClass:"alert-icon-info",textClass:"alert-text-info",icon:de.InfoCircle},success:{containerClass:"alert-success",iconClass:"alert-icon-success",textClass:"alert-text-success",icon:de.CheckCircle},warning:{containerClass:"alert-warning",iconClass:"alert-icon-warning",textClass:"alert-text-warning",icon:de.ExclamationTriangle},error:{containerClass:"alert-error",iconClass:"alert-icon-error",textClass:"alert-text-error",icon:de.TimesCircle}},l=a[t]??a.info;return h.jsxs(I,{className:`${l.containerClass} ${s}`,role:"alert","aria-live":"polite",id:o,...i,children:[h.jsx(re,{name:l.icon,className:l.iconClass,ariaLabel:`${t} icon`}),h.jsx(bt,{className:l.textClass,children:e}),n&&h.jsx(oe,{onClick:r,className:`alert-dismiss ${l.textClass}`,"aria-label":"Close alert",children:h.jsx(re,{name:de.Times,className:l.iconClass,ariaLabel:"Close"})})]})},My=({layoutName:t,onBack:e,onPreview:n,onSave:r,isSaving:s=!1,className:o=""})=>{const i=` + `,id:g,...m,children:[t&&h.jsxs(I,{className:"relative",children:[h.jsx(yn,{src:t,alt:e||Rn("common.template_preview",{vendor:n,name:r}),className:"w-full h-48 object-cover"}),h.jsx(I,{className:"absolute top-3 right-3",children:h.jsx($o,{status:p(o),label:y(o),showIcon:!0})}),i&&h.jsx(I,{className:"absolute top-3 left-3",children:h.jsxs(Q,{className:"flex items-center gap-1 px-2 py-1 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 rounded-md text-xs font-semibold",children:[h.jsx(re,{name:de.ExclamationTriangle,className:"w-3 h-3"}),h.jsx(Q,{children:Rn("common.update_available")})]})})]}),h.jsxs(I,{className:"p-4",children:[h.jsxs(I,{className:"flex items-start justify-between mb-3",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Ir,{className:"text-lg font-bold text-gray-900 dark:text-white",children:[n,"/",r]}),h.jsxs(I,{className:"flex items-center gap-2 mt-1 text-sm text-gray-600 dark:text-gray-400",children:[h.jsxs(Q,{children:["v",s]}),i&&a&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{children:"→"}),h.jsxs(Q,{className:"text-yellow-600 dark:text-yellow-400 font-semibold",children:["v",a]})]})]}),!t&&h.jsx(I,{className:"mt-2",children:h.jsx($o,{status:p(o),label:y(o),showIcon:!0})})]}),d.length>0&&h.jsx(bs,{items:d,triggerIconName:de.EllipsisVertical,position:"left"})]}),l.length>0&&h.jsxs(I,{className:"mb-3",children:[h.jsxs(bt,{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[Rn("common.dependencies"),":"]}),h.jsx(I,{className:"flex flex-wrap gap-1",children:l.map((b,S)=>h.jsx(Q,{className:"px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:b},S))})]}),c&&u&&h.jsxs(oe,{onClick:u,className:"w-full px-4 py-2 bg-blue-600 dark:bg-blue-500 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-600 transition-colors flex items-center justify-center gap-2 font-medium",children:[h.jsx(re,{name:de.Edit,className:"w-4 h-4"}),h.jsx(Q,{children:Rn("common.edit_layout")})]})]})]})},cu=({type:t,message:e,dismissible:n=!1,onDismiss:r,className:s="",id:o,editorAttrs:i})=>{const a={info:{containerClass:"alert-info",iconClass:"alert-icon-info",textClass:"alert-text-info",icon:de.InfoCircle},success:{containerClass:"alert-success",iconClass:"alert-icon-success",textClass:"alert-text-success",icon:de.CheckCircle},warning:{containerClass:"alert-warning",iconClass:"alert-icon-warning",textClass:"alert-text-warning",icon:de.ExclamationTriangle},error:{containerClass:"alert-error",iconClass:"alert-icon-error",textClass:"alert-text-error",icon:de.TimesCircle}},l=a[t]??a.info;return h.jsxs(I,{className:`${l.containerClass} ${s}`,role:"alert","aria-live":"polite",id:o,...i,children:[h.jsx(re,{name:l.icon,className:l.iconClass,ariaLabel:`${t} icon`}),h.jsx(bt,{className:l.textClass,children:e}),n&&h.jsx(oe,{onClick:r,className:`alert-dismiss ${l.textClass}`,"aria-label":"Close alert",children:h.jsx(re,{name:de.Times,className:l.iconClass,ariaLabel:"Close"})})]})},Ty=({layoutName:t,onBack:e,onPreview:n,onSave:r,isSaving:s=!1,className:o=""})=>{const i=` flex items-center justify-between gap-4 p-4 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${o} `.trim().replace(/\s+/g," ");return h.jsxs(I,{className:i,children:[h.jsxs(I,{className:"flex items-center gap-3",children:[h.jsx(oe,{onClick:e,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors bg-transparent border-0 cursor-pointer","aria-label":"뒤로가기",children:h.jsx(re,{name:de.ArrowLeft,className:"text-gray-700 dark:text-gray-300",ariaLabel:"뒤로가기"})}),h.jsx(Qn,{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t})]}),h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(oe,{onClick:n,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors border-0 cursor-pointer","aria-label":"미리보기",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Eye,className:"text-gray-700 dark:text-gray-300",ariaLabel:"미리보기 아이콘"}),h.jsx("span",{children:"미리보기"})]})}),h.jsx(oe,{onClick:r,disabled:s,className:` px-4 py-2 rounded-lg transition-colors border-0 cursor-pointer ${s?"bg-blue-400 dark:bg-blue-600 cursor-not-allowed":"bg-blue-600 dark:bg-blue-500 hover:bg-blue-700 dark:hover:bg-blue-600"} text-white - `.trim().replace(/\s+/g," "),"aria-label":s?"저장 중...":"저장",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:s?de.Spinner:de.Save,className:`text-white ${s?"animate-spin":""}`,ariaLabel:s?"저장 중 아이콘":"저장 아이콘"}),h.jsx("span",{children:s?"저장 중...":"저장"})]})})]})]})},Ny=({files:t,selectedId:e,onSelect:n,className:r=""})=>{const s=a=>{try{const l=new Date(a);if(isNaN(l.getTime()))return a;const c=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0"),f=String(l.getHours()).padStart(2,"0"),g=String(l.getMinutes()).padStart(2,"0");return`${c}-${d}-${u} ${f}:${g}`}catch{return a}},o=a=>{n(a)},i=` + `.trim().replace(/\s+/g," "),"aria-label":s?"저장 중...":"저장",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:s?de.Spinner:de.Save,className:`text-white ${s?"animate-spin":""}`,ariaLabel:s?"저장 중 아이콘":"저장 아이콘"}),h.jsx("span",{children:s?"저장 중...":"저장"})]})})]})]})},Ay=({files:t,selectedId:e,onSelect:n,className:r=""})=>{const s=a=>{try{const l=new Date(a);if(isNaN(l.getTime()))return a;const c=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0"),f=String(l.getHours()).padStart(2,"0"),g=String(l.getMinutes()).padStart(2,"0");return`${c}-${d}-${u} ${f}:${g}`}catch{return a}},o=a=>{n(a)},i=` w-full ${r} `.trim().replace(/\s+/g," ");return h.jsx(I,{className:i,children:t.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"파일이 없습니다."}):h.jsx(Da,{className:"divide-y divide-gray-200 dark:divide-gray-700",role:"listbox","aria-label":"레이아웃 파일 목록",children:t.map(a=>{const l=a.id===e,c=` @@ -105,8 +105,8 @@ var SirsoftAdminBasic=(function(R,h,v,On){"use strict";var T5=Object.definePrope `.trim().replace(/\s+/g," "),u=` text-sm ${l?"text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400"} - `.trim().replace(/\s+/g," ");return h.jsx(Ia,{className:c,onClick:()=>o(a.id),role:"option","aria-selected":l,tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(a.id))},children:h.jsxs(I,{className:"flex flex-col gap-1",children:[h.jsx(Q,{className:d,children:a.name}),h.jsx(Q,{className:u,children:s(a.updated_at)})]})},a.id)})})})};function cu(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?t.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};Wo.initial(t),Wo.handler(e);var n={current:t},r=Es(Jy)(n,e),s=Es(Qy)(n),o=Es(Wo.changes)(t),i=Es(Zy)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Wo.selector(c),c(n.current)}function l(c){Hy(r,s,o,i)(c)}return[a,l]}function Zy(t,e){return Ms(e)?e(t.current):e}function Qy(t,e){return t.current=hu(hu({},t.current),e),e}function Jy(t,e,n){return Ms(e)?e(t.current):Object.keys(n).forEach(function(r){var s;return(s=e[r])===null||s===void 0?void 0:s.call(e,t.current[r])}),n}var Ry={create:qy},ev={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function tv(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o=t.length?t.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;lo(a.id),role:"option","aria-selected":l,tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(a.id))},children:h.jsxs(I,{className:"flex flex-col gap-1",children:[h.jsx(Q,{className:d,children:a.name}),h.jsx(Q,{className:u,children:s(a.updated_at)})]})},a.id)})})})};function du(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?t.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};Wo.initial(t),Wo.handler(e);var n={current:t},r=Es(tv)(n,e),s=Es(ev)(n),o=Es(Wo.changes)(t),i=Es(Ry)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Wo.selector(c),c(n.current)}function l(c){jy(r,s,o,i)(c)}return[a,l]}function Ry(t,e){return Ms(e)?e(t.current):e}function ev(t,e){return t.current=gu(gu({},t.current),e),e}function tv(t,e,n){return Ms(e)?e(t.current):Object.keys(n).forEach(function(r){var s;return(s=e[r])===null||s===void 0?void 0:s.call(e,t.current[r])}),n}var nv={create:Jy},rv={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function sv(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o=t.length?t.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l{r.current=!1}:t,e)}var sn=Mv;function Os(){}function Vr(t,e,n,r){return Nv(t,r)||Ov(t,e,n,r)}function Nv(t,e){return t.editor.getModel(ku(t,e))}function Ov(t,e,n,r){return t.editor.createModel(e,n,r?ku(t,r):void 0)}function ku(t,e){return t.Uri.parse(e)}function Tv({original:t,modified:e,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:f="100%",width:g="100%",className:m,wrapperProps:p={},beforeMount:y=Os,onMount:b=Os}){let[S,x]=v.useState(!1),[E,k]=v.useState(!0),C=v.useRef(null),N=v.useRef(null),_=v.useRef(null),w=v.useRef(b),M=v.useRef(y),O=v.useRef(!1);wu(()=>{let D=vu.init();return D.then(A=>(N.current=A)&&k(!1)).catch(A=>A?.type!=="cancelation"&&console.error("Monaco initialization: error:",A)),()=>C.current?$():D.cancel()}),sn(()=>{if(C.current&&N.current){let D=C.current.getOriginalEditor(),A=Vr(N.current,t||"",r||n||"text",o||"");A!==D.getModel()&&D.setModel(A)}},[o],S),sn(()=>{if(C.current&&N.current){let D=C.current.getModifiedEditor(),A=Vr(N.current,e||"",s||n||"text",i||"");A!==D.getModel()&&D.setModel(A)}},[i],S),sn(()=>{let D=C.current.getModifiedEditor();D.getOption(N.current.editor.EditorOption.readOnly)?D.setValue(e||""):e!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[e],S),sn(()=>{C.current?.getModel()?.original.setValue(t||"")},[t],S),sn(()=>{let{original:D,modified:A}=C.current.getModel();N.current.editor.setModelLanguage(D,r||n||"text"),N.current.editor.setModelLanguage(A,s||n||"text")},[n,r,s],S),sn(()=>{N.current?.editor.setTheme(c)},[c],S),sn(()=>{C.current?.updateOptions(u)},[u],S);let L=v.useCallback(()=>{if(!N.current)return;M.current(N.current);let D=Vr(N.current,t||"",r||n||"text",o||""),A=Vr(N.current,e||"",s||n||"text",i||"");C.current?.setModel({original:D,modified:A})},[n,e,s,t,r,o,i]),F=v.useCallback(()=>{!O.current&&_.current&&(C.current=N.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...u}),L(),N.current?.editor.setTheme(c),x(!0),O.current=!0)},[u,c,L]);v.useEffect(()=>{S&&w.current(C.current,N.current)},[S]),v.useEffect(()=>{!E&&!S&&F()},[E,S,F]);function $(){let D=C.current?.getModel();a||D?.original?.dispose(),l||D?.modified?.dispose(),C.current?.dispose()}return v.createElement(xu,{width:g,height:f,isEditorReady:S,loading:d,_ref:_,className:m,wrapperProps:p})}var Av=Tv;v.memo(Av);function Dv(t){let e=v.useRef();return v.useEffect(()=>{e.current=t},[t]),e.current}var Iv=Dv,Yo=new Map;function Lv({defaultValue:t,defaultLanguage:e,defaultPath:n,value:r,language:s,path:o,theme:i="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:p,wrapperProps:y={},beforeMount:b=Os,onMount:S=Os,onChange:x,onValidate:E=Os}){let[k,C]=v.useState(!1),[N,_]=v.useState(!0),w=v.useRef(null),M=v.useRef(null),O=v.useRef(null),L=v.useRef(S),F=v.useRef(b),$=v.useRef(),D=v.useRef(r),A=Iv(o),T=v.useRef(!1),z=v.useRef(!1);wu(()=>{let j=vu.init();return j.then(U=>(w.current=U)&&_(!1)).catch(U=>U?.type!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>M.current?W():j.cancel()}),sn(()=>{let j=Vr(w.current,t||r||"",e||s||"",o||n||"");j!==M.current?.getModel()&&(u&&Yo.set(A,M.current?.saveViewState()),M.current?.setModel(j),u&&M.current?.restoreViewState(Yo.get(o)))},[o],k),sn(()=>{M.current?.updateOptions(c)},[c],k),sn(()=>{!M.current||r===void 0||(M.current.getOption(w.current.editor.EditorOption.readOnly)?M.current.setValue(r):r!==M.current.getValue()&&(z.current=!0,M.current.executeEdits("",[{range:M.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),M.current.pushUndoStop(),z.current=!1))},[r],k),sn(()=>{let j=M.current?.getModel();j&&s&&w.current?.editor.setModelLanguage(j,s)},[s],k),sn(()=>{a!==void 0&&M.current?.revealLine(a)},[a],k),sn(()=>{w.current?.editor.setTheme(i)},[i],k);let H=v.useCallback(()=>{if(!(!O.current||!w.current)&&!T.current){F.current(w.current);let j=o||n,U=Vr(w.current,r||t||"",e||s||"",j||"");M.current=w.current?.editor.create(O.current,{model:U,automaticLayout:!0,...c},d),u&&M.current.restoreViewState(Yo.get(j)),w.current.editor.setTheme(i),a!==void 0&&M.current.revealLine(a),C(!0),T.current=!0}},[t,e,n,r,s,o,c,d,u,i,a]);v.useEffect(()=>{k&&L.current(M.current,w.current)},[k]),v.useEffect(()=>{!N&&!k&&H()},[N,k,H]),D.current=r,v.useEffect(()=>{k&&x&&($.current?.dispose(),$.current=M.current?.onDidChangeModelContent(j=>{z.current||x(M.current.getValue(),j)}))},[k,x]),v.useEffect(()=>{if(k){let j=w.current.editor.onDidChangeMarkers(U=>{let B=M.current.getModel()?.uri;if(B&&U.find(G=>G.path===B.path)){let G=w.current.editor.getModelMarkers({resource:B});E?.(G)}});return()=>{j?.dispose()}}return()=>{}},[k,E]);function W(){$.current?.dispose(),f?u&&Yo.set(o,M.current.saveViewState()):M.current.getModel()?.dispose(),M.current.dispose()}return v.createElement(xu,{width:g,height:m,isEditorReady:k,loading:l,_ref:O,className:p,wrapperProps:y})}var Pv=Lv,$v=v.memo(Pv),Fv=$v;const zv=({value:t,onChange:e,language:n="json",height:r="100%",readOnly:s=!1,theme:o="vs-dark"})=>{const i=v.useRef(null),a=(c,d)=>{i.current=c,n==="json"&&d.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",allowComments:!1}),c.updateOptions({readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0})},l=c=>{e&&c!==void 0&&e({target:{value:c}})};return v.useEffect(()=>{i.current&&i.current.updateOptions({readOnly:s})},[s]),h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx(Fv,{height:r,language:n,value:t,theme:o,onChange:l,onMount:a,options:{readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0}})})},Vv=t=>{const e=new Date(t);return new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(e)},Cu=v.memo(({version:t,isSelected:e,onSelect:n})=>{const r=v.useCallback(()=>{n?.(t.id)},[n,t.id]);return h.jsx(Ia,{role:"listitem","aria-selected":e,className:` + `},mu=sv(lv)(pu),cv={config:iv},dv=function(){for(var e=arguments.length,n=new Array(e),r=0;r{r.current=!1}:t,e)}var sn=Tv;function Os(){}function Vr(t,e,n,r){return Av(t,r)||Dv(t,e,n,r)}function Av(t,e){return t.editor.getModel(Cu(t,e))}function Dv(t,e,n,r){return t.editor.createModel(e,n,r?Cu(t,r):void 0)}function Cu(t,e){return t.Uri.parse(e)}function Iv({original:t,modified:e,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:f="100%",width:g="100%",className:m,wrapperProps:p={},beforeMount:y=Os,onMount:b=Os}){let[S,x]=v.useState(!1),[E,k]=v.useState(!0),C=v.useRef(null),N=v.useRef(null),_=v.useRef(null),w=v.useRef(b),M=v.useRef(y),O=v.useRef(!1);ku(()=>{let D=xu.init();return D.then(A=>(N.current=A)&&k(!1)).catch(A=>A?.type!=="cancelation"&&console.error("Monaco initialization: error:",A)),()=>C.current?$():D.cancel()}),sn(()=>{if(C.current&&N.current){let D=C.current.getOriginalEditor(),A=Vr(N.current,t||"",r||n||"text",o||"");A!==D.getModel()&&D.setModel(A)}},[o],S),sn(()=>{if(C.current&&N.current){let D=C.current.getModifiedEditor(),A=Vr(N.current,e||"",s||n||"text",i||"");A!==D.getModel()&&D.setModel(A)}},[i],S),sn(()=>{let D=C.current.getModifiedEditor();D.getOption(N.current.editor.EditorOption.readOnly)?D.setValue(e||""):e!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[e],S),sn(()=>{C.current?.getModel()?.original.setValue(t||"")},[t],S),sn(()=>{let{original:D,modified:A}=C.current.getModel();N.current.editor.setModelLanguage(D,r||n||"text"),N.current.editor.setModelLanguage(A,s||n||"text")},[n,r,s],S),sn(()=>{N.current?.editor.setTheme(c)},[c],S),sn(()=>{C.current?.updateOptions(u)},[u],S);let L=v.useCallback(()=>{if(!N.current)return;M.current(N.current);let D=Vr(N.current,t||"",r||n||"text",o||""),A=Vr(N.current,e||"",s||n||"text",i||"");C.current?.setModel({original:D,modified:A})},[n,e,s,t,r,o,i]),F=v.useCallback(()=>{!O.current&&_.current&&(C.current=N.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...u}),L(),N.current?.editor.setTheme(c),x(!0),O.current=!0)},[u,c,L]);v.useEffect(()=>{S&&w.current(C.current,N.current)},[S]),v.useEffect(()=>{!E&&!S&&F()},[E,S,F]);function $(){let D=C.current?.getModel();a||D?.original?.dispose(),l||D?.modified?.dispose(),C.current?.dispose()}return v.createElement(wu,{width:g,height:f,isEditorReady:S,loading:d,_ref:_,className:m,wrapperProps:p})}var Lv=Iv;v.memo(Lv);function Pv(t){let e=v.useRef();return v.useEffect(()=>{e.current=t},[t]),e.current}var $v=Pv,Yo=new Map;function Fv({defaultValue:t,defaultLanguage:e,defaultPath:n,value:r,language:s,path:o,theme:i="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:p,wrapperProps:y={},beforeMount:b=Os,onMount:S=Os,onChange:x,onValidate:E=Os}){let[k,C]=v.useState(!1),[N,_]=v.useState(!0),w=v.useRef(null),M=v.useRef(null),O=v.useRef(null),L=v.useRef(S),F=v.useRef(b),$=v.useRef(),D=v.useRef(r),A=$v(o),T=v.useRef(!1),z=v.useRef(!1);ku(()=>{let j=xu.init();return j.then(U=>(w.current=U)&&_(!1)).catch(U=>U?.type!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>M.current?W():j.cancel()}),sn(()=>{let j=Vr(w.current,t||r||"",e||s||"",o||n||"");j!==M.current?.getModel()&&(u&&Yo.set(A,M.current?.saveViewState()),M.current?.setModel(j),u&&M.current?.restoreViewState(Yo.get(o)))},[o],k),sn(()=>{M.current?.updateOptions(c)},[c],k),sn(()=>{!M.current||r===void 0||(M.current.getOption(w.current.editor.EditorOption.readOnly)?M.current.setValue(r):r!==M.current.getValue()&&(z.current=!0,M.current.executeEdits("",[{range:M.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),M.current.pushUndoStop(),z.current=!1))},[r],k),sn(()=>{let j=M.current?.getModel();j&&s&&w.current?.editor.setModelLanguage(j,s)},[s],k),sn(()=>{a!==void 0&&M.current?.revealLine(a)},[a],k),sn(()=>{w.current?.editor.setTheme(i)},[i],k);let H=v.useCallback(()=>{if(!(!O.current||!w.current)&&!T.current){F.current(w.current);let j=o||n,U=Vr(w.current,r||t||"",e||s||"",j||"");M.current=w.current?.editor.create(O.current,{model:U,automaticLayout:!0,...c},d),u&&M.current.restoreViewState(Yo.get(j)),w.current.editor.setTheme(i),a!==void 0&&M.current.revealLine(a),C(!0),T.current=!0}},[t,e,n,r,s,o,c,d,u,i,a]);v.useEffect(()=>{k&&L.current(M.current,w.current)},[k]),v.useEffect(()=>{!N&&!k&&H()},[N,k,H]),D.current=r,v.useEffect(()=>{k&&x&&($.current?.dispose(),$.current=M.current?.onDidChangeModelContent(j=>{z.current||x(M.current.getValue(),j)}))},[k,x]),v.useEffect(()=>{if(k){let j=w.current.editor.onDidChangeMarkers(U=>{let B=M.current.getModel()?.uri;if(B&&U.find(G=>G.path===B.path)){let G=w.current.editor.getModelMarkers({resource:B});E?.(G)}});return()=>{j?.dispose()}}return()=>{}},[k,E]);function W(){$.current?.dispose(),f?u&&Yo.set(o,M.current.saveViewState()):M.current.getModel()?.dispose(),M.current.dispose()}return v.createElement(wu,{width:g,height:m,isEditorReady:k,loading:l,_ref:O,className:p,wrapperProps:y})}var zv=Fv,Vv=v.memo(zv),Hv=Vv;const Uv=({value:t,onChange:e,language:n="json",height:r="100%",readOnly:s=!1,theme:o="vs-dark"})=>{const i=v.useRef(null),a=(c,d)=>{i.current=c,n==="json"&&d.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",allowComments:!1}),c.updateOptions({readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0})},l=c=>{e&&c!==void 0&&e({target:{value:c}})};return v.useEffect(()=>{i.current&&i.current.updateOptions({readOnly:s})},[s]),h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx(Hv,{height:r,language:n,value:t,theme:o,onChange:l,onMount:a,options:{readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0}})})},Bv=t=>{const e=new Date(t);return new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(e)},Su=v.memo(({version:t,isSelected:e,onSelect:n})=>{const r=v.useCallback(()=>{n?.(t.id)},[n,t.id]);return h.jsx(Ia,{role:"listitem","aria-selected":e,className:` p-3 rounded-lg border cursor-pointer transition-colors ${e?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 hover:border-gray-400 dark:border-gray-600 dark:hover:border-gray-500"} - `,onClick:r,children:h.jsxs(I,{className:"flex justify-between items-start",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Q,{className:"font-semibold text-gray-900 dark:text-gray-100",children:["버전 ",t.version]}),h.jsx(Q,{className:"ml-2 text-sm text-gray-500 dark:text-gray-400",children:Vv(t.created_at)})]}),h.jsxs(I,{className:"flex gap-3 text-sm",children:[h.jsxs(Q,{className:"text-green-600 dark:text-green-400",children:["+",t.changes_summary.added]}),h.jsxs(Q,{className:"text-red-600 dark:text-red-400",children:["-",t.changes_summary.removed]})]})]})})});Cu.displayName="VersionListItem";const Su=({versions:t,selectedId:e,onSelect:n})=>t.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"버전이 없습니다."}):h.jsx(Da,{role:"list",className:"space-y-2",children:t.map(r=>h.jsx(Cu,{version:r,isSelected:e===r.id,onSelect:n},r.id))}),Hv=({layoutId:t,versions:e,onRestore:n})=>{const[r,s]=v.useState(),o=l=>{s(l)},i=()=>{r!==void 0&&n(r)},a=r===void 0;return h.jsxs(I,{className:"space-y-4",role:"region","aria-label":"레이아웃 히스토리 패널",children:[h.jsx(I,{className:"border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:h.jsx(Su,{versions:e,selectedId:r,onSelect:o})}),h.jsx(I,{className:"flex justify-end",children:h.jsx(oe,{variant:"primary",disabled:a,onClick:i,"aria-label":"선택한 버전으로 복원",children:"복원"})})]})},Uv=({emailLabel:t="Email",passwordLabel:e="Password",submitButtonText:n="Sign In",processingText:r="Processing...",emailPlaceholder:s="Email",passwordPlaceholder:o="Password",forgotPasswordText:i="Forgot your password?",forgotPasswordUrl:a="/admin/password/reset",emailRequiredError:l="Please enter your email.",emailInvalidError:c="Please enter a valid email address.",passwordRequiredError:d="Please enter your password.",onSubmit:u,loadingActions:f={},isLoading:g=!1,disabled:m=!1,apiError:p="",className:y="",style:b})=>{const[S,x]=v.useState(""),[E,k]=v.useState(""),[C,N]=v.useState({}),_=p,w=Object.values(f).some($=>$===!0),M=g||w,O=m||M,L=()=>{const $={},D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!S||S.trim()===""?$.email=l:D.test(S)||($.email=c),(!E||E.trim()==="")&&($.password=d),N($),Object.keys($).length===0},F=async $=>{if(!L()){$.preventDefault();return}N({}),u?await u($):$.preventDefault()};return h.jsx(I,{className:`w-full ${y}`,style:b,children:h.jsxs(La,{onSubmit:F,className:"space-y-6",noValidate:!0,children:[_&&h.jsx(I,{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:h.jsx(bt,{className:"text-sm text-red-600 dark:text-red-400",children:_})}),h.jsxs(I,{children:[h.jsx(rn,{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t}),h.jsx(wt,{id:"email",name:"email",type:"email",value:S,onChange:$=>x($.target.value),placeholder:s,disabled:O,className:` + `,onClick:r,children:h.jsxs(I,{className:"flex justify-between items-start",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Q,{className:"font-semibold text-gray-900 dark:text-gray-100",children:["버전 ",t.version]}),h.jsx(Q,{className:"ml-2 text-sm text-gray-500 dark:text-gray-400",children:Bv(t.created_at)})]}),h.jsxs(I,{className:"flex gap-3 text-sm",children:[h.jsxs(Q,{className:"text-green-600 dark:text-green-400",children:["+",t.changes_summary.added]}),h.jsxs(Q,{className:"text-red-600 dark:text-red-400",children:["-",t.changes_summary.removed]})]})]})})});Su.displayName="VersionListItem";const _u=({versions:t,selectedId:e,onSelect:n})=>t.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"버전이 없습니다."}):h.jsx(Da,{role:"list",className:"space-y-2",children:t.map(r=>h.jsx(Su,{version:r,isSelected:e===r.id,onSelect:n},r.id))}),jv=({layoutId:t,versions:e,onRestore:n})=>{const[r,s]=v.useState(),o=l=>{s(l)},i=()=>{r!==void 0&&n(r)},a=r===void 0;return h.jsxs(I,{className:"space-y-4",role:"region","aria-label":"레이아웃 히스토리 패널",children:[h.jsx(I,{className:"border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:h.jsx(_u,{versions:e,selectedId:r,onSelect:o})}),h.jsx(I,{className:"flex justify-end",children:h.jsx(oe,{variant:"primary",disabled:a,onClick:i,"aria-label":"선택한 버전으로 복원",children:"복원"})})]})},Wv=({emailLabel:t="Email",passwordLabel:e="Password",submitButtonText:n="Sign In",processingText:r="Processing...",emailPlaceholder:s="Email",passwordPlaceholder:o="Password",forgotPasswordText:i="Forgot your password?",forgotPasswordUrl:a="/admin/password/reset",emailRequiredError:l="Please enter your email.",emailInvalidError:c="Please enter a valid email address.",passwordRequiredError:d="Please enter your password.",onSubmit:u,loadingActions:f={},isLoading:g=!1,disabled:m=!1,apiError:p="",className:y="",style:b})=>{const[S,x]=v.useState(""),[E,k]=v.useState(""),[C,N]=v.useState({}),_=p,w=Object.values(f).some($=>$===!0),M=g||w,O=m||M,L=()=>{const $={},D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!S||S.trim()===""?$.email=l:D.test(S)||($.email=c),(!E||E.trim()==="")&&($.password=d),N($),Object.keys($).length===0},F=async $=>{if(!L()){$.preventDefault();return}N({}),u?await u($):$.preventDefault()};return h.jsx(I,{className:`w-full ${y}`,style:b,children:h.jsxs(La,{onSubmit:F,className:"space-y-6",noValidate:!0,children:[_&&h.jsx(I,{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:h.jsx(bt,{className:"text-sm text-red-600 dark:text-red-400",children:_})}),h.jsxs(I,{children:[h.jsx(rn,{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t}),h.jsx(wt,{id:"email",name:"email",type:"email",value:S,onChange:$=>x($.target.value),placeholder:s,disabled:O,className:` w-full px-4 py-3 rounded-lg border ${C.email?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"} bg-white dark:bg-gray-800 @@ -146,7 +146,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-200 flex items-center justify-center - `,children:M?h.jsxs(h.Fragment,{children:[h.jsxs(Hn,{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]}):n})]})})},_u=t=>t==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,ll=t=>{const e=_u(t);document.documentElement.setAttribute("data-theme",e),e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Bv=()=>{const t=localStorage.getItem("g7_color_scheme");return t&&["auto","light","dark"].includes(t)?t:"auto"},jv=({onThemeChange:t,className:e="",autoText:n="System",lightText:r="Light",darkText:s="Dark",id:o,editorAttrs:i})=>{const a=Bv(),[l,c]=v.useState(a),[d,u]=v.useState(!1),f=v.useRef(null);v.useEffect(()=>{ll(l)},[]),v.useEffect(()=>{if(l!=="auto")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{ll("auto")};return p.addEventListener("change",y),()=>p.removeEventListener("change",y)},[l]),v.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g=p=>{c(p),localStorage.setItem("g7_color_scheme",p),ll(p),u(!1),t?.(p)},m=()=>_u(l)==="dark"?de.Moon:de.Sun;return h.jsxs(I,{ref:f,className:`relative ${e}`,id:o,...i,children:[h.jsx(oe,{onClick:()=>u(!d),className:"w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors","aria-label":"Toggle theme",children:h.jsx(re,{name:m(),className:"text-sm text-slate-500 dark:text-slate-400"})}),d&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>g("auto"),className:` + `,children:M?h.jsxs(h.Fragment,{children:[h.jsxs(Hn,{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]}):n})]})})},Eu=t=>t==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,ll=t=>{const e=Eu(t);document.documentElement.setAttribute("data-theme",e),e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Gv=()=>{const t=localStorage.getItem("g7_color_scheme");return t&&["auto","light","dark"].includes(t)?t:"auto"},Yv=({onThemeChange:t,className:e="",autoText:n="System",lightText:r="Light",darkText:s="Dark",id:o,editorAttrs:i})=>{const a=Gv(),[l,c]=v.useState(a),[d,u]=v.useState(!1),f=v.useRef(null);v.useEffect(()=>{ll(l)},[]),v.useEffect(()=>{if(l!=="auto")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{ll("auto")};return p.addEventListener("change",y),()=>p.removeEventListener("change",y)},[l]),v.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g=p=>{c(p),localStorage.setItem("g7_color_scheme",p),ll(p),u(!1),t?.(p)},m=()=>Eu(l)==="dark"?de.Moon:de.Sun;return h.jsxs(I,{ref:f,className:`relative ${e}`,id:o,...i,children:[h.jsx(oe,{onClick:()=>u(!d),className:"w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors","aria-label":"Toggle theme",children:h.jsx(re,{name:m(),className:"text-sm text-slate-500 dark:text-slate-400"})}),d&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>g("auto"),className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${l==="auto"?"bg-gray-50 dark:bg-gray-700":""} `,children:[h.jsx(re,{name:de.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),l==="auto"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(oe,{onClick:()=>g("light"),className:` @@ -155,7 +155,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `,children:[h.jsx(re,{name:de.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),l==="light"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(oe,{onClick:()=>g("dark"),className:` w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors ${l==="dark"?"bg-gray-50 dark:bg-gray-700":""} - `,children:[h.jsx(re,{name:de.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:s}),l==="dark"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Eu=window.G7Core?.createLogger?.("Comp:ColumnSelector")??{log:(...t)=>console.log("[Comp:ColumnSelector]",...t),warn:(...t)=>console.warn("[Comp:ColumnSelector]",...t),error:(...t)=>console.error("[Comp:ColumnSelector]",...t)},Mu=(t,e)=>window.G7Core?.t?.(t,e)??t,Wv=()=>window.G7Core,Gv=({id:t,columns:e,visibleColumns:n,onColumnVisibilityChange:r,triggerLabel:s,triggerIconName:o=de.Sliders,position:i="right",className:a="",style:l,requiredText:c,menuTitle:d,menuDescription:u,defaultColumns:f,triggerClassName:g,labelClassName:m,dynamicColumns:p,dynamicColumnsInsertAfter:y,editorAttrs:b})=>{const S=s??Mu("common.column_selector"),x=c??Mu("common.required"),E=v.useMemo(()=>{if(!p||!Array.isArray(p)||p.length===0)return e;if(y){const V=e.findIndex(K=>K.field===y);if(V!==-1)return[...e.slice(0,V+1),...p,...e.slice(V+1)]}return[...e,...p]},[e,p,y]),[k,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),[w,M]=v.useState(!1),[O,L]=v.useState(i),F=v.useMemo(()=>{try{const V=window.G7Core?.AuthManager?.getInstance();return V?V.getUser()?.uuid:void 0}catch{return}},[]),$=t?`g7_columns_${t}${F!==void 0?`_${F}`:""}`:null,D=()=>{if(!$)return null;try{const V=localStorage.getItem($);if(V){const K=JSON.parse(V);if(Array.isArray(K)&&K.length>0)return K}}catch(V){Eu.warn("Failed to load from localStorage:",V)}return null},A=V=>{if($)try{localStorage.setItem($,JSON.stringify(V))}catch(K){Eu.warn("Failed to save to localStorage:",K)}},T=()=>{const V=D();return V||(n&&n.length>0?n:f&&f.length>0?f:E.filter(K=>K.visible!==!1).map(K=>K.field))},[z,H]=v.useState(T);v.useEffect(()=>{w||(r&&z.length>0&&r(z),M(!0))},[w,r,z]),v.useEffect(()=>{w&&n&&n.length>0&&(D()||H(n))},[n,w]);const W=v.useRef([]),j=v.useRef(null);v.useEffect(()=>{if(w&&p&&p.length>0){const V=p.map(Z=>Z.field);if(j.current===null){const Z=D();if(j.current=Z!==null,Z!==null){W.current=V;return}}const K=W.current,X=V.filter(Z=>!K.includes(Z));if(X.length>0){const Z=n&&n.length>0?n:z,ee=X.filter(ne=>!Z.includes(ne));if(ee.length>0){const ne=[...Z,...ee];H(ne),A(ne),r?.(ne)}}W.current=V}},[p,w]);const U=n&&n.length>0?n:z;v.useEffect(()=>{const V=K=>{N.current&&!N.current.contains(K.target)&&C(!1)};return k&&document.addEventListener("mousedown",V),()=>{document.removeEventListener("mousedown",V)}},[k]),v.useEffect(()=>{if(k&&_.current&&N.current){const V=_.current.getBoundingClientRect(),K=N.current.getBoundingClientRect(),X=window.innerWidth,Z=V.width||256;i==="right"?K.right-Z<0?L("left"):L("right"):K.left+Z>X?L("right"):L("left")}},[k,i]);const B=V=>{if(E.find(Z=>Z.field===V)?.required)return;const X=U.includes(V)?U.filter(Z=>Z!==V):[...U,V];H(X),A(X),r?.(X)},G=O==="left"?"left-0":"right-0";return h.jsxs(I,{ref:N,className:`relative inline-block ${a}`,style:l,id:t,...b,children:[h.jsxs(oe,{onClick:()=>C(!k),className:Wv()?.style?.mergeClasses?.("flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",g)??`flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors ${g??""}`,children:[h.jsx(re,{name:o,className:"w-5 h-5"}),S&&h.jsx(Q,{className:`${m||"hidden sm:inline"} text-sm`,children:S})]}),k&&h.jsxs(I,{ref:_,className:`absolute ${G} z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg`,children:[(d||u)&&h.jsxs(I,{className:"px-4 pt-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[d&&h.jsx(Q,{className:"block text-sm font-medium text-gray-900 dark:text-white",children:d}),u&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:u})]}),h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:E.map(V=>{const K=U.includes(V.field),X=V.required===!0;return h.jsxs(I,{onClick:()=>!X&&B(V.field),className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${X?"cursor-default":"cursor-pointer"}`,children:[h.jsx(vn,{checked:K,disabled:X,readOnly:!0,className:"h-4 w-4 text-blue-600 rounded border-gray-300 dark:border-gray-600 pointer-events-none"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:V.header}),X&&x&&h.jsx(Q,{className:"ml-auto text-xs text-gray-400 dark:text-gray-500",children:x})]},V.field)})})]})]})},Yv=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...t)=>console.log("[Comp:PageTransition]",...t),warn:(...t)=>console.warn("[Comp:PageTransition]",...t),error:(...t)=>console.error("[Comp:PageTransition]",...t)},Xv=({className:t="",style:e})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const s=window.G7Core?.TransitionManager;if(!s){Yv.warn("TransitionManager를 찾을 수 없습니다.");return}return r(s.getIsPending()),s.subscribe(i=>{r(i)})},[]),n?h.jsxs(I,{className:`fixed top-0 left-0 right-0 z-[999] ${t}`,style:e,role:"progressbar","aria-label":"페이지 로딩 중",children:[h.jsx(I,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:h.jsx(I,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),h.jsx("style",{children:` + `,children:[h.jsx(re,{name:de.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:s}),l==="dark"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Mu=window.G7Core?.createLogger?.("Comp:ColumnSelector")??{log:(...t)=>console.log("[Comp:ColumnSelector]",...t),warn:(...t)=>console.warn("[Comp:ColumnSelector]",...t),error:(...t)=>console.error("[Comp:ColumnSelector]",...t)},Nu=(t,e)=>window.G7Core?.t?.(t,e)??t,Xv=()=>window.G7Core,Kv=({id:t,columns:e,visibleColumns:n,onColumnVisibilityChange:r,triggerLabel:s,triggerIconName:o=de.Sliders,position:i="right",className:a="",style:l,requiredText:c,menuTitle:d,menuDescription:u,defaultColumns:f,triggerClassName:g,labelClassName:m,dynamicColumns:p,dynamicColumnsInsertAfter:y,editorAttrs:b})=>{const S=s??Nu("common.column_selector"),x=c??Nu("common.required"),E=v.useMemo(()=>{if(!p||!Array.isArray(p)||p.length===0)return e;if(y){const V=e.findIndex(K=>K.field===y);if(V!==-1)return[...e.slice(0,V+1),...p,...e.slice(V+1)]}return[...e,...p]},[e,p,y]),[k,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),[w,M]=v.useState(!1),[O,L]=v.useState(i),F=v.useMemo(()=>{try{const V=window.G7Core?.AuthManager?.getInstance();return V?V.getUser()?.uuid:void 0}catch{return}},[]),$=t?`g7_columns_${t}${F!==void 0?`_${F}`:""}`:null,D=()=>{if(!$)return null;try{const V=localStorage.getItem($);if(V){const K=JSON.parse(V);if(Array.isArray(K)&&K.length>0)return K}}catch(V){Mu.warn("Failed to load from localStorage:",V)}return null},A=V=>{if($)try{localStorage.setItem($,JSON.stringify(V))}catch(K){Mu.warn("Failed to save to localStorage:",K)}},T=()=>{const V=D();return V||(n&&n.length>0?n:f&&f.length>0?f:E.filter(K=>K.visible!==!1).map(K=>K.field))},[z,H]=v.useState(T);v.useEffect(()=>{w||(r&&z.length>0&&r(z),M(!0))},[w,r,z]),v.useEffect(()=>{w&&n&&n.length>0&&(D()||H(n))},[n,w]);const W=v.useRef([]),j=v.useRef(null);v.useEffect(()=>{if(w&&p&&p.length>0){const V=p.map(Z=>Z.field);if(j.current===null){const Z=D();if(j.current=Z!==null,Z!==null){W.current=V;return}}const K=W.current,X=V.filter(Z=>!K.includes(Z));if(X.length>0){const Z=n&&n.length>0?n:z,ee=X.filter(ne=>!Z.includes(ne));if(ee.length>0){const ne=[...Z,...ee];H(ne),A(ne),r?.(ne)}}W.current=V}},[p,w]);const U=n&&n.length>0?n:z;v.useEffect(()=>{const V=K=>{N.current&&!N.current.contains(K.target)&&C(!1)};return k&&document.addEventListener("mousedown",V),()=>{document.removeEventListener("mousedown",V)}},[k]),v.useEffect(()=>{if(k&&_.current&&N.current){const V=_.current.getBoundingClientRect(),K=N.current.getBoundingClientRect(),X=window.innerWidth,Z=V.width||256;i==="right"?K.right-Z<0?L("left"):L("right"):K.left+Z>X?L("right"):L("left")}},[k,i]);const B=V=>{if(E.find(Z=>Z.field===V)?.required)return;const X=U.includes(V)?U.filter(Z=>Z!==V):[...U,V];H(X),A(X),r?.(X)},G=O==="left"?"left-0":"right-0";return h.jsxs(I,{ref:N,className:`relative inline-block ${a}`,style:l,id:t,...b,children:[h.jsxs(oe,{onClick:()=>C(!k),className:Xv()?.style?.mergeClasses?.("flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",g)??`flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors ${g??""}`,children:[h.jsx(re,{name:o,className:"w-5 h-5"}),S&&h.jsx(Q,{className:`${m||"hidden sm:inline"} text-sm`,children:S})]}),k&&h.jsxs(I,{ref:_,className:`absolute ${G} z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg`,children:[(d||u)&&h.jsxs(I,{className:"px-4 pt-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[d&&h.jsx(Q,{className:"block text-sm font-medium text-gray-900 dark:text-white",children:d}),u&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:u})]}),h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:E.map(V=>{const K=U.includes(V.field),X=V.required===!0;return h.jsxs(I,{onClick:()=>!X&&B(V.field),className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${X?"cursor-default":"cursor-pointer"}`,children:[h.jsx(vn,{checked:K,disabled:X,readOnly:!0,className:"h-4 w-4 text-blue-600 rounded border-gray-300 dark:border-gray-600 pointer-events-none"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:V.header}),X&&x&&h.jsx(Q,{className:"ml-auto text-xs text-gray-400 dark:text-gray-500",children:x})]},V.field)})})]})]})},qv=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...t)=>console.log("[Comp:PageTransition]",...t),warn:(...t)=>console.warn("[Comp:PageTransition]",...t),error:(...t)=>console.error("[Comp:PageTransition]",...t)},Zv=({className:t="",style:e})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const s=window.G7Core?.TransitionManager;if(!s){qv.warn("TransitionManager를 찾을 수 없습니다.");return}return r(s.getIsPending()),s.subscribe(i=>{r(i)})},[]),n?h.jsxs(I,{className:`fixed top-0 left-0 right-0 z-[999] ${t}`,style:e,role:"progressbar","aria-label":"페이지 로딩 중",children:[h.jsx(I,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:h.jsx(I,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),h.jsx("style",{children:` @keyframes loading { 0% { transform: translateX(-100%); @@ -167,12 +167,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho transform: translateX(-100%); } } - `})]}):null},Kv=(t,e)=>window.G7Core?.t?.(t,e)??t,qv=({options:t})=>{const e=document.documentElement.classList.contains("dark"),n=e?"rgb(17,24,39)":"rgb(249,250,251)",r=e?"#6b7280":"#9ca3af",s=e?"#9ca3af":"#6b7280";return h.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[h.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${r}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),h.jsx("span",{style:{color:s,fontSize:"14px"},children:t?.text||Kv("nav.loading")})]})};function hr(t){"@babel/helpers - typeof";return hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hr(t)}function Zv(t,e){if(hr(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(hr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nu(t){var e=Zv(t,"string");return hr(e)=="symbol"?e:e+""}function Ts(t,e,n){return(e=Nu(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ou(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Me(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n0?It(Br,--qt):0,Ur--,kt===10&&(Ur=1,Qo--),kt}function on(){return kt=qt2||Ls(kt)>3?"":" "}function Sx(t,e){for(;--e&&on()&&!(kt<48||kt>102||kt>57&&kt<65||kt>70&&kt<97););return Is(t,Ro()+(e<6&&Dn()==32&&on()==32))}function pl(t){for(;on();)switch(kt){case t:return qt;case 34:case 39:t!==34&&t!==39&&pl(kt);break;case 40:t===41&&pl(t);break;case 92:on();break}return qt}function _x(t,e){for(;on()&&t+kt!==57;)if(t+kt===84&&Dn()===47)break;return"/*"+Is(e,qt-1)+"*"+qo(t===47?t:on())}function Ex(t){for(;!Ls(Dn());)on();return Is(t,qt)}function Mx(t){return Vu(ti("",null,null,null,[""],t=zu(t),0,[0],t))}function ti(t,e,n,r,s,o,i,a,l){for(var c=0,d=0,u=i,f=0,g=0,m=0,p=1,y=1,b=1,S=0,x="",E=s,k=o,C=r,N=x;y;)switch(m=S,S=on()){case 40:if(m!=108&&It(N,u-1)==58){hl(N+=nt(ei(S),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=ei(S);break;case 9:case 10:case 13:case 32:N+=Cx(m);break;case 92:N+=Sx(Ro()-1,7);continue;case 47:switch(Dn()){case 42:case 47:Zo(Nx(_x(on(),Ro()),e,n),l);break;default:N+="/"}break;case 123*p:a[c++]=An(N)*b;case 125*p:case 59:case 0:switch(S){case 0:case 125:y=0;case 59+d:b==-1&&(N=nt(N,/\f/g,"")),g>0&&An(N)-u&&Zo(g>32?Uu(N+";",r,n,u-1):Uu(nt(N," ","")+";",r,n,u-2),l);break;case 59:N+=";";default:if(Zo(C=Hu(N,e,n,c,d,s,a,x,E=[],k=[],u),o),S===123)if(d===0)ti(N,e,C,C,E,o,u,a,k);else switch(f===99&&It(N,3)===110?100:f){case 100:case 108:case 109:case 115:ti(t,C,C,r&&Zo(Hu(t,C,C,0,0,s,a,x,s,E=[],u),k),s,k,u,a,r?E:k);break;default:ti(N,C,C,C,[""],k,0,a,k)}}c=d=g=0,p=b=1,x=N="",u=i;break;case 58:u=1+An(N),g=m;default:if(p<1){if(S==123)--p;else if(S==125&&p++==0&&kx()==125)continue}switch(N+=qo(S),S*p){case 38:b=d>0?1:(N+="\f",-1);break;case 44:a[c++]=(An(N)-1)*b,b=1;break;case 64:Dn()===45&&(N+=ei(on())),f=Dn(),d=u=An(x=N+=Ex(Ro())),S++;break;case 45:m===45&&An(N)==2&&(p=0)}}return o}function Hu(t,e,n,r,s,o,i,a,l,c,d){for(var u=s-1,f=s===0?o:[""],g=gl(f),m=0,p=0,y=0;m0?f[b]+" "+S:nt(S,/&\f/g,f[b])))&&(l[y++]=x);return Jo(t,e,n,s===0?ul:a,l,c,d)}function Nx(t,e,n){return Jo(t,e,n,Lu,qo(wx()),As(t,2,-2),0)}function Uu(t,e,n,r){return Jo(t,e,n,fl,As(t,0,r),As(t,r+1,-1),r)}function jr(t,e){for(var n="",r=gl(t),s=0;s6)switch(It(t,e+1)){case 109:if(It(t,e+4)!==45)break;case 102:return nt(t,/(.+:)(.+)-([^]+)/,"$1"+tt+"$2-$3$1"+Ko+(It(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~hl(t,"stretch")?ju(nt(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(It(t,e+1)!==115)break;case 6444:switch(It(t,An(t)-3-(~hl(t,"!important")&&10))){case 107:return nt(t,":",":"+tt)+t;case 101:return nt(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+tt+(It(t,14)===45?"inline-":"")+"box$3$1"+tt+"$2$3$1"+$t+"$2box$3")+t}break;case 5936:switch(It(t,e+11)){case 114:return tt+t+$t+nt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return tt+t+$t+nt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return tt+t+$t+nt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return tt+t+$t+t+t}return t}var zx=function(e,n,r,s){if(e.length>-1&&!e.return)switch(e.type){case fl:e.return=ju(e.value,e.length);break;case Pu:return jr([Ds(e,{value:nt(e.value,"@","@"+tt)})],s);case ul:if(e.length)return xx(e.props,function(o){switch(vx(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return jr([Ds(e,{props:[nt(o,/:(read-\w+)/,":"+Ko+"$1")]})],s);case"::placeholder":return jr([Ds(e,{props:[nt(o,/:(plac\w+)/,":"+tt+"input-$1")]}),Ds(e,{props:[nt(o,/:(plac\w+)/,":"+Ko+"$1")]}),Ds(e,{props:[nt(o,/:(plac\w+)/,$t+"input-$1")]})],s)}return""})}},Vx=[zx],Hx=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var s=e.stylisPlugins||Vx,o={},i,a=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;b=4;++r,s-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(s){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var Kx={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},qx=/[A-Z]|^ms/g,Zx=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Ku=function(e){return e.charCodeAt(1)===45},qu=function(e){return e!=null&&typeof e!="boolean"},yl=Dx(function(t){return Ku(t)?t:t.replace(qx,"-$&").toLowerCase()}),Zu=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(Zx,function(r,s,o){return In={name:s,styles:o,next:In},s})}return Kx[e]!==1&&!Ku(e)&&typeof n=="number"&&n!==0?n+"px":n};function Ps(t,e,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return In={name:s.name,styles:s.styles,next:In},s.name;var o=n;if(o.styles!==void 0){var i=o.next;if(i!==void 0)for(;i!==void 0;)In={name:i.name,styles:i.styles,next:In},i=i.next;var a=o.styles+";";return a}return Qx(t,e,n)}case"function":{if(t!==void 0){var l=In,c=n(t);return In=l,Ps(t,e,c)}break}}var d=n;return d}function Qx(t,e,n){var r="";if(Array.isArray(n))for(var s=0;s({x:t,y:t});function uw(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function oi(){return typeof window<"u"}function ef(t){return nf(t)?(t.nodeName||"").toLowerCase():"#document"}function jn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function tf(t){var e;return(e=(nf(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function nf(t){return oi()?t instanceof Node||t instanceof jn(t).Node:!1}function fw(t){return oi()?t instanceof Element||t instanceof jn(t).Element:!1}function kl(t){return oi()?t instanceof HTMLElement||t instanceof jn(t).HTMLElement:!1}function rf(t){return!oi()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof jn(t).ShadowRoot}function sf(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Sl(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}let Cl;function hw(){return Cl==null&&(Cl=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cl}function gw(t){return/^(html|body|#document)$/.test(ef(t))}function Sl(t){return jn(t).getComputedStyle(t)}function pw(t){if(ef(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rf(t)&&t.host||tf(t);return rf(e)?e.host:e}function of(t){const e=pw(t);return gw(e)?t.ownerDocument?t.ownerDocument.body:t.body:kl(e)&&sf(e)?e:of(e)}function ii(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=of(t),o=s===((r=t.ownerDocument)==null?void 0:r.body),i=jn(s);if(o){const a=_l(i);return e.concat(i,i.visualViewport||[],sf(s)?s:[],a&&n?ii(a):[])}else return e.concat(s,ii(s,[],n))}function _l(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function mw(t){const e=Sl(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=kl(t),o=s?t.offsetWidth:n,i=s?t.offsetHeight:r,a=ni(n)!==o||ni(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function El(t){return fw(t)?t:t.contextElement}function af(t){const e=El(t);if(!kl(e))return si(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:o}=mw(e);let i=(o?ni(n.width):n.width)/r,a=(o?ni(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const bw=si(0);function yw(t){const e=jn(t);return!hw()||!e.visualViewport?bw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vw(t,e,n){return!1}function lf(t,e,n,r){e===void 0&&(e=!1);const s=t.getBoundingClientRect(),o=El(t);let i=si(1);e&&(i=af(t));const a=vw()?yw(o):si(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,d=s.width/i.x,u=s.height/i.y;if(o){const f=jn(o),g=r;let m=f,p=_l(m);for(;p&&r&&g!==m;){const y=af(p),b=p.getBoundingClientRect(),S=Sl(p),x=b.left+(p.clientLeft+parseFloat(S.paddingLeft))*y.x,E=b.top+(p.clientTop+parseFloat(S.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=x,c+=E,m=jn(p),p=_l(m)}}return uw({width:d,height:u,x:l,y:c})}function cf(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function xw(t,e){let n=null,r;const s=tf(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=t.getBoundingClientRect(),{left:d,top:u,width:f,height:g}=c;if(a||e(),!f||!g)return;const m=ri(u),p=ri(s.clientWidth-(d+f)),y=ri(s.clientHeight-(u+g)),b=ri(d),x={rootMargin:-m+"px "+-p+"px "+-y+"px "+-b+"px",threshold:dw(0,cw(1,l))||1};let E=!0;function k(C){const N=C[0].intersectionRatio;if(N!==l){if(!E)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!cf(c,t.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(k,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(k,x)}n.observe(t)}return i(!0),o}function ww(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=El(t),d=s||o?[...c?ii(c):[],...e?ii(e):[]]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const u=c&&a?xw(c,n):null;let f=-1,g=null;i&&(g=new ResizeObserver(b=>{let[S]=b;S&&S.target===c&&g&&e&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(e)})),n()}),c&&!l&&g.observe(c),e&&g.observe(e));let m,p=l?lf(t):null;l&&y();function y(){const b=lf(t);p&&!cf(p,b)&&n(),p=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(S=>{s&&S.removeEventListener("scroll",n),o&&S.removeEventListener("resize",n)}),u?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(m)}}var Ml=v.useLayoutEffect,kw=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],ai=function(){};function Cw(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function Sw(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s-1}function _w(t){return ci(t)?window.innerHeight:t.clientHeight}function uf(t){return ci(t)?window.pageYOffset:t.scrollTop}function di(t,e){if(ci(t)){window.scrollTo(0,e);return}t.scrollTop=e}function Ew(t){var e=getComputedStyle(t),n=e.position==="absolute",r=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var s=t;s=s.parentElement;)if(e=getComputedStyle(s),!(n&&e.position==="static")&&r.test(e.overflow+e.overflowY+e.overflowX))return s;return document.documentElement}function Mw(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e}function ui(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ai,s=uf(t),o=e-s,i=10,a=0;function l(){a+=i;var c=Mw(a,s,o,n);di(t,c),an.bottom?di(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+s,t.scrollHeight)):r.top-s1?n-1:0),s=1;s=m)return{placement:"bottom",maxHeight:e};if(w>=m&&!i)return o&&ui(l,M,L),{placement:"bottom",maxHeight:e};if(!i&&w>=r||i&&N>=r){o&&ui(l,M,L);var F=i?N-E:w-E;return{placement:"bottom",maxHeight:F}}if(s==="auto"||i){var $=e,D=i?C:_;return D>=r&&($=Math.min(D-E-a,e)),{placement:"top",maxHeight:$}}if(s==="bottom")return o&&di(l,M),{placement:"bottom",maxHeight:e};break;case"top":if(C>=m)return{placement:"top",maxHeight:e};if(_>=m&&!i)return o&&ui(l,O,L),{placement:"top",maxHeight:e};if(!i&&_>=r||i&&C>=r){var A=e;return(!i&&_>=r||i&&C>=r)&&(A=i?C-k:_-k),o&&ui(l,O,L),{placement:"top",maxHeight:A}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return c}function zw(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var pf=function(e){return e==="auto"?"bottom":e},Vw=function(e,n){var r,s=e.placement,o=e.theme,i=o.borderRadius,a=o.spacing,l=o.colors;return Me((r={label:"menu"},Ts(r,zw(s),"100%"),Ts(r,"position","absolute"),Ts(r,"width","100%"),Ts(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},mf=v.createContext(null),Hw=function(e){var n=e.children,r=e.minMenuHeight,s=e.maxMenuHeight,o=e.menuPlacement,i=e.menuPosition,a=e.menuShouldScrollIntoView,l=e.theme,c=v.useContext(mf)||{},d=c.setPortalPlacement,u=v.useRef(null),f=v.useState(s),g=Bn(f,2),m=g[0],p=g[1],y=v.useState(null),b=Bn(y,2),S=b[0],x=b[1],E=l.spacing.controlHeight;return Ml(function(){var k=u.current;if(k){var C=i==="fixed",N=a&&!C,_=Fw({maxHeight:s,menuEl:k,minHeight:r,placement:o,shouldScroll:N,isFixedPosition:C,controlHeight:E});p(_.maxHeight),x(_.placement),d?.(_.placement)}},[s,o,i,a,r,d,E]),n({ref:u,placerProps:Me(Me({},e),{},{placement:S||pf(o),maxHeight:m})})},Uw=function(e){var n=e.children,r=e.innerRef,s=e.innerProps;return Ee("div",Ae({},yt(e,"menu",{menu:!0}),{ref:r},s),n)},Bw=Uw,jw=function(e,n){var r=e.maxHeight,s=e.theme.spacing.baseUnit;return Me({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},Ww=function(e){var n=e.children,r=e.innerProps,s=e.innerRef,o=e.isMulti;return Ee("div",Ae({},yt(e,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:s},r),n)},bf=function(e,n){var r=e.theme,s=r.spacing.baseUnit,o=r.colors;return Me({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},Gw=bf,Yw=bf,Xw=function(e){var n=e.children,r=n===void 0?"No options":n,s=e.innerProps,o=Tn(e,Pw);return Ee("div",Ae({},yt(Me(Me({},o),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},Kw=function(e){var n=e.children,r=n===void 0?"Loading...":n,s=e.innerProps,o=Tn(e,$w);return Ee("div",Ae({},yt(Me(Me({},o),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},qw=function(e){var n=e.rect,r=e.offset,s=e.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},Zw=function(e){var n=e.appendTo,r=e.children,s=e.controlElement,o=e.innerProps,i=e.menuPlacement,a=e.menuPosition,l=v.useRef(null),c=v.useRef(null),d=v.useState(pf(i)),u=Bn(d,2),f=u[0],g=u[1],m=v.useMemo(function(){return{setPortalPlacement:g}},[]),p=v.useState(null),y=Bn(p,2),b=y[0],S=y[1],x=v.useCallback(function(){if(s){var N=Nw(s),_=a==="fixed"?0:window.pageYOffset,w=N[f]+_;(w!==b?.offset||N.left!==b?.rect.left||N.width!==b?.rect.width)&&S({offset:w,rect:N})}},[s,a,f,b?.offset,b?.rect.left,b?.rect.width]);Ml(function(){x()},[x]);var E=v.useCallback(function(){typeof c.current=="function"&&(c.current(),c.current=null),s&&l.current&&(c.current=ww(s,l.current,x,{elementResize:"ResizeObserver"in window}))},[s,x]);Ml(function(){E()},[E]);var k=v.useCallback(function(N){l.current=N,E()},[E]);if(!n&&a!=="fixed"||!b)return null;var C=Ee("div",Ae({ref:k},yt(Me(Me({},e),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),o),r);return Ee(mf.Provider,{value:m},n?On.createPortal(C,n):C)},Qw=function(e){var n=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},Jw=function(e){var n=e.children,r=e.innerProps,s=e.isDisabled,o=e.isRtl;return Ee("div",Ae({},yt(e,"container",{"--is-disabled":s,"--is-rtl":o}),r),n)},Rw=function(e,n){var r=e.theme.spacing,s=e.isMulti,o=e.hasValue,i=e.selectProps.controlShouldRenderValue;return Me({alignItems:"center",display:s&&o&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},e1=function(e){var n=e.children,r=e.innerProps,s=e.isMulti,o=e.hasValue;return Ee("div",Ae({},yt(e,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":o}),r),n)},t1=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},n1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"indicatorsContainer",{indicators:!0}),r),n)},yf,r1=["size"],s1=["innerProps","isRtl","size"],o1={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},vf=function(e){var n=e.size,r=Tn(e,r1);return Ee("svg",Ae({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:o1},r))},Nl=function(e){return Ee(vf,Ae({size:20},e),Ee("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},xf=function(e){return Ee(vf,Ae({size:20},e),Ee("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},wf=function(e,n){var r=e.isFocused,s=e.theme,o=s.spacing.baseUnit,i=s.colors;return Me({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:o*2,":hover":{color:r?i.neutral80:i.neutral40}})},i1=wf,a1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Ee(xf,null))},l1=wf,c1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Ee(Nl,null))},d1=function(e,n){var r=e.isDisabled,s=e.theme,o=s.spacing.baseUnit,i=s.colors;return Me({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:o*2,marginTop:o*2})},u1=function(e){var n=e.innerProps;return Ee("span",Ae({},n,yt(e,"indicatorSeparator",{"indicator-separator":!0})))},f1=aw(yf||(yf=lw([` + `})]}):null},Qv=(t,e)=>window.G7Core?.t?.(t,e)??t,Jv=({options:t})=>{const e=document.documentElement.classList.contains("dark"),n=e?"rgb(17,24,39)":"rgb(249,250,251)",r=e?"#6b7280":"#9ca3af",s=e?"#9ca3af":"#6b7280";return h.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[h.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${r}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),h.jsx("span",{style:{color:s,fontSize:"14px"},children:t?.text||Qv("nav.loading")})]})};function hr(t){"@babel/helpers - typeof";return hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hr(t)}function Rv(t,e){if(hr(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(hr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ou(t){var e=Rv(t,"string");return hr(e)=="symbol"?e:e+""}function Ts(t,e,n){return(e=Ou(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Me(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n0?It(Br,--qt):0,Ur--,kt===10&&(Ur=1,Qo--),kt}function on(){return kt=qt2||Ls(kt)>3?"":" "}function Mx(t,e){for(;--e&&on()&&!(kt<48||kt>102||kt>57&&kt<65||kt>70&&kt<97););return Is(t,Ro()+(e<6&&Dn()==32&&on()==32))}function pl(t){for(;on();)switch(kt){case t:return qt;case 34:case 39:t!==34&&t!==39&&pl(kt);break;case 40:t===41&&pl(t);break;case 92:on();break}return qt}function Nx(t,e){for(;on()&&t+kt!==57;)if(t+kt===84&&Dn()===47)break;return"/*"+Is(e,qt-1)+"*"+qo(t===47?t:on())}function Ox(t){for(;!Ls(Dn());)on();return Is(t,qt)}function Tx(t){return Hu(ti("",null,null,null,[""],t=Vu(t),0,[0],t))}function ti(t,e,n,r,s,o,i,a,l){for(var c=0,d=0,u=i,f=0,g=0,m=0,p=1,y=1,b=1,S=0,x="",E=s,k=o,C=r,N=x;y;)switch(m=S,S=on()){case 40:if(m!=108&&It(N,u-1)==58){hl(N+=nt(ei(S),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=ei(S);break;case 9:case 10:case 13:case 32:N+=Ex(m);break;case 92:N+=Mx(Ro()-1,7);continue;case 47:switch(Dn()){case 42:case 47:Zo(Ax(Nx(on(),Ro()),e,n),l);break;default:N+="/"}break;case 123*p:a[c++]=An(N)*b;case 125*p:case 59:case 0:switch(S){case 0:case 125:y=0;case 59+d:b==-1&&(N=nt(N,/\f/g,"")),g>0&&An(N)-u&&Zo(g>32?Bu(N+";",r,n,u-1):Bu(nt(N," ","")+";",r,n,u-2),l);break;case 59:N+=";";default:if(Zo(C=Uu(N,e,n,c,d,s,a,x,E=[],k=[],u),o),S===123)if(d===0)ti(N,e,C,C,E,o,u,a,k);else switch(f===99&&It(N,3)===110?100:f){case 100:case 108:case 109:case 115:ti(t,C,C,r&&Zo(Uu(t,C,C,0,0,s,a,x,s,E=[],u),k),s,k,u,a,r?E:k);break;default:ti(N,C,C,C,[""],k,0,a,k)}}c=d=g=0,p=b=1,x=N="",u=i;break;case 58:u=1+An(N),g=m;default:if(p<1){if(S==123)--p;else if(S==125&&p++==0&&_x()==125)continue}switch(N+=qo(S),S*p){case 38:b=d>0?1:(N+="\f",-1);break;case 44:a[c++]=(An(N)-1)*b,b=1;break;case 64:Dn()===45&&(N+=ei(on())),f=Dn(),d=u=An(x=N+=Ox(Ro())),S++;break;case 45:m===45&&An(N)==2&&(p=0)}}return o}function Uu(t,e,n,r,s,o,i,a,l,c,d){for(var u=s-1,f=s===0?o:[""],g=gl(f),m=0,p=0,y=0;m0?f[b]+" "+S:nt(S,/&\f/g,f[b])))&&(l[y++]=x);return Jo(t,e,n,s===0?ul:a,l,c,d)}function Ax(t,e,n){return Jo(t,e,n,Pu,qo(Sx()),As(t,2,-2),0)}function Bu(t,e,n,r){return Jo(t,e,n,fl,As(t,0,r),As(t,r+1,-1),r)}function jr(t,e){for(var n="",r=gl(t),s=0;s6)switch(It(t,e+1)){case 109:if(It(t,e+4)!==45)break;case 102:return nt(t,/(.+:)(.+)-([^]+)/,"$1"+tt+"$2-$3$1"+Ko+(It(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~hl(t,"stretch")?Wu(nt(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(It(t,e+1)!==115)break;case 6444:switch(It(t,An(t)-3-(~hl(t,"!important")&&10))){case 107:return nt(t,":",":"+tt)+t;case 101:return nt(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+tt+(It(t,14)===45?"inline-":"")+"box$3$1"+tt+"$2$3$1"+$t+"$2box$3")+t}break;case 5936:switch(It(t,e+11)){case 114:return tt+t+$t+nt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return tt+t+$t+nt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return tt+t+$t+nt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return tt+t+$t+t+t}return t}var Ux=function(e,n,r,s){if(e.length>-1&&!e.return)switch(e.type){case fl:e.return=Wu(e.value,e.length);break;case $u:return jr([Ds(e,{value:nt(e.value,"@","@"+tt)})],s);case ul:if(e.length)return Cx(e.props,function(o){switch(kx(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return jr([Ds(e,{props:[nt(o,/:(read-\w+)/,":"+Ko+"$1")]})],s);case"::placeholder":return jr([Ds(e,{props:[nt(o,/:(plac\w+)/,":"+tt+"input-$1")]}),Ds(e,{props:[nt(o,/:(plac\w+)/,":"+Ko+"$1")]}),Ds(e,{props:[nt(o,/:(plac\w+)/,$t+"input-$1")]})],s)}return""})}},Bx=[Ux],jx=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var s=e.stylisPlugins||Bx,o={},i,a=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;b=4;++r,s-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(s){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var Qx={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Jx=/[A-Z]|^ms/g,Rx=/_EMO_([^_]+?)_([^]*?)_EMO_/g,qu=function(e){return e.charCodeAt(1)===45},Zu=function(e){return e!=null&&typeof e!="boolean"},yl=Px(function(t){return qu(t)?t:t.replace(Jx,"-$&").toLowerCase()}),Qu=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(Rx,function(r,s,o){return In={name:s,styles:o,next:In},s})}return Qx[e]!==1&&!qu(e)&&typeof n=="number"&&n!==0?n+"px":n};function Ps(t,e,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return In={name:s.name,styles:s.styles,next:In},s.name;var o=n;if(o.styles!==void 0){var i=o.next;if(i!==void 0)for(;i!==void 0;)In={name:i.name,styles:i.styles,next:In},i=i.next;var a=o.styles+";";return a}return ew(t,e,n)}case"function":{if(t!==void 0){var l=In,c=n(t);return In=l,Ps(t,e,c)}break}}var d=n;return d}function ew(t,e,n){var r="";if(Array.isArray(n))for(var s=0;s({x:t,y:t});function gw(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function oi(){return typeof window<"u"}function tf(t){return rf(t)?(t.nodeName||"").toLowerCase():"#document"}function jn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function nf(t){var e;return(e=(rf(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rf(t){return oi()?t instanceof Node||t instanceof jn(t).Node:!1}function pw(t){return oi()?t instanceof Element||t instanceof jn(t).Element:!1}function kl(t){return oi()?t instanceof HTMLElement||t instanceof jn(t).HTMLElement:!1}function sf(t){return!oi()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof jn(t).ShadowRoot}function of(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Sl(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}let Cl;function mw(){return Cl==null&&(Cl=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cl}function bw(t){return/^(html|body|#document)$/.test(tf(t))}function Sl(t){return jn(t).getComputedStyle(t)}function yw(t){if(tf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||sf(t)&&t.host||nf(t);return sf(e)?e.host:e}function af(t){const e=yw(t);return bw(e)?t.ownerDocument?t.ownerDocument.body:t.body:kl(e)&&of(e)?e:af(e)}function ii(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=af(t),o=s===((r=t.ownerDocument)==null?void 0:r.body),i=jn(s);if(o){const a=_l(i);return e.concat(i,i.visualViewport||[],of(s)?s:[],a&&n?ii(a):[])}else return e.concat(s,ii(s,[],n))}function _l(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function vw(t){const e=Sl(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=kl(t),o=s?t.offsetWidth:n,i=s?t.offsetHeight:r,a=ni(n)!==o||ni(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function El(t){return pw(t)?t:t.contextElement}function lf(t){const e=El(t);if(!kl(e))return si(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:o}=vw(e);let i=(o?ni(n.width):n.width)/r,a=(o?ni(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const xw=si(0);function ww(t){const e=jn(t);return!mw()||!e.visualViewport?xw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function kw(t,e,n){return!1}function cf(t,e,n,r){e===void 0&&(e=!1);const s=t.getBoundingClientRect(),o=El(t);let i=si(1);e&&(i=lf(t));const a=kw()?ww(o):si(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,d=s.width/i.x,u=s.height/i.y;if(o){const f=jn(o),g=r;let m=f,p=_l(m);for(;p&&r&&g!==m;){const y=lf(p),b=p.getBoundingClientRect(),S=Sl(p),x=b.left+(p.clientLeft+parseFloat(S.paddingLeft))*y.x,E=b.top+(p.clientTop+parseFloat(S.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=x,c+=E,m=jn(p),p=_l(m)}}return gw({width:d,height:u,x:l,y:c})}function df(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Cw(t,e){let n=null,r;const s=nf(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=t.getBoundingClientRect(),{left:d,top:u,width:f,height:g}=c;if(a||e(),!f||!g)return;const m=ri(u),p=ri(s.clientWidth-(d+f)),y=ri(s.clientHeight-(u+g)),b=ri(d),x={rootMargin:-m+"px "+-p+"px "+-y+"px "+-b+"px",threshold:hw(0,fw(1,l))||1};let E=!0;function k(C){const N=C[0].intersectionRatio;if(N!==l){if(!E)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!df(c,t.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(k,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(k,x)}n.observe(t)}return i(!0),o}function Sw(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=El(t),d=s||o?[...c?ii(c):[],...e?ii(e):[]]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const u=c&&a?Cw(c,n):null;let f=-1,g=null;i&&(g=new ResizeObserver(b=>{let[S]=b;S&&S.target===c&&g&&e&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(e)})),n()}),c&&!l&&g.observe(c),e&&g.observe(e));let m,p=l?cf(t):null;l&&y();function y(){const b=cf(t);p&&!df(p,b)&&n(),p=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(S=>{s&&S.removeEventListener("scroll",n),o&&S.removeEventListener("resize",n)}),u?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(m)}}var Ml=v.useLayoutEffect,_w=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],ai=function(){};function Ew(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function Mw(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s-1}function Nw(t){return ci(t)?window.innerHeight:t.clientHeight}function ff(t){return ci(t)?window.pageYOffset:t.scrollTop}function di(t,e){if(ci(t)){window.scrollTo(0,e);return}t.scrollTop=e}function Ow(t){var e=getComputedStyle(t),n=e.position==="absolute",r=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var s=t;s=s.parentElement;)if(e=getComputedStyle(s),!(n&&e.position==="static")&&r.test(e.overflow+e.overflowY+e.overflowX))return s;return document.documentElement}function Tw(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e}function ui(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ai,s=ff(t),o=e-s,i=10,a=0;function l(){a+=i;var c=Tw(a,s,o,n);di(t,c),an.bottom?di(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+s,t.scrollHeight)):r.top-s1?n-1:0),s=1;s=m)return{placement:"bottom",maxHeight:e};if(w>=m&&!i)return o&&ui(l,M,L),{placement:"bottom",maxHeight:e};if(!i&&w>=r||i&&N>=r){o&&ui(l,M,L);var F=i?N-E:w-E;return{placement:"bottom",maxHeight:F}}if(s==="auto"||i){var $=e,D=i?C:_;return D>=r&&($=Math.min(D-E-a,e)),{placement:"top",maxHeight:$}}if(s==="bottom")return o&&di(l,M),{placement:"bottom",maxHeight:e};break;case"top":if(C>=m)return{placement:"top",maxHeight:e};if(_>=m&&!i)return o&&ui(l,O,L),{placement:"top",maxHeight:e};if(!i&&_>=r||i&&C>=r){var A=e;return(!i&&_>=r||i&&C>=r)&&(A=i?C-k:_-k),o&&ui(l,O,L),{placement:"top",maxHeight:A}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return c}function Uw(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var mf=function(e){return e==="auto"?"bottom":e},Bw=function(e,n){var r,s=e.placement,o=e.theme,i=o.borderRadius,a=o.spacing,l=o.colors;return Me((r={label:"menu"},Ts(r,Uw(s),"100%"),Ts(r,"position","absolute"),Ts(r,"width","100%"),Ts(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},bf=v.createContext(null),jw=function(e){var n=e.children,r=e.minMenuHeight,s=e.maxMenuHeight,o=e.menuPlacement,i=e.menuPosition,a=e.menuShouldScrollIntoView,l=e.theme,c=v.useContext(bf)||{},d=c.setPortalPlacement,u=v.useRef(null),f=v.useState(s),g=Bn(f,2),m=g[0],p=g[1],y=v.useState(null),b=Bn(y,2),S=b[0],x=b[1],E=l.spacing.controlHeight;return Ml(function(){var k=u.current;if(k){var C=i==="fixed",N=a&&!C,_=Hw({maxHeight:s,menuEl:k,minHeight:r,placement:o,shouldScroll:N,isFixedPosition:C,controlHeight:E});p(_.maxHeight),x(_.placement),d?.(_.placement)}},[s,o,i,a,r,d,E]),n({ref:u,placerProps:Me(Me({},e),{},{placement:S||mf(o),maxHeight:m})})},Ww=function(e){var n=e.children,r=e.innerRef,s=e.innerProps;return Ee("div",Ae({},yt(e,"menu",{menu:!0}),{ref:r},s),n)},Gw=Ww,Yw=function(e,n){var r=e.maxHeight,s=e.theme.spacing.baseUnit;return Me({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},Xw=function(e){var n=e.children,r=e.innerProps,s=e.innerRef,o=e.isMulti;return Ee("div",Ae({},yt(e,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:s},r),n)},yf=function(e,n){var r=e.theme,s=r.spacing.baseUnit,o=r.colors;return Me({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},Kw=yf,qw=yf,Zw=function(e){var n=e.children,r=n===void 0?"No options":n,s=e.innerProps,o=Tn(e,zw);return Ee("div",Ae({},yt(Me(Me({},o),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},Qw=function(e){var n=e.children,r=n===void 0?"Loading...":n,s=e.innerProps,o=Tn(e,Vw);return Ee("div",Ae({},yt(Me(Me({},o),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},Jw=function(e){var n=e.rect,r=e.offset,s=e.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},Rw=function(e){var n=e.appendTo,r=e.children,s=e.controlElement,o=e.innerProps,i=e.menuPlacement,a=e.menuPosition,l=v.useRef(null),c=v.useRef(null),d=v.useState(mf(i)),u=Bn(d,2),f=u[0],g=u[1],m=v.useMemo(function(){return{setPortalPlacement:g}},[]),p=v.useState(null),y=Bn(p,2),b=y[0],S=y[1],x=v.useCallback(function(){if(s){var N=Aw(s),_=a==="fixed"?0:window.pageYOffset,w=N[f]+_;(w!==b?.offset||N.left!==b?.rect.left||N.width!==b?.rect.width)&&S({offset:w,rect:N})}},[s,a,f,b?.offset,b?.rect.left,b?.rect.width]);Ml(function(){x()},[x]);var E=v.useCallback(function(){typeof c.current=="function"&&(c.current(),c.current=null),s&&l.current&&(c.current=Sw(s,l.current,x,{elementResize:"ResizeObserver"in window}))},[s,x]);Ml(function(){E()},[E]);var k=v.useCallback(function(N){l.current=N,E()},[E]);if(!n&&a!=="fixed"||!b)return null;var C=Ee("div",Ae({ref:k},yt(Me(Me({},e),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),o),r);return Ee(bf.Provider,{value:m},n?On.createPortal(C,n):C)},e1=function(e){var n=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},t1=function(e){var n=e.children,r=e.innerProps,s=e.isDisabled,o=e.isRtl;return Ee("div",Ae({},yt(e,"container",{"--is-disabled":s,"--is-rtl":o}),r),n)},n1=function(e,n){var r=e.theme.spacing,s=e.isMulti,o=e.hasValue,i=e.selectProps.controlShouldRenderValue;return Me({alignItems:"center",display:s&&o&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},r1=function(e){var n=e.children,r=e.innerProps,s=e.isMulti,o=e.hasValue;return Ee("div",Ae({},yt(e,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":o}),r),n)},s1=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},o1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"indicatorsContainer",{indicators:!0}),r),n)},vf,i1=["size"],a1=["innerProps","isRtl","size"],l1={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},xf=function(e){var n=e.size,r=Tn(e,i1);return Ee("svg",Ae({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:l1},r))},Nl=function(e){return Ee(xf,Ae({size:20},e),Ee("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},wf=function(e){return Ee(xf,Ae({size:20},e),Ee("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},kf=function(e,n){var r=e.isFocused,s=e.theme,o=s.spacing.baseUnit,i=s.colors;return Me({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:o*2,":hover":{color:r?i.neutral80:i.neutral40}})},c1=kf,d1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Ee(wf,null))},u1=kf,f1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Ee(Nl,null))},h1=function(e,n){var r=e.isDisabled,s=e.theme,o=s.spacing.baseUnit,i=s.colors;return Me({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:o*2,marginTop:o*2})},g1=function(e){var n=e.innerProps;return Ee("span",Ae({},n,yt(e,"indicatorSeparator",{"indicator-separator":!0})))},p1=dw(vf||(vf=uw([` 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } -`]))),h1=function(e,n){var r=e.isFocused,s=e.size,o=e.theme,i=o.colors,a=o.spacing.baseUnit;return Me({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:a*2})},Ol=function(e){var n=e.delay,r=e.offset;return Ee("span",{css:wl({animation:"".concat(f1," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},g1=function(e){var n=e.innerProps,r=e.isRtl,s=e.size,o=s===void 0?4:s,i=Tn(e,s1);return Ee("div",Ae({},yt(Me(Me({},i),{},{innerProps:n,isRtl:r,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Ee(Ol,{delay:0,offset:r}),Ee(Ol,{delay:160,offset:!0}),Ee(Ol,{delay:320,offset:!r}))},p1=function(e,n){var r=e.isDisabled,s=e.isFocused,o=e.theme,i=o.colors,a=o.borderRadius,l=o.spacing;return Me({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:s?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:s?i.primary:i.neutral30}})},m1=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,o=e.innerRef,i=e.innerProps,a=e.menuIsOpen;return Ee("div",Ae({ref:o},yt(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":a}),i,{"aria-disabled":r||void 0}),n)},b1=m1,y1=["data"],v1=function(e,n){var r=e.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},x1=function(e){var n=e.children,r=e.cx,s=e.getStyles,o=e.getClassNames,i=e.Heading,a=e.headingProps,l=e.innerProps,c=e.label,d=e.theme,u=e.selectProps;return Ee("div",Ae({},yt(e,"group",{group:!0}),l),Ee(i,Ae({},a,{selectProps:u,theme:d,getStyles:s,getClassNames:o,cx:r}),c),Ee("div",null,n))},w1=function(e,n){var r=e.theme,s=r.colors,o=r.spacing;return Me({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},k1=function(e){var n=df(e);n.data;var r=Tn(n,y1);return Ee("div",Ae({},yt(e,"groupHeading",{"group-heading":!0}),r))},C1=x1,S1=["innerRef","isDisabled","isHidden","inputClassName"],_1=function(e,n){var r=e.isDisabled,s=e.value,o=e.theme,i=o.spacing,a=o.colors;return Me(Me({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},E1),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},kf={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},E1={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Me({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},kf)},M1=function(e){return Me({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},kf)},N1=function(e){var n=e.cx,r=e.value,s=df(e),o=s.innerRef,i=s.isDisabled,a=s.isHidden,l=s.inputClassName,c=Tn(s,S1);return Ee("div",Ae({},yt(e,"input",{"input-container":!0}),{"data-value":r||""}),Ee("input",Ae({className:n({input:!0},l),ref:o,style:M1(a),disabled:i},c)))},O1=N1,T1=function(e,n){var r=e.theme,s=r.spacing,o=r.borderRadius,i=r.colors;return Me({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:o/2,margin:s.baseUnit/2})},A1=function(e,n){var r=e.theme,s=r.borderRadius,o=r.colors,i=e.cropWithEllipsis;return Me({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},D1=function(e,n){var r=e.theme,s=r.spacing,o=r.borderRadius,i=r.colors,a=e.isFocused;return Me({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},Cf=function(e){var n=e.children,r=e.innerProps;return Ee("div",r,n)},I1=Cf,L1=Cf;function P1(t){var e=t.children,n=t.innerProps;return Ee("div",Ae({role:"button"},n),e||Ee(Nl,{size:14}))}var $1=function(e){var n=e.children,r=e.components,s=e.data,o=e.innerProps,i=e.isDisabled,a=e.removeProps,l=e.selectProps,c=r.Container,d=r.Label,u=r.Remove;return Ee(c,{data:s,innerProps:Me(Me({},yt(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),o),selectProps:l},Ee(d,{data:s,innerProps:Me({},yt(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),Ee(u,{data:s,innerProps:Me(Me({},yt(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},a),selectProps:l}))},F1=$1,z1=function(e,n){var r=e.isDisabled,s=e.isFocused,o=e.isSelected,i=e.theme,a=i.spacing,l=i.colors;return Me({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:o?l.primary:l.primary50}})},V1=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,o=e.isSelected,i=e.innerRef,a=e.innerProps;return Ee("div",Ae({},yt(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":o}),{ref:i,"aria-disabled":r},a),n)},H1=V1,U1=function(e,n){var r=e.theme,s=r.spacing,o=r.colors;return Me({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},B1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"placeholder",{placeholder:!0}),r),n)},j1=B1,W1=function(e,n){var r=e.isDisabled,s=e.theme,o=s.spacing,i=s.colors;return Me({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},G1=function(e){var n=e.children,r=e.isDisabled,s=e.innerProps;return Ee("div",Ae({},yt(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},Y1=G1,hi={ClearIndicator:c1,Control:b1,DropdownIndicator:a1,DownChevron:xf,CrossIcon:Nl,Group:C1,GroupHeading:k1,IndicatorsContainer:n1,IndicatorSeparator:u1,Input:O1,LoadingIndicator:g1,Menu:Bw,MenuList:Ww,MenuPortal:Zw,LoadingMessage:Kw,NoOptionsMessage:Xw,MultiValue:F1,MultiValueContainer:I1,MultiValueLabel:L1,MultiValueRemove:P1,Option:H1,Placeholder:j1,SelectContainer:Jw,SingleValue:Y1,ValueContainer:e1},X1=function(e){return Me(Me({},hi),e.components)},Sf=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function K1(t,e){return!!(t===e||Sf(t)&&Sf(e))}function q1(t,e){if(t.length!==e.length)return!1;for(var n=0;n1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return i?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(e){var n=e.context,r=e.focused,s=e.options,o=e.label,i=o===void 0?"":o,a=e.selectValue,l=e.isDisabled,c=e.isSelected,d=e.isAppleDevice,u=function(p,y){return p&&p.length?"".concat(p.indexOf(y)+1," of ").concat(p.length):""};if(n==="value"&&a)return"value ".concat(i," focused, ").concat(u(a,r),".");if(n==="menu"&&d){var f=l?" disabled":"",g="".concat(c?" selected":"").concat(f);return"".concat(i).concat(g,", ").concat(u(s,r),".")}return""},onFilter:function(e){var n=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},ek=function(e){var n=e.ariaSelection,r=e.focusedOption,s=e.focusedValue,o=e.focusableOptions,i=e.isFocused,a=e.selectValue,l=e.selectProps,c=e.id,d=e.isAppleDevice,u=l.ariaLiveMessages,f=l.getOptionLabel,g=l.inputValue,m=l.isMulti,p=l.isOptionDisabled,y=l.isSearchable,b=l.menuIsOpen,S=l.options,x=l.screenReaderStatus,E=l.tabSelectsValue,k=l.isLoading,C=l["aria-label"],N=l["aria-live"],_=v.useMemo(function(){return Me(Me({},R1),u||{})},[u]),w=v.useMemo(function(){var D="";if(n&&_.onChange){var A=n.option,T=n.options,z=n.removedValue,H=n.removedValues,W=n.value,j=function(Z){return Array.isArray(Z)?null:Z},U=z||A||j(W),B=U?f(U):"",G=T||H||void 0,V=G?G.map(f):[],K=Me({isDisabled:U&&p(U,a),label:B,labels:V},n);D=_.onChange(K)}return D},[n,_,p,a,f]),M=v.useMemo(function(){var D="",A=r||s,T=!!(r&&a&&a.includes(r));if(A&&_.onFocus){var z={focused:A,label:f(A),isDisabled:p(A,a),isSelected:T,options:o,context:A===r?"menu":"value",selectValue:a,isAppleDevice:d};D=_.onFocus(z)}return D},[r,s,f,p,_,o,a,d]),O=v.useMemo(function(){var D="";if(b&&S.length&&!k&&_.onFilter){var A=x({count:o.length});D=_.onFilter({inputValue:g,resultsMessage:A})}return D},[o,g,b,_,S,x,k]),L=n?.action==="initial-input-focus",F=v.useMemo(function(){var D="";if(_.guidance){var A=s?"value":b?"menu":"input";D=_.guidance({"aria-label":C,context:A,isDisabled:r&&p(r,a),isMulti:m,isSearchable:y,tabSelectsValue:E,isInitialFocus:L})}return D},[C,r,s,m,p,y,b,_,a,E,L]),$=Ee(v.Fragment,null,Ee("span",{id:"aria-selection"},w),Ee("span",{id:"aria-focused"},M),Ee("span",{id:"aria-results"},O),Ee("span",{id:"aria-guidance"},F));return Ee(v.Fragment,null,Ee(_f,{id:c},L&&$),Ee(_f,{"aria-live":N,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!L&&$))},tk=ek,Tl=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],nk=new RegExp("["+Tl.map(function(t){return t.letters}).join("")+"]","g"),Ef={},Al=0;Al-1}},ik=["innerRef"];function ak(t){var e=t.innerRef,n=Tn(t,ik),r=Lw(n,"onExited","in","enter","exit","appear");return Ee("input",Ae({ref:e},r,{css:wl({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var lk=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function ck(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,s=t.onTopArrive,o=t.onTopLeave,i=v.useRef(!1),a=v.useRef(!1),l=v.useRef(0),c=v.useRef(null),d=v.useCallback(function(y,b){if(c.current!==null){var S=c.current,x=S.scrollTop,E=S.scrollHeight,k=S.clientHeight,C=c.current,N=b>0,_=E-k-x,w=!1;_>b&&i.current&&(r&&r(y),i.current=!1),N&&a.current&&(o&&o(y),a.current=!1),N&&b>_?(n&&!i.current&&n(y),C.scrollTop=E,w=!0,i.current=!0):!N&&-b>x&&(s&&!a.current&&s(y),C.scrollTop=0,w=!0,a.current=!0),w&&lk(y)}},[n,r,s,o]),u=v.useCallback(function(y){d(y,y.deltaY)},[d]),f=v.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),g=v.useCallback(function(y){var b=l.current-y.changedTouches[0].clientY;d(y,b)},[d]),m=v.useCallback(function(y){if(y){var b=Aw?{passive:!1}:!1;y.addEventListener("wheel",u,b),y.addEventListener("touchstart",f,b),y.addEventListener("touchmove",g,b)}},[g,f,u]),p=v.useCallback(function(y){y&&(y.removeEventListener("wheel",u,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",g,!1))},[g,f,u]);return v.useEffect(function(){if(e){var y=c.current;return m(y),function(){p(y)}}},[e,m,p]),function(y){c.current=y}}var Of=["boxSizing","height","overflow","paddingRight","position"],Tf={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Af(t){t.cancelable&&t.preventDefault()}function Df(t){t.stopPropagation()}function If(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function Lf(){return"ontouchstart"in window||navigator.maxTouchPoints}var Pf=!!(typeof window<"u"&&window.document&&window.document.createElement),Fs=0,Wr={capture:!1,passive:!1};function dk(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,s=v.useRef({}),o=v.useRef(null),i=v.useCallback(function(l){if(Pf){var c=document.body,d=c&&c.style;if(r&&Of.forEach(function(m){var p=d&&d[m];s.current[m]=p}),r&&Fs<1){var u=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,g=window.innerWidth-f+u||0;Object.keys(Tf).forEach(function(m){var p=Tf[m];d&&(d[m]=p)}),d&&(d.paddingRight="".concat(g,"px"))}c&&Lf()&&(c.addEventListener("touchmove",Af,Wr),l&&(l.addEventListener("touchstart",If,Wr),l.addEventListener("touchmove",Df,Wr))),Fs+=1}},[r]),a=v.useCallback(function(l){if(Pf){var c=document.body,d=c&&c.style;Fs=Math.max(Fs-1,0),r&&Fs<1&&Of.forEach(function(u){var f=s.current[u];d&&(d[u]=f)}),c&&Lf()&&(c.removeEventListener("touchmove",Af,Wr),l&&(l.removeEventListener("touchstart",If,Wr),l.removeEventListener("touchmove",Df,Wr)))}},[r]);return v.useEffect(function(){if(e){var l=o.current;return i(l),function(){a(l)}}},[e,i,a]),function(l){o.current=l}}var uk=function(e){var n=e.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},fk={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function hk(t){var e=t.children,n=t.lockEnabled,r=t.captureEnabled,s=r===void 0?!0:r,o=t.onBottomArrive,i=t.onBottomLeave,a=t.onTopArrive,l=t.onTopLeave,c=ck({isEnabled:s,onBottomArrive:o,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),d=dk({isEnabled:n}),u=function(g){c(g),d(g)};return Ee(v.Fragment,null,n&&Ee("div",{onClick:uk,css:fk}),e(u))}var gk={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},pk=function(e){var n=e.name,r=e.onFocus;return Ee("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:gk,value:"",onChange:function(){}})},mk=pk;function Ll(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function bk(){return Ll(/^iPhone/i)}function $f(){return Ll(/^Mac/i)}function yk(){return Ll(/^iPad/i)||$f()&&navigator.maxTouchPoints>1}function vk(){return bk()||yk()}function xk(){return $f()||vk()}var wk=function(e){return e.label},Ff=function(e){return e.label},zf=function(e){return e.value},kk=function(e){return!!e.isDisabled},Ck={clearIndicator:l1,container:Qw,control:p1,dropdownIndicator:i1,group:v1,groupHeading:w1,indicatorsContainer:t1,indicatorSeparator:d1,input:_1,loadingIndicator:h1,loadingMessage:Yw,menu:Vw,menuList:jw,menuPortal:qw,multiValue:T1,multiValueLabel:A1,multiValueRemove:D1,noOptionsMessage:Gw,option:z1,placeholder:U1,singleValue:W1,valueContainer:Rw},Sk={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},_k=4,Vf=4,Ek=38,Mk=Vf*2,Nk={baseUnit:Vf,controlHeight:Ek,menuGutter:Mk},Pl={borderRadius:_k,colors:Sk,spacing:Nk},Ok={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:hf(),captureMenuScroll:!hf(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:ok(),formatGroupLabel:wk,getOptionLabel:Ff,getOptionValue:zf,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:kk,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Ow(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var n=e.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Hf(t,e,n,r){var s=Gf(t,e,n),o=Yf(t,e,n),i=Wf(t,e),a=pi(t,e);return{type:"option",data:e,isDisabled:s,isSelected:o,label:i,value:a,index:r}}function gi(t,e){return t.options.map(function(n,r){if("options"in n){var s=n.options.map(function(i,a){return Hf(t,i,e,a)}).filter(function(i){return jf(t,i)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var o=Hf(t,n,e,r);return jf(t,o)?o:void 0}).filter(Dw)}function Uf(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,Hr(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function Bf(t,e){return t.reduce(function(n,r){return r.type==="group"?n.push.apply(n,Hr(r.options.map(function(s){return{data:s.data,id:"".concat(e,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(e,"-").concat(r.index)}),n},[])}function Tk(t,e){return Uf(gi(t,e))}function jf(t,e){var n=t.inputValue,r=n===void 0?"":n,s=e.data,o=e.isSelected,i=e.label,a=e.value;return(!Kf(t)||!o)&&Xf(t,{label:i,value:a,data:s},r)}function Ak(t,e){var n=t.focusedValue,r=t.selectValue,s=r.indexOf(n);if(s>-1){var o=e.indexOf(n);if(o>-1)return n;if(s-1?n:e[0]}var $l=function(e,n){var r,s=(r=e.find(function(o){return o.data===n}))===null||r===void 0?void 0:r.id;return s||null},Wf=function(e,n){return e.getOptionLabel(n)},pi=function(e,n){return e.getOptionValue(n)};function Gf(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function Yf(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=pi(t,e);return n.some(function(s){return pi(t,s)===r})}function Xf(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var Kf=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},Ik=1,Fl=(function(t){sx(n,t);var e=ax(n);function n(r){var s;if(nx(this,n),s=e.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,c){var d=s.props,u=d.onChange,f=d.name;c.name=f,s.ariaOnChange(l,c),u(l,c)},s.setValue=function(l,c,d){var u=s.props,f=u.closeMenuOnSelect,g=u.isMulti,m=u.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:m}),f&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:c,option:d})},s.selectOption=function(l){var c=s.props,d=c.blurInputOnSelect,u=c.isMulti,f=c.name,g=s.state.selectValue,m=u&&s.isOptionSelected(l,g),p=s.isOptionDisabled(l,g);if(m){var y=s.getOptionValue(l);s.setValue(g.filter(function(b){return s.getOptionValue(b)!==y}),"deselect-option",l)}else if(!p)u?s.setValue([].concat(Hr(g),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var c=s.props.isMulti,d=s.state.selectValue,u=s.getOptionValue(l),f=d.filter(function(m){return s.getOptionValue(m)!==u}),g=$s(c,f,f[0]||null);s.onChange(g,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange($s(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,c=s.state.selectValue,d=c[c.length-1],u=c.slice(0,c.length-1),f=$s(l,u,u[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return $l(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return Bf(gi(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,c=new Array(l),d=0;dg||f>g}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var c=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:c}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var c=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:c}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var c=s.getFocusableOptions(),d=c.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return Kf(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var c=s.props,d=c.isMulti,u=c.backspaceRemovesValue,f=c.escapeClearsValue,g=c.inputValue,m=c.isClearable,p=c.isDisabled,y=c.menuIsOpen,b=c.onKeyDown,S=c.tabSelectsValue,x=c.openMenuOnFocus,E=s.state,k=E.focusedOption,C=E.focusedValue,N=E.selectValue;if(!p&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(C)s.removeValue(C);else{if(!u)return;d?s.popValue():m&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!S||!k||x&&s.isOptionSelected(k,N))return;s.selectOption(k);break;case"Enter":if(l.keyCode===229)break;if(y){if(!k||s.isComposing)return;s.selectOption(k);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):m&&f&&s.clearValue();break;case" ":if(g)return;if(!y){s.openMenu("first");break}if(!k)return;s.selectOption(k);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++Ik),s.state.selectValue=li(r.value),r.menuIsOpen&&s.state.selectValue.length){var o=s.getFocusableOptionsWithIds(),i=s.buildFocusableOptions(),a=i.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=o,s.state.focusedOption=i[a],s.state.focusedOptionId=$l(o,i[a])}return s}return rx(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&ff(this.menuListRef,this.focusedOptionRef),xk()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!i&&s.isDisabled||l&&a&&!s.menuIsOpen)&&this.focusInput(),l&&i&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(ff(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,o){this.props.onInputChange(s,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var o=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),d=s==="first"?0:c.length-1;if(!this.props.isMulti){var u=c.indexOf(a[0]);u>-1&&(d=u)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[d],focusedOptionId:this.getFocusedOptionId(c[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(s){var o=this.state,i=o.selectValue,a=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,d=-1;if(i.length){switch(s){case"previous":l===0?d=0:l===-1?d=c:d=l-1;break;case"next":l>-1&&l0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),s==="up"?l=c>0?c-1:a.length-1:s==="down"?l=(c+1)%a.length:s==="pageup"?(l=c-o,l<0&&(l=0)):s==="pagedown"?(l=c+o,l>a.length-1&&(l=a.length-1)):s==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Pl):Me(Me({},Pl),this.props.theme):Pl})},{key:"getCommonProps",value:function(){var s=this.clearValue,o=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,d=this.setValue,u=this.props,f=u.isMulti,g=u.isRtl,m=u.options,p=this.hasValue();return{clearValue:s,cx:o,getStyles:i,getClassNames:a,getValue:l,hasValue:p,isMulti:f,isRtl:g,options:m,selectOption:c,selectProps:u,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,o=s.isClearable,i=s.isMulti;return o===void 0?i:o}},{key:"isOptionDisabled",value:function(s,o){return Gf(this.props,s,o)}},{key:"isOptionSelected",value:function(s,o){return Yf(this.props,s,o)}},{key:"filterOption",value:function(s,o){return Xf(this.props,s,o)}},{key:"formatOptionLabel",value:function(s,o){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(s,{context:o,inputValue:i,selectValue:a})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var s=this.props,o=s.isDisabled,i=s.isSearchable,a=s.inputId,l=s.inputValue,c=s.tabIndex,d=s.form,u=s.menuIsOpen,f=s.required,g=this.getComponents(),m=g.Input,p=this.state,y=p.inputIsHidden,b=p.ariaSelection,S=this.commonProps,x=a||this.getElementId("input"),E=Me(Me(Me({"aria-autocomplete":"list","aria-expanded":u,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},u&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?P.createElement(m,Ae({},S,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:d,type:"text",value:l},E)):P.createElement(ak,Ae({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:ai,onFocus:this.onInputFocus,disabled:o,tabIndex:c,inputMode:"none",form:d,value:""},E))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,o=this.getComponents(),i=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,c=o.MultiValueRemove,d=o.SingleValue,u=o.Placeholder,f=this.commonProps,g=this.props,m=g.controlShouldRenderValue,p=g.isDisabled,y=g.isMulti,b=g.inputValue,S=g.placeholder,x=this.state,E=x.selectValue,k=x.focusedValue,C=x.isFocused;if(!this.hasValue()||!m)return b?null:P.createElement(u,Ae({},f,{key:"placeholder",isDisabled:p,isFocused:C,innerProps:{id:this.getElementId("placeholder")}}),S);if(y)return E.map(function(_,w){var M=_===k,O="".concat(s.getOptionLabel(_),"-").concat(s.getOptionValue(_));return P.createElement(i,Ae({},f,{components:{Container:a,Label:l,Remove:c},isFocused:M,isDisabled:p,key:O,index:w,removeProps:{onClick:function(){return s.removeValue(_)},onTouchEnd:function(){return s.removeValue(_)},onMouseDown:function(F){F.preventDefault()}},data:_}),s.formatOptionLabel(_,"value"))});if(b)return null;var N=E[0];return P.createElement(d,Ae({},f,{data:N,isDisabled:p}),this.formatOptionLabel(N,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),o=s.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||c)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return P.createElement(o,Ae({},i,{innerProps:u,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),o=s.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!o||!c)return null;var u={"aria-hidden":"true"};return P.createElement(o,Ae({},i,{innerProps:u,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator,i=s.IndicatorSeparator;if(!o||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return P.createElement(i,Ae({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator;if(!o)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return P.createElement(o,Ae({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,o=this.getComponents(),i=o.Group,a=o.GroupHeading,l=o.Menu,c=o.MenuList,d=o.MenuPortal,u=o.LoadingMessage,f=o.NoOptionsMessage,g=o.Option,m=this.commonProps,p=this.state.focusedOption,y=this.props,b=y.captureMenuScroll,S=y.inputValue,x=y.isLoading,E=y.loadingMessage,k=y.minMenuHeight,C=y.maxMenuHeight,N=y.menuIsOpen,_=y.menuPlacement,w=y.menuPosition,M=y.menuPortalTarget,O=y.menuShouldBlockScroll,L=y.menuShouldScrollIntoView,F=y.noOptionsMessage,$=y.onMenuScrollToTop,D=y.onMenuScrollToBottom;if(!N)return null;var A=function(B,G){var V=B.type,K=B.data,X=B.isDisabled,Z=B.isSelected,ee=B.label,ne=B.value,he=p===K,J=X?void 0:function(){return s.onOptionHover(K)},ce=X?void 0:function(){return s.selectOption(K)},ue="".concat(s.getElementId("option"),"-").concat(G),ae={id:ue,onClick:ce,onMouseMove:J,onMouseOver:J,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:Z};return P.createElement(g,Ae({},m,{innerProps:ae,data:K,isDisabled:X,isSelected:Z,key:ue,label:ee,type:V,value:ne,isFocused:he,innerRef:he?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(B.data,"menu"))},T;if(this.hasOptions())T=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var B=U.data,G=U.options,V=U.index,K="".concat(s.getElementId("group"),"-").concat(V),X="".concat(K,"-heading");return P.createElement(i,Ae({},m,{key:K,data:B,options:G,Heading:a,headingProps:{id:X,data:U.data},label:s.formatGroupLabel(U.data)}),U.options.map(function(Z){return A(Z,"".concat(V,"-").concat(Z.index))}))}else if(U.type==="option")return A(U,"".concat(U.index))});else if(x){var z=E({inputValue:S});if(z===null)return null;T=P.createElement(u,m,z)}else{var H=F({inputValue:S});if(H===null)return null;T=P.createElement(f,m,H)}var W={minMenuHeight:k,maxMenuHeight:C,menuPlacement:_,menuPosition:w,menuShouldScrollIntoView:L},j=P.createElement(Hw,Ae({},m,W),function(U){var B=U.ref,G=U.placerProps,V=G.placement,K=G.maxHeight;return P.createElement(l,Ae({},m,W,{innerRef:B,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:x,placement:V}),P.createElement(hk,{captureEnabled:b,onTopArrive:$,onBottomArrive:D,lockEnabled:O},function(X){return P.createElement(c,Ae({},m,{innerRef:function(ee){s.getMenuListRef(ee),X(ee)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:s.getElementId("listbox")},isLoading:x,maxHeight:K,focusedOption:p}),T)}))});return M||w==="fixed"?P.createElement(d,Ae({},m,{appendTo:M,controlElement:this.controlRef,menuPlacement:_,menuPosition:w}),j):j}},{key:"renderFormField",value:function(){var s=this,o=this.props,i=o.delimiter,a=o.isDisabled,l=o.isMulti,c=o.name,d=o.required,u=this.state.selectValue;if(d&&!this.hasValue()&&!a)return P.createElement(mk,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=u.map(function(p){return s.getOptionValue(p)}).join(i);return P.createElement("input",{name:c,type:"hidden",value:f})}else{var g=u.length>0?u.map(function(p,y){return P.createElement("input",{key:"i-".concat(y),name:c,type:"hidden",value:s.getOptionValue(p)})}):P.createElement("input",{name:c,type:"hidden",value:""});return P.createElement("div",null,g)}else{var m=u[0]?this.getOptionValue(u[0]):"";return P.createElement("input",{name:c,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,o=this.state,i=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,c=o.isFocused,d=o.selectValue,u=this.getFocusableOptions();return P.createElement(tk,Ae({},s,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:d,focusableOptions:u,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),o=s.Control,i=s.IndicatorsContainer,a=s.SelectContainer,l=s.ValueContainer,c=this.props,d=c.className,u=c.id,f=c.isDisabled,g=c.menuIsOpen,m=this.state.isFocused,p=this.commonProps=this.getCommonProps();return P.createElement(a,Ae({},p,{className:d,innerProps:{id:u,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:m}),this.renderLiveRegion(),P.createElement(o,Ae({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:m,menuIsOpen:g}),P.createElement(l,Ae({},p,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),P.createElement(i,Ae({},p,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,o){var i=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,c=o.ariaSelection,d=o.isFocused,u=o.prevWasFocused,f=o.instancePrefix,g=s.options,m=s.value,p=s.menuIsOpen,y=s.inputValue,b=s.isMulti,S=li(m),x={};if(i&&(m!==i.value||g!==i.options||p!==i.menuIsOpen||y!==i.inputValue)){var E=p?Tk(s,S):[],k=p?Bf(gi(s,S),"".concat(f,"-option")):[],C=a?Ak(o,S):null,N=Dk(o,E),_=$l(k,N);x={selectValue:S,focusedOption:N,focusedOptionId:_,focusableOptionsWithIds:k,focusedValue:C,clearFocusValueOnUpdate:!1}}var w=l!=null&&s!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},M=c,O=d&&u;return d&&!O&&(M={value:$s(b,S,S[0]||null),options:S,action:"initial-input-focus"},O=!u),c?.action==="initial-input-focus"&&(M=null),Me(Me(Me({},x),w),{},{prevProps:s,ariaSelection:M,prevWasFocused:O})}}]),n})(v.Component);Fl.defaultProps=Ok;var Lk=v.forwardRef(function(t,e){var n=Au(t);return P.createElement(Fl,Ae({ref:e},n))}),qf=Lk,Pk=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],Zf=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=String(e).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),i=String(r.getOptionLabel(n)).toLowerCase();return o===s||i===s},zl={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,n,r,s){return!(!e||n.some(function(o){return Zf(e,o,s)})||r.some(function(o){return Zf(e,o,s)}))},getNewOptionData:function(e,n){return{label:n,value:e,__isNew__:!0}}};function $k(t){var e=t.allowCreateWhileLoading,n=e===void 0?!1:e,r=t.createOptionPosition,s=r===void 0?"last":r,o=t.formatCreateLabel,i=o===void 0?zl.formatCreateLabel:o,a=t.isValidNewOption,l=a===void 0?zl.isValidNewOption:a,c=t.getNewOptionData,d=c===void 0?zl.getNewOptionData:c,u=t.onCreateOption,f=t.options,g=f===void 0?[]:f,m=t.onChange,p=Tn(t,Pk),y=p.getOptionValue,b=y===void 0?zf:y,S=p.getOptionLabel,x=S===void 0?Ff:S,E=p.inputValue,k=p.isLoading,C=p.isMulti,N=p.value,_=p.name,w=v.useMemo(function(){return l(E,li(N),g,{getOptionValue:b,getOptionLabel:x})?d(E,i(E)):void 0},[i,d,x,b,E,l,g,N]),M=v.useMemo(function(){return(n||!k)&&w?s==="first"?[w].concat(Hr(g)):[].concat(Hr(g),[w]):g},[n,s,k,w,g]),O=v.useCallback(function(L,F){if(F.action!=="select-option")return m(L,F);var $=Array.isArray(L)?L:[L];if($[$.length-1]===w){if(u)u(E);else{var D=d(E,E),A={action:"create-option",name:_,option:D};m($s(C,[].concat(Hr(li(N)),[D]),D),A)}return}m(L,F)},[d,E,C,_,w,u,m,N]);return Me(Me({},p),{},{options:M,onChange:O})}var Fk=v.forwardRef(function(t,e){var n=Au(t),r=$k(n);return P.createElement(Fl,Ae({ref:e},r))}),Qf=Fk;const Lt={control:"input-tag",valueContainer:"gap-1 flex flex-wrap",multiValue:{blue:"bg-blue-100 dark:bg-blue-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",green:"bg-green-100 dark:bg-green-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",amber:"bg-amber-100 dark:bg-amber-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",red:"bg-red-100 dark:bg-red-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",purple:"bg-purple-100 dark:bg-purple-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",gray:"bg-gray-100 dark:bg-gray-700/50 rounded px-1.5 py-0.5 flex items-center gap-1"},multiValueLabel:{blue:"text-blue-700 dark:text-blue-300 text-xs",green:"text-green-700 dark:text-green-300 text-xs font-semibold",amber:"text-amber-700 dark:text-amber-300 text-xs font-semibold",red:"text-red-700 dark:text-red-300 text-xs font-semibold",purple:"text-purple-700 dark:text-purple-300 text-xs font-semibold",gray:"text-gray-700 dark:text-gray-300 text-xs"},multiValueRemove:{blue:"text-blue-700 dark:text-blue-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",green:"text-green-700 dark:text-green-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",amber:"text-amber-700 dark:text-amber-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",red:"text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",purple:"text-purple-700 dark:text-purple-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",gray:"text-gray-700 dark:text-gray-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1"},input:"text-gray-900 dark:text-white text-sm",placeholder:"text-gray-400 dark:text-gray-500 text-sm",menu:"mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",menuList:"py-1",option:{base:"px-3 py-2 cursor-pointer text-gray-900 dark:text-white text-[13px]",selected:"bg-blue-100 dark:bg-blue-900/20",focused:"bg-gray-100 dark:bg-gray-700",default:"bg-white dark:bg-gray-800"},noOptionsMessage:"px-3 py-2 text-gray-500 dark:text-gray-400 text-[13px]",checkbox:{base:"w-4 h-4 rounded border flex items-center justify-center text-white text-[10px] shrink-0",selected:"bg-blue-500 border-blue-500",unselected:"border-gray-400 dark:border-gray-500"}},Jf=t=>{const{data:e,isSelected:n}=t;return h.jsx(hi.Option,{...t,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`${Lt.checkbox.base} ${n?Lt.checkbox.selected:Lt.checkbox.unselected}`,children:n?"✓":""}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[13px]",children:e.label}),e.count!==void 0&&e.count>0&&h.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-[10px]",children:["(",e.count,")"]})]}),e.description&&h.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.description})]})]})})},Rf=t=>h.jsx(hi.GroupHeading,{...t,children:h.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-700",children:t.data.label})}),zk=t=>{const{data:e}=t;return h.jsxs(hi.MultiValueLabel,{...t,children:[h.jsx("span",{children:e.label}),e.count!==void 0&&e.count>0&&h.jsxs("span",{className:"text-xs opacity-60 ml-1",children:["(",e.count,")"]})]})},Vk=({value:t,options:e=[],onChange:n,creatable:r=!1,placeholder:s="검색 또는 입력...",noOptionsMessage:o="검색 결과가 없습니다",formatCreateLabel:i,createLabelSuffix:a="추가",maxItems:l,disabled:c=!1,onBeforeRemove:d,onCreateOption:u,className:f="",tagVariants:g,defaultVariant:m="blue",name:p,isMulti:y=!0,isClearable:b=!0,isSearchable:S=!0,delimiters:x=[","],splitOnPaste:E=!0,onInputChange:k,id:C,editorAttrs:N})=>{const _=c===!0||c==="true",w=v.useCallback(J=>J==null?[]:Array.isArray(J)?J:[J],[]),[M,O]=v.useState(()=>w(t)),[L,F]=v.useState(""),$=v.useRef(void 0);v.useEffect(()=>{const J=(ue,ae)=>!ue&&!ae?!0:!ue||!ae||ue.length!==ae.length?!1:ue.every((ve,fe)=>ve===ae[fe]),ce=w(t);J(ce,$.current)||(O(ce),$.current=ce)},[t,w]);const D=v.useMemo(()=>i?typeof i=="string"?J=>`${i} "${J}"`:i:J=>h.jsxs("span",{className:"text-[13px]",children:[h.jsx("strong",{children:J})," ",a]}),[i,a]),A=v.useMemo(()=>!M||!Array.isArray(M)?[]:M.map(J=>e.find(ue=>ue.value===J)||{value:J,label:String(J)}).filter(J=>J!==void 0),[M,e]),T=v.useMemo(()=>{const J=new Set(e.map(ke=>ke.value)),ce=M?M.filter(ke=>!J.has(ke)).map(ke=>({value:ke,label:String(ke)})):[],ue=[...e,...ce];if(!ue.some(ke=>ke.group))return ue;const ve=new Map,fe=[];ue.forEach(ke=>{if(ke.group){const Ue=ve.get(ke.group)||[];Ue.push(ke),ve.set(ke.group,Ue)}else fe.push(ke)});const ye=[];return ve.forEach((ke,Ue)=>{ye.push({label:Ue,options:ke})}),fe.length>0&&ye.push({label:"",options:fe}),ye},[e,M]),z=v.useCallback(J=>({target:{value:J},currentTarget:{value:J},preventDefault:()=>{},stopPropagation:()=>{}}),[]),H=v.useCallback(J=>{if(!x?.length)return[J.trim()].filter(Boolean);const ce=x.map(ae=>ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ue=new RegExp(`[${ce.join("")}]`);return J.split(ue).map(ae=>ae.trim()).filter(Boolean)},[x]),W=v.useCallback((J,ce)=>{if(ce.action!=="input-change"){F(J);return}if(k&&k(z(J)),!x?.some(fe=>J.includes(fe))||!r||!y){F(J);return}const ve=H(J).filter(fe=>fe&&!M.includes(fe));if(ve.length>0){const fe=l?l-M.length:1/0,ye=ve.slice(0,fe);if(ye.length>0){const ke=[...M,...ye];O(ke),n(z(ke))}}F("")},[x,r,y,H,M,l,n,z,k]),j=v.useCallback(J=>{if(!E||!r||!y)return;const ce=J.clipboardData.getData("text"),ue=H(ce);if(ue.length<=1)return;J.preventDefault();const ae=ue.filter(ve=>ve&&!M.includes(ve));if(ae.length>0){const ve=l?l-M.length:1/0,fe=ae.slice(0,ve);if(fe.length>0){const ye=[...M,...fe];O(ye),n(z(ye))}}},[E,r,y,H,M,l,n,z]),U=v.useCallback((J,ce)=>{if((ce.action==="remove-value"||ce.action==="pop-value")&&ce.removedValue&&d){const ae=d(ce.removedValue);if(ae!==!0){const ve=typeof ae=="string"?ae:`"${ce.removedValue.label}"은(는) 제거할 수 없습니다.`;alert(ve);return}}if(l&&J.length>l)return;const ue=J.map(ae=>ae.value);O(ue),n(z(ue))},[n,d,l,z]),B=v.useCallback((J,ce)=>{if(ce.action==="clear"&&M.length>0&&d){const ve=e.find(ye=>ye.value===M[0])||{value:M[0],label:String(M[0])},fe=d(ve);if(fe!==!0){const ye=typeof fe=="string"?fe:`"${ve.label}"은(는) 제거할 수 없습니다.`;alert(ye);return}}const ue=J?J.value:null,ae=J?[J.value]:[];O(ae),n(z(ue))},[n,d,M,e,z]),G=v.useCallback(J=>{u&&u(J);const ce=[...M||[],J];O(ce),n(z(ce))},[n,u,M,z]),V=v.useCallback(J=>!J||!J.trim()?!1:!M?.includes(J.trim()),[M]),K=v.useCallback(J=>{const ce=L.trim();if(J.key==="Tab"&&r&&y&&ce){if(M.includes(ce))J.preventDefault(),F("");else if(!l||M.lengthg&&g[J]?g[J]:m,[g,m]),Z={control:()=>`${Lt.control} ${f} ${_?"opacity-60 cursor-not-allowed":""}`,valueContainer:()=>Lt.valueContainer,multiValue:J=>{const ce=X(J.data.value);return Lt.multiValue[ce]},multiValueLabel:J=>{const ce=X(J.data.value);return Lt.multiValueLabel[ce]},multiValueRemove:J=>{const ce=X(J.data.value);return`${Lt.multiValueRemove[ce]} ${_?"pointer-events-none":""}`},singleValue:()=>"text-gray-900 dark:text-white text-sm",input:()=>Lt.input,placeholder:()=>Lt.placeholder,menu:()=>Lt.menu,menuList:()=>Lt.menuList,menuPortal:()=>"z-[9999]",option:J=>`${Lt.option.base} ${J.isSelected?Lt.option.selected:J.isFocused?Lt.option.focused:Lt.option.default}`,noOptionsMessage:()=>Lt.noOptionsMessage,clearIndicator:()=>"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer px-1",dropdownIndicator:()=>"text-gray-400 dark:text-gray-500 px-1"},ee={options:T,onKeyDown:K,placeholder:s,noOptionsMessage:()=>o,isDisabled:_,isSearchable:S,menuIsOpen:void 0,openMenuOnClick:!0,openMenuOnFocus:!0,menuPortalTarget:typeof document<"u"?document.body:null,menuPosition:"fixed",classNamePrefix:"tag-input",unstyled:!0,classNames:Z,...r&&y||k?{inputValue:L,onInputChange:W}:{}},ne=y?M.join(","):M[0]??"";if(!y){const J={...ee,isMulti:!1,value:A[0]||null,onChange:B,isClearable:b,closeMenuOnSelect:!0,components:{Option:Jf,GroupHeading:Rf,IndicatorSeparator:()=>null,...b?{}:{ClearIndicator:()=>null}}};return r?h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Qf,{...J,onCreateOption:G,formatCreateLabel:D,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(qf,{...J})]})}const he={...ee,isMulti:!0,value:A,onChange:U,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!1,isClearable:!1,components:{Option:Jf,GroupHeading:Rf,MultiValueLabel:zk,ClearIndicator:()=>null,DropdownIndicator:()=>null,IndicatorSeparator:()=>null}};return r?h.jsxs(I,{id:C,...N,onPaste:j,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Qf,{...he,onCreateOption:G,formatCreateLabel:D,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(qf,{...he})]})},Gr=(t,e)=>window.G7Core?.t?.(t,e)??t,Hk=()=>window.G7Core?.locale?.supported?.()??["ko","en"],Uk=()=>window.G7Core?.locale?.current?.()??"ko",Vl=t=>{const e=Gr(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},Bk=({value:t=[],onChange:e,placeholder:n="입력 후 Enter",disabled:r=!1,creatable:s=!0,delimiters:o=[","],className:i="",name:a,error:l,maxItems:c,modalId:d,statePath:u,__componentContext:f,id:g,editorAttrs:m})=>{const p=v.useMemo(()=>Hk(),[]),y=v.useMemo(()=>Uk(),[]),[b,S]=v.useState(()=>t||[]),[x,E]=v.useState(""),[k,C]=v.useState(!1),[N,_]=v.useState(null),[w,M]=v.useState({}),O=v.useRef(null),L=v.useRef(void 0);v.useEffect(()=>{const V=(X,Z)=>!X&&!Z?!0:!X||!Z||X.length!==Z.length?!1:JSON.stringify(X)===JSON.stringify(Z),K=t||[];V(K,L.current)||(S(K),L.current=K)},[t]);const F=v.useCallback(V=>({target:{name:a,value:V},currentTarget:{name:a,value:V},preventDefault:()=>{},stopPropagation:()=>{}}),[a]),$=v.useCallback(V=>{const K=[];for(const X of p){const Z=V[X];Z?.trim()&&K.push(`${X.toUpperCase()}: ${Z}`)}return K.length>0?K.join(" / "):""},[p]),D=v.useCallback(V=>{const K=b.filter((X,Z)=>Z!==V);S(K),e?.(F(K))},[b,e,F]),A=v.useCallback((V,K,X)=>{const Z=window.G7Core;if(!Z?.dispatch)return;const ee=p.map(ne=>({code:ne,label:Vl(ne)}));Z.dispatch({handler:"setState",params:{target:"global",multilingualTagEdit:{fieldName:a,editingIndex:V,values:K,supportedLocales:ee,defaultLocale:y,statePath:u,currentTags:X}}}),Z.dispatch({handler:"openModal",target:d},{componentContext:f})},[a,p,y,d,u,f]),T=v.useCallback(V=>{r||(d?A(V,{...b[V]},b):(_(V),M({...b[V]}),C(!0)))},[r,b,d,A]),z=v.useCallback((V="")=>{const K={};p.forEach(X=>{K[X]=X===y?V:""}),d?(A(null,K,b),E("")):(_(null),M(K),C(!0),E(""))},[p,y,d,A,b]),H=v.useCallback(()=>{if(!Object.values(w).some(X=>X.trim()!=="")){C(!1);return}let K;N!==null?K=b.map((X,Z)=>Z===N?w:X):K=[...b,w],S(K),e?.(F(K)),C(!1),M({}),_(null)},[w,N,b,e,F]),W=v.useCallback(()=>{C(!1),M({}),_(null)},[]),j=v.useCallback(V=>{const K=V.target.value;if(o.some(Z=>K.includes(Z))&&s){const Z=o.map(he=>he.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ee=new RegExp(`[${Z.join("")}]`),ne=K.split(ee).map(he=>he.trim()).filter(Boolean);if(ne.length>0){z(ne[0]);return}}E(K)},[o,s,z]),U=v.useCallback(V=>{if(V.key==="Enter"&&x.trim()&&s){if(V.preventDefault(),c&&b.length>=c)return;z(x.trim())}},[x,s,c,b.length,z]),B=v.useCallback((V,K)=>{M(X=>({...X,[V]:K}))},[]),G=!!l;return h.jsxs(I,{className:i,id:g,...m,children:[h.jsxs(I,{className:`flex flex-wrap gap-1.5 p-2 border rounded-lg bg-white dark:bg-gray-700 min-h-[42px] ${G?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500"} ${r?"opacity-60 bg-gray-100 dark:bg-gray-800 cursor-not-allowed":""}`,children:[b.map((V,K)=>h.jsxs(I,{className:"flex items-center gap-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded px-2 py-0.5 text-sm",children:[h.jsx(Q,{className:`cursor-pointer hover:underline ${r?"cursor-not-allowed":""}`,onClick:()=>T(K),children:$(V)}),!r&&h.jsx(oe,{type:"button",className:"p-0 h-4 w-4 min-w-0 border-0 bg-transparent text-blue-600 dark:text-blue-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-transparent",onClick:X=>{X.stopPropagation(),D(K)},children:h.jsx(re,{name:"times",className:"text-xs"})})]},K)),s&&!r&&(!c||b.lengthh.jsxs(I,{className:"space-y-1",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300 w-16",children:Vl(V)}),h.jsxs(Q,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",V.toUpperCase(),")"]})]}),h.jsx(wt,{type:"text",value:w[V]??"",onChange:K=>B(V,K.target.value),placeholder:`${Vl(V)} 값 입력`,className:"w-full",autoFocus:V===y})]},V)),h.jsxs(I,{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[h.jsx(oe,{type:"button",variant:"secondary",onClick:W,children:Gr("common.cancel")}),h.jsx(oe,{type:"button",variant:"primary",onClick:H,children:Gr(N!==null?"common.save":"common.add")})]})]})}),a&&h.jsx("input",{type:"hidden",name:a,value:JSON.stringify(b)})]})},eh=(t,e)=>window.G7Core?.t?.(t,e)??t,th=({type:t,identifier:e,name:n,installedModules:r=[],installedPlugins:s=[],className:o="",style:i,id:a,editorAttrs:l})=>{const c={module:de.Cubes,plugin:de.PuzzlePiece},d={module:eh("common.module"),plugin:eh("common.plugin")},u=v.useMemo(()=>{if(n)return n;if(e){const p=(t==="module"?r:s)?.find(y=>y.identifier===e);if(p)return p.name}},[n,e,t,r,s]),f=c[t],g=u?`${u} ${d[t]}`:d[t];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium text-gray-400 dark:text-gray-500 ${o}`,style:i,id:a,...l,children:[h.jsx(re,{name:f,className:"w-3.5 h-3.5"}),h.jsx(Q,{children:g})]})},jk=({options:t=[],value:e,onChange:n,multiple:r=!1,searchPlaceholder:s="Search...",onSearch:o,noResultsText:i="No results found",initialText:a="Type to search",triggerLabel:l="Select",triggerIcon:c,disabled:d=!1,className:u="",id:f,editorAttrs:g})=>{const[m,p]=v.useState(!1),[y,b]=v.useState(""),S=v.useRef(null),x=v.useRef(null),E=v.useRef(`searchable-dropdown-input-${Math.random().toString(36).slice(2,9)}`).current,k=v.useMemo(()=>e==null?[]:Array.isArray(e)?e:[e],[e]),C=v.useMemo(()=>{if(!y.trim())return t;const D=y.toLowerCase();return t.filter(A=>A.label.toLowerCase().includes(D)||A.description?.toLowerCase().includes(D))},[t,y]),N=v.useMemo(()=>{if(k.length===0)return l;if(r){const A=k.length;return A===1?t.find(z=>String(z.value)===String(k[0]))?.label||l:`${A} selected`}return t.find(A=>String(A.value)===String(k[0]))?.label||l},[k,t,r,l]);v.useEffect(()=>{const D=A=>{S.current&&!S.current.contains(A.target)&&p(!1)};return m&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[m]),v.useEffect(()=>{const D=A=>{A.key==="Escape"&&m&&(p(!1),x.current?.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m]),v.useEffect(()=>{if(!m){b("");return}const D=setTimeout(()=>{document.getElementById(E)?.focus()},50);return()=>{clearTimeout(D)}},[m,E]);const _=v.useCallback(()=>{d||p(D=>!D)},[d]),w=v.useCallback(D=>{const A=D.target.value;b(A),o?.(A)},[o]),M=v.useCallback(D=>{if(r){const T=k.some(z=>String(z)===String(D))?k.filter(z=>String(z)!==String(D)):[...k,D];n?.(T)}else n?.(D),p(!1),x.current?.focus()},[r,k,n]),O=D=>k.some(A=>String(A)===String(D)),L=y.length===0&&t.length===0,F=y.length>0&&C.length===0,$=C.length>0;return h.jsxs(I,{ref:S,className:`relative inline-block ${u}`,id:f,...g,children:[h.jsxs(oe,{ref:x,type:"button",onClick:_,disabled:d,className:` +`]))),m1=function(e,n){var r=e.isFocused,s=e.size,o=e.theme,i=o.colors,a=o.spacing.baseUnit;return Me({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:a*2})},Ol=function(e){var n=e.delay,r=e.offset;return Ee("span",{css:wl({animation:"".concat(p1," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},b1=function(e){var n=e.innerProps,r=e.isRtl,s=e.size,o=s===void 0?4:s,i=Tn(e,a1);return Ee("div",Ae({},yt(Me(Me({},i),{},{innerProps:n,isRtl:r,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Ee(Ol,{delay:0,offset:r}),Ee(Ol,{delay:160,offset:!0}),Ee(Ol,{delay:320,offset:!r}))},y1=function(e,n){var r=e.isDisabled,s=e.isFocused,o=e.theme,i=o.colors,a=o.borderRadius,l=o.spacing;return Me({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:s?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:s?i.primary:i.neutral30}})},v1=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,o=e.innerRef,i=e.innerProps,a=e.menuIsOpen;return Ee("div",Ae({ref:o},yt(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":a}),i,{"aria-disabled":r||void 0}),n)},x1=v1,w1=["data"],k1=function(e,n){var r=e.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},C1=function(e){var n=e.children,r=e.cx,s=e.getStyles,o=e.getClassNames,i=e.Heading,a=e.headingProps,l=e.innerProps,c=e.label,d=e.theme,u=e.selectProps;return Ee("div",Ae({},yt(e,"group",{group:!0}),l),Ee(i,Ae({},a,{selectProps:u,theme:d,getStyles:s,getClassNames:o,cx:r}),c),Ee("div",null,n))},S1=function(e,n){var r=e.theme,s=r.colors,o=r.spacing;return Me({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},_1=function(e){var n=uf(e);n.data;var r=Tn(n,w1);return Ee("div",Ae({},yt(e,"groupHeading",{"group-heading":!0}),r))},E1=C1,M1=["innerRef","isDisabled","isHidden","inputClassName"],N1=function(e,n){var r=e.isDisabled,s=e.value,o=e.theme,i=o.spacing,a=o.colors;return Me(Me({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},O1),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},Cf={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},O1={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Me({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},Cf)},T1=function(e){return Me({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},Cf)},A1=function(e){var n=e.cx,r=e.value,s=uf(e),o=s.innerRef,i=s.isDisabled,a=s.isHidden,l=s.inputClassName,c=Tn(s,M1);return Ee("div",Ae({},yt(e,"input",{"input-container":!0}),{"data-value":r||""}),Ee("input",Ae({className:n({input:!0},l),ref:o,style:T1(a),disabled:i},c)))},D1=A1,I1=function(e,n){var r=e.theme,s=r.spacing,o=r.borderRadius,i=r.colors;return Me({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:o/2,margin:s.baseUnit/2})},L1=function(e,n){var r=e.theme,s=r.borderRadius,o=r.colors,i=e.cropWithEllipsis;return Me({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},P1=function(e,n){var r=e.theme,s=r.spacing,o=r.borderRadius,i=r.colors,a=e.isFocused;return Me({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},Sf=function(e){var n=e.children,r=e.innerProps;return Ee("div",r,n)},$1=Sf,F1=Sf;function z1(t){var e=t.children,n=t.innerProps;return Ee("div",Ae({role:"button"},n),e||Ee(Nl,{size:14}))}var V1=function(e){var n=e.children,r=e.components,s=e.data,o=e.innerProps,i=e.isDisabled,a=e.removeProps,l=e.selectProps,c=r.Container,d=r.Label,u=r.Remove;return Ee(c,{data:s,innerProps:Me(Me({},yt(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),o),selectProps:l},Ee(d,{data:s,innerProps:Me({},yt(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),Ee(u,{data:s,innerProps:Me(Me({},yt(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},a),selectProps:l}))},H1=V1,U1=function(e,n){var r=e.isDisabled,s=e.isFocused,o=e.isSelected,i=e.theme,a=i.spacing,l=i.colors;return Me({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:o?l.primary:l.primary50}})},B1=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,o=e.isSelected,i=e.innerRef,a=e.innerProps;return Ee("div",Ae({},yt(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":o}),{ref:i,"aria-disabled":r},a),n)},j1=B1,W1=function(e,n){var r=e.theme,s=r.spacing,o=r.colors;return Me({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},G1=function(e){var n=e.children,r=e.innerProps;return Ee("div",Ae({},yt(e,"placeholder",{placeholder:!0}),r),n)},Y1=G1,X1=function(e,n){var r=e.isDisabled,s=e.theme,o=s.spacing,i=s.colors;return Me({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},K1=function(e){var n=e.children,r=e.isDisabled,s=e.innerProps;return Ee("div",Ae({},yt(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},q1=K1,hi={ClearIndicator:f1,Control:x1,DropdownIndicator:d1,DownChevron:wf,CrossIcon:Nl,Group:E1,GroupHeading:_1,IndicatorsContainer:o1,IndicatorSeparator:g1,Input:D1,LoadingIndicator:b1,Menu:Gw,MenuList:Xw,MenuPortal:Rw,LoadingMessage:Qw,NoOptionsMessage:Zw,MultiValue:H1,MultiValueContainer:$1,MultiValueLabel:F1,MultiValueRemove:z1,Option:j1,Placeholder:Y1,SelectContainer:t1,SingleValue:q1,ValueContainer:r1},Z1=function(e){return Me(Me({},hi),e.components)},_f=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Q1(t,e){return!!(t===e||_f(t)&&_f(e))}function J1(t,e){if(t.length!==e.length)return!1;for(var n=0;n1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return i?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(e){var n=e.context,r=e.focused,s=e.options,o=e.label,i=o===void 0?"":o,a=e.selectValue,l=e.isDisabled,c=e.isSelected,d=e.isAppleDevice,u=function(p,y){return p&&p.length?"".concat(p.indexOf(y)+1," of ").concat(p.length):""};if(n==="value"&&a)return"value ".concat(i," focused, ").concat(u(a,r),".");if(n==="menu"&&d){var f=l?" disabled":"",g="".concat(c?" selected":"").concat(f);return"".concat(i).concat(g,", ").concat(u(s,r),".")}return""},onFilter:function(e){var n=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},rk=function(e){var n=e.ariaSelection,r=e.focusedOption,s=e.focusedValue,o=e.focusableOptions,i=e.isFocused,a=e.selectValue,l=e.selectProps,c=e.id,d=e.isAppleDevice,u=l.ariaLiveMessages,f=l.getOptionLabel,g=l.inputValue,m=l.isMulti,p=l.isOptionDisabled,y=l.isSearchable,b=l.menuIsOpen,S=l.options,x=l.screenReaderStatus,E=l.tabSelectsValue,k=l.isLoading,C=l["aria-label"],N=l["aria-live"],_=v.useMemo(function(){return Me(Me({},nk),u||{})},[u]),w=v.useMemo(function(){var D="";if(n&&_.onChange){var A=n.option,T=n.options,z=n.removedValue,H=n.removedValues,W=n.value,j=function(Z){return Array.isArray(Z)?null:Z},U=z||A||j(W),B=U?f(U):"",G=T||H||void 0,V=G?G.map(f):[],K=Me({isDisabled:U&&p(U,a),label:B,labels:V},n);D=_.onChange(K)}return D},[n,_,p,a,f]),M=v.useMemo(function(){var D="",A=r||s,T=!!(r&&a&&a.includes(r));if(A&&_.onFocus){var z={focused:A,label:f(A),isDisabled:p(A,a),isSelected:T,options:o,context:A===r?"menu":"value",selectValue:a,isAppleDevice:d};D=_.onFocus(z)}return D},[r,s,f,p,_,o,a,d]),O=v.useMemo(function(){var D="";if(b&&S.length&&!k&&_.onFilter){var A=x({count:o.length});D=_.onFilter({inputValue:g,resultsMessage:A})}return D},[o,g,b,_,S,x,k]),L=n?.action==="initial-input-focus",F=v.useMemo(function(){var D="";if(_.guidance){var A=s?"value":b?"menu":"input";D=_.guidance({"aria-label":C,context:A,isDisabled:r&&p(r,a),isMulti:m,isSearchable:y,tabSelectsValue:E,isInitialFocus:L})}return D},[C,r,s,m,p,y,b,_,a,E,L]),$=Ee(v.Fragment,null,Ee("span",{id:"aria-selection"},w),Ee("span",{id:"aria-focused"},M),Ee("span",{id:"aria-results"},O),Ee("span",{id:"aria-guidance"},F));return Ee(v.Fragment,null,Ee(Ef,{id:c},L&&$),Ee(Ef,{"aria-live":N,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!L&&$))},sk=rk,Tl=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],ok=new RegExp("["+Tl.map(function(t){return t.letters}).join("")+"]","g"),Mf={},Al=0;Al-1}},ck=["innerRef"];function dk(t){var e=t.innerRef,n=Tn(t,ck),r=Fw(n,"onExited","in","enter","exit","appear");return Ee("input",Ae({ref:e},r,{css:wl({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var uk=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function fk(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,s=t.onTopArrive,o=t.onTopLeave,i=v.useRef(!1),a=v.useRef(!1),l=v.useRef(0),c=v.useRef(null),d=v.useCallback(function(y,b){if(c.current!==null){var S=c.current,x=S.scrollTop,E=S.scrollHeight,k=S.clientHeight,C=c.current,N=b>0,_=E-k-x,w=!1;_>b&&i.current&&(r&&r(y),i.current=!1),N&&a.current&&(o&&o(y),a.current=!1),N&&b>_?(n&&!i.current&&n(y),C.scrollTop=E,w=!0,i.current=!0):!N&&-b>x&&(s&&!a.current&&s(y),C.scrollTop=0,w=!0,a.current=!0),w&&uk(y)}},[n,r,s,o]),u=v.useCallback(function(y){d(y,y.deltaY)},[d]),f=v.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),g=v.useCallback(function(y){var b=l.current-y.changedTouches[0].clientY;d(y,b)},[d]),m=v.useCallback(function(y){if(y){var b=Lw?{passive:!1}:!1;y.addEventListener("wheel",u,b),y.addEventListener("touchstart",f,b),y.addEventListener("touchmove",g,b)}},[g,f,u]),p=v.useCallback(function(y){y&&(y.removeEventListener("wheel",u,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",g,!1))},[g,f,u]);return v.useEffect(function(){if(e){var y=c.current;return m(y),function(){p(y)}}},[e,m,p]),function(y){c.current=y}}var Tf=["boxSizing","height","overflow","paddingRight","position"],Af={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Df(t){t.cancelable&&t.preventDefault()}function If(t){t.stopPropagation()}function Lf(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function Pf(){return"ontouchstart"in window||navigator.maxTouchPoints}var $f=!!(typeof window<"u"&&window.document&&window.document.createElement),Fs=0,Wr={capture:!1,passive:!1};function hk(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,s=v.useRef({}),o=v.useRef(null),i=v.useCallback(function(l){if($f){var c=document.body,d=c&&c.style;if(r&&Tf.forEach(function(m){var p=d&&d[m];s.current[m]=p}),r&&Fs<1){var u=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,g=window.innerWidth-f+u||0;Object.keys(Af).forEach(function(m){var p=Af[m];d&&(d[m]=p)}),d&&(d.paddingRight="".concat(g,"px"))}c&&Pf()&&(c.addEventListener("touchmove",Df,Wr),l&&(l.addEventListener("touchstart",Lf,Wr),l.addEventListener("touchmove",If,Wr))),Fs+=1}},[r]),a=v.useCallback(function(l){if($f){var c=document.body,d=c&&c.style;Fs=Math.max(Fs-1,0),r&&Fs<1&&Tf.forEach(function(u){var f=s.current[u];d&&(d[u]=f)}),c&&Pf()&&(c.removeEventListener("touchmove",Df,Wr),l&&(l.removeEventListener("touchstart",Lf,Wr),l.removeEventListener("touchmove",If,Wr)))}},[r]);return v.useEffect(function(){if(e){var l=o.current;return i(l),function(){a(l)}}},[e,i,a]),function(l){o.current=l}}var gk=function(e){var n=e.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},pk={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function mk(t){var e=t.children,n=t.lockEnabled,r=t.captureEnabled,s=r===void 0?!0:r,o=t.onBottomArrive,i=t.onBottomLeave,a=t.onTopArrive,l=t.onTopLeave,c=fk({isEnabled:s,onBottomArrive:o,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),d=hk({isEnabled:n}),u=function(g){c(g),d(g)};return Ee(v.Fragment,null,n&&Ee("div",{onClick:gk,css:pk}),e(u))}var bk={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},yk=function(e){var n=e.name,r=e.onFocus;return Ee("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:bk,value:"",onChange:function(){}})},vk=yk;function Ll(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function xk(){return Ll(/^iPhone/i)}function Ff(){return Ll(/^Mac/i)}function wk(){return Ll(/^iPad/i)||Ff()&&navigator.maxTouchPoints>1}function kk(){return xk()||wk()}function Ck(){return Ff()||kk()}var Sk=function(e){return e.label},zf=function(e){return e.label},Vf=function(e){return e.value},_k=function(e){return!!e.isDisabled},Ek={clearIndicator:u1,container:e1,control:y1,dropdownIndicator:c1,group:k1,groupHeading:S1,indicatorsContainer:s1,indicatorSeparator:h1,input:N1,loadingIndicator:m1,loadingMessage:qw,menu:Bw,menuList:Yw,menuPortal:Jw,multiValue:I1,multiValueLabel:L1,multiValueRemove:P1,noOptionsMessage:Kw,option:U1,placeholder:W1,singleValue:X1,valueContainer:n1},Mk={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},Nk=4,Hf=4,Ok=38,Tk=Hf*2,Ak={baseUnit:Hf,controlHeight:Ok,menuGutter:Tk},Pl={borderRadius:Nk,colors:Mk,spacing:Ak},Dk={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:gf(),captureMenuScroll:!gf(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:lk(),formatGroupLabel:Sk,getOptionLabel:zf,getOptionValue:Vf,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:_k,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Dw(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var n=e.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Uf(t,e,n,r){var s=Yf(t,e,n),o=Xf(t,e,n),i=Gf(t,e),a=pi(t,e);return{type:"option",data:e,isDisabled:s,isSelected:o,label:i,value:a,index:r}}function gi(t,e){return t.options.map(function(n,r){if("options"in n){var s=n.options.map(function(i,a){return Uf(t,i,e,a)}).filter(function(i){return Wf(t,i)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var o=Uf(t,n,e,r);return Wf(t,o)?o:void 0}).filter(Pw)}function Bf(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,Hr(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function jf(t,e){return t.reduce(function(n,r){return r.type==="group"?n.push.apply(n,Hr(r.options.map(function(s){return{data:s.data,id:"".concat(e,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(e,"-").concat(r.index)}),n},[])}function Ik(t,e){return Bf(gi(t,e))}function Wf(t,e){var n=t.inputValue,r=n===void 0?"":n,s=e.data,o=e.isSelected,i=e.label,a=e.value;return(!qf(t)||!o)&&Kf(t,{label:i,value:a,data:s},r)}function Lk(t,e){var n=t.focusedValue,r=t.selectValue,s=r.indexOf(n);if(s>-1){var o=e.indexOf(n);if(o>-1)return n;if(s-1?n:e[0]}var $l=function(e,n){var r,s=(r=e.find(function(o){return o.data===n}))===null||r===void 0?void 0:r.id;return s||null},Gf=function(e,n){return e.getOptionLabel(n)},pi=function(e,n){return e.getOptionValue(n)};function Yf(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function Xf(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=pi(t,e);return n.some(function(s){return pi(t,s)===r})}function Kf(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var qf=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},$k=1,Fl=(function(t){ax(n,t);var e=dx(n);function n(r){var s;if(ox(this,n),s=e.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,c){var d=s.props,u=d.onChange,f=d.name;c.name=f,s.ariaOnChange(l,c),u(l,c)},s.setValue=function(l,c,d){var u=s.props,f=u.closeMenuOnSelect,g=u.isMulti,m=u.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:m}),f&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:c,option:d})},s.selectOption=function(l){var c=s.props,d=c.blurInputOnSelect,u=c.isMulti,f=c.name,g=s.state.selectValue,m=u&&s.isOptionSelected(l,g),p=s.isOptionDisabled(l,g);if(m){var y=s.getOptionValue(l);s.setValue(g.filter(function(b){return s.getOptionValue(b)!==y}),"deselect-option",l)}else if(!p)u?s.setValue([].concat(Hr(g),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var c=s.props.isMulti,d=s.state.selectValue,u=s.getOptionValue(l),f=d.filter(function(m){return s.getOptionValue(m)!==u}),g=$s(c,f,f[0]||null);s.onChange(g,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange($s(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,c=s.state.selectValue,d=c[c.length-1],u=c.slice(0,c.length-1),f=$s(l,u,u[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return $l(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return jf(gi(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,c=new Array(l),d=0;dg||f>g}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var c=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:c}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var c=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:c}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var c=s.getFocusableOptions(),d=c.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return qf(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var c=s.props,d=c.isMulti,u=c.backspaceRemovesValue,f=c.escapeClearsValue,g=c.inputValue,m=c.isClearable,p=c.isDisabled,y=c.menuIsOpen,b=c.onKeyDown,S=c.tabSelectsValue,x=c.openMenuOnFocus,E=s.state,k=E.focusedOption,C=E.focusedValue,N=E.selectValue;if(!p&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(C)s.removeValue(C);else{if(!u)return;d?s.popValue():m&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!S||!k||x&&s.isOptionSelected(k,N))return;s.selectOption(k);break;case"Enter":if(l.keyCode===229)break;if(y){if(!k||s.isComposing)return;s.selectOption(k);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):m&&f&&s.clearValue();break;case" ":if(g)return;if(!y){s.openMenu("first");break}if(!k)return;s.selectOption(k);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++$k),s.state.selectValue=li(r.value),r.menuIsOpen&&s.state.selectValue.length){var o=s.getFocusableOptionsWithIds(),i=s.buildFocusableOptions(),a=i.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=o,s.state.focusedOption=i[a],s.state.focusedOptionId=$l(o,i[a])}return s}return ix(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&hf(this.menuListRef,this.focusedOptionRef),Ck()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!i&&s.isDisabled||l&&a&&!s.menuIsOpen)&&this.focusInput(),l&&i&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(hf(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,o){this.props.onInputChange(s,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var o=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),d=s==="first"?0:c.length-1;if(!this.props.isMulti){var u=c.indexOf(a[0]);u>-1&&(d=u)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[d],focusedOptionId:this.getFocusedOptionId(c[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(s){var o=this.state,i=o.selectValue,a=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,d=-1;if(i.length){switch(s){case"previous":l===0?d=0:l===-1?d=c:d=l-1;break;case"next":l>-1&&l0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),s==="up"?l=c>0?c-1:a.length-1:s==="down"?l=(c+1)%a.length:s==="pageup"?(l=c-o,l<0&&(l=0)):s==="pagedown"?(l=c+o,l>a.length-1&&(l=a.length-1)):s==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Pl):Me(Me({},Pl),this.props.theme):Pl})},{key:"getCommonProps",value:function(){var s=this.clearValue,o=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,d=this.setValue,u=this.props,f=u.isMulti,g=u.isRtl,m=u.options,p=this.hasValue();return{clearValue:s,cx:o,getStyles:i,getClassNames:a,getValue:l,hasValue:p,isMulti:f,isRtl:g,options:m,selectOption:c,selectProps:u,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,o=s.isClearable,i=s.isMulti;return o===void 0?i:o}},{key:"isOptionDisabled",value:function(s,o){return Yf(this.props,s,o)}},{key:"isOptionSelected",value:function(s,o){return Xf(this.props,s,o)}},{key:"filterOption",value:function(s,o){return Kf(this.props,s,o)}},{key:"formatOptionLabel",value:function(s,o){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(s,{context:o,inputValue:i,selectValue:a})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var s=this.props,o=s.isDisabled,i=s.isSearchable,a=s.inputId,l=s.inputValue,c=s.tabIndex,d=s.form,u=s.menuIsOpen,f=s.required,g=this.getComponents(),m=g.Input,p=this.state,y=p.inputIsHidden,b=p.ariaSelection,S=this.commonProps,x=a||this.getElementId("input"),E=Me(Me(Me({"aria-autocomplete":"list","aria-expanded":u,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},u&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?P.createElement(m,Ae({},S,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:d,type:"text",value:l},E)):P.createElement(dk,Ae({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:ai,onFocus:this.onInputFocus,disabled:o,tabIndex:c,inputMode:"none",form:d,value:""},E))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,o=this.getComponents(),i=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,c=o.MultiValueRemove,d=o.SingleValue,u=o.Placeholder,f=this.commonProps,g=this.props,m=g.controlShouldRenderValue,p=g.isDisabled,y=g.isMulti,b=g.inputValue,S=g.placeholder,x=this.state,E=x.selectValue,k=x.focusedValue,C=x.isFocused;if(!this.hasValue()||!m)return b?null:P.createElement(u,Ae({},f,{key:"placeholder",isDisabled:p,isFocused:C,innerProps:{id:this.getElementId("placeholder")}}),S);if(y)return E.map(function(_,w){var M=_===k,O="".concat(s.getOptionLabel(_),"-").concat(s.getOptionValue(_));return P.createElement(i,Ae({},f,{components:{Container:a,Label:l,Remove:c},isFocused:M,isDisabled:p,key:O,index:w,removeProps:{onClick:function(){return s.removeValue(_)},onTouchEnd:function(){return s.removeValue(_)},onMouseDown:function(F){F.preventDefault()}},data:_}),s.formatOptionLabel(_,"value"))});if(b)return null;var N=E[0];return P.createElement(d,Ae({},f,{data:N,isDisabled:p}),this.formatOptionLabel(N,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),o=s.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||c)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return P.createElement(o,Ae({},i,{innerProps:u,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),o=s.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!o||!c)return null;var u={"aria-hidden":"true"};return P.createElement(o,Ae({},i,{innerProps:u,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator,i=s.IndicatorSeparator;if(!o||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return P.createElement(i,Ae({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator;if(!o)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return P.createElement(o,Ae({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,o=this.getComponents(),i=o.Group,a=o.GroupHeading,l=o.Menu,c=o.MenuList,d=o.MenuPortal,u=o.LoadingMessage,f=o.NoOptionsMessage,g=o.Option,m=this.commonProps,p=this.state.focusedOption,y=this.props,b=y.captureMenuScroll,S=y.inputValue,x=y.isLoading,E=y.loadingMessage,k=y.minMenuHeight,C=y.maxMenuHeight,N=y.menuIsOpen,_=y.menuPlacement,w=y.menuPosition,M=y.menuPortalTarget,O=y.menuShouldBlockScroll,L=y.menuShouldScrollIntoView,F=y.noOptionsMessage,$=y.onMenuScrollToTop,D=y.onMenuScrollToBottom;if(!N)return null;var A=function(B,G){var V=B.type,K=B.data,X=B.isDisabled,Z=B.isSelected,ee=B.label,ne=B.value,he=p===K,J=X?void 0:function(){return s.onOptionHover(K)},ce=X?void 0:function(){return s.selectOption(K)},ue="".concat(s.getElementId("option"),"-").concat(G),ae={id:ue,onClick:ce,onMouseMove:J,onMouseOver:J,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:Z};return P.createElement(g,Ae({},m,{innerProps:ae,data:K,isDisabled:X,isSelected:Z,key:ue,label:ee,type:V,value:ne,isFocused:he,innerRef:he?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(B.data,"menu"))},T;if(this.hasOptions())T=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var B=U.data,G=U.options,V=U.index,K="".concat(s.getElementId("group"),"-").concat(V),X="".concat(K,"-heading");return P.createElement(i,Ae({},m,{key:K,data:B,options:G,Heading:a,headingProps:{id:X,data:U.data},label:s.formatGroupLabel(U.data)}),U.options.map(function(Z){return A(Z,"".concat(V,"-").concat(Z.index))}))}else if(U.type==="option")return A(U,"".concat(U.index))});else if(x){var z=E({inputValue:S});if(z===null)return null;T=P.createElement(u,m,z)}else{var H=F({inputValue:S});if(H===null)return null;T=P.createElement(f,m,H)}var W={minMenuHeight:k,maxMenuHeight:C,menuPlacement:_,menuPosition:w,menuShouldScrollIntoView:L},j=P.createElement(jw,Ae({},m,W),function(U){var B=U.ref,G=U.placerProps,V=G.placement,K=G.maxHeight;return P.createElement(l,Ae({},m,W,{innerRef:B,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:x,placement:V}),P.createElement(mk,{captureEnabled:b,onTopArrive:$,onBottomArrive:D,lockEnabled:O},function(X){return P.createElement(c,Ae({},m,{innerRef:function(ee){s.getMenuListRef(ee),X(ee)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:s.getElementId("listbox")},isLoading:x,maxHeight:K,focusedOption:p}),T)}))});return M||w==="fixed"?P.createElement(d,Ae({},m,{appendTo:M,controlElement:this.controlRef,menuPlacement:_,menuPosition:w}),j):j}},{key:"renderFormField",value:function(){var s=this,o=this.props,i=o.delimiter,a=o.isDisabled,l=o.isMulti,c=o.name,d=o.required,u=this.state.selectValue;if(d&&!this.hasValue()&&!a)return P.createElement(vk,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=u.map(function(p){return s.getOptionValue(p)}).join(i);return P.createElement("input",{name:c,type:"hidden",value:f})}else{var g=u.length>0?u.map(function(p,y){return P.createElement("input",{key:"i-".concat(y),name:c,type:"hidden",value:s.getOptionValue(p)})}):P.createElement("input",{name:c,type:"hidden",value:""});return P.createElement("div",null,g)}else{var m=u[0]?this.getOptionValue(u[0]):"";return P.createElement("input",{name:c,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,o=this.state,i=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,c=o.isFocused,d=o.selectValue,u=this.getFocusableOptions();return P.createElement(sk,Ae({},s,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:d,focusableOptions:u,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),o=s.Control,i=s.IndicatorsContainer,a=s.SelectContainer,l=s.ValueContainer,c=this.props,d=c.className,u=c.id,f=c.isDisabled,g=c.menuIsOpen,m=this.state.isFocused,p=this.commonProps=this.getCommonProps();return P.createElement(a,Ae({},p,{className:d,innerProps:{id:u,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:m}),this.renderLiveRegion(),P.createElement(o,Ae({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:m,menuIsOpen:g}),P.createElement(l,Ae({},p,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),P.createElement(i,Ae({},p,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,o){var i=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,c=o.ariaSelection,d=o.isFocused,u=o.prevWasFocused,f=o.instancePrefix,g=s.options,m=s.value,p=s.menuIsOpen,y=s.inputValue,b=s.isMulti,S=li(m),x={};if(i&&(m!==i.value||g!==i.options||p!==i.menuIsOpen||y!==i.inputValue)){var E=p?Ik(s,S):[],k=p?jf(gi(s,S),"".concat(f,"-option")):[],C=a?Lk(o,S):null,N=Pk(o,E),_=$l(k,N);x={selectValue:S,focusedOption:N,focusedOptionId:_,focusableOptionsWithIds:k,focusedValue:C,clearFocusValueOnUpdate:!1}}var w=l!=null&&s!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},M=c,O=d&&u;return d&&!O&&(M={value:$s(b,S,S[0]||null),options:S,action:"initial-input-focus"},O=!u),c?.action==="initial-input-focus"&&(M=null),Me(Me(Me({},x),w),{},{prevProps:s,ariaSelection:M,prevWasFocused:O})}}]),n})(v.Component);Fl.defaultProps=Dk;var Fk=v.forwardRef(function(t,e){var n=Du(t);return P.createElement(Fl,Ae({ref:e},n))}),Zf=Fk,zk=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],Qf=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=String(e).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),i=String(r.getOptionLabel(n)).toLowerCase();return o===s||i===s},zl={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,n,r,s){return!(!e||n.some(function(o){return Qf(e,o,s)})||r.some(function(o){return Qf(e,o,s)}))},getNewOptionData:function(e,n){return{label:n,value:e,__isNew__:!0}}};function Vk(t){var e=t.allowCreateWhileLoading,n=e===void 0?!1:e,r=t.createOptionPosition,s=r===void 0?"last":r,o=t.formatCreateLabel,i=o===void 0?zl.formatCreateLabel:o,a=t.isValidNewOption,l=a===void 0?zl.isValidNewOption:a,c=t.getNewOptionData,d=c===void 0?zl.getNewOptionData:c,u=t.onCreateOption,f=t.options,g=f===void 0?[]:f,m=t.onChange,p=Tn(t,zk),y=p.getOptionValue,b=y===void 0?Vf:y,S=p.getOptionLabel,x=S===void 0?zf:S,E=p.inputValue,k=p.isLoading,C=p.isMulti,N=p.value,_=p.name,w=v.useMemo(function(){return l(E,li(N),g,{getOptionValue:b,getOptionLabel:x})?d(E,i(E)):void 0},[i,d,x,b,E,l,g,N]),M=v.useMemo(function(){return(n||!k)&&w?s==="first"?[w].concat(Hr(g)):[].concat(Hr(g),[w]):g},[n,s,k,w,g]),O=v.useCallback(function(L,F){if(F.action!=="select-option")return m(L,F);var $=Array.isArray(L)?L:[L];if($[$.length-1]===w){if(u)u(E);else{var D=d(E,E),A={action:"create-option",name:_,option:D};m($s(C,[].concat(Hr(li(N)),[D]),D),A)}return}m(L,F)},[d,E,C,_,w,u,m,N]);return Me(Me({},p),{},{options:M,onChange:O})}var Hk=v.forwardRef(function(t,e){var n=Du(t),r=Vk(n);return P.createElement(Fl,Ae({ref:e},r))}),Jf=Hk;const Lt={control:"input-tag",valueContainer:"gap-1 flex flex-wrap",multiValue:{blue:"bg-blue-100 dark:bg-blue-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",green:"bg-green-100 dark:bg-green-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",amber:"bg-amber-100 dark:bg-amber-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",red:"bg-red-100 dark:bg-red-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",purple:"bg-purple-100 dark:bg-purple-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",gray:"bg-gray-100 dark:bg-gray-700/50 rounded px-1.5 py-0.5 flex items-center gap-1"},multiValueLabel:{blue:"text-blue-700 dark:text-blue-300 text-xs",green:"text-green-700 dark:text-green-300 text-xs font-semibold",amber:"text-amber-700 dark:text-amber-300 text-xs font-semibold",red:"text-red-700 dark:text-red-300 text-xs font-semibold",purple:"text-purple-700 dark:text-purple-300 text-xs font-semibold",gray:"text-gray-700 dark:text-gray-300 text-xs"},multiValueRemove:{blue:"text-blue-700 dark:text-blue-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",green:"text-green-700 dark:text-green-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",amber:"text-amber-700 dark:text-amber-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",red:"text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",purple:"text-purple-700 dark:text-purple-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",gray:"text-gray-700 dark:text-gray-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1"},input:"text-gray-900 dark:text-white text-sm",placeholder:"text-gray-400 dark:text-gray-500 text-sm",menu:"mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",menuList:"py-1",option:{base:"px-3 py-2 cursor-pointer text-gray-900 dark:text-white text-[13px]",selected:"bg-blue-100 dark:bg-blue-900/20",focused:"bg-gray-100 dark:bg-gray-700",default:"bg-white dark:bg-gray-800"},noOptionsMessage:"px-3 py-2 text-gray-500 dark:text-gray-400 text-[13px]",checkbox:{base:"w-4 h-4 rounded border flex items-center justify-center text-white text-[10px] shrink-0",selected:"bg-blue-500 border-blue-500",unselected:"border-gray-400 dark:border-gray-500"}},Rf=t=>{const{data:e,isSelected:n}=t;return h.jsx(hi.Option,{...t,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`${Lt.checkbox.base} ${n?Lt.checkbox.selected:Lt.checkbox.unselected}`,children:n?"✓":""}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[13px]",children:e.label}),e.count!==void 0&&e.count>0&&h.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-[10px]",children:["(",e.count,")"]})]}),e.description&&h.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.description})]})]})})},eh=t=>h.jsx(hi.GroupHeading,{...t,children:h.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-700",children:t.data.label})}),Uk=t=>{const{data:e}=t;return h.jsxs(hi.MultiValueLabel,{...t,children:[h.jsx("span",{children:e.label}),e.count!==void 0&&e.count>0&&h.jsxs("span",{className:"text-xs opacity-60 ml-1",children:["(",e.count,")"]})]})},Bk=({value:t,options:e=[],onChange:n,creatable:r=!1,placeholder:s="검색 또는 입력...",noOptionsMessage:o="검색 결과가 없습니다",formatCreateLabel:i,createLabelSuffix:a="추가",maxItems:l,disabled:c=!1,onBeforeRemove:d,onCreateOption:u,className:f="",tagVariants:g,defaultVariant:m="blue",name:p,isMulti:y=!0,isClearable:b=!0,isSearchable:S=!0,delimiters:x=[","],splitOnPaste:E=!0,onInputChange:k,id:C,editorAttrs:N})=>{const _=c===!0||c==="true",w=v.useCallback(J=>J==null?[]:Array.isArray(J)?J:[J],[]),[M,O]=v.useState(()=>w(t)),[L,F]=v.useState(""),$=v.useRef(void 0);v.useEffect(()=>{const J=(ue,ae)=>!ue&&!ae?!0:!ue||!ae||ue.length!==ae.length?!1:ue.every((ve,fe)=>ve===ae[fe]),ce=w(t);J(ce,$.current)||(O(ce),$.current=ce)},[t,w]);const D=v.useMemo(()=>i?typeof i=="string"?J=>`${i} "${J}"`:i:J=>h.jsxs("span",{className:"text-[13px]",children:[h.jsx("strong",{children:J})," ",a]}),[i,a]),A=v.useMemo(()=>!M||!Array.isArray(M)?[]:M.map(J=>e.find(ue=>ue.value===J)||{value:J,label:String(J)}).filter(J=>J!==void 0),[M,e]),T=v.useMemo(()=>{const J=new Set(e.map(ke=>ke.value)),ce=M?M.filter(ke=>!J.has(ke)).map(ke=>({value:ke,label:String(ke)})):[],ue=[...e,...ce];if(!ue.some(ke=>ke.group))return ue;const ve=new Map,fe=[];ue.forEach(ke=>{if(ke.group){const Ue=ve.get(ke.group)||[];Ue.push(ke),ve.set(ke.group,Ue)}else fe.push(ke)});const ye=[];return ve.forEach((ke,Ue)=>{ye.push({label:Ue,options:ke})}),fe.length>0&&ye.push({label:"",options:fe}),ye},[e,M]),z=v.useCallback(J=>({target:{value:J},currentTarget:{value:J},preventDefault:()=>{},stopPropagation:()=>{}}),[]),H=v.useCallback(J=>{if(!x?.length)return[J.trim()].filter(Boolean);const ce=x.map(ae=>ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ue=new RegExp(`[${ce.join("")}]`);return J.split(ue).map(ae=>ae.trim()).filter(Boolean)},[x]),W=v.useCallback((J,ce)=>{if(ce.action!=="input-change"){F(J);return}if(k&&k(z(J)),!x?.some(fe=>J.includes(fe))||!r||!y){F(J);return}const ve=H(J).filter(fe=>fe&&!M.includes(fe));if(ve.length>0){const fe=l?l-M.length:1/0,ye=ve.slice(0,fe);if(ye.length>0){const ke=[...M,...ye];O(ke),n(z(ke))}}F("")},[x,r,y,H,M,l,n,z,k]),j=v.useCallback(J=>{if(!E||!r||!y)return;const ce=J.clipboardData.getData("text"),ue=H(ce);if(ue.length<=1)return;J.preventDefault();const ae=ue.filter(ve=>ve&&!M.includes(ve));if(ae.length>0){const ve=l?l-M.length:1/0,fe=ae.slice(0,ve);if(fe.length>0){const ye=[...M,...fe];O(ye),n(z(ye))}}},[E,r,y,H,M,l,n,z]),U=v.useCallback((J,ce)=>{if((ce.action==="remove-value"||ce.action==="pop-value")&&ce.removedValue&&d){const ae=d(ce.removedValue);if(ae!==!0){const ve=typeof ae=="string"?ae:`"${ce.removedValue.label}"은(는) 제거할 수 없습니다.`;alert(ve);return}}if(l&&J.length>l)return;const ue=J.map(ae=>ae.value);O(ue),n(z(ue))},[n,d,l,z]),B=v.useCallback((J,ce)=>{if(ce.action==="clear"&&M.length>0&&d){const ve=e.find(ye=>ye.value===M[0])||{value:M[0],label:String(M[0])},fe=d(ve);if(fe!==!0){const ye=typeof fe=="string"?fe:`"${ve.label}"은(는) 제거할 수 없습니다.`;alert(ye);return}}const ue=J?J.value:null,ae=J?[J.value]:[];O(ae),n(z(ue))},[n,d,M,e,z]),G=v.useCallback(J=>{u&&u(J);const ce=[...M||[],J];O(ce),n(z(ce))},[n,u,M,z]),V=v.useCallback(J=>!J||!J.trim()?!1:!M?.includes(J.trim()),[M]),K=v.useCallback(J=>{const ce=L.trim();if(J.key==="Tab"&&r&&y&&ce){if(M.includes(ce))J.preventDefault(),F("");else if(!l||M.lengthg&&g[J]?g[J]:m,[g,m]),Z={control:()=>`${Lt.control} ${f} ${_?"opacity-60 cursor-not-allowed":""}`,valueContainer:()=>Lt.valueContainer,multiValue:J=>{const ce=X(J.data.value);return Lt.multiValue[ce]},multiValueLabel:J=>{const ce=X(J.data.value);return Lt.multiValueLabel[ce]},multiValueRemove:J=>{const ce=X(J.data.value);return`${Lt.multiValueRemove[ce]} ${_?"pointer-events-none":""}`},singleValue:()=>"text-gray-900 dark:text-white text-sm",input:()=>Lt.input,placeholder:()=>Lt.placeholder,menu:()=>Lt.menu,menuList:()=>Lt.menuList,menuPortal:()=>"z-[9999]",option:J=>`${Lt.option.base} ${J.isSelected?Lt.option.selected:J.isFocused?Lt.option.focused:Lt.option.default}`,noOptionsMessage:()=>Lt.noOptionsMessage,clearIndicator:()=>"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer px-1",dropdownIndicator:()=>"text-gray-400 dark:text-gray-500 px-1"},ee={options:T,onKeyDown:K,placeholder:s,noOptionsMessage:()=>o,isDisabled:_,isSearchable:S,menuIsOpen:void 0,openMenuOnClick:!0,openMenuOnFocus:!0,menuPortalTarget:typeof document<"u"?document.body:null,menuPosition:"fixed",classNamePrefix:"tag-input",unstyled:!0,classNames:Z,...r&&y||k?{inputValue:L,onInputChange:W}:{}},ne=y?M.join(","):M[0]??"";if(!y){const J={...ee,isMulti:!1,value:A[0]||null,onChange:B,isClearable:b,closeMenuOnSelect:!0,components:{Option:Rf,GroupHeading:eh,IndicatorSeparator:()=>null,...b?{}:{ClearIndicator:()=>null}}};return r?h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Jf,{...J,onCreateOption:G,formatCreateLabel:D,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Zf,{...J})]})}const he={...ee,isMulti:!0,value:A,onChange:U,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!1,isClearable:!1,components:{Option:Rf,GroupHeading:eh,MultiValueLabel:Uk,ClearIndicator:()=>null,DropdownIndicator:()=>null,IndicatorSeparator:()=>null}};return r?h.jsxs(I,{id:C,...N,onPaste:j,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Jf,{...he,onCreateOption:G,formatCreateLabel:D,isValidNewOption:V,createOptionPosition:"first"})]}):h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Zf,{...he})]})},Gr=(t,e)=>window.G7Core?.t?.(t,e)??t,jk=()=>window.G7Core?.locale?.supported?.()??["ko","en"],Wk=()=>window.G7Core?.locale?.current?.()??"ko",Vl=t=>{const e=Gr(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},Gk=({value:t=[],onChange:e,placeholder:n="입력 후 Enter",disabled:r=!1,creatable:s=!0,delimiters:o=[","],className:i="",name:a,error:l,maxItems:c,modalId:d,statePath:u,__componentContext:f,id:g,editorAttrs:m})=>{const p=v.useMemo(()=>jk(),[]),y=v.useMemo(()=>Wk(),[]),[b,S]=v.useState(()=>t||[]),[x,E]=v.useState(""),[k,C]=v.useState(!1),[N,_]=v.useState(null),[w,M]=v.useState({}),O=v.useRef(null),L=v.useRef(void 0);v.useEffect(()=>{const V=(X,Z)=>!X&&!Z?!0:!X||!Z||X.length!==Z.length?!1:JSON.stringify(X)===JSON.stringify(Z),K=t||[];V(K,L.current)||(S(K),L.current=K)},[t]);const F=v.useCallback(V=>({target:{name:a,value:V},currentTarget:{name:a,value:V},preventDefault:()=>{},stopPropagation:()=>{}}),[a]),$=v.useCallback(V=>{const K=[];for(const X of p){const Z=V[X];Z?.trim()&&K.push(`${X.toUpperCase()}: ${Z}`)}return K.length>0?K.join(" / "):""},[p]),D=v.useCallback(V=>{const K=b.filter((X,Z)=>Z!==V);S(K),e?.(F(K))},[b,e,F]),A=v.useCallback((V,K,X)=>{const Z=window.G7Core;if(!Z?.dispatch)return;const ee=p.map(ne=>({code:ne,label:Vl(ne)}));Z.dispatch({handler:"setState",params:{target:"global",multilingualTagEdit:{fieldName:a,editingIndex:V,values:K,supportedLocales:ee,defaultLocale:y,statePath:u,currentTags:X}}}),Z.dispatch({handler:"openModal",target:d},{componentContext:f})},[a,p,y,d,u,f]),T=v.useCallback(V=>{r||(d?A(V,{...b[V]},b):(_(V),M({...b[V]}),C(!0)))},[r,b,d,A]),z=v.useCallback((V="")=>{const K={};p.forEach(X=>{K[X]=X===y?V:""}),d?(A(null,K,b),E("")):(_(null),M(K),C(!0),E(""))},[p,y,d,A,b]),H=v.useCallback(()=>{if(!Object.values(w).some(X=>X.trim()!=="")){C(!1);return}let K;N!==null?K=b.map((X,Z)=>Z===N?w:X):K=[...b,w],S(K),e?.(F(K)),C(!1),M({}),_(null)},[w,N,b,e,F]),W=v.useCallback(()=>{C(!1),M({}),_(null)},[]),j=v.useCallback(V=>{const K=V.target.value;if(o.some(Z=>K.includes(Z))&&s){const Z=o.map(he=>he.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ee=new RegExp(`[${Z.join("")}]`),ne=K.split(ee).map(he=>he.trim()).filter(Boolean);if(ne.length>0){z(ne[0]);return}}E(K)},[o,s,z]),U=v.useCallback(V=>{if(V.key==="Enter"&&x.trim()&&s){if(V.preventDefault(),c&&b.length>=c)return;z(x.trim())}},[x,s,c,b.length,z]),B=v.useCallback((V,K)=>{M(X=>({...X,[V]:K}))},[]),G=!!l;return h.jsxs(I,{className:i,id:g,...m,children:[h.jsxs(I,{className:`flex flex-wrap gap-1.5 p-2 border rounded-lg bg-white dark:bg-gray-700 min-h-[42px] ${G?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500"} ${r?"opacity-60 bg-gray-100 dark:bg-gray-800 cursor-not-allowed":""}`,children:[b.map((V,K)=>h.jsxs(I,{className:"flex items-center gap-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded px-2 py-0.5 text-sm",children:[h.jsx(Q,{className:`cursor-pointer hover:underline ${r?"cursor-not-allowed":""}`,onClick:()=>T(K),children:$(V)}),!r&&h.jsx(oe,{type:"button",className:"p-0 h-4 w-4 min-w-0 border-0 bg-transparent text-blue-600 dark:text-blue-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-transparent",onClick:X=>{X.stopPropagation(),D(K)},children:h.jsx(re,{name:"times",className:"text-xs"})})]},K)),s&&!r&&(!c||b.lengthh.jsxs(I,{className:"space-y-1",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300 w-16",children:Vl(V)}),h.jsxs(Q,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",V.toUpperCase(),")"]})]}),h.jsx(wt,{type:"text",value:w[V]??"",onChange:K=>B(V,K.target.value),placeholder:`${Vl(V)} 값 입력`,className:"w-full",autoFocus:V===y})]},V)),h.jsxs(I,{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[h.jsx(oe,{type:"button",variant:"secondary",onClick:W,children:Gr("common.cancel")}),h.jsx(oe,{type:"button",variant:"primary",onClick:H,children:Gr(N!==null?"common.save":"common.add")})]})]})}),a&&h.jsx("input",{type:"hidden",name:a,value:JSON.stringify(b)})]})},th=(t,e)=>window.G7Core?.t?.(t,e)??t,nh=({type:t,identifier:e,name:n,installedModules:r=[],installedPlugins:s=[],className:o="",style:i,id:a,editorAttrs:l})=>{const c={module:de.Cubes,plugin:de.PuzzlePiece},d={module:th("common.module"),plugin:th("common.plugin")},u=v.useMemo(()=>{if(n)return n;if(e){const p=(t==="module"?r:s)?.find(y=>y.identifier===e);if(p)return p.name}},[n,e,t,r,s]),f=c[t],g=u?`${u} ${d[t]}`:d[t];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium text-gray-400 dark:text-gray-500 ${o}`,style:i,id:a,...l,children:[h.jsx(re,{name:f,className:"w-3.5 h-3.5"}),h.jsx(Q,{children:g})]})},Yk=({options:t=[],value:e,onChange:n,multiple:r=!1,searchPlaceholder:s="Search...",onSearch:o,noResultsText:i="No results found",initialText:a="Type to search",triggerLabel:l="Select",triggerIcon:c,disabled:d=!1,className:u="",id:f,editorAttrs:g})=>{const[m,p]=v.useState(!1),[y,b]=v.useState(""),S=v.useRef(null),x=v.useRef(null),E=v.useRef(`searchable-dropdown-input-${Math.random().toString(36).slice(2,9)}`).current,k=v.useMemo(()=>e==null?[]:Array.isArray(e)?e:[e],[e]),C=v.useMemo(()=>{if(!y.trim())return t;const D=y.toLowerCase();return t.filter(A=>A.label.toLowerCase().includes(D)||A.description?.toLowerCase().includes(D))},[t,y]),N=v.useMemo(()=>{if(k.length===0)return l;if(r){const A=k.length;return A===1?t.find(z=>String(z.value)===String(k[0]))?.label||l:`${A} selected`}return t.find(A=>String(A.value)===String(k[0]))?.label||l},[k,t,r,l]);v.useEffect(()=>{const D=A=>{S.current&&!S.current.contains(A.target)&&p(!1)};return m&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[m]),v.useEffect(()=>{const D=A=>{A.key==="Escape"&&m&&(p(!1),x.current?.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m]),v.useEffect(()=>{if(!m){b("");return}const D=setTimeout(()=>{document.getElementById(E)?.focus()},50);return()=>{clearTimeout(D)}},[m,E]);const _=v.useCallback(()=>{d||p(D=>!D)},[d]),w=v.useCallback(D=>{const A=D.target.value;b(A),o?.(A)},[o]),M=v.useCallback(D=>{if(r){const T=k.some(z=>String(z)===String(D))?k.filter(z=>String(z)!==String(D)):[...k,D];n?.(T)}else n?.(D),p(!1),x.current?.focus()},[r,k,n]),O=D=>k.some(A=>String(A)===String(D)),L=y.length===0&&t.length===0,F=y.length>0&&C.length===0,$=C.length>0;return h.jsxs(I,{ref:S,className:`relative inline-block ${u}`,id:f,...g,children:[h.jsxs(oe,{ref:x,type:"button",onClick:_,disabled:d,className:` px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-gray-700 dark:text-gray-200 font-medium @@ -187,11 +187,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${D.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"} - `,role:"option","aria-selected":A,children:[h.jsx(I,{className:"w-5 h-5 flex-shrink-0 mt-0.5",children:A&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`font-medium ${A?"text-blue-600 dark:text-blue-400":"text-gray-900 dark:text-white"}`,children:D.label}),D.description&&h.jsx(I,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:D.description})]})]},D.value)})})]})]})]})},zs={container:{base:"tag-select",disabled:"opacity-50 cursor-not-allowed"},tag:"tag",tagRemove:"tag-remove",placeholder:"tag-select-placeholder"},Wk=({options:t=[],value:e=[],onChange:n,placeholder:r="No items selected",disabled:s=!1,className:o="",id:i,editorAttrs:a})=>{const l=v.useCallback(f=>t.find(m=>String(m.value)===String(f))?.label||String(f),[t]),c=v.useCallback(f=>{if(s)return;const g=e.filter(m=>String(m)!==String(f));n?.(g)},[e,n,s]),d=v.useMemo(()=>e.map(f=>({value:f,label:l(f)})),[e,l]),u=`${zs.container.base} ${s?zs.container.disabled:""} ${o}`.trim();return h.jsx(I,{className:u,id:i,...a,children:d.length===0?h.jsx(Q,{className:zs.placeholder,children:r}):d.map(f=>h.jsxs(Q,{className:zs.tag,children:[f.label,!s&&h.jsx(Q,{className:zs.tagRemove,onClick:()=>c(f.value),role:"button","aria-label":`Remove ${f.label}`,children:h.jsx(Hn,{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},f.value))})};function Gk(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const mi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yr(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Hl(t){return"nodeType"in t}function Yt(t){var e,n;return t?Yr(t)?t:Hl(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Ul(t){const{Document:e}=Yt(t);return t instanceof e}function Vs(t){return Yr(t)?!1:t instanceof Yt(t).HTMLElement}function nh(t){return t instanceof Yt(t).SVGElement}function Xr(t){return t?Yr(t)?t.document:Hl(t)?Ul(t)?t:Vs(t)||nh(t)?t.ownerDocument:document:document:document}const wn=mi?v.useLayoutEffect:v.useEffect;function bi(t){const e=v.useRef(t);return wn(()=>{e.current=t}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=v.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Hs(t,e){e===void 0&&(e=[t]);const n=v.useRef(t);return wn(()=>{n.current!==t&&(n.current=t)},e),n}function Us(t,e){const n=v.useRef();return v.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function yi(t){const e=bi(t),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function vi(t){const e=v.useRef();return v.useEffect(()=>{e.current=t},[t]),e.current}let Bl={};function Bs(t,e){return v.useMemo(()=>{if(e)return e;const n=Bl[t]==null?0:Bl[t]+1;return Bl[t]=n,t+"-"+n},[t,e])}function rh(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+t*c)}return o},{...e})}}const Kr=rh(1),js=rh(-1);function Xk(t){return"clientX"in t&&"clientY"in t}function xi(t){if(!t)return!1;const{KeyboardEvent:e}=Yt(t.target);return e&&t instanceof e}function Kk(t){if(!t)return!1;const{TouchEvent:e}=Yt(t.target);return e&&t instanceof e}function wi(t){if(Kk(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Xk(t)?{x:t.clientX,y:t.clientY}:null}const Ln=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Ln.Translate.toString(t),Ln.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),sh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qk(t){return t.matches(sh)?t:t.querySelector(sh)}const Zk={display:"none"};function Qk(t){let{id:e,value:n}=t;return v.createElement("div",{id:e,style:Zk},n)}function Jk(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return v.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function Rk(){const[t,e]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const oh=v.createContext(null);function eC(t){const e=v.useContext(oh);v.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function tC(){const[t]=v.useState(()=>new Set),e=v.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[v.useCallback(r=>{let{type:s,event:o}=r;t.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[t]),e]}const nC={draggable:` + `,role:"option","aria-selected":A,children:[h.jsx(I,{className:"w-5 h-5 flex-shrink-0 mt-0.5",children:A&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`font-medium ${A?"text-blue-600 dark:text-blue-400":"text-gray-900 dark:text-white"}`,children:D.label}),D.description&&h.jsx(I,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:D.description})]})]},D.value)})})]})]})]})},zs={container:{base:"tag-select",disabled:"opacity-50 cursor-not-allowed"},tag:"tag",tagRemove:"tag-remove",placeholder:"tag-select-placeholder"},Xk=({options:t=[],value:e=[],onChange:n,placeholder:r="No items selected",disabled:s=!1,className:o="",id:i,editorAttrs:a})=>{const l=v.useCallback(f=>t.find(m=>String(m.value)===String(f))?.label||String(f),[t]),c=v.useCallback(f=>{if(s)return;const g=e.filter(m=>String(m)!==String(f));n?.(g)},[e,n,s]),d=v.useMemo(()=>e.map(f=>({value:f,label:l(f)})),[e,l]),u=`${zs.container.base} ${s?zs.container.disabled:""} ${o}`.trim();return h.jsx(I,{className:u,id:i,...a,children:d.length===0?h.jsx(Q,{className:zs.placeholder,children:r}):d.map(f=>h.jsxs(Q,{className:zs.tag,children:[f.label,!s&&h.jsx(Q,{className:zs.tagRemove,onClick:()=>c(f.value),role:"button","aria-label":`Remove ${f.label}`,children:h.jsx(Hn,{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},f.value))})};function Kk(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const mi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yr(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Hl(t){return"nodeType"in t}function Yt(t){var e,n;return t?Yr(t)?t:Hl(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Ul(t){const{Document:e}=Yt(t);return t instanceof e}function Vs(t){return Yr(t)?!1:t instanceof Yt(t).HTMLElement}function rh(t){return t instanceof Yt(t).SVGElement}function Xr(t){return t?Yr(t)?t.document:Hl(t)?Ul(t)?t:Vs(t)||rh(t)?t.ownerDocument:document:document:document}const wn=mi?v.useLayoutEffect:v.useEffect;function bi(t){const e=v.useRef(t);return wn(()=>{e.current=t}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=v.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Hs(t,e){e===void 0&&(e=[t]);const n=v.useRef(t);return wn(()=>{n.current!==t&&(n.current=t)},e),n}function Us(t,e){const n=v.useRef();return v.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function yi(t){const e=bi(t),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function vi(t){const e=v.useRef();return v.useEffect(()=>{e.current=t},[t]),e.current}let Bl={};function Bs(t,e){return v.useMemo(()=>{if(e)return e;const n=Bl[t]==null?0:Bl[t]+1;return Bl[t]=n,t+"-"+n},[t,e])}function sh(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+t*c)}return o},{...e})}}const Kr=sh(1),js=sh(-1);function Zk(t){return"clientX"in t&&"clientY"in t}function xi(t){if(!t)return!1;const{KeyboardEvent:e}=Yt(t.target);return e&&t instanceof e}function Qk(t){if(!t)return!1;const{TouchEvent:e}=Yt(t.target);return e&&t instanceof e}function wi(t){if(Qk(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Zk(t)?{x:t.clientX,y:t.clientY}:null}const Ln=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Ln.Translate.toString(t),Ln.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),oh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Jk(t){return t.matches(oh)?t:t.querySelector(oh)}const Rk={display:"none"};function eC(t){let{id:e,value:n}=t;return v.createElement("div",{id:e,style:Rk},n)}function tC(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return v.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function nC(){const[t,e]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const ih=v.createContext(null);function rC(t){const e=v.useContext(ih);v.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function sC(){const[t]=v.useState(()=>new Set),e=v.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[v.useCallback(r=>{let{type:s,event:o}=r;t.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[t]),e]}const oC={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},rC={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function sC(t){let{announcements:e=rC,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=nC}=t;const{announce:o,announcement:i}=Rk(),a=Bs("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),eC(v.useMemo(()=>({onDragStart(u){let{active:f}=u;o(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:g}=u;e.onDragMove&&o(e.onDragMove({active:f,over:g}))},onDragOver(u){let{active:f,over:g}=u;o(e.onDragOver({active:f,over:g}))},onDragEnd(u){let{active:f,over:g}=u;o(e.onDragEnd({active:f,over:g}))},onDragCancel(u){let{active:f,over:g}=u;o(e.onDragCancel({active:f,over:g}))}}),[o,e])),!l)return null;const d=v.createElement(v.Fragment,null,v.createElement(Qk,{id:r,value:s.draggable}),v.createElement(Jk,{id:a,announcement:i}));return n?On.createPortal(d,n):d}var St;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(St||(St={}));function ki(){}function qr(t,e){return v.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function jl(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const kn=Object.freeze({x:0,y:0});function ih(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function oC(t,e){const n=wi(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function ah(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function iC(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function lh(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function ch(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function dh(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const Wl=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=dh(e,e.left,e.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=ih(dh(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(ah)},aC=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=lh(e),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=lh(l),d=s.reduce((f,g,m)=>f+ih(c[m],g),0),u=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(ah)};function lC(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),i=s-r,a=o-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=lC(a,e);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(iC)};function dC(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function uh(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:kn}function uC(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o({...i,top:i.top+t*a.y,bottom:i.bottom+t*a.y,left:i.left+t*a.x,right:i.right+t*a.x}),{...n})}}const fC=uC(1);function fh(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function hC(t,e,n){const r=fh(e);if(!r)return t;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=t.left-i-(1-s)*parseFloat(n),c=t.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?t.width/s:t.width,u=o?t.height/o:t.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const gC={ignoreTransform:!1};function Zr(t,e){e===void 0&&(e=gC);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Yt(t).getComputedStyle(t);c&&(n=hC(n,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function hh(t){return Zr(t,{ignoreTransform:!0})}function pC(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function mC(t,e){return e===void 0&&(e=Yt(t).getComputedStyle(t)),e.position==="fixed"}function bC(t,e){e===void 0&&(e=Yt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=e[s];return typeof o=="string"?n.test(o):!1})}function Ci(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Ul(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Vs(s)||nh(s)||n.includes(s))return n;const o=Yt(t).getComputedStyle(s);return s!==t&&bC(s,o)&&n.push(s),mC(s,o)?n:r(s.parentNode)}return t?r(t):n}function gh(t){const[e]=Ci(t,1);return e??null}function Gl(t){return!mi||!t?null:Yr(t)?t:Hl(t)?Ul(t)||t===Xr(t).scrollingElement?window:Vs(t)?t:null:null}function ph(t){return Yr(t)?t.scrollX:t.scrollLeft}function mh(t){return Yr(t)?t.scrollY:t.scrollTop}function Yl(t){return{x:ph(t),y:mh(t)}}var Mt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Mt||(Mt={}));function bh(t){return!mi||!t?!1:t===document.scrollingElement}function yh(t){const e={x:0,y:0},n=bh(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,i=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:e}}const yC={x:.2,y:.2};function vC(t,e,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=yC);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=yh(t),g={x:0,y:0},m={x:0,y:0},p={height:e.height*s.y,width:e.width*s.x};return!c&&o<=e.top+p.height?(g.y=Mt.Backward,m.y=r*Math.abs((e.top+p.height-o)/p.height)):!d&&l>=e.bottom-p.height&&(g.y=Mt.Forward,m.y=r*Math.abs((e.bottom-p.height-l)/p.height)),!f&&a>=e.right-p.width?(g.x=Mt.Forward,m.x=r*Math.abs((e.right-p.width-a)/p.width)):!u&&i<=e.left+p.width&&(g.x=Mt.Backward,m.x=r*Math.abs((e.left+p.width-i)/p.width)),{direction:g,speed:m}}function xC(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function vh(t){return t.reduce((e,n)=>Kr(e,Yl(n)),kn)}function wC(t){return t.reduce((e,n)=>e+ph(n),0)}function kC(t){return t.reduce((e,n)=>e+mh(n),0)}function xh(t,e){if(e===void 0&&(e=Zr),!t)return;const{top:n,left:r,bottom:s,right:o}=e(t);gh(t)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const CC=[["x",["left","right"],wC],["y",["top","bottom"],kC]];class Xl{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ci(n),s=vh(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,i,a]of CC)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ws{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function SC(t){const{EventTarget:e}=Yt(t);return t instanceof e?t:Xr(t)}function Kl(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var dn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(dn||(dn={}));function wh(t){t.preventDefault()}function _C(t){t.stopPropagation()}var qe;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(qe||(qe={}));const kh={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter,qe.Tab]},EC=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case qe.Right:return{...n,x:n.x+25};case qe.Left:return{...n,x:n.x-25};case qe.Down:return{...n,y:n.y+25};case qe.Up:return{...n,y:n.y-25}}};class Gs{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Ws(Xr(n)),this.windowListeners=new Ws(Yt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(dn.Resize,this.handleCancel),this.windowListeners.add(dn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(dn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&xh(r),n(kn)}handleKeyDown(e){if(xi(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=kh,coordinateGetter:i=EC,scrollBehavior:a="smooth"}=s,{code:l}=e;if(o.end.includes(l)){this.handleEnd(e);return}if(o.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:kn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(e,{active:n,context:r.current,currentCoordinates:d});if(u){const f=js(u,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const p of m){const y=e.code,{isTop:b,isRight:S,isLeft:x,isBottom:E,maxScroll:k,minScroll:C}=yh(p),N=xC(p),_={x:Math.min(y===qe.Right?N.right-N.width/2:N.right,Math.max(y===qe.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(y===qe.Down?N.bottom-N.height/2:N.bottom,Math.max(y===qe.Down?N.top:N.top+N.height/2,u.y))},w=y===qe.Right&&!S||y===qe.Left&&!x,M=y===qe.Down&&!E||y===qe.Up&&!b;if(w&&_.x!==u.x){const O=p.scrollLeft+f.x,L=y===qe.Right&&O<=k.x||y===qe.Left&&O>=C.x;if(L&&!f.y){p.scrollTo({left:O,behavior:a});return}L?g.x=p.scrollLeft-O:g.x=y===qe.Right?p.scrollLeft-k.x:p.scrollLeft-C.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(M&&_.y!==u.y){const O=p.scrollTop+f.y,L=y===qe.Down&&O<=k.y||y===qe.Up&&O>=C.y;if(L&&!f.x){p.scrollTo({top:O,behavior:a});return}L?g.y=p.scrollTop-O:g.y=y===qe.Down?p.scrollTop-k.y:p.scrollTop-C.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(e,Kr(js(u,this.referenceCoordinates),g))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Gs.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=kh,onActivation:s}=e,{active:o}=n;const{code:i}=t.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function Ch(t){return!!(t&&"distance"in t)}function Sh(t){return!!(t&&"delay"in t)}class ql{constructor(e,n,r){var s;r===void 0&&(r=SC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:o}=e,{target:i}=o;this.props=e,this.events=n,this.document=Xr(i),this.documentListeners=new Ws(this.document),this.listeners=new Ws(r),this.windowListeners=new Ws(Yt(i)),this.initialCoordinates=(s=wi(o))!=null?s:kn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(dn.Resize,this.handleCancel),this.windowListeners.add(dn.DragStart,wh),this.windowListeners.add(dn.VisibilityChange,this.handleCancel),this.windowListeners.add(dn.ContextMenu,wh),this.documentListeners.add(dn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Sh(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ch(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(dn.Click,_C,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(dn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=wi(e))!=null?n:kn,c=js(s,l);if(!r&&a){if(Ch(a)){if(a.tolerance!=null&&Kl(c,a.tolerance))return this.handleCancel();if(Kl(c,a.distance))return this.handleStart()}if(Sh(a)&&Kl(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const MC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ys extends ql{constructor(e){const{event:n}=e,r=Xr(n.target);super(e,MC,r)}}Ys.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const NC={move:{name:"mousemove"},end:{name:"mouseup"}};var Zl;(function(t){t[t.RightClick=2]="RightClick"})(Zl||(Zl={}));class OC extends ql{constructor(e){super(e,NC,Xr(e.event.target))}}OC.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Zl.RightClick?!1:(r?.({event:n}),!0)}}];const Ql={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class TC extends ql{constructor(e){super(e,Ql)}static setup(){return window.addEventListener(Ql.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ql.move.name,e)};function e(){}}}TC.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Xs;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Xs||(Xs={}));var Si;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Si||(Si={}));function AC(t){let{acceleration:e,activator:n=Xs.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=Si.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=t;const g=IC({delta:u,disabled:!o}),[m,p]=Yk(),y=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),S=v.useMemo(()=>{switch(n){case Xs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xs.DraggableRect:return s}},[n,s,l]),x=v.useRef(null),E=v.useCallback(()=>{const C=x.current;if(!C)return;const N=y.current.x*b.current.x,_=y.current.y*b.current.y;C.scrollBy(N,_)},[]),k=v.useMemo(()=>a===Si.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!S){p();return}for(const C of k){if(r?.(C)===!1)continue;const N=c.indexOf(C),_=d[N];if(!_)continue;const{direction:w,speed:M}=vC(C,_,S,e,f);for(const O of["x","y"])g[O][w[O]]||(M[O]=0,w[O]=0);if(M.x>0||M.y>0){p(),x.current=C,m(E,i),y.current=M,b.current=w;return}}y.current={x:0,y:0},b.current={x:0,y:0},p()},[e,E,r,p,o,i,JSON.stringify(S),JSON.stringify(g),m,c,k,d,JSON.stringify(f)])}const DC={x:{[Mt.Backward]:!1,[Mt.Forward]:!1},y:{[Mt.Backward]:!1,[Mt.Forward]:!1}};function IC(t){let{delta:e,disabled:n}=t;const r=vi(e);return Us(s=>{if(n||!r||!s)return DC;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Mt.Backward]:s.x[Mt.Backward]||o.x===-1,[Mt.Forward]:s.x[Mt.Forward]||o.x===1},y:{[Mt.Backward]:s.y[Mt.Backward]||o.y===-1,[Mt.Forward]:s.y[Mt.Forward]||o.y===1}}},[n,e,r])}function LC(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Us(s=>{var o;return e==null?null:(o=r??s)!=null?o:null},[r,e])}function PC(t,e){return v.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:e(i.handler,r)}));return[...n,...o]},[]),[t,e])}var Ks;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ks||(Ks={}));var Jl;(function(t){t.Optimized="optimized"})(Jl||(Jl={}));const _h=new Map;function $C(t,e){let{dragging:n,dependencies:r,config:s}=e;const[o,i]=v.useState(null),{frequency:a,measure:l,strategy:c}=s,d=v.useRef(t),u=y(),f=Hs(u),g=v.useCallback(function(b){b===void 0&&(b=[]),!f.current&&i(S=>S===null?b:S.concat(b.filter(x=>!S.includes(x))))},[f]),m=v.useRef(null),p=Us(b=>{if(u&&!n)return _h;if(!b||b===_h||d.current!==t||o!=null){const S=new Map;for(let x of t){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){S.set(x.id,x.rect.current);continue}const E=x.node.current,k=E?new Xl(l(E),E):null;x.rect.current=k,k&&S.set(x.id,k)}return S}return b},[t,o,n,u,l]);return v.useEffect(()=>{d.current=t},[t]),v.useEffect(()=>{u||g()},[n,u]),v.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),v.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:o!=null};function y(){switch(c){case Ks.Always:return!1;case Ks.BeforeDragging:return n;default:return!n}}}function Rl(t,e){return Us(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function FC(t,e){return Rl(t,e)}function zC(t){let{callback:e,disabled:n}=t;const r=bi(e),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function _i(t){let{callback:e,disabled:n}=t;const r=bi(e),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function VC(t){return new Xl(Zr(t),t)}function Eh(t,e,n){e===void 0&&(e=VC);const[r,s]=v.useState(null);function o(){s(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=zC({callback(l){if(t)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(t)){o();break}}}}),a=_i({callback:o});return wn(()=>{o(),t?(a?.observe(t),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[t]),r}function HC(t){const e=Rl(t);return uh(t,e)}const Mh=[];function UC(t){const e=v.useRef(t),n=Us(r=>t?r&&r!==Mh&&t&&e.current&&t.parentNode===e.current.parentNode?r:Ci(t):Mh,[t]);return v.useEffect(()=>{e.current=t},[t]),n}function BC(t){const[e,n]=v.useState(null),r=v.useRef(t),s=v.useCallback(o=>{const i=Gl(o.target);i&&n(a=>a?(a.set(i,Yl(i)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(t!==o){i(o);const a=t.map(l=>{const c=Gl(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,Yl(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{i(t),i(o)};function i(a){a.forEach(l=>{const c=Gl(l);c?.removeEventListener("scroll",s)})}},[s,t]),v.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,i)=>Kr(o,i),kn):vh(t):kn,[t,e])}function Nh(t,e){e===void 0&&(e=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},e),v.useEffect(()=>{const r=t!==kn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?js(t,n.current):kn}function jC(t){v.useEffect(()=>{if(!mi)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function WC(t,e){return v.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,e)},n},{}),[t,e])}function Oh(t){return v.useMemo(()=>t?pC(t):null,[t])}const Th=[];function GC(t,e){e===void 0&&(e=Zr);const[n]=t,r=Oh(n?Yt(n):null),[s,o]=v.useState(Th);function i(){o(()=>t.length?t.map(l=>bh(l)?r:new Xl(e(l),l)):Th)}const a=_i({callback:i});return wn(()=>{a?.disconnect(),i(),t.forEach(l=>a?.observe(l))},[t]),s}function Ah(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Vs(e)?e:t}function YC(t){let{measure:e}=t;const[n,r]=v.useState(null),s=v.useCallback(c=>{for(const{target:d}of c)if(Vs(d)){r(u=>{const f=e(d);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),o=_i({callback:s}),i=v.useCallback(c=>{const d=Ah(c);o?.disconnect(),d&&o?.observe(d),r(d?e(d):null)},[e,o]),[a,l]=yi(i);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const XC=[{sensor:Ys,options:{}},{sensor:Gs,options:{}}],KC={current:{}},Ei={draggable:{measure:hh},droppable:{measure:hh,strategy:Ks.WhileDragging,frequency:Jl.Optimized},dragOverlay:{measure:Zr}};class qs extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const qC={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ki},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ei,measureDroppableContainers:ki,windowRect:null,measuringScheduled:!1},Dh={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ki,draggableNodes:new Map,over:null,measureDroppableContainers:ki},Zs=v.createContext(Dh),Ih=v.createContext(qC);function ZC(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qs}}}function QC(t,e){switch(e.type){case St.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case St.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case St.DragEnd:case St.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case St.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new qs(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case St.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const i=new qs(t.droppable.containers);return i.set(n,{...o,disabled:s}),{...t,droppable:{...t.droppable,containers:i}}}case St.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new qs(t.droppable.containers);return o.delete(n),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function JC(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(Zs),o=vi(r),i=vi(n?.id);return v.useEffect(()=>{if(!e&&!r&&o&&i!=null){if(!xi(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=qk(d);if(u){u.focus();break}}})}},[r,e,s,i,o]),null}function Lh(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,o)=>o({transform:s,...r}),n):n}function RC(t){return v.useMemo(()=>({draggable:{...Ei.draggable,...t?.draggable},droppable:{...Ei.droppable,...t?.droppable},dragOverlay:{...Ei.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function eS(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const o=v.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;wn(()=>{if(!i&&!a||!e){o.current=!1;return}if(o.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),u=uh(d,r);if(i||(u.x=0),a||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=gh(c);f&&f.scrollBy({top:u.y,left:u.x})}},[e,i,a,r,n])}const Mi=v.createContext({...kn,scaleX:1,scaleY:1});var tr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(tr||(tr={}));const ec=v.memo(function(e){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=XC,collisionDetection:u=cC,measuring:f,modifiers:g,...m}=e;const p=v.useReducer(QC,void 0,ZC),[y,b]=p,[S,x]=tC(),[E,k]=v.useState(tr.Uninitialized),C=E===tr.Initialized,{draggable:{active:N,nodes:_,translate:w},droppable:{containers:M}}=y,O=N!=null?_.get(N):null,L=v.useRef({initial:null,translated:null}),F=v.useMemo(()=>{var $e;return N!=null?{id:N,data:($e=O?.data)!=null?$e:KC,rect:L}:null},[N,O]),$=v.useRef(null),[D,A]=v.useState(null),[T,z]=v.useState(null),H=Hs(m,Object.values(m)),W=Bs("DndDescribedBy",i),j=v.useMemo(()=>M.getEnabled(),[M]),U=RC(f),{droppableRects:B,measureDroppableContainers:G,measuringScheduled:V}=$C(j,{dragging:C,dependencies:[w.x,w.y],config:U.droppable}),K=LC(_,N),X=v.useMemo(()=>T?wi(T):null,[T]),Z=ot(),ee=FC(K,U.draggable.measure);eS({activeNode:N!=null?_.get(N):null,config:Z.layoutShiftCompensation,initialRect:ee,measure:U.draggable.measure});const ne=Eh(K,U.draggable.measure,ee),he=Eh(K?K.parentElement:null),J=v.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=M.getNodeFor((n=J.current.over)==null?void 0:n.id),ue=YC({measure:U.dragOverlay.measure}),ae=(r=ue.nodeRef.current)!=null?r:K,ve=C?(s=ue.rect)!=null?s:ne:null,fe=!!(ue.nodeRef.current&&ue.rect),ye=HC(fe?null:ne),ke=Oh(ae?Yt(ae):null),Ue=UC(C?ce??K:null),se=GC(Ue),Oe=Lh(g,{transform:{x:w.x-ye.x,y:w.y-ye.y,scaleX:1,scaleY:1},activatorEvent:T,active:F,activeNodeRect:ne,containerNodeRect:he,draggingNodeRect:ve,over:J.current.over,overlayNodeRect:ue.rect,scrollableAncestors:Ue,scrollableAncestorRects:se,windowRect:ke}),Pe=X?Kr(X,w):null,Ie=BC(Ue),je=Nh(Ie),st=Nh(Ie,[ne]),ut=Kr(Oe,je),We=ve?fC(ve,Oe):null,et=F&&We?u({active:F,collisionRect:We,droppableRects:B,droppableContainers:j,pointerCoordinates:Pe}):null,Xe=ch(et,"id"),[te,ge]=v.useState(null),pe=fe?Oe:Kr(Oe,st),me=dC(pe,(o=te?.rect)!=null?o:null,ne),be=v.useRef(null),Be=v.useCallback(($e,Te)=>{let{sensor:He,options:De}=Te;if($.current==null)return;const Ze=_.get($.current);if(!Ze)return;const it=$e.nativeEvent,gt=new He({active:$.current,activeNode:Ze,event:it,options:De,context:J,onAbort(mt){if(!_.get(mt))return;const{onDragAbort:Dt}=H.current,Ve={id:mt};Dt?.(Ve),S({type:"onDragAbort",event:Ve})},onPending(mt,xt,Dt,Ve){if(!_.get(mt))return;const{onDragPending:ln}=H.current,nn={id:mt,constraint:xt,initialCoordinates:Dt,offset:Ve};ln?.(nn),S({type:"onDragPending",event:nn})},onStart(mt){const xt=$.current;if(xt==null)return;const Dt=_.get(xt);if(!Dt)return;const{onDragStart:Ve}=H.current,Bt={activatorEvent:it,active:{id:xt,data:Dt.data,rect:L}};On.unstable_batchedUpdates(()=>{Ve?.(Bt),k(tr.Initializing),b({type:St.DragStart,initialCoordinates:mt,active:xt}),S({type:"onDragStart",event:Bt}),A(be.current),z(it)})},onMove(mt){b({type:St.DragMove,coordinates:mt})},onEnd:tn(St.DragEnd),onCancel:tn(St.DragCancel)});be.current=gt;function tn(mt){return async function(){const{active:Dt,collisions:Ve,over:Bt,scrollAdjustedTranslate:ln}=J.current;let nn=null;if(Dt&&ln){const{cancelDrop:Nn}=H.current;nn={activatorEvent:it,active:Dt,collisions:Ve,delta:ln,over:Bt},mt===St.DragEnd&&typeof Nn=="function"&&await Promise.resolve(Nn(nn))&&(mt=St.DragCancel)}$.current=null,On.unstable_batchedUpdates(()=>{b({type:mt}),k(tr.Uninitialized),ge(null),A(null),z(null),be.current=null;const Nn=mt===St.DragEnd?"onDragEnd":"onDragCancel";if(nn){const fr=H.current[Nn];fr?.(nn),S({type:Nn,event:nn})}})}}},[_]),Se=v.useCallback(($e,Te)=>(He,De)=>{const Ze=He.nativeEvent,it=_.get(De);if($.current!==null||!it||Ze.dndKit||Ze.defaultPrevented)return;const gt={active:it};$e(He,Te.options,gt)===!0&&(Ze.dndKit={capturedBy:Te.sensor},$.current=De,Be(He,Te))},[_,Be]),ze=PC(d,Se);jC(d),wn(()=>{ne&&E===tr.Initializing&&k(tr.Initialized)},[ne,E]),v.useEffect(()=>{const{onDragMove:$e}=H.current,{active:Te,activatorEvent:He,collisions:De,over:Ze}=J.current;if(!Te||!He)return;const it={active:Te,activatorEvent:He,collisions:De,delta:{x:ut.x,y:ut.y},over:Ze};On.unstable_batchedUpdates(()=>{$e?.(it),S({type:"onDragMove",event:it})})},[ut.x,ut.y]),v.useEffect(()=>{const{active:$e,activatorEvent:Te,collisions:He,droppableContainers:De,scrollAdjustedTranslate:Ze}=J.current;if(!$e||$.current==null||!Te||!Ze)return;const{onDragOver:it}=H.current,gt=De.get(Xe),tn=gt&>.rect.current?{id:gt.id,rect:gt.rect.current,data:gt.data,disabled:gt.disabled}:null,mt={active:$e,activatorEvent:Te,collisions:He,delta:{x:Ze.x,y:Ze.y},over:tn};On.unstable_batchedUpdates(()=>{ge(tn),it?.(mt),S({type:"onDragOver",event:mt})})},[Xe]),wn(()=>{J.current={activatorEvent:T,active:F,activeNode:K,collisionRect:We,collisions:et,droppableRects:B,draggableNodes:_,draggingNode:ae,draggingNodeRect:ve,droppableContainers:M,over:te,scrollableAncestors:Ue,scrollAdjustedTranslate:ut},L.current={initial:ve,translated:We}},[F,K,et,We,_,ae,ve,B,M,te,Ue,ut]),AC({...Z,delta:w,draggingRect:We,pointerCoordinates:Pe,scrollableAncestors:Ue,scrollableAncestorRects:se});const _e=v.useMemo(()=>({active:F,activeNode:K,activeNodeRect:ne,activatorEvent:T,collisions:et,containerNodeRect:he,dragOverlay:ue,draggableNodes:_,droppableContainers:M,droppableRects:B,over:te,measureDroppableContainers:G,scrollableAncestors:Ue,scrollableAncestorRects:se,measuringConfiguration:U,measuringScheduled:V,windowRect:ke}),[F,K,ne,T,et,he,ue,_,M,B,te,G,Ue,se,U,V,ke]),Re=v.useMemo(()=>({activatorEvent:T,activators:ze,active:F,activeNodeRect:ne,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:_,over:te,measureDroppableContainers:G}),[T,ze,F,ne,b,W,_,te,G]);return v.createElement(oh.Provider,{value:x},v.createElement(Zs.Provider,{value:Re},v.createElement(Ih.Provider,{value:_e},v.createElement(Mi.Provider,{value:me},c)),v.createElement(JC,{disabled:a?.restoreFocus===!1})),v.createElement(sC,{...a,hiddenTextDescribedById:W}));function ot(){const $e=D?.autoScrollEnabled===!1,Te=typeof l=="object"?l.enabled===!1:l===!1,He=C&&!$e&&!Te;return typeof l=="object"?{...l,enabled:He}:{enabled:He}}}),tS=v.createContext(null),Ph="button",nS="Draggable";function rS(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const o=Bs(nS),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=v.useContext(Zs),{role:g=Ph,roleDescription:m="draggable",tabIndex:p=0}=s??{},y=l?.id===e,b=v.useContext(y?Mi:tS),[S,x]=yi(),[E,k]=yi(),C=WC(i,e),N=Hs(n);wn(()=>(u.set(e,{id:e,key:o,node:S,activatorNode:E,data:N}),()=>{const w=u.get(e);w&&w.key===o&&u.delete(e)}),[u,e]);const _=v.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&g===Ph?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,p,y,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:_,isDragging:y,listeners:r?void 0:C,node:S,over:f,setNodeRef:x,setActivatorNodeRef:k,transform:b}}function $h(){return v.useContext(Ih)}const sS="Droppable",oS={timeout:25};function iS(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const o=Bs(sS),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(Zs),d=v.useRef({disabled:n}),u=v.useRef(!1),f=v.useRef(null),g=v.useRef(null),{disabled:m,updateMeasurementsFor:p,timeout:y}={...oS,...s},b=Hs(p??r),S=v.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},y)},[y]),x=_i({callback:S,disabled:m||!i}),E=v.useCallback((_,w)=>{x&&(w&&(x.unobserve(w),u.current=!1),_&&x.observe(_))},[x]),[k,C]=yi(E),N=Hs(e);return v.useEffect(()=>{!x||!k.current||(x.disconnect(),u.current=!1,x.observe(k.current))},[k,x]),v.useEffect(()=>(a({type:St.RegisterDroppable,element:{id:r,key:o,disabled:n,node:k,rect:f,data:N}}),()=>a({type:St.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:St.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:i,rect:f,isOver:l?.id===r,node:k,over:l,setNodeRef:C}}function aS(t){let{animation:e,children:n}=t;const[r,s]=v.useState(null),[o,i]=v.useState(null),a=vi(n);return!n&&!r&&a&&s(a),wn(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(e(c,o)).then(()=>{s(null)})},[e,r,o]),v.createElement(v.Fragment,null,n,r?v.cloneElement(r,{ref:i}):null)}const lS={x:0,y:0,scaleX:1,scaleY:1};function cS(t){let{children:e}=t;return v.createElement(Zs.Provider,{value:Dh},v.createElement(Mi.Provider,{value:lS},e))}const dS={position:"fixed",touchAction:"none"},uS=t=>xi(t)?"transform 250ms ease":void 0,fS=v.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=uS}=t;if(!a)return null;const u=s?c:{...c,scaleX:1,scaleY:1},f={...dS,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ln.Transform.toString(u),transformOrigin:s&&r?oC(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return v.createElement(n,{className:i,style:f,ref:e},o)}),hS={duration:250,easing:"ease",keyframes:t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Ln.Transform.toString(e)},{transform:Ln.Transform.toString(n)}]},sideEffects:(t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:o,className:i}=t;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function gS(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return bi((o,i)=>{if(e===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Ah(i);if(!c)return;const{transform:d}=Yt(i).getComputedStyle(i),u=fh(d);if(!u)return;const f=typeof e=="function"?e:pS(e);return xh(l,s.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function pS(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...hS,...t};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!e)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...u},g=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:f}}),[m]=g,p=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(p))return;const y=r?.({active:i,dragOverlay:a,...c}),b=a.node.animate(g,{duration:e,easing:n,fill:"forwards"});return new Promise(S=>{b.onfinish=()=>{y?.(),S()}})}}let Fh=0;function mS(t){return v.useMemo(()=>{if(t!=null)return Fh++,Fh},[t])}const bS=v.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggableNodes:m,droppableContainers:p,dragOverlay:y,over:b,measuringConfiguration:S,scrollableAncestors:x,scrollableAncestorRects:E,windowRect:k}=$h(),C=v.useContext(Mi),N=mS(u?.id),_=Lh(i,{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:y.rect,over:b,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:E,transform:C,windowRect:k}),w=Rl(f),M=gS({config:r,draggableNodes:m,droppableContainers:p,measuringConfiguration:S}),O=w?y.setRef:void 0;return v.createElement(cS,null,v.createElement(aS,{animation:M},u&&N?v.createElement(fS,{key:N,id:u.id,ref:O,as:a,activatorEvent:d,adjustScale:e,className:l,transition:o,rect:w,style:{zIndex:c,...s},transform:_},n):null))});function Qr(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function yS(t,e){return t.reduce((n,r,s)=>{const o=e.get(r);return o&&(n[s]=o),n},Array(t.length))}function Ni(t){return t!==null&&t>=0}function vS(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const o=Qr(e,r,n),i=e[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},Ti={scaleX:1,scaleY:1},tc=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=t;const a=(e=o[n])!=null?e:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:nn&&s<=i?{x:0,y:-a.height-l,...Ti}:s=i?{x:0,y:a.height+l,...Ti}:{x:0,y:0,...Ti}};function wS(t,e,n){const r=t[e],s=t[e-1],o=t[e+1];return r?nr.map(C=>typeof C=="object"&&"id"in C?C.id:C),[r]),m=i!=null,p=i?g.indexOf(i.id):-1,y=c?g.indexOf(c.id):-1,b=v.useRef(g),S=!vS(g,b.current),x=y!==-1&&p===-1||S,E=xS(o);wn(()=>{S&&m&&d(g)},[S,g,m,d]),v.useEffect(()=>{b.current=g},[g]);const k=v.useMemo(()=>({activeIndex:p,containerId:u,disabled:E,disableTransforms:x,items:g,overIndex:y,useDragOverlay:f,sortedRects:yS(g,l),strategy:s}),[p,u,E.draggable,E.droppable,x,g,y,l,f,s]);return v.createElement(Vh.Provider,{value:k},e)}const Hh=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return Qr(n,r,s).indexOf(e)},Uh=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&e===l},kS={duration:200,easing:"ease"},Bh="transform",CS=Ln.Transition.toString({property:Bh,duration:0,easing:"linear"}),SS={roleDescription:"sortable"};function _S(t){let{disabled:e,index:n,node:r,rect:s}=t;const[o,i]=v.useState(null),a=v.useRef(n);return wn(()=>{if(!e&&n!==a.current&&r.current){const l=s.current;if(l){const c=Zr(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}n!==a.current&&(a.current=n)},[e,n,r,s]),v.useEffect(()=>{o&&i(null)},[o]),o}function Di(t){let{animateLayoutChanges:e=Uh,attributes:n,disabled:r,data:s,getNewIndex:o=Hh,id:i,strategy:a,resizeObserverConfig:l,transition:c=kS}=t;const{items:d,containerId:u,activeIndex:f,disabled:g,disableTransforms:m,sortedRects:p,overIndex:y,useDragOverlay:b,strategy:S}=v.useContext(Vh),x=ES(r,g),E=d.indexOf(i),k=v.useMemo(()=>({sortable:{containerId:u,index:E,items:d},...s}),[u,s,E,d]),C=v.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:N,node:_,isOver:w,setNodeRef:M}=iS({id:i,data:k,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:L,activeNodeRect:F,attributes:$,setNodeRef:D,listeners:A,isDragging:T,over:z,setActivatorNodeRef:H,transform:W}=rS({id:i,data:k,attributes:{...SS,...n},disabled:x.draggable}),j=Gk(M,D),U=!!O,B=U&&!m&&Ni(f)&&Ni(y),G=!b&&T,V=G&&B?W:null,X=B?V??(a??S)({rects:p,activeNodeRect:F,activeIndex:f,overIndex:y,index:E}):null,Z=Ni(f)&&Ni(y)?o({id:i,items:d,activeIndex:f,overIndex:y}):E,ee=O?.id,ne=v.useRef({activeId:ee,items:d,newIndex:Z,containerId:u}),he=d!==ne.current.items,J=e({active:O,containerId:u,isDragging:T,isSorting:U,id:i,index:E,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),ce=_S({disabled:!J,index:E,node:_,rect:N});return v.useEffect(()=>{U&&ne.current.newIndex!==Z&&(ne.current.newIndex=Z),u!==ne.current.containerId&&(ne.current.containerId=u),d!==ne.current.items&&(ne.current.items=d)},[U,Z,u,d]),v.useEffect(()=>{if(ee===ne.current.activeId)return;if(ee!=null&&ne.current.activeId==null){ne.current.activeId=ee;return}const ae=setTimeout(()=>{ne.current.activeId=ee},50);return()=>clearTimeout(ae)},[ee]),{active:O,activeIndex:f,attributes:$,data:k,rect:N,index:E,newIndex:Z,items:d,isOver:w,isSorting:U,isDragging:T,listeners:A,node:_,overIndex:y,over:z,setNodeRef:j,setActivatorNodeRef:H,setDroppableNodeRef:M,setDraggableNodeRef:D,transform:ce??X,transition:ue()};function ue(){if(ce||he&&ne.current.newIndex===E)return CS;if(!(G&&!xi(L)||!c)&&(U||J))return Ln.Transition.toString({...c,property:Bh})}}function ES(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function Qs(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const MS=[qe.Down,qe.Right,qe.Up,qe.Left],Ii=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=e;if(MS.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(t.code){case qe.Down:r.topf.top&&l.push(u);break;case qe.Left:r.left>f.left&&l.push(u);break;case qe.Right:r.left1&&(d=c[1].id),d!=null){const u=o.get(n.id),f=o.get(d),g=f?s.get(f.id):null,m=f?.node.current;if(m&&g&&u&&f){const y=Ci(m).some((C,N)=>a[N]!==C),b=jh(u,f),S=NS(u,f),x=y||!b?{x:0,y:0}:{x:S?r.width-g.width:0,y:S?r.height-g.height:0},E={x:g.left,y:g.top};return x.x&&x.y?E:js(E,x)}}}};function jh(t,e){return!Qs(t)||!Qs(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function NS(t,e){return!Qs(t)||!Qs(e)||!jh(t,e)?!1:t.data.current.sortable.indexwindow.G7Core,Wh=({item:t,isSelected:e=!1,isExpanded:n=!1,level:r=0,onClick:s,onToggle:o,onExpandToggle:i,className:a="",selectedClassName:l="bg-blue-50 dark:bg-blue-900/30 border-blue-500",defaultClassName:c="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600",dragHandleClassName:d="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",iconContainerClassName:u="bg-gray-100 dark:bg-gray-700",contentClassName:f="",enableDrag:g=!0,toggleDisabled:m=!1})=>{const{attributes:p,listeners:y,setNodeRef:b,transform:S,transition:x,isDragging:E}=Di({id:t.id}),k={transform:Ln.Transform.toString(S),transition:x,opacity:E?.5:1},C=r*24+12,_=`flex items-center gap-2 cursor-pointer transition-colors ${e?l:c}`,w=TS()?.style?.mergeClasses?.(_,a)??`${_} ${a}`.trim();return h.jsxs(I,{ref:b,style:k,className:w,onClick:s,children:[g&&h.jsx(I,{...p,...y,className:`flex-shrink-0 cursor-grab active:cursor-grabbing p-1 ${d}`,style:{paddingLeft:`${C}px`},children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),!g&&r>0&&h.jsx(I,{style:{paddingLeft:`${C}px`}}),g&&h.jsx(h.Fragment,{children:t.hasChildren?h.jsx(oe,{type:"button",onClick:M=>{M.stopPropagation(),i?.()},className:`flex-shrink-0 p-1 ${d}`,children:h.jsx(re,{name:n?"chevron-down":"chevron-right",className:"w-4 h-4"})}):h.jsx(I,{className:"flex-shrink-0 w-6"})}),h.jsx(I,{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center rounded ${u}`,children:h.jsx(re,{name:t.icon||"file",className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:`flex-1 min-w-0 ${f}`,children:[h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:t.name}),t.isModuleMenu&&h.jsx(re,{name:"cube",className:"w-2 h-2 text-gray-300 dark:text-gray-500 ml-2",title:t.moduleName})]}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400 truncate block",children:t.url})]}),h.jsx(I,{className:"flex-shrink-0",onClick:M=>M.stopPropagation(),children:h.jsx(Ha,{checked:t.isActive,onChange:()=>o?.(new MouseEvent("click")),size:"sm",disabled:m})})]})},AS=()=>window.G7Core;function Gh(t,e,n=0,r=null){const s=[];for(const o of t)s.push({item:o,depth:n,parentId:r}),o.children?.length>0&&e.has(o.id)&&s.push(...Gh(o.children,e,n+1,o.id));return s}function nc(t,e){for(const n of t){if(n.id===e)return n;if(n.children){const r=nc(n.children,e);if(r)return r}}return null}function Yh(t){const e=[];if(t.children)for(const n of t.children)e.push(n.id),e.push(...Yh(n));return e}function Xh(t,e){return t.filter(n=>n.id!==e).map(n=>n.children?.length>0?{...n,children:Xh(n.children,e)}:n)}function Kh(t,e,n,r){if(n===null){const s=[...t];return s.splice(r,0,e),s}return t.map(s=>{if(s.id===n){const o=[...s.children||[]];return o.splice(r,0,e),{...s,children:o}}return s.children?.length>0?{...s,children:Kh(s.children,e,n,r)}:s})}function qh(t,e,n,r){if(e===null){const s=t.findIndex(i=>i.id===n),o=t.findIndex(i=>i.id===r);return s===-1||o===-1?t:Qr(t,s,o)}return t.map(s=>{if(s.id===e&&s.children){const o=s.children.findIndex(a=>a.id===n),i=s.children.findIndex(a=>a.id===r);return o===-1||i===-1?s:{...s,children:Qr(s.children,o,i)}}return s.children?.length>0?{...s,children:qh(s.children,e,n,r)}:s})}function Zh(t){const e=t.map((s,o)=>({id:s.id,order:o+1})),n={},r=s=>{s.forEach(o=>{o.children?.length>0&&(n[o.id]=o.children.map((i,a)=>({id:i.id,order:a+1})),r(o.children))})};return r(t),{parent_menus:e,child_menus:n}}const DS=({items:t=[],selectedId:e,onSelect:n,onOrderChange:r,onToggleStatus:s,title:o,className:i="",listClassName:a="",childrenContainerClassName:l="bg-gray-50 dark:bg-gray-900/50",itemClassName:c="py-2.5 px-3 mx-4 my-2 rounded-lg border",itemSelectedClassName:d,itemDefaultClassName:u,titleClassName:f="px-4 py-3 border-b border-gray-200 dark:border-gray-700",enableDrag:g=!0,toggleDisabled:m=!1,id:p,editorAttrs:y})=>{const[b,S]=v.useState(new Set),[x,E]=v.useState(null),[k,C]=v.useState(t),N=v.useRef(!1),_=v.useRef(""),w=v.useRef(""),M=v.useCallback(B=>JSON.stringify(B),[]),O=v.useCallback(B=>B.map(G=>{const V=G.children?.map(K=>K.id).join(",")||"";return`${G.id}:${V}`}).join("|"),[]);v.useEffect(()=>{const B=O(t),G=M(t);if(N.current){const V=O(k);(B===V||B!==_.current)&&(N.current=!1,_.current=B,w.current=G,(B!==V||G!==M(k))&&C(t));return}G!==w.current&&(_.current=B,w.current=G,C(t))},[t,O,M,k]);const L=jl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Ii})),F=v.useCallback(B=>{if(typeof B=="string")return B;const V=AS()?.locale?.current?.()||"ko";return B[V]||B.en||Object.values(B)[0]||""},[]),$=v.useCallback(B=>{S(G=>{const V=new Set(G);return V.has(B)?V.delete(B):V.add(B),V})},[]),D=v.useCallback(B=>{n?.(B)},[n]),A=v.useCallback((B,G,V)=>{V.stopPropagation(),s?.(B,G)},[s]),T=B=>{E(B.active.id)},z=B=>{const{active:G,over:V}=B;if(E(null),!V||G.id===V.id)return;const K=W.find(Z=>Z.item.id===Number(G.id)),X=W.find(Z=>Z.item.id===Number(V.id));if(!(!K||!X))if(K.parentId===X.parentId){const Z=qh(k,K.parentId,Number(G.id),Number(V.id));C(Z),N.current=!0,r?.(Zh(Z))}else{const Z=K.item;if(Yh(Z).includes(Number(V.id)))return;let ne=Xh(k,Z.id);const he=W.findIndex(ye=>ye.item.id===Number(G.id)),J=W.findIndex(ye=>ye.item.id===Number(V.id)),ce=he>J,ue=X.parentId;let ae;if(ue===null)ae=ne.findIndex(ye=>ye.id===Number(V.id)),ae===-1?ae=ne.length:ce||(ae+=1);else{const ke=nc(ne,ue)?.children||[];ae=ke.findIndex(Ue=>Ue.id===Number(V.id)),ae===-1?ae=ke.length:ce||(ae+=1)}const ve={...Z,parent_id:ue,children:Z.children||[]};ne=Kh(ne,ve,ue,ae),C(ne),N.current=!0;const fe=Zh(ne);fe.moved_items=[{id:Z.id,new_parent_id:ue}],r?.(fe)}},H=B=>({id:B.id,name:F(B.name),slug:B.slug,url:B.url,icon:B.icon,isActive:B.is_active,isModuleMenu:!!B.module_id,moduleName:B.module?F(B.module.name):void 0,hasChildren:B.children&&B.children.length>0}),W=v.useMemo(()=>Gh(k,b),[k,b]),j=v.useMemo(()=>W.map(B=>B.item.id),[W]),U=x?nc(k,Number(x)):null;return h.jsxs(I,{className:i,id:p,...y,children:[o&&h.jsx(I,{className:f,children:h.jsx(Ir,{className:"text-sm font-medium text-gray-900 dark:text-white",children:o})}),h.jsxs(ec,{sensors:L,collisionDetection:Wl,onDragStart:T,onDragEnd:z,children:[h.jsx(Ai,{items:j,strategy:tc,children:h.jsx(I,{className:a,children:W.map(B=>h.jsx(I,{className:B.depth>0?l:"",children:h.jsx(Wh,{item:H(B.item),isSelected:e===B.item.id,isExpanded:b.has(B.item.id),level:B.depth,onClick:()=>D(B.item),onToggle:G=>A(B.item.id,B.item.is_active,G),onExpandToggle:()=>$(B.item.id),className:c,selectedClassName:d,defaultClassName:u,enableDrag:g,toggleDisabled:m})},B.item.id))})}),h.jsx(bS,{children:U?h.jsx(I,{className:"bg-white dark:bg-gray-800 shadow-lg rounded-lg border border-blue-500 p-3",children:h.jsx(I,{className:"flex items-center gap-2",children:h.jsx(I,{className:"text-sm font-medium text-gray-900 dark:text-white",children:F(U.name)})})}):null})]})]})},IS=[{value:"LayoutDashboard",label:"LayoutDashboard",faIcon:"tachometer-alt"},{value:"Settings",label:"Settings",faIcon:"cog"},{value:"Menu",label:"Menu",faIcon:"bars"},{value:"Users",label:"Users",faIcon:"users"},{value:"Package",label:"Package",faIcon:"cube"},{value:"Puzzle",label:"Puzzle",faIcon:"puzzle-piece"},{value:"FileText",label:"FileText",faIcon:"file-alt"},{value:"ShoppingCart",label:"ShoppingCart",faIcon:"shopping-cart"},{value:"MessageSquare",label:"MessageSquare",faIcon:"comment"},{value:"Home",label:"Home",faIcon:"home"},{value:"User",label:"User",faIcon:"user"},{value:"Search",label:"Search",faIcon:"search"},{value:"Bell",label:"Bell",faIcon:"bell"},{value:"Mail",label:"Mail",faIcon:"envelope"},{value:"Calendar",label:"Calendar",faIcon:"calendar"},{value:"Chart",label:"Chart",faIcon:"chart-bar"},{value:"Database",label:"Database",faIcon:"database"},{value:"Lock",label:"Lock",faIcon:"lock"},{value:"Globe",label:"Globe",faIcon:"globe"},{value:"Image",label:"Image",faIcon:"image"}],LS=({value:t,onChange:e,options:n=IS,placeholder:r,searchPlaceholder:s,noResultsText:o,className:i="",disabled:a=!1,name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),[g,m]=v.useState(""),p=v.useRef(null),y=n.find(x=>{if(!t)return!1;if(t.includes("fa-")){const E=t.replace(/^(fas|far|fab|fal|fad)\s+fa-/,"");return x.faIcon===E||x.faIcon===t}return x.value===t||x.faIcon===t}),b=n.filter(x=>x.label.toLowerCase().includes(g.toLowerCase()));v.useEffect(()=>{const x=E=>{p.current&&!p.current.contains(E.target)&&(f(!1),m(""))};if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const S=x=>{const E=`fas fa-${x.faIcon}`;e?.(E),f(!1),m("")};return h.jsxs(I,{ref:p,className:`relative ${i}`,id:c,...d,children:[h.jsxs(oe,{type:"button",onClick:()=>!a&&f(!u),disabled:a,className:` + `},iC={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function aC(t){let{announcements:e=iC,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=oC}=t;const{announce:o,announcement:i}=nC(),a=Bs("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),rC(v.useMemo(()=>({onDragStart(u){let{active:f}=u;o(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:g}=u;e.onDragMove&&o(e.onDragMove({active:f,over:g}))},onDragOver(u){let{active:f,over:g}=u;o(e.onDragOver({active:f,over:g}))},onDragEnd(u){let{active:f,over:g}=u;o(e.onDragEnd({active:f,over:g}))},onDragCancel(u){let{active:f,over:g}=u;o(e.onDragCancel({active:f,over:g}))}}),[o,e])),!l)return null;const d=v.createElement(v.Fragment,null,v.createElement(eC,{id:r,value:s.draggable}),v.createElement(tC,{id:a,announcement:i}));return n?On.createPortal(d,n):d}var St;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(St||(St={}));function ki(){}function qr(t,e){return v.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function jl(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const kn=Object.freeze({x:0,y:0});function ah(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function lC(t,e){const n=wi(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function lh(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function cC(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function ch(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function dh(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function uh(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const Wl=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=uh(e,e.left,e.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=ah(uh(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(lh)},dC=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=ch(e),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=ch(l),d=s.reduce((f,g,m)=>f+ah(c[m],g),0),u=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(lh)};function uC(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),i=s-r,a=o-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=uC(a,e);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(cC)};function hC(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function fh(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:kn}function gC(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o({...i,top:i.top+t*a.y,bottom:i.bottom+t*a.y,left:i.left+t*a.x,right:i.right+t*a.x}),{...n})}}const pC=gC(1);function hh(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function mC(t,e,n){const r=hh(e);if(!r)return t;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=t.left-i-(1-s)*parseFloat(n),c=t.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?t.width/s:t.width,u=o?t.height/o:t.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const bC={ignoreTransform:!1};function Zr(t,e){e===void 0&&(e=bC);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Yt(t).getComputedStyle(t);c&&(n=mC(n,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function gh(t){return Zr(t,{ignoreTransform:!0})}function yC(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function vC(t,e){return e===void 0&&(e=Yt(t).getComputedStyle(t)),e.position==="fixed"}function xC(t,e){e===void 0&&(e=Yt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=e[s];return typeof o=="string"?n.test(o):!1})}function Ci(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Ul(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Vs(s)||rh(s)||n.includes(s))return n;const o=Yt(t).getComputedStyle(s);return s!==t&&xC(s,o)&&n.push(s),vC(s,o)?n:r(s.parentNode)}return t?r(t):n}function ph(t){const[e]=Ci(t,1);return e??null}function Gl(t){return!mi||!t?null:Yr(t)?t:Hl(t)?Ul(t)||t===Xr(t).scrollingElement?window:Vs(t)?t:null:null}function mh(t){return Yr(t)?t.scrollX:t.scrollLeft}function bh(t){return Yr(t)?t.scrollY:t.scrollTop}function Yl(t){return{x:mh(t),y:bh(t)}}var Mt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Mt||(Mt={}));function yh(t){return!mi||!t?!1:t===document.scrollingElement}function vh(t){const e={x:0,y:0},n=yh(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,i=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:e}}const wC={x:.2,y:.2};function kC(t,e,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=wC);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=vh(t),g={x:0,y:0},m={x:0,y:0},p={height:e.height*s.y,width:e.width*s.x};return!c&&o<=e.top+p.height?(g.y=Mt.Backward,m.y=r*Math.abs((e.top+p.height-o)/p.height)):!d&&l>=e.bottom-p.height&&(g.y=Mt.Forward,m.y=r*Math.abs((e.bottom-p.height-l)/p.height)),!f&&a>=e.right-p.width?(g.x=Mt.Forward,m.x=r*Math.abs((e.right-p.width-a)/p.width)):!u&&i<=e.left+p.width&&(g.x=Mt.Backward,m.x=r*Math.abs((e.left+p.width-i)/p.width)),{direction:g,speed:m}}function CC(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function xh(t){return t.reduce((e,n)=>Kr(e,Yl(n)),kn)}function SC(t){return t.reduce((e,n)=>e+mh(n),0)}function _C(t){return t.reduce((e,n)=>e+bh(n),0)}function wh(t,e){if(e===void 0&&(e=Zr),!t)return;const{top:n,left:r,bottom:s,right:o}=e(t);ph(t)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const EC=[["x",["left","right"],SC],["y",["top","bottom"],_C]];class Xl{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ci(n),s=xh(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,i,a]of EC)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ws{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function MC(t){const{EventTarget:e}=Yt(t);return t instanceof e?t:Xr(t)}function Kl(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var dn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(dn||(dn={}));function kh(t){t.preventDefault()}function NC(t){t.stopPropagation()}var qe;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(qe||(qe={}));const Ch={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter,qe.Tab]},OC=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case qe.Right:return{...n,x:n.x+25};case qe.Left:return{...n,x:n.x-25};case qe.Down:return{...n,y:n.y+25};case qe.Up:return{...n,y:n.y-25}}};class Gs{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Ws(Xr(n)),this.windowListeners=new Ws(Yt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(dn.Resize,this.handleCancel),this.windowListeners.add(dn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(dn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&wh(r),n(kn)}handleKeyDown(e){if(xi(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=Ch,coordinateGetter:i=OC,scrollBehavior:a="smooth"}=s,{code:l}=e;if(o.end.includes(l)){this.handleEnd(e);return}if(o.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:kn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(e,{active:n,context:r.current,currentCoordinates:d});if(u){const f=js(u,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const p of m){const y=e.code,{isTop:b,isRight:S,isLeft:x,isBottom:E,maxScroll:k,minScroll:C}=vh(p),N=CC(p),_={x:Math.min(y===qe.Right?N.right-N.width/2:N.right,Math.max(y===qe.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(y===qe.Down?N.bottom-N.height/2:N.bottom,Math.max(y===qe.Down?N.top:N.top+N.height/2,u.y))},w=y===qe.Right&&!S||y===qe.Left&&!x,M=y===qe.Down&&!E||y===qe.Up&&!b;if(w&&_.x!==u.x){const O=p.scrollLeft+f.x,L=y===qe.Right&&O<=k.x||y===qe.Left&&O>=C.x;if(L&&!f.y){p.scrollTo({left:O,behavior:a});return}L?g.x=p.scrollLeft-O:g.x=y===qe.Right?p.scrollLeft-k.x:p.scrollLeft-C.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(M&&_.y!==u.y){const O=p.scrollTop+f.y,L=y===qe.Down&&O<=k.y||y===qe.Up&&O>=C.y;if(L&&!f.x){p.scrollTo({top:O,behavior:a});return}L?g.y=p.scrollTop-O:g.y=y===qe.Down?p.scrollTop-k.y:p.scrollTop-C.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(e,Kr(js(u,this.referenceCoordinates),g))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Gs.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=Ch,onActivation:s}=e,{active:o}=n;const{code:i}=t.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function Sh(t){return!!(t&&"distance"in t)}function _h(t){return!!(t&&"delay"in t)}class ql{constructor(e,n,r){var s;r===void 0&&(r=MC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:o}=e,{target:i}=o;this.props=e,this.events=n,this.document=Xr(i),this.documentListeners=new Ws(this.document),this.listeners=new Ws(r),this.windowListeners=new Ws(Yt(i)),this.initialCoordinates=(s=wi(o))!=null?s:kn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(dn.Resize,this.handleCancel),this.windowListeners.add(dn.DragStart,kh),this.windowListeners.add(dn.VisibilityChange,this.handleCancel),this.windowListeners.add(dn.ContextMenu,kh),this.documentListeners.add(dn.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(_h(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Sh(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(dn.Click,NC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(dn.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=wi(e))!=null?n:kn,c=js(s,l);if(!r&&a){if(Sh(a)){if(a.tolerance!=null&&Kl(c,a.tolerance))return this.handleCancel();if(Kl(c,a.distance))return this.handleStart()}if(_h(a)&&Kl(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const TC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ys extends ql{constructor(e){const{event:n}=e,r=Xr(n.target);super(e,TC,r)}}Ys.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const AC={move:{name:"mousemove"},end:{name:"mouseup"}};var Zl;(function(t){t[t.RightClick=2]="RightClick"})(Zl||(Zl={}));class DC extends ql{constructor(e){super(e,AC,Xr(e.event.target))}}DC.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Zl.RightClick?!1:(r?.({event:n}),!0)}}];const Ql={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class IC extends ql{constructor(e){super(e,Ql)}static setup(){return window.addEventListener(Ql.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ql.move.name,e)};function e(){}}}IC.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Xs;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Xs||(Xs={}));var Si;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Si||(Si={}));function LC(t){let{acceleration:e,activator:n=Xs.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=Si.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=t;const g=$C({delta:u,disabled:!o}),[m,p]=qk(),y=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),S=v.useMemo(()=>{switch(n){case Xs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xs.DraggableRect:return s}},[n,s,l]),x=v.useRef(null),E=v.useCallback(()=>{const C=x.current;if(!C)return;const N=y.current.x*b.current.x,_=y.current.y*b.current.y;C.scrollBy(N,_)},[]),k=v.useMemo(()=>a===Si.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!S){p();return}for(const C of k){if(r?.(C)===!1)continue;const N=c.indexOf(C),_=d[N];if(!_)continue;const{direction:w,speed:M}=kC(C,_,S,e,f);for(const O of["x","y"])g[O][w[O]]||(M[O]=0,w[O]=0);if(M.x>0||M.y>0){p(),x.current=C,m(E,i),y.current=M,b.current=w;return}}y.current={x:0,y:0},b.current={x:0,y:0},p()},[e,E,r,p,o,i,JSON.stringify(S),JSON.stringify(g),m,c,k,d,JSON.stringify(f)])}const PC={x:{[Mt.Backward]:!1,[Mt.Forward]:!1},y:{[Mt.Backward]:!1,[Mt.Forward]:!1}};function $C(t){let{delta:e,disabled:n}=t;const r=vi(e);return Us(s=>{if(n||!r||!s)return PC;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Mt.Backward]:s.x[Mt.Backward]||o.x===-1,[Mt.Forward]:s.x[Mt.Forward]||o.x===1},y:{[Mt.Backward]:s.y[Mt.Backward]||o.y===-1,[Mt.Forward]:s.y[Mt.Forward]||o.y===1}}},[n,e,r])}function FC(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Us(s=>{var o;return e==null?null:(o=r??s)!=null?o:null},[r,e])}function zC(t,e){return v.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:e(i.handler,r)}));return[...n,...o]},[]),[t,e])}var Ks;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ks||(Ks={}));var Jl;(function(t){t.Optimized="optimized"})(Jl||(Jl={}));const Eh=new Map;function VC(t,e){let{dragging:n,dependencies:r,config:s}=e;const[o,i]=v.useState(null),{frequency:a,measure:l,strategy:c}=s,d=v.useRef(t),u=y(),f=Hs(u),g=v.useCallback(function(b){b===void 0&&(b=[]),!f.current&&i(S=>S===null?b:S.concat(b.filter(x=>!S.includes(x))))},[f]),m=v.useRef(null),p=Us(b=>{if(u&&!n)return Eh;if(!b||b===Eh||d.current!==t||o!=null){const S=new Map;for(let x of t){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){S.set(x.id,x.rect.current);continue}const E=x.node.current,k=E?new Xl(l(E),E):null;x.rect.current=k,k&&S.set(x.id,k)}return S}return b},[t,o,n,u,l]);return v.useEffect(()=>{d.current=t},[t]),v.useEffect(()=>{u||g()},[n,u]),v.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),v.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:o!=null};function y(){switch(c){case Ks.Always:return!1;case Ks.BeforeDragging:return n;default:return!n}}}function Rl(t,e){return Us(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function HC(t,e){return Rl(t,e)}function UC(t){let{callback:e,disabled:n}=t;const r=bi(e),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function _i(t){let{callback:e,disabled:n}=t;const r=bi(e),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function BC(t){return new Xl(Zr(t),t)}function Mh(t,e,n){e===void 0&&(e=BC);const[r,s]=v.useState(null);function o(){s(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=UC({callback(l){if(t)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(t)){o();break}}}}),a=_i({callback:o});return wn(()=>{o(),t?(a?.observe(t),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[t]),r}function jC(t){const e=Rl(t);return fh(t,e)}const Nh=[];function WC(t){const e=v.useRef(t),n=Us(r=>t?r&&r!==Nh&&t&&e.current&&t.parentNode===e.current.parentNode?r:Ci(t):Nh,[t]);return v.useEffect(()=>{e.current=t},[t]),n}function GC(t){const[e,n]=v.useState(null),r=v.useRef(t),s=v.useCallback(o=>{const i=Gl(o.target);i&&n(a=>a?(a.set(i,Yl(i)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(t!==o){i(o);const a=t.map(l=>{const c=Gl(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,Yl(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{i(t),i(o)};function i(a){a.forEach(l=>{const c=Gl(l);c?.removeEventListener("scroll",s)})}},[s,t]),v.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,i)=>Kr(o,i),kn):xh(t):kn,[t,e])}function Oh(t,e){e===void 0&&(e=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},e),v.useEffect(()=>{const r=t!==kn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?js(t,n.current):kn}function YC(t){v.useEffect(()=>{if(!mi)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function XC(t,e){return v.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,e)},n},{}),[t,e])}function Th(t){return v.useMemo(()=>t?yC(t):null,[t])}const Ah=[];function KC(t,e){e===void 0&&(e=Zr);const[n]=t,r=Th(n?Yt(n):null),[s,o]=v.useState(Ah);function i(){o(()=>t.length?t.map(l=>yh(l)?r:new Xl(e(l),l)):Ah)}const a=_i({callback:i});return wn(()=>{a?.disconnect(),i(),t.forEach(l=>a?.observe(l))},[t]),s}function Dh(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Vs(e)?e:t}function qC(t){let{measure:e}=t;const[n,r]=v.useState(null),s=v.useCallback(c=>{for(const{target:d}of c)if(Vs(d)){r(u=>{const f=e(d);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),o=_i({callback:s}),i=v.useCallback(c=>{const d=Dh(c);o?.disconnect(),d&&o?.observe(d),r(d?e(d):null)},[e,o]),[a,l]=yi(i);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const ZC=[{sensor:Ys,options:{}},{sensor:Gs,options:{}}],QC={current:{}},Ei={draggable:{measure:gh},droppable:{measure:gh,strategy:Ks.WhileDragging,frequency:Jl.Optimized},dragOverlay:{measure:Zr}};class qs extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const JC={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ki},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ei,measureDroppableContainers:ki,windowRect:null,measuringScheduled:!1},Ih={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ki,draggableNodes:new Map,over:null,measureDroppableContainers:ki},Zs=v.createContext(Ih),Lh=v.createContext(JC);function RC(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qs}}}function eS(t,e){switch(e.type){case St.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case St.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case St.DragEnd:case St.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case St.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new qs(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case St.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const i=new qs(t.droppable.containers);return i.set(n,{...o,disabled:s}),{...t,droppable:{...t.droppable,containers:i}}}case St.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new qs(t.droppable.containers);return o.delete(n),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function tS(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(Zs),o=vi(r),i=vi(n?.id);return v.useEffect(()=>{if(!e&&!r&&o&&i!=null){if(!xi(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=Jk(d);if(u){u.focus();break}}})}},[r,e,s,i,o]),null}function Ph(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,o)=>o({transform:s,...r}),n):n}function nS(t){return v.useMemo(()=>({draggable:{...Ei.draggable,...t?.draggable},droppable:{...Ei.droppable,...t?.droppable},dragOverlay:{...Ei.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function rS(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const o=v.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;wn(()=>{if(!i&&!a||!e){o.current=!1;return}if(o.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),u=fh(d,r);if(i||(u.x=0),a||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=ph(c);f&&f.scrollBy({top:u.y,left:u.x})}},[e,i,a,r,n])}const Mi=v.createContext({...kn,scaleX:1,scaleY:1});var tr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(tr||(tr={}));const ec=v.memo(function(e){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=ZC,collisionDetection:u=fC,measuring:f,modifiers:g,...m}=e;const p=v.useReducer(eS,void 0,RC),[y,b]=p,[S,x]=sC(),[E,k]=v.useState(tr.Uninitialized),C=E===tr.Initialized,{draggable:{active:N,nodes:_,translate:w},droppable:{containers:M}}=y,O=N!=null?_.get(N):null,L=v.useRef({initial:null,translated:null}),F=v.useMemo(()=>{var $e;return N!=null?{id:N,data:($e=O?.data)!=null?$e:QC,rect:L}:null},[N,O]),$=v.useRef(null),[D,A]=v.useState(null),[T,z]=v.useState(null),H=Hs(m,Object.values(m)),W=Bs("DndDescribedBy",i),j=v.useMemo(()=>M.getEnabled(),[M]),U=nS(f),{droppableRects:B,measureDroppableContainers:G,measuringScheduled:V}=VC(j,{dragging:C,dependencies:[w.x,w.y],config:U.droppable}),K=FC(_,N),X=v.useMemo(()=>T?wi(T):null,[T]),Z=ot(),ee=HC(K,U.draggable.measure);rS({activeNode:N!=null?_.get(N):null,config:Z.layoutShiftCompensation,initialRect:ee,measure:U.draggable.measure});const ne=Mh(K,U.draggable.measure,ee),he=Mh(K?K.parentElement:null),J=v.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=M.getNodeFor((n=J.current.over)==null?void 0:n.id),ue=qC({measure:U.dragOverlay.measure}),ae=(r=ue.nodeRef.current)!=null?r:K,ve=C?(s=ue.rect)!=null?s:ne:null,fe=!!(ue.nodeRef.current&&ue.rect),ye=jC(fe?null:ne),ke=Th(ae?Yt(ae):null),Ue=WC(C?ce??K:null),se=KC(Ue),Oe=Ph(g,{transform:{x:w.x-ye.x,y:w.y-ye.y,scaleX:1,scaleY:1},activatorEvent:T,active:F,activeNodeRect:ne,containerNodeRect:he,draggingNodeRect:ve,over:J.current.over,overlayNodeRect:ue.rect,scrollableAncestors:Ue,scrollableAncestorRects:se,windowRect:ke}),Pe=X?Kr(X,w):null,Ie=GC(Ue),je=Oh(Ie),st=Oh(Ie,[ne]),ut=Kr(Oe,je),We=ve?pC(ve,Oe):null,et=F&&We?u({active:F,collisionRect:We,droppableRects:B,droppableContainers:j,pointerCoordinates:Pe}):null,Xe=dh(et,"id"),[te,ge]=v.useState(null),pe=fe?Oe:Kr(Oe,st),me=hC(pe,(o=te?.rect)!=null?o:null,ne),be=v.useRef(null),Be=v.useCallback(($e,Te)=>{let{sensor:He,options:De}=Te;if($.current==null)return;const Ze=_.get($.current);if(!Ze)return;const it=$e.nativeEvent,gt=new He({active:$.current,activeNode:Ze,event:it,options:De,context:J,onAbort(mt){if(!_.get(mt))return;const{onDragAbort:Dt}=H.current,Ve={id:mt};Dt?.(Ve),S({type:"onDragAbort",event:Ve})},onPending(mt,xt,Dt,Ve){if(!_.get(mt))return;const{onDragPending:ln}=H.current,nn={id:mt,constraint:xt,initialCoordinates:Dt,offset:Ve};ln?.(nn),S({type:"onDragPending",event:nn})},onStart(mt){const xt=$.current;if(xt==null)return;const Dt=_.get(xt);if(!Dt)return;const{onDragStart:Ve}=H.current,Bt={activatorEvent:it,active:{id:xt,data:Dt.data,rect:L}};On.unstable_batchedUpdates(()=>{Ve?.(Bt),k(tr.Initializing),b({type:St.DragStart,initialCoordinates:mt,active:xt}),S({type:"onDragStart",event:Bt}),A(be.current),z(it)})},onMove(mt){b({type:St.DragMove,coordinates:mt})},onEnd:tn(St.DragEnd),onCancel:tn(St.DragCancel)});be.current=gt;function tn(mt){return async function(){const{active:Dt,collisions:Ve,over:Bt,scrollAdjustedTranslate:ln}=J.current;let nn=null;if(Dt&&ln){const{cancelDrop:Nn}=H.current;nn={activatorEvent:it,active:Dt,collisions:Ve,delta:ln,over:Bt},mt===St.DragEnd&&typeof Nn=="function"&&await Promise.resolve(Nn(nn))&&(mt=St.DragCancel)}$.current=null,On.unstable_batchedUpdates(()=>{b({type:mt}),k(tr.Uninitialized),ge(null),A(null),z(null),be.current=null;const Nn=mt===St.DragEnd?"onDragEnd":"onDragCancel";if(nn){const fr=H.current[Nn];fr?.(nn),S({type:Nn,event:nn})}})}}},[_]),Se=v.useCallback(($e,Te)=>(He,De)=>{const Ze=He.nativeEvent,it=_.get(De);if($.current!==null||!it||Ze.dndKit||Ze.defaultPrevented)return;const gt={active:it};$e(He,Te.options,gt)===!0&&(Ze.dndKit={capturedBy:Te.sensor},$.current=De,Be(He,Te))},[_,Be]),ze=zC(d,Se);YC(d),wn(()=>{ne&&E===tr.Initializing&&k(tr.Initialized)},[ne,E]),v.useEffect(()=>{const{onDragMove:$e}=H.current,{active:Te,activatorEvent:He,collisions:De,over:Ze}=J.current;if(!Te||!He)return;const it={active:Te,activatorEvent:He,collisions:De,delta:{x:ut.x,y:ut.y},over:Ze};On.unstable_batchedUpdates(()=>{$e?.(it),S({type:"onDragMove",event:it})})},[ut.x,ut.y]),v.useEffect(()=>{const{active:$e,activatorEvent:Te,collisions:He,droppableContainers:De,scrollAdjustedTranslate:Ze}=J.current;if(!$e||$.current==null||!Te||!Ze)return;const{onDragOver:it}=H.current,gt=De.get(Xe),tn=gt&>.rect.current?{id:gt.id,rect:gt.rect.current,data:gt.data,disabled:gt.disabled}:null,mt={active:$e,activatorEvent:Te,collisions:He,delta:{x:Ze.x,y:Ze.y},over:tn};On.unstable_batchedUpdates(()=>{ge(tn),it?.(mt),S({type:"onDragOver",event:mt})})},[Xe]),wn(()=>{J.current={activatorEvent:T,active:F,activeNode:K,collisionRect:We,collisions:et,droppableRects:B,draggableNodes:_,draggingNode:ae,draggingNodeRect:ve,droppableContainers:M,over:te,scrollableAncestors:Ue,scrollAdjustedTranslate:ut},L.current={initial:ve,translated:We}},[F,K,et,We,_,ae,ve,B,M,te,Ue,ut]),LC({...Z,delta:w,draggingRect:We,pointerCoordinates:Pe,scrollableAncestors:Ue,scrollableAncestorRects:se});const _e=v.useMemo(()=>({active:F,activeNode:K,activeNodeRect:ne,activatorEvent:T,collisions:et,containerNodeRect:he,dragOverlay:ue,draggableNodes:_,droppableContainers:M,droppableRects:B,over:te,measureDroppableContainers:G,scrollableAncestors:Ue,scrollableAncestorRects:se,measuringConfiguration:U,measuringScheduled:V,windowRect:ke}),[F,K,ne,T,et,he,ue,_,M,B,te,G,Ue,se,U,V,ke]),Re=v.useMemo(()=>({activatorEvent:T,activators:ze,active:F,activeNodeRect:ne,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:_,over:te,measureDroppableContainers:G}),[T,ze,F,ne,b,W,_,te,G]);return v.createElement(ih.Provider,{value:x},v.createElement(Zs.Provider,{value:Re},v.createElement(Lh.Provider,{value:_e},v.createElement(Mi.Provider,{value:me},c)),v.createElement(tS,{disabled:a?.restoreFocus===!1})),v.createElement(aC,{...a,hiddenTextDescribedById:W}));function ot(){const $e=D?.autoScrollEnabled===!1,Te=typeof l=="object"?l.enabled===!1:l===!1,He=C&&!$e&&!Te;return typeof l=="object"?{...l,enabled:He}:{enabled:He}}}),sS=v.createContext(null),$h="button",oS="Draggable";function iS(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const o=Bs(oS),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=v.useContext(Zs),{role:g=$h,roleDescription:m="draggable",tabIndex:p=0}=s??{},y=l?.id===e,b=v.useContext(y?Mi:sS),[S,x]=yi(),[E,k]=yi(),C=XC(i,e),N=Hs(n);wn(()=>(u.set(e,{id:e,key:o,node:S,activatorNode:E,data:N}),()=>{const w=u.get(e);w&&w.key===o&&u.delete(e)}),[u,e]);const _=v.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&g===$h?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,p,y,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:_,isDragging:y,listeners:r?void 0:C,node:S,over:f,setNodeRef:x,setActivatorNodeRef:k,transform:b}}function Fh(){return v.useContext(Lh)}const aS="Droppable",lS={timeout:25};function cS(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const o=Bs(aS),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(Zs),d=v.useRef({disabled:n}),u=v.useRef(!1),f=v.useRef(null),g=v.useRef(null),{disabled:m,updateMeasurementsFor:p,timeout:y}={...lS,...s},b=Hs(p??r),S=v.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},y)},[y]),x=_i({callback:S,disabled:m||!i}),E=v.useCallback((_,w)=>{x&&(w&&(x.unobserve(w),u.current=!1),_&&x.observe(_))},[x]),[k,C]=yi(E),N=Hs(e);return v.useEffect(()=>{!x||!k.current||(x.disconnect(),u.current=!1,x.observe(k.current))},[k,x]),v.useEffect(()=>(a({type:St.RegisterDroppable,element:{id:r,key:o,disabled:n,node:k,rect:f,data:N}}),()=>a({type:St.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:St.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:i,rect:f,isOver:l?.id===r,node:k,over:l,setNodeRef:C}}function dS(t){let{animation:e,children:n}=t;const[r,s]=v.useState(null),[o,i]=v.useState(null),a=vi(n);return!n&&!r&&a&&s(a),wn(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(e(c,o)).then(()=>{s(null)})},[e,r,o]),v.createElement(v.Fragment,null,n,r?v.cloneElement(r,{ref:i}):null)}const uS={x:0,y:0,scaleX:1,scaleY:1};function fS(t){let{children:e}=t;return v.createElement(Zs.Provider,{value:Ih},v.createElement(Mi.Provider,{value:uS},e))}const hS={position:"fixed",touchAction:"none"},gS=t=>xi(t)?"transform 250ms ease":void 0,pS=v.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=gS}=t;if(!a)return null;const u=s?c:{...c,scaleX:1,scaleY:1},f={...hS,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ln.Transform.toString(u),transformOrigin:s&&r?lC(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return v.createElement(n,{className:i,style:f,ref:e},o)}),mS={duration:250,easing:"ease",keyframes:t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Ln.Transform.toString(e)},{transform:Ln.Transform.toString(n)}]},sideEffects:(t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:o,className:i}=t;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function bS(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return bi((o,i)=>{if(e===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Dh(i);if(!c)return;const{transform:d}=Yt(i).getComputedStyle(i),u=hh(d);if(!u)return;const f=typeof e=="function"?e:yS(e);return wh(l,s.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function yS(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...mS,...t};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!e)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...u},g=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:f}}),[m]=g,p=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(p))return;const y=r?.({active:i,dragOverlay:a,...c}),b=a.node.animate(g,{duration:e,easing:n,fill:"forwards"});return new Promise(S=>{b.onfinish=()=>{y?.(),S()}})}}let zh=0;function vS(t){return v.useMemo(()=>{if(t!=null)return zh++,zh},[t])}const xS=v.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggableNodes:m,droppableContainers:p,dragOverlay:y,over:b,measuringConfiguration:S,scrollableAncestors:x,scrollableAncestorRects:E,windowRect:k}=Fh(),C=v.useContext(Mi),N=vS(u?.id),_=Ph(i,{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:y.rect,over:b,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:E,transform:C,windowRect:k}),w=Rl(f),M=bS({config:r,draggableNodes:m,droppableContainers:p,measuringConfiguration:S}),O=w?y.setRef:void 0;return v.createElement(fS,null,v.createElement(dS,{animation:M},u&&N?v.createElement(pS,{key:N,id:u.id,ref:O,as:a,activatorEvent:d,adjustScale:e,className:l,transition:o,rect:w,style:{zIndex:c,...s},transform:_},n):null))});function Qr(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function wS(t,e){return t.reduce((n,r,s)=>{const o=e.get(r);return o&&(n[s]=o),n},Array(t.length))}function Ni(t){return t!==null&&t>=0}function kS(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const o=Qr(e,r,n),i=e[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},Ti={scaleX:1,scaleY:1},tc=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=t;const a=(e=o[n])!=null?e:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:nn&&s<=i?{x:0,y:-a.height-l,...Ti}:s=i?{x:0,y:a.height+l,...Ti}:{x:0,y:0,...Ti}};function SS(t,e,n){const r=t[e],s=t[e-1],o=t[e+1];return r?nr.map(C=>typeof C=="object"&&"id"in C?C.id:C),[r]),m=i!=null,p=i?g.indexOf(i.id):-1,y=c?g.indexOf(c.id):-1,b=v.useRef(g),S=!kS(g,b.current),x=y!==-1&&p===-1||S,E=CS(o);wn(()=>{S&&m&&d(g)},[S,g,m,d]),v.useEffect(()=>{b.current=g},[g]);const k=v.useMemo(()=>({activeIndex:p,containerId:u,disabled:E,disableTransforms:x,items:g,overIndex:y,useDragOverlay:f,sortedRects:wS(g,l),strategy:s}),[p,u,E.draggable,E.droppable,x,g,y,l,f,s]);return v.createElement(Hh.Provider,{value:k},e)}const Uh=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return Qr(n,r,s).indexOf(e)},Bh=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&e===l},_S={duration:200,easing:"ease"},jh="transform",ES=Ln.Transition.toString({property:jh,duration:0,easing:"linear"}),MS={roleDescription:"sortable"};function NS(t){let{disabled:e,index:n,node:r,rect:s}=t;const[o,i]=v.useState(null),a=v.useRef(n);return wn(()=>{if(!e&&n!==a.current&&r.current){const l=s.current;if(l){const c=Zr(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}n!==a.current&&(a.current=n)},[e,n,r,s]),v.useEffect(()=>{o&&i(null)},[o]),o}function Di(t){let{animateLayoutChanges:e=Bh,attributes:n,disabled:r,data:s,getNewIndex:o=Uh,id:i,strategy:a,resizeObserverConfig:l,transition:c=_S}=t;const{items:d,containerId:u,activeIndex:f,disabled:g,disableTransforms:m,sortedRects:p,overIndex:y,useDragOverlay:b,strategy:S}=v.useContext(Hh),x=OS(r,g),E=d.indexOf(i),k=v.useMemo(()=>({sortable:{containerId:u,index:E,items:d},...s}),[u,s,E,d]),C=v.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:N,node:_,isOver:w,setNodeRef:M}=cS({id:i,data:k,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:L,activeNodeRect:F,attributes:$,setNodeRef:D,listeners:A,isDragging:T,over:z,setActivatorNodeRef:H,transform:W}=iS({id:i,data:k,attributes:{...MS,...n},disabled:x.draggable}),j=Kk(M,D),U=!!O,B=U&&!m&&Ni(f)&&Ni(y),G=!b&&T,V=G&&B?W:null,X=B?V??(a??S)({rects:p,activeNodeRect:F,activeIndex:f,overIndex:y,index:E}):null,Z=Ni(f)&&Ni(y)?o({id:i,items:d,activeIndex:f,overIndex:y}):E,ee=O?.id,ne=v.useRef({activeId:ee,items:d,newIndex:Z,containerId:u}),he=d!==ne.current.items,J=e({active:O,containerId:u,isDragging:T,isSorting:U,id:i,index:E,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),ce=NS({disabled:!J,index:E,node:_,rect:N});return v.useEffect(()=>{U&&ne.current.newIndex!==Z&&(ne.current.newIndex=Z),u!==ne.current.containerId&&(ne.current.containerId=u),d!==ne.current.items&&(ne.current.items=d)},[U,Z,u,d]),v.useEffect(()=>{if(ee===ne.current.activeId)return;if(ee!=null&&ne.current.activeId==null){ne.current.activeId=ee;return}const ae=setTimeout(()=>{ne.current.activeId=ee},50);return()=>clearTimeout(ae)},[ee]),{active:O,activeIndex:f,attributes:$,data:k,rect:N,index:E,newIndex:Z,items:d,isOver:w,isSorting:U,isDragging:T,listeners:A,node:_,overIndex:y,over:z,setNodeRef:j,setActivatorNodeRef:H,setDroppableNodeRef:M,setDraggableNodeRef:D,transform:ce??X,transition:ue()};function ue(){if(ce||he&&ne.current.newIndex===E)return ES;if(!(G&&!xi(L)||!c)&&(U||J))return Ln.Transition.toString({...c,property:jh})}}function OS(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function Qs(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const TS=[qe.Down,qe.Right,qe.Up,qe.Left],Ii=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=e;if(TS.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(t.code){case qe.Down:r.topf.top&&l.push(u);break;case qe.Left:r.left>f.left&&l.push(u);break;case qe.Right:r.left1&&(d=c[1].id),d!=null){const u=o.get(n.id),f=o.get(d),g=f?s.get(f.id):null,m=f?.node.current;if(m&&g&&u&&f){const y=Ci(m).some((C,N)=>a[N]!==C),b=Wh(u,f),S=AS(u,f),x=y||!b?{x:0,y:0}:{x:S?r.width-g.width:0,y:S?r.height-g.height:0},E={x:g.left,y:g.top};return x.x&&x.y?E:js(E,x)}}}};function Wh(t,e){return!Qs(t)||!Qs(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function AS(t,e){return!Qs(t)||!Qs(e)||!Wh(t,e)?!1:t.data.current.sortable.indexwindow.G7Core,Gh=({item:t,isSelected:e=!1,isExpanded:n=!1,level:r=0,onClick:s,onToggle:o,onExpandToggle:i,className:a="",selectedClassName:l="bg-blue-50 dark:bg-blue-900/30 border-blue-500",defaultClassName:c="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600",dragHandleClassName:d="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",iconContainerClassName:u="bg-gray-100 dark:bg-gray-700",contentClassName:f="",enableDrag:g=!0,toggleDisabled:m=!1})=>{const{attributes:p,listeners:y,setNodeRef:b,transform:S,transition:x,isDragging:E}=Di({id:t.id}),k={transform:Ln.Transform.toString(S),transition:x,opacity:E?.5:1},C=r*24+12,_=`flex items-center gap-2 cursor-pointer transition-colors ${e?l:c}`,w=IS()?.style?.mergeClasses?.(_,a)??`${_} ${a}`.trim();return h.jsxs(I,{ref:b,style:k,className:w,onClick:s,children:[g&&h.jsx(I,{...p,...y,className:`flex-shrink-0 cursor-grab active:cursor-grabbing p-1 ${d}`,style:{paddingLeft:`${C}px`},children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),!g&&r>0&&h.jsx(I,{style:{paddingLeft:`${C}px`}}),g&&h.jsx(h.Fragment,{children:t.hasChildren?h.jsx(oe,{type:"button",onClick:M=>{M.stopPropagation(),i?.()},className:`flex-shrink-0 p-1 ${d}`,children:h.jsx(re,{name:n?"chevron-down":"chevron-right",className:"w-4 h-4"})}):h.jsx(I,{className:"flex-shrink-0 w-6"})}),h.jsx(I,{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center rounded ${u}`,children:h.jsx(re,{name:t.icon||"file",className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:`flex-1 min-w-0 ${f}`,children:[h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:t.name}),t.isModuleMenu&&h.jsx(re,{name:"cube",className:"w-2 h-2 text-gray-300 dark:text-gray-500 ml-2",title:t.moduleName})]}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400 truncate block",children:t.url})]}),h.jsx(I,{className:"flex-shrink-0",onClick:M=>M.stopPropagation(),children:h.jsx(Ha,{checked:t.isActive,onChange:()=>o?.(new MouseEvent("click")),size:"sm",disabled:m})})]})},LS=()=>window.G7Core;function Yh(t,e,n=0,r=null){const s=[];for(const o of t)s.push({item:o,depth:n,parentId:r}),o.children?.length>0&&e.has(o.id)&&s.push(...Yh(o.children,e,n+1,o.id));return s}function nc(t,e){for(const n of t){if(n.id===e)return n;if(n.children){const r=nc(n.children,e);if(r)return r}}return null}function Xh(t){const e=[];if(t.children)for(const n of t.children)e.push(n.id),e.push(...Xh(n));return e}function Kh(t,e){return t.filter(n=>n.id!==e).map(n=>n.children?.length>0?{...n,children:Kh(n.children,e)}:n)}function qh(t,e,n,r){if(n===null){const s=[...t];return s.splice(r,0,e),s}return t.map(s=>{if(s.id===n){const o=[...s.children||[]];return o.splice(r,0,e),{...s,children:o}}return s.children?.length>0?{...s,children:qh(s.children,e,n,r)}:s})}function Zh(t,e,n,r){if(e===null){const s=t.findIndex(i=>i.id===n),o=t.findIndex(i=>i.id===r);return s===-1||o===-1?t:Qr(t,s,o)}return t.map(s=>{if(s.id===e&&s.children){const o=s.children.findIndex(a=>a.id===n),i=s.children.findIndex(a=>a.id===r);return o===-1||i===-1?s:{...s,children:Qr(s.children,o,i)}}return s.children?.length>0?{...s,children:Zh(s.children,e,n,r)}:s})}function Qh(t){const e=t.map((s,o)=>({id:s.id,order:o+1})),n={},r=s=>{s.forEach(o=>{o.children?.length>0&&(n[o.id]=o.children.map((i,a)=>({id:i.id,order:a+1})),r(o.children))})};return r(t),{parent_menus:e,child_menus:n}}const PS=({items:t=[],selectedId:e,onSelect:n,onOrderChange:r,onToggleStatus:s,title:o,className:i="",listClassName:a="",childrenContainerClassName:l="bg-gray-50 dark:bg-gray-900/50",itemClassName:c="py-2.5 px-3 mx-4 my-2 rounded-lg border",itemSelectedClassName:d,itemDefaultClassName:u,titleClassName:f="px-4 py-3 border-b border-gray-200 dark:border-gray-700",enableDrag:g=!0,toggleDisabled:m=!1,id:p,editorAttrs:y})=>{const[b,S]=v.useState(new Set),[x,E]=v.useState(null),[k,C]=v.useState(t),N=v.useRef(!1),_=v.useRef(""),w=v.useRef(""),M=v.useCallback(B=>JSON.stringify(B),[]),O=v.useCallback(B=>B.map(G=>{const V=G.children?.map(K=>K.id).join(",")||"";return`${G.id}:${V}`}).join("|"),[]);v.useEffect(()=>{const B=O(t),G=M(t);if(N.current){const V=O(k);(B===V||B!==_.current)&&(N.current=!1,_.current=B,w.current=G,(B!==V||G!==M(k))&&C(t));return}G!==w.current&&(_.current=B,w.current=G,C(t))},[t,O,M,k]);const L=jl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Ii})),F=v.useCallback(B=>{if(typeof B=="string")return B;const V=LS()?.locale?.current?.()||"ko";return B[V]||B.en||Object.values(B)[0]||""},[]),$=v.useCallback(B=>{S(G=>{const V=new Set(G);return V.has(B)?V.delete(B):V.add(B),V})},[]),D=v.useCallback(B=>{n?.(B)},[n]),A=v.useCallback((B,G,V)=>{V.stopPropagation(),s?.(B,G)},[s]),T=B=>{E(B.active.id)},z=B=>{const{active:G,over:V}=B;if(E(null),!V||G.id===V.id)return;const K=W.find(Z=>Z.item.id===Number(G.id)),X=W.find(Z=>Z.item.id===Number(V.id));if(!(!K||!X))if(K.parentId===X.parentId){const Z=Zh(k,K.parentId,Number(G.id),Number(V.id));C(Z),N.current=!0,r?.(Qh(Z))}else{const Z=K.item;if(Xh(Z).includes(Number(V.id)))return;let ne=Kh(k,Z.id);const he=W.findIndex(ye=>ye.item.id===Number(G.id)),J=W.findIndex(ye=>ye.item.id===Number(V.id)),ce=he>J,ue=X.parentId;let ae;if(ue===null)ae=ne.findIndex(ye=>ye.id===Number(V.id)),ae===-1?ae=ne.length:ce||(ae+=1);else{const ke=nc(ne,ue)?.children||[];ae=ke.findIndex(Ue=>Ue.id===Number(V.id)),ae===-1?ae=ke.length:ce||(ae+=1)}const ve={...Z,parent_id:ue,children:Z.children||[]};ne=qh(ne,ve,ue,ae),C(ne),N.current=!0;const fe=Qh(ne);fe.moved_items=[{id:Z.id,new_parent_id:ue}],r?.(fe)}},H=B=>({id:B.id,name:F(B.name),slug:B.slug,url:B.url,icon:B.icon,isActive:B.is_active,isModuleMenu:!!B.module_id,moduleName:B.module?F(B.module.name):void 0,hasChildren:B.children&&B.children.length>0}),W=v.useMemo(()=>Yh(k,b),[k,b]),j=v.useMemo(()=>W.map(B=>B.item.id),[W]),U=x?nc(k,Number(x)):null;return h.jsxs(I,{className:i,id:p,...y,children:[o&&h.jsx(I,{className:f,children:h.jsx(Ir,{className:"text-sm font-medium text-gray-900 dark:text-white",children:o})}),h.jsxs(ec,{sensors:L,collisionDetection:Wl,onDragStart:T,onDragEnd:z,children:[h.jsx(Ai,{items:j,strategy:tc,children:h.jsx(I,{className:a,children:W.map(B=>h.jsx(I,{className:B.depth>0?l:"",children:h.jsx(Gh,{item:H(B.item),isSelected:e===B.item.id,isExpanded:b.has(B.item.id),level:B.depth,onClick:()=>D(B.item),onToggle:G=>A(B.item.id,B.item.is_active,G),onExpandToggle:()=>$(B.item.id),className:c,selectedClassName:d,defaultClassName:u,enableDrag:g,toggleDisabled:m})},B.item.id))})}),h.jsx(xS,{children:U?h.jsx(I,{className:"bg-white dark:bg-gray-800 shadow-lg rounded-lg border border-blue-500 p-3",children:h.jsx(I,{className:"flex items-center gap-2",children:h.jsx(I,{className:"text-sm font-medium text-gray-900 dark:text-white",children:F(U.name)})})}):null})]})]})},$S=[{value:"LayoutDashboard",label:"LayoutDashboard",faIcon:"tachometer-alt"},{value:"Settings",label:"Settings",faIcon:"cog"},{value:"Menu",label:"Menu",faIcon:"bars"},{value:"Users",label:"Users",faIcon:"users"},{value:"Package",label:"Package",faIcon:"cube"},{value:"Puzzle",label:"Puzzle",faIcon:"puzzle-piece"},{value:"FileText",label:"FileText",faIcon:"file-alt"},{value:"ShoppingCart",label:"ShoppingCart",faIcon:"shopping-cart"},{value:"MessageSquare",label:"MessageSquare",faIcon:"comment"},{value:"Home",label:"Home",faIcon:"home"},{value:"User",label:"User",faIcon:"user"},{value:"Search",label:"Search",faIcon:"search"},{value:"Bell",label:"Bell",faIcon:"bell"},{value:"Mail",label:"Mail",faIcon:"envelope"},{value:"Calendar",label:"Calendar",faIcon:"calendar"},{value:"Chart",label:"Chart",faIcon:"chart-bar"},{value:"Database",label:"Database",faIcon:"database"},{value:"Lock",label:"Lock",faIcon:"lock"},{value:"Globe",label:"Globe",faIcon:"globe"},{value:"Image",label:"Image",faIcon:"image"}],FS=({value:t,onChange:e,options:n=$S,placeholder:r,searchPlaceholder:s,noResultsText:o,className:i="",disabled:a=!1,name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),[g,m]=v.useState(""),p=v.useRef(null),y=n.find(x=>{if(!t)return!1;if(t.includes("fa-")){const E=t.replace(/^(fas|far|fab|fal|fad)\s+fa-/,"");return x.faIcon===E||x.faIcon===t}return x.value===t||x.faIcon===t}),b=n.filter(x=>x.label.toLowerCase().includes(g.toLowerCase()));v.useEffect(()=>{const x=E=>{p.current&&!p.current.contains(E.target)&&(f(!1),m(""))};if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const S=x=>{const E=`fas fa-${x.faIcon}`;e?.(E),f(!1),m("")};return h.jsxs(I,{ref:p,className:`relative ${i}`,id:c,...d,children:[h.jsxs(oe,{type:"button",onClick:()=>!a&&f(!u),disabled:a,className:` w-full flex items-center justify-between px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg @@ -201,7 +201,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `,children:[h.jsx(I,{className:"flex items-center gap-2",children:y?h.jsxs(h.Fragment,{children:[h.jsx(re,{name:y.faIcon,className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:y.label})]}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:r})}),h.jsx(re,{name:"chevron-down",className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${u?"rotate-180":""}`})]}),l&&h.jsx("input",{type:"hidden",name:l,value:t||""}),u&&h.jsxs(I,{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-72 overflow-hidden",children:[h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:h.jsx(wt,{type:"text",value:g,onChange:x=>m(x.target.value),placeholder:s,className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white",autoFocus:!0})}),h.jsx(I,{className:"max-h-56 overflow-y-auto",children:b.length>0?b.map(x=>h.jsxs(oe,{type:"button",onClick:()=>S(x),className:` w-full flex items-center gap-3 px-3 py-2 text-left text-sm ${y?.faIcon===x.faIcon?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"} - `,children:[h.jsx(re,{name:x.faIcon,className:"w-4 h-4"}),h.jsx(Q,{children:x.label}),y?.faIcon===x.faIcon&&h.jsx(re,{name:"check",className:"w-4 h-4 ml-auto text-blue-600"})]},x.value)):h.jsx(I,{className:"px-3 py-4 text-sm text-gray-500 dark:text-gray-400 text-center",children:o})})]})]})},rc=({defaultOpen:t=!1,isOpen:e,onToggle:n,className:r="",style:s,children:o,disabled:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(t),u=e!==void 0,f=u?e:c,g=v.useRef(null),[m,p]=v.useState(t?void 0:0),y=()=>{if(i)return;const S=!f;u||d(S),n?.(S)};v.useEffect(()=>{if(g.current)if(f){p(g.current.scrollHeight);const S=setTimeout(()=>{p(void 0)},300);return()=>clearTimeout(S)}else p(g.current.scrollHeight),requestAnimationFrame(()=>{p(0)})},[f]);const b={};if(v.Children.forEach(o,S=>{if(v.isValidElement(S)){const x=S.props?.slot;x==="trigger"?b.trigger=S:x==="content"&&(b.content=S)}}),!b.trigger&&!b.content){const S=v.Children.toArray(o);S.length>=2?(b.trigger=S[0],b.content=S.slice(1)):S.length===1&&(b.content=S[0])}return h.jsxs(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${r}`,style:s,id:a,...l,children:[h.jsxs(oe,{type:"button",onClick:y,disabled:i,className:`w-full flex items-center justify-between p-3 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${i?"opacity-50 cursor-not-allowed":""} ${f?"border-b border-gray-200 dark:border-gray-700":""}`,"aria-expanded":f,children:[h.jsx(I,{className:"flex-1",children:b.trigger}),!b.trigger&&h.jsx("svg",{className:`w-5 h-5 text-gray-500 dark:text-gray-400 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h.jsx(I,{ref:g,className:"overflow-hidden transition-all duration-300 ease-in-out",style:{height:m!==void 0?`${m}px`:"auto"},children:h.jsx(I,{className:"bg-white dark:bg-gray-800",children:b.content})})]})},Js=window.G7Core,Qh=Js?.useControllableState,Jh=(t,e)=>window.G7Core?.t?.(t,e)??t,PS={"":"common.scope_type_all_desc",self:"common.scope_type_self_desc",role:"common.scope_type_role_desc"},$S=({options:t,value:e,onChange:n,disabled:r=!1})=>{const[s,o]=v.useState(!1),[i,a]=v.useState({}),l=v.useRef(null),c=t.find(u=>u.value===e)??t[0];v.useEffect(()=>{if(!s)return;const u=g=>{l.current&&!l.current.contains(g.target)&&o(!1)},f=()=>{if(!l.current)return;const g=l.current.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,right:window.innerWidth-g.right,zIndex:9999})};return document.addEventListener("mousedown",u),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s]);const d=v.useCallback(()=>{if(r||!l.current)return;const u=l.current.getBoundingClientRect();a({position:"fixed",top:u.bottom+4,right:window.innerWidth-u.right,zIndex:9999}),o(f=>!f)},[r]);return h.jsxs(I,{ref:l,className:"relative flex-shrink-0",children:[h.jsxs(I,{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),u.preventDefault(),d()},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),u.preventDefault(),d()),u.key==="Escape"&&o(!1)},className:`flex items-center gap-1 text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer select-none ${r?"opacity-50 cursor-not-allowed":"hover:border-blue-400 dark:hover:border-blue-500"}`,children:[h.jsx(Q,{children:c?.label??""}),h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3 text-gray-400 dark:text-gray-500"})]}),s&&h.jsx(I,{style:i,className:"w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1",children:t.map(u=>{const f=u.value??"",g=PS[f],m=g?Jh(g):"",p=u.value===e;return h.jsxs(I,{role:"option","aria-selected":p,onClick:y=>{y.stopPropagation(),y.preventDefault(),n(u.value),o(!1)},onMouseDown:y=>y.stopPropagation(),className:`px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[h.jsx(Q,{className:`text-xs font-medium ${p?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:u.label}),p&&h.jsx(re,{name:de.Check,className:"w-3.5 h-3.5 text-blue-600 dark:text-blue-400"})]}),m&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:m})]},f||"__null__")})})]})},FS=(t,e)=>{if(t.length!==e.length)return!1;const n=[...t].sort((s,o)=>s.id-o.id),r=[...e].sort((s,o)=>s.id-o.id);return n.every((s,o)=>s.id===r[o].id&&s.scope_type===r[o].scope_type)},zS=({data:t=[],value:e=[],onChange:n,scopeOptions:r=[],className:s="",disabled:o=!1,desktopColumns:i=2,installedModules:a=[],installedPlugins:l=[],id:c,editorAttrs:d})=>{const u=v.useCallback(M=>{if(n){const O=Js?.createChangeEvent?Js.createChangeEvent({value:M}):{target:{value:M}};n(O)}},[n]),[f,g]=Qh?Qh(e,[],u,{isEqual:FS}):(()=>{const[M,O]=v.useState(e),L=v.useRef(n);L.current=n;const F=v.useRef(!1);v.useEffect(()=>{if(F.current){F.current=!1;return}O(e)},[e]);const $=v.useCallback(D=>{F.current=!0,O(A=>{const T=typeof D=="function"?D(A):D;if(L.current){const z=Js?.createChangeEvent?Js.createChangeEvent({value:T}):{target:{value:T}};L.current(z)}return T})},[]);return[M,$]})(),m=v.useMemo(()=>new Set(f.map(M=>M.id)),[f]),p=v.useCallback(M=>M.is_assignable?[M.id]:M.children.flatMap(O=>p(O)),[]),y=v.useCallback(M=>{const O=p(M);return O.length>0&&O.every(L=>m.has(L))},[m,p]),b=v.useCallback(M=>{const O=p(M),L=O.filter(F=>m.has(F)).length;return L>0&&Lp(M).filter(L=>m.has(L)).length,[m,p]),x=v.useCallback((M,O)=>{o||g(L=>O?[...L,{id:M,scope_type:null}]:L.filter(F=>F.id!==M))},[o,g]),E=v.useCallback((M,O)=>{if(o)return;const L=p(M),F=new Set(L);g($=>{if(O){const D=new Set($.map(T=>T.id)),A=L.filter(T=>!D.has(T)).map(T=>({id:T,scope_type:null}));return[...$,...A]}else return $.filter(D=>!F.has(D.id))})},[o,p,g]),k=v.useCallback((M,O)=>{o||g(L=>L.map(F=>F.id===M?{...F,scope_type:O}:F))},[o,g]),C=M=>{const O=m.has(M.id),L=!!M.resource_route_key,F=O&&L&&r.length>0,$=f.find(D=>D.id===M.id)?.scope_type??null;return h.jsxs(rn,{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${O?"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${o?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx(wt,{type:"checkbox",checked:O,onChange:D=>{D.stopPropagation(),x(M.id,D.target.checked)},disabled:o,className:"w-4 h-4 mt-0.5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsxs(I,{className:"flex items-center justify-between gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white",children:M.name}),F&&h.jsx($S,{options:r,value:$,onChange:D=>k(M.id,D),disabled:o})]}),M.description&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:M.description})]})]},M.id)},N=(M,O)=>{const L=y(M),F=b(M),$=S(M),D=M.children.filter(z=>z.is_assignable);if(D.length===0&&M.children.length===0)return null;const A=M.children.some(z=>!z.is_assignable),T=i===1?"grid-cols-1":i===3?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2";return h.jsxs(rc,{defaultOpen:!1,className:"border-0 rounded-none",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:L,ref:z=>{z&&(z.indeterminate=F)},onChange:z=>{z.stopPropagation(),E(M,z.target.checked)},onClick:z=>z.stopPropagation(),onMouseDown:z=>z.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:de.Folder,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:M.name}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-1",children:[$,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:`pl-8 grid ${T} gap-2 py-2`,children:A?M.children.map(z=>z.is_assignable?C(z):N(z)):D.map(z=>C(z))})]},M.id)},_=M=>{if(M.extension_type==="core")return"core";if(M.extension_type==="module")return"module";if(M.extension_type==="plugin")return"plugin";const O=M.extension_identifier??M.module??"";return O==="core"||!O?"core":l?.some(F=>F.identifier===O)?"plugin":"module"},w=M=>{const O=y(M),L=b(M),F=S(M),$=_(M);return h.jsxs(rc,{defaultOpen:!1,className:"mb-2",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:O,ref:D=>{D&&(D.indeterminate=L)},onChange:D=>{D.stopPropagation(),E(M,D.target.checked)},onClick:D=>D.stopPropagation(),onMouseDown:D=>D.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:$==="core"?de.Cog:de.Cube,className:"w-5 h-5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white",children:M.name}),$!=="core"&&h.jsx(th,{type:$,identifier:M.extension_identifier??M.module,installedModules:a,installedPlugins:l}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-2",children:[F,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:"pl-8 space-y-2 pb-2",children:M.children.map(D=>D.is_assignable?C(D):N(D))})]},M.id)};return t.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${s}`,id:c,...d,children:Jh("common.no_data")??"데이터가 없습니다."}):h.jsx(I,{className:`space-y-2 ${s}`,id:c,...d,children:t.map(M=>w(M))})};function VS({text:t,keyword:e}){if(!e||!t)return h.jsx(h.Fragment,{children:t});const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=t.split(new RegExp(`(${n})`,"gi"));return h.jsx(h.Fragment,{children:r.map((s,o)=>s.toLowerCase()===e.toLowerCase()?h.jsx(Q,{className:"bg-yellow-200 dark:bg-yellow-700 rounded px-0.5",children:s},o):s)})}const HS=({data:t=[],expandedIds:e=[],selectedIds:n=[],searchKeyword:r="",showProductCount:s=!1,selectable:o=!1,className:i="",onToggle:a,onSelectionChange:l,id:c,editorAttrs:d})=>{const u=v.useCallback(y=>{if(!a)return;const b=e.includes(y)?e.filter(S=>S!==y):[...e,y];a(b)},[e,a]),f=v.useCallback((y,b)=>{if(!l)return;const S=b?[...n,y]:n.filter(x=>x!==y);l(S)},[n,l]),g=v.useMemo(()=>{if(!r)return null;const y=new Set,b=S=>{for(const x of S)(x.localized_name||x.name).toLowerCase().includes(r.toLowerCase())&&y.add(x.id),x.children&&b(x.children)};return b(t),y},[t,r]),m=v.useCallback(y=>!g||g.has(y.id)?!0:(y.children??[]).some(b=>m(b)),[g]),p=(y,b=0)=>{const S=(y.children??[]).length>0,x=e.includes(y.id),E=n.includes(y.id),k=y.localized_name||y.name;return r&&!m(y)?null:h.jsxs(I,{"data-testid":`category-node-${y.id}`,children:[h.jsxs(I,{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${b>0?"ml-"+Math.min(b*5,20):""}`,style:b>0?{marginLeft:`${b*20}px`}:void 0,children:[S?h.jsx(I,{className:"flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-400 dark:text-gray-500",onClick:()=>u(y.id),"data-testid":`toggle-${y.id}`,children:h.jsx(re,{name:x?de.CaretDown:de.CaretRight,className:"text-xs"})}):h.jsx(I,{className:"flex-shrink-0 w-5 h-5"}),o&&h.jsx(vn,{checked:E,onChange:C=>{C.stopPropagation(),f(y.id,C.target.checked)},className:"flex-shrink-0","data-testid":`checkbox-${y.id}`}),h.jsx(re,{name:de.Folder,className:`flex-shrink-0 text-sm ${S?"text-yellow-500 dark:text-yellow-400":"text-gray-400 dark:text-gray-500"}`}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300 select-none",onClick:()=>S&&u(y.id),children:h.jsx(VS,{text:k,keyword:r})}),s&&y.products_count!==void 0&&h.jsx(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-400 ml-1",children:y.products_count})]}),S&&x&&h.jsx(I,{"data-testid":`children-${y.id}`,children:(y.children??[]).map(C=>p(C,b+1))})]},y.id)};return t.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${i}`,id:c,...d,children:"데이터가 없습니다."}):h.jsx(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-80 overflow-y-auto ${i}`,id:c,...d,children:t.map(y=>p(y,0))})},Rh="carousel",Rs="controller",US="navigation",BS="no-scroll",sc="portal",jS="root",eg="toolbar",WS="counter",eo="fullscreen",tg="slideshow",to="thumbnails",ng="zoom",Jr="loading",oc="playing",no="error",ro="complete",GS="placeholder",so=t=>`active-slide-${t}`,YS=so(Jr),XS=so(oc),KS=so(no),qS=so(ro),rg="fullsize",Rr="flex_center",ZS="no_scroll",sg="no_scroll_padding",ic="slide",og="slide_wrapper",QS="slide_wrapper_interactive",nr="prev",rr="next",ac="swipe",es="close",ig="onPointerDown",ag="onPointerMove",lg="onPointerUp",cg="onPointerLeave",dg="onPointerCancel",lc="onKeyDown",JS="onKeyUp",cc="onWheel",RS="Escape",e_="ArrowLeft",t_="ArrowRight",n_="button",Li="icon",ug="contain",fg="cover",hg="Unknown action type",gg="yarl__";function Ft(...t){return t.filter(Boolean).join(" ")}function Ne(t){return`${gg}${t}`}function dt(t){return`--${gg}${t}`}function gr(t,e){return`${t}${e?`_${e}`:""}`}function pr(t){return e=>gr(t,e)}function mr(t,e){var n;return(n=t?.[e])!==null&&n!==void 0?n:e}function pg(t,e,n){return mr(t,"{index} of {total}").replace(/\{index}/g,`${hc(n,e.length)+1}`).replace(/\{total}/g,`${e.length}`)}function ts(...t){return()=>{t.forEach(e=>{e()})}}function an(t,e,n){return()=>{const r=P.useContext(n);if(!r)throw new Error(`${t} must be used within a ${e}.Provider`);return r}}function dc(){return typeof window<"u"}function uc(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function sr(t){return t.type===void 0||t.type==="image"}function fc(t,e){return t.imageFit===fg||t.imageFit!==ug&&e===fg}function Pi(t){return typeof t=="string"?Number.parseInt(t,10):t}function $i(t){if(typeof t=="number")return{pixel:t};if(typeof t=="string"){const e=Pi(t);return t.endsWith("%")?{percent:e}:{pixel:e}}return{pixel:0}}function r_(t,e){const n=$i(e),r=n.percent!==void 0?t.width/100*n.percent:n.pixel;return{width:Math.max(t.width-2*r,0),height:Math.max(t.height-2*r,0)}}function s_(){return(dc()?window?.devicePixelRatio:void 0)||1}function hc(t,e){return e>0?(t%e+e)%e:0}function gc(t){return t.length>0}function pc(t,e){return t[hc(e,t.length)]}function mc(t,e){return gc(t)?pc(t,e):void 0}function mg(t){return sr(t)?t.src:void 0}function Fi(t,e,n){if(!n)return t;const{buttons:r,...s}=t,o=r.findIndex(a=>a===e),i=P.isValidElement(n)?P.cloneElement(n,{key:e},null):n;if(o>=0){const a=[...r];return a.splice(o,1,i),{buttons:a,...s}}return{buttons:[i,...r],...s}}function bg(t,e,n=0){return Math.min(t.preload,Math.max(t.finite?e.length-1:Math.floor(e.length/2),n))}const o_=Number(P.version.split(".")[0])>=19;function i_(t){return{inert:o_?t:t?"":void 0}}function a_(t){t.scrollTop}const bc={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[es]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:ug,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function un(t,e){return{name:t,component:e}}function Nt(t,e){return{module:t,children:e}}function yg(t,e,n){return t.module.name===e?n(t):t.children?[Nt(t.module,t.children.flatMap(r=>{var s;return(s=yg(r,e,n))!==null&&s!==void 0?s:[]}))]:[t]}function ns(t,e,n){return t.flatMap(r=>{var s;return(s=yg(r,e,n))!==null&&s!==void 0?s:[]})}function l_(t,e=[],n=[]){let r=t;const s=g=>{const m=[...r];for(;m.length>0;){const p=m.pop();if(p?.module.name===g)return!0;p?.children&&m.push(...p.children)}return!1},o=(g,m)=>{if(g===""){r=[Nt(m,r)];return}r=ns(r,g,p=>[Nt(m,[p])])},i=(g,m)=>{r=ns(r,g,p=>[Nt(p.module,[Nt(m,p.children)])])},a=(g,m,p)=>{r=ns(r,g,y=>{var b;return[Nt(y.module,[...p?[Nt(m)]:[],...(b=y.children)!==null&&b!==void 0?b:[],...p?[]:[Nt(m)]])]})},l=(g,m,p)=>{r=ns(r,g,y=>[...p?[Nt(m)]:[],y,...p?[]:[Nt(m)]])},c=g=>{i(Rs,g)},d=(g,m)=>{r=ns(r,g,p=>[Nt(m,p.children)])},u=g=>{r=ns(r,g,m=>m.children)},f=g=>{n.push(g)};return e.forEach(g=>{g({contains:s,addParent:o,append:i,addChild:a,addSibling:l,addModule:c,replace:d,remove:u,augment:f})}),{config:r,augmentation:g=>n.reduce((m,p)=>p(m),g)}}const vg=P.createContext(null),yc=an("useA11yContext","A11yContext",vg);function c_({children:t}){const[e,n]=P.useState(!1),[r,s]=P.useState(!1),o=P.useMemo(()=>({focusWithin:e,trackFocusWithin:(a,l)=>{const c=d=>u=>{var f;u.currentTarget.contains(u.relatedTarget)||n(d),(f=d?a:l)===null||f===void 0||f(u)};return{onFocus:c(!0),onBlur:c(!1)}},autoPlaying:r,setAutoPlaying:s}),[e,r]);return P.createElement(vg.Provider,{value:o},t)}const xg=P.createContext(null),rs=an("useDocument","DocumentContext",xg);function d_({nodeRef:t,children:e}){const n=P.useMemo(()=>{const r=o=>{var i;return((i=o||t.current)===null||i===void 0?void 0:i.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var i;return((i=r(o))===null||i===void 0?void 0:i.defaultView)||window}}},[t]);return P.createElement(xg.Provider,{value:n},e)}const wg=P.createContext(null),ss=an("useEvents","EventsContext",wg);function u_({children:t}){const[e]=P.useState({});P.useEffect(()=>()=>{Object.keys(e).forEach(r=>delete e[r])},[e]);const n=P.useMemo(()=>{const r=(i,a)=>{var l;(l=e[i])===null||l===void 0||l.splice(0,e[i].length,...e[i].filter(c=>c!==a))};return{publish:(...[i,a])=>{var l;(l=e[i])===null||l===void 0||l.forEach(c=>c(a))},subscribe:(i,a)=>(e[i]||(e[i]=[]),e[i].push(a),()=>r(i,a)),unsubscribe:r}},[e]);return P.createElement(wg.Provider,{value:n},t)}const kg=P.createContext(null),Ot=an("useLightboxProps","LightboxPropsContext",kg);function Cg({children:t,...e}){return P.createElement(kg.Provider,{value:e},t)}const Sg=P.createContext(null),fn=an("useLightboxState","LightboxStateContext",Sg),_g=P.createContext(null),f_=an("useLightboxDispatch","LightboxDispatchContext",_g);function h_(t,e){switch(e.type){case"swipe":{const{slides:n}=t,r=e?.increment||0,s=t.globalIndex+r,o=hc(s,n.length),i=mc(n,o),a=r||e.duration!==void 0?{increment:r,duration:e.duration,easing:e.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:s,currentSlide:i,animation:a}}case"update":return e.slides!==t.slides||e.index!==t.currentIndex?{slides:e.slides,currentIndex:e.index,globalIndex:e.index,currentSlide:mc(e.slides,e.index)}:t;default:throw new Error(hg)}}function g_({slides:t,index:e,children:n}){const[r,s]=P.useReducer(h_,{slides:t,currentIndex:e,globalIndex:e,currentSlide:mc(t,e)}),[o,i]=P.useState(t),[a,l]=P.useState(e);(t!==o||e!==a)&&(i(t),l(e),s({type:"update",slides:t,index:e}));const c=P.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return P.createElement(_g.Provider,{value:s},P.createElement(Sg.Provider,{value:c},n))}const Eg=P.createContext(null),p_=an("useRTLContext","RTLContext",Eg);function m_({isRTL:t,children:e}){const n=P.useMemo(()=>({isRTL:t}),[t]);return P.createElement(Eg.Provider,{value:n},e)}const Mg=P.createContext(null),oo=an("useTimeouts","TimeoutsContext",Mg);function b_({children:t}){const[e]=P.useState([]);P.useEffect(()=>()=>{e.forEach(r=>window.clearTimeout(r)),e.splice(0,e.length)},[e]);const n=P.useMemo(()=>{const r=i=>{e.splice(0,e.length,...e.filter(a=>a!==i))};return{setTimeout:(i,a)=>{const l=window.setTimeout(()=>{r(l),i()},a);return e.push(l),l},clearTimeout:i=>{i!==void 0&&(r(i),window.clearTimeout(i))}}},[e]);return P.createElement(Mg.Provider,{value:n},t)}const os=P.forwardRef(function({label:e,className:n,icon:r,renderIcon:s,onClick:o,style:i,...a},l){const{styles:c,labels:d}=Ot(),u=mr(d,e);return P.createElement("button",{ref:l,type:"button",title:u,"aria-label":u,className:Ft(Ne(n_),n),onClick:o,style:{...i,...c.button},...a},s?s():P.createElement(r,{className:Ne(Li),style:c.icon}))});function Ng(t,e){const n=r=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},e);return n.displayName=t,n}function Zt(t,e){return Ng(t,P.createElement("g",{fill:"currentColor"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e))}function y_(t,e){return Ng(t,P.createElement(P.Fragment,null,P.createElement("defs",null,P.createElement("mask",{id:"strike"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),P.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),P.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),P.createElement("g",{fill:"currentColor",mask:"url(#strike)"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e)))}const v_=Zt("Close",P.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),x_=Zt("Previous",P.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),w_=Zt("Next",P.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),k_=Zt("Loading",P.createElement(P.Fragment,null,Array.from({length:8}).map((t,e,n)=>P.createElement("line",{key:e,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(e+1),transform:`rotate(${360/n.length*e}, 12, 12)`})))),C_=Zt("Error",P.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),Cn=dc()?P.useLayoutEffect:P.useEffect;function vc(){const[t,e]=P.useState(!1);return P.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");e(s?.matches);const o=i=>e(i.matches);return(r=s?.addEventListener)===null||r===void 0||r.call(s,"change",o),()=>{var i;return(i=s?.removeEventListener)===null||i===void 0?void 0:i.call(s,"change",o)}},[]),t}function S_(t){let e=0,n=0,r=0;const o=window.getComputedStyle(t).transform.match(/matrix.*\((.+)\)/);if(o){const i=o[1].split(",").map(Pi);i.length===6?(e=i[4],n=i[5]):i.length===16&&(e=i[12],n=i[13],r=i[14])}return{x:e,y:n,z:r}}function xc(t,e){const n=P.useRef(void 0),r=P.useRef(void 0),s=vc();return Cn(()=>{var o,i,a;if(t.current&&n.current!==void 0&&!s){const{keyframes:l,duration:c,easing:d,onfinish:u}=e(n.current,t.current.getBoundingClientRect(),S_(t.current))||{};if(l&&c){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(i=t.current).animate)===null||a===void 0?void 0:a.call(i,l,{duration:c,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,u?.()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function Og(){const t=P.useRef(null),e=P.useRef(void 0),[n,r]=P.useState();return{setContainerRef:P.useCallback(o=>{t.current=o,e.current&&(e.current.disconnect(),e.current=void 0);const i=()=>{if(o){const a=window.getComputedStyle(o),l=c=>parseFloat(c)||0;r({width:Math.round(o.clientWidth-l(a.paddingLeft)-l(a.paddingRight)),height:Math.round(o.clientHeight-l(a.paddingTop)-l(a.paddingBottom))})}else r(void 0)};i(),o&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(i),e.current.observe(o))},[]),containerRef:t,containerRect:n}}function zi(){const t=P.useRef(void 0),{setTimeout:e,clearTimeout:n}=oo();return P.useCallback((r,s)=>{n(t.current),t.current=e(r,s>0?s:0)},[e,n])}function Ge(t){const e=P.useRef(t);return Cn(()=>{e.current=t}),P.useCallback((...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Tg(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function wc(t,e){return P.useMemo(()=>t==null&&e==null?null:n=>{Tg(t,n),Tg(e,n)},[t,e])}function Ag(t,e=!1){const n=P.useRef(!1);Cn(()=>{e&&n.current&&(n.current=!1,t())},[e,t]);const r=P.useCallback(()=>{n.current=!0},[]),s=P.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function Vi(){return p_().isRTL}function Dg(){const[t]=P.useState({}),e=P.useCallback((s,o)=>{var i;(i=t[s])===null||i===void 0||i.forEach(a=>{o.isPropagationStopped()||a(o)})},[t]),n=P.useMemo(()=>({onPointerDown:s=>e(ig,s),onPointerMove:s=>e(ag,s),onPointerUp:s=>e(lg,s),onPointerLeave:s=>e(cg,s),onPointerCancel:s=>e(dg,s),onKeyDown:s=>e(lc,s),onKeyUp:s=>e(JS,s),onWheel:s=>e(cc,s)}),[e]),r=P.useCallback((s,o)=>(t[s]||(t[s]=[]),t[s].unshift(o),()=>{const i=t[s];i&&i.splice(0,i.length,...i.filter(a=>a!==o))}),[t]);return{registerSensors:n,subscribeSensors:r}}function Ig(t,e){const n=P.useRef(0),r=zi(),s=Ge((...o)=>{n.current=Date.now(),t(o)});return P.useCallback((...o)=>{r(()=>{s(o)},e-(Date.now()-n.current))},[e,s,r])}const kc=pr("slide"),Cc=pr("slide_image");function br({slide:t,offset:e,render:n,rect:r,imageFit:s,imageProps:o,onClick:i,onLoad:a,onError:l,style:c}){var d,u,f,g,m,p,y,b;const[S,x]=P.useState(Jr),{publish:E}=ss(),{setTimeout:k}=oo(),C=P.useRef(null);P.useEffect(()=>{e===0&&E(so(S))},[e,S,E]);const N=Ge(U=>{("decode"in U?U.decode():Promise.resolve()).catch(()=>{}).then(()=>{U.parentNode&&(x(ro),k(()=>{a?.(U)},0))})}),_=P.useCallback(U=>{C.current=U,U?.complete&&N(U)},[N]),w=P.useCallback(U=>{N(U.currentTarget)},[N]),M=Ge(()=>{x(no),l?.()}),O=fc(t,s),L=(U,B)=>Number.isFinite(U)?U:B,F=L(Math.max(...((u=(d=t.srcSet)===null||d===void 0?void 0:d.map(U=>U.width))!==null&&u!==void 0?u:[]).concat(t.width?[t.width]:[]).filter(Boolean)),((f=C.current)===null||f===void 0?void 0:f.naturalWidth)||0),$=L(Math.max(...((m=(g=t.srcSet)===null||g===void 0?void 0:g.map(U=>U.height))!==null&&m!==void 0?m:[]).concat(t.height?[t.height]:[]).filter(Boolean)),((p=C.current)===null||p===void 0?void 0:p.naturalHeight)||0),D=F&&$?{maxWidth:`min(${F}px, 100%)`,maxHeight:`min(${$}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},A=(y=t.srcSet)===null||y===void 0?void 0:y.slice().sort((U,B)=>U.width-B.width).map(U=>`${U.src} ${U.width}w`).join(", "),T=()=>r&&!O&&t.width&&t.height?r.height/t.height*t.width:Number.MAX_VALUE,z=A&&r&&dc()?`${Math.round(Math.min(T(),r.width))}px`:void 0,{style:H,className:W,...j}=(typeof o=="function"?o(t):o)||{};return P.createElement(P.Fragment,null,P.createElement("img",{ref:_,onLoad:w,onError:M,onClick:i,draggable:!1,className:Ft(Ne(Cc()),O&&Ne(Cc("cover")),S!==ro&&Ne(Cc("loading")),W),style:{...D,...c,...H},...j,alt:(b=t.alt)!==null&&b!==void 0?b:"",sizes:z,srcSet:A,src:t.src}),S!==ro&&P.createElement("div",{className:Ne(kc(GS))},S===Jr&&(n?.iconLoading?n.iconLoading():P.createElement(k_,{className:Ft(Ne(Li),Ne(kc(Jr)))})),S===no&&(n?.iconError?n.iconError():P.createElement(C_,{className:Ft(Ne(Li),Ne(kc(no)))}))))}const __=P.forwardRef(function({className:e,children:n,onFocus:r,onBlur:s,...o},i){const a=P.useRef(null),[l,c]=P.useState(!1),{trackFocusWithin:d}=yc(),u=Ge(()=>{if(a.current){const f=window.getComputedStyle(a.current).direction==="rtl";f!==l&&c(f)}});return P.useEffect(u),P.createElement(d_,{nodeRef:a},P.createElement(m_,{isRTL:l},P.createElement("div",{ref:wc(i,a),className:Ft(Ne("root"),e),...d(r,s),...o},n)))});var zt;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL",t[t.ANIMATION=3]="ANIMATION"})(zt||(zt={}));function Lg(t,e,n,r,s){P.useEffect(()=>s?()=>{}:ts(t(ig,e),t(ag,n),t(lg,r),t(cg,r),t(dg,r)),[t,e,n,r,s])}var Sn;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL"})(Sn||(Sn={}));const Sc=30;function E_({disableSwipeNavigation:t,closeOnBackdropClick:e},n,r,s,o,i,a,l,c,d,u,f,g,m,p,y){const b=P.useRef(0),S=P.useRef([]),x=P.useRef(void 0),E=P.useRef(0),k=P.useRef(Sn.NONE),C=P.useCallback(F=>{x.current===F.pointerId&&(x.current=void 0,k.current=Sn.NONE);const $=S.current;$.splice(0,$.length,...$.filter(D=>D.pointerId!==F.pointerId))},[]),N=P.useCallback(F=>{C(F),F.persist(),S.current.push(F)},[C]),_=P.useCallback(F=>S.current.find(({pointerId:$})=>F.pointerId===$),[]),w=Ge(F=>{N(F)}),M=(F,$)=>u&&F>$||d&&F<-$,O=Ge(F=>{const $=_(F);if($)if(x.current===F.pointerId){const D=Date.now()-E.current,A=b.current;k.current===Sn.SWIPE?Math.abs(A)>.3*s||Math.abs(A)>5&&D{const $=_(F);if($){const D=x.current===F.pointerId;if(F.buttons===0){D&&b.current!==0?O(F):C($);return}const A=F.clientX-$.clientX,T=F.clientY-$.clientY;if(x.current===void 0){const z=H=>{N(F),x.current=F.pointerId,E.current=Date.now(),k.current=H};Math.abs(A)>Math.abs(T)&&Math.abs(A)>Sc&&r(A)?t||(z(Sn.SWIPE),i()):Math.abs(T)>Math.abs(A)&&M(T,Sc)&&(z(Sn.PULL),f())}else D&&(k.current===Sn.SWIPE?(b.current=A,a(A)):k.current===Sn.PULL&&(b.current=T,g(T)))}});Lg(n,w,L,O)}function M_({preventDefaultWheelX:t,preventDefaultWheelY:e}){const n=P.useRef(null),r=Ge(s=>{const o=Math.abs(s.deltaX)>Math.abs(s.deltaY);(o&&t||!o&&e||s.ctrlKey)&&s.preventDefault()});return P.useCallback(s=>{var o;s?s.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=s},[r])}function N_(t,e,n,r,s,o,i,a,l){const c=P.useRef(0),d=P.useRef(0),u=P.useRef(void 0),f=P.useRef(void 0),g=P.useRef(0),m=P.useRef(void 0),p=P.useRef(0),{setTimeout:y,clearTimeout:b}=oo(),S=P.useCallback(()=>{u.current&&(b(u.current),u.current=void 0)},[b]),x=P.useCallback(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),E=Ge(()=>{t!==zt.SWIPE&&(c.current=0,p.current=0,S(),x())});P.useEffect(E,[t,E]);const k=Ge(N=>{f.current=void 0,c.current===N&&l(c.current)}),C=Ge(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const _=w=>{g.current=w,b(m.current),m.current=w>0?y(()=>{g.current=0,m.current=void 0},300):void 0};if(t===zt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){_(N.deltaX);return}if(!n(-N.deltaX))return;if(d.current+=N.deltaX,S(),Math.abs(d.current)>30)d.current=0,_(0),p.current=Date.now(),o();else{const w=d.current;u.current=y(()=>{u.current=void 0,w===d.current&&(d.current=0)},s)}}else if(t===zt.SWIPE){let w=c.current-N.deltaX;if(w=Math.min(Math.abs(w),r)*Math.sign(w),c.current=w,i(w),x(),Math.abs(w)>.2*r){_(N.deltaX),a(w,Date.now()-p.current);return}f.current=y(()=>k(w),2*s)}else _(N.deltaX)});P.useEffect(()=>e(cc,C),[e,C])}const Pg=pr("container"),$g=P.createContext(null),_n=an("useController","ControllerContext",$g);function O_({children:t,...e}){var n;const{carousel:r,animation:s,controller:o,on:i,styles:a,render:l}=e,{closeOnPullUp:c,closeOnPullDown:d,preventDefaultWheelX:u,preventDefaultWheelY:f}=o,[g,m]=P.useState(),p=fn(),y=f_(),[b,S]=P.useState(zt.NONE),x=P.useRef(0),E=P.useRef(0),k=P.useRef(1),{registerSensors:C,subscribeSensors:N}=Dg(),{subscribe:_,publish:w}=ss(),M=zi(),O=zi(),L=zi(),{containerRef:F,setContainerRef:$,containerRect:D}=Og(),A=wc(M_({preventDefaultWheelX:u,preventDefaultWheelY:f}),$),T=P.useRef(null),z=wc(T,void 0),{getOwnerDocument:H}=rs(),W=Vi(),j=se=>(W?-1:1)*(typeof se=="number"?se:1),U=Ge(()=>{var se;return(se=F.current)===null||se===void 0?void 0:se.focus()}),B=Ge(()=>e),G=Ge(()=>p),V=P.useCallback(se=>w(nr,se),[w]),K=P.useCallback(se=>w(rr,se),[w]),X=P.useCallback(()=>w(es),[w]),Z=se=>!(r.finite&&(j(se)>0&&p.currentIndex===0||j(se)<0&&p.currentIndex===p.slides.length-1)),ee=se=>{var Oe;x.current=se,(Oe=F.current)===null||Oe===void 0||Oe.style.setProperty(dt("swipe_offset"),`${Math.round(se)}px`)},ne=se=>{var Oe,Pe;E.current=se,k.current=(()=>{const st=d&&se>0?se:c&&se<0?-se:0;return Math.min(Math.max(uc(1-st/60*(1-.5),2),.5),1)})(),(Oe=F.current)===null||Oe===void 0||Oe.style.setProperty(dt("pull_offset"),`${Math.round(se)}px`),(Pe=F.current)===null||Pe===void 0||Pe.style.setProperty(dt("pull_opacity"),`${k.current}`)},{prepareAnimation:he}=xc(T,(se,Oe,Pe)=>{if(T.current&&D)return{keyframes:[{transform:`translate(0, ${se.rect.y-Oe.y+Pe.y}px)`,opacity:se.opacity},{transform:"translate(0, 0)",opacity:1}],duration:se.duration,easing:s.easing.fade}}),J=(se,Oe)=>{if(c||d){ne(se);let Pe=0;T.current&&(Pe=s.fade*(Oe?2:1),he({rect:T.current.getBoundingClientRect(),opacity:k.current,duration:Pe})),L(()=>{ne(0),S(zt.NONE)},Pe),S(zt.ANIMATION),Oe||X()}},{prepareAnimation:ce,isAnimationPlaying:ue}=xc(T,(se,Oe,Pe)=>{var Ie;if(T.current&&D&&(!((Ie=p.animation)===null||Ie===void 0)&&Ie.duration)){const je=$i(r.spacing),st=(je.percent?je.percent*D.width/100:je.pixel)||0;return{keyframes:[{transform:`translate(${j(p.globalIndex-se.index)*(D.width+st)+se.rect.x-Oe.x+Pe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:p.animation.duration,easing:p.animation.easing}}}),ae=Ge(se=>{var Oe,Pe;const Ie=se.offset||0,je=Ie?s.swipe:(Oe=s.navigation)!==null&&Oe!==void 0?Oe:s.swipe,st=!Ie&&!ue()?s.easing.navigation:s.easing.swipe;let{direction:ut}=se;const We=(Pe=se.count)!==null&&Pe!==void 0?Pe:1;let et=zt.ANIMATION,Xe=je*We;if(!ut){const ge=D?.width,pe=se.duration||0,me=ge?je/ge*Math.abs(Ie):je;We!==0?(pe0?nr:rr):Xe=je/2}let te=0;ut===nr?Z(j(1))?te=-We:(et=zt.NONE,Xe=je):ut===rr&&(Z(j(-1))?te=We:(et=zt.NONE,Xe=je)),Xe=Math.round(Xe),O(()=>{ee(0),S(zt.NONE)},Xe),T.current&&ce({rect:T.current.getBoundingClientRect(),index:p.globalIndex}),S(et),w(ac,{type:"swipe",increment:te,duration:Xe,easing:st})});P.useEffect(()=>{var se,Oe;!((se=p.animation)===null||se===void 0)&&se.increment&&(!((Oe=p.animation)===null||Oe===void 0)&&Oe.duration)&&M(()=>y({type:"swipe",increment:0}),p.animation.duration)},[p.animation,y,M]);const ve=[N,Z,D?.width||0,s.swipe,()=>S(zt.SWIPE),se=>ee(se),(se,Oe)=>ae({offset:se,duration:Oe,count:1}),se=>ae({offset:se,count:0})],fe=[()=>{d&&S(zt.PULL)},se=>ne(se),se=>J(se),se=>J(se,!0)];E_(o,...ve,c,d,...fe,X),N_(b,...ve);const ye=Ge(()=>{o.focus&&H().querySelector(`.${Ne(sc)} .${Ne(Pg())}`)&&U()});P.useEffect(ye,[ye]);const ke=Ge(()=>{var se;(se=i.view)===null||se===void 0||se.call(i,{index:p.currentIndex})});P.useEffect(ke,[p.globalIndex,ke]),P.useEffect(()=>ts(_(nr,se=>ae({direction:nr,...se})),_(rr,se=>ae({direction:rr,...se})),_(ac,se=>y(se))),[_,ae,y]);const Ue=P.useMemo(()=>({prev:V,next:K,close:X,focus:U,slideRect:D?r_(D,r.padding):{width:0,height:0},containerRect:D||{width:0,height:0},subscribeSensors:N,containerRef:F,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:m}),[V,K,X,U,N,D,F,z,g,m,r.padding]);return P.useImperativeHandle(o.ref,()=>({prev:V,next:K,close:X,focus:U,getLightboxProps:B,getLightboxState:G}),[V,K,X,U,B,G]),P.createElement("div",{ref:A,className:Ft(Ne(Pg()),Ne(Rr)),style:{...b===zt.SWIPE?{[dt("swipe_offset")]:`${Math.round(x.current)}px`}:null,...b===zt.PULL?{[dt("pull_offset")]:`${Math.round(E.current)}px`,[dt("pull_opacity")]:`${k.current}`}:null,...o.touchAction!=="none"?{[dt("controller_touch_action")]:o.touchAction}:null,...a.container},tabIndex:-1,...C},D&&P.createElement($g.Provider,{value:Ue},t,(n=l.controls)===null||n===void 0?void 0:n.call(l)))}const T_=un(Rs,O_);function yr(t){return gr(Rh,t)}function Fg(t){return gr(ic,t)}function A_({slide:t,offset:e}){const n=P.useRef(null),{currentIndex:r,slides:s}=fn(),{slideRect:o,focus:i}=_n(),{render:a,carousel:{imageFit:l,imageProps:c},on:{click:d},styles:{slide:u},labels:f}=Ot(),{getOwnerDocument:g}=rs(),m=e!==0;P.useEffect(()=>{var y;m&&(!((y=n.current)===null||y===void 0)&&y.contains(g().activeElement))&&i()},[m,i,g]);const p=()=>{var y,b,S,x;let E=(y=a.slide)===null||y===void 0?void 0:y.call(a,{slide:t,offset:e,rect:o});return!E&&sr(t)&&(E=P.createElement(br,{slide:t,offset:e,render:a,rect:o,imageFit:l,imageProps:c,onClick:m?void 0:()=>d?.({index:r})})),E?P.createElement(P.Fragment,null,(b=a.slideHeader)===null||b===void 0?void 0:b.call(a,{slide:t}),((S=a.slideContainer)!==null&&S!==void 0?S:(({children:k})=>k))({slide:t,children:E}),(x=a.slideFooter)===null||x===void 0?void 0:x.call(a,{slide:t})):null};return P.createElement("div",{ref:n,className:Ft(Ne(Fg()),!m&&Ne(Fg("current")),Ne(Rr)),...i_(m),style:u,role:"group","aria-roledescription":mr(f,"Slide"),"aria-label":pg(f,s,r+e)},p())}function D_(){const t=Ot().styles.slide;return P.createElement("div",{className:Ne(ic),style:t})}function I_({carousel:t,labels:e}){const{slides:n,currentIndex:r,globalIndex:s}=fn(),{setCarouselRef:o}=_n(),{autoPlaying:i,focusWithin:a}=yc(),l=$i(t.spacing),c=$i(t.padding),d=bg(t,n,1),u=[];if(gc(n))for(let f=r-d;f<=r+d;f+=1){const g=pc(n,f),m=s-r+f,p=t.finite&&(f<0||f>n.length-1);u.push(p?{key:m}:{key:[`${m}`,mg(g)].filter(Boolean).join("|"),offset:f-r,slide:g})}return P.createElement("div",{ref:o,className:Ft(Ne(yr()),u.length>0&&Ne(yr("with_slides"))),style:{[`${dt(yr("slides_count"))}`]:u.length,[`${dt(yr("spacing_px"))}`]:l.pixel||0,[`${dt(yr("spacing_percent"))}`]:l.percent||0,[`${dt(yr("padding_px"))}`]:c.pixel||0,[`${dt(yr("padding_percent"))}`]:c.percent||0},role:"region","aria-live":i&&!a?"off":"polite","aria-roledescription":mr(e,"Carousel"),"aria-label":mr(e,"Photo gallery")},u.map(({key:f,slide:g,offset:m})=>g?P.createElement(A_,{key:f,slide:g,offset:m}):P.createElement(D_,{key:f})))}const L_=un(Rh,I_);function zg(){const{carousel:t}=Ot(),{slides:e,currentIndex:n}=fn(),r=e.length===0||t.finite&&n===0,s=e.length===0||t.finite&&n===e.length-1;return{prevDisabled:r,nextDisabled:s}}function Vg(t){var e;const n=Vi(),{publish:r}=ss(),{animation:s,controller:o}=Ot(),{prevDisabled:i,nextDisabled:a}=zg(),l=((e=s.navigation)!==null&&e!==void 0?e:s.swipe)/2,c=Ig(()=>r(nr),l),d=Ig(()=>r(rr),l),u=Ge(f=>{switch(f.key){case RS:if(!o.closeOnEscape)return;r(es);break;case e_:(n?a:i)||(n?d:c)();break;case t_:(n?i:a)||(n?c:d)();break;default:return}f.stopPropagation()});P.useEffect(()=>t(lc,u),[t,u])}function Hg({label:t,icon:e,renderIcon:n,action:r,onClick:s,disabled:o,style:i}){return P.createElement(os,{label:t,icon:e,renderIcon:n,className:Ne(`navigation_${r}`),disabled:o,onClick:s,style:i,...Ag(_n().focus,o)})}function P_({render:{buttonPrev:t,buttonNext:e,iconPrev:n,iconNext:r},styles:s}){const{prev:o,next:i,subscribeSensors:a}=_n(),{prevDisabled:l,nextDisabled:c}=zg();return Vg(a),P.createElement(P.Fragment,null,t?t():P.createElement(Hg,{label:"Previous",action:nr,icon:x_,renderIcon:n,style:s.navigationPrev,disabled:l,onClick:o}),e?e():P.createElement(Hg,{label:"Next",action:rr,icon:w_,renderIcon:r,style:s.navigationNext,disabled:c,onClick:i}))}const $_=un(US,P_),Ug=Ne(ZS),F_=Ne(sg);function z_(t){return"style"in t}function Bg(t,e,n){const r=window.getComputedStyle(t),s=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,i=t.style.getPropertyValue(s);return t.style.setProperty(s,`${(Pi(o)||0)+e}px`),()=>{i?t.style.setProperty(s,i):t.style.removeProperty(s)}}function V_({noScroll:{disabled:t},children:e}){const n=Vi(),{getOwnerDocument:r,getOwnerWindow:s}=rs();return P.useEffect(()=>{if(t)return()=>{};const o=[],i=s(),{body:a,documentElement:l}=r(),c=Math.round(i.innerWidth-l.clientWidth);if(c>0){o.push(Bg(a,c,n));const d=a.getElementsByTagName("*");for(let u=0;u{a.classList.remove(Ug),o.forEach(d=>d())}},[n,t,r,s]),P.createElement(P.Fragment,null,e)}const H_=un(BS,V_);function jg(t){return gr(sc,t)}function Wg(t,e,n){const r=t.getAttribute(e);return t.setAttribute(e,n),()=>{r?t.setAttribute(e,r):t.removeAttribute(e)}}function U_({portal:{root:t,container:{className:e,style:n,...r}={}},animation:s,styles:o,className:i,on:a,close:l,labels:c,children:d}){const[u,f]=P.useState(!1),[g,m]=P.useState(!1),p=P.useRef([]),y=P.useRef(null),{setTimeout:b}=oo(),{subscribe:S}=ss(),E=vc()?0:s.fade;P.useEffect(()=>(f(!0),()=>{f(!1),m(!1)}),[]);const k=Ge(()=>{p.current.forEach(w=>w()),p.current=[]}),C=Ge(()=>{var w;m(!1),k(),(w=a.exiting)===null||w===void 0||w.call(a),b(()=>{var M;(M=a.exited)===null||M===void 0||M.call(a),l()},E)});P.useEffect(()=>S(es,C),[S,C]);const N=Ge(w=>{var M,O,L;a_(w),m(!0),(M=a.entering)===null||M===void 0||M.call(a);const F=(L=(O=w.parentNode)===null||O===void 0?void 0:O.children)!==null&&L!==void 0?L:[];for(let $=0;${var $,D;(D=($=y.current)===null||$===void 0?void 0:$.focus)===null||D===void 0||D.call($)}),b(()=>{var $;($=a.entered)===null||$===void 0||$.call(a)},E)}),_=P.useCallback(w=>{w?N(w):k()},[N,k]);return u?On.createPortal(P.createElement(__,{ref:_,className:Ft(i,e,Ne(jg()),Ne(sg),g&&Ne(jg("open"))),"aria-modal":!0,role:"dialog","aria-label":mr(c,"Lightbox"),style:{...s.fade!==bc.animation.fade?{[dt("fade_animation_duration")]:`${E}ms`}:null,...s.easing.fade!==bc.animation.easing.fade?{[dt("fade_animation_timing_function")]:s.easing.fade}:null,...o.root,...n},onFocus:w=>{y.current||(y.current=w.relatedTarget)},...r},d),(typeof t=="function"?t():t)||document.body):null}const B_=un(sc,U_);function j_({children:t}){return P.createElement(P.Fragment,null,t)}const W_=un(jS,j_);function G_(t){return gr(eg,t)}function Y_({toolbar:{buttons:t},render:{buttonClose:e,iconClose:n},styles:r}){const{close:s,setToolbarWidth:o}=_n(),{setContainerRef:i,containerRect:a}=Og();Cn(()=>{o(a?.width)},[o,a?.width]);const l=()=>e?e():P.createElement(os,{key:es,label:"Close",icon:v_,renderIcon:n,onClick:s});return P.createElement("div",{ref:i,style:r.toolbar,className:Ne(G_())},t?.map(c=>c===es?l():c))}const X_=un(eg,Y_);function Gg(t,e){var n;return P.createElement(t.module.component,{key:t.module.name,...e},(n=t.children)===null||n===void 0?void 0:n.map(r=>Gg(r,e)))}function K_(t,e={}){const{easing:n,...r}=t,{easing:s,...o}=e;return{easing:{...n,...s},...r,...o}}function q_({carousel:t,animation:e,render:n,toolbar:r,controller:s,noScroll:o,on:i,plugins:a,slides:l,index:c,...d}){const{animation:u,carousel:f,render:g,toolbar:m,controller:p,noScroll:y,on:b,slides:S,index:x,plugins:E,...k}=bc,{config:C,augmentation:N}=l_([Nt(B_,[Nt(H_,[Nt(T_,[Nt(L_),Nt(X_),Nt($_)])])])],a||E),_=N({animation:K_(u,e),carousel:{...f,...t},render:{...g,...n},toolbar:{...m,...r},controller:{...p,...s},noScroll:{...y,...o},on:{...b,...i},...k,...d});return _.open?P.createElement(Cg,{..._},P.createElement(g_,{slides:l||S,index:Pi(c||x)},P.createElement(b_,null,P.createElement(u_,null,P.createElement(c_,null,Gg(Nt(W_,C),_)))))):null}const Yg={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1,maxZoom:8};function Z_(t){return Math.min(Math.max(t,Number.EPSILON),1)}function Xg(t){const{minZoom:e,...n}={...Yg,...t};return{minZoom:Z_(e),...n}}function Q_(t,e,n,r){const s=P.useRef(void 0),o=P.useRef(void 0),{zoom:i}=Ot().animation,a=vc(),l=Ge(()=>{var c,d,u;if((c=s.current)===null||c===void 0||c.cancel(),s.current=void 0,o.current&&r?.current){try{s.current=(u=(d=r.current).animate)===null||u===void 0?void 0:u.call(d,[{transform:o.current},{transform:`scale(${t}) translateX(${e}px) translateY(${n}px)`}],{duration:a?0:i??500,easing:s.current?"ease-out":"ease-in-out"})}catch(f){console.error(f)}o.current=void 0,s.current&&(s.current.onfinish=()=>{s.current=void 0})}});return Cn(l,[t,e,n,l]),P.useCallback(()=>{o.current=r?.current?window.getComputedStyle(r.current).transform:void 0},[r])}function J_(t,e){const{on:n}=Ot(),r=Ge(()=>{var s;e||(s=n.zoom)===null||s===void 0||s.call(n,{zoom:t})});P.useEffect(r,[t,r])}function Hi(){const{zoom:t}=Ot();return Xg(t)}function R_(t,e){var n;const r=typeof t=="function"?(n=t(e))!==null&&n!==void 0?n:Yg.maxZoom:t;return Math.max(r,1)}function e2(t,e){var n,r;let s={width:0,height:0},o={width:0,height:0};const{currentSlide:i}=fn(),{imageFit:a}=Ot().carousel,{maxZoomPixelRatio:l,maxZoom:c}=Hi();if(t&&i){const u={...i,...e};if(sr(u)){const f=fc(u,a),g=Math.max(...(((n=u.srcSet)===null||n===void 0?void 0:n.map(p=>p.width))||[]).concat(u.width?[u.width]:[])),m=Math.max(...(((r=u.srcSet)===null||r===void 0?void 0:r.map(p=>p.height))||[]).concat(u.height?[u.height]:[]));g>0&&m>0&&t.width>0&&t.height>0&&(o=f?{width:Math.round(Math.min(g,t.width/t.height*m)),height:Math.round(Math.min(m,t.height/t.width*g))}:{width:g,height:m},o={width:o.width*l,height:o.height*l},s=f?{width:Math.min(t.width,o.width,g),height:Math.min(t.height,o.height,m)}:{width:Math.round(Math.min(t.width,t.height/m*g,g)),height:Math.round(Math.min(t.height,t.width/g*m,m))})}else t.width>0&&t.height>0&&(e&&e.width>0&&e.height>0?s={width:Math.min(t.width,e.width),height:Math.min(t.height,e.height)}:s={width:t.width,height:t.height})}const d=i&&s.width?sr(i)?Math.max(uc(o.width/s.width,5),1):R_(c,i):1;return{imageRect:s,maxZoom:d}}function Kg(t,e){return Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)}function qg(t,e,n=100,r=2){return t*Math.min(1+Math.abs(e/n),r)**Math.sign(e)}function t2(t,e,n,r,s,o,i,a,l){const c=P.useRef([]),d=P.useRef(0),u=P.useRef(void 0),{globalIndex:f}=fn(),{getOwnerWindow:g}=rs(),{containerRef:m,subscribeSensors:p}=_n(),{keyboardMoveDistance:y,zoomInMultiplier:b,wheelZoomDistanceFactor:S,scrollToZoom:x,doubleTapDelay:E,doubleClickDelay:k,doubleClickMaxStops:C,pinchZoomDistanceFactor:N,pinchZoomV4:_}=Hi(),w=P.useCallback(z=>{if(m.current){const{pageX:H,pageY:W}=z,{scrollX:j,scrollY:U}=g(),{left:B,top:G,width:V,height:K}=m.current.getBoundingClientRect();return[H-B-j-V/2,W-G-U-K/2]}return[]},[m,g]),M=Ge(z=>{const{key:H,metaKey:W,ctrlKey:j}=z,U=W||j,B=()=>{z.preventDefault(),z.stopPropagation()};if(t>1){const G=(V,K)=>{B(),a(V,K)};H==="ArrowDown"?G(0,y):H==="ArrowUp"?G(0,-y):H==="ArrowLeft"?G(-y,0):H==="ArrowRight"&&G(y,0)}H==="+"||U&&H==="="?(B(),s()):H==="-"||U&&H==="_"?(B(),o()):U&&H==="0"&&(B(),i(1))}),O=Ge(z=>{if((z.ctrlKey||x)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),i(qg(t,-z.deltaY,S),!0,...w(z));return}t>1&&(z.stopPropagation(),x||a(z.deltaX,z.deltaY))}),L=P.useCallback(z=>{const H=c.current;H.splice(0,H.length,...H.filter(W=>W.pointerId!==z.pointerId))},[]),F=P.useCallback(z=>{L(z),z.persist(),c.current.push(z)},[L]),$=Ge(z=>{var H;const W=c.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((H=l?.current)===null||H===void 0)&&H.contains(z.target)))return;t>1&&z.stopPropagation();const{timeStamp:j}=z;if(W.length===0&&j-d.current<(z.pointerType==="touch"?E:k)){d.current=0;const U=t>=1?t!==n?t*Math.max(n**(1/C),b):1:t!==e?t/Math.max(e**(-1/C),b):1;i(U,!1,...w(z))}else d.current=j;if(F(z),W.length===2){const U=Kg(W[0],W[1]);u.current={previousDistance:U,initialDistance:Math.max(U,1),initialZoom:t}}}),D=Ge(z=>{const H=c.current,W=H.find(j=>j.pointerId===z.pointerId);if(H.length===2&&u.current){z.stopPropagation(),F(z);const j=Kg(H[0],H[1]),U=_?u.current.initialZoom/u.current.initialDistance*j:qg(t,j-u.current.previousDistance,N);i(U,!0,...H.map(B=>w(B)).reduce((B,G)=>G.map((V,K)=>B[K]+V/2))),u.current.previousDistance=j;return}t>1&&(z.stopPropagation(),W&&(H.length===1&&a((W.clientX-z.clientX)/t,(W.clientY-z.clientY)/t),F(z)))}),A=P.useCallback(z=>{const H=c.current;H.length===2&&H.find(W=>W.pointerId===z.pointerId)&&(u.current=void 0),L(z)},[L]),T=P.useCallback(()=>{const z=c.current;z.splice(0,z.length),d.current=0,u.current=void 0},[]);Lg(p,$,D,A,r),P.useEffect(T,[f,T]),P.useEffect(()=>r?()=>{}:ts(T,p(lc,M),p(cc,O)),[r,p,T,M,O])}function n2(t,e,n){const[r,s]=P.useState(1),[o,i]=P.useState(0),[a,l]=P.useState(0),c=Q_(r,o,a,n),{currentSlide:d,globalIndex:u}=fn(),{containerRect:f,slideRect:g}=_n(),{minZoom:m,zoomInMultiplier:p}=Hi(),y=d&&sr(d)?d.src:void 0,b=!n?.current;Cn(()=>{s(1),i(0),l(0)},[u,y]);const S=P.useCallback((N,_,w)=>{const M=w||r,O=o-(N||0),L=a-(_||0),F=(t.width*M-g.width)/2/M,$=(t.height*M-g.height)/2/M;i(Math.min(Math.abs(O),Math.max(F,0))*Math.sign(O)),l(Math.min(Math.abs(L),Math.max($,0))*Math.sign(L))},[r,o,a,g,t.width,t.height]),x=P.useCallback((N,_,w,M)=>{const O=uc(N+.01m?N:m:e,5);_||c(),S(w?w*(1/r-1/O):0,M?M*(1/r-1/O):0,O),s(O)},[r,m,e,S,c]),E=Ge(()=>{r>1&&(r>e&&x(e,!0),S())});Cn(E,[f.width,f.height,E]);const k=P.useCallback(()=>{const N=r*p;x(r<1&&N>1?1:N)},[r,p,x]),C=P.useCallback(()=>{const N=r/p;x(r>1&&N<1?1:N)},[r,p,x]);return{zoom:r,offsetX:o,offsetY:a,disabled:b,changeOffsets:S,changeZoom:x,zoomIn:k,zoomOut:C}}const Zg=P.createContext(null),_c=an("useZoom","ZoomControllerContext",Zg);function r2({children:t}){const[e,n]=P.useState(),{slideRect:r}=_n(),{ref:s,minZoom:o}=Hi(),{imageRect:i,maxZoom:a}=e2(r,e?.imageDimensions),{zoom:l,offsetX:c,offsetY:d,disabled:u,changeZoom:f,changeOffsets:g,zoomIn:m,zoomOut:p}=n2(i,a,e?.zoomWrapperRef);J_(l,u),t2(l,o,a,u,m,p,f,g,e?.zoomWrapperRef);const y=P.useMemo(()=>({zoom:l,minZoom:o,maxZoom:a,offsetX:c,offsetY:d,disabled:u,zoomIn:m,zoomOut:p,changeZoom:f}),[l,o,a,c,d,u,m,p,f]);P.useImperativeHandle(s,()=>y,[y]);const b=P.useMemo(()=>({...y,setZoomWrapper:n}),[y,n]);return P.createElement(Zg.Provider,{value:b},t)}const s2=Zt("ZoomIn",P.createElement(P.Fragment,null,P.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),P.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),o2=Zt("ZoomOut",P.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),Qg=P.forwardRef(function({zoomIn:e,onLoseFocus:n},r){const s=P.useRef(!1),o=P.useRef(!1),{zoom:i,minZoom:a,maxZoom:l,zoomIn:c,zoomOut:d,disabled:u}=_c(),{render:f}=Ot(),g=u||(e?i>=l:i<=a);return P.useEffect(()=>{g&&s.current&&o.current&&n(),g||(s.current=!0)},[g,n]),P.createElement(os,{ref:r,disabled:g,label:e?"Zoom in":"Zoom out",icon:e?s2:o2,renderIcon:e?f.iconZoomIn:f.iconZoomOut,onClick:e?c:d,onFocus:()=>{o.current=!0},onBlur:()=>{o.current=!1}})});function i2(){const t=P.useRef(null),e=P.useRef(null),{focus:n}=_n(),r=P.useCallback(i=>{var a,l;!((a=i.current)===null||a===void 0)&&a.disabled?n():(l=i.current)===null||l===void 0||l.focus()},[n]),s=P.useCallback(()=>r(t),[r]),o=P.useCallback(()=>r(e),[r]);return P.createElement(P.Fragment,null,P.createElement(Qg,{zoomIn:!0,ref:t,onLoseFocus:o}),P.createElement(Qg,{ref:e,onLoseFocus:s}))}function a2(){const{render:t}=Ot(),e=_c();return t.buttonZoom?P.createElement(P.Fragment,null,t.buttonZoom(e)):P.createElement(i2,null)}function l2(t){var e;return(((e=t.srcSet)===null||e===void 0?void 0:e.length)||0)>0}function c2({current:t,preload:e},{type:n,source:r}){switch(n){case"fetch":return t?{current:t,preload:r}:{current:r};case"done":return r===e?{current:r}:{current:t,preload:e};default:throw new Error(hg)}}function d2(t){var e,n;const[{current:r,preload:s},o]=P.useReducer(c2,{}),{slide:i,rect:a,imageFit:l,render:c,interactive:d}=t,u=i.srcSet.sort((k,C)=>k.width-C.width),f=(e=i.width)!==null&&e!==void 0?e:u[u.length-1].width,g=(n=i.height)!==null&&n!==void 0?n:u[u.length-1].height,m=fc(i,l),p=Math.max(...u.map(k=>k.width)),y=Math.min((m?Math.max:Math.min)(a.width,f*(a.height/g)),p),b=s_(),S=Ge(()=>{var k;const C=(k=u.find(N=>N.width>=y*b))!==null&&k!==void 0?k:u[u.length-1];(!r||u.findIndex(N=>N.src===r)N===C))&&o({type:"fetch",source:C.src})});Cn(S,[a.width,a.height,b,S]);const x=Ge(k=>o({type:"done",source:k})),E={WebkitTransform:d?"initial":"translateZ(0)"};return m||Object.assign(E,a.width/a.heightx(s),render:{...c,iconLoading:()=>null,iconError:()=>null}}),r&&P.createElement(br,{key:"current",...t,slide:{...i,src:r,srcSet:void 0},style:E}))}function u2({render:t,slide:e,offset:n,rect:r}){var s;const[o,i]=P.useState(),a=P.useRef(null),l=sr(e),{zoom:c,maxZoom:d,offsetX:u,offsetY:f,setZoomWrapper:g}=_c(),m=c>1,{carousel:p,on:y}=Ot(),{currentIndex:b}=fn();Cn(()=>{if(n!==0||l||!a.current)return()=>{};const x=()=>{const k=a.current;if(!k)return;let C=0,N=0;for(const _ of k.children)_ instanceof HTMLElement&&(C=Math.max(C,_.offsetWidth),N=Math.max(N,_.offsetHeight));i(_=>_&&_.width===C&&_.height===N?_:{width:C,height:N})};if(x(),typeof ResizeObserver>"u")return()=>{};const E=new ResizeObserver(x);for(const k of a.current.children)E.observe(k);return()=>E.disconnect()},[n,l,r]),Cn(()=>n===0?(g({zoomWrapperRef:a,imageDimensions:o}),()=>g(void 0)):()=>{},[n,o,g]);let S=(s=t.slide)===null||s===void 0?void 0:s.call(t,{slide:e,offset:n,rect:r,zoom:c,maxZoom:d});if(!S&&l){const x={slide:e,offset:n,rect:r,render:t,imageFit:p.imageFit,imageProps:p.imageProps,onClick:n===0?()=>{var E;return(E=y.click)===null||E===void 0?void 0:E.call(y,{index:b})}:void 0};S=l2(e)?P.createElement(d2,{...x,slide:e,interactive:m,rect:n===0?{width:r.width*c,height:r.height*c}:r}):P.createElement(br,{onLoad:E=>i({width:E.naturalWidth,height:E.naturalHeight}),...x})}return S?P.createElement("div",{ref:a,className:Ft(Ne(rg),Ne(Rr),Ne(og),m&&Ne(QS)),style:n===0?{transform:`scale(${c}) translateX(${u}px) translateY(${f}px)`}:void 0},S):null}const f2=({augment:t,addModule:e})=>{t(({zoom:n,toolbar:r,render:s,controller:o,...i})=>{const a=Xg(n);return{zoom:a,toolbar:Fi(r,ng,P.createElement(a2,null)),render:{...s,slide:l=>{var c,d;return sr(l.slide)||l.slide.type!=null&&(!((c=a.supports)===null||c===void 0)&&c.includes(l.slide.type))?P.createElement(u2,{render:s,...l}):(d=s.slide)===null||d===void 0?void 0:d.call(s,l)}},controller:{...o,preventDefaultWheelY:a.scrollToZoom},...i}}),e(un(ng,r2))},h2={separator:"/",container:{}},Jg=t=>({...h2,...t});function g2({counter:t}){const{slides:e,currentIndex:n}=fn(),{separator:r,container:{className:s,...o},className:i,...a}=Jg(t);return e.length===0?null:P.createElement("div",{className:Ft(Ne("counter"),s||i),...a,...o,"aria-hidden":!0},n+1," ",r," ",e.length)}function p2({augment:t,addChild:e}){t(({counter:n,...r})=>({counter:Jg(n),...r})),e(Rs,un(WS,g2))}const m2={autoplay:!1,delay:3e3,ref:null},Rg=t=>({...m2,...t}),ep=P.createContext(null),b2=an("useSlideshow","SlideshowContext",ep);function y2({slideshow:t,carousel:{finite:e},on:n,children:r}){const{autoplay:s,delay:o,ref:i}=Rg(t),a=P.useRef(s),[l,c]=P.useState(s),d=P.useRef(void 0),u=P.useRef(void 0),{slides:f,currentIndex:g}=fn(),{setTimeout:m,clearTimeout:p}=oo(),{subscribe:y}=ss(),{next:b}=_n(),{setAutoPlaying:S}=yc();P.useEffect(()=>S(l),[l,S]);const x=f.length===0||e&&g===f.length-1,E=P.useCallback(()=>{!l&&!x&&c(!0)},[l,x]),k=P.useCallback(()=>{l&&c(!1)},[l]),C=P.useCallback(()=>{p(d.current),d.current=void 0},[p]),N=Ge(()=>{C(),!(!l||x||u.current===Jr||u.current===oc)&&(d.current=m(()=>{l&&(u.current=void 0,b())},o))});P.useEffect(N,[g,l,N]),P.useEffect(()=>{l&&x&&c(!1)},[g,l,x]);const _=Ge(()=>{var O;return(O=n.slideshowStart)===null||O===void 0?void 0:O.call(n)}),w=Ge(()=>{var O;return(O=n.slideshowStop)===null||O===void 0?void 0:O.call(n)});P.useEffect(()=>{l?_():a.current&&w(),a.current=l},[l,_,w]),P.useEffect(()=>ts(C,y(YS,()=>{u.current=Jr,C()}),y(XS,()=>{u.current=oc,C()}),y(KS,()=>{u.current=no,N()}),y(qS,()=>{u.current=ro,N()})),[y,C,N]);const M=P.useMemo(()=>({playing:l,disabled:x,play:E,pause:k}),[l,x,E,k]);return P.useImperativeHandle(i,()=>M,[M]),P.createElement(ep.Provider,{value:M},r)}const v2=Zt("Play",P.createElement("path",{d:"M8 5v14l11-7z"})),x2=Zt("Pause",P.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function w2(){const{playing:t,disabled:e,play:n,pause:r}=b2(),{render:s}=Ot(),o=Ag(_n().focus,e);return s.buttonSlideshow?P.createElement(P.Fragment,null,s.buttonSlideshow({playing:t,disabled:e,play:n,pause:r})):P.createElement(os,{label:t?"Pause":"Play",icon:t?x2:v2,renderIcon:t?s.iconSlideshowPause:s.iconSlideshowPlay,onClick:t?r:n,disabled:e,...o})}function k2({augment:t,addModule:e}){t(({slideshow:n,toolbar:r,...s})=>({toolbar:Fi(r,tg,P.createElement(w2,null)),slideshow:Rg(n),...s})),e(un(tg,y2))}const C2={auto:!1,ref:null},tp=t=>({...C2,...t}),np=P.createContext(null),S2=an("useFullscreen","FullscreenContext",np);function _2({fullscreen:t,on:e,children:n}){const{auto:r,ref:s}=tp(t),o=P.useRef(null),[i,a]=P.useState(),[l,c]=P.useState(!1),d=P.useRef(!1),{getOwnerDocument:u}=rs();Cn(()=>{var x,E,k,C;const N=u();a(!((C=(k=(E=(x=N.fullscreenEnabled)!==null&&x!==void 0?x:N.webkitFullscreenEnabled)!==null&&E!==void 0?E:N.mozFullScreenEnabled)!==null&&k!==void 0?k:N.msFullscreenEnabled)!==null&&C!==void 0&&C))},[u]);const f=P.useCallback(()=>{var x;const E=u(),k=E.fullscreenElement||E.webkitFullscreenElement||E.mozFullScreenElement||E.msFullscreenElement;return((x=k?.shadowRoot)===null||x===void 0?void 0:x.fullscreenElement)||k},[u]),g=P.useCallback(()=>{const x=o.current;try{x.requestFullscreen?x.requestFullscreen().catch(()=>{}):x.webkitRequestFullscreen?x.webkitRequestFullscreen():x.mozRequestFullScreen?x.mozRequestFullScreen():x.msRequestFullscreen&&x.msRequestFullscreen()}catch{}},[]),m=P.useCallback(()=>{if(!f())return;const x=u();try{x.exitFullscreen?x.exitFullscreen().catch(()=>{}):x.webkitExitFullscreen?x.webkitExitFullscreen():x.mozCancelFullScreen?x.mozCancelFullScreen():x.msExitFullscreen&&x.msExitFullscreen()}catch{}},[f,u]);P.useEffect(()=>{const x=u(),E=()=>{c(f()===o.current)};return ts(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(k=>(x.addEventListener(k,E),()=>x.removeEventListener(k,E))))},[f,u]);const p=Ge(()=>{var x;return(x=e.enterFullscreen)===null||x===void 0?void 0:x.call(e)}),y=Ge(()=>{var x;return(x=e.exitFullscreen)===null||x===void 0?void 0:x.call(e)});P.useEffect(()=>{l&&(d.current=!0),d.current&&(l?p:y)()},[l,p,y]);const b=Ge(()=>{var x;return(x=r?g:null)===null||x===void 0||x(),m});P.useEffect(b,[b]);const S=P.useMemo(()=>({fullscreen:l,disabled:i,enter:g,exit:m}),[l,i,g,m]);return P.useImperativeHandle(s,()=>S,[S]),P.createElement("div",{ref:o,className:Ft(Ne(eo),Ne(rg))},P.createElement(np.Provider,{value:S},n))}const E2=Zt("EnterFullscreen",P.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),M2=Zt("ExitFullscreen",P.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function N2(){var t;const{fullscreen:e,disabled:n,enter:r,exit:s}=S2(),{render:o}=Ot();return n?null:o.buttonFullscreen?P.createElement(P.Fragment,null,(t=o.buttonFullscreen)===null||t===void 0?void 0:t.call(o,{fullscreen:e,disabled:n,enter:r,exit:s})):P.createElement(os,{disabled:n,label:e?"Exit Fullscreen":"Enter Fullscreen",icon:e?M2:E2,renderIcon:e?o.iconExitFullscreen:o.iconEnterFullscreen,onClick:e?s:r})}function O2({augment:t,contains:e,addParent:n}){t(({fullscreen:r,toolbar:s,...o})=>({toolbar:Fi(s,eo,P.createElement(N2,null)),fullscreen:tp(r),...o})),n(e(to)?to:Rs,un(eo,_2))}const vr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Ec=t=>({...vr,...t});function rp(){const{thumbnails:t}=Ot();return Ec(t)}const xr=t=>gr(to,t),Tt=t=>xr(gr("thumbnail",t)),T2=Zt("VideoThumbnail",P.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"})),A2=Zt("UnknownThumbnail",P.createElement("path",{d:"M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"}));function D2({slide:t,render:e,rect:n,imageFit:r}){var s;const o=(s=e.thumbnail)===null||s===void 0?void 0:s.call(e,{slide:t,render:e,rect:n,imageFit:r});if(o)return o;const i={render:e,rect:n,imageFit:r};if(t.thumbnail)return P.createElement(br,{slide:{src:t.thumbnail},...i});if(sr(t))return P.createElement(br,{slide:t,...i});const a=Ne(Tt(Li));return t.type==="video"?P.createElement(P.Fragment,null,t.poster&&P.createElement(br,{slide:{src:t.poster},...i}),P.createElement(T2,{className:a})):P.createElement(A2,{className:a})}const I2=pr("active"),Mc=pr("fadein"),Nc=pr("fadeout"),L2=pr("placeholder"),sp="delay",op="duration";function P2({slide:t,index:e,onClick:n,fadeIn:r,fadeOut:s,placeholder:o,onLoseFocus:i}){const a=P.useRef(null),{render:l,styles:c,labels:d}=Ot(),{slides:u,globalIndex:f}=fn(),{getOwnerDocument:g}=rs(),{width:m,height:p,imageFit:y}=rp(),b={width:m,height:p},S=e===f,x=Ge(i);return P.useEffect(()=>{s&&g().activeElement===a.current&&x()},[s,x,g]),P.createElement("button",{ref:a,type:"button",className:Ft(Ne(Rr),Ne(Tt()),S&&Ne(Tt(I2())),r&&Ne(Tt(Mc())),s&&Ne(Tt(Nc())),o&&Ne(Tt(L2()))),style:{...r?{[dt(Tt(Mc(op)))]:`${r.duration}ms`,[dt(Tt(Mc(sp)))]:`${r.delay}ms`}:null,...s?{[dt(Tt(Nc(op)))]:`${s.duration}ms`,[dt(Tt(Nc(sp)))]:`${s.delay}ms`}:null,...c.thumbnail},onClick:n,"aria-current":S?!0:void 0,"aria-label":pg(d,u,e)},t&&D2({slide:t,render:l,rect:b,imageFit:y}))}function ip(t){return["top","bottom"].includes(t)}function ap(t,e){return e+2*(t.border+t.padding)+t.gap}function $2(t){const{thumbnail:e,poster:n}=t||{thumbnail:"placeholder"};return typeof e=="string"&&e||typeof n=="string"&&n||t&&mg(t)||void 0}function lp({visible:t,containerRef:e}){const n=P.useRef(null),r=Vi(),{publish:s,subscribe:o}=ss(),{carousel:i,styles:a,labels:l}=Ot(),{slides:c,globalIndex:d,animation:u}=fn(),{registerSensors:f,subscribeSensors:g}=Dg();Vg(g);const m=rp(),{position:p,width:y,height:b,border:S,borderStyle:x,borderColor:E,borderRadius:k,padding:C,gap:N,vignette:_}=m,w=u?.duration!==void 0&&u?.increment||0,M=u?.duration||0,{prepareAnimation:O}=xc(n,A=>({keyframes:ip(p)?[{transform:`translateX(${(r?-1:1)*ap(m,y)*w+A}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${ap(m,b)*w+A}px)`},{transform:"translateY(0)"}],duration:M,easing:u?.easing})),L=Ge(()=>{let A=0;if(e.current&&n.current){const T=e.current.getBoundingClientRect(),z=n.current.getBoundingClientRect();A=ip(p)?z.left-T.left-(T.width-z.width)/2:z.top-T.top-(T.height-z.height)/2}O(A)});P.useEffect(()=>ts(o(ac,L)),[o,L]);const F=bg(i,c),$=[];if(gc(c))for(let A=d-F-Math.abs(w);A<=d+F+Math.abs(w);A+=1){const z=i.finite&&(A<0||A>c.length-1)||w<0&&A0&&A>d+F?null:pc(c,A),H=[`${A}`,$2(z)].filter(Boolean).join("|");$.push({key:H,index:A,slide:z})}const D=A=>()=>{A>d?s(rr,{count:A-d}):A{const H=M/Math.abs(w||1),W=w>0&&T>d+F-w&&T<=d+F||w<0&&T=d-F?{duration:H,delay:((w>0?T-(d+F-w):d-F-w-T)-1)*H}:void 0,j=w>0&&Td+F?{duration:H,delay:(w>0?w-(d-F-T):-w-(T-(d+F)))*H}:void 0;return P.createElement(P2,{key:A,index:T,slide:z,fadeIn:W,fadeOut:j,placeholder:!z,onClick:D(T),onLoseFocus:()=>{var U;return(U=n.current)===null||U===void 0?void 0:U.focus()}})})),_&&P.createElement("div",{className:Ne(xr("vignette"))}))}const cp=P.createContext(null),F2=an("useThumbnails","ThumbnailsContext",cp);function z2({children:t,...e}){const{ref:n,position:r,hidden:s}=Ec(e.thumbnails),[o,i]=P.useState(!s),a=P.useRef(null),l=P.useMemo(()=>({visible:o,show:()=>i(!0),hide:()=>i(!1)}),[o]);return P.useImperativeHandle(n,()=>l,[l]),P.createElement(Cg,{...e},P.createElement(cp.Provider,{value:l},P.createElement("div",{ref:a,className:Ft(Ne(xr()),Ne(xr(`${r}`)))},["start","top"].includes(r)&&P.createElement(lp,{containerRef:a,visible:o}),P.createElement("div",{className:Ne(xr("wrapper"))},t),["end","bottom"].includes(r)&&P.createElement(lp,{containerRef:a,visible:o}))))}const dp=()=>P.createElement(P.Fragment,null,P.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),P.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),V2=Zt("ThumbnailsVisible",dp()),H2=y_("ThumbnailsHidden",dp());function U2(){const{visible:t,show:e,hide:n}=F2(),{render:r}=Ot();return r.buttonThumbnails?P.createElement(P.Fragment,null,r.buttonThumbnails({visible:t,show:e,hide:n})):P.createElement(os,{label:t?"Hide thumbnails":"Show thumbnails",icon:t?V2:H2,renderIcon:t?r.iconThumbnailsVisible:r.iconThumbnailsHidden,onClick:t?n:e})}function B2({augment:t,contains:e,append:n,addParent:r}){t(({thumbnails:o,toolbar:i,...a})=>{const l=Ec(o);return{toolbar:Fi(i,to,l.showToggle?P.createElement(U2,null):null),thumbnails:l,...a}});const s=un(to,z2);e(eo)?n(eo,s):r(Rs,s)}const j2=window.G7Core?.createLogger?.("Comp:ImageGallery")??{log:(...t)=>console.log("[Comp:ImageGallery]",...t),warn:(...t)=>console.warn("[Comp:ImageGallery]",...t),error:(...t)=>console.error("[Comp:ImageGallery]",...t)},Oc=window.G7Core,Ui=(t,e)=>Oc?.t?.(t,e)??t,W2=async(t,e)=>{try{const n=await Oc.api.get(t,{responseType:"blob"});if(n){const r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}catch(n){j2.error("Failed to download file:",n),Oc?.toast?.error?.(Ui("common.download_failed"))}},G2=(t,e)=>{const n=document.createElement("a");n.href=t,n.download=e,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)},Tc=async t=>{const e=t.downloadUrl||t.src,n=t.filename||t.title||"image";t.downloadRequiresAuth?await W2(e,n):G2(e,n)},Y2=({image:t,index:e,onDownload:n})=>{const[r,s]=v.useState(!1),o=async i=>{if(i.stopPropagation(),n){n(t,e);return}s(!0);try{await Tc(t)}finally{s(!1)}};return h.jsx(oe,{type:"button",onClick:o,disabled:r,className:"yarl__button flex items-center justify-center","aria-label":Ui("common.download"),title:Ui("common.download"),children:r?h.jsx(pt,{className:"fa-solid fa-spinner fa-spin text-white"}):h.jsx(pt,{className:"fa-solid fa-download text-white"})})},Bi=({images:t,isOpen:e,onClose:n,startIndex:r=0,enableZoom:s=!0,enableSlideshow:o=!1,enableFullscreen:i=!0,showCounter:a=!0,showDownload:l=!0,showThumbnails:c=!0,onDownload:d,editorAttrs:u,id:f})=>{const[g,m]=v.useState(r),p=v.useRef(r),y=t.map(x=>({src:x.src,title:x.title,description:x.description})),b=[];s&&b.push(f2),o&&b.push(k2),i&&b.push(O2),a&&b.push(p2),c&&b.push(B2);const S=t[g];if(v.useEffect(()=>{p.current=g},[g]),u){const x=(t??[]).slice(0,4);return h.jsx(I,{id:f,className:"grid grid-cols-2 gap-2 p-3 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",...u,children:x.length>0?x.map((E,k)=>h.jsx(yn,{src:E.thumbnail||E.src,alt:E.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},k)):h.jsxs(I,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[h.jsx(pt,{className:"fa-regular fa-images mr-2"}),Ui("editor.component.image_gallery")]})})}return h.jsx(q_,{open:e,close:n,slides:y,index:g,plugins:b,on:{view:({index:x})=>{x!==p.current&&m(x)}},zoom:{maxZoomPixelRatio:3,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:300,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,scrollToZoom:!0},carousel:{finite:!0,preload:2,padding:"16px",spacing:"30%"},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},controller:{closeOnBackdropClick:!0,closeOnPullDown:!0,closeOnPullUp:!0},thumbnails:{position:"bottom",width:120,height:80,border:2,borderRadius:4,padding:4,gap:16,showToggle:!1,vignette:!0},toolbar:{buttons:[l&&S&&h.jsx(Y2,{image:S,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},up=()=>{const[t,e]=v.useState(!1),[n,r]=v.useState([]),[s,o]=v.useState(0),i=v.useCallback((l,c=0)=>{r(l),o(c),e(!0)},[]),a=v.useCallback(()=>{e(!1)},[]);return{isOpen:t,openGallery:i,closeGallery:a,galleryProps:{images:n,isOpen:t,onClose:a,startIndex:s}}};Bi.displayName="ImageGallery";const X2=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Bi,executeImageDownload:Tc,useImageGallery:up},Symbol.toStringTag,{value:"Module"})),K2=v.createContext(null),q2=({value:t,children:e})=>h.jsx(K2.Provider,{value:t,children:e});function Z2(t,e){return e.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in t)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(t)}function fp(t,e){return new Promise((function(n,r){let s;return Q2(t).then((function(o){try{return s=o,n(new Blob([e.slice(0,2),s,e.slice(2)],{type:"image/jpeg"}))}catch(i){return r(i)}}),r)}))}const Q2=t=>new Promise(((e,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let i=0;if(o.getUint16(i)!==65496)return n("not a valid JPEG");for(i+=2;;){const a=o.getUint16(i);if(a===65498)break;const l=o.getUint16(i+2);if(a===65505&&o.getUint32(i+4)===1165519206){const c=i+10;let d;switch(o.getUint16(c)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(c+2,d)!==42)return n("TIFF header contains invalid version");const u=o.getUint32(c+4,d),f=c+u+2+12*o.getUint16(c+u,d);for(let g=c+u+2;g>>24&255,a[i+1]=l>>>16&255,a[i+2]=l>>>8&255,a[i+3]=l>>>0&255,new Uint8Array(a.buffer,0,i+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var i=new Uint8Array(50+Math.floor(1.1*s.length)),a=r.F.deflateRaw(s,i,a,o.level);return new Uint8Array(i.buffer,0,a)},r.encode=function(s,o){o==null&&(o=!1);var i=0,a=r.bin.writeUint,l=r.bin.writeUshort,c={};for(var d in s){var u=!r._noNeed(d)&&!o,f=s[d],g=r.crc.crc(f,0,f.length);c[d]={cpr:u,usize:f.length,crc:g,file:u?r.deflateRaw(f):f}}for(var d in c)i+=c[d].file.length+30+46+2*r.bin.sizeUTF8(d);i+=22;var m=new Uint8Array(i),p=0,y=[];for(var d in c){var b=c[d];y.push(p),p=r._writeHeader(m,p,d,b,0)}var S=0,x=p;for(var d in c)b=c[d],y.push(p),p=r._writeHeader(m,p,d,b,1,y[S++]);var E=p-x;return a(m,p,101010256),p+=4,l(m,p+=4,S),l(m,p+=2,S),a(m,p+=2,E),a(m,p+=4,x),p+=4,p+=2,m.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,i,a,l,c){var d=r.bin.writeUint,u=r.bin.writeUshort,f=a.file;return d(s,o,l==0?67324752:33639248),o+=4,l==1&&(o+=2),u(s,o,20),u(s,o+=2,0),u(s,o+=2,a.cpr?8:0),d(s,o+=2,0),d(s,o+=4,a.crc),d(s,o+=4,f.length),d(s,o+=4,a.usize),u(s,o+=4,r.bin.sizeUTF8(i)),u(s,o+=2,0),o+=2,l==1&&(o+=2,o+=2,d(s,o+=6,c),o+=4),o+=r.bin.writeUTF8(s,o,i),l==0&&(s.set(f,o),o+=f.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var i=o,a=0;a<8;a++)1&i?i=3988292384^i>>>1:i>>>=1;s[o]=i}return s})(),update:function(s,o,i,a){for(var l=0;l>>8;return s},crc:function(s,o,i){return 4294967295^r.crc.update(4294967295,s,o,i)}},r.adler=function(s,o,i){for(var a=1,l=0,c=o,d=o+i;c>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255,s[o+2]=i>>16&255,s[o+3]=i>>24&255},readASCII:function(s,o,i){for(var a="",l=0;l>6,s[o+l+1]=128|d>>0&63,l+=2;else if((4294901760&d)==0)s[o+l]=224|d>>12,s[o+l+1]=128|d>>6&63,s[o+l+2]=128|d>>0&63,l+=3;else{if((4292870144&d)!=0)throw"e";s[o+l]=240|d>>18,s[o+l+1]=128|d>>12&63,s[o+l+2]=128|d>>6&63,s[o+l+3]=128|d>>0&63,l+=4}}return l},sizeUTF8:function(s){for(var o=s.length,i=0,a=0;a>>3}var y=c.lits,b=c.strt,S=c.prev,x=0,E=0,k=0,C=0,N=0,_=0;for(p>2&&(b[_=r.F._hash(s,0)]=0),f=0;f14e3||E>26697)&&p-f>100&&(m>>16,L=65535&M;if(M!=0){L=65535&M;var F=d(O=M>>>16,c.of0);c.lhst[257+F]++;var $=d(L,c.df0);c.dhst[$]++,C+=c.exb[F]+c.dxb[$],y[x]=O<<23|f-m,y[x+1]=L<<16|F<<8|$,x+=2,m=f+O}else c.lhst[s[f]]++;E++}}for(k==f&&s.length!=0||(m>>3},r.F._bestMatch=function(s,o,i,a,l,c){var d=32767&o,u=i[d],f=d-u+32768&32767;if(u==d||a!=r.F._hash(s,o-f))return 0;for(var g=0,m=0,p=Math.min(32767,o);f<=p&&--c!=0&&u!=d;){if(g==0||s[o+g]==s[o+g-f]){var y=r.F._howLong(s,o,f);if(y>g){if(m=f,(g=y)>=l)break;f+2b&&(b=E,u=x)}}}f+=(d=u)-(u=i[d])+32768&32767}return g<<16|m},r.F._howLong=function(s,o,i){if(s[o]!=s[o-i]||s[o+1]!=s[o+1-i]||s[o+2]!=s[o+2-i])return 0;var a=o,l=Math.min(s.length,o+258);for(o+=3;o>>23,j=T+(8388607&H);T>16,G=U>>8&255,V=255&U;_(u,f=r.F._writeLit(257+G,$,u,f),W-C.of0[G]),f+=C.exb[G],N(u,f=r.F._writeLit(V,D,u,f),B-C.df0[V]),f+=C.dxb[V],T+=W}}f=r.F._writeLit(256,$,u,f)}return f},r.F._copyExact=function(s,o,i,a,l){var c=l>>>3;return a[c]=i,a[c+1]=i>>>8,a[c+2]=255-a[c],a[c+3]=255-a[c+1],c+=4,a.set(new Uint8Array(s.buffer,o,i),c),l+(i+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),i=r.F._hufTree(s.dhst,s.dtree,15),a=[],l=r.F._lenCodes(s.ltree,a),c=[],d=r.F._lenCodes(s.dtree,c),u=0;u4&&s.itree[1+(s.ordr[g-1]<<1)]==0;)g--;return[o,i,f,l,d,g,a,c]},r.F.getSecond=function(s){for(var o=[],i=0;i>1)+",");return o},r.F.contSize=function(s,o){for(var i=0,a=0;a15&&(r.F._putsE(i,a,d,u),a+=u)}return a},r.F._lenCodes=function(s,o){for(var i=s.length;i!=2&&s[i-1]==0;)i-=2;for(var a=0;a>>1,138))<11?o.push(17,g-3):o.push(18,g-11),a+=2*g-2}else if(l==u&&c==l&&d==l){for(f=a+5;f+2>>1,6);o.push(16,g-3),a+=2*g-2}else o.push(l,0)}return i>>>1},r.F._hufTree=function(s,o,i){var a=[],l=s.length,c=o.length,d=0;for(d=0;di&&(r.F.restrictDepth(f,i,x),x=i),d=0;do;a++){var d=s[a].d;s[a].d=o,c+=l-(1<>>=i-o;c>0;)(d=s[a].d)=0;a--)s[a].d==o&&c<0&&(s[a].d--,c++);c!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var i=0;return o[16|i]<=s&&(i|=16),o[8|i]<=s&&(i|=8),o[4|i]<=s&&(i|=4),o[2|i]<=s&&(i|=2),o[1|i]<=s&&(i|=1),i},r.F._writeLit=function(s,o,i,a){return r.F._putsF(i,a,o[s<<1]),a+o[1+(s<<1)]},r.F.inflate=function(s,o){var i=Uint8Array;if(s[0]==3&&s[1]==0)return o||new i(0);var a=r.F,l=a._bitsF,c=a._bitsE,d=a._decodeTiny,u=a.makeCodes,f=a.codes2map,g=a._get17,m=a.U,p=o==null;p&&(o=new i(s.length>>>2<<3));for(var y,b,S=0,x=0,E=0,k=0,C=0,N=0,_=0,w=0,M=0;S==0;)if(S=l(s,M,1),x=l(s,M+1,2),M+=3,x!=0){if(p&&(o=r.F._check(o,w+131072)),x==1&&(y=m.flmap,b=m.fdmap,N=511,_=31),x==2){E=c(s,M,5)+257,k=c(s,M+5,5)+1,C=c(s,M+10,4)+4,M+=14;for(var O=0;O<38;O+=2)m.itree[O]=0,m.itree[O+1]=0;var L=1;for(O=0;OL&&(L=F)}M+=3*C,u(m.itree,L),f(m.itree,L,m.imap),y=m.lmap,b=m.dmap,M=d(m.imap,(1<>>4;if(!(T>>>8))o[w++]=T;else{if(T==256)break;var z=w+T-254;if(T>264){var H=m.ldef[T-257];z=w+(H>>>3)+c(s,M,7&H),M+=7&H}var W=b[g(s,M)&_];M+=15&W;var j=W>>>4,U=m.ddef[j],B=(U>>>4)+l(s,M,15&U);for(M+=15&U,p&&(o=r.F._check(o,w+131072));w>>3),V=s[G-4]|s[G-3]<<8;p&&(o=r.F._check(o,w+V)),o.set(new i(s.buffer,s.byteOffset+G,V),w),M=G+V<<3,w+=V}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var i=s.length;if(o<=i)return s;var a=new Uint8Array(Math.max(i<<1,o));return a.set(s,0),a},r.F._decodeTiny=function(s,o,i,a,l,c){for(var d=r.F._bitsE,u=r.F._get17,f=0;f>>4;if(m<=15)c[f]=m,f++;else{var p=0,y=0;m==16?(y=3+d(a,l,2),l+=2,p=c[f-1]):m==17?(y=3+d(a,l,3),l+=3):m==18&&(y=11+d(a,l,7),l+=7);for(var b=f+y;f>>1;cl&&(l=u),c++}for(;c>1,u=s[c+1],f=d<<4|u,g=o-u,m=s[c]<>>15-o]=f,m++},r.F.revCodes=function(s,o){for(var i=r.F.U.rev15,a=15-o,l=0;l>>a}},r.F._putsE=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8},r.F._putsF=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8,s[a+2]|=i>>>16},r.F._bitsE=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(e=Uint16Array,n=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var i=o;i=(4278255360&(i=(4042322160&(i=(3435973836&(i=(2863311530&i)>>>1|(1431655765&i)<<1))>>>2|(858993459&i)<<2))>>>4|(252645135&i)<<4))>>>8|(16711935&i)<<8,s.rev15[o]=(i>>>16|i<<16)>>>17}function a(l,c,d){for(;c--!=0;)l.push(0,d)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];a(s.fltree,144,8),a(s.fltree,112,9),a(s.fltree,24,7),a(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),a(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),a(s.itree,19,0),a(s.ltree,286,0),a(s.dtree,30,0),a(s.ttree,320,0)})()})();var R2=Z2({__proto__:null,default:ji},[ji]);const En=(function(){var t={nextZero(d,u){for(;d[u]!=0;)u++;return u},readUshort:(d,u)=>d[u]<<8|d[u+1],writeUshort(d,u,f){d[u]=f>>8&255,d[u+1]=255&f},readUint:(d,u)=>16777216*d[u]+(d[u+1]<<16|d[u+2]<<8|d[u+3]),writeUint(d,u,f){d[u]=f>>24&255,d[u+1]=f>>16&255,d[u+2]=f>>8&255,d[u+3]=255&f},readASCII(d,u,f){let g="";for(let m=0;md.length<2?`0${d}`:d,readUTF8(d,u,f){let g,m="";for(let p=0;p>3)]>>7-((7&C)<<0)&1);b[w]=H[F],b[w+1]=H[F+1],b[w+2]=H[F+2],b[w+3]=$>2)]>>6-((3&C)<<1)&3),b[w]=H[F],b[w+1]=H[F+1],b[w+2]=H[F+2],b[w+3]=$>1)]>>4-((1&C)<<2)&15),b[w]=H[F],b[w+1]=H[F+1],b[w+2]=H[F+2],b[w+3]=$>>3)]>>>7-(7&T)&1))==255*_?0:255;S[W+T]=z<<24|D<<16|D<<8|D}else if(E==2)for(T=0;T>>2)]>>>6-((3&T)<<1)&3))==85*_?0:255,S[W+T]=z<<24|D<<16|D<<8|D;else if(E==4)for(T=0;T>>1)]>>>4-((1&T)<<2)&15))==17*_?0:255,S[W+T]=z<<24|D<<16|D<<8|D;else if(E==8)for(T=0;T>3,_=Math.ceil(E*C/8),w=new Uint8Array(k*_);let M=0;const O=[0,0,4,0,2,0,1],L=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],$=[8,8,4,4,2,2,1];let D=0;for(;D<7;){const T=F[D],z=$[D];let H=0,W=0,j=O[D];for(;j>3])>>7-(7&X)&1,w[V*_+(K>>3)]|=A<<7-((7&K)<<0)),C==2&&(A=(A=S[X>>3])>>6-(7&X)&3,w[V*_+(K>>2)]|=A<<6-((3&K)<<1)),C==4&&(A=(A=S[X>>3])>>4-(7&X)&15,w[V*_+(K>>1)]|=A<<4-((1&K)<<2)),C>=8){const Z=V*_+K*N;for(let ee=0;ee>3)+ee]}X+=C,K+=z}G++,V+=T}H*W!=0&&(M+=W*(1+B)),D+=1}return w})(u,d)),u}function r(d,u){return s(new Uint8Array(d.buffer,2,d.length-6),u)}var s=(function(){const d={H:{}};return d.H.N=function(u,f){const g=Uint8Array;let m,p,y=0,b=0,S=0,x=0,E=0,k=0,C=0,N=0,_=0;if(u[0]==3&&u[1]==0)return f||new g(0);const w=d.H,M=w.b,O=w.e,L=w.R,F=w.n,$=w.A,D=w.Z,A=w.m,T=f==null;for(T&&(f=new g(u.length>>>2<<5));y==0;)if(y=M(u,_,1),b=M(u,_+1,2),_+=3,b!=0){if(T&&(f=d.H.W(f,N+(1<<17))),b==1&&(m=A.J,p=A.h,k=511,C=31),b==2){S=O(u,_,5)+257,x=O(u,_+5,5)+1,E=O(u,_+10,4)+4,_+=14;let H=1;for(var z=0;z<38;z+=2)A.Q[z]=0,A.Q[z+1]=0;for(z=0;zH&&(H=U)}_+=3*E,F(A.Q,H),$(A.Q,H,A.u),m=A.w,p=A.d,_=L(A.u,(1<>>4;if(!(W>>>8))f[N++]=W;else{if(W==256)break;{let j=N+W-254;if(W>264){const K=A.q[W-257];j=N+(K>>>3)+O(u,_,7&K),_+=7&K}const U=p[D(u,_)&C];_+=15&U;const B=U>>>4,G=A.c[B],V=(G>>>4)+M(u,_,15&G);for(_+=15&G;N>>3),W=u[H-4]|u[H-3]<<8;T&&(f=d.H.W(f,N+W)),f.set(new g(u.buffer,u.byteOffset+H,W),N),_=H+W<<3,N+=W}return f.length==N?f:f.slice(0,N)},d.H.W=function(u,f){const g=u.length;if(f<=g)return u;const m=new Uint8Array(g<<1);return m.set(u,0),m},d.H.R=function(u,f,g,m,p,y){const b=d.H.e,S=d.H.Z;let x=0;for(;x>>4;if(k<=15)y[x]=k,x++;else{let C=0,N=0;k==16?(N=3+b(m,p,2),p+=2,C=y[x-1]):k==17?(N=3+b(m,p,3),p+=3):k==18&&(N=11+b(m,p,7),p+=7);const _=x+N;for(;x<_;)y[x]=C,x++}}return p},d.H.V=function(u,f,g,m){let p=0,y=0;const b=m.length>>>1;for(;yp&&(p=S),y++}for(;y>1,S=u[y+1],x=b<<4|S,E=f-S;let k=u[y]<>>15-f]=x,k++}},d.H.l=function(u,f){const g=d.H.m.r,m=15-f;for(let p=0;p>>m}},d.H.M=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8},d.H.I=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8,u[m+2]|=g>>>16},d.H.e=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16|u[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=(function(){const u=Uint16Array,f=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new f(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new u(65536),g:new u(32768)}})(),(function(){const u=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,u.r[f]=(m>>>16|m<<16)>>>17}function g(m,p,y){for(;p--!=0;)m.push(0,y)}for(f=0;f<32;f++)u.q[f]=u.S[f]<<3|u.T[f],u.c[f]=u.p[f]<<4|u.z[f];g(u._,144,8),g(u._,112,9),g(u._,24,7),g(u._,8,8),d.H.n(u._,9),d.H.A(u._,9,u.J),d.H.l(u._,9),g(u.$,32,5),d.H.n(u.$,5),d.H.A(u.$,5,u.h),d.H.l(u.$,5),g(u.Q,19,0),g(u.C,286,0),g(u.D,30,0),g(u.v,320,0)})(),d.H.N})();function o(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function i(d,u,f,g,m){let p=o(u);const y=Math.ceil(g*p/8);let b,S;p=Math.ceil(p/8);let x=d[f],E=0;if(x>1&&(d[f]=[0,0,1][x-2]),x==3)for(E=p;E>>1)&255;for(let k=0;k>>1);for(;E>>1)}else{for(;E=0&&b>=0?(k=D*u+A<<2,C=(b+D)*m+y+A<<2):(k=(-b+D)*u-y+A<<2,C=D*m+A<<2),S==0)g[C]=d[k],g[C+1]=d[k+1],g[C+2]=d[k+2],g[C+3]=d[k+3];else if(S==1){var N=d[k+3]*.00392156862745098,_=d[k]*N,w=d[k+1]*N,M=d[k+2]*N,O=g[C+3]*(1/255),L=g[C]*O,F=g[C+1]*O,$=g[C+2]*O;const T=1-N,z=N+O*T,H=z==0?0:1/z;g[C+3]=255*z,g[C+0]=(_+L*T)*H,g[C+1]=(w+F*T)*H,g[C+2]=(M+$*T)*H}else if(S==2)N=d[k+3],_=d[k],w=d[k+1],M=d[k+2],O=g[C+3],L=g[C],F=g[C+1],$=g[C+2],N==O&&_==L&&w==F&&M==$?(g[C]=0,g[C+1]=0,g[C+2]=0,g[C+3]=0):(g[C]=_,g[C+1]=w,g[C+2]=M,g[C+3]=N);else if(S==3){if(N=d[k+3],_=d[k],w=d[k+1],M=d[k+2],O=g[C+3],L=g[C],F=g[C+1],$=g[C+2],N==O&&_==L&&w==F&&M==$)continue;if(N<220&&O>20)return!1}return!0}return{decode:function(u){const f=new Uint8Array(u);let g=8;const m=t,p=m.readUshort,y=m.readUint,b={tabs:{},frames:[]},S=new Uint8Array(f.length);let x,E=0,k=0;const C=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(f[N]!=C[N])throw"The input is not a PNG file!";for(;g>>1:M>>>=1;_[w]=M}return _})(),update(_,w,M,O){for(let L=0;L>>8;return _},crc:(_,w,M)=>4294967295^r.update(4294967295,_,w,M)};function s(_,w,M,O){w[M]+=_[0]*O>>4,w[M+1]+=_[1]*O>>4,w[M+2]+=_[2]*O>>4,w[M+3]+=_[3]*O>>4}function o(_){return Math.max(0,Math.min(255,_))}function i(_,w){const M=_[0]-w[0],O=_[1]-w[1],L=_[2]-w[2],F=_[3]-w[3];return M*M+O*O+L*L+F*F}function a(_,w,M,O,L,F,$){$==null&&($=1);const D=O.length,A=[];for(var T=0;T>>0&255,V>>>8&255,V>>>16&255,V>>>24&255])}for(T=0;T>2]=z,j[T>>2]=O[z]}}function l(_,w,M,O,L){L==null&&(L={});const{crc:F}=r,$=e.writeUint,D=e.writeUshort,A=e.writeASCII;let T=8;const z=_.frames.length>1;let H,W=!1,j=33+(z?20:0);if(L.sRGB!=null&&(j+=13),L.pHYs!=null&&(j+=21),L.iCCP!=null&&(H=pako.deflate(L.iCCP),j+=21+H.length+4),_.ctype==3){for(var U=_.plte.length,B=0;B>>24!=255&&(W=!0);j+=8+3*U+4+(W?8+1*U+4:0)}for(var G=0;G<_.frames.length;G++)z&&(j+=38),j+=(Z=_.frames[G]).cimg.length+12,G!=0&&(j+=4);j+=12;const V=new Uint8Array(j),K=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)V[B]=K[B];if($(V,T,13),T+=4,A(V,T,"IHDR"),T+=4,$(V,T,w),T+=4,$(V,T,M),T+=4,V[T]=_.depth,T++,V[T]=_.ctype,T++,V[T]=0,T++,V[T]=0,T++,V[T]=0,T++,$(V,T,F(V,T-17,17)),T+=4,L.sRGB!=null&&($(V,T,1),T+=4,A(V,T,"sRGB"),T+=4,V[T]=L.sRGB,T++,$(V,T,F(V,T-5,5)),T+=4),L.iCCP!=null){const ee=13+H.length;$(V,T,ee),T+=4,A(V,T,"iCCP"),T+=4,A(V,T,"ICC profile"),T+=11,T+=2,V.set(H,T),T+=H.length,$(V,T,F(V,T-(ee+4),ee+4)),T+=4}if(L.pHYs!=null&&($(V,T,9),T+=4,A(V,T,"pHYs"),T+=4,$(V,T,L.pHYs[0]),T+=4,$(V,T,L.pHYs[1]),T+=4,V[T]=L.pHYs[2],T++,$(V,T,F(V,T-13,13)),T+=4),z&&($(V,T,8),T+=4,A(V,T,"acTL"),T+=4,$(V,T,_.frames.length),T+=4,$(V,T,L.loop!=null?L.loop:0),T+=4,$(V,T,F(V,T-12,12)),T+=4),_.ctype==3){for($(V,T,3*(U=_.plte.length)),T+=4,A(V,T,"PLTE"),T+=4,B=0;B>>8&255,ce=ne>>>16&255;V[T+ee+0]=he,V[T+ee+1]=J,V[T+ee+2]=ce}if(T+=3*U,$(V,T,F(V,T-3*U-4,3*U+4)),T+=4,W){for($(V,T,U),T+=4,A(V,T,"tRNS"),T+=4,B=0;B>>24&255;T+=U,$(V,T,F(V,T-U-4,U+4)),T+=4}}let X=0;for(G=0;G<_.frames.length;G++){var Z=_.frames[G];z&&($(V,T,26),T+=4,A(V,T,"fcTL"),T+=4,$(V,T,X++),T+=4,$(V,T,Z.rect.width),T+=4,$(V,T,Z.rect.height),T+=4,$(V,T,Z.rect.x),T+=4,$(V,T,Z.rect.y),T+=4,D(V,T,O[G]),T+=2,D(V,T,1e3),T+=2,V[T]=Z.dispose,T++,V[T]=Z.blend,T++,$(V,T,F(V,T-30,30)),T+=4);const ee=Z.cimg;$(V,T,(U=ee.length)+(G==0?0:4)),T+=4;const ne=T;A(V,T,G==0?"IDAT":"fdAT"),T+=4,G!=0&&($(V,T,X++),T+=4),V.set(ee,T),T+=U,$(V,T,F(V,ne,T-ne)),T+=4}return $(V,T,0),T+=4,A(V,T,"IEND"),T+=4,$(V,T,F(V,T-4,4)),T+=4,V.buffer}function c(_,w,M){for(let O=0;O<_.frames.length;O++){const L=_.frames[O];L.rect.width;const F=L.rect.height,$=new Uint8Array(F*L.bpl+F);L.cimg=g(L.img,F,L.bpp,L.bpl,$,w,M)}}function d(_,w,M,O,L){const F=L[0],$=L[1],D=L[2],A=L[3],T=L[4],z=L[5];let H=6,W=8,j=255;for(var U=0;U<_.length;U++){const ve=new Uint8Array(_[U]);for(var B=ve.length,G=0;GHe&&(He=gt),itDe&&(De=it));He==-1&&($e=Te=He=De=0),se&&((1&$e)==1&&$e--,(1&Te)==1&&Te--);const Ze=(He-$e+1)*(De-Te+1);Ze<_e&&(_e=Ze,ze=Re,ge=$e,pe=Te,me=He-$e+1,be=De-Te+1)}st=new Uint8Array(fe[Ie-1-ze]),ze==1&&(Pe[Ie-1].dispose=2),je=new Uint8Array(me*be*4),t(st,ye,ke,je,me,be,-ge,-pe,0),Be=t(Xe,ye,ke,je,me,be,-ge,-pe,3)?1:0,Be==1?f(Xe,ye,ke,je,{x:ge,y:pe,width:me,height:be}):t(Xe,ye,ke,je,me,be,-ge,-pe,0)}else je=Xe.slice(0);Pe.push({rect:{x:ge,y:pe,width:me,height:be},img:je,blend:Be,dispose:0})}if(Ue)for(Ie=0;Ie>2,Ue>>2);ee.push(ne);const se=new Uint8Array(ye.abuf,ke,Ue);z&&a(he.img,he.rect.width,he.rect.height,Z,se,ne),he.img.set(se),ke+=Ue}}else for(U=0;UJ&&fe==ve[G-J])ne[G]=ne[G-J];else{let ye=X[fe];if(ye==null&&(X[fe]=ye=Z.length,Z.push(fe),Z.length>=300))break;ne[G]=ye}}}const ce=Z.length;for(ce<=256&&T==0&&(W=ce<=2?1:ce<=4?2:ce<=16?4:8,W=Math.max(W,A)),U=0;U>1)]|=Ue[Oe+ae]<<4-4*(1&ae);else if(W==2)for(ae=0;ae>2)]|=Ue[Oe+ae]<<6-2*(3&ae);else if(W==1)for(ae=0;ae>3)]|=Ue[Oe+ae]<<7-1*(7&ae)}fe=ue,H=3,ke=1}else if(V==0&&K.length==1){ue=new Uint8Array(J*ve*3);const Ue=J*ve;for(G=0;GG&&(G=ee),neV&&(V=ne))}G==-1&&(U=B=G=V=0),$&&((1&U)==1&&U--,(1&B)==1&&B--),F={x:U,y:B,width:G-U+1,height:V-B+1};const K=O[L];K.rect=F,K.blend=1,K.img=new Uint8Array(F.width*F.height*4),O[L-1].dispose==0?(t(T,w,M,K.img,F.width,F.height,-F.x,-F.y,0),f(W,w,M,K.img,F)):t(W,w,M,K.img,F.width,F.height,-F.x,-F.y,0)}function f(_,w,M,O,L){t(_,w,M,O,L.width,L.height,-L.x,-L.y,2)}function g(_,w,M,O,L,F,$){const D=[];let A,T=[0,1,2,3,4];F!=-1?T=[F]:(w*O>5e5||M==1)&&(T=[0]),$&&(A={level:0});const z=R2;for(var H=0;H>1)+256&255;if(F==4)for(A=L;A>1)&255;for(A=L;A>1)&255}if(F==4){for(A=0;A>2);let z;if(M.length<2e7)for(var H=0;H>2]=z.ind,L[H>>2]=z.est.rgba;else for(H=0;H>2]=z.ind,L[H>>2]=z.est.rgba}return{abuf:O.buffer,inds:T,plte:D}}function y(_,w,M){M==null&&(M=1e-4);const O=new Uint32Array(_.buffer),L={i0:0,i1:_.length,bst:null,est:null,tdst:0,left:null,right:null};L.bst=k(_,L.i0,L.i1),L.est=C(L.bst);const F=[L];for(;F.lengthD&&(D=F[$].est.L,A=$);if(D=z||T.i1<=z){T.est.L=0;continue}const H={i0:T.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};H.bst=k(_,H.i0,H.i1),H.est=C(H.bst);const W={i0:z,i1:T.i1,bst:null,est:null,tdst:0,left:null,right:null};for(W.bst={R:[],m:[],N:T.bst.N-H.bst.N},$=0;$<16;$++)W.bst.R[$]=T.bst.R[$]-H.bst.R[$];for($=0;$<4;$++)W.bst.m[$]=T.bst.m[$]-H.bst.m[$];W.est=C(W.bst),T.left=H,T.right=W,F[A]=H,F.push(W)}for(F.sort(((D,A)=>A.bst.N-D.bst.N)),$=0;$0&&($=_.right,D=_.left);const A=b($,w,M,O,L);if(A.tdst<=F*F)return A;const T=b(D,w,M,O,L);return T.tdstF;)O-=4;if(M>=O)break;const $=w[M>>2];w[M>>2]=w[O>>2],w[O>>2]=$,M+=4,O-=4}for(;E(_,M,L)>F;)M-=4;return M+4}function E(_,w,M){return _[w]*M[0]+_[w+1]*M[1]+_[w+2]*M[2]+_[w+3]*M[3]}function k(_,w,M){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,0],F=M-w>>2;for(let $=w;$>>0}}var N={multVec:(_,w)=>[_[0]*w[0]+_[1]*w[1]+_[2]*w[2]+_[3]*w[3],_[4]*w[0]+_[5]*w[1]+_[6]*w[2]+_[7]*w[3],_[8]*w[0]+_[9]*w[1]+_[10]*w[2]+_[11]*w[3],_[12]*w[0]+_[13]*w[1]+_[14]*w[2]+_[15]*w[3]],dot:(_,w)=>_[0]*w[0]+_[1]*w[1]+_[2]*w[2]+_[3]*w[3],sml:(_,w)=>[_*w[0],_*w[1],_*w[2],_*w[3]]};En.encode=function(w,M,O,L,F,$,D){L==null&&(L=0),D==null&&(D=!1);const A=d(w,M,O,L,[!1,!1,!1,0,D,!1]);return c(A,-1),l(A,M,O,F,$)},En.encodeLL=function(w,M,O,L,F,$,D,A){const T={ctype:0+(L==1?0:2)+(F==0?0:4),depth:$,frames:[]},z=(L+F)*$,H=z*M;for(let W=0;W>>0),k(1),k(32),C(3),C(l),C(2835),C(2835),N(8),C(16711680),C(65280),C(255),C(4278190080),C(1466527264),(function _(){for(;S0;){for(y=122+S*a,g=0;g>>24,u.setUint32(y+g,m<<8|p),g+=4;S++}E{e(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Qt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},eE={[Qt.CHROME]:16384,[Qt.FIREFOX]:11180,[Qt.DESKTOP_SAFARI]:16384,[Qt.IE]:8192,[Qt.IOS]:4096,[Qt.ETC]:8192};const Ac=typeof window<"u",gp=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Wi=Ac&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),tE=(Ac||gp)&&(Wi&&Wi.getOriginalSymbol(window,"File")||typeof File<"u"&&File),pp=(Ac||gp)&&(Wi&&Wi.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Dc(t,e,n=Date.now()){return new Promise((r=>{const s=t.split(","),o=s[0].match(/:(.*?);/)[1],i=globalThis.atob(s[1]);let a=i.length;const l=new Uint8Array(a);for(;a--;)l[a]=i.charCodeAt(a);const c=new Blob([l],{type:o});c.name=e,c.lastModified=n,r(c)}))}function mp(t){return new Promise(((e,n)=>{const r=new pp;r.onload=()=>e(r.result),r.onerror=s=>n(s),r.readAsDataURL(t)}))}function bp(t){return new Promise(((e,n)=>{const r=new Image;r.onload=()=>e(r),r.onerror=s=>n(s),r.src=t}))}function wr(){if(wr.cachedResult!==void 0)return wr.cachedResult;let t=Qt.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?t=Qt.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?t=Qt.IOS:/Safari/i.test(e)?t=Qt.DESKTOP_SAFARI:/Firefox/i.test(e)?t=Qt.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(t=Qt.IE),wr.cachedResult=t,wr.cachedResult}function yp(t,e){const n=wr(),r=eE[n];let s=t,o=e,i=s*o;const a=s>o?o/s:s/o;for(;i>r*r;){const l=(r+s)/2,c=(r+o)/2;lhp.toBlob(t,d))).then(function(d){try{return a=d,a.name=n,a.lastModified=r,c.call(this)}catch(u){return i(u)}}.bind(this),i);{let d=function(){return c.call(this)};if(typeof OffscreenCanvas=="function"&&t instanceof OffscreenCanvas)return t.convertToBlob({type:e,quality:s}).then(function(u){try{return a=u,a.name=n,a.lastModified=r,d.call(this)}catch(f){return i(f)}}.bind(this),i);{let u;return u=t.toDataURL(e,s),Dc(u,n,r).then(function(f){try{return a=f,d.call(this)}catch(g){return i(g)}}.bind(this),i)}}}function l(){return o(a)}}))}function Pn(t){t.width=0,t.height=0}function is(){return new Promise((function(t,e){let n,r,s,o;return is.cachedResult!==void 0?t(is.cachedResult):Dc("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(i){try{return n=i,Xi(n).then((function(a){try{return r=a[1],Ki(r,n.type,n.name,n.lastModified).then((function(l){try{return s=l,Pn(r),Xi(s).then((function(c){try{return o=c[0],is.cachedResult=o.width===1&&o.height===2,t(is.cachedResult)}catch(d){return e(d)}}),e)}catch(c){return e(c)}}),e)}catch(l){return e(l)}}),e)}catch(a){return e(a)}}),e)}))}function xp(t){return new Promise(((e,n)=>{const r=new pp;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return e(-2);const i=o.byteLength;let a=2;for(;an(s),r.readAsArrayBuffer(t)}))}function wp(t,e){const{width:n}=t,{height:r}=t,{maxWidthOrHeight:s}=e;let o,i=t;return isFinite(s)&&(n>s||r>s)&&([i,o]=Gi(n,r),n>r?(i.width=s,i.height=r/n*s):(i.width=n/r*s,i.height=s),o.drawImage(t,0,0,i.width,i.height),Pn(t)),i}function kp(t,e){const{width:n}=t,{height:r}=t,[s,o]=Gi(n,r);switch(e>4&&e<9?(s.width=r,s.height=n):(s.width=n,s.height=r),e){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(t,0,0,n,r),Pn(t),s}function Cp(t,e,n=0){return new Promise((function(r,s){let o,i,a,l,c,d,u,f,g,m,p,y,b,S,x,E,k,C,N,_;function w(O=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;o+=O,e.onProgress(Math.min(o,100))}function M(O){if(e.signal&&e.signal.aborted)throw e.signal.reason;o=Math.min(Math.max(O,o),100),e.onProgress(o)}return o=n,i=e.maxIteration||10,a=1024*e.maxSizeMB*1024,w(),Xi(t,e).then(function(O){try{return[,l]=O,w(),c=wp(l,e),w(),new Promise((function(L,F){var $;if(!($=e.exifOrientation))return xp(t).then(function(A){try{return $=A,D.call(this)}catch(T){return F(T)}}.bind(this),F);function D(){return L($)}return D.call(this)})).then(function(L){try{return d=L,w(),is().then(function(F){try{return u=F?c:kp(c,d),w(),f=e.initialQuality||1,g=e.fileType||t.type,Ki(u,g,t.name,t.lastModified,f).then(function($){try{{let A=function(){if(i--&&(x>a||x>b)){let z,H;return z=_?.95*N.width:N.width,H=_?.95*N.height:N.height,[k,C]=Gi(z,H),C.drawImage(N,0,0,z,H),f*=g==="image/png"?.85:.95,Ki(k,g,t.name,t.lastModified,f).then((function(W){try{return E=W,Pn(N),N=k,x=E.size,M(Math.min(99,Math.floor((S-x)/(S-a)*100))),A}catch(j){return s(j)}}),s)}return[1]},T=function(){return Pn(N),Pn(k),Pn(c),Pn(u),Pn(l),M(100),r(E)};if(m=$,w(),p=m.size>a,y=m.size>t.size,!p&&!y)return M(100),r(m);var D;return b=t.size,S=m.size,x=S,N=u,_=!e.alwaysKeepResolution&&p,(D=function(z){for(;z;){if(z.then)return void z.then(D,s);try{if(z.pop){if(z.length)return z.pop()?T.call(this):z;z=A}else z=z.call(this)}catch(H){return s(H)}}}.bind(this))(A)}}catch(A){return s(A)}}.bind(this),s)}catch($){return s($)}}.bind(this),s)}catch(F){return s(F)}}.bind(this),s)}catch(L){return s(L)}}.bind(this),s)}))}const nE=` + `,children:[h.jsx(re,{name:x.faIcon,className:"w-4 h-4"}),h.jsx(Q,{children:x.label}),y?.faIcon===x.faIcon&&h.jsx(re,{name:"check",className:"w-4 h-4 ml-auto text-blue-600"})]},x.value)):h.jsx(I,{className:"px-3 py-4 text-sm text-gray-500 dark:text-gray-400 text-center",children:o})})]})]})},rc=({defaultOpen:t=!1,isOpen:e,onToggle:n,className:r="",style:s,children:o,disabled:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(t),u=e!==void 0,f=u?e:c,g=v.useRef(null),[m,p]=v.useState(t?void 0:0),y=()=>{if(i)return;const S=!f;u||d(S),n?.(S)};v.useEffect(()=>{if(g.current)if(f){p(g.current.scrollHeight);const S=setTimeout(()=>{p(void 0)},300);return()=>clearTimeout(S)}else p(g.current.scrollHeight),requestAnimationFrame(()=>{p(0)})},[f]);const b={};if(v.Children.forEach(o,S=>{if(v.isValidElement(S)){const x=S.props?.slot;x==="trigger"?b.trigger=S:x==="content"&&(b.content=S)}}),!b.trigger&&!b.content){const S=v.Children.toArray(o);S.length>=2?(b.trigger=S[0],b.content=S.slice(1)):S.length===1&&(b.content=S[0])}return h.jsxs(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${r}`,style:s,id:a,...l,children:[h.jsxs(oe,{type:"button",onClick:y,disabled:i,className:`w-full flex items-center justify-between p-3 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${i?"opacity-50 cursor-not-allowed":""} ${f?"border-b border-gray-200 dark:border-gray-700":""}`,"aria-expanded":f,children:[h.jsx(I,{className:"flex-1",children:b.trigger}),!b.trigger&&h.jsx("svg",{className:`w-5 h-5 text-gray-500 dark:text-gray-400 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h.jsx(I,{ref:g,className:"overflow-hidden transition-all duration-300 ease-in-out",style:{height:m!==void 0?`${m}px`:"auto"},children:h.jsx(I,{className:"bg-white dark:bg-gray-800",children:b.content})})]})},Js=window.G7Core,Jh=Js?.useControllableState,Rh=(t,e)=>window.G7Core?.t?.(t,e)??t,zS={"":"common.scope_type_all_desc",self:"common.scope_type_self_desc",role:"common.scope_type_role_desc"},VS=({options:t,value:e,onChange:n,disabled:r=!1})=>{const[s,o]=v.useState(!1),[i,a]=v.useState({}),l=v.useRef(null),c=t.find(u=>u.value===e)??t[0];v.useEffect(()=>{if(!s)return;const u=g=>{l.current&&!l.current.contains(g.target)&&o(!1)},f=()=>{if(!l.current)return;const g=l.current.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,right:window.innerWidth-g.right,zIndex:9999})};return document.addEventListener("mousedown",u),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s]);const d=v.useCallback(()=>{if(r||!l.current)return;const u=l.current.getBoundingClientRect();a({position:"fixed",top:u.bottom+4,right:window.innerWidth-u.right,zIndex:9999}),o(f=>!f)},[r]);return h.jsxs(I,{ref:l,className:"relative flex-shrink-0",children:[h.jsxs(I,{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),u.preventDefault(),d()},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),u.preventDefault(),d()),u.key==="Escape"&&o(!1)},className:`flex items-center gap-1 text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer select-none ${r?"opacity-50 cursor-not-allowed":"hover:border-blue-400 dark:hover:border-blue-500"}`,children:[h.jsx(Q,{children:c?.label??""}),h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3 text-gray-400 dark:text-gray-500"})]}),s&&h.jsx(I,{style:i,className:"w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1",children:t.map(u=>{const f=u.value??"",g=zS[f],m=g?Rh(g):"",p=u.value===e;return h.jsxs(I,{role:"option","aria-selected":p,onClick:y=>{y.stopPropagation(),y.preventDefault(),n(u.value),o(!1)},onMouseDown:y=>y.stopPropagation(),className:`px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[h.jsx(Q,{className:`text-xs font-medium ${p?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:u.label}),p&&h.jsx(re,{name:de.Check,className:"w-3.5 h-3.5 text-blue-600 dark:text-blue-400"})]}),m&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:m})]},f||"__null__")})})]})},HS=(t,e)=>{if(t.length!==e.length)return!1;const n=[...t].sort((s,o)=>s.id-o.id),r=[...e].sort((s,o)=>s.id-o.id);return n.every((s,o)=>s.id===r[o].id&&s.scope_type===r[o].scope_type)},US=({data:t=[],value:e=[],onChange:n,scopeOptions:r=[],className:s="",disabled:o=!1,desktopColumns:i=2,installedModules:a=[],installedPlugins:l=[],id:c,editorAttrs:d})=>{const u=v.useCallback(M=>{if(n){const O=Js?.createChangeEvent?Js.createChangeEvent({value:M}):{target:{value:M}};n(O)}},[n]),[f,g]=Jh?Jh(e,[],u,{isEqual:HS}):(()=>{const[M,O]=v.useState(e),L=v.useRef(n);L.current=n;const F=v.useRef(!1);v.useEffect(()=>{if(F.current){F.current=!1;return}O(e)},[e]);const $=v.useCallback(D=>{F.current=!0,O(A=>{const T=typeof D=="function"?D(A):D;if(L.current){const z=Js?.createChangeEvent?Js.createChangeEvent({value:T}):{target:{value:T}};L.current(z)}return T})},[]);return[M,$]})(),m=v.useMemo(()=>new Set(f.map(M=>M.id)),[f]),p=v.useCallback(M=>M.is_assignable?[M.id]:M.children.flatMap(O=>p(O)),[]),y=v.useCallback(M=>{const O=p(M);return O.length>0&&O.every(L=>m.has(L))},[m,p]),b=v.useCallback(M=>{const O=p(M),L=O.filter(F=>m.has(F)).length;return L>0&&Lp(M).filter(L=>m.has(L)).length,[m,p]),x=v.useCallback((M,O)=>{o||g(L=>O?[...L,{id:M,scope_type:null}]:L.filter(F=>F.id!==M))},[o,g]),E=v.useCallback((M,O)=>{if(o)return;const L=p(M),F=new Set(L);g($=>{if(O){const D=new Set($.map(T=>T.id)),A=L.filter(T=>!D.has(T)).map(T=>({id:T,scope_type:null}));return[...$,...A]}else return $.filter(D=>!F.has(D.id))})},[o,p,g]),k=v.useCallback((M,O)=>{o||g(L=>L.map(F=>F.id===M?{...F,scope_type:O}:F))},[o,g]),C=M=>{const O=m.has(M.id),L=!!M.resource_route_key,F=O&&L&&r.length>0,$=f.find(D=>D.id===M.id)?.scope_type??null;return h.jsxs(rn,{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${O?"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${o?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx(wt,{type:"checkbox",checked:O,onChange:D=>{D.stopPropagation(),x(M.id,D.target.checked)},disabled:o,className:"w-4 h-4 mt-0.5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsxs(I,{className:"flex items-center justify-between gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white",children:M.name}),F&&h.jsx(VS,{options:r,value:$,onChange:D=>k(M.id,D),disabled:o})]}),M.description&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:M.description})]})]},M.id)},N=(M,O)=>{const L=y(M),F=b(M),$=S(M),D=M.children.filter(z=>z.is_assignable);if(D.length===0&&M.children.length===0)return null;const A=M.children.some(z=>!z.is_assignable),T=i===1?"grid-cols-1":i===3?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2";return h.jsxs(rc,{defaultOpen:!1,className:"border-0 rounded-none",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:L,ref:z=>{z&&(z.indeterminate=F)},onChange:z=>{z.stopPropagation(),E(M,z.target.checked)},onClick:z=>z.stopPropagation(),onMouseDown:z=>z.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:de.Folder,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:M.name}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-1",children:[$,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:`pl-8 grid ${T} gap-2 py-2`,children:A?M.children.map(z=>z.is_assignable?C(z):N(z)):D.map(z=>C(z))})]},M.id)},_=M=>{if(M.extension_type==="core")return"core";if(M.extension_type==="module")return"module";if(M.extension_type==="plugin")return"plugin";const O=M.extension_identifier??M.module??"";return O==="core"||!O?"core":l?.some(F=>F.identifier===O)?"plugin":"module"},w=M=>{const O=y(M),L=b(M),F=S(M),$=_(M);return h.jsxs(rc,{defaultOpen:!1,className:"mb-2",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:O,ref:D=>{D&&(D.indeterminate=L)},onChange:D=>{D.stopPropagation(),E(M,D.target.checked)},onClick:D=>D.stopPropagation(),onMouseDown:D=>D.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:$==="core"?de.Cog:de.Cube,className:"w-5 h-5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white",children:M.name}),$!=="core"&&h.jsx(nh,{type:$,identifier:M.extension_identifier??M.module,installedModules:a,installedPlugins:l}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-2",children:[F,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:"pl-8 space-y-2 pb-2",children:M.children.map(D=>D.is_assignable?C(D):N(D))})]},M.id)};return t.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${s}`,id:c,...d,children:Rh("common.no_data")??"데이터가 없습니다."}):h.jsx(I,{className:`space-y-2 ${s}`,id:c,...d,children:t.map(M=>w(M))})};function BS({text:t,keyword:e}){if(!e||!t)return h.jsx(h.Fragment,{children:t});const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=t.split(new RegExp(`(${n})`,"gi"));return h.jsx(h.Fragment,{children:r.map((s,o)=>s.toLowerCase()===e.toLowerCase()?h.jsx(Q,{className:"bg-yellow-200 dark:bg-yellow-700 rounded px-0.5",children:s},o):s)})}const jS=({data:t=[],expandedIds:e=[],selectedIds:n=[],searchKeyword:r="",showProductCount:s=!1,selectable:o=!1,className:i="",onToggle:a,onSelectionChange:l,id:c,editorAttrs:d})=>{const u=v.useCallback(y=>{if(!a)return;const b=e.includes(y)?e.filter(S=>S!==y):[...e,y];a(b)},[e,a]),f=v.useCallback((y,b)=>{if(!l)return;const S=b?[...n,y]:n.filter(x=>x!==y);l(S)},[n,l]),g=v.useMemo(()=>{if(!r)return null;const y=new Set,b=S=>{for(const x of S)(x.localized_name||x.name).toLowerCase().includes(r.toLowerCase())&&y.add(x.id),x.children&&b(x.children)};return b(t),y},[t,r]),m=v.useCallback(y=>!g||g.has(y.id)?!0:(y.children??[]).some(b=>m(b)),[g]),p=(y,b=0)=>{const S=(y.children??[]).length>0,x=e.includes(y.id),E=n.includes(y.id),k=y.localized_name||y.name;return r&&!m(y)?null:h.jsxs(I,{"data-testid":`category-node-${y.id}`,children:[h.jsxs(I,{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${b>0?"ml-"+Math.min(b*5,20):""}`,style:b>0?{marginLeft:`${b*20}px`}:void 0,children:[S?h.jsx(I,{className:"flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-400 dark:text-gray-500",onClick:()=>u(y.id),"data-testid":`toggle-${y.id}`,children:h.jsx(re,{name:x?de.CaretDown:de.CaretRight,className:"text-xs"})}):h.jsx(I,{className:"flex-shrink-0 w-5 h-5"}),o&&h.jsx(vn,{checked:E,onChange:C=>{C.stopPropagation(),f(y.id,C.target.checked)},className:"flex-shrink-0","data-testid":`checkbox-${y.id}`}),h.jsx(re,{name:de.Folder,className:`flex-shrink-0 text-sm ${S?"text-yellow-500 dark:text-yellow-400":"text-gray-400 dark:text-gray-500"}`}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300 select-none",onClick:()=>S&&u(y.id),children:h.jsx(BS,{text:k,keyword:r})}),s&&y.products_count!==void 0&&h.jsx(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-400 ml-1",children:y.products_count})]}),S&&x&&h.jsx(I,{"data-testid":`children-${y.id}`,children:(y.children??[]).map(C=>p(C,b+1))})]},y.id)};return t.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${i}`,id:c,...d,children:"데이터가 없습니다."}):h.jsx(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-80 overflow-y-auto ${i}`,id:c,...d,children:t.map(y=>p(y,0))})},eg="carousel",Rs="controller",WS="navigation",GS="no-scroll",sc="portal",YS="root",tg="toolbar",XS="counter",eo="fullscreen",ng="slideshow",to="thumbnails",rg="zoom",Jr="loading",oc="playing",no="error",ro="complete",KS="placeholder",so=t=>`active-slide-${t}`,qS=so(Jr),ZS=so(oc),QS=so(no),JS=so(ro),sg="fullsize",Rr="flex_center",RS="no_scroll",og="no_scroll_padding",ic="slide",ig="slide_wrapper",e_="slide_wrapper_interactive",nr="prev",rr="next",ac="swipe",es="close",ag="onPointerDown",lg="onPointerMove",cg="onPointerUp",dg="onPointerLeave",ug="onPointerCancel",lc="onKeyDown",t_="onKeyUp",cc="onWheel",n_="Escape",r_="ArrowLeft",s_="ArrowRight",o_="button",Li="icon",fg="contain",hg="cover",gg="Unknown action type",pg="yarl__";function Ft(...t){return t.filter(Boolean).join(" ")}function Ne(t){return`${pg}${t}`}function dt(t){return`--${pg}${t}`}function gr(t,e){return`${t}${e?`_${e}`:""}`}function pr(t){return e=>gr(t,e)}function mr(t,e){var n;return(n=t?.[e])!==null&&n!==void 0?n:e}function mg(t,e,n){return mr(t,"{index} of {total}").replace(/\{index}/g,`${hc(n,e.length)+1}`).replace(/\{total}/g,`${e.length}`)}function ts(...t){return()=>{t.forEach(e=>{e()})}}function an(t,e,n){return()=>{const r=P.useContext(n);if(!r)throw new Error(`${t} must be used within a ${e}.Provider`);return r}}function dc(){return typeof window<"u"}function uc(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function sr(t){return t.type===void 0||t.type==="image"}function fc(t,e){return t.imageFit===hg||t.imageFit!==fg&&e===hg}function Pi(t){return typeof t=="string"?Number.parseInt(t,10):t}function $i(t){if(typeof t=="number")return{pixel:t};if(typeof t=="string"){const e=Pi(t);return t.endsWith("%")?{percent:e}:{pixel:e}}return{pixel:0}}function i_(t,e){const n=$i(e),r=n.percent!==void 0?t.width/100*n.percent:n.pixel;return{width:Math.max(t.width-2*r,0),height:Math.max(t.height-2*r,0)}}function a_(){return(dc()?window?.devicePixelRatio:void 0)||1}function hc(t,e){return e>0?(t%e+e)%e:0}function gc(t){return t.length>0}function pc(t,e){return t[hc(e,t.length)]}function mc(t,e){return gc(t)?pc(t,e):void 0}function bg(t){return sr(t)?t.src:void 0}function Fi(t,e,n){if(!n)return t;const{buttons:r,...s}=t,o=r.findIndex(a=>a===e),i=P.isValidElement(n)?P.cloneElement(n,{key:e},null):n;if(o>=0){const a=[...r];return a.splice(o,1,i),{buttons:a,...s}}return{buttons:[i,...r],...s}}function yg(t,e,n=0){return Math.min(t.preload,Math.max(t.finite?e.length-1:Math.floor(e.length/2),n))}const l_=Number(P.version.split(".")[0])>=19;function c_(t){return{inert:l_?t:t?"":void 0}}function d_(t){t.scrollTop}const bc={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[es]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:fg,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function un(t,e){return{name:t,component:e}}function Nt(t,e){return{module:t,children:e}}function vg(t,e,n){return t.module.name===e?n(t):t.children?[Nt(t.module,t.children.flatMap(r=>{var s;return(s=vg(r,e,n))!==null&&s!==void 0?s:[]}))]:[t]}function ns(t,e,n){return t.flatMap(r=>{var s;return(s=vg(r,e,n))!==null&&s!==void 0?s:[]})}function u_(t,e=[],n=[]){let r=t;const s=g=>{const m=[...r];for(;m.length>0;){const p=m.pop();if(p?.module.name===g)return!0;p?.children&&m.push(...p.children)}return!1},o=(g,m)=>{if(g===""){r=[Nt(m,r)];return}r=ns(r,g,p=>[Nt(m,[p])])},i=(g,m)=>{r=ns(r,g,p=>[Nt(p.module,[Nt(m,p.children)])])},a=(g,m,p)=>{r=ns(r,g,y=>{var b;return[Nt(y.module,[...p?[Nt(m)]:[],...(b=y.children)!==null&&b!==void 0?b:[],...p?[]:[Nt(m)]])]})},l=(g,m,p)=>{r=ns(r,g,y=>[...p?[Nt(m)]:[],y,...p?[]:[Nt(m)]])},c=g=>{i(Rs,g)},d=(g,m)=>{r=ns(r,g,p=>[Nt(m,p.children)])},u=g=>{r=ns(r,g,m=>m.children)},f=g=>{n.push(g)};return e.forEach(g=>{g({contains:s,addParent:o,append:i,addChild:a,addSibling:l,addModule:c,replace:d,remove:u,augment:f})}),{config:r,augmentation:g=>n.reduce((m,p)=>p(m),g)}}const xg=P.createContext(null),yc=an("useA11yContext","A11yContext",xg);function f_({children:t}){const[e,n]=P.useState(!1),[r,s]=P.useState(!1),o=P.useMemo(()=>({focusWithin:e,trackFocusWithin:(a,l)=>{const c=d=>u=>{var f;u.currentTarget.contains(u.relatedTarget)||n(d),(f=d?a:l)===null||f===void 0||f(u)};return{onFocus:c(!0),onBlur:c(!1)}},autoPlaying:r,setAutoPlaying:s}),[e,r]);return P.createElement(xg.Provider,{value:o},t)}const wg=P.createContext(null),rs=an("useDocument","DocumentContext",wg);function h_({nodeRef:t,children:e}){const n=P.useMemo(()=>{const r=o=>{var i;return((i=o||t.current)===null||i===void 0?void 0:i.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var i;return((i=r(o))===null||i===void 0?void 0:i.defaultView)||window}}},[t]);return P.createElement(wg.Provider,{value:n},e)}const kg=P.createContext(null),ss=an("useEvents","EventsContext",kg);function g_({children:t}){const[e]=P.useState({});P.useEffect(()=>()=>{Object.keys(e).forEach(r=>delete e[r])},[e]);const n=P.useMemo(()=>{const r=(i,a)=>{var l;(l=e[i])===null||l===void 0||l.splice(0,e[i].length,...e[i].filter(c=>c!==a))};return{publish:(...[i,a])=>{var l;(l=e[i])===null||l===void 0||l.forEach(c=>c(a))},subscribe:(i,a)=>(e[i]||(e[i]=[]),e[i].push(a),()=>r(i,a)),unsubscribe:r}},[e]);return P.createElement(kg.Provider,{value:n},t)}const Cg=P.createContext(null),Ot=an("useLightboxProps","LightboxPropsContext",Cg);function Sg({children:t,...e}){return P.createElement(Cg.Provider,{value:e},t)}const _g=P.createContext(null),fn=an("useLightboxState","LightboxStateContext",_g),Eg=P.createContext(null),p_=an("useLightboxDispatch","LightboxDispatchContext",Eg);function m_(t,e){switch(e.type){case"swipe":{const{slides:n}=t,r=e?.increment||0,s=t.globalIndex+r,o=hc(s,n.length),i=mc(n,o),a=r||e.duration!==void 0?{increment:r,duration:e.duration,easing:e.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:s,currentSlide:i,animation:a}}case"update":return e.slides!==t.slides||e.index!==t.currentIndex?{slides:e.slides,currentIndex:e.index,globalIndex:e.index,currentSlide:mc(e.slides,e.index)}:t;default:throw new Error(gg)}}function b_({slides:t,index:e,children:n}){const[r,s]=P.useReducer(m_,{slides:t,currentIndex:e,globalIndex:e,currentSlide:mc(t,e)}),[o,i]=P.useState(t),[a,l]=P.useState(e);(t!==o||e!==a)&&(i(t),l(e),s({type:"update",slides:t,index:e}));const c=P.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return P.createElement(Eg.Provider,{value:s},P.createElement(_g.Provider,{value:c},n))}const Mg=P.createContext(null),y_=an("useRTLContext","RTLContext",Mg);function v_({isRTL:t,children:e}){const n=P.useMemo(()=>({isRTL:t}),[t]);return P.createElement(Mg.Provider,{value:n},e)}const Ng=P.createContext(null),oo=an("useTimeouts","TimeoutsContext",Ng);function x_({children:t}){const[e]=P.useState([]);P.useEffect(()=>()=>{e.forEach(r=>window.clearTimeout(r)),e.splice(0,e.length)},[e]);const n=P.useMemo(()=>{const r=i=>{e.splice(0,e.length,...e.filter(a=>a!==i))};return{setTimeout:(i,a)=>{const l=window.setTimeout(()=>{r(l),i()},a);return e.push(l),l},clearTimeout:i=>{i!==void 0&&(r(i),window.clearTimeout(i))}}},[e]);return P.createElement(Ng.Provider,{value:n},t)}const os=P.forwardRef(function({label:e,className:n,icon:r,renderIcon:s,onClick:o,style:i,...a},l){const{styles:c,labels:d}=Ot(),u=mr(d,e);return P.createElement("button",{ref:l,type:"button",title:u,"aria-label":u,className:Ft(Ne(o_),n),onClick:o,style:{...i,...c.button},...a},s?s():P.createElement(r,{className:Ne(Li),style:c.icon}))});function Og(t,e){const n=r=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},e);return n.displayName=t,n}function Zt(t,e){return Og(t,P.createElement("g",{fill:"currentColor"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e))}function w_(t,e){return Og(t,P.createElement(P.Fragment,null,P.createElement("defs",null,P.createElement("mask",{id:"strike"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),P.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),P.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),P.createElement("g",{fill:"currentColor",mask:"url(#strike)"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e)))}const k_=Zt("Close",P.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),C_=Zt("Previous",P.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),S_=Zt("Next",P.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),__=Zt("Loading",P.createElement(P.Fragment,null,Array.from({length:8}).map((t,e,n)=>P.createElement("line",{key:e,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(e+1),transform:`rotate(${360/n.length*e}, 12, 12)`})))),E_=Zt("Error",P.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),Cn=dc()?P.useLayoutEffect:P.useEffect;function vc(){const[t,e]=P.useState(!1);return P.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");e(s?.matches);const o=i=>e(i.matches);return(r=s?.addEventListener)===null||r===void 0||r.call(s,"change",o),()=>{var i;return(i=s?.removeEventListener)===null||i===void 0?void 0:i.call(s,"change",o)}},[]),t}function M_(t){let e=0,n=0,r=0;const o=window.getComputedStyle(t).transform.match(/matrix.*\((.+)\)/);if(o){const i=o[1].split(",").map(Pi);i.length===6?(e=i[4],n=i[5]):i.length===16&&(e=i[12],n=i[13],r=i[14])}return{x:e,y:n,z:r}}function xc(t,e){const n=P.useRef(void 0),r=P.useRef(void 0),s=vc();return Cn(()=>{var o,i,a;if(t.current&&n.current!==void 0&&!s){const{keyframes:l,duration:c,easing:d,onfinish:u}=e(n.current,t.current.getBoundingClientRect(),M_(t.current))||{};if(l&&c){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(i=t.current).animate)===null||a===void 0?void 0:a.call(i,l,{duration:c,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,u?.()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function Tg(){const t=P.useRef(null),e=P.useRef(void 0),[n,r]=P.useState();return{setContainerRef:P.useCallback(o=>{t.current=o,e.current&&(e.current.disconnect(),e.current=void 0);const i=()=>{if(o){const a=window.getComputedStyle(o),l=c=>parseFloat(c)||0;r({width:Math.round(o.clientWidth-l(a.paddingLeft)-l(a.paddingRight)),height:Math.round(o.clientHeight-l(a.paddingTop)-l(a.paddingBottom))})}else r(void 0)};i(),o&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(i),e.current.observe(o))},[]),containerRef:t,containerRect:n}}function zi(){const t=P.useRef(void 0),{setTimeout:e,clearTimeout:n}=oo();return P.useCallback((r,s)=>{n(t.current),t.current=e(r,s>0?s:0)},[e,n])}function Ge(t){const e=P.useRef(t);return Cn(()=>{e.current=t}),P.useCallback((...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Ag(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function wc(t,e){return P.useMemo(()=>t==null&&e==null?null:n=>{Ag(t,n),Ag(e,n)},[t,e])}function Dg(t,e=!1){const n=P.useRef(!1);Cn(()=>{e&&n.current&&(n.current=!1,t())},[e,t]);const r=P.useCallback(()=>{n.current=!0},[]),s=P.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function Vi(){return y_().isRTL}function Ig(){const[t]=P.useState({}),e=P.useCallback((s,o)=>{var i;(i=t[s])===null||i===void 0||i.forEach(a=>{o.isPropagationStopped()||a(o)})},[t]),n=P.useMemo(()=>({onPointerDown:s=>e(ag,s),onPointerMove:s=>e(lg,s),onPointerUp:s=>e(cg,s),onPointerLeave:s=>e(dg,s),onPointerCancel:s=>e(ug,s),onKeyDown:s=>e(lc,s),onKeyUp:s=>e(t_,s),onWheel:s=>e(cc,s)}),[e]),r=P.useCallback((s,o)=>(t[s]||(t[s]=[]),t[s].unshift(o),()=>{const i=t[s];i&&i.splice(0,i.length,...i.filter(a=>a!==o))}),[t]);return{registerSensors:n,subscribeSensors:r}}function Lg(t,e){const n=P.useRef(0),r=zi(),s=Ge((...o)=>{n.current=Date.now(),t(o)});return P.useCallback((...o)=>{r(()=>{s(o)},e-(Date.now()-n.current))},[e,s,r])}const kc=pr("slide"),Cc=pr("slide_image");function br({slide:t,offset:e,render:n,rect:r,imageFit:s,imageProps:o,onClick:i,onLoad:a,onError:l,style:c}){var d,u,f,g,m,p,y,b;const[S,x]=P.useState(Jr),{publish:E}=ss(),{setTimeout:k}=oo(),C=P.useRef(null);P.useEffect(()=>{e===0&&E(so(S))},[e,S,E]);const N=Ge(U=>{("decode"in U?U.decode():Promise.resolve()).catch(()=>{}).then(()=>{U.parentNode&&(x(ro),k(()=>{a?.(U)},0))})}),_=P.useCallback(U=>{C.current=U,U?.complete&&N(U)},[N]),w=P.useCallback(U=>{N(U.currentTarget)},[N]),M=Ge(()=>{x(no),l?.()}),O=fc(t,s),L=(U,B)=>Number.isFinite(U)?U:B,F=L(Math.max(...((u=(d=t.srcSet)===null||d===void 0?void 0:d.map(U=>U.width))!==null&&u!==void 0?u:[]).concat(t.width?[t.width]:[]).filter(Boolean)),((f=C.current)===null||f===void 0?void 0:f.naturalWidth)||0),$=L(Math.max(...((m=(g=t.srcSet)===null||g===void 0?void 0:g.map(U=>U.height))!==null&&m!==void 0?m:[]).concat(t.height?[t.height]:[]).filter(Boolean)),((p=C.current)===null||p===void 0?void 0:p.naturalHeight)||0),D=F&&$?{maxWidth:`min(${F}px, 100%)`,maxHeight:`min(${$}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},A=(y=t.srcSet)===null||y===void 0?void 0:y.slice().sort((U,B)=>U.width-B.width).map(U=>`${U.src} ${U.width}w`).join(", "),T=()=>r&&!O&&t.width&&t.height?r.height/t.height*t.width:Number.MAX_VALUE,z=A&&r&&dc()?`${Math.round(Math.min(T(),r.width))}px`:void 0,{style:H,className:W,...j}=(typeof o=="function"?o(t):o)||{};return P.createElement(P.Fragment,null,P.createElement("img",{ref:_,onLoad:w,onError:M,onClick:i,draggable:!1,className:Ft(Ne(Cc()),O&&Ne(Cc("cover")),S!==ro&&Ne(Cc("loading")),W),style:{...D,...c,...H},...j,alt:(b=t.alt)!==null&&b!==void 0?b:"",sizes:z,srcSet:A,src:t.src}),S!==ro&&P.createElement("div",{className:Ne(kc(KS))},S===Jr&&(n?.iconLoading?n.iconLoading():P.createElement(__,{className:Ft(Ne(Li),Ne(kc(Jr)))})),S===no&&(n?.iconError?n.iconError():P.createElement(E_,{className:Ft(Ne(Li),Ne(kc(no)))}))))}const N_=P.forwardRef(function({className:e,children:n,onFocus:r,onBlur:s,...o},i){const a=P.useRef(null),[l,c]=P.useState(!1),{trackFocusWithin:d}=yc(),u=Ge(()=>{if(a.current){const f=window.getComputedStyle(a.current).direction==="rtl";f!==l&&c(f)}});return P.useEffect(u),P.createElement(h_,{nodeRef:a},P.createElement(v_,{isRTL:l},P.createElement("div",{ref:wc(i,a),className:Ft(Ne("root"),e),...d(r,s),...o},n)))});var zt;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL",t[t.ANIMATION=3]="ANIMATION"})(zt||(zt={}));function Pg(t,e,n,r,s){P.useEffect(()=>s?()=>{}:ts(t(ag,e),t(lg,n),t(cg,r),t(dg,r),t(ug,r)),[t,e,n,r,s])}var Sn;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL"})(Sn||(Sn={}));const Sc=30;function O_({disableSwipeNavigation:t,closeOnBackdropClick:e},n,r,s,o,i,a,l,c,d,u,f,g,m,p,y){const b=P.useRef(0),S=P.useRef([]),x=P.useRef(void 0),E=P.useRef(0),k=P.useRef(Sn.NONE),C=P.useCallback(F=>{x.current===F.pointerId&&(x.current=void 0,k.current=Sn.NONE);const $=S.current;$.splice(0,$.length,...$.filter(D=>D.pointerId!==F.pointerId))},[]),N=P.useCallback(F=>{C(F),F.persist(),S.current.push(F)},[C]),_=P.useCallback(F=>S.current.find(({pointerId:$})=>F.pointerId===$),[]),w=Ge(F=>{N(F)}),M=(F,$)=>u&&F>$||d&&F<-$,O=Ge(F=>{const $=_(F);if($)if(x.current===F.pointerId){const D=Date.now()-E.current,A=b.current;k.current===Sn.SWIPE?Math.abs(A)>.3*s||Math.abs(A)>5&&D{const $=_(F);if($){const D=x.current===F.pointerId;if(F.buttons===0){D&&b.current!==0?O(F):C($);return}const A=F.clientX-$.clientX,T=F.clientY-$.clientY;if(x.current===void 0){const z=H=>{N(F),x.current=F.pointerId,E.current=Date.now(),k.current=H};Math.abs(A)>Math.abs(T)&&Math.abs(A)>Sc&&r(A)?t||(z(Sn.SWIPE),i()):Math.abs(T)>Math.abs(A)&&M(T,Sc)&&(z(Sn.PULL),f())}else D&&(k.current===Sn.SWIPE?(b.current=A,a(A)):k.current===Sn.PULL&&(b.current=T,g(T)))}});Pg(n,w,L,O)}function T_({preventDefaultWheelX:t,preventDefaultWheelY:e}){const n=P.useRef(null),r=Ge(s=>{const o=Math.abs(s.deltaX)>Math.abs(s.deltaY);(o&&t||!o&&e||s.ctrlKey)&&s.preventDefault()});return P.useCallback(s=>{var o;s?s.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=s},[r])}function A_(t,e,n,r,s,o,i,a,l){const c=P.useRef(0),d=P.useRef(0),u=P.useRef(void 0),f=P.useRef(void 0),g=P.useRef(0),m=P.useRef(void 0),p=P.useRef(0),{setTimeout:y,clearTimeout:b}=oo(),S=P.useCallback(()=>{u.current&&(b(u.current),u.current=void 0)},[b]),x=P.useCallback(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),E=Ge(()=>{t!==zt.SWIPE&&(c.current=0,p.current=0,S(),x())});P.useEffect(E,[t,E]);const k=Ge(N=>{f.current=void 0,c.current===N&&l(c.current)}),C=Ge(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const _=w=>{g.current=w,b(m.current),m.current=w>0?y(()=>{g.current=0,m.current=void 0},300):void 0};if(t===zt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){_(N.deltaX);return}if(!n(-N.deltaX))return;if(d.current+=N.deltaX,S(),Math.abs(d.current)>30)d.current=0,_(0),p.current=Date.now(),o();else{const w=d.current;u.current=y(()=>{u.current=void 0,w===d.current&&(d.current=0)},s)}}else if(t===zt.SWIPE){let w=c.current-N.deltaX;if(w=Math.min(Math.abs(w),r)*Math.sign(w),c.current=w,i(w),x(),Math.abs(w)>.2*r){_(N.deltaX),a(w,Date.now()-p.current);return}f.current=y(()=>k(w),2*s)}else _(N.deltaX)});P.useEffect(()=>e(cc,C),[e,C])}const $g=pr("container"),Fg=P.createContext(null),_n=an("useController","ControllerContext",Fg);function D_({children:t,...e}){var n;const{carousel:r,animation:s,controller:o,on:i,styles:a,render:l}=e,{closeOnPullUp:c,closeOnPullDown:d,preventDefaultWheelX:u,preventDefaultWheelY:f}=o,[g,m]=P.useState(),p=fn(),y=p_(),[b,S]=P.useState(zt.NONE),x=P.useRef(0),E=P.useRef(0),k=P.useRef(1),{registerSensors:C,subscribeSensors:N}=Ig(),{subscribe:_,publish:w}=ss(),M=zi(),O=zi(),L=zi(),{containerRef:F,setContainerRef:$,containerRect:D}=Tg(),A=wc(T_({preventDefaultWheelX:u,preventDefaultWheelY:f}),$),T=P.useRef(null),z=wc(T,void 0),{getOwnerDocument:H}=rs(),W=Vi(),j=se=>(W?-1:1)*(typeof se=="number"?se:1),U=Ge(()=>{var se;return(se=F.current)===null||se===void 0?void 0:se.focus()}),B=Ge(()=>e),G=Ge(()=>p),V=P.useCallback(se=>w(nr,se),[w]),K=P.useCallback(se=>w(rr,se),[w]),X=P.useCallback(()=>w(es),[w]),Z=se=>!(r.finite&&(j(se)>0&&p.currentIndex===0||j(se)<0&&p.currentIndex===p.slides.length-1)),ee=se=>{var Oe;x.current=se,(Oe=F.current)===null||Oe===void 0||Oe.style.setProperty(dt("swipe_offset"),`${Math.round(se)}px`)},ne=se=>{var Oe,Pe;E.current=se,k.current=(()=>{const st=d&&se>0?se:c&&se<0?-se:0;return Math.min(Math.max(uc(1-st/60*(1-.5),2),.5),1)})(),(Oe=F.current)===null||Oe===void 0||Oe.style.setProperty(dt("pull_offset"),`${Math.round(se)}px`),(Pe=F.current)===null||Pe===void 0||Pe.style.setProperty(dt("pull_opacity"),`${k.current}`)},{prepareAnimation:he}=xc(T,(se,Oe,Pe)=>{if(T.current&&D)return{keyframes:[{transform:`translate(0, ${se.rect.y-Oe.y+Pe.y}px)`,opacity:se.opacity},{transform:"translate(0, 0)",opacity:1}],duration:se.duration,easing:s.easing.fade}}),J=(se,Oe)=>{if(c||d){ne(se);let Pe=0;T.current&&(Pe=s.fade*(Oe?2:1),he({rect:T.current.getBoundingClientRect(),opacity:k.current,duration:Pe})),L(()=>{ne(0),S(zt.NONE)},Pe),S(zt.ANIMATION),Oe||X()}},{prepareAnimation:ce,isAnimationPlaying:ue}=xc(T,(se,Oe,Pe)=>{var Ie;if(T.current&&D&&(!((Ie=p.animation)===null||Ie===void 0)&&Ie.duration)){const je=$i(r.spacing),st=(je.percent?je.percent*D.width/100:je.pixel)||0;return{keyframes:[{transform:`translate(${j(p.globalIndex-se.index)*(D.width+st)+se.rect.x-Oe.x+Pe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:p.animation.duration,easing:p.animation.easing}}}),ae=Ge(se=>{var Oe,Pe;const Ie=se.offset||0,je=Ie?s.swipe:(Oe=s.navigation)!==null&&Oe!==void 0?Oe:s.swipe,st=!Ie&&!ue()?s.easing.navigation:s.easing.swipe;let{direction:ut}=se;const We=(Pe=se.count)!==null&&Pe!==void 0?Pe:1;let et=zt.ANIMATION,Xe=je*We;if(!ut){const ge=D?.width,pe=se.duration||0,me=ge?je/ge*Math.abs(Ie):je;We!==0?(pe0?nr:rr):Xe=je/2}let te=0;ut===nr?Z(j(1))?te=-We:(et=zt.NONE,Xe=je):ut===rr&&(Z(j(-1))?te=We:(et=zt.NONE,Xe=je)),Xe=Math.round(Xe),O(()=>{ee(0),S(zt.NONE)},Xe),T.current&&ce({rect:T.current.getBoundingClientRect(),index:p.globalIndex}),S(et),w(ac,{type:"swipe",increment:te,duration:Xe,easing:st})});P.useEffect(()=>{var se,Oe;!((se=p.animation)===null||se===void 0)&&se.increment&&(!((Oe=p.animation)===null||Oe===void 0)&&Oe.duration)&&M(()=>y({type:"swipe",increment:0}),p.animation.duration)},[p.animation,y,M]);const ve=[N,Z,D?.width||0,s.swipe,()=>S(zt.SWIPE),se=>ee(se),(se,Oe)=>ae({offset:se,duration:Oe,count:1}),se=>ae({offset:se,count:0})],fe=[()=>{d&&S(zt.PULL)},se=>ne(se),se=>J(se),se=>J(se,!0)];O_(o,...ve,c,d,...fe,X),A_(b,...ve);const ye=Ge(()=>{o.focus&&H().querySelector(`.${Ne(sc)} .${Ne($g())}`)&&U()});P.useEffect(ye,[ye]);const ke=Ge(()=>{var se;(se=i.view)===null||se===void 0||se.call(i,{index:p.currentIndex})});P.useEffect(ke,[p.globalIndex,ke]),P.useEffect(()=>ts(_(nr,se=>ae({direction:nr,...se})),_(rr,se=>ae({direction:rr,...se})),_(ac,se=>y(se))),[_,ae,y]);const Ue=P.useMemo(()=>({prev:V,next:K,close:X,focus:U,slideRect:D?i_(D,r.padding):{width:0,height:0},containerRect:D||{width:0,height:0},subscribeSensors:N,containerRef:F,setCarouselRef:z,toolbarWidth:g,setToolbarWidth:m}),[V,K,X,U,N,D,F,z,g,m,r.padding]);return P.useImperativeHandle(o.ref,()=>({prev:V,next:K,close:X,focus:U,getLightboxProps:B,getLightboxState:G}),[V,K,X,U,B,G]),P.createElement("div",{ref:A,className:Ft(Ne($g()),Ne(Rr)),style:{...b===zt.SWIPE?{[dt("swipe_offset")]:`${Math.round(x.current)}px`}:null,...b===zt.PULL?{[dt("pull_offset")]:`${Math.round(E.current)}px`,[dt("pull_opacity")]:`${k.current}`}:null,...o.touchAction!=="none"?{[dt("controller_touch_action")]:o.touchAction}:null,...a.container},tabIndex:-1,...C},D&&P.createElement(Fg.Provider,{value:Ue},t,(n=l.controls)===null||n===void 0?void 0:n.call(l)))}const I_=un(Rs,D_);function yr(t){return gr(eg,t)}function zg(t){return gr(ic,t)}function L_({slide:t,offset:e}){const n=P.useRef(null),{currentIndex:r,slides:s}=fn(),{slideRect:o,focus:i}=_n(),{render:a,carousel:{imageFit:l,imageProps:c},on:{click:d},styles:{slide:u},labels:f}=Ot(),{getOwnerDocument:g}=rs(),m=e!==0;P.useEffect(()=>{var y;m&&(!((y=n.current)===null||y===void 0)&&y.contains(g().activeElement))&&i()},[m,i,g]);const p=()=>{var y,b,S,x;let E=(y=a.slide)===null||y===void 0?void 0:y.call(a,{slide:t,offset:e,rect:o});return!E&&sr(t)&&(E=P.createElement(br,{slide:t,offset:e,render:a,rect:o,imageFit:l,imageProps:c,onClick:m?void 0:()=>d?.({index:r})})),E?P.createElement(P.Fragment,null,(b=a.slideHeader)===null||b===void 0?void 0:b.call(a,{slide:t}),((S=a.slideContainer)!==null&&S!==void 0?S:(({children:k})=>k))({slide:t,children:E}),(x=a.slideFooter)===null||x===void 0?void 0:x.call(a,{slide:t})):null};return P.createElement("div",{ref:n,className:Ft(Ne(zg()),!m&&Ne(zg("current")),Ne(Rr)),...c_(m),style:u,role:"group","aria-roledescription":mr(f,"Slide"),"aria-label":mg(f,s,r+e)},p())}function P_(){const t=Ot().styles.slide;return P.createElement("div",{className:Ne(ic),style:t})}function $_({carousel:t,labels:e}){const{slides:n,currentIndex:r,globalIndex:s}=fn(),{setCarouselRef:o}=_n(),{autoPlaying:i,focusWithin:a}=yc(),l=$i(t.spacing),c=$i(t.padding),d=yg(t,n,1),u=[];if(gc(n))for(let f=r-d;f<=r+d;f+=1){const g=pc(n,f),m=s-r+f,p=t.finite&&(f<0||f>n.length-1);u.push(p?{key:m}:{key:[`${m}`,bg(g)].filter(Boolean).join("|"),offset:f-r,slide:g})}return P.createElement("div",{ref:o,className:Ft(Ne(yr()),u.length>0&&Ne(yr("with_slides"))),style:{[`${dt(yr("slides_count"))}`]:u.length,[`${dt(yr("spacing_px"))}`]:l.pixel||0,[`${dt(yr("spacing_percent"))}`]:l.percent||0,[`${dt(yr("padding_px"))}`]:c.pixel||0,[`${dt(yr("padding_percent"))}`]:c.percent||0},role:"region","aria-live":i&&!a?"off":"polite","aria-roledescription":mr(e,"Carousel"),"aria-label":mr(e,"Photo gallery")},u.map(({key:f,slide:g,offset:m})=>g?P.createElement(L_,{key:f,slide:g,offset:m}):P.createElement(P_,{key:f})))}const F_=un(eg,$_);function Vg(){const{carousel:t}=Ot(),{slides:e,currentIndex:n}=fn(),r=e.length===0||t.finite&&n===0,s=e.length===0||t.finite&&n===e.length-1;return{prevDisabled:r,nextDisabled:s}}function Hg(t){var e;const n=Vi(),{publish:r}=ss(),{animation:s,controller:o}=Ot(),{prevDisabled:i,nextDisabled:a}=Vg(),l=((e=s.navigation)!==null&&e!==void 0?e:s.swipe)/2,c=Lg(()=>r(nr),l),d=Lg(()=>r(rr),l),u=Ge(f=>{switch(f.key){case n_:if(!o.closeOnEscape)return;r(es);break;case r_:(n?a:i)||(n?d:c)();break;case s_:(n?i:a)||(n?c:d)();break;default:return}f.stopPropagation()});P.useEffect(()=>t(lc,u),[t,u])}function Ug({label:t,icon:e,renderIcon:n,action:r,onClick:s,disabled:o,style:i}){return P.createElement(os,{label:t,icon:e,renderIcon:n,className:Ne(`navigation_${r}`),disabled:o,onClick:s,style:i,...Dg(_n().focus,o)})}function z_({render:{buttonPrev:t,buttonNext:e,iconPrev:n,iconNext:r},styles:s}){const{prev:o,next:i,subscribeSensors:a}=_n(),{prevDisabled:l,nextDisabled:c}=Vg();return Hg(a),P.createElement(P.Fragment,null,t?t():P.createElement(Ug,{label:"Previous",action:nr,icon:C_,renderIcon:n,style:s.navigationPrev,disabled:l,onClick:o}),e?e():P.createElement(Ug,{label:"Next",action:rr,icon:S_,renderIcon:r,style:s.navigationNext,disabled:c,onClick:i}))}const V_=un(WS,z_),Bg=Ne(RS),H_=Ne(og);function U_(t){return"style"in t}function jg(t,e,n){const r=window.getComputedStyle(t),s=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,i=t.style.getPropertyValue(s);return t.style.setProperty(s,`${(Pi(o)||0)+e}px`),()=>{i?t.style.setProperty(s,i):t.style.removeProperty(s)}}function B_({noScroll:{disabled:t},children:e}){const n=Vi(),{getOwnerDocument:r,getOwnerWindow:s}=rs();return P.useEffect(()=>{if(t)return()=>{};const o=[],i=s(),{body:a,documentElement:l}=r(),c=Math.round(i.innerWidth-l.clientWidth);if(c>0){o.push(jg(a,c,n));const d=a.getElementsByTagName("*");for(let u=0;u{a.classList.remove(Bg),o.forEach(d=>d())}},[n,t,r,s]),P.createElement(P.Fragment,null,e)}const j_=un(GS,B_);function Wg(t){return gr(sc,t)}function Gg(t,e,n){const r=t.getAttribute(e);return t.setAttribute(e,n),()=>{r?t.setAttribute(e,r):t.removeAttribute(e)}}function W_({portal:{root:t,container:{className:e,style:n,...r}={}},animation:s,styles:o,className:i,on:a,close:l,labels:c,children:d}){const[u,f]=P.useState(!1),[g,m]=P.useState(!1),p=P.useRef([]),y=P.useRef(null),{setTimeout:b}=oo(),{subscribe:S}=ss(),E=vc()?0:s.fade;P.useEffect(()=>(f(!0),()=>{f(!1),m(!1)}),[]);const k=Ge(()=>{p.current.forEach(w=>w()),p.current=[]}),C=Ge(()=>{var w;m(!1),k(),(w=a.exiting)===null||w===void 0||w.call(a),b(()=>{var M;(M=a.exited)===null||M===void 0||M.call(a),l()},E)});P.useEffect(()=>S(es,C),[S,C]);const N=Ge(w=>{var M,O,L;d_(w),m(!0),(M=a.entering)===null||M===void 0||M.call(a);const F=(L=(O=w.parentNode)===null||O===void 0?void 0:O.children)!==null&&L!==void 0?L:[];for(let $=0;${var $,D;(D=($=y.current)===null||$===void 0?void 0:$.focus)===null||D===void 0||D.call($)}),b(()=>{var $;($=a.entered)===null||$===void 0||$.call(a)},E)}),_=P.useCallback(w=>{w?N(w):k()},[N,k]);return u?On.createPortal(P.createElement(N_,{ref:_,className:Ft(i,e,Ne(Wg()),Ne(og),g&&Ne(Wg("open"))),"aria-modal":!0,role:"dialog","aria-label":mr(c,"Lightbox"),style:{...s.fade!==bc.animation.fade?{[dt("fade_animation_duration")]:`${E}ms`}:null,...s.easing.fade!==bc.animation.easing.fade?{[dt("fade_animation_timing_function")]:s.easing.fade}:null,...o.root,...n},onFocus:w=>{y.current||(y.current=w.relatedTarget)},...r},d),(typeof t=="function"?t():t)||document.body):null}const G_=un(sc,W_);function Y_({children:t}){return P.createElement(P.Fragment,null,t)}const X_=un(YS,Y_);function K_(t){return gr(tg,t)}function q_({toolbar:{buttons:t},render:{buttonClose:e,iconClose:n},styles:r}){const{close:s,setToolbarWidth:o}=_n(),{setContainerRef:i,containerRect:a}=Tg();Cn(()=>{o(a?.width)},[o,a?.width]);const l=()=>e?e():P.createElement(os,{key:es,label:"Close",icon:k_,renderIcon:n,onClick:s});return P.createElement("div",{ref:i,style:r.toolbar,className:Ne(K_())},t?.map(c=>c===es?l():c))}const Z_=un(tg,q_);function Yg(t,e){var n;return P.createElement(t.module.component,{key:t.module.name,...e},(n=t.children)===null||n===void 0?void 0:n.map(r=>Yg(r,e)))}function Q_(t,e={}){const{easing:n,...r}=t,{easing:s,...o}=e;return{easing:{...n,...s},...r,...o}}function J_({carousel:t,animation:e,render:n,toolbar:r,controller:s,noScroll:o,on:i,plugins:a,slides:l,index:c,...d}){const{animation:u,carousel:f,render:g,toolbar:m,controller:p,noScroll:y,on:b,slides:S,index:x,plugins:E,...k}=bc,{config:C,augmentation:N}=u_([Nt(G_,[Nt(j_,[Nt(I_,[Nt(F_),Nt(Z_),Nt(V_)])])])],a||E),_=N({animation:Q_(u,e),carousel:{...f,...t},render:{...g,...n},toolbar:{...m,...r},controller:{...p,...s},noScroll:{...y,...o},on:{...b,...i},...k,...d});return _.open?P.createElement(Sg,{..._},P.createElement(b_,{slides:l||S,index:Pi(c||x)},P.createElement(x_,null,P.createElement(g_,null,P.createElement(f_,null,Yg(Nt(X_,C),_)))))):null}const Xg={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1,maxZoom:8};function R_(t){return Math.min(Math.max(t,Number.EPSILON),1)}function Kg(t){const{minZoom:e,...n}={...Xg,...t};return{minZoom:R_(e),...n}}function e2(t,e,n,r){const s=P.useRef(void 0),o=P.useRef(void 0),{zoom:i}=Ot().animation,a=vc(),l=Ge(()=>{var c,d,u;if((c=s.current)===null||c===void 0||c.cancel(),s.current=void 0,o.current&&r?.current){try{s.current=(u=(d=r.current).animate)===null||u===void 0?void 0:u.call(d,[{transform:o.current},{transform:`scale(${t}) translateX(${e}px) translateY(${n}px)`}],{duration:a?0:i??500,easing:s.current?"ease-out":"ease-in-out"})}catch(f){console.error(f)}o.current=void 0,s.current&&(s.current.onfinish=()=>{s.current=void 0})}});return Cn(l,[t,e,n,l]),P.useCallback(()=>{o.current=r?.current?window.getComputedStyle(r.current).transform:void 0},[r])}function t2(t,e){const{on:n}=Ot(),r=Ge(()=>{var s;e||(s=n.zoom)===null||s===void 0||s.call(n,{zoom:t})});P.useEffect(r,[t,r])}function Hi(){const{zoom:t}=Ot();return Kg(t)}function n2(t,e){var n;const r=typeof t=="function"?(n=t(e))!==null&&n!==void 0?n:Xg.maxZoom:t;return Math.max(r,1)}function r2(t,e){var n,r;let s={width:0,height:0},o={width:0,height:0};const{currentSlide:i}=fn(),{imageFit:a}=Ot().carousel,{maxZoomPixelRatio:l,maxZoom:c}=Hi();if(t&&i){const u={...i,...e};if(sr(u)){const f=fc(u,a),g=Math.max(...(((n=u.srcSet)===null||n===void 0?void 0:n.map(p=>p.width))||[]).concat(u.width?[u.width]:[])),m=Math.max(...(((r=u.srcSet)===null||r===void 0?void 0:r.map(p=>p.height))||[]).concat(u.height?[u.height]:[]));g>0&&m>0&&t.width>0&&t.height>0&&(o=f?{width:Math.round(Math.min(g,t.width/t.height*m)),height:Math.round(Math.min(m,t.height/t.width*g))}:{width:g,height:m},o={width:o.width*l,height:o.height*l},s=f?{width:Math.min(t.width,o.width,g),height:Math.min(t.height,o.height,m)}:{width:Math.round(Math.min(t.width,t.height/m*g,g)),height:Math.round(Math.min(t.height,t.width/g*m,m))})}else t.width>0&&t.height>0&&(e&&e.width>0&&e.height>0?s={width:Math.min(t.width,e.width),height:Math.min(t.height,e.height)}:s={width:t.width,height:t.height})}const d=i&&s.width?sr(i)?Math.max(uc(o.width/s.width,5),1):n2(c,i):1;return{imageRect:s,maxZoom:d}}function qg(t,e){return Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)}function Zg(t,e,n=100,r=2){return t*Math.min(1+Math.abs(e/n),r)**Math.sign(e)}function s2(t,e,n,r,s,o,i,a,l){const c=P.useRef([]),d=P.useRef(0),u=P.useRef(void 0),{globalIndex:f}=fn(),{getOwnerWindow:g}=rs(),{containerRef:m,subscribeSensors:p}=_n(),{keyboardMoveDistance:y,zoomInMultiplier:b,wheelZoomDistanceFactor:S,scrollToZoom:x,doubleTapDelay:E,doubleClickDelay:k,doubleClickMaxStops:C,pinchZoomDistanceFactor:N,pinchZoomV4:_}=Hi(),w=P.useCallback(z=>{if(m.current){const{pageX:H,pageY:W}=z,{scrollX:j,scrollY:U}=g(),{left:B,top:G,width:V,height:K}=m.current.getBoundingClientRect();return[H-B-j-V/2,W-G-U-K/2]}return[]},[m,g]),M=Ge(z=>{const{key:H,metaKey:W,ctrlKey:j}=z,U=W||j,B=()=>{z.preventDefault(),z.stopPropagation()};if(t>1){const G=(V,K)=>{B(),a(V,K)};H==="ArrowDown"?G(0,y):H==="ArrowUp"?G(0,-y):H==="ArrowLeft"?G(-y,0):H==="ArrowRight"&&G(y,0)}H==="+"||U&&H==="="?(B(),s()):H==="-"||U&&H==="_"?(B(),o()):U&&H==="0"&&(B(),i(1))}),O=Ge(z=>{if((z.ctrlKey||x)&&Math.abs(z.deltaY)>Math.abs(z.deltaX)){z.stopPropagation(),i(Zg(t,-z.deltaY,S),!0,...w(z));return}t>1&&(z.stopPropagation(),x||a(z.deltaX,z.deltaY))}),L=P.useCallback(z=>{const H=c.current;H.splice(0,H.length,...H.filter(W=>W.pointerId!==z.pointerId))},[]),F=P.useCallback(z=>{L(z),z.persist(),c.current.push(z)},[L]),$=Ge(z=>{var H;const W=c.current;if(z.pointerType==="mouse"&&z.buttons>1||!(!((H=l?.current)===null||H===void 0)&&H.contains(z.target)))return;t>1&&z.stopPropagation();const{timeStamp:j}=z;if(W.length===0&&j-d.current<(z.pointerType==="touch"?E:k)){d.current=0;const U=t>=1?t!==n?t*Math.max(n**(1/C),b):1:t!==e?t/Math.max(e**(-1/C),b):1;i(U,!1,...w(z))}else d.current=j;if(F(z),W.length===2){const U=qg(W[0],W[1]);u.current={previousDistance:U,initialDistance:Math.max(U,1),initialZoom:t}}}),D=Ge(z=>{const H=c.current,W=H.find(j=>j.pointerId===z.pointerId);if(H.length===2&&u.current){z.stopPropagation(),F(z);const j=qg(H[0],H[1]),U=_?u.current.initialZoom/u.current.initialDistance*j:Zg(t,j-u.current.previousDistance,N);i(U,!0,...H.map(B=>w(B)).reduce((B,G)=>G.map((V,K)=>B[K]+V/2))),u.current.previousDistance=j;return}t>1&&(z.stopPropagation(),W&&(H.length===1&&a((W.clientX-z.clientX)/t,(W.clientY-z.clientY)/t),F(z)))}),A=P.useCallback(z=>{const H=c.current;H.length===2&&H.find(W=>W.pointerId===z.pointerId)&&(u.current=void 0),L(z)},[L]),T=P.useCallback(()=>{const z=c.current;z.splice(0,z.length),d.current=0,u.current=void 0},[]);Pg(p,$,D,A,r),P.useEffect(T,[f,T]),P.useEffect(()=>r?()=>{}:ts(T,p(lc,M),p(cc,O)),[r,p,T,M,O])}function o2(t,e,n){const[r,s]=P.useState(1),[o,i]=P.useState(0),[a,l]=P.useState(0),c=e2(r,o,a,n),{currentSlide:d,globalIndex:u}=fn(),{containerRect:f,slideRect:g}=_n(),{minZoom:m,zoomInMultiplier:p}=Hi(),y=d&&sr(d)?d.src:void 0,b=!n?.current;Cn(()=>{s(1),i(0),l(0)},[u,y]);const S=P.useCallback((N,_,w)=>{const M=w||r,O=o-(N||0),L=a-(_||0),F=(t.width*M-g.width)/2/M,$=(t.height*M-g.height)/2/M;i(Math.min(Math.abs(O),Math.max(F,0))*Math.sign(O)),l(Math.min(Math.abs(L),Math.max($,0))*Math.sign(L))},[r,o,a,g,t.width,t.height]),x=P.useCallback((N,_,w,M)=>{const O=uc(N+.01m?N:m:e,5);_||c(),S(w?w*(1/r-1/O):0,M?M*(1/r-1/O):0,O),s(O)},[r,m,e,S,c]),E=Ge(()=>{r>1&&(r>e&&x(e,!0),S())});Cn(E,[f.width,f.height,E]);const k=P.useCallback(()=>{const N=r*p;x(r<1&&N>1?1:N)},[r,p,x]),C=P.useCallback(()=>{const N=r/p;x(r>1&&N<1?1:N)},[r,p,x]);return{zoom:r,offsetX:o,offsetY:a,disabled:b,changeOffsets:S,changeZoom:x,zoomIn:k,zoomOut:C}}const Qg=P.createContext(null),_c=an("useZoom","ZoomControllerContext",Qg);function i2({children:t}){const[e,n]=P.useState(),{slideRect:r}=_n(),{ref:s,minZoom:o}=Hi(),{imageRect:i,maxZoom:a}=r2(r,e?.imageDimensions),{zoom:l,offsetX:c,offsetY:d,disabled:u,changeZoom:f,changeOffsets:g,zoomIn:m,zoomOut:p}=o2(i,a,e?.zoomWrapperRef);t2(l,u),s2(l,o,a,u,m,p,f,g,e?.zoomWrapperRef);const y=P.useMemo(()=>({zoom:l,minZoom:o,maxZoom:a,offsetX:c,offsetY:d,disabled:u,zoomIn:m,zoomOut:p,changeZoom:f}),[l,o,a,c,d,u,m,p,f]);P.useImperativeHandle(s,()=>y,[y]);const b=P.useMemo(()=>({...y,setZoomWrapper:n}),[y,n]);return P.createElement(Qg.Provider,{value:b},t)}const a2=Zt("ZoomIn",P.createElement(P.Fragment,null,P.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),P.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),l2=Zt("ZoomOut",P.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),Jg=P.forwardRef(function({zoomIn:e,onLoseFocus:n},r){const s=P.useRef(!1),o=P.useRef(!1),{zoom:i,minZoom:a,maxZoom:l,zoomIn:c,zoomOut:d,disabled:u}=_c(),{render:f}=Ot(),g=u||(e?i>=l:i<=a);return P.useEffect(()=>{g&&s.current&&o.current&&n(),g||(s.current=!0)},[g,n]),P.createElement(os,{ref:r,disabled:g,label:e?"Zoom in":"Zoom out",icon:e?a2:l2,renderIcon:e?f.iconZoomIn:f.iconZoomOut,onClick:e?c:d,onFocus:()=>{o.current=!0},onBlur:()=>{o.current=!1}})});function c2(){const t=P.useRef(null),e=P.useRef(null),{focus:n}=_n(),r=P.useCallback(i=>{var a,l;!((a=i.current)===null||a===void 0)&&a.disabled?n():(l=i.current)===null||l===void 0||l.focus()},[n]),s=P.useCallback(()=>r(t),[r]),o=P.useCallback(()=>r(e),[r]);return P.createElement(P.Fragment,null,P.createElement(Jg,{zoomIn:!0,ref:t,onLoseFocus:o}),P.createElement(Jg,{ref:e,onLoseFocus:s}))}function d2(){const{render:t}=Ot(),e=_c();return t.buttonZoom?P.createElement(P.Fragment,null,t.buttonZoom(e)):P.createElement(c2,null)}function u2(t){var e;return(((e=t.srcSet)===null||e===void 0?void 0:e.length)||0)>0}function f2({current:t,preload:e},{type:n,source:r}){switch(n){case"fetch":return t?{current:t,preload:r}:{current:r};case"done":return r===e?{current:r}:{current:t,preload:e};default:throw new Error(gg)}}function h2(t){var e,n;const[{current:r,preload:s},o]=P.useReducer(f2,{}),{slide:i,rect:a,imageFit:l,render:c,interactive:d}=t,u=i.srcSet.sort((k,C)=>k.width-C.width),f=(e=i.width)!==null&&e!==void 0?e:u[u.length-1].width,g=(n=i.height)!==null&&n!==void 0?n:u[u.length-1].height,m=fc(i,l),p=Math.max(...u.map(k=>k.width)),y=Math.min((m?Math.max:Math.min)(a.width,f*(a.height/g)),p),b=a_(),S=Ge(()=>{var k;const C=(k=u.find(N=>N.width>=y*b))!==null&&k!==void 0?k:u[u.length-1];(!r||u.findIndex(N=>N.src===r)N===C))&&o({type:"fetch",source:C.src})});Cn(S,[a.width,a.height,b,S]);const x=Ge(k=>o({type:"done",source:k})),E={WebkitTransform:d?"initial":"translateZ(0)"};return m||Object.assign(E,a.width/a.heightx(s),render:{...c,iconLoading:()=>null,iconError:()=>null}}),r&&P.createElement(br,{key:"current",...t,slide:{...i,src:r,srcSet:void 0},style:E}))}function g2({render:t,slide:e,offset:n,rect:r}){var s;const[o,i]=P.useState(),a=P.useRef(null),l=sr(e),{zoom:c,maxZoom:d,offsetX:u,offsetY:f,setZoomWrapper:g}=_c(),m=c>1,{carousel:p,on:y}=Ot(),{currentIndex:b}=fn();Cn(()=>{if(n!==0||l||!a.current)return()=>{};const x=()=>{const k=a.current;if(!k)return;let C=0,N=0;for(const _ of k.children)_ instanceof HTMLElement&&(C=Math.max(C,_.offsetWidth),N=Math.max(N,_.offsetHeight));i(_=>_&&_.width===C&&_.height===N?_:{width:C,height:N})};if(x(),typeof ResizeObserver>"u")return()=>{};const E=new ResizeObserver(x);for(const k of a.current.children)E.observe(k);return()=>E.disconnect()},[n,l,r]),Cn(()=>n===0?(g({zoomWrapperRef:a,imageDimensions:o}),()=>g(void 0)):()=>{},[n,o,g]);let S=(s=t.slide)===null||s===void 0?void 0:s.call(t,{slide:e,offset:n,rect:r,zoom:c,maxZoom:d});if(!S&&l){const x={slide:e,offset:n,rect:r,render:t,imageFit:p.imageFit,imageProps:p.imageProps,onClick:n===0?()=>{var E;return(E=y.click)===null||E===void 0?void 0:E.call(y,{index:b})}:void 0};S=u2(e)?P.createElement(h2,{...x,slide:e,interactive:m,rect:n===0?{width:r.width*c,height:r.height*c}:r}):P.createElement(br,{onLoad:E=>i({width:E.naturalWidth,height:E.naturalHeight}),...x})}return S?P.createElement("div",{ref:a,className:Ft(Ne(sg),Ne(Rr),Ne(ig),m&&Ne(e_)),style:n===0?{transform:`scale(${c}) translateX(${u}px) translateY(${f}px)`}:void 0},S):null}const p2=({augment:t,addModule:e})=>{t(({zoom:n,toolbar:r,render:s,controller:o,...i})=>{const a=Kg(n);return{zoom:a,toolbar:Fi(r,rg,P.createElement(d2,null)),render:{...s,slide:l=>{var c,d;return sr(l.slide)||l.slide.type!=null&&(!((c=a.supports)===null||c===void 0)&&c.includes(l.slide.type))?P.createElement(g2,{render:s,...l}):(d=s.slide)===null||d===void 0?void 0:d.call(s,l)}},controller:{...o,preventDefaultWheelY:a.scrollToZoom},...i}}),e(un(rg,i2))},m2={separator:"/",container:{}},Rg=t=>({...m2,...t});function b2({counter:t}){const{slides:e,currentIndex:n}=fn(),{separator:r,container:{className:s,...o},className:i,...a}=Rg(t);return e.length===0?null:P.createElement("div",{className:Ft(Ne("counter"),s||i),...a,...o,"aria-hidden":!0},n+1," ",r," ",e.length)}function y2({augment:t,addChild:e}){t(({counter:n,...r})=>({counter:Rg(n),...r})),e(Rs,un(XS,b2))}const v2={autoplay:!1,delay:3e3,ref:null},ep=t=>({...v2,...t}),tp=P.createContext(null),x2=an("useSlideshow","SlideshowContext",tp);function w2({slideshow:t,carousel:{finite:e},on:n,children:r}){const{autoplay:s,delay:o,ref:i}=ep(t),a=P.useRef(s),[l,c]=P.useState(s),d=P.useRef(void 0),u=P.useRef(void 0),{slides:f,currentIndex:g}=fn(),{setTimeout:m,clearTimeout:p}=oo(),{subscribe:y}=ss(),{next:b}=_n(),{setAutoPlaying:S}=yc();P.useEffect(()=>S(l),[l,S]);const x=f.length===0||e&&g===f.length-1,E=P.useCallback(()=>{!l&&!x&&c(!0)},[l,x]),k=P.useCallback(()=>{l&&c(!1)},[l]),C=P.useCallback(()=>{p(d.current),d.current=void 0},[p]),N=Ge(()=>{C(),!(!l||x||u.current===Jr||u.current===oc)&&(d.current=m(()=>{l&&(u.current=void 0,b())},o))});P.useEffect(N,[g,l,N]),P.useEffect(()=>{l&&x&&c(!1)},[g,l,x]);const _=Ge(()=>{var O;return(O=n.slideshowStart)===null||O===void 0?void 0:O.call(n)}),w=Ge(()=>{var O;return(O=n.slideshowStop)===null||O===void 0?void 0:O.call(n)});P.useEffect(()=>{l?_():a.current&&w(),a.current=l},[l,_,w]),P.useEffect(()=>ts(C,y(qS,()=>{u.current=Jr,C()}),y(ZS,()=>{u.current=oc,C()}),y(QS,()=>{u.current=no,N()}),y(JS,()=>{u.current=ro,N()})),[y,C,N]);const M=P.useMemo(()=>({playing:l,disabled:x,play:E,pause:k}),[l,x,E,k]);return P.useImperativeHandle(i,()=>M,[M]),P.createElement(tp.Provider,{value:M},r)}const k2=Zt("Play",P.createElement("path",{d:"M8 5v14l11-7z"})),C2=Zt("Pause",P.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function S2(){const{playing:t,disabled:e,play:n,pause:r}=x2(),{render:s}=Ot(),o=Dg(_n().focus,e);return s.buttonSlideshow?P.createElement(P.Fragment,null,s.buttonSlideshow({playing:t,disabled:e,play:n,pause:r})):P.createElement(os,{label:t?"Pause":"Play",icon:t?C2:k2,renderIcon:t?s.iconSlideshowPause:s.iconSlideshowPlay,onClick:t?r:n,disabled:e,...o})}function _2({augment:t,addModule:e}){t(({slideshow:n,toolbar:r,...s})=>({toolbar:Fi(r,ng,P.createElement(S2,null)),slideshow:ep(n),...s})),e(un(ng,w2))}const E2={auto:!1,ref:null},np=t=>({...E2,...t}),rp=P.createContext(null),M2=an("useFullscreen","FullscreenContext",rp);function N2({fullscreen:t,on:e,children:n}){const{auto:r,ref:s}=np(t),o=P.useRef(null),[i,a]=P.useState(),[l,c]=P.useState(!1),d=P.useRef(!1),{getOwnerDocument:u}=rs();Cn(()=>{var x,E,k,C;const N=u();a(!((C=(k=(E=(x=N.fullscreenEnabled)!==null&&x!==void 0?x:N.webkitFullscreenEnabled)!==null&&E!==void 0?E:N.mozFullScreenEnabled)!==null&&k!==void 0?k:N.msFullscreenEnabled)!==null&&C!==void 0&&C))},[u]);const f=P.useCallback(()=>{var x;const E=u(),k=E.fullscreenElement||E.webkitFullscreenElement||E.mozFullScreenElement||E.msFullscreenElement;return((x=k?.shadowRoot)===null||x===void 0?void 0:x.fullscreenElement)||k},[u]),g=P.useCallback(()=>{const x=o.current;try{x.requestFullscreen?x.requestFullscreen().catch(()=>{}):x.webkitRequestFullscreen?x.webkitRequestFullscreen():x.mozRequestFullScreen?x.mozRequestFullScreen():x.msRequestFullscreen&&x.msRequestFullscreen()}catch{}},[]),m=P.useCallback(()=>{if(!f())return;const x=u();try{x.exitFullscreen?x.exitFullscreen().catch(()=>{}):x.webkitExitFullscreen?x.webkitExitFullscreen():x.mozCancelFullScreen?x.mozCancelFullScreen():x.msExitFullscreen&&x.msExitFullscreen()}catch{}},[f,u]);P.useEffect(()=>{const x=u(),E=()=>{c(f()===o.current)};return ts(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(k=>(x.addEventListener(k,E),()=>x.removeEventListener(k,E))))},[f,u]);const p=Ge(()=>{var x;return(x=e.enterFullscreen)===null||x===void 0?void 0:x.call(e)}),y=Ge(()=>{var x;return(x=e.exitFullscreen)===null||x===void 0?void 0:x.call(e)});P.useEffect(()=>{l&&(d.current=!0),d.current&&(l?p:y)()},[l,p,y]);const b=Ge(()=>{var x;return(x=r?g:null)===null||x===void 0||x(),m});P.useEffect(b,[b]);const S=P.useMemo(()=>({fullscreen:l,disabled:i,enter:g,exit:m}),[l,i,g,m]);return P.useImperativeHandle(s,()=>S,[S]),P.createElement("div",{ref:o,className:Ft(Ne(eo),Ne(sg))},P.createElement(rp.Provider,{value:S},n))}const O2=Zt("EnterFullscreen",P.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),T2=Zt("ExitFullscreen",P.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function A2(){var t;const{fullscreen:e,disabled:n,enter:r,exit:s}=M2(),{render:o}=Ot();return n?null:o.buttonFullscreen?P.createElement(P.Fragment,null,(t=o.buttonFullscreen)===null||t===void 0?void 0:t.call(o,{fullscreen:e,disabled:n,enter:r,exit:s})):P.createElement(os,{disabled:n,label:e?"Exit Fullscreen":"Enter Fullscreen",icon:e?T2:O2,renderIcon:e?o.iconExitFullscreen:o.iconEnterFullscreen,onClick:e?s:r})}function D2({augment:t,contains:e,addParent:n}){t(({fullscreen:r,toolbar:s,...o})=>({toolbar:Fi(s,eo,P.createElement(A2,null)),fullscreen:np(r),...o})),n(e(to)?to:Rs,un(eo,N2))}const vr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Ec=t=>({...vr,...t});function sp(){const{thumbnails:t}=Ot();return Ec(t)}const xr=t=>gr(to,t),Tt=t=>xr(gr("thumbnail",t)),I2=Zt("VideoThumbnail",P.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"})),L2=Zt("UnknownThumbnail",P.createElement("path",{d:"M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"}));function P2({slide:t,render:e,rect:n,imageFit:r}){var s;const o=(s=e.thumbnail)===null||s===void 0?void 0:s.call(e,{slide:t,render:e,rect:n,imageFit:r});if(o)return o;const i={render:e,rect:n,imageFit:r};if(t.thumbnail)return P.createElement(br,{slide:{src:t.thumbnail},...i});if(sr(t))return P.createElement(br,{slide:t,...i});const a=Ne(Tt(Li));return t.type==="video"?P.createElement(P.Fragment,null,t.poster&&P.createElement(br,{slide:{src:t.poster},...i}),P.createElement(I2,{className:a})):P.createElement(L2,{className:a})}const $2=pr("active"),Mc=pr("fadein"),Nc=pr("fadeout"),F2=pr("placeholder"),op="delay",ip="duration";function z2({slide:t,index:e,onClick:n,fadeIn:r,fadeOut:s,placeholder:o,onLoseFocus:i}){const a=P.useRef(null),{render:l,styles:c,labels:d}=Ot(),{slides:u,globalIndex:f}=fn(),{getOwnerDocument:g}=rs(),{width:m,height:p,imageFit:y}=sp(),b={width:m,height:p},S=e===f,x=Ge(i);return P.useEffect(()=>{s&&g().activeElement===a.current&&x()},[s,x,g]),P.createElement("button",{ref:a,type:"button",className:Ft(Ne(Rr),Ne(Tt()),S&&Ne(Tt($2())),r&&Ne(Tt(Mc())),s&&Ne(Tt(Nc())),o&&Ne(Tt(F2()))),style:{...r?{[dt(Tt(Mc(ip)))]:`${r.duration}ms`,[dt(Tt(Mc(op)))]:`${r.delay}ms`}:null,...s?{[dt(Tt(Nc(ip)))]:`${s.duration}ms`,[dt(Tt(Nc(op)))]:`${s.delay}ms`}:null,...c.thumbnail},onClick:n,"aria-current":S?!0:void 0,"aria-label":mg(d,u,e)},t&&P2({slide:t,render:l,rect:b,imageFit:y}))}function ap(t){return["top","bottom"].includes(t)}function lp(t,e){return e+2*(t.border+t.padding)+t.gap}function V2(t){const{thumbnail:e,poster:n}=t||{thumbnail:"placeholder"};return typeof e=="string"&&e||typeof n=="string"&&n||t&&bg(t)||void 0}function cp({visible:t,containerRef:e}){const n=P.useRef(null),r=Vi(),{publish:s,subscribe:o}=ss(),{carousel:i,styles:a,labels:l}=Ot(),{slides:c,globalIndex:d,animation:u}=fn(),{registerSensors:f,subscribeSensors:g}=Ig();Hg(g);const m=sp(),{position:p,width:y,height:b,border:S,borderStyle:x,borderColor:E,borderRadius:k,padding:C,gap:N,vignette:_}=m,w=u?.duration!==void 0&&u?.increment||0,M=u?.duration||0,{prepareAnimation:O}=xc(n,A=>({keyframes:ap(p)?[{transform:`translateX(${(r?-1:1)*lp(m,y)*w+A}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${lp(m,b)*w+A}px)`},{transform:"translateY(0)"}],duration:M,easing:u?.easing})),L=Ge(()=>{let A=0;if(e.current&&n.current){const T=e.current.getBoundingClientRect(),z=n.current.getBoundingClientRect();A=ap(p)?z.left-T.left-(T.width-z.width)/2:z.top-T.top-(T.height-z.height)/2}O(A)});P.useEffect(()=>ts(o(ac,L)),[o,L]);const F=yg(i,c),$=[];if(gc(c))for(let A=d-F-Math.abs(w);A<=d+F+Math.abs(w);A+=1){const z=i.finite&&(A<0||A>c.length-1)||w<0&&A0&&A>d+F?null:pc(c,A),H=[`${A}`,V2(z)].filter(Boolean).join("|");$.push({key:H,index:A,slide:z})}const D=A=>()=>{A>d?s(rr,{count:A-d}):A{const H=M/Math.abs(w||1),W=w>0&&T>d+F-w&&T<=d+F||w<0&&T=d-F?{duration:H,delay:((w>0?T-(d+F-w):d-F-w-T)-1)*H}:void 0,j=w>0&&Td+F?{duration:H,delay:(w>0?w-(d-F-T):-w-(T-(d+F)))*H}:void 0;return P.createElement(z2,{key:A,index:T,slide:z,fadeIn:W,fadeOut:j,placeholder:!z,onClick:D(T),onLoseFocus:()=>{var U;return(U=n.current)===null||U===void 0?void 0:U.focus()}})})),_&&P.createElement("div",{className:Ne(xr("vignette"))}))}const dp=P.createContext(null),H2=an("useThumbnails","ThumbnailsContext",dp);function U2({children:t,...e}){const{ref:n,position:r,hidden:s}=Ec(e.thumbnails),[o,i]=P.useState(!s),a=P.useRef(null),l=P.useMemo(()=>({visible:o,show:()=>i(!0),hide:()=>i(!1)}),[o]);return P.useImperativeHandle(n,()=>l,[l]),P.createElement(Sg,{...e},P.createElement(dp.Provider,{value:l},P.createElement("div",{ref:a,className:Ft(Ne(xr()),Ne(xr(`${r}`)))},["start","top"].includes(r)&&P.createElement(cp,{containerRef:a,visible:o}),P.createElement("div",{className:Ne(xr("wrapper"))},t),["end","bottom"].includes(r)&&P.createElement(cp,{containerRef:a,visible:o}))))}const up=()=>P.createElement(P.Fragment,null,P.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),P.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),B2=Zt("ThumbnailsVisible",up()),j2=w_("ThumbnailsHidden",up());function W2(){const{visible:t,show:e,hide:n}=H2(),{render:r}=Ot();return r.buttonThumbnails?P.createElement(P.Fragment,null,r.buttonThumbnails({visible:t,show:e,hide:n})):P.createElement(os,{label:t?"Hide thumbnails":"Show thumbnails",icon:t?B2:j2,renderIcon:t?r.iconThumbnailsVisible:r.iconThumbnailsHidden,onClick:t?n:e})}function G2({augment:t,contains:e,append:n,addParent:r}){t(({thumbnails:o,toolbar:i,...a})=>{const l=Ec(o);return{toolbar:Fi(i,to,l.showToggle?P.createElement(W2,null):null),thumbnails:l,...a}});const s=un(to,U2);e(eo)?n(eo,s):r(Rs,s)}const Y2=window.G7Core?.createLogger?.("Comp:ImageGallery")??{log:(...t)=>console.log("[Comp:ImageGallery]",...t),warn:(...t)=>console.warn("[Comp:ImageGallery]",...t),error:(...t)=>console.error("[Comp:ImageGallery]",...t)},Oc=window.G7Core,Ui=(t,e)=>Oc?.t?.(t,e)??t,X2=async(t,e)=>{try{const n=await Oc.api.get(t,{responseType:"blob"});if(n){const r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}catch(n){Y2.error("Failed to download file:",n),Oc?.toast?.error?.(Ui("common.download_failed"))}},K2=(t,e)=>{const n=document.createElement("a");n.href=t,n.download=e,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)},Tc=async t=>{const e=t.downloadUrl||t.src,n=t.filename||t.title||"image";t.downloadRequiresAuth?await X2(e,n):K2(e,n)},q2=({image:t,index:e,onDownload:n})=>{const[r,s]=v.useState(!1),o=async i=>{if(i.stopPropagation(),n){n(t,e);return}s(!0);try{await Tc(t)}finally{s(!1)}};return h.jsx(oe,{type:"button",onClick:o,disabled:r,className:"yarl__button flex items-center justify-center","aria-label":Ui("common.download"),title:Ui("common.download"),children:r?h.jsx(pt,{className:"fa-solid fa-spinner fa-spin text-white"}):h.jsx(pt,{className:"fa-solid fa-download text-white"})})},Bi=({images:t,isOpen:e,onClose:n,startIndex:r=0,enableZoom:s=!0,enableSlideshow:o=!1,enableFullscreen:i=!0,showCounter:a=!0,showDownload:l=!0,showThumbnails:c=!0,onDownload:d,editorAttrs:u,id:f})=>{const[g,m]=v.useState(r),p=v.useRef(r),y=t.map(x=>({src:x.src,title:x.title,description:x.description})),b=[];s&&b.push(p2),o&&b.push(_2),i&&b.push(D2),a&&b.push(y2),c&&b.push(G2);const S=t[g];if(v.useEffect(()=>{p.current=g},[g]),u){const x=(t??[]).slice(0,4);return h.jsx(I,{id:f,className:"grid grid-cols-2 gap-2 p-3 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",...u,children:x.length>0?x.map((E,k)=>h.jsx(yn,{src:E.thumbnail||E.src,alt:E.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},k)):h.jsxs(I,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[h.jsx(pt,{className:"fa-regular fa-images mr-2"}),Ui("editor.component.image_gallery")]})})}return h.jsx(J_,{open:e,close:n,slides:y,index:g,plugins:b,on:{view:({index:x})=>{x!==p.current&&m(x)}},zoom:{maxZoomPixelRatio:3,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:300,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,scrollToZoom:!0},carousel:{finite:!0,preload:2,padding:"16px",spacing:"30%"},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},controller:{closeOnBackdropClick:!0,closeOnPullDown:!0,closeOnPullUp:!0},thumbnails:{position:"bottom",width:120,height:80,border:2,borderRadius:4,padding:4,gap:16,showToggle:!1,vignette:!0},toolbar:{buttons:[l&&S&&h.jsx(q2,{image:S,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},fp=()=>{const[t,e]=v.useState(!1),[n,r]=v.useState([]),[s,o]=v.useState(0),i=v.useCallback((l,c=0)=>{r(l),o(c),e(!0)},[]),a=v.useCallback(()=>{e(!1)},[]);return{isOpen:t,openGallery:i,closeGallery:a,galleryProps:{images:n,isOpen:t,onClose:a,startIndex:s}}};Bi.displayName="ImageGallery";const Z2=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Bi,executeImageDownload:Tc,useImageGallery:fp},Symbol.toStringTag,{value:"Module"})),Q2=v.createContext(null),J2=({value:t,children:e})=>h.jsx(Q2.Provider,{value:t,children:e});function R2(t,e){return e.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in t)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(t)}function hp(t,e){return new Promise((function(n,r){let s;return eE(t).then((function(o){try{return s=o,n(new Blob([e.slice(0,2),s,e.slice(2)],{type:"image/jpeg"}))}catch(i){return r(i)}}),r)}))}const eE=t=>new Promise(((e,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let i=0;if(o.getUint16(i)!==65496)return n("not a valid JPEG");for(i+=2;;){const a=o.getUint16(i);if(a===65498)break;const l=o.getUint16(i+2);if(a===65505&&o.getUint32(i+4)===1165519206){const c=i+10;let d;switch(o.getUint16(c)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(c+2,d)!==42)return n("TIFF header contains invalid version");const u=o.getUint32(c+4,d),f=c+u+2+12*o.getUint16(c+u,d);for(let g=c+u+2;g>>24&255,a[i+1]=l>>>16&255,a[i+2]=l>>>8&255,a[i+3]=l>>>0&255,new Uint8Array(a.buffer,0,i+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var i=new Uint8Array(50+Math.floor(1.1*s.length)),a=r.F.deflateRaw(s,i,a,o.level);return new Uint8Array(i.buffer,0,a)},r.encode=function(s,o){o==null&&(o=!1);var i=0,a=r.bin.writeUint,l=r.bin.writeUshort,c={};for(var d in s){var u=!r._noNeed(d)&&!o,f=s[d],g=r.crc.crc(f,0,f.length);c[d]={cpr:u,usize:f.length,crc:g,file:u?r.deflateRaw(f):f}}for(var d in c)i+=c[d].file.length+30+46+2*r.bin.sizeUTF8(d);i+=22;var m=new Uint8Array(i),p=0,y=[];for(var d in c){var b=c[d];y.push(p),p=r._writeHeader(m,p,d,b,0)}var S=0,x=p;for(var d in c)b=c[d],y.push(p),p=r._writeHeader(m,p,d,b,1,y[S++]);var E=p-x;return a(m,p,101010256),p+=4,l(m,p+=4,S),l(m,p+=2,S),a(m,p+=2,E),a(m,p+=4,x),p+=4,p+=2,m.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,i,a,l,c){var d=r.bin.writeUint,u=r.bin.writeUshort,f=a.file;return d(s,o,l==0?67324752:33639248),o+=4,l==1&&(o+=2),u(s,o,20),u(s,o+=2,0),u(s,o+=2,a.cpr?8:0),d(s,o+=2,0),d(s,o+=4,a.crc),d(s,o+=4,f.length),d(s,o+=4,a.usize),u(s,o+=4,r.bin.sizeUTF8(i)),u(s,o+=2,0),o+=2,l==1&&(o+=2,o+=2,d(s,o+=6,c),o+=4),o+=r.bin.writeUTF8(s,o,i),l==0&&(s.set(f,o),o+=f.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var i=o,a=0;a<8;a++)1&i?i=3988292384^i>>>1:i>>>=1;s[o]=i}return s})(),update:function(s,o,i,a){for(var l=0;l>>8;return s},crc:function(s,o,i){return 4294967295^r.crc.update(4294967295,s,o,i)}},r.adler=function(s,o,i){for(var a=1,l=0,c=o,d=o+i;c>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255,s[o+2]=i>>16&255,s[o+3]=i>>24&255},readASCII:function(s,o,i){for(var a="",l=0;l>6,s[o+l+1]=128|d>>0&63,l+=2;else if((4294901760&d)==0)s[o+l]=224|d>>12,s[o+l+1]=128|d>>6&63,s[o+l+2]=128|d>>0&63,l+=3;else{if((4292870144&d)!=0)throw"e";s[o+l]=240|d>>18,s[o+l+1]=128|d>>12&63,s[o+l+2]=128|d>>6&63,s[o+l+3]=128|d>>0&63,l+=4}}return l},sizeUTF8:function(s){for(var o=s.length,i=0,a=0;a>>3}var y=c.lits,b=c.strt,S=c.prev,x=0,E=0,k=0,C=0,N=0,_=0;for(p>2&&(b[_=r.F._hash(s,0)]=0),f=0;f14e3||E>26697)&&p-f>100&&(m>>16,L=65535&M;if(M!=0){L=65535&M;var F=d(O=M>>>16,c.of0);c.lhst[257+F]++;var $=d(L,c.df0);c.dhst[$]++,C+=c.exb[F]+c.dxb[$],y[x]=O<<23|f-m,y[x+1]=L<<16|F<<8|$,x+=2,m=f+O}else c.lhst[s[f]]++;E++}}for(k==f&&s.length!=0||(m>>3},r.F._bestMatch=function(s,o,i,a,l,c){var d=32767&o,u=i[d],f=d-u+32768&32767;if(u==d||a!=r.F._hash(s,o-f))return 0;for(var g=0,m=0,p=Math.min(32767,o);f<=p&&--c!=0&&u!=d;){if(g==0||s[o+g]==s[o+g-f]){var y=r.F._howLong(s,o,f);if(y>g){if(m=f,(g=y)>=l)break;f+2b&&(b=E,u=x)}}}f+=(d=u)-(u=i[d])+32768&32767}return g<<16|m},r.F._howLong=function(s,o,i){if(s[o]!=s[o-i]||s[o+1]!=s[o+1-i]||s[o+2]!=s[o+2-i])return 0;var a=o,l=Math.min(s.length,o+258);for(o+=3;o>>23,j=T+(8388607&H);T>16,G=U>>8&255,V=255&U;_(u,f=r.F._writeLit(257+G,$,u,f),W-C.of0[G]),f+=C.exb[G],N(u,f=r.F._writeLit(V,D,u,f),B-C.df0[V]),f+=C.dxb[V],T+=W}}f=r.F._writeLit(256,$,u,f)}return f},r.F._copyExact=function(s,o,i,a,l){var c=l>>>3;return a[c]=i,a[c+1]=i>>>8,a[c+2]=255-a[c],a[c+3]=255-a[c+1],c+=4,a.set(new Uint8Array(s.buffer,o,i),c),l+(i+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),i=r.F._hufTree(s.dhst,s.dtree,15),a=[],l=r.F._lenCodes(s.ltree,a),c=[],d=r.F._lenCodes(s.dtree,c),u=0;u4&&s.itree[1+(s.ordr[g-1]<<1)]==0;)g--;return[o,i,f,l,d,g,a,c]},r.F.getSecond=function(s){for(var o=[],i=0;i>1)+",");return o},r.F.contSize=function(s,o){for(var i=0,a=0;a15&&(r.F._putsE(i,a,d,u),a+=u)}return a},r.F._lenCodes=function(s,o){for(var i=s.length;i!=2&&s[i-1]==0;)i-=2;for(var a=0;a>>1,138))<11?o.push(17,g-3):o.push(18,g-11),a+=2*g-2}else if(l==u&&c==l&&d==l){for(f=a+5;f+2>>1,6);o.push(16,g-3),a+=2*g-2}else o.push(l,0)}return i>>>1},r.F._hufTree=function(s,o,i){var a=[],l=s.length,c=o.length,d=0;for(d=0;di&&(r.F.restrictDepth(f,i,x),x=i),d=0;do;a++){var d=s[a].d;s[a].d=o,c+=l-(1<>>=i-o;c>0;)(d=s[a].d)=0;a--)s[a].d==o&&c<0&&(s[a].d--,c++);c!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var i=0;return o[16|i]<=s&&(i|=16),o[8|i]<=s&&(i|=8),o[4|i]<=s&&(i|=4),o[2|i]<=s&&(i|=2),o[1|i]<=s&&(i|=1),i},r.F._writeLit=function(s,o,i,a){return r.F._putsF(i,a,o[s<<1]),a+o[1+(s<<1)]},r.F.inflate=function(s,o){var i=Uint8Array;if(s[0]==3&&s[1]==0)return o||new i(0);var a=r.F,l=a._bitsF,c=a._bitsE,d=a._decodeTiny,u=a.makeCodes,f=a.codes2map,g=a._get17,m=a.U,p=o==null;p&&(o=new i(s.length>>>2<<3));for(var y,b,S=0,x=0,E=0,k=0,C=0,N=0,_=0,w=0,M=0;S==0;)if(S=l(s,M,1),x=l(s,M+1,2),M+=3,x!=0){if(p&&(o=r.F._check(o,w+131072)),x==1&&(y=m.flmap,b=m.fdmap,N=511,_=31),x==2){E=c(s,M,5)+257,k=c(s,M+5,5)+1,C=c(s,M+10,4)+4,M+=14;for(var O=0;O<38;O+=2)m.itree[O]=0,m.itree[O+1]=0;var L=1;for(O=0;OL&&(L=F)}M+=3*C,u(m.itree,L),f(m.itree,L,m.imap),y=m.lmap,b=m.dmap,M=d(m.imap,(1<>>4;if(!(T>>>8))o[w++]=T;else{if(T==256)break;var z=w+T-254;if(T>264){var H=m.ldef[T-257];z=w+(H>>>3)+c(s,M,7&H),M+=7&H}var W=b[g(s,M)&_];M+=15&W;var j=W>>>4,U=m.ddef[j],B=(U>>>4)+l(s,M,15&U);for(M+=15&U,p&&(o=r.F._check(o,w+131072));w>>3),V=s[G-4]|s[G-3]<<8;p&&(o=r.F._check(o,w+V)),o.set(new i(s.buffer,s.byteOffset+G,V),w),M=G+V<<3,w+=V}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var i=s.length;if(o<=i)return s;var a=new Uint8Array(Math.max(i<<1,o));return a.set(s,0),a},r.F._decodeTiny=function(s,o,i,a,l,c){for(var d=r.F._bitsE,u=r.F._get17,f=0;f>>4;if(m<=15)c[f]=m,f++;else{var p=0,y=0;m==16?(y=3+d(a,l,2),l+=2,p=c[f-1]):m==17?(y=3+d(a,l,3),l+=3):m==18&&(y=11+d(a,l,7),l+=7);for(var b=f+y;f>>1;cl&&(l=u),c++}for(;c>1,u=s[c+1],f=d<<4|u,g=o-u,m=s[c]<>>15-o]=f,m++},r.F.revCodes=function(s,o){for(var i=r.F.U.rev15,a=15-o,l=0;l>>a}},r.F._putsE=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8},r.F._putsF=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8,s[a+2]|=i>>>16},r.F._bitsE=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(e=Uint16Array,n=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var i=o;i=(4278255360&(i=(4042322160&(i=(3435973836&(i=(2863311530&i)>>>1|(1431655765&i)<<1))>>>2|(858993459&i)<<2))>>>4|(252645135&i)<<4))>>>8|(16711935&i)<<8,s.rev15[o]=(i>>>16|i<<16)>>>17}function a(l,c,d){for(;c--!=0;)l.push(0,d)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];a(s.fltree,144,8),a(s.fltree,112,9),a(s.fltree,24,7),a(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),a(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),a(s.itree,19,0),a(s.ltree,286,0),a(s.dtree,30,0),a(s.ttree,320,0)})()})();var nE=R2({__proto__:null,default:ji},[ji]);const En=(function(){var t={nextZero(d,u){for(;d[u]!=0;)u++;return u},readUshort:(d,u)=>d[u]<<8|d[u+1],writeUshort(d,u,f){d[u]=f>>8&255,d[u+1]=255&f},readUint:(d,u)=>16777216*d[u]+(d[u+1]<<16|d[u+2]<<8|d[u+3]),writeUint(d,u,f){d[u]=f>>24&255,d[u+1]=f>>16&255,d[u+2]=f>>8&255,d[u+3]=255&f},readASCII(d,u,f){let g="";for(let m=0;md.length<2?`0${d}`:d,readUTF8(d,u,f){let g,m="";for(let p=0;p>3)]>>7-((7&C)<<0)&1);b[w]=H[F],b[w+1]=H[F+1],b[w+2]=H[F+2],b[w+3]=$>2)]>>6-((3&C)<<1)&3),b[w]=H[F],b[w+1]=H[F+1],b[w+2]=H[F+2],b[w+3]=$>1)]>>4-((1&C)<<2)&15),b[w]=H[F],b[w+1]=H[F+1],b[w+2]=H[F+2],b[w+3]=$>>3)]>>>7-(7&T)&1))==255*_?0:255;S[W+T]=z<<24|D<<16|D<<8|D}else if(E==2)for(T=0;T>>2)]>>>6-((3&T)<<1)&3))==85*_?0:255,S[W+T]=z<<24|D<<16|D<<8|D;else if(E==4)for(T=0;T>>1)]>>>4-((1&T)<<2)&15))==17*_?0:255,S[W+T]=z<<24|D<<16|D<<8|D;else if(E==8)for(T=0;T>3,_=Math.ceil(E*C/8),w=new Uint8Array(k*_);let M=0;const O=[0,0,4,0,2,0,1],L=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],$=[8,8,4,4,2,2,1];let D=0;for(;D<7;){const T=F[D],z=$[D];let H=0,W=0,j=O[D];for(;j>3])>>7-(7&X)&1,w[V*_+(K>>3)]|=A<<7-((7&K)<<0)),C==2&&(A=(A=S[X>>3])>>6-(7&X)&3,w[V*_+(K>>2)]|=A<<6-((3&K)<<1)),C==4&&(A=(A=S[X>>3])>>4-(7&X)&15,w[V*_+(K>>1)]|=A<<4-((1&K)<<2)),C>=8){const Z=V*_+K*N;for(let ee=0;ee>3)+ee]}X+=C,K+=z}G++,V+=T}H*W!=0&&(M+=W*(1+B)),D+=1}return w})(u,d)),u}function r(d,u){return s(new Uint8Array(d.buffer,2,d.length-6),u)}var s=(function(){const d={H:{}};return d.H.N=function(u,f){const g=Uint8Array;let m,p,y=0,b=0,S=0,x=0,E=0,k=0,C=0,N=0,_=0;if(u[0]==3&&u[1]==0)return f||new g(0);const w=d.H,M=w.b,O=w.e,L=w.R,F=w.n,$=w.A,D=w.Z,A=w.m,T=f==null;for(T&&(f=new g(u.length>>>2<<5));y==0;)if(y=M(u,_,1),b=M(u,_+1,2),_+=3,b!=0){if(T&&(f=d.H.W(f,N+(1<<17))),b==1&&(m=A.J,p=A.h,k=511,C=31),b==2){S=O(u,_,5)+257,x=O(u,_+5,5)+1,E=O(u,_+10,4)+4,_+=14;let H=1;for(var z=0;z<38;z+=2)A.Q[z]=0,A.Q[z+1]=0;for(z=0;zH&&(H=U)}_+=3*E,F(A.Q,H),$(A.Q,H,A.u),m=A.w,p=A.d,_=L(A.u,(1<>>4;if(!(W>>>8))f[N++]=W;else{if(W==256)break;{let j=N+W-254;if(W>264){const K=A.q[W-257];j=N+(K>>>3)+O(u,_,7&K),_+=7&K}const U=p[D(u,_)&C];_+=15&U;const B=U>>>4,G=A.c[B],V=(G>>>4)+M(u,_,15&G);for(_+=15&G;N>>3),W=u[H-4]|u[H-3]<<8;T&&(f=d.H.W(f,N+W)),f.set(new g(u.buffer,u.byteOffset+H,W),N),_=H+W<<3,N+=W}return f.length==N?f:f.slice(0,N)},d.H.W=function(u,f){const g=u.length;if(f<=g)return u;const m=new Uint8Array(g<<1);return m.set(u,0),m},d.H.R=function(u,f,g,m,p,y){const b=d.H.e,S=d.H.Z;let x=0;for(;x>>4;if(k<=15)y[x]=k,x++;else{let C=0,N=0;k==16?(N=3+b(m,p,2),p+=2,C=y[x-1]):k==17?(N=3+b(m,p,3),p+=3):k==18&&(N=11+b(m,p,7),p+=7);const _=x+N;for(;x<_;)y[x]=C,x++}}return p},d.H.V=function(u,f,g,m){let p=0,y=0;const b=m.length>>>1;for(;yp&&(p=S),y++}for(;y>1,S=u[y+1],x=b<<4|S,E=f-S;let k=u[y]<>>15-f]=x,k++}},d.H.l=function(u,f){const g=d.H.m.r,m=15-f;for(let p=0;p>>m}},d.H.M=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8},d.H.I=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8,u[m+2]|=g>>>16},d.H.e=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)&(1<>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16|u[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=(function(){const u=Uint16Array,f=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new f(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new u(65536),g:new u(32768)}})(),(function(){const u=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,u.r[f]=(m>>>16|m<<16)>>>17}function g(m,p,y){for(;p--!=0;)m.push(0,y)}for(f=0;f<32;f++)u.q[f]=u.S[f]<<3|u.T[f],u.c[f]=u.p[f]<<4|u.z[f];g(u._,144,8),g(u._,112,9),g(u._,24,7),g(u._,8,8),d.H.n(u._,9),d.H.A(u._,9,u.J),d.H.l(u._,9),g(u.$,32,5),d.H.n(u.$,5),d.H.A(u.$,5,u.h),d.H.l(u.$,5),g(u.Q,19,0),g(u.C,286,0),g(u.D,30,0),g(u.v,320,0)})(),d.H.N})();function o(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function i(d,u,f,g,m){let p=o(u);const y=Math.ceil(g*p/8);let b,S;p=Math.ceil(p/8);let x=d[f],E=0;if(x>1&&(d[f]=[0,0,1][x-2]),x==3)for(E=p;E>>1)&255;for(let k=0;k>>1);for(;E>>1)}else{for(;E=0&&b>=0?(k=D*u+A<<2,C=(b+D)*m+y+A<<2):(k=(-b+D)*u-y+A<<2,C=D*m+A<<2),S==0)g[C]=d[k],g[C+1]=d[k+1],g[C+2]=d[k+2],g[C+3]=d[k+3];else if(S==1){var N=d[k+3]*.00392156862745098,_=d[k]*N,w=d[k+1]*N,M=d[k+2]*N,O=g[C+3]*(1/255),L=g[C]*O,F=g[C+1]*O,$=g[C+2]*O;const T=1-N,z=N+O*T,H=z==0?0:1/z;g[C+3]=255*z,g[C+0]=(_+L*T)*H,g[C+1]=(w+F*T)*H,g[C+2]=(M+$*T)*H}else if(S==2)N=d[k+3],_=d[k],w=d[k+1],M=d[k+2],O=g[C+3],L=g[C],F=g[C+1],$=g[C+2],N==O&&_==L&&w==F&&M==$?(g[C]=0,g[C+1]=0,g[C+2]=0,g[C+3]=0):(g[C]=_,g[C+1]=w,g[C+2]=M,g[C+3]=N);else if(S==3){if(N=d[k+3],_=d[k],w=d[k+1],M=d[k+2],O=g[C+3],L=g[C],F=g[C+1],$=g[C+2],N==O&&_==L&&w==F&&M==$)continue;if(N<220&&O>20)return!1}return!0}return{decode:function(u){const f=new Uint8Array(u);let g=8;const m=t,p=m.readUshort,y=m.readUint,b={tabs:{},frames:[]},S=new Uint8Array(f.length);let x,E=0,k=0;const C=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(f[N]!=C[N])throw"The input is not a PNG file!";for(;g>>1:M>>>=1;_[w]=M}return _})(),update(_,w,M,O){for(let L=0;L>>8;return _},crc:(_,w,M)=>4294967295^r.update(4294967295,_,w,M)};function s(_,w,M,O){w[M]+=_[0]*O>>4,w[M+1]+=_[1]*O>>4,w[M+2]+=_[2]*O>>4,w[M+3]+=_[3]*O>>4}function o(_){return Math.max(0,Math.min(255,_))}function i(_,w){const M=_[0]-w[0],O=_[1]-w[1],L=_[2]-w[2],F=_[3]-w[3];return M*M+O*O+L*L+F*F}function a(_,w,M,O,L,F,$){$==null&&($=1);const D=O.length,A=[];for(var T=0;T>>0&255,V>>>8&255,V>>>16&255,V>>>24&255])}for(T=0;T>2]=z,j[T>>2]=O[z]}}function l(_,w,M,O,L){L==null&&(L={});const{crc:F}=r,$=e.writeUint,D=e.writeUshort,A=e.writeASCII;let T=8;const z=_.frames.length>1;let H,W=!1,j=33+(z?20:0);if(L.sRGB!=null&&(j+=13),L.pHYs!=null&&(j+=21),L.iCCP!=null&&(H=pako.deflate(L.iCCP),j+=21+H.length+4),_.ctype==3){for(var U=_.plte.length,B=0;B>>24!=255&&(W=!0);j+=8+3*U+4+(W?8+1*U+4:0)}for(var G=0;G<_.frames.length;G++)z&&(j+=38),j+=(Z=_.frames[G]).cimg.length+12,G!=0&&(j+=4);j+=12;const V=new Uint8Array(j),K=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)V[B]=K[B];if($(V,T,13),T+=4,A(V,T,"IHDR"),T+=4,$(V,T,w),T+=4,$(V,T,M),T+=4,V[T]=_.depth,T++,V[T]=_.ctype,T++,V[T]=0,T++,V[T]=0,T++,V[T]=0,T++,$(V,T,F(V,T-17,17)),T+=4,L.sRGB!=null&&($(V,T,1),T+=4,A(V,T,"sRGB"),T+=4,V[T]=L.sRGB,T++,$(V,T,F(V,T-5,5)),T+=4),L.iCCP!=null){const ee=13+H.length;$(V,T,ee),T+=4,A(V,T,"iCCP"),T+=4,A(V,T,"ICC profile"),T+=11,T+=2,V.set(H,T),T+=H.length,$(V,T,F(V,T-(ee+4),ee+4)),T+=4}if(L.pHYs!=null&&($(V,T,9),T+=4,A(V,T,"pHYs"),T+=4,$(V,T,L.pHYs[0]),T+=4,$(V,T,L.pHYs[1]),T+=4,V[T]=L.pHYs[2],T++,$(V,T,F(V,T-13,13)),T+=4),z&&($(V,T,8),T+=4,A(V,T,"acTL"),T+=4,$(V,T,_.frames.length),T+=4,$(V,T,L.loop!=null?L.loop:0),T+=4,$(V,T,F(V,T-12,12)),T+=4),_.ctype==3){for($(V,T,3*(U=_.plte.length)),T+=4,A(V,T,"PLTE"),T+=4,B=0;B>>8&255,ce=ne>>>16&255;V[T+ee+0]=he,V[T+ee+1]=J,V[T+ee+2]=ce}if(T+=3*U,$(V,T,F(V,T-3*U-4,3*U+4)),T+=4,W){for($(V,T,U),T+=4,A(V,T,"tRNS"),T+=4,B=0;B>>24&255;T+=U,$(V,T,F(V,T-U-4,U+4)),T+=4}}let X=0;for(G=0;G<_.frames.length;G++){var Z=_.frames[G];z&&($(V,T,26),T+=4,A(V,T,"fcTL"),T+=4,$(V,T,X++),T+=4,$(V,T,Z.rect.width),T+=4,$(V,T,Z.rect.height),T+=4,$(V,T,Z.rect.x),T+=4,$(V,T,Z.rect.y),T+=4,D(V,T,O[G]),T+=2,D(V,T,1e3),T+=2,V[T]=Z.dispose,T++,V[T]=Z.blend,T++,$(V,T,F(V,T-30,30)),T+=4);const ee=Z.cimg;$(V,T,(U=ee.length)+(G==0?0:4)),T+=4;const ne=T;A(V,T,G==0?"IDAT":"fdAT"),T+=4,G!=0&&($(V,T,X++),T+=4),V.set(ee,T),T+=U,$(V,T,F(V,ne,T-ne)),T+=4}return $(V,T,0),T+=4,A(V,T,"IEND"),T+=4,$(V,T,F(V,T-4,4)),T+=4,V.buffer}function c(_,w,M){for(let O=0;O<_.frames.length;O++){const L=_.frames[O];L.rect.width;const F=L.rect.height,$=new Uint8Array(F*L.bpl+F);L.cimg=g(L.img,F,L.bpp,L.bpl,$,w,M)}}function d(_,w,M,O,L){const F=L[0],$=L[1],D=L[2],A=L[3],T=L[4],z=L[5];let H=6,W=8,j=255;for(var U=0;U<_.length;U++){const ve=new Uint8Array(_[U]);for(var B=ve.length,G=0;GHe&&(He=gt),itDe&&(De=it));He==-1&&($e=Te=He=De=0),se&&((1&$e)==1&&$e--,(1&Te)==1&&Te--);const Ze=(He-$e+1)*(De-Te+1);Ze<_e&&(_e=Ze,ze=Re,ge=$e,pe=Te,me=He-$e+1,be=De-Te+1)}st=new Uint8Array(fe[Ie-1-ze]),ze==1&&(Pe[Ie-1].dispose=2),je=new Uint8Array(me*be*4),t(st,ye,ke,je,me,be,-ge,-pe,0),Be=t(Xe,ye,ke,je,me,be,-ge,-pe,3)?1:0,Be==1?f(Xe,ye,ke,je,{x:ge,y:pe,width:me,height:be}):t(Xe,ye,ke,je,me,be,-ge,-pe,0)}else je=Xe.slice(0);Pe.push({rect:{x:ge,y:pe,width:me,height:be},img:je,blend:Be,dispose:0})}if(Ue)for(Ie=0;Ie>2,Ue>>2);ee.push(ne);const se=new Uint8Array(ye.abuf,ke,Ue);z&&a(he.img,he.rect.width,he.rect.height,Z,se,ne),he.img.set(se),ke+=Ue}}else for(U=0;UJ&&fe==ve[G-J])ne[G]=ne[G-J];else{let ye=X[fe];if(ye==null&&(X[fe]=ye=Z.length,Z.push(fe),Z.length>=300))break;ne[G]=ye}}}const ce=Z.length;for(ce<=256&&T==0&&(W=ce<=2?1:ce<=4?2:ce<=16?4:8,W=Math.max(W,A)),U=0;U>1)]|=Ue[Oe+ae]<<4-4*(1&ae);else if(W==2)for(ae=0;ae>2)]|=Ue[Oe+ae]<<6-2*(3&ae);else if(W==1)for(ae=0;ae>3)]|=Ue[Oe+ae]<<7-1*(7&ae)}fe=ue,H=3,ke=1}else if(V==0&&K.length==1){ue=new Uint8Array(J*ve*3);const Ue=J*ve;for(G=0;GG&&(G=ee),neV&&(V=ne))}G==-1&&(U=B=G=V=0),$&&((1&U)==1&&U--,(1&B)==1&&B--),F={x:U,y:B,width:G-U+1,height:V-B+1};const K=O[L];K.rect=F,K.blend=1,K.img=new Uint8Array(F.width*F.height*4),O[L-1].dispose==0?(t(T,w,M,K.img,F.width,F.height,-F.x,-F.y,0),f(W,w,M,K.img,F)):t(W,w,M,K.img,F.width,F.height,-F.x,-F.y,0)}function f(_,w,M,O,L){t(_,w,M,O,L.width,L.height,-L.x,-L.y,2)}function g(_,w,M,O,L,F,$){const D=[];let A,T=[0,1,2,3,4];F!=-1?T=[F]:(w*O>5e5||M==1)&&(T=[0]),$&&(A={level:0});const z=nE;for(var H=0;H>1)+256&255;if(F==4)for(A=L;A>1)&255;for(A=L;A>1)&255}if(F==4){for(A=0;A>2);let z;if(M.length<2e7)for(var H=0;H>2]=z.ind,L[H>>2]=z.est.rgba;else for(H=0;H>2]=z.ind,L[H>>2]=z.est.rgba}return{abuf:O.buffer,inds:T,plte:D}}function y(_,w,M){M==null&&(M=1e-4);const O=new Uint32Array(_.buffer),L={i0:0,i1:_.length,bst:null,est:null,tdst:0,left:null,right:null};L.bst=k(_,L.i0,L.i1),L.est=C(L.bst);const F=[L];for(;F.lengthD&&(D=F[$].est.L,A=$);if(D=z||T.i1<=z){T.est.L=0;continue}const H={i0:T.i0,i1:z,bst:null,est:null,tdst:0,left:null,right:null};H.bst=k(_,H.i0,H.i1),H.est=C(H.bst);const W={i0:z,i1:T.i1,bst:null,est:null,tdst:0,left:null,right:null};for(W.bst={R:[],m:[],N:T.bst.N-H.bst.N},$=0;$<16;$++)W.bst.R[$]=T.bst.R[$]-H.bst.R[$];for($=0;$<4;$++)W.bst.m[$]=T.bst.m[$]-H.bst.m[$];W.est=C(W.bst),T.left=H,T.right=W,F[A]=H,F.push(W)}for(F.sort(((D,A)=>A.bst.N-D.bst.N)),$=0;$0&&($=_.right,D=_.left);const A=b($,w,M,O,L);if(A.tdst<=F*F)return A;const T=b(D,w,M,O,L);return T.tdstF;)O-=4;if(M>=O)break;const $=w[M>>2];w[M>>2]=w[O>>2],w[O>>2]=$,M+=4,O-=4}for(;E(_,M,L)>F;)M-=4;return M+4}function E(_,w,M){return _[w]*M[0]+_[w+1]*M[1]+_[w+2]*M[2]+_[w+3]*M[3]}function k(_,w,M){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,0],F=M-w>>2;for(let $=w;$>>0}}var N={multVec:(_,w)=>[_[0]*w[0]+_[1]*w[1]+_[2]*w[2]+_[3]*w[3],_[4]*w[0]+_[5]*w[1]+_[6]*w[2]+_[7]*w[3],_[8]*w[0]+_[9]*w[1]+_[10]*w[2]+_[11]*w[3],_[12]*w[0]+_[13]*w[1]+_[14]*w[2]+_[15]*w[3]],dot:(_,w)=>_[0]*w[0]+_[1]*w[1]+_[2]*w[2]+_[3]*w[3],sml:(_,w)=>[_*w[0],_*w[1],_*w[2],_*w[3]]};En.encode=function(w,M,O,L,F,$,D){L==null&&(L=0),D==null&&(D=!1);const A=d(w,M,O,L,[!1,!1,!1,0,D,!1]);return c(A,-1),l(A,M,O,F,$)},En.encodeLL=function(w,M,O,L,F,$,D,A){const T={ctype:0+(L==1?0:2)+(F==0?0:4),depth:$,frames:[]},z=(L+F)*$,H=z*M;for(let W=0;W>>0),k(1),k(32),C(3),C(l),C(2835),C(2835),N(8),C(16711680),C(65280),C(255),C(4278190080),C(1466527264),(function _(){for(;S0;){for(y=122+S*a,g=0;g>>24,u.setUint32(y+g,m<<8|p),g+=4;S++}E{e(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Qt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},rE={[Qt.CHROME]:16384,[Qt.FIREFOX]:11180,[Qt.DESKTOP_SAFARI]:16384,[Qt.IE]:8192,[Qt.IOS]:4096,[Qt.ETC]:8192};const Ac=typeof window<"u",pp=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Wi=Ac&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),sE=(Ac||pp)&&(Wi&&Wi.getOriginalSymbol(window,"File")||typeof File<"u"&&File),mp=(Ac||pp)&&(Wi&&Wi.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Dc(t,e,n=Date.now()){return new Promise((r=>{const s=t.split(","),o=s[0].match(/:(.*?);/)[1],i=globalThis.atob(s[1]);let a=i.length;const l=new Uint8Array(a);for(;a--;)l[a]=i.charCodeAt(a);const c=new Blob([l],{type:o});c.name=e,c.lastModified=n,r(c)}))}function bp(t){return new Promise(((e,n)=>{const r=new mp;r.onload=()=>e(r.result),r.onerror=s=>n(s),r.readAsDataURL(t)}))}function yp(t){return new Promise(((e,n)=>{const r=new Image;r.onload=()=>e(r),r.onerror=s=>n(s),r.src=t}))}function wr(){if(wr.cachedResult!==void 0)return wr.cachedResult;let t=Qt.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?t=Qt.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?t=Qt.IOS:/Safari/i.test(e)?t=Qt.DESKTOP_SAFARI:/Firefox/i.test(e)?t=Qt.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(t=Qt.IE),wr.cachedResult=t,wr.cachedResult}function vp(t,e){const n=wr(),r=rE[n];let s=t,o=e,i=s*o;const a=s>o?o/s:s/o;for(;i>r*r;){const l=(r+s)/2,c=(r+o)/2;lgp.toBlob(t,d))).then(function(d){try{return a=d,a.name=n,a.lastModified=r,c.call(this)}catch(u){return i(u)}}.bind(this),i);{let d=function(){return c.call(this)};if(typeof OffscreenCanvas=="function"&&t instanceof OffscreenCanvas)return t.convertToBlob({type:e,quality:s}).then(function(u){try{return a=u,a.name=n,a.lastModified=r,d.call(this)}catch(f){return i(f)}}.bind(this),i);{let u;return u=t.toDataURL(e,s),Dc(u,n,r).then(function(f){try{return a=f,d.call(this)}catch(g){return i(g)}}.bind(this),i)}}}function l(){return o(a)}}))}function Pn(t){t.width=0,t.height=0}function is(){return new Promise((function(t,e){let n,r,s,o;return is.cachedResult!==void 0?t(is.cachedResult):Dc("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(i){try{return n=i,Xi(n).then((function(a){try{return r=a[1],Ki(r,n.type,n.name,n.lastModified).then((function(l){try{return s=l,Pn(r),Xi(s).then((function(c){try{return o=c[0],is.cachedResult=o.width===1&&o.height===2,t(is.cachedResult)}catch(d){return e(d)}}),e)}catch(c){return e(c)}}),e)}catch(l){return e(l)}}),e)}catch(a){return e(a)}}),e)}))}function wp(t){return new Promise(((e,n)=>{const r=new mp;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return e(-2);const i=o.byteLength;let a=2;for(;an(s),r.readAsArrayBuffer(t)}))}function kp(t,e){const{width:n}=t,{height:r}=t,{maxWidthOrHeight:s}=e;let o,i=t;return isFinite(s)&&(n>s||r>s)&&([i,o]=Gi(n,r),n>r?(i.width=s,i.height=r/n*s):(i.width=n/r*s,i.height=s),o.drawImage(t,0,0,i.width,i.height),Pn(t)),i}function Cp(t,e){const{width:n}=t,{height:r}=t,[s,o]=Gi(n,r);switch(e>4&&e<9?(s.width=r,s.height=n):(s.width=n,s.height=r),e){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(t,0,0,n,r),Pn(t),s}function Sp(t,e,n=0){return new Promise((function(r,s){let o,i,a,l,c,d,u,f,g,m,p,y,b,S,x,E,k,C,N,_;function w(O=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;o+=O,e.onProgress(Math.min(o,100))}function M(O){if(e.signal&&e.signal.aborted)throw e.signal.reason;o=Math.min(Math.max(O,o),100),e.onProgress(o)}return o=n,i=e.maxIteration||10,a=1024*e.maxSizeMB*1024,w(),Xi(t,e).then(function(O){try{return[,l]=O,w(),c=kp(l,e),w(),new Promise((function(L,F){var $;if(!($=e.exifOrientation))return wp(t).then(function(A){try{return $=A,D.call(this)}catch(T){return F(T)}}.bind(this),F);function D(){return L($)}return D.call(this)})).then(function(L){try{return d=L,w(),is().then(function(F){try{return u=F?c:Cp(c,d),w(),f=e.initialQuality||1,g=e.fileType||t.type,Ki(u,g,t.name,t.lastModified,f).then(function($){try{{let A=function(){if(i--&&(x>a||x>b)){let z,H;return z=_?.95*N.width:N.width,H=_?.95*N.height:N.height,[k,C]=Gi(z,H),C.drawImage(N,0,0,z,H),f*=g==="image/png"?.85:.95,Ki(k,g,t.name,t.lastModified,f).then((function(W){try{return E=W,Pn(N),N=k,x=E.size,M(Math.min(99,Math.floor((S-x)/(S-a)*100))),A}catch(j){return s(j)}}),s)}return[1]},T=function(){return Pn(N),Pn(k),Pn(c),Pn(u),Pn(l),M(100),r(E)};if(m=$,w(),p=m.size>a,y=m.size>t.size,!p&&!y)return M(100),r(m);var D;return b=t.size,S=m.size,x=S,N=u,_=!e.alwaysKeepResolution&&p,(D=function(z){for(;z;){if(z.then)return void z.then(D,s);try{if(z.pop){if(z.length)return z.pop()?T.call(this):z;z=A}else z=z.call(this)}catch(H){return s(H)}}}.bind(this))(A)}}catch(A){return s(A)}}.bind(this),s)}catch($){return s($)}}.bind(this),s)}catch(F){return s(F)}}.bind(this),s)}catch(L){return s(L)}}.bind(this),s)}))}const oE=` let scriptImported = false self.addEventListener('message', async (e) => { const { file, id, imageCompressionLibUrl, options } = e.data @@ -220,11 +220,11 @@ self.addEventListener('message', async (e) => { self.postMessage({ error: e.message + '\\n' + e.stack, id }) } }) -`;let Ic;function rE(t,e){return new Promise(((n,r)=>{Ic||(Ic=(function(i){const a=[];return a.push(i),URL.createObjectURL(new Blob(a))})(nE));const s=new Worker(Ic);s.addEventListener("message",(function(i){if(e.signal&&e.signal.aborted)s.terminate();else if(i.data.progress===void 0){if(i.data.error)return r(new Error(i.data.error)),void s.terminate();n(i.data.file),s.terminate()}else e.onProgress(i.data.progress)})),s.addEventListener("error",r),e.signal&&e.signal.addEventListener("abort",(()=>{r(e.signal.reason),s.terminate()})),s.postMessage({file:t,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})}))}function Vt(t,e){return new Promise((function(n,r){let s,o,i,a,l,c;if(s={...e},i=0,{onProgress:a}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,l=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=g=>{i=g,typeof a=="function"&&a(i)},!(t instanceof Blob||t instanceof tE))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(t.type))return r(new Error("The file given is not an image"));if(c=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!l||typeof Worker!="function"||c)return Cp(t,s).then(function(g){try{return o=g,f.call(this)}catch(m){return r(m)}}.bind(this),r);var d=function(){try{return f.call(this)}catch(g){return r(g)}}.bind(this),u=function(g){try{return Cp(t,s).then((function(m){try{return o=m,d()}catch(p){return r(p)}}),r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",rE(t,s).then((function(g){try{return o=g,d()}catch{return u()}}),u)}catch{u()}function f(){try{o.name=t.name,o.lastModified=t.lastModified}catch{}try{s.preserveExif&&t.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===t.type)&&(o=fp(t,o))}catch{}return n(o)}}))}Vt.getDataUrlFromFile=mp,Vt.getFilefromDataUrl=Dc,Vt.loadImage=bp,Vt.drawImageInCanvas=vp,Vt.drawFileInCanvas=Xi,Vt.canvasToFile=Ki,Vt.getExifOrientation=xp,Vt.handleMaxWidthOrHeight=wp,Vt.followExifOrientation=kp,Vt.cleanupCanvasMemory=Pn,Vt.isAutoOrientationInBrowser=is,Vt.approximateBelowMaximumCanvasSizeOfBrowser=yp,Vt.copyExifWithoutOrientation=fp,Vt.getBrowserName=wr,Vt.version="2.0.2";const sE=window.G7Core,Lc=t=>{const e=["B","KB","MB","GB"];let n=0,r=t;for(;r>=1024&&n{if(t&&typeof t=="object"){const e=t;if(e.response?.data?.message)return e.response.data.message;if(e.response?.data?.errors){const n=Object.values(e.response.data.errors)[0];if(Array.isArray(n)&&n[0])return n[0]}if(e.message)return e.message}return t instanceof Error?t.message:"업로드 실패"},iE=t=>t?t.startsWith("image/")?"fa-file-image":t.startsWith("video/")?"fa-file-video":t.startsWith("audio/")?"fa-file-audio":t==="application/pdf"?"fa-file-pdf":t.includes("word")||t.includes("document")?"fa-file-word":t.includes("excel")||t.includes("spreadsheet")?"fa-file-excel":t.includes("zip")||t.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",At=(t,e)=>sE?.t?.(t,e)??t,Sp=window.G7Core?.createLogger?.("Comp:FileUploader")??{log:(...t)=>console.log("[Comp:FileUploader]",...t),warn:(...t)=>console.warn("[Comp:FileUploader]",...t),error:(...t)=>console.error("[Comp:FileUploader]",...t)},kr=window.G7Core;function aE(t){const{attachmentableType:e,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:u,endpoints:f,onFilesChange:g,onUploadComplete:m,onUploadError:p,onRemove:y,onReorder:b,uploadTriggerEvent:S,confirmBeforeRemove:x,uploadParams:E}=t,[k,C]=v.useState(u),[N,_]=v.useState([]),[w,M]=v.useState(!1),O=v.useRef(null),L=v.useRef(0),F=v.useRef(new Set),$=v.useRef(new Map),D=v.useRef(null),[A,T]=v.useState(!1),[z,H]=v.useState(null),[W,j]=v.useState(!1),U=v.useRef(!1),[B,G]=v.useState([]),[V,K]=v.useState(!1),[X,Z]=v.useState(0),ee=v.useRef(0),[ne,he]=v.useState(new Map),J=v.useRef(new Map),ce=v.useRef(g);ce.current=g,v.useEffect(()=>{ce.current?.(N)},[N]),v.useEffect(()=>{if(U.current)return;const te=u.filter(me=>!F.current.has(me.id)&&(!me.hash||!F.current.has(me.hash))),ge=new Set(te.map(me=>me.id)),pe=Array.from($.current.values()).filter(me=>!ge.has(me.id)&&!F.current.has(me.id));C([...te,...pe])},[u]);const ue=v.useCallback(async te=>{const ge={maxSizeMB:l?.maxSizeMB??1,maxWidthOrHeight:l?.maxWidthOrHeight??1920,useWebWorker:!0};return await Vt(te,ge)},[l]),ae=v.useCallback(async te=>{const ge=k.length+N.length,pe=Math.max(0,s-ge),me=Array.from(te).slice(0,pe);if(te.length>pe){const be=Array.from(te).slice(pe),Be=At("attachment.upload_limit_exceeded",{max:s});p?.(Be,be[0]??te[0])}for(const be of me){if(be.size>o*1024*1024){p?.(`[${be.name}] 파일 크기(${Lc(be.size)})가 최대 허용 크기(${o}MB)를 초과합니다.`,be);continue}if(a){const Se="."+be.name.split(".").pop()?.toLowerCase();if(!a.split(",").map(_e=>_e.trim().toLowerCase()).includes(Se)){p?.(`[${be.name}] 허용되지 않는 파일 형식입니다. (허용: ${a})`,be);continue}}const Be={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:be,original_filename:be.name,mime_type:be.type,size:be.size,size_formatted:Lc(be.size),status:"pending",progress:0};if(be.type.startsWith("image/")&&(Be.preview=URL.createObjectURL(be)),_(Se=>[...Se,Be]),be.type.startsWith("image/")&&l){_(Se=>Se.map(ze=>ze.id===Be.id?{...ze,status:"compressing"}:ze));try{const Se=await ue(be);_(ze=>ze.map(_e=>_e.id===Be.id?{..._e,compressedBlob:Se,size:Se.size,size_formatted:Lc(Se.size),status:"pending",progress:0}:_e))}catch{_(Se=>Se.map(ze=>ze.id===Be.id?{...ze,status:"error",error:"이미지 압축 실패"}:ze))}}}},[k.length,N.length,s,o,a,l,ue,p]),ve=v.useCallback(async te=>{const ge=new FormData,pe=te.compressedBlob?new File([te.compressedBlob],te.original_filename,{type:te.mime_type}):te.file;ge.append("file",pe),e&&ge.append("attachmentable_type",e),n&&ge.append("attachmentable_id",String(n)),ge.append("collection",r),c.forEach(me=>{ge.append("role_ids[]",String(me))}),E&&Object.entries(E).forEach(([me,be])=>{ge.append(me,be)});try{const me=await kr.api.post(f.upload,ge,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Be=>{const Se=Math.round(Be.loaded*100/(Be.total??1));_(ze=>ze.map(_e=>_e.id===te.id?{..._e,progress:Se}:_e))}});return me?.data?.data??me?.data}catch(me){const be=oE(me);throw new Error(be)}},[e,n,r,c,f.upload]),fe=v.useCallback(async()=>{const te=N.filter(Se=>Se.status==="pending"||Se.status==="error");if(te.length===0)return D.current=k,[];const ge=[],pe=new Map,me=[...te],be=async()=>{for(;me.length>0&&L.currentze.map(_e=>_e.id===Se.id?{..._e,status:"uploading",progress:0}:_e));try{const ze=await ve(Se);if(ze)ge.push(ze),pe.set(String(Se.id),String(ze.hash)),$.current.set(ze.id,ze),_(_e=>_e.filter(Re=>Re.id!==Se.id)),C(_e=>[..._e,ze]),G(_e=>{if(_e.length===0)return _e;const Re=String(Se.id);return _e.some($e=>String($e)===Re)?_e.map($e=>String($e)===Re?String(ze.hash):$e):_e}),Se.preview&&URL.revokeObjectURL(Se.preview);else{const _e=At("attachment.upload_response_invalid");_(Re=>Re.map(ot=>ot.id===Se.id?{...ot,status:"error",error:_e}:ot)),p?.(`[${Se.original_filename}] ${_e}`,Se.file)}}catch(ze){const _e=ze instanceof Error?ze.message:"업로드 실패";_(Re=>Re.map(ot=>ot.id===Se.id?{...ot,status:"error",error:_e}:ot)),p?.(`[${Se.original_filename}] ${_e}`,Se.file)}finally{L.current--}}},Be=Array(Math.min(i,te.length)).fill(null).map(()=>be());if(await Promise.all(Be),ge.length>0){m?.(ge);const Se=[...k,...ge];if(B.length>0){const ze=B.map(ot=>pe.get(String(ot))??ot),_e=new Map(ze.map((ot,$e)=>[String(ot),$e])),Re=[...Se].sort((ot,$e)=>{const Te=_e.get(String(ot.hash))??Se.length,He=_e.get(String($e.hash))??Se.length;return Te-He}).map((ot,$e)=>({...ot,sort_order:$e,order:$e+1}));D.current=Re,f.reorder&&b&&b(Re)}else D.current=Se.map((ze,_e)=>({...ze,sort_order:_e,order:_e+1}))}else D.current=k;return ge},[N,i,ve,m,p,B,k,b,f.reorder]);v.useEffect(()=>{if(!S)return;const te=kr.componentEvent.on(S,async()=>{const ge=await fe(),pe=D.current??[...k,...ge];return{uploadedAttachments:ge,existingFiles:k,allFiles:pe}});return()=>{te()}},[S,fe,k]),v.useEffect(()=>{d&&N.some(te=>te.status==="pending")&&fe()},[d,N,fe]);const ye=v.useCallback(async te=>{j(!0);try{if(te.id&&f.delete){const pe=f.delete.replace(":id",String(te.id));await kr.api.delete(pe)}const ge=te.hash||te.id;te.id&&(F.current.add(te.id),$.current.delete(te.id)),te.hash&&F.current.add(te.hash),C(pe=>pe.filter(me=>(me.hash||me.id)!==ge)),y?.(te.hash||te.id),T(!1),H(null)}catch{Sp.error("첨부파일 삭제 실패")}finally{j(!1)}},[y,f.delete]),ke=v.useCallback(async te=>{"hash"in te?x?(H(te),T(!0)):await ye(te):(te.preview&&URL.revokeObjectURL(te.preview),_(ge=>ge.filter(pe=>pe.id!==te.id)))},[x,ye]),Ue=v.useCallback(te=>{_(ge=>ge.map(pe=>pe.id===te.id?{...pe,status:"pending",error:void 0}:pe))},[]),se=v.useCallback(async te=>{const{arrayMove:ge}=await Promise.resolve().then(()=>OS),{active:pe,over:me}=te;if(!me||pe.id===me.id)return;const be=[...k,...N];let Be;if(B.length===0)Be=be;else{const Te=new Map(B.map((He,De)=>[String(He),De]));Be=[...be].sort((He,De)=>{const Ze="hash"in He?String(He.hash):String(He.id),it="hash"in De?String(De.hash):String(De.id);return(Te.get(Ze)??be.length)-(Te.get(it)??be.length)})}const Se=Be.findIndex(Te=>"hash"in Te?Te.hash===pe.id:Te.id===pe.id),ze=Be.findIndex(Te=>"hash"in Te?Te.hash===me.id:Te.id===me.id),_e=ge(Be,Se,ze);G(_e.map(Te=>"hash"in Te?Te.hash:Te.id));const Re=_e.filter(Te=>"hash"in Te),ot=_e.filter(Te=>!("hash"in Te));U.current=!0,C(Re),_(ot);const $e=Re.map((Te,He)=>({...Te,sort_order:He,order:He+1}));if(Re.length>0&&f.reorder){const Te=Re.map((He,De)=>({id:He.id,order:De+1}));try{const He=await kr.api.patch(f.reorder,{order:Te});kr.toast.success(He.message)}catch(He){const De=He instanceof Error?He.message:At("attachment.reorder_failed");kr.toast.error(De)}}b?.($e)},[k,N,B,f.reorder,b]),Oe=v.useMemo(()=>[...k,...N].filter(te=>"is_image"in te?te.is_image:te.mime_type?.startsWith("image/")??!1),[k,N]),Pe=v.useCallback(te=>{const ge=Oe.findIndex(pe=>"hash"in te&&"hash"in pe?pe.hash===te.hash:"id"in te&&"id"in pe&&!("hash"in te)&&!("hash"in pe)?pe.id===te.id:!1);ge!==-1&&(ee.current+=1,Z(ge),K(!0))},[Oe]);v.useEffect(()=>{let te=!1;return(async()=>{const pe=k.filter(be=>be.is_image),me=new Set(pe.map(be=>be.id));for(const[be,Be]of J.current)me.has(be)||(URL.revokeObjectURL(Be),J.current.delete(be));for(const be of pe){if(te)break;if(!J.current.has(be.id))try{const Be=await kr.api.get(be.download_url,{responseType:"blob"});if(!te&&Be){const Se=URL.createObjectURL(Be);J.current.set(be.id,Se),he(new Map(J.current))}}catch(Be){Sp.error("Failed to load authenticated image:",Be)}}})(),()=>{te=!0}},[k]),v.useEffect(()=>()=>{J.current.forEach(te=>URL.revokeObjectURL(te)),J.current.clear()},[]);const Ie=v.useCallback(async te=>{const{executeImageDownload:ge}=await Promise.resolve().then(()=>X2);await ge({src:te.download_url,downloadUrl:te.download_url,filename:te.original_filename,downloadRequiresAuth:!0})},[]),je=v.useMemo(()=>{const te=[...k,...N];if(B.length===0)return te;const ge=new Map(B.map((pe,me)=>[String(pe),me]));return[...te].sort((pe,me)=>{const be="hash"in pe?String(pe.hash):String(pe.id),Be="hash"in me?String(me.hash):String(me.id),Se=ge.get(be)??te.length,ze=ge.get(Be)??te.length;return Se-ze})},[k,N,B]),st=je.length,ut=st>0,We=st_([]),[]),Xe=v.useCallback(()=>N,[N]);return{existingFiles:k,pendingFiles:N,isDragOver:w,setIsDragOver:M,isDeleting:W,totalCount:st,hasFiles:ut,canAddMore:We,allItems:je,imageFiles:Oe,handleFiles:ae,handleRemove:ke,handleRetry:Ue,handleUploadAll:fe,handleOpenGallery:Pe,handleDownload:Ie,handleDragEnd:se,inputRef:O,galleryOpen:V,setGalleryOpen:K,galleryStartIndex:X,galleryKeyRef:ee,confirmDialogOpen:A,setConfirmDialogOpen:T,itemToDelete:z,executeRemoveAttachment:ye,authenticatedImageUrls:ne,clear:et,getPendingFiles:Xe}}const lE=({isDragOver:t,canAddMore:e,onFiles:n,setIsDragOver:r,inputRef:s,accept:o,maxFiles:i,maxSize:a,disabled:l,children:c})=>{const d=e&&!l;return h.jsxs(I,{className:` +`;let Ic;function iE(t,e){return new Promise(((n,r)=>{Ic||(Ic=(function(i){const a=[];return a.push(i),URL.createObjectURL(new Blob(a))})(oE));const s=new Worker(Ic);s.addEventListener("message",(function(i){if(e.signal&&e.signal.aborted)s.terminate();else if(i.data.progress===void 0){if(i.data.error)return r(new Error(i.data.error)),void s.terminate();n(i.data.file),s.terminate()}else e.onProgress(i.data.progress)})),s.addEventListener("error",r),e.signal&&e.signal.addEventListener("abort",(()=>{r(e.signal.reason),s.terminate()})),s.postMessage({file:t,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})}))}function Vt(t,e){return new Promise((function(n,r){let s,o,i,a,l,c;if(s={...e},i=0,{onProgress:a}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,l=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=g=>{i=g,typeof a=="function"&&a(i)},!(t instanceof Blob||t instanceof sE))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(t.type))return r(new Error("The file given is not an image"));if(c=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!l||typeof Worker!="function"||c)return Sp(t,s).then(function(g){try{return o=g,f.call(this)}catch(m){return r(m)}}.bind(this),r);var d=function(){try{return f.call(this)}catch(g){return r(g)}}.bind(this),u=function(g){try{return Sp(t,s).then((function(m){try{return o=m,d()}catch(p){return r(p)}}),r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",iE(t,s).then((function(g){try{return o=g,d()}catch{return u()}}),u)}catch{u()}function f(){try{o.name=t.name,o.lastModified=t.lastModified}catch{}try{s.preserveExif&&t.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===t.type)&&(o=hp(t,o))}catch{}return n(o)}}))}Vt.getDataUrlFromFile=bp,Vt.getFilefromDataUrl=Dc,Vt.loadImage=yp,Vt.drawImageInCanvas=xp,Vt.drawFileInCanvas=Xi,Vt.canvasToFile=Ki,Vt.getExifOrientation=wp,Vt.handleMaxWidthOrHeight=kp,Vt.followExifOrientation=Cp,Vt.cleanupCanvasMemory=Pn,Vt.isAutoOrientationInBrowser=is,Vt.approximateBelowMaximumCanvasSizeOfBrowser=vp,Vt.copyExifWithoutOrientation=hp,Vt.getBrowserName=wr,Vt.version="2.0.2";const aE=window.G7Core,Lc=t=>{const e=["B","KB","MB","GB"];let n=0,r=t;for(;r>=1024&&n{if(t&&typeof t=="object"){const e=t;if(e.response?.data?.message)return e.response.data.message;if(e.response?.data?.errors){const n=Object.values(e.response.data.errors)[0];if(Array.isArray(n)&&n[0])return n[0]}if(e.message)return e.message}return t instanceof Error?t.message:"업로드 실패"},cE=t=>t?t.startsWith("image/")?"fa-file-image":t.startsWith("video/")?"fa-file-video":t.startsWith("audio/")?"fa-file-audio":t==="application/pdf"?"fa-file-pdf":t.includes("word")||t.includes("document")?"fa-file-word":t.includes("excel")||t.includes("spreadsheet")?"fa-file-excel":t.includes("zip")||t.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",At=(t,e)=>aE?.t?.(t,e)??t,_p=window.G7Core?.createLogger?.("Comp:FileUploader")??{log:(...t)=>console.log("[Comp:FileUploader]",...t),warn:(...t)=>console.warn("[Comp:FileUploader]",...t),error:(...t)=>console.error("[Comp:FileUploader]",...t)},kr=window.G7Core;function dE(t){const{attachmentableType:e,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:u,endpoints:f,onFilesChange:g,onUploadComplete:m,onUploadError:p,onRemove:y,onReorder:b,uploadTriggerEvent:S,confirmBeforeRemove:x,uploadParams:E}=t,[k,C]=v.useState(u),[N,_]=v.useState([]),[w,M]=v.useState(!1),O=v.useRef(null),L=v.useRef(0),F=v.useRef(new Set),$=v.useRef(new Map),D=v.useRef(null),[A,T]=v.useState(!1),[z,H]=v.useState(null),[W,j]=v.useState(!1),U=v.useRef(!1),[B,G]=v.useState([]),[V,K]=v.useState(!1),[X,Z]=v.useState(0),ee=v.useRef(0),[ne,he]=v.useState(new Map),J=v.useRef(new Map),ce=v.useRef(g);ce.current=g,v.useEffect(()=>{ce.current?.(N)},[N]),v.useEffect(()=>{if(U.current)return;const te=u.filter(me=>!F.current.has(me.id)&&(!me.hash||!F.current.has(me.hash))),ge=new Set(te.map(me=>me.id)),pe=Array.from($.current.values()).filter(me=>!ge.has(me.id)&&!F.current.has(me.id));C([...te,...pe])},[u]);const ue=v.useCallback(async te=>{const ge={maxSizeMB:l?.maxSizeMB??1,maxWidthOrHeight:l?.maxWidthOrHeight??1920,useWebWorker:!0};return await Vt(te,ge)},[l]),ae=v.useCallback(async te=>{const ge=k.length+N.length,pe=Math.max(0,s-ge),me=Array.from(te).slice(0,pe);if(te.length>pe){const be=Array.from(te).slice(pe),Be=At("attachment.upload_limit_exceeded",{max:s});p?.(Be,be[0]??te[0])}for(const be of me){if(be.size>o*1024*1024){p?.(`[${be.name}] 파일 크기(${Lc(be.size)})가 최대 허용 크기(${o}MB)를 초과합니다.`,be);continue}if(a){const Se="."+be.name.split(".").pop()?.toLowerCase();if(!a.split(",").map(_e=>_e.trim().toLowerCase()).includes(Se)){p?.(`[${be.name}] 허용되지 않는 파일 형식입니다. (허용: ${a})`,be);continue}}const Be={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:be,original_filename:be.name,mime_type:be.type,size:be.size,size_formatted:Lc(be.size),status:"pending",progress:0};if(be.type.startsWith("image/")&&(Be.preview=URL.createObjectURL(be)),_(Se=>[...Se,Be]),be.type.startsWith("image/")&&l){_(Se=>Se.map(ze=>ze.id===Be.id?{...ze,status:"compressing"}:ze));try{const Se=await ue(be);_(ze=>ze.map(_e=>_e.id===Be.id?{..._e,compressedBlob:Se,size:Se.size,size_formatted:Lc(Se.size),status:"pending",progress:0}:_e))}catch{_(Se=>Se.map(ze=>ze.id===Be.id?{...ze,status:"error",error:"이미지 압축 실패"}:ze))}}}},[k.length,N.length,s,o,a,l,ue,p]),ve=v.useCallback(async te=>{const ge=new FormData,pe=te.compressedBlob?new File([te.compressedBlob],te.original_filename,{type:te.mime_type}):te.file;ge.append("file",pe),e&&ge.append("attachmentable_type",e),n&&ge.append("attachmentable_id",String(n)),ge.append("collection",r),c.forEach(me=>{ge.append("role_ids[]",String(me))}),E&&Object.entries(E).forEach(([me,be])=>{ge.append(me,be)});try{const me=await kr.api.post(f.upload,ge,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Be=>{const Se=Math.round(Be.loaded*100/(Be.total??1));_(ze=>ze.map(_e=>_e.id===te.id?{..._e,progress:Se}:_e))}});return me?.data?.data??me?.data}catch(me){const be=lE(me);throw new Error(be)}},[e,n,r,c,f.upload]),fe=v.useCallback(async()=>{const te=N.filter(Se=>Se.status==="pending"||Se.status==="error");if(te.length===0)return D.current=k,[];const ge=[],pe=new Map,me=[...te],be=async()=>{for(;me.length>0&&L.currentze.map(_e=>_e.id===Se.id?{..._e,status:"uploading",progress:0}:_e));try{const ze=await ve(Se);if(ze)ge.push(ze),pe.set(String(Se.id),String(ze.hash)),$.current.set(ze.id,ze),_(_e=>_e.filter(Re=>Re.id!==Se.id)),C(_e=>[..._e,ze]),G(_e=>{if(_e.length===0)return _e;const Re=String(Se.id);return _e.some($e=>String($e)===Re)?_e.map($e=>String($e)===Re?String(ze.hash):$e):_e}),Se.preview&&URL.revokeObjectURL(Se.preview);else{const _e=At("attachment.upload_response_invalid");_(Re=>Re.map(ot=>ot.id===Se.id?{...ot,status:"error",error:_e}:ot)),p?.(`[${Se.original_filename}] ${_e}`,Se.file)}}catch(ze){const _e=ze instanceof Error?ze.message:"업로드 실패";_(Re=>Re.map(ot=>ot.id===Se.id?{...ot,status:"error",error:_e}:ot)),p?.(`[${Se.original_filename}] ${_e}`,Se.file)}finally{L.current--}}},Be=Array(Math.min(i,te.length)).fill(null).map(()=>be());if(await Promise.all(Be),ge.length>0){m?.(ge);const Se=[...k,...ge];if(B.length>0){const ze=B.map(ot=>pe.get(String(ot))??ot),_e=new Map(ze.map((ot,$e)=>[String(ot),$e])),Re=[...Se].sort((ot,$e)=>{const Te=_e.get(String(ot.hash))??Se.length,He=_e.get(String($e.hash))??Se.length;return Te-He}).map((ot,$e)=>({...ot,sort_order:$e,order:$e+1}));D.current=Re,f.reorder&&b&&b(Re)}else D.current=Se.map((ze,_e)=>({...ze,sort_order:_e,order:_e+1}))}else D.current=k;return ge},[N,i,ve,m,p,B,k,b,f.reorder]);v.useEffect(()=>{if(!S)return;const te=kr.componentEvent.on(S,async()=>{const ge=await fe(),pe=D.current??[...k,...ge];return{uploadedAttachments:ge,existingFiles:k,allFiles:pe}});return()=>{te()}},[S,fe,k]),v.useEffect(()=>{d&&N.some(te=>te.status==="pending")&&fe()},[d,N,fe]);const ye=v.useCallback(async te=>{j(!0);try{if(te.id&&f.delete){const pe=f.delete.replace(":id",String(te.id));await kr.api.delete(pe)}const ge=te.hash||te.id;te.id&&(F.current.add(te.id),$.current.delete(te.id)),te.hash&&F.current.add(te.hash),C(pe=>pe.filter(me=>(me.hash||me.id)!==ge)),y?.(te.hash||te.id),T(!1),H(null)}catch{_p.error("첨부파일 삭제 실패")}finally{j(!1)}},[y,f.delete]),ke=v.useCallback(async te=>{"hash"in te?x?(H(te),T(!0)):await ye(te):(te.preview&&URL.revokeObjectURL(te.preview),_(ge=>ge.filter(pe=>pe.id!==te.id)))},[x,ye]),Ue=v.useCallback(te=>{_(ge=>ge.map(pe=>pe.id===te.id?{...pe,status:"pending",error:void 0}:pe))},[]),se=v.useCallback(async te=>{const{arrayMove:ge}=await Promise.resolve().then(()=>DS),{active:pe,over:me}=te;if(!me||pe.id===me.id)return;const be=[...k,...N];let Be;if(B.length===0)Be=be;else{const Te=new Map(B.map((He,De)=>[String(He),De]));Be=[...be].sort((He,De)=>{const Ze="hash"in He?String(He.hash):String(He.id),it="hash"in De?String(De.hash):String(De.id);return(Te.get(Ze)??be.length)-(Te.get(it)??be.length)})}const Se=Be.findIndex(Te=>"hash"in Te?Te.hash===pe.id:Te.id===pe.id),ze=Be.findIndex(Te=>"hash"in Te?Te.hash===me.id:Te.id===me.id),_e=ge(Be,Se,ze);G(_e.map(Te=>"hash"in Te?Te.hash:Te.id));const Re=_e.filter(Te=>"hash"in Te),ot=_e.filter(Te=>!("hash"in Te));U.current=!0,C(Re),_(ot);const $e=Re.map((Te,He)=>({...Te,sort_order:He,order:He+1}));if(Re.length>0&&f.reorder){const Te=Re.map((He,De)=>({id:He.id,order:De+1}));try{const He=await kr.api.patch(f.reorder,{order:Te});kr.toast.success(He.message)}catch(He){const De=He instanceof Error?He.message:At("attachment.reorder_failed");kr.toast.error(De)}}b?.($e)},[k,N,B,f.reorder,b]),Oe=v.useMemo(()=>[...k,...N].filter(te=>"is_image"in te?te.is_image:te.mime_type?.startsWith("image/")??!1),[k,N]),Pe=v.useCallback(te=>{const ge=Oe.findIndex(pe=>"hash"in te&&"hash"in pe?pe.hash===te.hash:"id"in te&&"id"in pe&&!("hash"in te)&&!("hash"in pe)?pe.id===te.id:!1);ge!==-1&&(ee.current+=1,Z(ge),K(!0))},[Oe]);v.useEffect(()=>{let te=!1;return(async()=>{const pe=k.filter(be=>be.is_image),me=new Set(pe.map(be=>be.id));for(const[be,Be]of J.current)me.has(be)||(URL.revokeObjectURL(Be),J.current.delete(be));for(const be of pe){if(te)break;if(!J.current.has(be.id))try{const Be=await kr.api.get(be.download_url,{responseType:"blob"});if(!te&&Be){const Se=URL.createObjectURL(Be);J.current.set(be.id,Se),he(new Map(J.current))}}catch(Be){_p.error("Failed to load authenticated image:",Be)}}})(),()=>{te=!0}},[k]),v.useEffect(()=>()=>{J.current.forEach(te=>URL.revokeObjectURL(te)),J.current.clear()},[]);const Ie=v.useCallback(async te=>{const{executeImageDownload:ge}=await Promise.resolve().then(()=>Z2);await ge({src:te.download_url,downloadUrl:te.download_url,filename:te.original_filename,downloadRequiresAuth:!0})},[]),je=v.useMemo(()=>{const te=[...k,...N];if(B.length===0)return te;const ge=new Map(B.map((pe,me)=>[String(pe),me]));return[...te].sort((pe,me)=>{const be="hash"in pe?String(pe.hash):String(pe.id),Be="hash"in me?String(me.hash):String(me.id),Se=ge.get(be)??te.length,ze=ge.get(Be)??te.length;return Se-ze})},[k,N,B]),st=je.length,ut=st>0,We=st_([]),[]),Xe=v.useCallback(()=>N,[N]);return{existingFiles:k,pendingFiles:N,isDragOver:w,setIsDragOver:M,isDeleting:W,totalCount:st,hasFiles:ut,canAddMore:We,allItems:je,imageFiles:Oe,handleFiles:ae,handleRemove:ke,handleRetry:Ue,handleUploadAll:fe,handleOpenGallery:Pe,handleDownload:Ie,handleDragEnd:se,inputRef:O,galleryOpen:V,setGalleryOpen:K,galleryStartIndex:X,galleryKeyRef:ee,confirmDialogOpen:A,setConfirmDialogOpen:T,itemToDelete:z,executeRemoveAttachment:ye,authenticatedImageUrls:ne,clear:et,getPendingFiles:Xe}}const uE=({isDragOver:t,canAddMore:e,onFiles:n,setIsDragOver:r,inputRef:s,accept:o,maxFiles:i,maxSize:a,disabled:l,children:c})=>{const d=e&&!l;return h.jsxs(I,{className:` relative border-2 border-dashed rounded-lg transition-colors ${l?"opacity-60 cursor-not-allowed":""} ${t&&!l?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"} - `,onDragOver:u=>{u.preventDefault(),d&&r(!0)},onDragLeave:()=>r(!1),onDrop:u=>{u.preventDefault(),r(!1),d&&n(u.dataTransfer.files)},children:[h.jsx("input",{ref:s,type:"file",multiple:!0,accept:o,onChange:u=>u.target.files&&!l&&n(u.target.files),className:"hidden",disabled:l}),!c&&h.jsxs(I,{className:`p-8 text-center transition-colors ${l?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,onClick:()=>!l&&s.current?.click(),children:[h.jsx(pt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),h.jsx(bt,{className:"text-sm text-gray-600 dark:text-gray-400",children:At("attachment.drop_or_click")}),h.jsxs(bt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[At("attachment.upload_limit",{maxFiles:i,maxSize:a}),o&&` (${o})`]})]}),c]})},cE=window.G7Core,dE=window.G7Core?.createLogger?.("Comp:SortableThumbnail")??{log:(...t)=>console.log("[Comp:SortableThumbnail]",...t),warn:(...t)=>console.warn("[Comp:SortableThumbnail]",...t),error:(...t)=>console.error("[Comp:SortableThumbnail]",...t)},uE=({file:t,onRemove:e,onRetry:n,onImageClick:r,onDownload:s,isPrimary:o,onPrimaryClick:i,disabled:a})=>{const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:g}=Di({id:"hash"in t?t.hash:t.id}),m={transform:Ln.Transform.toString(u),transition:f,opacity:g?.5:1},p="status"in t&&t.status!==void 0,y=p?t.status:"done",b=y==="uploading",S=y==="compressing",x=y==="error",E=p?t.progress:100,k=p?t.preview:void 0,C=p?t.mime_type?.startsWith("image/")??!1:t.is_image,[N,_]=v.useState(void 0),w=!p&&C?t.download_url:void 0;v.useEffect(()=>{if(!w){_(void 0);return}let O=!0,L;return(async()=>{try{const $=await cE.api.get(w,{responseType:"blob"});O&&$&&(L=URL.createObjectURL($),_(L))}catch($){dE.error("Failed to load authenticated image:",$)}})(),()=>{O=!1,L&&URL.revokeObjectURL(L)}},[w]);const M=N;return h.jsxs(I,{ref:d,style:m,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsxs(I,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${C||!p?"cursor-pointer":""}`,onClick:()=>{b||S||(C&&r?r():!p&&s&&s())},children:[k||M?h.jsx(yn,{src:k||M,alt:t.original_filename,className:"w-full h-full object-cover"}):h.jsx(pt,{className:`fa-solid ${iE(t.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(b||S)&&h.jsxs(I,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[h.jsx(I,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:h.jsx(I,{className:"h-full bg-blue-500 transition-all",style:{width:`${E}%`}})}),h.jsxs(Q,{className:"text-white text-xs mt-1",children:[E,"%"]})]}),x&&h.jsx(I,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:h.jsx(pt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),i&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),i()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${o?"bg-yellow-500 text-white":"bg-gray-800/50 text-gray-300 hover:bg-yellow-500 hover:text-white opacity-0 group-hover:opacity-100"}`,title:At(o?"attachment.primary_image":"attachment.set_as_primary"),children:h.jsx(pt,{className:"fa-solid fa-star text-xs"})}),h.jsxs(I,{className:`absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-start justify-end p-1 gap-1 opacity-0 group-hover:opacity-100 ${a?"hidden":""}`,children:[h.jsx(oe,{type:"button",...l,...c,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-gray-600 dark:text-gray-300 hover:bg-white cursor-grab active:cursor-grabbing",title:At("attachment.drag_to_reorder"),onClick:O=>O.stopPropagation(),children:h.jsx(pt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&s&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),s()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:At("common.download"),children:h.jsx(pt,{className:"fa-solid fa-download text-sm"})}),x&&n&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),n()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:At("common.retry"),children:h.jsx(pt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),e()},disabled:b||S,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:At("common.delete"),children:h.jsx(pt,{className:"fa-solid fa-times text-sm"})})]})]}),h.jsxs(I,{className:`p-2 ${!p&&s?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&s&&s()},children:[h.jsx(bt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:t.original_filename,children:t.original_filename}),h.jsx(bt,{className:"text-xs text-gray-500 dark:text-gray-400",children:t.size_formatted})]})]})},fE=({allItems:t,canAddMore:e,totalCount:n,maxFiles:r,maxSize:s,accept:o,onRemove:i,onRetry:a,onImageClick:l,onDownload:c,onDragEnd:d,onAddClick:u,enablePrimarySelection:f,primaryFileId:g,onPrimaryChange:m,disabled:p})=>{const y=jl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Ii}));return h.jsxs(I,{className:"p-3",children:[h.jsx(ec,{sensors:y,collisionDetection:Wl,onDragEnd:d,children:h.jsx(Ai,{items:t.map(b=>"hash"in b?b.hash:b.id),strategy:Oi,children:h.jsxs(I,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[t.map(b=>{const S="hash"in b,x=S?b.is_image:b.mime_type?.startsWith("image/")??!1;return h.jsx(uE,{file:b,onRemove:()=>i(b),onRetry:"status"in b&&b.status==="error"?()=>a(b):void 0,onImageClick:x?()=>l(b):void 0,onDownload:S?()=>c(b):void 0,isPrimary:f&&S&&(b.hash||b.id)===g,onPrimaryClick:f&&S?()=>m?.(b.hash||b.id):void 0,disabled:p},S?b.hash:b.id)}),e&&!p&&h.jsxs(I,{className:"aspect-square flex flex-col items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-gray-400 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:u,children:[h.jsx(pt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400",children:At("common.add")})]})]})})}),h.jsxs(I,{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center text-xs text-gray-500 dark:text-gray-400",children:[h.jsx(Q,{children:At("attachment.attached_count",{count:n,max:r})}),h.jsxs(Q,{children:[At("attachment.max_size",{size:s}),o&&` (${o})`]})]})]})},_p=v.forwardRef(({uploadTriggerEvent:t,attachmentableType:e,attachmentableId:n,collection:r="default",maxFiles:s=10,maxSize:o=10,maxConcurrentUploads:i=3,accept:a,imageCompression:l,roleIds:c=[],autoUpload:d=!0,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,initialFiles:y=[],disabled:b=!1,className:S="",confirmBeforeRemove:x=!1,confirmRemoveTitle:E,confirmRemoveMessage:k,apiEndpoints:C,uploadParams:N,enablePrimarySelection:_=!1,primaryFileId:w,onPrimaryChange:M,id:O,editorAttrs:L},F)=>{const $={upload:C?.upload??"/api/admin/attachments",delete:C?.delete??"/api/admin/attachments/:id",reorder:C?.reorder??"/api/admin/attachments/reorder"},D=aE({attachmentableType:e,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:y,endpoints:$,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,uploadTriggerEvent:t,confirmBeforeRemove:x,uploadParams:N});v.useImperativeHandle(F,()=>({uploadAll:D.handleUploadAll,clear:D.clear,getPendingFiles:D.getPendingFiles}));const A=v.useMemo(()=>D.imageFiles.map(z=>{const H=!("hash"in z),W=z,j=z;return H?{src:W.preview||"",filename:W.original_filename,title:W.original_filename,downloadRequiresAuth:!1}:{src:D.authenticatedImageUrls.get(j.id)||j.download_url,downloadUrl:j.download_url,filename:j.original_filename,title:j.original_filename,downloadRequiresAuth:!0}}),[D.imageFiles,D.authenticatedImageUrls]),T=v.useMemo(()=>({existingFiles:D.existingFiles,pendingFiles:D.pendingFiles,isDragOver:D.isDragOver,isDeleting:D.isDeleting,maxFiles:s,maxSize:o,accept:a,endpoints:$,confirmBeforeRemove:x,totalCount:D.totalCount,hasFiles:D.hasFiles,canAddMore:D.canAddMore,allItems:D.allItems,imageFiles:D.imageFiles,handleFiles:D.handleFiles,handleRemove:D.handleRemove,handleRetry:D.handleRetry,handleUploadAll:D.handleUploadAll,handleOpenGallery:D.handleOpenGallery,handleDownload:D.handleDownload,handleDragEnd:D.handleDragEnd,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,galleryOpen:D.galleryOpen,setGalleryOpen:D.setGalleryOpen,galleryStartIndex:D.galleryStartIndex,galleryKeyRef:D.galleryKeyRef,confirmDialogOpen:D.confirmDialogOpen,setConfirmDialogOpen:D.setConfirmDialogOpen,itemToDelete:D.itemToDelete,executeRemoveAttachment:D.executeRemoveAttachment,authenticatedImageUrls:D.authenticatedImageUrls}),[D,s,o,a,$,x]);return h.jsx(q2,{value:T,children:h.jsxs(I,{id:O,className:S,...L,children:[h.jsx(lE,{isDragOver:D.isDragOver,canAddMore:D.canAddMore,onFiles:D.handleFiles,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,accept:a,maxFiles:s,maxSize:o,disabled:b,children:D.hasFiles&&h.jsx(fE,{allItems:D.allItems,canAddMore:D.canAddMore,totalCount:D.totalCount,maxFiles:s,maxSize:o,accept:a,onRemove:D.handleRemove,onRetry:D.handleRetry,onImageClick:D.handleOpenGallery,onDownload:D.handleDownload,onDragEnd:D.handleDragEnd,onAddClick:()=>D.inputRef.current?.click(),enablePrimarySelection:_,primaryFileId:w,onPrimaryChange:M,disabled:b})}),x&&h.jsx(nu,{isOpen:D.confirmDialogOpen,onClose:()=>{D.isDeleting||D.setConfirmDialogOpen(!1)},title:E??At("attachment.delete_confirm_title"),message:k??At("attachment.delete_confirm_message"),confirmText:At("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{D.itemToDelete&&D.executeRemoveAttachment(D.itemToDelete)},isLoading:D.isDeleting,loadingText:At("attachment.deleting")}),A.length>0&&D.galleryOpen&&h.jsx(Bi,{images:A,isOpen:!0,onClose:()=>D.setGalleryOpen(!1),startIndex:D.galleryStartIndex,showDownload:!0},`gallery-${D.galleryKeyRef.current}`)]})})});_p.displayName="FileUploader";const hE=({name:t,value:e,options:n,onChange:r,disabled:s=!1,inline:o=!1,className:i="",size:a="md",label:l,error:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(()=>e??"");v.useEffect(()=>{g(e??"")},[e]);const m=S=>{const x=S.target.value;g(x),r&&!s&&r(S)},y={sm:{radio:"w-3.5 h-3.5",label:"text-xs",gap:"gap-1.5"},md:{radio:"w-4 h-4",label:"text-sm",gap:"gap-2"},lg:{radio:"w-5 h-5",label:"text-base",gap:"gap-2.5"}}[a],b=o?"flex flex-wrap items-center gap-4":"flex flex-col gap-2";return h.jsxs(I,{className:i,id:d,...u,children:[l&&h.jsx(Q,{className:`block mb-2 font-medium text-gray-700 dark:text-gray-300 ${y.label}`,children:l}),h.jsx(I,{className:b,children:n.map(S=>{const x=String(S.value)===String(f),E=s||S.disabled;return h.jsxs(rn,{className:`inline-flex items-center ${y.gap} ${E?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[h.jsx("input",{type:"radio",name:t,value:S.value,checked:x,onChange:m,disabled:E,className:` + `,onDragOver:u=>{u.preventDefault(),d&&r(!0)},onDragLeave:()=>r(!1),onDrop:u=>{u.preventDefault(),r(!1),d&&n(u.dataTransfer.files)},children:[h.jsx("input",{ref:s,type:"file",multiple:!0,accept:o,onChange:u=>u.target.files&&!l&&n(u.target.files),className:"hidden",disabled:l}),!c&&h.jsxs(I,{className:`p-8 text-center transition-colors ${l?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,onClick:()=>!l&&s.current?.click(),children:[h.jsx(pt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),h.jsx(bt,{className:"text-sm text-gray-600 dark:text-gray-400",children:At("attachment.drop_or_click")}),h.jsxs(bt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[At("attachment.upload_limit",{maxFiles:i,maxSize:a}),o&&` (${o})`]})]}),c]})},fE=window.G7Core,hE=window.G7Core?.createLogger?.("Comp:SortableThumbnail")??{log:(...t)=>console.log("[Comp:SortableThumbnail]",...t),warn:(...t)=>console.warn("[Comp:SortableThumbnail]",...t),error:(...t)=>console.error("[Comp:SortableThumbnail]",...t)},gE=({file:t,onRemove:e,onRetry:n,onImageClick:r,onDownload:s,isPrimary:o,onPrimaryClick:i,disabled:a})=>{const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:g}=Di({id:"hash"in t?t.hash:t.id}),m={transform:Ln.Transform.toString(u),transition:f,opacity:g?.5:1},p="status"in t&&t.status!==void 0,y=p?t.status:"done",b=y==="uploading",S=y==="compressing",x=y==="error",E=p?t.progress:100,k=p?t.preview:void 0,C=p?t.mime_type?.startsWith("image/")??!1:t.is_image,[N,_]=v.useState(void 0),w=!p&&C?t.download_url:void 0;v.useEffect(()=>{if(!w){_(void 0);return}let O=!0,L;return(async()=>{try{const $=await fE.api.get(w,{responseType:"blob"});O&&$&&(L=URL.createObjectURL($),_(L))}catch($){hE.error("Failed to load authenticated image:",$)}})(),()=>{O=!1,L&&URL.revokeObjectURL(L)}},[w]);const M=N;return h.jsxs(I,{ref:d,style:m,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsxs(I,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${C||!p?"cursor-pointer":""}`,onClick:()=>{b||S||(C&&r?r():!p&&s&&s())},children:[k||M?h.jsx(yn,{src:k||M,alt:t.original_filename,className:"w-full h-full object-cover"}):h.jsx(pt,{className:`fa-solid ${cE(t.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(b||S)&&h.jsxs(I,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[h.jsx(I,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:h.jsx(I,{className:"h-full bg-blue-500 transition-all",style:{width:`${E}%`}})}),h.jsxs(Q,{className:"text-white text-xs mt-1",children:[E,"%"]})]}),x&&h.jsx(I,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:h.jsx(pt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),i&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),i()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${o?"bg-yellow-500 text-white":"bg-gray-800/50 text-gray-300 hover:bg-yellow-500 hover:text-white opacity-0 group-hover:opacity-100"}`,title:At(o?"attachment.primary_image":"attachment.set_as_primary"),children:h.jsx(pt,{className:"fa-solid fa-star text-xs"})}),h.jsxs(I,{className:`absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-start justify-end p-1 gap-1 opacity-0 group-hover:opacity-100 ${a?"hidden":""}`,children:[h.jsx(oe,{type:"button",...l,...c,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-gray-600 dark:text-gray-300 hover:bg-white cursor-grab active:cursor-grabbing",title:At("attachment.drag_to_reorder"),onClick:O=>O.stopPropagation(),children:h.jsx(pt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&s&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),s()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:At("common.download"),children:h.jsx(pt,{className:"fa-solid fa-download text-sm"})}),x&&n&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),n()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:At("common.retry"),children:h.jsx(pt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),e()},disabled:b||S,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:At("common.delete"),children:h.jsx(pt,{className:"fa-solid fa-times text-sm"})})]})]}),h.jsxs(I,{className:`p-2 ${!p&&s?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&s&&s()},children:[h.jsx(bt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:t.original_filename,children:t.original_filename}),h.jsx(bt,{className:"text-xs text-gray-500 dark:text-gray-400",children:t.size_formatted})]})]})},pE=({allItems:t,canAddMore:e,totalCount:n,maxFiles:r,maxSize:s,accept:o,onRemove:i,onRetry:a,onImageClick:l,onDownload:c,onDragEnd:d,onAddClick:u,enablePrimarySelection:f,primaryFileId:g,onPrimaryChange:m,disabled:p})=>{const y=jl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Ii}));return h.jsxs(I,{className:"p-3",children:[h.jsx(ec,{sensors:y,collisionDetection:Wl,onDragEnd:d,children:h.jsx(Ai,{items:t.map(b=>"hash"in b?b.hash:b.id),strategy:Oi,children:h.jsxs(I,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[t.map(b=>{const S="hash"in b,x=S?b.is_image:b.mime_type?.startsWith("image/")??!1;return h.jsx(gE,{file:b,onRemove:()=>i(b),onRetry:"status"in b&&b.status==="error"?()=>a(b):void 0,onImageClick:x?()=>l(b):void 0,onDownload:S?()=>c(b):void 0,isPrimary:f&&S&&(b.hash||b.id)===g,onPrimaryClick:f&&S?()=>m?.(b.hash||b.id):void 0,disabled:p},S?b.hash:b.id)}),e&&!p&&h.jsxs(I,{className:"aspect-square flex flex-col items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-gray-400 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:u,children:[h.jsx(pt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400",children:At("common.add")})]})]})})}),h.jsxs(I,{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center text-xs text-gray-500 dark:text-gray-400",children:[h.jsx(Q,{children:At("attachment.attached_count",{count:n,max:r})}),h.jsxs(Q,{children:[At("attachment.max_size",{size:s}),o&&` (${o})`]})]})]})},Ep=v.forwardRef(({uploadTriggerEvent:t,attachmentableType:e,attachmentableId:n,collection:r="default",maxFiles:s=10,maxSize:o=10,maxConcurrentUploads:i=3,accept:a,imageCompression:l,roleIds:c=[],autoUpload:d=!0,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,initialFiles:y=[],disabled:b=!1,className:S="",confirmBeforeRemove:x=!1,confirmRemoveTitle:E,confirmRemoveMessage:k,apiEndpoints:C,uploadParams:N,enablePrimarySelection:_=!1,primaryFileId:w,onPrimaryChange:M,id:O,editorAttrs:L},F)=>{const $={upload:C?.upload??"/api/admin/attachments",delete:C?.delete??"/api/admin/attachments/:id",reorder:C?.reorder??"/api/admin/attachments/reorder"},D=dE({attachmentableType:e,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:y,endpoints:$,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,uploadTriggerEvent:t,confirmBeforeRemove:x,uploadParams:N});v.useImperativeHandle(F,()=>({uploadAll:D.handleUploadAll,clear:D.clear,getPendingFiles:D.getPendingFiles}));const A=v.useMemo(()=>D.imageFiles.map(z=>{const H=!("hash"in z),W=z,j=z;return H?{src:W.preview||"",filename:W.original_filename,title:W.original_filename,downloadRequiresAuth:!1}:{src:D.authenticatedImageUrls.get(j.id)||j.download_url,downloadUrl:j.download_url,filename:j.original_filename,title:j.original_filename,downloadRequiresAuth:!0}}),[D.imageFiles,D.authenticatedImageUrls]),T=v.useMemo(()=>({existingFiles:D.existingFiles,pendingFiles:D.pendingFiles,isDragOver:D.isDragOver,isDeleting:D.isDeleting,maxFiles:s,maxSize:o,accept:a,endpoints:$,confirmBeforeRemove:x,totalCount:D.totalCount,hasFiles:D.hasFiles,canAddMore:D.canAddMore,allItems:D.allItems,imageFiles:D.imageFiles,handleFiles:D.handleFiles,handleRemove:D.handleRemove,handleRetry:D.handleRetry,handleUploadAll:D.handleUploadAll,handleOpenGallery:D.handleOpenGallery,handleDownload:D.handleDownload,handleDragEnd:D.handleDragEnd,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,galleryOpen:D.galleryOpen,setGalleryOpen:D.setGalleryOpen,galleryStartIndex:D.galleryStartIndex,galleryKeyRef:D.galleryKeyRef,confirmDialogOpen:D.confirmDialogOpen,setConfirmDialogOpen:D.setConfirmDialogOpen,itemToDelete:D.itemToDelete,executeRemoveAttachment:D.executeRemoveAttachment,authenticatedImageUrls:D.authenticatedImageUrls}),[D,s,o,a,$,x]);return h.jsx(J2,{value:T,children:h.jsxs(I,{id:O,className:S,...L,children:[h.jsx(uE,{isDragOver:D.isDragOver,canAddMore:D.canAddMore,onFiles:D.handleFiles,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,accept:a,maxFiles:s,maxSize:o,disabled:b,children:D.hasFiles&&h.jsx(pE,{allItems:D.allItems,canAddMore:D.canAddMore,totalCount:D.totalCount,maxFiles:s,maxSize:o,accept:a,onRemove:D.handleRemove,onRetry:D.handleRetry,onImageClick:D.handleOpenGallery,onDownload:D.handleDownload,onDragEnd:D.handleDragEnd,onAddClick:()=>D.inputRef.current?.click(),enablePrimarySelection:_,primaryFileId:w,onPrimaryChange:M,disabled:b})}),x&&h.jsx(ru,{isOpen:D.confirmDialogOpen,onClose:()=>{D.isDeleting||D.setConfirmDialogOpen(!1)},title:E??At("attachment.delete_confirm_title"),message:k??At("attachment.delete_confirm_message"),confirmText:At("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{D.itemToDelete&&D.executeRemoveAttachment(D.itemToDelete)},isLoading:D.isDeleting,loadingText:At("attachment.deleting")}),A.length>0&&D.galleryOpen&&h.jsx(Bi,{images:A,isOpen:!0,onClose:()=>D.setGalleryOpen(!1),startIndex:D.galleryStartIndex,showDownload:!0},`gallery-${D.galleryKeyRef.current}`)]})})});Ep.displayName="FileUploader";const mE=({name:t,value:e,options:n,onChange:r,disabled:s=!1,inline:o=!1,className:i="",size:a="md",label:l,error:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(()=>e??"");v.useEffect(()=>{g(e??"")},[e]);const m=S=>{const x=S.target.value;g(x),r&&!s&&r(S)},y={sm:{radio:"w-3.5 h-3.5",label:"text-xs",gap:"gap-1.5"},md:{radio:"w-4 h-4",label:"text-sm",gap:"gap-2"},lg:{radio:"w-5 h-5",label:"text-base",gap:"gap-2.5"}}[a],b=o?"flex flex-wrap items-center gap-4":"flex flex-col gap-2";return h.jsxs(I,{className:i,id:d,...u,children:[l&&h.jsx(Q,{className:`block mb-2 font-medium text-gray-700 dark:text-gray-300 ${y.label}`,children:l}),h.jsx(I,{className:b,children:n.map(S=>{const x=String(S.value)===String(f),E=s||S.disabled;return h.jsxs(rn,{className:`inline-flex items-center ${y.gap} ${E?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[h.jsx("input",{type:"radio",name:t,value:S.value,checked:x,onChange:m,disabled:E,className:` ${y.radio} text-blue-600 bg-gray-100 dark:bg-gray-700 @@ -237,10 +237,10 @@ self.addEventListener('message', async (e) => { ${y.label} font-medium text-gray-900 dark:text-gray-300 - `,children:S.label})]},S.value)})}),c&&h.jsx(Q,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:c})]})},as=()=>window.G7Core,qi=(t,e)=>as()?.t?.(t,e)??t,gE=()=>as()?.locale?.supported?.()??["ko","en"],pE=()=>as()?.locale?.current?.()??"ko",Ep=t=>{const e=qi(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},mE=({content:t="",value:e,onChange:n,multilingual:r=!1,isHtml:s=!1,onIsHtmlChange:o,rows:i=15,placeholder:a="",label:l,showHtmlModeToggle:c=!0,contentClassName:d="",purifyConfig:u,className:f="",name:g="content",htmlFieldName:m="content_mode",readOnly:p=!1,id:y,editorAttrs:b})=>{const S=v.useMemo(()=>gE(),[]),x=v.useMemo(()=>pE(),[]),[E,k]=v.useState(x),[C,N]=v.useState(s),[_,w]=v.useState(t),[M,O]=v.useState(e??{}),[L,F]=v.useState(!1);v.useEffect(()=>{N(s)},[s]),v.useEffect(()=>{r||w(t)},[t,r]),v.useEffect(()=>{r&&e&&O(e)},[e,r]);const $=v.useCallback(j=>{const U=j.target.value;if(w(U),n){const B=as()?.createChangeEvent?.({value:U,name:g,type:"textarea"})??{target:{name:g,value:U}};n(B)}},[n,g]),D=v.useCallback((j,U)=>{const B={...M,[j]:U};if(O(B),n){const G=as()?.createChangeEvent?.({value:B,name:g,type:"multilingual"})??{target:{name:g,value:B}};n(G)}},[n,g,M]),A=v.useCallback(j=>{const U=j.target.checked;if(N(U),U||F(!1),o){const B=as()?.createChangeEvent?.({checked:U,name:m,type:"checkbox"})??{target:{name:m,checked:U}};o(B)}},[o,m]),T=v.useCallback(()=>{F(j=>!j)},[]),z=r?M[E]??"":_,H=v.useCallback(j=>!!M[j]?.trim(),[M]),W=()=>h.jsx(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:S.map(j=>{const U=j===x,B=E===j;return h.jsxs(oe,{type:"button",className:` + `,children:S.label})]},S.value)})}),c&&h.jsx(Q,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:c})]})},as=()=>window.G7Core,qi=(t,e)=>as()?.t?.(t,e)??t,bE=()=>as()?.locale?.supported?.()??["ko","en"],yE=()=>as()?.locale?.current?.()??"ko",Mp=t=>{const e=qi(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},vE=({content:t="",value:e,onChange:n,multilingual:r=!1,isHtml:s=!1,onIsHtmlChange:o,rows:i=15,placeholder:a="",label:l,showHtmlModeToggle:c=!0,contentClassName:d="",purifyConfig:u,className:f="",name:g="content",htmlFieldName:m="content_mode",readOnly:p=!1,id:y,editorAttrs:b})=>{const S=v.useMemo(()=>bE(),[]),x=v.useMemo(()=>yE(),[]),[E,k]=v.useState(x),[C,N]=v.useState(s),[_,w]=v.useState(t),[M,O]=v.useState(e??{}),[L,F]=v.useState(!1);v.useEffect(()=>{N(s)},[s]),v.useEffect(()=>{r||w(t)},[t,r]),v.useEffect(()=>{r&&e&&O(e)},[e,r]);const $=v.useCallback(j=>{const U=j.target.value;if(w(U),n){const B=as()?.createChangeEvent?.({value:U,name:g,type:"textarea"})??{target:{name:g,value:U}};n(B)}},[n,g]),D=v.useCallback((j,U)=>{const B={...M,[j]:U};if(O(B),n){const G=as()?.createChangeEvent?.({value:B,name:g,type:"multilingual"})??{target:{name:g,value:B}};n(G)}},[n,g,M]),A=v.useCallback(j=>{const U=j.target.checked;if(N(U),U||F(!1),o){const B=as()?.createChangeEvent?.({checked:U,name:m,type:"checkbox"})??{target:{name:m,checked:U}};o(B)}},[o,m]),T=v.useCallback(()=>{F(j=>!j)},[]),z=r?M[E]??"":_,H=v.useCallback(j=>!!M[j]?.trim(),[M]),W=()=>h.jsx(I,{className:"flex flex-wrap items-center gap-2 mb-3",children:S.map(j=>{const U=j===x,B=E===j;return h.jsxs(oe,{type:"button",className:` inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all ${B?U?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":U?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"} - `,onClick:()=>k(j),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),h.jsx(Q,{children:Ep(j)}),U&&h.jsx(Q,{className:"text-red-500",children:"*"}),H(j)&&!B&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"})]},j)})});return h.jsxs(I,{className:`space-y-2 ${f}`,id:y,...b,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[l&&h.jsx(rn,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:l}),h.jsxs(I,{className:"flex items-center gap-3",children:[C&&!p&&h.jsx(oe,{type:"button",onClick:T,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${L?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:qi(L?"common.preview_off":"common.preview")}),c&&h.jsxs(rn,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[h.jsx(wt,{type:"checkbox",name:m,checked:C,onChange:A,disabled:p,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(I,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:qi("common.html_mode")})]})]})]}),r&&W(),!L&&(r?S.map(j=>h.jsx(I,{className:E===j?"block":"hidden",children:h.jsx(Zn,{name:`${g}[${j}]`,value:M[j]??"",onChange:U=>D(j,U.target.value),placeholder:`${a} (${Ep(j)})`,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${C?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})},j)):h.jsx(Zn,{name:g,value:_,onChange:$,placeholder:a,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${C?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})),L&&h.jsx(I,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:h.jsx(qa,{content:z,isHtml:!0,className:d||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:u})})]})},Mp="g7_dismissed_warnings";function Np(){try{const t=sessionStorage.getItem(Mp);return t?JSON.parse(t):[]}catch{return[]}}function bE(t){try{const e=Np();e.includes(t)||(e.push(t),sessionStorage.setItem(Mp,JSON.stringify(e)))}catch{}}function yE(t){switch(t){case"error":return"error";case"warning":return"warning";default:return"info"}}const vE=({warnings:t,className:e=""})=>{const[n,r]=v.useState([]);v.useEffect(()=>{r(Np())},[]);const s=v.useCallback(i=>{bE(i),r(a=>[...a,i])},[]);if(!t||t.length===0)return null;const o=t.filter(i=>!n.includes(i.id));return o.length===0?null:h.jsx(I,{className:`space-y-2 ${e}`.trim(),children:o.map(i=>h.jsx(lu,{type:yE(i.level),message:i.message,dismissible:!0,onDismiss:()=>s(i.id)},i.id))})},Op=window.G7Core?.createLogger?.("Comp:FilterVisibility")??{log:(...t)=>console.log("[Comp:FilterVisibility]",...t),warn:(...t)=>console.warn("[Comp:FilterVisibility]",...t),error:(...t)=>console.error("[Comp:FilterVisibility]",...t)},xE=({id:t,visibleFilters:e,defaultFilters:n=[],onFilterVisibilityChange:r})=>{const[s,o]=v.useState(!1),i=v.useRef(!0),a=v.useMemo(()=>{try{const f=window.G7Core?.AuthManager?.getInstance();return f?f.getUser()?.uuid:void 0}catch{return}},[]),l=v.useMemo(()=>`g7_filters_${t}${a!==void 0?`_${a}`:""}`,[t,a]),c=v.useCallback(()=>{try{const f=localStorage.getItem(l);if(f){const g=JSON.parse(f);if(Array.isArray(g))return g}}catch(f){Op.warn("Failed to load from localStorage:",f)}return null},[l]),d=v.useCallback(f=>{try{localStorage.setItem(l,JSON.stringify(f))}catch(g){Op.warn("Failed to save to localStorage:",g)}},[l]),u=v.useCallback(()=>{const f=c();return f||(e&&e.length>0?e:n)},[c,e,n]);return v.useEffect(()=>{if(!s){const f=u();r&&f.length>0&&r(f),o(!0)}},[s,r,u]),v.useEffect(()=>{if(s&&e&&e.length>0){if(i.current){i.current=!1;return}d(e)}},[s,e,d]),null},wE=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...t)=>console.log("[Comp:SlotContainer]",...t),warn:(...t)=>console.warn("[Comp:SlotContainer]",...t),error:(...t)=>console.error("[Comp:SlotContainer]",...t)};function kE(t,e){return e&&t&&typeof t.id=="string"&&t.id.length>0?{...t,id:`${t.id}__${e}`}:t}const CE=({slotId:t,className:e="",emptyContent:n,style:r,id:s,children:o})=>{const[i,a]=v.useState([]),[,l]=v.useState({}),c=v.useCallback(()=>{const m=window.__slotContextValue;if(m)return m;const p=window.G7Core;return p&&p.getSlotContext?.()||null},[]),d=v.useCallback(()=>{const m=c();m&&m.isEnabled&&a(m.getSlotComponents(t))},[t,c]);v.useEffect(()=>{const m=c();return!m||!m.isEnabled?void 0:(d(),m.subscribeToSlot(t,()=>{d(),l({})}))},[t,c,d]);const u=v.useCallback(()=>{const m=window.G7Core;return m?m.getDynamicRenderer?.():null},[]);if(i.length===0)return n?h.jsx(I,{className:e,style:r,id:s,children:n}):o?h.jsx(I,{className:e,style:r,id:s,children:o}):null;const f=u(),g=window.G7Core;return!f||!g?(wE.error("G7Core or DynamicRenderer not available"),null):h.jsxs(I,{className:e,style:r,id:s,children:[i.map(m=>{const{componentDef:p,dataContext:y,parentFormContext:b,getParentComponentContext:S,translationContext:x}=m,E=kE(p,s);return h.jsx(f,{componentDef:E,dataContext:y,translationContext:x,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:S?.(),parentFormContextProp:b,isRootRenderer:!1},E.id||`slot-${t}-${m.order}`)}),o]})},Tp=(t,e)=>window.G7Core?.t?.(t,e)??t,Ap=(t,e,n)=>window.G7Core?.renderComponentLayout?.(t,e,n)??null,SE=({options:t=[],value:e,onChange:n,placeholder:r,disabled:s=!1,className:o="",maxHeight:i="320px",children:a,selectedChildren:l,__componentLayoutDefs:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(!1),m=v.useRef(null),p=v.useRef(null),y=v.useMemo(()=>e==null?null:t.find(C=>String(C.value)===String(e))||null,[t,e]);v.useEffect(()=>{const C=N=>{m.current&&!m.current.contains(N.target)&&g(!1)};return f&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[f]),v.useEffect(()=>{const C=N=>{N.key==="Escape"&&f&&(g(!1),p.current?.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[f]);const b=v.useCallback(()=>{s||g(C=>!C)},[s]),S=v.useCallback(C=>{n&&n({target:{value:C},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),p.current?.focus()},[n]),x=r??Tp("common.select"),E=()=>{if(!y)return h.jsx(Q,{className:"text-gray-400 dark:text-gray-500",children:x});if(c?.selected){const C=Ap(c.selected,{item:y,isSelected:!0},"selected");if(C)return C}return l||h.jsx(Q,{className:"truncate",children:y.label})},k=(C,N)=>h.jsxs(I,{className:"flex items-center justify-between w-full",children:[h.jsx(Q,{className:N?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-900 dark:text-white",children:C.label}),N&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]});return h.jsxs(I,{ref:m,className:`relative ${o}`,id:d,...u,children:[h.jsxs(oe,{ref:p,type:"button",onClick:b,disabled:s,className:` + `,onClick:()=>k(j),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),h.jsx(Q,{children:Mp(j)}),U&&h.jsx(Q,{className:"text-red-500",children:"*"}),H(j)&&!B&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"})]},j)})});return h.jsxs(I,{className:`space-y-2 ${f}`,id:y,...b,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[l&&h.jsx(rn,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:l}),h.jsxs(I,{className:"flex items-center gap-3",children:[C&&!p&&h.jsx(oe,{type:"button",onClick:T,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${L?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:qi(L?"common.preview_off":"common.preview")}),c&&h.jsxs(rn,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[h.jsx(wt,{type:"checkbox",name:m,checked:C,onChange:A,disabled:p,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(I,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:qi("common.html_mode")})]})]})]}),r&&W(),!L&&(r?S.map(j=>h.jsx(I,{className:E===j?"block":"hidden",children:h.jsx(Zn,{name:`${g}[${j}]`,value:M[j]??"",onChange:U=>D(j,U.target.value),placeholder:`${a} (${Mp(j)})`,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${C?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})},j)):h.jsx(Zn,{name:g,value:_,onChange:$,placeholder:a,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${C?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})),L&&h.jsx(I,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:h.jsx(qa,{content:z,isHtml:!0,className:d||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:u})})]})},Np="g7_dismissed_warnings";function Op(){try{const t=sessionStorage.getItem(Np);return t?JSON.parse(t):[]}catch{return[]}}function xE(t){try{const e=Op();e.includes(t)||(e.push(t),sessionStorage.setItem(Np,JSON.stringify(e)))}catch{}}function wE(t){switch(t){case"error":return"error";case"warning":return"warning";default:return"info"}}const kE=({warnings:t,className:e=""})=>{const[n,r]=v.useState([]);v.useEffect(()=>{r(Op())},[]);const s=v.useCallback(i=>{xE(i),r(a=>[...a,i])},[]);if(!t||t.length===0)return null;const o=t.filter(i=>!n.includes(i.id));return o.length===0?null:h.jsx(I,{className:`space-y-2 ${e}`.trim(),children:o.map(i=>h.jsx(cu,{type:wE(i.level),message:i.message,dismissible:!0,onDismiss:()=>s(i.id)},i.id))})},Tp=window.G7Core?.createLogger?.("Comp:FilterVisibility")??{log:(...t)=>console.log("[Comp:FilterVisibility]",...t),warn:(...t)=>console.warn("[Comp:FilterVisibility]",...t),error:(...t)=>console.error("[Comp:FilterVisibility]",...t)},CE=({id:t,visibleFilters:e,defaultFilters:n=[],onFilterVisibilityChange:r})=>{const[s,o]=v.useState(!1),i=v.useRef(!0),a=v.useMemo(()=>{try{const f=window.G7Core?.AuthManager?.getInstance();return f?f.getUser()?.uuid:void 0}catch{return}},[]),l=v.useMemo(()=>`g7_filters_${t}${a!==void 0?`_${a}`:""}`,[t,a]),c=v.useCallback(()=>{try{const f=localStorage.getItem(l);if(f){const g=JSON.parse(f);if(Array.isArray(g))return g}}catch(f){Tp.warn("Failed to load from localStorage:",f)}return null},[l]),d=v.useCallback(f=>{try{localStorage.setItem(l,JSON.stringify(f))}catch(g){Tp.warn("Failed to save to localStorage:",g)}},[l]),u=v.useCallback(()=>{const f=c();return f||(e&&e.length>0?e:n)},[c,e,n]);return v.useEffect(()=>{if(!s){const f=u();r&&f.length>0&&r(f),o(!0)}},[s,r,u]),v.useEffect(()=>{if(s&&e&&e.length>0){if(i.current){i.current=!1;return}d(e)}},[s,e,d]),null},SE=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...t)=>console.log("[Comp:SlotContainer]",...t),warn:(...t)=>console.warn("[Comp:SlotContainer]",...t),error:(...t)=>console.error("[Comp:SlotContainer]",...t)};function _E(t,e){return e&&t&&typeof t.id=="string"&&t.id.length>0?{...t,id:`${t.id}__${e}`}:t}const EE=({slotId:t,className:e="",emptyContent:n,style:r,id:s,children:o})=>{const[i,a]=v.useState([]),[,l]=v.useState({}),c=v.useCallback(()=>{const m=window.__slotContextValue;if(m)return m;const p=window.G7Core;return p&&p.getSlotContext?.()||null},[]),d=v.useCallback(()=>{const m=c();m&&m.isEnabled&&a(m.getSlotComponents(t))},[t,c]);v.useEffect(()=>{const m=c();return!m||!m.isEnabled?void 0:(d(),m.subscribeToSlot(t,()=>{d(),l({})}))},[t,c,d]);const u=v.useCallback(()=>{const m=window.G7Core;return m?m.getDynamicRenderer?.():null},[]);if(i.length===0)return n?h.jsx(I,{className:e,style:r,id:s,children:n}):o?h.jsx(I,{className:e,style:r,id:s,children:o}):null;const f=u(),g=window.G7Core;return!f||!g?(SE.error("G7Core or DynamicRenderer not available"),null):h.jsxs(I,{className:e,style:r,id:s,children:[i.map(m=>{const{componentDef:p,dataContext:y,parentFormContext:b,getParentComponentContext:S,translationContext:x}=m,E=_E(p,s);return h.jsx(f,{componentDef:E,dataContext:y,translationContext:x,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:S?.(),parentFormContextProp:b,isRootRenderer:!1},E.id||`slot-${t}-${m.order}`)}),o]})},Ap=(t,e)=>window.G7Core?.t?.(t,e)??t,Dp=(t,e,n)=>window.G7Core?.renderComponentLayout?.(t,e,n)??null,ME=({options:t=[],value:e,onChange:n,placeholder:r,disabled:s=!1,className:o="",maxHeight:i="320px",children:a,selectedChildren:l,__componentLayoutDefs:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(!1),m=v.useRef(null),p=v.useRef(null),y=v.useMemo(()=>e==null?null:t.find(C=>String(C.value)===String(e))||null,[t,e]);v.useEffect(()=>{const C=N=>{m.current&&!m.current.contains(N.target)&&g(!1)};return f&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[f]),v.useEffect(()=>{const C=N=>{N.key==="Escape"&&f&&(g(!1),p.current?.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[f]);const b=v.useCallback(()=>{s||g(C=>!C)},[s]),S=v.useCallback(C=>{n&&n({target:{value:C},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),p.current?.focus()},[n]),x=r??Ap("common.select"),E=()=>{if(!y)return h.jsx(Q,{className:"text-gray-400 dark:text-gray-500",children:x});if(c?.selected){const C=Dp(c.selected,{item:y,isSelected:!0},"selected");if(C)return C}return l||h.jsx(Q,{className:"truncate",children:y.label})},k=(C,N)=>h.jsxs(I,{className:"flex items-center justify-between w-full",children:[h.jsx(Q,{className:N?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-900 dark:text-white",children:C.label}),N&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]});return h.jsxs(I,{ref:m,className:`relative ${o}`,id:d,...u,children:[h.jsxs(oe,{ref:p,type:"button",onClick:b,disabled:s,className:` w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl @@ -249,13 +249,13 @@ self.addEventListener('message', async (e) => { flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed - `,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(I,{className:"flex-1 min-w-0",children:E()}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&h.jsx(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",role:"listbox",children:h.jsx(I,{className:"overflow-auto",style:{maxHeight:i},children:t.length===0?h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:Tp("common.no_options")}):t.map((C,N)=>{const _=String(C.value)===String(e);return h.jsx(oe,{type:"button",onClick:()=>!C.disabled&&S(C.value),disabled:C.disabled,className:` + `,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(I,{className:"flex-1 min-w-0",children:E()}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&h.jsx(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",role:"listbox",children:h.jsx(I,{className:"overflow-auto",style:{maxHeight:i},children:t.length===0?h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:Ap("common.no_options")}):t.map((C,N)=>{const _=String(C.value)===String(e);return h.jsx(oe,{type:"button",onClick:()=>!C.disabled&&S(C.value),disabled:C.disabled,className:` w-full px-4 py-3 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${_?"bg-blue-50 dark:bg-blue-900/20":""} ${C.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"} - `,role:"option","aria-selected":_,"data-item-value":C.value,"data-item-index":N,"data-item-selected":_,children:c?.item?Ap(c.item,{item:C,index:N,isSelected:_},`item-${N}`):a||k(C,_)},C.value)})})})]})};function _E(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}const EE=({value:t,checked:e=!1,icon:n,label:r,variant:s="blue",customColor:o,className:i="",style:a,onChange:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),g="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border cursor-pointer transition-all";if(o){const b=_E(o),S=document.documentElement.classList.contains("dark");let x;return e?x={backgroundColor:o,color:"#ffffff",borderColor:o,opacity:u?.85:1}:x=b?{backgroundColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${u?S?.25:.12:S?.15:.06})`,color:o,borderColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${S?.3:.2})`}:{},h.jsxs(rn,{className:`${g} ${i}`,style:{...x,...a},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:t,checked:e,onChange:E=>{l?.(E)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})}const y=e?{green:"bg-green-600 dark:bg-green-600 text-white dark:text-white border-green-700 dark:border-green-500 hover:bg-green-700 dark:hover:bg-green-500",orange:"bg-orange-600 dark:bg-orange-600 text-white dark:text-white border-orange-700 dark:border-orange-500 hover:bg-orange-700 dark:hover:bg-orange-500",yellow:"bg-yellow-600 dark:bg-yellow-600 text-white dark:text-white border-yellow-700 dark:border-yellow-500 hover:bg-yellow-700 dark:hover:bg-yellow-500",gray:"bg-gray-600 dark:bg-gray-500 text-white dark:text-white border-gray-700 dark:border-gray-400 hover:bg-gray-700 dark:hover:bg-gray-400",blue:"bg-blue-600 dark:bg-blue-600 text-white dark:text-white border-blue-700 dark:border-blue-500 hover:bg-blue-700 dark:hover:bg-blue-500"}[s]:{green:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/30",orange:"bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800 hover:bg-orange-100 dark:hover:bg-orange-900/30",yellow:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/30",gray:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600",blue:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/30"}[s];return h.jsxs(rn,{className:`${g} ${y} ${i}`,style:a,id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:t,checked:e,onChange:b=>{l?.(b)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})},ME=({label:t,icon:e,iconPosition:n="left",position:r="right",className:s="",style:o,children:i})=>{const[a,l]=v.useState(!1),[c,d]=v.useState({top:0,left:0}),u=v.useRef(null),f=v.useRef(null),g=v.useCallback(()=>{if(!u.current)return;const p=u.current.getBoundingClientRect(),y=224;let b=r==="right"?p.right-y:p.left;const S=p.bottom+8;b<8&&(b=8),b+y>window.innerWidth-8&&(b=window.innerWidth-y-8),d({top:S,left:b})},[r]);v.useEffect(()=>{a&&g()},[a,g]),v.useEffect(()=>{if(!a)return;const p=()=>{l(!1)};return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]),v.useEffect(()=>{const p=y=>{const b=y.target,S=u.current?.contains(b),x=f.current?.contains(b);!S&&!x&&l(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const m=a?On.createPortal(h.jsx("div",{ref:f,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:c.top,left:c.left},onClick:()=>l(!1),children:i}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,children:[h.jsxs(oe,{ref:u,onClick:()=>l(!a),className:"flex items-center gap-2",children:[n==="left"&&e&&h.jsx(re,{name:e,className:"w-4 h-4"}),t&&h.jsx(Q,{className:"text-sm font-medium",children:t}),n==="right"&&e&&h.jsx(re,{name:e,className:"w-4 h-4"})]}),m]})},NE=({label:t,icon:e,variant:n="default",disabled:r=!1,divider:s=!1,className:o="",style:i,onClick:a})=>{if(s)return h.jsx(I,{className:"h-px bg-gray-200 dark:bg-gray-700 my-1",style:i});const l=n==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",c=r?"opacity-50 cursor-not-allowed":"cursor-pointer",d=()=>{!r&&a&&a()};return h.jsxs(I,{onClick:d,className:`flex items-center gap-3 px-4 py-3 transition-colors ${l} ${c} ${o}`,style:i,children:[e&&h.jsx(re,{name:e,className:"w-4 h-4"}),t&&h.jsx(Q,{className:"text-sm font-medium",children:t})]})},OE=()=>window.G7Core,Pc=v.createContext(null),Dp=()=>{const t=v.useContext(Pc);if(!t){const e=OE(),n=e?.locale?.current?.()||"ko",r=e?.locale?.supported?.()||["ko","en"];return{activeLocale:n,getActiveLocale:()=>e?.locale?.current?.()||"ko",supportedLocales:r,isInsideMultilingualTabPanel:!1}}return{...t,isInsideMultilingualTabPanel:!0}},TE=()=>window.G7Core,AE=({value:t,onChange:e,placeholder:n,readOnly:r,disabled:s,hasError:o})=>{const{activeLocale:i,getActiveLocale:a}=Dp(),l=typeof t=="string"?{[i]:t}:t||{},c=v.useCallback(u=>{const f=a();e({...l,[f]:u.target.value})},[l,a,e]),d=o?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500";return h.jsx(wt,{type:"text",value:l[i]||"",onChange:c,placeholder:n,readOnly:r,disabled:s,className:`w-full px-3 py-2 text-sm border ${d} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2`})},DE=(t,e)=>{if(!e)return!1;const n=e.startsWith("!"),r=n?e.slice(1):e,s=!!t[r];return n?!s:s},IE=({column:t,item:e,index:n,onValueChange:r,readOnly:s,error:o})=>{const i=e[t.key],a=s||t.readOnly||DE(e,t.readOnlyCondition)||t.disabled,l=!!o,c=l?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500",d=v.useCallback(f=>{r(t.key,f)},[t.key,r]),u=f=>h.jsxs(I,{className:"w-full",children:[f,l&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:o})]});switch(t.type){case"input":return u(h.jsx(wt,{type:"text",value:i||"",onChange:f=>d(f.target.value),placeholder:t.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`}));case"number":return u(h.jsx(wt,{type:"number",value:i??"",onChange:f=>d(f.target.value?Number(f.target.value):null),placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`}));case"select":return u(h.jsxs(Pr,{value:i??"",onChange:f=>d(f.target.value),disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`,children:[h.jsx("option",{value:"",children:"선택하세요"}),t.options?.map(f=>h.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}));case"textarea":return u(h.jsx(Zn,{value:i||"",onChange:f=>d(f.target.value),placeholder:t.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 resize-none ${t.className||""}`,rows:2}));case"multilingual":return u(h.jsx(AE,{value:i,onChange:f=>d(f),placeholder:t.placeholder,readOnly:a,disabled:a,hasError:l}));case"custom":return t.render?h.jsx(h.Fragment,{children:t.render(e,n,d)}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"-"});default:return h.jsx(Q,{className:"text-gray-900 dark:text-white text-sm",children:String(i??"")})}},LE=(t,e,n)=>{if(!t)return;if(n==="multilingual"){const o=TE()?.locale?.current?.()||"ko",i=`${e}.${o}`;return t[i]?.[0]}return t[e]?.[0]},PE=({item:t,index:e,id:n,columns:r,enableDrag:s=!0,showIndex:o=!0,canRemove:i=!0,rowActions:a,readOnly:l=!1,onValueChange:c,onRemove:d,className:u="",level:f=0,errors:g})=>{const{attributes:m,listeners:p,setNodeRef:y,transform:b,transition:S,isDragging:x}=Di({id:n,disabled:!s||l}),E={transform:Ln.Transform.toString(b),transition:S,opacity:x?.5:1},k=v.useCallback((_,w)=>{c?.(_,w)},[c]),C=v.useCallback(_=>{_.onClick?.(t,e)},[t,e]),N=f>0?{paddingLeft:`${f*24}px`}:{};return h.jsxs(I,{ref:y,style:E,className:`flex items-center gap-2 py-2 px-2 border-b border-gray-100 dark:border-gray-700 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors ${x?"bg-blue-50 dark:bg-blue-900/20 shadow-lg rounded-lg z-10":""} ${u}`,children:[s&&!l&&h.jsx(I,{...m,...p,className:"flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-grab active:cursor-grabbing text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400",style:N,children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),o&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-sm text-gray-500 dark:text-gray-400 font-medium",children:e+1}),r.map(_=>{const w=LE(g,_.key,_.type);return h.jsx(I,{className:`flex-1 min-w-0 ${_.width||""}`,style:_.width?{flex:"none",width:_.width}:{},children:h.jsx(IE,{column:_,item:t,index:e,onValueChange:k,readOnly:l,error:w})},_.key)}),a&&a.length>0&&!l&&h.jsx(I,{className:"flex-shrink-0 flex items-center gap-1",children:a.map(_=>{const w=typeof _.disabled=="function"?_.disabled(t,e):_.disabled;return h.jsx(oe,{type:"button",onClick:()=>C(_),disabled:w,className:`p-1.5 rounded transition-colors ${_.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300"} disabled:opacity-50 disabled:cursor-not-allowed`,title:_.label,children:_.icon?h.jsx(re,{name:_.icon,className:"w-4 h-4"}):h.jsx(Q,{className:"text-xs",children:_.label})},_.key)})}),i&&!a&&!l&&h.jsx(I,{className:"flex-shrink-0",children:h.jsx(oe,{type:"button",onClick:d,className:"p-1.5 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",title:"삭제",children:h.jsx(re,{name:"minus",className:"w-4 h-4"})})})]})},Ip=()=>window.G7Core,$c=()=>`item_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,$E=t=>{const e={_id:$c()};return t.forEach(n=>{if(n.type==="multilingual"){const s=Ip()?.locale?.all?.()||["ko","en"],o={};s.forEach(i=>{o[i]=""}),e[n.key]=o}else n.type==="number"?e[n.key]=null:(n.type,e[n.key]="")}),e},FE=(t,e)=>{if(!t)return{};const n=`fields.${e}.`,r={};return Object.keys(t).forEach(s=>{if(s.startsWith(n)){const o=s.substring(n.length);r[o]=t[s]}}),r},zE=({items:t=[],columns:e,onChange:n,onAddItem:r,onRemoveItem:s,onReorder:o,addLabel:i="항목 추가",enableDrag:a=!0,showIndex:l=!0,minItems:c=0,maxItems:d,rowActions:u,emptyMessage:f="항목이 없습니다.",className:g="",headerClassName:m="",rowClassName:p="",name:y,readOnly:b=!1,createDefaultItem:S,childrenKey:x,itemIdKey:E="_id",errors:k,id:C,editorAttrs:N})=>{const _=v.useRef(null),w=v.useRef([]),M=v.useRef(null),O=v.useMemo(()=>{let j=!1;for(const U of t)if(U[E]==null){j=!0;break}return j?t.map(U=>U[E]!=null?U:{...U,[E]:$c()}):t},[t,E]);w.current=O,v.useEffect(()=>{M.current=null},[O]);const L=v.useCallback(j=>String(j[E]??""),[E]);v.useEffect(()=>{if(y){const j=Ip();j?.form&&(_.current=j.form)}},[y]);const F=jl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Ii})),$=v.useMemo(()=>O.map(j=>L(j)),[O,L]),D=v.useCallback(j=>{const{active:U,over:B}=j;if(B&&U.id!==B.id){const G=M.current??w.current,V=G.map(Z=>String(Z[E]??"")),K=V.indexOf(String(U.id)),X=V.indexOf(String(B.id));if(K!==-1&&X!==-1){const Z=Qr([...G],K,X);M.current=Z,n?.(Z),o?.(Z)}}},[n,o,E]),A=v.useCallback((j,U,B)=>{const V=[...M.current??w.current];V[j]={...V[j],[U]:B},M.current=V,n?.(V)},[n]),T=v.useCallback(()=>{const j=M.current??w.current;if(d&&j.length>=d)return;if(r){r();return}const U=S?S():$E(e);U[E]||(U[E]=$c());const B=[...j,U];M.current=B,n?.(B)},[d,r,S,e,E,n]),z=v.useCallback(j=>{const U=M.current??w.current;if(U.length<=c)return;const B=U[j];if(s){s(j,B);return}const G=U.filter((V,K)=>K!==j);M.current=G,n?.(G)},[c,s,n]),H=O.length>c,W=!d||O.lengthh.jsxs(I,{className:`flex-1 min-w-0 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase ${j.width||""}`,style:j.width?{flex:"none",width:j.width}:{},children:[j.label,j.required&&h.jsx(Q,{className:"text-red-500 dark:text-red-400 ml-0.5",children:"*"})]},j.key)),(u||!b&&H)&&h.jsx(I,{className:"flex-shrink-0 w-8"})]}),O.length>0?h.jsx(ec,{sensors:F,collisionDetection:Wl,onDragEnd:D,children:h.jsx(Ai,{items:$,strategy:tc,children:h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700",children:O.map((j,U)=>{const B=L(j),G=FE(k,U);return h.jsx(PE,{id:B,item:j,index:U,columns:e,enableDrag:a,showIndex:l,canRemove:H,rowActions:u,readOnly:b,onValueChange:(V,K)=>A(U,V,K),onRemove:()=>z(U),className:p,errors:G},B)})})})}):h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:f}),!b&&W&&h.jsx(I,{className:"relative border border-gray-200 dark:border-gray-700 border-t-0 rounded-b-lg",children:h.jsx(I,{className:"flex items-center justify-center py-2",children:h.jsxs(oe,{type:"button",onClick:T,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[h.jsx(re,{name:"plus",className:"w-4 h-4"}),h.jsx(Q,{children:i})]})})}),(b||!W)&&O.length>0&&h.jsx(I,{className:"border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg h-1"})]})},Lp=()=>window.G7Core,VE=()=>Lp()?.locale?.supported?.()??["ko","en"],HE=()=>Lp()?.locale?.current?.()??"ko",UE={ko:"한국어",en:"English",ja:"日本語",zh:"中文"},BE=({children:t,className:e="",style:n,variant:r="default",defaultLocale:s,onLocaleChange:o,locales:i})=>{const a=v.useMemo(()=>i&&i.length>0?i:VE(),[i]),[l,c]=v.useState(s||HE());v.useEffect(()=>{if(a.length>0&&!a.includes(l)){const p=a[0];c(p),o?.(p)}},[a,l,o]);const d=v.useRef(l);d.current=l;const u=v.useCallback(()=>d.current,[]),f=v.useCallback(p=>{c(p),o?.(p)},[o]),g=v.useMemo(()=>({activeLocale:l,getActiveLocale:u,supportedLocales:a}),[l,u,a]),m=p=>{const y=p===l,b="px-4 py-2 text-sm font-medium transition-all";return r==="pills"?y?`${b} bg-blue-600 text-white rounded-lg`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`:r==="underline"?y?`${b} text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400`:`${b} text-gray-600 dark:text-gray-400 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-500`:y?`${b} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`};return h.jsxs(I,{className:e,style:n,children:[h.jsx(Lo,{className:"flex gap-1 border-b border-gray-200 dark:border-gray-700 mb-4",children:a.map(p=>h.jsx(oe,{type:"button",onClick:()=>f(p),className:m(p),children:h.jsx(Q,{children:UE[p]||p})},p))}),h.jsx(Pc.Provider,{value:g,children:t})]})},jE=({label:t,required:e=!1,error:n,helperText:r,className:s="",labelClassName:o="",children:i,horizontal:a=!1,labelWidth:l="w-1/3",id:c,editorAttrs:d})=>{const u=a?`flex items-start gap-4 ${s}`:`space-y-1 ${s}`,f=a?`${l} flex-shrink-0 pt-2`:"",g=a?"flex-1":"";return h.jsxs(I,{className:u,id:c,...d,children:[t&&h.jsx(I,{className:f,children:h.jsxs(rn,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 ${o}`,children:[t,e&&h.jsx("span",{className:"ml-1 text-red-500 dark:text-red-400",children:"*"})]})}),h.jsxs(I,{className:`${g} ${n?"form-field-error":""}`.trim(),children:[i,r&&!n&&h.jsx(I,{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r}),n&&h.jsx(I,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:n})]})]})};function io(t){return t+.5|0}const or=(t,e,n)=>Math.max(Math.min(t,n),e);function ao(t){return or(io(t*2.55),0,255)}function ir(t){return or(io(t*255),0,255)}function Wn(t){return or(io(t/2.55)/100,0,1)}function Pp(t){return or(io(t*100),0,100)}const hn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Fc=[..."0123456789ABCDEF"],WE=t=>Fc[t&15],GE=t=>Fc[(t&240)>>4]+Fc[t&15],Zi=t=>(t&240)>>4===(t&15),YE=t=>Zi(t.r)&&Zi(t.g)&&Zi(t.b)&&Zi(t.a);function XE(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&hn[t[1]]*17,g:255&hn[t[2]]*17,b:255&hn[t[3]]*17,a:e===5?hn[t[4]]*17:255}:(e===7||e===9)&&(n={r:hn[t[1]]<<4|hn[t[2]],g:hn[t[3]]<<4|hn[t[4]],b:hn[t[5]]<<4|hn[t[6]],a:e===9?hn[t[7]]<<4|hn[t[8]]:255})),n}const KE=(t,e)=>t<255?e(t):"";function qE(t){var e=YE(t)?WE:GE;return t?"#"+e(t.r)+e(t.g)+e(t.b)+KE(t.a,e):void 0}const ZE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function $p(t,e,n){const r=e*Math.min(n,1-n),s=(o,i=(o+t/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function QE(t,e,n){const r=(s,o=(s+t/60)%6)=>n-n*e*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function JE(t,e,n){const r=$p(t,1,.5);let s;for(e+n>1&&(s=1/(e+n),e*=s,n*=s),s=0;s<3;s++)r[s]*=1-e-n,r[s]+=e;return r}function RE(t,e,n,r,s){return t===s?(e-n)/r+(e.5?d/(2-o-i):d/(o+i),l=RE(n,r,s,d,o),l=l*60+.5),[l|0,c||0,a]}function Vc(t,e,n,r){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,r)).map(ir)}function Hc(t,e,n){return Vc($p,t,e,n)}function eM(t,e,n){return Vc(JE,t,e,n)}function tM(t,e,n){return Vc(QE,t,e,n)}function Fp(t){return(t%360+360)%360}function nM(t){const e=ZE.exec(t);let n=255,r;if(!e)return;e[5]!==r&&(n=e[6]?ao(+e[5]):ir(+e[5]));const s=Fp(+e[2]),o=+e[3]/100,i=+e[4]/100;return e[1]==="hwb"?r=eM(s,o,i):e[1]==="hsv"?r=tM(s,o,i):r=Hc(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function rM(t,e){var n=zc(t);n[0]=Fp(n[0]+e),n=Hc(n),t.r=n[0],t.g=n[1],t.b=n[2]}function sM(t){if(!t)return;const e=zc(t),n=e[0],r=Pp(e[1]),s=Pp(e[2]);return t.a<255?`hsla(${n}, ${r}%, ${s}%, ${Wn(t.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const zp={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Vp={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function oM(){const t={},e=Object.keys(Vp),n=Object.keys(zp);let r,s,o,i,a;for(r=0;r>16&255,o>>8&255,o&255]}return t}let Qi;function iM(t){Qi||(Qi=oM(),Qi.transparent=[0,0,0,0]);const e=Qi[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const aM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function lM(t){const e=aM.exec(t);let n=255,r,s,o;if(e){if(e[7]!==r){const i=+e[7];n=e[8]?ao(i):or(i*255,0,255)}return r=+e[1],s=+e[3],o=+e[5],r=255&(e[2]?ao(r):or(r,0,255)),s=255&(e[4]?ao(s):or(s,0,255)),o=255&(e[6]?ao(o):or(o,0,255)),{r,g:s,b:o,a:n}}}function cM(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Wn(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Uc=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,ls=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function dM(t,e,n){const r=ls(Wn(t.r)),s=ls(Wn(t.g)),o=ls(Wn(t.b));return{r:ir(Uc(r+n*(ls(Wn(e.r))-r))),g:ir(Uc(s+n*(ls(Wn(e.g))-s))),b:ir(Uc(o+n*(ls(Wn(e.b))-o))),a:t.a+n*(e.a-t.a)}}function Ji(t,e,n){if(t){let r=zc(t);r[e]=Math.max(0,Math.min(r[e]+r[e]*n,e===0?360:1)),r=Hc(r),t.r=r[0],t.g=r[1],t.b=r[2]}}function Hp(t,e){return t&&Object.assign(e||{},t)}function Up(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=ir(t[3]))):(e=Hp(t,{r:0,g:0,b:0,a:1}),e.a=ir(e.a)),e}function uM(t){return t.charAt(0)==="r"?lM(t):nM(t)}class lo{constructor(e){if(e instanceof lo)return e;const n=typeof e;let r;n==="object"?r=Up(e):n==="string"&&(r=XE(e)||iM(e)||uM(e)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=Hp(this._rgb);return e&&(e.a=Wn(e.a)),e}set rgb(e){this._rgb=Up(e)}rgbString(){return this._valid?cM(this._rgb):void 0}hexString(){return this._valid?qE(this._rgb):void 0}hslString(){return this._valid?sM(this._rgb):void 0}mix(e,n){if(e){const r=this.rgb,s=e.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*s.r+.5,r.g=255&c*r.g+o*s.g+.5,r.b=255&c*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(e,n){return e&&(this._rgb=dM(this._rgb,e._rgb,n)),this}clone(){return new lo(this.rgb)}alpha(e){return this._rgb.a=ir(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=io(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=n,this}opaquer(e){const n=this._rgb;return n.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Ji(this._rgb,2,e),this}darken(e){return Ji(this._rgb,2,-e),this}saturate(e){return Ji(this._rgb,1,e),this}desaturate(e){return Ji(this._rgb,1,-e),this}rotate(e){return rM(this._rgb,e),this}}function Gn(){}const fM=(()=>{let t=0;return()=>t++})();function lt(t){return t==null}function _t(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function Qe(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function gn(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function $n(t,e){return gn(t)?t:e}function Je(t,e){return typeof t>"u"?e:t}const hM=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,Bp=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function ht(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function at(t,e,n,r){let s,o,i;if(_t(t))for(o=t.length,s=0;st,x:t=>t.x,y:t=>t.y};function mM(t){const e=t.split("."),n=[];let r="";for(const s of e)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function bM(t){const e=mM(t);return n=>{for(const r of e){if(r==="")break;n=n&&n[r]}return n}}function Cr(t,e){return(Wp[e]||(Wp[e]=bM(e)))(t)}function Bc(t){return t.charAt(0).toUpperCase()+t.slice(1)}const fo=t=>typeof t<"u",ar=t=>typeof t=="function",Gp=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function yM(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const ct=Math.PI,Ct=2*ct,ta=Number.POSITIVE_INFINITY,vM=ct/180,Et=ct/2,Sr=ct/4,Yp=ct*2/3,Xp=Math.log10,lr=Math.sign;function na(t,e,n){return Math.abs(t-e)s-o).pop(),e}function wM(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function ra(t){return!wM(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function kM(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function CM(t,e,n){let r,s,o;for(r=0,s=t.length;rl&&c=Math.min(e,n)-r&&t<=Math.max(e,n)+r}function jc(t,e,n){n=n||(i=>t[i]1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const Wc=(t,e,n,r)=>jc(t,n,r?s=>{const o=t[s][e];return ot[s][e]jc(t,n,r=>t[r][e]>=n);function NM(t,e,n){let r=0,s=t.length;for(;rr&&t[s-1]>n;)s--;return r>0||s{const r="_onData"+Bc(n),s=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return t._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function Jp(t,e){const n=t._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(e);s!==-1&&r.splice(s,1),!(r.length>0)&&(Qp.forEach(o=>{delete t[o]}),delete t._chartjs)}function Rp(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const e0=(function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame})();function t0(t,e){let n=[],r=!1;return function(...s){n=s,r||(r=!0,e0.call(window,()=>{r=!1,t.apply(e,n)}))}}function TM(t,e){let n;return function(...r){return e?(clearTimeout(n),n=setTimeout(t,e,r)):t.apply(this,r),e}}const Gc=t=>t==="start"?"left":t==="end"?"right":"center",Ht=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2,AM=(t,e,n,r)=>t===(r?"left":"right")?n:t==="center"?(e+n)/2:e,oa=t=>t===0||t===1,n0=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*Ct/n)),r0=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*Ct/n)+1,ho={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*Et)+1,easeOutSine:t=>Math.sin(t*Et),easeInOutSine:t=>-.5*(Math.cos(ct*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>oa(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>oa(t)?t:n0(t,.075,.3),easeOutElastic:t=>oa(t)?t:r0(t,.075,.3),easeInOutElastic(t){return oa(t)?t:t<.5?.5*n0(t*2,.1125,.45):.5+.5*r0(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-ho.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?ho.easeInBounce(t*2)*.5:ho.easeOutBounce(t*2-1)*.5+.5};function s0(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function o0(t){return s0(t)?t:new lo(t)}function Yc(t){return s0(t)?t:new lo(t).saturate(.5).darken(.1).hexString()}const DM=["x","y","borderWidth","radius","tension"],IM=["color","borderColor","backgroundColor"];function LM(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:IM},numbers:{type:"number",properties:DM}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function PM(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const i0=new Map;function $M(t,e){e=e||{};const n=t+JSON.stringify(e);let r=i0.get(n);return r||(r=new Intl.NumberFormat(t,e),i0.set(n,r)),r}function Xc(t,e,n){return $M(e,n).format(t)}const FM={values(t){return _t(t)?t:""+t},numeric(t,e,n){if(t===0)return"0";const r=this.chart.options.locale;let s,o=t;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=zM(t,n)}const i=Xp(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Xc(t,r,l)}};function zM(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}var a0={formatters:FM};function VM(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,n)=>n.lineWidth,tickColor:(e,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:a0.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const Er=Object.create(null),Kc=Object.create(null);function go(t,e){if(!e)return t;const n=e.split(".");for(let r=0,s=n.length;rr.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>Yc(s.backgroundColor),this.hoverBorderColor=(r,s)=>Yc(s.borderColor),this.hoverColor=(r,s)=>Yc(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(n)}set(e,n){return qc(this,e,n)}get(e){return go(this,e)}describe(e,n){return qc(Kc,e,n)}override(e,n){return qc(Er,e,n)}route(e,n,r,s){const o=go(this,e),i=go(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=i[s];return Qe(l)?Object.assign({},c,l):Je(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var vt=new HM({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[LM,PM,VM]);function UM(t){return!t||lt(t.size)||lt(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function l0(t,e,n,r,s){let o=e[s];return o||(o=e[s]=t.measureText(s).width,n.push(s)),o>r&&(r=o),r}function Mr(t,e,n){const r=t.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((e-s)*r)/r+s}function c0(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function d0(t,e,n,r){u0(t,e,n,r,null)}function u0(t,e,n,r,s){let o,i,a,l,c,d,u,f;const g=e.pointStyle,m=e.rotation,p=e.radius;let y=(m||0)*vM;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){t.save(),t.translate(n,r),t.rotate(y),t.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),t.restore();return}if(!(isNaN(p)||p<=0)){switch(t.beginPath(),g){default:s?t.ellipse(n,r,s/2,p,0,0,Ct):t.arc(n,r,p,0,Ct),t.closePath();break;case"triangle":d=s?s/2:p,t.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Yp,t.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Yp,t.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),t.closePath();break;case"rectRounded":c=p*.516,l=p-c,i=Math.cos(y+Sr)*l,u=Math.cos(y+Sr)*(s?s/2-c:l),a=Math.sin(y+Sr)*l,f=Math.sin(y+Sr)*(s?s/2-c:l),t.arc(n-u,r-a,c,y-ct,y-Et),t.arc(n+f,r-i,c,y-Et,y),t.arc(n+u,r+a,c,y,y+Et),t.arc(n-f,r+i,c,y+Et,y+ct),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,t.rect(n-d,r-l,2*d,2*l);break}y+=Sr;case"rectRot":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+f,r-i),t.lineTo(n+u,r+a),t.lineTo(n-f,r+i),t.closePath();break;case"crossRot":y+=Sr;case"cross":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i);break;case"star":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i),y+=Sr,u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*p,a=Math.sin(y)*p,t.moveTo(n-i,r-a),t.lineTo(n+i,r+a);break;case"dash":t.moveTo(n,r),t.lineTo(n+Math.cos(y)*(s?s/2:p),r+Math.sin(y)*p);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function f0(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.xe.top-n&&t.y0&&o.strokeColor!=="";let l,c;for(t.save(),t.font=s.string,BM(t,o),l=0;l+t||0;function Jc(t,e){const n={},r=Qe(e),s=r?Object.keys(e):e,o=Qe(t)?r?i=>Je(t[i],t[e[i]]):i=>t[i]:()=>t;for(const i of s)n[i]=KM(o(i));return n}function h0(t){return Jc(t,{top:"y",right:"x",bottom:"y",left:"x"})}function cs(t){return Jc(t,["topLeft","topRight","bottomLeft","bottomRight"])}function pn(t){const e=h0(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ut(t,e){t=t||{},e=e||vt.font;let n=Je(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let r=Je(t.style,e.style);r&&!(""+r).match(YM)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:Je(t.family,e.family),lineHeight:XM(Je(t.lineHeight,e.lineHeight),n),size:n,style:r,weight:Je(t.weight,e.weight),string:""};return s.string=UM(s),s}function aa(t,e,n,r){let s,o,i;for(s=0,o=t.length;sn&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function ds(t,e){return Object.assign(Object.create(t),e)}function Rc(t,e=[""],n,r,s=()=>t[0]){const o=n||t;typeof r>"u"&&(r=y0("_fallback",t));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>Rc([a,...t],e,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete t[0][l],!0},get(a,l){return p0(a,l,()=>rN(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return v0(a).includes(l)},ownKeys(a){return v0(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function us(t,e,n,r){const s={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:g0(t,r),setContext:o=>us(t,o,n,r),override:o=>us(t.override(o),e,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete t[i],!0},get(o,i,a){return p0(o,i,()=>QM(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(o,i){return Reflect.has(t,i)},ownKeys(){return Reflect.ownKeys(t)},set(o,i,a){return t[i]=a,delete o[i],!0}})}function g0(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:r=e.indexable,_allKeys:s=e.allKeys}=t;return{allKeys:s,scriptable:n,indexable:r,isScriptable:ar(n)?n:()=>n,isIndexable:ar(r)?r:()=>r}}const ZM=(t,e)=>t?t+Bc(e):e,ed=(t,e)=>Qe(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function p0(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const r=n();return t[e]=r,r}function QM(t,e,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=t;let a=r[e];return ar(a)&&i.isScriptable(e)&&(a=JM(e,a,t,n)),_t(a)&&a.length&&(a=RM(e,a,t,i.isIndexable)),ed(e,a)&&(a=us(a,s,o&&o[e],i)),a}function JM(t,e,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(o,i||r);return a.delete(t),ed(t,l)&&(l=td(s._scopes,s,t,l)),l}function RM(t,e,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(t))return e[o.index%e.length];if(Qe(e[0])){const l=e,c=s._scopes.filter(d=>d!==l);e=[];for(const d of l){const u=td(c,s,t,d);e.push(us(u,o,i&&i[t],a))}}return e}function m0(t,e,n){return ar(t)?t(e,n):t}const eN=(t,e)=>t===!0?e:typeof t=="string"?Cr(e,t):void 0;function tN(t,e,n,r,s){for(const o of e){const i=eN(n,o);if(i){t.add(i);const a=m0(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function td(t,e,n,r){const s=e._rootScopes,o=m0(e._fallback,n,r),i=[...t,...s],a=new Set;a.add(r);let l=b0(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=b0(a,i,o,l,r),l===null)?!1:Rc(Array.from(a),[""],s,o,()=>nN(e,n,r))}function b0(t,e,n,r,s){for(;n;)n=tN(t,e,n,r,s);return n}function nN(t,e,n){const r=t._getTarget();e in r||(r[e]={});const s=r[e];return _t(s)&&Qe(n)?n:s||{}}function rN(t,e,n,r){let s;for(const o of e)if(s=y0(ZM(o,t),n),typeof s<"u")return ed(t,s)?td(n,r,t,s):s}function y0(t,e){for(const n of e){if(!n)continue;const r=n[t];if(typeof r<"u")return r}}function v0(t){let e=t._keys;return e||(e=t._keys=sN(t._scopes)),e}function sN(t){const e=new Set;for(const n of t)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))e.add(r);return Array.from(e)}function nd(){return typeof window<"u"&&typeof document<"u"}function rd(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function la(t,e,n){let r;return typeof t=="string"?(r=parseInt(t,10),t.indexOf("%")!==-1&&(r=r/100*e.parentNode[n])):r=t,r}const ca=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function oN(t,e){return ca(t).getPropertyValue(e)}const iN=["top","right","bottom","left"];function Nr(t,e,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=iN[s];r[o]=parseFloat(t[e+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const aN=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function lN(t,e){const n=t.touches,r=n&&n.length?n[0]:t,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(aN(s,o,t.target))a=s,l=o;else{const c=e.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,i=!0}return{x:a,y:l,box:i}}function Or(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:r}=e,s=ca(n),o=s.boxSizing==="border-box",i=Nr(s,"padding"),a=Nr(s,"border","width"),{x:l,y:c,box:d}=lN(t,n),u=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:g,height:m}=e;return o&&(g-=i.width+a.width,m-=i.height+a.height),{x:Math.round((l-u)/g*n.width/r),y:Math.round((c-f)/m*n.height/r)}}function cN(t,e,n){let r,s;if(e===void 0||n===void 0){const o=t&&rd(t);if(!o)e=t.clientWidth,n=t.clientHeight;else{const i=o.getBoundingClientRect(),a=ca(o),l=Nr(a,"border","width"),c=Nr(a,"padding");e=i.width-c.width-l.width,n=i.height-c.height-l.height,r=la(a.maxWidth,o,"clientWidth"),s=la(a.maxHeight,o,"clientHeight")}}return{width:e,height:n,maxWidth:r||ta,maxHeight:s||ta}}const cr=t=>Math.round(t*10)/10;function dN(t,e,n,r){const s=ca(t),o=Nr(s,"margin"),i=la(s.maxWidth,t,"clientWidth")||ta,a=la(s.maxHeight,t,"clientHeight")||ta,l=cN(t,e,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=Nr(s,"border","width"),g=Nr(s,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,r?c/r:d-o.height),c=cr(Math.min(c,i,l.maxWidth)),d=cr(Math.min(d,a,l.maxHeight)),c&&!d&&(d=cr(c/2)),(e!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,c=cr(Math.floor(d*r))),{width:c,height:d}}function x0(t,e,n){const r=e||1,s=cr(t.height*r),o=cr(t.width*r);t.height=cr(t.height),t.width=cr(t.width);const i=t.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${t.height}px`,i.style.width=`${t.width}px`),t.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(t.currentDevicePixelRatio=r,i.height=s,i.width=o,t.ctx.setTransform(r,0,0,r,0,0),!0):!1}const uN=(function(){let t=!1;try{const e={get passive(){return t=!0,!1}};nd()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t})();function w0(t,e){const n=oN(t,e),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}const fN=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},hN=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function fs(t,e,n){return t?fN(e,n):hN()}function k0(t,e){let n,r;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=r)}function C0(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function da(t,e,n){return t.options.clip?t[n]:e[n]}function gN(t,e){const{xScale:n,yScale:r}=t;return n&&r?{left:da(n,e,"left"),right:da(n,e,"right"),top:da(r,e,"top"),bottom:da(r,e,"bottom")}:e}function pN(t,e){const n=e._clip;if(n.disabled)return!1;const r=gN(e,t.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?t.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?t.height:r.bottom+(n.bottom===!0?0:n.bottom)}}class mN{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,s){const o=n.listeners[s],i=n.duration;o.forEach(a=>a({chart:e,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=e0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(e),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,e,"progress")),o.length||(r.running=!1,this._notify(s,r,e,"complete"),r.initial=!1),n+=o.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Xn=new mN;const S0="transparent",bN={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=o0(t||S0),s=r.valid&&o0(e||S0);return s&&s.valid?s.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class yN{constructor(e,n,r,s){const o=n[r];s=aa([e.to,s,o,e.from]);const i=aa([e.from,o,s]);this._active=!0,this._fn=e.fn||bN[e.type||typeof i],this._easing=ho[e.easing]||ho.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=aa([e.to,n,s,e.from]),this._from=aa([e.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let s=0;s{const o=e[s];if(!Qe(o))return;const i={};for(const a of n)i[a]=o[a];(_t(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(e,n){const r=n.options,s=xN(e,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&vN(e.options.$animations,r).then(()=>{e.options=r},()=>{}),o}_createAnimations(e,n){const r=this._properties,s=[],o=e.$animations||(e.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const c=i[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(e,n));continue}const d=n[c];let u=o[c];const f=r.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){e[c]=d;continue}o[c]=u=new yN(f,e,c,d),s.push(u)}return s}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return Xn.add(this._chart,r),!0}}function vN(t,e){const n=[],r=Object.keys(e);for(let s=0;s0||!n&&o<0)return s.index}return null}function T0(t,e){const{chart:n,_cachedMeta:r}=t,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,c=i.axis,d=SN(o,i,r),u=e.length;let f;for(let g=0;gn[r].axis===e).shift()}function MN(t,e){return ds(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function NN(t,e,n){return ds(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function mo(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const s of e){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const id=t=>t==="reset"||t==="none",A0=(t,e)=>e?t:Object.assign({},t),ON=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:M0(n,!0),values:null};class hs{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=sd(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&mo(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(u,f,g,m)=>u==="x"?f:u==="r"?m:g,o=n.xAxisID=Je(r.xAxisID,od(e,"x")),i=n.yAxisID=Je(r.yAxisID,od(e,"y")),a=n.rAxisID=Je(r.rAxisID,od(e,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Jp(this._data,this),e._stacked&&mo(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(Qe(n)){const s=this._cachedMeta;this._data=CN(n,s)}else if(r!==n){if(r){Jp(r,this);const s=this._cachedMeta;mo(s),s._parsed=[]}n&&Object.isExtensible(n)&&OM(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=sd(n.vScale,n),n.stack!==r.stack&&(s=!0,mo(n),n.stack=r.stack),this._resyncElements(e),(s||o!==n._stacked)&&(T0(this,n._parsed),n._stacked=sd(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=e===0&&n===s.length?!0:r._sorted,c=e>0&&r._parsed[e-1],d,u,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{_t(s[e])?f=this.parseArrayData(r,s,e,n):Qe(s[e])?f=this.parseObjectData(r,s,e,n):f=this.parsePrimitiveData(r,s,e,n);const g=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!m()){this.updateRangeFromParsed(c,e,g,l);break}}return c}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&ethis.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(A0(p,l))),p}_resolveAnimations(e,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(e,r,n))}const c=new _0(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||id(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(e,n,r,s){id(s)?Object.assign(e,r):this._resolveAnimations(n,s).update(e,r)}updateSharedOptions(e,n,r){e&&!id(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,s){e.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(e,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,e):o{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=e;as-o))}return t._cache.$bar}function AN(t){const e=t.iScale,n=TN(e,t.type);let r=e._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(fo(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s0?s[t-1]:null,a=tMath.abs(a)&&(l=a,c=i),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:s,end:o,min:i,max:a}}function D0(t,e,n,r){return _t(t)?LN(t,e,n,r):e[n.axis]=n.parse(t,r),e}function I0(t,e,n,r){const s=t.iScale,o=t.vScale,i=s.getLabels(),a=s===o,l=[];let c,d,u,f;for(c=n,d=n+r;c=n?1:-1)}function $N(t){let e,n,r,s,o;return t.horizontal?(e=t.base>t.x,n="left",r="right"):(e=t.based.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=d=>{const u=d._parsed.find(g=>g[r.axis]===l),f=u&&u[d.vScale.axis];if(lt(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||i.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&i.push(d.stack),d.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(e).filter(r=>e[r].axis===n).shift()}_getAxis(){const e={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)e[Je(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(e)}_getStackIndex(e,n,r){const s=this._getStacks(e,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const e=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;osa(x,a,l,!0)?1:Math.max(E,E*n,k,k*n),m=(x,E,k)=>sa(x,a,l,!0)?-1:Math.min(E,E*n,k,k*n),p=g(0,c,u),y=g(Et,d,f),b=m(ct,c,u),S=m(ct+Et,d,f);r=(p-b)/2,s=(y-S)/2,o=-(p+b)/2,i=-(y+S)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class bo extends hs{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(Qe(r[e])){const{key:l="value"}=this._parsing;o=c=>+Cr(r[c],l)}let i,a;for(i=e,a=e+n;i0&&!isNaN(e)?Ct*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Xc(n._parsed[e],r.options.locale);return{label:s[e]||"",value:o}}getMaxBorderWidth(e){let n=0;const r=this.chart;let s,o,i,a,l;if(!e){for(s=0,o=r.data.datasets.length;se!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),Fe(bo,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=e.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!e.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||u.borderRadius),index:c}}):[]}},onClick(e,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});function Tr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ld{constructor(e){Fe(this,"options");this.options=e||{}}static override(e){Object.assign(ld.prototype,e)}init(){}formats(){return Tr()}parse(){return Tr()}format(){return Tr()}add(){return Tr()}diff(){return Tr()}startOf(){return Tr()}endOf(){return Tr()}}var UN={_date:ld};function BN(t,e,n,r){const{controller:s,data:o,_sorted:i}=t,a=s._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&i&&o.length){const c=a._reversePixels?MM:Wc;if(r){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(e);if(u){const f=c(o,e,n-u),g=c(o,e,n+u);return{lo:f.lo,hi:g.hi}}}}else{const d=c(o,e,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:f}=t,g=f.slice(0,d.lo+1).reverse().findIndex(p=>!lt(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!lt(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function fa(t,e,n,r,s){const o=t.getSortedVisibleDatasetMetas(),i=n[e];for(let a=0,l=o.length;a{l[i]&&l[i](e[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,s))}),r&&!a?[]:o}var YN={modes:{index(t,e,n,r){const s=Or(e,t),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?cd(t,s,o,r,i):dd(t,s,o,!1,r,i),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(t,e,n,r){const s=Or(e,t),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?cd(t,s,o,r,i):dd(t,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===e)}function z0(t,e){return t.filter(n=>F0.indexOf(n.pos)===-1&&n.box.axis===e)}function vo(t,e){return t.sort((n,r)=>{const s=e?r:n,o=e?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function XN(t){const e=[];let n,r,s,o,i,a;for(n=0,r=(t||[]).length;nc.box.fullSize),!0),r=vo(yo(e,"left"),!0),s=vo(yo(e,"right")),o=vo(yo(e,"top"),!0),i=vo(yo(e,"bottom")),a=z0(e,"x"),l=z0(e,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:yo(e,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function V0(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function H0(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function QN(t,e,n,r){const{pos:s,box:o}=n,i=t.maxPadding;if(!Qe(s)){n.size&&(t[s]-=n.size);const u=r[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,t[s]+=n.size}o.getPadding&&H0(i,o.getPadding());const a=Math.max(0,e.outerWidth-V0(i,t,"left","right")),l=Math.max(0,e.outerHeight-V0(i,t,"top","bottom")),c=a!==t.w,d=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function JN(t){const e=t.maxPadding;function n(r){const s=Math.max(e[r]-t[r],0);return t[r]+=s,s}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function RN(t,e){const n=e.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(e[i],n[i])}),o}return r(t?["left","right"]:["top","bottom"])}function xo(t,e,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=t.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const d=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);H0(f,pn(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=qN(l.concat(c),u);xo(a.fullSize,g,u,m),xo(l,g,u,m),xo(c,g,u,m)&&xo(l,g,u,m),JN(g),U0(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,U0(a.rightAndBottom,g,u,m),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},at(a.chartArea,p=>{const y=p.box;Object.assign(y,t.chartArea),y.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class B0{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,s){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(e){return!0}updateConfig(e){}}class eO extends B0{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ga="$chartjs",tO={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},j0=t=>t===null||t==="";function nO(t,e){const n=t.style,r=t.getAttribute("height"),s=t.getAttribute("width");if(t[ga]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",j0(s)){const o=w0(t,"width");o!==void 0&&(t.width=o)}if(j0(r))if(t.style.height==="")t.height=t.width/(e||2);else{const o=w0(t,"height");o!==void 0&&(t.height=o)}return t}const W0=uN?{passive:!0}:!1;function rO(t,e,n){t&&t.addEventListener(e,n,W0)}function sO(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,W0)}function oO(t,e){const n=tO[t.type]||t.type,{x:r,y:s}=Or(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:s!==void 0?s:null}}function pa(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function iO(t,e,n){const r=t.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||pa(a.addedNodes,r),i=i&&!pa(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function aO(t,e,n){const r=t.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||pa(a.removedNodes,r),i=i&&!pa(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const wo=new Map;let G0=0;function Y0(){const t=window.devicePixelRatio;t!==G0&&(G0=t,wo.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function lO(t,e){wo.size||window.addEventListener("resize",Y0),wo.set(t,e)}function cO(t){wo.delete(t),wo.size||window.removeEventListener("resize",Y0)}function dO(t,e,n){const r=t.canvas,s=r&&rd(r);if(!s)return;const o=t0((a,l)=>{const c=s.clientWidth;n(a,l),c{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),lO(t,o),i}function ud(t,e,n){n&&n.disconnect(),e==="resize"&&cO(t)}function uO(t,e,n){const r=t.canvas,s=t0(o=>{t.ctx!==null&&n(oO(o,t))},t);return rO(r,e,s),s}class fO extends B0{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(nO(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[ga])return!1;const r=n[ga].initial;["height","width"].forEach(o=>{const i=r[o];lt(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[ga],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const s=e.$proxies||(e.$proxies={}),i={attach:iO,detach:aO,resize:dO}[n]||uO;s[n]=i(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),s=r[n];if(!s)return;({attach:ud,detach:ud,resize:ud}[n]||sO)(e,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,s){return dN(e,n,r,s)}isAttached(e){const n=e&&rd(e);return!!(n&&n.isConnected)}}function hO(t){return!nd()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?eO:fO}let Ar=(Oa=class{constructor(){Fe(this,"x");Fe(this,"y");Fe(this,"active",!1);Fe(this,"options");Fe(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return ra(this.x)&&ra(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const s={};return e.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},Fe(Oa,"defaults",{}),Fe(Oa,"defaultRoutes"),Oa);function gO(t,e){const n=t.options.ticks,r=pO(t),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?bO(e):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return yO(e,c,o,i/s),c;const d=mO(o,e,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(ma(e,c,d,lt(g)?0:a-g,a),u=0,f=i-1;us)return l}return Math.max(s,1)}function bO(t){const e=[];let n,r;for(n=0,r=t.length;nt==="left"?"right":t==="right"?"left":t,X0=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,K0=(t,e)=>Math.min(e||t,t);function q0(t,e){const n=[],r=t.length/e,s=t.length;let o=0;for(;oi+a)))return l}function kO(t,e){at(t,n=>{const r=n.gc,s=r.length/2;let o;if(s>e){for(o=0;or?r:n,r=s&&n>r?n:r,{min:$n(n,$n(r,n)),max:$n(r,$n(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ht(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=qM(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=Jt(this.chart.width-u,0,this.maxWidth);a=e.offset?this.maxWidth/r:g/(r-1),u+6>a&&(a=g/(r-(e.offset?.5:1)),l=this.maxHeight-ko(e.grid)-n.padding-Z0(e.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=SM(Math.min(Math.asin(Jt((d.highest.height+6)/a,-1,1)),Math.asin(Jt(l/c,-1,1))-Math.asin(Jt(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){ht(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ht(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=Z0(s,n.options.font);if(a?(e.width=this.maxWidth,e.height=ko(o)+l):(e.height=this.maxHeight,e.width=ko(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=Yn(this.labelRotation),p=Math.cos(m),y=Math.sin(m);if(a){const b=r.mirror?0:y*u.width+p*f.height;e.height=Math.min(this.maxHeight,e.height+b+g)}else{const b=r.mirror?0:p*u.width+y*f.height;e.width=Math.min(this.maxWidth,e.width+b+g)}this._calculatePadding(c,d,y,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=s*e.width,g=r*n.height):(f=r*e.height,g=s*n.width):o==="start"?g=n.width:o==="end"?f=e.width:o!=="inner"&&(f=e.width/2,g=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+i)*this.width/(this.width-u),0)}else{let d=n.height/2,u=e.height/2;o==="start"?(d=0,u=e.height):o==="end"&&(d=n.height,u=0),this.paddingTop=d+i,this.paddingBottom=u+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ht(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,r;for(n=0,r=e.length;n({width:i[w]||0,height:a[w]||0});return{first:_(0),last:_(n-1),widest:_(C),highest:_(N),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return EM(this._alignToPixels?Mr(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&ea*s?a/r:l/s:l*s0}_computeGridLineItems(e){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=ko(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(A){return Mr(r,A,p)};let S,x,E,k,C,N,_,w,M,O,L,F;if(i==="top")S=b(this.bottom),N=this.bottom-f,w=S-y,O=b(e.top)+y,F=e.bottom;else if(i==="bottom")S=b(this.top),O=e.top,F=b(e.bottom)-y,N=S+y,w=this.top+f;else if(i==="left")S=b(this.right),C=this.right-f,_=S-y,M=b(e.left)+y,L=e.right;else if(i==="right")S=b(this.left),M=e.left,L=b(e.right)-y,C=S+y,_=this.left+f;else if(n==="x"){if(i==="center")S=b((e.top+e.bottom)/2+.5);else if(Qe(i)){const A=Object.keys(i)[0],T=i[A];S=b(this.chart.scales[A].getPixelForValue(T))}O=e.top,F=e.bottom,N=S+y,w=N+f}else if(n==="y"){if(i==="center")S=b((e.left+e.right)/2);else if(Qe(i)){const A=Object.keys(i)[0],T=i[A];S=b(this.chart.scales[A].getPixelForValue(T))}C=S-y,_=C-f,M=e.left,L=e.right}const $=Je(s.ticks.maxTicksLimit,u),D=Math.max(1,Math.ceil(u/$));for(x=0;x0&&(K-=G/2);break}j={left:K,top:V,width:G+U.width,height:B+U.height,color:D.backdropColor}}y.push({label:E,font:w,textOffset:L,options:{rotation:p,color:T,strokeColor:z,strokeWidth:H,textAlign:W,textBaseline:F,translation:[k,C],backdrop:j}})}return y}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Yn(this.labelRotation))return e==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=e+o,l=i.widest.width;let c,d;return n==="left"?s?(d=this.right+o,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,s,o,i),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===e);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,i;const a=(l,c,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[t].concat(r).join("."),i=e[n].split("."),a=i.pop(),l=i.join(".");vt.route(o,s,l,a)})}function OO(t){return"id"in t&&"defaults"in t}class TO{constructor(){this.controllers=new ba(hs,"datasets",!0),this.elements=new ba(Ar,"elements"),this.plugins=new ba(Object,"plugins"),this.scales=new ba(gs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(e,o,s):at(s,i=>{const a=r||this._getRegistryForType(i);this._exec(e,a,i)})})}_exec(e,n,r){const s=Bc(e);ht(r["before"+s],[],r),n[e](r),ht(r["after"+s],[],r)}_getRegistryForType(e){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),e,"stop"),this._notify(s(r,n),e,"start")}}function DO(t){const e={},n=[],r=Object.keys(zn.plugins.items);for(let o=0;o1&&Q0(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function J0(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function VO(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return J0(t,"x",n[0])||J0(t,"y",n[0])}return{}}function HO(t,e){const n=Er[t.type]||{scales:{}},r=e.scales||{},s=fd(t.type,e),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Qe(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=hd(i,a,VO(i,t),vt.scales[a.type]),c=FO(l,s),d=n.scales||{};o[i]=uo(Object.create(null),[{axis:l},a,d[l],d[c]])}),t.data.datasets.forEach(i=>{const a=i.type||t.type,l=i.indexAxis||fd(a,e),d=(Er[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=$O(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),uo(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];uo(a,[vt.scales[a.type],vt.scale])}),o}function R0(t){const e=t.options||(t.options={});e.plugins=Je(e.plugins,{}),e.scales=HO(t,e)}function em(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function UO(t){return t=t||{},t.data=em(t.data),R0(t),t}const tm=new Map,nm=new Set;function ya(t,e){let n=tm.get(t);return n||(n=e(),tm.set(t,n),nm.add(n)),n}const Co=(t,e,n)=>{const r=Cr(e,n);r!==void 0&&t.add(r)};class BO{constructor(e){this._config=UO(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=em(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),R0(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return ya(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return ya(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return ya(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return ya(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let s=r.get(e);return(!s||n)&&(s=new Map,r.set(e,s)),s}getOptionScopes(e,n,r){const{options:s,type:o}=this,i=this._cachedScopes(e,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{e&&(l.add(e),d.forEach(u=>Co(l,e,u))),d.forEach(u=>Co(l,s,u)),d.forEach(u=>Co(l,Er[o]||{},u)),d.forEach(u=>Co(l,vt,u)),d.forEach(u=>Co(l,Kc,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),nm.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,Er[n]||{},vt.datasets[n]||{},{type:n},vt,Kc]}resolveNamedOptions(e,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=rm(this._resolverCache,e,s);let l=i;if(WO(i,n)){o.$shared=!1,r=ar(r)?r():r;const c=this.createResolver(e,r,a);l=us(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(e,n,r=[""],s){const{resolver:o}=rm(this._resolverCache,e,r);return Qe(n)?us(o,n,void 0,s):o}}function rm(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Rc(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const jO=t=>Qe(t)&&Object.getOwnPropertyNames(t).some(e=>ar(t[e]));function WO(t,e){const{isScriptable:n,isIndexable:r}=g0(t);for(const s of e){const o=n(s),i=r(s),a=(i||o)&&t[s];if(o&&(ar(a)||jO(a))||i&&_t(a))return!0}return!1}var GO="4.5.1";const YO=["top","bottom","left","right","chartArea"];function sm(t,e){return t==="top"||t==="bottom"||YO.indexOf(t)===-1&&e==="x"}function om(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function im(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),ht(n&&n.onComplete,[t],e)}function XO(t){const e=t.chart,n=e.options.animation;ht(n&&n.onProgress,[t],e)}function am(t){return nd()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const va={},lm=t=>{const e=am(t);return Object.values(va).filter(n=>n.canvas===e).pop()};function KO(t,e,n){const r=Object.keys(t);for(const s of r){const o=+s;if(o>=e){const i=t[s];delete t[s],(n>0||o>e)&&(t[o+n]=i)}}}function qO(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}let So=(ur=class{static register(...e){zn.add(...e),cm()}static unregister(...e){zn.remove(...e),cm()}constructor(e,n){const r=this.config=new BO(n),s=am(e),o=lm(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||hO(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=fM(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new AO,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=TM(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],va[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Xn.listen(this,"complete",im),Xn.listen(this,"progress",XO),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return lt(e)?n&&o?o:s?r/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return zn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():x0(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return c0(this.canvas,this.ctx),this}stop(){return Xn.stop(this),this}resize(e,n){Xn.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,e,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,x0(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),ht(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=hd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),at(o,i=>{const a=i.options,l=a.id,c=hd(l,a),d=Je(a.type,i.dtype);(a.position===void 0||sm(a.position,c)!==sm(i.dposition))&&(a.position=i.dposition),s[l]=!0;let u=null;if(l in r&&r[l].type===d)u=r[l];else{const f=zn.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,e)}),at(s,(i,a)=>{i||delete r[a]}),at(r,i=>{mn.configure(this,i,i.options),mn.addBox(this,i)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,e.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(om("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,e=>{mn.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!Gp(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;KO(e,s,i)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(e.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;mn.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r={meta:e,index:e.index,cancelable:!0},s=pN(this,e);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Zc(n,s),e.controller.draw(),s&&Qc(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return f0(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,s){const o=YN.modes[n];return typeof o=="function"?o(this,e,r,s):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=ds(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(e),i=o.controller._resolveAnimations(void 0,s);fo(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===e?s:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),Xn.remove(this),e=0,n=this.data.datasets.length;e{n.addEventListener(this,o,i),e[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),e[l]=c},s=(l,c)=>{e[l]&&(n.removeEventListener(this,l,c),delete e[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){at(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},at(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=e.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!Ri(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),i=o(n,e),a=r?e:o(e,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},s=i=>(i.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(e,s,r,i),l=yM(e),c=qO(e,this._lastEvent,r,l);r&&(this._lastEvent=null,ht(o.onHover,[e,a,this],this),l&&ht(o.onClick,[e,a,this],this));const d=!Ri(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,d}_getActiveElements(e,n,r,s){if(e.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,s)}},Fe(ur,"defaults",vt),Fe(ur,"instances",va),Fe(ur,"overrides",Er),Fe(ur,"registry",zn),Fe(ur,"version",GO),Fe(ur,"getChart",lm),ur);function cm(){return at(So.instances,t=>t._plugins.invalidate())}function ZO(t,e,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/i,Fn(r-n));if(t.beginPath(),t.arc(s,o,i-c/2,r+u/2,n-u/2),a>0){const f=Math.min(c/a,Fn(r-n));t.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*Fn(r-n));if(d==="round")t.arc(s,o,f,n-ct/2,r+ct/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+ct/2)+s,p=-g*Math.sin(n+ct/2)+o,y=g*Math.cos(r+ct/2)+s,b=g*Math.sin(r+ct/2)+o;t.lineTo(m,p),t.lineTo(y,b)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function QO(t,e,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=e;let c=s/a;t.beginPath(),t.arc(o,i,a,r-c,n+c),l>s?(c=s/l,t.arc(o,i,l,n+c,r-c,!0)):t.arc(o,i,s,n+Et,r-Et),t.closePath(),t.clip()}function JO(t){return Jc(t,["outerStart","outerEnd","innerStart","innerEnd"])}function RO(t,e,n,r){const s=JO(t.options.borderRadius),o=(n-e)/2,i=Math.min(o,r*e/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return Jt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Jt(s.innerStart,0,i),innerEnd:Jt(s.innerEnd,0,i)}}function ps(t,e,n,r){return{x:n+t*Math.cos(e),y:r+t*Math.sin(e)}}function xa(t,e,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,u=Math.max(e.outerRadius+r+n-c,0),f=d>0?d+r+n+c:0;let g=0;const m=s-l;if(r){const D=d>0?d-r:0,A=u>0?u-r:0,T=(D+A)/2,z=T!==0?m*T/(T+r):m;g=(m-z)/2}const p=Math.max(.001,m*u-n/ct)/u,y=(m-p)/2,b=l+y+g,S=s-y-g,{outerStart:x,outerEnd:E,innerStart:k,innerEnd:C}=RO(e,f,u,S-b),N=u-x,_=u-E,w=b+x/N,M=S-E/_,O=f+k,L=f+C,F=b+k/O,$=S-C/L;if(t.beginPath(),o){const D=(w+M)/2;if(t.arc(i,a,u,w,D),t.arc(i,a,u,D,M),E>0){const H=ps(_,M,i,a);t.arc(H.x,H.y,E,M,S+Et)}const A=ps(L,S,i,a);if(t.lineTo(A.x,A.y),C>0){const H=ps(L,$,i,a);t.arc(H.x,H.y,C,S+Et,$+Math.PI)}const T=(S-C/f+(b+k/f))/2;if(t.arc(i,a,f,S-C/f,T,!0),t.arc(i,a,f,T,b+k/f,!0),k>0){const H=ps(O,F,i,a);t.arc(H.x,H.y,k,F+Math.PI,b-Et)}const z=ps(N,b,i,a);if(t.lineTo(z.x,z.y),x>0){const H=ps(N,w,i,a);t.arc(H.x,H.y,x,b-Et,w)}}else{t.moveTo(i,a);const D=Math.cos(w)*u+i,A=Math.sin(w)*u+a;t.lineTo(D,A);const T=Math.cos(M)*u+i,z=Math.sin(M)*u+a;t.lineTo(T,z)}t.closePath()}function eT(t,e,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=e;let l=e.endAngle;if(o){xa(t,e,n,r,l,s);for(let c=0;c=ct&&g===0&&d!=="miter"&&ZO(t,e,p),o||(xa(t,e,n,r,p,s),t.stroke())}class _o extends Ar{constructor(n){super();Fe(this,"circumference");Fe(this,"endAngle");Fe(this,"fullCircles");Fe(this,"innerRadius");Fe(this,"outerRadius");Fe(this,"pixelMargin");Fe(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=Zp(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,m=Je(f,c-l),p=sa(i,l,c)&&l!==c,y=m>=Ct||p,b=_r(a,d+g,u+g);return y&&b}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(o+i)/2,f=(a+l+d+c)/2;return{x:r+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ct?Math.floor(s/Ct):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(ct,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,eT(n,this,d,i,a),tT(n,this,d,i,a),n.restore()}}Fe(_o,"id","arc"),Fe(_o,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Fe(_o,"defaultRoutes",{backgroundColor:"backgroundColor"}),Fe(_o,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function dm(t,e){const{x:n,y:r,base:s,width:o,height:i}=t.getProps(["x","y","base","width","height"],e);let a,l,c,d,u;return t.horizontal?(u=i/2,a=Math.min(n,s),l=Math.max(n,s),c=r-u,d=r+u):(u=o/2,a=n-u,l=n+u,c=Math.min(r,s),d=Math.max(r,s)),{left:a,top:c,right:l,bottom:d}}function dr(t,e,n,r){return t?0:Jt(e,n,r)}function nT(t,e,n){const r=t.options.borderWidth,s=t.borderSkipped,o=h0(r);return{t:dr(s.top,o.top,0,n),r:dr(s.right,o.right,0,e),b:dr(s.bottom,o.bottom,0,n),l:dr(s.left,o.left,0,e)}}function rT(t,e,n){const{enableBorderRadius:r}=t.getProps(["enableBorderRadius"]),s=t.options.borderRadius,o=cs(s),i=Math.min(e,n),a=t.borderSkipped,l=r||Qe(s);return{topLeft:dr(!l||a.top||a.left,o.topLeft,0,i),topRight:dr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:dr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:dr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function sT(t){const e=dm(t),n=e.right-e.left,r=e.bottom-e.top,s=nT(t,n/2,r/2),o=rT(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r,radius:o},inner:{x:e.left+s.l,y:e.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function gd(t,e,n,r){const s=e===null,o=n===null,a=t&&!(s&&o)&&dm(t,r);return a&&(s||_r(e,a.left,a.right))&&(o||_r(n,a.top,a.bottom))}function oT(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function iT(t,e){t.rect(e.x,e.y,e.w,e.h)}function pd(t,e,n={}){const r=t.x!==n.x?-e:0,s=t.y!==n.y?-e:0,o=(t.x+t.w!==n.x+n.w?e:0)-r,i=(t.y+t.h!==n.y+n.h?e:0)-s;return{x:t.x+r,y:t.y+s,w:t.w+o,h:t.h+i,radius:t.radius}}class wa extends Ar{constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=sT(this),a=oT(i.radius)?ia:iT;e.save(),(i.w!==o.w||i.h!==o.h)&&(e.beginPath(),a(e,pd(i,n,o)),e.clip(),a(e,pd(o,-n,i)),e.fillStyle=r,e.fill("evenodd")),e.beginPath(),a(e,pd(o,n)),e.fillStyle=s,e.fill(),e.restore()}inRange(e,n,r){return gd(this,e,n,r)}inXRange(e,n){return gd(this,e,null,n)}inYRange(e,n){return gd(this,null,e,n)}getCenterPoint(e){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}Fe(wa,"id","bar"),Fe(wa,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Fe(wa,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const um=(t,e)=>{let{boxHeight:n=e,boxWidth:r=e}=t;return t.usePointStyle&&(n=Math.min(n,e),r=t.pointStyleWidth||Math.min(r,e)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(e,n)}},aT=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class fm extends Ar{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,r){this.maxWidth=e,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=ht(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(r=>e.filter(r,this.chart.data))),e.sort&&(n=n.sort((r,s)=>e.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const r=e.labels,s=Ut(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=um(r,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(i,s,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=e;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((m,p)=>{const y=r+n/2+o.measureText(m.text).width;(p===0||c[c.length-1]+y+2*a>i)&&(u+=d,c[c.length-(p>0?0:1)]=0,g+=d,f++),l[p]={left:0,top:g,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(e,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=i-e;let u=a,f=0,g=0,m=0,p=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:S,itemHeight:x}=lT(r,n,o,y,s);b>0&&g+x+2*a>d&&(u+=f+a,c.push({width:f,height:g}),m+=f+a,p++,f=g=0),l[b]={left:m,top:g,col:p,width:S,height:x},f=Math.max(f,S),g+=x+a}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=fs(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ht(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Ht(r,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+e+s,c.left=i.leftForLtr(i.x(l),c.width),l+=c.width+s}else{let a=0,l=Ht(r,this.top+e+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Ht(r,this.top+e+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=i.leftForLtr(i.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;Zc(e,this),this._draw(),Qc(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=e,a=vt.color,l=fs(e.rtl,this.left,this.width),c=Ut(i.font),{padding:d}=i,u=c.size,f=u/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:y}=um(i,u),b=function(C,N,_){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const w=Je(_.lineWidth,1);if(s.fillStyle=Je(_.fillStyle,a),s.lineCap=Je(_.lineCap,"butt"),s.lineDashOffset=Je(_.lineDashOffset,0),s.lineJoin=Je(_.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=Je(_.strokeStyle,a),s.setLineDash(Je(_.lineDash,[])),i.usePointStyle){const M={radius:p*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:w},O=l.xPlus(C,m/2),L=N+f;u0(s,M,O,L,i.pointStyleWidth&&m)}else{const M=N+Math.max((u-p)/2,0),O=l.leftForLtr(C,m),L=cs(_.borderRadius);s.beginPath(),Object.values(L).some(F=>F!==0)?ia(s,{x:O,y:M,w:m,h:p,radius:L}):s.rect(O,M,m,p),s.fill(),w!==0&&s.stroke()}s.restore()},S=function(C,N,_){po(s,_.text,C,N+y/2,c,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},x=this.isHorizontal(),E=this._computeTitleHeight();x?g={x:Ht(o,this.left+d,this.right-r[0]),y:this.top+d+E,line:0}:g={x:this.left+d,y:Ht(o,this.top+E+d,this.bottom-n[0].height),line:0},k0(this.ctx,e.textDirection);const k=y+d;this.legendItems.forEach((C,N)=>{s.strokeStyle=C.fontColor,s.fillStyle=C.fontColor;const _=s.measureText(C.text).width,w=l.textAlign(C.textAlign||(C.textAlign=i.textAlign)),M=m+f+_;let O=g.x,L=g.y;l.setWidth(this.width),x?N>0&&O+M+d>this.right&&(L=g.y+=k,g.line++,O=g.x=Ht(o,this.left+d,this.right-r[g.line])):N>0&&L+k>this.bottom&&(O=g.x=O+n[g.line].width+d,g.line++,L=g.y=Ht(o,this.top+E+d,this.bottom-n[g.line].height));const F=l.x(O);if(b(F,L,C),O=AM(w,O+m+f,x?O+M:this.right,e.rtl),S(l.x(O),L,C),x)g.x+=M+d;else if(typeof C.text!="string"){const $=c.lineHeight;g.y+=hm(C,$)+d}else g.y+=k}),C0(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,r=Ut(n.font),s=pn(n.padding);if(!n.display)return;const o=fs(e.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,c=s.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=Ht(e.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+Ht(e.align,this.top,this.bottom-m-e.labels.padding-this._computeTitleHeight())}const g=Ht(a,u,u+f);i.textAlign=o.textAlign(Gc(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,po(i,n.text,g,d,r)}_computeTitleHeight(){const e=this.options.title,n=Ut(e.font),r=pn(e.padding);return e.display?n.lineHeight+r.height:0}_getLegendItemAt(e,n){let r,s,o;if(_r(e,this.left,this.right)&&_r(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),e+n.size/2+r.measureText(s).width}function dT(t,e,n){let r=t;return typeof e.text!="string"&&(r=hm(e,n)),r}function hm(t,e){const n=t.text?t.text.length:0;return e*n}function uT(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var gm={id:"legend",_element:fm,start(t,e,n){const r=t.legend=new fm({ctx:t.ctx,options:n,chart:t});mn.configure(t,r,n),mn.addBox(t,r)},stop(t){mn.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const r=t.legend;mn.configure(t,r,n),r.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const r=e.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),e.hidden=!0):(s.show(r),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=pn(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class pm extends Ar{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const s=_t(r.text)?r.text.length:1;this._padding=pn(r.padding);const o=s*Ut(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,c,d,u;return this.isHorizontal()?(d=Ht(a,r,o),u=n+e,c=o-r):(i.position==="left"?(d=r+e,u=Ht(a,s,n),l=ct*-.5):(d=o-e,u=Ht(a,n,s),l=ct*.5),c=s-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const r=Ut(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);po(e,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:Gc(n.align),textBaseline:"middle",translation:[i,a]})}}function fT(t,e){const n=new pm({ctx:t.ctx,options:e,chart:t});mn.configure(t,n,e),mn.addBox(t,n),t.titleBlock=n}var hT={id:"title",_element:pm,start(t,e,n){fT(t,n)},stop(t){const e=t.titleBlock;mn.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const r=t.titleBlock;mn.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Eo={average(t){if(!t.length)return!1;let e,n,r=new Set,s=0,o=0;for(e=0,n=t.length;ea+l)/r.size,y:s/o}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=t.length;o{const[u,f]=v.useState(!1),g="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border cursor-pointer transition-all";if(o){const b=NE(o),S=document.documentElement.classList.contains("dark");let x;return e?x={backgroundColor:o,color:"#ffffff",borderColor:o,opacity:u?.85:1}:x=b?{backgroundColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${u?S?.25:.12:S?.15:.06})`,color:o,borderColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${S?.3:.2})`}:{},h.jsxs(rn,{className:`${g} ${i}`,style:{...x,...a},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:t,checked:e,onChange:E=>{l?.(E)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})}const y=e?{green:"bg-green-600 dark:bg-green-600 text-white dark:text-white border-green-700 dark:border-green-500 hover:bg-green-700 dark:hover:bg-green-500",orange:"bg-orange-600 dark:bg-orange-600 text-white dark:text-white border-orange-700 dark:border-orange-500 hover:bg-orange-700 dark:hover:bg-orange-500",yellow:"bg-yellow-600 dark:bg-yellow-600 text-white dark:text-white border-yellow-700 dark:border-yellow-500 hover:bg-yellow-700 dark:hover:bg-yellow-500",gray:"bg-gray-600 dark:bg-gray-500 text-white dark:text-white border-gray-700 dark:border-gray-400 hover:bg-gray-700 dark:hover:bg-gray-400",blue:"bg-blue-600 dark:bg-blue-600 text-white dark:text-white border-blue-700 dark:border-blue-500 hover:bg-blue-700 dark:hover:bg-blue-500"}[s]:{green:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/30",orange:"bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800 hover:bg-orange-100 dark:hover:bg-orange-900/30",yellow:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/30",gray:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600",blue:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/30"}[s];return h.jsxs(rn,{className:`${g} ${y} ${i}`,style:a,id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:t,checked:e,onChange:b=>{l?.(b)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})},TE=({label:t,icon:e,iconPosition:n="left",position:r="right",className:s="",style:o,children:i})=>{const[a,l]=v.useState(!1),[c,d]=v.useState({top:0,left:0}),u=v.useRef(null),f=v.useRef(null),g=v.useCallback(()=>{if(!u.current)return;const p=u.current.getBoundingClientRect(),y=224;let b=r==="right"?p.right-y:p.left;const S=p.bottom+8;b<8&&(b=8),b+y>window.innerWidth-8&&(b=window.innerWidth-y-8),d({top:S,left:b})},[r]);v.useEffect(()=>{a&&g()},[a,g]),v.useEffect(()=>{if(!a)return;const p=()=>{l(!1)};return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]),v.useEffect(()=>{const p=y=>{const b=y.target,S=u.current?.contains(b),x=f.current?.contains(b);!S&&!x&&l(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const m=a?On.createPortal(h.jsx("div",{ref:f,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:c.top,left:c.left},onClick:()=>l(!1),children:i}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,children:[h.jsxs(oe,{ref:u,onClick:()=>l(!a),className:"flex items-center gap-2",children:[n==="left"&&e&&h.jsx(re,{name:e,className:"w-4 h-4"}),t&&h.jsx(Q,{className:"text-sm font-medium",children:t}),n==="right"&&e&&h.jsx(re,{name:e,className:"w-4 h-4"})]}),m]})},AE=({label:t,icon:e,variant:n="default",disabled:r=!1,divider:s=!1,className:o="",style:i,onClick:a})=>{if(s)return h.jsx(I,{className:"h-px bg-gray-200 dark:bg-gray-700 my-1",style:i});const l=n==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",c=r?"opacity-50 cursor-not-allowed":"cursor-pointer",d=()=>{!r&&a&&a()};return h.jsxs(I,{onClick:d,className:`flex items-center gap-3 px-4 py-3 transition-colors ${l} ${c} ${o}`,style:i,children:[e&&h.jsx(re,{name:e,className:"w-4 h-4"}),t&&h.jsx(Q,{className:"text-sm font-medium",children:t})]})},DE=()=>window.G7Core,Pc=v.createContext(null),Ip=()=>{const t=v.useContext(Pc);if(!t){const e=DE(),n=e?.locale?.current?.()||"ko",r=e?.locale?.supported?.()||["ko","en"];return{activeLocale:n,getActiveLocale:()=>e?.locale?.current?.()||"ko",supportedLocales:r,isInsideMultilingualTabPanel:!1}}return{...t,isInsideMultilingualTabPanel:!0}},IE=()=>window.G7Core,LE=({value:t,onChange:e,placeholder:n,readOnly:r,disabled:s,hasError:o})=>{const{activeLocale:i,getActiveLocale:a}=Ip(),l=typeof t=="string"?{[i]:t}:t||{},c=v.useCallback(u=>{const f=a();e({...l,[f]:u.target.value})},[l,a,e]),d=o?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500";return h.jsx(wt,{type:"text",value:l[i]||"",onChange:c,placeholder:n,readOnly:r,disabled:s,className:`w-full px-3 py-2 text-sm border ${d} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2`})},PE=(t,e)=>{if(!e)return!1;const n=e.startsWith("!"),r=n?e.slice(1):e,s=!!t[r];return n?!s:s},$E=({column:t,item:e,index:n,onValueChange:r,readOnly:s,error:o})=>{const i=e[t.key],a=s||t.readOnly||PE(e,t.readOnlyCondition)||t.disabled,l=!!o,c=l?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500",d=v.useCallback(f=>{r(t.key,f)},[t.key,r]),u=f=>h.jsxs(I,{className:"w-full",children:[f,l&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:o})]});switch(t.type){case"input":return u(h.jsx(wt,{type:"text",value:i||"",onChange:f=>d(f.target.value),placeholder:t.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`}));case"number":return u(h.jsx(wt,{type:"number",value:i??"",onChange:f=>d(f.target.value?Number(f.target.value):null),placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`}));case"select":return u(h.jsxs(Pr,{value:i??"",onChange:f=>d(f.target.value),disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`,children:[h.jsx("option",{value:"",children:"선택하세요"}),t.options?.map(f=>h.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}));case"textarea":return u(h.jsx(Zn,{value:i||"",onChange:f=>d(f.target.value),placeholder:t.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 resize-none ${t.className||""}`,rows:2}));case"multilingual":return u(h.jsx(LE,{value:i,onChange:f=>d(f),placeholder:t.placeholder,readOnly:a,disabled:a,hasError:l}));case"custom":return t.render?h.jsx(h.Fragment,{children:t.render(e,n,d)}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"-"});default:return h.jsx(Q,{className:"text-gray-900 dark:text-white text-sm",children:String(i??"")})}},FE=(t,e,n)=>{if(!t)return;if(n==="multilingual"){const o=IE()?.locale?.current?.()||"ko",i=`${e}.${o}`;return t[i]?.[0]}return t[e]?.[0]},zE=({item:t,index:e,id:n,columns:r,enableDrag:s=!0,showIndex:o=!0,canRemove:i=!0,rowActions:a,readOnly:l=!1,onValueChange:c,onRemove:d,className:u="",level:f=0,errors:g})=>{const{attributes:m,listeners:p,setNodeRef:y,transform:b,transition:S,isDragging:x}=Di({id:n,disabled:!s||l}),E={transform:Ln.Transform.toString(b),transition:S,opacity:x?.5:1},k=v.useCallback((_,w)=>{c?.(_,w)},[c]),C=v.useCallback(_=>{_.onClick?.(t,e)},[t,e]),N=f>0?{paddingLeft:`${f*24}px`}:{};return h.jsxs(I,{ref:y,style:E,className:`flex items-center gap-2 py-2 px-2 border-b border-gray-100 dark:border-gray-700 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors ${x?"bg-blue-50 dark:bg-blue-900/20 shadow-lg rounded-lg z-10":""} ${u}`,children:[s&&!l&&h.jsx(I,{...m,...p,className:"flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-grab active:cursor-grabbing text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400",style:N,children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),o&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-sm text-gray-500 dark:text-gray-400 font-medium",children:e+1}),r.map(_=>{const w=FE(g,_.key,_.type);return h.jsx(I,{className:`flex-1 min-w-0 ${_.width||""}`,style:_.width?{flex:"none",width:_.width}:{},children:h.jsx($E,{column:_,item:t,index:e,onValueChange:k,readOnly:l,error:w})},_.key)}),a&&a.length>0&&!l&&h.jsx(I,{className:"flex-shrink-0 flex items-center gap-1",children:a.map(_=>{const w=typeof _.disabled=="function"?_.disabled(t,e):_.disabled;return h.jsx(oe,{type:"button",onClick:()=>C(_),disabled:w,className:`p-1.5 rounded transition-colors ${_.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300"} disabled:opacity-50 disabled:cursor-not-allowed`,title:_.label,children:_.icon?h.jsx(re,{name:_.icon,className:"w-4 h-4"}):h.jsx(Q,{className:"text-xs",children:_.label})},_.key)})}),i&&!a&&!l&&h.jsx(I,{className:"flex-shrink-0",children:h.jsx(oe,{type:"button",onClick:d,className:"p-1.5 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",title:"삭제",children:h.jsx(re,{name:"minus",className:"w-4 h-4"})})})]})},Lp=()=>window.G7Core,$c=()=>`item_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,VE=t=>{const e={_id:$c()};return t.forEach(n=>{if(n.type==="multilingual"){const s=Lp()?.locale?.all?.()||["ko","en"],o={};s.forEach(i=>{o[i]=""}),e[n.key]=o}else n.type==="number"?e[n.key]=null:(n.type,e[n.key]="")}),e},HE=(t,e)=>{if(!t)return{};const n=`fields.${e}.`,r={};return Object.keys(t).forEach(s=>{if(s.startsWith(n)){const o=s.substring(n.length);r[o]=t[s]}}),r},UE=({items:t=[],columns:e,onChange:n,onAddItem:r,onRemoveItem:s,onReorder:o,addLabel:i="항목 추가",enableDrag:a=!0,showIndex:l=!0,minItems:c=0,maxItems:d,rowActions:u,emptyMessage:f="항목이 없습니다.",className:g="",headerClassName:m="",rowClassName:p="",name:y,readOnly:b=!1,createDefaultItem:S,childrenKey:x,itemIdKey:E="_id",errors:k,id:C,editorAttrs:N})=>{const _=v.useRef(null),w=v.useRef([]),M=v.useRef(null),O=v.useMemo(()=>{let j=!1;for(const U of t)if(U[E]==null){j=!0;break}return j?t.map(U=>U[E]!=null?U:{...U,[E]:$c()}):t},[t,E]);w.current=O,v.useEffect(()=>{M.current=null},[O]);const L=v.useCallback(j=>String(j[E]??""),[E]);v.useEffect(()=>{if(y){const j=Lp();j?.form&&(_.current=j.form)}},[y]);const F=jl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Ii})),$=v.useMemo(()=>O.map(j=>L(j)),[O,L]),D=v.useCallback(j=>{const{active:U,over:B}=j;if(B&&U.id!==B.id){const G=M.current??w.current,V=G.map(Z=>String(Z[E]??"")),K=V.indexOf(String(U.id)),X=V.indexOf(String(B.id));if(K!==-1&&X!==-1){const Z=Qr([...G],K,X);M.current=Z,n?.(Z),o?.(Z)}}},[n,o,E]),A=v.useCallback((j,U,B)=>{const V=[...M.current??w.current];V[j]={...V[j],[U]:B},M.current=V,n?.(V)},[n]),T=v.useCallback(()=>{const j=M.current??w.current;if(d&&j.length>=d)return;if(r){r();return}const U=S?S():VE(e);U[E]||(U[E]=$c());const B=[...j,U];M.current=B,n?.(B)},[d,r,S,e,E,n]),z=v.useCallback(j=>{const U=M.current??w.current;if(U.length<=c)return;const B=U[j];if(s){s(j,B);return}const G=U.filter((V,K)=>K!==j);M.current=G,n?.(G)},[c,s,n]),H=O.length>c,W=!d||O.lengthh.jsxs(I,{className:`flex-1 min-w-0 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase ${j.width||""}`,style:j.width?{flex:"none",width:j.width}:{},children:[j.label,j.required&&h.jsx(Q,{className:"text-red-500 dark:text-red-400 ml-0.5",children:"*"})]},j.key)),(u||!b&&H)&&h.jsx(I,{className:"flex-shrink-0 w-8"})]}),O.length>0?h.jsx(ec,{sensors:F,collisionDetection:Wl,onDragEnd:D,children:h.jsx(Ai,{items:$,strategy:tc,children:h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700",children:O.map((j,U)=>{const B=L(j),G=HE(k,U);return h.jsx(zE,{id:B,item:j,index:U,columns:e,enableDrag:a,showIndex:l,canRemove:H,rowActions:u,readOnly:b,onValueChange:(V,K)=>A(U,V,K),onRemove:()=>z(U),className:p,errors:G},B)})})})}):h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:f}),!b&&W&&h.jsx(I,{className:"relative border border-gray-200 dark:border-gray-700 border-t-0 rounded-b-lg",children:h.jsx(I,{className:"flex items-center justify-center py-2",children:h.jsxs(oe,{type:"button",onClick:T,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[h.jsx(re,{name:"plus",className:"w-4 h-4"}),h.jsx(Q,{children:i})]})})}),(b||!W)&&O.length>0&&h.jsx(I,{className:"border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg h-1"})]})},Pp=()=>window.G7Core,BE=()=>Pp()?.locale?.supported?.()??["ko","en"],jE=()=>Pp()?.locale?.current?.()??"ko",WE={ko:"한국어",en:"English",ja:"日本語",zh:"中文"},GE=({children:t,className:e="",style:n,variant:r="default",defaultLocale:s,onLocaleChange:o,locales:i})=>{const a=v.useMemo(()=>i&&i.length>0?i:BE(),[i]),[l,c]=v.useState(s||jE());v.useEffect(()=>{if(a.length>0&&!a.includes(l)){const p=a[0];c(p),o?.(p)}},[a,l,o]);const d=v.useRef(l);d.current=l;const u=v.useCallback(()=>d.current,[]),f=v.useCallback(p=>{c(p),o?.(p)},[o]),g=v.useMemo(()=>({activeLocale:l,getActiveLocale:u,supportedLocales:a}),[l,u,a]),m=p=>{const y=p===l,b="px-4 py-2 text-sm font-medium transition-all";return r==="pills"?y?`${b} bg-blue-600 text-white rounded-lg`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`:r==="underline"?y?`${b} text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400`:`${b} text-gray-600 dark:text-gray-400 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-500`:y?`${b} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`};return h.jsxs(I,{className:e,style:n,children:[h.jsx(Lo,{className:"flex gap-1 border-b border-gray-200 dark:border-gray-700 mb-4",children:a.map(p=>h.jsx(oe,{type:"button",onClick:()=>f(p),className:m(p),children:h.jsx(Q,{children:WE[p]||p})},p))}),h.jsx(Pc.Provider,{value:g,children:t})]})},YE=({label:t,required:e=!1,error:n,helperText:r,className:s="",labelClassName:o="",children:i,horizontal:a=!1,labelWidth:l="w-1/3",id:c,editorAttrs:d})=>{const u=a?`flex items-start gap-4 ${s}`:`space-y-1 ${s}`,f=a?`${l} flex-shrink-0 pt-2`:"",g=a?"flex-1":"";return h.jsxs(I,{className:u,id:c,...d,children:[t&&h.jsx(I,{className:f,children:h.jsxs(rn,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 ${o}`,children:[t,e&&h.jsx("span",{className:"ml-1 text-red-500 dark:text-red-400",children:"*"})]})}),h.jsxs(I,{className:`${g} ${n?"form-field-error":""}`.trim(),children:[i,r&&!n&&h.jsx(I,{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r}),n&&h.jsx(I,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:n})]})]})};function io(t){return t+.5|0}const or=(t,e,n)=>Math.max(Math.min(t,n),e);function ao(t){return or(io(t*2.55),0,255)}function ir(t){return or(io(t*255),0,255)}function Wn(t){return or(io(t/2.55)/100,0,1)}function $p(t){return or(io(t*100),0,100)}const hn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Fc=[..."0123456789ABCDEF"],XE=t=>Fc[t&15],KE=t=>Fc[(t&240)>>4]+Fc[t&15],Zi=t=>(t&240)>>4===(t&15),qE=t=>Zi(t.r)&&Zi(t.g)&&Zi(t.b)&&Zi(t.a);function ZE(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&hn[t[1]]*17,g:255&hn[t[2]]*17,b:255&hn[t[3]]*17,a:e===5?hn[t[4]]*17:255}:(e===7||e===9)&&(n={r:hn[t[1]]<<4|hn[t[2]],g:hn[t[3]]<<4|hn[t[4]],b:hn[t[5]]<<4|hn[t[6]],a:e===9?hn[t[7]]<<4|hn[t[8]]:255})),n}const QE=(t,e)=>t<255?e(t):"";function JE(t){var e=qE(t)?XE:KE;return t?"#"+e(t.r)+e(t.g)+e(t.b)+QE(t.a,e):void 0}const RE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Fp(t,e,n){const r=e*Math.min(n,1-n),s=(o,i=(o+t/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function eM(t,e,n){const r=(s,o=(s+t/60)%6)=>n-n*e*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function tM(t,e,n){const r=Fp(t,1,.5);let s;for(e+n>1&&(s=1/(e+n),e*=s,n*=s),s=0;s<3;s++)r[s]*=1-e-n,r[s]+=e;return r}function nM(t,e,n,r,s){return t===s?(e-n)/r+(e.5?d/(2-o-i):d/(o+i),l=nM(n,r,s,d,o),l=l*60+.5),[l|0,c||0,a]}function Vc(t,e,n,r){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,r)).map(ir)}function Hc(t,e,n){return Vc(Fp,t,e,n)}function rM(t,e,n){return Vc(tM,t,e,n)}function sM(t,e,n){return Vc(eM,t,e,n)}function zp(t){return(t%360+360)%360}function oM(t){const e=RE.exec(t);let n=255,r;if(!e)return;e[5]!==r&&(n=e[6]?ao(+e[5]):ir(+e[5]));const s=zp(+e[2]),o=+e[3]/100,i=+e[4]/100;return e[1]==="hwb"?r=rM(s,o,i):e[1]==="hsv"?r=sM(s,o,i):r=Hc(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function iM(t,e){var n=zc(t);n[0]=zp(n[0]+e),n=Hc(n),t.r=n[0],t.g=n[1],t.b=n[2]}function aM(t){if(!t)return;const e=zc(t),n=e[0],r=$p(e[1]),s=$p(e[2]);return t.a<255?`hsla(${n}, ${r}%, ${s}%, ${Wn(t.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const Vp={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Hp={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function lM(){const t={},e=Object.keys(Hp),n=Object.keys(Vp);let r,s,o,i,a;for(r=0;r>16&255,o>>8&255,o&255]}return t}let Qi;function cM(t){Qi||(Qi=lM(),Qi.transparent=[0,0,0,0]);const e=Qi[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const dM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function uM(t){const e=dM.exec(t);let n=255,r,s,o;if(e){if(e[7]!==r){const i=+e[7];n=e[8]?ao(i):or(i*255,0,255)}return r=+e[1],s=+e[3],o=+e[5],r=255&(e[2]?ao(r):or(r,0,255)),s=255&(e[4]?ao(s):or(s,0,255)),o=255&(e[6]?ao(o):or(o,0,255)),{r,g:s,b:o,a:n}}}function fM(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Wn(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Uc=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,ls=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function hM(t,e,n){const r=ls(Wn(t.r)),s=ls(Wn(t.g)),o=ls(Wn(t.b));return{r:ir(Uc(r+n*(ls(Wn(e.r))-r))),g:ir(Uc(s+n*(ls(Wn(e.g))-s))),b:ir(Uc(o+n*(ls(Wn(e.b))-o))),a:t.a+n*(e.a-t.a)}}function Ji(t,e,n){if(t){let r=zc(t);r[e]=Math.max(0,Math.min(r[e]+r[e]*n,e===0?360:1)),r=Hc(r),t.r=r[0],t.g=r[1],t.b=r[2]}}function Up(t,e){return t&&Object.assign(e||{},t)}function Bp(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=ir(t[3]))):(e=Up(t,{r:0,g:0,b:0,a:1}),e.a=ir(e.a)),e}function gM(t){return t.charAt(0)==="r"?uM(t):oM(t)}class lo{constructor(e){if(e instanceof lo)return e;const n=typeof e;let r;n==="object"?r=Bp(e):n==="string"&&(r=ZE(e)||cM(e)||gM(e)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=Up(this._rgb);return e&&(e.a=Wn(e.a)),e}set rgb(e){this._rgb=Bp(e)}rgbString(){return this._valid?fM(this._rgb):void 0}hexString(){return this._valid?JE(this._rgb):void 0}hslString(){return this._valid?aM(this._rgb):void 0}mix(e,n){if(e){const r=this.rgb,s=e.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*s.r+.5,r.g=255&c*r.g+o*s.g+.5,r.b=255&c*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(e,n){return e&&(this._rgb=hM(this._rgb,e._rgb,n)),this}clone(){return new lo(this.rgb)}alpha(e){return this._rgb.a=ir(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=io(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=n,this}opaquer(e){const n=this._rgb;return n.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Ji(this._rgb,2,e),this}darken(e){return Ji(this._rgb,2,-e),this}saturate(e){return Ji(this._rgb,1,e),this}desaturate(e){return Ji(this._rgb,1,-e),this}rotate(e){return iM(this._rgb,e),this}}function Gn(){}const pM=(()=>{let t=0;return()=>t++})();function lt(t){return t==null}function _t(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function Qe(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function gn(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function $n(t,e){return gn(t)?t:e}function Je(t,e){return typeof t>"u"?e:t}const mM=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,jp=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function ht(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function at(t,e,n,r){let s,o,i;if(_t(t))for(o=t.length,s=0;st,x:t=>t.x,y:t=>t.y};function vM(t){const e=t.split("."),n=[];let r="";for(const s of e)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function xM(t){const e=vM(t);return n=>{for(const r of e){if(r==="")break;n=n&&n[r]}return n}}function Cr(t,e){return(Gp[e]||(Gp[e]=xM(e)))(t)}function Bc(t){return t.charAt(0).toUpperCase()+t.slice(1)}const fo=t=>typeof t<"u",ar=t=>typeof t=="function",Yp=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function wM(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const ct=Math.PI,Ct=2*ct,ta=Number.POSITIVE_INFINITY,kM=ct/180,Et=ct/2,Sr=ct/4,Xp=ct*2/3,Kp=Math.log10,lr=Math.sign;function na(t,e,n){return Math.abs(t-e)s-o).pop(),e}function SM(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function ra(t){return!SM(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function _M(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function EM(t,e,n){let r,s,o;for(r=0,s=t.length;rl&&c=Math.min(e,n)-r&&t<=Math.max(e,n)+r}function jc(t,e,n){n=n||(i=>t[i]1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const Wc=(t,e,n,r)=>jc(t,n,r?s=>{const o=t[s][e];return ot[s][e]jc(t,n,r=>t[r][e]>=n);function AM(t,e,n){let r=0,s=t.length;for(;rr&&t[s-1]>n;)s--;return r>0||s{const r="_onData"+Bc(n),s=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return t._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function Rp(t,e){const n=t._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(e);s!==-1&&r.splice(s,1),!(r.length>0)&&(Jp.forEach(o=>{delete t[o]}),delete t._chartjs)}function e0(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const t0=(function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame})();function n0(t,e){let n=[],r=!1;return function(...s){n=s,r||(r=!0,t0.call(window,()=>{r=!1,t.apply(e,n)}))}}function IM(t,e){let n;return function(...r){return e?(clearTimeout(n),n=setTimeout(t,e,r)):t.apply(this,r),e}}const Gc=t=>t==="start"?"left":t==="end"?"right":"center",Ht=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2,LM=(t,e,n,r)=>t===(r?"left":"right")?n:t==="center"?(e+n)/2:e,oa=t=>t===0||t===1,r0=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*Ct/n)),s0=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*Ct/n)+1,ho={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*Et)+1,easeOutSine:t=>Math.sin(t*Et),easeInOutSine:t=>-.5*(Math.cos(ct*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>oa(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>oa(t)?t:r0(t,.075,.3),easeOutElastic:t=>oa(t)?t:s0(t,.075,.3),easeInOutElastic(t){return oa(t)?t:t<.5?.5*r0(t*2,.1125,.45):.5+.5*s0(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-ho.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?ho.easeInBounce(t*2)*.5:ho.easeOutBounce(t*2-1)*.5+.5};function o0(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function i0(t){return o0(t)?t:new lo(t)}function Yc(t){return o0(t)?t:new lo(t).saturate(.5).darken(.1).hexString()}const PM=["x","y","borderWidth","radius","tension"],$M=["color","borderColor","backgroundColor"];function FM(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:$M},numbers:{type:"number",properties:PM}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function zM(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const a0=new Map;function VM(t,e){e=e||{};const n=t+JSON.stringify(e);let r=a0.get(n);return r||(r=new Intl.NumberFormat(t,e),a0.set(n,r)),r}function Xc(t,e,n){return VM(e,n).format(t)}const HM={values(t){return _t(t)?t:""+t},numeric(t,e,n){if(t===0)return"0";const r=this.chart.options.locale;let s,o=t;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=UM(t,n)}const i=Kp(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Xc(t,r,l)}};function UM(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}var l0={formatters:HM};function BM(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,n)=>n.lineWidth,tickColor:(e,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:l0.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const Er=Object.create(null),Kc=Object.create(null);function go(t,e){if(!e)return t;const n=e.split(".");for(let r=0,s=n.length;rr.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>Yc(s.backgroundColor),this.hoverBorderColor=(r,s)=>Yc(s.borderColor),this.hoverColor=(r,s)=>Yc(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(n)}set(e,n){return qc(this,e,n)}get(e){return go(this,e)}describe(e,n){return qc(Kc,e,n)}override(e,n){return qc(Er,e,n)}route(e,n,r,s){const o=go(this,e),i=go(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=i[s];return Qe(l)?Object.assign({},c,l):Je(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var vt=new jM({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[FM,zM,BM]);function WM(t){return!t||lt(t.size)||lt(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function c0(t,e,n,r,s){let o=e[s];return o||(o=e[s]=t.measureText(s).width,n.push(s)),o>r&&(r=o),r}function Mr(t,e,n){const r=t.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((e-s)*r)/r+s}function d0(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function u0(t,e,n,r){f0(t,e,n,r,null)}function f0(t,e,n,r,s){let o,i,a,l,c,d,u,f;const g=e.pointStyle,m=e.rotation,p=e.radius;let y=(m||0)*kM;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){t.save(),t.translate(n,r),t.rotate(y),t.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),t.restore();return}if(!(isNaN(p)||p<=0)){switch(t.beginPath(),g){default:s?t.ellipse(n,r,s/2,p,0,0,Ct):t.arc(n,r,p,0,Ct),t.closePath();break;case"triangle":d=s?s/2:p,t.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Xp,t.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Xp,t.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),t.closePath();break;case"rectRounded":c=p*.516,l=p-c,i=Math.cos(y+Sr)*l,u=Math.cos(y+Sr)*(s?s/2-c:l),a=Math.sin(y+Sr)*l,f=Math.sin(y+Sr)*(s?s/2-c:l),t.arc(n-u,r-a,c,y-ct,y-Et),t.arc(n+f,r-i,c,y-Et,y),t.arc(n+u,r+a,c,y,y+Et),t.arc(n-f,r+i,c,y+Et,y+ct),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,t.rect(n-d,r-l,2*d,2*l);break}y+=Sr;case"rectRot":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+f,r-i),t.lineTo(n+u,r+a),t.lineTo(n-f,r+i),t.closePath();break;case"crossRot":y+=Sr;case"cross":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i);break;case"star":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i),y+=Sr,u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*p,a=Math.sin(y)*p,t.moveTo(n-i,r-a),t.lineTo(n+i,r+a);break;case"dash":t.moveTo(n,r),t.lineTo(n+Math.cos(y)*(s?s/2:p),r+Math.sin(y)*p);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function h0(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.xe.top-n&&t.y0&&o.strokeColor!=="";let l,c;for(t.save(),t.font=s.string,GM(t,o),l=0;l+t||0;function Jc(t,e){const n={},r=Qe(e),s=r?Object.keys(e):e,o=Qe(t)?r?i=>Je(t[i],t[e[i]]):i=>t[i]:()=>t;for(const i of s)n[i]=QM(o(i));return n}function g0(t){return Jc(t,{top:"y",right:"x",bottom:"y",left:"x"})}function cs(t){return Jc(t,["topLeft","topRight","bottomLeft","bottomRight"])}function pn(t){const e=g0(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ut(t,e){t=t||{},e=e||vt.font;let n=Je(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let r=Je(t.style,e.style);r&&!(""+r).match(qM)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:Je(t.family,e.family),lineHeight:ZM(Je(t.lineHeight,e.lineHeight),n),size:n,style:r,weight:Je(t.weight,e.weight),string:""};return s.string=WM(s),s}function aa(t,e,n,r){let s,o,i;for(s=0,o=t.length;sn&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function ds(t,e){return Object.assign(Object.create(t),e)}function Rc(t,e=[""],n,r,s=()=>t[0]){const o=n||t;typeof r>"u"&&(r=v0("_fallback",t));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>Rc([a,...t],e,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete t[0][l],!0},get(a,l){return m0(a,l,()=>iN(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return x0(a).includes(l)},ownKeys(a){return x0(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function us(t,e,n,r){const s={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:p0(t,r),setContext:o=>us(t,o,n,r),override:o=>us(t.override(o),e,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete t[i],!0},get(o,i,a){return m0(o,i,()=>eN(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(o,i){return Reflect.has(t,i)},ownKeys(){return Reflect.ownKeys(t)},set(o,i,a){return t[i]=a,delete o[i],!0}})}function p0(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:r=e.indexable,_allKeys:s=e.allKeys}=t;return{allKeys:s,scriptable:n,indexable:r,isScriptable:ar(n)?n:()=>n,isIndexable:ar(r)?r:()=>r}}const RM=(t,e)=>t?t+Bc(e):e,ed=(t,e)=>Qe(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function m0(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const r=n();return t[e]=r,r}function eN(t,e,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=t;let a=r[e];return ar(a)&&i.isScriptable(e)&&(a=tN(e,a,t,n)),_t(a)&&a.length&&(a=nN(e,a,t,i.isIndexable)),ed(e,a)&&(a=us(a,s,o&&o[e],i)),a}function tN(t,e,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(o,i||r);return a.delete(t),ed(t,l)&&(l=td(s._scopes,s,t,l)),l}function nN(t,e,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(t))return e[o.index%e.length];if(Qe(e[0])){const l=e,c=s._scopes.filter(d=>d!==l);e=[];for(const d of l){const u=td(c,s,t,d);e.push(us(u,o,i&&i[t],a))}}return e}function b0(t,e,n){return ar(t)?t(e,n):t}const rN=(t,e)=>t===!0?e:typeof t=="string"?Cr(e,t):void 0;function sN(t,e,n,r,s){for(const o of e){const i=rN(n,o);if(i){t.add(i);const a=b0(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function td(t,e,n,r){const s=e._rootScopes,o=b0(e._fallback,n,r),i=[...t,...s],a=new Set;a.add(r);let l=y0(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=y0(a,i,o,l,r),l===null)?!1:Rc(Array.from(a),[""],s,o,()=>oN(e,n,r))}function y0(t,e,n,r,s){for(;n;)n=sN(t,e,n,r,s);return n}function oN(t,e,n){const r=t._getTarget();e in r||(r[e]={});const s=r[e];return _t(s)&&Qe(n)?n:s||{}}function iN(t,e,n,r){let s;for(const o of e)if(s=v0(RM(o,t),n),typeof s<"u")return ed(t,s)?td(n,r,t,s):s}function v0(t,e){for(const n of e){if(!n)continue;const r=n[t];if(typeof r<"u")return r}}function x0(t){let e=t._keys;return e||(e=t._keys=aN(t._scopes)),e}function aN(t){const e=new Set;for(const n of t)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))e.add(r);return Array.from(e)}function nd(){return typeof window<"u"&&typeof document<"u"}function rd(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function la(t,e,n){let r;return typeof t=="string"?(r=parseInt(t,10),t.indexOf("%")!==-1&&(r=r/100*e.parentNode[n])):r=t,r}const ca=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function lN(t,e){return ca(t).getPropertyValue(e)}const cN=["top","right","bottom","left"];function Nr(t,e,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=cN[s];r[o]=parseFloat(t[e+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const dN=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function uN(t,e){const n=t.touches,r=n&&n.length?n[0]:t,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(dN(s,o,t.target))a=s,l=o;else{const c=e.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,i=!0}return{x:a,y:l,box:i}}function Or(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:r}=e,s=ca(n),o=s.boxSizing==="border-box",i=Nr(s,"padding"),a=Nr(s,"border","width"),{x:l,y:c,box:d}=uN(t,n),u=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:g,height:m}=e;return o&&(g-=i.width+a.width,m-=i.height+a.height),{x:Math.round((l-u)/g*n.width/r),y:Math.round((c-f)/m*n.height/r)}}function fN(t,e,n){let r,s;if(e===void 0||n===void 0){const o=t&&rd(t);if(!o)e=t.clientWidth,n=t.clientHeight;else{const i=o.getBoundingClientRect(),a=ca(o),l=Nr(a,"border","width"),c=Nr(a,"padding");e=i.width-c.width-l.width,n=i.height-c.height-l.height,r=la(a.maxWidth,o,"clientWidth"),s=la(a.maxHeight,o,"clientHeight")}}return{width:e,height:n,maxWidth:r||ta,maxHeight:s||ta}}const cr=t=>Math.round(t*10)/10;function hN(t,e,n,r){const s=ca(t),o=Nr(s,"margin"),i=la(s.maxWidth,t,"clientWidth")||ta,a=la(s.maxHeight,t,"clientHeight")||ta,l=fN(t,e,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=Nr(s,"border","width"),g=Nr(s,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,r?c/r:d-o.height),c=cr(Math.min(c,i,l.maxWidth)),d=cr(Math.min(d,a,l.maxHeight)),c&&!d&&(d=cr(c/2)),(e!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,c=cr(Math.floor(d*r))),{width:c,height:d}}function w0(t,e,n){const r=e||1,s=cr(t.height*r),o=cr(t.width*r);t.height=cr(t.height),t.width=cr(t.width);const i=t.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${t.height}px`,i.style.width=`${t.width}px`),t.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(t.currentDevicePixelRatio=r,i.height=s,i.width=o,t.ctx.setTransform(r,0,0,r,0,0),!0):!1}const gN=(function(){let t=!1;try{const e={get passive(){return t=!0,!1}};nd()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t})();function k0(t,e){const n=lN(t,e),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}const pN=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},mN=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function fs(t,e,n){return t?pN(e,n):mN()}function C0(t,e){let n,r;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=r)}function S0(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function da(t,e,n){return t.options.clip?t[n]:e[n]}function bN(t,e){const{xScale:n,yScale:r}=t;return n&&r?{left:da(n,e,"left"),right:da(n,e,"right"),top:da(r,e,"top"),bottom:da(r,e,"bottom")}:e}function yN(t,e){const n=e._clip;if(n.disabled)return!1;const r=bN(e,t.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?t.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?t.height:r.bottom+(n.bottom===!0?0:n.bottom)}}class vN{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,s){const o=n.listeners[s],i=n.duration;o.forEach(a=>a({chart:e,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=t0.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(e),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,e,"progress")),o.length||(r.running=!1,this._notify(s,r,e,"complete"),r.initial=!1),n+=o.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Xn=new vN;const _0="transparent",xN={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=i0(t||_0),s=r.valid&&i0(e||_0);return s&&s.valid?s.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class wN{constructor(e,n,r,s){const o=n[r];s=aa([e.to,s,o,e.from]);const i=aa([e.from,o,s]);this._active=!0,this._fn=e.fn||xN[e.type||typeof i],this._easing=ho[e.easing]||ho.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=aa([e.to,n,s,e.from]),this._from=aa([e.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let s=0;s{const o=e[s];if(!Qe(o))return;const i={};for(const a of n)i[a]=o[a];(_t(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(e,n){const r=n.options,s=CN(e,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&kN(e.options.$animations,r).then(()=>{e.options=r},()=>{}),o}_createAnimations(e,n){const r=this._properties,s=[],o=e.$animations||(e.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const c=i[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(e,n));continue}const d=n[c];let u=o[c];const f=r.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){e[c]=d;continue}o[c]=u=new wN(f,e,c,d),s.push(u)}return s}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return Xn.add(this._chart,r),!0}}function kN(t,e){const n=[],r=Object.keys(e);for(let s=0;s0||!n&&o<0)return s.index}return null}function A0(t,e){const{chart:n,_cachedMeta:r}=t,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,c=i.axis,d=MN(o,i,r),u=e.length;let f;for(let g=0;gn[r].axis===e).shift()}function TN(t,e){return ds(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function AN(t,e,n){return ds(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function mo(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const s of e){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const id=t=>t==="reset"||t==="none",D0=(t,e)=>e?t:Object.assign({},t),DN=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:N0(n,!0),values:null};class hs{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=sd(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&mo(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(u,f,g,m)=>u==="x"?f:u==="r"?m:g,o=n.xAxisID=Je(r.xAxisID,od(e,"x")),i=n.yAxisID=Je(r.yAxisID,od(e,"y")),a=n.rAxisID=Je(r.rAxisID,od(e,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Rp(this._data,this),e._stacked&&mo(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(Qe(n)){const s=this._cachedMeta;this._data=EN(n,s)}else if(r!==n){if(r){Rp(r,this);const s=this._cachedMeta;mo(s),s._parsed=[]}n&&Object.isExtensible(n)&&DM(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=sd(n.vScale,n),n.stack!==r.stack&&(s=!0,mo(n),n.stack=r.stack),this._resyncElements(e),(s||o!==n._stacked)&&(A0(this,n._parsed),n._stacked=sd(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=e===0&&n===s.length?!0:r._sorted,c=e>0&&r._parsed[e-1],d,u,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{_t(s[e])?f=this.parseArrayData(r,s,e,n):Qe(s[e])?f=this.parseObjectData(r,s,e,n):f=this.parsePrimitiveData(r,s,e,n);const g=()=>u[a]===null||c&&u[a]p||u=0;--f)if(!m()){this.updateRangeFromParsed(c,e,g,l);break}}return c}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s=0&&ethis.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(D0(p,l))),p}_resolveAnimations(e,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(e,r,n))}const c=new E0(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||id(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(e,n,r,s){id(s)?Object.assign(e,r):this._resolveAnimations(n,s).update(e,r)}updateSharedOptions(e,n,r){e&&!id(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,s){e.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(e,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,e):o{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=e;as-o))}return t._cache.$bar}function LN(t){const e=t.iScale,n=IN(e,t.type);let r=e._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(fo(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s0?s[t-1]:null,a=tMath.abs(a)&&(l=a,c=i),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:s,end:o,min:i,max:a}}function I0(t,e,n,r){return _t(t)?FN(t,e,n,r):e[n.axis]=n.parse(t,r),e}function L0(t,e,n,r){const s=t.iScale,o=t.vScale,i=s.getLabels(),a=s===o,l=[];let c,d,u,f;for(c=n,d=n+r;c=n?1:-1)}function VN(t){let e,n,r,s,o;return t.horizontal?(e=t.base>t.x,n="left",r="right"):(e=t.based.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=d=>{const u=d._parsed.find(g=>g[r.axis]===l),f=u&&u[d.vScale.axis];if(lt(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||i.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&i.push(d.stack),d.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(e).filter(r=>e[r].axis===n).shift()}_getAxis(){const e={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)e[Je(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(e)}_getStackIndex(e,n,r){const s=this._getStacks(e,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const e=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;osa(x,a,l,!0)?1:Math.max(E,E*n,k,k*n),m=(x,E,k)=>sa(x,a,l,!0)?-1:Math.min(E,E*n,k,k*n),p=g(0,c,u),y=g(Et,d,f),b=m(ct,c,u),S=m(ct+Et,d,f);r=(p-b)/2,s=(y-S)/2,o=-(p+b)/2,i=-(y+S)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class bo extends hs{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(Qe(r[e])){const{key:l="value"}=this._parsing;o=c=>+Cr(r[c],l)}let i,a;for(i=e,a=e+n;i0&&!isNaN(e)?Ct*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Xc(n._parsed[e],r.options.locale);return{label:s[e]||"",value:o}}getMaxBorderWidth(e){let n=0;const r=this.chart;let s,o,i,a,l;if(!e){for(s=0,o=r.data.datasets.length;se!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),Fe(bo,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=e.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!e.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||u.borderRadius),index:c}}):[]}},onClick(e,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});function Tr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ld{constructor(e){Fe(this,"options");this.options=e||{}}static override(e){Object.assign(ld.prototype,e)}init(){}formats(){return Tr()}parse(){return Tr()}format(){return Tr()}add(){return Tr()}diff(){return Tr()}startOf(){return Tr()}endOf(){return Tr()}}var WN={_date:ld};function GN(t,e,n,r){const{controller:s,data:o,_sorted:i}=t,a=s._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&i&&o.length){const c=a._reversePixels?TM:Wc;if(r){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(e);if(u){const f=c(o,e,n-u),g=c(o,e,n+u);return{lo:f.lo,hi:g.hi}}}}else{const d=c(o,e,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:f}=t,g=f.slice(0,d.lo+1).reverse().findIndex(p=>!lt(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!lt(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function fa(t,e,n,r,s){const o=t.getSortedVisibleDatasetMetas(),i=n[e];for(let a=0,l=o.length;a{l[i]&&l[i](e[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,s))}),r&&!a?[]:o}var qN={modes:{index(t,e,n,r){const s=Or(e,t),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?cd(t,s,o,r,i):dd(t,s,o,!1,r,i),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(t,e,n,r){const s=Or(e,t),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?cd(t,s,o,r,i):dd(t,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let d=0;dn.pos===e)}function V0(t,e){return t.filter(n=>z0.indexOf(n.pos)===-1&&n.box.axis===e)}function vo(t,e){return t.sort((n,r)=>{const s=e?r:n,o=e?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function ZN(t){const e=[];let n,r,s,o,i,a;for(n=0,r=(t||[]).length;nc.box.fullSize),!0),r=vo(yo(e,"left"),!0),s=vo(yo(e,"right")),o=vo(yo(e,"top"),!0),i=vo(yo(e,"bottom")),a=V0(e,"x"),l=V0(e,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:yo(e,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function H0(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function U0(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function eO(t,e,n,r){const{pos:s,box:o}=n,i=t.maxPadding;if(!Qe(s)){n.size&&(t[s]-=n.size);const u=r[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,t[s]+=n.size}o.getPadding&&U0(i,o.getPadding());const a=Math.max(0,e.outerWidth-H0(i,t,"left","right")),l=Math.max(0,e.outerHeight-H0(i,t,"top","bottom")),c=a!==t.w,d=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function tO(t){const e=t.maxPadding;function n(r){const s=Math.max(e[r]-t[r],0);return t[r]+=s,s}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function nO(t,e){const n=e.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(e[i],n[i])}),o}return r(t?["left","right"]:["top","bottom"])}function xo(t,e,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=t.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const d=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);U0(f,pn(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=JN(l.concat(c),u);xo(a.fullSize,g,u,m),xo(l,g,u,m),xo(c,g,u,m)&&xo(l,g,u,m),tO(g),B0(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,B0(a.rightAndBottom,g,u,m),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},at(a.chartArea,p=>{const y=p.box;Object.assign(y,t.chartArea),y.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class j0{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,s){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(e){return!0}updateConfig(e){}}class rO extends j0{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ga="$chartjs",sO={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},W0=t=>t===null||t==="";function oO(t,e){const n=t.style,r=t.getAttribute("height"),s=t.getAttribute("width");if(t[ga]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",W0(s)){const o=k0(t,"width");o!==void 0&&(t.width=o)}if(W0(r))if(t.style.height==="")t.height=t.width/(e||2);else{const o=k0(t,"height");o!==void 0&&(t.height=o)}return t}const G0=gN?{passive:!0}:!1;function iO(t,e,n){t&&t.addEventListener(e,n,G0)}function aO(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,G0)}function lO(t,e){const n=sO[t.type]||t.type,{x:r,y:s}=Or(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:s!==void 0?s:null}}function pa(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function cO(t,e,n){const r=t.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||pa(a.addedNodes,r),i=i&&!pa(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function dO(t,e,n){const r=t.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||pa(a.removedNodes,r),i=i&&!pa(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const wo=new Map;let Y0=0;function X0(){const t=window.devicePixelRatio;t!==Y0&&(Y0=t,wo.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function uO(t,e){wo.size||window.addEventListener("resize",X0),wo.set(t,e)}function fO(t){wo.delete(t),wo.size||window.removeEventListener("resize",X0)}function hO(t,e,n){const r=t.canvas,s=r&&rd(r);if(!s)return;const o=n0((a,l)=>{const c=s.clientWidth;n(a,l),c{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),uO(t,o),i}function ud(t,e,n){n&&n.disconnect(),e==="resize"&&fO(t)}function gO(t,e,n){const r=t.canvas,s=n0(o=>{t.ctx!==null&&n(lO(o,t))},t);return iO(r,e,s),s}class pO extends j0{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(oO(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[ga])return!1;const r=n[ga].initial;["height","width"].forEach(o=>{const i=r[o];lt(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[ga],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const s=e.$proxies||(e.$proxies={}),i={attach:cO,detach:dO,resize:hO}[n]||gO;s[n]=i(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),s=r[n];if(!s)return;({attach:ud,detach:ud,resize:ud}[n]||aO)(e,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,s){return hN(e,n,r,s)}isAttached(e){const n=e&&rd(e);return!!(n&&n.isConnected)}}function mO(t){return!nd()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?rO:pO}let Ar=(Oa=class{constructor(){Fe(this,"x");Fe(this,"y");Fe(this,"active",!1);Fe(this,"options");Fe(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return ra(this.x)&&ra(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const s={};return e.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},Fe(Oa,"defaults",{}),Fe(Oa,"defaultRoutes"),Oa);function bO(t,e){const n=t.options.ticks,r=yO(t),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?xO(e):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return wO(e,c,o,i/s),c;const d=vO(o,e,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(ma(e,c,d,lt(g)?0:a-g,a),u=0,f=i-1;us)return l}return Math.max(s,1)}function xO(t){const e=[];let n,r;for(n=0,r=t.length;nt==="left"?"right":t==="right"?"left":t,K0=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,q0=(t,e)=>Math.min(e||t,t);function Z0(t,e){const n=[],r=t.length/e,s=t.length;let o=0;for(;oi+a)))return l}function _O(t,e){at(t,n=>{const r=n.gc,s=r.length/2;let o;if(s>e){for(o=0;or?r:n,r=s&&n>r?n:r,{min:$n(n,$n(r,n)),max:$n(r,$n(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ht(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=JM(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=Jt(this.chart.width-u,0,this.maxWidth);a=e.offset?this.maxWidth/r:g/(r-1),u+6>a&&(a=g/(r-(e.offset?.5:1)),l=this.maxHeight-ko(e.grid)-n.padding-Q0(e.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=MM(Math.min(Math.asin(Jt((d.highest.height+6)/a,-1,1)),Math.asin(Jt(l/c,-1,1))-Math.asin(Jt(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){ht(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ht(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=Q0(s,n.options.font);if(a?(e.width=this.maxWidth,e.height=ko(o)+l):(e.height=this.maxHeight,e.width=ko(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=Yn(this.labelRotation),p=Math.cos(m),y=Math.sin(m);if(a){const b=r.mirror?0:y*u.width+p*f.height;e.height=Math.min(this.maxHeight,e.height+b+g)}else{const b=r.mirror?0:p*u.width+y*f.height;e.width=Math.min(this.maxWidth,e.width+b+g)}this._calculatePadding(c,d,y,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=s*e.width,g=r*n.height):(f=r*e.height,g=s*n.width):o==="start"?g=n.width:o==="end"?f=e.width:o!=="inner"&&(f=e.width/2,g=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+i)*this.width/(this.width-u),0)}else{let d=n.height/2,u=e.height/2;o==="start"?(d=0,u=e.height):o==="end"&&(d=n.height,u=0),this.paddingTop=d+i,this.paddingBottom=u+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ht(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,r;for(n=0,r=e.length;n({width:i[w]||0,height:a[w]||0});return{first:_(0),last:_(n-1),widest:_(C),highest:_(N),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return OM(this._alignToPixels?Mr(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&ea*s?a/r:l/s:l*s0}_computeGridLineItems(e){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=ko(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(A){return Mr(r,A,p)};let S,x,E,k,C,N,_,w,M,O,L,F;if(i==="top")S=b(this.bottom),N=this.bottom-f,w=S-y,O=b(e.top)+y,F=e.bottom;else if(i==="bottom")S=b(this.top),O=e.top,F=b(e.bottom)-y,N=S+y,w=this.top+f;else if(i==="left")S=b(this.right),C=this.right-f,_=S-y,M=b(e.left)+y,L=e.right;else if(i==="right")S=b(this.left),M=e.left,L=b(e.right)-y,C=S+y,_=this.left+f;else if(n==="x"){if(i==="center")S=b((e.top+e.bottom)/2+.5);else if(Qe(i)){const A=Object.keys(i)[0],T=i[A];S=b(this.chart.scales[A].getPixelForValue(T))}O=e.top,F=e.bottom,N=S+y,w=N+f}else if(n==="y"){if(i==="center")S=b((e.left+e.right)/2);else if(Qe(i)){const A=Object.keys(i)[0],T=i[A];S=b(this.chart.scales[A].getPixelForValue(T))}C=S-y,_=C-f,M=e.left,L=e.right}const $=Je(s.ticks.maxTicksLimit,u),D=Math.max(1,Math.ceil(u/$));for(x=0;x0&&(K-=G/2);break}j={left:K,top:V,width:G+U.width,height:B+U.height,color:D.backdropColor}}y.push({label:E,font:w,textOffset:L,options:{rotation:p,color:T,strokeColor:z,strokeWidth:H,textAlign:W,textBaseline:F,translation:[k,C],backdrop:j}})}return y}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Yn(this.labelRotation))return e==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=e+o,l=i.widest.width;let c,d;return n==="left"?s?(d=this.right+o,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,s,o,i),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===e);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,i;const a=(l,c,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o{const r=n.split("."),s=r.pop(),o=[t].concat(r).join("."),i=e[n].split("."),a=i.pop(),l=i.join(".");vt.route(o,s,l,a)})}function DO(t){return"id"in t&&"defaults"in t}class IO{constructor(){this.controllers=new ba(hs,"datasets",!0),this.elements=new ba(Ar,"elements"),this.plugins=new ba(Object,"plugins"),this.scales=new ba(gs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(e,o,s):at(s,i=>{const a=r||this._getRegistryForType(i);this._exec(e,a,i)})})}_exec(e,n,r){const s=Bc(e);ht(r["before"+s],[],r),n[e](r),ht(r["after"+s],[],r)}_getRegistryForType(e){for(let n=0;no.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),e,"stop"),this._notify(s(r,n),e,"start")}}function PO(t){const e={},n=[],r=Object.keys(zn.plugins.items);for(let o=0;o1&&J0(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function R0(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function BO(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return R0(t,"x",n[0])||R0(t,"y",n[0])}return{}}function jO(t,e){const n=Er[t.type]||{scales:{}},r=e.scales||{},s=fd(t.type,e),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Qe(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=hd(i,a,BO(i,t),vt.scales[a.type]),c=HO(l,s),d=n.scales||{};o[i]=uo(Object.create(null),[{axis:l},a,d[l],d[c]])}),t.data.datasets.forEach(i=>{const a=i.type||t.type,l=i.indexAxis||fd(a,e),d=(Er[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=VO(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),uo(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];uo(a,[vt.scales[a.type],vt.scale])}),o}function em(t){const e=t.options||(t.options={});e.plugins=Je(e.plugins,{}),e.scales=jO(t,e)}function tm(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function WO(t){return t=t||{},t.data=tm(t.data),em(t),t}const nm=new Map,rm=new Set;function ya(t,e){let n=nm.get(t);return n||(n=e(),nm.set(t,n),rm.add(n)),n}const Co=(t,e,n)=>{const r=Cr(e,n);r!==void 0&&t.add(r)};class GO{constructor(e){this._config=WO(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=tm(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),em(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return ya(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return ya(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return ya(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return ya(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let s=r.get(e);return(!s||n)&&(s=new Map,r.set(e,s)),s}getOptionScopes(e,n,r){const{options:s,type:o}=this,i=this._cachedScopes(e,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{e&&(l.add(e),d.forEach(u=>Co(l,e,u))),d.forEach(u=>Co(l,s,u)),d.forEach(u=>Co(l,Er[o]||{},u)),d.forEach(u=>Co(l,vt,u)),d.forEach(u=>Co(l,Kc,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),rm.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,Er[n]||{},vt.datasets[n]||{},{type:n},vt,Kc]}resolveNamedOptions(e,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=sm(this._resolverCache,e,s);let l=i;if(XO(i,n)){o.$shared=!1,r=ar(r)?r():r;const c=this.createResolver(e,r,a);l=us(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(e,n,r=[""],s){const{resolver:o}=sm(this._resolverCache,e,r);return Qe(n)?us(o,n,void 0,s):o}}function sm(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Rc(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const YO=t=>Qe(t)&&Object.getOwnPropertyNames(t).some(e=>ar(t[e]));function XO(t,e){const{isScriptable:n,isIndexable:r}=p0(t);for(const s of e){const o=n(s),i=r(s),a=(i||o)&&t[s];if(o&&(ar(a)||YO(a))||i&&_t(a))return!0}return!1}var KO="4.5.1";const qO=["top","bottom","left","right","chartArea"];function om(t,e){return t==="top"||t==="bottom"||qO.indexOf(t)===-1&&e==="x"}function im(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function am(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),ht(n&&n.onComplete,[t],e)}function ZO(t){const e=t.chart,n=e.options.animation;ht(n&&n.onProgress,[t],e)}function lm(t){return nd()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const va={},cm=t=>{const e=lm(t);return Object.values(va).filter(n=>n.canvas===e).pop()};function QO(t,e,n){const r=Object.keys(t);for(const s of r){const o=+s;if(o>=e){const i=t[s];delete t[s],(n>0||o>e)&&(t[o+n]=i)}}}function JO(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}let So=(ur=class{static register(...e){zn.add(...e),dm()}static unregister(...e){zn.remove(...e),dm()}constructor(e,n){const r=this.config=new GO(n),s=lm(e),o=cm(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||mO(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=pM(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new LO,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=IM(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],va[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Xn.listen(this,"complete",am),Xn.listen(this,"progress",ZO),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return lt(e)?n&&o?o:s?r/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return zn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():w0(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return d0(this.canvas,this.ctx),this}stop(){return Xn.stop(this),this}resize(e,n){Xn.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,e,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,w0(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),ht(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=hd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),at(o,i=>{const a=i.options,l=a.id,c=hd(l,a),d=Je(a.type,i.dtype);(a.position===void 0||om(a.position,c)!==om(i.dposition))&&(a.position=i.dposition),s[l]=!0;let u=null;if(l in r&&r[l].type===d)u=r[l];else{const f=zn.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,e)}),at(s,(i,a)=>{i||delete r[a]}),at(r,i=>{mn.configure(this,i,i.options),mn.addBox(this,i)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((s,o)=>s.index-o.index),r>n){for(let s=n;sn.length&&delete this._stacks,e.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(im("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,e=>{mn.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!Yp(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;QO(e,s,i)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(e.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;mn.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r={meta:e,index:e.index,cancelable:!0},s=yN(this,e);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Zc(n,s),e.controller.draw(),s&&Qc(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return h0(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,s){const o=qN.modes[n];return typeof o=="function"?o(this,e,r,s):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=ds(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(e),i=o.controller._resolveAnimations(void 0,s);fo(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===e?s:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),Xn.remove(this),e=0,n=this.data.datasets.length;e{n.addEventListener(this,o,i),e[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),e[l]=c},s=(l,c)=>{e[l]&&(n.removeEventListener(this,l,c),delete e[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){at(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},at(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=e.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!Ri(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),i=o(n,e),a=r?e:o(e,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},s=i=>(i.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(e,s,r,i),l=wM(e),c=JO(e,this._lastEvent,r,l);r&&(this._lastEvent=null,ht(o.onHover,[e,a,this],this),l&&ht(o.onClick,[e,a,this],this));const d=!Ri(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,d}_getActiveElements(e,n,r,s){if(e.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,s)}},Fe(ur,"defaults",vt),Fe(ur,"instances",va),Fe(ur,"overrides",Er),Fe(ur,"registry",zn),Fe(ur,"version",KO),Fe(ur,"getChart",cm),ur);function dm(){return at(So.instances,t=>t._plugins.invalidate())}function RO(t,e,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/i,Fn(r-n));if(t.beginPath(),t.arc(s,o,i-c/2,r+u/2,n-u/2),a>0){const f=Math.min(c/a,Fn(r-n));t.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*Fn(r-n));if(d==="round")t.arc(s,o,f,n-ct/2,r+ct/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+ct/2)+s,p=-g*Math.sin(n+ct/2)+o,y=g*Math.cos(r+ct/2)+s,b=g*Math.sin(r+ct/2)+o;t.lineTo(m,p),t.lineTo(y,b)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function eT(t,e,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=e;let c=s/a;t.beginPath(),t.arc(o,i,a,r-c,n+c),l>s?(c=s/l,t.arc(o,i,l,n+c,r-c,!0)):t.arc(o,i,s,n+Et,r-Et),t.closePath(),t.clip()}function tT(t){return Jc(t,["outerStart","outerEnd","innerStart","innerEnd"])}function nT(t,e,n,r){const s=tT(t.options.borderRadius),o=(n-e)/2,i=Math.min(o,r*e/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return Jt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Jt(s.innerStart,0,i),innerEnd:Jt(s.innerEnd,0,i)}}function ps(t,e,n,r){return{x:n+t*Math.cos(e),y:r+t*Math.sin(e)}}function xa(t,e,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,u=Math.max(e.outerRadius+r+n-c,0),f=d>0?d+r+n+c:0;let g=0;const m=s-l;if(r){const D=d>0?d-r:0,A=u>0?u-r:0,T=(D+A)/2,z=T!==0?m*T/(T+r):m;g=(m-z)/2}const p=Math.max(.001,m*u-n/ct)/u,y=(m-p)/2,b=l+y+g,S=s-y-g,{outerStart:x,outerEnd:E,innerStart:k,innerEnd:C}=nT(e,f,u,S-b),N=u-x,_=u-E,w=b+x/N,M=S-E/_,O=f+k,L=f+C,F=b+k/O,$=S-C/L;if(t.beginPath(),o){const D=(w+M)/2;if(t.arc(i,a,u,w,D),t.arc(i,a,u,D,M),E>0){const H=ps(_,M,i,a);t.arc(H.x,H.y,E,M,S+Et)}const A=ps(L,S,i,a);if(t.lineTo(A.x,A.y),C>0){const H=ps(L,$,i,a);t.arc(H.x,H.y,C,S+Et,$+Math.PI)}const T=(S-C/f+(b+k/f))/2;if(t.arc(i,a,f,S-C/f,T,!0),t.arc(i,a,f,T,b+k/f,!0),k>0){const H=ps(O,F,i,a);t.arc(H.x,H.y,k,F+Math.PI,b-Et)}const z=ps(N,b,i,a);if(t.lineTo(z.x,z.y),x>0){const H=ps(N,w,i,a);t.arc(H.x,H.y,x,b-Et,w)}}else{t.moveTo(i,a);const D=Math.cos(w)*u+i,A=Math.sin(w)*u+a;t.lineTo(D,A);const T=Math.cos(M)*u+i,z=Math.sin(M)*u+a;t.lineTo(T,z)}t.closePath()}function rT(t,e,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=e;let l=e.endAngle;if(o){xa(t,e,n,r,l,s);for(let c=0;c=ct&&g===0&&d!=="miter"&&RO(t,e,p),o||(xa(t,e,n,r,p,s),t.stroke())}class _o extends Ar{constructor(n){super();Fe(this,"circumference");Fe(this,"endAngle");Fe(this,"fullCircles");Fe(this,"innerRadius");Fe(this,"outerRadius");Fe(this,"pixelMargin");Fe(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=Qp(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,m=Je(f,c-l),p=sa(i,l,c)&&l!==c,y=m>=Ct||p,b=_r(a,d+g,u+g);return y&&b}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(o+i)/2,f=(a+l+d+c)/2;return{x:r+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ct?Math.floor(s/Ct):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(ct,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,rT(n,this,d,i,a),sT(n,this,d,i,a),n.restore()}}Fe(_o,"id","arc"),Fe(_o,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),Fe(_o,"defaultRoutes",{backgroundColor:"backgroundColor"}),Fe(_o,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function um(t,e){const{x:n,y:r,base:s,width:o,height:i}=t.getProps(["x","y","base","width","height"],e);let a,l,c,d,u;return t.horizontal?(u=i/2,a=Math.min(n,s),l=Math.max(n,s),c=r-u,d=r+u):(u=o/2,a=n-u,l=n+u,c=Math.min(r,s),d=Math.max(r,s)),{left:a,top:c,right:l,bottom:d}}function dr(t,e,n,r){return t?0:Jt(e,n,r)}function oT(t,e,n){const r=t.options.borderWidth,s=t.borderSkipped,o=g0(r);return{t:dr(s.top,o.top,0,n),r:dr(s.right,o.right,0,e),b:dr(s.bottom,o.bottom,0,n),l:dr(s.left,o.left,0,e)}}function iT(t,e,n){const{enableBorderRadius:r}=t.getProps(["enableBorderRadius"]),s=t.options.borderRadius,o=cs(s),i=Math.min(e,n),a=t.borderSkipped,l=r||Qe(s);return{topLeft:dr(!l||a.top||a.left,o.topLeft,0,i),topRight:dr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:dr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:dr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function aT(t){const e=um(t),n=e.right-e.left,r=e.bottom-e.top,s=oT(t,n/2,r/2),o=iT(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r,radius:o},inner:{x:e.left+s.l,y:e.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function gd(t,e,n,r){const s=e===null,o=n===null,a=t&&!(s&&o)&&um(t,r);return a&&(s||_r(e,a.left,a.right))&&(o||_r(n,a.top,a.bottom))}function lT(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function cT(t,e){t.rect(e.x,e.y,e.w,e.h)}function pd(t,e,n={}){const r=t.x!==n.x?-e:0,s=t.y!==n.y?-e:0,o=(t.x+t.w!==n.x+n.w?e:0)-r,i=(t.y+t.h!==n.y+n.h?e:0)-s;return{x:t.x+r,y:t.y+s,w:t.w+o,h:t.h+i,radius:t.radius}}class wa extends Ar{constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=aT(this),a=lT(i.radius)?ia:cT;e.save(),(i.w!==o.w||i.h!==o.h)&&(e.beginPath(),a(e,pd(i,n,o)),e.clip(),a(e,pd(o,-n,i)),e.fillStyle=r,e.fill("evenodd")),e.beginPath(),a(e,pd(o,n)),e.fillStyle=s,e.fill(),e.restore()}inRange(e,n,r){return gd(this,e,n,r)}inXRange(e,n){return gd(this,e,null,n)}inYRange(e,n){return gd(this,null,e,n)}getCenterPoint(e){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}Fe(wa,"id","bar"),Fe(wa,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Fe(wa,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const fm=(t,e)=>{let{boxHeight:n=e,boxWidth:r=e}=t;return t.usePointStyle&&(n=Math.min(n,e),r=t.pointStyleWidth||Math.min(r,e)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(e,n)}},dT=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class hm extends Ar{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,r){this.maxWidth=e,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=ht(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(r=>e.filter(r,this.chart.data))),e.sort&&(n=n.sort((r,s)=>e.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const r=e.labels,s=Ut(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=fm(r,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(i,s,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=e;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((m,p)=>{const y=r+n/2+o.measureText(m.text).width;(p===0||c[c.length-1]+y+2*a>i)&&(u+=d,c[c.length-(p>0?0:1)]=0,g+=d,f++),l[p]={left:0,top:g,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(e,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=i-e;let u=a,f=0,g=0,m=0,p=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:S,itemHeight:x}=uT(r,n,o,y,s);b>0&&g+x+2*a>d&&(u+=f+a,c.push({width:f,height:g}),m+=f+a,p++,f=g=0),l[b]={left:m,top:g,col:p,width:S,height:x},f=Math.max(f,S),g+=x+a}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=fs(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ht(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Ht(r,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+e+s,c.left=i.leftForLtr(i.x(l),c.width),l+=c.width+s}else{let a=0,l=Ht(r,this.top+e+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Ht(r,this.top+e+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=i.leftForLtr(i.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;Zc(e,this),this._draw(),Qc(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=e,a=vt.color,l=fs(e.rtl,this.left,this.width),c=Ut(i.font),{padding:d}=i,u=c.size,f=u/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:y}=fm(i,u),b=function(C,N,_){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const w=Je(_.lineWidth,1);if(s.fillStyle=Je(_.fillStyle,a),s.lineCap=Je(_.lineCap,"butt"),s.lineDashOffset=Je(_.lineDashOffset,0),s.lineJoin=Je(_.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=Je(_.strokeStyle,a),s.setLineDash(Je(_.lineDash,[])),i.usePointStyle){const M={radius:p*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:w},O=l.xPlus(C,m/2),L=N+f;f0(s,M,O,L,i.pointStyleWidth&&m)}else{const M=N+Math.max((u-p)/2,0),O=l.leftForLtr(C,m),L=cs(_.borderRadius);s.beginPath(),Object.values(L).some(F=>F!==0)?ia(s,{x:O,y:M,w:m,h:p,radius:L}):s.rect(O,M,m,p),s.fill(),w!==0&&s.stroke()}s.restore()},S=function(C,N,_){po(s,_.text,C,N+y/2,c,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},x=this.isHorizontal(),E=this._computeTitleHeight();x?g={x:Ht(o,this.left+d,this.right-r[0]),y:this.top+d+E,line:0}:g={x:this.left+d,y:Ht(o,this.top+E+d,this.bottom-n[0].height),line:0},C0(this.ctx,e.textDirection);const k=y+d;this.legendItems.forEach((C,N)=>{s.strokeStyle=C.fontColor,s.fillStyle=C.fontColor;const _=s.measureText(C.text).width,w=l.textAlign(C.textAlign||(C.textAlign=i.textAlign)),M=m+f+_;let O=g.x,L=g.y;l.setWidth(this.width),x?N>0&&O+M+d>this.right&&(L=g.y+=k,g.line++,O=g.x=Ht(o,this.left+d,this.right-r[g.line])):N>0&&L+k>this.bottom&&(O=g.x=O+n[g.line].width+d,g.line++,L=g.y=Ht(o,this.top+E+d,this.bottom-n[g.line].height));const F=l.x(O);if(b(F,L,C),O=LM(w,O+m+f,x?O+M:this.right,e.rtl),S(l.x(O),L,C),x)g.x+=M+d;else if(typeof C.text!="string"){const $=c.lineHeight;g.y+=gm(C,$)+d}else g.y+=k}),S0(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,r=Ut(n.font),s=pn(n.padding);if(!n.display)return;const o=fs(e.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,c=s.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=Ht(e.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+Ht(e.align,this.top,this.bottom-m-e.labels.padding-this._computeTitleHeight())}const g=Ht(a,u,u+f);i.textAlign=o.textAlign(Gc(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,po(i,n.text,g,d,r)}_computeTitleHeight(){const e=this.options.title,n=Ut(e.font),r=pn(e.padding);return e.display?n.lineHeight+r.height:0}_getLegendItemAt(e,n){let r,s,o;if(_r(e,this.left,this.right)&&_r(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>i.length?o:i)),e+n.size/2+r.measureText(s).width}function hT(t,e,n){let r=t;return typeof e.text!="string"&&(r=gm(e,n)),r}function gm(t,e){const n=t.text?t.text.length:0;return e*n}function gT(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var pm={id:"legend",_element:hm,start(t,e,n){const r=t.legend=new hm({ctx:t.ctx,options:n,chart:t});mn.configure(t,r,n),mn.addBox(t,r)},stop(t){mn.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const r=t.legend;mn.configure(t,r,n),r.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const r=e.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),e.hidden=!0):(s.show(r),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=pn(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class mm extends Ar{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const s=_t(r.text)?r.text.length:1;this._padding=pn(r.padding);const o=s*Ut(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,c,d,u;return this.isHorizontal()?(d=Ht(a,r,o),u=n+e,c=o-r):(i.position==="left"?(d=r+e,u=Ht(a,s,n),l=ct*-.5):(d=o-e,u=Ht(a,n,s),l=ct*.5),c=s-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const r=Ut(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);po(e,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:Gc(n.align),textBaseline:"middle",translation:[i,a]})}}function pT(t,e){const n=new mm({ctx:t.ctx,options:e,chart:t});mn.configure(t,n,e),mn.addBox(t,n),t.titleBlock=n}var mT={id:"title",_element:mm,start(t,e,n){pT(t,n)},stop(t){const e=t.titleBlock;mn.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const r=t.titleBlock;mn.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Eo={average(t){if(!t.length)return!1;let e,n,r=new Set,s=0,o=0;for(e=0,n=t.length;ea+l)/r.size,y:s/o}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=t.length;o-1?t.split(` -`):t}function gT(t,e){const{element:n,datasetIndex:r,index:s}=e,o=t.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:t,label:i,parsed:o.getParsed(s),raw:t.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function mm(t,e){const n=t.chart.ctx,{body:r,footer:s,title:o}=t,{boxWidth:i,boxHeight:a}=e,l=Ut(e.bodyFont),c=Ut(e.titleFont),d=Ut(e.footerFont),u=o.length,f=s.length,g=r.length,m=pn(e.padding);let p=m.height,y=0,b=r.reduce((E,k)=>E+k.before.length+k.lines.length+k.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){const E=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*E+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(p+=e.footerMarginTop+f*d.lineHeight+(f-1)*e.footerSpacing);let S=0;const x=function(E){y=Math.max(y,n.measureText(E).width+S)};return n.save(),n.font=c.string,at(t.title,x),n.font=l.string,at(t.beforeBody.concat(t.afterBody),x),S=e.displayColors?i+2+e.boxPadding:0,at(r,E=>{at(E.before,x),at(E.lines,x),at(E.after,x)}),S=0,n.font=d.string,at(t.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function pT(t,e){const{y:n,height:r}=e;return nt.height-r/2?"bottom":"center"}function mT(t,e,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(t==="left"&&s+o+i>e.width||t==="right"&&s-o-i<0)return!0}function bT(t,e,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=t;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),mT(c,t,e,n)&&(c="center"),c}function bm(t,e,n){const r=n.yAlign||e.yAlign||pT(t,n);return{xAlign:n.xAlign||e.xAlign||bT(t,e,n,r),yAlign:r}}function yT(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function vT(t,e,n){let{y:r,height:s}=t;return e==="top"?r+=n:e==="bottom"?r-=s+n:r-=s/2,r}function ym(t,e,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=t,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=cs(i);let m=yT(e,a);const p=vT(e,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:Jt(m,0,r.width-e.width),y:Jt(p,0,r.height-e.height)}}function ka(t,e,n){const r=pn(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function vm(t){return Vn([],Kn(t))}function xT(t,e,n){return ds(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function xm(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const wm={beforeTitle:Gn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex"u"?wm[e].call(n,r):s}class md extends Ar{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new _0(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=xT(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,s=Rt(r,"beforeTitle",this,e),o=Rt(r,"title",this,e),i=Rt(r,"afterTitle",this,e);let a=[];return a=Vn(a,Kn(s)),a=Vn(a,Kn(o)),a=Vn(a,Kn(i)),a}getBeforeBody(e,n){return vm(Rt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,s=[];return at(e,o=>{const i={before:[],lines:[],after:[]},a=xm(r,o);Vn(i.before,Kn(Rt(a,"beforeLabel",this,o))),Vn(i.lines,Rt(a,"label",this,o)),Vn(i.after,Kn(Rt(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(e,n){return vm(Rt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,s=Rt(r,"beforeFooter",this,e),o=Rt(r,"footer",this,e),i=Rt(r,"afterFooter",this,e);let a=[];return a=Vn(a,Kn(s)),a=Vn(a,Kn(o)),a=Vn(a,Kn(i)),a}_createItems(e){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;le.filter(d,u,f,r))),e.itemSort&&(a=a.sort((d,u)=>e.itemSort(d,u,r))),at(a,d=>{const u=xm(e.callbacks,d);s.push(Rt(u,"labelColor",this,d)),o.push(Rt(u,"labelPointStyle",this,d)),i.push(Rt(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Eo[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=mm(this,r),c=Object.assign({},a,l),d=bm(this.chart,r,c),u=ym(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,s){const o=this.getCaretPosition(e,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(e,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=cs(a),{x:f,y:g}=e,{width:m,height:p}=n;let y,b,S,x,E,k;return o==="center"?(E=g+p/2,s==="left"?(y=f,b=y-i,x=E+i,k=E-i):(y=f+m,b=y+i,x=E-i,k=E+i),S=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,E=x-i,y=b-i,S=b+i):(x=g+p,E=x+i,y=b+i,S=b-i),k=x),{x1:y,x2:b,x3:S,y1:x,y2:E,y3:k}}drawTitle(e,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=fs(r.rtl,this.x,this.width);for(e.x=ka(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Ut(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;lS!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,ia(e,{x:p,y:m,w:c,h:l,radius:b}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),ia(e,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(p,m,c,l),e.strokeRect(p,m,c,l),e.fillStyle=i.backgroundColor,e.fillRect(y,m+1,c-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Ut(r.bodyFont);let f=u.lineHeight,g=0;const m=fs(r.rtl,this.x,this.width),p=function(_){n.fillText(_,m.x(e.x+g),e.y+f/2),e.y+=f+o},y=m.textAlign(i);let b,S,x,E,k,C,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,e.x=ka(this,y,r),n.fillStyle=r.bodyColor,at(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,E=0,C=s.length;E0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Eo[e.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=mm(this,e),l=Object.assign({},i,this._size),c=bm(n,e,l),d=ym(e,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=pn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(o,e,s,n),k0(e,n.textDirection),o.y+=i.top,this.drawTitle(o,e,n),this.drawBody(o,e,n),this.drawFooter(o,e,n),C0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,s=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ri(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(e,o,n,r),a=this._positionChanged(i,e),l=n||!Ri(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,s){const o=this.options;if(e.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(e,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(e,n){const{caretX:r,caretY:s,options:o}=this,i=Eo[o.position].call(this,e,n);return i!==!1&&(r!==i.x||s!==i.y)}}Fe(md,"positioners",Eo);var km={id:"tooltip",_element:md,positioners:Eo,afterInit(t,e,n){n&&(t.tooltip=new md({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:wm},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const wT=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function kT(t,e,n,r){const s=t.indexOf(e);if(s===-1)return wT(t,e,n,r);const o=t.lastIndexOf(e);return s!==o?n:s}const CT=(t,e)=>t===null?null:Jt(Math.round(t),0,e);function Cm(t){const e=this.getLabels();return t>=0&&tn.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}Fe(bd,"id","category"),Fe(bd,"defaults",{ticks:{callback:Cm}});function ST(t,e){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=t,g=o||1,m=d-1,{min:p,max:y}=e,b=!lt(i),S=!lt(a),x=!lt(c),E=(y-p)/(u+1);let k=Kp((y-p)/m/g)*g,C,N,_,w;if(k<1e-14&&!b&&!S)return[{value:p},{value:y}];w=Math.ceil(y/k)-Math.floor(p/k),w>m&&(k=Kp(w*k/m/g)*g),lt(l)||(C=Math.pow(10,l),k=Math.ceil(k*C)/C),s==="ticks"?(N=Math.floor(p/k)*k,_=Math.ceil(y/k)*k):(N=p,_=y),b&&S&&o&&kM((a-i)/o,k/1e3)?(w=Math.round(Math.min((a-i)/k,d)),k=(a-i)/w,N=i,_=a):x?(N=b?i:N,_=S?a:_,w=c-1,k=(_-N)/w):(w=(_-N)/k,na(w,Math.round(w),k/1e3)?w=Math.round(w):w=Math.ceil(w));const M=Math.max(qp(k),qp(N));C=Math.pow(10,lt(l)?M:l),N=Math.round(N*C)/C,_=Math.round(_*C)/C;let O=0;for(b&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:L})}return S&&f&&_!==a?n.length&&na(n[n.length-1].value,a,Sm(a,E,t))?n[n.length-1].value=a:n.push({value:a}):(!S||_===a)&&n.push({value:_}),n}function Sm(t,e,{horizontal:n,minRotation:r}){const s=Yn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*e*(""+t).length;return Math.min(e/o,i)}class _T extends gs{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return lt(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(e){const l=lr(s),c=lr(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||i(s-l)}this.min=s,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=ST(s,o);return e.bounds==="ticks"&&CM(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const s=(r-n)/Math.max(e.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return Xc(e,this.chart.options.locale,this.options.ticks.format)}}class yd extends _T{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=gn(e)?e:0,this.max=gn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=Yn(this.options.ticks.minRotation),s=(e?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Fe(yd,"id","linear"),Fe(yd,"defaults",{ticks:{callback:a0.formatters.numeric}});const Ca={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},en=Object.keys(Ca);function _m(t,e){return t-e}function Em(t,e){if(lt(e))return null;const n=t._adapter,{parser:r,round:s,isoWeekday:o}=t._parseOpts;let i=e;return typeof r=="function"&&(i=r(i)),gn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(ra(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function Mm(t,e,n,r){const s=en.length;for(let o=en.indexOf(t);o=en.indexOf(n);o--){const i=en[o];if(Ca[i].common&&t._adapter.diff(s,r,i)>=e-1)return i}return en[n?en.indexOf(n):0]}function MT(t){for(let e=en.indexOf(t)+1,n=en.length;e=e?n[r]:n[s];t[o]=!0}}function NT(t,e,n,r){const s=t._adapter,o=+s.startOf(e[0].value,r),i=e[e.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function Om(t,e,n){const r=[],s={},o=e.length;let i,a;for(i=0;i+e.value))}initOffsets(e=[]){let n=0,r=0,s,o;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?n=1-s:n=(this.getDecimalForValue(e[1])-s)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?r=o:r=(o-this.getDecimalForValue(e[e.length-2]))/2);const i=e.length<3?.5:.25;n=Jt(n,0,i),r=Jt(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||Mm(o.minUnit,n,r,this._getLabelCapacity(n)),a=Je(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=ra(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,c?"day":i),e.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+p)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(e,i)}_tickFormatFunction(e,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return ht(i,[e,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(e,s||(g?u:d))}generateTickLabels(e){let n,r,s;for(n=0,r=e.length;n0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=t[r].pos&&e<=t[s].pos&&({lo:r,hi:s}=Wc(t,"pos",e)),{pos:o,time:a}=t[r],{pos:i,time:l}=t[s]):(e>=t[r].time&&e<=t[s].time&&({lo:r,hi:s}=Wc(t,"time",e)),{time:o,pos:a}=t[r],{time:i,pos:l}=t[s]);const c=i-o;return c?a+(l-a)*(e-o)/c:a}class Tm extends Sa{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=_a(n,this.min),this._tableRange=_a(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=e.length;i=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(_a(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return _a(this._table,r*this._tableRange+this._minPos,!0)}}Fe(Tm,"id","timeseries"),Fe(Tm,"defaults",Sa.defaults);const Am="label";function Dm(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function OT(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Im(t,e){t.labels=e}function Lm(t,e,n=Am){const r=[];t.datasets=e.map(s=>{const o=t.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function TT(t,e=Am){const n={labels:[],datasets:[]};return Im(n,t.labels),Lm(n,t.datasets,e),n}function AT(t,e){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=t,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new So(g.current,{type:i,data:TT(a,o),options:l&&{...l},plugins:c}),Dm(e,m.current))},y=()=>{Dm(e,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&OT(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&Im(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&Lm(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const DT=v.forwardRef(AT);function Pm(t,e){return So.register(e),v.forwardRef((n,r)=>h.jsx(DT,{...n,ref:r,type:t}))}const IT=Pm("bar",ua),LT=Pm("doughnut",bo);So.register(bd,yd,wa,hT,km,gm);const PT=({labels:t,datasets:e,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:t??[],datasets:(e??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[t,e]),u=v.useMemo(()=>(e??[]).some(m=>m.yAxisID==="y1"),[e]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx(IT,{data:d,options:f})})},$T=v.memo(PT,(t,e)=>JSON.stringify(t.labels)===JSON.stringify(e.labels)&&JSON.stringify(t.datasets)===JSON.stringify(e.datasets)&&t.height===e.height&&t.showLegend===e.showLegend&&t.showGrid===e.showGrid&&t.showYGrid===e.showYGrid&&t.showYAxis===e.showYAxis&&t.className===e.className&&t.id===e.id&&t.editorAttrs===e.editorAttrs);So.register(_o,km,gm);const FT=({data:t,centerLabel:e,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(t??[]).map(f=>f.name),datasets:[{data:(t??[]).map(f=>f.value),backgroundColor:(t??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[t]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(LT,{data:c,options:d}),(e||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:e}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},zT=({id:t,className:e,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:t,className:e,style:n,...s,children:r}),VT=({children:t,cols:e=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(e&&m.push(`grid-cols-${e}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={row:"grid-flow-row",col:"grid-flow-col",dense:"grid-flow-dense","row-dense":"grid-flow-row-dense","col-dense":"grid-flow-col-dense"};return m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:t})},HT=({children:t,direction:e="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[e]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:t})},UT=({title:t,subtitle:e,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={none:"",white:"bg-white dark:bg-gray-700",gray:"bg-gray-50 dark:bg-gray-800",primary:"bg-blue-50 dark:bg-blue-900/20",secondary:"bg-gray-50 dark:bg-gray-800"};if(s!=="none"&&p.push(b[s]),o){const x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl","4xl":"max-w-4xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const S={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(S[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(Nd,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(t||e)&&h.jsxs("div",{className:"mb-4",children:[t&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),e&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:e})]}),n]})},BT=({leftWidth:t="250px",rightWidth:e="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:t,flexShrink:0},u={flex:1,minWidth:0},f={width:e,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},jT={language:"json",theme:"vs-dark",options:{automaticLayout:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,tabSize:2,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",folding:!0,lineNumbers:"on",renderWhitespace:"selection"}},$m=[{uri:`${window.location.origin}/schemas/layout.json`,fileMatch:["*layout*.json"],schema:{type:"object",properties:{version:{type:"string"},endpoint:{type:"string"},components:{type:"array"}},required:["version","endpoint","components"]}}],WT={"vs/nls":{availableLanguages:{"*":"ko"}}};function GT(t){t.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:$m,enableSchemaRequest:!0,schemaValidation:"error",schemaRequest:"error"})}const YT={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.4",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.0",dependencies:{modules:{},plugins:{}},assets:{css:["assets/css/main.css","assets/css/ui-system.css"],js:["dist/components.js"],fonts:["assets/fonts/"],images:["assets/images/"]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],layout:["container","flex","grid","section"]},preview:{thumbnail:"preview/thumbnail.png",screenshots:["preview/screenshot1.png","preview/screenshot2.png"]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",url:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",preconnect:"https://cdnjs.cloudflare.com"},{id:"pretendard",type:"webfont",url:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css",preconnect:"https://cdn.jsdelivr.net",crossorigin:"anonymous"},{id:"flag-icons",type:"style",url:"https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/css/flag-icons.min.css"}]},qn=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...t)=>console.log("[Handler:SetTheme]",...t),warn:(...t)=>console.warn("[Handler:SetTheme]",...t),error:(...t)=>console.error("[Handler:SetTheme]",...t)},vd=["auto","light","dark"],Fm="g7_color_scheme",XT=t=>t==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,Ea=t=>{const e=XT(t);document.documentElement.setAttribute("data-theme",e),e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function KT(){try{const t=localStorage.getItem(Fm),e=t&&vd.includes(t)?t:"auto";Ea(e);try{window.G7Core?.state?.setGlobal?.({theme:e})}catch(n){qn.warn("Failed to set global theme state:",n)}qn.log("Initial theme applied:",e)}catch(t){qn.warn("Failed to load initial theme:",t),Ea("auto")}}async function qT(t,e){const n=t?.target;if(n&&typeof n=="string"&&vd.includes(n)){Ea(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){qn.warn("Failed to set global theme state:",r)}return}KT()}async function ZT(t,e){let n;if(t?.target&&typeof t.target=="string"&&!t.target.includes("{{")&&(n=t.target),!n||typeof n!="string"){qn.warn("Invalid theme:",n);return}if(!vd.includes(n)){qn.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(Fm,r)}catch(s){qn.error("Failed to save theme to localStorage:",s);return}Ea(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){qn.warn("Failed to set global theme state:",s)}qn.log("Theme changed to:",r)}const Mo=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...t)=>console.log("[Handler:InitMenu]",...t),warn:(...t)=>console.warn("[Handler:InitMenu]",...t),error:(...t)=>console.error("[Handler:InitMenu]",...t)};function zm(t,e){for(const n of t){if(n.slug===e)return n;if(n.children&&n.children.length>0){const r=zm(n.children,e);if(r)return r}}return null}function Vm(t){return new URLSearchParams(window.location.search).get(t)}function QT(t){return window.G7Core?.state?.getDataSource?.(t)}async function JT(t,e=30,n=100){for(let r=0;r0)return o;await new Promise(i=>setTimeout(i,n))}return null}async function RT(t,e){const n=window.G7Core,r=Vm("menu"),s=Vm("mode");if(!r){Mo.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){Mo.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await JT("menus");if(!o){Mo.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=zm(o,r);if(!i){Mo.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=s==="edit"?"edit":"view";n.state.set({selectedMenuId:i.id,selectedMenu:i,panelMode:a}),a==="edit"&&n.state.set({formData:{name:i.name,slug:i.slug,url:i.url,icon:i.icon,parent_id:i.parent_id,module_id:i.module_id,is_active:i.is_active}}),Mo.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:a,menuId:i.id})}const Xt=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...t)=>console.log("[Handler:FilterVisibility]",...t),warn:(...t)=>console.warn("[Handler:FilterVisibility]",...t),error:(...t)=>console.error("[Handler:FilterVisibility]",...t)},Ma="g7_filter_visibility_";async function e5(t,e){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=t?.params||{};if(!n){Xt.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ma}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,Xt.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,Xt.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,Xt.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);e?.setState&&e.setState({[s]:a})}catch(i){Xt.error("[initFilterVisibility] Failed to load filter visibility:",i),e?.setState&&e.setState({[s]:r})}}async function t5(t,e){const{storageKey:n,filters:r}=t?.params||{};if(!n){Xt.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){Xt.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ma}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),Xt.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){Xt.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function n5(t,e){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=t?.params||{};if(!n||!r){Xt.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=e?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],e?.setState&&e.setState({[s]:i});const a=`${Ma}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),Xt.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){Xt.error("[toggleFilterVisibility] Failed to save:",l)}}async function r5(t,e){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=t?.params||{};if(!n){Xt.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ma}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),e?.setState&&e.setState({[s]:r}),Xt.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){Xt.error("[resetFilterVisibility] Failed to reset:",i)}}const ms=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...t)=>console.log("[Handler:MultilingualTag]",...t),warn:(...t)=>console.warn("[Handler:MultilingualTag]",...t),error:(...t)=>console.error("[Handler:MultilingualTag]",...t)};async function s5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){ms.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){ms.warn("No values to save"),n.modal?.close?.(),xd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),xd(n)}async function o5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}n.modal?.close?.(),xd(n)}async function i5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}const r=t?.params?.locale;if(!r){ms.warn("No locale specified");return}const s=e?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function xd(t){t.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function Hm(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return`${e}-${n}-${r}T${s}:${o}:${i}`}function a5(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59),r=Hm(n),s=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);switch(t){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:Hm(s),endDate:r}}function l5(t){const{preset:e}=t.params||{preset:"today"},{startDate:n,endDate:r}=a5(e);return{startDate:n,endDate:r,preset:e}}const No=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...t)=>console.log("[Handler:Sidebar]",...t),warn:(...t)=>console.warn("[Handler:Sidebar]",...t),error:(...t)=>console.error("[Handler:Sidebar]",...t)},Um="g7_admin_sidebar_collapsed";function Bm(){try{return localStorage.getItem(Um)==="1"}catch{return!1}}function c5(t){try{localStorage.setItem(Um,t?"1":"0")}catch(e){No.error("Failed to save sidebar state to localStorage:",e)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:t})}catch(e){No.warn("Failed to set global sidebar state:",e)}}function jm(){const t=Bm();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:t})}catch(e){No.warn("Failed to restore sidebar state:",e)}No.log("Initial sidebar collapsed state restored:",t)}async function d5(t,e){jm()}async function u5(t,e){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return Bm()}})();c5(r),No.log("Sidebar collapsed toggled to:",r)}const wd=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...t)=>console.log("[Handler:DownloadAttachment]",...t),warn:(...t)=>console.warn("[Handler:DownloadAttachment]",...t),error:(...t)=>console.error("[Handler:DownloadAttachment]",...t)};async function f5(t,e){const n=window.G7Core,{url:r,filename:s}=t?.params||{};if(!r){wd.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){wd.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){wd.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const Na={setTheme:ZT,initTheme:qT,scrollToSection:Rd,initMenuFromUrl:RT,initFilterVisibility:e5,saveFilterVisibility:t5,toggleFilterVisibility:n5,resetFilterVisibility:r5,saveMultilingualTag:s5,cancelMultilingualTag:o5,updateMultilingualTagValue:i5,setDateRange:l5,toggleSidebar:u5,initSidebar:d5,downloadAttachment:f5},Oo=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...t),error:(...t)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...t)};function h5(){const e=window.G7Core?.api?.getToken?.()??null;return e?{Authorization:`Bearer ${e}`}:{}}function g5(){try{const t=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return t?{"Accept-Language":t}:{}}catch{return{}}}async function p5(t,e=null){const n={purpose:t.purpose};t.provider_id&&(n.provider_id=t.provider_id),e&&(n.target=e);const r=t.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...g5(),...h5()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??t.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function m5(t){const e=window.G7Core,n=e?.identity;if(!e?.dispatch||!e?.state||!n)return Oo.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(t.render_hint==="external_redirect"||t.redirect_url)return n.redirectExternally(t);const r=t.target&&(t.target.email||t.target.phone)?t.target:null;let s;try{s=await p5(t,r)}catch(m){Oo.error("Challenge 시작 실패:",m);try{await e.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...t,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;e.state.set({identityChallenge:{policy_key:t.policy_key,purpose:t.purpose,provider_id:t.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),e.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=e.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await e.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Oo.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...t,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function b5(){const t=window.G7Core?.identity;if(!t?.setLauncher){Oo.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}t.setLauncher(m5),Oo.log("IDV launcher registered (sirsoft-admin_basic)")}function y5(t){const e=t.icons;return Array.isArray(e)?e.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function v5(t,e){const n=t.label;return typeof n=="string"?n.startsWith("$t:")?e(n.slice(3)):n:t.value}function x5(t,e,n){if(n==="")return!0;const r=n.toLowerCase();return t.value.toLowerCase().includes(r)||e.toLowerCase().includes(r)?!0:(t.keywords??[]).some(s=>s.toLowerCase().includes(r))}function w5({entry:t}){const e=t.preview;return e?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:e.html},style:Cd}):e?.className?h.jsx("span",{className:`g7le-icon-preview ${e.className}`,style:Cd}):h.jsx("i",{className:`fas fa-${t.value}`,style:Cd,"aria-hidden":"true"})}function k5({control:t,value:e,onChange:n,t:r}){const s=y5(t),o=e==null?"":String(e),i=typeof t.iconColumns=="number"?t.iconColumns:6,a=t.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Wm,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Gm})});const u=g=>v5(g,r),f=s.filter(g=>x5(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Wm,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Gm}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...C5,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?Ym:kd,children:h.jsx("span",{style:S5,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?Ym:kd,children:h.jsx(w5,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:_5,children:r("layout_editor.icon_picker.no_results")})]})}const Wm={display:"flex",flexDirection:"column",gap:6,width:"100%"},Gm={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},C5={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},kd={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Ym={...kd,border:"2px solid #2563eb",background:"#eff6ff"},Cd={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},S5={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},_5={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Xm=130,Mn=20;function E5(t){const e=t?.arrayProp;return typeof e=="string"&&e?e:"tabs"}function M5(t){let e=0;for(const n of t){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>e&&(e=r)}return e+1}function N5({node:t,params:e,cellBoxes:n,t:r,onPatchNode:s}){const o=E5(e),i=v.useMemo(()=>{const g=(t.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[t,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=t.props??{};s({...t,props:{...m,[o]:g}})},[t,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:M5(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:Mn,height:Mn,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:Xm};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Xm},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-Mn/2,top:p.top-Mn/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-Mn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-Mn,top:p.top+p.height/2-Mn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-Mn/2,top:p.top+p.height/2-Mn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const Sd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...t)};function O5(){if(typeof window>"u")return;const t=window.G7Core?.layoutEditor;if(!t?.registerWidget){Sd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}t.registerWidget("icon-picker",k5),Sd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),t.registerCanvasOverlay&&(t.registerCanvasOverlay("tabnav",N5),Sd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const _d=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic]",...t),error:(...t)=>console.error("[Template:sirsoft-admin_basic]",...t)};typeof window<"u"&&(window.G7TemplateHandlers=Na);function Km(){if(typeof window<"u"){let t=0;const e=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Na).forEach(([s,o])=>{r.registerHandler(s,o)}),_d.log(`${Object.keys(Na).length} custom handler(s) registered:`,Object.keys(Na)),b5(),jm()):(t++,t<=e?(_d.warn(`ActionDispatcher not found, retrying... (${t}/${e})`),setTimeout(n,100)):_d.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return O5(),Km(),R.A=Lr,R.Accordion=rc,R.ActionMenu=bs,R.AdminFooter=ky,R.AdminHeader=yy,R.AdminSidebar=by,R.Alert=lu,R.AlertDialog=ly,R.Badge=Ld,R.BarChart=$T,R.Breadcrumb=su,R.Button=oe,R.Card=fb,R.CardGrid=Gb,R.CategoryTree=HS,R.Checkbox=vn,R.ChipCheckbox=EE,R.Code=lb,R.CodeEditor=zv,R.ColumnSelector=Gv,R.ConfirmDialog=nu,R.Container=zT,R.DataGrid=Hb,R.Dialog=tu,R.Div=I,R.DonutChart=FT,R.Dropdown=Xb,R.DropdownButton=ME,R.DropdownMenuItem=NE,R.DynamicFieldList=zE,R.EmptyState=gy,R.ExtensionBadge=th,R.FileInput=Ed,R.FileUploader=_p,R.FilterGroup=Qb,R.FilterVisibilitySelector=xE,R.Flex=HT,R.Form=La,R.FormField=jE,R.Fragment=db,R.Grid=VT,R.H1=Aa,R.H2=Qn,R.H3=Ir,R.H4=Md,R.Hr=ub,R.HtmlContent=qa,R.HtmlEditor=mE,R.I=pt,R.Icon=re,R.IconButton=oy,R.IconName=de,R.IconSelect=LS,R.ImageGallery=Bi,R.Img=yn,R.Input=wt,R.Label=rn,R.LanguageSelector=wy,R.LayoutEditorHeader=My,R.LayoutFileList=Ny,R.LayoutHistoryPanel=Hv,R.LayoutWarnings=vE,R.Li=Ia,R.LoadingSpinner=my,R.LoginForm=Uv,R.Modal=Uo,R.MultilingualInput=Va,R.MultilingualLocaleContext=Pc,R.MultilingualTabPanel=BE,R.MultilingualTagInput=Bk,R.Nav=Lo,R.NotificationCenter=vy,R.Ol=tb,R.Optgroup=ob,R.Option=sb,R.P=bt,R.PageHeader=Cy,R.PageLoading=qv,R.PageTransitionIndicator=Xv,R.Pagination=Po,R.PermissionTree=zS,R.Pre=cb,R.ProductCard=Kb,R.RadioGroup=hE,R.RichSelect=SE,R.SearchBar=Zb,R.SearchableDropdown=jk,R.Section=Nd,R.SectionHeader=_y,R.SectionLayout=UT,R.Select=Pr,R.SlotContainer=CE,R.SortableMenuItem=Wh,R.SortableMenuList=DS,R.Span=Q,R.StatCard=qb,R.StatusBadge=$o,R.Svg=Hn,R.TabNavigation=Jb,R.TabNavigationScroll=ry,R.Table=Pa,R.TagInput=Vk,R.TagSelect=Wk,R.Tbody=Fa,R.Td=Kt,R.TemplateCard=Ey,R.Textarea=Zn,R.Tfoot=za,R.Th=$r,R.Thead=$a,R.ThemeToggle=jv,R.ThreeColumnLayout=BT,R.Toast=fy,R.Toggle=Ha,R.Tr=Jn,R.Ul=Da,R.UnifiedIcon=ab,R.UserProfile=xy,R.VersionList=Su,R.configureJSONLanguageService=GT,R.defaultJSONSchemas=$m,R.executeImageDownload=Tc,R.initTemplate=Km,R.jsonEditorDefaults=jT,R.monacoInitOptions=WT,R.templateMetadata=YT,R.useCurrentMultilingualLocale=Dp,R.useImageGallery=up,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM); +`):t}function bT(t,e){const{element:n,datasetIndex:r,index:s}=e,o=t.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:t,label:i,parsed:o.getParsed(s),raw:t.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function bm(t,e){const n=t.chart.ctx,{body:r,footer:s,title:o}=t,{boxWidth:i,boxHeight:a}=e,l=Ut(e.bodyFont),c=Ut(e.titleFont),d=Ut(e.footerFont),u=o.length,f=s.length,g=r.length,m=pn(e.padding);let p=m.height,y=0,b=r.reduce((E,k)=>E+k.before.length+k.lines.length+k.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){const E=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*E+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(p+=e.footerMarginTop+f*d.lineHeight+(f-1)*e.footerSpacing);let S=0;const x=function(E){y=Math.max(y,n.measureText(E).width+S)};return n.save(),n.font=c.string,at(t.title,x),n.font=l.string,at(t.beforeBody.concat(t.afterBody),x),S=e.displayColors?i+2+e.boxPadding:0,at(r,E=>{at(E.before,x),at(E.lines,x),at(E.after,x)}),S=0,n.font=d.string,at(t.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function yT(t,e){const{y:n,height:r}=e;return nt.height-r/2?"bottom":"center"}function vT(t,e,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(t==="left"&&s+o+i>e.width||t==="right"&&s-o-i<0)return!0}function xT(t,e,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=t;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),vT(c,t,e,n)&&(c="center"),c}function ym(t,e,n){const r=n.yAlign||e.yAlign||yT(t,n);return{xAlign:n.xAlign||e.xAlign||xT(t,e,n,r),yAlign:r}}function wT(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function kT(t,e,n){let{y:r,height:s}=t;return e==="top"?r+=n:e==="bottom"?r-=s+n:r-=s/2,r}function vm(t,e,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=t,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=cs(i);let m=wT(e,a);const p=kT(e,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:Jt(m,0,r.width-e.width),y:Jt(p,0,r.height-e.height)}}function ka(t,e,n){const r=pn(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function xm(t){return Vn([],Kn(t))}function CT(t,e,n){return ds(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function wm(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const km={beforeTitle:Gn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex"u"?km[e].call(n,r):s}class md extends Ar{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new E0(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=CT(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,s=Rt(r,"beforeTitle",this,e),o=Rt(r,"title",this,e),i=Rt(r,"afterTitle",this,e);let a=[];return a=Vn(a,Kn(s)),a=Vn(a,Kn(o)),a=Vn(a,Kn(i)),a}getBeforeBody(e,n){return xm(Rt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,s=[];return at(e,o=>{const i={before:[],lines:[],after:[]},a=wm(r,o);Vn(i.before,Kn(Rt(a,"beforeLabel",this,o))),Vn(i.lines,Rt(a,"label",this,o)),Vn(i.after,Kn(Rt(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(e,n){return xm(Rt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,s=Rt(r,"beforeFooter",this,e),o=Rt(r,"footer",this,e),i=Rt(r,"afterFooter",this,e);let a=[];return a=Vn(a,Kn(s)),a=Vn(a,Kn(o)),a=Vn(a,Kn(i)),a}_createItems(e){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;le.filter(d,u,f,r))),e.itemSort&&(a=a.sort((d,u)=>e.itemSort(d,u,r))),at(a,d=>{const u=wm(e.callbacks,d);s.push(Rt(u,"labelColor",this,d)),o.push(Rt(u,"labelPointStyle",this,d)),i.push(Rt(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Eo[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=bm(this,r),c=Object.assign({},a,l),d=ym(this.chart,r,c),u=vm(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,s){const o=this.getCaretPosition(e,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(e,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=cs(a),{x:f,y:g}=e,{width:m,height:p}=n;let y,b,S,x,E,k;return o==="center"?(E=g+p/2,s==="left"?(y=f,b=y-i,x=E+i,k=E-i):(y=f+m,b=y+i,x=E-i,k=E+i),S=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,E=x-i,y=b-i,S=b+i):(x=g+p,E=x+i,y=b+i,S=b-i),k=x),{x1:y,x2:b,x3:S,y1:x,y2:E,y3:k}}drawTitle(e,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=fs(r.rtl,this.x,this.width);for(e.x=ka(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Ut(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;lS!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,ia(e,{x:p,y:m,w:c,h:l,radius:b}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),ia(e,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(p,m,c,l),e.strokeRect(p,m,c,l),e.fillStyle=i.backgroundColor,e.fillRect(y,m+1,c-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Ut(r.bodyFont);let f=u.lineHeight,g=0;const m=fs(r.rtl,this.x,this.width),p=function(_){n.fillText(_,m.x(e.x+g),e.y+f/2),e.y+=f+o},y=m.textAlign(i);let b,S,x,E,k,C,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,e.x=ka(this,y,r),n.fillStyle=r.bodyColor,at(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,E=0,C=s.length;E0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Eo[e.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=bm(this,e),l=Object.assign({},i,this._size),c=ym(n,e,l),d=vm(e,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=pn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(o,e,s,n),C0(e,n.textDirection),o.y+=i.top,this.drawTitle(o,e,n),this.drawBody(o,e,n),this.drawFooter(o,e,n),S0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,s=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ri(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(e,o,n,r),a=this._positionChanged(i,e),l=n||!Ri(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,s){const o=this.options;if(e.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(e,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(e,n){const{caretX:r,caretY:s,options:o}=this,i=Eo[o.position].call(this,e,n);return i!==!1&&(r!==i.x||s!==i.y)}}Fe(md,"positioners",Eo);var Cm={id:"tooltip",_element:md,positioners:Eo,afterInit(t,e,n){n&&(t.tooltip=new md({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:km},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const ST=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function _T(t,e,n,r){const s=t.indexOf(e);if(s===-1)return ST(t,e,n,r);const o=t.lastIndexOf(e);return s!==o?n:s}const ET=(t,e)=>t===null?null:Jt(Math.round(t),0,e);function Sm(t){const e=this.getLabels();return t>=0&&tn.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}Fe(bd,"id","category"),Fe(bd,"defaults",{ticks:{callback:Sm}});function MT(t,e){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=t,g=o||1,m=d-1,{min:p,max:y}=e,b=!lt(i),S=!lt(a),x=!lt(c),E=(y-p)/(u+1);let k=qp((y-p)/m/g)*g,C,N,_,w;if(k<1e-14&&!b&&!S)return[{value:p},{value:y}];w=Math.ceil(y/k)-Math.floor(p/k),w>m&&(k=qp(w*k/m/g)*g),lt(l)||(C=Math.pow(10,l),k=Math.ceil(k*C)/C),s==="ticks"?(N=Math.floor(p/k)*k,_=Math.ceil(y/k)*k):(N=p,_=y),b&&S&&o&&_M((a-i)/o,k/1e3)?(w=Math.round(Math.min((a-i)/k,d)),k=(a-i)/w,N=i,_=a):x?(N=b?i:N,_=S?a:_,w=c-1,k=(_-N)/w):(w=(_-N)/k,na(w,Math.round(w),k/1e3)?w=Math.round(w):w=Math.ceil(w));const M=Math.max(Zp(k),Zp(N));C=Math.pow(10,lt(l)?M:l),N=Math.round(N*C)/C,_=Math.round(_*C)/C;let O=0;for(b&&(f&&N!==i?(n.push({value:i}),Na)break;n.push({value:L})}return S&&f&&_!==a?n.length&&na(n[n.length-1].value,a,_m(a,E,t))?n[n.length-1].value=a:n.push({value:a}):(!S||_===a)&&n.push({value:_}),n}function _m(t,e,{horizontal:n,minRotation:r}){const s=Yn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*e*(""+t).length;return Math.min(e/o,i)}class NT extends gs{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return lt(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(e){const l=lr(s),c=lr(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||i(s-l)}this.min=s,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=MT(s,o);return e.bounds==="ticks"&&EM(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const s=(r-n)/Math.max(e.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return Xc(e,this.chart.options.locale,this.options.ticks.format)}}class yd extends NT{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=gn(e)?e:0,this.max=gn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=Yn(this.options.ticks.minRotation),s=(e?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Fe(yd,"id","linear"),Fe(yd,"defaults",{ticks:{callback:l0.formatters.numeric}});const Ca={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},en=Object.keys(Ca);function Em(t,e){return t-e}function Mm(t,e){if(lt(e))return null;const n=t._adapter,{parser:r,round:s,isoWeekday:o}=t._parseOpts;let i=e;return typeof r=="function"&&(i=r(i)),gn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(ra(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function Nm(t,e,n,r){const s=en.length;for(let o=en.indexOf(t);o=en.indexOf(n);o--){const i=en[o];if(Ca[i].common&&t._adapter.diff(s,r,i)>=e-1)return i}return en[n?en.indexOf(n):0]}function TT(t){for(let e=en.indexOf(t)+1,n=en.length;e=e?n[r]:n[s];t[o]=!0}}function AT(t,e,n,r){const s=t._adapter,o=+s.startOf(e[0].value,r),i=e[e.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function Tm(t,e,n){const r=[],s={},o=e.length;let i,a;for(i=0;i+e.value))}initOffsets(e=[]){let n=0,r=0,s,o;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?n=1-s:n=(this.getDecimalForValue(e[1])-s)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?r=o:r=(o-this.getDecimalForValue(e[e.length-2]))/2);const i=e.length<3?.5:.25;n=Jt(n,0,i),r=Jt(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||Nm(o.minUnit,n,r,this._getLabelCapacity(n)),a=Je(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=ra(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,c?"day":i),e.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f+p)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(e,i)}_tickFormatFunction(e,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return ht(i,[e,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(e,s||(g?u:d))}generateTickLabels(e){let n,r,s;for(n=0,r=e.length;n0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n=t[r].pos&&e<=t[s].pos&&({lo:r,hi:s}=Wc(t,"pos",e)),{pos:o,time:a}=t[r],{pos:i,time:l}=t[s]):(e>=t[r].time&&e<=t[s].time&&({lo:r,hi:s}=Wc(t,"time",e)),{time:o,pos:a}=t[r],{time:i,pos:l}=t[s]);const c=i-o;return c?a+(l-a)*(e-o)/c:a}class Am extends Sa{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=_a(n,this.min),this._tableRange=_a(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=e.length;i=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;is-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(_a(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return _a(this._table,r*this._tableRange+this._minPos,!0)}}Fe(Am,"id","timeseries"),Fe(Am,"defaults",Sa.defaults);const Dm="label";function Im(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function DT(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Lm(t,e){t.labels=e}function Pm(t,e,n=Dm){const r=[];t.datasets=e.map(s=>{const o=t.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function IT(t,e=Dm){const n={labels:[],datasets:[]};return Lm(n,t.labels),Pm(n,t.datasets,e),n}function LT(t,e){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=t,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new So(g.current,{type:i,data:IT(a,o),options:l&&{...l},plugins:c}),Im(e,m.current))},y=()=>{Im(e,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&DT(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&Lm(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&Pm(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const PT=v.forwardRef(LT);function $m(t,e){return So.register(e),v.forwardRef((n,r)=>h.jsx(PT,{...n,ref:r,type:t}))}const $T=$m("bar",ua),FT=$m("doughnut",bo);So.register(bd,yd,wa,mT,Cm,pm);const zT=({labels:t,datasets:e,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:t??[],datasets:(e??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[t,e]),u=v.useMemo(()=>(e??[]).some(m=>m.yAxisID==="y1"),[e]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx($T,{data:d,options:f})})},VT=v.memo(zT,(t,e)=>JSON.stringify(t.labels)===JSON.stringify(e.labels)&&JSON.stringify(t.datasets)===JSON.stringify(e.datasets)&&t.height===e.height&&t.showLegend===e.showLegend&&t.showGrid===e.showGrid&&t.showYGrid===e.showYGrid&&t.showYAxis===e.showYAxis&&t.className===e.className&&t.id===e.id&&t.editorAttrs===e.editorAttrs);So.register(_o,Cm,pm);const HT=({data:t,centerLabel:e,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(t??[]).map(f=>f.name),datasets:[{data:(t??[]).map(f=>f.value),backgroundColor:(t??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[t]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(FT,{data:c,options:d}),(e||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:e}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},UT=({id:t,className:e,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:t,className:e,style:n,...s,children:r}),BT=({children:t,cols:e=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(e&&m.push(`grid-cols-${e}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={row:"grid-flow-row",col:"grid-flow-col",dense:"grid-flow-dense","row-dense":"grid-flow-row-dense","col-dense":"grid-flow-col-dense"};return m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:t})},jT=({children:t,direction:e="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[e]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:t})},WT=({title:t,subtitle:e,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={none:"",white:"bg-white dark:bg-gray-700",gray:"bg-gray-50 dark:bg-gray-800",primary:"bg-blue-50 dark:bg-blue-900/20",secondary:"bg-gray-50 dark:bg-gray-800"};if(s!=="none"&&p.push(b[s]),o){const x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl","4xl":"max-w-4xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const S={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(S[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(Od,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(t||e)&&h.jsxs("div",{className:"mb-4",children:[t&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),e&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:e})]}),n]})},GT=({leftWidth:t="250px",rightWidth:e="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:t,flexShrink:0},u={flex:1,minWidth:0},f={width:e,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},YT={language:"json",theme:"vs-dark",options:{automaticLayout:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,tabSize:2,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",folding:!0,lineNumbers:"on",renderWhitespace:"selection"}},Fm=[{uri:`${window.location.origin}/schemas/layout.json`,fileMatch:["*layout*.json"],schema:{type:"object",properties:{version:{type:"string"},endpoint:{type:"string"},components:{type:"array"}},required:["version","endpoint","components"]}}],XT={"vs/nls":{availableLanguages:{"*":"ko"}}};function KT(t){t.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:Fm,enableSchemaRequest:!0,schemaValidation:"error",schemaRequest:"error"})}const qT={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.4",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.0",dependencies:{modules:{},plugins:{}},assets:{css:["assets/css/main.css","assets/css/ui-system.css"],js:["dist/components.js"],fonts:["assets/fonts/"],images:["assets/images/"]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],layout:["container","flex","grid","section"]},preview:{thumbnail:"preview/thumbnail.png",screenshots:["preview/screenshot1.png","preview/screenshot2.png"]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",url:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",preconnect:"https://cdnjs.cloudflare.com"},{id:"pretendard",type:"webfont",url:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css",preconnect:"https://cdn.jsdelivr.net",crossorigin:"anonymous"},{id:"flag-icons",type:"style",url:"https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/css/flag-icons.min.css"}]},qn=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...t)=>console.log("[Handler:SetTheme]",...t),warn:(...t)=>console.warn("[Handler:SetTheme]",...t),error:(...t)=>console.error("[Handler:SetTheme]",...t)},vd=["auto","light","dark"],zm="g7_color_scheme",ZT=t=>t==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,Ea=t=>{const e=ZT(t);document.documentElement.setAttribute("data-theme",e),e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function QT(){try{const t=localStorage.getItem(zm),e=t&&vd.includes(t)?t:"auto";Ea(e);try{window.G7Core?.state?.setGlobal?.({theme:e})}catch(n){qn.warn("Failed to set global theme state:",n)}qn.log("Initial theme applied:",e)}catch(t){qn.warn("Failed to load initial theme:",t),Ea("auto")}}async function JT(t,e){const n=t?.target;if(n&&typeof n=="string"&&vd.includes(n)){Ea(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){qn.warn("Failed to set global theme state:",r)}return}QT()}async function RT(t,e){let n;if(t?.target&&typeof t.target=="string"&&!t.target.includes("{{")&&(n=t.target),!n||typeof n!="string"){qn.warn("Invalid theme:",n);return}if(!vd.includes(n)){qn.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(zm,r)}catch(s){qn.error("Failed to save theme to localStorage:",s);return}Ea(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){qn.warn("Failed to set global theme state:",s)}qn.log("Theme changed to:",r)}const Mo=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...t)=>console.log("[Handler:InitMenu]",...t),warn:(...t)=>console.warn("[Handler:InitMenu]",...t),error:(...t)=>console.error("[Handler:InitMenu]",...t)};function Vm(t,e){for(const n of t){if(n.slug===e)return n;if(n.children&&n.children.length>0){const r=Vm(n.children,e);if(r)return r}}return null}function Hm(t){return new URLSearchParams(window.location.search).get(t)}function e5(t){return window.G7Core?.state?.getDataSource?.(t)}async function t5(t,e=30,n=100){for(let r=0;r0)return o;await new Promise(i=>setTimeout(i,n))}return null}async function n5(t,e){const n=window.G7Core,r=Hm("menu"),s=Hm("mode");if(!r){Mo.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){Mo.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await t5("menus");if(!o){Mo.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=Vm(o,r);if(!i){Mo.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=s==="edit"?"edit":"view";n.state.set({selectedMenuId:i.id,selectedMenu:i,panelMode:a}),a==="edit"&&n.state.set({formData:{name:i.name,slug:i.slug,url:i.url,icon:i.icon,parent_id:i.parent_id,module_id:i.module_id,is_active:i.is_active}}),Mo.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:a,menuId:i.id})}const Xt=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...t)=>console.log("[Handler:FilterVisibility]",...t),warn:(...t)=>console.warn("[Handler:FilterVisibility]",...t),error:(...t)=>console.error("[Handler:FilterVisibility]",...t)},Ma="g7_filter_visibility_";async function r5(t,e){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=t?.params||{};if(!n){Xt.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ma}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,Xt.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,Xt.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,Xt.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);e?.setState&&e.setState({[s]:a})}catch(i){Xt.error("[initFilterVisibility] Failed to load filter visibility:",i),e?.setState&&e.setState({[s]:r})}}async function s5(t,e){const{storageKey:n,filters:r}=t?.params||{};if(!n){Xt.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){Xt.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ma}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),Xt.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){Xt.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function o5(t,e){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=t?.params||{};if(!n||!r){Xt.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=e?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],e?.setState&&e.setState({[s]:i});const a=`${Ma}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),Xt.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){Xt.error("[toggleFilterVisibility] Failed to save:",l)}}async function i5(t,e){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=t?.params||{};if(!n){Xt.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ma}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),e?.setState&&e.setState({[s]:r}),Xt.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){Xt.error("[resetFilterVisibility] Failed to reset:",i)}}const ms=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...t)=>console.log("[Handler:MultilingualTag]",...t),warn:(...t)=>console.warn("[Handler:MultilingualTag]",...t),error:(...t)=>console.error("[Handler:MultilingualTag]",...t)};async function a5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){ms.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){ms.warn("No values to save"),n.modal?.close?.(),xd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),xd(n)}async function l5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}n.modal?.close?.(),xd(n)}async function c5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}const r=t?.params?.locale;if(!r){ms.warn("No locale specified");return}const s=e?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function xd(t){t.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function Um(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return`${e}-${n}-${r}T${s}:${o}:${i}`}function d5(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59),r=Um(n),s=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);switch(t){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:Um(s),endDate:r}}function u5(t){const{preset:e}=t.params||{preset:"today"},{startDate:n,endDate:r}=d5(e);return{startDate:n,endDate:r,preset:e}}const No=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...t)=>console.log("[Handler:Sidebar]",...t),warn:(...t)=>console.warn("[Handler:Sidebar]",...t),error:(...t)=>console.error("[Handler:Sidebar]",...t)},Bm="g7_admin_sidebar_collapsed";function jm(){try{return localStorage.getItem(Bm)==="1"}catch{return!1}}function f5(t){try{localStorage.setItem(Bm,t?"1":"0")}catch(e){No.error("Failed to save sidebar state to localStorage:",e)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:t})}catch(e){No.warn("Failed to set global sidebar state:",e)}}function Wm(){const t=jm();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:t})}catch(e){No.warn("Failed to restore sidebar state:",e)}No.log("Initial sidebar collapsed state restored:",t)}async function h5(t,e){Wm()}async function g5(t,e){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return jm()}})();f5(r),No.log("Sidebar collapsed toggled to:",r)}const wd=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...t)=>console.log("[Handler:DownloadAttachment]",...t),warn:(...t)=>console.warn("[Handler:DownloadAttachment]",...t),error:(...t)=>console.error("[Handler:DownloadAttachment]",...t)};async function p5(t,e){const n=window.G7Core,{url:r,filename:s}=t?.params||{};if(!r){wd.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){wd.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){wd.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const kd=window.G7Core?.createLogger?.("Handler:DetectAssetUrlMode")??{log:(...t)=>console.log("[Handler:DetectAssetUrlMode]",...t),warn:(...t)=>console.warn("[Handler:DetectAssetUrlMode]",...t),error:(...t)=>console.error("[Handler:DetectAssetUrlMode]",...t)},m5="G7_ASSET_PROBE_OK";async function Gm(t){try{const e=await fetch(t,{cache:"no-store",credentials:"omit"});if(!e.ok)return!1;const n=e.headers.get("content-type")??"";return/javascript|ecmascript/i.test(n)?(await e.text()).includes(m5):!1}catch{return!1}}async function Ym(){const[t,e]=await Promise.all([Gm("/api/system/asset-probe.js"),Gm("/api/system/asset-probe")]);return t&&e?"extension":!t&&e?"extensionless":"unavailable"}function b5(){return window.G7Config?.settings?.general?.asset_url_mode??"extension"}async function y5(t){try{const e=await Ym();if(e==="unavailable")return;const n=b5();if(e===n)return;window.G7Core?.state?.setGlobal?.({assetUrlModeDrift:{detected:e,stored:n}})}catch(e){kd.warn("자산 URL 방식 대조 실패 (대시보드 동작에는 영향 없음):",e)}}async function v5(t,e){const n=window.G7Core;try{n?.dispatch?.({handler:"toast",params:{message:"$t:admin.settings.general.asset_url_mode_detecting",type:"info"}});const r=await Ym();if(r==="unavailable"){n?.dispatch?.({handler:"toast",params:{message:"$t:admin.settings.general.asset_url_mode_detect_unavailable",type:"error"}});return}const s=e?.setState??n?.state?.setLocal;typeof s=="function"?s({"general.asset_url_mode":r}):kd.warn("setState 를 찾지 못해 감지 결과를 폼에 반영하지 못했습니다"),n?.dispatch?.({handler:"toast",params:{message:`$t:admin.settings.general.asset_url_mode_detect_${r}`,type:r==="extension"?"success":"warning"}})}catch(r){kd.error("자산 URL 방식 감지 실패:",r),n?.dispatch?.({handler:"toast",params:{message:"$t:admin.settings.general.asset_url_mode_detect_unavailable",type:"error"}})}}const Na={detectAssetUrlMode:v5,checkAssetUrlModeDrift:y5,setTheme:RT,initTheme:JT,scrollToSection:eu,initMenuFromUrl:n5,initFilterVisibility:r5,saveFilterVisibility:s5,toggleFilterVisibility:o5,resetFilterVisibility:i5,saveMultilingualTag:a5,cancelMultilingualTag:l5,updateMultilingualTagValue:c5,setDateRange:u5,toggleSidebar:g5,initSidebar:h5,downloadAttachment:p5},Oo=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...t),error:(...t)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...t)};function x5(){const e=window.G7Core?.api?.getToken?.()??null;return e?{Authorization:`Bearer ${e}`}:{}}function w5(){try{const t=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return t?{"Accept-Language":t}:{}}catch{return{}}}async function k5(t,e=null){const n={purpose:t.purpose};t.provider_id&&(n.provider_id=t.provider_id),e&&(n.target=e);const r=t.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...w5(),...x5()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??t.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function C5(t){const e=window.G7Core,n=e?.identity;if(!e?.dispatch||!e?.state||!n)return Oo.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(t.render_hint==="external_redirect"||t.redirect_url)return n.redirectExternally(t);const r=t.target&&(t.target.email||t.target.phone)?t.target:null;let s;try{s=await k5(t,r)}catch(m){Oo.error("Challenge 시작 실패:",m);try{await e.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...t,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;e.state.set({identityChallenge:{policy_key:t.policy_key,purpose:t.purpose,provider_id:t.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),e.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=e.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await e.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Oo.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...t,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function S5(){const t=window.G7Core?.identity;if(!t?.setLauncher){Oo.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}t.setLauncher(C5),Oo.log("IDV launcher registered (sirsoft-admin_basic)")}function _5(t){const e=t.icons;return Array.isArray(e)?e.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function E5(t,e){const n=t.label;return typeof n=="string"?n.startsWith("$t:")?e(n.slice(3)):n:t.value}function M5(t,e,n){if(n==="")return!0;const r=n.toLowerCase();return t.value.toLowerCase().includes(r)||e.toLowerCase().includes(r)?!0:(t.keywords??[]).some(s=>s.toLowerCase().includes(r))}function N5({entry:t}){const e=t.preview;return e?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:e.html},style:Sd}):e?.className?h.jsx("span",{className:`g7le-icon-preview ${e.className}`,style:Sd}):h.jsx("i",{className:`fas fa-${t.value}`,style:Sd,"aria-hidden":"true"})}function O5({control:t,value:e,onChange:n,t:r}){const s=_5(t),o=e==null?"":String(e),i=typeof t.iconColumns=="number"?t.iconColumns:6,a=t.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Xm,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Km})});const u=g=>E5(g,r),f=s.filter(g=>M5(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Xm,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Km}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...T5,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?qm:Cd,children:h.jsx("span",{style:A5,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?qm:Cd,children:h.jsx(N5,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:D5,children:r("layout_editor.icon_picker.no_results")})]})}const Xm={display:"flex",flexDirection:"column",gap:6,width:"100%"},Km={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},T5={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},Cd={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},qm={...Cd,border:"2px solid #2563eb",background:"#eff6ff"},Sd={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},A5={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},D5={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Zm=130,Mn=20;function I5(t){const e=t?.arrayProp;return typeof e=="string"&&e?e:"tabs"}function L5(t){let e=0;for(const n of t){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>e&&(e=r)}return e+1}function P5({node:t,params:e,cellBoxes:n,t:r,onPatchNode:s}){const o=I5(e),i=v.useMemo(()=>{const g=(t.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[t,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=t.props??{};s({...t,props:{...m,[o]:g}})},[t,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:L5(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:Mn,height:Mn,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:Zm};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:Zm},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-Mn/2,top:p.top-Mn/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-Mn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-Mn,top:p.top+p.height/2-Mn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-Mn/2,top:p.top+p.height/2-Mn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const _d=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...t)};function $5(){if(typeof window>"u")return;const t=window.G7Core?.layoutEditor;if(!t?.registerWidget){_d.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}t.registerWidget("icon-picker",O5),_d.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),t.registerCanvasOverlay&&(t.registerCanvasOverlay("tabnav",P5),_d.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Ed=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic]",...t),error:(...t)=>console.error("[Template:sirsoft-admin_basic]",...t)};typeof window<"u"&&(window.G7TemplateHandlers=Na);function Qm(){if(typeof window<"u"){let t=0;const e=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Na).forEach(([s,o])=>{r.registerHandler(s,o)}),Ed.log(`${Object.keys(Na).length} custom handler(s) registered:`,Object.keys(Na)),S5(),Wm()):(t++,t<=e?(Ed.warn(`ActionDispatcher not found, retrying... (${t}/${e})`),setTimeout(n,100)):Ed.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return $5(),Qm(),R.A=Lr,R.Accordion=rc,R.ActionMenu=bs,R.AdminFooter=_y,R.AdminHeader=wy,R.AdminSidebar=xy,R.Alert=cu,R.AlertDialog=uy,R.Badge=Pd,R.BarChart=VT,R.Breadcrumb=ou,R.Button=oe,R.Card=pb,R.CardGrid=Kb,R.CategoryTree=jS,R.Checkbox=vn,R.ChipCheckbox=OE,R.Code=ub,R.CodeEditor=Uv,R.ColumnSelector=Kv,R.ConfirmDialog=ru,R.Container=UT,R.DataGrid=jb,R.Dialog=nu,R.Div=I,R.DonutChart=HT,R.Dropdown=Zb,R.DropdownButton=TE,R.DropdownMenuItem=AE,R.DynamicFieldList=UE,R.EmptyState=by,R.ExtensionBadge=nh,R.FileInput=Md,R.FileUploader=Ep,R.FilterGroup=ey,R.FilterVisibilitySelector=CE,R.Flex=jT,R.Form=La,R.FormField=YE,R.Fragment=hb,R.Grid=BT,R.H1=Aa,R.H2=Qn,R.H3=Ir,R.H4=Nd,R.Hr=gb,R.HtmlContent=qa,R.HtmlEditor=vE,R.I=pt,R.Icon=re,R.IconButton=ly,R.IconName=de,R.IconSelect=FS,R.ImageGallery=Bi,R.Img=yn,R.Input=wt,R.Label=rn,R.LanguageSelector=Sy,R.LayoutEditorHeader=Ty,R.LayoutFileList=Ay,R.LayoutHistoryPanel=jv,R.LayoutWarnings=kE,R.Li=Ia,R.LoadingSpinner=vy,R.LoginForm=Wv,R.Modal=Uo,R.MultilingualInput=Va,R.MultilingualLocaleContext=Pc,R.MultilingualTabPanel=GE,R.MultilingualTagInput=Gk,R.Nav=Lo,R.NotificationCenter=ky,R.Ol=sb,R.Optgroup=lb,R.Option=ab,R.P=bt,R.PageHeader=Ey,R.PageLoading=Jv,R.PageTransitionIndicator=Zv,R.Pagination=Po,R.PermissionTree=US,R.Pre=fb,R.ProductCard=Qb,R.RadioGroup=mE,R.RichSelect=ME,R.SearchBar=Rb,R.SearchableDropdown=Yk,R.Section=Od,R.SectionHeader=Ny,R.SectionLayout=WT,R.Select=Pr,R.SlotContainer=EE,R.SortableMenuItem=Gh,R.SortableMenuList=PS,R.Span=Q,R.StatCard=Jb,R.StatusBadge=$o,R.Svg=Hn,R.TabNavigation=ty,R.TabNavigationScroll=iy,R.Table=Pa,R.TagInput=Bk,R.TagSelect=Xk,R.Tbody=Fa,R.Td=Kt,R.TemplateCard=Oy,R.Textarea=Zn,R.Tfoot=za,R.Th=$r,R.Thead=$a,R.ThemeToggle=Yv,R.ThreeColumnLayout=GT,R.Toast=py,R.Toggle=Ha,R.Tr=Jn,R.Ul=Da,R.UnifiedIcon=db,R.UserProfile=Cy,R.VersionList=_u,R.configureJSONLanguageService=KT,R.defaultJSONSchemas=Fm,R.executeImageDownload=Tc,R.initTemplate=Qm,R.jsonEditorDefaults=YT,R.monacoInitOptions=XT,R.templateMetadata=qT,R.useCurrentMultilingualLocale=Ip,R.useImageGallery=fp,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM); //# sourceMappingURL=components.iife.js.map diff --git a/templates/_bundled/sirsoft-admin_basic/editor-spec/sampleData.json b/templates/_bundled/sirsoft-admin_basic/editor-spec/sampleData.json index 6e4e90cc..45ad464a 100644 --- a/templates/_bundled/sirsoft-admin_basic/editor-spec/sampleData.json +++ b/templates/_bundled/sirsoft-admin_basic/editor-spec/sampleData.json @@ -1,6 +1,30 @@ { "comment": "admin 자체 + 코어 SSoT 도메인. locales/admin_menus/me/installed_modules/active_plugins/users 등. 실제 데이터소스 ID 는 착수 시점 admin 레이아웃 data_sources 로 재검증 — 본 블록은 코어 SSoT/공통 폴백.", "byDataSourceId": { + "sitemap_status": { + "data": { + "last_updated_at": "2026-06-21T15:40:00+09:00", + "realtime_enabled": true, + "progress": { + "status": "completed", + "total": 128, + "written": 128, + "percent": 100 + } + } + }, + "sitemap_progress_ws": { + "data": { + "last_updated_at": "2026-06-21T15:40:00+09:00", + "realtime_enabled": true, + "progress": { + "status": "running", + "total": 128, + "written": 64, + "percent": 50 + } + } + }, "locales": { "data": [ { diff --git a/templates/_bundled/sirsoft-admin_basic/src/styles/main.css b/templates/_bundled/sirsoft-admin_basic/src/styles/main.css index 107d96ad..1de81bdc 100644 --- a/templates/_bundled/sirsoft-admin_basic/src/styles/main.css +++ b/templates/_bundled/sirsoft-admin_basic/src/styles/main.css @@ -16,7 +16,7 @@ */ @source "../../layouts/**/*.json"; /* SAFELIST-START */ -@source inline("bg-blue-600 bg-gray-100 bg-gray-50 bg-gray-800 bg-gray-900 bg-red-600 bg-white block border border-0 border-blue-600 border-dashed border-dotted border-gray-300 border-gray-500 border-gray-700 border-gray-900 border-green-600 border-red-600 border-solid border-white dark:bg-amber-500 dark:bg-amber-900 dark:bg-amber-900/20 dark:bg-amber-900/30 dark:bg-amber-900/40 dark:bg-blue-400 dark:bg-blue-500 dark:bg-blue-600 dark:bg-blue-800 dark:bg-blue-900 dark:bg-blue-900/20 dark:bg-blue-900/30 dark:bg-blue-900/40 dark:bg-blue-900/50 dark:bg-emerald-400 dark:bg-gray-100 dark:bg-gray-50 dark:bg-gray-600 dark:bg-gray-700 dark:bg-gray-700/30 dark:bg-gray-700/50 dark:bg-gray-800 dark:bg-gray-800/50 dark:bg-gray-900 dark:bg-gray-900/50 dark:bg-gray-950 dark:bg-green-900 dark:bg-green-900/20 dark:bg-green-900/30 dark:bg-indigo-500 dark:bg-indigo-900 dark:bg-indigo-900/30 dark:bg-orange-900 dark:bg-purple-800/50 dark:bg-purple-900 dark:bg-purple-900/20 dark:bg-purple-900/30 dark:bg-purple-900/50 dark:bg-red-500 dark:bg-red-600 dark:bg-red-700 dark:bg-red-900 dark:bg-red-900/20 dark:bg-red-900/30 dark:bg-rose-400 dark:bg-slate-300 dark:bg-slate-700 dark:bg-slate-800 dark:bg-white dark:bg-yellow-900 dark:bg-yellow-900/30 dark:bg-yellow-900/40 dark:block dark:border dark:border-0 dark:border-amber-400 dark:border-amber-600 dark:border-amber-700 dark:border-amber-800 dark:border-blue-600 dark:border-blue-700 dark:border-blue-800 dark:border-dashed dark:border-dotted dark:border-gray-300 dark:border-gray-500 dark:border-gray-600 dark:border-gray-700 dark:border-gray-900 dark:border-green-600 dark:border-green-700 dark:border-green-800 dark:border-indigo-400 dark:border-orange-600 dark:border-purple-600 dark:border-purple-700 dark:border-red-500 dark:border-red-600 dark:border-red-700 dark:border-red-800 dark:border-solid dark:border-white dark:border-yellow-600 dark:disabled:hover:bg-indigo-500 dark:disabled:text-gray-600 dark:divide-purple-800 dark:flex dark:flex-1 dark:flex-auto dark:flex-col dark:flex-none dark:flex-row dark:flex-wrap dark:focus:ring-amber-400 dark:focus:ring-blue-400 dark:focus:ring-indigo-400 dark:focus:ring-offset-gray-900 dark:focus:ring-slate-500 dark:font-bold dark:font-medium dark:font-normal dark:from-blue-900 dark:hover:bg-amber-600 dark:hover:bg-blue-600 dark:hover:bg-gray-100 dark:hover:bg-gray-200 dark:hover:bg-gray-500 dark:hover:bg-gray-600 dark:hover:bg-gray-700 dark:hover:bg-gray-700/30 dark:hover:bg-indigo-600 dark:hover:bg-indigo-900/30 dark:hover:bg-orange-900/30 dark:hover:bg-purple-900/30 dark:hover:bg-red-600 dark:hover:bg-red-800 dark:hover:bg-red-900/20 dark:hover:bg-red-900/30 dark:hover:bg-slate-200 dark:hover:bg-slate-600 dark:hover:text-blue-300 dark:hover:text-blue-400 dark:hover:text-gray-200 dark:hover:text-gray-300 dark:hover:text-purple-200 dark:hover:text-purple-300 dark:hover:text-red-400 dark:hover:text-slate-800 dark:hover:text-white dark:italic dark:items-center dark:items-end dark:items-start dark:items-stretch dark:justify-around dark:justify-between dark:justify-center dark:justify-end dark:justify-start dark:opacity-0 dark:opacity-100 dark:opacity-25 dark:opacity-50 dark:opacity-75 dark:overflow-auto dark:overflow-hidden dark:overflow-visible dark:overflow-x-auto dark:overflow-y-auto dark:placeholder-gray-500 dark:prose-invert dark:rounded dark:rounded-full dark:rounded-lg dark:rounded-none dark:rounded-sm dark:rounded-xl dark:self-center dark:self-end dark:self-start dark:self-stretch dark:shadow dark:shadow-2xl dark:shadow-lg dark:shadow-none dark:shadow-purple-900/50 dark:shadow-sm dark:shadow-xl dark:text-2xl dark:text-amber-200 dark:text-amber-300 dark:text-amber-400 dark:text-base dark:text-blue-100 dark:text-blue-200 dark:text-blue-300 dark:text-blue-400 dark:text-blue-600 dark:text-center dark:text-gray-100 dark:text-gray-200 dark:text-gray-300 dark:text-gray-400 dark:text-gray-500 dark:text-gray-600 dark:text-gray-700 dark:text-gray-900 dark:text-green-100 dark:text-green-200 dark:text-green-300 dark:text-green-400 dark:text-green-600 dark:text-indigo-200 dark:text-indigo-300 dark:text-indigo-400 dark:text-justify dark:text-left dark:text-lg dark:text-orange-200 dark:text-orange-400 dark:text-orange-500 dark:text-purple-100 dark:text-purple-200 dark:text-purple-300 dark:text-purple-400 dark:text-red-200 dark:text-red-300 dark:text-red-400 dark:text-red-500 dark:text-red-600 dark:text-right dark:text-slate-300 dark:text-slate-400 dark:text-sm dark:text-white dark:text-xl dark:text-xs dark:text-yellow-100 dark:text-yellow-200 dark:text-yellow-300 dark:text-yellow-400 dark:text-yellow-500 dark:to-indigo-900 dark:underline dark:whitespace-normal dark:whitespace-nowrap dark:whitespace-pre-wrap disabled:bg-blue-400 disabled:bg-gray-100 disabled:bg-gray-400 disabled:cursor-not-allowed disabled:hover:bg-indigo-600 disabled:hover:bg-transparent disabled:no-underline disabled:opacity-50 disabled:text-gray-400 flex flex-1 flex-auto flex-col flex-none flex-row flex-wrap focus:border-blue-500 focus:border-indigo-500 focus:border-red-500 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-blue-500 focus:ring-indigo-500 focus:ring-offset-2 focus:ring-red-500 focus:ring-slate-400 font-bold font-medium font-normal hover:-translate-y-0.5 hover:bg-amber-50 hover:bg-amber-700 hover:bg-blue-700 hover:bg-gray-100 hover:bg-gray-200 hover:bg-gray-300 hover:bg-gray-50 hover:bg-gray-800 hover:bg-gray-900 hover:bg-green-700 hover:bg-indigo-50 hover:bg-indigo-700 hover:bg-orange-50 hover:bg-orange-700 hover:bg-purple-50 hover:bg-purple-700 hover:bg-red-100 hover:bg-red-50 hover:bg-red-700 hover:bg-slate-50 hover:bg-slate-700 hover:bg-yellow-700 hover:text-blue-500 hover:text-blue-600 hover:text-gray-600 hover:text-gray-700 hover:text-gray-900 hover:text-purple-800 hover:text-purple-900 hover:text-red-500 hover:text-white hover:underline italic items-center items-end items-start items-stretch justify-around justify-between justify-center justify-end justify-start lg:grid-cols-2 lg:grid-cols-3 lg:mb-8 lg:p-8 lg:px-8 max-h-[400px] max-h-[500px] max-h-[70vh] max-w-[200px] md: md:col-span-2 md:flex-1 md:flex-row md:gap-2 md:gap-3 md:grid-cols-2 md:grid-cols-3 md:grid-cols-4 md:h-20 md:items-center md:justify-between md:mb-6 md:p-6 md:rounded-2xl md:space-y-0 md:text-xl md:text-xs md:w-20 md:w-40 md:w-64 md:w-72 md:w-80 md:w-auto min-h-[200px] min-h-[60vh] min-w-[200px] min-w-[80px] opacity-0 opacity-100 opacity-25 opacity-50 opacity-75 overflow-auto overflow-hidden overflow-visible overflow-x-auto overflow-y-auto rounded rounded-full rounded-lg rounded-none rounded-sm rounded-xl self-center self-end self-start self-stretch shadow shadow-2xl shadow-lg shadow-none shadow-sm shadow-xl sm:flex-row sm:gap-6 sm:grid-cols-2 sm:inline sm:items-start sm:justify-between sm:mt-6 sm:p-6 sm:px-6 sm:text-2xl sm:text-3xl sm:w-40 text-2xl text-[10px] text-[11px] text-base text-blue-600 text-center text-gray-500 text-gray-700 text-gray-900 text-green-600 text-justify text-left text-lg text-red-600 text-right text-sm text-white text-xl text-xs underline whitespace-normal whitespace-nowrap whitespace-pre-wrap"); +@source inline("bg-blue-600 bg-gray-100 bg-gray-50 bg-gray-800 bg-gray-900 bg-red-600 bg-white block border border-0 border-blue-600 border-dashed border-dotted border-gray-300 border-gray-500 border-gray-700 border-gray-900 border-green-600 border-red-600 border-solid border-white dark:bg-amber-500 dark:bg-amber-900 dark:bg-amber-900/20 dark:bg-amber-900/30 dark:bg-amber-900/40 dark:bg-blue-400 dark:bg-blue-500 dark:bg-blue-600 dark:bg-blue-800 dark:bg-blue-900 dark:bg-blue-900/20 dark:bg-blue-900/30 dark:bg-blue-900/40 dark:bg-blue-900/50 dark:bg-emerald-400 dark:bg-gray-100 dark:bg-gray-50 dark:bg-gray-600 dark:bg-gray-700 dark:bg-gray-700/30 dark:bg-gray-700/50 dark:bg-gray-800 dark:bg-gray-800/50 dark:bg-gray-900 dark:bg-gray-900/50 dark:bg-gray-950 dark:bg-green-900 dark:bg-green-900/20 dark:bg-green-900/30 dark:bg-indigo-500 dark:bg-indigo-900 dark:bg-indigo-900/30 dark:bg-orange-900 dark:bg-purple-800/50 dark:bg-purple-900 dark:bg-purple-900/20 dark:bg-purple-900/30 dark:bg-purple-900/50 dark:bg-red-500 dark:bg-red-600 dark:bg-red-700 dark:bg-red-900 dark:bg-red-900/20 dark:bg-red-900/30 dark:bg-rose-400 dark:bg-slate-300 dark:bg-slate-700 dark:bg-slate-800 dark:bg-white dark:bg-yellow-900 dark:bg-yellow-900/30 dark:bg-yellow-900/40 dark:block dark:border dark:border-0 dark:border-amber-400 dark:border-amber-600 dark:border-amber-700 dark:border-amber-800 dark:border-blue-600 dark:border-blue-700 dark:border-blue-800 dark:border-dashed dark:border-dotted dark:border-gray-300 dark:border-gray-500 dark:border-gray-600 dark:border-gray-700 dark:border-gray-900 dark:border-green-600 dark:border-green-700 dark:border-green-800 dark:border-indigo-400 dark:border-orange-600 dark:border-purple-600 dark:border-purple-700 dark:border-red-500 dark:border-red-600 dark:border-red-700 dark:border-red-800 dark:border-solid dark:border-white dark:border-yellow-600 dark:disabled:hover:bg-indigo-500 dark:disabled:text-gray-600 dark:divide-purple-800 dark:flex dark:flex-1 dark:flex-auto dark:flex-col dark:flex-none dark:flex-row dark:flex-wrap dark:focus:ring-amber-400 dark:focus:ring-blue-400 dark:focus:ring-indigo-400 dark:focus:ring-offset-gray-900 dark:focus:ring-slate-500 dark:font-bold dark:font-medium dark:font-normal dark:from-blue-900 dark:hover:bg-amber-600 dark:hover:bg-blue-600 dark:hover:bg-gray-100 dark:hover:bg-gray-200 dark:hover:bg-gray-500 dark:hover:bg-gray-600 dark:hover:bg-gray-700 dark:hover:bg-gray-700/30 dark:hover:bg-indigo-600 dark:hover:bg-indigo-900/30 dark:hover:bg-orange-900/30 dark:hover:bg-purple-900/30 dark:hover:bg-red-600 dark:hover:bg-red-800 dark:hover:bg-red-900/20 dark:hover:bg-red-900/30 dark:hover:bg-slate-200 dark:hover:bg-slate-600 dark:hover:text-blue-300 dark:hover:text-blue-400 dark:hover:text-gray-200 dark:hover:text-gray-300 dark:hover:text-purple-200 dark:hover:text-purple-300 dark:hover:text-red-400 dark:hover:text-slate-800 dark:hover:text-white dark:italic dark:items-center dark:items-end dark:items-start dark:items-stretch dark:justify-around dark:justify-between dark:justify-center dark:justify-end dark:justify-start dark:opacity-0 dark:opacity-100 dark:opacity-25 dark:opacity-50 dark:opacity-75 dark:overflow-auto dark:overflow-hidden dark:overflow-visible dark:overflow-x-auto dark:overflow-y-auto dark:placeholder-gray-500 dark:prose-invert dark:rounded dark:rounded-full dark:rounded-lg dark:rounded-none dark:rounded-sm dark:rounded-xl dark:self-center dark:self-end dark:self-start dark:self-stretch dark:shadow dark:shadow-2xl dark:shadow-lg dark:shadow-none dark:shadow-purple-900/50 dark:shadow-sm dark:shadow-xl dark:text-2xl dark:text-amber-200 dark:text-amber-300 dark:text-amber-400 dark:text-base dark:text-blue-100 dark:text-blue-200 dark:text-blue-300 dark:text-blue-400 dark:text-blue-600 dark:text-center dark:text-gray-100 dark:text-gray-200 dark:text-gray-300 dark:text-gray-400 dark:text-gray-500 dark:text-gray-600 dark:text-gray-700 dark:text-gray-900 dark:text-green-100 dark:text-green-200 dark:text-green-300 dark:text-green-400 dark:text-green-600 dark:text-indigo-200 dark:text-indigo-300 dark:text-indigo-400 dark:text-justify dark:text-left dark:text-lg dark:text-orange-200 dark:text-orange-400 dark:text-orange-500 dark:text-purple-100 dark:text-purple-200 dark:text-purple-300 dark:text-purple-400 dark:text-red-200 dark:text-red-300 dark:text-red-400 dark:text-red-500 dark:text-red-600 dark:text-right dark:text-slate-300 dark:text-slate-400 dark:text-sm dark:text-white dark:text-xl dark:text-xs dark:text-yellow-100 dark:text-yellow-200 dark:text-yellow-300 dark:text-yellow-400 dark:text-yellow-500 dark:to-indigo-900 dark:underline dark:whitespace-normal dark:whitespace-nowrap dark:whitespace-pre-wrap disabled:bg-blue-400 disabled:bg-gray-100 disabled:bg-gray-400 disabled:cursor-not-allowed disabled:hover:bg-indigo-600 disabled:hover:bg-transparent disabled:no-underline disabled:opacity-50 disabled:text-gray-400 flex flex-1 flex-auto flex-col flex-none flex-row flex-wrap focus:border-blue-500 focus:border-indigo-500 focus:border-red-500 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-blue-500 focus:ring-indigo-500 focus:ring-offset-2 focus:ring-red-500 focus:ring-slate-400 font-bold font-medium font-normal hover:-translate-y-0.5 hover:bg-amber-50 hover:bg-amber-700 hover:bg-blue-700 hover:bg-gray-100 hover:bg-gray-200 hover:bg-gray-300 hover:bg-gray-50 hover:bg-gray-800 hover:bg-gray-900 hover:bg-green-700 hover:bg-indigo-50 hover:bg-indigo-700 hover:bg-orange-50 hover:bg-orange-700 hover:bg-purple-50 hover:bg-purple-700 hover:bg-red-100 hover:bg-red-50 hover:bg-red-700 hover:bg-slate-50 hover:bg-slate-700 hover:bg-yellow-700 hover:no-underline hover:text-blue-500 hover:text-blue-600 hover:text-gray-600 hover:text-gray-700 hover:text-gray-900 hover:text-purple-800 hover:text-purple-900 hover:text-red-500 hover:text-white hover:underline italic items-center items-end items-start items-stretch justify-around justify-between justify-center justify-end justify-start lg:grid-cols-2 lg:grid-cols-3 lg:mb-8 lg:p-8 lg:px-8 max-h-[400px] max-h-[500px] max-h-[70vh] max-w-[200px] md: md:col-span-2 md:flex-1 md:flex-row md:gap-2 md:gap-3 md:grid-cols-2 md:grid-cols-3 md:grid-cols-4 md:h-20 md:items-center md:justify-between md:mb-6 md:p-6 md:rounded-2xl md:space-y-0 md:text-xl md:text-xs md:w-20 md:w-40 md:w-64 md:w-72 md:w-80 md:w-auto min-h-[200px] min-h-[60vh] min-w-[200px] min-w-[80px] opacity-0 opacity-100 opacity-25 opacity-50 opacity-75 overflow-auto overflow-hidden overflow-visible overflow-x-auto overflow-y-auto rounded rounded-full rounded-lg rounded-none rounded-sm rounded-xl self-center self-end self-start self-stretch shadow shadow-2xl shadow-lg shadow-none shadow-sm shadow-xl sm:flex-row sm:gap-6 sm:grid-cols-2 sm:inline sm:items-start sm:justify-between sm:mt-6 sm:p-6 sm:px-6 sm:text-2xl sm:text-3xl sm:w-40 text-2xl text-[10px] text-[11px] text-base text-blue-600 text-center text-gray-500 text-gray-700 text-gray-900 text-green-600 text-justify text-left text-lg text-red-600 text-right text-sm text-white text-xl text-xs underline whitespace-normal whitespace-nowrap whitespace-pre-wrap"); /* SAFELIST-END */ @@ -379,6 +379,8 @@ + +