세 갈래의 결함을 한 브랜치에서 정리한다.
## 목록 컨텍스트 왕복 시 URL 상태 소실 ( @jiwonpapa 님께서 제보해주셨습니다.)
목록에서 상세·형제 상세(이전/다음)·작성/수정 폼에 다녀오면 보고 있던
page/search/category/filters 가 사라지던 문제를 전 도메인에서 수정했다.
- 엔진(engine-v1.54.2): `mergeQuery: true` 만 적고 `query` 를 생략하면 병합이
통째로 건너뛰어지던 함정을 교정 — `ActionDispatcher.handleNavigate`/`handleReplaceUrl`.
- 게시판·이커머스·페이지·회원·마이페이지·gdpr 등 9개 확장 레이아웃의 왕복 leg 전수
적용(mergeQuery: true). 의도적 리셋(검색/필터 초기화·탭 전환·프리셋)은 면제 주석으로 구분.
- 무한스크롤 목록(브랜드·상품 공통정보·고시정보)의 새로고침이 URL 검색·정렬을 떨구던
결함 수정.
- 재발 차단: audit 룰 `layout-list-context-navigate-merge-query`(목록 클러스터 자동 도출,
page/필터 URL 신호 4종) + `layout-navigate-path-absolute`(navigate path 동작 키워드 금지).
## cellChildren 등 반복 렌더에서 단일 바인딩 파이프 미적용 ( @glitter-gim 님께서 제보해주셨습니다.)
목록 표의 각 칸에 넣은 날짜·숫자 서식(`{{row.x | datetime(...)}}`)이 빈 값이 되거나
서식 없는 원본으로 나오던 문제를, 표현식 판정 로직이 엔진 전역에 복제되며 갈라진
구조적 결함으로 진단하고 판정 경로를 단일화했다(engine-v1.54.3).
- `RenderHelpers`(renderItemChildren·evaluateIfCondition)·`ConditionEvaluator`·
`DataBindingEngine.resolveObject`·`DynamicRenderer` props 5곳에 단일 바인딩 파이프 분기 추가.
- 계획: `g7-scalable-lobster.md`(렌더 경로 비대칭 결함 일괄 수정).
## 공개 문서 내부 도구 귀속 제거
release 에 포함되는 공개 문서(`docs/**`)에서 내부 audit 룰 ID 귀속 서술을
도구 비귀속 표현("정적 검사")으로 정리. 재발 차단 룰 `public-no-internal-audit-reference` 신설.
전 계층 테스트(PHPUnit·Vitest·Playwright)·회귀 테스트 동반, 버전/CHANGELOG/활성 디렉토리 동기 완료.
88 lines
351 KiB
JavaScript
88 lines
351 KiB
JavaScript
var SirsoftBasic=(function(J,c,k,Jt){"use strict";function Ic(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const T=Ic(k),Dc=()=>window.G7Core,Q=k.forwardRef(({children:e,variant:t="primary",size:r="md",className:n="",...o},a)=>{const s="inline-flex items-center justify-center",l=Dc()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return c.jsx("button",{ref:a,className:l,...o,children:e})});Q.displayName="Button";const W=k.forwardRef(({children:e,className:t="",...r},n)=>c.jsx("div",{ref:n,className:t,...r,children:e})),ee=({children:e,className:t="",...r})=>c.jsx("span",{className:t,...r,children:e}),fn=({children:e,className:t="",...r})=>c.jsx("svg",{className:t,...r,children:e}),xt=k.forwardRef(({label:e,error:t,className:r="",onChange:n,onKeyPress:o,value:a,defaultValue:s,type:l="text",checked:f,defaultChecked:h,...d},i)=>{const u=l==="radio"||l==="checkbox",g=k.useRef(!1),p=k.useRef(null);k.useImperativeHandle(i,()=>p.current);const[m,w]=k.useState(a??s??"");k.useEffect(()=>{!u&&!g.current&&a!==void 0&&w(a)},[a,u]);const x=k.useCallback(()=>{g.current=!0},[]),O=k.useCallback(v=>{if(g.current=!1,n){const N=v.target.value;w(N);const A=new Event("change",{bubbles:!0});Object.defineProperty(A,"target",{writable:!1,value:{value:N}}),Object.defineProperty(A,"currentTarget",{writable:!1,value:{value:N}}),n(A)}},[n]),y=k.useCallback(v=>{const N=v.target.value;w(N),!g.current&&n&&n(v)},[n]),E=k.useCallback(v=>{g.current||o&&o(v)},[o]),{loadingactions:M,formdata:_,...I}=d;if(u)return c.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:h,value:a,...I});const C=a!==void 0?{value:m}:{defaultValue:s};return c.jsx("input",{ref:p,type:l,className:r,onChange:y,onKeyPress:E,onCompositionStart:x,onCompositionEnd:O,...C,...I})});xt.displayName="Input";const Ba=k.forwardRef(({accept:e,maxSize:t,onChange:r,onError:n,buttonText:o="Browse",placeholder:a="No file selected",className:s="",disabled:l,...f},h)=>{const d=k.useRef(null),i=h||d,[u,g]=k.useState(""),p={},m={};Object.entries(f).forEach(([y,E])=>{y.startsWith("data-editor-")||y==="id"||y==="onMouseMove"||y==="onMouseLeave"?p[y]=E:m[y]=E});const w=k.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),x=k.useCallback(y=>{const E=y.target.files?.[0]||null;if(!E){g(""),r?.(null);return}if(t&&E.size>t*1024*1024){const M=`File size exceeds ${t}MB limit`;n?.(M),i.current&&(i.current.value=""),g("");return}g(E.name),r?.(E)},[t,r,n,i]),O=k.useCallback(y=>{y.stopPropagation(),i.current&&(i.current.value=""),g(""),r?.(null)},[r,i]);return c.jsxs(W,{className:`flex items-center gap-2 ${s}`,...p,children:[c.jsx(xt,{ref:i,type:"file",accept:e,onChange:x,disabled:l,className:"hidden",...m}),c.jsx(Q,{type:"button",onClick:w,disabled:l,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:o}),c.jsx(ee,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:u||a}),u&&!l&&c.jsx(Q,{type:"button",onClick:O,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:c.jsx(fn,{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Ba.displayName="FileInput";var Je=(e=>(e.User="fa-user",e.Users="fa-users",e.UserCircle="fa-user-circle",e.UserPlus="fa-user-plus",e.UserMinus="fa-user-minus",e.UserShield="fa-user-shield",e.Search="fa-search",e.Edit="fa-edit",e.Pencil="fa-pencil-alt",e.Trash="fa-trash",e.Save="fa-save",e.Plus="fa-plus",e.Minus="fa-minus",e.Check="fa-check",e.Times="fa-times",e.Download="fa-download",e.Upload="fa-upload",e.Copy="fa-copy",e.ExternalLink="fa-external-link-alt",e.Home="fa-home",e.ChevronLeft="fa-chevron-left",e.ChevronRight="fa-chevron-right",e.ChevronUp="fa-chevron-up",e.ChevronDown="fa-chevron-down",e.AngleLeft="fa-angle-left",e.AngleRight="fa-angle-right",e.AngleUp="fa-angle-up",e.AngleDown="fa-angle-down",e.ArrowUp="fa-arrow-up",e.ArrowDown="fa-arrow-down",e.ArrowLeft="fa-arrow-left",e.ArrowRight="fa-arrow-right",e.Bars="fa-bars",e.EllipsisVertical="fa-ellipsis-v",e.EllipsisHorizontal="fa-ellipsis-h",e.CheckCircle="fa-check-circle",e.TimesCircle="fa-times-circle",e.ExclamationCircle="fa-exclamation-circle",e.ExclamationTriangle="fa-exclamation-triangle",e.InfoCircle="fa-info-circle",e.QuestionCircle="fa-question-circle",e.XCircle="fa-times-circle",e.ShoppingCart="fa-shopping-cart",e.ShoppingBag="fa-shopping-bag",e.CreditCard="fa-credit-card",e.Tag="fa-tag",e.Tags="fa-tags",e.File="fa-file",e.FileAlt="fa-file-alt",e.Folder="fa-folder",e.FolderOpen="fa-folder-open",e.Envelope="fa-envelope",e.Phone="fa-phone",e.Comment="fa-comment",e.Comments="fa-comments",e.Cog="fa-cog",e.Cogs="fa-cogs",e.Settings="fa-cog",e.Wrench="fa-wrench",e.Sliders="fa-sliders-h",e.Image="fa-image",e.Images="fa-images",e.Video="fa-video",e.Camera="fa-camera",e.Heart="fa-heart",e.Star="fa-star",e.ThumbsUp="fa-thumbs-up",e.ThumbsDown="fa-thumbs-down",e.Share="fa-share",e.Clock="fa-clock",e.Calendar="fa-calendar",e.CalendarAlt="fa-calendar-alt",e.Lock="fa-lock",e.Unlock="fa-unlock",e.Eye="fa-eye",e.EyeSlash="fa-eye-slash",e.Bell="fa-bell",e.Flag="fa-flag",e.Map="fa-map",e.MapMarker="fa-map-marker-alt",e.Globe="fa-globe",e.Link="fa-link",e.Unlink="fa-unlink",e.Sun="fa-sun",e.Moon="fa-moon",e.ChartBar="fa-chart-bar",e.ChartLine="fa-chart-line",e.ChartPie="fa-chart-pie",e.ChartArea="fa-chart-area",e.Spinner="fa-spinner",e.CircleNotch="fa-circle-notch",e.CheckBadge="fa-badge-check",e.BellSlash="fa-bell-slash",e.BookOpen="fa-book-open",e.Building="fa-building",e.FileCircleCheck="fa-file-circle-check",e.WandMagicSparkles="fa-wand-magic-sparkles",e.UserXmark="fa-user-xmark",e.Cube="fa-cube",e.Cubes="fa-cubes",e.Plug="fa-plug",e.PuzzlePiece="fa-puzzle-piece",e.Fire="fa-fire",e.CommentDots="fa-comment-dots",e.DollarSign="fa-dollar-sign",e.Bars2="fa-bars",e.X="fa-times",e.List="fa-list",e.ThLarge="fa-th-large",e.Inbox="fa-inbox",e.Box="fa-box",e.PaperPlane="fa-paper-plane",e.FileText="fa-file-alt",e.Paperclip="fa-paperclip",e.Truck="fa-truck",e.Sync="fa-sync",e.RotateLeft="fa-rotate-left",e.MapPin="fa-map-marker-alt",e.HelpCircle="fa-question-circle",e))(Je||{});const Lc={user:"fa-user",users:"fa-users","user-circle":"fa-user-circle","user-plus":"fa-user-plus","user-minus":"fa-user-minus","user-shield":"fa-user-shield",search:"fa-search",edit:"fa-edit",pencil:"fa-pencil-alt",trash:"fa-trash",save:"fa-save",plus:"fa-plus",minus:"fa-minus",check:"fa-check",times:"fa-times",download:"fa-download",upload:"fa-upload",copy:"fa-copy","external-link":"fa-external-link-alt",home:"fa-home","chevron-left":"fa-chevron-left","chevron-right":"fa-chevron-right","chevron-up":"fa-chevron-up","chevron-down":"fa-chevron-down","angle-left":"fa-angle-left","angle-right":"fa-angle-right","angle-up":"fa-angle-up","angle-down":"fa-angle-down","arrow-up":"fa-arrow-up","arrow-down":"fa-arrow-down","arrow-left":"fa-arrow-left","arrow-right":"fa-arrow-right",bars:"fa-bars","ellipsis-vertical":"fa-ellipsis-v","ellipsis-v":"fa-ellipsis-v","ellipsis-horizontal":"fa-ellipsis-h","ellipsis-h":"fa-ellipsis-h","check-circle":"fa-check-circle","times-circle":"fa-times-circle","x-circle":"fa-times-circle","exclamation-circle":"fa-exclamation-circle","exclamation-triangle":"fa-exclamation-triangle","info-circle":"fa-info-circle","question-circle":"fa-question-circle","shopping-cart":"fa-shopping-cart","shopping-bag":"fa-shopping-bag","credit-card":"fa-credit-card",tag:"fa-tag",tags:"fa-tags",file:"fa-file","file-alt":"fa-file-alt",folder:"fa-folder","folder-open":"fa-folder-open",envelope:"fa-envelope",phone:"fa-phone",comment:"fa-comment",comments:"fa-comments",cog:"fa-cog",cogs:"fa-cogs",settings:"fa-cog",wrench:"fa-wrench",sliders:"fa-sliders-h",image:"fa-image",images:"fa-images",video:"fa-video",camera:"fa-camera",heart:"fa-heart",star:"fa-star","thumbs-up":"fa-thumbs-up","thumbs-down":"fa-thumbs-down",share:"fa-share",clock:"fa-clock",calendar:"fa-calendar","calendar-alt":"fa-calendar-alt",lock:"fa-lock",unlock:"fa-unlock",eye:"fa-eye","eye-slash":"fa-eye-slash",bell:"fa-bell",flag:"fa-flag",map:"fa-map","map-marker":"fa-map-marker-alt",globe:"fa-globe",link:"fa-link",unlink:"fa-unlink",sun:"fa-sun",moon:"fa-moon","chart-bar":"fa-chart-bar","chart-line":"fa-chart-line","chart-pie":"fa-chart-pie","chart-area":"fa-chart-area",spinner:"fa-spinner","circle-notch":"fa-circle-notch","check-badge":"fa-badge-check","badge-check":"fa-badge-check",cube:"fa-cube",cubes:"fa-cubes",plug:"fa-plug","puzzle-piece":"fa-puzzle-piece",flame:"fa-fire",fire:"fa-fire","message-square":"fa-comment-dots","dollar-sign":"fa-dollar-sign",menu:"fa-bars",x:"fa-times",list:"fa-list","layout-grid":"fa-th-large","th-large":"fa-th-large",grid:"fa-th-large",inbox:"fa-inbox",package:"fa-box",box:"fa-box",send:"fa-paper-plane","paper-plane":"fa-paper-plane","file-text":"fa-file-alt",paperclip:"fa-paperclip",truck:"fa-truck","refresh-cw":"fa-sync",sync:"fa-sync","undo-2":"fa-rotate-left","rotate-left":"fa-rotate-left","map-pin":"fa-map-marker-alt","help-circle":"fa-question-circle","alert-triangle":"fa-exclamation-triangle","bell-off":"fa-bell-slash","book-open":"fa-book-open",building:"fa-building","edit-2":"fa-edit","edit-3":"fa-edit","file-check":"fa-file-circle-check",mail:"fa-envelope",sparkles:"fa-wand-magic-sparkles","trash-2":"fa-trash","user-x":"fa-user-xmark"},de=({name:e,iconStyle:t="solid",size:r,color:n,spin:o=!1,pulse:a=!1,fixedWidth:s=!1,ariaLabel:l,className:f="",style:h,...d})=>{const i={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},u=typeof e=="string"?e:String(e),g=Lc[u],p=g?String(g).replace(/^fa-/,""):u.replace(/^fa-/,""),m=[i[t],`fa-${p}`,r&&`fa-${r}`,o&&"fa-spin",a&&"fa-pulse",s&&"fa-fw",n,f].filter(Boolean).join(" "),w=l||p.replace(/-/g," ");return c.jsx("i",{className:m,style:h,"aria-label":w,role:"img",...d})},br=(e,t)=>window.G7Core?.t?.(e,t)??e,ro={minLength:{key:"minLength",labelKey:"auth.password_input.rules.minLength",defaultParam:6,validate:(e,t=6)=>e.length>=t},maxLength:{key:"maxLength",labelKey:"auth.password_input.rules.maxLength",defaultParam:20,validate:(e,t=20)=>e.length<=t},hasUppercase:{key:"hasUppercase",labelKey:"auth.password_input.rules.hasUppercase",validate:e=>/[A-Z]/.test(e)},hasLowercase:{key:"hasLowercase",labelKey:"auth.password_input.rules.hasLowercase",validate:e=>/[a-z]/.test(e)},hasNumber:{key:"hasNumber",labelKey:"auth.password_input.rules.hasNumber",validate:e=>/[0-9]/.test(e)},hasSpecial:{key:"hasSpecial",labelKey:"auth.password_input.rules.hasSpecial",validate:e=>/[!@#$%^&*(),.?":{}|<>]/.test(e)},noSpaces:{key:"noSpaces",labelKey:"auth.password_input.rules.noSpaces",validate:e=>!/\s/.test(e)},minTypes:{key:"minTypes",labelKey:"auth.password_input.rules.minTypes",defaultParam:3,validate:(e,t=3)=>{let r=0;return/[A-Z]/.test(e)&&r++,/[a-z]/.test(e)&&r++,/[0-9]/.test(e)&&r++,/[!@#$%^&*(),.?":{}|<>]/.test(e)&&r++,r>=t}}},Wa=[ro.minLength];function Pc(e){const[t,r]=e.split(":"),n=ro[t];if(!n)return null;const o=r?parseInt(r,10):n.defaultParam;return{rule:n,param:isNaN(o)?n.defaultParam:o}}const Ka=k.forwardRef(({label:e,error:t,showToggle:r=!0,showValidation:n=!1,isConfirmField:o=!1,confirmTarget:a,onMatchChange:s,onValidityChange:l,rules:f,enableRules:h,showRules:d,wrapperClassName:i="",validationClassName:u="",className:g="",onChange:p,value:m,defaultValue:w,disabled:x,...O},y)=>{const E=k.useRef(null);k.useImperativeHandle(y,()=>E.current);const[M,_]=k.useState(!1),[I,C]=k.useState(!1),[v,N]=k.useState(m??w??"");k.useEffect(()=>{m!==void 0&&N(m)},[m]);const A=k.useMemo(()=>f&&f.length>0?f.map(j=>({rule:j,param:j.defaultParam})):h&&h.length>0?h.map(j=>Pc(j)).filter(j=>j!==null):Wa.map(j=>({rule:j,param:j.defaultParam})),[f,h]),P=k.useMemo(()=>!d||d.length===0?A:A.filter(j=>d.includes(j.rule.key)),[A,d]),D=k.useMemo(()=>!n||o?{}:P.reduce((j,{rule:H,param:q})=>(j[H.key]=H.validate(v,q),j),{}),[v,P,n,o]),L=k.useMemo(()=>!o||a===void 0?!0:v===a&&v.length>0,[o,v,a]),U=k.useMemo(()=>n?Object.values(D).every(j=>j):!0,[D,n]);k.useEffect(()=>{if(l&&n&&!o){const j=Object.entries(D).filter(([,H])=>!H).map(([H])=>H);l(U,j)}},[U,D,l,n,o]),k.useEffect(()=>{s&&o&&s(L)},[L,s,o]);const S=k.useCallback(()=>{_(j=>!j)},[]),b=k.useCallback(j=>{const H=j.target.value;N(H),p&&p(j)},[p]),$=k.useCallback(j=>{C(j.getModifierState("CapsLock"))},[]),{loadingactions:F,formdata:G,...Y}=O,B={},V={};for(const[j,H]of Object.entries(Y))j.startsWith("data-editor-")||j==="onMouseMove"||j==="onMouseLeave"?B[j]=H:V[j]=H;return c.jsxs("div",{className:`relative ${i}`,...B,children:[c.jsxs("div",{className:"relative",children:[c.jsx("input",{ref:E,type:M?"text":"password",className:`${g} ${r?"pr-10":""}`,value:m!==void 0?m:void 0,defaultValue:m===void 0?w:void 0,onChange:b,onKeyDown:$,onKeyUp:$,disabled:x,...V}),r&&c.jsx("button",{type:"button",onClick:S,disabled:x,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed dark:disabled:opacity-50","aria-label":br(M?"auth.password_input.hide":"auth.password_input.show"),children:c.jsx(de,{name:M?"eye-slash":"eye",className:"w-5 h-5"})})]}),I&&!M&&c.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-sm text-yellow-600 dark:text-yellow-400",children:[c.jsx(de,{name:"triangle-exclamation",className:"w-4 h-4"}),c.jsx("span",{children:br("auth.password_input.caps_lock_on")})]}),o&&a!==void 0&&v.length>0&&c.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-sm ${L?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:[c.jsx(de,{name:L?"check-circle":"xmark-circle",className:"w-4 h-4"}),c.jsx("span",{children:br(L?"auth.password_input.match":"auth.password_input.mismatch")})]}),n&&!o&&v.length>0&&c.jsx("div",{className:`mt-2 space-y-1 ${u}`,children:P.map(({rule:j,param:H})=>{const q=D[j.key],ue=H!==void 0?{count:H}:void 0;return c.jsxs("div",{className:`flex items-center gap-1.5 text-sm ${q?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-gray-400"}`,children:[c.jsx(de,{name:q?"check-circle":"circle",className:"w-4 h-4"}),c.jsx("span",{children:br(j.labelKey,ue)})]},j.key)})}),t&&c.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:t})]})});Ka.displayName="PasswordInput";const no=({label:e,error:t,className:r="",onChange:n,value:o,defaultValue:a,...s})=>{const l=k.useRef(!1),f=k.useRef(null),[h,d]=k.useState(o??a??"");k.useEffect(()=>{!l.current&&o!==void 0&&d(o)},[o]);const i=k.useCallback(()=>{l.current=!0},[]),u=k.useCallback(O=>{if(l.current=!1,n){const y=O.target.value;d(y);const E=new Event("change",{bubbles:!0});Object.defineProperty(E,"target",{writable:!1,value:{value:y}}),Object.defineProperty(E,"currentTarget",{writable:!1,value:{value:y}}),n(E)}},[n]),g=k.useCallback(O=>{const y=O.target.value;d(y),!l.current&&n&&n(O)},[n]),{loadingactions:p,formdata:m,...w}=s,x=o!==void 0?{value:h}:{defaultValue:a};return c.jsx("textarea",{ref:f,className:r,onChange:g,onCompositionStart:i,onCompositionEnd:u,...x,...w})},yr=({children:e,className:t="",...r})=>c.jsx("label",{className:t,...r,children:e}),Dt=({children:e,className:t="",...r})=>c.jsx("p",{className:t,...r,children:e}),Lt=({className:e="",alt:t="",...r})=>c.jsx("img",{className:e,alt:t,...r}),Fc=({children:e,className:t="",...r})=>c.jsx("h1",{className:t,...r,children:e}),Va=({children:e,className:t="",...r})=>c.jsx("h2",{className:t,...r,children:e}),gn=({children:e,className:t="",...r})=>c.jsx("h3",{className:t,...r,children:e}),Ya=({children:e,className:t="",...r})=>c.jsx("h4",{className:t,...r,children:e}),oo=({children:e,className:t="",...r})=>c.jsx("ul",{className:t,...r,children:e}),$c=({children:e,className:t="",...r})=>c.jsx("ol",{className:t,...r,children:e}),Xt=({children:e,className:t="",...r})=>c.jsx("li",{className:t,...r,children:e}),ao=({children:e,className:t="",...r})=>c.jsx("a",{className:t,...r,children:e}),so=({children:e,className:t="",...r})=>c.jsx("form",{className:t,...r,children:e}),Uc=window.G7Core?.createLogger?.("Comp:Select")??{log:(...e)=>console.log("[Comp:Select]",...e),warn:(...e)=>console.warn("[Comp:Select]",...e),error:(...e)=>console.error("[Comp:Select]",...e)};function zc(e){const t=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[e];return t||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[e]||e}const Xa=({children:e,label:t,error:r,options:n,className:o="",value:a,onChange:s,disabled:l,searchable:f=!1,searchPlaceholder:h,editorAttrs:d,...i})=>{const[u,g]=k.useState(!1),[p,m]=k.useState(""),[w,x]=k.useState(null),O=k.useRef(null),y=k.useRef(null),E=k.useRef(null),M=k.useRef(null),_=k.useMemo(()=>n?Array.isArray(n)?n.length===0?[]:typeof n[0]=="string"?n.map(S=>({value:S,label:zc(S)})):n:(Uc.warn("options prop is not an array:",n),null):null,[n]),I=k.useMemo(()=>_&&_.find(b=>String(b.value)===String(a))?.label||"",[_,a]),C=k.useMemo(()=>{if(!_)return null;if(!f||p.trim()==="")return _;const S=p.trim().toLowerCase();return _.filter(b=>b.label.toLowerCase().includes(S)||String(b.value).toLowerCase().includes(S))},[_,f,p]);k.useEffect(()=>{if(u&&f){m("");const S=setTimeout(()=>E.current?.focus(),0);return()=>clearTimeout(S)}u||m("")},[u,f]);const v=k.useCallback(()=>{if(!y.current)return;const S=y.current.getBoundingClientRect(),b=window.innerHeight-S.bottom,F=b<280&&S.top>b;x(F?{bottom:window.innerHeight-S.top+4,left:S.left,width:S.width}:{top:S.bottom+4,left:S.left,width:S.width})},[]);k.useEffect(()=>{if(!u){x(null);return}return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[u,v]),k.useEffect(()=>{const S=b=>{const $=b.target;O.current&&!O.current.contains($)&&(!M.current||!M.current.contains($))&&g(!1)};return u&&document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[u]),k.useEffect(()=>{const S=b=>{b.key==="Escape"&&u&&(g(!1),y.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[u]);const N=()=>{l||g(!u)},A=S=>{s&&s({target:{value:S},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),y.current?.focus()};if(!_)return c.jsx("select",{className:o,value:a,onChange:s,disabled:l,...d,...i,children:e});const P=o&&o.includes("bg-"),D=o&&/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(o),L=P?`${o}${D?"":" 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-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${o}`,U={...d,...i};return c.jsxs(W,{ref:O,className:"relative",...U,children:[c.jsxs(Q,{ref:y,type:"button",onClick:N,disabled:l,className:`${L} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":u,children:[c.jsx(ee,{className:"truncate",children:I||" "}),c.jsx(fn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${u?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),u&&w&&Jt.createPortal(c.jsxs(W,{ref:M,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:w.top,bottom:w.bottom,left:w.left,width:w.width},role:"listbox",children:[f&&c.jsx(W,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:c.jsx(xt,{ref:E,type:"text",value:p,onChange:S=>m(S.target.value),placeholder:h??"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":h??"Search"})}),c.jsxs(W,{className:"py-2 max-h-60 overflow-auto",children:[C&&C.length===0&&c.jsx(W,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:p?"No results":""}),(C??[]).map(S=>{const b=String(S.value)===String(a);return c.jsxs(Q,{type:"button",onClick:()=>!S.disabled&&A(S.value),disabled:S.disabled,className:`w-full px-4 py-3 text-left flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${b?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${S.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":b,children:[c.jsx(ee,{children:S.label}),b&&c.jsx(fn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},S.value)})]})]}),document.body)]})},Hc=({children:e,className:t="",...r})=>c.jsx("option",{className:t,...r,children:e}),Gc=({children:e,className:t="",...r})=>c.jsx("optgroup",{className:t,...r,children:e}),qa=k.forwardRef(({label:e,className:t="",...r},n)=>c.jsx("input",{ref:n,type:"checkbox",className:t,...r}));qa.displayName="Checkbox";const jc=({children:e,className:t="",...r})=>c.jsx("table",{className:t,...r,children:e}),Bc=({children:e,className:t="",...r})=>c.jsx("thead",{className:t,...r,children:e}),Wc=({children:e,className:t="",...r})=>c.jsx("tbody",{className:t,...r,children:e}),Kc=({children:e,className:t="",...r})=>c.jsx("tr",{className:t,...r,children:e}),Vc=({children:e,className:t="",...r})=>c.jsx("th",{className:t,...r,children:e}),Yc=({children:e,className:t="",...r})=>c.jsx("td",{className:t,...r,children:e}),$r=k.forwardRef(({children:e,className:t="",...r},n)=>c.jsx("nav",{ref:n,className:t,...r,children:e}));$r.displayName="Nav";const Za=({children:e,className:t="",...r})=>c.jsx("section",{className:t,...r,children:e}),Xc=({children:e,className:t="",...r})=>c.jsx("code",{className:t,...r,children:e}),lo=k.forwardRef(({className:e="",...t},r)=>c.jsx("hr",{ref:r,className:e,...t})),qc=k.forwardRef(({children:e,className:t="",...r},n)=>c.jsx("header",{ref:n,className:t,...r,children:e})),Qa=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,io=e=>{const t=Qa(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Zc=()=>{const e=localStorage.getItem("g7_color_scheme");return e&&["auto","light","dark"].includes(e)?e:"auto"},hn=({onThemeChange:e,className:t="",autoText:r="System",lightText:n="Light",darkText:o="Dark",id:a,editorAttrs:s})=>{const l=Zc(),[f,h]=k.useState(l),[d,i]=k.useState(!1),u=k.useRef(null);k.useEffect(()=>{io(f)},[]),k.useEffect(()=>{if(f!=="auto")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),w=()=>{io("auto")};return m.addEventListener("change",w),()=>m.removeEventListener("change",w)},[f]),k.useEffect(()=>{const m=w=>{u.current&&!u.current.contains(w.target)&&i(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const g=m=>{h(m),localStorage.setItem("g7_color_scheme",m),io(m),i(!1),e?.(m)},p=()=>Qa(f)==="dark"?Je.Moon:Je.Sun;return c.jsxs(W,{ref:u,className:`relative ${t}`,id:a,...s,children:[c.jsx(Q,{onClick:()=>i(!d),className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors text-gray-600 dark:text-gray-400","aria-label":"Toggle theme",children:c.jsx(de,{name:p(),className:"w-5 h-5"})}),d&&c.jsx(W,{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:c.jsxs(W,{className:"py-2",children:[c.jsxs(Q,{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
|
||
${f==="auto"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[c.jsx(de,{name:Je.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),c.jsx(ee,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),f==="auto"&&c.jsx(de,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),c.jsxs(Q,{onClick:()=>g("light"),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
|
||
${f==="light"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[c.jsx(de,{name:Je.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),c.jsx(ee,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),f==="light"&&c.jsx(de,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),c.jsxs(Q,{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
|
||
${f==="dark"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[c.jsx(de,{name:Je.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),c.jsx(ee,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),f==="dark"&&c.jsx(de,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Qc=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:hn,default:hn},Symbol.toStringTag,{value:"Module"})),Ja={xs:"w-6 h-6 text-xs",sm:"w-8 h-8 text-sm",md:"w-10 h-10 text-base",lg:"w-12 h-12 text-lg",xl:"w-16 h-16 text-xl","2xl":"w-24 h-24 text-2xl","3xl":"w-32 h-32 text-3xl","4xl":"w-40 h-40 text-4xl","5xl":"w-48 h-48 text-5xl"},Jc="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",Rc="grayscale opacity-50",co={normal:"bg-gradient-to-br from-blue-500 to-purple-600",withdrawn:"bg-gray-300 dark:bg-gray-600",guest:"bg-gray-200 dark:bg-gray-700"},Ur=({author:e,name:t,avatar:r,size:n="md",className:o="",text:a,isWithdrawn:s=!1,isGuest:l=!1,id:f,editorAttrs:h})=>{const d=r??e?.avatar,i=a??t??e?.name??"?",u=s||e?.status==="withdrawn",g=l||e?.is_guest||!1,p=k.useMemo(()=>[Ja[n]||Ja.md,Jc,u?Rc:"",o].filter(Boolean).join(" "),[n,u,o]),m=g?co.guest:u?co.withdrawn:co.normal,w=()=>g?c.jsx(W,{className:`w-full h-full flex items-center justify-center ${m}`,children:c.jsx(de,{name:"user",className:"text-gray-400 dark:text-gray-500"})}):u?c.jsx(W,{className:`w-full h-full flex items-center justify-center ${m}`,children:c.jsx(de,{name:"user",className:"text-gray-500 dark:text-gray-400"})}):c.jsx(W,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${m}`,children:i.charAt(0).toUpperCase()});return c.jsx(W,{className:p,id:f,...h,children:d&&!g&&!u?c.jsx(Lt,{src:d,alt:i,className:"w-full h-full object-cover"}):w()})},ed=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Ur},Symbol.toStringTag,{value:"Module"})),td=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...e)=>console.log("[Comp:SlotContainer]",...e),warn:(...e)=>console.warn("[Comp:SlotContainer]",...e),error:(...e)=>console.error("[Comp:SlotContainer]",...e)};function Ra(e,t){return t&&e&&typeof e.id=="string"&&e.id.length>0?{...e,id:`${e.id}__${t}`}:e}const pn=({slotId:e,className:t="",emptyContent:r,style:n,id:o,children:a})=>{const[s,l]=k.useState([]),[,f]=k.useState({}),h=k.useCallback(()=>{const p=window.__slotContextValue;if(p)return p;const m=window.G7Core;return m&&m.getSlotContext?.()||null},[]),d=k.useCallback(()=>{const p=h();p&&p.isEnabled&&l(p.getSlotComponents(e))},[e,h]);k.useEffect(()=>{const p=h();return!p||!p.isEnabled?void 0:(d(),p.subscribeToSlot(e,()=>{d(),f({})}))},[e,h,d]);const i=k.useCallback(()=>{const p=window.G7Core;return p?p.getDynamicRenderer?.():null},[]);if(s.length===0)return r?c.jsx(W,{className:t,style:n,id:o,children:r}):a?c.jsx(W,{className:t,style:n,id:o,children:a}):null;const u=i(),g=window.G7Core;return!u||!g?(td.error("G7Core or DynamicRenderer not available"),null):c.jsxs(W,{className:t,style:n,id:o,children:[s.map(p=>{const{componentDef:m,dataContext:w,parentFormContext:x,getParentComponentContext:O,translationContext:y}=p,E=Ra(m,o);return c.jsx(u,{componentDef:E,dataContext:w,translationContext:y,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:O?.(),parentFormContextProp:x,isRootRenderer:!1},E.id||`slot-${e}-${p.order}`)}),a]})},rd=Object.freeze(Object.defineProperty({__proto__:null,SlotContainer:pn,default:pn,scopeSlotChildDef:Ra},Symbol.toStringTag,{value:"Module"})),mn=({notifications:e=[],unreadCount:t=0,hasMore:r=!1,loading:n=!1,titleText:o="알림",emptyText:a="알림이 없습니다.",markAllReadText:s="모두 읽음",deleteAllText:l="모두 삭제",unreadOnlyText:f="안 읽은 알림만",unreadOnly:h=!1,onNotificationClick:d,onClose:i,onLoadMore:u,onMarkAllRead:g,onDeleteAll:p,onDelete:m,onUnreadOnlyToggle:w,dropdownAlign:x="right",className:O="",id:y,editorAttrs:E})=>{const[M,_]=k.useState(!1),I=k.useRef(null),C=k.useRef(null),v=k.useRef(null),N=k.useRef(null),A=k.useRef(new Set),P=k.useRef(u),D=k.useRef(r),L=k.useRef(n),U=k.useRef(e.length),S=k.useRef(-1);k.useEffect(()=>{P.current=u,D.current=r,L.current=n,U.current=e.length}),k.useEffect(()=>{if(!N.current||!v.current||!M)return;S.current=-1;const G=new IntersectionObserver(([Y])=>{Y.isIntersecting&&(L.current||!D.current||S.current!==U.current&&(S.current=U.current,P.current?.()))},{root:v.current,threshold:.1});return G.observe(N.current),()=>G.disconnect()},[M]),k.useEffect(()=>{if(!v.current||!M)return;const G=new IntersectionObserver(B=>{B.forEach(V=>{const j=V.target.getAttribute("data-notification-id"),H=V.target.getAttribute("data-unread")==="true";j&&H&&V.isIntersecting&&A.current.add(j)})},{root:v.current,threshold:.5});return v.current.querySelectorAll("[data-notification-id]").forEach(B=>G.observe(B)),()=>G.disconnect()},[M,e]);const b=t>0?t:e.filter(G=>!G.read).length,$=k.useCallback(()=>{if(M){if(b>0){const G=Array.from(A.current).filter(Y=>{const B=e.find(V=>String(V.id)===String(Y));return B&&!B.read});G.length>0&&i?.(G)}A.current.clear(),_(!1)}},[M,i,b,e]);k.useEffect(()=>{if(!M)return;const G=Y=>{I.current&&!I.current.contains(Y.target)&&$()};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[M,$]);const F=k.useCallback(()=>{M?$():_(!0)},[M,$]);return k.useLayoutEffect(()=>{const G=C.current;if(!M||!G)return;G.style.transform="";const Y=G.getBoundingClientRect(),B=typeof window<"u"?window.innerWidth:0;if(Y.width===0&&Y.height===0)return;const V=8;let j=0;Y.right>B-V?j=-(Y.right-(B-V)):Y.left<V&&(j=V-Y.left),j!==0&&(G.style.transform=`translateX(${j}px)`)},[M,x,e.length]),c.jsxs(W,{ref:I,className:`relative ${O}`,id:y,...E,children:[c.jsxs(Q,{onClick:F,className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors cursor-pointer","aria-label":o,children:[c.jsx(de,{name:Je.Bell,className:"w-5 h-5"}),b>0&&c.jsx(ee,{className:"absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:b>99?"99+":b})]}),M&&c.jsxs(W,{ref:C,className:`absolute ${x==="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:[c.jsxs(W,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[c.jsxs(W,{className:"flex items-center gap-3 min-w-0",children:[c.jsx(ee,{className:"font-semibold text-gray-900 dark:text-white",children:o}),w&&c.jsxs(W,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>w(!h),children:[c.jsx(xt,{type:"checkbox",checked:h,onChange:G=>{G.stopPropagation(),w(G.target.checked)},onClick:G=>G.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"}),c.jsx(ee,{className:"text-xs text-gray-600 dark:text-gray-400",children:f})]})]}),c.jsxs(W,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&b>0&&c.jsx(Q,{onClick:()=>{g(),A.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:s}),p&&e.length>0&&c.jsx(Q,{onClick:()=>{p()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:l})]})]}),c.jsx(W,{ref:v,className:"max-h-96 overflow-y-auto",children:e.length===0&&!n?c.jsx(W,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:c.jsx(ee,{children:a})}):c.jsxs(c.Fragment,{children:[e.map(G=>{const Y=!G.read;return c.jsxs(W,{"data-notification-id":G.id,"data-unread":Y?"true":"false",onClick:()=>{G.onClick?.(),d?.(G),_(!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 ${Y?"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:[G.iconName&&c.jsx(de,{name:G.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${Y?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),c.jsxs(W,{className:"flex-1 min-w-0",children:[c.jsx(W,{className:`text-sm truncate ${Y?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:G.title}),c.jsx(W,{className:`text-sm mt-1 line-clamp-2 ${Y?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:G.message}),c.jsx(W,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:G.time})]}),c.jsxs(W,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[Y&&c.jsx(ee,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),m&&c.jsx(Q,{onClick:B=>{B.stopPropagation(),m(G)},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:c.jsx(de,{name:Je.Trash,className:"w-4 h-4"})})]})]},G.id)}),r&&c.jsx(W,{ref:N,className:"px-4 py-3 text-center",children:n?c.jsx(ee,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):c.jsx(ee,{className:"text-sm text-gray-400 dark:text-gray-500"})}),n&&!r&&e.length>0&&c.jsx(W,{className:"px-4 py-2 text-center",children:c.jsx(ee,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},nd=Object.freeze(Object.defineProperty({__proto__:null,NotificationCenter:mn,default:mn},Symbol.toStringTag,{value:"Module"})),Xe=(e,t)=>window.G7Core?.t?.(e,t)??e,pt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},es=({logo:e,siteName:t="그누보드7",user:r,cartCount:n=0,notificationCount:o=0,boards:a=[],maxVisibleBoards:s=5,onMobileMenuOpen:l,availableLocales:f=[],currentLocale:h="ko",shopBase:d="/shop",className:i="",editorAttrs:u,notifications:g=[],notificationHasMore:p=!1,notificationLoading:m=!1,notificationUnreadOnly:w=!1,notificationTitleText:x,notificationEmptyText:O,notificationMarkAllReadText:y,notificationDeleteAllText:E,notificationUnreadOnlyText:M,onNotificationClose:_,onNotificationClick:I,onNotificationLoadMore:C,onNotificationMarkAllRead:v,onNotificationDeleteAll:N,onNotificationDelete:A,onNotificationUnreadOnlyToggle:P})=>{const[D,L]=k.useState(""),[U,S]=k.useState(!1),[b,$]=k.useState(!1),[F,G]=k.useState(!1),[Y,B]=k.useState({top:0,left:0}),[V,j]=k.useState(window.location.pathname),H=k.useRef(null),q=k.useRef(null),ue=k.useRef(null),fe=window.G7Core?.useResponsive,R=fe?.(),ke=R?R.width<768:typeof window<"u"&&window.innerWidth<768;k.useEffect(()=>{const K=()=>j(window.location.pathname);window.addEventListener("popstate",K);const re=history.pushState;return history.pushState=function(...oe){re.apply(this,oe),j(window.location.pathname)},()=>{window.removeEventListener("popstate",K),history.pushState=re}},[]);const me=(K,re=!1)=>re?V===K:V===K||V.startsWith(K+"/"),Ge=()=>{const K=d==="/"?"":d;return V.startsWith(`${K}/products`)||V.startsWith(`${K}/cart`)||V.startsWith(`${K}/checkout`)||V.startsWith(`${K}/category`)},De=K=>{const re="px-3 py-2 text-sm font-medium whitespace-nowrap cursor-pointer rounded-lg transition-colors";return K?`${re} bg-gray-900 text-white dark:bg-white dark:text-gray-900`:`${re} text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800`};k.useEffect(()=>{const K=re=>{H.current&&!H.current.contains(re.target)&&S(!1),q.current&&!q.current.contains(re.target)&&$(!1),ue.current&&!ue.current.contains(re.target)&&G(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const ye=a.slice(0,s),Me=a.slice(s),Ce=K=>{K.preventDefault(),D.trim()&&pt(`/search?q=${encodeURIComponent(D)}`)},we=async()=>{window.G7Core?.dispatch?.({handler:"logout"})},$e=K=>{window.G7Core?.dispatch?.({handler:"setLocale",target:K}),G(!1)},Le=K=>window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[K]??(K==="ko"?"한국어":K==="en"?"English":K==="ja"?"日本語":K==="zh"?"中文":K==="es"?"Español":K==="fr"?"Français":K==="de"?"Deutsch":K.toUpperCase());return c.jsxs(qc,{...u??{},className:`sticky top-0 z-50 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 ${i}`,children:[c.jsx(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:c.jsxs(W,{className:"flex items-center justify-between h-16",children:[c.jsx(Q,{onClick:()=>pt("/"),className:"flex items-center gap-2 flex-shrink-0 cursor-pointer",children:e?c.jsx(Lt,{src:e,alt:t,className:"h-8"}):c.jsx(ee,{className:"text-xl font-bold text-gray-900 dark:text-white",children:t})}),!ke&&c.jsx(so,{onSubmit:Ce,className:"flex flex-1 max-w-lg mx-8",children:c.jsxs(W,{className:"relative w-full",children:[c.jsx(xt,{type:"text",value:D,onChange:K=>L(K.target.value),placeholder:Xe("common.search_placeholder"),className:"w-full px-4 py-2 pl-10 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),c.jsx(de,{name:"search",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500"})]})}),c.jsxs(W,{className:"flex items-center gap-2",children:[c.jsx(hn,{autoText:Xe("common.theme.auto"),lightText:Xe("common.theme.light"),darkText:Xe("common.theme.dark")}),r?.uuid&&c.jsx(mn,{notifications:g,unreadCount:o,hasMore:p,loading:m,unreadOnly:w,titleText:x??Xe("mypage.notifications.title"),emptyText:O??Xe("mypage.notifications.empty"),markAllReadText:y??Xe("mypage.notifications.mark_all_read"),deleteAllText:E??Xe("mypage.notifications.delete_all"),unreadOnlyText:M??Xe("mypage.notifications.unread_only"),onClose:_,onNotificationClick:I,onLoadMore:C,onMarkAllRead:v,onDeleteAll:N,onDelete:A,onUnreadOnlyToggle:P,dropdownAlign:"right"}),c.jsxs(Q,{onClick:()=>pt(`${d}/cart`),className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:[c.jsx(de,{name:"shopping-cart",className:"w-5 h-5"}),n>0&&c.jsx(ee,{className:"absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs bg-blue-500 text-white rounded-full",children:n>99?"99+":n})]}),f&&f.length>1&&c.jsxs(W,{ref:ue,className:"relative",children:[c.jsxs(Q,{onClick:()=>G(!F),className:"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 cursor-pointer transition-colors","aria-haspopup":"listbox","aria-expanded":F,"aria-label":Xe("common.language"),children:[c.jsx(de,{name:"globe",className:"w-4 h-4"}),c.jsx(ee,{className:"font-medium uppercase",children:h}),c.jsx(de,{name:"chevron-down",className:"w-3 h-3"})]}),F&&c.jsx(W,{role:"listbox",className:"absolute right-0 mt-2 w-44 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50 overflow-hidden",children:f.map(K=>{const re=K===h;return c.jsxs(Q,{role:"option","aria-selected":re,onClick:()=>$e(K),className:`w-full px-4 py-2.5 text-left text-sm flex items-center gap-3 cursor-pointer transition-colors ${re?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[c.jsx(de,{name:"globe",className:"w-4 h-4"}),c.jsx(ee,{className:"flex-1 font-medium",children:Le(K)}),re&&c.jsx(de,{name:"check",className:"w-4 h-4"})]},K)})})]}),c.jsx(pn,{slotId:"header_currency",id:"header_currency_slot_desktop",className:"flex items-center"}),r?.uuid?c.jsxs(W,{ref:H,className:"relative",children:[c.jsxs(Q,{onClick:()=>S(!U),className:"flex items-center gap-2 p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white",children:[c.jsx(Ur,{avatar:r.avatar,name:r.name,size:"sm"}),c.jsx(ee,{className:"hidden sm:inline text-sm font-medium",children:r.name}),c.jsx(de,{name:"chevron-down",className:"w-4 h-4"})]}),U&&c.jsxs(W,{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 py-1 z-50",children:[c.jsx(W,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:c.jsxs(W,{className:"flex items-center gap-3",children:[c.jsx(Ur,{avatar:r.avatar,name:r.name,size:"md"}),c.jsxs(W,{children:[c.jsx(W,{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),c.jsx(W,{className:"text-xs text-gray-500 dark:text-gray-400",children:Xe("common.member")})]})]})}),c.jsxs(W,{className:"py-1",children:[r.is_admin&&c.jsxs(c.Fragment,{children:[c.jsxs(ao,{href:"/admin",className:"block w-full text-left px-4 py-2 text-sm text-blue-600 dark:text-blue-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer font-medium",children:[c.jsx(de,{name:"settings",className:"inline w-4 h-4 mr-2"}),Xe("common.admin_menu")]}),c.jsx(lo,{className:"my-1 border-gray-200 dark:border-gray-700"})]}),c.jsxs(Q,{onClick:()=>{pt("/mypage"),S(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[c.jsx(de,{name:"user",className:"inline w-4 h-4 mr-2"}),Xe("common.mypage")]}),c.jsxs(Q,{onClick:()=>{pt("/mypage/orders"),S(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[c.jsx(de,{name:"shopping-bag",className:"inline w-4 h-4 mr-2"}),Xe("mypage.tabs.orders")]}),c.jsxs(Q,{onClick:()=>{pt("/mypage/wishlist"),S(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[c.jsx(de,{name:"heart",className:"inline w-4 h-4 mr-2"}),Xe("mypage.tabs.wishlist")]})]}),c.jsx(lo,{className:"my-1 border-gray-200 dark:border-gray-700"}),c.jsxs(Q,{onClick:we,className:"block w-full text-left px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[c.jsx(de,{name:"log-out",className:"inline w-4 h-4 mr-2"}),Xe("auth.logout")]})]})]}):c.jsxs(W,{className:"flex items-center gap-1.5",children:[c.jsx(Q,{onClick:()=>pt("/login?redirect=/mypage/orders"),className:"px-2.5 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:Xe("shop.guest_order_form.nav_link")}),c.jsx(Q,{onClick:()=>pt("/login"),className:"px-2.5 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:Xe("auth.login")}),c.jsx(Q,{onClick:()=>pt("/register"),className:"ml-1 px-3 py-2 text-sm font-medium text-white bg-emerald-500 rounded-lg hover:bg-emerald-600 cursor-pointer",children:Xe("auth.register_link")})]}),ke&&c.jsx(Q,{onClick:l,className:"p-2 text-gray-600 dark:text-gray-400",children:c.jsx(de,{name:"menu",className:"w-6 h-6"})})]})]})}),!ke&&c.jsx($r,{className:"border-t border-gray-200 dark:border-gray-800",children:c.jsx(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:c.jsxs(W,{className:"flex items-center gap-1 h-12 overflow-x-auto",children:[c.jsx(Q,{onClick:()=>pt("/"),className:De(me("/",!0)),"data-testid":"nav-home",children:Xe("nav.home")}),c.jsxs(Q,{onClick:()=>pt("/boards/popular"),className:`flex items-center gap-1 ${De(me("/boards/popular"))}`,"data-testid":"nav-popular",children:[c.jsx(ee,{className:"text-orange-500",children:"🔥"}),Xe("nav.popular")]}),c.jsxs(Q,{onClick:()=>pt(`${d==="/"?"":d}/products`),className:`flex items-center gap-1 ${De(Ge())}`,"data-testid":"nav-shop",children:[c.jsx(ee,{children:"🛒"}),Xe("nav.shop")]}),ye.map(K=>c.jsxs(Q,{onClick:()=>pt(`/board/${K.slug}`),className:De(me(`/board/${K.slug}`)),children:[K.icon&&c.jsx(ee,{className:"mr-1",children:K.icon}),K.name]},K.id)),Me.length>0&&c.jsxs(W,{ref:q,className:"relative",children:[c.jsxs(Q,{onClick:()=>{if(!b&&q.current){const K=q.current.getBoundingClientRect();B({top:K.bottom+4,left:K.left})}$(!b)},className:"flex items-center gap-1 px-3 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white",children:[Xe("nav.more"),c.jsx(de,{name:"chevron-down",className:"w-4 h-4"})]}),b&&c.jsx(W,{className:"fixed w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-50",style:{top:`${Y.top}px`,left:`${Y.left}px`},children:Me.map(K=>{const re=me(`/board/${K.slug}`);return c.jsxs(Q,{onClick:()=>{pt(`/board/${K.slug}`),$(!1)},className:`block w-full text-left px-4 py-2 text-sm cursor-pointer ${re?"bg-gray-900 text-white dark:bg-white dark:text-gray-900":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[K.icon&&c.jsx(ee,{className:"mr-1",children:K.icon}),K.name]},K.id)})})]})]})})})]})},od=Object.freeze(Object.defineProperty({__proto__:null,default:es},Symbol.toStringTag,{value:"Module"})),ad=k.forwardRef(({children:e,className:t="",...r},n)=>c.jsx("footer",{ref:n,className:t,...r,children:e})),kt=(e,t)=>window.G7Core?.t?.(e,t)??e,sd=768,ts=1024,ld=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},rs=({siteName:e="그누보드7",siteDescription:t,copyrightText:r,socialLinks:n={},linkGroups:o,className:a="",editorAttrs:s})=>{const l=new Date().getFullYear(),h=window.G7Core?.useResponsive,i=h?.()?.width??(typeof window<"u"?window.innerWidth:ts),u=i<sd,g=i>=ts,p=u?1:g?5:2,m=[{title:kt("footer.community"),links:[{label:kt("nav.home"),href:"/"},{label:kt("nav.popular"),href:"/boards/popular"},{label:kt("footer.all_boards"),href:"/boards"}]},{title:kt("footer.info"),links:[{label:kt("footer.about"),href:"/page/about"},{label:kt("footer.faq"),href:"/page/faq"},{label:kt("footer.contact"),href:"/page/contact"}]},{title:kt("footer.policy"),links:[{label:kt("footer.terms"),href:"/page/terms"},{label:kt("footer.privacy"),href:"/page/privacy"},{label:kt("footer.refund"),href:"/page/refund"}]}],w=o||m,x={github:"github",twitter:"twitter",discord:"discord",facebook:"facebook",instagram:"instagram"};return c.jsx(ad,{...s??{},className:`bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 ${a}`,children:c.jsxs(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[c.jsxs(W,{className:"grid gap-8",style:{gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`},children:[c.jsxs(W,{style:g?{gridColumn:"span 2 / span 2"}:void 0,children:[c.jsx(gn,{className:"text-lg font-bold text-gray-900 dark:text-white",children:e}),t&&c.jsx(Dt,{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:t}),c.jsx(W,{className:"mt-4 flex items-center gap-4",children:Object.entries(n).map(([O,y])=>y?c.jsx(ao,{href:y,target:"_blank",rel:"noopener noreferrer",className:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":O,children:c.jsx(de,{name:x[O],className:"w-5 h-5"})},O):null)})]}),w.map((O,y)=>c.jsxs(W,{children:[c.jsx(Ya,{className:"text-sm font-semibold text-gray-900 dark:text-white uppercase tracking-wider",children:O.title}),c.jsx(oo,{className:"mt-4 space-y-2",children:O.links.map((E,M)=>c.jsx(Xt,{children:c.jsx(Q,{onClick:()=>ld(E.href),className:"text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:E.label})},M))})]},y))]}),c.jsxs(W,{className:"mt-8 pt-8 border-t border-gray-200 dark:border-gray-800 flex justify-between items-center gap-4",style:{flexDirection:u?"column":"row"},children:[c.jsx(Dt,{className:"text-sm text-gray-500 dark:text-gray-400",children:r||`© ${l} ${e}. All rights reserved.`}),c.jsx(Dt,{className:"text-sm text-gray-500 dark:text-gray-400",children:kt("footer.powered_by")})]})]})})},id=Object.freeze(Object.defineProperty({__proto__:null,default:rs},Symbol.toStringTag,{value:"Module"})),Pt=(e,t)=>window.G7Core?.t?.(e,t)??e,Tt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ns=({isOpen:e,onClose:t,logo:r,siteName:n="그누보드7",user:o,boards:a=[],cartCount:s=0})=>{const l=k.useRef(null),h=window.G7Core?.useResponsive,d=h?.(),i=d?d.width<1024:typeof window<"u"&&window.innerWidth<1024;k.useEffect(()=>{const g=p=>{p.key==="Escape"&&t()};return e&&(document.addEventListener("keydown",g),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",g),document.body.style.overflow=""}},[e,t]);const u=g=>{g.target===g.currentTarget&&t()};return!e||!i?null:c.jsxs(W,{className:"fixed inset-0 z-50",onClick:u,children:[c.jsx(W,{className:"fixed inset-0 bg-black/50 transition-opacity"}),c.jsxs(W,{ref:l,className:`fixed inset-y-0 left-0 w-80 max-w-[85vw] bg-white dark:bg-gray-900 shadow-xl transform transition-transform duration-300 ${e?"translate-x-0":"-translate-x-full"}`,children:[c.jsxs(W,{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[c.jsx(Q,{onClick:()=>{t(),Tt("/")},className:"flex items-center gap-2 cursor-pointer",children:r?c.jsx(Lt,{src:r,alt:n,className:"h-8"}):c.jsx(ee,{className:"text-xl font-bold text-gray-900 dark:text-white",children:n})}),c.jsx(Q,{onClick:t,className:"p-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","aria-label":"메뉴 닫기",children:c.jsx(de,{name:"x",className:"w-6 h-6"})})]}),o?c.jsx(W,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:c.jsxs(W,{className:"flex items-center gap-3",children:[o.avatar?c.jsx(Lt,{src:o.avatar,alt:o.name,className:"w-12 h-12 rounded-full"}):c.jsx(W,{className:"w-12 h-12 rounded-full bg-blue-500 flex items-center justify-center text-white text-lg font-medium",children:(o.name||"U").charAt(0).toUpperCase()}),c.jsxs(W,{children:[c.jsx(Dt,{className:"font-medium text-gray-900 dark:text-white",children:o.name}),c.jsx(Q,{onClick:()=>{t(),Tt("/mypage")},className:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:Pt("common.mypage")})]})]})}):c.jsx(W,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:c.jsxs(W,{className:"flex gap-2",children:[c.jsx(Q,{onClick:()=>{t(),Tt("/login")},className:"flex-1 py-2 text-center text-sm font-medium text-white bg-gray-900 dark:bg-white dark:text-gray-900 rounded-lg cursor-pointer",children:Pt("auth.login")}),c.jsx(Q,{onClick:()=>{t(),Tt("/register")},className:"flex-1 py-2 text-center text-sm font-medium text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer",children:Pt("auth.register")})]})}),c.jsx($r,{className:"p-4 overflow-y-auto max-h-[calc(100vh-200px)]",children:c.jsxs(oo,{className:"space-y-1",children:[c.jsx(Xt,{children:c.jsxs(Q,{onClick:()=>{t(),Tt("/")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[c.jsx(de,{name:"home",className:"w-5 h-5"}),Pt("nav.home")]})}),c.jsx(Xt,{children:c.jsxs(Q,{onClick:()=>{t(),Tt("/popular")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[c.jsx(ee,{className:"text-orange-500",children:"🔥"}),Pt("nav.popular")]})}),c.jsx(Xt,{children:c.jsxs(Q,{onClick:()=>{t(),Tt("/shop")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[c.jsx(ee,{children:"🛒"}),Pt("nav.shop")]})}),c.jsx(Xt,{children:c.jsxs(Q,{onClick:()=>{t(),Tt("/cart")},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[c.jsx(de,{name:"shopping-cart",className:"w-5 h-5"}),Pt("nav.cart"),s>0&&c.jsx(ee,{className:"ml-auto px-2 py-0.5 text-xs bg-blue-500 text-white rounded-full",children:s})]})}),c.jsx(Xt,{className:"my-4 border-t border-gray-200 dark:border-gray-800"}),c.jsx(Xt,{className:"px-3 py-2 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider",children:Pt("nav.boards")}),a.map(g=>c.jsx(Xt,{children:c.jsxs(Q,{onClick:()=>{t(),Tt(`/board/${g.slug}`)},className:"flex items-center gap-3 px-3 py-2 w-full text-left text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer",children:[g.icon&&c.jsx(ee,{children:g.icon}),g.name]})},g.id))]})}),c.jsx(W,{className:"absolute bottom-0 left-0 right-0 p-4 border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900",children:c.jsxs(W,{className:"flex items-center justify-between text-sm text-gray-500 dark:text-gray-400",children:[c.jsx(Q,{onClick:()=>{t(),Tt("/about")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Pt("footer.about")}),c.jsx(Q,{onClick:()=>{t(),Tt("/terms")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Pt("footer.terms")}),c.jsx(Q,{onClick:()=>{t(),Tt("/privacy")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Pt("footer.privacy")})]})})]})]})},cd=Object.freeze(Object.defineProperty({__proto__:null,default:ns},Symbol.toStringTag,{value:"Module"}));const{entries:os,setPrototypeOf:as,isFrozen:dd,getPrototypeOf:ud,getOwnPropertyDescriptor:fd}=Object;let{freeze:ft,seal:Nt,create:uo}=Object,{apply:fo,construct:go}=typeof Reflect<"u"&&Reflect;ft||(ft=function(t){return t}),Nt||(Nt=function(t){return t}),fo||(fo=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),a=2;a<n;a++)o[a-2]=arguments[a];return t.apply(r,o)}),go||(go=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return new t(...n)});const bn=ht(Array.prototype.forEach),gd=ht(Array.prototype.lastIndexOf),ss=ht(Array.prototype.pop),zr=ht(Array.prototype.push),hd=ht(Array.prototype.splice),yn=ht(String.prototype.toLowerCase),ho=ht(String.prototype.toString),po=ht(String.prototype.match),Hr=ht(String.prototype.replace),pd=ht(String.prototype.indexOf),md=ht(String.prototype.trim),Ft=ht(Object.prototype.hasOwnProperty),gt=ht(RegExp.prototype.test),Gr=bd(TypeError);function ht(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return fo(e,t,n)}}function bd(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return go(e,r)}}function Ae(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yn;as&&as(e,null);let n=t.length;for(;n--;){let o=t[n];if(typeof o=="string"){const a=r(o);a!==o&&(dd(t)||(t[n]=a),o=a)}e[o]=!0}return e}function yd(e){for(let t=0;t<e.length;t++)Ft(e,t)||(e[t]=null);return e}function Kt(e){const t=uo(null);for(const[r,n]of os(e))Ft(e,r)&&(Array.isArray(n)?t[r]=yd(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=Kt(n):t[r]=n);return t}function jr(e,t){for(;e!==null;){const n=fd(e,t);if(n){if(n.get)return ht(n.get);if(typeof n.value=="function")return ht(n.value)}e=ud(e)}function r(){return null}return r}const ls=ft(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),mo=ft(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bo=ft(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),vd=ft(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),yo=ft(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),wd=ft(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),is=ft(["#text"]),cs=ft(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),vo=ft(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ds=ft(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),vn=ft(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xd=Nt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),kd=Nt(/<%[\w\W]*|[\w\W]*%>/gm),Cd=Nt(/\$\{[\w\W]*/gm),Sd=Nt(/^data-[\-\w.\u00B7-\uFFFF]+$/),_d=Nt(/^aria-[\-\w]+$/),us=Nt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ed=Nt(/^(?:\w+script|data):/i),Td=Nt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fs=Nt(/^html$/i),Nd=Nt(/^[a-z][.\w]*(-[.\w]+)+$/i);var gs=Object.freeze({__proto__:null,ARIA_ATTR:_d,ATTR_WHITESPACE:Td,CUSTOM_ELEMENT:Nd,DATA_ATTR:Sd,DOCTYPE_NAME:fs,ERB_EXPR:kd,IS_ALLOWED_URI:us,IS_SCRIPT_OR_DATA:Ed,MUSTACHE_EXPR:xd,TMPLIT_EXPR:Cd});const Br={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ad=function(){return typeof window>"u"?null:window},Md=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(n=r.getAttribute(o));const a="dompurify"+(n?"#"+n:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},hs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ps(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ad();const t=ge=>ps(ge);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Br.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,o=n.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:f,NodeFilter:h,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:i,DOMParser:u,trustedTypes:g}=e,p=f.prototype,m=jr(p,"cloneNode"),w=jr(p,"remove"),x=jr(p,"nextSibling"),O=jr(p,"childNodes"),y=jr(p,"parentNode");if(typeof s=="function"){const ge=r.createElement("template");ge.content&&ge.content.ownerDocument&&(r=ge.content.ownerDocument)}let E,M="";const{implementation:_,createNodeIterator:I,createDocumentFragment:C,getElementsByTagName:v}=r,{importNode:N}=n;let A=hs();t.isSupported=typeof os=="function"&&typeof y=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:P,ERB_EXPR:D,TMPLIT_EXPR:L,DATA_ATTR:U,ARIA_ATTR:S,IS_SCRIPT_OR_DATA:b,ATTR_WHITESPACE:$,CUSTOM_ELEMENT:F}=gs;let{IS_ALLOWED_URI:G}=gs,Y=null;const B=Ae({},[...ls,...mo,...bo,...yo,...is]);let V=null;const j=Ae({},[...cs,...vo,...ds,...vn]);let H=Object.seal(uo(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}})),q=null,ue=null;const te=Object.seal(uo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let fe=!0,R=!0,ke=!1,me=!0,Ge=!1,De=!0,ye=!1,Me=!1,Ce=!1,we=!1,$e=!1,Le=!1,K=!0,re=!1;const oe="user-content-";let ae=!0,be=!1,xe={},He=null;const Pe=Ae({},["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 Ke=null;const Oe=Ae({},["audio","video","img","source","image","track"]);let X=null;const se=Ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",le="http://www.w3.org/2000/svg",ne="http://www.w3.org/1999/xhtml";let Te=ne,ve=!1,Se=null;const _e=Ae({},[ie,le,ne],ho);let Ue=Ae({},["mi","mo","mn","ms","mtext"]),je=Ae({},["annotation-xml"]);const Ee=Ae({},["title","style","font","a","script"]);let he=null;const Ne=["application/xhtml+xml","text/html"],Ve="text/html";let Fe=null,Be=null;const Ze=r.createElement("form"),qt=function(z){return z instanceof RegExp||z instanceof Function},qe=function(){let z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Be&&Be===z)){if((!z||typeof z!="object")&&(z={}),z=Kt(z),he=Ne.indexOf(z.PARSER_MEDIA_TYPE)===-1?Ve:z.PARSER_MEDIA_TYPE,Fe=he==="application/xhtml+xml"?ho:yn,Y=Ft(z,"ALLOWED_TAGS")?Ae({},z.ALLOWED_TAGS,Fe):B,V=Ft(z,"ALLOWED_ATTR")?Ae({},z.ALLOWED_ATTR,Fe):j,Se=Ft(z,"ALLOWED_NAMESPACES")?Ae({},z.ALLOWED_NAMESPACES,ho):_e,X=Ft(z,"ADD_URI_SAFE_ATTR")?Ae(Kt(se),z.ADD_URI_SAFE_ATTR,Fe):se,Ke=Ft(z,"ADD_DATA_URI_TAGS")?Ae(Kt(Oe),z.ADD_DATA_URI_TAGS,Fe):Oe,He=Ft(z,"FORBID_CONTENTS")?Ae({},z.FORBID_CONTENTS,Fe):Pe,q=Ft(z,"FORBID_TAGS")?Ae({},z.FORBID_TAGS,Fe):Kt({}),ue=Ft(z,"FORBID_ATTR")?Ae({},z.FORBID_ATTR,Fe):Kt({}),xe=Ft(z,"USE_PROFILES")?z.USE_PROFILES:!1,fe=z.ALLOW_ARIA_ATTR!==!1,R=z.ALLOW_DATA_ATTR!==!1,ke=z.ALLOW_UNKNOWN_PROTOCOLS||!1,me=z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ge=z.SAFE_FOR_TEMPLATES||!1,De=z.SAFE_FOR_XML!==!1,ye=z.WHOLE_DOCUMENT||!1,we=z.RETURN_DOM||!1,$e=z.RETURN_DOM_FRAGMENT||!1,Le=z.RETURN_TRUSTED_TYPE||!1,Ce=z.FORCE_BODY||!1,K=z.SANITIZE_DOM!==!1,re=z.SANITIZE_NAMED_PROPS||!1,ae=z.KEEP_CONTENT!==!1,be=z.IN_PLACE||!1,G=z.ALLOWED_URI_REGEXP||us,Te=z.NAMESPACE||ne,Ue=z.MATHML_TEXT_INTEGRATION_POINTS||Ue,je=z.HTML_INTEGRATION_POINTS||je,H=z.CUSTOM_ELEMENT_HANDLING||{},z.CUSTOM_ELEMENT_HANDLING&&qt(z.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=z.CUSTOM_ELEMENT_HANDLING.tagNameCheck),z.CUSTOM_ELEMENT_HANDLING&&qt(z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=z.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),z.CUSTOM_ELEMENT_HANDLING&&typeof z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=z.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ge&&(R=!1),$e&&(we=!0),xe&&(Y=Ae({},is),V=[],xe.html===!0&&(Ae(Y,ls),Ae(V,cs)),xe.svg===!0&&(Ae(Y,mo),Ae(V,vo),Ae(V,vn)),xe.svgFilters===!0&&(Ae(Y,bo),Ae(V,vo),Ae(V,vn)),xe.mathMl===!0&&(Ae(Y,yo),Ae(V,ds),Ae(V,vn))),z.ADD_TAGS&&(typeof z.ADD_TAGS=="function"?te.tagCheck=z.ADD_TAGS:(Y===B&&(Y=Kt(Y)),Ae(Y,z.ADD_TAGS,Fe))),z.ADD_ATTR&&(typeof z.ADD_ATTR=="function"?te.attributeCheck=z.ADD_ATTR:(V===j&&(V=Kt(V)),Ae(V,z.ADD_ATTR,Fe))),z.ADD_URI_SAFE_ATTR&&Ae(X,z.ADD_URI_SAFE_ATTR,Fe),z.FORBID_CONTENTS&&(He===Pe&&(He=Kt(He)),Ae(He,z.FORBID_CONTENTS,Fe)),z.ADD_FORBID_CONTENTS&&(He===Pe&&(He=Kt(He)),Ae(He,z.ADD_FORBID_CONTENTS,Fe)),ae&&(Y["#text"]=!0),ye&&Ae(Y,["html","head","body"]),Y.table&&(Ae(Y,["tbody"]),delete q.tbody),z.TRUSTED_TYPES_POLICY){if(typeof z.TRUSTED_TYPES_POLICY.createHTML!="function")throw Gr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Gr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=z.TRUSTED_TYPES_POLICY,M=E.createHTML("")}else E===void 0&&(E=Md(g,o)),E!==null&&typeof M=="string"&&(M=E.createHTML(""));ft&&ft(z),Be=z}},jt=Ae({},[...mo,...bo,...vd]),_t=Ae({},[...yo,...wd]),Bt=function(z){let Z=y(z);(!Z||!Z.tagName)&&(Z={namespaceURI:Te,tagName:"template"});const ce=yn(z.tagName),Ye=yn(Z.tagName);return Se[z.namespaceURI]?z.namespaceURI===le?Z.namespaceURI===ne?ce==="svg":Z.namespaceURI===ie?ce==="svg"&&(Ye==="annotation-xml"||Ue[Ye]):!!jt[ce]:z.namespaceURI===ie?Z.namespaceURI===ne?ce==="math":Z.namespaceURI===le?ce==="math"&&je[Ye]:!!_t[ce]:z.namespaceURI===ne?Z.namespaceURI===le&&!je[Ye]||Z.namespaceURI===ie&&!Ue[Ye]?!1:!_t[ce]&&(Ee[ce]||!jt[ce]):!!(he==="application/xhtml+xml"&&Se[z.namespaceURI]):!1},dt=function(z){zr(t.removed,{element:z});try{y(z).removeChild(z)}catch{w(z)}},Et=function(z,Z){try{zr(t.removed,{attribute:Z.getAttributeNode(z),from:Z})}catch{zr(t.removed,{attribute:null,from:Z})}if(Z.removeAttribute(z),z==="is")if(we||$e)try{dt(Z)}catch{}else try{Z.setAttribute(z,"")}catch{}},Wt=function(z){let Z=null,ce=null;if(Ce)z="<remove></remove>"+z;else{const Qe=po(z,/^[\r\n\t ]+/);ce=Qe&&Qe[0]}he==="application/xhtml+xml"&&Te===ne&&(z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+z+"</body></html>");const Ye=E?E.createHTML(z):z;if(Te===ne)try{Z=new u().parseFromString(Ye,he)}catch{}if(!Z||!Z.documentElement){Z=_.createDocument(Te,"template",null);try{Z.documentElement.innerHTML=ve?M:Ye}catch{}}const ut=Z.body||Z.documentElement;return z&&ce&&ut.insertBefore(r.createTextNode(ce),ut.childNodes[0]||null),Te===ne?v.call(Z,ye?"html":"body")[0]:ye?Z.documentElement:ut},nr=function(z){return I.call(z.ownerDocument||z,z,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},mr=function(z){return z instanceof i&&(typeof z.nodeName!="string"||typeof z.textContent!="string"||typeof z.removeChild!="function"||!(z.attributes instanceof d)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function")},_c=function(z){return typeof l=="function"&&z instanceof l};function Zt(ge,z,Z){bn(ge,ce=>{ce.call(t,z,Z,Be)})}const Ec=function(z){let Z=null;if(Zt(A.beforeSanitizeElements,z,null),mr(z))return dt(z),!0;const ce=Fe(z.nodeName);if(Zt(A.uponSanitizeElement,z,{tagName:ce,allowedTags:Y}),De&&z.hasChildNodes()&&!_c(z.firstElementChild)&>(/<[/\w!]/g,z.innerHTML)&>(/<[/\w!]/g,z.textContent)||z.nodeType===Br.progressingInstruction||De&&z.nodeType===Br.comment&>(/<[/\w]/g,z.data))return dt(z),!0;if(!(te.tagCheck instanceof Function&&te.tagCheck(ce))&&(!Y[ce]||q[ce])){if(!q[ce]&&Nc(ce)&&(H.tagNameCheck instanceof RegExp&>(H.tagNameCheck,ce)||H.tagNameCheck instanceof Function&&H.tagNameCheck(ce)))return!1;if(ae&&!He[ce]){const Ye=y(z)||z.parentNode,ut=O(z)||z.childNodes;if(ut&&Ye){const Qe=ut.length;for(let wt=Qe-1;wt>=0;--wt){const Qt=m(ut[wt],!0);Qt.__removalCount=(z.__removalCount||0)+1,Ye.insertBefore(Qt,x(z))}}}return dt(z),!0}return z instanceof f&&!Bt(z)||(ce==="noscript"||ce==="noembed"||ce==="noframes")&>(/<\/no(script|embed|frames)/i,z.innerHTML)?(dt(z),!0):(Ge&&z.nodeType===Br.text&&(Z=z.textContent,bn([P,D,L],Ye=>{Z=Hr(Z,Ye," ")}),z.textContent!==Z&&(zr(t.removed,{element:z.cloneNode()}),z.textContent=Z)),Zt(A.afterSanitizeElements,z,null),!1)},Tc=function(z,Z,ce){if(K&&(Z==="id"||Z==="name")&&(ce in r||ce in Ze))return!1;if(!(R&&!ue[Z]&>(U,Z))){if(!(fe&>(S,Z))){if(!(te.attributeCheck instanceof Function&&te.attributeCheck(Z,z))){if(!V[Z]||ue[Z]){if(!(Nc(z)&&(H.tagNameCheck instanceof RegExp&>(H.tagNameCheck,z)||H.tagNameCheck instanceof Function&&H.tagNameCheck(z))&&(H.attributeNameCheck instanceof RegExp&>(H.attributeNameCheck,Z)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(Z,z))||Z==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&>(H.tagNameCheck,ce)||H.tagNameCheck instanceof Function&&H.tagNameCheck(ce))))return!1}else if(!X[Z]){if(!gt(G,Hr(ce,$,""))){if(!((Z==="src"||Z==="xlink:href"||Z==="href")&&z!=="script"&&pd(ce,"data:")===0&&Ke[z])){if(!(ke&&!gt(b,Hr(ce,$,"")))){if(ce)return!1}}}}}}}return!0},Nc=function(z){return z!=="annotation-xml"&&po(z,F)},Ac=function(z){Zt(A.beforeSanitizeAttributes,z,null);const{attributes:Z}=z;if(!Z||mr(z))return;const ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let Ye=Z.length;for(;Ye--;){const ut=Z[Ye],{name:Qe,namespaceURI:wt,value:Qt}=ut,Fr=Fe(Qe),ja=Qt;let st=Qe==="value"?ja:md(ja);if(ce.attrName=Fr,ce.attrValue=st,ce.keepAttr=!0,ce.forceKeepAttr=void 0,Zt(A.uponSanitizeAttribute,z,ce),st=ce.attrValue,re&&(Fr==="id"||Fr==="name")&&(Et(Qe,z),st=oe+st),De&>(/((--!?|])>)|<\/(style|title|textarea)/i,st)){Et(Qe,z);continue}if(Fr==="attributename"&&po(st,"href")){Et(Qe,z);continue}if(ce.forceKeepAttr)continue;if(!ce.keepAttr){Et(Qe,z);continue}if(!me&>(/\/>/i,st)){Et(Qe,z);continue}Ge&&bn([P,D,L],Oc=>{st=Hr(st,Oc," ")});const Mc=Fe(z.nodeName);if(!Tc(Mc,Fr,st)){Et(Qe,z);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!wt)switch(g.getAttributeType(Mc,Fr)){case"TrustedHTML":{st=E.createHTML(st);break}case"TrustedScriptURL":{st=E.createScriptURL(st);break}}if(st!==ja)try{wt?z.setAttributeNS(wt,Qe,st):z.setAttribute(Qe,st),mr(z)?dt(z):ss(t.removed)}catch{Et(Qe,z)}}Zt(A.afterSanitizeAttributes,z,null)},Gp=function ge(z){let Z=null;const ce=nr(z);for(Zt(A.beforeSanitizeShadowDOM,z,null);Z=ce.nextNode();)Zt(A.uponSanitizeShadowNode,Z,null),Ec(Z),Ac(Z),Z.content instanceof a&&ge(Z.content);Zt(A.afterSanitizeShadowDOM,z,null)};return t.sanitize=function(ge){let z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Z=null,ce=null,Ye=null,ut=null;if(ve=!ge,ve&&(ge="<!-->"),typeof ge!="string"&&!_c(ge))if(typeof ge.toString=="function"){if(ge=ge.toString(),typeof ge!="string")throw Gr("dirty is not a string, aborting")}else throw Gr("toString is not a function");if(!t.isSupported)return ge;if(Me||qe(z),t.removed=[],typeof ge=="string"&&(be=!1),be){if(ge.nodeName){const Qt=Fe(ge.nodeName);if(!Y[Qt]||q[Qt])throw Gr("root node is forbidden and cannot be sanitized in-place")}}else if(ge instanceof l)Z=Wt("<!---->"),ce=Z.ownerDocument.importNode(ge,!0),ce.nodeType===Br.element&&ce.nodeName==="BODY"||ce.nodeName==="HTML"?Z=ce:Z.appendChild(ce);else{if(!we&&!Ge&&!ye&&ge.indexOf("<")===-1)return E&&Le?E.createHTML(ge):ge;if(Z=Wt(ge),!Z)return we?null:Le?M:""}Z&&Ce&&dt(Z.firstChild);const Qe=nr(be?ge:Z);for(;Ye=Qe.nextNode();)Ec(Ye),Ac(Ye),Ye.content instanceof a&&Gp(Ye.content);if(be)return ge;if(we){if($e)for(ut=C.call(Z.ownerDocument);Z.firstChild;)ut.appendChild(Z.firstChild);else ut=Z;return(V.shadowroot||V.shadowrootmode)&&(ut=N.call(n,ut,!0)),ut}let wt=ye?Z.outerHTML:Z.innerHTML;return ye&&Y["!doctype"]&&Z.ownerDocument&&Z.ownerDocument.doctype&&Z.ownerDocument.doctype.name&>(fs,Z.ownerDocument.doctype.name)&&(wt="<!DOCTYPE "+Z.ownerDocument.doctype.name+`>
|
||
`+wt),Ge&&bn([P,D,L],Qt=>{wt=Hr(wt,Qt," ")}),E&&Le?E.createHTML(wt):wt},t.setConfig=function(){let ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qe(ge),Me=!0},t.clearConfig=function(){Be=null,Me=!1},t.isValidAttribute=function(ge,z,Z){Be||qe({});const ce=Fe(ge),Ye=Fe(z);return Tc(ce,Ye,Z)},t.addHook=function(ge,z){typeof z=="function"&&zr(A[ge],z)},t.removeHook=function(ge,z){if(z!==void 0){const Z=gd(A[ge],z);return Z===-1?void 0:hd(A[ge],Z,1)[0]}return ss(A[ge])},t.removeHooks=function(ge){A[ge]=[]},t.removeAllHooks=function(){A=hs()},t}var wo=ps();const Od=()=>{const e=()=>{const n=window.G7Core?.state?.get?.();return n&&n.preferredCurrency||"KRW"},[t,r]=k.useState(e);return k.useEffect(()=>{const n=window.G7Core?.state?.subscribe;if(r(e()),typeof n!="function")return;const o=n(a=>{r(a&&a.preferredCurrency||"KRW")});return typeof o=="function"?o:void 0},[]),t},Id=(e,t=!1)=>{window.G7Core?.dispatch?.({handler:"navigate",params:t?{path:e,mergeQuery:!0,query:{}}:{path:e}})},Dd=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},ms=({product:e,onClick:t,shopBase:r="/shop",preserveListQuery:n=!1,className:o="",id:a,editorAttrs:s})=>{const l=Od(),f=y=>{const E=`multi_currency_${y}`,M=e[E];if(M&&M[l])return M[l].formatted;const _=`${y}_formatted`;return e[_]},h=e.name_localized??(typeof e.name=="string"?e.name:"")??"",d=f("selling_price"),i=f("list_price"),u=e.discount_rate&&e.discount_rate>0,g=e.sales_status&&e.sales_status!=="on_sale",p=e.labels??[],m=y=>wo.sanitize(y,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),w=e.name_highlighted,x=e.description_highlighted??e.short_description,O=()=>{if(t)t(e.id);else{const y=r==="/"?"":r,E=e.product_code??e.id;Id(`${y}/products/${E}`,n)}};return c.jsxs(Q,{onClick:O,className:`block w-full text-left group bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden hover:shadow-lg transition-shadow cursor-pointer ${o}`,id:a,...s,children:[c.jsxs(W,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[c.jsx(Lt,{src:e.thumbnail_url,alt:h,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200",loading:"lazy"}),g&&c.jsx(W,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:c.jsx(ee,{className:`text-lg font-bold ${e.sales_status==="sold_out"?"text-red-300":e.sales_status==="suspended"?"text-amber-300":"text-blue-300"}`,style:{textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e.sales_status_label??e.sales_status})}),u&&e.sales_status!=="sold_out"&&e.sales_status!=="suspended"&&c.jsxs(ee,{className:"absolute top-2 left-2 px-2 py-1 bg-red-500 text-white text-xs font-bold rounded",children:[e.discount_rate,"%"]}),p.length>0&&c.jsx(W,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:p.map((y,E)=>c.jsx(ee,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:y.color||"#6b7280"},children:y.name},E))})]}),c.jsxs(W,{className:"p-4",children:[c.jsxs(W,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&c.jsx(ee,{className:"inline-block text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-0.5 rounded",children:e.primary_category}),e.brand_name&&c.jsx(ee,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),w?c.jsx(W,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:m(w)}}):c.jsx(gn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:h}),x&&c.jsx(W,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400 line-clamp-2 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:m(x)}}),c.jsxs(W,{className:"mt-1.5 flex items-center gap-1",children:[Dd(e.rating_avg??0).map((y,E)=>c.jsxs(ee,{className:`text-xs ${y==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[y==="full"&&c.jsx("i",{className:"fa-solid fa-star"}),y==="half"&&c.jsx("i",{className:"fa-solid fa-star-half-stroke"}),y==="empty"&&c.jsx("i",{className:"fa-regular fa-star"})]},E)),c.jsx(ee,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),c.jsxs(ee,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),c.jsxs(W,{className:"mt-2 flex items-baseline gap-2",children:[c.jsx(ee,{className:"font-bold text-gray-900 dark:text-white",children:d}),i&&u&&c.jsx(ee,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:i})]})]})]})},Ld=Object.freeze(Object.defineProperty({__proto__:null,default:ms},Symbol.toStringTag,{value:"Module"})),Pd={ALLOWED_TAGS:["svg","g","defs","title","desc","rect","circle","ellipse","line","polyline","polygon","path","text","tspan","linearGradient","radialGradient","stop","clipPath"],ALLOWED_ATTR:["xmlns","width","height","viewBox","role","aria-label","aria-hidden","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","opacity","transform","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","d","points","width","height","text-anchor","dominant-baseline","font-family","font-size","font-weight","offset","stop-color","stop-opacity","gradientUnits","id","clip-path"],FORBID_TAGS:["script","foreignObject","image","use","a","style"],FORBID_ATTR:["onload","onerror","onclick","onmouseover","onfocus","onblur","href","xlink:href"]},xo=({brandMark:e,size:t=32,className:r="",id:n,editorAttrs:o})=>{const a=e?.svg,s=e?.text,l=k.useMemo(()=>!a||a.trim()===""?"":wo.sanitize(a,Pd),[a]),f={width:`${t}px`,height:`${t}px`,flex:`0 0 ${t}px`};if(l)return c.jsx(W,{id:n,"aria-hidden":"true",className:`inline-flex items-center justify-center ${r}`.trim(),style:f,dangerouslySetInnerHTML:{__html:l},...o});if(s&&s.trim()!==""){const h=e?.class??"bg-gray-500 text-white";return c.jsx(ee,{id:n,"aria-hidden":"true",className:`inline-flex items-center justify-center rounded-lg text-xs font-bold ${h} ${r}`.trim(),style:f,...o,children:s})}return null},Fd=Object.freeze(Object.defineProperty({__proto__:null,BrandMark:xo,default:xo},Symbol.toStringTag,{value:"Module"})),bs="carousel",Wr="controller",$d="navigation",Ud="no-scroll",ko="portal",zd="root",ys="toolbar",Hd="counter",Kr="fullscreen",vs="slideshow",Vr="thumbnails",ws="zoom",vr="loading",Co="playing",Yr="error",Xr="complete",Gd="placeholder",qr=e=>`active-slide-${e}`,jd=qr(vr),Bd=qr(Co),Wd=qr(Yr),Kd=qr(Xr),xs="fullsize",wr="flex_center",Vd="no_scroll",ks="no_scroll_padding",So="slide",Cs="slide_wrapper",Yd="slide_wrapper_interactive",Rt="prev",er="next",_o="swipe",xr="close",Ss="onPointerDown",_s="onPointerMove",Es="onPointerUp",Ts="onPointerLeave",Ns="onPointerCancel",Eo="onKeyDown",Xd="onKeyUp",To="onWheel",qd="Escape",Zd="ArrowLeft",Qd="ArrowRight",Jd="button",wn="icon",As="contain",Ms="cover",Os="Unknown action type",Is="yarl__";function lt(...e){return[...e].filter(Boolean).join(" ")}function pe(e){return`${Is}${e}`}function We(e){return`--${Is}${e}`}function or(e,t){return`${e}${t?`_${t}`:""}`}function ar(e){return t=>or(e,t)}function sr(e,t){var r;return(r=e?.[t])!==null&&r!==void 0?r:t}function Ds(e,t,r){return sr(e,"{index} of {total}").replace(/\{index}/g,`${Oo(r,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function kr(...e){return()=>{e.forEach(t=>{t()})}}function At(e,t,r){return()=>{const n=T.useContext(r);if(!n)throw new Error(`${e} must be used within a ${t}.Provider`);return n}}function No(){return typeof window<"u"}function Ao(e,t=0){const r=10**t;return Math.round((e+Number.EPSILON)*r)/r}function lr(e){return e.type===void 0||e.type==="image"}function Mo(e,t){return e.imageFit===Ms||e.imageFit!==As&&t===Ms}function xn(e){return typeof e=="string"?Number.parseInt(e,10):e}function kn(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=xn(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function Rd(e,t){const r=kn(t),n=r.percent!==void 0?e.width/100*r.percent:r.pixel;return{width:Math.max(e.width-2*n,0),height:Math.max(e.height-2*n,0)}}function eu(){return(No()?window?.devicePixelRatio:void 0)||1}function Oo(e,t){return t>0?(e%t+t)%t:0}function Io(e){return e.length>0}function Do(e,t){return e[Oo(t,e.length)]}function Lo(e,t){return Io(e)?Do(e,t):void 0}function Ls(e){return lr(e)?e.src:void 0}function Cn(e,t,r){if(!r)return e;const{buttons:n,...o}=e,a=n.findIndex(l=>l===t),s=T.isValidElement(r)?T.cloneElement(r,{key:t},null):r;if(a>=0){const l=[...n];return l.splice(a,1,s),{buttons:l,...o}}return{buttons:[s,...n],...o}}function Ps(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const tu=Number(T.version.split(".")[0])>=19;function ru(e){return{inert:tu?e:e?"":void 0}}function nu(e){e.scrollTop}const Po={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[xr]},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:As,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Mt(e,t){return{name:e,component:t}}function tt(e,t){return{module:e,children:t}}function Fs(e,t,r){return e.module.name===t?r(e):e.children?[tt(e.module,e.children.flatMap(n=>{var o;return(o=Fs(n,t,r))!==null&&o!==void 0?o:[]}))]:[e]}function Cr(e,t,r){return e.flatMap(n=>{var o;return(o=Fs(n,t,r))!==null&&o!==void 0?o:[]})}function ou(e,t=[],r=[]){let n=e;const o=g=>{const p=[...n];for(;p.length>0;){const m=p.pop();if(m?.module.name===g)return!0;m?.children&&p.push(...m.children)}return!1},a=(g,p)=>{if(g===""){n=[tt(p,n)];return}n=Cr(n,g,m=>[tt(p,[m])])},s=(g,p)=>{n=Cr(n,g,m=>[tt(m.module,[tt(p,m.children)])])},l=(g,p,m)=>{n=Cr(n,g,w=>{var x;return[tt(w.module,[...m?[tt(p)]:[],...(x=w.children)!==null&&x!==void 0?x:[],...m?[]:[tt(p)]])]})},f=(g,p,m)=>{n=Cr(n,g,w=>[...m?[tt(p)]:[],w,...m?[]:[tt(p)]])},h=g=>{s(Wr,g)},d=(g,p)=>{n=Cr(n,g,m=>[tt(p,m.children)])},i=g=>{n=Cr(n,g,p=>p.children)},u=g=>{r.push(g)};return t.forEach(g=>{g({contains:o,addParent:a,append:s,addChild:l,addSibling:f,addModule:h,replace:d,remove:i,augment:u})}),{config:n,augmentation:g=>r.reduce((p,m)=>m(p),g)}}const $s=T.createContext(null),Fo=At("useA11yContext","A11yContext",$s);function au({children:e}){const[t,r]=T.useState(!1),[n,o]=T.useState(!1),a=T.useMemo(()=>({focusWithin:t,trackFocusWithin:(l,f)=>{const h=d=>i=>{var u;i.currentTarget.contains(i.relatedTarget)||r(d),(u=d?l:f)===null||u===void 0||u(i)};return{onFocus:h(!0),onBlur:h(!1)}},autoPlaying:n,setAutoPlaying:o}),[t,n]);return T.createElement($s.Provider,{value:a},e)}const Us=T.createContext(null),Sr=At("useDocument","DocumentContext",Us);function su({nodeRef:e,children:t}){const r=T.useMemo(()=>{const n=a=>{var s;return((s=a||e.current)===null||s===void 0?void 0:s.ownerDocument)||document};return{getOwnerDocument:n,getOwnerWindow:a=>{var s;return((s=n(a))===null||s===void 0?void 0:s.defaultView)||window}}},[e]);return T.createElement(Us.Provider,{value:r},t)}const zs=T.createContext(null),_r=At("useEvents","EventsContext",zs);function lu({children:e}){const[t]=T.useState({});T.useEffect(()=>()=>{Object.keys(t).forEach(n=>delete t[n])},[t]);const r=T.useMemo(()=>{const n=(s,l)=>{var f;(f=t[s])===null||f===void 0||f.splice(0,t[s].length,...t[s].filter(h=>h!==l))};return{publish:(...[s,l])=>{var f;(f=t[s])===null||f===void 0||f.forEach(h=>h(l))},subscribe:(s,l)=>(t[s]||(t[s]=[]),t[s].push(l),()=>n(s,l)),unsubscribe:n}},[t]);return T.createElement(zs.Provider,{value:r},e)}const Hs=T.createContext(null),rt=At("useLightboxProps","LightboxPropsContext",Hs);function Gs({children:e,...t}){return T.createElement(Hs.Provider,{value:t},e)}const js=T.createContext(null),Ot=At("useLightboxState","LightboxStateContext",js),Bs=T.createContext(null),iu=At("useLightboxDispatch","LightboxDispatchContext",Bs);function cu(e,t){switch(t.type){case"swipe":{const{slides:r}=e,n=t?.increment||0,o=e.globalIndex+n,a=Oo(o,r.length),s=Lo(r,a),l=n||t.duration!==void 0?{increment:n,duration:t.duration,easing:t.easing}:void 0;return{slides:r,currentIndex:a,globalIndex:o,currentSlide:s,animation:l}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Lo(t.slides,t.index)}:e;default:throw new Error(Os)}}function du({slides:e,index:t,children:r}){const[n,o]=T.useReducer(cu,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Lo(e,t)});T.useEffect(()=>{o({type:"update",slides:e,index:t})},[e,t]);const a=T.useMemo(()=>({...n,state:n,dispatch:o}),[n,o]);return T.createElement(Bs.Provider,{value:o},T.createElement(js.Provider,{value:a},r))}const Ws=T.createContext(null),Zr=At("useTimeouts","TimeoutsContext",Ws);function uu({children:e}){const[t]=T.useState([]);T.useEffect(()=>()=>{t.forEach(n=>window.clearTimeout(n)),t.splice(0,t.length)},[t]);const r=T.useMemo(()=>{const n=s=>{t.splice(0,t.length,...t.filter(l=>l!==s))};return{setTimeout:(s,l)=>{const f=window.setTimeout(()=>{n(f),s()},l);return t.push(f),f},clearTimeout:s=>{s!==void 0&&(n(s),window.clearTimeout(s))}}},[t]);return T.createElement(Ws.Provider,{value:r},e)}const Er=T.forwardRef(function({label:t,className:r,icon:n,renderIcon:o,onClick:a,style:s,...l},f){const{styles:h,labels:d}=rt(),i=sr(d,t);return T.createElement("button",{ref:f,type:"button",title:i,"aria-label":i,className:lt(pe(Jd),r),onClick:a,style:{...s,...h.button},...l},o?o():T.createElement(n,{className:pe(wn),style:h.icon}))});function Ks(e,t){const r=n=>T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...n},t);return r.displayName=e,r}function mt(e,t){return Ks(e,T.createElement("g",{fill:"currentColor"},T.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function fu(e,t){return Ks(e,T.createElement(T.Fragment,null,T.createElement("defs",null,T.createElement("mask",{id:"strike"},T.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),T.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),T.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),T.createElement("g",{fill:"currentColor",mask:"url(#strike)"},T.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const gu=mt("Close",T.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"})),hu=mt("Previous",T.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),pu=mt("Next",T.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),mu=mt("Loading",T.createElement(T.Fragment,null,Array.from({length:8}).map((e,t,r)=>T.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/r.length*(t+1),transform:`rotate(${360/r.length*t}, 12, 12)`})))),bu=mt("Error",T.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"})),$t=No()?T.useLayoutEffect:T.useEffect;function $o(){const[e,t]=T.useState(!1);return T.useEffect(()=>{var r,n;const o=(r=window.matchMedia)===null||r===void 0?void 0:r.call(window,"(prefers-reduced-motion: reduce)");t(o?.matches);const a=s=>t(s.matches);return(n=o?.addEventListener)===null||n===void 0||n.call(o,"change",a),()=>{var s;return(s=o?.removeEventListener)===null||s===void 0?void 0:s.call(o,"change",a)}},[]),e}function yu(e){let t=0,r=0,n=0;const a=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(a){const s=a[1].split(",").map(xn);s.length===6?(t=s[4],r=s[5]):s.length===16&&(t=s[12],r=s[13],n=s[14])}return{x:t,y:r,z:n}}function Uo(e,t){const r=T.useRef(void 0),n=T.useRef(void 0),o=$o();return $t(()=>{var a,s,l;if(e.current&&r.current!==void 0&&!o){const{keyframes:f,duration:h,easing:d,onfinish:i}=t(r.current,e.current.getBoundingClientRect(),yu(e.current))||{};if(f&&h){(a=n.current)===null||a===void 0||a.cancel(),n.current=void 0;try{n.current=(l=(s=e.current).animate)===null||l===void 0?void 0:l.call(s,f,{duration:h,easing:d})}catch(u){console.error(u)}n.current&&(n.current.onfinish=()=>{n.current=void 0,i?.()})}}r.current=void 0}),{prepareAnimation:a=>{r.current=a},isAnimationPlaying:()=>{var a;return((a=n.current)===null||a===void 0?void 0:a.playState)==="running"}}}function Vs(){const e=T.useRef(null),t=T.useRef(void 0),[r,n]=T.useState();return{setContainerRef:T.useCallback(a=>{e.current=a,t.current&&(t.current.disconnect(),t.current=void 0);const s=()=>{if(a){const l=window.getComputedStyle(a),f=h=>parseFloat(h)||0;n({width:Math.round(a.clientWidth-f(l.paddingLeft)-f(l.paddingRight)),height:Math.round(a.clientHeight-f(l.paddingTop)-f(l.paddingBottom))})}else n(void 0)};s(),a&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(s),t.current.observe(a))},[]),containerRef:e,containerRect:r}}function Sn(){const e=T.useRef(void 0),{setTimeout:t,clearTimeout:r}=Zr();return T.useCallback((n,o)=>{r(e.current),e.current=t(n,o>0?o:0)},[t,r])}function Ie(e){const t=T.useRef(e);return $t(()=>{t.current=e}),T.useCallback((...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function Ys(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function zo(e,t){return T.useMemo(()=>e==null&&t==null?null:r=>{Ys(e,r),Ys(t,r)},[e,t])}function Xs(e,t=!1){const r=T.useRef(!1);$t(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const n=T.useCallback(()=>{r.current=!0},[]),o=T.useCallback(()=>{r.current=!1},[]);return{onFocus:n,onBlur:o}}function _n(){const[e,t]=T.useState(!1);return $t(()=>{t(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),e}function qs(){const[e]=T.useState({}),t=T.useCallback((o,a)=>{var s;(s=e[o])===null||s===void 0||s.forEach(l=>{a.isPropagationStopped()||l(a)})},[e]),r=T.useMemo(()=>({onPointerDown:o=>t(Ss,o),onPointerMove:o=>t(_s,o),onPointerUp:o=>t(Es,o),onPointerLeave:o=>t(Ts,o),onPointerCancel:o=>t(Ns,o),onKeyDown:o=>t(Eo,o),onKeyUp:o=>t(Xd,o),onWheel:o=>t(To,o)}),[t]),n=T.useCallback((o,a)=>(e[o]||(e[o]=[]),e[o].unshift(a),()=>{const s=e[o];s&&s.splice(0,s.length,...s.filter(l=>l!==a))}),[e]);return{registerSensors:r,subscribeSensors:n}}function Zs(e,t){const r=T.useRef(0),n=Sn(),o=Ie((...a)=>{r.current=Date.now(),e(a)});return T.useCallback((...a)=>{n(()=>{o(a)},t-(Date.now()-r.current))},[t,o,n])}const Ho=ar("slide"),Go=ar("slide_image");function ir({slide:e,offset:t,render:r,rect:n,imageFit:o,imageProps:a,onClick:s,onLoad:l,onError:f,style:h}){var d,i,u,g,p,m,w,x;const[O,y]=T.useState(vr),{publish:E}=_r(),{setTimeout:M}=Zr(),_=T.useRef(null);T.useEffect(()=>{t===0&&E(qr(O))},[t,O,E]);const I=Ie(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(y(Xr),M(()=>{l?.(B)},0))})}),C=T.useCallback(B=>{_.current=B,B?.complete&&I(B)},[I]),v=T.useCallback(B=>{I(B.currentTarget)},[I]),N=Ie(()=>{y(Yr),f?.()}),A=Mo(e,o),P=(B,V)=>Number.isFinite(B)?B:V,D=P(Math.max(...((i=(d=e.srcSet)===null||d===void 0?void 0:d.map(B=>B.width))!==null&&i!==void 0?i:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((u=_.current)===null||u===void 0?void 0:u.naturalWidth)||0),L=P(Math.max(...((p=(g=e.srcSet)===null||g===void 0?void 0:g.map(B=>B.height))!==null&&p!==void 0?p:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((m=_.current)===null||m===void 0?void 0:m.naturalHeight)||0),U=D&&L?{maxWidth:`min(${D}px, 100%)`,maxHeight:`min(${L}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},S=(w=e.srcSet)===null||w===void 0?void 0:w.sort((B,V)=>B.width-V.width).map(B=>`${B.src} ${B.width}w`).join(", "),b=()=>n&&!A&&e.width&&e.height?n.height/e.height*e.width:Number.MAX_VALUE,$=S&&n&&No()?`${Math.round(Math.min(b(),n.width))}px`:void 0,{style:F,className:G,...Y}=a||{};return T.createElement(T.Fragment,null,T.createElement("img",{ref:C,onLoad:v,onError:N,onClick:s,draggable:!1,className:lt(pe(Go()),A&&pe(Go("cover")),O!==Xr&&pe(Go("loading")),G),style:{...U,...h,...F},...Y,alt:(x=e.alt)!==null&&x!==void 0?x:"",sizes:$,srcSet:S,src:e.src}),O!==Xr&&T.createElement("div",{className:pe(Ho(Gd))},O===vr&&(r?.iconLoading?r.iconLoading():T.createElement(mu,{className:lt(pe(wn),pe(Ho(vr)))})),O===Yr&&(r?.iconError?r.iconError():T.createElement(bu,{className:lt(pe(wn),pe(Ho(Yr)))}))))}const vu=T.forwardRef(function({className:t,children:r,onFocus:n,onBlur:o,...a},s){const l=T.useRef(null),{trackFocusWithin:f}=Fo();return T.createElement(su,{nodeRef:l},T.createElement("div",{ref:zo(s,l),className:lt(pe("root"),t),...f(n,o),...a},r))});var it;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(it||(it={}));function Qs(e,t,r,n,o){T.useEffect(()=>o?()=>{}:kr(e(Ss,t),e(_s,r),e(Es,n),e(Ts,n),e(Ns,n)),[e,t,r,n,o])}var Ut;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Ut||(Ut={}));const jo=30;function wu({disableSwipeNavigation:e,closeOnBackdropClick:t},r,n,o,a,s,l,f,h,d,i,u,g,p,m,w){const x=T.useRef(0),O=T.useRef([]),y=T.useRef(void 0),E=T.useRef(0),M=T.useRef(Ut.NONE),_=T.useCallback(D=>{y.current===D.pointerId&&(y.current=void 0,M.current=Ut.NONE);const L=O.current;L.splice(0,L.length,...L.filter(U=>U.pointerId!==D.pointerId))},[]),I=T.useCallback(D=>{_(D),D.persist(),O.current.push(D)},[_]),C=T.useCallback(D=>O.current.find(({pointerId:L})=>D.pointerId===L),[]),v=Ie(D=>{I(D)}),N=(D,L)=>i&&D>L||d&&D<-L,A=Ie(D=>{const L=C(D);if(L)if(y.current===D.pointerId){const U=Date.now()-E.current,S=x.current;M.current===Ut.SWIPE?Math.abs(S)>.3*o||Math.abs(S)>5&&U<a?f(S,U):h(S):M.current===Ut.PULL&&(N(S,2*jo)?p(S,U):m(S)),x.current=0,M.current=Ut.NONE}else{const{target:U}=D;t&&U instanceof HTMLElement&&U===L.target&&(U.classList.contains(pe(So))||U.classList.contains(pe(Cs)))&&w()}_(D)}),P=Ie(D=>{const L=C(D);if(L){const U=y.current===D.pointerId;if(D.buttons===0){U&&x.current!==0?A(D):_(L);return}const S=D.clientX-L.clientX,b=D.clientY-L.clientY;if(y.current===void 0){const $=F=>{I(D),y.current=D.pointerId,E.current=Date.now(),M.current=F};Math.abs(S)>Math.abs(b)&&Math.abs(S)>jo&&n(S)?e||($(Ut.SWIPE),s()):Math.abs(b)>Math.abs(S)&&N(b,jo)&&($(Ut.PULL),u())}else U&&(M.current===Ut.SWIPE?(x.current=S,l(S)):M.current===Ut.PULL&&(x.current=b,g(b)))}});Qs(r,v,P,A)}function xu({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=T.useRef(null),n=Ie(o=>{const a=Math.abs(o.deltaX)>Math.abs(o.deltaY);(a&&e||!a&&t||o.ctrlKey)&&o.preventDefault()});return T.useCallback(o=>{var a;o?o.addEventListener("wheel",n,{passive:!1}):(a=r.current)===null||a===void 0||a.removeEventListener("wheel",n),r.current=o},[n])}function ku(e,t,r,n,o,a,s,l,f){const h=T.useRef(0),d=T.useRef(0),i=T.useRef(void 0),u=T.useRef(void 0),g=T.useRef(0),p=T.useRef(void 0),m=T.useRef(0),{setTimeout:w,clearTimeout:x}=Zr(),O=T.useCallback(()=>{i.current&&(x(i.current),i.current=void 0)},[x]),y=T.useCallback(()=>{u.current&&(x(u.current),u.current=void 0)},[x]),E=Ie(()=>{e!==it.SWIPE&&(h.current=0,m.current=0,O(),y())});T.useEffect(E,[e,E]);const M=Ie(I=>{u.current=void 0,h.current===I&&f(h.current)}),_=Ie(I=>{if(I.ctrlKey||Math.abs(I.deltaY)>Math.abs(I.deltaX))return;const C=v=>{g.current=v,x(p.current),p.current=v>0?w(()=>{g.current=0,p.current=void 0},300):void 0};if(e===it.NONE){if(Math.abs(I.deltaX)<=1.2*Math.abs(g.current)){C(I.deltaX);return}if(!r(-I.deltaX))return;if(d.current+=I.deltaX,O(),Math.abs(d.current)>30)d.current=0,C(0),m.current=Date.now(),a();else{const v=d.current;i.current=w(()=>{i.current=void 0,v===d.current&&(d.current=0)},o)}}else if(e===it.SWIPE){let v=h.current-I.deltaX;if(v=Math.min(Math.abs(v),n)*Math.sign(v),h.current=v,s(v),y(),Math.abs(v)>.2*n){C(I.deltaX),l(v,Date.now()-m.current);return}u.current=w(()=>M(v),2*o)}else C(I.deltaX)});T.useEffect(()=>t(To,_),[t,_])}const Js=ar("container"),Rs=T.createContext(null),zt=At("useController","ControllerContext",Rs);function Cu({children:e,...t}){var r;const{carousel:n,animation:o,controller:a,on:s,styles:l,render:f}=t,{closeOnPullUp:h,closeOnPullDown:d,preventDefaultWheelX:i,preventDefaultWheelY:u}=a,[g,p]=T.useState(),m=Ot(),w=iu(),[x,O]=T.useState(it.NONE),y=T.useRef(0),E=T.useRef(0),M=T.useRef(1),{registerSensors:_,subscribeSensors:I}=qs(),{subscribe:C,publish:v}=_r(),N=Sn(),A=Sn(),P=Sn(),{containerRef:D,setContainerRef:L,containerRect:U}=Vs(),S=zo(xu({preventDefaultWheelX:i,preventDefaultWheelY:u}),L),b=T.useRef(null),$=zo(b,void 0),{getOwnerDocument:F}=Sr(),G=_n(),Y=K=>(G?-1:1)*(typeof K=="number"?K:1),B=Ie(()=>{var K;return(K=D.current)===null||K===void 0?void 0:K.focus()}),V=Ie(()=>t),j=Ie(()=>m),H=T.useCallback(K=>v(Rt,K),[v]),q=T.useCallback(K=>v(er,K),[v]),ue=T.useCallback(()=>v(xr),[v]),te=K=>!(n.finite&&(Y(K)>0&&m.currentIndex===0||Y(K)<0&&m.currentIndex===m.slides.length-1)),fe=K=>{var re;y.current=K,(re=D.current)===null||re===void 0||re.style.setProperty(We("swipe_offset"),`${Math.round(K)}px`)},R=K=>{var re,oe;E.current=K,M.current=(()=>{const xe=d&&K>0?K:h&&K<0?-K:0;return Math.min(Math.max(Ao(1-xe/60*(1-.5),2),.5),1)})(),(re=D.current)===null||re===void 0||re.style.setProperty(We("pull_offset"),`${Math.round(K)}px`),(oe=D.current)===null||oe===void 0||oe.style.setProperty(We("pull_opacity"),`${M.current}`)},{prepareAnimation:ke}=Uo(b,(K,re,oe)=>{if(b.current&&U)return{keyframes:[{transform:`translate(0, ${K.rect.y-re.y+oe.y}px)`,opacity:K.opacity},{transform:"translate(0, 0)",opacity:1}],duration:K.duration,easing:o.easing.fade}}),me=(K,re)=>{if(h||d){R(K);let oe=0;b.current&&(oe=o.fade*(re?2:1),ke({rect:b.current.getBoundingClientRect(),opacity:M.current,duration:oe})),P(()=>{R(0),O(it.NONE)},oe),O(it.ANIMATION),re||ue()}},{prepareAnimation:Ge,isAnimationPlaying:De}=Uo(b,(K,re,oe)=>{var ae;if(b.current&&U&&(!((ae=m.animation)===null||ae===void 0)&&ae.duration)){const be=kn(n.spacing),xe=(be.percent?be.percent*U.width/100:be.pixel)||0;return{keyframes:[{transform:`translate(${Y(m.globalIndex-K.index)*(U.width+xe)+K.rect.x-re.x+oe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:m.animation.duration,easing:m.animation.easing}}}),ye=Ie(K=>{var re,oe;const ae=K.offset||0,be=ae?o.swipe:(re=o.navigation)!==null&&re!==void 0?re:o.swipe,xe=!ae&&!De()?o.easing.navigation:o.easing.swipe;let{direction:He}=K;const Pe=(oe=K.count)!==null&&oe!==void 0?oe:1;let Ke=it.ANIMATION,Oe=be*Pe;if(!He){const se=U?.width,ie=K.duration||0,le=se?be/se*Math.abs(ae):be;Pe!==0?(ie<le?Oe=Oe/le*Math.max(ie,le/5):se&&(Oe=be/se*(se-Math.abs(ae))),He=Y(ae)>0?Rt:er):Oe=be/2}let X=0;He===Rt?te(Y(1))?X=-Pe:(Ke=it.NONE,Oe=be):He===er&&(te(Y(-1))?X=Pe:(Ke=it.NONE,Oe=be)),Oe=Math.round(Oe),A(()=>{fe(0),O(it.NONE)},Oe),b.current&&Ge({rect:b.current.getBoundingClientRect(),index:m.globalIndex}),O(Ke),v(_o,{type:"swipe",increment:X,duration:Oe,easing:xe})});T.useEffect(()=>{var K,re;!((K=m.animation)===null||K===void 0)&&K.increment&&(!((re=m.animation)===null||re===void 0)&&re.duration)&&N(()=>w({type:"swipe",increment:0}),m.animation.duration)},[m.animation,w,N]);const Me=[I,te,U?.width||0,o.swipe,()=>O(it.SWIPE),K=>fe(K),(K,re)=>ye({offset:K,duration:re,count:1}),K=>ye({offset:K,count:0})],Ce=[()=>{d&&O(it.PULL)},K=>R(K),K=>me(K),K=>me(K,!0)];wu(a,...Me,h,d,...Ce,ue),ku(x,...Me);const we=Ie(()=>{a.focus&&F().querySelector(`.${pe(ko)} .${pe(Js())}`)&&B()});T.useEffect(we,[we]);const $e=Ie(()=>{var K;(K=s.view)===null||K===void 0||K.call(s,{index:m.currentIndex})});T.useEffect($e,[m.globalIndex,$e]),T.useEffect(()=>kr(C(Rt,K=>ye({direction:Rt,...K})),C(er,K=>ye({direction:er,...K})),C(_o,K=>w(K))),[C,ye,w]);const Le=T.useMemo(()=>({prev:H,next:q,close:ue,focus:B,slideRect:U?Rd(U,n.padding):{width:0,height:0},containerRect:U||{width:0,height:0},subscribeSensors:I,containerRef:D,setCarouselRef:$,toolbarWidth:g,setToolbarWidth:p}),[H,q,ue,B,I,U,D,$,g,p,n.padding]);return T.useImperativeHandle(a.ref,()=>({prev:H,next:q,close:ue,focus:B,getLightboxProps:V,getLightboxState:j}),[H,q,ue,B,V,j]),T.createElement("div",{ref:S,className:lt(pe(Js()),pe(wr)),style:{...x===it.SWIPE?{[We("swipe_offset")]:`${Math.round(y.current)}px`}:null,...x===it.PULL?{[We("pull_offset")]:`${Math.round(E.current)}px`,[We("pull_opacity")]:`${M.current}`}:null,...a.touchAction!=="none"?{[We("controller_touch_action")]:a.touchAction}:null,...l.container},tabIndex:-1,..._},U&&T.createElement(Rs.Provider,{value:Le},e,(r=f.controls)===null||r===void 0?void 0:r.call(f)))}const Su=Mt(Wr,Cu);function cr(e){return or(bs,e)}function el(e){return or(So,e)}function _u({slide:e,offset:t}){const r=T.useRef(null),{currentIndex:n,slides:o}=Ot(),{slideRect:a,focus:s}=zt(),{render:l,carousel:{imageFit:f,imageProps:h},on:{click:d},styles:{slide:i},labels:u}=rt(),{getOwnerDocument:g}=Sr(),p=t!==0;T.useEffect(()=>{var w;p&&(!((w=r.current)===null||w===void 0)&&w.contains(g().activeElement))&&s()},[p,s,g]);const m=()=>{var w,x,O,y;let E=(w=l.slide)===null||w===void 0?void 0:w.call(l,{slide:e,offset:t,rect:a});return!E&&lr(e)&&(E=T.createElement(ir,{slide:e,offset:t,render:l,rect:a,imageFit:f,imageProps:h,onClick:p?void 0:()=>d?.({index:n})})),E?T.createElement(T.Fragment,null,(x=l.slideHeader)===null||x===void 0?void 0:x.call(l,{slide:e}),((O=l.slideContainer)!==null&&O!==void 0?O:(({children:M})=>M))({slide:e,children:E}),(y=l.slideFooter)===null||y===void 0?void 0:y.call(l,{slide:e})):null};return T.createElement("div",{ref:r,className:lt(pe(el()),!p&&pe(el("current")),pe(wr)),...ru(p),style:i,role:"group","aria-roledescription":sr(u,"Slide"),"aria-label":Ds(u,o,n+t)},m())}function Eu(){const e=rt().styles.slide;return T.createElement("div",{className:pe(So),style:e})}function Tu({carousel:e,labels:t}){const{slides:r,currentIndex:n,globalIndex:o}=Ot(),{setCarouselRef:a}=zt(),{autoPlaying:s,focusWithin:l}=Fo(),f=kn(e.spacing),h=kn(e.padding),d=Ps(e,r,1),i=[];if(Io(r))for(let u=n-d;u<=n+d;u+=1){const g=Do(r,u),p=o-n+u,m=e.finite&&(u<0||u>r.length-1);i.push(m?{key:p}:{key:[`${p}`,Ls(g)].filter(Boolean).join("|"),offset:u-n,slide:g})}return T.createElement("div",{ref:a,className:lt(pe(cr()),i.length>0&&pe(cr("with_slides"))),style:{[`${We(cr("slides_count"))}`]:i.length,[`${We(cr("spacing_px"))}`]:f.pixel||0,[`${We(cr("spacing_percent"))}`]:f.percent||0,[`${We(cr("padding_px"))}`]:h.pixel||0,[`${We(cr("padding_percent"))}`]:h.percent||0},role:"region","aria-live":s&&!l?"off":"polite","aria-roledescription":sr(t,"Carousel"),"aria-label":sr(t,"Photo gallery")},i.map(({key:u,slide:g,offset:p})=>g?T.createElement(_u,{key:u,slide:g,offset:p}):T.createElement(Eu,{key:u})))}const Nu=Mt(bs,Tu);function tl(){const{carousel:e}=rt(),{slides:t,currentIndex:r}=Ot(),n=t.length===0||e.finite&&r===0,o=t.length===0||e.finite&&r===t.length-1;return{prevDisabled:n,nextDisabled:o}}function rl(e){var t;const r=_n(),{publish:n}=_r(),{animation:o}=rt(),{prevDisabled:a,nextDisabled:s}=tl(),l=((t=o.navigation)!==null&&t!==void 0?t:o.swipe)/2,f=Zs(()=>n(Rt),l),h=Zs(()=>n(er),l),d=Ie(i=>{switch(i.key){case qd:n(xr);break;case Zd:(r?s:a)||(r?h:f)();break;case Qd:(r?a:s)||(r?f:h)();break}});T.useEffect(()=>e(Eo,d),[e,d])}function nl({label:e,icon:t,renderIcon:r,action:n,onClick:o,disabled:a,style:s}){return T.createElement(Er,{label:e,icon:t,renderIcon:r,className:pe(`navigation_${n}`),disabled:a,onClick:o,style:s,...Xs(zt().focus,a)})}function Au({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:n},styles:o}){const{prev:a,next:s,subscribeSensors:l}=zt(),{prevDisabled:f,nextDisabled:h}=tl();return rl(l),T.createElement(T.Fragment,null,e?e():T.createElement(nl,{label:"Previous",action:Rt,icon:hu,renderIcon:r,style:o.navigationPrev,disabled:f,onClick:a}),t?t():T.createElement(nl,{label:"Next",action:er,icon:pu,renderIcon:n,style:o.navigationNext,disabled:h,onClick:s}))}const Mu=Mt($d,Au),ol=pe(Vd),Ou=pe(ks);function Iu(e){return"style"in e}function al(e,t,r){const n=window.getComputedStyle(e),o=r?"padding-left":"padding-right",a=r?n.paddingLeft:n.paddingRight,s=e.style.getPropertyValue(o);return e.style.setProperty(o,`${(xn(a)||0)+t}px`),()=>{s?e.style.setProperty(o,s):e.style.removeProperty(o)}}function Du({noScroll:{disabled:e},children:t}){const r=_n(),{getOwnerDocument:n,getOwnerWindow:o}=Sr();return T.useEffect(()=>{if(e)return()=>{};const a=[],s=o(),{body:l,documentElement:f}=n(),h=Math.round(s.innerWidth-f.clientWidth);if(h>0){a.push(al(l,h,r));const d=l.getElementsByTagName("*");for(let i=0;i<d.length;i+=1){const u=d[i];Iu(u)&&s.getComputedStyle(u).getPropertyValue("position")==="fixed"&&!u.classList.contains(Ou)&&a.push(al(u,h,r))}}return l.classList.add(ol),()=>{l.classList.remove(ol),a.forEach(d=>d())}},[r,e,n,o]),T.createElement(T.Fragment,null,t)}const Lu=Mt(Ud,Du);function sl(e){return or(ko,e)}function ll(e,t,r){const n=e.getAttribute(t);return e.setAttribute(t,r),()=>{n?e.setAttribute(t,n):e.removeAttribute(t)}}function Pu({children:e,animation:t,styles:r,className:n,on:o,portal:a,close:s,labels:l}){const[f,h]=T.useState(!1),[d,i]=T.useState(!1),u=T.useRef([]),g=T.useRef(null),{setTimeout:p}=Zr(),{subscribe:m}=_r(),x=$o()?0:t.fade;T.useEffect(()=>(h(!0),()=>{h(!1),i(!1)}),[]);const O=Ie(()=>{u.current.forEach(_=>_()),u.current=[]}),y=Ie(()=>{var _;i(!1),O(),(_=o.exiting)===null||_===void 0||_.call(o),p(()=>{var I;(I=o.exited)===null||I===void 0||I.call(o),s()},x)});T.useEffect(()=>m(xr,y),[m,y]);const E=Ie(_=>{var I,C,v;nu(_),i(!0),(I=o.entering)===null||I===void 0||I.call(o);const N=(v=(C=_.parentNode)===null||C===void 0?void 0:C.children)!==null&&v!==void 0?v:[];for(let A=0;A<N.length;A+=1){const P=N[A];["TEMPLATE","SCRIPT","STYLE"].indexOf(P.tagName)===-1&&P!==_&&(u.current.push(ll(P,"inert","")),u.current.push(ll(P,"aria-hidden","true")))}u.current.push(()=>{var A,P;(P=(A=g.current)===null||A===void 0?void 0:A.focus)===null||P===void 0||P.call(A)}),p(()=>{var A;(A=o.entered)===null||A===void 0||A.call(o)},x)}),M=T.useCallback(_=>{_?E(_):O()},[E,O]);return f?Jt.createPortal(T.createElement(vu,{ref:M,className:lt(n,pe(sl()),pe(ks),d&&pe(sl("open"))),"aria-modal":!0,role:"dialog","aria-label":sr(l,"Lightbox"),style:{...t.fade!==Po.animation.fade?{[We("fade_animation_duration")]:`${x}ms`}:null,...t.easing.fade!==Po.animation.easing.fade?{[We("fade_animation_timing_function")]:t.easing.fade}:null,...r.root},onFocus:_=>{g.current||(g.current=_.relatedTarget)}},e),a.root||document.body):null}const Fu=Mt(ko,Pu);function $u({children:e}){return T.createElement(T.Fragment,null,e)}const Uu=Mt(zd,$u);function zu(e){return or(ys,e)}function Hu({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:n}){const{close:o,setToolbarWidth:a}=zt(),{setContainerRef:s,containerRect:l}=Vs();$t(()=>{a(l?.width)},[a,l?.width]);const f=()=>t?t():T.createElement(Er,{key:xr,label:"Close",icon:gu,renderIcon:r,onClick:o});return T.createElement("div",{ref:s,style:n.toolbar,className:pe(zu())},e?.map(h=>h===xr?f():h))}const Gu=Mt(ys,Hu);function il(e,t){var r;return T.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(n=>il(n,t)))}function ju(e,t={}){const{easing:r,...n}=e,{easing:o,...a}=t;return{easing:{...r,...o},...n,...a}}function Bu({carousel:e,animation:t,render:r,toolbar:n,controller:o,noScroll:a,on:s,plugins:l,slides:f,index:h,...d}){const{animation:i,carousel:u,render:g,toolbar:p,controller:m,noScroll:w,on:x,slides:O,index:y,plugins:E,...M}=Po,{config:_,augmentation:I}=ou([tt(Fu,[tt(Lu,[tt(Su,[tt(Nu),tt(Gu),tt(Mu)])])])],l||E),C=I({animation:ju(i,t),carousel:{...u,...e},render:{...g,...r},toolbar:{...p,...n},controller:{...m,...o},noScroll:{...w,...a},on:{...x,...s},...M,...d});return C.open?T.createElement(Gs,{...C},T.createElement(du,{slides:f||O,index:xn(h||y)},T.createElement(uu,null,T.createElement(lu,null,T.createElement(au,null,il(tt(Uu,_),C)))))):null}const Wu={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1};function Ku(e){return Math.min(Math.max(e,Number.EPSILON),1)}function cl(e){const{minZoom:t,...r}={...Wu,...e};return{minZoom:Ku(t),...r}}function Vu(e,t,r,n){const o=T.useRef(void 0),a=T.useRef(void 0),{zoom:s}=rt().animation,l=$o(),f=Ie(()=>{var h,d,i;if((h=o.current)===null||h===void 0||h.cancel(),o.current=void 0,a.current&&n?.current){try{o.current=(i=(d=n.current).animate)===null||i===void 0?void 0:i.call(d,[{transform:a.current},{transform:`scale(${e}) translateX(${t}px) translateY(${r}px)`}],{duration:l?0:s??500,easing:o.current?"ease-out":"ease-in-out"})}catch(u){console.error(u)}a.current=void 0,o.current&&(o.current.onfinish=()=>{o.current=void 0})}});return $t(f,[e,t,r,f]),T.useCallback(()=>{a.current=n?.current?window.getComputedStyle(n.current).transform:void 0},[n])}function Yu(e,t){const{on:r}=rt(),n=Ie(()=>{var o;t||(o=r.zoom)===null||o===void 0||o.call(r,{zoom:e})});T.useEffect(n,[e,n])}function En(){const{zoom:e}=rt();return cl(e)}function Xu(e,t){var r,n;let o={width:0,height:0},a={width:0,height:0};const{currentSlide:s}=Ot(),{imageFit:l}=rt().carousel,{maxZoomPixelRatio:f}=En();if(e&&s){const d={...s,...t};if(lr(d)){const i=Mo(d,l),u=Math.max(...(((r=d.srcSet)===null||r===void 0?void 0:r.map(p=>p.width))||[]).concat(d.width?[d.width]:[])),g=Math.max(...(((n=d.srcSet)===null||n===void 0?void 0:n.map(p=>p.height))||[]).concat(d.height?[d.height]:[]));u>0&&g>0&&e.width>0&&e.height>0&&(a=i?{width:Math.round(Math.min(u,e.width/e.height*g)),height:Math.round(Math.min(g,e.height/e.width*u))}:{width:u,height:g},a={width:a.width*f,height:a.height*f},o=i?{width:Math.min(e.width,a.width,u),height:Math.min(e.height,a.height,g)}:{width:Math.round(Math.min(e.width,e.height/g*u,u)),height:Math.round(Math.min(e.height,e.width/u*g,g))})}}const h=o.width?Math.max(Ao(a.width/o.width,5),1):1;return{imageRect:o,maxZoom:h}}function dl(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function ul(e,t,r=100,n=2){return e*Math.min(1+Math.abs(t/r),n)**Math.sign(t)}function qu(e,t,r,n,o,a,s,l,f){const h=T.useRef([]),d=T.useRef(0),i=T.useRef(void 0),{globalIndex:u}=Ot(),{getOwnerWindow:g}=Sr(),{containerRef:p,subscribeSensors:m}=zt(),{keyboardMoveDistance:w,zoomInMultiplier:x,wheelZoomDistanceFactor:O,scrollToZoom:y,doubleTapDelay:E,doubleClickDelay:M,doubleClickMaxStops:_,pinchZoomDistanceFactor:I,pinchZoomV4:C}=En(),v=T.useCallback($=>{if(p.current){const{pageX:F,pageY:G}=$,{scrollX:Y,scrollY:B}=g(),{left:V,top:j,width:H,height:q}=p.current.getBoundingClientRect();return[F-V-Y-H/2,G-j-B-q/2]}return[]},[p,g]),N=Ie($=>{const{key:F,metaKey:G,ctrlKey:Y}=$,B=G||Y,V=()=>{$.preventDefault(),$.stopPropagation()};if(e>1){const j=(H,q)=>{V(),l(H,q)};F==="ArrowDown"?j(0,w):F==="ArrowUp"?j(0,-w):F==="ArrowLeft"?j(-w,0):F==="ArrowRight"&&j(w,0)}F==="+"||B&&F==="="?(V(),o()):F==="-"||B&&F==="_"?(V(),a()):B&&F==="0"&&(V(),s(1))}),A=Ie($=>{if(($.ctrlKey||y)&&Math.abs($.deltaY)>Math.abs($.deltaX)){$.stopPropagation(),s(ul(e,-$.deltaY,O),!0,...v($));return}e>1&&($.stopPropagation(),y||l($.deltaX,$.deltaY))}),P=T.useCallback($=>{const F=h.current;F.splice(0,F.length,...F.filter(G=>G.pointerId!==$.pointerId))},[]),D=T.useCallback($=>{P($),$.persist(),h.current.push($)},[P]),L=Ie($=>{var F;const G=h.current;if($.pointerType==="mouse"&&$.buttons>1||!(!((F=f?.current)===null||F===void 0)&&F.contains($.target)))return;e>1&&$.stopPropagation();const{timeStamp:Y}=$;if(G.length===0&&Y-d.current<($.pointerType==="touch"?E:M)){d.current=0;const B=e>=1?e!==r?e*Math.max(r**(1/_),x):1:e!==t?e/Math.max(t**(-1/_),x):1;s(B,!1,...v($))}else d.current=Y;if(D($),G.length===2){const B=dl(G[0],G[1]);i.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),U=Ie($=>{const F=h.current,G=F.find(Y=>Y.pointerId===$.pointerId);if(F.length===2&&i.current){$.stopPropagation(),D($);const Y=dl(F[0],F[1]),B=C?i.current.initialZoom/i.current.initialDistance*Y:ul(e,Y-i.current.previousDistance,I);s(B,!0,...F.map(V=>v(V)).reduce((V,j)=>j.map((H,q)=>V[q]+H/2))),i.current.previousDistance=Y;return}e>1&&($.stopPropagation(),G&&(F.length===1&&l((G.clientX-$.clientX)/e,(G.clientY-$.clientY)/e),D($)))}),S=T.useCallback($=>{const F=h.current;F.length===2&&F.find(G=>G.pointerId===$.pointerId)&&(i.current=void 0),P($)},[P]),b=T.useCallback(()=>{const $=h.current;$.splice(0,$.length),d.current=0,i.current=void 0},[]);Qs(m,L,U,S,n),T.useEffect(b,[u,b]),T.useEffect(()=>n?()=>{}:kr(b,m(Eo,N),m(To,A)),[n,m,b,N,A])}function Zu(e,t,r){const[n,o]=T.useState(1),[a,s]=T.useState(0),[l,f]=T.useState(0),h=Vu(n,a,l,r),{currentSlide:d,globalIndex:i}=Ot(),{containerRect:u,slideRect:g}=zt(),{minZoom:p,zoomInMultiplier:m}=En(),w=d&&lr(d)?d.src:void 0,x=!w||!r?.current;$t(()=>{o(1),s(0),f(0)},[i,w]);const O=T.useCallback((I,C,v)=>{const N=v||n,A=a-(I||0),P=l-(C||0),D=(e.width*N-g.width)/2/N,L=(e.height*N-g.height)/2/N;s(Math.min(Math.abs(A),Math.max(D,0))*Math.sign(A)),f(Math.min(Math.abs(P),Math.max(L,0))*Math.sign(P))},[n,a,l,g,e.width,e.height]),y=T.useCallback((I,C,v,N)=>{const A=Ao(I+.01<t?I-.01>p?I:p:t,5);C||h(),O(v?v*(1/n-1/A):0,N?N*(1/n-1/A):0,A),o(A)},[n,p,t,O,h]),E=Ie(()=>{n>1&&(n>t&&y(t,!0),O())});$t(E,[u.width,u.height,E]);const M=T.useCallback(()=>{const I=n*m;y(n<1&&I>1?1:I)},[n,m,y]),_=T.useCallback(()=>{const I=n/m;y(n>1&&I<1?1:I)},[n,m,y]);return{zoom:n,offsetX:a,offsetY:l,disabled:x,changeOffsets:O,changeZoom:y,zoomIn:M,zoomOut:_}}const fl=T.createContext(null),Bo=At("useZoom","ZoomControllerContext",fl);function Qu({children:e}){const[t,r]=T.useState(),{slideRect:n}=zt(),{ref:o,minZoom:a}=En(),{imageRect:s,maxZoom:l}=Xu(n,t?.imageDimensions),{zoom:f,offsetX:h,offsetY:d,disabled:i,changeZoom:u,changeOffsets:g,zoomIn:p,zoomOut:m}=Zu(s,l,t?.zoomWrapperRef);Yu(f,i),qu(f,a,l,i,p,m,u,g,t?.zoomWrapperRef);const w=T.useMemo(()=>({zoom:f,minZoom:a,maxZoom:l,offsetX:h,offsetY:d,disabled:i,zoomIn:p,zoomOut:m,changeZoom:u}),[f,a,l,h,d,i,p,m,u]);T.useImperativeHandle(o,()=>w,[w]);const x=T.useMemo(()=>({...w,setZoomWrapper:r}),[w,r]);return T.createElement(fl.Provider,{value:x},e)}const Ju=mt("ZoomIn",T.createElement(T.Fragment,null,T.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"}),T.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),Ru=mt("ZoomOut",T.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"})),gl=T.forwardRef(function({zoomIn:t,onLoseFocus:r},n){const o=T.useRef(!1),a=T.useRef(!1),{zoom:s,minZoom:l,maxZoom:f,zoomIn:h,zoomOut:d,disabled:i}=Bo(),{render:u}=rt(),g=i||(t?s>=f:s<=l);return T.useEffect(()=>{g&&o.current&&a.current&&r(),g||(o.current=!0)},[g,r]),T.createElement(Er,{ref:n,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?Ju:Ru,renderIcon:t?u.iconZoomIn:u.iconZoomOut,onClick:t?h:d,onFocus:()=>{a.current=!0},onBlur:()=>{a.current=!1}})});function ef(){const e=T.useRef(null),t=T.useRef(null),{focus:r}=zt(),n=T.useCallback(s=>{var l,f;!((l=s.current)===null||l===void 0)&&l.disabled?r():(f=s.current)===null||f===void 0||f.focus()},[r]),o=T.useCallback(()=>n(e),[n]),a=T.useCallback(()=>n(t),[n]);return T.createElement(T.Fragment,null,T.createElement(gl,{zoomIn:!0,ref:e,onLoseFocus:a}),T.createElement(gl,{ref:t,onLoseFocus:o}))}function tf(){const{render:e}=rt(),t=Bo();return e.buttonZoom?T.createElement(T.Fragment,null,e.buttonZoom(t)):T.createElement(ef,null)}function rf(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function nf({current:e,preload:t},{type:r,source:n}){switch(r){case"fetch":return e?{current:e,preload:n}:{current:n};case"done":return n===t?{current:n}:{current:e,preload:t};default:throw new Error(Os)}}function of(e){var t,r;const[{current:n,preload:o},a]=T.useReducer(nf,{}),{slide:s,rect:l,imageFit:f,render:h,interactive:d}=e,i=s.srcSet.sort((M,_)=>M.width-_.width),u=(t=s.width)!==null&&t!==void 0?t:i[i.length-1].width,g=(r=s.height)!==null&&r!==void 0?r:i[i.length-1].height,p=Mo(s,f),m=Math.max(...i.map(M=>M.width)),w=Math.min((p?Math.max:Math.min)(l.width,u*(l.height/g)),m),x=eu(),O=Ie(()=>{var M;const _=(M=i.find(I=>I.width>=w*x))!==null&&M!==void 0?M:i[i.length-1];(!n||i.findIndex(I=>I.src===n)<i.findIndex(I=>I===_))&&a({type:"fetch",source:_.src})});$t(O,[l.width,l.height,x,O]);const y=Ie(M=>a({type:"done",source:M})),E={WebkitTransform:d?"initial":"translateZ(0)"};return p||Object.assign(E,l.width/l.height<u/g?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),T.createElement(T.Fragment,null,o&&o!==n&&T.createElement(ir,{key:"preload",...e,offset:void 0,slide:{...s,src:o,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...E},onLoad:()=>y(o),render:{...h,iconLoading:()=>null,iconError:()=>null}}),n&&T.createElement(ir,{key:"current",...e,slide:{...s,src:n,srcSet:void 0},style:E}))}function af({render:e,slide:t,offset:r,rect:n}){var o;const[a,s]=T.useState(),l=T.useRef(null),{zoom:f,maxZoom:h,offsetX:d,offsetY:i,setZoomWrapper:u}=Bo(),g=f>1,{carousel:p,on:m}=rt(),{currentIndex:w}=Ot();$t(()=>r===0?(u({zoomWrapperRef:l,imageDimensions:a}),()=>u(void 0)):()=>{},[r,a,u]);let x=(o=e.slide)===null||o===void 0?void 0:o.call(e,{slide:t,offset:r,rect:n,zoom:f,maxZoom:h});if(!x&&lr(t)){const O={slide:t,offset:r,rect:n,render:e,imageFit:p.imageFit,imageProps:p.imageProps,onClick:r===0?()=>{var y;return(y=m.click)===null||y===void 0?void 0:y.call(m,{index:w})}:void 0};x=rf(t)?T.createElement(of,{...O,slide:t,interactive:g,rect:r===0?{width:n.width*f,height:n.height*f}:n}):T.createElement(ir,{onLoad:y=>s({width:y.naturalWidth,height:y.naturalHeight}),...O})}return x?T.createElement("div",{ref:l,className:lt(pe(xs),pe(wr),pe(Cs),g&&pe(Yd)),style:r===0?{transform:`scale(${f}) translateX(${d}px) translateY(${i}px)`}:void 0},x):null}const sf=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:n,render:o,controller:a,...s})=>{const l=cl(r);return{zoom:l,toolbar:Cn(n,ws,T.createElement(tf,null)),render:{...o,slide:f=>{var h;return lr(f.slide)?T.createElement(af,{render:o,...f}):(h=o.slide)===null||h===void 0?void 0:h.call(o,f)}},controller:{...a,preventDefaultWheelY:l.scrollToZoom},...s}}),t(Mt(ws,Qu))},lf={separator:"/",container:{}},hl=e=>({...lf,...e});function cf({counter:e}){const{slides:t,currentIndex:r}=Ot(),{separator:n,container:{className:o,...a},className:s,...l}=hl(e);return t.length===0?null:T.createElement("div",{className:lt(pe("counter"),o||s),...l,...a,"aria-hidden":!0},r+1," ",n," ",t.length)}function df({augment:e,addChild:t}){e(({counter:r,...n})=>({counter:hl(r),...n})),t(Wr,Mt(Hd,cf))}const uf={autoplay:!1,delay:3e3,ref:null},pl=e=>({...uf,...e}),ml=T.createContext(null),ff=At("useSlideshow","SlideshowContext",ml);function gf({slideshow:e,carousel:{finite:t},on:r,children:n}){const{autoplay:o,delay:a,ref:s}=pl(e),l=T.useRef(o),[f,h]=T.useState(o),d=T.useRef(void 0),i=T.useRef(void 0),{slides:u,currentIndex:g}=Ot(),{setTimeout:p,clearTimeout:m}=Zr(),{subscribe:w}=_r(),{next:x}=zt(),{setAutoPlaying:O}=Fo();T.useEffect(()=>O(f),[f,O]);const y=u.length===0||t&&g===u.length-1,E=T.useCallback(()=>{!f&&!y&&h(!0)},[f,y]),M=T.useCallback(()=>{f&&h(!1)},[f]),_=T.useCallback(()=>{m(d.current),d.current=void 0},[m]),I=Ie(()=>{_(),!(!f||y||i.current===vr||i.current===Co)&&(d.current=p(()=>{f&&(i.current=void 0,x())},a))});T.useEffect(I,[g,f,I]),T.useEffect(()=>{f&&y&&h(!1)},[g,f,y]);const C=Ie(()=>{var A;return(A=r.slideshowStart)===null||A===void 0?void 0:A.call(r)}),v=Ie(()=>{var A;return(A=r.slideshowStop)===null||A===void 0?void 0:A.call(r)});T.useEffect(()=>{f?C():l.current&&v(),l.current=f},[f,C,v]),T.useEffect(()=>kr(_,w(jd,()=>{i.current=vr,_()}),w(Bd,()=>{i.current=Co,_()}),w(Wd,()=>{i.current=Yr,I()}),w(Kd,()=>{i.current=Xr,I()})),[w,_,I]);const N=T.useMemo(()=>({playing:f,disabled:y,play:E,pause:M}),[f,y,E,M]);return T.useImperativeHandle(s,()=>N,[N]),T.createElement(ml.Provider,{value:N},n)}const hf=mt("Play",T.createElement("path",{d:"M8 5v14l11-7z"})),pf=mt("Pause",T.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function mf(){const{playing:e,disabled:t,play:r,pause:n}=ff(),{render:o}=rt(),a=Xs(zt().focus,t);return o.buttonSlideshow?T.createElement(T.Fragment,null,o.buttonSlideshow({playing:e,disabled:t,play:r,pause:n})):T.createElement(Er,{label:e?"Pause":"Play",icon:e?pf:hf,renderIcon:e?o.iconSlideshowPause:o.iconSlideshowPlay,onClick:e?n:r,disabled:t,...a})}function bf({augment:e,addModule:t}){e(({slideshow:r,toolbar:n,...o})=>({toolbar:Cn(n,vs,T.createElement(mf,null)),slideshow:pl(r),...o})),t(Mt(vs,gf))}const yf={auto:!1,ref:null},bl=e=>({...yf,...e}),yl=T.createContext(null),vf=At("useFullscreen","FullscreenContext",yl);function wf({fullscreen:e,on:t,children:r}){const{auto:n,ref:o}=bl(e),a=T.useRef(null),[s,l]=T.useState(),[f,h]=T.useState(!1),d=T.useRef(!1),{getOwnerDocument:i}=Sr();$t(()=>{var y,E,M,_;const I=i();l(!((_=(M=(E=(y=I.fullscreenEnabled)!==null&&y!==void 0?y:I.webkitFullscreenEnabled)!==null&&E!==void 0?E:I.mozFullScreenEnabled)!==null&&M!==void 0?M:I.msFullscreenEnabled)!==null&&_!==void 0&&_))},[i]);const u=T.useCallback(()=>{var y;const E=i(),M=E.fullscreenElement||E.webkitFullscreenElement||E.mozFullScreenElement||E.msFullscreenElement;return((y=M?.shadowRoot)===null||y===void 0?void 0:y.fullscreenElement)||M},[i]),g=T.useCallback(()=>{const y=a.current;try{y.requestFullscreen?y.requestFullscreen().catch(()=>{}):y.webkitRequestFullscreen?y.webkitRequestFullscreen():y.mozRequestFullScreen?y.mozRequestFullScreen():y.msRequestFullscreen&&y.msRequestFullscreen()}catch{}},[]),p=T.useCallback(()=>{if(!u())return;const y=i();try{y.exitFullscreen?y.exitFullscreen().catch(()=>{}):y.webkitExitFullscreen?y.webkitExitFullscreen():y.mozCancelFullScreen?y.mozCancelFullScreen():y.msExitFullscreen&&y.msExitFullscreen()}catch{}},[u,i]);T.useEffect(()=>{const y=i(),E=()=>{h(u()===a.current)};return kr(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(M=>(y.addEventListener(M,E),()=>y.removeEventListener(M,E))))},[u,i]);const m=Ie(()=>{var y;return(y=t.enterFullscreen)===null||y===void 0?void 0:y.call(t)}),w=Ie(()=>{var y;return(y=t.exitFullscreen)===null||y===void 0?void 0:y.call(t)});T.useEffect(()=>{f&&(d.current=!0),d.current&&(f?m:w)()},[f,m,w]);const x=Ie(()=>{var y;return(y=n?g:null)===null||y===void 0||y(),p});T.useEffect(x,[x]);const O=T.useMemo(()=>({fullscreen:f,disabled:s,enter:g,exit:p}),[f,s,g,p]);return T.useImperativeHandle(o,()=>O,[O]),T.createElement("div",{ref:a,className:lt(pe(Kr),pe(xs))},T.createElement(yl.Provider,{value:O},r))}const xf=mt("EnterFullscreen",T.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),kf=mt("ExitFullscreen",T.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function Cf(){var e;const{fullscreen:t,disabled:r,enter:n,exit:o}=vf(),{render:a}=rt();return r?null:a.buttonFullscreen?T.createElement(T.Fragment,null,(e=a.buttonFullscreen)===null||e===void 0?void 0:e.call(a,{fullscreen:t,disabled:r,enter:n,exit:o})):T.createElement(Er,{disabled:r,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?kf:xf,renderIcon:t?a.iconExitFullscreen:a.iconEnterFullscreen,onClick:t?o:n})}function Sf({augment:e,contains:t,addParent:r}){e(({fullscreen:n,toolbar:o,...a})=>({toolbar:Cn(o,Kr,T.createElement(Cf,null)),fullscreen:bl(n),...a})),r(t(Vr)?Vr:Wr,Mt(Kr,wf))}const dr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Wo=e=>({...dr,...e});function vl(){const{thumbnails:e}=rt();return Wo(e)}const ur=e=>or(Vr,e),nt=e=>ur(or("thumbnail",e)),_f=mt("VideoThumbnail",T.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"})),Ef=mt("UnknownThumbnail",T.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 Tf({slide:e,render:t,rect:r,imageFit:n}){var o;const a=(o=t.thumbnail)===null||o===void 0?void 0:o.call(t,{slide:e,render:t,rect:r,imageFit:n});if(a)return a;const s={render:t,rect:r,imageFit:n};if(e.thumbnail)return T.createElement(ir,{slide:{src:e.thumbnail},...s});if(lr(e))return T.createElement(ir,{slide:e,...s});const l=pe(nt(wn));return e.type==="video"?T.createElement(T.Fragment,null,e.poster&&T.createElement(ir,{slide:{src:e.poster},...s}),T.createElement(_f,{className:l})):T.createElement(Ef,{className:l})}const Nf=ar("active"),Ko=ar("fadein"),Vo=ar("fadeout"),Af=ar("placeholder"),wl="delay",xl="duration";function Mf({slide:e,index:t,onClick:r,fadeIn:n,fadeOut:o,placeholder:a,onLoseFocus:s}){const l=T.useRef(null),{render:f,styles:h,labels:d}=rt(),{slides:i,globalIndex:u}=Ot(),{getOwnerDocument:g}=Sr(),{width:p,height:m,imageFit:w}=vl(),x={width:p,height:m},O=t===u,y=Ie(s);return T.useEffect(()=>{o&&g().activeElement===l.current&&y()},[o,y,g]),T.createElement("button",{ref:l,type:"button",className:lt(pe(wr),pe(nt()),O&&pe(nt(Nf())),n&&pe(nt(Ko())),o&&pe(nt(Vo())),a&&pe(nt(Af()))),style:{...n?{[We(nt(Ko(xl)))]:`${n.duration}ms`,[We(nt(Ko(wl)))]:`${n.delay}ms`}:null,...o?{[We(nt(Vo(xl)))]:`${o.duration}ms`,[We(nt(Vo(wl)))]:`${o.delay}ms`}:null,...h.thumbnail},onClick:r,"aria-current":O?!0:void 0,"aria-label":Ds(d,i,t)},e&&Tf({slide:e,render:f,rect:x,imageFit:w}))}function kl(e){return["top","bottom"].includes(e)}function Cl(e,t){return t+2*(e.border+e.padding)+e.gap}function Of(e){const{thumbnail:t,poster:r}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof r=="string"&&r||e&&Ls(e)||void 0}function Sl({visible:e,containerRef:t}){const r=T.useRef(null),n=_n(),{publish:o,subscribe:a}=_r(),{carousel:s,styles:l,labels:f}=rt(),{slides:h,globalIndex:d,animation:i}=Ot(),{registerSensors:u,subscribeSensors:g}=qs();rl(g);const p=vl(),{position:m,width:w,height:x,border:O,borderStyle:y,borderColor:E,borderRadius:M,padding:_,gap:I,vignette:C}=p,v=i?.duration!==void 0&&i?.increment||0,N=i?.duration||0,{prepareAnimation:A}=Uo(r,S=>({keyframes:kl(m)?[{transform:`translateX(${(n?-1:1)*Cl(p,w)*v+S}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${Cl(p,x)*v+S}px)`},{transform:"translateY(0)"}],duration:N,easing:i?.easing})),P=Ie(()=>{let S=0;if(t.current&&r.current){const b=t.current.getBoundingClientRect(),$=r.current.getBoundingClientRect();S=kl(m)?$.left-b.left-(b.width-$.width)/2:$.top-b.top-(b.height-$.height)/2}A(S)});T.useEffect(()=>kr(a(_o,P)),[a,P]);const D=Ps(s,h),L=[];if(Io(h))for(let S=d-D-Math.abs(v);S<=d+D+Math.abs(v);S+=1){const $=s.finite&&(S<0||S>h.length-1)||v<0&&S<d-D||v>0&&S>d+D?null:Do(h,S),F=[`${S}`,Of($)].filter(Boolean).join("|");L.push({key:F,index:S,slide:$})}const U=S=>()=>{S>d?o(er,{count:S-d}):S<d&&o(Rt,{count:d-S})};return T.createElement("div",{className:lt(pe(ur("container")),pe(wr)),style:{...e?null:{display:"none"},...w!==dr.width?{[We(nt("width"))]:`${w}px`}:null,...x!==dr.height?{[We(nt("height"))]:`${x}px`}:null,...O!==dr.border?{[We(nt("border"))]:`${O}px`}:null,...y?{[We(nt("border_style"))]:y}:null,...E?{[We(nt("border_color"))]:E}:null,...M!==dr.borderRadius?{[We(nt("border_radius"))]:`${M}px`}:null,..._!==dr.padding?{[We(nt("padding"))]:`${_}px`}:null,...I!==dr.gap?{[We(nt("gap"))]:`${I}px`}:null,...l.thumbnailsContainer}},T.createElement("nav",{ref:r,style:l.thumbnailsTrack,className:lt(pe(ur("track")),pe(wr)),"aria-label":sr(f,"Thumbnails"),tabIndex:-1,...u},L.map(({key:S,index:b,slide:$})=>{const F=N/Math.abs(v||1),G=v>0&&b>d+D-v&&b<=d+D||v<0&&b<d-D-v&&b>=d-D?{duration:F,delay:((v>0?b-(d+D-v):d-D-v-b)-1)*F}:void 0,Y=v>0&&b<d-D||v<0&&b>d+D?{duration:F,delay:(v>0?v-(d-D-b):-v-(b-(d+D)))*F}:void 0;return T.createElement(Mf,{key:S,index:b,slide:$,fadeIn:G,fadeOut:Y,placeholder:!$,onClick:U(b),onLoseFocus:()=>{var B;return(B=r.current)===null||B===void 0?void 0:B.focus()}})})),C&&T.createElement("div",{className:pe(ur("vignette"))}))}const _l=T.createContext(null),If=At("useThumbnails","ThumbnailsContext",_l);function Df({children:e,...t}){const{ref:r,position:n,hidden:o}=Wo(t.thumbnails),[a,s]=T.useState(!o),l=T.useRef(null),f=T.useMemo(()=>({visible:a,show:()=>s(!0),hide:()=>s(!1)}),[a]);return T.useImperativeHandle(r,()=>f,[f]),T.createElement(Gs,{...t},T.createElement(_l.Provider,{value:f},T.createElement("div",{ref:l,className:lt(pe(ur()),pe(ur(`${n}`)))},["start","top"].includes(n)&&T.createElement(Sl,{containerRef:l,visible:a}),T.createElement("div",{className:pe(ur("wrapper"))},e),["end","bottom"].includes(n)&&T.createElement(Sl,{containerRef:l,visible:a}))))}const El=()=>T.createElement(T.Fragment,null,T.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),T.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),Lf=mt("ThumbnailsVisible",El()),Pf=fu("ThumbnailsHidden",El());function Ff(){const{visible:e,show:t,hide:r}=If(),{render:n}=rt();return n.buttonThumbnails?T.createElement(T.Fragment,null,n.buttonThumbnails({visible:e,show:t,hide:r})):T.createElement(Er,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?Lf:Pf,renderIcon:e?n.iconThumbnailsVisible:n.iconThumbnailsHidden,onClick:e?r:t})}function $f({augment:e,contains:t,append:r,addParent:n}){e(({thumbnails:a,toolbar:s,...l})=>{const f=Wo(a);return{toolbar:Cn(s,Vr,f.showToggle?T.createElement(Ff,null):null),thumbnails:f,...l}});const o=Mt(Vr,Df);t(Kr)?r(Kr,o):n(Wr,o)}const Ct=({className:e="",children:t,style:r,...n})=>c.jsx("i",{className:e,style:r,...n,children:t}),Yo=window.G7Core,Tn=(e,t)=>Yo?.t?.(e,t)??e,Uf=async(e,t)=>{try{const r=await Yo.api.get(e,{responseType:"blob"});if(r){const n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}}catch(r){console.error("Failed to download file:",r),Yo?.toast?.error?.(Tn("common.download_failed"))}},zf=(e,t)=>{const r=document.createElement("a");r.href=e,r.download=t,r.target="_blank",document.body.appendChild(r),r.click(),document.body.removeChild(r)},Tl=async e=>{const t=e.downloadUrl||e.src,r=e.filename||e.title||"image";e.downloadRequiresAuth?await Uf(t,r):zf(t,r)},Hf=({image:e,index:t,onDownload:r})=>{const[n,o]=k.useState(!1),a=async s=>{if(s.stopPropagation(),r){r(e,t);return}o(!0);try{await Tl(e)}finally{o(!1)}};return c.jsx(Q,{type:"button",onClick:a,disabled:n,className:"yarl__button flex items-center justify-center","aria-label":Tn("common.download"),title:Tn("common.download"),children:n?c.jsx(Ct,{className:"fa-solid fa-spinner fa-spin text-white"}):c.jsx(Ct,{className:"fa-solid fa-download text-white"})})},Tr=({images:e,isOpen:t,onClose:r,startIndex:n=0,enableZoom:o=!0,enableSlideshow:a=!1,enableFullscreen:s=!0,showCounter:l=!0,showDownload:f=!0,showThumbnails:h=!0,onDownload:d,editorAttrs:i,id:u})=>{const[g,p]=k.useState(n),m=k.useRef(n),w=e.map(y=>({src:y.src,title:y.title,description:y.description})),x=[];o&&x.push(sf),a&&x.push(bf),s&&x.push(Sf),l&&x.push(df),h&&x.push($f);const O=e[g];if(k.useEffect(()=>{m.current=g},[g]),i){const y=(e??[]).slice(0,4);return c.jsx(W,{id:u,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",...i,children:y.length>0?y.map((E,M)=>c.jsx(Lt,{src:E.thumbnail||E.src,alt:E.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},M)):c.jsxs(W,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[c.jsx(Ct,{className:"fa-regular fa-images mr-2"}),Tn("editor.component.image_gallery")]})})}return c.jsx(Bu,{open:t,close:r,slides:w,index:g,plugins:x,on:{view:({index:y})=>{y!==m.current&&p(y)}},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:[f&&O&&c.jsx(Hf,{image:O,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},Nl=()=>{const[e,t]=k.useState(!1),[r,n]=k.useState([]),[o,a]=k.useState(0),s=k.useCallback((f,h=0)=>{n(f),a(h),t(!0)},[]),l=k.useCallback(()=>{t(!1)},[]);return{isOpen:e,openGallery:s,closeGallery:l,galleryProps:{images:r,isOpen:e,onClose:l,startIndex:o}}};Tr.displayName="ImageGallery";const Al=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Tr,default:Tr,executeImageDownload:Tl,useImageGallery:Nl},Symbol.toStringTag,{value:"Module"})),Gf=window.G7Core,Xo=(e,t)=>Gf?.t?.(e,t)??e,Nn=e=>e.url??e.download_url,An=({images:e=[],className:t="",id:r,editorAttrs:n})=>{const[o,a]=k.useState(0),{openGallery:s,galleryProps:l}=Nl(),f=k.useMemo(()=>e.map(d=>({src:Nn(d),title:d.alt_text_current??"",thumbnail:Nn(d),downloadUrl:d.download_url,filename:d.alt_text_current??`image-${d.id}`})),[e]);if(!e||e.length===0)return c.jsx(W,{className:`flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-lg aspect-square ${t}`,id:r,...n,children:c.jsxs(W,{className:"text-center text-gray-400 dark:text-gray-500",children:[c.jsx(de,{name:"image",size:"3x",className:"mb-3 opacity-50"}),c.jsx(W,{className:"text-sm",children:Xo("shop.no_image")})]})});const h=e[o]??e[0];return c.jsxs(W,{id:r,className:t,...n,children:[c.jsx(W,{className:"relative overflow-hidden rounded-lg bg-gray-100 dark:bg-gray-700 aspect-square mb-3",children:c.jsx(Q,{type:"button",className:"w-full h-full cursor-zoom-in block",onClick:()=>s(f,o),"aria-label":Xo("shop.view_image"),children:c.jsx(Lt,{src:Nn(h),alt:h.alt_text_current??"",className:"w-full h-full object-contain"})})}),e.length>1&&c.jsx(W,{className:"flex gap-2 overflow-x-auto pb-1",children:e.map((d,i)=>c.jsx(Q,{type:"button",className:`flex-shrink-0 w-16 h-16 rounded-md overflow-hidden border-2 transition-colors cursor-pointer ${i===o?"border-gray-900 dark:border-white":"border-gray-200 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-400"}`,onClick:()=>a(i),"aria-label":d.alt_text_current??`${Xo("shop.image")} ${i+1}`,children:c.jsx(Lt,{src:Nn(d),alt:d.alt_text_current??"",className:"w-full h-full object-cover"})},d.id))}),c.jsx(Tr,{...l})]})};An.displayName="ProductImageViewer";const jf=Object.freeze(Object.defineProperty({__proto__:null,ProductImageViewer:An,default:An},Symbol.toStringTag,{value:"Module"})),Ml=({value:e,min:t=1,max:r=999,onChange:n,size:o="md",disabled:a=!1,className:s="",id:l,editorAttrs:f})=>{const d={sm:{container:"h-8",button:"w-8 h-8 text-sm",input:"w-10 text-sm"},md:{container:"h-10",button:"w-10 h-10",input:"w-14"},lg:{container:"h-12",button:"w-12 h-12 text-lg",input:"w-16 text-lg"}}[o],i=()=>{e>t&&!a&&n(e-1)},u=()=>{e<r&&!a&&n(e+1)},g=x=>{const O=parseInt(x.target.value,10);if(!isNaN(O)){const y=Math.max(t,Math.min(r,O));n(y)}},p=x=>{const O=parseInt(x.target.value,10);isNaN(O)||O<t?n(t):O>r&&n(r)},m=a||e<=t,w=a||e>=r;return c.jsxs(W,{className:`inline-flex items-center border border-gray-300 dark:border-gray-600 rounded-lg ${d.container} ${s}`,id:l,...f,children:[c.jsx(Q,{type:"button",onClick:i,disabled:m,className:`${d.button} flex items-center justify-center text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-l-lg transition-colors`,"aria-label":"수량 감소",children:c.jsx(de,{name:"minus",className:"w-4 h-4"})}),c.jsx(xt,{type:"number",value:e,onChange:g,onBlur:p,min:t,max:r,disabled:a,className:`${d.input} text-center border-x border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`,"aria-label":"수량"}),c.jsx(Q,{type:"button",onClick:u,disabled:w,className:`${d.button} flex items-center justify-center text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-r-lg transition-colors`,"aria-label":"수량 증가",children:c.jsx(de,{name:"plus",className:"w-4 h-4"})})]})},Bf=Object.freeze(Object.defineProperty({__proto__:null,default:Ml},Symbol.toStringTag,{value:"Module"})),Wf=window.G7Core?.createLogger?.("Comp:PostReactions")??{log:(...e)=>console.log("[Comp:PostReactions]",...e),warn:(...e)=>console.warn("[Comp:PostReactions]",...e),error:(...e)=>console.error("[Comp:PostReactions]",...e)},Ol=(e,t)=>window.G7Core?.t?.(e,t)??e,Kf=[{type:"like",emoji:"👍",labelKey:"board.reactions.like",activeColor:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400"},{type:"funny",emoji:"😂",labelKey:"board.reactions.funny",activeColor:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600 dark:text-yellow-400"},{type:"agree",emoji:"👌",labelKey:"board.reactions.agree",activeColor:"bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400"},{type:"thanks",emoji:"🙏",labelKey:"board.reactions.thanks",activeColor:"bg-purple-100 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400"},{type:"wow",emoji:"😮",labelKey:"board.reactions.wow",activeColor:"bg-orange-100 dark:bg-orange-900/30 text-orange-600 dark:text-orange-400"}],Il=({reactions:e,userReaction:t,postId:r,onReact:n,size:o="md",className:a="",id:s,editorAttrs:l})=>{const f={sm:"px-2 py-1 text-xs gap-1",md:"px-3 py-1.5 text-sm gap-1.5",lg:"px-4 py-2 text-base gap-2"},h={sm:"text-sm",md:"text-base",lg:"text-lg"},d=u=>e.find(p=>p.type===u)?.count??0,i=async u=>{if(n){n(u);return}try{if(!(await fetch(`/api/posts/${r}/reactions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:u}),credentials:"include"})).ok)throw new Error("리액션 처리 실패");window.location.reload()}catch(g){Wf.error("리액션 오류:",g)}};return c.jsx(W,{className:`flex flex-wrap gap-2 ${a}`,id:s,...l,children:Kf.map(u=>{const g=d(u.type),p=t===u.type;return c.jsxs(Q,{onClick:()=>i(u.type),className:`
|
||
inline-flex items-center rounded-full border transition-colors
|
||
${f[o]}
|
||
${p?`${u.activeColor} border-transparent`:"border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}
|
||
`,title:Ol(u.labelKey),children:[c.jsx(ee,{className:h[o],children:u.emoji}),c.jsx(ee,{children:Ol(u.labelKey)}),g>0&&c.jsx(ee,{className:"font-medium",children:g})]},u.type)})})},Vf=Object.freeze(Object.defineProperty({__proto__:null,default:Il},Symbol.toStringTag,{value:"Module"})),Mn=window.G7Core?.createLogger?.("Comp:RichTextEditor")??{log:(...e)=>console.log("[Comp:RichTextEditor]",...e),warn:(...e)=>console.warn("[Comp:RichTextEditor]",...e),error:(...e)=>console.error("[Comp:RichTextEditor]",...e)},St=(e,t)=>window.G7Core?.t?.(e,t)??e,Dl=({name:e,initialValue:t="",placeholder:r,onChange:n,imageUploadUrl:o="/api/upload/image",minHeight:a="300px",disabled:s=!1,className:l="",id:f,editorAttrs:h})=>{const d=k.useRef(null),[i,u]=k.useState(t),[g,p]=k.useState(!1),[m,w]=k.useState(!1),[x,O]=k.useState("");k.useEffect(()=>{d.current&&!d.current.innerHTML&&(d.current.innerHTML=t)},[t]),k.useEffect(()=>{n&&n(i)},[i,n]);const y=N=>{Mn.log("Apply format:",N)},E=async N=>{const A=new FormData;A.append("file",N);try{const P=await fetch(o,{method:"POST",body:A,credentials:"include"});if(!P.ok)throw new Error("업로드 실패");const D=await P.json();Mn.log("Image uploaded:",D.url)}catch(P){Mn.error("이미지 업로드 오류:",P)}},M=N=>{const A=N.target.files?.[0];A&&E(A)},_=()=>{x&&(Mn.log("Insert link:",x),w(!1),O(""))},I=[{format:"bold",icon:"B",title:St("editor.toolbar.bold")},{format:"italic",icon:"I",title:St("editor.toolbar.italic")},{format:"underline",icon:"U",title:St("editor.toolbar.underline")},{format:"strike",icon:"S",title:St("editor.toolbar.strike")},{format:"code",icon:"</>",title:St("editor.toolbar.code")}],C=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],v=[{format:"bulletList",icon:"•",title:St("editor.toolbar.bullet_list")},{format:"orderedList",icon:"1.",title:St("editor.toolbar.ordered_list")},{format:"blockquote",icon:"❝",title:St("editor.toolbar.blockquote")}];return c.jsxs(W,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,id:f,...h,children:[c.jsxs(W,{className:"flex flex-wrap items-center gap-1 p-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[c.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:I.map(N=>c.jsx(Q,{type:"button",onClick:()=>y(N.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:N.title,children:N.icon},N.format))}),c.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:C.map(N=>c.jsx(Q,{type:"button",onClick:()=>y(N.format),disabled:s,className:"px-2 h-8 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",children:N.label},N.format))}),c.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:v.map(N=>c.jsx(Q,{type:"button",onClick:()=>y(N.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:N.title,children:N.icon},N.format))}),c.jsxs(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[c.jsx(Q,{type:"button",onClick:()=>w(!0),disabled:s,className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:St("editor.toolbar.link"),children:"🔗"}),c.jsxs(yr,{className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer",children:["🖼",c.jsx(xt,{type:"file",accept:"image/*",onChange:M,disabled:s,className:"hidden"})]})]}),c.jsxs(Q,{type:"button",onClick:()=>p(!g),disabled:s,className:`px-2 h-8 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50 ${g?"bg-gray-200 dark:bg-gray-700":""}`,children:["</>",St("editor.toolbar.code_view")]})]}),g?c.jsx(no,{value:i,onChange:N=>u(N.target.value),placeholder:r,disabled:s,className:"w-full p-4 bg-gray-900 text-gray-100 font-mono text-sm focus:outline-none resize-none",style:{minHeight:a}}):c.jsx(W,{ref:d,contentEditable:!s,onInput:N=>u(N.currentTarget.innerHTML),className:"p-4 bg-white dark:bg-gray-900 text-gray-900 dark:text-white focus:outline-none prose dark:prose-invert max-w-none",style:{minHeight:a},"data-placeholder":r}),c.jsx(xt,{type:"hidden",name:e,value:i}),m&&c.jsx(W,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:c.jsxs(W,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[c.jsx(gn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:St("editor.link_modal.title")}),c.jsx(xt,{type:"url",value:x,onChange:N=>O(N.target.value),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white mb-4"}),c.jsxs(W,{className:"flex justify-end gap-2",children:[c.jsx(Q,{type:"button",onClick:()=>{w(!1),O("")},className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:St("common.cancel")}),c.jsx(Q,{type:"button",onClick:_,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:St("editor.link_modal.insert")})]})]})})]})},Yf=Object.freeze(Object.defineProperty({__proto__:null,default:Dl},Symbol.toStringTag,{value:"Module"})),qo=({content:e,text:t,isHtml:r=!0,className:n="",purifyConfig:o,id:a,editorAttrs:s})=>{const l=t??e??"";if(!l||l.trim()==="")return null;if(!r){const i=`
|
||
whitespace-pre-wrap
|
||
text-gray-900 dark:text-gray-100
|
||
font-sans
|
||
${n}
|
||
`.trim().replace(/\s+/g," ");return c.jsx(W,{className:i,id:a,...s,children:l})}const f={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"]},h=k.useMemo(()=>{const i=o?{...f,...o,FORBID_TAGS:[...f.FORBID_TAGS,...o.FORBID_TAGS||[]],FORBID_ATTR:[...f.FORBID_ATTR,...o.FORBID_ATTR||[]]}:f;return wo.sanitize(l,i).replace(/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,p,m,w)=>(m.startsWith("http://")||m.startsWith("https://"))&&!g.includes("rel=")?`<a ${p}href="${m}"${w} rel="noopener noreferrer">`:g)},[l,o]),d=`
|
||
prose dark:prose-invert max-w-none
|
||
prose-p:my-2
|
||
prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4
|
||
prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg
|
||
prose-a:text-blue-600 dark:prose-a:text-blue-400
|
||
prose-a:no-underline hover:prose-a:underline
|
||
prose-blockquote:border-l-4 prose-blockquote:border-gray-300 dark:prose-blockquote:border-gray-600
|
||
prose-blockquote:pl-4 prose-blockquote:italic
|
||
prose-code:bg-gray-100 dark:prose-code:bg-gray-800
|
||
prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
||
prose-pre:bg-gray-100 dark:prose-pre:bg-gray-800
|
||
prose-pre:p-4 prose-pre:rounded-lg prose-pre:overflow-x-auto
|
||
[&_table]:w-full [&_table]:border-collapse [&_table]:border [&_table]:border-gray-300
|
||
dark:[&_table]:border-gray-600
|
||
[&_th]:border [&_th]:border-gray-300 [&_th]:px-4 [&_th]:py-2 [&_th]:bg-gray-100 [&_th]:text-left
|
||
dark:[&_th]:border-gray-600 dark:[&_th]:bg-gray-800
|
||
[&_td]:border [&_td]:border-gray-300 [&_td]:px-4 [&_td]:py-2
|
||
dark:[&_td]:border-gray-600
|
||
[&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50
|
||
after:content-[''] after:block after:clear-both
|
||
${n}
|
||
`.trim().replace(/\s+/g," ");return c.jsx(W,{id:a,className:d,dangerouslySetInnerHTML:{__html:h},...s})},Xf=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:qo},Symbol.toStringTag,{value:"Module"})),Zo=()=>window.G7Core,Qo=(e,t)=>Zo()?.t?.(e,t)??e,Ll=({content:e="",onChange:t,isHtml:r=!1,onIsHtmlChange:n,rows:o=15,placeholder:a="",label:s,showHtmlModeToggle:l=!0,contentClassName:f="",purifyConfig:h,className:d="",name:i="content",htmlFieldName:u="content_mode",readOnly:g=!1,id:p,editorAttrs:m})=>{const[w,x]=k.useState(r),[O,y]=k.useState(e),[E,M]=k.useState(!1);k.useEffect(()=>{x(r)},[r]),k.useEffect(()=>{y(e)},[e]);const _=k.useCallback(v=>{const N=v.target.value;if(y(N),t){const A=Zo()?.createChangeEvent?.({value:N,name:i,type:"textarea"})??{target:{name:i,value:N}};t(A)}},[t,i]),I=k.useCallback(v=>{const N=v.target.checked;if(x(N),N||M(!1),n){const A=Zo()?.createChangeEvent?.({checked:N,name:u,type:"checkbox"})??{target:{name:u,checked:N}};n(A)}},[n,u]),C=k.useCallback(()=>{M(v=>!v)},[]);return c.jsxs(W,{className:`space-y-2 ${d}`,id:p,...m,children:[c.jsxs(W,{className:"flex items-center justify-between",children:[s&&c.jsx(yr,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),c.jsxs(W,{className:"flex items-center gap-3",children:[w&&!g&&c.jsx(Q,{type:"button",onClick:C,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${E?"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:Qo(E?"common.preview_off":"common.preview")}),l&&c.jsxs(yr,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[c.jsx(xt,{type:"checkbox",name:u,checked:w,onChange:I,disabled:g,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"}),c.jsx(W,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Qo("common.html_mode")})]})]})]}),!E&&c.jsx(no,{name:i,value:O,onChange:_,placeholder:a,rows:o,readOnly:g,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 ${w?"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"}`}),E&&c.jsx(W,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:c.jsx(qo,{content:O,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:h})})]})},qf=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:Ll},Symbol.toStringTag,{value:"Module"})),Pl=e=>window.G7Core?.t?.(e)??e,Jo=({maxHeight:e=500,expandText:t,collapseText:r,className:n="",children:o,id:a,editorAttrs:s})=>{const[l,f]=k.useState(!1),[h,d]=k.useState(!1),i=k.useRef(null),u=k.useCallback(()=>{if(i.current){const w=i.current.scrollHeight;d(w>e)}},[e]);k.useEffect(()=>{u();const w=i.current;if(!w)return;const x=w.querySelectorAll("img");x.forEach(y=>{y.complete||y.addEventListener("load",u)});let O=null;return typeof ResizeObserver<"u"&&(O=new ResizeObserver(u),O.observe(w)),()=>{x.forEach(y=>{y.removeEventListener("load",u)}),O?.disconnect()}},[u,o]);const g=()=>{f(w=>!w)},p=t||Pl("sirsoft-ecommerce.shop.product.expand_detail"),m=r||Pl("sirsoft-ecommerce.shop.product.collapse_detail");return c.jsxs(W,{className:n,id:a,...s,children:[c.jsxs(W,{className:"relative",children:[c.jsx(W,{ref:i,className:!l&&h?"overflow-hidden transition-[max-height] duration-300 ease-in-out":"transition-[max-height] duration-300 ease-in-out",style:!l&&h?{maxHeight:`${e}px`}:void 0,children:o}),!l&&h&&c.jsx(W,{className:"absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-white dark:from-gray-900 to-transparent pointer-events-none"})]}),h&&c.jsxs(Q,{type:"button",onClick:g,className:"flex items-center justify-center w-full py-3.5 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors cursor-pointer gap-1.5",children:[c.jsx(ee,{className:"text-sm font-semibold text-gray-600 dark:text-gray-400",children:l?m:p}),c.jsx(de,{name:l?"chevron-up":"chevron-down",size:"sm"})]})]})},Zf=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:Jo,default:Jo},Symbol.toStringTag,{value:"Module"})),Qf=(e,t)=>window.G7Core?.t?.(e,t)??e,Ro=({isOpen:e,onClose:t,title:r,icon:n,iconClassName:o="text-gray-500 dark:text-gray-400",closeOnBackdropClick:a=!0,closeOnOverlayClick:s,showCloseButton:l=!0,closeOnEscape:f=!0,children:h,width:d="500px",className:i="",style:u})=>{const g=s!==void 0?s:a,p=k.useRef(null),m=k.useRef(null);if(k.useEffect(()=>{const x=O=>{O.key==="Escape"&&e&&f&&t()};if(e&&f)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,t,f]),k.useEffect(()=>{if(e&&p.current){m.current=document.activeElement;const x=p.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),O=x[0],y=x[x.length-1];O?.focus();const E=M=>{M.key==="Tab"&&(M.shiftKey?document.activeElement===O&&(M.preventDefault(),y?.focus()):document.activeElement===y&&(M.preventDefault(),O?.focus()))};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E),m.current?.focus()}}},[e]),k.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const w=u?.zIndex??50;return c.jsxs(W,{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:w},onClick:g?t:void 0,children:[c.jsx(W,{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),c.jsxs(W,{ref:p,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden ${i}`,style:{width:d,...u?{...u,zIndex:void 0}:{}},onClick:x=>x.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[(r||n||l)&&c.jsxs(W,{className:"flex items-center justify-between p-4",children:[(r||n)&&c.jsxs(W,{id:"modal-title",className:"flex items-center gap-3 text-lg font-semibold text-gray-900 dark:text-white",children:[n&&c.jsx(de,{name:n,size:"md",className:o}),r]}),l&&c.jsx(Q,{onClick:t,className:"ml-auto text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 focus:outline-none","aria-label":Qf("common.close_modal"),children:c.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsx(W,{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-140px)]",children:h})]})]})},Jf=Object.freeze(Object.defineProperty({__proto__:null,Modal:Ro},Symbol.toStringTag,{value:"Module"})),ea=(e,t)=>window.G7Core?.t?.(e,t)??e,ta=({isOpen:e,onClose:t,title:r,message:n,confirmText:o,cancelText:a,onConfirm:s,onCancel:l,confirmButtonVariant:f="primary",cancelButtonVariant:h="secondary",width:d="500px",closeOnOverlay:i=!0,isLoading:u=!1,loadingText:g})=>{const p=o??ea("common.confirm"),m=a??ea("common.cancel"),w=g??ea("common.loading"),x=()=>{s()},O=()=>{u||(l?.(),t())},y=()=>{u||t()},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 c.jsxs(Ro,{isOpen:e,onClose:y,title:r,width:d,children:[c.jsx(W,{className:"py-2",children:typeof n=="string"?c.jsx(Dt,{className:"text-gray-700 dark:text-gray-300",children:n}):n}),c.jsxs(W,{className:"flex justify-end gap-3 mt-6",children:[c.jsx(Q,{onClick:O,disabled:u,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:c.jsx(ee,{children:m})}),c.jsxs(Q,{onClick:x,disabled:u,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${E[f]}`,children:[u&&c.jsx(Ct,{className:"fa-solid fa-spinner w-4 h-4 animate-spin"}),c.jsx(ee,{children:u?w:p})]})]})]})},Rf=Object.freeze(Object.defineProperty({__proto__:null,ConfirmDialog:ta},Symbol.toStringTag,{value:"Module"})),Fl=k.createContext(null),$l=({value:e,children:t})=>c.jsx(Fl.Provider,{value:e,children:t}),eg=()=>{const e=k.useContext(Fl);if(!e)throw new Error("useFileUploaderContext must be used within FileUploaderProvider");return e};function tg(e,t){return t.forEach((function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach((function(n){if(n!=="default"&&!(n in e)){var o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return r[n]}})}}))})),Object.freeze(e)}function Ul(e,t){return new Promise((function(r,n){let o;return rg(e).then((function(a){try{return o=a,r(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(s){return n(s)}}),n)}))}const rg=e=>new Promise(((t,r)=>{const n=new FileReader;n.addEventListener("load",(({target:{result:o}})=>{const a=new DataView(o);let s=0;if(a.getUint16(s)!==65496)return r("not a valid JPEG");for(s+=2;;){const l=a.getUint16(s);if(l===65498)break;const f=a.getUint16(s+2);if(l===65505&&a.getUint32(s+4)===1165519206){const h=s+10;let d;switch(a.getUint16(h)){case 18761:d=!0;break;case 19789:d=!1;break;default:return r("TIFF header contains invalid endian")}if(a.getUint16(h+2,d)!==42)return r("TIFF header contains invalid version");const i=a.getUint32(h+4,d),u=h+i+2+12*a.getUint16(h+i,d);for(let g=h+i+2;g<u;g+=12)if(a.getUint16(g,d)==274){if(a.getUint16(g+2,d)!==3)return r("Orientation data type is invalid");if(a.getUint32(g+4,d)!==1)return r("Orientation data count is invalid");a.setUint16(g+8,1,d);break}return t(o.slice(s,s+2+f))}s+=2+f}return t(new Blob)})),n.readAsArrayBuffer(e)}));var On={},ng={get exports(){return On},set exports(e){On=e}};(function(e){var t,r,n={};ng.exports=n,n.parse=function(o,a){for(var s=n.bin.readUshort,l=n.bin.readUint,f=0,h={},d=new Uint8Array(o),i=d.length-4;l(d,i)!=101010256;)i--;f=i,f+=4;var u=s(d,f+=4);s(d,f+=2);var g=l(d,f+=2),p=l(d,f+=4);f+=4,f=p;for(var m=0;m<u;m++){l(d,f),f+=4,f+=4,f+=4,l(d,f+=4),g=l(d,f+=4);var w=l(d,f+=4),x=s(d,f+=4),O=s(d,f+2),y=s(d,f+4);f+=6;var E=l(d,f+=8);f+=4,f+=x+O+y,n._readLocal(d,E,h,g,w,a)}return h},n._readLocal=function(o,a,s,l,f,h){var d=n.bin.readUshort,i=n.bin.readUint;i(o,a),d(o,a+=4),d(o,a+=2);var u=d(o,a+=2);i(o,a+=2),i(o,a+=4),a+=4;var g=d(o,a+=8),p=d(o,a+=2);a+=2;var m=n.bin.readUTF8(o,a,g);if(a+=g,a+=p,h)s[m]={size:f,csize:l};else{var w=new Uint8Array(o.buffer,a);if(u==0)s[m]=new Uint8Array(w.buffer.slice(a,a+l));else{if(u!=8)throw"unknown compression method: "+u;var x=new Uint8Array(f);n.inflateRaw(w,x),s[m]=x}}},n.inflateRaw=function(o,a){return n.F.inflate(o,a)},n.inflate=function(o,a){return o[0],o[1],n.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),a)},n.deflate=function(o,a){a==null&&(a={level:6});var s=0,l=new Uint8Array(50+Math.floor(1.1*o.length));l[s]=120,l[s+1]=156,s+=2,s=n.F.deflateRaw(o,l,s,a.level);var f=n.adler(o,0,o.length);return l[s+0]=f>>>24&255,l[s+1]=f>>>16&255,l[s+2]=f>>>8&255,l[s+3]=f>>>0&255,new Uint8Array(l.buffer,0,s+4)},n.deflateRaw=function(o,a){a==null&&(a={level:6});var s=new Uint8Array(50+Math.floor(1.1*o.length)),l=n.F.deflateRaw(o,s,l,a.level);return new Uint8Array(s.buffer,0,l)},n.encode=function(o,a){a==null&&(a=!1);var s=0,l=n.bin.writeUint,f=n.bin.writeUshort,h={};for(var d in o){var i=!n._noNeed(d)&&!a,u=o[d],g=n.crc.crc(u,0,u.length);h[d]={cpr:i,usize:u.length,crc:g,file:i?n.deflateRaw(u):u}}for(var d in h)s+=h[d].file.length+30+46+2*n.bin.sizeUTF8(d);s+=22;var p=new Uint8Array(s),m=0,w=[];for(var d in h){var x=h[d];w.push(m),m=n._writeHeader(p,m,d,x,0)}var O=0,y=m;for(var d in h)x=h[d],w.push(m),m=n._writeHeader(p,m,d,x,1,w[O++]);var E=m-y;return l(p,m,101010256),m+=4,f(p,m+=4,O),f(p,m+=2,O),l(p,m+=2,E),l(p,m+=4,y),m+=4,m+=2,p.buffer},n._noNeed=function(o){var a=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(a)!=-1},n._writeHeader=function(o,a,s,l,f,h){var d=n.bin.writeUint,i=n.bin.writeUshort,u=l.file;return d(o,a,f==0?67324752:33639248),a+=4,f==1&&(a+=2),i(o,a,20),i(o,a+=2,0),i(o,a+=2,l.cpr?8:0),d(o,a+=2,0),d(o,a+=4,l.crc),d(o,a+=4,u.length),d(o,a+=4,l.usize),i(o,a+=4,n.bin.sizeUTF8(s)),i(o,a+=2,0),a+=2,f==1&&(a+=2,a+=2,d(o,a+=6,h),a+=4),a+=n.bin.writeUTF8(o,a,s),f==0&&(o.set(u,a),a+=u.length),a},n.crc={table:(function(){for(var o=new Uint32Array(256),a=0;a<256;a++){for(var s=a,l=0;l<8;l++)1&s?s=3988292384^s>>>1:s>>>=1;o[a]=s}return o})(),update:function(o,a,s,l){for(var f=0;f<l;f++)o=n.crc.table[255&(o^a[s+f])]^o>>>8;return o},crc:function(o,a,s){return 4294967295^n.crc.update(4294967295,o,a,s)}},n.adler=function(o,a,s){for(var l=1,f=0,h=a,d=a+s;h<d;){for(var i=Math.min(h+5552,d);h<i;)f+=l+=o[h++];l%=65521,f%=65521}return f<<16|l},n.bin={readUshort:function(o,a){return o[a]|o[a+1]<<8},writeUshort:function(o,a,s){o[a]=255&s,o[a+1]=s>>8&255},readUint:function(o,a){return 16777216*o[a+3]+(o[a+2]<<16|o[a+1]<<8|o[a])},writeUint:function(o,a,s){o[a]=255&s,o[a+1]=s>>8&255,o[a+2]=s>>16&255,o[a+3]=s>>24&255},readASCII:function(o,a,s){for(var l="",f=0;f<s;f++)l+=String.fromCharCode(o[a+f]);return l},writeASCII:function(o,a,s){for(var l=0;l<s.length;l++)o[a+l]=s.charCodeAt(l)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,a,s){for(var l,f="",h=0;h<s;h++)f+="%"+n.bin.pad(o[a+h].toString(16));try{l=decodeURIComponent(f)}catch{return n.bin.readASCII(o,a,s)}return l},writeUTF8:function(o,a,s){for(var l=s.length,f=0,h=0;h<l;h++){var d=s.charCodeAt(h);if((4294967168&d)==0)o[a+f]=d,f++;else if((4294965248&d)==0)o[a+f]=192|d>>6,o[a+f+1]=128|d>>0&63,f+=2;else if((4294901760&d)==0)o[a+f]=224|d>>12,o[a+f+1]=128|d>>6&63,o[a+f+2]=128|d>>0&63,f+=3;else{if((4292870144&d)!=0)throw"e";o[a+f]=240|d>>18,o[a+f+1]=128|d>>12&63,o[a+f+2]=128|d>>6&63,o[a+f+3]=128|d>>0&63,f+=4}}return f},sizeUTF8:function(o){for(var a=o.length,s=0,l=0;l<a;l++){var f=o.charCodeAt(l);if((4294967168&f)==0)s++;else if((4294965248&f)==0)s+=2;else if((4294901760&f)==0)s+=3;else{if((4292870144&f)!=0)throw"e";s+=4}}return s}},n.F={},n.F.deflateRaw=function(o,a,s,l){var f=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][l],h=n.F.U,d=n.F._goodIndex;n.F._hash;var i=n.F._putsE,u=0,g=s<<3,p=0,m=o.length;if(l==0){for(;u<m;)i(a,g,u+(A=Math.min(65535,m-u))==m?1:0),g=n.F._copyExact(o,u,A,a,g+8),u+=A;return g>>>3}var w=h.lits,x=h.strt,O=h.prev,y=0,E=0,M=0,_=0,I=0,C=0;for(m>2&&(x[C=n.F._hash(o,0)]=0),u=0;u<m;u++){if(I=C,u+1<m-2){C=n.F._hash(o,u+1);var v=u+1&32767;O[v]=x[C],x[C]=v}if(p<=u){(y>14e3||E>26697)&&m-u>100&&(p<u&&(w[y]=u-p,y+=2,p=u),g=n.F._writeBlock(u==m-1||p==m?1:0,w,y,_,o,M,u-M,a,g),y=E=_=0,M=u);var N=0;u<m-2&&(N=n.F._bestMatch(o,u,O,I,Math.min(f[2],m-u),f[3]));var A=N>>>16,P=65535&N;if(N!=0){P=65535&N;var D=d(A=N>>>16,h.of0);h.lhst[257+D]++;var L=d(P,h.df0);h.dhst[L]++,_+=h.exb[D]+h.dxb[L],w[y]=A<<23|u-p,w[y+1]=P<<16|D<<8|L,y+=2,p=u+A}else h.lhst[o[u]]++;E++}}for(M==u&&o.length!=0||(p<u&&(w[y]=u-p,y+=2,p=u),g=n.F._writeBlock(1,w,y,_,o,M,u-M,a,g),y=0,E=0,y=E=_=0,M=u);(7&g)!=0;)g++;return g>>>3},n.F._bestMatch=function(o,a,s,l,f,h){var d=32767&a,i=s[d],u=d-i+32768&32767;if(i==d||l!=n.F._hash(o,a-u))return 0;for(var g=0,p=0,m=Math.min(32767,a);u<=m&&--h!=0&&i!=d;){if(g==0||o[a+g]==o[a+g-u]){var w=n.F._howLong(o,a,u);if(w>g){if(p=u,(g=w)>=f)break;u+2<w&&(w=u+2);for(var x=0,O=0;O<w-2;O++){var y=a-u+O+32768&32767,E=y-s[y]+32768&32767;E>x&&(x=E,i=y)}}}u+=(d=i)-(i=s[d])+32768&32767}return g<<16|p},n.F._howLong=function(o,a,s){if(o[a]!=o[a-s]||o[a+1]!=o[a+1-s]||o[a+2]!=o[a+2-s])return 0;var l=a,f=Math.min(o.length,a+258);for(a+=3;a<f&&o[a]==o[a-s];)a++;return a-l},n.F._hash=function(o,a){return(o[a]<<8|o[a+1])+(o[a+2]<<4)&65535},n.saved=0,n.F._writeBlock=function(o,a,s,l,f,h,d,i,u){var g,p,m,w,x,O,y,E,M,_=n.F.U,I=n.F._putsF,C=n.F._putsE;_.lhst[256]++,p=(g=n.F.getTrees())[0],m=g[1],w=g[2],x=g[3],O=g[4],y=g[5],E=g[6],M=g[7];var v=32+((u+3&7)==0?0:8-(u+3&7))+(d<<3),N=l+n.F.contSize(_.fltree,_.lhst)+n.F.contSize(_.fdtree,_.dhst),A=l+n.F.contSize(_.ltree,_.lhst)+n.F.contSize(_.dtree,_.dhst);A+=14+3*y+n.F.contSize(_.itree,_.ihst)+(2*_.ihst[16]+3*_.ihst[17]+7*_.ihst[18]);for(var P=0;P<286;P++)_.lhst[P]=0;for(P=0;P<30;P++)_.dhst[P]=0;for(P=0;P<19;P++)_.ihst[P]=0;var D=v<N&&v<A?0:N<A?1:2;if(I(i,u,o),I(i,u+1,D),u+=3,D==0){for(;(7&u)!=0;)u++;u=n.F._copyExact(f,h,d,i,u)}else{var L,U;if(D==1&&(L=_.fltree,U=_.fdtree),D==2){n.F.makeCodes(_.ltree,p),n.F.revCodes(_.ltree,p),n.F.makeCodes(_.dtree,m),n.F.revCodes(_.dtree,m),n.F.makeCodes(_.itree,w),n.F.revCodes(_.itree,w),L=_.ltree,U=_.dtree,C(i,u,x-257),C(i,u+=5,O-1),C(i,u+=5,y-4),u+=4;for(var S=0;S<y;S++)C(i,u+3*S,_.itree[1+(_.ordr[S]<<1)]);u+=3*y,u=n.F._codeTiny(E,_.itree,i,u),u=n.F._codeTiny(M,_.itree,i,u)}for(var b=h,$=0;$<s;$+=2){for(var F=a[$],G=F>>>23,Y=b+(8388607&F);b<Y;)u=n.F._writeLit(f[b++],L,i,u);if(G!=0){var B=a[$+1],V=B>>16,j=B>>8&255,H=255&B;C(i,u=n.F._writeLit(257+j,L,i,u),G-_.of0[j]),u+=_.exb[j],I(i,u=n.F._writeLit(H,U,i,u),V-_.df0[H]),u+=_.dxb[H],b+=G}}u=n.F._writeLit(256,L,i,u)}return u},n.F._copyExact=function(o,a,s,l,f){var h=f>>>3;return l[h]=s,l[h+1]=s>>>8,l[h+2]=255-l[h],l[h+3]=255-l[h+1],h+=4,l.set(new Uint8Array(o.buffer,a,s),h),f+(s+4<<3)},n.F.getTrees=function(){for(var o=n.F.U,a=n.F._hufTree(o.lhst,o.ltree,15),s=n.F._hufTree(o.dhst,o.dtree,15),l=[],f=n.F._lenCodes(o.ltree,l),h=[],d=n.F._lenCodes(o.dtree,h),i=0;i<l.length;i+=2)o.ihst[l[i]]++;for(i=0;i<h.length;i+=2)o.ihst[h[i]]++;for(var u=n.F._hufTree(o.ihst,o.itree,7),g=19;g>4&&o.itree[1+(o.ordr[g-1]<<1)]==0;)g--;return[a,s,u,f,d,g,l,h]},n.F.getSecond=function(o){for(var a=[],s=0;s<o.length;s+=2)a.push(o[s+1]);return a},n.F.nonZero=function(o){for(var a="",s=0;s<o.length;s+=2)o[s+1]!=0&&(a+=(s>>1)+",");return a},n.F.contSize=function(o,a){for(var s=0,l=0;l<a.length;l++)s+=a[l]*o[1+(l<<1)];return s},n.F._codeTiny=function(o,a,s,l){for(var f=0;f<o.length;f+=2){var h=o[f],d=o[f+1];l=n.F._writeLit(h,a,s,l);var i=h==16?2:h==17?3:7;h>15&&(n.F._putsE(s,l,d,i),l+=i)}return l},n.F._lenCodes=function(o,a){for(var s=o.length;s!=2&&o[s-1]==0;)s-=2;for(var l=0;l<s;l+=2){var f=o[l+1],h=l+3<s?o[l+3]:-1,d=l+5<s?o[l+5]:-1,i=l==0?-1:o[l-1];if(f==0&&h==f&&d==f){for(var u=l+5;u+2<s&&o[u+2]==f;)u+=2;(g=Math.min(u+1-l>>>1,138))<11?a.push(17,g-3):a.push(18,g-11),l+=2*g-2}else if(f==i&&h==f&&d==f){for(u=l+5;u+2<s&&o[u+2]==f;)u+=2;var g=Math.min(u+1-l>>>1,6);a.push(16,g-3),l+=2*g-2}else a.push(f,0)}return s>>>1},n.F._hufTree=function(o,a,s){var l=[],f=o.length,h=a.length,d=0;for(d=0;d<h;d+=2)a[d]=0,a[d+1]=0;for(d=0;d<f;d++)o[d]!=0&&l.push({lit:d,f:o[d]});var i=l.length,u=l.slice(0);if(i==0)return 0;if(i==1){var g=l[0].lit;return u=g==0?1:0,a[1+(g<<1)]=1,a[1+(u<<1)]=1,1}l.sort((function(E,M){return E.f-M.f}));var p=l[0],m=l[1],w=0,x=1,O=2;for(l[0]={lit:-1,f:p.f+m.f,l:p,r:m,d:0};x!=i-1;)p=w!=x&&(O==i||l[w].f<l[O].f)?l[w++]:l[O++],m=w!=x&&(O==i||l[w].f<l[O].f)?l[w++]:l[O++],l[x++]={lit:-1,f:p.f+m.f,l:p,r:m};var y=n.F.setDepth(l[x-1],0);for(y>s&&(n.F.restrictDepth(u,s,y),y=s),d=0;d<i;d++)a[1+(u[d].lit<<1)]=u[d].d;return y},n.F.setDepth=function(o,a){return o.lit!=-1?(o.d=a,a):Math.max(n.F.setDepth(o.l,a+1),n.F.setDepth(o.r,a+1))},n.F.restrictDepth=function(o,a,s){var l=0,f=1<<s-a,h=0;for(o.sort((function(i,u){return u.d==i.d?i.f-u.f:u.d-i.d})),l=0;l<o.length&&o[l].d>a;l++){var d=o[l].d;o[l].d=a,h+=f-(1<<s-d)}for(h>>>=s-a;h>0;)(d=o[l].d)<a?(o[l].d++,h-=1<<a-d-1):l++;for(;l>=0;l--)o[l].d==a&&h<0&&(o[l].d--,h++);h!=0&&console.log("debt left")},n.F._goodIndex=function(o,a){var s=0;return a[16|s]<=o&&(s|=16),a[8|s]<=o&&(s|=8),a[4|s]<=o&&(s|=4),a[2|s]<=o&&(s|=2),a[1|s]<=o&&(s|=1),s},n.F._writeLit=function(o,a,s,l){return n.F._putsF(s,l,a[o<<1]),l+a[1+(o<<1)]},n.F.inflate=function(o,a){var s=Uint8Array;if(o[0]==3&&o[1]==0)return a||new s(0);var l=n.F,f=l._bitsF,h=l._bitsE,d=l._decodeTiny,i=l.makeCodes,u=l.codes2map,g=l._get17,p=l.U,m=a==null;m&&(a=new s(o.length>>>2<<3));for(var w,x,O=0,y=0,E=0,M=0,_=0,I=0,C=0,v=0,N=0;O==0;)if(O=f(o,N,1),y=f(o,N+1,2),N+=3,y!=0){if(m&&(a=n.F._check(a,v+131072)),y==1&&(w=p.flmap,x=p.fdmap,I=511,C=31),y==2){E=h(o,N,5)+257,M=h(o,N+5,5)+1,_=h(o,N+10,4)+4,N+=14;for(var A=0;A<38;A+=2)p.itree[A]=0,p.itree[A+1]=0;var P=1;for(A=0;A<_;A++){var D=h(o,N+3*A,3);p.itree[1+(p.ordr[A]<<1)]=D,D>P&&(P=D)}N+=3*_,i(p.itree,P),u(p.itree,P,p.imap),w=p.lmap,x=p.dmap,N=d(p.imap,(1<<P)-1,E+M,o,N,p.ttree);var L=l._copyOut(p.ttree,0,E,p.ltree);I=(1<<L)-1;var U=l._copyOut(p.ttree,E,M,p.dtree);C=(1<<U)-1,i(p.ltree,L),u(p.ltree,L,w),i(p.dtree,U),u(p.dtree,U,x)}for(;;){var S=w[g(o,N)&I];N+=15&S;var b=S>>>4;if(!(b>>>8))a[v++]=b;else{if(b==256)break;var $=v+b-254;if(b>264){var F=p.ldef[b-257];$=v+(F>>>3)+h(o,N,7&F),N+=7&F}var G=x[g(o,N)&C];N+=15&G;var Y=G>>>4,B=p.ddef[Y],V=(B>>>4)+f(o,N,15&B);for(N+=15&B,m&&(a=n.F._check(a,v+131072));v<$;)a[v]=a[v++-V],a[v]=a[v++-V],a[v]=a[v++-V],a[v]=a[v++-V];v=$}}}else{(7&N)!=0&&(N+=8-(7&N));var j=4+(N>>>3),H=o[j-4]|o[j-3]<<8;m&&(a=n.F._check(a,v+H)),a.set(new s(o.buffer,o.byteOffset+j,H),v),N=j+H<<3,v+=H}return a.length==v?a:a.slice(0,v)},n.F._check=function(o,a){var s=o.length;if(a<=s)return o;var l=new Uint8Array(Math.max(s<<1,a));return l.set(o,0),l},n.F._decodeTiny=function(o,a,s,l,f,h){for(var d=n.F._bitsE,i=n.F._get17,u=0;u<s;){var g=o[i(l,f)&a];f+=15&g;var p=g>>>4;if(p<=15)h[u]=p,u++;else{var m=0,w=0;p==16?(w=3+d(l,f,2),f+=2,m=h[u-1]):p==17?(w=3+d(l,f,3),f+=3):p==18&&(w=11+d(l,f,7),f+=7);for(var x=u+w;u<x;)h[u]=m,u++}}return f},n.F._copyOut=function(o,a,s,l){for(var f=0,h=0,d=l.length>>>1;h<s;){var i=o[h+a];l[h<<1]=0,l[1+(h<<1)]=i,i>f&&(f=i),h++}for(;h<d;)l[h<<1]=0,l[1+(h<<1)]=0,h++;return f},n.F.makeCodes=function(o,a){for(var s,l,f,h,d=n.F.U,i=o.length,u=d.bl_count,g=0;g<=a;g++)u[g]=0;for(g=1;g<i;g+=2)u[o[g]]++;var p=d.next_code;for(s=0,u[0]=0,l=1;l<=a;l++)s=s+u[l-1]<<1,p[l]=s;for(f=0;f<i;f+=2)(h=o[f+1])!=0&&(o[f]=p[h],p[h]++)},n.F.codes2map=function(o,a,s){for(var l=o.length,f=n.F.U.rev15,h=0;h<l;h+=2)if(o[h+1]!=0)for(var d=h>>1,i=o[h+1],u=d<<4|i,g=a-i,p=o[h]<<g,m=p+(1<<g);p!=m;)s[f[p]>>>15-a]=u,p++},n.F.revCodes=function(o,a){for(var s=n.F.U.rev15,l=15-a,f=0;f<o.length;f+=2){var h=o[f]<<a-o[f+1];o[f]=s[h]>>>l}},n.F._putsE=function(o,a,s){s<<=7&a;var l=a>>>3;o[l]|=s,o[l+1]|=s>>>8},n.F._putsF=function(o,a,s){s<<=7&a;var l=a>>>3;o[l]|=s,o[l+1]|=s>>>8,o[l+2]|=s>>>16},n.F._bitsE=function(o,a,s){return(o[a>>>3]|o[1+(a>>>3)]<<8)>>>(7&a)&(1<<s)-1},n.F._bitsF=function(o,a,s){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<<s)-1},n.F._get17=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)},n.F._get25=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16|o[3+(a>>>3)]<<24)>>>(7&a)},n.F.U=(t=Uint16Array,r=Uint32Array,{next_code:new t(16),bl_count:new t(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 t(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 r(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new r(286),dhst:new r(30),ihst:new r(19),lits:new r(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=n.F.U,a=0;a<32768;a++){var s=a;s=(4278255360&(s=(4042322160&(s=(3435973836&(s=(2863311530&s)>>>1|(1431655765&s)<<1))>>>2|(858993459&s)<<2))>>>4|(252645135&s)<<4))>>>8|(16711935&s)<<8,o.rev15[a]=(s>>>16|s<<16)>>>17}function l(f,h,d){for(;h--!=0;)f.push(0,d)}for(a=0;a<32;a++)o.ldef[a]=o.of0[a]<<3|o.exb[a],o.ddef[a]=o.df0[a]<<4|o.dxb[a];l(o.fltree,144,8),l(o.fltree,112,9),l(o.fltree,24,7),l(o.fltree,8,8),n.F.makeCodes(o.fltree,9),n.F.codes2map(o.fltree,9,o.flmap),n.F.revCodes(o.fltree,9),l(o.fdtree,32,5),n.F.makeCodes(o.fdtree,5),n.F.codes2map(o.fdtree,5,o.fdmap),n.F.revCodes(o.fdtree,5),l(o.itree,19,0),l(o.ltree,286,0),l(o.dtree,30,0),l(o.ttree,320,0)})()})();var og=tg({__proto__:null,default:On},[On]);const Ht=(function(){var e={nextZero(d,i){for(;d[i]!=0;)i++;return i},readUshort:(d,i)=>d[i]<<8|d[i+1],writeUshort(d,i,u){d[i]=u>>8&255,d[i+1]=255&u},readUint:(d,i)=>16777216*d[i]+(d[i+1]<<16|d[i+2]<<8|d[i+3]),writeUint(d,i,u){d[i]=u>>24&255,d[i+1]=u>>16&255,d[i+2]=u>>8&255,d[i+3]=255&u},readASCII(d,i,u){let g="";for(let p=0;p<u;p++)g+=String.fromCharCode(d[i+p]);return g},writeASCII(d,i,u){for(let g=0;g<u.length;g++)d[i+g]=u.charCodeAt(g)},readBytes(d,i,u){const g=[];for(let p=0;p<u;p++)g.push(d[i+p]);return g},pad:d=>d.length<2?`0${d}`:d,readUTF8(d,i,u){let g,p="";for(let m=0;m<u;m++)p+=`%${e.pad(d[i+m].toString(16))}`;try{g=decodeURIComponent(p)}catch{return e.readASCII(d,i,u)}return g}};function t(d,i,u,g){const p=i*u,m=a(g),w=Math.ceil(i*m/8),x=new Uint8Array(4*p),O=new Uint32Array(x.buffer),{ctype:y}=g,{depth:E}=g,M=e.readUshort;if(y==6){const F=p<<2;if(E==8)for(var _=0;_<F;_+=4)x[_]=d[_],x[_+1]=d[_+1],x[_+2]=d[_+2],x[_+3]=d[_+3];if(E==16)for(_=0;_<F;_++)x[_]=d[_<<1]}else if(y==2){const F=g.tabs.tRNS;if(F==null){if(E==8)for(_=0;_<p;_++){var I=3*_;O[_]=255<<24|d[I+2]<<16|d[I+1]<<8|d[I]}if(E==16)for(_=0;_<p;_++)I=6*_,O[_]=255<<24|d[I+4]<<16|d[I+2]<<8|d[I]}else{var C=F[0];const G=F[1],Y=F[2];if(E==8)for(_=0;_<p;_++){var v=_<<2;I=3*_,O[_]=255<<24|d[I+2]<<16|d[I+1]<<8|d[I],d[I]==C&&d[I+1]==G&&d[I+2]==Y&&(x[v+3]=0)}if(E==16)for(_=0;_<p;_++)v=_<<2,I=6*_,O[_]=255<<24|d[I+4]<<16|d[I+2]<<8|d[I],M(d,I)==C&&M(d,I+2)==G&&M(d,I+4)==Y&&(x[v+3]=0)}}else if(y==3){const F=g.tabs.PLTE,G=g.tabs.tRNS,Y=G?G.length:0;if(E==1)for(var N=0;N<u;N++){var A=N*w,P=N*i;for(_=0;_<i;_++){v=P+_<<2;var D=3*(L=d[A+(_>>3)]>>7-((7&_)<<0)&1);x[v]=F[D],x[v+1]=F[D+1],x[v+2]=F[D+2],x[v+3]=L<Y?G[L]:255}}if(E==2)for(N=0;N<u;N++)for(A=N*w,P=N*i,_=0;_<i;_++)v=P+_<<2,D=3*(L=d[A+(_>>2)]>>6-((3&_)<<1)&3),x[v]=F[D],x[v+1]=F[D+1],x[v+2]=F[D+2],x[v+3]=L<Y?G[L]:255;if(E==4)for(N=0;N<u;N++)for(A=N*w,P=N*i,_=0;_<i;_++)v=P+_<<2,D=3*(L=d[A+(_>>1)]>>4-((1&_)<<2)&15),x[v]=F[D],x[v+1]=F[D+1],x[v+2]=F[D+2],x[v+3]=L<Y?G[L]:255;if(E==8)for(_=0;_<p;_++){var L;v=_<<2,D=3*(L=d[_]),x[v]=F[D],x[v+1]=F[D+1],x[v+2]=F[D+2],x[v+3]=L<Y?G[L]:255}}else if(y==4){if(E==8)for(_=0;_<p;_++){v=_<<2;var U=d[S=_<<1];x[v]=U,x[v+1]=U,x[v+2]=U,x[v+3]=d[S+1]}if(E==16)for(_=0;_<p;_++){var S;v=_<<2,U=d[S=_<<2],x[v]=U,x[v+1]=U,x[v+2]=U,x[v+3]=d[S+2]}}else if(y==0)for(C=g.tabs.tRNS?g.tabs.tRNS:-1,N=0;N<u;N++){const F=N*w,G=N*i;if(E==1)for(var b=0;b<i;b++){var $=(U=255*(d[F+(b>>>3)]>>>7-(7&b)&1))==255*C?0:255;O[G+b]=$<<24|U<<16|U<<8|U}else if(E==2)for(b=0;b<i;b++)$=(U=85*(d[F+(b>>>2)]>>>6-((3&b)<<1)&3))==85*C?0:255,O[G+b]=$<<24|U<<16|U<<8|U;else if(E==4)for(b=0;b<i;b++)$=(U=17*(d[F+(b>>>1)]>>>4-((1&b)<<2)&15))==17*C?0:255,O[G+b]=$<<24|U<<16|U<<8|U;else if(E==8)for(b=0;b<i;b++)$=(U=d[F+b])==C?0:255,O[G+b]=$<<24|U<<16|U<<8|U;else if(E==16)for(b=0;b<i;b++)U=d[F+(b<<1)],$=M(d,F+(b<<1))==C?0:255,O[G+b]=$<<24|U<<16|U<<8|U}return x}function r(d,i,u,g){const p=a(d),m=Math.ceil(u*p/8),w=new Uint8Array((m+1+d.interlace)*g);return i=d.tabs.CgBI?o(i,w):n(i,w),d.interlace==0?i=s(i,d,0,u,g):d.interlace==1&&(i=(function(O,y){const E=y.width,M=y.height,_=a(y),I=_>>3,C=Math.ceil(E*_/8),v=new Uint8Array(M*C);let N=0;const A=[0,0,4,0,2,0,1],P=[0,4,0,2,0,1,0],D=[8,8,8,4,4,2,2],L=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const b=D[U],$=L[U];let F=0,G=0,Y=A[U];for(;Y<M;)Y+=b,G++;let B=P[U];for(;B<E;)B+=$,F++;const V=Math.ceil(F*_/8);s(O,y,N,F,G);let j=0,H=A[U];for(;H<M;){let q=P[U],ue=N+j*V<<3;for(;q<E;){var S;if(_==1&&(S=(S=O[ue>>3])>>7-(7&ue)&1,v[H*C+(q>>3)]|=S<<7-((7&q)<<0)),_==2&&(S=(S=O[ue>>3])>>6-(7&ue)&3,v[H*C+(q>>2)]|=S<<6-((3&q)<<1)),_==4&&(S=(S=O[ue>>3])>>4-(7&ue)&15,v[H*C+(q>>1)]|=S<<4-((1&q)<<2)),_>=8){const te=H*C+q*I;for(let fe=0;fe<I;fe++)v[te+fe]=O[(ue>>3)+fe]}ue+=_,q+=$}j++,H+=b}F*G!=0&&(N+=G*(1+V)),U+=1}return v})(i,d)),i}function n(d,i){return o(new Uint8Array(d.buffer,2,d.length-6),i)}var o=(function(){const d={H:{}};return d.H.N=function(i,u){const g=Uint8Array;let p,m,w=0,x=0,O=0,y=0,E=0,M=0,_=0,I=0,C=0;if(i[0]==3&&i[1]==0)return u||new g(0);const v=d.H,N=v.b,A=v.e,P=v.R,D=v.n,L=v.A,U=v.Z,S=v.m,b=u==null;for(b&&(u=new g(i.length>>>2<<5));w==0;)if(w=N(i,C,1),x=N(i,C+1,2),C+=3,x!=0){if(b&&(u=d.H.W(u,I+(1<<17))),x==1&&(p=S.J,m=S.h,M=511,_=31),x==2){O=A(i,C,5)+257,y=A(i,C+5,5)+1,E=A(i,C+10,4)+4,C+=14;let F=1;for(var $=0;$<38;$+=2)S.Q[$]=0,S.Q[$+1]=0;for($=0;$<E;$++){const B=A(i,C+3*$,3);S.Q[1+(S.X[$]<<1)]=B,B>F&&(F=B)}C+=3*E,D(S.Q,F),L(S.Q,F,S.u),p=S.w,m=S.d,C=P(S.u,(1<<F)-1,O+y,i,C,S.v);const G=v.V(S.v,0,O,S.C);M=(1<<G)-1;const Y=v.V(S.v,O,y,S.D);_=(1<<Y)-1,D(S.C,G),L(S.C,G,p),D(S.D,Y),L(S.D,Y,m)}for(;;){const F=p[U(i,C)&M];C+=15&F;const G=F>>>4;if(!(G>>>8))u[I++]=G;else{if(G==256)break;{let Y=I+G-254;if(G>264){const q=S.q[G-257];Y=I+(q>>>3)+A(i,C,7&q),C+=7&q}const B=m[U(i,C)&_];C+=15&B;const V=B>>>4,j=S.c[V],H=(j>>>4)+N(i,C,15&j);for(C+=15&j;I<Y;)u[I]=u[I++-H],u[I]=u[I++-H],u[I]=u[I++-H],u[I]=u[I++-H];I=Y}}}}else{(7&C)!=0&&(C+=8-(7&C));const F=4+(C>>>3),G=i[F-4]|i[F-3]<<8;b&&(u=d.H.W(u,I+G)),u.set(new g(i.buffer,i.byteOffset+F,G),I),C=F+G<<3,I+=G}return u.length==I?u:u.slice(0,I)},d.H.W=function(i,u){const g=i.length;if(u<=g)return i;const p=new Uint8Array(g<<1);return p.set(i,0),p},d.H.R=function(i,u,g,p,m,w){const x=d.H.e,O=d.H.Z;let y=0;for(;y<g;){const E=i[O(p,m)&u];m+=15&E;const M=E>>>4;if(M<=15)w[y]=M,y++;else{let _=0,I=0;M==16?(I=3+x(p,m,2),m+=2,_=w[y-1]):M==17?(I=3+x(p,m,3),m+=3):M==18&&(I=11+x(p,m,7),m+=7);const C=y+I;for(;y<C;)w[y]=_,y++}}return m},d.H.V=function(i,u,g,p){let m=0,w=0;const x=p.length>>>1;for(;w<g;){const O=i[w+u];p[w<<1]=0,p[1+(w<<1)]=O,O>m&&(m=O),w++}for(;w<x;)p[w<<1]=0,p[1+(w<<1)]=0,w++;return m},d.H.n=function(i,u){const g=d.H.m,p=i.length;let m,w,x,O;const y=g.j;for(var E=0;E<=u;E++)y[E]=0;for(E=1;E<p;E+=2)y[i[E]]++;const M=g.K;for(m=0,y[0]=0,w=1;w<=u;w++)m=m+y[w-1]<<1,M[w]=m;for(x=0;x<p;x+=2)O=i[x+1],O!=0&&(i[x]=M[O],M[O]++)},d.H.A=function(i,u,g){const p=i.length,m=d.H.m.r;for(let w=0;w<p;w+=2)if(i[w+1]!=0){const x=w>>1,O=i[w+1],y=x<<4|O,E=u-O;let M=i[w]<<E;const _=M+(1<<E);for(;M!=_;)g[m[M]>>>15-u]=y,M++}},d.H.l=function(i,u){const g=d.H.m.r,p=15-u;for(let m=0;m<i.length;m+=2){const w=i[m]<<u-i[m+1];i[m]=g[w]>>>p}},d.H.M=function(i,u,g){g<<=7&u;const p=u>>>3;i[p]|=g,i[p+1]|=g>>>8},d.H.I=function(i,u,g){g<<=7&u;const p=u>>>3;i[p]|=g,i[p+1]|=g>>>8,i[p+2]|=g>>>16},d.H.e=function(i,u,g){return(i[u>>>3]|i[1+(u>>>3)]<<8)>>>(7&u)&(1<<g)-1},d.H.b=function(i,u,g){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)&(1<<g)-1},d.H.Z=function(i,u){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)},d.H.i=function(i,u){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16|i[3+(u>>>3)]<<24)>>>(7&u)},d.H.m=(function(){const i=Uint16Array,u=Uint32Array;return{K:new i(16),j:new i(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 i(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 u(32),J:new i(512),_:[],h:new i(32),$:[],w:new i(32768),C:[],v:[],d:new i(32768),D:[],u:new i(512),Q:[],r:new i(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new i(65536),g:new i(32768)}})(),(function(){const i=d.H.m;for(var u=0;u<32768;u++){let p=u;p=(2863311530&p)>>>1|(1431655765&p)<<1,p=(3435973836&p)>>>2|(858993459&p)<<2,p=(4042322160&p)>>>4|(252645135&p)<<4,p=(4278255360&p)>>>8|(16711935&p)<<8,i.r[u]=(p>>>16|p<<16)>>>17}function g(p,m,w){for(;m--!=0;)p.push(0,w)}for(u=0;u<32;u++)i.q[u]=i.S[u]<<3|i.T[u],i.c[u]=i.p[u]<<4|i.z[u];g(i._,144,8),g(i._,112,9),g(i._,24,7),g(i._,8,8),d.H.n(i._,9),d.H.A(i._,9,i.J),d.H.l(i._,9),g(i.$,32,5),d.H.n(i.$,5),d.H.A(i.$,5,i.h),d.H.l(i.$,5),g(i.Q,19,0),g(i.C,286,0),g(i.D,30,0),g(i.v,320,0)})(),d.H.N})();function a(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function s(d,i,u,g,p){let m=a(i);const w=Math.ceil(g*m/8);let x,O;m=Math.ceil(m/8);let y=d[u],E=0;if(y>1&&(d[u]=[0,0,1][y-2]),y==3)for(E=m;E<w;E++)d[E+1]=d[E+1]+(d[E+1-m]>>>1)&255;for(let M=0;M<p;M++)if(x=u+M*w,O=x+M+1,y=d[O-1],E=0,y==0)for(;E<w;E++)d[x+E]=d[O+E];else if(y==1){for(;E<m;E++)d[x+E]=d[O+E];for(;E<w;E++)d[x+E]=d[O+E]+d[x+E-m]}else if(y==2)for(;E<w;E++)d[x+E]=d[O+E]+d[x+E-w];else if(y==3){for(;E<m;E++)d[x+E]=d[O+E]+(d[x+E-w]>>>1);for(;E<w;E++)d[x+E]=d[O+E]+(d[x+E-w]+d[x+E-m]>>>1)}else{for(;E<m;E++)d[x+E]=d[O+E]+l(0,d[x+E-w],0);for(;E<w;E++)d[x+E]=d[O+E]+l(d[x+E-m],d[x+E-w],d[x+E-m-w])}return d}function l(d,i,u){const g=d+i-u,p=g-d,m=g-i,w=g-u;return p*p<=m*m&&p*p<=w*w?d:m*m<=w*w?i:u}function f(d,i,u){u.width=e.readUint(d,i),i+=4,u.height=e.readUint(d,i),i+=4,u.depth=d[i],i++,u.ctype=d[i],i++,u.compress=d[i],i++,u.filter=d[i],i++,u.interlace=d[i],i++}function h(d,i,u,g,p,m,w,x,O){const y=Math.min(i,p),E=Math.min(u,m);let M=0,_=0;for(let U=0;U<E;U++)for(let S=0;S<y;S++)if(w>=0&&x>=0?(M=U*i+S<<2,_=(x+U)*p+w+S<<2):(M=(-x+U)*i-w+S<<2,_=U*p+S<<2),O==0)g[_]=d[M],g[_+1]=d[M+1],g[_+2]=d[M+2],g[_+3]=d[M+3];else if(O==1){var I=d[M+3]*.00392156862745098,C=d[M]*I,v=d[M+1]*I,N=d[M+2]*I,A=g[_+3]*(1/255),P=g[_]*A,D=g[_+1]*A,L=g[_+2]*A;const b=1-I,$=I+A*b,F=$==0?0:1/$;g[_+3]=255*$,g[_+0]=(C+P*b)*F,g[_+1]=(v+D*b)*F,g[_+2]=(N+L*b)*F}else if(O==2)I=d[M+3],C=d[M],v=d[M+1],N=d[M+2],A=g[_+3],P=g[_],D=g[_+1],L=g[_+2],I==A&&C==P&&v==D&&N==L?(g[_]=0,g[_+1]=0,g[_+2]=0,g[_+3]=0):(g[_]=C,g[_+1]=v,g[_+2]=N,g[_+3]=I);else if(O==3){if(I=d[M+3],C=d[M],v=d[M+1],N=d[M+2],A=g[_+3],P=g[_],D=g[_+1],L=g[_+2],I==A&&C==P&&v==D&&N==L)continue;if(I<220&&A>20)return!1}return!0}return{decode:function(i){const u=new Uint8Array(i);let g=8;const p=e,m=p.readUshort,w=p.readUint,x={tabs:{},frames:[]},O=new Uint8Array(u.length);let y,E=0,M=0;const _=[137,80,78,71,13,10,26,10];for(var I=0;I<8;I++)if(u[I]!=_[I])throw"The input is not a PNG file!";for(;g<u.length;){const U=p.readUint(u,g);g+=4;const S=p.readASCII(u,g,4);if(g+=4,S=="IHDR")f(u,g,x);else if(S=="iCCP"){for(var C=g;u[C]!=0;)C++;p.readASCII(u,g,C-g),u[C+1];const b=u.slice(C+2,g+U);let $=null;try{$=n(b)}catch{$=o(b)}x.tabs[S]=$}else if(S=="CgBI")x.tabs[S]=u.slice(g,g+4);else if(S=="IDAT"){for(I=0;I<U;I++)O[E+I]=u[g+I];E+=U}else if(S=="acTL")x.tabs[S]={num_frames:w(u,g),num_plays:w(u,g+4)},y=new Uint8Array(u.length);else if(S=="fcTL"){M!=0&&((L=x.frames[x.frames.length-1]).data=r(x,y.slice(0,M),L.rect.width,L.rect.height),M=0);const b={x:w(u,g+12),y:w(u,g+16),width:w(u,g+4),height:w(u,g+8)};let $=m(u,g+22);$=m(u,g+20)/($==0?100:$);const F={rect:b,delay:Math.round(1e3*$),dispose:u[g+24],blend:u[g+25]};x.frames.push(F)}else if(S=="fdAT"){for(I=0;I<U-4;I++)y[M+I]=u[g+I+4];M+=U-4}else if(S=="pHYs")x.tabs[S]=[p.readUint(u,g),p.readUint(u,g+4),u[g+8]];else if(S=="cHRM")for(x.tabs[S]=[],I=0;I<8;I++)x.tabs[S].push(p.readUint(u,g+4*I));else if(S=="tEXt"||S=="zTXt"){x.tabs[S]==null&&(x.tabs[S]={});var v=p.nextZero(u,g),N=p.readASCII(u,g,v-g),A=g+U-v-1;if(S=="tEXt")D=p.readASCII(u,v+1,A);else{var P=n(u.slice(v+2,v+2+A));D=p.readUTF8(P,0,P.length)}x.tabs[S][N]=D}else if(S=="iTXt"){x.tabs[S]==null&&(x.tabs[S]={}),v=0,C=g,v=p.nextZero(u,C),N=p.readASCII(u,C,v-C);const b=u[C=v+1];var D;u[C+1],C+=2,v=p.nextZero(u,C),p.readASCII(u,C,v-C),C=v+1,v=p.nextZero(u,C),p.readUTF8(u,C,v-C),A=U-((C=v+1)-g),b==0?D=p.readUTF8(u,C,A):(P=n(u.slice(C,C+A)),D=p.readUTF8(P,0,P.length)),x.tabs[S][N]=D}else if(S=="PLTE")x.tabs[S]=p.readBytes(u,g,U);else if(S=="hIST"){const b=x.tabs.PLTE.length/3;for(x.tabs[S]=[],I=0;I<b;I++)x.tabs[S].push(m(u,g+2*I))}else if(S=="tRNS")x.ctype==3?x.tabs[S]=p.readBytes(u,g,U):x.ctype==0?x.tabs[S]=m(u,g):x.ctype==2&&(x.tabs[S]=[m(u,g),m(u,g+2),m(u,g+4)]);else if(S=="gAMA")x.tabs[S]=p.readUint(u,g)/1e5;else if(S=="sRGB")x.tabs[S]=u[g];else if(S=="bKGD")x.ctype==0||x.ctype==4?x.tabs[S]=[m(u,g)]:x.ctype==2||x.ctype==6?x.tabs[S]=[m(u,g),m(u,g+2),m(u,g+4)]:x.ctype==3&&(x.tabs[S]=u[g]);else if(S=="IEND")break;g+=U,p.readUint(u,g),g+=4}var L;return M!=0&&((L=x.frames[x.frames.length-1]).data=r(x,y.slice(0,M),L.rect.width,L.rect.height)),x.data=r(x,O,x.width,x.height),delete x.compress,delete x.interlace,delete x.filter,x},toRGBA8:function(i){const u=i.width,g=i.height;if(i.tabs.acTL==null)return[t(i.data,u,g,i).buffer];const p=[];i.frames[0].data==null&&(i.frames[0].data=i.data);const m=u*g*4,w=new Uint8Array(m),x=new Uint8Array(m),O=new Uint8Array(m);for(let E=0;E<i.frames.length;E++){const M=i.frames[E],_=M.rect.x,I=M.rect.y,C=M.rect.width,v=M.rect.height,N=t(M.data,C,v,i);if(E!=0)for(var y=0;y<m;y++)O[y]=w[y];if(M.blend==0?h(N,C,v,w,u,g,_,I,0):M.blend==1&&h(N,C,v,w,u,g,_,I,1),p.push(w.buffer.slice(0)),M.dispose!=0){if(M.dispose==1)h(x,C,v,w,u,g,_,I,0);else if(M.dispose==2)for(y=0;y<m;y++)w[y]=O[y]}}return p},_paeth:l,_copyTile:h,_bin:e}})();(function(){const{_copyTile:e}=Ht,{_bin:t}=Ht,r=Ht._paeth;var n={table:(function(){const C=new Uint32Array(256);for(let v=0;v<256;v++){let N=v;for(let A=0;A<8;A++)1&N?N=3988292384^N>>>1:N>>>=1;C[v]=N}return C})(),update(C,v,N,A){for(let P=0;P<A;P++)C=n.table[255&(C^v[N+P])]^C>>>8;return C},crc:(C,v,N)=>4294967295^n.update(4294967295,C,v,N)};function o(C,v,N,A){v[N]+=C[0]*A>>4,v[N+1]+=C[1]*A>>4,v[N+2]+=C[2]*A>>4,v[N+3]+=C[3]*A>>4}function a(C){return Math.max(0,Math.min(255,C))}function s(C,v){const N=C[0]-v[0],A=C[1]-v[1],P=C[2]-v[2],D=C[3]-v[3];return N*N+A*A+P*P+D*D}function l(C,v,N,A,P,D,L){L==null&&(L=1);const U=A.length,S=[];for(var b=0;b<U;b++){const H=A[b];S.push([H>>>0&255,H>>>8&255,H>>>16&255,H>>>24&255])}for(b=0;b<U;b++){let H=4294967295;for(var $=0,F=0;F<U;F++){var G=s(S[b],S[F]);F!=b&&G<H&&(H=G,$=F)}}const Y=new Uint32Array(P.buffer),B=new Int16Array(v*N*4),V=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(b=0;b<V.length;b++)V[b]=255*((V[b]+.5)/16-.5);for(let H=0;H<N;H++)for(let q=0;q<v;q++){var j;b=4*(H*v+q),L!=2?j=[a(C[b]+B[b]),a(C[b+1]+B[b+1]),a(C[b+2]+B[b+2]),a(C[b+3]+B[b+3])]:(G=V[4*(3&H)+(3&q)],j=[a(C[b]+G),a(C[b+1]+G),a(C[b+2]+G),a(C[b+3]+G)]),$=0;let ue=16777215;for(F=0;F<U;F++){const R=s(j,S[F]);R<ue&&(ue=R,$=F)}const te=S[$],fe=[j[0]-te[0],j[1]-te[1],j[2]-te[2],j[3]-te[3]];L==1&&(q!=v-1&&o(fe,B,b+4,7),H!=N-1&&(q!=0&&o(fe,B,b+4*v-4,3),o(fe,B,b+4*v,5),q!=v-1&&o(fe,B,b+4*v+4,1))),D[b>>2]=$,Y[b>>2]=A[$]}}function f(C,v,N,A,P){P==null&&(P={});const{crc:D}=n,L=t.writeUint,U=t.writeUshort,S=t.writeASCII;let b=8;const $=C.frames.length>1;let F,G=!1,Y=33+($?20:0);if(P.sRGB!=null&&(Y+=13),P.pHYs!=null&&(Y+=21),P.iCCP!=null&&(F=pako.deflate(P.iCCP),Y+=21+F.length+4),C.ctype==3){for(var B=C.plte.length,V=0;V<B;V++)C.plte[V]>>>24!=255&&(G=!0);Y+=8+3*B+4+(G?8+1*B+4:0)}for(var j=0;j<C.frames.length;j++)$&&(Y+=38),Y+=(te=C.frames[j]).cimg.length+12,j!=0&&(Y+=4);Y+=12;const H=new Uint8Array(Y),q=[137,80,78,71,13,10,26,10];for(V=0;V<8;V++)H[V]=q[V];if(L(H,b,13),b+=4,S(H,b,"IHDR"),b+=4,L(H,b,v),b+=4,L(H,b,N),b+=4,H[b]=C.depth,b++,H[b]=C.ctype,b++,H[b]=0,b++,H[b]=0,b++,H[b]=0,b++,L(H,b,D(H,b-17,17)),b+=4,P.sRGB!=null&&(L(H,b,1),b+=4,S(H,b,"sRGB"),b+=4,H[b]=P.sRGB,b++,L(H,b,D(H,b-5,5)),b+=4),P.iCCP!=null){const fe=13+F.length;L(H,b,fe),b+=4,S(H,b,"iCCP"),b+=4,S(H,b,"ICC profile"),b+=11,b+=2,H.set(F,b),b+=F.length,L(H,b,D(H,b-(fe+4),fe+4)),b+=4}if(P.pHYs!=null&&(L(H,b,9),b+=4,S(H,b,"pHYs"),b+=4,L(H,b,P.pHYs[0]),b+=4,L(H,b,P.pHYs[1]),b+=4,H[b]=P.pHYs[2],b++,L(H,b,D(H,b-13,13)),b+=4),$&&(L(H,b,8),b+=4,S(H,b,"acTL"),b+=4,L(H,b,C.frames.length),b+=4,L(H,b,P.loop!=null?P.loop:0),b+=4,L(H,b,D(H,b-12,12)),b+=4),C.ctype==3){for(L(H,b,3*(B=C.plte.length)),b+=4,S(H,b,"PLTE"),b+=4,V=0;V<B;V++){const fe=3*V,R=C.plte[V],ke=255&R,me=R>>>8&255,Ge=R>>>16&255;H[b+fe+0]=ke,H[b+fe+1]=me,H[b+fe+2]=Ge}if(b+=3*B,L(H,b,D(H,b-3*B-4,3*B+4)),b+=4,G){for(L(H,b,B),b+=4,S(H,b,"tRNS"),b+=4,V=0;V<B;V++)H[b+V]=C.plte[V]>>>24&255;b+=B,L(H,b,D(H,b-B-4,B+4)),b+=4}}let ue=0;for(j=0;j<C.frames.length;j++){var te=C.frames[j];$&&(L(H,b,26),b+=4,S(H,b,"fcTL"),b+=4,L(H,b,ue++),b+=4,L(H,b,te.rect.width),b+=4,L(H,b,te.rect.height),b+=4,L(H,b,te.rect.x),b+=4,L(H,b,te.rect.y),b+=4,U(H,b,A[j]),b+=2,U(H,b,1e3),b+=2,H[b]=te.dispose,b++,H[b]=te.blend,b++,L(H,b,D(H,b-30,30)),b+=4);const fe=te.cimg;L(H,b,(B=fe.length)+(j==0?0:4)),b+=4;const R=b;S(H,b,j==0?"IDAT":"fdAT"),b+=4,j!=0&&(L(H,b,ue++),b+=4),H.set(fe,b),b+=B,L(H,b,D(H,R,b-R)),b+=4}return L(H,b,0),b+=4,S(H,b,"IEND"),b+=4,L(H,b,D(H,b-4,4)),b+=4,H.buffer}function h(C,v,N){for(let A=0;A<C.frames.length;A++){const P=C.frames[A];P.rect.width;const D=P.rect.height,L=new Uint8Array(D*P.bpl+D);P.cimg=g(P.img,D,P.bpp,P.bpl,L,v,N)}}function d(C,v,N,A,P){const D=P[0],L=P[1],U=P[2],S=P[3],b=P[4],$=P[5];let F=6,G=8,Y=255;for(var B=0;B<C.length;B++){const Me=new Uint8Array(C[B]);for(var V=Me.length,j=0;j<V;j+=4)Y&=Me[j+3]}const H=Y!=255,q=(function(Ce,we,$e,Le,K,re){const oe=[];for(var ae=0;ae<Ce.length;ae++){const Oe=new Uint8Array(Ce[ae]),X=new Uint32Array(Oe.buffer);var be;let se=0,ie=0,le=we,ne=$e,Te=Le?1:0;if(ae!=0){const ve=re||Le||ae==1||oe[ae-2].dispose!=0?1:2;let Se=0,_e=1e9;for(let Ue=0;Ue<ve;Ue++){var xe=new Uint8Array(Ce[ae-1-Ue]);const je=new Uint32Array(Ce[ae-1-Ue]);let Ee=we,he=$e,Ne=-1,Ve=-1;for(let Be=0;Be<$e;Be++)for(let Ze=0;Ze<we;Ze++)X[Pe=Be*we+Ze]!=je[Pe]&&(Ze<Ee&&(Ee=Ze),Ze>Ne&&(Ne=Ze),Be<he&&(he=Be),Be>Ve&&(Ve=Be));Ne==-1&&(Ee=he=Ne=Ve=0),K&&((1&Ee)==1&&Ee--,(1&he)==1&&he--);const Fe=(Ne-Ee+1)*(Ve-he+1);Fe<_e&&(_e=Fe,Se=Ue,se=Ee,ie=he,le=Ne-Ee+1,ne=Ve-he+1)}xe=new Uint8Array(Ce[ae-1-Se]),Se==1&&(oe[ae-1].dispose=2),be=new Uint8Array(le*ne*4),e(xe,we,$e,be,le,ne,-se,-ie,0),Te=e(Oe,we,$e,be,le,ne,-se,-ie,3)?1:0,Te==1?u(Oe,we,$e,be,{x:se,y:ie,width:le,height:ne}):e(Oe,we,$e,be,le,ne,-se,-ie,0)}else be=Oe.slice(0);oe.push({rect:{x:se,y:ie,width:le,height:ne},img:be,blend:Te,dispose:0})}if(Le)for(ae=0;ae<oe.length;ae++){if((Ke=oe[ae]).blend==1)continue;const Oe=Ke.rect,X=oe[ae-1].rect,se=Math.min(Oe.x,X.x),ie=Math.min(Oe.y,X.y),le={x:se,y:ie,width:Math.max(Oe.x+Oe.width,X.x+X.width)-se,height:Math.max(Oe.y+Oe.height,X.y+X.height)-ie};oe[ae-1].dispose=1,ae-1!=0&&i(Ce,we,$e,oe,ae-1,le,K),i(Ce,we,$e,oe,ae,le,K)}let He=0;if(Ce.length!=1)for(var Pe=0;Pe<oe.length;Pe++){var Ke;He+=(Ke=oe[Pe]).rect.width*Ke.rect.height}return oe})(C,v,N,D,L,U),ue={},te=[],fe=[];if(A!=0){const Me=[];for(j=0;j<q.length;j++)Me.push(q[j].img.buffer);const Ce=(function(K){let re=0;for(var oe=0;oe<K.length;oe++)re+=K[oe].byteLength;const ae=new Uint8Array(re);let be=0;for(oe=0;oe<K.length;oe++){const xe=new Uint8Array(K[oe]),He=xe.length;for(let Pe=0;Pe<He;Pe+=4){let Ke=xe[Pe],Oe=xe[Pe+1],X=xe[Pe+2];const se=xe[Pe+3];se==0&&(Ke=Oe=X=0),ae[be+Pe]=Ke,ae[be+Pe+1]=Oe,ae[be+Pe+2]=X,ae[be+Pe+3]=se}be+=He}return ae.buffer})(Me),we=m(Ce,A);for(j=0;j<we.plte.length;j++)te.push(we.plte[j].est.rgba);let $e=0;for(j=0;j<q.length;j++){const Le=(ke=q[j]).img.length;var R=new Uint8Array(we.inds.buffer,$e>>2,Le>>2);fe.push(R);const K=new Uint8Array(we.abuf,$e,Le);$&&l(ke.img,ke.rect.width,ke.rect.height,te,K,R),ke.img.set(K),$e+=Le}}else for(B=0;B<q.length;B++){var ke=q[B];const Me=new Uint32Array(ke.img.buffer);var me=ke.rect.width;for(V=Me.length,R=new Uint8Array(V),fe.push(R),j=0;j<V;j++){const Ce=Me[j];if(j!=0&&Ce==Me[j-1])R[j]=R[j-1];else if(j>me&&Ce==Me[j-me])R[j]=R[j-me];else{let we=ue[Ce];if(we==null&&(ue[Ce]=we=te.length,te.push(Ce),te.length>=300))break;R[j]=we}}}const Ge=te.length;for(Ge<=256&&b==0&&(G=Ge<=2?1:Ge<=4?2:Ge<=16?4:8,G=Math.max(G,S)),B=0;B<q.length;B++){(ke=q[B]).rect.x,ke.rect.y,me=ke.rect.width;const Me=ke.rect.height;let Ce=ke.img;new Uint32Array(Ce.buffer);let we=4*me,$e=4;if(Ge<=256&&b==0){we=Math.ceil(G*me/8);var De=new Uint8Array(we*Me);const Le=fe[B];for(let K=0;K<Me;K++){j=K*we;const re=K*me;if(G==8)for(var ye=0;ye<me;ye++)De[j+ye]=Le[re+ye];else if(G==4)for(ye=0;ye<me;ye++)De[j+(ye>>1)]|=Le[re+ye]<<4-4*(1&ye);else if(G==2)for(ye=0;ye<me;ye++)De[j+(ye>>2)]|=Le[re+ye]<<6-2*(3&ye);else if(G==1)for(ye=0;ye<me;ye++)De[j+(ye>>3)]|=Le[re+ye]<<7-1*(7&ye)}Ce=De,F=3,$e=1}else if(H==0&&q.length==1){De=new Uint8Array(me*Me*3);const Le=me*Me;for(j=0;j<Le;j++){const K=3*j,re=4*j;De[K]=Ce[re],De[K+1]=Ce[re+1],De[K+2]=Ce[re+2]}Ce=De,F=2,$e=3,we=3*me}ke.img=Ce,ke.bpl=we,ke.bpp=$e}return{ctype:F,depth:G,plte:te,frames:q}}function i(C,v,N,A,P,D,L){const U=Uint8Array,S=Uint32Array,b=new U(C[P-1]),$=new S(C[P-1]),F=P+1<C.length?new U(C[P+1]):null,G=new U(C[P]),Y=new S(G.buffer);let B=v,V=N,j=-1,H=-1;for(let ue=0;ue<D.height;ue++)for(let te=0;te<D.width;te++){const fe=D.x+te,R=D.y+ue,ke=R*v+fe,me=Y[ke];me==0||A[P-1].dispose==0&&$[ke]==me&&(F==null||F[4*ke+3]!=0)||(fe<B&&(B=fe),fe>j&&(j=fe),R<V&&(V=R),R>H&&(H=R))}j==-1&&(B=V=j=H=0),L&&((1&B)==1&&B--,(1&V)==1&&V--),D={x:B,y:V,width:j-B+1,height:H-V+1};const q=A[P];q.rect=D,q.blend=1,q.img=new Uint8Array(D.width*D.height*4),A[P-1].dispose==0?(e(b,v,N,q.img,D.width,D.height,-D.x,-D.y,0),u(G,v,N,q.img,D)):e(G,v,N,q.img,D.width,D.height,-D.x,-D.y,0)}function u(C,v,N,A,P){e(C,v,N,A,P.width,P.height,-P.x,-P.y,2)}function g(C,v,N,A,P,D,L){const U=[];let S,b=[0,1,2,3,4];D!=-1?b=[D]:(v*A>5e5||N==1)&&(b=[0]),L&&(S={level:0});const $=og;for(var F=0;F<b.length;F++){for(let B=0;B<v;B++)p(P,C,B,A,N,b[F]);U.push($.deflate(P,S))}let G,Y=1e9;for(F=0;F<U.length;F++)U[F].length<Y&&(G=F,Y=U[F].length);return U[G]}function p(C,v,N,A,P,D){const L=N*A;let U=L+N;if(C[U]=D,U++,D==0)if(A<500)for(var S=0;S<A;S++)C[U+S]=v[L+S];else C.set(new Uint8Array(v.buffer,L,A),U);else if(D==1){for(S=0;S<P;S++)C[U+S]=v[L+S];for(S=P;S<A;S++)C[U+S]=v[L+S]-v[L+S-P]+256&255}else if(N==0){for(S=0;S<P;S++)C[U+S]=v[L+S];if(D==2)for(S=P;S<A;S++)C[U+S]=v[L+S];if(D==3)for(S=P;S<A;S++)C[U+S]=v[L+S]-(v[L+S-P]>>1)+256&255;if(D==4)for(S=P;S<A;S++)C[U+S]=v[L+S]-r(v[L+S-P],0,0)+256&255}else{if(D==2)for(S=0;S<A;S++)C[U+S]=v[L+S]+256-v[L+S-A]&255;if(D==3){for(S=0;S<P;S++)C[U+S]=v[L+S]+256-(v[L+S-A]>>1)&255;for(S=P;S<A;S++)C[U+S]=v[L+S]+256-(v[L+S-A]+v[L+S-P]>>1)&255}if(D==4){for(S=0;S<P;S++)C[U+S]=v[L+S]+256-r(0,v[L+S-A],0)&255;for(S=P;S<A;S++)C[U+S]=v[L+S]+256-r(v[L+S-P],v[L+S-A],v[L+S-P-A])&255}}}function m(C,v){const N=new Uint8Array(C),A=N.slice(0),P=new Uint32Array(A.buffer),D=w(A,v),L=D[0],U=D[1],S=N.length,b=new Uint8Array(S>>2);let $;if(N.length<2e7)for(var F=0;F<S;F+=4)$=x(L,G=N[F]*.00392156862745098,Y=N[F+1]*.00392156862745098,B=N[F+2]*.00392156862745098,V=N[F+3]*.00392156862745098),b[F>>2]=$.ind,P[F>>2]=$.est.rgba;else for(F=0;F<S;F+=4){var G=N[F]*.00392156862745098,Y=N[F+1]*(1/255),B=N[F+2]*(1/255),V=N[F+3]*(1/255);for($=L;$.left;)$=O($.est,G,Y,B,V)<=0?$.left:$.right;b[F>>2]=$.ind,P[F>>2]=$.est.rgba}return{abuf:A.buffer,inds:b,plte:U}}function w(C,v,N){N==null&&(N=1e-4);const A=new Uint32Array(C.buffer),P={i0:0,i1:C.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=M(C,P.i0,P.i1),P.est=_(P.bst);const D=[P];for(;D.length<v;){let U=0,S=0;for(var L=0;L<D.length;L++)D[L].est.L>U&&(U=D[L].est.L,S=L);if(U<N)break;const b=D[S],$=y(C,A,b.i0,b.i1,b.est.e,b.est.eMq255);if(b.i0>=$||b.i1<=$){b.est.L=0;continue}const F={i0:b.i0,i1:$,bst:null,est:null,tdst:0,left:null,right:null};F.bst=M(C,F.i0,F.i1),F.est=_(F.bst);const G={i0:$,i1:b.i1,bst:null,est:null,tdst:0,left:null,right:null};for(G.bst={R:[],m:[],N:b.bst.N-F.bst.N},L=0;L<16;L++)G.bst.R[L]=b.bst.R[L]-F.bst.R[L];for(L=0;L<4;L++)G.bst.m[L]=b.bst.m[L]-F.bst.m[L];G.est=_(G.bst),b.left=F,b.right=G,D[S]=F,D.push(G)}for(D.sort(((U,S)=>S.bst.N-U.bst.N)),L=0;L<D.length;L++)D[L].ind=L;return[P,D]}function x(C,v,N,A,P){if(C.left==null)return C.tdst=(function(F,G,Y,B,V){const j=G-F[0],H=Y-F[1],q=B-F[2],ue=V-F[3];return j*j+H*H+q*q+ue*ue})(C.est.q,v,N,A,P),C;const D=O(C.est,v,N,A,P);let L=C.left,U=C.right;D>0&&(L=C.right,U=C.left);const S=x(L,v,N,A,P);if(S.tdst<=D*D)return S;const b=x(U,v,N,A,P);return b.tdst<S.tdst?b:S}function O(C,v,N,A,P){const{e:D}=C;return D[0]*v+D[1]*N+D[2]*A+D[3]*P-C.eMq}function y(C,v,N,A,P,D){for(A-=4;N<A;){for(;E(C,N,P)<=D;)N+=4;for(;E(C,A,P)>D;)A-=4;if(N>=A)break;const L=v[N>>2];v[N>>2]=v[A>>2],v[A>>2]=L,N+=4,A-=4}for(;E(C,N,P)>D;)N-=4;return N+4}function E(C,v,N){return C[v]*N[0]+C[v+1]*N[1]+C[v+2]*N[2]+C[v+3]*N[3]}function M(C,v,N){const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=[0,0,0,0],D=N-v>>2;for(let L=v;L<N;L+=4){const U=C[L]*.00392156862745098,S=C[L+1]*(1/255),b=C[L+2]*(1/255),$=C[L+3]*(1/255);P[0]+=U,P[1]+=S,P[2]+=b,P[3]+=$,A[0]+=U*U,A[1]+=U*S,A[2]+=U*b,A[3]+=U*$,A[5]+=S*S,A[6]+=S*b,A[7]+=S*$,A[10]+=b*b,A[11]+=b*$,A[15]+=$*$}return A[4]=A[1],A[8]=A[2],A[9]=A[6],A[12]=A[3],A[13]=A[7],A[14]=A[11],{R:A,m:P,N:D}}function _(C){const{R:v}=C,{m:N}=C,{N:A}=C,P=N[0],D=N[1],L=N[2],U=N[3],S=A==0?0:1/A,b=[v[0]-P*P*S,v[1]-P*D*S,v[2]-P*L*S,v[3]-P*U*S,v[4]-D*P*S,v[5]-D*D*S,v[6]-D*L*S,v[7]-D*U*S,v[8]-L*P*S,v[9]-L*D*S,v[10]-L*L*S,v[11]-L*U*S,v[12]-U*P*S,v[13]-U*D*S,v[14]-U*L*S,v[15]-U*U*S],$=b,F=I;let G=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,B=0;if(A!=0)for(let j=0;j<16&&(G=F.multVec($,G),B=Math.sqrt(F.dot(G,G)),G=F.sml(1/B,G),!(j!=0&&Math.abs(B-Y)<1e-9));j++)Y=B;const V=[P*S,D*S,L*S,U*S];return{Cov:b,q:V,e:G,L:Y,eMq255:F.dot(F.sml(255,V),G),eMq:F.dot(G,V),rgba:(Math.round(255*V[3])<<24|Math.round(255*V[2])<<16|Math.round(255*V[1])<<8|Math.round(255*V[0])<<0)>>>0}}var I={multVec:(C,v)=>[C[0]*v[0]+C[1]*v[1]+C[2]*v[2]+C[3]*v[3],C[4]*v[0]+C[5]*v[1]+C[6]*v[2]+C[7]*v[3],C[8]*v[0]+C[9]*v[1]+C[10]*v[2]+C[11]*v[3],C[12]*v[0]+C[13]*v[1]+C[14]*v[2]+C[15]*v[3]],dot:(C,v)=>C[0]*v[0]+C[1]*v[1]+C[2]*v[2]+C[3]*v[3],sml:(C,v)=>[C*v[0],C*v[1],C*v[2],C*v[3]]};Ht.encode=function(v,N,A,P,D,L,U){P==null&&(P=0),U==null&&(U=!1);const S=d(v,N,A,P,[!1,!1,!1,0,U,!1]);return h(S,-1),f(S,N,A,D,L)},Ht.encodeLL=function(v,N,A,P,D,L,U,S){const b={ctype:0+(P==1?0:2)+(D==0?0:4),depth:L,frames:[]},$=(P+D)*L,F=$*N;for(let G=0;G<v.length;G++)b.frames.push({rect:{x:0,y:0,width:N,height:A},img:new Uint8Array(v[G]),blend:0,dispose:1,bpp:Math.ceil($/8),bpl:Math.ceil(F/8)});return h(b,0,!0),f(b,N,A,U,S)},Ht.encode.compress=d,Ht.encode.dither=l,Ht.quantize=m,Ht.quantize.getKDtree=w,Ht.quantize.getNearest=x})();const zl={toArrayBuffer(e,t){const r=e.width,n=e.height,o=r<<2,a=e.getContext("2d").getImageData(0,0,r,n),s=new Uint32Array(a.data.buffer),l=(32*r+31)/32<<2,f=l*n,h=122+f,d=new ArrayBuffer(h),i=new DataView(d),u=1<<20;let g,p,m,w,x=u,O=0,y=0,E=0;function M(C){i.setUint16(y,C,!0),y+=2}function _(C){i.setUint32(y,C,!0),y+=4}function I(C){y+=C}M(19778),_(h),I(4),_(122),_(108),_(r),_(-n>>>0),M(1),M(32),_(3),_(f),_(2835),_(2835),I(8),_(16711680),_(65280),_(255),_(4278190080),_(1466527264),(function C(){for(;O<n&&x>0;){for(w=122+O*l,g=0;g<o;)x--,p=s[E++],m=p>>>24,i.setUint32(w+g,p<<8|m),g+=4;O++}E<s.length?(x=u,setTimeout(C,zl._dly)):t(d)})()},toBlob(e,t){this.toArrayBuffer(e,(r=>{t(new Blob([r],{type:"image/bmp"}))}))},_dly:9};var bt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},ag={[bt.CHROME]:16384,[bt.FIREFOX]:11180,[bt.DESKTOP_SAFARI]:16384,[bt.IE]:8192,[bt.IOS]:4096,[bt.ETC]:8192};const ra=typeof window<"u",Hl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,In=ra&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),sg=(ra||Hl)&&(In&&In.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Gl=(ra||Hl)&&(In&&In.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function na(e,t,r=Date.now()){return new Promise((n=>{const o=e.split(","),a=o[0].match(/:(.*?);/)[1],s=globalThis.atob(o[1]);let l=s.length;const f=new Uint8Array(l);for(;l--;)f[l]=s.charCodeAt(l);const h=new Blob([f],{type:a});h.name=t,h.lastModified=r,n(h)}))}function jl(e){return new Promise(((t,r)=>{const n=new Gl;n.onload=()=>t(n.result),n.onerror=o=>r(o),n.readAsDataURL(e)}))}function Bl(e){return new Promise(((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=o=>r(o),n.src=e}))}function fr(){if(fr.cachedResult!==void 0)return fr.cachedResult;let e=bt.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=bt.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=bt.IOS:/Safari/i.test(t)?e=bt.DESKTOP_SAFARI:/Firefox/i.test(t)?e=bt.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=bt.IE),fr.cachedResult=e,fr.cachedResult}function Wl(e,t){const r=fr(),n=ag[r];let o=e,a=t,s=o*a;const l=o>a?a/o:o/a;for(;s>n*n;){const f=(n+o)/2,h=(n+a)/2;f<h?(a=h,o=h*l):(a=f*l,o=f),s=o*a}return{width:o,height:a}}function Dn(e,t){let r,n;try{if(r=new OffscreenCanvas(e,t),n=r.getContext("2d"),n===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{r=document.createElement("canvas"),n=r.getContext("2d")}return r.width=e,r.height=t,[r,n]}function Kl(e,t){const{width:r,height:n}=Wl(e.width,e.height),[o,a]=Dn(r,n);return t&&/jpe?g/.test(t)&&(a.fillStyle="white",a.fillRect(0,0,o.width,o.height)),a.drawImage(e,0,0,o.width,o.height),o}function Ln(){return Ln.cachedResult!==void 0||(Ln.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Ln.cachedResult}function Pn(e,t={}){return new Promise((function(r,n){let o,a;var s=function(){try{return a=Kl(o,t.fileType||e.type),r([o,a])}catch(f){return n(f)}},l=function(f){try{var h=function(d){try{throw d}catch(i){return n(i)}};try{let d;return jl(e).then((function(i){try{return d=i,Bl(d).then((function(u){try{return o=u,(function(){try{return s()}catch(g){return n(g)}})()}catch(g){return h(g)}}),h)}catch(u){return h(u)}}),h)}catch(d){h(d)}}catch(d){return n(d)}};try{if(Ln()||[bt.DESKTOP_SAFARI,bt.MOBILE_SAFARI].includes(fr()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(f){try{return o=f,s()}catch{return l()}}),l)}catch{l()}}))}function Fn(e,t,r,n,o=1){return new Promise((function(a,s){let l;if(t==="image/png"){let h,d,i;return h=e.getContext("2d"),{data:d}=h.getImageData(0,0,e.width,e.height),i=Ht.encode([d.buffer],e.width,e.height,4096*o),l=new Blob([i],{type:t}),l.name=r,l.lastModified=n,f.call(this)}{let h=function(){return f.call(this)};if(t==="image/bmp")return new Promise((d=>zl.toBlob(e,d))).then(function(d){try{return l=d,l.name=r,l.lastModified=n,h.call(this)}catch(i){return s(i)}}.bind(this),s);{let d=function(){return h.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then(function(i){try{return l=i,l.name=r,l.lastModified=n,d.call(this)}catch(u){return s(u)}}.bind(this),s);{let i;return i=e.toDataURL(t,o),na(i,r,n).then(function(u){try{return l=u,d.call(this)}catch(g){return s(g)}}.bind(this),s)}}}function f(){return a(l)}}))}function Vt(e){e.width=0,e.height=0}function Nr(){return new Promise((function(e,t){let r,n,o,a;return Nr.cachedResult!==void 0?e(Nr.cachedResult):na("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(s){try{return r=s,Pn(r).then((function(l){try{return n=l[1],Fn(n,r.type,r.name,r.lastModified).then((function(f){try{return o=f,Vt(n),Pn(o).then((function(h){try{return a=h[0],Nr.cachedResult=a.width===1&&a.height===2,e(Nr.cachedResult)}catch(d){return t(d)}}),t)}catch(h){return t(h)}}),t)}catch(f){return t(f)}}),t)}catch(l){return t(l)}}),t)}))}function Vl(e){return new Promise(((t,r)=>{const n=new Gl;n.onload=o=>{const a=new DataView(o.target.result);if(a.getUint16(0,!1)!=65496)return t(-2);const s=a.byteLength;let l=2;for(;l<s;){if(a.getUint16(l+2,!1)<=8)return t(-1);const f=a.getUint16(l,!1);if(l+=2,f==65505){if(a.getUint32(l+=2,!1)!=1165519206)return t(-1);const h=a.getUint16(l+=6,!1)==18761;l+=a.getUint32(l+4,h);const d=a.getUint16(l,h);l+=2;for(let i=0;i<d;i++)if(a.getUint16(l+12*i,h)==274)return t(a.getUint16(l+12*i+8,h))}else{if((65280&f)!=65280)break;l+=a.getUint16(l,!1)}}return t(-1)},n.onerror=o=>r(o),n.readAsArrayBuffer(e)}))}function Yl(e,t){const{width:r}=e,{height:n}=e,{maxWidthOrHeight:o}=t;let a,s=e;return isFinite(o)&&(r>o||n>o)&&([s,a]=Dn(r,n),r>n?(s.width=o,s.height=n/r*o):(s.width=r/n*o,s.height=o),a.drawImage(e,0,0,s.width,s.height),Vt(e)),s}function Xl(e,t){const{width:r}=e,{height:n}=e,[o,a]=Dn(r,n);switch(t>4&&t<9?(o.width=n,o.height=r):(o.width=r,o.height=n),t){case 2:a.transform(-1,0,0,1,r,0);break;case 3:a.transform(-1,0,0,-1,r,n);break;case 4:a.transform(1,0,0,-1,0,n);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,n,0);break;case 7:a.transform(0,-1,-1,0,n,r);break;case 8:a.transform(0,-1,1,0,0,r)}return a.drawImage(e,0,0,r,n),Vt(e),o}function ql(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,d,i,u,g,p,m,w,x,O,y,E,M,_,I,C;function v(A=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=A,t.onProgress(Math.min(a,100))}function N(A){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(A,a),100),t.onProgress(a)}return a=r,s=t.maxIteration||10,l=1024*t.maxSizeMB*1024,v(),Pn(e,t).then(function(A){try{return[,f]=A,v(),h=Yl(f,t),v(),new Promise((function(P,D){var L;if(!(L=t.exifOrientation))return Vl(e).then(function(S){try{return L=S,U.call(this)}catch(b){return D(b)}}.bind(this),D);function U(){return P(L)}return U.call(this)})).then(function(P){try{return d=P,v(),Nr().then(function(D){try{return i=D?h:Xl(h,d),v(),u=t.initialQuality||1,g=t.fileType||e.type,Fn(i,g,e.name,e.lastModified,u).then(function(L){try{{let S=function(){if(s--&&(y>l||y>x)){let $,F;return $=C?.95*I.width:I.width,F=C?.95*I.height:I.height,[M,_]=Dn($,F),_.drawImage(I,0,0,$,F),u*=g==="image/png"?.85:.95,Fn(M,g,e.name,e.lastModified,u).then((function(G){try{return E=G,Vt(I),I=M,y=E.size,N(Math.min(99,Math.floor((O-y)/(O-l)*100))),S}catch(Y){return o(Y)}}),o)}return[1]},b=function(){return Vt(I),Vt(M),Vt(h),Vt(i),Vt(f),N(100),n(E)};if(p=L,v(),m=p.size>l,w=p.size>e.size,!m&&!w)return N(100),n(p);var U;return x=e.size,O=p.size,y=O,I=i,C=!t.alwaysKeepResolution&&m,(U=function($){for(;$;){if($.then)return void $.then(U,o);try{if($.pop){if($.length)return $.pop()?b.call(this):$;$=S}else $=$.call(this)}catch(F){return o(F)}}}.bind(this))(S)}}catch(S){return o(S)}}.bind(this),o)}catch(L){return o(L)}}.bind(this),o)}catch(D){return o(D)}}.bind(this),o)}catch(P){return o(P)}}.bind(this),o)}))}const lg=`
|
||
let scriptImported = false
|
||
self.addEventListener('message', async (e) => {
|
||
const { file, id, imageCompressionLibUrl, options } = e.data
|
||
options.onProgress = (progress) => self.postMessage({ progress, id })
|
||
try {
|
||
if (!scriptImported) {
|
||
// console.log('[worker] importScripts', imageCompressionLibUrl)
|
||
self.importScripts(imageCompressionLibUrl)
|
||
scriptImported = true
|
||
}
|
||
// console.log('[worker] self', self)
|
||
const compressedFile = await imageCompression(file, options)
|
||
self.postMessage({ file: compressedFile, id })
|
||
} catch (e) {
|
||
// console.error('[worker] error', e)
|
||
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
||
}
|
||
})
|
||
`;let oa;function ig(e,t){return new Promise(((r,n)=>{oa||(oa=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(lg));const o=new Worker(oa);o.addEventListener("message",(function(s){if(t.signal&&t.signal.aborted)o.terminate();else if(s.data.progress===void 0){if(s.data.error)return n(new Error(s.data.error)),void o.terminate();r(s.data.file),o.terminate()}else t.onProgress(s.data.progress)})),o.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",(()=>{n(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ct(e,t){return new Promise((function(r,n){let o,a,s,l,f,h;if(o={...t},s=0,{onProgress:l}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,f=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=g=>{s=g,typeof l=="function"&&l(s)},!(e instanceof Blob||e instanceof sg))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(h=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!f||typeof Worker!="function"||h)return ql(e,o).then(function(g){try{return a=g,u.call(this)}catch(p){return n(p)}}.bind(this),n);var d=function(){try{return u.call(this)}catch(g){return n(g)}}.bind(this),i=function(g){try{return ql(e,o).then((function(p){try{return a=p,d()}catch(m){return n(m)}}),n)}catch(p){return n(p)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",ig(e,o).then((function(g){try{return a=g,d()}catch{return i()}}),i)}catch{i()}function u(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(a=Ul(e,a))}catch{}return r(a)}}))}ct.getDataUrlFromFile=jl,ct.getFilefromDataUrl=na,ct.loadImage=Bl,ct.drawImageInCanvas=Kl,ct.drawFileInCanvas=Pn,ct.canvasToFile=Fn,ct.getExifOrientation=Vl,ct.handleMaxWidthOrHeight=Yl,ct.followExifOrientation=Xl,ct.cleanupCanvasMemory=Vt,ct.isAutoOrientationInBrowser=Nr,ct.approximateBelowMaximumCanvasSizeOfBrowser=Wl,ct.copyExifWithoutOrientation=Ul,ct.getBrowserName=fr,ct.version="2.0.2";const cg=window.G7Core,$n=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(2)} ${t[r]}`},Zl=e=>{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const r=Object.values(t.response.data.errors)[0];if(Array.isArray(r)&&r[0])return r[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},Ql=e=>e?e.startsWith("image/")?"fa-file-image":e.startsWith("video/")?"fa-file-video":e.startsWith("audio/")?"fa-file-audio":e==="application/pdf"?"fa-file-pdf":e.includes("word")||e.includes("document")?"fa-file-word":e.includes("excel")||e.includes("spreadsheet")?"fa-file-excel":e.includes("zip")||e.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",Re=(e,t)=>cg?.t?.(e,t)??e,gr=window.G7Core;function Jl(e){const{attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:d,initialFiles:i,endpoints:u,onFilesChange:g,onUploadComplete:p,onUploadError:m,onRemove:w,onReorder:x,uploadTriggerEvent:O,confirmBeforeRemove:y,uploadParams:E}=e,[M,_]=k.useState(i),[I,C]=k.useState([]),[v,N]=k.useState(!1),A=k.useRef(null),P=k.useRef(0),D=k.useRef(new Set),L=k.useRef(new Map),[U,S]=k.useState(!1),[b,$]=k.useState(null),[F,G]=k.useState(!1),Y=k.useRef(!1),[B,V]=k.useState([]),j=k.useRef(i),[H,q]=k.useState(!1),[ue,te]=k.useState(0),fe=k.useRef(0),[R,ke]=k.useState(new Map),me=k.useRef(new Map);k.useEffect(()=>{g?.(I)},[I,g]);const Ge=k.useMemo(()=>{const X=j.current;return X===i?X:X.length!==i.length?(j.current=i,i):X.length===0&&i.length===0?X:i.some((ie,le)=>ie.id!==X[le]?.id)?(j.current=i,i):X},[i]);k.useEffect(()=>{if(Y.current)return;const X=Ge.filter(le=>!D.current.has(le.id)&&(!le.hash||!D.current.has(le.hash))),se=new Set(X.map(le=>le.id)),ie=Array.from(L.current.values()).filter(le=>!se.has(le.id)&&!D.current.has(le.id));_([...X,...ie])},[Ge]);const De=k.useCallback(async X=>{const se={maxSizeMB:f?.maxSizeMB??1,maxWidthOrHeight:f?.maxWidthOrHeight??1920,useWebWorker:!0};return await ct(X,se)},[f]),ye=k.useCallback(async X=>{const se=M.length+I.length,ie=Math.max(0,o-se),le=Array.from(X).slice(0,ie);if(X.length>ie){const ne=Array.from(X).slice(ie),Te=Re("attachment.upload_limit_exceeded",{max:o});m?.(Te,ne[0]??X[0])}for(const ne of le){if(ne.size>a*1024*1024){m?.(`[${ne.name}] 파일 크기(${$n(ne.size)})가 최대 허용 크기(${a}MB)를 초과합니다.`,ne);continue}if(l){const ve="."+ne.name.split(".").pop()?.toLowerCase();if(!l.split(",").map(Ue=>Ue.trim().toLowerCase()).some(Ue=>{if(Ue.includes("/")){if(Ue.endsWith("/*")){const je=Ue.slice(0,-2);return ne.type.toLowerCase().startsWith(je+"/")}return ne.type.toLowerCase()===Ue}return ve===Ue})){m?.(`[${ne.name}] 허용되지 않는 파일 형식입니다. (허용: ${l})`,ne);continue}}const Te={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:ne,original_filename:ne.name,mime_type:ne.type,size:ne.size,size_formatted:$n(ne.size),status:"pending",progress:0};if(ne.type.startsWith("image/")&&(Te.preview=URL.createObjectURL(ne)),C(ve=>[...ve,Te]),ne.type.startsWith("image/")&&f){C(ve=>ve.map(Se=>Se.id===Te.id?{...Se,status:"compressing"}:Se));try{const ve=await De(ne);C(Se=>Se.map(_e=>_e.id===Te.id?{..._e,compressedBlob:ve,size:ve.size,size_formatted:$n(ve.size),status:"pending",progress:0}:_e))}catch{C(ve=>ve.map(Se=>Se.id===Te.id?{...Se,status:"error",error:"이미지 압축 실패"}:Se))}}}},[M.length,I.length,o,a,l,f,De,m]),Me=k.useCallback(async X=>{const se=new FormData,ie=X.compressedBlob?new File([X.compressedBlob],X.original_filename,{type:X.mime_type}):X.file;se.append("file",ie),t&&se.append("attachmentable_type",t),r&&se.append("attachmentable_id",String(r)),se.append("collection",n),h.forEach(le=>{se.append("role_ids[]",String(le))}),E&&Object.entries(E).forEach(([le,ne])=>{se.append(le,ne)});try{const le=await gr.api.post(u.upload,se,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Te=>{const ve=Math.round(Te.loaded*100/(Te.total??1));C(Se=>Se.map(_e=>_e.id===X.id?{..._e,progress:ve}:_e))}});return le?.data?.data??le?.data}catch(le){const ne=Zl(le);throw new Error(ne)}},[t,r,n,h,u.upload]),Ce=k.useCallback(async()=>{const X=I.filter(ve=>ve.status==="pending"||ve.status==="error");if(X.length===0)return[];const se=[],ie=new Map,le=[...X],ne=async()=>{for(;le.length>0&&P.current<s;){const ve=le.shift();P.current++,C(Se=>Se.map(_e=>_e.id===ve.id?{..._e,status:"uploading",progress:0}:_e));try{const Se=await Me(ve);if(Se)se.push(Se),ie.set(String(ve.id),String(Se.hash)),L.current.set(Se.id,Se),C(_e=>_e.filter(Ue=>Ue.id!==ve.id)),_(_e=>[..._e,Se]),V(_e=>{if(_e.length===0)return _e;const Ue=String(ve.id);return _e.some(Ee=>String(Ee)===Ue)?_e.map(Ee=>String(Ee)===Ue?String(Se.hash):Ee):_e}),ve.preview&&URL.revokeObjectURL(ve.preview);else{const _e=Re("attachment.upload_response_invalid");C(Ue=>Ue.map(je=>je.id===ve.id?{...je,status:"error",error:_e}:je)),m?.(`[${ve.original_filename}] ${_e}`,ve.file)}}catch(Se){const _e=Se instanceof Error?Se.message:"업로드 실패";C(Ue=>Ue.map(je=>je.id===ve.id?{...je,status:"error",error:_e}:je)),m?.(`[${ve.original_filename}] ${_e}`,ve.file)}finally{P.current--}}},Te=Array(Math.min(s,X.length)).fill(null).map(()=>ne());if(await Promise.all(Te),se.length>0&&(p?.(se),u.reorder&&B.length>0&&x)){const ve=[...M,...se],Se=B.map(je=>ie.get(String(je))??je),_e=new Map(Se.map((je,Ee)=>[String(je),Ee])),Ue=[...ve].sort((je,Ee)=>{const he=_e.get(String(je.hash))??ve.length,Ne=_e.get(String(Ee.hash))??ve.length;return he-Ne}).map((je,Ee)=>({...je,sort_order:Ee,order:Ee+1}));x(Ue)}return se},[I,s,Me,p,m,B,M,x,u.reorder]);k.useEffect(()=>{if(!O)return;const X=gr.componentEvent.on(O,async()=>{const se=await Ce();return{uploadedAttachments:se,existingFiles:M,allFiles:[...M,...se]}});return()=>{X()}},[O,Ce,M]),k.useEffect(()=>{d&&I.some(X=>X.status==="pending")&&Ce()},[d,I,Ce]);const we=k.useCallback(async X=>{G(!0);try{if(X.id&&u.delete){const ie=u.delete.replace(":id",String(X.id));await gr.api.delete(ie)}const se=X.hash||X.id;X.id&&(D.current.add(X.id),L.current.delete(X.id)),X.hash&&D.current.add(X.hash),_(ie=>ie.filter(le=>(le.hash||le.id)!==se)),w?.(X.hash||X.id),S(!1),$(null)}catch{console.error("첨부파일 삭제 실패")}finally{G(!1)}},[w,u.delete]),$e=k.useCallback(async X=>{"hash"in X?y?($(X),S(!0)):await we(X):(X.preview&&URL.revokeObjectURL(X.preview),C(se=>se.filter(ie=>ie.id!==X.id)))},[y,we]),Le=k.useCallback(X=>{C(se=>se.map(ie=>ie.id===X.id?{...ie,status:"pending",error:void 0}:ie))},[]),K=k.useCallback(async X=>{const{arrayMove:se}=await Promise.resolve().then(()=>Wh),{active:ie,over:le}=X;if(!le||ie.id===le.id)return;const ne=[...M,...I];let Te;if(B.length===0)Te=ne;else{const he=new Map(B.map((Ne,Ve)=>[String(Ne),Ve]));Te=[...ne].sort((Ne,Ve)=>{const Fe="hash"in Ne?String(Ne.hash):String(Ne.id),Be="hash"in Ve?String(Ve.hash):String(Ve.id);return(he.get(Fe)??ne.length)-(he.get(Be)??ne.length)})}const ve=Te.findIndex(he=>"hash"in he?he.hash===ie.id:he.id===ie.id),Se=Te.findIndex(he=>"hash"in he?he.hash===le.id:he.id===le.id),_e=se(Te,ve,Se);V(_e.map(he=>"hash"in he?he.hash:he.id));const Ue=_e.filter(he=>"hash"in he),je=_e.filter(he=>!("hash"in he));Y.current=!0,_(Ue),C(je);const Ee=Ue.map((he,Ne)=>({...he,sort_order:Ne,order:Ne+1}));if(Ue.length>0&&u.reorder){const he=Ue.map((Ne,Ve)=>({id:Ne.id,order:Ve+1}));try{const Ne=await gr.api.patch(u.reorder,{order:he});gr.toast.success(Ne.message)}catch(Ne){const Ve=Ne instanceof Error?Ne.message:Re("attachment.reorder_failed");gr.toast.error(Ve)}}x?.(Ee)},[M,I,B,u.reorder,x]),re=k.useMemo(()=>[...M,...I].filter(X=>"is_image"in X?X.is_image:X.mime_type?.startsWith("image/")??!1),[M,I]),oe=k.useCallback(X=>{const se=re.findIndex(ie=>"hash"in X&&"hash"in ie?ie.hash===X.hash:"id"in X&&"id"in ie&&!("hash"in X)&&!("hash"in ie)?ie.id===X.id:!1);se!==-1&&(fe.current+=1,te(se),q(!0))},[re]);k.useEffect(()=>{let X=!1;return(async()=>{const ie=M.filter(ne=>ne.is_image),le=new Set(ie.map(ne=>ne.id));for(const[ne,Te]of me.current)le.has(ne)||(URL.revokeObjectURL(Te),me.current.delete(ne));for(const ne of ie){if(X)break;if(!me.current.has(ne.id))try{const Te=await gr.api.get(ne.download_url,{responseType:"blob"});if(!X&&Te){const ve=URL.createObjectURL(Te);me.current.set(ne.id,ve),ke(new Map(me.current))}}catch(Te){console.error("Failed to load authenticated image:",Te)}}})(),()=>{X=!0}},[M]),k.useEffect(()=>()=>{me.current.forEach(X=>URL.revokeObjectURL(X)),me.current.clear()},[]);const ae=k.useCallback(async X=>{const{executeImageDownload:se}=await Promise.resolve().then(()=>Al);await se({src:X.download_url,downloadUrl:X.download_url,filename:X.original_filename,downloadRequiresAuth:!0})},[]),be=k.useMemo(()=>{const X=[...M,...I];if(B.length===0)return X;const se=new Map(B.map((ie,le)=>[String(ie),le]));return[...X].sort((ie,le)=>{const ne="hash"in ie?String(ie.hash):String(ie.id),Te="hash"in le?String(le.hash):String(le.id),ve=se.get(ne)??X.length,Se=se.get(Te)??X.length;return ve-Se})},[M,I,B]),xe=be.length,He=xe>0,Pe=xe<o,Ke=k.useCallback(()=>C([]),[]),Oe=k.useCallback(()=>I,[I]);return{existingFiles:M,pendingFiles:I,isDragOver:v,setIsDragOver:N,isDeleting:F,totalCount:xe,hasFiles:He,canAddMore:Pe,allItems:be,imageFiles:re,handleFiles:ye,handleRemove:$e,handleRetry:Le,handleUploadAll:Ce,handleOpenGallery:oe,handleDownload:ae,handleDragEnd:K,inputRef:A,galleryOpen:H,setGalleryOpen:q,galleryStartIndex:ue,galleryKeyRef:fe,confirmDialogOpen:U,setConfirmDialogOpen:S,itemToDelete:b,executeRemoveAttachment:we,authenticatedImageUrls:R,clear:Ke,getPendingFiles:Oe}}const Rl=({isDragOver:e,canAddMore:t,onFiles:r,setIsDragOver:n,inputRef:o,accept:a,maxFiles:s,maxSize:l,children:f})=>c.jsxs(W,{className:`
|
||
relative border-2 border-dashed rounded-lg transition-colors
|
||
${e?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"}
|
||
`,onDragOver:h=>{h.preventDefault(),t&&n(!0)},onDragLeave:()=>n(!1),onDrop:h=>{h.preventDefault(),n(!1),t&&r(h.dataTransfer.files)},children:[c.jsx("input",{ref:o,type:"file",multiple:!0,accept:a,onChange:h=>h.target.files&&r(h.target.files),className:"hidden"}),!f&&c.jsxs(W,{className:"p-8 text-center cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:()=>o.current?.click(),children:[c.jsx(Ct,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),c.jsx(Dt,{className:"text-sm text-gray-600 dark:text-gray-400",children:Re("attachment.drop_or_click")}),c.jsxs(Dt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[Re("attachment.upload_limit",{maxFiles:s,maxSize:l}),a&&` (${a})`]})]}),f]});function dg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Un=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ar(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function aa(e){return"nodeType"in e}function yt(e){var t,r;return e?Ar(e)?e:aa(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function sa(e){const{Document:t}=yt(e);return e instanceof t}function Qr(e){return Ar(e)?!1:e instanceof yt(e).HTMLElement}function ei(e){return e instanceof yt(e).SVGElement}function Mr(e){return e?Ar(e)?e.document:aa(e)?sa(e)?e:Qr(e)||ei(e)?e.ownerDocument:document:document:document}const Yt=Un?k.useLayoutEffect:k.useEffect;function la(e){const t=k.useRef(e);return Yt(()=>{t.current=e}),k.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function ug(){const e=k.useRef(null),t=k.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Jr(e,t){t===void 0&&(t=[e]);const r=k.useRef(e);return Yt(()=>{r.current!==e&&(r.current=e)},t),r}function Rr(e,t){const r=k.useRef();return k.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function zn(e){const t=la(e),r=k.useRef(null),n=k.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function ia(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let ca={};function en(e,t){return k.useMemo(()=>{if(t)return t;const r=ca[e]==null?0:ca[e]+1;return ca[e]=r,e+"-"+r},[e,t])}function ti(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const l=Object.entries(s);for(const[f,h]of l){const d=a[f];d!=null&&(a[f]=d+e*h)}return a},{...t})}}const Or=ti(1),tn=ti(-1);function fg(e){return"clientX"in e&&"clientY"in e}function da(e){if(!e)return!1;const{KeyboardEvent:t}=yt(e.target);return t&&e instanceof t}function gg(e){if(!e)return!1;const{TouchEvent:t}=yt(e.target);return t&&e instanceof t}function ua(e){if(gg(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return fg(e)?{x:e.clientX,y:e.clientY}:null}const rn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[rn.Translate.toString(e),rn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),ri="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function hg(e){return e.matches(ri)?e:e.querySelector(ri)}const pg={display:"none"};function mg(e){let{id:t,value:r}=e;return k.createElement("div",{id:t,style:pg},r)}function bg(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={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 k.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function yg(){const[e,t]=k.useState("");return{announce:k.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const ni=k.createContext(null);function vg(e){const t=k.useContext(ni);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function wg(){const[e]=k.useState(()=>new Set),t=k.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[k.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const xg={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.
|
||
`},kg={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Cg(e){let{announcements:t=kg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=xg}=e;const{announce:a,announcement:s}=yg(),l=en("DndLiveRegion"),[f,h]=k.useState(!1);if(k.useEffect(()=>{h(!0)},[]),vg(k.useMemo(()=>({onDragStart(i){let{active:u}=i;a(t.onDragStart({active:u}))},onDragMove(i){let{active:u,over:g}=i;t.onDragMove&&a(t.onDragMove({active:u,over:g}))},onDragOver(i){let{active:u,over:g}=i;a(t.onDragOver({active:u,over:g}))},onDragEnd(i){let{active:u,over:g}=i;a(t.onDragEnd({active:u,over:g}))},onDragCancel(i){let{active:u,over:g}=i;a(t.onDragCancel({active:u,over:g}))}}),[a,t])),!f)return null;const d=k.createElement(k.Fragment,null,k.createElement(mg,{id:n,value:o.draggable}),k.createElement(bg,{id:l,announcement:s}));return r?Jt.createPortal(d,r):d}var et;(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"})(et||(et={}));function Hn(){}function oi(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Sg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Gt=Object.freeze({x:0,y:0});function ai(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function si(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function _g(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function li(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function ii(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function ci(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Eg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=ci(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=ai(ci(f),o);a.push({id:l,data:{droppableContainer:s,value:h}})}}return a.sort(si)},Tg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=li(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=li(f),d=o.reduce((u,g,p)=>u+ai(h[p],g),0),i=Number((d/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(si)};function Ng(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,l=a-r;if(n<o&&r<a){const f=t.width*t.height,h=e.width*e.height,d=s*l,i=d/(f+h-d);return Number(i.toFixed(4))}return 0}const Ag=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,l=r.get(s);if(l){const f=Ng(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(_g)};function Mg(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function di(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Gt}function Og(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...r})}}const Ig=Og(1);function Dg(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 Lg(e,t,r){const n=Dg(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:l}=n,f=e.left-s-(1-o)*parseFloat(r),h=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),d=o?e.width/o:e.width,i=a?e.height/a:e.height;return{width:d,height:i,top:h,right:f+d,bottom:h+i,left:f}}const Pg={ignoreTransform:!1};function Ir(e,t){t===void 0&&(t=Pg);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:d}=yt(e).getComputedStyle(e);h&&(r=Lg(r,h,d))}const{top:n,left:o,width:a,height:s,bottom:l,right:f}=r;return{top:n,left:o,width:a,height:s,bottom:l,right:f}}function ui(e){return Ir(e,{ignoreTransform:!0})}function Fg(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function $g(e,t){return t===void 0&&(t=yt(e).getComputedStyle(e)),t.position==="fixed"}function Ug(e,t){t===void 0&&(t=yt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function Gn(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(sa(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!Qr(o)||ei(o)||r.includes(o))return r;const a=yt(e).getComputedStyle(o);return o!==e&&Ug(o,a)&&r.push(o),$g(o,a)?r:n(o.parentNode)}return e?n(e):r}function fi(e){const[t]=Gn(e,1);return t??null}function fa(e){return!Un||!e?null:Ar(e)?e:aa(e)?sa(e)||e===Mr(e).scrollingElement?window:Qr(e)?e:null:null}function gi(e){return Ar(e)?e.scrollX:e.scrollLeft}function hi(e){return Ar(e)?e.scrollY:e.scrollTop}function ga(e){return{x:gi(e),y:hi(e)}}var ot;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ot||(ot={}));function pi(e){return!Un||!e?!1:e===document.scrollingElement}function mi(e){const t={x:0,y:0},r=pi(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:l,maxScroll:n,minScroll:t}}const zg={x:.2,y:.2};function Hg(e,t,r,n,o){let{top:a,left:s,right:l,bottom:f}=r;n===void 0&&(n=10),o===void 0&&(o=zg);const{isTop:h,isBottom:d,isLeft:i,isRight:u}=mi(e),g={x:0,y:0},p={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!h&&a<=t.top+m.height?(g.y=ot.Backward,p.y=n*Math.abs((t.top+m.height-a)/m.height)):!d&&f>=t.bottom-m.height&&(g.y=ot.Forward,p.y=n*Math.abs((t.bottom-m.height-f)/m.height)),!u&&l>=t.right-m.width?(g.x=ot.Forward,p.x=n*Math.abs((t.right-m.width-l)/m.width)):!i&&s<=t.left+m.width&&(g.x=ot.Backward,p.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:g,speed:p}}function Gg(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function bi(e){return e.reduce((t,r)=>Or(t,ga(r)),Gt)}function jg(e){return e.reduce((t,r)=>t+gi(r),0)}function Bg(e){return e.reduce((t,r)=>t+hi(r),0)}function Wg(e,t){if(t===void 0&&(t=Ir),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);fi(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Kg=[["x",["left","right"],jg],["y",["top","bottom"],Bg]];class ha{constructor(t,r){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 n=Gn(r),o=bi(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of Kg)for(const f of s)Object.defineProperty(this,f,{get:()=>{const h=l(n),d=o[a]-h;return this.rect[f]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class nn{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function Vg(e){const{EventTarget:t}=yt(e);return e instanceof t?e:Mr(e)}function pa(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var It;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(It||(It={}));function yi(e){e.preventDefault()}function Yg(e){e.stopPropagation()}var ze;(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"})(ze||(ze={}));const vi={start:[ze.Space,ze.Enter],cancel:[ze.Esc],end:[ze.Space,ze.Enter,ze.Tab]},Xg=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ze.Right:return{...r,x:r.x+25};case ze.Left:return{...r,x:r.x-25};case ze.Down:return{...r,y:r.y+25};case ze.Up:return{...r,y:r.y-25}}};class ma{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:r}}=t;this.props=t,this.listeners=new nn(Mr(r)),this.windowListeners=new nn(yt(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(It.Resize,this.handleCancel),this.windowListeners.add(It.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(It.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Wg(n),r(Gt)}handleKeyDown(t){if(da(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=vi,coordinateGetter:s=Xg,scrollBehavior:l="smooth"}=o,{code:f}=t;if(a.end.includes(f)){this.handleEnd(t);return}if(a.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:h}=n.current,d=h?{x:h.left,y:h.top}:Gt;this.referenceCoordinates||(this.referenceCoordinates=d);const i=s(t,{active:r,context:n.current,currentCoordinates:d});if(i){const u=tn(i,d),g={x:0,y:0},{scrollableAncestors:p}=n.current;for(const m of p){const w=t.code,{isTop:x,isRight:O,isLeft:y,isBottom:E,maxScroll:M,minScroll:_}=mi(m),I=Gg(m),C={x:Math.min(w===ze.Right?I.right-I.width/2:I.right,Math.max(w===ze.Right?I.left:I.left+I.width/2,i.x)),y:Math.min(w===ze.Down?I.bottom-I.height/2:I.bottom,Math.max(w===ze.Down?I.top:I.top+I.height/2,i.y))},v=w===ze.Right&&!O||w===ze.Left&&!y,N=w===ze.Down&&!E||w===ze.Up&&!x;if(v&&C.x!==i.x){const A=m.scrollLeft+u.x,P=w===ze.Right&&A<=M.x||w===ze.Left&&A>=_.x;if(P&&!u.y){m.scrollTo({left:A,behavior:l});return}P?g.x=m.scrollLeft-A:g.x=w===ze.Right?m.scrollLeft-M.x:m.scrollLeft-_.x,g.x&&m.scrollBy({left:-g.x,behavior:l});break}else if(N&&C.y!==i.y){const A=m.scrollTop+u.y,P=w===ze.Down&&A<=M.y||w===ze.Up&&A>=_.y;if(P&&!u.x){m.scrollTo({top:A,behavior:l});return}P?g.y=m.scrollTop-A:g.y=w===ze.Down?m.scrollTop-M.y:m.scrollTop-_.y,g.y&&m.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(t,Or(tn(i,this.referenceCoordinates),g))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ma.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=vi,onActivation:o}=t,{active:a}=r;const{code:s}=e.nativeEvent;if(n.start.includes(s)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function wi(e){return!!(e&&"distance"in e)}function xi(e){return!!(e&&"delay"in e)}class ba{constructor(t,r,n){var o;n===void 0&&(n=Vg(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=r;const{event:a}=t,{target:s}=a;this.props=t,this.events=r,this.document=Mr(s),this.documentListeners=new nn(this.document),this.listeners=new nn(n),this.windowListeners=new nn(yt(s)),this.initialCoordinates=(o=ua(a))!=null?o:Gt,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:r,bypassActivationConstraint:n}}}=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(It.Resize,this.handleCancel),this.windowListeners.add(It.DragStart,yi),this.windowListeners.add(It.VisibilityChange,this.handleCancel),this.windowListeners.add(It.ContextMenu,yi),this.documentListeners.add(It.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(xi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(wi(r)){this.handlePending(r);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,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(It.Click,Yg,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(It.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:l}}=a;if(!o)return;const f=(r=ua(t))!=null?r:Gt,h=tn(o,f);if(!n&&l){if(wi(l)){if(l.tolerance!=null&&pa(h,l.tolerance))return this.handleCancel();if(pa(h,l.distance))return this.handleStart()}if(xi(l)&&pa(h,l.tolerance))return this.handleCancel();this.handlePending(l,h);return}t.cancelable&&t.preventDefault(),s(f)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ze.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const qg={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ya extends ba{constructor(t){const{event:r}=t,n=Mr(r.target);super(t,qg,n)}}ya.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const Zg={move:{name:"mousemove"},end:{name:"mouseup"}};var va;(function(e){e[e.RightClick=2]="RightClick"})(va||(va={}));class Qg extends ba{constructor(t){super(t,Zg,Mr(t.event.target))}}Qg.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===va.RightClick?!1:(n?.({event:r}),!0)}}];const wa={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Jg extends ba{constructor(t){super(t,wa)}static setup(){return window.addEventListener(wa.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wa.move.name,t)};function t(){}}}Jg.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var on;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(on||(on={}));var jn;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(jn||(jn={}));function Rg(e){let{acceleration:t,activator:r=on.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:l=jn.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:d,delta:i,threshold:u}=e;const g=th({delta:i,disabled:!a}),[p,m]=ug(),w=k.useRef({x:0,y:0}),x=k.useRef({x:0,y:0}),O=k.useMemo(()=>{switch(r){case on.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case on.DraggableRect:return o}},[r,o,f]),y=k.useRef(null),E=k.useCallback(()=>{const _=y.current;if(!_)return;const I=w.current.x*x.current.x,C=w.current.y*x.current.y;_.scrollBy(I,C)},[]),M=k.useMemo(()=>l===jn.TreeOrder?[...h].reverse():h,[l,h]);k.useEffect(()=>{if(!a||!h.length||!O){m();return}for(const _ of M){if(n?.(_)===!1)continue;const I=h.indexOf(_),C=d[I];if(!C)continue;const{direction:v,speed:N}=Hg(_,C,O,t,u);for(const A of["x","y"])g[A][v[A]]||(N[A]=0,v[A]=0);if(N.x>0||N.y>0){m(),y.current=_,p(E,s),w.current=N,x.current=v;return}}w.current={x:0,y:0},x.current={x:0,y:0},m()},[t,E,n,m,a,s,JSON.stringify(O),JSON.stringify(g),p,h,M,d,JSON.stringify(u)])}const eh={x:{[ot.Backward]:!1,[ot.Forward]:!1},y:{[ot.Backward]:!1,[ot.Forward]:!1}};function th(e){let{delta:t,disabled:r}=e;const n=ia(t);return Rr(o=>{if(r||!n||!o)return eh;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ot.Backward]:o.x[ot.Backward]||a.x===-1,[ot.Forward]:o.x[ot.Forward]||a.x===1},y:{[ot.Backward]:o.y[ot.Backward]||a.y===-1,[ot.Forward]:o.y[ot.Forward]||a.y===1}}},[r,t,n])}function rh(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return Rr(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function nh(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...r,...a]},[]),[e,t])}var an;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(an||(an={}));var xa;(function(e){e.Optimized="optimized"})(xa||(xa={}));const ki=new Map;function oh(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=k.useState(null),{frequency:l,measure:f,strategy:h}=o,d=k.useRef(e),i=w(),u=Jr(i),g=k.useCallback(function(x){x===void 0&&(x=[]),!u.current&&s(O=>O===null?x:O.concat(x.filter(y=>!O.includes(y))))},[u]),p=k.useRef(null),m=Rr(x=>{if(i&&!r)return ki;if(!x||x===ki||d.current!==e||a!=null){const O=new Map;for(let y of e){if(!y)continue;if(a&&a.length>0&&!a.includes(y.id)&&y.rect.current){O.set(y.id,y.rect.current);continue}const E=y.node.current,M=E?new ha(f(E),E):null;y.rect.current=M,M&&O.set(y.id,M)}return O}return x},[e,a,r,i,f]);return k.useEffect(()=>{d.current=e},[e]),k.useEffect(()=>{i||g()},[r,i]),k.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),k.useEffect(()=>{i||typeof l!="number"||p.current!==null||(p.current=setTimeout(()=>{g(),p.current=null},l))},[l,i,g,...n]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:a!=null};function w(){switch(h){case an.Always:return!1;case an.BeforeDragging:return r;default:return!r}}}function Ci(e,t){return Rr(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ah(e,t){return Ci(e,t)}function sh(e){let{callback:t,disabled:r}=e;const n=la(t),o=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>o?.disconnect(),[o]),o}function Bn(e){let{callback:t,disabled:r}=e;const n=la(t),o=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>o?.disconnect(),[o]),o}function lh(e){return new ha(Ir(e),e)}function Si(e,t,r){t===void 0&&(t=lh);const[n,o]=k.useState(null);function a(){o(f=>{if(!e)return null;if(e.isConnected===!1){var h;return(h=f??r)!=null?h:null}const d=t(e);return JSON.stringify(f)===JSON.stringify(d)?f:d})}const s=sh({callback(f){if(e)for(const h of f){const{type:d,target:i}=h;if(d==="childList"&&i instanceof HTMLElement&&i.contains(e)){a();break}}}}),l=Bn({callback:a});return Yt(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),n}function ih(e){const t=Ci(e);return di(e,t)}const _i=[];function ch(e){const t=k.useRef(e),r=Rr(n=>e?n&&n!==_i&&e&&t.current&&e.parentNode===t.current.parentNode?n:Gn(e):_i,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function dh(e){const[t,r]=k.useState(null),n=k.useRef(e),o=k.useCallback(a=>{const s=fa(a.target);s&&r(l=>l?(l.set(s,ga(s)),new Map(l)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){s(a);const l=e.map(f=>{const h=fa(f);return h?(h.addEventListener("scroll",o,{passive:!0}),[h,ga(h)]):null}).filter(f=>f!=null);r(l.length?new Map(l):null),n.current=e}return()=>{s(e),s(a)};function s(l){l.forEach(f=>{const h=fa(f);h?.removeEventListener("scroll",o)})}},[o,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Or(a,s),Gt):bi(e):Gt,[e,t])}function Ei(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==Gt;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?tn(e,r.current):Gt}function uh(e){k.useEffect(()=>{if(!Un)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function fh(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function Ti(e){return k.useMemo(()=>e?Fg(e):null,[e])}const Ni=[];function gh(e,t){t===void 0&&(t=Ir);const[r]=e,n=Ti(r?yt(r):null),[o,a]=k.useState(Ni);function s(){a(()=>e.length?e.map(f=>pi(f)?n:new ha(t(f),f)):Ni)}const l=Bn({callback:s});return Yt(()=>{l?.disconnect(),s(),e.forEach(f=>l?.observe(f))},[e]),o}function hh(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qr(t)?t:e}function ph(e){let{measure:t}=e;const[r,n]=k.useState(null),o=k.useCallback(h=>{for(const{target:d}of h)if(Qr(d)){n(i=>{const u=t(d);return i?{...i,width:u.width,height:u.height}:u});break}},[t]),a=Bn({callback:o}),s=k.useCallback(h=>{const d=hh(h);a?.disconnect(),d&&a?.observe(d),n(d?t(d):null)},[t,a]),[l,f]=zn(s);return k.useMemo(()=>({nodeRef:l,rect:r,setRef:f}),[r,l,f])}const mh=[{sensor:ya,options:{}},{sensor:ma,options:{}}],bh={current:{}},Wn={draggable:{measure:ui},droppable:{measure:ui,strategy:an.WhileDragging,frequency:xa.Optimized},dragOverlay:{measure:Ir}};class sn extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const yh={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new sn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Hn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Wn,measureDroppableContainers:Hn,windowRect:null,measuringScheduled:!1},vh={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Hn,draggableNodes:new Map,over:null,measureDroppableContainers:Hn},Kn=k.createContext(vh),Ai=k.createContext(yh);function wh(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sn}}}function xh(e,t){switch(t.type){case et.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case et.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 et.DragEnd:case et.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case et.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new sn(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case et.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const s=new sn(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case et.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new sn(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function kh(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=k.useContext(Kn),a=ia(n),s=ia(r?.id);return k.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!da(a)||document.activeElement===a.target)return;const l=o.get(s);if(!l)return;const{activatorNode:f,node:h}=l;if(!f.current&&!h.current)return;requestAnimationFrame(()=>{for(const d of[f.current,h.current]){if(!d)continue;const i=hg(d);if(i){i.focus();break}}})}},[n,t,o,s,a]),null}function Ch(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function Sh(e){return k.useMemo(()=>({draggable:{...Wn.draggable,...e?.draggable},droppable:{...Wn.droppable,...e?.droppable},dragOverlay:{...Wn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _h(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=k.useRef(!1),{x:s,y:l}=typeof o=="boolean"?{x:o,y:o}:o;Yt(()=>{if(!s&&!l||!t){a.current=!1;return}if(a.current||!n)return;const h=t?.node.current;if(!h||h.isConnected===!1)return;const d=r(h),i=di(d,n);if(s||(i.x=0),l||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){const u=fi(h);u&&u.scrollBy({top:i.y,left:i.x})}},[t,s,l,n,r])}const Mi=k.createContext({...Gt,scaleX:1,scaleY:1});var tr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(tr||(tr={}));const Eh=k.memo(function(t){var r,n,o,a;let{id:s,accessibility:l,autoScroll:f=!0,children:h,sensors:d=mh,collisionDetection:i=Ag,measuring:u,modifiers:g,...p}=t;const m=k.useReducer(xh,void 0,wh),[w,x]=m,[O,y]=wg(),[E,M]=k.useState(tr.Uninitialized),_=E===tr.Initialized,{draggable:{active:I,nodes:C,translate:v},droppable:{containers:N}}=w,A=I!=null?C.get(I):null,P=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var Ee;return I!=null?{id:I,data:(Ee=A?.data)!=null?Ee:bh,rect:P}:null},[I,A]),L=k.useRef(null),[U,S]=k.useState(null),[b,$]=k.useState(null),F=Jr(p,Object.values(p)),G=en("DndDescribedBy",s),Y=k.useMemo(()=>N.getEnabled(),[N]),B=Sh(u),{droppableRects:V,measureDroppableContainers:j,measuringScheduled:H}=oh(Y,{dragging:_,dependencies:[v.x,v.y],config:B.droppable}),q=rh(C,I),ue=k.useMemo(()=>b?ua(b):null,[b]),te=je(),fe=ah(q,B.draggable.measure);_h({activeNode:I!=null?C.get(I):null,config:te.layoutShiftCompensation,initialRect:fe,measure:B.draggable.measure});const R=Si(q,B.draggable.measure,fe),ke=Si(q?q.parentElement:null),me=k.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=N.getNodeFor((r=me.current.over)==null?void 0:r.id),De=ph({measure:B.dragOverlay.measure}),ye=(n=De.nodeRef.current)!=null?n:q,Me=_?(o=De.rect)!=null?o:R:null,Ce=!!(De.nodeRef.current&&De.rect),we=ih(Ce?null:R),$e=Ti(ye?yt(ye):null),Le=ch(_?Ge??q:null),K=gh(Le),re=Ch(g,{transform:{x:v.x-we.x,y:v.y-we.y,scaleX:1,scaleY:1},activatorEvent:b,active:D,activeNodeRect:R,containerNodeRect:ke,draggingNodeRect:Me,over:me.current.over,overlayNodeRect:De.rect,scrollableAncestors:Le,scrollableAncestorRects:K,windowRect:$e}),oe=ue?Or(ue,v):null,ae=dh(Le),be=Ei(ae),xe=Ei(ae,[R]),He=Or(re,be),Pe=Me?Ig(Me,re):null,Ke=D&&Pe?i({active:D,collisionRect:Pe,droppableRects:V,droppableContainers:Y,pointerCoordinates:oe}):null,Oe=ii(Ke,"id"),[X,se]=k.useState(null),ie=Ce?re:Or(re,xe),le=Mg(ie,(a=X?.rect)!=null?a:null,R),ne=k.useRef(null),Te=k.useCallback((Ee,he)=>{let{sensor:Ne,options:Ve}=he;if(L.current==null)return;const Fe=C.get(L.current);if(!Fe)return;const Be=Ee.nativeEvent,Ze=new Ne({active:L.current,activeNode:Fe,event:Be,options:Ve,context:me,onAbort(qe){if(!C.get(qe))return;const{onDragAbort:_t}=F.current,Bt={id:qe};_t?.(Bt),O({type:"onDragAbort",event:Bt})},onPending(qe,jt,_t,Bt){if(!C.get(qe))return;const{onDragPending:Et}=F.current,Wt={id:qe,constraint:jt,initialCoordinates:_t,offset:Bt};Et?.(Wt),O({type:"onDragPending",event:Wt})},onStart(qe){const jt=L.current;if(jt==null)return;const _t=C.get(jt);if(!_t)return;const{onDragStart:Bt}=F.current,dt={activatorEvent:Be,active:{id:jt,data:_t.data,rect:P}};Jt.unstable_batchedUpdates(()=>{Bt?.(dt),M(tr.Initializing),x({type:et.DragStart,initialCoordinates:qe,active:jt}),O({type:"onDragStart",event:dt}),S(ne.current),$(Be)})},onMove(qe){x({type:et.DragMove,coordinates:qe})},onEnd:qt(et.DragEnd),onCancel:qt(et.DragCancel)});ne.current=Ze;function qt(qe){return async function(){const{active:_t,collisions:Bt,over:dt,scrollAdjustedTranslate:Et}=me.current;let Wt=null;if(_t&&Et){const{cancelDrop:nr}=F.current;Wt={activatorEvent:Be,active:_t,collisions:Bt,delta:Et,over:dt},qe===et.DragEnd&&typeof nr=="function"&&await Promise.resolve(nr(Wt))&&(qe=et.DragCancel)}L.current=null,Jt.unstable_batchedUpdates(()=>{x({type:qe}),M(tr.Uninitialized),se(null),S(null),$(null),ne.current=null;const nr=qe===et.DragEnd?"onDragEnd":"onDragCancel";if(Wt){const mr=F.current[nr];mr?.(Wt),O({type:nr,event:Wt})}})}}},[C]),ve=k.useCallback((Ee,he)=>(Ne,Ve)=>{const Fe=Ne.nativeEvent,Be=C.get(Ve);if(L.current!==null||!Be||Fe.dndKit||Fe.defaultPrevented)return;const Ze={active:Be};Ee(Ne,he.options,Ze)===!0&&(Fe.dndKit={capturedBy:he.sensor},L.current=Ve,Te(Ne,he))},[C,Te]),Se=nh(d,ve);uh(d),Yt(()=>{R&&E===tr.Initializing&&M(tr.Initialized)},[R,E]),k.useEffect(()=>{const{onDragMove:Ee}=F.current,{active:he,activatorEvent:Ne,collisions:Ve,over:Fe}=me.current;if(!he||!Ne)return;const Be={active:he,activatorEvent:Ne,collisions:Ve,delta:{x:He.x,y:He.y},over:Fe};Jt.unstable_batchedUpdates(()=>{Ee?.(Be),O({type:"onDragMove",event:Be})})},[He.x,He.y]),k.useEffect(()=>{const{active:Ee,activatorEvent:he,collisions:Ne,droppableContainers:Ve,scrollAdjustedTranslate:Fe}=me.current;if(!Ee||L.current==null||!he||!Fe)return;const{onDragOver:Be}=F.current,Ze=Ve.get(Oe),qt=Ze&&Ze.rect.current?{id:Ze.id,rect:Ze.rect.current,data:Ze.data,disabled:Ze.disabled}:null,qe={active:Ee,activatorEvent:he,collisions:Ne,delta:{x:Fe.x,y:Fe.y},over:qt};Jt.unstable_batchedUpdates(()=>{se(qt),Be?.(qe),O({type:"onDragOver",event:qe})})},[Oe]),Yt(()=>{me.current={activatorEvent:b,active:D,activeNode:q,collisionRect:Pe,collisions:Ke,droppableRects:V,draggableNodes:C,draggingNode:ye,draggingNodeRect:Me,droppableContainers:N,over:X,scrollableAncestors:Le,scrollAdjustedTranslate:He},P.current={initial:Me,translated:Pe}},[D,q,Ke,Pe,C,ye,Me,V,N,X,Le,He]),Rg({...te,delta:v,draggingRect:Pe,pointerCoordinates:oe,scrollableAncestors:Le,scrollableAncestorRects:K});const _e=k.useMemo(()=>({active:D,activeNode:q,activeNodeRect:R,activatorEvent:b,collisions:Ke,containerNodeRect:ke,dragOverlay:De,draggableNodes:C,droppableContainers:N,droppableRects:V,over:X,measureDroppableContainers:j,scrollableAncestors:Le,scrollableAncestorRects:K,measuringConfiguration:B,measuringScheduled:H,windowRect:$e}),[D,q,R,b,Ke,ke,De,C,N,V,X,j,Le,K,B,H,$e]),Ue=k.useMemo(()=>({activatorEvent:b,activators:Se,active:D,activeNodeRect:R,ariaDescribedById:{draggable:G},dispatch:x,draggableNodes:C,over:X,measureDroppableContainers:j}),[b,Se,D,R,x,G,C,X,j]);return k.createElement(ni.Provider,{value:y},k.createElement(Kn.Provider,{value:Ue},k.createElement(Ai.Provider,{value:_e},k.createElement(Mi.Provider,{value:le},h)),k.createElement(kh,{disabled:l?.restoreFocus===!1})),k.createElement(Cg,{...l,hiddenTextDescribedById:G}));function je(){const Ee=U?.autoScrollEnabled===!1,he=typeof f=="object"?f.enabled===!1:f===!1,Ne=_&&!Ee&&!he;return typeof f=="object"?{...f,enabled:Ne}:{enabled:Ne}}}),Th=k.createContext(null),Oi="button",Nh="Draggable";function Ah(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=en(Nh),{activators:s,activatorEvent:l,active:f,activeNodeRect:h,ariaDescribedById:d,draggableNodes:i,over:u}=k.useContext(Kn),{role:g=Oi,roleDescription:p="draggable",tabIndex:m=0}=o??{},w=f?.id===t,x=k.useContext(w?Mi:Th),[O,y]=zn(),[E,M]=zn(),_=fh(s,t),I=Jr(r);Yt(()=>(i.set(t,{id:t,key:a,node:O,activatorNode:E,data:I}),()=>{const v=i.get(t);v&&v.key===a&&i.delete(t)}),[i,t]);const C=k.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":w&&g===Oi?!0:void 0,"aria-roledescription":p,"aria-describedby":d.draggable}),[n,g,m,w,p,d.draggable]);return{active:f,activatorEvent:l,activeNodeRect:h,attributes:C,isDragging:w,listeners:n?void 0:_,node:O,over:u,setNodeRef:y,setActivatorNodeRef:M,transform:x}}function Mh(){return k.useContext(Ai)}const Oh="Droppable",Ih={timeout:25};function Dh(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=en(Oh),{active:s,dispatch:l,over:f,measureDroppableContainers:h}=k.useContext(Kn),d=k.useRef({disabled:r}),i=k.useRef(!1),u=k.useRef(null),g=k.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:w}={...Ih,...o},x=Jr(m??n),O=k.useCallback(()=>{if(!i.current){i.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{h(Array.isArray(x.current)?x.current:[x.current]),g.current=null},w)},[w]),y=Bn({callback:O,disabled:p||!s}),E=k.useCallback((C,v)=>{y&&(v&&(y.unobserve(v),i.current=!1),C&&y.observe(C))},[y]),[M,_]=zn(E),I=Jr(t);return k.useEffect(()=>{!y||!M.current||(y.disconnect(),i.current=!1,y.observe(M.current))},[M,y]),k.useEffect(()=>(l({type:et.RegisterDroppable,element:{id:n,key:a,disabled:r,node:M,rect:u,data:I}}),()=>l({type:et.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==d.current.disabled&&(l({type:et.SetDroppableDisabled,id:n,key:a,disabled:r}),d.current.disabled=r)},[n,a,r,l]),{active:s,rect:u,isOver:f?.id===n,node:M,over:f,setNodeRef:_}}function ka(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Lh(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function Vn(e){return e!==null&&e>=0}function Ph(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Fh(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Yn=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=ka(t,n,r),s=t[o],l=a[o];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},Ii="Sortable",Di=k.createContext({activeIndex:-1,containerId:Ii,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Yn,disabled:{draggable:!1,droppable:!1}});function Li(e){let{children:t,id:r,items:n,strategy:o=Yn,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:f,over:h,measureDroppableContainers:d}=Mh(),i=en(Ii,r),u=l.rect!==null,g=k.useMemo(()=>n.map(_=>typeof _=="object"&&"id"in _?_.id:_),[n]),p=s!=null,m=s?g.indexOf(s.id):-1,w=h?g.indexOf(h.id):-1,x=k.useRef(g),O=!Ph(g,x.current),y=w!==-1&&m===-1||O,E=Fh(a);Yt(()=>{O&&p&&d(g)},[O,g,p,d]),k.useEffect(()=>{x.current=g},[g]);const M=k.useMemo(()=>({activeIndex:m,containerId:i,disabled:E,disableTransforms:y,items:g,overIndex:w,useDragOverlay:u,sortedRects:Lh(g,f),strategy:o}),[m,i,E.draggable,E.droppable,y,g,w,f,u,o]);return k.createElement(Di.Provider,{value:M},t)}const Pi=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return ka(r,n,o).indexOf(t)},Fi=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:l,previousContainerId:f,transition:h}=e;return!h||!n||l!==a&&o===s?!1:r?!0:s!==o&&t===f},$h={duration:200,easing:"ease"},$i="transform",Uh=rn.Transition.toString({property:$i,duration:0,easing:"linear"}),zh={roleDescription:"sortable"};function Hh(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=k.useState(null),l=k.useRef(r);return Yt(()=>{if(!t&&r!==l.current&&n.current){const f=o.current;if(f){const h=Ir(n.current,{ignoreTransform:!0}),d={x:f.left-h.left,y:f.top-h.top,scaleX:f.width/h.width,scaleY:f.height/h.height};(d.x||d.y)&&s(d)}}r!==l.current&&(l.current=r)},[t,r,n,o]),k.useEffect(()=>{a&&s(null)},[a]),a}function Ui(e){let{animateLayoutChanges:t=Fi,attributes:r,disabled:n,data:o,getNewIndex:a=Pi,id:s,strategy:l,resizeObserverConfig:f,transition:h=$h}=e;const{items:d,containerId:i,activeIndex:u,disabled:g,disableTransforms:p,sortedRects:m,overIndex:w,useDragOverlay:x,strategy:O}=k.useContext(Di),y=Gh(n,g),E=d.indexOf(s),M=k.useMemo(()=>({sortable:{containerId:i,index:E,items:d},...o}),[i,o,E,d]),_=k.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:I,node:C,isOver:v,setNodeRef:N}=Dh({id:s,data:M,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...f}}),{active:A,activatorEvent:P,activeNodeRect:D,attributes:L,setNodeRef:U,listeners:S,isDragging:b,over:$,setActivatorNodeRef:F,transform:G}=Ah({id:s,data:M,attributes:{...zh,...r},disabled:y.draggable}),Y=dg(N,U),B=!!A,V=B&&!p&&Vn(u)&&Vn(w),j=!x&&b,H=j&&V?G:null,ue=V?H??(l??O)({rects:m,activeNodeRect:D,activeIndex:u,overIndex:w,index:E}):null,te=Vn(u)&&Vn(w)?a({id:s,items:d,activeIndex:u,overIndex:w}):E,fe=A?.id,R=k.useRef({activeId:fe,items:d,newIndex:te,containerId:i}),ke=d!==R.current.items,me=t({active:A,containerId:i,isDragging:b,isSorting:B,id:s,index:E,items:d,newIndex:R.current.newIndex,previousItems:R.current.items,previousContainerId:R.current.containerId,transition:h,wasDragging:R.current.activeId!=null}),Ge=Hh({disabled:!me,index:E,node:C,rect:I});return k.useEffect(()=>{B&&R.current.newIndex!==te&&(R.current.newIndex=te),i!==R.current.containerId&&(R.current.containerId=i),d!==R.current.items&&(R.current.items=d)},[B,te,i,d]),k.useEffect(()=>{if(fe===R.current.activeId)return;if(fe!=null&&R.current.activeId==null){R.current.activeId=fe;return}const ye=setTimeout(()=>{R.current.activeId=fe},50);return()=>clearTimeout(ye)},[fe]),{active:A,activeIndex:u,attributes:L,data:M,rect:I,index:E,newIndex:te,items:d,isOver:v,isSorting:B,isDragging:b,listeners:S,node:C,overIndex:w,over:$,setNodeRef:Y,setActivatorNodeRef:F,setDroppableNodeRef:N,setDraggableNodeRef:U,transform:Ge??ue,transition:De()};function De(){if(Ge||ke&&R.current.newIndex===E)return Uh;if(!(j&&!da(P)||!h)&&(B||me))return rn.Transition.toString({...h,property:$i})}}function Gh(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function ln(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const jh=[ze.Down,ze.Right,ze.Up,ze.Left],zi=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(jh.includes(e.code)){if(e.preventDefault(),!r||!n)return;const f=[];a.getEnabled().forEach(i=>{if(!i||i!=null&&i.disabled)return;const u=o.get(i.id);if(u)switch(e.code){case ze.Down:n.top<u.top&&f.push(i);break;case ze.Up:n.top>u.top&&f.push(i);break;case ze.Left:n.left>u.left&&f.push(i);break;case ze.Right:n.left<u.left&&f.push(i);break}});const h=Tg({collisionRect:n,droppableRects:o,droppableContainers:f});let d=ii(h,"id");if(d===s?.id&&h.length>1&&(d=h[1].id),d!=null){const i=a.get(r.id),u=a.get(d),g=u?o.get(u.id):null,p=u?.node.current;if(p&&g&&i&&u){const w=Gn(p).some((_,I)=>l[I]!==_),x=Hi(i,u),O=Bh(i,u),y=w||!x?{x:0,y:0}:{x:O?n.width-g.width:0,y:O?n.height-g.height:0},E={x:g.left,y:g.top};return y.x&&y.y?E:tn(E,y)}}}};function Hi(e,t){return!ln(e)||!ln(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Bh(e,t){return!ln(e)||!ln(t)||!Hi(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Wh=Object.freeze(Object.defineProperty({__proto__:null,SortableContext:Li,arrayMove:ka,defaultAnimateLayoutChanges:Fi,defaultNewIndexGetter:Pi,hasSortableData:ln,rectSortingStrategy:Yn,sortableKeyboardCoordinates:zi,useSortable:Ui},Symbol.toStringTag,{value:"Module"})),Kh=window.G7Core,Gi=({file:e,onRemove:t,onRetry:r,onImageClick:n,onDownload:o,isPrimary:a,onPrimaryClick:s})=>{const{attributes:l,listeners:f,setNodeRef:h,transform:d,transition:i,isDragging:u}=Ui({id:"hash"in e?e.hash:e.id}),g={transform:rn.Transform.toString(d),transition:i,opacity:u?.5:1},p="status"in e&&e.status!==void 0,m=p?e.status:"done",w=m==="uploading",x=m==="compressing",O=m==="error",y=p?e.progress:100,E=p?e.preview:void 0,M=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[_,I]=k.useState(void 0),C=!p&&M?e.download_url:void 0;k.useEffect(()=>{if(!C){I(void 0);return}let N=!0,A;return(async()=>{try{const D=await Kh.api.get(C,{responseType:"blob"});N&&D&&(A=URL.createObjectURL(D),I(A))}catch(D){console.error("Failed to load authenticated image:",D)}})(),()=>{N=!1,A&&URL.revokeObjectURL(A)}},[C]);const v=_;return c.jsxs(W,{ref:h,style:g,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[c.jsxs(W,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${M||!p?"cursor-pointer":""}`,onClick:()=>{w||x||(M&&n?n():!p&&o&&o())},children:[E||v?c.jsx(Lt,{src:E||v,alt:e.original_filename,className:"w-full h-full object-cover"}):c.jsx(Ct,{className:`fa-solid ${Ql(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(w||x)&&c.jsxs(W,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[c.jsx(W,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:c.jsx(W,{className:"h-full bg-blue-500 transition-all",style:{width:`${y}%`}})}),c.jsxs(ee,{className:"text-white text-xs mt-1",children:[y,"%"]})]}),O&&c.jsx(W,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:c.jsx(Ct,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),s&&c.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),s()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${a?"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:Re(a?"attachment.primary_image":"attachment.set_as_primary"),children:c.jsx(Ct,{className:"fa-solid fa-star text-xs"})}),c.jsxs(W,{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",children:[c.jsx(Q,{type:"button",...l,...f,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:Re("attachment.drag_to_reorder"),onClick:N=>N.stopPropagation(),children:c.jsx(Ct,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&o&&c.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),o()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:Re("common.download"),children:c.jsx(Ct,{className:"fa-solid fa-download text-sm"})}),O&&r&&c.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),r()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:Re("common.retry"),children:c.jsx(Ct,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),c.jsx(Q,{type:"button",onClick:N=>{N.stopPropagation(),t()},disabled:w||x,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:Re("common.delete"),children:c.jsx(Ct,{className:"fa-solid fa-times text-sm"})})]})]}),c.jsxs(W,{className:`p-2 ${!p&&o?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&o&&o()},children:[c.jsx(Dt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),c.jsx(Dt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},ji=({allItems:e,canAddMore:t,totalCount:r,maxFiles:n,maxSize:o,accept:a,onRemove:s,onRetry:l,onImageClick:f,onDownload:h,onDragEnd:d,onAddClick:i,enablePrimarySelection:u,primaryFileId:g,onPrimaryChange:p})=>{const m=Sg(oi(ya,{activationConstraint:{distance:8}}),oi(ma,{coordinateGetter:zi}));return c.jsxs(W,{className:"p-3",children:[c.jsx(Eh,{sensors:m,collisionDetection:Eg,onDragEnd:d,children:c.jsx(Li,{items:e.map(w=>"hash"in w?w.hash:w.id),strategy:Yn,children:c.jsxs(W,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[e.map(w=>{const x="hash"in w,O=x?w.is_image:w.mime_type?.startsWith("image/")??!1;return c.jsx(Gi,{file:w,onRemove:()=>s(w),onRetry:"status"in w&&w.status==="error"?()=>l(w):void 0,onImageClick:O?()=>f(w):void 0,onDownload:x?()=>h(w):void 0,isPrimary:u&&x&&(w.hash||w.id)===g,onPrimaryClick:u&&x?()=>p?.(w.hash||w.id):void 0},x?w.hash:w.id)}),t&&c.jsxs(W,{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:i,children:[c.jsx(Ct,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),c.jsx(ee,{className:"text-xs text-gray-500 dark:text-gray-400",children:Re("common.add")})]})]})})}),c.jsxs(W,{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:[c.jsx(ee,{children:Re("attachment.attached_count",{count:r,max:n})}),c.jsxs(ee,{children:[Re("attachment.max_size",{size:o}),a&&` (${a})`]})]})]})},Vh=[],Yh=[],Xn=k.forwardRef(({uploadTriggerEvent:e,attachmentableType:t,attachmentableId:r,collection:n="default",maxFiles:o=10,maxSize:a=10,maxConcurrentUploads:s=3,accept:l,imageCompression:f,roleIds:h=Yh,autoUpload:d=!0,onFilesChange:i,onChange:u,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:w,initialFiles:x=Vh,className:O="",confirmBeforeRemove:y=!1,confirmRemoveTitle:E,confirmRemoveMessage:M,apiEndpoints:_,uploadParams:I,enablePrimarySelection:C=!1,primaryFileId:v,onPrimaryChange:N,id:A,editorAttrs:P},D)=>{const L={upload:_?.upload??"/api/attachments",delete:_?.delete??"/api/attachments/:id",reorder:_?.reorder??"/api/attachments/reorder"},U=k.useRef(u??i);U.current=u??i;const S=k.useCallback(G=>{const Y=U.current;if(!Y)return;Y({target:{value:G,files:G},preventDefault:()=>{},stopPropagation:()=>{}})},[]),b=Jl({attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:d,initialFiles:x,endpoints:L,onFilesChange:S,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:w,uploadTriggerEvent:e,confirmBeforeRemove:y,uploadParams:I});k.useImperativeHandle(D,()=>({uploadAll:b.handleUploadAll,clear:b.clear,getPendingFiles:b.getPendingFiles}));const $=k.useMemo(()=>b.imageFiles.map(G=>{const Y=!("hash"in G),B=G,V=G;return Y?{src:B.preview||"",filename:B.original_filename,title:B.original_filename,downloadRequiresAuth:!1}:{src:b.authenticatedImageUrls.get(V.id)||V.download_url,downloadUrl:V.download_url,filename:V.original_filename,title:V.original_filename,downloadRequiresAuth:!0}}),[b.imageFiles,b.authenticatedImageUrls]),F=k.useMemo(()=>({existingFiles:b.existingFiles,pendingFiles:b.pendingFiles,isDragOver:b.isDragOver,isDeleting:b.isDeleting,maxFiles:o,maxSize:a,accept:l,endpoints:L,confirmBeforeRemove:y,totalCount:b.totalCount,hasFiles:b.hasFiles,canAddMore:b.canAddMore,allItems:b.allItems,imageFiles:b.imageFiles,handleFiles:b.handleFiles,handleRemove:b.handleRemove,handleRetry:b.handleRetry,handleUploadAll:b.handleUploadAll,handleOpenGallery:b.handleOpenGallery,handleDownload:b.handleDownload,handleDragEnd:b.handleDragEnd,setIsDragOver:b.setIsDragOver,inputRef:b.inputRef,galleryOpen:b.galleryOpen,setGalleryOpen:b.setGalleryOpen,galleryStartIndex:b.galleryStartIndex,galleryKeyRef:b.galleryKeyRef,confirmDialogOpen:b.confirmDialogOpen,setConfirmDialogOpen:b.setConfirmDialogOpen,itemToDelete:b.itemToDelete,executeRemoveAttachment:b.executeRemoveAttachment,authenticatedImageUrls:b.authenticatedImageUrls}),[b,o,a,l,L,y]);return c.jsx($l,{value:F,children:c.jsxs(W,{id:A,className:O,...P,children:[c.jsx(Rl,{isDragOver:b.isDragOver,canAddMore:b.canAddMore,onFiles:b.handleFiles,setIsDragOver:b.setIsDragOver,inputRef:b.inputRef,accept:l,maxFiles:o,maxSize:a,children:b.hasFiles&&c.jsx(ji,{allItems:b.allItems,canAddMore:b.canAddMore,totalCount:b.totalCount,maxFiles:o,maxSize:a,accept:l,onRemove:b.handleRemove,onRetry:b.handleRetry,onImageClick:b.handleOpenGallery,onDownload:b.handleDownload,onDragEnd:b.handleDragEnd,onAddClick:()=>b.inputRef.current?.click(),enablePrimarySelection:C,primaryFileId:v,onPrimaryChange:N})}),y&&c.jsx(ta,{isOpen:b.confirmDialogOpen,onClose:()=>{b.isDeleting||b.setConfirmDialogOpen(!1)},title:E??Re("attachment.delete_confirm_title"),message:M??Re("attachment.delete_confirm_message"),confirmText:Re("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{b.itemToDelete&&b.executeRemoveAttachment(b.itemToDelete)},isLoading:b.isDeleting,loadingText:Re("attachment.deleting")}),$.length>0&&b.galleryOpen&&c.jsx(Tr,{images:$,isOpen:!0,onClose:()=>b.setGalleryOpen(!1),startIndex:b.galleryStartIndex,showDownload:!0},`gallery-${b.galleryKeyRef.current}`)]})})});Xn.displayName="FileUploader";const Xh=Object.freeze(Object.defineProperty({__proto__:null,FileDropZone:Rl,FileList:ji,FileUploader:Xn,FileUploaderProvider:$l,SortableThumbnailItem:Gi,default:Xn,extractErrorMessage:Zl,fileUploaderT:Re,formatFileSize:$n,getFileIcon:Ql,useFileUploader:Jl,useFileUploaderContext:eg},Symbol.toStringTag,{value:"Module"})),Bi=({provider:e,className:t="w-5 h-5"})=>{switch(e){case"google":return c.jsxs("svg",{className:t,viewBox:"0 0 24 24",children:[c.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),c.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),c.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),c.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]});case"naver":return c.jsx("svg",{className:t,viewBox:"0 0 24 24",children:c.jsx("path",{fill:"currentColor",d:"M16.273 12.845L7.376 0H0v24h7.727V11.155L16.624 24H24V0h-7.727z"})});case"kakao":return c.jsx("svg",{className:t,viewBox:"0 0 24 24",children:c.jsx("path",{fill:"currentColor",d:"M12 3c5.799 0 10.5 3.664 10.5 8.185 0 4.52-4.701 8.184-10.5 8.184a13.5 13.5 0 0 1-1.727-.11l-4.408 2.883c-.501.265-.678.236-.472-.413l.892-3.678c-2.88-1.46-4.785-3.99-4.785-6.866C1.5 6.665 6.201 3 12 3zm5.519 8.625h-.634v2.916h-.97v-2.916h-.633v-.848h2.237v.848zm-3.294 2.916h-.97V10.77h.97v3.771zm-1.97 0h-.97v-2.77l-.658 1.53h-.629l-.665-1.53v2.77h-.97V10.77h1.13l.822 1.912.814-1.912h1.126v3.771zm-4.49 0h-.97V10.77h.97v3.771z"})});case"facebook":return c.jsx("svg",{className:t,viewBox:"0 0 24 24",children:c.jsx("path",{fill:"currentColor",d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})});case"apple":return c.jsx("svg",{className:t,viewBox:"0 0 24 24",children:c.jsx("path",{fill:"currentColor",d:"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"})});default:return null}},Wi=(e,t)=>window.G7Core?.t?.(e,t)??e,qh=[{id:"google",name:"Google",color:"bg-white dark:bg-gray-800",textColor:"text-gray-700 dark:text-gray-300"},{id:"naver",name:"네이버",color:"bg-[#03C75A]",textColor:"text-white"},{id:"kakao",name:"카카오",color:"bg-[#FEE500]",textColor:"text-[#000000]/85"},{id:"facebook",name:"Facebook",color:"bg-[#1877F2]",textColor:"text-white"},{id:"apple",name:"Apple",color:"bg-black dark:bg-white",textColor:"text-white dark:text-black"}],Ki=({providers:e=["google","naver","kakao"],mode:t="login",variant:r="full",className:n="",id:o,editorAttrs:a})=>{const s=h=>{const d=encodeURIComponent(window.location.href);window.location.href=`/api/auth/${h}?redirect=${d}`},l=h=>t==="register"?Wi("auth.social.register_with",{provider:h}):Wi("auth.social.login_with",{provider:h}),f=qh.filter(h=>e.includes(h.id));return r==="icon"?c.jsx(W,{className:`flex justify-center gap-4 ${n}`,id:o,...a,children:f.map(h=>c.jsx(Q,{onClick:()=>s(h.id),className:`w-12 h-12 flex items-center justify-center rounded-full ${h.color} ${h.textColor} border border-gray-200 dark:border-gray-700 hover:opacity-90 transition-opacity`,"aria-label":l(h.name),children:c.jsx(Bi,{provider:h.id,className:"w-5 h-5"})},h.id))}):c.jsx(W,{className:`space-y-3 ${n}`,id:o,...a,children:f.map(h=>c.jsxs(Q,{onClick:()=>s(h.id),className:`w-full flex items-center justify-center gap-3 px-4 py-3 rounded-lg font-medium border border-gray-200 dark:border-gray-700 ${h.color} ${h.textColor} hover:opacity-90 transition-opacity`,children:[c.jsx(Bi,{provider:h.id,className:"w-5 h-5"}),c.jsx(ee,{children:l(h.name)})]},h.id))})},Zh=Object.freeze(Object.defineProperty({__proto__:null,default:Ki},Symbol.toStringTag,{value:"Module"})),Qh=(e,t)=>window.G7Core?.t?.(e,t)??e,Jh={success:Je.CheckCircle,error:Je.XCircle,warning:Je.ExclamationTriangle,info:Je.InfoCircle},Vi={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"}},Rh={"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"},Ca=({toasts:e,position:t="bottom-center",duration:r=3e3,onRemove:n})=>{const[o,a]=k.useState(new Map),s=k.useCallback(l=>{a(f=>{const h=new Map(f);return h.set(l,!1),h}),setTimeout(()=>{if(n)n(l);else{const f=window.G7Core;f?.state?.update&&f.state.update(h=>({toasts:(Array.isArray(h.toasts)?h.toasts:[]).filter(i=>i.id!==l)}))}},300)},[n]);return k.useEffect(()=>{!e||e.length===0||e.forEach(l=>{if(o.has(l.id))return;a(h=>{const d=new Map(h);return d.set(l.id,!0),d});const f=l.duration||r;f>0&&setTimeout(()=>{s(l.id)},f)})},[e,r,s,o]),!e||e.length===0?null:c.jsx(W,{className:`fixed z-[9999] flex flex-col gap-2 ${Rh[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(l=>c.jsx(e0,{toast:l,position:t,isVisible:o.get(l.id)??!0,onClose:()=>s(l.id)},l.id))})},e0=({toast:e,position:t,isVisible:r,onClose:n})=>{const o=Vi[e.type]||Vi.info,a=e.icon?e.icon:Jh[e.type],s=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return c.jsxs(W,{className:`
|
||
flex items-center gap-3 p-4 rounded-lg border shadow-lg
|
||
min-w-[300px] max-w-md
|
||
transition-all duration-300
|
||
${o.bg}
|
||
${r?"opacity-100 translate-y-0":`opacity-0 ${s}`}
|
||
`,role:"alert",children:[c.jsx(de,{name:a,className:`w-5 h-5 flex-shrink-0 ${o.text}`}),c.jsx(ee,{className:`flex-1 text-sm font-medium ${o.text}`,children:e.message}),c.jsx(Q,{onClick:n,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${o.text} focus:outline-none`,"aria-label":Qh("common.close"),children:c.jsx(de,{name:Je.Times,className:"w-4 h-4"})})]})},t0=Object.freeze(Object.defineProperty({__proto__:null,Toast:Ca,default:Ca},Symbol.toStringTag,{value:"Module"})),r0=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},Sa=({className:e="",style:t})=>{const[r,n]=k.useState(!1);return k.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){r0.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{n(s)})},[]),r?c.jsxs(W,{className:`fixed top-0 left-0 right-0 z-50 ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[c.jsx(W,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:c.jsx(W,{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"}})}),c.jsx("style",{children:`
|
||
@keyframes loading {
|
||
0% {
|
||
transform: translateX(-100%);
|
||
}
|
||
50% {
|
||
transform: translateX(300%);
|
||
}
|
||
100% {
|
||
transform: translateX(-100%);
|
||
}
|
||
}
|
||
`})]}):null},n0=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:Sa,default:Sa},Symbol.toStringTag,{value:"Module"})),Yi=window.G7Core?.createLogger?.("Comp:PageTransitionBlur")??{log:(...e)=>console.log("[Comp:PageTransitionBlur]",...e),warn:(...e)=>console.warn("[Comp:PageTransitionBlur]",...e)},_a=({className:e="",style:t})=>{const[r,n]=k.useState(!1);return k.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){Yi.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{Yi.log("isPending changed:",s),n(s)})},[]),r?c.jsx(W,{className:`fixed inset-0 z-40 bg-white/30 dark:bg-gray-900/30 backdrop-blur-sm transition-opacity duration-150 pointer-events-none ${e}`,style:t,role:"status","aria-label":"페이지 전환 중","data-testid":"page-transition-blur"}):null},o0=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:_a,default:_a},Symbol.toStringTag,{value:"Module"})),Xi={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},qi=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),a0=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),s0=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),l0=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),i0=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),Zi={DataGrid:(e,t)=>c.jsxs("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[c.jsx("div",{className:`h-10 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${e}`,children:c.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[c.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"}),c.jsx("div",{className:"h-3 w-24 bg-gray-300 dark:bg-gray-600 rounded"}),c.jsx("div",{className:"h-3 w-20 bg-gray-300 dark:bg-gray-600 rounded"}),c.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"})]})}),Array.from({length:t},(r,n)=>c.jsx("div",{className:`h-12 border-b border-gray-100 dark:border-gray-800 ${e}`,style:{animationDelay:`${n*75}ms`},children:c.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[c.jsx("div",{className:"h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded"}),c.jsx("div",{className:"h-3 flex-1 bg-gray-200 dark:bg-gray-700 rounded"}),c.jsx("div",{className:"h-3 w-16 bg-gray-100 dark:bg-gray-800 rounded"}),c.jsx("div",{className:"h-3 w-14 bg-gray-100 dark:bg-gray-800 rounded"})]})},n))]}),Pagination:e=>c.jsx("div",{className:"flex justify-center gap-1.5 py-3",children:Array.from({length:5},(t,r)=>c.jsx("div",{className:`w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),Tabs:e=>c.jsxs("div",{children:[c.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2 mb-3",children:Array.from({length:3},(t,r)=>c.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),c.jsx("div",{className:`h-32 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]}),TabNavigation:e=>c.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2",children:Array.from({length:3},(t,r)=>c.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),ProductCard:e=>c.jsxs("div",{className:"rounded-lg overflow-hidden",children:[c.jsx("div",{className:`h-48 w-full bg-gray-200 dark:bg-gray-700 ${e}`}),c.jsxs("div",{className:"p-3 space-y-2",children:[c.jsx("div",{className:`h-3.5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),c.jsx("div",{className:`h-4 w-1/3 bg-gray-300 dark:bg-gray-600 rounded ${e}`})]})]}),UserInfo:e=>c.jsx("div",{className:`h-3 w-14 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),QuantitySelector:e=>c.jsx("div",{className:`h-9 w-28 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 ${e}`}),Header:e=>c.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:c.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"flex items-center justify-between h-16",children:[c.jsxs("div",{className:"flex items-center gap-8",children:[c.jsx("div",{className:`h-8 w-24 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),c.jsx("div",{className:"hidden lg:flex items-center gap-6",children:Array.from({length:4},(t,r)=>c.jsx("div",{className:`h-3.5 w-16 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))})]}),c.jsx("div",{className:"flex items-center gap-4",children:Array.from({length:3},(t,r)=>c.jsx("div",{className:`h-8 w-8 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))})]})})}),Footer:e=>c.jsx("footer",{className:"bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 mt-auto",children:c.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:c.jsxs("div",{className:"flex flex-col items-center gap-4",children:[c.jsx("div",{className:`h-4 w-32 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),c.jsx("div",{className:`h-3 w-48 bg-gray-100 dark:bg-gray-800 rounded ${e}`}),c.jsx("div",{className:"flex gap-3",children:Array.from({length:3},(t,r)=>c.jsx("div",{className:`h-6 w-6 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))}),c.jsx("div",{className:`h-3 w-40 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]})})}),Modal:()=>c.jsx(c.Fragment,{}),Toast:()=>c.jsx(c.Fragment,{}),ConfirmDialog:()=>c.jsx(c.Fragment,{})};function c0(e){if(!e||e.length===0)return[];const t=e.filter(n=>n.if),r=e.filter(n=>!n.if);if(r.length>0&&t.length>0){const n=t.filter(o=>!Qi(o.if));return n.length>1&&d0(n)?[...r,Ji(n)]:[...r,...n]}if(t.length>1&&r.length===0){const n=t.filter(o=>!Qi(o.if));return n.length===0?[]:n.length===1?n:[Ji(n)]}return e}function Qi(e){const t=e.replace(/^\{\{|\}\}$/g,"").trim();return t.startsWith("!")||/\b(hasError|isError|isLoading|error|Error)\b/.test(t)||/===\s*0\s*(\)|\}|$)/.test(t)}function d0(e){if(e.length<2)return!1;const t=[];for(const n of e){const o=(n.if||"").replace(/^\{\{|\}\}$/g,"").trim(),a=o.match(/^(.+?)\s*===\s*['"]/);if(a)t.push(a[1].trim());else{const s=o.match(/(.+?)\s*===\s*['"]/);if(!s)return!1;t.push(s[1].trim())}}const r=t[0];return t.every(n=>n===r)}function Ji(e){return e.reduce((t,r)=>Ea(r)>Ea(t)?r:t)}function Ea(e){return e.children?e.children.length+e.children.reduce((t,r)=>t+Ea(r),0):0}function u0(e){return e.includes("{{")?e.replace(/\{\{([^}]+)\}\}/g,(t,r)=>{const n=r.match(/\?[\s]*['"]([^'"]*)['"]\s*:\s*['"]/);return n?n[1]:""}):e}function Ta(e,t){if(!e)return"";let r=e;return r=r.replace(/\b(bg-\S+|text-\S+|border\b|border-\S+|shadow\S*|ring-\S+|outline-\S+|divide-\S+|opacity-\S+|font-\S+|tracking-\S+|leading-\S+|whitespace-\S+|truncate|line-clamp-\S+|underline|no-underline|decoration-\S+|cursor-\S+|hover:\S+|focus:\S+|active:\S+|group-hover:\S+|transition\S*|duration-\S+|ease-\S+|animate-\S+|dark:\S+)\b/g,"").replace(/\s{2,}/g," ").trim(),(t==="Grid"||/\bgrid-cols-\d/.test(r))&&(r=r.replace(/\bgrid-cols-(\d+)/g,(n,o)=>{const a=parseInt(o);return a>4?`grid-cols-${Math.ceil(a/2)}`:`grid-cols-${a}`})),r}function f0(e){const{name:t,props:r}=e;if(!r||!t)return"";const n=[];if(t==="Flex"){n.push("flex");const o=r.direction||"row",a={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};a[o]&&n.push(a[o]);const s=r.justify||"start",l={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};l[s]&&n.push(l[s]);const f=r.align||"stretch",h={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};h[f]&&n.push(h[f]);const d=r.wrap||"nowrap",i={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};i[d]&&n.push(i[d]),r.gap&&r.gap>0&&n.push(`gap-${r.gap}`)}if(t==="Grid"){n.push("grid");const o=r.cols||1;if(n.push(`grid-cols-${o}`),r.responsive){const a=r.responsive;a.sm&&n.push(`sm:grid-cols-${a.sm}`),a.md&&n.push(`md:grid-cols-${a.md}`),a.lg&&n.push(`lg:grid-cols-${a.lg}`),a.xl&&n.push(`xl:grid-cols-${a.xl}`),a["2xl"]&&n.push(`2xl:grid-cols-${a["2xl"]}`)}r.gap!==void 0&&r.gap>0&&n.push(`gap-${r.gap}`),r.rowGap!==void 0&&r.rowGap>0&&n.push(`gap-y-${r.rowGap}`),r.colGap!==void 0&&r.colGap>0&&n.push(`gap-x-${r.colGap}`)}return n.join(" ")}function g0(e){switch(e){case"pulse":return"animate-pulse";case"wave":return"animate-pulse";case"none":return"";default:return"animate-pulse"}}function qn(e,t,r,n){return!e||e.length===0?[]:c0(e).map((a,s)=>Ri(a,t,r,s,n))}function h0(e,t){const r=e.props?.className||e.className||"";return e.responsive?t>=1024&&e.responsive.desktop?.props?.className?e.responsive.desktop.props.className:t>=768&&e.responsive.tablet?.props?.className?e.responsive.tablet.props.className:r:r}function p0(e,t){const r=e.split(/\s+/).filter(Boolean),n=[],o=[];for(const f of r){const h=f.match(/^(sm|md|lg|xl|2xl):(.+)$/);if(h){const[,d,i]=h;if(qi.has(i)){n.push({breakpoint:Xi[d]||0,display:i});continue}(Xi[d]||0)<=t&&o.push(i);continue}if(qi.has(f)){n.push({breakpoint:0,display:f});continue}o.push(f)}if(n.length===0)return{visible:!0,className:e};n.sort((f,h)=>f.breakpoint-h.breakpoint);let a="";for(const f of n)f.breakpoint<=t&&(a=f.display);a||(a=n[0].display);const s=a!=="hidden",l=s?[a,...o].join(" "):"";return{visible:s,className:l}}function m0(e){const t=e.match(/\bgrid-cols-\[([^\]]+)\]/);if(!t)return{className:e};const r=t[1].replace(/_/g," ");return{className:e.replace(/\bgrid-cols-\[([^\]]+)\]/,"").replace(/\s{2,}/g," ").trim(),style:{gridTemplateColumns:r}}}function Ri(e,t,r,n,o){const{name:a,children:s,iteration:l}=e,f=h0(e,o),h=f0(e),d=h?`${h} ${f}`.trim():f,i=u0(d),u=p0(i,o);if(!a||!u.visible)return null;const g=u.className;if(l)return c.jsx(k.Fragment,{children:Array.from({length:r},(m,w)=>Ri({...e,iteration:void 0},t,r,w,o))},n);if(Zi[a])return c.jsx("div",{className:g,children:Zi[a](t,r)},n);if(a0.has(a)){const m=Ta(g,a);if(!s||s.length===0){const E=/\b(h-\S|w-\S)/.test(m)?`${m} bg-gray-200 dark:bg-gray-700 rounded ${t}`:`${m} h-3.5 w-full bg-gray-200 dark:bg-gray-700 rounded ${t}`.trim();return c.jsx("div",{className:E},n)}const w=qn(s,t,r,o);if(!(w.length>0&&w.some(y=>y!==null)))return null;const O=m0(m);return c.jsx("div",{className:O.className,style:O.style,children:w},n)}const p=Ta(g,a);if(s0.has(a)){const m={H1:"h-7",H2:"h-6",H3:"h-5",H4:"h-5",H5:"h-4",H6:"h-4",P:"h-3.5",Span:"h-3",Label:"h-3",A:"h-3.5",Badge:"h-5 w-16"},w={H1:"w-3/5",H2:"w-2/5",H3:"w-1/3",H4:"w-1/3",H5:"w-1/4",H6:"w-1/4",P:"w-full",Span:"w-1/4",Label:"w-1/4",A:"w-1/3",Strong:"w-1/5",Em:"w-1/4",Small:"w-1/5",Badge:"w-16"},x=m[a]||"h-3.5",O=w[a]||"w-full",y=a.startsWith("H")?"mb-2 mt-1":"mb-1.5";return c.jsx("div",{className:`${x} ${O} bg-gray-200 dark:bg-gray-700 rounded ${t} ${y} ${p}`.trim()},n)}if(l0.has(a))return a==="Textarea"?c.jsx("div",{className:`h-20 w-full bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 mb-2 ${t}`},n):a==="Checkbox"||a==="Radio"||a==="Toggle"?c.jsx("div",{className:`h-5 w-5 bg-gray-200 dark:bg-gray-700 rounded mb-1.5 ${t}`},n):c.jsx("div",{className:`h-9 w-full bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 mb-2 ${t}`},n);if(i0.has(a))return a==="Avatar"||a==="AvatarUploader"?c.jsx("div",{className:`h-10 w-10 bg-gray-200 dark:bg-gray-700 rounded-full ${t}`},n):a==="ProductImageViewer"?c.jsx("div",{className:`h-80 w-full bg-gray-200 dark:bg-gray-700 rounded ${t}`},n):c.jsx("div",{className:`h-40 w-full bg-gray-200 dark:bg-gray-700 rounded mb-2 ${t}`},n);if(a==="Button"){if(s&&s.length>0){const m=Ta(g,a),w=qn(s,t,r,o);if(!(w.length>0&&w.some(E=>E!==null)))return null;const y=/\b(border|rounded|px-\d|py-\d)/.test(f)?"border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 rounded-lg":"";return c.jsx("div",{className:`${m} ${y}`.trim(),children:w},n)}return c.jsx("div",{className:`h-9 w-24 bg-gray-200 dark:bg-gray-700 rounded ${t}`},n)}return a==="Icon"?c.jsx("div",{className:`h-5 w-5 bg-gray-200 dark:bg-gray-700 rounded ${t}`},n):s&&s.length>0?c.jsx("div",{className:p,children:qn(s,t,r,o)},n):c.jsx("div",{className:`h-3.5 w-full bg-gray-200 dark:bg-gray-700 rounded mb-1.5 ${t}`},n)}const Na=({components:e,options:t})=>{const r=g0(t.animation),o=window.G7Core?.useResponsive,a=o?.(),s=a?a.width:typeof window<"u"?window.innerWidth:1024;return c.jsx("div",{className:"w-full",role:"status","aria-busy":"true","aria-label":"Loading...",children:qn(e,r,t.iteration_count,s)})},b0=Object.freeze(Object.defineProperty({__proto__:null,PageSkeleton:Na,default:Na},Symbol.toStringTag,{value:"Module"})),y0=(e,t)=>window.G7Core?.t?.(e,t)??e,ec=({options:e})=>{const t=document.documentElement.classList.contains("dark"),r=t?"rgb(17,24,39)":"rgb(249,250,251)",n=t?"#6b7280":"#9ca3af",o=t?"#9ca3af":"#6b7280";return c.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:r,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[c.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${n}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),c.jsx("span",{style:{color:o,fontSize:"14px"},children:e?.text||y0("nav.loading")})]})},v0=Object.freeze(Object.defineProperty({__proto__:null,default:ec},Symbol.toStringTag,{value:"Module"})),Dr=(e,t)=>window.G7Core?.t?.(e,t)??e,tc=({currentPage:e,totalPages:t,onPageChange:r,maxVisiblePages:n=5,showFirstLast:o=!0,className:a="",style:s,prevText:l,nextText:f,id:h,editorAttrs:d})=>{const i=k.useMemo(()=>{const m=[];if(t<=n+2)for(let w=1;w<=t;w++)m.push(w);else{const w=Math.floor(n/2);let x=Math.max(2,e-w),O=Math.min(t-1,e+w);e<=w+1?O=n:e>=t-w&&(x=t-n+1),m.push(1),x>2&&m.push("...");for(let y=x;y<=O;y++)m.push(y);O<t-1&&m.push("..."),t>1&&m.push(t)}return m},[e,t,n]),u=m=>{m<1||m>t||m===e||r(m)},g=()=>{e>1&&r(e-1)},p=()=>{e<t&&r(e+1)};return c.jsxs(W,{className:`flex items-center gap-2 ${a}`,style:s,role:"navigation","aria-label":Dr("common.pagination"),id:h,...d,children:[o&&c.jsx(Q,{onClick:()=>u(1),disabled:e===1,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Dr("common.first_page"),children:"«"}),c.jsx(Q,{onClick:g,disabled:e===1,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Dr("common.prev_page"),children:l||c.jsx(c.Fragment,{children:"‹"})}),c.jsx(W,{className:"flex items-center gap-1",children:i.map((m,w)=>{if(m==="...")return c.jsx(ee,{className:"px-3 py-1 text-sm text-gray-500 dark:text-gray-400",children:"..."},`ellipsis-${w}`);const x=m,O=x===e;return c.jsx(Q,{onClick:()=>u(x),className:`px-3 py-1 text-sm border rounded ${O?"bg-blue-500 dark:bg-blue-600 text-white border-blue-500 dark:border-blue-600":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800"}`,"aria-label":Dr("common.page_n",{n:x}),"aria-current":O?"page":void 0,children:x},x)})}),c.jsx(Q,{onClick:p,disabled:e===t,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Dr("common.next_page"),children:f||c.jsx(c.Fragment,{children:"›"})}),o&&c.jsx(Q,{onClick:()=>u(t),disabled:e===t,className:"px-3 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800","aria-label":Dr("common.last_page"),children:"»"})]})},w0=Object.freeze(Object.defineProperty({__proto__:null,Pagination:tc},Symbol.toStringTag,{value:"Module"})),rc=(e,t)=>window.G7Core?.t?.(e,t)??e,nc=({name:e="search",placeholder:t,value:r,onChange:n,onSubmit:o,showButton:a=!1,suggestions:s=[],onSuggestionClick:l,showSuggestions:f=!1,className:h="",style:d,id:i,editorAttrs:u})=>{const g=t??rc("common.search_placeholder"),[p,m]=k.useState(""),[w,x]=k.useState(!1),O=k.useRef(null),y=k.useRef(""),E=r!==void 0?r:p,M=f&&w&&s.length>0&&E.length>0;k.useEffect(()=>{r!==void 0&&(y.current=r)},[r]);const _=v=>{const N=v.target.value;m(N),n?.(v),y.current!==""&&N===""&&!v.nativeEvent.inputType&&setTimeout(()=>{const A=O.current?.querySelector("form");A&&A.requestSubmit()},0),y.current=N},I=v=>{m(v.text);const N={target:{value:v.text,name:e}};n?.(N),l?.(v),x(!1)},C=v=>{v.preventDefault(),o?.(v)};return c.jsxs(W,{ref:O,className:`relative ${h}`,style:d,id:i,...u,children:[c.jsx(so,{onSubmit:C,className:"relative",children:c.jsxs(W,{className:`relative flex items-center ${a?"gap-2":""}`,children:[c.jsxs(W,{className:"relative flex-1",children:[c.jsx(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:c.jsx(de,{name:Je.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),c.jsx(xt,{type:"search",name:e,value:E,onChange:_,onFocus:()=>x(!0),onBlur:()=>setTimeout(()=>x(!1),200),placeholder:g,className:"w-full 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"})]}),a&&c.jsx(Q,{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:rc("common.search")})]})}),M&&c.jsx(W,{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:s.map(v=>c.jsx(W,{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:()=>I(v),children:c.jsxs(W,{className:"flex items-center gap-2",children:[c.jsx(de,{name:Je.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),c.jsx(ee,{className:"text-sm text-gray-700 dark:text-gray-300",children:v.text})]})},v.id))})]})},x0=Object.freeze(Object.defineProperty({__proto__:null,SearchBar:nc},Symbol.toStringTag,{value:"Module"})),vt=window.G7Core,k0={sm:"md",md:"lg",lg:"xl",xl:"2xl","2xl":"3xl"};function Aa({src:e,fallbackText:t="U",size:r="lg",uploadEndpoint:n="/api/me/avatar",deleteEndpoint:o="/api/me/avatar",onUploadSuccess:a,onUploadError:s,onDeleteSuccess:l,onDeleteError:f,showDeleteButton:h=!0,accept:d="image/*",maxSize:i=5,className:u="",uploadButtonText:g,deleteButtonText:p,readOnly:m=!1,confirmDelete:w=!0,deleteConfirmMessage:x,confirmUpload:O=!0,uploadConfirmMessage:y,uploadSuccessActions:E,uploadErrorActions:M,deleteSuccessActions:_,deleteErrorActions:I,id:C,editorAttrs:v}){const N=k.useRef(null),[A,P]=k.useState(!1),[D,L]=k.useState(!1),[U,S]=k.useState(void 0),[b,$]=k.useState(null),[F,G]=k.useState(!1),[Y,B]=k.useState(!1),[V,j]=k.useState(null),[H,q]=k.useState(null),ue=k.useRef(`avatar-upload-${Math.random().toString(36).slice(2,11)}`).current;k.useEffect(()=>{if(V){const oe=URL.createObjectURL(V);return q(oe),()=>URL.revokeObjectURL(oe)}else q(null)},[V]);const te=k.useCallback(oe=>vt?.t?.(oe)??oe,[]),fe=k.useCallback(()=>{const oe=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return oe?decodeURIComponent(oe[1]):null},[]),R=k.useCallback(()=>vt?.api?.getToken?.()??null,[]),ke=k.useCallback(async oe=>{B(!1),j(null),P(!0),$(null);try{const ae=new FormData;ae.append("avatar",oe);const be=fe(),xe=R(),He=await fetch(n,{method:"POST",headers:{Accept:"application/json",...be&&{"X-XSRF-TOKEN":be},...xe&&{Authorization:`Bearer ${xe}`}},credentials:"include",body:ae});if(!He.ok){const Oe=await He.json().catch(()=>({}));throw new Error(Oe.message||te("attachment.upload_failed"))}const Pe=await He.json(),Ke=Pe.data||Pe;Ke.avatar&&S(Ke.avatar),a?.(Ke),vt?.toast?.success?.(te("mypage.profile.avatar_uploaded")),E?.length?E.forEach(Oe=>vt?.dispatch?.(Oe)):vt?.refetchDataSource?.("user")}catch(ae){const be=ae instanceof Error?ae:new Error(String(ae));$(be.message),s?.(be),vt?.toast?.error?.(be.message),M?.length&&M.forEach(xe=>vt?.dispatch?.(xe))}finally{P(!1),N.current&&(N.current.value="")}},[n,a,s,fe,R,te]),me=k.useCallback(async oe=>{const ae=oe.target.files?.[0];if(!ae)return;$(null);const be=i*1024*1024;if(ae.size>be){const xe=new Error(te("attachment.file_too_large").replace(":max",`${i}MB`));$(xe.message),s?.(xe),vt?.toast?.error?.(xe.message);return}if(d&&!ae.type.match(d.replace("*",".*"))){const xe=new Error(te("attachment.invalid_file_type"));$(xe.message),s?.(xe),vt?.toast?.error?.(xe.message);return}O?(j(ae),B(!0)):ke(ae)},[i,d,s,O,ke,te]),Ge=k.useCallback(async()=>{G(!1),L(!0),$(null);try{const oe=fe(),ae=R(),be=await fetch(o,{method:"DELETE",headers:{Accept:"application/json","Content-Type":"application/json",...oe&&{"X-XSRF-TOKEN":oe},...ae&&{Authorization:`Bearer ${ae}`}},credentials:"include"});if(!be.ok){const xe=await be.json().catch(()=>({}));throw new Error(xe.message||te("attachment.delete_failed"))}S(null),l?.(),vt?.toast?.success?.(te("mypage.profile.avatar_deleted")),_?.length?_.forEach(xe=>vt?.dispatch?.(xe)):vt?.refetchDataSource?.("user")}catch(oe){const ae=oe instanceof Error?oe:new Error(String(oe));$(ae.message),f?.(ae),vt?.toast?.error?.(ae.message),I?.length&&I.forEach(be=>vt?.dispatch?.(be))}finally{L(!1)}},[o,l,f,fe,R,te]),De=k.useCallback(()=>{w?G(!0):Ge()},[w,Ge]),ye=k.useCallback(()=>{G(!1)},[]),Me=k.useCallback(()=>{B(!1),j(null),N.current&&(N.current.value="")},[]),Ce=k.useCallback(()=>{V&&ke(V)},[V,ke]),we=U===void 0?e:U,$e=!!we,Le=k0[r]||"lg",K=F||Y,re=()=>c.jsxs(W,{className:"flex items-center justify-center gap-2",children:[c.jsx(xt,{ref:N,id:ue,type:"file",accept:d,className:"hidden",onChange:me,disabled:A}),!$e&&c.jsxs(yr,{htmlFor:ue,className:`inline-flex items-center gap-2 px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${A?"opacity-50 cursor-not-allowed":""}`,children:[A?c.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):c.jsx(de,{name:"image",size:"sm"}),c.jsx(ee,{children:g||te("mypage.profile.register_avatar")})]}),$e&&c.jsxs(c.Fragment,{children:[c.jsxs(yr,{htmlFor:ue,className:`inline-flex items-center gap-2 px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors cursor-pointer ${A?"opacity-50 cursor-not-allowed":""}`,children:[A?c.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):c.jsx(de,{name:"upload",size:"sm"}),c.jsx(ee,{children:g||te("common.change")})]}),h&&c.jsxs(Q,{type:"button",className:"inline-flex items-center gap-2 px-4 py-2 border border-red-300 dark:border-red-600 text-red-600 dark:text-red-400 rounded-lg text-sm font-medium hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:De,disabled:D,children:[D?c.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):c.jsx(de,{name:"trash-2",size:"sm"}),c.jsx(ee,{children:p||te("common.delete")})]})]})]});return c.jsxs(W,{className:`flex flex-col items-center gap-3 ${u}`,id:C,...v,children:[Y&&H?c.jsxs(W,{className:"relative",children:[c.jsx(Lt,{src:H,alt:"Preview",className:`rounded-full object-cover ${r==="sm"?"w-10 h-10":r==="md"?"w-12 h-12":r==="lg"?"w-16 h-16":r==="xl"?"w-24 h-24":"w-32 h-32"}`}),c.jsx(W,{className:"absolute inset-0 rounded-full bg-blue-500/20 border-2 border-blue-500 border-dashed"})]}):c.jsx(Ur,{avatar:we||void 0,name:t,size:Le}),!m&&c.jsxs(W,{className:"w-[220px] flex flex-col items-center gap-2",children:[Y&&V&&c.jsxs(W,{className:"w-full p-3 bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg",children:[c.jsxs(W,{className:"flex items-center gap-2 mb-2",children:[c.jsx(de,{name:"upload",size:"sm",className:"text-blue-600 dark:text-blue-400 shrink-0"}),c.jsx(ee,{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:y||te("mypage.profile.upload_avatar_confirm")})]}),c.jsxs(W,{className:"text-xs text-blue-600 dark:text-blue-400 truncate mb-3",title:V.name,children:[V.name," (",(V.size/1024/1024).toFixed(2),"MB)"]}),c.jsxs(W,{className:"grid grid-cols-2 gap-2",children:[c.jsxs(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium transition-colors disabled:opacity-50",onClick:Ce,disabled:A,children:[A?c.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):c.jsx(de,{name:"check",size:"sm"}),c.jsx(ee,{children:te("common.confirm")})]}),c.jsx(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:Me,children:c.jsx(ee,{children:te("common.cancel")})})]})]}),F&&c.jsxs(W,{className:"w-full p-3 bg-red-50 dark:bg-red-950/50 border border-red-200 dark:border-red-800 rounded-lg",children:[c.jsxs(W,{className:"flex items-center gap-2 mb-2",children:[c.jsx(de,{name:"alert-triangle",size:"sm",className:"text-red-600 dark:text-red-400 shrink-0"}),c.jsx(ee,{className:"text-sm font-medium text-red-800 dark:text-red-300",children:x||te("mypage.profile.delete_avatar_confirm")})]}),c.jsxs(W,{className:"grid grid-cols-2 gap-2",children:[c.jsxs(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md text-sm font-medium transition-colors disabled:opacity-50",onClick:Ge,disabled:D,children:[D?c.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):c.jsx(de,{name:"trash-2",size:"sm"}),c.jsx(ee,{children:te("common.delete")})]}),c.jsx(Q,{type:"button",className:"inline-flex items-center justify-center gap-1.5 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-md text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:ye,children:c.jsx(ee,{children:te("common.cancel")})})]})]}),!K&&re()]}),b&&!K&&c.jsxs(W,{className:"flex items-center gap-2 text-sm text-red-600 dark:text-red-400",children:[c.jsx(de,{name:"alert-circle",size:"sm"}),c.jsx(ee,{children:b})]})]})}const C0=Object.freeze(Object.defineProperty({__proto__:null,AvatarUploader:Aa,default:Aa},Symbol.toStringTag,{value:"Module"})),oc=()=>window.G7Core,Zn=(e,t)=>window.G7Core?.t?.(e,t)??e,ac={horizontal:"flex items-center gap-1.5",vertical:"flex flex-col items-start"},S0=()=>[{key:"view_profile",label:Zn("userinfo.view_profile"),icon:"user",path:"/users/{{userId}}"},{key:"view_posts",label:Zn("userinfo.view_posts"),icon:"file-lines",path:"/users/{{userId}}/posts"}],Ma=({text:e,title:t})=>e?c.jsx(ee,{className:"text-sm text-gray-500 dark:text-gray-400",title:t,children:e}):null,sc=({author:e,name:t,userId:r,subText:n,subTextTitle:o,isGuest:a=!1,isWithdrawn:s=!1,showDropdown:l=!0,clickable:f=!0,profilePath:h="/users/{userId}",className:d="",layout:i="vertical",text:u,stopPropagation:g=!1,menuItems:p,hideMenuItems:m=[],appendMenuItems:w=[],id:x,editorAttrs:O})=>{const y=r??e?.uuid,E=a||e?.is_guest||!1,M=s||e?.status==="withdrawn",_=M?Zn("userinfo.withdrawn_user"):u??t??e?.name??"",[I,C]=k.useState(!1),[v,N]=k.useState({top:0,left:0}),A=k.useRef(null),P=k.useRef(null),D=k.useRef(null),L=h.replace("{userId}",String(y??"")),U=`${ac[i]} ${d}`;k.useEffect(()=>{if(!I)return;const j=q=>{const ue=q.target,te=A.current?.contains(ue),fe=P.current?.contains(ue);!te&&!fe&&C(!1)},H=()=>C(!1);return document.addEventListener("mousedown",j),window.addEventListener("scroll",H,!0),window.addEventListener("resize",H),()=>{document.removeEventListener("mousedown",j),window.removeEventListener("scroll",H,!0),window.removeEventListener("resize",H)}},[I]);const S=k.useCallback(()=>{if(p&&p.length>0)return p.filter(q=>q.show!==!1);let H=S0().filter(q=>!m.includes(q.key)&&q.show!==!1);return w&&w.length>0&&(H=[...H,...w.filter(q=>q.show!==!1)]),H},[p,m,w]),b=k.useCallback(()=>{if(D.current){const j=D.current.getBoundingClientRect();N({top:j.bottom+4,left:j.left})}},[]),$=k.useCallback((j,H)=>{if(H.stopPropagation(),H.preventDefault(),C(!1),j.onClick)j.onClick();else if(j.path){const q=j.path.replace(/\{\{userId\}\}/g,String(y??"")),ue=oc();ue?.navigate?ue.navigate(q):window.location.href=q}},[y]),F=k.useCallback(j=>{j.preventDefault(),g&&j.stopPropagation(),!(E||!y)&&(l?(I||b(),C(H=>!H)):f&&oc()?.navigate?.(L))},[g,E,y,l,I,b,f,L]);if(E||!y)return c.jsxs(W,{className:U,id:x,...O,children:[c.jsxs(W,{className:"flex items-center gap-1.5 text-gray-400 dark:text-gray-500",children:[c.jsx(ee,{children:_}),c.jsx(ee,{className:"text-xs px-1.5 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded",children:Zn("userinfo.guest_badge")})]}),c.jsx(Ma,{text:n,title:o})]});if(M)return c.jsxs(W,{className:U,id:x,...O,children:[c.jsx(ee,{className:"text-gray-400 dark:text-gray-500 line-through",children:_}),c.jsx(Ma,{text:n,title:o})]});const G=S(),B=/\btext-\S+/.test(d)?"":"text-gray-900 dark:text-white",V=l||f?`${B} hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer font-medium`.trim():`${B} font-medium`.trim();return c.jsxs(W,{ref:A,className:`relative inline-block ${d}`,id:x,...O,children:[c.jsxs(W,{className:ac[i],children:[c.jsx(Q,{ref:D,onClick:F,className:V,children:_}),c.jsx(Ma,{text:n,title:o})]}),l&&I&&G.length>0&&Jt.createPortal(c.jsx(W,{ref:P,className:"fixed w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 z-[9999]",style:{top:v.top,left:v.left},"data-testid":"author-dropdown-menu",children:G.map(j=>c.jsxs(Q,{onClick:H=>$(j,H),className:"flex items-center justify-start gap-2 w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","data-testid":`menu-item-${j.key}`,children:[j.icon&&c.jsx(de,{name:j.icon,className:"w-4 h-4"}),c.jsx(ee,{children:j.label})]},j.key))}),document.body)]})},_0=Object.freeze(Object.defineProperty({__proto__:null,UserInfo:sc},Symbol.toStringTag,{value:"Module"})),lc=({tabs:e,activeTabId:t,onTabChange:r,variant:n="underline",className:o="",style:a,hiddenTabIds:s=[],mobileBreakpoint:l=768,id:f,editorAttrs:h})=>{const i=window.G7Core?.useResponsive,u=i?.(),g=u?u.width<l:typeof window<"u"&&window.innerWidth<l,p=y=>{!y.disabled&&y.id!==t&&r?.(y.id)},m=y=>{const E=y.target.value,M=Number(E),_=typeof E=="string"&&E!==""&&!Number.isNaN(M)?M:E,I=e.find(C=>String(C.id)===String(_));I&&p(I)},w=s.length>0?e.filter(y=>!s.includes(y.id)):e;if(g)return c.jsx(W,{className:`relative ${o}`,style:a,id:f,...h,children:c.jsx(Xa,{value:t!==void 0?String(t):"",onChange:m,options:w.map(y=>({value:String(y.id),label:y.badge!==void 0?`${y.label} (${y.badge})`:y.label,disabled:y.disabled})),className:"w-full"})});const x=y=>{const E=y.id===t,M="flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap";if(y.disabled)return`${M} opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600`;switch(n){case"pills":return E?`${M} bg-blue-600 dark:bg-blue-500 text-white rounded-lg`:`${M} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`;case"underline":return E?`${M} text-gray-900 dark:text-white border-b-2 border-gray-900 dark:border-white`:`${M} text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-600`;default:return E?`${M} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600 dark:border-blue-400`:`${M} text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`}},O=n==="underline"?"flex gap-0 border-b border-gray-200 dark:border-gray-700":"flex gap-2";return c.jsx(W,{className:`relative ${o}`,style:a,id:f,...h,children:c.jsx($r,{className:O,children:w.map(y=>c.jsxs(Q,{type:"button",onClick:()=>p(y),disabled:y.disabled,className:x(y),children:[y.iconName&&c.jsx(de,{name:y.iconName,size:"sm"}),c.jsx(ee,{children:y.label}),y.badge!==void 0&&c.jsx(W,{className:"flex items-center justify-center min-w-5 h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full",children:c.jsx(ee,{children:y.badge})})]},y.id))})})},E0=Object.freeze(Object.defineProperty({__proto__:null,TabNavigation:lc},Symbol.toStringTag,{value:"Module"})),T0={Header:()=>Promise.resolve().then(()=>od),Footer:()=>Promise.resolve().then(()=>id),MobileNav:()=>Promise.resolve().then(()=>cd),SlotContainer:()=>Promise.resolve().then(()=>rd),NotificationCenter:()=>Promise.resolve().then(()=>nd),ProductCard:()=>Promise.resolve().then(()=>Ld),BrandMark:()=>Promise.resolve().then(()=>Fd),ImageGallery:()=>Promise.resolve().then(()=>Al),ProductImageViewer:()=>Promise.resolve().then(()=>jf),QuantitySelector:()=>Promise.resolve().then(()=>Bf),PostReactions:()=>Promise.resolve().then(()=>Vf),RichTextEditor:()=>Promise.resolve().then(()=>Yf),HtmlContent:()=>Promise.resolve().then(()=>Xf),HtmlEditor:()=>Promise.resolve().then(()=>qf),ExpandableContent:()=>Promise.resolve().then(()=>Zf),FileUploader:()=>Promise.resolve().then(()=>Xh),ConfirmDialog:()=>Promise.resolve().then(()=>Rf),SocialLoginButtons:()=>Promise.resolve().then(()=>Zh),Toast:()=>Promise.resolve().then(()=>t0),PageTransitionIndicator:()=>Promise.resolve().then(()=>n0),PageTransitionBlur:()=>Promise.resolve().then(()=>o0),PageSkeleton:()=>Promise.resolve().then(()=>b0),PageLoading:()=>Promise.resolve().then(()=>v0),ThemeToggle:()=>Promise.resolve().then(()=>Qc),Pagination:()=>Promise.resolve().then(()=>w0),SearchBar:()=>Promise.resolve().then(()=>x0),Avatar:()=>Promise.resolve().then(()=>ed),AvatarUploader:()=>Promise.resolve().then(()=>C0),UserInfo:()=>Promise.resolve().then(()=>_0),Modal:()=>Promise.resolve().then(()=>Jf),TabNavigation:()=>Promise.resolve().then(()=>E0)},N0=({id:e,className:t,style:r,children:n,editorAttrs:o})=>c.jsx(W,{id:e,className:t,style:r,...o,children:n}),A0=({id:e,children:t,cols:r=1,responsive:n,gap:o,rowGap:a,colGap:s,autoRows:l,autoCols:f,flow:h="row",className:d="",style:i,onClick:u,editorAttrs:g})=>{const p=["grid"];if(r&&p.push(`grid-cols-${r}`),n&&(n.sm&&p.push(`sm:grid-cols-${n.sm}`),n.md&&p.push(`md:grid-cols-${n.md}`),n.lg&&p.push(`lg:grid-cols-${n.lg}`),n.xl&&p.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&p.push(`2xl:grid-cols-${n["2xl"]}`)),o!==void 0&&o>0&&p.push(`gap-${o}`),a!==void 0&&a>0&&p.push(`gap-y-${a}`),s!==void 0&&s>0&&p.push(`gap-x-${s}`),l){const w={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};p.push(w[l])}if(f){const w={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};p.push(w[f])}const m={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 p.push(m[h]),d&&p.push(d),c.jsx(W,{id:e,className:p.join(" "),style:i,onClick:u,...g,children:t})},M0=({id:e,children:t,direction:r="row",justify:n="start",align:o="stretch",wrap:a="nowrap",gap:s=0,grow:l=!1,shrink:f=!0,className:h="",style:d,onClick:i,editorAttrs:u})=>{const g=["flex"],p={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(p[r]);const m={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(m[a]);const w={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(w[n]);const x={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(x[o]),s>0&&g.push(`gap-${s}`),l===!0?g.push("flex-grow"):typeof l=="number"&&l>0&&g.push(`flex-grow-${l}`),f===!1?g.push("shrink-0"):f===!0?g.push("flex-shrink"):typeof f=="number"&&f>0&&g.push(`flex-shrink-${f}`),h&&g.push(h),c.jsx(W,{id:e,className:g.join(" "),style:d,onClick:i,...u,children:t})},O0=({id:e,title:t,subtitle:r,children:n,padding:o="md",background:a="none",maxWidth:s,centered:l=!1,border:f=!1,shadow:h="none",rounded:d=!1,className:i="",style:u,onClick:g,editorAttrs:p})=>{const m=[],w={none:"p-0",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};m.push(w[o]);const x={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(a!=="none"&&m.push(x[a]),s){const y={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"};m.push(y[s])}l&&m.push("mx-auto"),f&&m.push("border","border-gray-200","dark:border-gray-700");const O={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return h!=="none"&&m.push(O[h]),d&&m.push("rounded-lg"),i&&m.push(i),c.jsxs(Za,{id:e,className:m.join(" "),style:u,onClick:g,...p,children:[(t||r)&&c.jsxs(W,{className:"mb-4",children:[t&&c.jsx(Va,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),r&&c.jsx(Dt,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:r})]}),n]})},I0=({id:e,leftWidth:t="250px",rightWidth:r="300px",leftSlot:n,centerSlot:o,rightSlot:a,className:s="",style:l,editorAttrs:f})=>{const h=`flex flex-row w-full h-full ${s}`.trim(),d={width:t,flexShrink:0},i={flex:1,minWidth:0},u={width:r,flexShrink:0};return c.jsxs(W,{id:e,className:h,style:l,...f,children:[c.jsx(W,{className:"flex flex-col",style:d,children:n}),c.jsx(W,{className:"flex flex-col",style:i,children:o}),c.jsx(W,{className:"flex flex-col",style:u,children:a})]})},D0={identifier:"sirsoft-basic",vendor:"sirsoft",name:{ko:"Basic",en:"Basic"},version:"1.0.4",license:"MIT",description:{ko:"그누보드7 기본 사용자 템플릿",en:"Gnuboard7 default user template"},type:"user",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-01-07",g7_version:">=7.0.0",dependencies:{modules:{"sirsoft-board":">=1.0.0","sirsoft-ecommerce":">=1.0.5","sirsoft-page":">=1.0.0"},plugins:{"sirsoft-daum_postcode":">=1.0.0"}},assets:{css:["dist/css/components.css"],js:["dist/js/components.iife.js"],fonts:[],images:[]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","h4","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["header","footer","mobile-nav","product-card","rich-text-editor","image-gallery","quantity-selector","post-reactions","social-login-buttons","file-uploader","card","modal","toast","pagination","stat-card","status-badge","tab-navigation","empty-state","loading-spinner","breadcrumb","search-bar","dropdown"],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"}},features:{dark_mode:!0,responsive:!0,multi_language:!0,multi_currency:!0},github_url:"https://github.com/gnuboard/g7-template-sirsoft-basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-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"}]},ic={KRW:{locale:"ko-KR",decimals:0},USD:{locale:"en-US",decimals:2},JPY:{locale:"ja-JP",decimals:0},CNY:{locale:"zh-CN",decimals:2},EUR:{locale:"de-DE",decimals:2}};function Lr(e,t="KRW"){if(!Number.isFinite(e))return"0";const r=ic[t]||ic.KRW;try{return new Intl.NumberFormat(r.locale,{style:"currency",currency:t,minimumFractionDigits:r.decimals,maximumFractionDigits:r.decimals}).format(e)}catch{return e.toLocaleString()+(t==="KRW"?"원":"")}}function Qn(e,t,r=0){if(!e)return;const n=e.KRW?.value??e.KRW?.price??0,o={};for(const[a,s]of Object.entries(e)){const l=s?.value??s?.price??0;let f=0;r>0&&(a==="KRW"?f=r:n>0&&(f=r*l/n));const h=(l+f)*t;o[a]={value:h,formatted:Lr(h,a)}}return o}function Jn(e){const t={};for(const n of e){const o=n?.multiCurrencyTotalPrice;if(o)for(const[a,s]of Object.entries(o)){const l=s?.value??s?.price??0;t[a]=(t[a]??0)+l}}const r={};for(const[n,o]of Object.entries(t))r[n]={value:o,formatted:Lr(o,n)};return r}function cc(e,t){if(!e||!t?.length)return 0;let r=0;for(const n of t){const o=e[n.id];if(o==null)continue;const a=n.values?.find(s=>s.id===Number(o));a&&(r+=a.price_adjustment??0)}return r}function Rn(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function L0(e,t,r){if(t&&r in t)return t[r];if(Array.isArray(e)){const n=e.find(o=>typeof o.key=="string"?o.key===r:o.key?.ko===r||Object.values(o.key).includes(r));return n?typeof n.value=="string"?n.value:n.value?.ko??Object.values(n.value)[0]:void 0}return e[r]}function P0(e,t){if(t)return t;if(!Array.isArray(e))return e;const r={};for(const n of e){const o=typeof n.key=="string"?n.key:n.key?.ko??Object.values(n.key)[0]??"",a=typeof n.value=="string"?n.value:n.value?.ko??Object.values(n.value)[0]??"";o&&(r[o]=a)}return r}function F0(e,t,r){return r.find(n=>!n?.option_values||!n?.is_active?!1:e.every(o=>{const a=Rn(o),s=t?.[a];return L0(n.option_values,n.option_values_localized,a)===s}))}function $0(e,t){const r=e.params;if(!r)return;const{optionGroups:n,options:o,selectedOptionItems:a,preferredCurrency:s}=r;let l;if(r.newGroupName&&r.newValue?l={...r.currentSelection??{},[r.newGroupName]:r.newValue}:l=r.currentSelection??{},!n?.every(M=>{const _=Rn(M);return l?.[_]}))return;const h=F0(n,l,o??[]);if(!h){t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const d=n.map(M=>l[Rn(M)]).join("_"),i=a??[];if(i.find(M=>M.id===d)){const M=window.G7Core;M?.toast?.warning?.(M?.t?.("sirsoft-ecommerce.shop.already_added_option")??"이미 추가된 옵션입니다."),t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const g=h.selling_price??0,p={};n.forEach(M=>{const _=Rn(M);p[_]=l[_]});const m=r.additionalOptionGroups??[],w={};for(const M of m){if(!M.is_required)continue;const _=M.values?.find(I=>I.is_default);_&&(w[M.id]=_.id)}const x=cc(w,m),O=g+x,y={id:d,optionId:h.id,options:p,optionValues:P0(h.option_values,h.option_values_localized),quantity:1,stock:h.stock_quantity??999,unitPrice:g,unitPriceFormatted:Lr(g,s),totalPrice:O,totalPriceFormatted:Lr(O,s),multiCurrencyUnitPrice:h.multi_currency_selling_price,multiCurrencyTotalPrice:Qn(h.multi_currency_selling_price,1,x),additionalOptionSelections:w,additionalOptionsTotal:x},E=[...i,y];t.setState?.({selectedOptionItems:E,selectedTotalMultiCurrency:Jn(E),currentSelection:{},__mergeMode:"shallow"})}function U0(e,t){const r=e.params;if(!r)return;const{selectedOptionItems:n,preferredCurrency:o}=r,a=Number(r.itemIndex)||0,s=Number(r.newQuantity)||1,l=(n??[]).map((f,h)=>{if(h!==a)return f;const d=f?.unitPrice??0,i=f?.additionalOptionsTotal??0,u=(d+i)*s;return{...f,quantity:s,totalPrice:u,totalPriceFormatted:Lr(u,o),multiCurrencyTotalPrice:Qn(f?.multiCurrencyUnitPrice,s,i)}});t.setState?.({selectedOptionItems:l,selectedTotalMultiCurrency:Jn(l)})}function z0(e,t){const r=e.params;if(!r)return;const{selectedOptionItems:n,additionalOptionGroups:o,preferredCurrency:a}=r,s=Number(r.itemIndex)||0,l=Number(r.additionalOptionId),f=Object.prototype.hasOwnProperty.call(r,"customText"),h=r.valueId===""||r.valueId==null?null:Number(r.valueId),d=(n??[]).map((i,u)=>{if(u!==s)return i;const g={...i.additionalOptionSelections??{}},p={...i.additionalOptionCustomTexts??{}};if(f){const y=String(r.customText??"");y.trim()===""?delete p[l]:p[l]=y}else h==null?(delete g[l],delete p[l]):(g[l]=h,(o??[]).find(M=>M.id===l)?.values?.find(M=>M.id===h)?.allow_custom_text||delete p[l]);const m=cc(g,o),w=i?.unitPrice??0,x=i?.quantity??1,O=(w+m)*x;return{...i,additionalOptionSelections:g,additionalOptionCustomTexts:p,additionalOptionsTotal:m,totalPrice:O,totalPriceFormatted:Lr(O,a),multiCurrencyTotalPrice:Qn(i?.multiCurrencyUnitPrice,x,m)}});t.setState?.({selectedOptionItems:d,selectedTotalMultiCurrency:Jn(d)})}function H0(e,t){const r=e.params;if(!r)return;const n=Number(r.itemIndex)||0,o=(r.selectedOptionItems??[]).filter((a,s)=>s!==n);t.setState?.({selectedOptionItems:o,selectedTotalMultiCurrency:Jn(o)})}function G0(e,t){const r=e.params;if(!r)return;const n=Math.max(1,Number(r.newQuantity)||1);t.setState?.({noOptionQuantity:n,noOptionTotalMultiCurrency:Qn(r.multiCurrencyUnitPrice,n)})}const cn=window.G7Core?.createLogger?.("Handler:Cart")??{log:(...e)=>console.log("[Handler:Cart]",...e),warn:(...e)=>console.warn("[Handler:Cart]",...e),error:(...e)=>console.error("[Handler:Cart]",...e)};function hr(e){const t=window.G7Core;t?.state?.setLocal?(t.state.setLocal(e),cn.log("Local state updated:",e)):cn.warn("G7Core.state.setLocal not available")}function dc(){return window.G7Core?.state?.getLocal?.()||{}}function j0(){return window.G7Core?.state?.get?.()||{}}function B0(e,t="info"){const r=window.G7Core;r?.toast?.show?r.toast.show(e,t):cn.warn("G7Core.toast.show not available, message:",e)}function W0(e){const t=window.G7Core;return t?.t?t.t(e):e}function uc(){const e=window.G7Core;if(e?.dispatch){const r=dc().selectedItems||[];e.dispatch({handler:"refetchDataSource",params:{dataSourceId:"cartItems"}}),cn.log("Refetching cartItems with selected_ids:",r)}else cn.warn("G7Core.dispatch not available")}function K0(e,t){const{itemId:r,selectedItems:n}=e?.params||{},o=n||[];let a;o.includes(r)?a=o.filter(h=>h!==r):a=[...o,r];const l=j0().cartItems?.data?.items||[],f=l.length>0&&a.length===l.length;hr({selectedItems:a,allSelected:f,selectedCount:a.length}),uc()}function V0(e,t){const{allItemIds:r,isSelected:n}=e?.params||{};hr({selectedItems:n?r:[],allSelected:n,selectedCount:n?r.length:0}),uc()}function Y0(e,t){const{optionName:r,optionValue:n}=e?.params||{},a=dc().selectedOptions||{};hr({selectedOptions:{...a,[r]:n}})}function X0(e,t){const{targetIds:r}=e?.params||{};if(!r||r.length===0){B0(W0("shop.cart.select_items_to_delete"),"warning");return}hr({deleteModal:{visible:!0,targetIds:r}})}function q0(e,t){const{targetItem:r}=e?.params||{};hr({optionModal:{visible:!0,targetItem:r},selectedOptions:r?.options||{},selectedQuantity:r?.quantity})}function Z0(e,t){const{selectedItems:r}=e?.params||{};if(!r||r.length===0){hr({isCalculating:!1});return}hr({isCalculating:!0})}const pr=window.G7Core?.createLogger?.("Handler:CartOptionChange")??{log:(...e)=>console.log("[Handler:CartOptionChange]",...e),warn:(...e)=>console.warn("[Handler:CartOptionChange]",...e),error:(...e)=>console.error("[Handler:CartOptionChange]",...e)};function Oa(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function Q0(e,t,r){if(t&&r in t)return t[r];if(Array.isArray(e)){const n=e.find(o=>typeof o.key=="string"?o.key===r:o.key?.ko===r||Object.values(o.key).includes(r));return n?typeof n.value=="string"?n.value:n.value?.ko??Object.values(n.value)[0]:void 0}return e[r]}function fc(e,t,r){return!e||!t?.length?null:t.every(a=>{const s=Oa(a);return e[s]})?r?.find(a=>t.every(s=>{const l=Oa(s);return Q0(a.option_values,a.option_values_localized,l)===e[l]}))||null:(pr.log("Not all options selected yet"),null)}function J0(e,t){const{selectedOptions:r,optionGroups:n,options:o}=e?.params||{};pr.log("findMatchingOption called:",{selectedOptions:r,optionGroups:n,optionsCount:o?.length});const a=fc(r,n,o);return pr.log("Matched option:",a),{matchedOption:a}}function R0(e,t){const{currentOptionValues:r,optionGroups:n,options:o}=e?.params||{};if(pr.log("initCartOptionSelection called:",{currentOptionValues:r,optionGroups:n,optionsCount:o?.length}),!n?.length||!r)return pr.log("No option groups or current values, returning empty"),{selectedOptions:{},matchedOption:null};const a={};for(const l of n){const f=Oa(l),h=r[f],d=l.values_localized??(Array.isArray(l.values)?l.values.map(i=>typeof i=="string"?i:i?.ko??""):[]);h&&d.includes(h)&&(a[f]=h)}pr.log("Initial selectedOptions:",a);const s=fc(a,n,o||[]);return pr.log("Matched option:",s),{selectedOptions:a,matchedOption:s}}const dn="g7_cart_key",ep="/api/modules/sirsoft-ecommerce/cart/key",Ia="g7_guest_order_token",gc="g7_guest_order_number",Da="g7_guest_order_expires_at",at=window.G7Core?.createLogger?.("Handler:Storage")??{log:(...e)=>console.log("[Handler:Storage]",...e),warn:(...e)=>console.warn("[Handler:Storage]",...e),error:(...e)=>console.error("[Handler:Storage]",...e)};async function hc(){try{const e=await fetch(ep,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"}});return e.ok?(await e.json()).data?.cart_key||null:(at.error("Failed to issue cartKey from API:",e.status),null)}catch(e){return at.error("Error issuing cartKey from API:",e),null}}function rr(e){const t=window.G7Core;t?.state?.set?(t.state.set(e),at.log("Global state updated:",e)):at.warn("G7Core.state.set not available")}function tp(){try{const e=window.G7Config;return e?.user?e.user:(window.G7Core?.state?.get?.()||{}).currentUser||null}catch{return null}}async function rp(e,t){let r=null;try{r=localStorage.getItem(dn)}catch{}if(r)at.log("Existing cartKey loaded:",r);else if(r=await hc(),r)try{localStorage.setItem(dn,r),at.log("New cartKey issued from API:",r)}catch{}else at.error("Failed to issue cartKey from API");rr({cartKey:r})}function np(e,t){try{return localStorage.getItem(dn)}catch{return null}}function pc(e,t){try{localStorage.removeItem(dn),at.log("cartKey removed from localStorage")}catch{}rr({cartKey:null})}async function op(e,t){if(tp()){pc();return}const n=await hc();if(n){try{localStorage.setItem(dn,n),at.log("New cartKey regenerated from API:",n)}catch{}rr({cartKey:n})}else at.error("Failed to regenerate cartKey from API")}function ap(e,t){const{key:r,value:n}=e?.params||{};if(!r){at.warn("saveToStorage: key is required");return}try{localStorage.setItem(r,n),at.log("Saved to storage:",r,n)}catch{}}function sp(e,t){const{key:r,defaultValue:n}=e?.params||{};if(!r)return at.warn("loadFromStorage: key is required"),n||null;try{return localStorage.getItem(r)||n||null}catch{return n||null}}function La(){try{sessionStorage.removeItem(Ia),sessionStorage.removeItem(gc),sessionStorage.removeItem(Da)}catch{}}function lp(e,t){let r=null,n=null;try{r=sessionStorage.getItem(Ia),n=sessionStorage.getItem(Da)}catch{}let o=!1;if(r){const a=n?new Date(n).getTime():NaN;(isNaN(a)||a<=Date.now())&&(La(),r=null,o=!0)}if(r){rr({guestOrderToken:r}),at.log("Guest order token loaded from sessionStorage");return}if(!o){const s=window.G7Core?.state?.get?.("_global")?.guestOrderToken;if(typeof s=="string"&&s!==""){at.log("Guest order token preserved from in-memory _global (sessionStorage empty)");return}}rr({guestOrderToken:null}),at.log("No guest order token (visitor not authenticated)")}function ip(e,t){const{token:r,orderNumber:n,expiresAt:o}=e?.params||{};if(!r||!n||!o){at.warn("saveGuestOrderToken: token, orderNumber, expiresAt are required");return}try{sessionStorage.setItem(Ia,r),sessionStorage.setItem(gc,n),sessionStorage.setItem(Da,o)}catch{}rr({guestOrderToken:r})}function cp(e,t){La(),rr({guestOrderToken:null})}function dp(e,t){La(),rr({guestOrderToken:null})}function up(e,t){const{product:r,priceField:n,currencyCode:o}=e,a=o||t.getState("_global.preferredCurrency")||"KRW",s=`multi_currency_${n}`,l=r[s];if(l&&l[a])return l[a].formatted;const f=`${n}_formatted`;return r[f]||String(r[n])}const Pa={KRW:{code:"KRW",symbol:"₩",locale:"ko-KR",decimals:0},USD:{code:"USD",symbol:"$",locale:"en-US",decimals:2},JPY:{code:"JPY",symbol:"¥",locale:"ja-JP",decimals:0},CNY:{code:"CNY",symbol:"¥",locale:"zh-CN",decimals:2},EUR:{code:"EUR",symbol:"€",locale:"de-DE",decimals:2}};function fp(e,t){const{value:r,currencyCode:n,locale:o}=e,a=n||t.getState("_global.preferredCurrency")||"KRW",s=Pa[a]||Pa.KRW,l=o||s.locale;try{return new Intl.NumberFormat(l,{style:"currency",currency:s.code,minimumFractionDigits:s.decimals,maximumFractionDigits:s.decimals}).format(r)}catch{const f=r.toLocaleString(void 0,{minimumFractionDigits:s.decimals,maximumFractionDigits:s.decimals});return`${s.symbol}${f}`}}function gp(e){return Pa[e]?.symbol||e}const Fa=window.G7Core?.createLogger?.("Handler:Currency")??{log:(...e)=>console.log("[Handler:Currency]",...e),warn:(...e)=>console.warn("[Handler:Currency]",...e),error:(...e)=>console.error("[Handler:Currency]",...e)},mc="g7_preferred_currency",hp="KRW";function pp(e,t){const{defaultCurrency:r=hp}=e;let n=r;try{if(typeof window<"u"&&window.localStorage){const o=localStorage.getItem(mc);o&&bc(o)&&(n=o)}}catch{Fa.warn("localStorage 접근 불가, 기본 통화 사용:",r)}return t.setState("global",{preferredCurrency:n}),n}function mp(e,t){const{currencyCode:r}=e;if(!bc(r)){Fa.warn("유효하지 않은 통화 코드:",r);return}try{typeof window<"u"&&window.localStorage&&localStorage.setItem(mc,r)}catch{Fa.warn("localStorage 저장 실패")}t.setState("global",{preferredCurrency:r})}function bc(e){return typeof e=="string"&&/^[A-Z]{3}$/.test(e)}const Pr=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...e)=>console.log("[Handler:SetTheme]",...e),warn:(...e)=>console.warn("[Handler:SetTheme]",...e),error:(...e)=>console.error("[Handler:SetTheme]",...e)},$a=["auto","light","dark"],yc="g7_color_scheme",bp=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,eo=e=>{const t=bp(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function yp(){try{const e=localStorage.getItem(yc),t=e&&$a.includes(e)?e:"auto";eo(t),Pr.log("Initial theme applied:",t)}catch(e){Pr.warn("Failed to load initial theme:",e),eo("auto")}}async function vp(e,t){const r=e?.target;if(r&&typeof r=="string"&&$a.includes(r)){eo(r);return}yp()}async function wp(e,t){let r;if(e?.target&&typeof e.target=="string"&&!e.target.includes("{{")&&(r=e.target),!r||typeof r!="string"){Pr.warn("Invalid theme:",r);return}if(!$a.includes(r)){Pr.warn("Unsupported theme:",r);return}const n=r;try{localStorage.setItem(yc,n)}catch(o){Pr.error("Failed to save theme to localStorage:",o);return}eo(n),Pr.log("Theme changed to:",n)}const xp=window.G7Core?.createLogger?.("Handler:RedirectToLoginWithReturn")??{log:(...e)=>console.log("[Handler:RedirectToLoginWithReturn]",...e),warn:(...e)=>console.warn("[Handler:RedirectToLoginWithReturn]",...e),error:(...e)=>console.error("[Handler:RedirectToLoginWithReturn]",...e)};async function kp(e,t){const r=window.G7Core;if(!r?.dispatch){xp.error("G7Core.dispatch 가 초기화되지 않아 로그인 리다이렉트를 실행할 수 없습니다.");return}const n=window.location.pathname+window.location.search;await r.dispatch({handler:"navigate",params:{path:"/login",query:{redirect:n}}})}const Ua=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...e)=>console.log("[Handler:DownloadAttachment]",...e),warn:(...e)=>console.warn("[Handler:DownloadAttachment]",...e),error:(...e)=>console.error("[Handler:DownloadAttachment]",...e)};async function Cp(e,t){const r=window.G7Core,{url:n,filename:o}=e?.params||{};if(!n){Ua.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!r?.api?.get){Ua.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const a=await r.api.get(n,{responseType:"blob"});if(a){const s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=o||"",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(s)}}catch(a){Ua.error("첨부파일 다운로드 실패",a),r?.toast?.error?.(r?.t?.("common.download_failed")??"Download failed")}}const to={"sirsoft-basic.addSelectedItemIfComplete":$0,"sirsoft-basic.updateSelectedItemQuantity":U0,"sirsoft-basic.removeSelectedItem":H0,"sirsoft-basic.updateNoOptionQuantity":G0,"sirsoft-basic.setBlockAdditionalOption":z0,"sirsoft-basic.getDisplayPrice":up,"sirsoft-basic.formatCurrency":fp,"sirsoft-basic.getCurrencySymbol":gp,"sirsoft-basic.loadPreferredCurrency":pp,"sirsoft-basic.savePreferredCurrency":mp,setTheme:wp,initTheme:vp,redirectToLoginWithReturn:kp,downloadAttachment:Cp,toggleCartItemSelection:K0,selectAllCartItems:V0,setCartOption:Y0,openCartDeleteModal:X0,openCartOptionModal:q0,recalculateCart:Z0,findMatchingOption:J0,initCartOptionSelection:R0,initCartKey:rp,getCartKey:np,clearCartKey:pc,regenerateCartKey:op,saveToStorage:ap,loadFromStorage:sp,initGuestOrderToken:lp,saveGuestOrderToken:ip,clearGuestOrderToken:cp,clearGuestTokenOnEntry:dp},un=window.G7Core?.createLogger?.("Template:sirsoft-basic:IdentityLauncher")??{log:(...e)=>console.log("[Template:sirsoft-basic:IdentityLauncher]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:IdentityLauncher]",...e),error:(...e)=>console.error("[Template:sirsoft-basic:IdentityLauncher]",...e)};function Sp(e){const t=window.G7Core,r=t?.state?.getLocal?.()??{},n=t?.state?.getGlobal?.()??t?.state?.get?.()??{},o=(...f)=>f.find(h=>typeof h=="string"&&h.length>0),a=o(e.target?.email,n?.currentUser?.email,n?.user?.email,n?.auth?.user?.email,e.purpose==="signup"?r?.registerForm?.email:void 0,e.purpose==="password_reset"?r?.passwordResetForm?.email:void 0,e.purpose==="password_reset"?r?.email:void 0),s=o(e.target?.phone,n?.currentUser?.phone,n?.user?.phone,n?.auth?.user?.phone);if(!a&&!s)return null;const l={};return a&&(l.email=a),s&&(l.phone=s),l}function _p(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function Ep(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function Tp(e,t){const r={purpose:e.purpose};e.provider_id&&(r.provider_id=e.provider_id),t&&(r.target=t);const n=e.challenge_start_url||"/api/identity/challenges",o=await fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...Ep(),..._p()},body:JSON.stringify(r)}),a=await o.json().catch(()=>null);if(!o.ok||!a?.success){const l=a?.message??`Challenge 시작 실패 (HTTP ${o.status})`;throw new Error(l)}const s=a.data??a;return{id:s.id,expires_at:s.expires_at,render_hint:s.render_hint??e.render_hint??"text_code",public_payload:s.public_payload,redirect_url:s.redirect_url,max_attempts:typeof s.max_attempts=="number"?s.max_attempts:void 0}}async function Np(e){const t=window.G7Core,r=t?.identity;if(!t?.dispatch||!t?.state||!r)return un.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(e.render_hint==="external_redirect"||e.redirect_url)return r.redirectExternally(e);const n=Sp(e);let o;try{o=await Tp(e,n)}catch(p){un.error("Challenge 시작 실패:",p);try{await t.dispatch({handler:"toast",params:{type:"error",message:p instanceof Error?p.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:p instanceof Error?p.message:String(p)}}if(o.redirect_url)return r.redirectExternally({...e,render_hint:"external_redirect",redirect_url:o.redirect_url});const a=o.expires_at?new Date(o.expires_at).getTime():0,s=a>0?Math.max(0,Math.floor((a-Date.now())/1e3)):0,l=typeof o.max_attempts=="number"?o.max_attempts:0;t.state.set({identityChallenge:{policy_key:e.policy_key,purpose:e.purpose,provider_id:e.provider_id??null,render_hint:o.render_hint,challenge_id:o.id,expires_at:o.expires_at,public_payload:o.public_payload??{},target:n??null,code:"",error:null,attempts:0,maxAttempts:l,remainingSeconds:s,resendCooldown:0}});let f=a,h=0;const d=window.setInterval(()=>{const p=f>0?Math.max(0,Math.floor((f-Date.now())/1e3)):0;h=Math.max(0,h-1),t.state.set({identityChallenge:{remainingSeconds:p,resendCooldown:h}})},1e3);let i=null;try{i=t.state.subscribe?.(p=>{const m=p?.identityChallenge?.expires_at;if(typeof m=="string"){const x=new Date(m).getTime();Number.isFinite(x)&&x!==f&&(f=x)}const w=p?.identityChallenge?.resendCooldown;typeof w=="number"&&w>h&&(h=w)})??null}catch{}const u=r.createDeferred();try{await t.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(p){return un.error("openModal 실패 — 풀페이지로 폴백:",p),window.clearInterval(d),i?.(),r.redirectExternally({...e,render_hint:"external_redirect",redirect_url:`/identity/challenge?challenge_id=${encodeURIComponent(o.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await u;return window.clearInterval(d),i?.(),g}function Ap(){const e=window.G7Core?.identity;if(!e?.setLauncher){un.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(Np),un.log("IDV launcher registered (sirsoft-basic)")}const vc=window.G7Core?.createLogger?.("Template:sirsoft-basic:device")??{log:(...e)=>console.log("[Template:sirsoft-basic:device]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:device]",...e)};function Mp(){if(typeof navigator>"u")return!1;const e=navigator,t=(e.userAgent||"").toLowerCase(),r=((e.userAgentData?.platform??e.platform)||"").toLowerCase(),n=e.maxTouchPoints??0;return/iphone|ipad|ipod/.test(t)||/iphone|ipad|ipod|ios/.test(r)?!0:/macintosh|mac os x/.test(t)&&n>1}function Op(){const e=window.G7Core;if(!e?.state?.get||!e?.state?.set){vc.warn("G7Core.state not available; skip iOS device correction");return}if(!Mp())return;const r=(e.state.get()||{}).appConfig||{};r.isIos!==!0&&(e.state.set({appConfig:{...r,isIos:!0}}),vc.log("appConfig.isIos corrected to true by client signals (iPadOS desktop-UA)"))}function Ip(e){const t=e.icons;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.value=="string"):[]}function Dp(e,t){const r=e.label;return typeof r=="string"?r.startsWith("$t:")?t(r.slice(3)):r:e.value}function Lp(e,t,r){if(r==="")return!0;const n=r.toLowerCase();return e.value.toLowerCase().includes(n)||t.toLowerCase().includes(n)?!0:(e.keywords??[]).some(o=>o.toLowerCase().includes(n))}function Pp({entry:e}){const t=e.preview;return t?.html?c.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:Ha}):t?.className?c.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:Ha}):c.jsx("i",{className:`fas fa-${e.value}`,style:Ha,"aria-hidden":"true"})}function Fp({control:e,value:t,onChange:r,t:n}){const o=Ip(e),a=t==null?"":String(t),s=typeof e.iconColumns=="number"?e.iconColumns:6,l=e.iconSearchPlaceholder,f=typeof l=="string"&&l.startsWith("$t:")?n(l.slice(3)):n("layout_editor.icon_picker.search_placeholder"),[h,d]=k.useState("");if(o.length===0)return c.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:wc,children:c.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:a,placeholder:n("layout_editor.icon_picker.free_input_hint"),onChange:g=>r(g.target.value===""?void 0:g.target.value),style:xc})});const i=g=>Dp(g,n),u=o.filter(g=>Lp(g,i(g),h));return c.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:wc,children:[c.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:h,placeholder:f,onChange:g=>d(g.target.value),style:xc}),c.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...$p,gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`},children:[c.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:n("layout_editor.icon_picker.none"),onClick:()=>r(void 0),"aria-pressed":a==="",style:a===""?kc:za,children:c.jsx("span",{style:Up,children:"—"})}),u.map(g=>{const p=g.value===a;return c.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:i(g),"aria-pressed":p,onClick:()=>r(g.value),style:p?kc:za,children:c.jsx(Pp,{entry:g})},g.value)})]}),u.length===0&&c.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:zp,children:n("layout_editor.icon_picker.no_results")})]})}const wc={display:"flex",flexDirection:"column",gap:6,width:"100%"},xc={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},$p={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},za={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},kc={...za,border:"2px solid #2563eb",background:"#eff6ff"},Ha={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},Up={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},zp={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Cc=window.G7Core?.createLogger?.("Template:sirsoft-basic:EditorWidgets")??{log:(...e)=>console.log("[Template:sirsoft-basic:EditorWidgets]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic:EditorWidgets]",...e)};function Hp(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Cc.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",Fp),Cc.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)")}const Ga=window.G7Core?.createLogger?.("Template:sirsoft-basic")??{log:(...e)=>console.log("[Template:sirsoft-basic]",...e),warn:(...e)=>console.warn("[Template:sirsoft-basic]",...e),error:(...e)=>console.error("[Template:sirsoft-basic]",...e)};typeof window<"u"&&(window.G7TemplateHandlers=to);function Sc(){if(typeof window<"u"){let e=0;const t=50,r=()=>{const n=window.G7Core?.getActionDispatcher?.();n?(Object.entries(to).forEach(([o,a])=>{n.registerHandler(o,a)}),Ga.log(`${Object.keys(to).length} custom handler(s) registered:`,Object.keys(to)),Ap(),Op()):(e++,e<=t?(Ga.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(r,100)):Ga.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?r():window.addEventListener("load",r)}}return Hp(),Sc(),J.A=ao,J.Avatar=Ur,J.AvatarUploader=Aa,J.BrandMark=xo,J.Button=Q,J.Checkbox=qa,J.Code=Xc,J.ConfirmDialog=ta,J.Container=N0,J.Div=W,J.ExpandableContent=Jo,J.FileInput=Ba,J.FileUploader=Xn,J.Flex=M0,J.Footer=rs,J.Form=so,J.Grid=A0,J.H1=Fc,J.H2=Va,J.H3=gn,J.H4=Ya,J.Header=es,J.Hr=lo,J.HtmlContent=qo,J.HtmlEditor=Ll,J.Icon=de,J.IconName=Je,J.ImageGallery=Tr,J.Img=Lt,J.Input=xt,J.Label=yr,J.Li=Xt,J.MobileNav=ns,J.Modal=Ro,J.Nav=$r,J.NotificationCenter=mn,J.Ol=$c,J.Optgroup=Gc,J.Option=Hc,J.P=Dt,J.PageLoading=ec,J.PageSkeleton=Na,J.PageTransitionBlur=_a,J.PageTransitionIndicator=Sa,J.Pagination=tc,J.PasswordInput=Ka,J.PostReactions=Il,J.ProductCard=ms,J.ProductImageViewer=An,J.QuantitySelector=Ml,J.RichTextEditor=Dl,J.SearchBar=nc,J.Section=Za,J.SectionLayout=O0,J.Select=Xa,J.SlotContainer=pn,J.SocialLoginButtons=Ki,J.Span=ee,J.Svg=fn,J.TabNavigation=lc,J.Table=jc,J.Tbody=Wc,J.Td=Yc,J.Textarea=no,J.Th=Vc,J.Thead=Bc,J.ThemeToggle=hn,J.ThreeColumnLayout=I0,J.Toast=Ca,J.Tr=Kc,J.Ul=oo,J.UserInfo=sc,J.availablePasswordRules=ro,J.compositeComponents=T0,J.defaultPasswordRules=Wa,J.initTemplate=Sc,J.templateMetadata=D0,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),J})({},ReactJSXRuntime,React,ReactDOM);
|
||
//# sourceMappingURL=components.iife.js.map
|