7.0.6 사이클에서 유입된 회귀 3건을 출시 전에 닫는다. 추가옵션 저장소의 반환 타입 선언이 실제 반환(중첩 맵)과 어긋나 추가옵션 있는 상품의 담기· 바로구매가 죽었고, 검색 엔진이 결과 소비 시점에 SELECT 를 재작성해 정렬이 참조하던 스코어 별칭을 지웠으며, 미들웨어 targets 가 늘어난 라우트를 따라가지 못해 비회원 현금영수증이 전면 불능이었다. 셋 다 정적 검사의 사각지대였으므로 룰 2건과 계약 테스트를 함께 세워 재발을 막는다. 같은 유형의 잠복 결함 3건(빈 반환의 타입 불일치 2건, 없는 메서드 호출 1건)도 호출 경로가 생기는 순간 fatal 이므로 함께 닫았다. 브라우저 검수 중 드러난 선행 결함 5건을 이어서 수정한다. 엔진이 event 키로 선언한 액션을 React prop 으로 연결하지 않아 오류 없이 조용히 무반응이었고, 연결한 뒤에는 커스텀 컴포넌트의 이벤트 payload 가 유실됐다. 비회원 주문상세 응답에 현금영수증 키가 없어 발급 결과에 도달할 수 없었으며, 입금확인과 현금영수증 발급이 base 통화 금액을 써서 결제 통화가 다른 주문에서 각각 저장 실패와 잘못된 증빙을 냈다. 마지막으로 통화 단위를 코드·문구에서 걷어내 설정으로 이관한다. 다국어 문구의 원/円, 프론트의 KRW 고정표와 리터럴 폴백 173건, 서버 포맷의 통화 코드 리터럴이 대상이며, 기본 통화가 원이 아닌 상점에서 값은 맞고 단위만 틀린 금액이 예외 없이 나가던 문제였다. 통화 판정을 설정 단일 출처로 모으고 규칙 3건을 정적 검사로 고정했다.
88 lines
352 KiB
JavaScript
88 lines
352 KiB
JavaScript
var SirsoftBasic=(function(J,d,k,Jt){"use strict";function Dc(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 N=Dc(k),Lc=()=>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=Lc()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return d.jsx("button",{ref:a,className:l,...o,children:e})});Q.displayName="Button";const W=k.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("div",{ref:n,className:t,...r,children:e})),R=({children:e,className:t="",...r})=>d.jsx("span",{className:t,...r,children:e}),fn=({children:e,className:t="",...r})=>d.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,...c},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 C=k.useCallback(()=>{g.current=!0},[]),O=k.useCallback(y=>{if(g.current=!1,n){const T=y.target.value;w(T);const A=new Event("change",{bubbles:!0});Object.defineProperty(A,"target",{writable:!1,value:{value:T}}),Object.defineProperty(A,"currentTarget",{writable:!1,value:{value:T}}),n(A)}},[n]),v=k.useCallback(y=>{const T=y.target.value;w(T),!g.current&&n&&n(y)},[n]),E=k.useCallback(y=>{g.current||o&&o(y)},[o]),{loadingactions:I,formdata:_,...M}=c;if(u)return d.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:h,value:a,...M});const x=a!==void 0?{value:m}:{defaultValue:s};return d.jsx("input",{ref:p,type:l,className:r,onChange:v,onKeyPress:E,onCompositionStart:C,onCompositionEnd:O,...x,...M})});xt.displayName="Input";const ja=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 c=k.useRef(null),i=h||c,[u,g]=k.useState(""),p={},m={};Object.entries(f).forEach(([v,E])=>{v.startsWith("data-editor-")||v==="id"||v==="onMouseMove"||v==="onMouseLeave"?p[v]=E:m[v]=E});const w=k.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),C=k.useCallback(v=>{const E=v.target.files?.[0]||null;if(!E){g(""),r?.(null);return}if(t&&E.size>t*1024*1024){const I=`File size exceeds ${t}MB limit`;n?.(I),i.current&&(i.current.value=""),g("");return}g(E.name),r?.(E)},[t,r,n,i]),O=k.useCallback(v=>{v.stopPropagation(),i.current&&(i.current.value=""),g(""),r?.(null)},[r,i]);return d.jsxs(W,{className:`flex items-center gap-2 ${s}`,...p,children:[d.jsx(xt,{ref:i,type:"file",accept:e,onChange:C,disabled:l,className:"hidden",...m}),d.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}),d.jsx(R,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:u||a}),u&&!l&&d.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:d.jsx(fn,{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});ja.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 Pc={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,...c})=>{const i={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},u=typeof e=="string"?e:String(e),g=Pc[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 d.jsx("i",{className:m,style:h,"aria-label":w,role:"img",...c})},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}}},Ba=[ro.minLength];function $c(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 Wa=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:c,wrapperClassName:i="",validationClassName:u="",className:g="",onChange:p,value:m,defaultValue:w,disabled:C,...O},v)=>{const E=k.useRef(null);k.useImperativeHandle(v,()=>E.current);const[I,_]=k.useState(!1),[M,x]=k.useState(!1),[y,T]=k.useState(m??w??"");k.useEffect(()=>{m!==void 0&&T(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=>$c(j)).filter(j=>j!==null):Ba.map(j=>({rule:j,param:j.defaultParam})),[f,h]),P=k.useMemo(()=>!c||c.length===0?A:A.filter(j=>c.includes(j.rule.key)),[A,c]),D=k.useMemo(()=>!n||o?{}:P.reduce((j,{rule:H,param:q})=>(j[H.key]=H.validate(y,q),j),{}),[y,P,n,o]),L=k.useMemo(()=>!o||a===void 0?!0:y===a&&y.length>0,[o,y,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;T(H),p&&p(j)},[p]),F=k.useCallback(j=>{x(j.getModifierState("CapsLock"))},[]),{loadingactions:$,formdata:G,...Y}=O,B={},K={};for(const[j,H]of Object.entries(Y))j.startsWith("data-editor-")||j==="onMouseMove"||j==="onMouseLeave"?B[j]=H:K[j]=H;return d.jsxs("div",{className:`relative ${i}`,...B,children:[d.jsxs("div",{className:"relative",children:[d.jsx("input",{ref:E,type:I?"text":"password",className:`${g} ${r?"pr-10":""}`,value:m!==void 0?m:void 0,defaultValue:m===void 0?w:void 0,onChange:b,onKeyDown:F,onKeyUp:F,disabled:C,...K}),r&&d.jsx("button",{type:"button",onClick:S,disabled:C,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(I?"auth.password_input.hide":"auth.password_input.show"),children:d.jsx(de,{name:I?"eye-slash":"eye",className:"w-5 h-5"})})]}),M&&!I&&d.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-sm text-yellow-600 dark:text-yellow-400",children:[d.jsx(de,{name:"triangle-exclamation",className:"w-4 h-4"}),d.jsx("span",{children:br("auth.password_input.caps_lock_on")})]}),o&&a!==void 0&&y.length>0&&d.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:[d.jsx(de,{name:L?"check-circle":"xmark-circle",className:"w-4 h-4"}),d.jsx("span",{children:br(L?"auth.password_input.match":"auth.password_input.mismatch")})]}),n&&!o&&y.length>0&&d.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 d.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:[d.jsx(de,{name:q?"check-circle":"circle",className:"w-4 h-4"}),d.jsx("span",{children:br(j.labelKey,ue)})]},j.key)})}),t&&d.jsx("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400",children:t})]})});Wa.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,c]=k.useState(o??a??"");k.useEffect(()=>{!l.current&&o!==void 0&&c(o)},[o]);const i=k.useCallback(()=>{l.current=!0},[]),u=k.useCallback(O=>{if(l.current=!1,n){const v=O.target.value;c(v);const E=new Event("change",{bubbles:!0});Object.defineProperty(E,"target",{writable:!1,value:{value:v}}),Object.defineProperty(E,"currentTarget",{writable:!1,value:{value:v}}),n(E)}},[n]),g=k.useCallback(O=>{const v=O.target.value;c(v),!l.current&&n&&n(O)},[n]),{loadingactions:p,formdata:m,...w}=s,C=o!==void 0?{value:h}:{defaultValue:a};return d.jsx("textarea",{ref:f,className:r,onChange:g,onCompositionStart:i,onCompositionEnd:u,...C,...w})},yr=({children:e,className:t="",...r})=>d.jsx("label",{className:t,...r,children:e}),Dt=({children:e,className:t="",...r})=>d.jsx("p",{className:t,...r,children:e}),Lt=({className:e="",alt:t="",...r})=>d.jsx("img",{className:e,alt:t,...r}),Fc=({children:e,className:t="",...r})=>d.jsx("h1",{className:t,...r,children:e}),Va=({children:e,className:t="",...r})=>d.jsx("h2",{className:t,...r,children:e}),gn=({children:e,className:t="",...r})=>d.jsx("h3",{className:t,...r,children:e}),Ka=({children:e,className:t="",...r})=>d.jsx("h4",{className:t,...r,children:e}),oo=({children:e,className:t="",...r})=>d.jsx("ul",{className:t,...r,children:e}),Uc=({children:e,className:t="",...r})=>d.jsx("ol",{className:t,...r,children:e}),Xt=({children:e,className:t="",...r})=>d.jsx("li",{className:t,...r,children:e}),ao=({children:e,className:t="",...r})=>d.jsx("a",{className:t,...r,children:e}),so=({children:e,className:t="",...r})=>d.jsx("form",{className:t,...r,children:e}),zc=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 Hc(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 Ya=({children:e,label:t,error:r,options:n,className:o="",value:a,onChange:s,disabled:l,searchable:f=!1,searchPlaceholder:h,editorAttrs:c,...i})=>{const[u,g]=k.useState(!1),[p,m]=k.useState(""),[w,C]=k.useState(null),O=k.useRef(null),v=k.useRef(null),E=k.useRef(null),I=k.useRef(null),_=k.useMemo(()=>n?Array.isArray(n)?n.length===0?[]:typeof n[0]=="string"?n.map(S=>({value:S,label:Hc(S)})):n:(zc.warn("options prop is not an array:",n),null):null,[n]),M=k.useMemo(()=>_&&_.find(b=>String(b.value)===String(a))?.label||"",[_,a]),x=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 y=k.useCallback(()=>{if(!v.current)return;const S=v.current.getBoundingClientRect(),b=window.innerHeight-S.bottom,$=b<280&&S.top>b;C($?{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){C(null);return}return y(),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}},[u,y]),k.useEffect(()=>{const S=b=>{const F=b.target;O.current&&!O.current.contains(F)&&(!I.current||!I.current.contains(F))&&g(!1)};return u&&document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[u]),k.useEffect(()=>{const S=b=>{b.key==="Escape"&&u&&(g(!1),v.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[u]);const T=()=>{l||g(!u)},A=S=>{s&&s({target:{value:S},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),v.current?.focus()};if(!_)return d.jsx("select",{className:o,value:a,onChange:s,disabled:l,...c,...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={...c,...i};return d.jsxs(W,{ref:O,className:"relative",...U,children:[d.jsxs(Q,{ref:v,type:"button",onClick:T,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:[d.jsx(R,{className:"truncate",children:M||" "}),d.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:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),u&&w&&Jt.createPortal(d.jsxs(W,{ref:I,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&&d.jsx(W,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:d.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"})}),d.jsxs(W,{className:"py-2 max-h-60 overflow-auto",children:[x&&x.length===0&&d.jsx(W,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:p?"No results":""}),(x??[]).map(S=>{const b=String(S.value)===String(a);return d.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:[d.jsx(R,{children:S.label}),b&&d.jsx(fn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},S.value)})]})]}),document.body)]})},Gc=({children:e,className:t="",...r})=>d.jsx("option",{className:t,...r,children:e}),jc=({children:e,className:t="",...r})=>d.jsx("optgroup",{className:t,...r,children:e}),Xa=k.forwardRef(({label:e,className:t="",...r},n)=>d.jsx("input",{ref:n,type:"checkbox",className:t,...r}));Xa.displayName="Checkbox";const Bc=({children:e,className:t="",...r})=>d.jsx("table",{className:t,...r,children:e}),Wc=({children:e,className:t="",...r})=>d.jsx("thead",{className:t,...r,children:e}),Vc=({children:e,className:t="",...r})=>d.jsx("tbody",{className:t,...r,children:e}),Kc=({children:e,className:t="",...r})=>d.jsx("tr",{className:t,...r,children:e}),Yc=({children:e,className:t="",...r})=>d.jsx("th",{className:t,...r,children:e}),Xc=({children:e,className:t="",...r})=>d.jsx("td",{className:t,...r,children:e}),Fr=k.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("nav",{ref:n,className:t,...r,children:e}));Fr.displayName="Nav";const qa=({children:e,className:t="",...r})=>d.jsx("section",{className:t,...r,children:e}),qc=({children:e,className:t="",...r})=>d.jsx("code",{className:t,...r,children:e}),lo=k.forwardRef(({className:e="",...t},r)=>d.jsx("hr",{ref:r,className:e,...t})),Zc=k.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("header",{ref:n,className:t,...r,children:e})),Za=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,io=e=>{const t=Za(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},Qc=()=>{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=Qc(),[f,h]=k.useState(l),[c,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=()=>Za(f)==="dark"?Je.Moon:Je.Sun;return d.jsxs(W,{ref:u,className:`relative ${t}`,id:a,...s,children:[d.jsx(Q,{onClick:()=>i(!c),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:d.jsx(de,{name:p(),className:"w-5 h-5"})}),c&&d.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:d.jsxs(W,{className:"py-2",children:[d.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:[d.jsx(de,{name:Je.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(R,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),f==="auto"&&d.jsx(de,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.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:[d.jsx(de,{name:Je.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(R,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),f==="light"&&d.jsx(de,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.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:[d.jsx(de,{name:Je.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(R,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),f==="dark"&&d.jsx(de,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Jc=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:hn,default:hn},Symbol.toStringTag,{value:"Module"})),Qa={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"},Rc="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",ed="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 c=r??e?.avatar,i=a??t??e?.name??"?",u=s||e?.status==="withdrawn",g=l||e?.is_guest||!1,p=k.useMemo(()=>[Qa[n]||Qa.md,Rc,u?ed:"",o].filter(Boolean).join(" "),[n,u,o]),m=g?co.guest:u?co.withdrawn:co.normal,w=()=>g?d.jsx(W,{className:`w-full h-full flex items-center justify-center ${m}`,children:d.jsx(de,{name:"user",className:"text-gray-400 dark:text-gray-500"})}):u?d.jsx(W,{className:`w-full h-full flex items-center justify-center ${m}`,children:d.jsx(de,{name:"user",className:"text-gray-500 dark:text-gray-400"})}):d.jsx(W,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${m}`,children:i.charAt(0).toUpperCase()});return d.jsx(W,{className:p,id:f,...h,children:c&&!g&&!u?d.jsx(Lt,{src:c,alt:i,className:"w-full h-full object-cover"}):w()})},td=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Ur},Symbol.toStringTag,{value:"Module"})),rd=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 Ja(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},[]),c=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:(c(),p.subscribeToSlot(e,()=>{c(),f({})}))},[e,h,c]);const i=k.useCallback(()=>{const p=window.G7Core;return p?p.getDynamicRenderer?.():null},[]);if(s.length===0)return r?d.jsx(W,{className:t,style:n,id:o,children:r}):a?d.jsx(W,{className:t,style:n,id:o,children:a}):null;const u=i(),g=window.G7Core;return!u||!g?(rd.error("G7Core or DynamicRenderer not available"),null):d.jsxs(W,{className:t,style:n,id:o,children:[s.map(p=>{const{componentDef:m,dataContext:w,parentFormContext:C,getParentComponentContext:O,translationContext:v}=p,E=Ja(m,o);return d.jsx(u,{componentDef:E,dataContext:w,translationContext:v,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:O?.(),parentFormContextProp:C,isRootRenderer:!1},E.id||`slot-${e}-${p.order}`)}),a]})},nd=Object.freeze(Object.defineProperty({__proto__:null,SlotContainer:pn,default:pn,scopeSlotChildDef:Ja},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:c,onClose:i,onLoadMore:u,onMarkAllRead:g,onDeleteAll:p,onDelete:m,onUnreadOnlyToggle:w,dropdownAlign:C="right",className:O="",id:v,editorAttrs:E})=>{const[I,_]=k.useState(!1),M=k.useRef(null),x=k.useRef(null),y=k.useRef(null),T=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(!T.current||!y.current||!I)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:y.current,threshold:.1});return G.observe(T.current),()=>G.disconnect()},[I]),k.useEffect(()=>{if(!y.current||!I)return;const G=new IntersectionObserver(B=>{B.forEach(K=>{const j=K.target.getAttribute("data-notification-id"),H=K.target.getAttribute("data-unread")==="true";j&&H&&K.isIntersecting&&A.current.add(j)})},{root:y.current,threshold:.5});return y.current.querySelectorAll("[data-notification-id]").forEach(B=>G.observe(B)),()=>G.disconnect()},[I,e]);const b=t>0?t:e.filter(G=>!G.read).length,F=k.useCallback(()=>{if(I){if(b>0){const G=Array.from(A.current).filter(Y=>{const B=e.find(K=>String(K.id)===String(Y));return B&&!B.read});G.length>0&&i?.(G)}A.current.clear(),_(!1)}},[I,i,b,e]);k.useEffect(()=>{if(!I)return;const G=Y=>{M.current&&!M.current.contains(Y.target)&&F()};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[I,F]);const $=k.useCallback(()=>{I?F():_(!0)},[I,F]);return k.useLayoutEffect(()=>{const G=x.current;if(!I||!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 K=8;let j=0;Y.right>B-K?j=-(Y.right-(B-K)):Y.left<K&&(j=K-Y.left),j!==0&&(G.style.transform=`translateX(${j}px)`)},[I,C,e.length]),d.jsxs(W,{ref:M,className:`relative ${O}`,id:v,...E,children:[d.jsxs(Q,{onClick:$,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:[d.jsx(de,{name:Je.Bell,className:"w-5 h-5"}),b>0&&d.jsx(R,{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})]}),I&&d.jsxs(W,{ref:x,className:`absolute ${C==="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:[d.jsxs(W,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[d.jsxs(W,{className:"flex items-center gap-3 min-w-0",children:[d.jsx(R,{className:"font-semibold text-gray-900 dark:text-white",children:o}),w&&d.jsxs(W,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>w(!h),children:[d.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"}),d.jsx(R,{className:"text-xs text-gray-600 dark:text-gray-400",children:f})]})]}),d.jsxs(W,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&b>0&&d.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&&d.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})]})]}),d.jsx(W,{ref:y,className:"max-h-96 overflow-y-auto",children:e.length===0&&!n?d.jsx(W,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:d.jsx(R,{children:a})}):d.jsxs(d.Fragment,{children:[e.map(G=>{const Y=!G.read;return d.jsxs(W,{"data-notification-id":G.id,"data-unread":Y?"true":"false",onClick:()=>{G.onClick?.(),c?.(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&&d.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"}`}),d.jsxs(W,{className:"flex-1 min-w-0",children:[d.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}),d.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}),d.jsx(W,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:G.time})]}),d.jsxs(W,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[Y&&d.jsx(R,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),m&&d.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:d.jsx(de,{name:Je.Trash,className:"w-4 h-4"})})]})]},G.id)}),r&&d.jsx(W,{ref:T,className:"px-4 py-3 text-center",children:n?d.jsx(R,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):d.jsx(R,{className:"text-sm text-gray-400 dark:text-gray-500"})}),n&&!r&&e.length>0&&d.jsx(W,{className:"px-4 py-2 text-center",children:d.jsx(R,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},od=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}})},Ra=({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:c="/shop",className:i="",editorAttrs:u,notifications:g=[],notificationHasMore:p=!1,notificationLoading:m=!1,notificationUnreadOnly:w=!1,notificationTitleText:C,notificationEmptyText:O,notificationMarkAllReadText:v,notificationDeleteAllText:E,notificationUnreadOnlyText:I,onNotificationClose:_,onNotificationClick:M,onNotificationLoadMore:x,onNotificationMarkAllRead:y,onNotificationDeleteAll:T,onNotificationDelete:A,onNotificationUnreadOnlyToggle:P})=>{const[D,L]=k.useState(""),[U,S]=k.useState(!1),[b,F]=k.useState(!1),[$,G]=k.useState(!1),[Y,B]=k.useState({top:0,left:0}),[K,j]=k.useState(window.location.pathname),H=k.useRef(null),q=k.useRef(null),ue=k.useRef(null),fe=window.G7Core?.useResponsive,ee=fe?.(),ke=ee?ee.width<768:typeof window<"u"&&window.innerWidth<768;k.useEffect(()=>{const V=()=>j(window.location.pathname);window.addEventListener("popstate",V);const re=history.pushState;return history.pushState=function(...oe){re.apply(this,oe),j(window.location.pathname)},()=>{window.removeEventListener("popstate",V),history.pushState=re}},[]);const me=(V,re=!1)=>re?K===V:K===V||K.startsWith(V+"/"),Ge=()=>{const V=c==="/"?"":c;return K.startsWith(`${V}/products`)||K.startsWith(`${V}/cart`)||K.startsWith(`${V}/checkout`)||K.startsWith(`${V}/category`)},De=V=>{const re="px-3 py-2 text-sm font-medium whitespace-nowrap cursor-pointer rounded-lg transition-colors";return V?`${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 V=re=>{H.current&&!H.current.contains(re.target)&&S(!1),q.current&&!q.current.contains(re.target)&&F(!1),ue.current&&!ue.current.contains(re.target)&&G(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[]);const ye=a.slice(0,s),Me=a.slice(s),Ce=V=>{V.preventDefault(),D.trim()&&pt(`/search?q=${encodeURIComponent(D)}`)},we=async()=>{window.G7Core?.dispatch?.({handler:"logout"})},Fe=V=>{window.G7Core?.dispatch?.({handler:"setLocale",target:V}),G(!1)},Le=V=>window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[V]??(V==="ko"?"한국어":V==="en"?"English":V==="ja"?"日本語":V==="zh"?"中文":V==="es"?"Español":V==="fr"?"Français":V==="de"?"Deutsch":V.toUpperCase());return d.jsxs(Zc,{...u??{},className:`sticky top-0 z-50 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 ${i}`,children:[d.jsx(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(W,{className:"flex items-center justify-between h-16",children:[d.jsx(Q,{onClick:()=>pt("/"),className:"flex items-center gap-2 flex-shrink-0 cursor-pointer",children:e?d.jsx(Lt,{src:e,alt:t,className:"h-8"}):d.jsx(R,{className:"text-xl font-bold text-gray-900 dark:text-white",children:t})}),!ke&&d.jsx(so,{onSubmit:Ce,className:"flex flex-1 max-w-lg mx-8",children:d.jsxs(W,{className:"relative w-full",children:[d.jsx(xt,{type:"text",value:D,onChange:V=>L(V.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"}),d.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"})]})}),d.jsxs(W,{className:"flex items-center gap-2",children:[d.jsx(hn,{autoText:Xe("common.theme.auto"),lightText:Xe("common.theme.light"),darkText:Xe("common.theme.dark")}),r?.uuid&&d.jsx(mn,{notifications:g,unreadCount:o,hasMore:p,loading:m,unreadOnly:w,titleText:C??Xe("mypage.notifications.title"),emptyText:O??Xe("mypage.notifications.empty"),markAllReadText:v??Xe("mypage.notifications.mark_all_read"),deleteAllText:E??Xe("mypage.notifications.delete_all"),unreadOnlyText:I??Xe("mypage.notifications.unread_only"),onClose:_,onNotificationClick:M,onLoadMore:x,onMarkAllRead:y,onDeleteAll:T,onDelete:A,onUnreadOnlyToggle:P,dropdownAlign:"right"}),d.jsxs(Q,{onClick:()=>pt(`${c}/cart`),className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer",children:[d.jsx(de,{name:"shopping-cart",className:"w-5 h-5"}),n>0&&d.jsx(R,{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&&d.jsxs(W,{ref:ue,className:"relative",children:[d.jsxs(Q,{onClick:()=>G(!$),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":$,"aria-label":Xe("common.language"),children:[d.jsx(de,{name:"globe",className:"w-4 h-4"}),d.jsx(R,{className:"font-medium uppercase",children:h}),d.jsx(de,{name:"chevron-down",className:"w-3 h-3"})]}),$&&d.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(V=>{const re=V===h;return d.jsxs(Q,{role:"option","aria-selected":re,onClick:()=>Fe(V),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:[d.jsx(de,{name:"globe",className:"w-4 h-4"}),d.jsx(R,{className:"flex-1 font-medium",children:Le(V)}),re&&d.jsx(de,{name:"check",className:"w-4 h-4"})]},V)})})]}),d.jsx(pn,{slotId:"header_currency",id:"header_currency_slot_desktop",className:"flex items-center"}),r?.uuid?d.jsxs(W,{ref:H,className:"relative",children:[d.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:[d.jsx(Ur,{avatar:r.avatar,name:r.name,size:"sm"}),d.jsx(R,{className:"hidden sm:inline text-sm font-medium",children:r.name}),d.jsx(de,{name:"chevron-down",className:"w-4 h-4"})]}),U&&d.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:[d.jsx(W,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:d.jsxs(W,{className:"flex items-center gap-3",children:[d.jsx(Ur,{avatar:r.avatar,name:r.name,size:"md"}),d.jsxs(W,{children:[d.jsx(W,{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.name}),d.jsx(W,{className:"text-xs text-gray-500 dark:text-gray-400",children:Xe("common.member")})]})]})}),d.jsxs(W,{className:"py-1",children:[r.is_admin&&d.jsxs(d.Fragment,{children:[d.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:[d.jsx(de,{name:"settings",className:"inline w-4 h-4 mr-2"}),Xe("common.admin_menu")]}),d.jsx(lo,{className:"my-1 border-gray-200 dark:border-gray-700"})]}),d.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:[d.jsx(de,{name:"user",className:"inline w-4 h-4 mr-2"}),Xe("common.mypage")]}),d.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:[d.jsx(de,{name:"shopping-bag",className:"inline w-4 h-4 mr-2"}),Xe("mypage.tabs.orders")]}),d.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:[d.jsx(de,{name:"heart",className:"inline w-4 h-4 mr-2"}),Xe("mypage.tabs.wishlist")]})]}),d.jsx(lo,{className:"my-1 border-gray-200 dark:border-gray-700"}),d.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:[d.jsx(de,{name:"log-out",className:"inline w-4 h-4 mr-2"}),Xe("auth.logout")]})]})]}):d.jsxs(W,{className:"flex items-center gap-1.5",children:[d.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")}),d.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")}),d.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&&d.jsx(Q,{onClick:l,className:"p-2 text-gray-600 dark:text-gray-400",children:d.jsx(de,{name:"menu",className:"w-6 h-6"})})]})]})}),!ke&&d.jsx(Fr,{className:"border-t border-gray-200 dark:border-gray-800",children:d.jsx(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs(W,{className:"flex items-center gap-1 h-12 overflow-x-auto",children:[d.jsx(Q,{onClick:()=>pt("/"),className:De(me("/",!0)),"data-testid":"nav-home",children:Xe("nav.home")}),d.jsxs(Q,{onClick:()=>pt("/boards/popular"),className:`flex items-center gap-1 ${De(me("/boards/popular"))}`,"data-testid":"nav-popular",children:[d.jsx(R,{className:"text-orange-500",children:"🔥"}),Xe("nav.popular")]}),d.jsxs(Q,{onClick:()=>pt(`${c==="/"?"":c}/products`),className:`flex items-center gap-1 ${De(Ge())}`,"data-testid":"nav-shop",children:[d.jsx(R,{children:"🛒"}),Xe("nav.shop")]}),ye.map(V=>d.jsxs(Q,{onClick:()=>pt(`/board/${V.slug}`),className:De(me(`/board/${V.slug}`)),children:[V.icon&&d.jsx(R,{className:"mr-1",children:V.icon}),V.name]},V.id)),Me.length>0&&d.jsxs(W,{ref:q,className:"relative",children:[d.jsxs(Q,{onClick:()=>{if(!b&&q.current){const V=q.current.getBoundingClientRect();B({top:V.bottom+4,left:V.left})}F(!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"),d.jsx(de,{name:"chevron-down",className:"w-4 h-4"})]}),b&&d.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(V=>{const re=me(`/board/${V.slug}`);return d.jsxs(Q,{onClick:()=>{pt(`/board/${V.slug}`),F(!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:[V.icon&&d.jsx(R,{className:"mr-1",children:V.icon}),V.name]},V.id)})})]})]})})})]})},ad=Object.freeze(Object.defineProperty({__proto__:null,default:Ra},Symbol.toStringTag,{value:"Module"})),sd=k.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("footer",{ref:n,className:t,...r,children:e})),kt=(e,t)=>window.G7Core?.t?.(e,t)??e,ld=768,es=1024,id=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ts=({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:es),u=i<ld,g=i>=es,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,C={github:"github",twitter:"twitter",discord:"discord",facebook:"facebook",instagram:"instagram"};return d.jsx(sd,{...s??{},className:`bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-800 ${a}`,children:d.jsxs(W,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[d.jsxs(W,{className:"grid gap-8",style:{gridTemplateColumns:`repeat(${p}, minmax(0, 1fr))`},children:[d.jsxs(W,{style:g?{gridColumn:"span 2 / span 2"}:void 0,children:[d.jsx(gn,{className:"text-lg font-bold text-gray-900 dark:text-white",children:e}),t&&d.jsx(Dt,{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:t}),d.jsx(W,{className:"mt-4 flex items-center gap-4",children:Object.entries(n).map(([O,v])=>v?d.jsx(ao,{href:v,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:d.jsx(de,{name:C[O],className:"w-5 h-5"})},O):null)})]}),w.map((O,v)=>d.jsxs(W,{children:[d.jsx(Ka,{className:"text-sm font-semibold text-gray-900 dark:text-white uppercase tracking-wider",children:O.title}),d.jsx(oo,{className:"mt-4 space-y-2",children:O.links.map((E,I)=>d.jsx(Xt,{children:d.jsx(Q,{onClick:()=>id(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})},I))})]},v))]}),d.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:[d.jsx(Dt,{className:"text-sm text-gray-500 dark:text-gray-400",children:r||`© ${l} ${e}. All rights reserved.`}),d.jsx(Dt,{className:"text-sm text-gray-500 dark:text-gray-400",children:kt("footer.powered_by")})]})]})})},cd=Object.freeze(Object.defineProperty({__proto__:null,default:ts},Symbol.toStringTag,{value:"Module"})),Pt=(e,t)=>window.G7Core?.t?.(e,t)??e,Tt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},rs=({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,c=h?.(),i=c?c.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:d.jsxs(W,{className:"fixed inset-0 z-50",onClick:u,children:[d.jsx(W,{className:"fixed inset-0 bg-black/50 transition-opacity"}),d.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:[d.jsxs(W,{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-800",children:[d.jsx(Q,{onClick:()=>{t(),Tt("/")},className:"flex items-center gap-2 cursor-pointer",children:r?d.jsx(Lt,{src:r,alt:n,className:"h-8"}):d.jsx(R,{className:"text-xl font-bold text-gray-900 dark:text-white",children:n})}),d.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:d.jsx(de,{name:"x",className:"w-6 h-6"})})]}),o?d.jsx(W,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(W,{className:"flex items-center gap-3",children:[o.avatar?d.jsx(Lt,{src:o.avatar,alt:o.name,className:"w-12 h-12 rounded-full"}):d.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()}),d.jsxs(W,{children:[d.jsx(Dt,{className:"font-medium text-gray-900 dark:text-white",children:o.name}),d.jsx(Q,{onClick:()=>{t(),Tt("/mypage")},className:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:Pt("common.mypage")})]})]})}):d.jsx(W,{className:"p-4 border-b border-gray-200 dark:border-gray-800",children:d.jsxs(W,{className:"flex gap-2",children:[d.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")}),d.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")})]})}),d.jsx(Fr,{className:"p-4 overflow-y-auto max-h-[calc(100vh-200px)]",children:d.jsxs(oo,{className:"space-y-1",children:[d.jsx(Xt,{children:d.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:[d.jsx(de,{name:"home",className:"w-5 h-5"}),Pt("nav.home")]})}),d.jsx(Xt,{children:d.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:[d.jsx(R,{className:"text-orange-500",children:"🔥"}),Pt("nav.popular")]})}),d.jsx(Xt,{children:d.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:[d.jsx(R,{children:"🛒"}),Pt("nav.shop")]})}),d.jsx(Xt,{children:d.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:[d.jsx(de,{name:"shopping-cart",className:"w-5 h-5"}),Pt("nav.cart"),s>0&&d.jsx(R,{className:"ml-auto px-2 py-0.5 text-xs bg-blue-500 text-white rounded-full",children:s})]})}),d.jsx(Xt,{className:"my-4 border-t border-gray-200 dark:border-gray-800"}),d.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=>d.jsx(Xt,{children:d.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&&d.jsx(R,{children:g.icon}),g.name]})},g.id))]})}),d.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:d.jsxs(W,{className:"flex items-center justify-between text-sm text-gray-500 dark:text-gray-400",children:[d.jsx(Q,{onClick:()=>{t(),Tt("/about")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Pt("footer.about")}),d.jsx(Q,{onClick:()=>{t(),Tt("/terms")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Pt("footer.terms")}),d.jsx(Q,{onClick:()=>{t(),Tt("/privacy")},className:"hover:text-gray-700 dark:hover:text-gray-200 cursor-pointer",children:Pt("footer.privacy")})]})})]})]})},dd=Object.freeze(Object.defineProperty({__proto__:null,default:rs},Symbol.toStringTag,{value:"Module"}));const{entries:ns,setPrototypeOf:os,isFrozen:ud,getPrototypeOf:fd,getOwnPropertyDescriptor:gd}=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),hd=ht(Array.prototype.lastIndexOf),as=ht(Array.prototype.pop),zr=ht(Array.prototype.push),pd=ht(Array.prototype.splice),yn=ht(String.prototype.toLowerCase),ho=ht(String.prototype.toString),po=ht(String.prototype.match),Hr=ht(String.prototype.replace),md=ht(String.prototype.indexOf),bd=ht(String.prototype.trim),$t=ht(Object.prototype.hasOwnProperty),gt=ht(RegExp.prototype.test),Gr=yd(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 yd(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;os&&os(e,null);let n=t.length;for(;n--;){let o=t[n];if(typeof o=="string"){const a=r(o);a!==o&&(ud(t)||(t[n]=a),o=a)}e[o]=!0}return e}function vd(e){for(let t=0;t<e.length;t++)$t(e,t)||(e[t]=null);return e}function Vt(e){const t=uo(null);for(const[r,n]of ns(e))$t(e,r)&&(Array.isArray(n)?t[r]=vd(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=Vt(n):t[r]=n);return t}function jr(e,t){for(;e!==null;){const n=gd(e,t);if(n){if(n.get)return ht(n.get);if(typeof n.value=="function")return ht(n.value)}e=fd(e)}function r(){return null}return r}const ss=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"]),wd=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"]),xd=ft(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ls=ft(["#text"]),is=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"]),cs=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"]),kd=Nt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Cd=Nt(/<%[\w\W]*|[\w\W]*%>/gm),Sd=Nt(/\$\{[\w\W]*/gm),_d=Nt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ed=Nt(/^aria-[\-\w]+$/),ds=Nt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Td=Nt(/^(?:\w+script|data):/i),Nd=Nt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),us=Nt(/^html$/i),Ad=Nt(/^[a-z][.\w]*(-[.\w]+)+$/i);var fs=Object.freeze({__proto__:null,ARIA_ATTR:Ed,ATTR_WHITESPACE:Nd,CUSTOM_ELEMENT:Ad,DATA_ATTR:_d,DOCTYPE_NAME:us,ERB_EXPR:Cd,IS_ALLOWED_URI:ds,IS_SCRIPT_OR_DATA:Td,MUSTACHE_EXPR:kd,TMPLIT_EXPR:Sd});const Br={element:1,text:3,progressingInstruction:7,comment:8,document:9},Md=function(){return typeof window>"u"?null:window},Od=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}},gs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function hs(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Md();const t=ge=>hs(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:c=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:i,DOMParser:u,trustedTypes:g}=e,p=f.prototype,m=jr(p,"cloneNode"),w=jr(p,"remove"),C=jr(p,"nextSibling"),O=jr(p,"childNodes"),v=jr(p,"parentNode");if(typeof s=="function"){const ge=r.createElement("template");ge.content&&ge.content.ownerDocument&&(r=ge.content.ownerDocument)}let E,I="";const{implementation:_,createNodeIterator:M,createDocumentFragment:x,getElementsByTagName:y}=r,{importNode:T}=n;let A=gs();t.isSupported=typeof ns=="function"&&typeof v=="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:F,CUSTOM_ELEMENT:$}=fs;let{IS_ALLOWED_URI:G}=fs,Y=null;const B=Ae({},[...ss,...mo,...bo,...yo,...ls]);let K=null;const j=Ae({},[...is,...vo,...cs,...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,ee=!0,ke=!1,me=!0,Ge=!1,De=!0,ye=!1,Me=!1,Ce=!1,we=!1,Fe=!1,Le=!1,V=!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 Ve=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"],Ke="text/html";let $e=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=Vt(z),he=Ne.indexOf(z.PARSER_MEDIA_TYPE)===-1?Ke:z.PARSER_MEDIA_TYPE,$e=he==="application/xhtml+xml"?ho:yn,Y=$t(z,"ALLOWED_TAGS")?Ae({},z.ALLOWED_TAGS,$e):B,K=$t(z,"ALLOWED_ATTR")?Ae({},z.ALLOWED_ATTR,$e):j,Se=$t(z,"ALLOWED_NAMESPACES")?Ae({},z.ALLOWED_NAMESPACES,ho):_e,X=$t(z,"ADD_URI_SAFE_ATTR")?Ae(Vt(se),z.ADD_URI_SAFE_ATTR,$e):se,Ve=$t(z,"ADD_DATA_URI_TAGS")?Ae(Vt(Oe),z.ADD_DATA_URI_TAGS,$e):Oe,He=$t(z,"FORBID_CONTENTS")?Ae({},z.FORBID_CONTENTS,$e):Pe,q=$t(z,"FORBID_TAGS")?Ae({},z.FORBID_TAGS,$e):Vt({}),ue=$t(z,"FORBID_ATTR")?Ae({},z.FORBID_ATTR,$e):Vt({}),xe=$t(z,"USE_PROFILES")?z.USE_PROFILES:!1,fe=z.ALLOW_ARIA_ATTR!==!1,ee=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,Fe=z.RETURN_DOM_FRAGMENT||!1,Le=z.RETURN_TRUSTED_TYPE||!1,Ce=z.FORCE_BODY||!1,V=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||ds,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&&(ee=!1),Fe&&(we=!0),xe&&(Y=Ae({},ls),K=[],xe.html===!0&&(Ae(Y,ss),Ae(K,is)),xe.svg===!0&&(Ae(Y,mo),Ae(K,vo),Ae(K,vn)),xe.svgFilters===!0&&(Ae(Y,bo),Ae(K,vo),Ae(K,vn)),xe.mathMl===!0&&(Ae(Y,yo),Ae(K,cs),Ae(K,vn))),z.ADD_TAGS&&(typeof z.ADD_TAGS=="function"?te.tagCheck=z.ADD_TAGS:(Y===B&&(Y=Vt(Y)),Ae(Y,z.ADD_TAGS,$e))),z.ADD_ATTR&&(typeof z.ADD_ATTR=="function"?te.attributeCheck=z.ADD_ATTR:(K===j&&(K=Vt(K)),Ae(K,z.ADD_ATTR,$e))),z.ADD_URI_SAFE_ATTR&&Ae(X,z.ADD_URI_SAFE_ATTR,$e),z.FORBID_CONTENTS&&(He===Pe&&(He=Vt(He)),Ae(He,z.FORBID_CONTENTS,$e)),z.ADD_FORBID_CONTENTS&&(He===Pe&&(He=Vt(He)),Ae(He,z.ADD_FORBID_CONTENTS,$e)),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,I=E.createHTML("")}else E===void 0&&(E=Od(g,o)),E!==null&&typeof I=="string"&&(I=E.createHTML(""));ft&&ft(z),Be=z}},jt=Ae({},[...mo,...bo,...wd]),_t=Ae({},[...yo,...xd]),Bt=function(z){let Z=v(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{v(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||Fe)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?I:Ye}catch{}}const ut=Z.body||Z.documentElement;return z&&ce&&ut.insertBefore(r.createTextNode(ce),ut.childNodes[0]||null),Te===ne?y.call(Z,ye?"html":"body")[0]:ye?Z.documentElement:ut},nr=function(z){return M.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 c)||typeof z.removeAttribute!="function"||typeof z.setAttribute!="function"||typeof z.namespaceURI!="string"||typeof z.insertBefore!="function"||typeof z.hasChildNodes!="function")},Ec=function(z){return typeof l=="function"&&z instanceof l};function Zt(ge,z,Z){bn(ge,ce=>{ce.call(t,z,Z,Be)})}const Tc=function(z){let Z=null;if(Zt(A.beforeSanitizeElements,z,null),mr(z))return dt(z),!0;const ce=$e(z.nodeName);if(Zt(A.uponSanitizeElement,z,{tagName:ce,allowedTags:Y}),De&&z.hasChildNodes()&&!Ec(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]&&Ac(ce)&&(H.tagNameCheck instanceof RegExp&>(H.tagNameCheck,ce)||H.tagNameCheck instanceof Function&&H.tagNameCheck(ce)))return!1;if(ae&&!He[ce]){const Ye=v(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,C(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)},Nc=function(z,Z,ce){if(V&&(Z==="id"||Z==="name")&&(ce in r||ce in Ze))return!1;if(!(ee&&!ue[Z]&>(U,Z))){if(!(fe&>(S,Z))){if(!(te.attributeCheck instanceof Function&&te.attributeCheck(Z,z))){if(!K[Z]||ue[Z]){if(!(Ac(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,F,""))){if(!((Z==="src"||Z==="xlink:href"||Z==="href")&&z!=="script"&&md(ce,"data:")===0&&Ve[z])){if(!(ke&&!gt(b,Hr(ce,F,"")))){if(ce)return!1}}}}}}}return!0},Ac=function(z){return z!=="annotation-xml"&&po(z,$)},Mc=function(z){Zt(A.beforeSanitizeAttributes,z,null);const{attributes:Z}=z;if(!Z||mr(z))return;const ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let Ye=Z.length;for(;Ye--;){const ut=Z[Ye],{name:Qe,namespaceURI:wt,value:Qt}=ut,$r=$e(Qe),Ga=Qt;let st=Qe==="value"?Ga:bd(Ga);if(ce.attrName=$r,ce.attrValue=st,ce.keepAttr=!0,ce.forceKeepAttr=void 0,Zt(A.uponSanitizeAttribute,z,ce),st=ce.attrValue,re&&($r==="id"||$r==="name")&&(Et(Qe,z),st=oe+st),De&>(/((--!?|])>)|<\/(style|title|textarea)/i,st)){Et(Qe,z);continue}if($r==="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],Ic=>{st=Hr(st,Ic," ")});const Oc=$e(z.nodeName);if(!Nc(Oc,$r,st)){Et(Qe,z);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!wt)switch(g.getAttributeType(Oc,$r)){case"TrustedHTML":{st=E.createHTML(st);break}case"TrustedScriptURL":{st=E.createScriptURL(st);break}}if(st!==Ga)try{wt?z.setAttributeNS(wt,Qe,st):z.setAttribute(Qe,st),mr(z)?dt(z):as(t.removed)}catch{Et(Qe,z)}}Zt(A.afterSanitizeAttributes,z,null)},Vp=function ge(z){let Z=null;const ce=nr(z);for(Zt(A.beforeSanitizeShadowDOM,z,null);Z=ce.nextNode();)Zt(A.uponSanitizeShadowNode,Z,null),Tc(Z),Mc(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"&&!Ec(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=$e(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?I:""}Z&&Ce&&dt(Z.firstChild);const Qe=nr(be?ge:Z);for(;Ye=Qe.nextNode();)Tc(Ye),Mc(Ye),Ye.content instanceof a&&Vp(Ye.content);if(be)return ge;if(we){if(Fe)for(ut=x.call(Z.ownerDocument);Z.firstChild;)ut.appendChild(Z.firstChild);else ut=Z;return(K.shadowroot||K.shadowrootmode)&&(ut=T.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&>(us,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=$e(ge),Ye=$e(z);return Nc(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=hd(A[ge],z);return Z===-1?void 0:pd(A[ge],Z,1)[0]}return as(A[ge])},t.removeHooks=function(ge){A[ge]=[]},t.removeAllHooks=function(){A=gs()},t}var wo=hs();const Id=()=>{const e=()=>{const n=window.G7Core?.state?.get?.();return n&&(n.preferredCurrency||n.defaultCurrency)||""},[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||a.defaultCurrency)||"")});return typeof o=="function"?o:void 0},[]),t},Dd=(e,t=!1)=>{window.G7Core?.dispatch?.({handler:"navigate",params:t?{path:e,mergeQuery:!0,query:{}}:{path:e}})},Ld=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},ps=({product:e,onClick:t,shopBase:r="/shop",preserveListQuery:n=!1,className:o="",id:a,editorAttrs:s})=>{const l=Id(),f=v=>{const E=`multi_currency_${v}`,I=e[E];if(I&&I[l])return I[l].formatted;const _=`${v}_formatted`;return e[_]},h=e.name_localized??(typeof e.name=="string"?e.name:"")??"",c=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=v=>wo.sanitize(v,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),w=e.name_highlighted,C=e.description_highlighted??e.short_description,O=()=>{if(t)t(e.id);else{const v=r==="/"?"":r,E=e.product_code??e.id;Dd(`${v}/products/${E}`,n)}};return d.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:[d.jsxs(W,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[d.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&&d.jsx(W,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:d.jsx(R,{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"&&d.jsxs(R,{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&&d.jsx(W,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:p.map((v,E)=>d.jsx(R,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:v.color||"#6b7280"},children:v.name},E))})]}),d.jsxs(W,{className:"p-4",children:[d.jsxs(W,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&d.jsx(R,{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&&d.jsx(R,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),w?d.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)}}):d.jsx(gn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:h}),C&&d.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(C)}}),d.jsxs(W,{className:"mt-1.5 flex items-center gap-1",children:[Ld(e.rating_avg??0).map((v,E)=>d.jsxs(R,{className:`text-xs ${v==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[v==="full"&&d.jsx("i",{className:"fa-solid fa-star"}),v==="half"&&d.jsx("i",{className:"fa-solid fa-star-half-stroke"}),v==="empty"&&d.jsx("i",{className:"fa-regular fa-star"})]},E)),d.jsx(R,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),d.jsxs(R,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),d.jsxs(W,{className:"mt-2 flex items-baseline gap-2",children:[d.jsx(R,{className:"font-bold text-gray-900 dark:text-white",children:c}),i&&u&&d.jsx(R,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:i})]})]})]})},Pd=Object.freeze(Object.defineProperty({__proto__:null,default:ps},Symbol.toStringTag,{value:"Module"})),$d={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,$d),[a]),f={width:`${t}px`,height:`${t}px`,flex:`0 0 ${t}px`};if(l)return d.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 d.jsx(R,{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"})),ms="carousel",Wr="controller",Ud="navigation",zd="no-scroll",ko="portal",Hd="root",bs="toolbar",Gd="counter",Vr="fullscreen",ys="slideshow",Kr="thumbnails",vs="zoom",vr="loading",Co="playing",Yr="error",Xr="complete",jd="placeholder",qr=e=>`active-slide-${e}`,Bd=qr(vr),Wd=qr(Co),Vd=qr(Yr),Kd=qr(Xr),ws="fullsize",wr="flex_center",Yd="no_scroll",xs="no_scroll_padding",So="slide",ks="slide_wrapper",Xd="slide_wrapper_interactive",Rt="prev",er="next",_o="swipe",xr="close",Cs="onPointerDown",Ss="onPointerMove",_s="onPointerUp",Es="onPointerLeave",Ts="onPointerCancel",Eo="onKeyDown",qd="onKeyUp",To="onWheel",Zd="Escape",Qd="ArrowLeft",Jd="ArrowRight",Rd="button",wn="icon",Ns="contain",As="cover",Ms="Unknown action type",Os="yarl__";function lt(...e){return[...e].filter(Boolean).join(" ")}function pe(e){return`${Os}${e}`}function We(e){return`--${Os}${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 Is(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=N.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===As||e.imageFit!==Ns&&t===As}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 eu(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 tu(){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 Ds(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=N.isValidElement(r)?N.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 Ls(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const ru=Number(N.version.split(".")[0])>=19;function nu(e){return{inert:ru?e:e?"":void 0}}function ou(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:Ns,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 Ps(e,t,r){return e.module.name===t?r(e):e.children?[tt(e.module,e.children.flatMap(n=>{var o;return(o=Ps(n,t,r))!==null&&o!==void 0?o:[]}))]:[e]}function Cr(e,t,r){return e.flatMap(n=>{var o;return(o=Ps(n,t,r))!==null&&o!==void 0?o:[]})}function au(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 C;return[tt(w.module,[...m?[tt(p)]:[],...(C=w.children)!==null&&C!==void 0?C:[],...m?[]:[tt(p)]])]})},f=(g,p,m)=>{n=Cr(n,g,w=>[...m?[tt(p)]:[],w,...m?[]:[tt(p)]])},h=g=>{s(Wr,g)},c=(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:c,remove:i,augment:u})}),{config:n,augmentation:g=>r.reduce((p,m)=>m(p),g)}}const $s=N.createContext(null),$o=At("useA11yContext","A11yContext",$s);function su({children:e}){const[t,r]=N.useState(!1),[n,o]=N.useState(!1),a=N.useMemo(()=>({focusWithin:t,trackFocusWithin:(l,f)=>{const h=c=>i=>{var u;i.currentTarget.contains(i.relatedTarget)||r(c),(u=c?l:f)===null||u===void 0||u(i)};return{onFocus:h(!0),onBlur:h(!1)}},autoPlaying:n,setAutoPlaying:o}),[t,n]);return N.createElement($s.Provider,{value:a},e)}const Fs=N.createContext(null),Sr=At("useDocument","DocumentContext",Fs);function lu({nodeRef:e,children:t}){const r=N.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 N.createElement(Fs.Provider,{value:r},t)}const Us=N.createContext(null),_r=At("useEvents","EventsContext",Us);function iu({children:e}){const[t]=N.useState({});N.useEffect(()=>()=>{Object.keys(t).forEach(n=>delete t[n])},[t]);const r=N.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 N.createElement(Us.Provider,{value:r},e)}const zs=N.createContext(null),rt=At("useLightboxProps","LightboxPropsContext",zs);function Hs({children:e,...t}){return N.createElement(zs.Provider,{value:t},e)}const Gs=N.createContext(null),Ot=At("useLightboxState","LightboxStateContext",Gs),js=N.createContext(null),cu=At("useLightboxDispatch","LightboxDispatchContext",js);function du(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(Ms)}}function uu({slides:e,index:t,children:r}){const[n,o]=N.useReducer(du,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Lo(e,t)});N.useEffect(()=>{o({type:"update",slides:e,index:t})},[e,t]);const a=N.useMemo(()=>({...n,state:n,dispatch:o}),[n,o]);return N.createElement(js.Provider,{value:o},N.createElement(Gs.Provider,{value:a},r))}const Bs=N.createContext(null),Zr=At("useTimeouts","TimeoutsContext",Bs);function fu({children:e}){const[t]=N.useState([]);N.useEffect(()=>()=>{t.forEach(n=>window.clearTimeout(n)),t.splice(0,t.length)},[t]);const r=N.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 N.createElement(Bs.Provider,{value:r},e)}const Er=N.forwardRef(function({label:t,className:r,icon:n,renderIcon:o,onClick:a,style:s,...l},f){const{styles:h,labels:c}=rt(),i=sr(c,t);return N.createElement("button",{ref:f,type:"button",title:i,"aria-label":i,className:lt(pe(Rd),r),onClick:a,style:{...s,...h.button},...l},o?o():N.createElement(n,{className:pe(wn),style:h.icon}))});function Ws(e,t){const r=n=>N.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 Ws(e,N.createElement("g",{fill:"currentColor"},N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}function gu(e,t){return Ws(e,N.createElement(N.Fragment,null,N.createElement("defs",null,N.createElement("mask",{id:"strike"},N.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),N.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),N.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),N.createElement("g",{fill:"currentColor",mask:"url(#strike)"},N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t)))}const hu=mt("Close",N.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"})),pu=mt("Previous",N.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),mu=mt("Next",N.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),bu=mt("Loading",N.createElement(N.Fragment,null,Array.from({length:8}).map((e,t,r)=>N.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)`})))),yu=mt("Error",N.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"})),Ft=No()?N.useLayoutEffect:N.useEffect;function Fo(){const[e,t]=N.useState(!1);return N.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 vu(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=N.useRef(void 0),n=N.useRef(void 0),o=Fo();return Ft(()=>{var a,s,l;if(e.current&&r.current!==void 0&&!o){const{keyframes:f,duration:h,easing:c,onfinish:i}=t(r.current,e.current.getBoundingClientRect(),vu(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:c})}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=N.useRef(null),t=N.useRef(void 0),[r,n]=N.useState();return{setContainerRef:N.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=N.useRef(void 0),{setTimeout:t,clearTimeout:r}=Zr();return N.useCallback((n,o)=>{r(e.current),e.current=t(n,o>0?o:0)},[t,r])}function Ie(e){const t=N.useRef(e);return Ft(()=>{t.current=e}),N.useCallback((...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function Ks(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function zo(e,t){return N.useMemo(()=>e==null&&t==null?null:r=>{Ks(e,r),Ks(t,r)},[e,t])}function Ys(e,t=!1){const r=N.useRef(!1);Ft(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const n=N.useCallback(()=>{r.current=!0},[]),o=N.useCallback(()=>{r.current=!1},[]);return{onFocus:n,onBlur:o}}function _n(){const[e,t]=N.useState(!1);return Ft(()=>{t(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),e}function Xs(){const[e]=N.useState({}),t=N.useCallback((o,a)=>{var s;(s=e[o])===null||s===void 0||s.forEach(l=>{a.isPropagationStopped()||l(a)})},[e]),r=N.useMemo(()=>({onPointerDown:o=>t(Cs,o),onPointerMove:o=>t(Ss,o),onPointerUp:o=>t(_s,o),onPointerLeave:o=>t(Es,o),onPointerCancel:o=>t(Ts,o),onKeyDown:o=>t(Eo,o),onKeyUp:o=>t(qd,o),onWheel:o=>t(To,o)}),[t]),n=N.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 qs(e,t){const r=N.useRef(0),n=Sn(),o=Ie((...a)=>{r.current=Date.now(),e(a)});return N.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 c,i,u,g,p,m,w,C;const[O,v]=N.useState(vr),{publish:E}=_r(),{setTimeout:I}=Zr(),_=N.useRef(null);N.useEffect(()=>{t===0&&E(qr(O))},[t,O,E]);const M=Ie(B=>{("decode"in B?B.decode():Promise.resolve()).catch(()=>{}).then(()=>{B.parentNode&&(v(Xr),I(()=>{l?.(B)},0))})}),x=N.useCallback(B=>{_.current=B,B?.complete&&M(B)},[M]),y=N.useCallback(B=>{M(B.currentTarget)},[M]),T=Ie(()=>{v(Yr),f?.()}),A=Mo(e,o),P=(B,K)=>Number.isFinite(B)?B:K,D=P(Math.max(...((i=(c=e.srcSet)===null||c===void 0?void 0:c.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,K)=>B.width-K.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,F=S&&n&&No()?`${Math.round(Math.min(b(),n.width))}px`:void 0,{style:$,className:G,...Y}=a||{};return N.createElement(N.Fragment,null,N.createElement("img",{ref:x,onLoad:y,onError:T,onClick:s,draggable:!1,className:lt(pe(Go()),A&&pe(Go("cover")),O!==Xr&&pe(Go("loading")),G),style:{...U,...h,...$},...Y,alt:(C=e.alt)!==null&&C!==void 0?C:"",sizes:F,srcSet:S,src:e.src}),O!==Xr&&N.createElement("div",{className:pe(Ho(jd))},O===vr&&(r?.iconLoading?r.iconLoading():N.createElement(bu,{className:lt(pe(wn),pe(Ho(vr)))})),O===Yr&&(r?.iconError?r.iconError():N.createElement(yu,{className:lt(pe(wn),pe(Ho(Yr)))}))))}const wu=N.forwardRef(function({className:t,children:r,onFocus:n,onBlur:o,...a},s){const l=N.useRef(null),{trackFocusWithin:f}=$o();return N.createElement(lu,{nodeRef:l},N.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 Zs(e,t,r,n,o){N.useEffect(()=>o?()=>{}:kr(e(Cs,t),e(Ss,r),e(_s,n),e(Es,n),e(Ts,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 xu({disableSwipeNavigation:e,closeOnBackdropClick:t},r,n,o,a,s,l,f,h,c,i,u,g,p,m,w){const C=N.useRef(0),O=N.useRef([]),v=N.useRef(void 0),E=N.useRef(0),I=N.useRef(Ut.NONE),_=N.useCallback(D=>{v.current===D.pointerId&&(v.current=void 0,I.current=Ut.NONE);const L=O.current;L.splice(0,L.length,...L.filter(U=>U.pointerId!==D.pointerId))},[]),M=N.useCallback(D=>{_(D),D.persist(),O.current.push(D)},[_]),x=N.useCallback(D=>O.current.find(({pointerId:L})=>D.pointerId===L),[]),y=Ie(D=>{M(D)}),T=(D,L)=>i&&D>L||c&&D<-L,A=Ie(D=>{const L=x(D);if(L)if(v.current===D.pointerId){const U=Date.now()-E.current,S=C.current;I.current===Ut.SWIPE?Math.abs(S)>.3*o||Math.abs(S)>5&&U<a?f(S,U):h(S):I.current===Ut.PULL&&(T(S,2*jo)?p(S,U):m(S)),C.current=0,I.current=Ut.NONE}else{const{target:U}=D;t&&U instanceof HTMLElement&&U===L.target&&(U.classList.contains(pe(So))||U.classList.contains(pe(ks)))&&w()}_(D)}),P=Ie(D=>{const L=x(D);if(L){const U=v.current===D.pointerId;if(D.buttons===0){U&&C.current!==0?A(D):_(L);return}const S=D.clientX-L.clientX,b=D.clientY-L.clientY;if(v.current===void 0){const F=$=>{M(D),v.current=D.pointerId,E.current=Date.now(),I.current=$};Math.abs(S)>Math.abs(b)&&Math.abs(S)>jo&&n(S)?e||(F(Ut.SWIPE),s()):Math.abs(b)>Math.abs(S)&&T(b,jo)&&(F(Ut.PULL),u())}else U&&(I.current===Ut.SWIPE?(C.current=S,l(S)):I.current===Ut.PULL&&(C.current=b,g(b)))}});Zs(r,y,P,A)}function ku({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=N.useRef(null),n=Ie(o=>{const a=Math.abs(o.deltaX)>Math.abs(o.deltaY);(a&&e||!a&&t||o.ctrlKey)&&o.preventDefault()});return N.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 Cu(e,t,r,n,o,a,s,l,f){const h=N.useRef(0),c=N.useRef(0),i=N.useRef(void 0),u=N.useRef(void 0),g=N.useRef(0),p=N.useRef(void 0),m=N.useRef(0),{setTimeout:w,clearTimeout:C}=Zr(),O=N.useCallback(()=>{i.current&&(C(i.current),i.current=void 0)},[C]),v=N.useCallback(()=>{u.current&&(C(u.current),u.current=void 0)},[C]),E=Ie(()=>{e!==it.SWIPE&&(h.current=0,m.current=0,O(),v())});N.useEffect(E,[e,E]);const I=Ie(M=>{u.current=void 0,h.current===M&&f(h.current)}),_=Ie(M=>{if(M.ctrlKey||Math.abs(M.deltaY)>Math.abs(M.deltaX))return;const x=y=>{g.current=y,C(p.current),p.current=y>0?w(()=>{g.current=0,p.current=void 0},300):void 0};if(e===it.NONE){if(Math.abs(M.deltaX)<=1.2*Math.abs(g.current)){x(M.deltaX);return}if(!r(-M.deltaX))return;if(c.current+=M.deltaX,O(),Math.abs(c.current)>30)c.current=0,x(0),m.current=Date.now(),a();else{const y=c.current;i.current=w(()=>{i.current=void 0,y===c.current&&(c.current=0)},o)}}else if(e===it.SWIPE){let y=h.current-M.deltaX;if(y=Math.min(Math.abs(y),n)*Math.sign(y),h.current=y,s(y),v(),Math.abs(y)>.2*n){x(M.deltaX),l(y,Date.now()-m.current);return}u.current=w(()=>I(y),2*o)}else x(M.deltaX)});N.useEffect(()=>t(To,_),[t,_])}const Qs=ar("container"),Js=N.createContext(null),zt=At("useController","ControllerContext",Js);function Su({children:e,...t}){var r;const{carousel:n,animation:o,controller:a,on:s,styles:l,render:f}=t,{closeOnPullUp:h,closeOnPullDown:c,preventDefaultWheelX:i,preventDefaultWheelY:u}=a,[g,p]=N.useState(),m=Ot(),w=cu(),[C,O]=N.useState(it.NONE),v=N.useRef(0),E=N.useRef(0),I=N.useRef(1),{registerSensors:_,subscribeSensors:M}=Xs(),{subscribe:x,publish:y}=_r(),T=Sn(),A=Sn(),P=Sn(),{containerRef:D,setContainerRef:L,containerRect:U}=Vs(),S=zo(ku({preventDefaultWheelX:i,preventDefaultWheelY:u}),L),b=N.useRef(null),F=zo(b,void 0),{getOwnerDocument:$}=Sr(),G=_n(),Y=V=>(G?-1:1)*(typeof V=="number"?V:1),B=Ie(()=>{var V;return(V=D.current)===null||V===void 0?void 0:V.focus()}),K=Ie(()=>t),j=Ie(()=>m),H=N.useCallback(V=>y(Rt,V),[y]),q=N.useCallback(V=>y(er,V),[y]),ue=N.useCallback(()=>y(xr),[y]),te=V=>!(n.finite&&(Y(V)>0&&m.currentIndex===0||Y(V)<0&&m.currentIndex===m.slides.length-1)),fe=V=>{var re;v.current=V,(re=D.current)===null||re===void 0||re.style.setProperty(We("swipe_offset"),`${Math.round(V)}px`)},ee=V=>{var re,oe;E.current=V,I.current=(()=>{const xe=c&&V>0?V:h&&V<0?-V: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(V)}px`),(oe=D.current)===null||oe===void 0||oe.style.setProperty(We("pull_opacity"),`${I.current}`)},{prepareAnimation:ke}=Uo(b,(V,re,oe)=>{if(b.current&&U)return{keyframes:[{transform:`translate(0, ${V.rect.y-re.y+oe.y}px)`,opacity:V.opacity},{transform:"translate(0, 0)",opacity:1}],duration:V.duration,easing:o.easing.fade}}),me=(V,re)=>{if(h||c){ee(V);let oe=0;b.current&&(oe=o.fade*(re?2:1),ke({rect:b.current.getBoundingClientRect(),opacity:I.current,duration:oe})),P(()=>{ee(0),O(it.NONE)},oe),O(it.ANIMATION),re||ue()}},{prepareAnimation:Ge,isAnimationPlaying:De}=Uo(b,(V,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-V.index)*(U.width+xe)+V.rect.x-re.x+oe.x}px, 0)`},{transform:"translate(0, 0)"}],duration:m.animation.duration,easing:m.animation.easing}}}),ye=Ie(V=>{var re,oe;const ae=V.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}=V;const Pe=(oe=V.count)!==null&&oe!==void 0?oe:1;let Ve=it.ANIMATION,Oe=be*Pe;if(!He){const se=U?.width,ie=V.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:(Ve=it.NONE,Oe=be):He===er&&(te(Y(-1))?X=Pe:(Ve=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(Ve),y(_o,{type:"swipe",increment:X,duration:Oe,easing:xe})});N.useEffect(()=>{var V,re;!((V=m.animation)===null||V===void 0)&&V.increment&&(!((re=m.animation)===null||re===void 0)&&re.duration)&&T(()=>w({type:"swipe",increment:0}),m.animation.duration)},[m.animation,w,T]);const Me=[M,te,U?.width||0,o.swipe,()=>O(it.SWIPE),V=>fe(V),(V,re)=>ye({offset:V,duration:re,count:1}),V=>ye({offset:V,count:0})],Ce=[()=>{c&&O(it.PULL)},V=>ee(V),V=>me(V),V=>me(V,!0)];xu(a,...Me,h,c,...Ce,ue),Cu(C,...Me);const we=Ie(()=>{a.focus&&$().querySelector(`.${pe(ko)} .${pe(Qs())}`)&&B()});N.useEffect(we,[we]);const Fe=Ie(()=>{var V;(V=s.view)===null||V===void 0||V.call(s,{index:m.currentIndex})});N.useEffect(Fe,[m.globalIndex,Fe]),N.useEffect(()=>kr(x(Rt,V=>ye({direction:Rt,...V})),x(er,V=>ye({direction:er,...V})),x(_o,V=>w(V))),[x,ye,w]);const Le=N.useMemo(()=>({prev:H,next:q,close:ue,focus:B,slideRect:U?eu(U,n.padding):{width:0,height:0},containerRect:U||{width:0,height:0},subscribeSensors:M,containerRef:D,setCarouselRef:F,toolbarWidth:g,setToolbarWidth:p}),[H,q,ue,B,M,U,D,F,g,p,n.padding]);return N.useImperativeHandle(a.ref,()=>({prev:H,next:q,close:ue,focus:B,getLightboxProps:K,getLightboxState:j}),[H,q,ue,B,K,j]),N.createElement("div",{ref:S,className:lt(pe(Qs()),pe(wr)),style:{...C===it.SWIPE?{[We("swipe_offset")]:`${Math.round(v.current)}px`}:null,...C===it.PULL?{[We("pull_offset")]:`${Math.round(E.current)}px`,[We("pull_opacity")]:`${I.current}`}:null,...a.touchAction!=="none"?{[We("controller_touch_action")]:a.touchAction}:null,...l.container},tabIndex:-1,..._},U&&N.createElement(Js.Provider,{value:Le},e,(r=f.controls)===null||r===void 0?void 0:r.call(f)))}const _u=Mt(Wr,Su);function cr(e){return or(ms,e)}function Rs(e){return or(So,e)}function Eu({slide:e,offset:t}){const r=N.useRef(null),{currentIndex:n,slides:o}=Ot(),{slideRect:a,focus:s}=zt(),{render:l,carousel:{imageFit:f,imageProps:h},on:{click:c},styles:{slide:i},labels:u}=rt(),{getOwnerDocument:g}=Sr(),p=t!==0;N.useEffect(()=>{var w;p&&(!((w=r.current)===null||w===void 0)&&w.contains(g().activeElement))&&s()},[p,s,g]);const m=()=>{var w,C,O,v;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=N.createElement(ir,{slide:e,offset:t,render:l,rect:a,imageFit:f,imageProps:h,onClick:p?void 0:()=>c?.({index:n})})),E?N.createElement(N.Fragment,null,(C=l.slideHeader)===null||C===void 0?void 0:C.call(l,{slide:e}),((O=l.slideContainer)!==null&&O!==void 0?O:(({children:I})=>I))({slide:e,children:E}),(v=l.slideFooter)===null||v===void 0?void 0:v.call(l,{slide:e})):null};return N.createElement("div",{ref:r,className:lt(pe(Rs()),!p&&pe(Rs("current")),pe(wr)),...nu(p),style:i,role:"group","aria-roledescription":sr(u,"Slide"),"aria-label":Is(u,o,n+t)},m())}function Tu(){const e=rt().styles.slide;return N.createElement("div",{className:pe(So),style:e})}function Nu({carousel:e,labels:t}){const{slides:r,currentIndex:n,globalIndex:o}=Ot(),{setCarouselRef:a}=zt(),{autoPlaying:s,focusWithin:l}=$o(),f=kn(e.spacing),h=kn(e.padding),c=Ls(e,r,1),i=[];if(Io(r))for(let u=n-c;u<=n+c;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}`,Ds(g)].filter(Boolean).join("|"),offset:u-n,slide:g})}return N.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?N.createElement(Eu,{key:u,slide:g,offset:p}):N.createElement(Tu,{key:u})))}const Au=Mt(ms,Nu);function el(){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 tl(e){var t;const r=_n(),{publish:n}=_r(),{animation:o}=rt(),{prevDisabled:a,nextDisabled:s}=el(),l=((t=o.navigation)!==null&&t!==void 0?t:o.swipe)/2,f=qs(()=>n(Rt),l),h=qs(()=>n(er),l),c=Ie(i=>{switch(i.key){case Zd:n(xr);break;case Qd:(r?s:a)||(r?h:f)();break;case Jd:(r?a:s)||(r?f:h)();break}});N.useEffect(()=>e(Eo,c),[e,c])}function rl({label:e,icon:t,renderIcon:r,action:n,onClick:o,disabled:a,style:s}){return N.createElement(Er,{label:e,icon:t,renderIcon:r,className:pe(`navigation_${n}`),disabled:a,onClick:o,style:s,...Ys(zt().focus,a)})}function Mu({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:n},styles:o}){const{prev:a,next:s,subscribeSensors:l}=zt(),{prevDisabled:f,nextDisabled:h}=el();return tl(l),N.createElement(N.Fragment,null,e?e():N.createElement(rl,{label:"Previous",action:Rt,icon:pu,renderIcon:r,style:o.navigationPrev,disabled:f,onClick:a}),t?t():N.createElement(rl,{label:"Next",action:er,icon:mu,renderIcon:n,style:o.navigationNext,disabled:h,onClick:s}))}const Ou=Mt(Ud,Mu),nl=pe(Yd),Iu=pe(xs);function Du(e){return"style"in e}function ol(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 Lu({noScroll:{disabled:e},children:t}){const r=_n(),{getOwnerDocument:n,getOwnerWindow:o}=Sr();return N.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(ol(l,h,r));const c=l.getElementsByTagName("*");for(let i=0;i<c.length;i+=1){const u=c[i];Du(u)&&s.getComputedStyle(u).getPropertyValue("position")==="fixed"&&!u.classList.contains(Iu)&&a.push(ol(u,h,r))}}return l.classList.add(nl),()=>{l.classList.remove(nl),a.forEach(c=>c())}},[r,e,n,o]),N.createElement(N.Fragment,null,t)}const Pu=Mt(zd,Lu);function al(e){return or(ko,e)}function sl(e,t,r){const n=e.getAttribute(t);return e.setAttribute(t,r),()=>{n?e.setAttribute(t,n):e.removeAttribute(t)}}function $u({children:e,animation:t,styles:r,className:n,on:o,portal:a,close:s,labels:l}){const[f,h]=N.useState(!1),[c,i]=N.useState(!1),u=N.useRef([]),g=N.useRef(null),{setTimeout:p}=Zr(),{subscribe:m}=_r(),C=Fo()?0:t.fade;N.useEffect(()=>(h(!0),()=>{h(!1),i(!1)}),[]);const O=Ie(()=>{u.current.forEach(_=>_()),u.current=[]}),v=Ie(()=>{var _;i(!1),O(),(_=o.exiting)===null||_===void 0||_.call(o),p(()=>{var M;(M=o.exited)===null||M===void 0||M.call(o),s()},C)});N.useEffect(()=>m(xr,v),[m,v]);const E=Ie(_=>{var M,x,y;ou(_),i(!0),(M=o.entering)===null||M===void 0||M.call(o);const T=(y=(x=_.parentNode)===null||x===void 0?void 0:x.children)!==null&&y!==void 0?y:[];for(let A=0;A<T.length;A+=1){const P=T[A];["TEMPLATE","SCRIPT","STYLE"].indexOf(P.tagName)===-1&&P!==_&&(u.current.push(sl(P,"inert","")),u.current.push(sl(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)},C)}),I=N.useCallback(_=>{_?E(_):O()},[E,O]);return f?Jt.createPortal(N.createElement(wu,{ref:I,className:lt(n,pe(al()),pe(xs),c&&pe(al("open"))),"aria-modal":!0,role:"dialog","aria-label":sr(l,"Lightbox"),style:{...t.fade!==Po.animation.fade?{[We("fade_animation_duration")]:`${C}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,$u);function Uu({children:e}){return N.createElement(N.Fragment,null,e)}const zu=Mt(Hd,Uu);function Hu(e){return or(bs,e)}function Gu({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:n}){const{close:o,setToolbarWidth:a}=zt(),{setContainerRef:s,containerRect:l}=Vs();Ft(()=>{a(l?.width)},[a,l?.width]);const f=()=>t?t():N.createElement(Er,{key:xr,label:"Close",icon:hu,renderIcon:r,onClick:o});return N.createElement("div",{ref:s,style:n.toolbar,className:pe(Hu())},e?.map(h=>h===xr?f():h))}const ju=Mt(bs,Gu);function ll(e,t){var r;return N.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(n=>ll(n,t)))}function Bu(e,t={}){const{easing:r,...n}=e,{easing:o,...a}=t;return{easing:{...r,...o},...n,...a}}function Wu({carousel:e,animation:t,render:r,toolbar:n,controller:o,noScroll:a,on:s,plugins:l,slides:f,index:h,...c}){const{animation:i,carousel:u,render:g,toolbar:p,controller:m,noScroll:w,on:C,slides:O,index:v,plugins:E,...I}=Po,{config:_,augmentation:M}=au([tt(Fu,[tt(Pu,[tt(_u,[tt(Au),tt(ju),tt(Ou)])])])],l||E),x=M({animation:Bu(i,t),carousel:{...u,...e},render:{...g,...r},toolbar:{...p,...n},controller:{...m,...o},noScroll:{...w,...a},on:{...C,...s},...I,...c});return x.open?N.createElement(Hs,{...x},N.createElement(uu,{slides:f||O,index:xn(h||v)},N.createElement(fu,null,N.createElement(iu,null,N.createElement(su,null,ll(tt(zu,_),x)))))):null}const Vu={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 il(e){const{minZoom:t,...r}={...Vu,...e};return{minZoom:Ku(t),...r}}function Yu(e,t,r,n){const o=N.useRef(void 0),a=N.useRef(void 0),{zoom:s}=rt().animation,l=Fo(),f=Ie(()=>{var h,c,i;if((h=o.current)===null||h===void 0||h.cancel(),o.current=void 0,a.current&&n?.current){try{o.current=(i=(c=n.current).animate)===null||i===void 0?void 0:i.call(c,[{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 Ft(f,[e,t,r,f]),N.useCallback(()=>{a.current=n?.current?window.getComputedStyle(n.current).transform:void 0},[n])}function Xu(e,t){const{on:r}=rt(),n=Ie(()=>{var o;t||(o=r.zoom)===null||o===void 0||o.call(r,{zoom:e})});N.useEffect(n,[e,n])}function En(){const{zoom:e}=rt();return il(e)}function qu(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 c={...s,...t};if(lr(c)){const i=Mo(c,l),u=Math.max(...(((r=c.srcSet)===null||r===void 0?void 0:r.map(p=>p.width))||[]).concat(c.width?[c.width]:[])),g=Math.max(...(((n=c.srcSet)===null||n===void 0?void 0:n.map(p=>p.height))||[]).concat(c.height?[c.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 cl(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function dl(e,t,r=100,n=2){return e*Math.min(1+Math.abs(t/r),n)**Math.sign(t)}function Zu(e,t,r,n,o,a,s,l,f){const h=N.useRef([]),c=N.useRef(0),i=N.useRef(void 0),{globalIndex:u}=Ot(),{getOwnerWindow:g}=Sr(),{containerRef:p,subscribeSensors:m}=zt(),{keyboardMoveDistance:w,zoomInMultiplier:C,wheelZoomDistanceFactor:O,scrollToZoom:v,doubleTapDelay:E,doubleClickDelay:I,doubleClickMaxStops:_,pinchZoomDistanceFactor:M,pinchZoomV4:x}=En(),y=N.useCallback(F=>{if(p.current){const{pageX:$,pageY:G}=F,{scrollX:Y,scrollY:B}=g(),{left:K,top:j,width:H,height:q}=p.current.getBoundingClientRect();return[$-K-Y-H/2,G-j-B-q/2]}return[]},[p,g]),T=Ie(F=>{const{key:$,metaKey:G,ctrlKey:Y}=F,B=G||Y,K=()=>{F.preventDefault(),F.stopPropagation()};if(e>1){const j=(H,q)=>{K(),l(H,q)};$==="ArrowDown"?j(0,w):$==="ArrowUp"?j(0,-w):$==="ArrowLeft"?j(-w,0):$==="ArrowRight"&&j(w,0)}$==="+"||B&&$==="="?(K(),o()):$==="-"||B&&$==="_"?(K(),a()):B&&$==="0"&&(K(),s(1))}),A=Ie(F=>{if((F.ctrlKey||v)&&Math.abs(F.deltaY)>Math.abs(F.deltaX)){F.stopPropagation(),s(dl(e,-F.deltaY,O),!0,...y(F));return}e>1&&(F.stopPropagation(),v||l(F.deltaX,F.deltaY))}),P=N.useCallback(F=>{const $=h.current;$.splice(0,$.length,...$.filter(G=>G.pointerId!==F.pointerId))},[]),D=N.useCallback(F=>{P(F),F.persist(),h.current.push(F)},[P]),L=Ie(F=>{var $;const G=h.current;if(F.pointerType==="mouse"&&F.buttons>1||!(!(($=f?.current)===null||$===void 0)&&$.contains(F.target)))return;e>1&&F.stopPropagation();const{timeStamp:Y}=F;if(G.length===0&&Y-c.current<(F.pointerType==="touch"?E:I)){c.current=0;const B=e>=1?e!==r?e*Math.max(r**(1/_),C):1:e!==t?e/Math.max(t**(-1/_),C):1;s(B,!1,...y(F))}else c.current=Y;if(D(F),G.length===2){const B=cl(G[0],G[1]);i.current={previousDistance:B,initialDistance:Math.max(B,1),initialZoom:e}}}),U=Ie(F=>{const $=h.current,G=$.find(Y=>Y.pointerId===F.pointerId);if($.length===2&&i.current){F.stopPropagation(),D(F);const Y=cl($[0],$[1]),B=x?i.current.initialZoom/i.current.initialDistance*Y:dl(e,Y-i.current.previousDistance,M);s(B,!0,...$.map(K=>y(K)).reduce((K,j)=>j.map((H,q)=>K[q]+H/2))),i.current.previousDistance=Y;return}e>1&&(F.stopPropagation(),G&&($.length===1&&l((G.clientX-F.clientX)/e,(G.clientY-F.clientY)/e),D(F)))}),S=N.useCallback(F=>{const $=h.current;$.length===2&&$.find(G=>G.pointerId===F.pointerId)&&(i.current=void 0),P(F)},[P]),b=N.useCallback(()=>{const F=h.current;F.splice(0,F.length),c.current=0,i.current=void 0},[]);Zs(m,L,U,S,n),N.useEffect(b,[u,b]),N.useEffect(()=>n?()=>{}:kr(b,m(Eo,T),m(To,A)),[n,m,b,T,A])}function Qu(e,t,r){const[n,o]=N.useState(1),[a,s]=N.useState(0),[l,f]=N.useState(0),h=Yu(n,a,l,r),{currentSlide:c,globalIndex:i}=Ot(),{containerRect:u,slideRect:g}=zt(),{minZoom:p,zoomInMultiplier:m}=En(),w=c&&lr(c)?c.src:void 0,C=!w||!r?.current;Ft(()=>{o(1),s(0),f(0)},[i,w]);const O=N.useCallback((M,x,y)=>{const T=y||n,A=a-(M||0),P=l-(x||0),D=(e.width*T-g.width)/2/T,L=(e.height*T-g.height)/2/T;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]),v=N.useCallback((M,x,y,T)=>{const A=Ao(M+.01<t?M-.01>p?M:p:t,5);x||h(),O(y?y*(1/n-1/A):0,T?T*(1/n-1/A):0,A),o(A)},[n,p,t,O,h]),E=Ie(()=>{n>1&&(n>t&&v(t,!0),O())});Ft(E,[u.width,u.height,E]);const I=N.useCallback(()=>{const M=n*m;v(n<1&&M>1?1:M)},[n,m,v]),_=N.useCallback(()=>{const M=n/m;v(n>1&&M<1?1:M)},[n,m,v]);return{zoom:n,offsetX:a,offsetY:l,disabled:C,changeOffsets:O,changeZoom:v,zoomIn:I,zoomOut:_}}const ul=N.createContext(null),Bo=At("useZoom","ZoomControllerContext",ul);function Ju({children:e}){const[t,r]=N.useState(),{slideRect:n}=zt(),{ref:o,minZoom:a}=En(),{imageRect:s,maxZoom:l}=qu(n,t?.imageDimensions),{zoom:f,offsetX:h,offsetY:c,disabled:i,changeZoom:u,changeOffsets:g,zoomIn:p,zoomOut:m}=Qu(s,l,t?.zoomWrapperRef);Xu(f,i),Zu(f,a,l,i,p,m,u,g,t?.zoomWrapperRef);const w=N.useMemo(()=>({zoom:f,minZoom:a,maxZoom:l,offsetX:h,offsetY:c,disabled:i,zoomIn:p,zoomOut:m,changeZoom:u}),[f,a,l,h,c,i,p,m,u]);N.useImperativeHandle(o,()=>w,[w]);const C=N.useMemo(()=>({...w,setZoomWrapper:r}),[w,r]);return N.createElement(ul.Provider,{value:C},e)}const Ru=mt("ZoomIn",N.createElement(N.Fragment,null,N.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"}),N.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),ef=mt("ZoomOut",N.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"})),fl=N.forwardRef(function({zoomIn:t,onLoseFocus:r},n){const o=N.useRef(!1),a=N.useRef(!1),{zoom:s,minZoom:l,maxZoom:f,zoomIn:h,zoomOut:c,disabled:i}=Bo(),{render:u}=rt(),g=i||(t?s>=f:s<=l);return N.useEffect(()=>{g&&o.current&&a.current&&r(),g||(o.current=!0)},[g,r]),N.createElement(Er,{ref:n,disabled:g,label:t?"Zoom in":"Zoom out",icon:t?Ru:ef,renderIcon:t?u.iconZoomIn:u.iconZoomOut,onClick:t?h:c,onFocus:()=>{a.current=!0},onBlur:()=>{a.current=!1}})});function tf(){const e=N.useRef(null),t=N.useRef(null),{focus:r}=zt(),n=N.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=N.useCallback(()=>n(e),[n]),a=N.useCallback(()=>n(t),[n]);return N.createElement(N.Fragment,null,N.createElement(fl,{zoomIn:!0,ref:e,onLoseFocus:a}),N.createElement(fl,{ref:t,onLoseFocus:o}))}function rf(){const{render:e}=rt(),t=Bo();return e.buttonZoom?N.createElement(N.Fragment,null,e.buttonZoom(t)):N.createElement(tf,null)}function nf(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function of({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(Ms)}}function af(e){var t,r;const[{current:n,preload:o},a]=N.useReducer(of,{}),{slide:s,rect:l,imageFit:f,render:h,interactive:c}=e,i=s.srcSet.sort((I,_)=>I.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(I=>I.width)),w=Math.min((p?Math.max:Math.min)(l.width,u*(l.height/g)),m),C=tu(),O=Ie(()=>{var I;const _=(I=i.find(M=>M.width>=w*C))!==null&&I!==void 0?I:i[i.length-1];(!n||i.findIndex(M=>M.src===n)<i.findIndex(M=>M===_))&&a({type:"fetch",source:_.src})});Ft(O,[l.width,l.height,C,O]);const v=Ie(I=>a({type:"done",source:I})),E={WebkitTransform:c?"initial":"translateZ(0)"};return p||Object.assign(E,l.width/l.height<u/g?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),N.createElement(N.Fragment,null,o&&o!==n&&N.createElement(ir,{key:"preload",...e,offset:void 0,slide:{...s,src:o,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...E},onLoad:()=>v(o),render:{...h,iconLoading:()=>null,iconError:()=>null}}),n&&N.createElement(ir,{key:"current",...e,slide:{...s,src:n,srcSet:void 0},style:E}))}function sf({render:e,slide:t,offset:r,rect:n}){var o;const[a,s]=N.useState(),l=N.useRef(null),{zoom:f,maxZoom:h,offsetX:c,offsetY:i,setZoomWrapper:u}=Bo(),g=f>1,{carousel:p,on:m}=rt(),{currentIndex:w}=Ot();Ft(()=>r===0?(u({zoomWrapperRef:l,imageDimensions:a}),()=>u(void 0)):()=>{},[r,a,u]);let C=(o=e.slide)===null||o===void 0?void 0:o.call(e,{slide:t,offset:r,rect:n,zoom:f,maxZoom:h});if(!C&&lr(t)){const O={slide:t,offset:r,rect:n,render:e,imageFit:p.imageFit,imageProps:p.imageProps,onClick:r===0?()=>{var v;return(v=m.click)===null||v===void 0?void 0:v.call(m,{index:w})}:void 0};C=nf(t)?N.createElement(af,{...O,slide:t,interactive:g,rect:r===0?{width:n.width*f,height:n.height*f}:n}):N.createElement(ir,{onLoad:v=>s({width:v.naturalWidth,height:v.naturalHeight}),...O})}return C?N.createElement("div",{ref:l,className:lt(pe(ws),pe(wr),pe(ks),g&&pe(Xd)),style:r===0?{transform:`scale(${f}) translateX(${c}px) translateY(${i}px)`}:void 0},C):null}const lf=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:n,render:o,controller:a,...s})=>{const l=il(r);return{zoom:l,toolbar:Cn(n,vs,N.createElement(rf,null)),render:{...o,slide:f=>{var h;return lr(f.slide)?N.createElement(sf,{render:o,...f}):(h=o.slide)===null||h===void 0?void 0:h.call(o,f)}},controller:{...a,preventDefaultWheelY:l.scrollToZoom},...s}}),t(Mt(vs,Ju))},cf={separator:"/",container:{}},gl=e=>({...cf,...e});function df({counter:e}){const{slides:t,currentIndex:r}=Ot(),{separator:n,container:{className:o,...a},className:s,...l}=gl(e);return t.length===0?null:N.createElement("div",{className:lt(pe("counter"),o||s),...l,...a,"aria-hidden":!0},r+1," ",n," ",t.length)}function uf({augment:e,addChild:t}){e(({counter:r,...n})=>({counter:gl(r),...n})),t(Wr,Mt(Gd,df))}const ff={autoplay:!1,delay:3e3,ref:null},hl=e=>({...ff,...e}),pl=N.createContext(null),gf=At("useSlideshow","SlideshowContext",pl);function hf({slideshow:e,carousel:{finite:t},on:r,children:n}){const{autoplay:o,delay:a,ref:s}=hl(e),l=N.useRef(o),[f,h]=N.useState(o),c=N.useRef(void 0),i=N.useRef(void 0),{slides:u,currentIndex:g}=Ot(),{setTimeout:p,clearTimeout:m}=Zr(),{subscribe:w}=_r(),{next:C}=zt(),{setAutoPlaying:O}=$o();N.useEffect(()=>O(f),[f,O]);const v=u.length===0||t&&g===u.length-1,E=N.useCallback(()=>{!f&&!v&&h(!0)},[f,v]),I=N.useCallback(()=>{f&&h(!1)},[f]),_=N.useCallback(()=>{m(c.current),c.current=void 0},[m]),M=Ie(()=>{_(),!(!f||v||i.current===vr||i.current===Co)&&(c.current=p(()=>{f&&(i.current=void 0,C())},a))});N.useEffect(M,[g,f,M]),N.useEffect(()=>{f&&v&&h(!1)},[g,f,v]);const x=Ie(()=>{var A;return(A=r.slideshowStart)===null||A===void 0?void 0:A.call(r)}),y=Ie(()=>{var A;return(A=r.slideshowStop)===null||A===void 0?void 0:A.call(r)});N.useEffect(()=>{f?x():l.current&&y(),l.current=f},[f,x,y]),N.useEffect(()=>kr(_,w(Bd,()=>{i.current=vr,_()}),w(Wd,()=>{i.current=Co,_()}),w(Vd,()=>{i.current=Yr,M()}),w(Kd,()=>{i.current=Xr,M()})),[w,_,M]);const T=N.useMemo(()=>({playing:f,disabled:v,play:E,pause:I}),[f,v,E,I]);return N.useImperativeHandle(s,()=>T,[T]),N.createElement(pl.Provider,{value:T},n)}const pf=mt("Play",N.createElement("path",{d:"M8 5v14l11-7z"})),mf=mt("Pause",N.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function bf(){const{playing:e,disabled:t,play:r,pause:n}=gf(),{render:o}=rt(),a=Ys(zt().focus,t);return o.buttonSlideshow?N.createElement(N.Fragment,null,o.buttonSlideshow({playing:e,disabled:t,play:r,pause:n})):N.createElement(Er,{label:e?"Pause":"Play",icon:e?mf:pf,renderIcon:e?o.iconSlideshowPause:o.iconSlideshowPlay,onClick:e?n:r,disabled:t,...a})}function yf({augment:e,addModule:t}){e(({slideshow:r,toolbar:n,...o})=>({toolbar:Cn(n,ys,N.createElement(bf,null)),slideshow:hl(r),...o})),t(Mt(ys,hf))}const vf={auto:!1,ref:null},ml=e=>({...vf,...e}),bl=N.createContext(null),wf=At("useFullscreen","FullscreenContext",bl);function xf({fullscreen:e,on:t,children:r}){const{auto:n,ref:o}=ml(e),a=N.useRef(null),[s,l]=N.useState(),[f,h]=N.useState(!1),c=N.useRef(!1),{getOwnerDocument:i}=Sr();Ft(()=>{var v,E,I,_;const M=i();l(!((_=(I=(E=(v=M.fullscreenEnabled)!==null&&v!==void 0?v:M.webkitFullscreenEnabled)!==null&&E!==void 0?E:M.mozFullScreenEnabled)!==null&&I!==void 0?I:M.msFullscreenEnabled)!==null&&_!==void 0&&_))},[i]);const u=N.useCallback(()=>{var v;const E=i(),I=E.fullscreenElement||E.webkitFullscreenElement||E.mozFullScreenElement||E.msFullscreenElement;return((v=I?.shadowRoot)===null||v===void 0?void 0:v.fullscreenElement)||I},[i]),g=N.useCallback(()=>{const v=a.current;try{v.requestFullscreen?v.requestFullscreen().catch(()=>{}):v.webkitRequestFullscreen?v.webkitRequestFullscreen():v.mozRequestFullScreen?v.mozRequestFullScreen():v.msRequestFullscreen&&v.msRequestFullscreen()}catch{}},[]),p=N.useCallback(()=>{if(!u())return;const v=i();try{v.exitFullscreen?v.exitFullscreen().catch(()=>{}):v.webkitExitFullscreen?v.webkitExitFullscreen():v.mozCancelFullScreen?v.mozCancelFullScreen():v.msExitFullscreen&&v.msExitFullscreen()}catch{}},[u,i]);N.useEffect(()=>{const v=i(),E=()=>{h(u()===a.current)};return kr(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(I=>(v.addEventListener(I,E),()=>v.removeEventListener(I,E))))},[u,i]);const m=Ie(()=>{var v;return(v=t.enterFullscreen)===null||v===void 0?void 0:v.call(t)}),w=Ie(()=>{var v;return(v=t.exitFullscreen)===null||v===void 0?void 0:v.call(t)});N.useEffect(()=>{f&&(c.current=!0),c.current&&(f?m:w)()},[f,m,w]);const C=Ie(()=>{var v;return(v=n?g:null)===null||v===void 0||v(),p});N.useEffect(C,[C]);const O=N.useMemo(()=>({fullscreen:f,disabled:s,enter:g,exit:p}),[f,s,g,p]);return N.useImperativeHandle(o,()=>O,[O]),N.createElement("div",{ref:a,className:lt(pe(Vr),pe(ws))},N.createElement(bl.Provider,{value:O},r))}const kf=mt("EnterFullscreen",N.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),Cf=mt("ExitFullscreen",N.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function Sf(){var e;const{fullscreen:t,disabled:r,enter:n,exit:o}=wf(),{render:a}=rt();return r?null:a.buttonFullscreen?N.createElement(N.Fragment,null,(e=a.buttonFullscreen)===null||e===void 0?void 0:e.call(a,{fullscreen:t,disabled:r,enter:n,exit:o})):N.createElement(Er,{disabled:r,label:t?"Exit Fullscreen":"Enter Fullscreen",icon:t?Cf:kf,renderIcon:t?a.iconExitFullscreen:a.iconEnterFullscreen,onClick:t?o:n})}function _f({augment:e,contains:t,addParent:r}){e(({fullscreen:n,toolbar:o,...a})=>({toolbar:Cn(o,Vr,N.createElement(Sf,null)),fullscreen:ml(n),...a})),r(t(Kr)?Kr:Wr,Mt(Vr,xf))}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 yl(){const{thumbnails:e}=rt();return Wo(e)}const ur=e=>or(Kr,e),nt=e=>ur(or("thumbnail",e)),Ef=mt("VideoThumbnail",N.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"})),Tf=mt("UnknownThumbnail",N.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 Nf({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 N.createElement(ir,{slide:{src:e.thumbnail},...s});if(lr(e))return N.createElement(ir,{slide:e,...s});const l=pe(nt(wn));return e.type==="video"?N.createElement(N.Fragment,null,e.poster&&N.createElement(ir,{slide:{src:e.poster},...s}),N.createElement(Ef,{className:l})):N.createElement(Tf,{className:l})}const Af=ar("active"),Vo=ar("fadein"),Ko=ar("fadeout"),Mf=ar("placeholder"),vl="delay",wl="duration";function Of({slide:e,index:t,onClick:r,fadeIn:n,fadeOut:o,placeholder:a,onLoseFocus:s}){const l=N.useRef(null),{render:f,styles:h,labels:c}=rt(),{slides:i,globalIndex:u}=Ot(),{getOwnerDocument:g}=Sr(),{width:p,height:m,imageFit:w}=yl(),C={width:p,height:m},O=t===u,v=Ie(s);return N.useEffect(()=>{o&&g().activeElement===l.current&&v()},[o,v,g]),N.createElement("button",{ref:l,type:"button",className:lt(pe(wr),pe(nt()),O&&pe(nt(Af())),n&&pe(nt(Vo())),o&&pe(nt(Ko())),a&&pe(nt(Mf()))),style:{...n?{[We(nt(Vo(wl)))]:`${n.duration}ms`,[We(nt(Vo(vl)))]:`${n.delay}ms`}:null,...o?{[We(nt(Ko(wl)))]:`${o.duration}ms`,[We(nt(Ko(vl)))]:`${o.delay}ms`}:null,...h.thumbnail},onClick:r,"aria-current":O?!0:void 0,"aria-label":Is(c,i,t)},e&&Nf({slide:e,render:f,rect:C,imageFit:w}))}function xl(e){return["top","bottom"].includes(e)}function kl(e,t){return t+2*(e.border+e.padding)+e.gap}function If(e){const{thumbnail:t,poster:r}=e||{thumbnail:"placeholder"};return typeof t=="string"&&t||typeof r=="string"&&r||e&&Ds(e)||void 0}function Cl({visible:e,containerRef:t}){const r=N.useRef(null),n=_n(),{publish:o,subscribe:a}=_r(),{carousel:s,styles:l,labels:f}=rt(),{slides:h,globalIndex:c,animation:i}=Ot(),{registerSensors:u,subscribeSensors:g}=Xs();tl(g);const p=yl(),{position:m,width:w,height:C,border:O,borderStyle:v,borderColor:E,borderRadius:I,padding:_,gap:M,vignette:x}=p,y=i?.duration!==void 0&&i?.increment||0,T=i?.duration||0,{prepareAnimation:A}=Uo(r,S=>({keyframes:xl(m)?[{transform:`translateX(${(n?-1:1)*kl(p,w)*y+S}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${kl(p,C)*y+S}px)`},{transform:"translateY(0)"}],duration:T,easing:i?.easing})),P=Ie(()=>{let S=0;if(t.current&&r.current){const b=t.current.getBoundingClientRect(),F=r.current.getBoundingClientRect();S=xl(m)?F.left-b.left-(b.width-F.width)/2:F.top-b.top-(b.height-F.height)/2}A(S)});N.useEffect(()=>kr(a(_o,P)),[a,P]);const D=Ls(s,h),L=[];if(Io(h))for(let S=c-D-Math.abs(y);S<=c+D+Math.abs(y);S+=1){const F=s.finite&&(S<0||S>h.length-1)||y<0&&S<c-D||y>0&&S>c+D?null:Do(h,S),$=[`${S}`,If(F)].filter(Boolean).join("|");L.push({key:$,index:S,slide:F})}const U=S=>()=>{S>c?o(er,{count:S-c}):S<c&&o(Rt,{count:c-S})};return N.createElement("div",{className:lt(pe(ur("container")),pe(wr)),style:{...e?null:{display:"none"},...w!==dr.width?{[We(nt("width"))]:`${w}px`}:null,...C!==dr.height?{[We(nt("height"))]:`${C}px`}:null,...O!==dr.border?{[We(nt("border"))]:`${O}px`}:null,...v?{[We(nt("border_style"))]:v}:null,...E?{[We(nt("border_color"))]:E}:null,...I!==dr.borderRadius?{[We(nt("border_radius"))]:`${I}px`}:null,..._!==dr.padding?{[We(nt("padding"))]:`${_}px`}:null,...M!==dr.gap?{[We(nt("gap"))]:`${M}px`}:null,...l.thumbnailsContainer}},N.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:F})=>{const $=T/Math.abs(y||1),G=y>0&&b>c+D-y&&b<=c+D||y<0&&b<c-D-y&&b>=c-D?{duration:$,delay:((y>0?b-(c+D-y):c-D-y-b)-1)*$}:void 0,Y=y>0&&b<c-D||y<0&&b>c+D?{duration:$,delay:(y>0?y-(c-D-b):-y-(b-(c+D)))*$}:void 0;return N.createElement(Of,{key:S,index:b,slide:F,fadeIn:G,fadeOut:Y,placeholder:!F,onClick:U(b),onLoseFocus:()=>{var B;return(B=r.current)===null||B===void 0?void 0:B.focus()}})})),x&&N.createElement("div",{className:pe(ur("vignette"))}))}const Sl=N.createContext(null),Df=At("useThumbnails","ThumbnailsContext",Sl);function Lf({children:e,...t}){const{ref:r,position:n,hidden:o}=Wo(t.thumbnails),[a,s]=N.useState(!o),l=N.useRef(null),f=N.useMemo(()=>({visible:a,show:()=>s(!0),hide:()=>s(!1)}),[a]);return N.useImperativeHandle(r,()=>f,[f]),N.createElement(Hs,{...t},N.createElement(Sl.Provider,{value:f},N.createElement("div",{ref:l,className:lt(pe(ur()),pe(ur(`${n}`)))},["start","top"].includes(n)&&N.createElement(Cl,{containerRef:l,visible:a}),N.createElement("div",{className:pe(ur("wrapper"))},e),["end","bottom"].includes(n)&&N.createElement(Cl,{containerRef:l,visible:a}))))}const _l=()=>N.createElement(N.Fragment,null,N.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),N.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),Pf=mt("ThumbnailsVisible",_l()),$f=gu("ThumbnailsHidden",_l());function Ff(){const{visible:e,show:t,hide:r}=Df(),{render:n}=rt();return n.buttonThumbnails?N.createElement(N.Fragment,null,n.buttonThumbnails({visible:e,show:t,hide:r})):N.createElement(Er,{label:e?"Hide thumbnails":"Show thumbnails",icon:e?Pf:$f,renderIcon:e?n.iconThumbnailsVisible:n.iconThumbnailsHidden,onClick:e?r:t})}function Uf({augment:e,contains:t,append:r,addParent:n}){e(({thumbnails:a,toolbar:s,...l})=>{const f=Wo(a);return{toolbar:Cn(s,Kr,f.showToggle?N.createElement(Ff,null):null),thumbnails:f,...l}});const o=Mt(Kr,Lf);t(Vr)?r(Vr,o):n(Wr,o)}const Ct=({className:e="",children:t,style:r,...n})=>d.jsx("i",{className:e,style:r,...n,children:t}),Yo=window.G7Core,Tn=(e,t)=>Yo?.t?.(e,t)??e,zf=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"))}},Hf=(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)},El=async e=>{const t=e.downloadUrl||e.src,r=e.filename||e.title||"image";e.downloadRequiresAuth?await zf(t,r):Hf(t,r)},Gf=({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 El(e)}finally{o(!1)}};return d.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?d.jsx(Ct,{className:"fa-solid fa-spinner fa-spin text-white"}):d.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:c,editorAttrs:i,id:u})=>{const[g,p]=k.useState(n),m=k.useRef(n),w=e.map(v=>({src:v.src,title:v.title,description:v.description})),C=[];o&&C.push(lf),a&&C.push(yf),s&&C.push(_f),l&&C.push(uf),h&&C.push(Uf);const O=e[g];if(k.useEffect(()=>{m.current=g},[g]),i){const v=(e??[]).slice(0,4);return d.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:v.length>0?v.map((E,I)=>d.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"},I)):d.jsxs(W,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[d.jsx(Ct,{className:"fa-regular fa-images mr-2"}),Tn("editor.component.image_gallery")]})})}return d.jsx(Wu,{open:t,close:r,slides:w,index:g,plugins:C,on:{view:({index:v})=>{v!==m.current&&p(v)}},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&&d.jsx(Gf,{image:O,index:g,onDownload:c},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},Tl=()=>{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 Nl=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Tr,default:Tr,executeImageDownload:El,useImageGallery:Tl},Symbol.toStringTag,{value:"Module"})),jf=window.G7Core,Xo=(e,t)=>jf?.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}=Tl(),f=k.useMemo(()=>e.map(c=>({src:Nn(c),title:c.alt_text_current??"",thumbnail:Nn(c),downloadUrl:c.download_url,filename:c.alt_text_current??`image-${c.id}`})),[e]);if(!e||e.length===0)return d.jsx(W,{className:`flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-lg aspect-square ${t}`,id:r,...n,children:d.jsxs(W,{className:"text-center text-gray-400 dark:text-gray-500",children:[d.jsx(de,{name:"image",size:"3x",className:"mb-3 opacity-50"}),d.jsx(W,{className:"text-sm",children:Xo("shop.no_image")})]})});const h=e[o]??e[0];return d.jsxs(W,{id:r,className:t,...n,children:[d.jsx(W,{className:"relative overflow-hidden rounded-lg bg-gray-100 dark:bg-gray-700 aspect-square mb-3",children:d.jsx(Q,{type:"button",className:"w-full h-full cursor-zoom-in block",onClick:()=>s(f,o),"aria-label":Xo("shop.view_image"),children:d.jsx(Lt,{src:Nn(h),alt:h.alt_text_current??"",className:"w-full h-full object-contain"})})}),e.length>1&&d.jsx(W,{className:"flex gap-2 overflow-x-auto pb-1",children:e.map((c,i)=>d.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":c.alt_text_current??`${Xo("shop.image")} ${i+1}`,children:d.jsx(Lt,{src:Nn(c),alt:c.alt_text_current??"",className:"w-full h-full object-cover"})},c.id))}),d.jsx(Tr,{...l})]})};An.displayName="ProductImageViewer";const Bf=Object.freeze(Object.defineProperty({__proto__:null,ProductImageViewer:An,default:An},Symbol.toStringTag,{value:"Module"})),Al=({value:e,min:t=1,max:r=999,onChange:n,size:o="md",disabled:a=!1,className:s="",id:l,editorAttrs:f})=>{const c={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=C=>{const O=parseInt(C.target.value,10);if(!isNaN(O)){const v=Math.max(t,Math.min(r,O));n(v)}},p=C=>{const O=parseInt(C.target.value,10);isNaN(O)||O<t?n(t):O>r&&n(r)},m=a||e<=t,w=a||e>=r;return d.jsxs(W,{className:`inline-flex items-center border border-gray-300 dark:border-gray-600 rounded-lg ${c.container} ${s}`,id:l,...f,children:[d.jsx(Q,{type:"button",onClick:i,disabled:m,className:`${c.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:d.jsx(de,{name:"minus",className:"w-4 h-4"})}),d.jsx(xt,{type:"number",value:e,onChange:g,onBlur:p,min:t,max:r,disabled:a,className:`${c.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":"수량"}),d.jsx(Q,{type:"button",onClick:u,disabled:w,className:`${c.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:d.jsx(de,{name:"plus",className:"w-4 h-4"})})]})},Wf=Object.freeze(Object.defineProperty({__proto__:null,default:Al},Symbol.toStringTag,{value:"Module"})),Vf=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)},Ml=(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"}],Ol=({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"},c=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){Vf.error("리액션 오류:",g)}};return d.jsx(W,{className:`flex flex-wrap gap-2 ${a}`,id:s,...l,children:Kf.map(u=>{const g=c(u.type),p=t===u.type;return d.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:Ml(u.labelKey),children:[d.jsx(R,{className:h[o],children:u.emoji}),d.jsx(R,{children:Ml(u.labelKey)}),g>0&&d.jsx(R,{className:"font-medium",children:g})]},u.type)})})},Yf=Object.freeze(Object.defineProperty({__proto__:null,default:Ol},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,Il=({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 c=k.useRef(null),[i,u]=k.useState(t),[g,p]=k.useState(!1),[m,w]=k.useState(!1),[C,O]=k.useState("");k.useEffect(()=>{c.current&&!c.current.innerHTML&&(c.current.innerHTML=t)},[t]),k.useEffect(()=>{n&&n(i)},[i,n]);const v=T=>{Mn.log("Apply format:",T)},E=async T=>{const A=new FormData;A.append("file",T);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)}},I=T=>{const A=T.target.files?.[0];A&&E(A)},_=()=>{C&&(Mn.log("Insert link:",C),w(!1),O(""))},M=[{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")}],x=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],y=[{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 d.jsxs(W,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,id:f,...h,children:[d.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:[d.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:M.map(T=>d.jsx(Q,{type:"button",onClick:()=>v(T.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:T.title,children:T.icon},T.format))}),d.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:x.map(T=>d.jsx(Q,{type:"button",onClick:()=>v(T.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:T.label},T.format))}),d.jsx(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:y.map(T=>d.jsx(Q,{type:"button",onClick:()=>v(T.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:T.title,children:T.icon},T.format))}),d.jsxs(W,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[d.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:"🔗"}),d.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:["🖼",d.jsx(xt,{type:"file",accept:"image/*",onChange:I,disabled:s,className:"hidden"})]})]}),d.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?d.jsx(no,{value:i,onChange:T=>u(T.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}}):d.jsx(W,{ref:c,contentEditable:!s,onInput:T=>u(T.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}),d.jsx(xt,{type:"hidden",name:e,value:i}),m&&d.jsx(W,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:d.jsxs(W,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[d.jsx(gn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:St("editor.link_modal.title")}),d.jsx(xt,{type:"url",value:C,onChange:T=>O(T.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"}),d.jsxs(W,{className:"flex justify-end gap-2",children:[d.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")}),d.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")})]})]})})]})},Xf=Object.freeze(Object.defineProperty({__proto__:null,default:Il},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 d.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]),c=`
|
||
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 d.jsx(W,{id:a,className:c,dangerouslySetInnerHTML:{__html:h},...s})},qf=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:qo},Symbol.toStringTag,{value:"Module"})),Zo=()=>window.G7Core,Qo=(e,t)=>Zo()?.t?.(e,t)??e,Dl=({content:e="",onChange:t,isHtml:r=!1,onIsHtmlChange:n,rows:o=15,placeholder:a="",label:s,showHtmlModeToggle:l=!0,contentClassName:f="",purifyConfig:h,className:c="",name:i="content",htmlFieldName:u="content_mode",readOnly:g=!1,id:p,editorAttrs:m})=>{const[w,C]=k.useState(r),[O,v]=k.useState(e),[E,I]=k.useState(!1);k.useEffect(()=>{C(r)},[r]),k.useEffect(()=>{v(e)},[e]);const _=k.useCallback(y=>{const T=y.target.value;if(v(T),t){const A=Zo()?.createChangeEvent?.({value:T,name:i,type:"textarea"})??{target:{name:i,value:T}};t(A)}},[t,i]),M=k.useCallback(y=>{const T=y.target.checked;if(C(T),T||I(!1),n){const A=Zo()?.createChangeEvent?.({checked:T,name:u,type:"checkbox"})??{target:{name:u,checked:T}};n(A)}},[n,u]),x=k.useCallback(()=>{I(y=>!y)},[]);return d.jsxs(W,{className:`space-y-2 ${c}`,id:p,...m,children:[d.jsxs(W,{className:"flex items-center justify-between",children:[s&&d.jsx(yr,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),d.jsxs(W,{className:"flex items-center gap-3",children:[w&&!g&&d.jsx(Q,{type:"button",onClick:x,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&&d.jsxs(yr,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[d.jsx(xt,{type:"checkbox",name:u,checked:w,onChange:M,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"}),d.jsx(W,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Qo("common.html_mode")})]})]})]}),!E&&d.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&&d.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:d.jsx(qo,{content:O,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:h})})]})},Zf=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:Dl},Symbol.toStringTag,{value:"Module"})),Ll=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,c]=k.useState(!1),i=k.useRef(null),u=k.useCallback(()=>{if(i.current){const w=i.current.scrollHeight;c(w>e)}},[e]);k.useEffect(()=>{u();const w=i.current;if(!w)return;const C=w.querySelectorAll("img");C.forEach(v=>{v.complete||v.addEventListener("load",u)});let O=null;return typeof ResizeObserver<"u"&&(O=new ResizeObserver(u),O.observe(w)),()=>{C.forEach(v=>{v.removeEventListener("load",u)}),O?.disconnect()}},[u,o]);const g=()=>{f(w=>!w)},p=t||Ll("sirsoft-ecommerce.shop.product.expand_detail"),m=r||Ll("sirsoft-ecommerce.shop.product.collapse_detail");return d.jsxs(W,{className:n,id:a,...s,children:[d.jsxs(W,{className:"relative",children:[d.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&&d.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&&d.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:[d.jsx(R,{className:"text-sm font-semibold text-gray-600 dark:text-gray-400",children:l?m:p}),d.jsx(de,{name:l?"chevron-up":"chevron-down",size:"sm"})]})]})},Qf=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:Jo,default:Jo},Symbol.toStringTag,{value:"Module"})),Jf=(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:c="500px",className:i="",style:u})=>{const g=s!==void 0?s:a,p=k.useRef(null),m=k.useRef(null);if(k.useEffect(()=>{const C=O=>{O.key==="Escape"&&e&&f&&t()};if(e&&f)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,t,f]),k.useEffect(()=>{if(e&&p.current){m.current=document.activeElement;const C=p.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),O=C[0],v=C[C.length-1];O?.focus();const E=I=>{I.key==="Tab"&&(I.shiftKey?document.activeElement===O&&(I.preventDefault(),v?.focus()):document.activeElement===v&&(I.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 d.jsxs(W,{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:w},onClick:g?t:void 0,children:[d.jsx(W,{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),d.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:c,...u?{...u,zIndex:void 0}:{}},onClick:C=>C.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[(r||n||l)&&d.jsxs(W,{className:"flex items-center justify-between p-4",children:[(r||n)&&d.jsxs(W,{id:"modal-title",className:"flex items-center gap-3 text-lg font-semibold text-gray-900 dark:text-white",children:[n&&d.jsx(de,{name:n,size:"md",className:o}),r]}),l&&d.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":Jf("common.close_modal"),children:d.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),d.jsx(W,{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-140px)]",children:h})]})]})},Rf=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:c="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"),C=()=>{s()},O=()=>{u||(l?.(),t())},v=()=>{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 d.jsxs(Ro,{isOpen:e,onClose:v,title:r,width:c,children:[d.jsx(W,{className:"py-2",children:typeof n=="string"?d.jsx(Dt,{className:"text-gray-700 dark:text-gray-300",children:n}):n}),d.jsxs(W,{className:"flex justify-end gap-3 mt-6",children:[d.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:d.jsx(R,{children:m})}),d.jsxs(Q,{onClick:C,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&&d.jsx(Ct,{className:"fa-solid fa-spinner w-4 h-4 animate-spin"}),d.jsx(R,{children:u?w:p})]})]})]})},eg=Object.freeze(Object.defineProperty({__proto__:null,ConfirmDialog:ta},Symbol.toStringTag,{value:"Module"})),Pl=k.createContext(null),$l=({value:e,children:t})=>d.jsx(Pl.Provider,{value:e,children:t}),tg=()=>{const e=k.useContext(Pl);if(!e)throw new Error("useFileUploaderContext must be used within FileUploaderProvider");return e};function rg(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 Fl(e,t){return new Promise((function(r,n){let o;return ng(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 ng=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 c;switch(a.getUint16(h)){case 18761:c=!0;break;case 19789:c=!1;break;default:return r("TIFF header contains invalid endian")}if(a.getUint16(h+2,c)!==42)return r("TIFF header contains invalid version");const i=a.getUint32(h+4,c),u=h+i+2+12*a.getUint16(h+i,c);for(let g=h+i+2;g<u;g+=12)if(a.getUint16(g,c)==274){if(a.getUint16(g+2,c)!==3)return r("Orientation data type is invalid");if(a.getUint32(g+4,c)!==1)return r("Orientation data count is invalid");a.setUint16(g+8,1,c);break}return t(o.slice(s,s+2+f))}s+=2+f}return t(new Blob)})),n.readAsArrayBuffer(e)}));var On={},og={get exports(){return On},set exports(e){On=e}};(function(e){var t,r,n={};og.exports=n,n.parse=function(o,a){for(var s=n.bin.readUshort,l=n.bin.readUint,f=0,h={},c=new Uint8Array(o),i=c.length-4;l(c,i)!=101010256;)i--;f=i,f+=4;var u=s(c,f+=4);s(c,f+=2);var g=l(c,f+=2),p=l(c,f+=4);f+=4,f=p;for(var m=0;m<u;m++){l(c,f),f+=4,f+=4,f+=4,l(c,f+=4),g=l(c,f+=4);var w=l(c,f+=4),C=s(c,f+=4),O=s(c,f+2),v=s(c,f+4);f+=6;var E=l(c,f+=8);f+=4,f+=C+O+v,n._readLocal(c,E,h,g,w,a)}return h},n._readLocal=function(o,a,s,l,f,h){var c=n.bin.readUshort,i=n.bin.readUint;i(o,a),c(o,a+=4),c(o,a+=2);var u=c(o,a+=2);i(o,a+=2),i(o,a+=4),a+=4;var g=c(o,a+=8),p=c(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 C=new Uint8Array(f);n.inflateRaw(w,C),s[m]=C}}},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 c in o){var i=!n._noNeed(c)&&!a,u=o[c],g=n.crc.crc(u,0,u.length);h[c]={cpr:i,usize:u.length,crc:g,file:i?n.deflateRaw(u):u}}for(var c in h)s+=h[c].file.length+30+46+2*n.bin.sizeUTF8(c);s+=22;var p=new Uint8Array(s),m=0,w=[];for(var c in h){var C=h[c];w.push(m),m=n._writeHeader(p,m,c,C,0)}var O=0,v=m;for(var c in h)C=h[c],w.push(m),m=n._writeHeader(p,m,c,C,1,w[O++]);var E=m-v;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,v),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 c=n.bin.writeUint,i=n.bin.writeUshort,u=l.file;return c(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),c(o,a+=2,0),c(o,a+=4,l.crc),c(o,a+=4,u.length),c(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,c(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,c=a+s;h<c;){for(var i=Math.min(h+5552,c);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 c=s.charCodeAt(h);if((4294967168&c)==0)o[a+f]=c,f++;else if((4294965248&c)==0)o[a+f]=192|c>>6,o[a+f+1]=128|c>>0&63,f+=2;else if((4294901760&c)==0)o[a+f]=224|c>>12,o[a+f+1]=128|c>>6&63,o[a+f+2]=128|c>>0&63,f+=3;else{if((4292870144&c)!=0)throw"e";o[a+f]=240|c>>18,o[a+f+1]=128|c>>12&63,o[a+f+2]=128|c>>6&63,o[a+f+3]=128|c>>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,c=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,C=h.strt,O=h.prev,v=0,E=0,I=0,_=0,M=0,x=0;for(m>2&&(C[x=n.F._hash(o,0)]=0),u=0;u<m;u++){if(M=x,u+1<m-2){x=n.F._hash(o,u+1);var y=u+1&32767;O[y]=C[x],C[x]=y}if(p<=u){(v>14e3||E>26697)&&m-u>100&&(p<u&&(w[v]=u-p,v+=2,p=u),g=n.F._writeBlock(u==m-1||p==m?1:0,w,v,_,o,I,u-I,a,g),v=E=_=0,I=u);var T=0;u<m-2&&(T=n.F._bestMatch(o,u,O,M,Math.min(f[2],m-u),f[3]));var A=T>>>16,P=65535&T;if(T!=0){P=65535&T;var D=c(A=T>>>16,h.of0);h.lhst[257+D]++;var L=c(P,h.df0);h.dhst[L]++,_+=h.exb[D]+h.dxb[L],w[v]=A<<23|u-p,w[v+1]=P<<16|D<<8|L,v+=2,p=u+A}else h.lhst[o[u]]++;E++}}for(I==u&&o.length!=0||(p<u&&(w[v]=u-p,v+=2,p=u),g=n.F._writeBlock(1,w,v,_,o,I,u-I,a,g),v=0,E=0,v=E=_=0,I=u);(7&g)!=0;)g++;return g>>>3},n.F._bestMatch=function(o,a,s,l,f,h){var c=32767&a,i=s[c],u=c-i+32768&32767;if(i==c||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!=c;){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 C=0,O=0;O<w-2;O++){var v=a-u+O+32768&32767,E=v-s[v]+32768&32767;E>C&&(C=E,i=v)}}}u+=(c=i)-(i=s[c])+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,c,i,u){var g,p,m,w,C,O,v,E,I,_=n.F.U,M=n.F._putsF,x=n.F._putsE;_.lhst[256]++,p=(g=n.F.getTrees())[0],m=g[1],w=g[2],C=g[3],O=g[4],v=g[5],E=g[6],I=g[7];var y=32+((u+3&7)==0?0:8-(u+3&7))+(c<<3),T=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*v+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=y<T&&y<A?0:T<A?1:2;if(M(i,u,o),M(i,u+1,D),u+=3,D==0){for(;(7&u)!=0;)u++;u=n.F._copyExact(f,h,c,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,x(i,u,C-257),x(i,u+=5,O-1),x(i,u+=5,v-4),u+=4;for(var S=0;S<v;S++)x(i,u+3*S,_.itree[1+(_.ordr[S]<<1)]);u+=3*v,u=n.F._codeTiny(E,_.itree,i,u),u=n.F._codeTiny(I,_.itree,i,u)}for(var b=h,F=0;F<s;F+=2){for(var $=a[F],G=$>>>23,Y=b+(8388607&$);b<Y;)u=n.F._writeLit(f[b++],L,i,u);if(G!=0){var B=a[F+1],K=B>>16,j=B>>8&255,H=255&B;x(i,u=n.F._writeLit(257+j,L,i,u),G-_.of0[j]),u+=_.exb[j],M(i,u=n.F._writeLit(H,U,i,u),K-_.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=[],c=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,c,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],c=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,c,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,c=l+5<s?o[l+5]:-1,i=l==0?-1:o[l-1];if(f==0&&h==f&&c==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&&c==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,c=0;for(c=0;c<h;c+=2)a[c]=0,a[c+1]=0;for(c=0;c<f;c++)o[c]!=0&&l.push({lit:c,f:o[c]});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,I){return E.f-I.f}));var p=l[0],m=l[1],w=0,C=1,O=2;for(l[0]={lit:-1,f:p.f+m.f,l:p,r:m,d:0};C!=i-1;)p=w!=C&&(O==i||l[w].f<l[O].f)?l[w++]:l[O++],m=w!=C&&(O==i||l[w].f<l[O].f)?l[w++]:l[O++],l[C++]={lit:-1,f:p.f+m.f,l:p,r:m};var v=n.F.setDepth(l[C-1],0);for(v>s&&(n.F.restrictDepth(u,s,v),v=s),c=0;c<i;c++)a[1+(u[c].lit<<1)]=u[c].d;return v},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 c=o[l].d;o[l].d=a,h+=f-(1<<s-c)}for(h>>>=s-a;h>0;)(c=o[l].d)<a?(o[l].d++,h-=1<<a-c-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,c=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,C,O=0,v=0,E=0,I=0,_=0,M=0,x=0,y=0,T=0;O==0;)if(O=f(o,T,1),v=f(o,T+1,2),T+=3,v!=0){if(m&&(a=n.F._check(a,y+131072)),v==1&&(w=p.flmap,C=p.fdmap,M=511,x=31),v==2){E=h(o,T,5)+257,I=h(o,T+5,5)+1,_=h(o,T+10,4)+4,T+=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,T+3*A,3);p.itree[1+(p.ordr[A]<<1)]=D,D>P&&(P=D)}T+=3*_,i(p.itree,P),u(p.itree,P,p.imap),w=p.lmap,C=p.dmap,T=c(p.imap,(1<<P)-1,E+I,o,T,p.ttree);var L=l._copyOut(p.ttree,0,E,p.ltree);M=(1<<L)-1;var U=l._copyOut(p.ttree,E,I,p.dtree);x=(1<<U)-1,i(p.ltree,L),u(p.ltree,L,w),i(p.dtree,U),u(p.dtree,U,C)}for(;;){var S=w[g(o,T)&M];T+=15&S;var b=S>>>4;if(!(b>>>8))a[y++]=b;else{if(b==256)break;var F=y+b-254;if(b>264){var $=p.ldef[b-257];F=y+($>>>3)+h(o,T,7&$),T+=7&$}var G=C[g(o,T)&x];T+=15&G;var Y=G>>>4,B=p.ddef[Y],K=(B>>>4)+f(o,T,15&B);for(T+=15&B,m&&(a=n.F._check(a,y+131072));y<F;)a[y]=a[y++-K],a[y]=a[y++-K],a[y]=a[y++-K],a[y]=a[y++-K];y=F}}}else{(7&T)!=0&&(T+=8-(7&T));var j=4+(T>>>3),H=o[j-4]|o[j-3]<<8;m&&(a=n.F._check(a,y+H)),a.set(new s(o.buffer,o.byteOffset+j,H),y),T=j+H<<3,y+=H}return a.length==y?a:a.slice(0,y)},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 c=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+c(l,f,2),f+=2,m=h[u-1]):p==17?(w=3+c(l,f,3),f+=3):p==18&&(w=11+c(l,f,7),f+=7);for(var C=u+w;u<C;)h[u]=m,u++}}return f},n.F._copyOut=function(o,a,s,l){for(var f=0,h=0,c=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<c;)l[h<<1]=0,l[1+(h<<1)]=0,h++;return f},n.F.makeCodes=function(o,a){for(var s,l,f,h,c=n.F.U,i=o.length,u=c.bl_count,g=0;g<=a;g++)u[g]=0;for(g=1;g<i;g+=2)u[o[g]]++;var p=c.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 c=h>>1,i=o[h+1],u=c<<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,c){for(;h--!=0;)f.push(0,c)}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 ag=rg({__proto__:null,default:On},[On]);const Ht=(function(){var e={nextZero(c,i){for(;c[i]!=0;)i++;return i},readUshort:(c,i)=>c[i]<<8|c[i+1],writeUshort(c,i,u){c[i]=u>>8&255,c[i+1]=255&u},readUint:(c,i)=>16777216*c[i]+(c[i+1]<<16|c[i+2]<<8|c[i+3]),writeUint(c,i,u){c[i]=u>>24&255,c[i+1]=u>>16&255,c[i+2]=u>>8&255,c[i+3]=255&u},readASCII(c,i,u){let g="";for(let p=0;p<u;p++)g+=String.fromCharCode(c[i+p]);return g},writeASCII(c,i,u){for(let g=0;g<u.length;g++)c[i+g]=u.charCodeAt(g)},readBytes(c,i,u){const g=[];for(let p=0;p<u;p++)g.push(c[i+p]);return g},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,i,u){let g,p="";for(let m=0;m<u;m++)p+=`%${e.pad(c[i+m].toString(16))}`;try{g=decodeURIComponent(p)}catch{return e.readASCII(c,i,u)}return g}};function t(c,i,u,g){const p=i*u,m=a(g),w=Math.ceil(i*m/8),C=new Uint8Array(4*p),O=new Uint32Array(C.buffer),{ctype:v}=g,{depth:E}=g,I=e.readUshort;if(v==6){const $=p<<2;if(E==8)for(var _=0;_<$;_+=4)C[_]=c[_],C[_+1]=c[_+1],C[_+2]=c[_+2],C[_+3]=c[_+3];if(E==16)for(_=0;_<$;_++)C[_]=c[_<<1]}else if(v==2){const $=g.tabs.tRNS;if($==null){if(E==8)for(_=0;_<p;_++){var M=3*_;O[_]=255<<24|c[M+2]<<16|c[M+1]<<8|c[M]}if(E==16)for(_=0;_<p;_++)M=6*_,O[_]=255<<24|c[M+4]<<16|c[M+2]<<8|c[M]}else{var x=$[0];const G=$[1],Y=$[2];if(E==8)for(_=0;_<p;_++){var y=_<<2;M=3*_,O[_]=255<<24|c[M+2]<<16|c[M+1]<<8|c[M],c[M]==x&&c[M+1]==G&&c[M+2]==Y&&(C[y+3]=0)}if(E==16)for(_=0;_<p;_++)y=_<<2,M=6*_,O[_]=255<<24|c[M+4]<<16|c[M+2]<<8|c[M],I(c,M)==x&&I(c,M+2)==G&&I(c,M+4)==Y&&(C[y+3]=0)}}else if(v==3){const $=g.tabs.PLTE,G=g.tabs.tRNS,Y=G?G.length:0;if(E==1)for(var T=0;T<u;T++){var A=T*w,P=T*i;for(_=0;_<i;_++){y=P+_<<2;var D=3*(L=c[A+(_>>3)]>>7-((7&_)<<0)&1);C[y]=$[D],C[y+1]=$[D+1],C[y+2]=$[D+2],C[y+3]=L<Y?G[L]:255}}if(E==2)for(T=0;T<u;T++)for(A=T*w,P=T*i,_=0;_<i;_++)y=P+_<<2,D=3*(L=c[A+(_>>2)]>>6-((3&_)<<1)&3),C[y]=$[D],C[y+1]=$[D+1],C[y+2]=$[D+2],C[y+3]=L<Y?G[L]:255;if(E==4)for(T=0;T<u;T++)for(A=T*w,P=T*i,_=0;_<i;_++)y=P+_<<2,D=3*(L=c[A+(_>>1)]>>4-((1&_)<<2)&15),C[y]=$[D],C[y+1]=$[D+1],C[y+2]=$[D+2],C[y+3]=L<Y?G[L]:255;if(E==8)for(_=0;_<p;_++){var L;y=_<<2,D=3*(L=c[_]),C[y]=$[D],C[y+1]=$[D+1],C[y+2]=$[D+2],C[y+3]=L<Y?G[L]:255}}else if(v==4){if(E==8)for(_=0;_<p;_++){y=_<<2;var U=c[S=_<<1];C[y]=U,C[y+1]=U,C[y+2]=U,C[y+3]=c[S+1]}if(E==16)for(_=0;_<p;_++){var S;y=_<<2,U=c[S=_<<2],C[y]=U,C[y+1]=U,C[y+2]=U,C[y+3]=c[S+2]}}else if(v==0)for(x=g.tabs.tRNS?g.tabs.tRNS:-1,T=0;T<u;T++){const $=T*w,G=T*i;if(E==1)for(var b=0;b<i;b++){var F=(U=255*(c[$+(b>>>3)]>>>7-(7&b)&1))==255*x?0:255;O[G+b]=F<<24|U<<16|U<<8|U}else if(E==2)for(b=0;b<i;b++)F=(U=85*(c[$+(b>>>2)]>>>6-((3&b)<<1)&3))==85*x?0:255,O[G+b]=F<<24|U<<16|U<<8|U;else if(E==4)for(b=0;b<i;b++)F=(U=17*(c[$+(b>>>1)]>>>4-((1&b)<<2)&15))==17*x?0:255,O[G+b]=F<<24|U<<16|U<<8|U;else if(E==8)for(b=0;b<i;b++)F=(U=c[$+b])==x?0:255,O[G+b]=F<<24|U<<16|U<<8|U;else if(E==16)for(b=0;b<i;b++)U=c[$+(b<<1)],F=I(c,$+(b<<1))==x?0:255,O[G+b]=F<<24|U<<16|U<<8|U}return C}function r(c,i,u,g){const p=a(c),m=Math.ceil(u*p/8),w=new Uint8Array((m+1+c.interlace)*g);return i=c.tabs.CgBI?o(i,w):n(i,w),c.interlace==0?i=s(i,c,0,u,g):c.interlace==1&&(i=(function(O,v){const E=v.width,I=v.height,_=a(v),M=_>>3,x=Math.ceil(E*_/8),y=new Uint8Array(I*x);let T=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],F=L[U];let $=0,G=0,Y=A[U];for(;Y<I;)Y+=b,G++;let B=P[U];for(;B<E;)B+=F,$++;const K=Math.ceil($*_/8);s(O,v,T,$,G);let j=0,H=A[U];for(;H<I;){let q=P[U],ue=T+j*K<<3;for(;q<E;){var S;if(_==1&&(S=(S=O[ue>>3])>>7-(7&ue)&1,y[H*x+(q>>3)]|=S<<7-((7&q)<<0)),_==2&&(S=(S=O[ue>>3])>>6-(7&ue)&3,y[H*x+(q>>2)]|=S<<6-((3&q)<<1)),_==4&&(S=(S=O[ue>>3])>>4-(7&ue)&15,y[H*x+(q>>1)]|=S<<4-((1&q)<<2)),_>=8){const te=H*x+q*M;for(let fe=0;fe<M;fe++)y[te+fe]=O[(ue>>3)+fe]}ue+=_,q+=F}j++,H+=b}$*G!=0&&(T+=G*(1+K)),U+=1}return y})(i,c)),i}function n(c,i){return o(new Uint8Array(c.buffer,2,c.length-6),i)}var o=(function(){const c={H:{}};return c.H.N=function(i,u){const g=Uint8Array;let p,m,w=0,C=0,O=0,v=0,E=0,I=0,_=0,M=0,x=0;if(i[0]==3&&i[1]==0)return u||new g(0);const y=c.H,T=y.b,A=y.e,P=y.R,D=y.n,L=y.A,U=y.Z,S=y.m,b=u==null;for(b&&(u=new g(i.length>>>2<<5));w==0;)if(w=T(i,x,1),C=T(i,x+1,2),x+=3,C!=0){if(b&&(u=c.H.W(u,M+(1<<17))),C==1&&(p=S.J,m=S.h,I=511,_=31),C==2){O=A(i,x,5)+257,v=A(i,x+5,5)+1,E=A(i,x+10,4)+4,x+=14;let $=1;for(var F=0;F<38;F+=2)S.Q[F]=0,S.Q[F+1]=0;for(F=0;F<E;F++){const B=A(i,x+3*F,3);S.Q[1+(S.X[F]<<1)]=B,B>$&&($=B)}x+=3*E,D(S.Q,$),L(S.Q,$,S.u),p=S.w,m=S.d,x=P(S.u,(1<<$)-1,O+v,i,x,S.v);const G=y.V(S.v,0,O,S.C);I=(1<<G)-1;const Y=y.V(S.v,O,v,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 $=p[U(i,x)&I];x+=15&$;const G=$>>>4;if(!(G>>>8))u[M++]=G;else{if(G==256)break;{let Y=M+G-254;if(G>264){const q=S.q[G-257];Y=M+(q>>>3)+A(i,x,7&q),x+=7&q}const B=m[U(i,x)&_];x+=15&B;const K=B>>>4,j=S.c[K],H=(j>>>4)+T(i,x,15&j);for(x+=15&j;M<Y;)u[M]=u[M++-H],u[M]=u[M++-H],u[M]=u[M++-H],u[M]=u[M++-H];M=Y}}}}else{(7&x)!=0&&(x+=8-(7&x));const $=4+(x>>>3),G=i[$-4]|i[$-3]<<8;b&&(u=c.H.W(u,M+G)),u.set(new g(i.buffer,i.byteOffset+$,G),M),x=$+G<<3,M+=G}return u.length==M?u:u.slice(0,M)},c.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},c.H.R=function(i,u,g,p,m,w){const C=c.H.e,O=c.H.Z;let v=0;for(;v<g;){const E=i[O(p,m)&u];m+=15&E;const I=E>>>4;if(I<=15)w[v]=I,v++;else{let _=0,M=0;I==16?(M=3+C(p,m,2),m+=2,_=w[v-1]):I==17?(M=3+C(p,m,3),m+=3):I==18&&(M=11+C(p,m,7),m+=7);const x=v+M;for(;v<x;)w[v]=_,v++}}return m},c.H.V=function(i,u,g,p){let m=0,w=0;const C=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<C;)p[w<<1]=0,p[1+(w<<1)]=0,w++;return m},c.H.n=function(i,u){const g=c.H.m,p=i.length;let m,w,C,O;const v=g.j;for(var E=0;E<=u;E++)v[E]=0;for(E=1;E<p;E+=2)v[i[E]]++;const I=g.K;for(m=0,v[0]=0,w=1;w<=u;w++)m=m+v[w-1]<<1,I[w]=m;for(C=0;C<p;C+=2)O=i[C+1],O!=0&&(i[C]=I[O],I[O]++)},c.H.A=function(i,u,g){const p=i.length,m=c.H.m.r;for(let w=0;w<p;w+=2)if(i[w+1]!=0){const C=w>>1,O=i[w+1],v=C<<4|O,E=u-O;let I=i[w]<<E;const _=I+(1<<E);for(;I!=_;)g[m[I]>>>15-u]=v,I++}},c.H.l=function(i,u){const g=c.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}},c.H.M=function(i,u,g){g<<=7&u;const p=u>>>3;i[p]|=g,i[p+1]|=g>>>8},c.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},c.H.e=function(i,u,g){return(i[u>>>3]|i[1+(u>>>3)]<<8)>>>(7&u)&(1<<g)-1},c.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},c.H.Z=function(i,u){return(i[u>>>3]|i[1+(u>>>3)]<<8|i[2+(u>>>3)]<<16)>>>(7&u)},c.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)},c.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=c.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),c.H.n(i._,9),c.H.A(i._,9,i.J),c.H.l(i._,9),g(i.$,32,5),c.H.n(i.$,5),c.H.A(i.$,5,i.h),c.H.l(i.$,5),g(i.Q,19,0),g(i.C,286,0),g(i.D,30,0),g(i.v,320,0)})(),c.H.N})();function a(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function s(c,i,u,g,p){let m=a(i);const w=Math.ceil(g*m/8);let C,O;m=Math.ceil(m/8);let v=c[u],E=0;if(v>1&&(c[u]=[0,0,1][v-2]),v==3)for(E=m;E<w;E++)c[E+1]=c[E+1]+(c[E+1-m]>>>1)&255;for(let I=0;I<p;I++)if(C=u+I*w,O=C+I+1,v=c[O-1],E=0,v==0)for(;E<w;E++)c[C+E]=c[O+E];else if(v==1){for(;E<m;E++)c[C+E]=c[O+E];for(;E<w;E++)c[C+E]=c[O+E]+c[C+E-m]}else if(v==2)for(;E<w;E++)c[C+E]=c[O+E]+c[C+E-w];else if(v==3){for(;E<m;E++)c[C+E]=c[O+E]+(c[C+E-w]>>>1);for(;E<w;E++)c[C+E]=c[O+E]+(c[C+E-w]+c[C+E-m]>>>1)}else{for(;E<m;E++)c[C+E]=c[O+E]+l(0,c[C+E-w],0);for(;E<w;E++)c[C+E]=c[O+E]+l(c[C+E-m],c[C+E-w],c[C+E-m-w])}return c}function l(c,i,u){const g=c+i-u,p=g-c,m=g-i,w=g-u;return p*p<=m*m&&p*p<=w*w?c:m*m<=w*w?i:u}function f(c,i,u){u.width=e.readUint(c,i),i+=4,u.height=e.readUint(c,i),i+=4,u.depth=c[i],i++,u.ctype=c[i],i++,u.compress=c[i],i++,u.filter=c[i],i++,u.interlace=c[i],i++}function h(c,i,u,g,p,m,w,C,O){const v=Math.min(i,p),E=Math.min(u,m);let I=0,_=0;for(let U=0;U<E;U++)for(let S=0;S<v;S++)if(w>=0&&C>=0?(I=U*i+S<<2,_=(C+U)*p+w+S<<2):(I=(-C+U)*i-w+S<<2,_=U*p+S<<2),O==0)g[_]=c[I],g[_+1]=c[I+1],g[_+2]=c[I+2],g[_+3]=c[I+3];else if(O==1){var M=c[I+3]*.00392156862745098,x=c[I]*M,y=c[I+1]*M,T=c[I+2]*M,A=g[_+3]*(1/255),P=g[_]*A,D=g[_+1]*A,L=g[_+2]*A;const b=1-M,F=M+A*b,$=F==0?0:1/F;g[_+3]=255*F,g[_+0]=(x+P*b)*$,g[_+1]=(y+D*b)*$,g[_+2]=(T+L*b)*$}else if(O==2)M=c[I+3],x=c[I],y=c[I+1],T=c[I+2],A=g[_+3],P=g[_],D=g[_+1],L=g[_+2],M==A&&x==P&&y==D&&T==L?(g[_]=0,g[_+1]=0,g[_+2]=0,g[_+3]=0):(g[_]=x,g[_+1]=y,g[_+2]=T,g[_+3]=M);else if(O==3){if(M=c[I+3],x=c[I],y=c[I+1],T=c[I+2],A=g[_+3],P=g[_],D=g[_+1],L=g[_+2],M==A&&x==P&&y==D&&T==L)continue;if(M<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,C={tabs:{},frames:[]},O=new Uint8Array(u.length);let v,E=0,I=0;const _=[137,80,78,71,13,10,26,10];for(var M=0;M<8;M++)if(u[M]!=_[M])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,C);else if(S=="iCCP"){for(var x=g;u[x]!=0;)x++;p.readASCII(u,g,x-g),u[x+1];const b=u.slice(x+2,g+U);let F=null;try{F=n(b)}catch{F=o(b)}C.tabs[S]=F}else if(S=="CgBI")C.tabs[S]=u.slice(g,g+4);else if(S=="IDAT"){for(M=0;M<U;M++)O[E+M]=u[g+M];E+=U}else if(S=="acTL")C.tabs[S]={num_frames:w(u,g),num_plays:w(u,g+4)},v=new Uint8Array(u.length);else if(S=="fcTL"){I!=0&&((L=C.frames[C.frames.length-1]).data=r(C,v.slice(0,I),L.rect.width,L.rect.height),I=0);const b={x:w(u,g+12),y:w(u,g+16),width:w(u,g+4),height:w(u,g+8)};let F=m(u,g+22);F=m(u,g+20)/(F==0?100:F);const $={rect:b,delay:Math.round(1e3*F),dispose:u[g+24],blend:u[g+25]};C.frames.push($)}else if(S=="fdAT"){for(M=0;M<U-4;M++)v[I+M]=u[g+M+4];I+=U-4}else if(S=="pHYs")C.tabs[S]=[p.readUint(u,g),p.readUint(u,g+4),u[g+8]];else if(S=="cHRM")for(C.tabs[S]=[],M=0;M<8;M++)C.tabs[S].push(p.readUint(u,g+4*M));else if(S=="tEXt"||S=="zTXt"){C.tabs[S]==null&&(C.tabs[S]={});var y=p.nextZero(u,g),T=p.readASCII(u,g,y-g),A=g+U-y-1;if(S=="tEXt")D=p.readASCII(u,y+1,A);else{var P=n(u.slice(y+2,y+2+A));D=p.readUTF8(P,0,P.length)}C.tabs[S][T]=D}else if(S=="iTXt"){C.tabs[S]==null&&(C.tabs[S]={}),y=0,x=g,y=p.nextZero(u,x),T=p.readASCII(u,x,y-x);const b=u[x=y+1];var D;u[x+1],x+=2,y=p.nextZero(u,x),p.readASCII(u,x,y-x),x=y+1,y=p.nextZero(u,x),p.readUTF8(u,x,y-x),A=U-((x=y+1)-g),b==0?D=p.readUTF8(u,x,A):(P=n(u.slice(x,x+A)),D=p.readUTF8(P,0,P.length)),C.tabs[S][T]=D}else if(S=="PLTE")C.tabs[S]=p.readBytes(u,g,U);else if(S=="hIST"){const b=C.tabs.PLTE.length/3;for(C.tabs[S]=[],M=0;M<b;M++)C.tabs[S].push(m(u,g+2*M))}else if(S=="tRNS")C.ctype==3?C.tabs[S]=p.readBytes(u,g,U):C.ctype==0?C.tabs[S]=m(u,g):C.ctype==2&&(C.tabs[S]=[m(u,g),m(u,g+2),m(u,g+4)]);else if(S=="gAMA")C.tabs[S]=p.readUint(u,g)/1e5;else if(S=="sRGB")C.tabs[S]=u[g];else if(S=="bKGD")C.ctype==0||C.ctype==4?C.tabs[S]=[m(u,g)]:C.ctype==2||C.ctype==6?C.tabs[S]=[m(u,g),m(u,g+2),m(u,g+4)]:C.ctype==3&&(C.tabs[S]=u[g]);else if(S=="IEND")break;g+=U,p.readUint(u,g),g+=4}var L;return I!=0&&((L=C.frames[C.frames.length-1]).data=r(C,v.slice(0,I),L.rect.width,L.rect.height)),C.data=r(C,O,C.width,C.height),delete C.compress,delete C.interlace,delete C.filter,C},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),C=new Uint8Array(m),O=new Uint8Array(m);for(let E=0;E<i.frames.length;E++){const I=i.frames[E],_=I.rect.x,M=I.rect.y,x=I.rect.width,y=I.rect.height,T=t(I.data,x,y,i);if(E!=0)for(var v=0;v<m;v++)O[v]=w[v];if(I.blend==0?h(T,x,y,w,u,g,_,M,0):I.blend==1&&h(T,x,y,w,u,g,_,M,1),p.push(w.buffer.slice(0)),I.dispose!=0){if(I.dispose==1)h(C,x,y,w,u,g,_,M,0);else if(I.dispose==2)for(v=0;v<m;v++)w[v]=O[v]}}return p},_paeth:l,_copyTile:h,_bin:e}})();(function(){const{_copyTile:e}=Ht,{_bin:t}=Ht,r=Ht._paeth;var n={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let T=y;for(let A=0;A<8;A++)1&T?T=3988292384^T>>>1:T>>>=1;x[y]=T}return x})(),update(x,y,T,A){for(let P=0;P<A;P++)x=n.table[255&(x^y[T+P])]^x>>>8;return x},crc:(x,y,T)=>4294967295^n.update(4294967295,x,y,T)};function o(x,y,T,A){y[T]+=x[0]*A>>4,y[T+1]+=x[1]*A>>4,y[T+2]+=x[2]*A>>4,y[T+3]+=x[3]*A>>4}function a(x){return Math.max(0,Math.min(255,x))}function s(x,y){const T=x[0]-y[0],A=x[1]-y[1],P=x[2]-y[2],D=x[3]-y[3];return T*T+A*A+P*P+D*D}function l(x,y,T,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 F=0,$=0;$<U;$++){var G=s(S[b],S[$]);$!=b&&G<H&&(H=G,F=$)}}const Y=new Uint32Array(P.buffer),B=new Int16Array(y*T*4),K=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(b=0;b<K.length;b++)K[b]=255*((K[b]+.5)/16-.5);for(let H=0;H<T;H++)for(let q=0;q<y;q++){var j;b=4*(H*y+q),L!=2?j=[a(x[b]+B[b]),a(x[b+1]+B[b+1]),a(x[b+2]+B[b+2]),a(x[b+3]+B[b+3])]:(G=K[4*(3&H)+(3&q)],j=[a(x[b]+G),a(x[b+1]+G),a(x[b+2]+G),a(x[b+3]+G)]),F=0;let ue=16777215;for($=0;$<U;$++){const ee=s(j,S[$]);ee<ue&&(ue=ee,F=$)}const te=S[F],fe=[j[0]-te[0],j[1]-te[1],j[2]-te[2],j[3]-te[3]];L==1&&(q!=y-1&&o(fe,B,b+4,7),H!=T-1&&(q!=0&&o(fe,B,b+4*y-4,3),o(fe,B,b+4*y,5),q!=y-1&&o(fe,B,b+4*y+4,1))),D[b>>2]=F,Y[b>>2]=A[F]}}function f(x,y,T,A,P){P==null&&(P={});const{crc:D}=n,L=t.writeUint,U=t.writeUshort,S=t.writeASCII;let b=8;const F=x.frames.length>1;let $,G=!1,Y=33+(F?20:0);if(P.sRGB!=null&&(Y+=13),P.pHYs!=null&&(Y+=21),P.iCCP!=null&&($=pako.deflate(P.iCCP),Y+=21+$.length+4),x.ctype==3){for(var B=x.plte.length,K=0;K<B;K++)x.plte[K]>>>24!=255&&(G=!0);Y+=8+3*B+4+(G?8+1*B+4:0)}for(var j=0;j<x.frames.length;j++)F&&(Y+=38),Y+=(te=x.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(K=0;K<8;K++)H[K]=q[K];if(L(H,b,13),b+=4,S(H,b,"IHDR"),b+=4,L(H,b,y),b+=4,L(H,b,T),b+=4,H[b]=x.depth,b++,H[b]=x.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+$.length;L(H,b,fe),b+=4,S(H,b,"iCCP"),b+=4,S(H,b,"ICC profile"),b+=11,b+=2,H.set($,b),b+=$.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),F&&(L(H,b,8),b+=4,S(H,b,"acTL"),b+=4,L(H,b,x.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),x.ctype==3){for(L(H,b,3*(B=x.plte.length)),b+=4,S(H,b,"PLTE"),b+=4,K=0;K<B;K++){const fe=3*K,ee=x.plte[K],ke=255&ee,me=ee>>>8&255,Ge=ee>>>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,K=0;K<B;K++)H[b+K]=x.plte[K]>>>24&255;b+=B,L(H,b,D(H,b-B-4,B+4)),b+=4}}let ue=0;for(j=0;j<x.frames.length;j++){var te=x.frames[j];F&&(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 ee=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,ee,b-ee)),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(x,y,T){for(let A=0;A<x.frames.length;A++){const P=x.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,y,T)}}function c(x,y,T,A,P){const D=P[0],L=P[1],U=P[2],S=P[3],b=P[4],F=P[5];let $=6,G=8,Y=255;for(var B=0;B<x.length;B++){const Me=new Uint8Array(x[B]);for(var K=Me.length,j=0;j<K;j+=4)Y&=Me[j+3]}const H=Y!=255,q=(function(Ce,we,Fe,Le,V,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=Fe,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=Fe,Ne=-1,Ke=-1;for(let Be=0;Be<Fe;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>Ke&&(Ke=Be));Ne==-1&&(Ee=he=Ne=Ke=0),V&&((1&Ee)==1&&Ee--,(1&he)==1&&he--);const $e=(Ne-Ee+1)*(Ke-he+1);$e<_e&&(_e=$e,Se=Ue,se=Ee,ie=he,le=Ne-Ee+1,ne=Ke-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,Fe,be,le,ne,-se,-ie,0),Te=e(Oe,we,Fe,be,le,ne,-se,-ie,3)?1:0,Te==1?u(Oe,we,Fe,be,{x:se,y:ie,width:le,height:ne}):e(Oe,we,Fe,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((Ve=oe[ae]).blend==1)continue;const Oe=Ve.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,Fe,oe,ae-1,le,V),i(Ce,we,Fe,oe,ae,le,V)}let He=0;if(Ce.length!=1)for(var Pe=0;Pe<oe.length;Pe++){var Ve;He+=(Ve=oe[Pe]).rect.width*Ve.rect.height}return oe})(x,y,T,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(V){let re=0;for(var oe=0;oe<V.length;oe++)re+=V[oe].byteLength;const ae=new Uint8Array(re);let be=0;for(oe=0;oe<V.length;oe++){const xe=new Uint8Array(V[oe]),He=xe.length;for(let Pe=0;Pe<He;Pe+=4){let Ve=xe[Pe],Oe=xe[Pe+1],X=xe[Pe+2];const se=xe[Pe+3];se==0&&(Ve=Oe=X=0),ae[be+Pe]=Ve,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 Fe=0;for(j=0;j<q.length;j++){const Le=(ke=q[j]).img.length;var ee=new Uint8Array(we.inds.buffer,Fe>>2,Le>>2);fe.push(ee);const V=new Uint8Array(we.abuf,Fe,Le);F&&l(ke.img,ke.rect.width,ke.rect.height,te,V,ee),ke.img.set(V),Fe+=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(K=Me.length,ee=new Uint8Array(K),fe.push(ee),j=0;j<K;j++){const Ce=Me[j];if(j!=0&&Ce==Me[j-1])ee[j]=ee[j-1];else if(j>me&&Ce==Me[j-me])ee[j]=ee[j-me];else{let we=ue[Ce];if(we==null&&(ue[Ce]=we=te.length,te.push(Ce),te.length>=300))break;ee[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,Fe=4;if(Ge<=256&&b==0){we=Math.ceil(G*me/8);var De=new Uint8Array(we*Me);const Le=fe[B];for(let V=0;V<Me;V++){j=V*we;const re=V*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,$=3,Fe=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 V=3*j,re=4*j;De[V]=Ce[re],De[V+1]=Ce[re+1],De[V+2]=Ce[re+2]}Ce=De,$=2,Fe=3,we=3*me}ke.img=Ce,ke.bpl=we,ke.bpp=Fe}return{ctype:$,depth:G,plte:te,frames:q}}function i(x,y,T,A,P,D,L){const U=Uint8Array,S=Uint32Array,b=new U(x[P-1]),F=new S(x[P-1]),$=P+1<x.length?new U(x[P+1]):null,G=new U(x[P]),Y=new S(G.buffer);let B=y,K=T,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,ee=D.y+ue,ke=ee*y+fe,me=Y[ke];me==0||A[P-1].dispose==0&&F[ke]==me&&($==null||$[4*ke+3]!=0)||(fe<B&&(B=fe),fe>j&&(j=fe),ee<K&&(K=ee),ee>H&&(H=ee))}j==-1&&(B=K=j=H=0),L&&((1&B)==1&&B--,(1&K)==1&&K--),D={x:B,y:K,width:j-B+1,height:H-K+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,y,T,q.img,D.width,D.height,-D.x,-D.y,0),u(G,y,T,q.img,D)):e(G,y,T,q.img,D.width,D.height,-D.x,-D.y,0)}function u(x,y,T,A,P){e(x,y,T,A,P.width,P.height,-P.x,-P.y,2)}function g(x,y,T,A,P,D,L){const U=[];let S,b=[0,1,2,3,4];D!=-1?b=[D]:(y*A>5e5||T==1)&&(b=[0]),L&&(S={level:0});const F=ag;for(var $=0;$<b.length;$++){for(let B=0;B<y;B++)p(P,x,B,A,T,b[$]);U.push(F.deflate(P,S))}let G,Y=1e9;for($=0;$<U.length;$++)U[$].length<Y&&(G=$,Y=U[$].length);return U[G]}function p(x,y,T,A,P,D){const L=T*A;let U=L+T;if(x[U]=D,U++,D==0)if(A<500)for(var S=0;S<A;S++)x[U+S]=y[L+S];else x.set(new Uint8Array(y.buffer,L,A),U);else if(D==1){for(S=0;S<P;S++)x[U+S]=y[L+S];for(S=P;S<A;S++)x[U+S]=y[L+S]-y[L+S-P]+256&255}else if(T==0){for(S=0;S<P;S++)x[U+S]=y[L+S];if(D==2)for(S=P;S<A;S++)x[U+S]=y[L+S];if(D==3)for(S=P;S<A;S++)x[U+S]=y[L+S]-(y[L+S-P]>>1)+256&255;if(D==4)for(S=P;S<A;S++)x[U+S]=y[L+S]-r(y[L+S-P],0,0)+256&255}else{if(D==2)for(S=0;S<A;S++)x[U+S]=y[L+S]+256-y[L+S-A]&255;if(D==3){for(S=0;S<P;S++)x[U+S]=y[L+S]+256-(y[L+S-A]>>1)&255;for(S=P;S<A;S++)x[U+S]=y[L+S]+256-(y[L+S-A]+y[L+S-P]>>1)&255}if(D==4){for(S=0;S<P;S++)x[U+S]=y[L+S]+256-r(0,y[L+S-A],0)&255;for(S=P;S<A;S++)x[U+S]=y[L+S]+256-r(y[L+S-P],y[L+S-A],y[L+S-P-A])&255}}}function m(x,y){const T=new Uint8Array(x),A=T.slice(0),P=new Uint32Array(A.buffer),D=w(A,y),L=D[0],U=D[1],S=T.length,b=new Uint8Array(S>>2);let F;if(T.length<2e7)for(var $=0;$<S;$+=4)F=C(L,G=T[$]*.00392156862745098,Y=T[$+1]*.00392156862745098,B=T[$+2]*.00392156862745098,K=T[$+3]*.00392156862745098),b[$>>2]=F.ind,P[$>>2]=F.est.rgba;else for($=0;$<S;$+=4){var G=T[$]*.00392156862745098,Y=T[$+1]*(1/255),B=T[$+2]*(1/255),K=T[$+3]*(1/255);for(F=L;F.left;)F=O(F.est,G,Y,B,K)<=0?F.left:F.right;b[$>>2]=F.ind,P[$>>2]=F.est.rgba}return{abuf:A.buffer,inds:b,plte:U}}function w(x,y,T){T==null&&(T=1e-4);const A=new Uint32Array(x.buffer),P={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=I(x,P.i0,P.i1),P.est=_(P.bst);const D=[P];for(;D.length<y;){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<T)break;const b=D[S],F=v(x,A,b.i0,b.i1,b.est.e,b.est.eMq255);if(b.i0>=F||b.i1<=F){b.est.L=0;continue}const $={i0:b.i0,i1:F,bst:null,est:null,tdst:0,left:null,right:null};$.bst=I(x,$.i0,$.i1),$.est=_($.bst);const G={i0:F,i1:b.i1,bst:null,est:null,tdst:0,left:null,right:null};for(G.bst={R:[],m:[],N:b.bst.N-$.bst.N},L=0;L<16;L++)G.bst.R[L]=b.bst.R[L]-$.bst.R[L];for(L=0;L<4;L++)G.bst.m[L]=b.bst.m[L]-$.bst.m[L];G.est=_(G.bst),b.left=$,b.right=G,D[S]=$,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 C(x,y,T,A,P){if(x.left==null)return x.tdst=(function($,G,Y,B,K){const j=G-$[0],H=Y-$[1],q=B-$[2],ue=K-$[3];return j*j+H*H+q*q+ue*ue})(x.est.q,y,T,A,P),x;const D=O(x.est,y,T,A,P);let L=x.left,U=x.right;D>0&&(L=x.right,U=x.left);const S=C(L,y,T,A,P);if(S.tdst<=D*D)return S;const b=C(U,y,T,A,P);return b.tdst<S.tdst?b:S}function O(x,y,T,A,P){const{e:D}=x;return D[0]*y+D[1]*T+D[2]*A+D[3]*P-x.eMq}function v(x,y,T,A,P,D){for(A-=4;T<A;){for(;E(x,T,P)<=D;)T+=4;for(;E(x,A,P)>D;)A-=4;if(T>=A)break;const L=y[T>>2];y[T>>2]=y[A>>2],y[A>>2]=L,T+=4,A-=4}for(;E(x,T,P)>D;)T-=4;return T+4}function E(x,y,T){return x[y]*T[0]+x[y+1]*T[1]+x[y+2]*T[2]+x[y+3]*T[3]}function I(x,y,T){const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=[0,0,0,0],D=T-y>>2;for(let L=y;L<T;L+=4){const U=x[L]*.00392156862745098,S=x[L+1]*(1/255),b=x[L+2]*(1/255),F=x[L+3]*(1/255);P[0]+=U,P[1]+=S,P[2]+=b,P[3]+=F,A[0]+=U*U,A[1]+=U*S,A[2]+=U*b,A[3]+=U*F,A[5]+=S*S,A[6]+=S*b,A[7]+=S*F,A[10]+=b*b,A[11]+=b*F,A[15]+=F*F}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 _(x){const{R:y}=x,{m:T}=x,{N:A}=x,P=T[0],D=T[1],L=T[2],U=T[3],S=A==0?0:1/A,b=[y[0]-P*P*S,y[1]-P*D*S,y[2]-P*L*S,y[3]-P*U*S,y[4]-D*P*S,y[5]-D*D*S,y[6]-D*L*S,y[7]-D*U*S,y[8]-L*P*S,y[9]-L*D*S,y[10]-L*L*S,y[11]-L*U*S,y[12]-U*P*S,y[13]-U*D*S,y[14]-U*L*S,y[15]-U*U*S],F=b,$=M;let G=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,B=0;if(A!=0)for(let j=0;j<16&&(G=$.multVec(F,G),B=Math.sqrt($.dot(G,G)),G=$.sml(1/B,G),!(j!=0&&Math.abs(B-Y)<1e-9));j++)Y=B;const K=[P*S,D*S,L*S,U*S];return{Cov:b,q:K,e:G,L:Y,eMq255:$.dot($.sml(255,K),G),eMq:$.dot(G,K),rgba:(Math.round(255*K[3])<<24|Math.round(255*K[2])<<16|Math.round(255*K[1])<<8|Math.round(255*K[0])<<0)>>>0}}var M={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Ht.encode=function(y,T,A,P,D,L,U){P==null&&(P=0),U==null&&(U=!1);const S=c(y,T,A,P,[!1,!1,!1,0,U,!1]);return h(S,-1),f(S,T,A,D,L)},Ht.encodeLL=function(y,T,A,P,D,L,U,S){const b={ctype:0+(P==1?0:2)+(D==0?0:4),depth:L,frames:[]},F=(P+D)*L,$=F*T;for(let G=0;G<y.length;G++)b.frames.push({rect:{x:0,y:0,width:T,height:A},img:new Uint8Array(y[G]),blend:0,dispose:1,bpp:Math.ceil(F/8),bpl:Math.ceil($/8)});return h(b,0,!0),f(b,T,A,U,S)},Ht.encode.compress=c,Ht.encode.dither=l,Ht.quantize=m,Ht.quantize.getKDtree=w,Ht.quantize.getNearest=C})();const Ul={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,c=new ArrayBuffer(h),i=new DataView(c),u=1<<20;let g,p,m,w,C=u,O=0,v=0,E=0;function I(x){i.setUint16(v,x,!0),v+=2}function _(x){i.setUint32(v,x,!0),v+=4}function M(x){v+=x}I(19778),_(h),M(4),_(122),_(108),_(r),_(-n>>>0),I(1),I(32),_(3),_(f),_(2835),_(2835),M(8),_(16711680),_(65280),_(255),_(4278190080),_(1466527264),(function x(){for(;O<n&&C>0;){for(w=122+O*l,g=0;g<o;)C--,p=s[E++],m=p>>>24,i.setUint32(w+g,p<<8|m),g+=4;O++}E<s.length?(C=u,setTimeout(x,Ul._dly)):t(c)})()},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"},sg={[bt.CHROME]:16384,[bt.FIREFOX]:11180,[bt.DESKTOP_SAFARI]:16384,[bt.IE]:8192,[bt.IOS]:4096,[bt.ETC]:8192};const ra=typeof window<"u",zl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,In=ra&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),lg=(ra||zl)&&(In&&In.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Hl=(ra||zl)&&(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 Gl(e){return new Promise(((t,r)=>{const n=new Hl;n.onload=()=>t(n.result),n.onerror=o=>r(o),n.readAsDataURL(e)}))}function jl(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 Bl(e,t){const r=fr(),n=sg[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 Wl(e,t){const{width:r,height:n}=Bl(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=Wl(o,t.fileType||e.type),r([o,a])}catch(f){return n(f)}},l=function(f){try{var h=function(c){try{throw c}catch(i){return n(i)}};try{let c;return Gl(e).then((function(i){try{return c=i,jl(c).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(c){h(c)}}catch(c){return n(c)}};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 $n(e,t,r,n,o=1){return new Promise((function(a,s){let l;if(t==="image/png"){let h,c,i;return h=e.getContext("2d"),{data:c}=h.getImageData(0,0,e.width,e.height),i=Ht.encode([c.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((c=>Ul.toBlob(e,c))).then(function(c){try{return l=c,l.name=r,l.lastModified=n,h.call(this)}catch(i){return s(i)}}.bind(this),s);{let c=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,c.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,c.call(this)}catch(g){return s(g)}}.bind(this),s)}}}function f(){return a(l)}}))}function Kt(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],$n(n,r.type,r.name,r.lastModified).then((function(f){try{return o=f,Kt(n),Pn(o).then((function(h){try{return a=h[0],Nr.cachedResult=a.width===1&&a.height===2,e(Nr.cachedResult)}catch(c){return t(c)}}),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 Hl;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 c=a.getUint16(l,h);l+=2;for(let i=0;i<c;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 Kl(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),Kt(e)),s}function Yl(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),Kt(e),o}function Xl(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,c,i,u,g,p,m,w,C,O,v,E,I,_,M,x;function y(A=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=A,t.onProgress(Math.min(a,100))}function T(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,y(),Pn(e,t).then(function(A){try{return[,f]=A,y(),h=Kl(f,t),y(),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 c=P,y(),Nr().then(function(D){try{return i=D?h:Yl(h,c),y(),u=t.initialQuality||1,g=t.fileType||e.type,$n(i,g,e.name,e.lastModified,u).then(function(L){try{{let S=function(){if(s--&&(v>l||v>C)){let F,$;return F=x?.95*M.width:M.width,$=x?.95*M.height:M.height,[I,_]=Dn(F,$),_.drawImage(M,0,0,F,$),u*=g==="image/png"?.85:.95,$n(I,g,e.name,e.lastModified,u).then((function(G){try{return E=G,Kt(M),M=I,v=E.size,T(Math.min(99,Math.floor((O-v)/(O-l)*100))),S}catch(Y){return o(Y)}}),o)}return[1]},b=function(){return Kt(M),Kt(I),Kt(h),Kt(i),Kt(f),T(100),n(E)};if(p=L,y(),m=p.size>l,w=p.size>e.size,!m&&!w)return T(100),n(p);var U;return C=e.size,O=p.size,v=O,M=i,x=!t.alwaysKeepResolution&&m,(U=function(F){for(;F;){if(F.then)return void F.then(U,o);try{if(F.pop){if(F.length)return F.pop()?b.call(this):F;F=S}else F=F.call(this)}catch($){return o($)}}}.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 ig=`
|
||
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 cg(e,t){return new Promise(((r,n)=>{oa||(oa=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(ig));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 lg))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 Xl(e,o).then(function(g){try{return a=g,u.call(this)}catch(p){return n(p)}}.bind(this),n);var c=function(){try{return u.call(this)}catch(g){return n(g)}}.bind(this),i=function(g){try{return Xl(e,o).then((function(p){try{return a=p,c()}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",cg(e,o).then((function(g){try{return a=g,c()}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=Fl(e,a))}catch{}return r(a)}}))}ct.getDataUrlFromFile=Gl,ct.getFilefromDataUrl=na,ct.loadImage=jl,ct.drawImageInCanvas=Wl,ct.drawFileInCanvas=Pn,ct.canvasToFile=$n,ct.getExifOrientation=Vl,ct.handleMaxWidthOrHeight=Kl,ct.followExifOrientation=Yl,ct.cleanupCanvasMemory=Kt,ct.isAutoOrientationInBrowser=Nr,ct.approximateBelowMaximumCanvasSizeOfBrowser=Bl,ct.copyExifWithoutOrientation=Fl,ct.getBrowserName=fr,ct.version="2.0.2";const dg=window.G7Core,Fn=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]}`},ql=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:"업로드 실패"},Zl=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)=>dg?.t?.(e,t)??e,gr=window.G7Core;function Ql(e){const{attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:c,initialFiles:i,endpoints:u,onFilesChange:g,onUploadComplete:p,onUploadError:m,onRemove:w,onReorder:C,uploadTriggerEvent:O,confirmBeforeRemove:v,uploadParams:E}=e,[I,_]=k.useState(i),[M,x]=k.useState([]),[y,T]=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,F]=k.useState(null),[$,G]=k.useState(!1),Y=k.useRef(!1),[B,K]=k.useState([]),j=k.useRef(i),[H,q]=k.useState(!1),[ue,te]=k.useState(0),fe=k.useRef(0),[ee,ke]=k.useState(new Map),me=k.useRef(new Map);k.useEffect(()=>{g?.(M)},[M,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=I.length+M.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}] 파일 크기(${Fn(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:Fn(ne.size),status:"pending",progress:0};if(ne.type.startsWith("image/")&&(Te.preview=URL.createObjectURL(ne)),x(ve=>[...ve,Te]),ne.type.startsWith("image/")&&f){x(ve=>ve.map(Se=>Se.id===Te.id?{...Se,status:"compressing"}:Se));try{const ve=await De(ne);x(Se=>Se.map(_e=>_e.id===Te.id?{..._e,compressedBlob:ve,size:ve.size,size_formatted:Fn(ve.size),status:"pending",progress:0}:_e))}catch{x(ve=>ve.map(Se=>Se.id===Te.id?{...Se,status:"error",error:"이미지 압축 실패"}:Se))}}}},[I.length,M.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));x(Se=>Se.map(_e=>_e.id===X.id?{..._e,progress:ve}:_e))}});return le?.data?.data??le?.data}catch(le){const ne=ql(le);throw new Error(ne)}},[t,r,n,h,u.upload]),Ce=k.useCallback(async()=>{const X=M.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++,x(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),x(_e=>_e.filter(Ue=>Ue.id!==ve.id)),_(_e=>[..._e,Se]),K(_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");x(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:"업로드 실패";x(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&&C)){const ve=[...I,...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}));C(Ue)}return se},[M,s,Me,p,m,B,I,C,u.reorder]);k.useEffect(()=>{if(!O)return;const X=gr.componentEvent.on(O,async()=>{const se=await Ce();return{uploadedAttachments:se,existingFiles:I,allFiles:[...I,...se]}});return()=>{X()}},[O,Ce,I]),k.useEffect(()=>{c&&M.some(X=>X.status==="pending")&&Ce()},[c,M,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),F(null)}catch{console.error("첨부파일 삭제 실패")}finally{G(!1)}},[w,u.delete]),Fe=k.useCallback(async X=>{"hash"in X?v?(F(X),S(!0)):await we(X):(X.preview&&URL.revokeObjectURL(X.preview),x(se=>se.filter(ie=>ie.id!==X.id)))},[v,we]),Le=k.useCallback(X=>{x(se=>se.map(ie=>ie.id===X.id?{...ie,status:"pending",error:void 0}:ie))},[]),V=k.useCallback(async X=>{const{arrayMove:se}=await Promise.resolve().then(()=>Vh),{active:ie,over:le}=X;if(!le||ie.id===le.id)return;const ne=[...I,...M];let Te;if(B.length===0)Te=ne;else{const he=new Map(B.map((Ne,Ke)=>[String(Ne),Ke]));Te=[...ne].sort((Ne,Ke)=>{const $e="hash"in Ne?String(Ne.hash):String(Ne.id),Be="hash"in Ke?String(Ke.hash):String(Ke.id);return(he.get($e)??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);K(_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),x(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,Ke)=>({id:Ne.id,order:Ke+1}));try{const Ne=await gr.api.patch(u.reorder,{order:he});gr.toast.success(Ne.message)}catch(Ne){const Ke=Ne instanceof Error?Ne.message:Re("attachment.reorder_failed");gr.toast.error(Ke)}}C?.(Ee)},[I,M,B,u.reorder,C]),re=k.useMemo(()=>[...I,...M].filter(X=>"is_image"in X?X.is_image:X.mime_type?.startsWith("image/")??!1),[I,M]),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=I.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}},[I]),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(()=>Nl);await se({src:X.download_url,downloadUrl:X.download_url,filename:X.original_filename,downloadRequiresAuth:!0})},[]),be=k.useMemo(()=>{const X=[...I,...M];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})},[I,M,B]),xe=be.length,He=xe>0,Pe=xe<o,Ve=k.useCallback(()=>x([]),[]),Oe=k.useCallback(()=>M,[M]);return{existingFiles:I,pendingFiles:M,isDragOver:y,setIsDragOver:T,isDeleting:$,totalCount:xe,hasFiles:He,canAddMore:Pe,allItems:be,imageFiles:re,handleFiles:ye,handleRemove:Fe,handleRetry:Le,handleUploadAll:Ce,handleOpenGallery:oe,handleDownload:ae,handleDragEnd:V,inputRef:A,galleryOpen:H,setGalleryOpen:q,galleryStartIndex:ue,galleryKeyRef:fe,confirmDialogOpen:U,setConfirmDialogOpen:S,itemToDelete:b,executeRemoveAttachment:we,authenticatedImageUrls:ee,clear:Ve,getPendingFiles:Oe}}const Jl=({isDragOver:e,canAddMore:t,onFiles:r,setIsDragOver:n,inputRef:o,accept:a,maxFiles:s,maxSize:l,children:f})=>d.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:[d.jsx("input",{ref:o,type:"file",multiple:!0,accept:a,onChange:h=>h.target.files&&r(h.target.files),className:"hidden"}),!f&&d.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:[d.jsx(Ct,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),d.jsx(Dt,{className:"text-sm text-gray-600 dark:text-gray-400",children:Re("attachment.drop_or_click")}),d.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 ug(){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 Rl(e){return e instanceof yt(e).SVGElement}function Mr(e){return e?Ar(e)?e.document:aa(e)?sa(e)?e:Qr(e)||Rl(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 fg(){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 ei(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 c=a[f];c!=null&&(a[f]=c+e*h)}return a},{...t})}}const Or=ei(1),tn=ei(-1);function gg(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 hg(e){if(!e)return!1;const{TouchEvent:t}=yt(e.target);return t&&e instanceof t}function ua(e){if(hg(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 gg(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}}}),ti="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function pg(e){return e.matches(ti)?e:e.querySelector(ti)}const mg={display:"none"};function bg(e){let{id:t,value:r}=e;return k.createElement("div",{id:t,style:mg},r)}function yg(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 vg(){const[e,t]=k.useState("");return{announce:k.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const ri=k.createContext(null);function wg(e){const t=k.useContext(ri);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function xg(){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 kg={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.
|
||
`},Cg={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 Sg(e){let{announcements:t=Cg,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=kg}=e;const{announce:a,announcement:s}=vg(),l=en("DndLiveRegion"),[f,h]=k.useState(!1);if(k.useEffect(()=>{h(!0)},[]),wg(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 c=k.createElement(k.Fragment,null,k.createElement(bg,{id:n,value:o.draggable}),k.createElement(yg,{id:l,announcement:s}));return r?Jt.createPortal(c,r):c}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 ni(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _g(){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 oi(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ai(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Eg(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function si(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 li(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function ii(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 Tg=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=ii(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=oi(ii(f),o);a.push({id:l,data:{droppableContainer:s,value:h}})}}return a.sort(ai)},Ng=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=si(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const h=si(f),c=o.reduce((u,g,p)=>u+oi(h[p],g),0),i=Number((c/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(ai)};function Ag(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,c=s*l,i=c/(f+h-c);return Number(i.toFixed(4))}return 0}const Mg=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=Ag(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(Eg)};function Og(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function ci(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Gt}function Ig(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 Dg=Ig(1);function Lg(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 Pg(e,t,r){const n=Lg(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)),c=o?e.width/o:e.width,i=a?e.height/a:e.height;return{width:c,height:i,top:h,right:f+c,bottom:h+i,left:f}}const $g={ignoreTransform:!1};function Ir(e,t){t===void 0&&(t=$g);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:c}=yt(e).getComputedStyle(e);h&&(r=Pg(r,h,c))}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 di(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 Ug(e,t){return t===void 0&&(t=yt(e).getComputedStyle(e)),t.position==="fixed"}function zg(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)||Rl(o)||r.includes(o))return r;const a=yt(e).getComputedStyle(o);return o!==e&&zg(o,a)&&r.push(o),Ug(o,a)?r:n(o.parentNode)}return e?n(e):r}function ui(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 fi(e){return Ar(e)?e.scrollX:e.scrollLeft}function gi(e){return Ar(e)?e.scrollY:e.scrollTop}function ga(e){return{x:fi(e),y:gi(e)}}var ot;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ot||(ot={}));function hi(e){return!Un||!e?!1:e===document.scrollingElement}function pi(e){const t={x:0,y:0},r=hi(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 Hg={x:.2,y:.2};function Gg(e,t,r,n,o){let{top:a,left:s,right:l,bottom:f}=r;n===void 0&&(n=10),o===void 0&&(o=Hg);const{isTop:h,isBottom:c,isLeft:i,isRight:u}=pi(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)):!c&&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 jg(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 mi(e){return e.reduce((t,r)=>Or(t,ga(r)),Gt)}function Bg(e){return e.reduce((t,r)=>t+fi(r),0)}function Wg(e){return e.reduce((t,r)=>t+gi(r),0)}function Vg(e,t){if(t===void 0&&(t=Ir),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);ui(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Kg=[["x",["left","right"],Bg],["y",["top","bottom"],Wg]];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=mi(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),c=o[a]-h;return this.rect[f]+c},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 Yg(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 bi(e){e.preventDefault()}function Xg(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 yi={start:[ze.Space,ze.Enter],cancel:[ze.Esc],end:[ze.Space,ze.Enter,ze.Tab]},qg=(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&&Vg(n),r(Gt)}handleKeyDown(t){if(da(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=yi,coordinateGetter:s=qg,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,c=h?{x:h.left,y:h.top}:Gt;this.referenceCoordinates||(this.referenceCoordinates=c);const i=s(t,{active:r,context:n.current,currentCoordinates:c});if(i){const u=tn(i,c),g={x:0,y:0},{scrollableAncestors:p}=n.current;for(const m of p){const w=t.code,{isTop:C,isRight:O,isLeft:v,isBottom:E,maxScroll:I,minScroll:_}=pi(m),M=jg(m),x={x:Math.min(w===ze.Right?M.right-M.width/2:M.right,Math.max(w===ze.Right?M.left:M.left+M.width/2,i.x)),y:Math.min(w===ze.Down?M.bottom-M.height/2:M.bottom,Math.max(w===ze.Down?M.top:M.top+M.height/2,i.y))},y=w===ze.Right&&!O||w===ze.Left&&!v,T=w===ze.Down&&!E||w===ze.Up&&!C;if(y&&x.x!==i.x){const A=m.scrollLeft+u.x,P=w===ze.Right&&A<=I.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-I.x:m.scrollLeft-_.x,g.x&&m.scrollBy({left:-g.x,behavior:l});break}else if(T&&x.y!==i.y){const A=m.scrollTop+u.y,P=w===ze.Down&&A<=I.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-I.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=yi,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 vi(e){return!!(e&&"distance"in e)}function wi(e){return!!(e&&"delay"in e)}class ba{constructor(t,r,n){var o;n===void 0&&(n=Yg(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,bi),this.windowListeners.add(It.VisibilityChange,this.handleCancel),this.windowListeners.add(It.ContextMenu,bi),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(wi(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(vi(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,Xg,{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(vi(l)){if(l.tolerance!=null&&pa(h,l.tolerance))return this.handleCancel();if(pa(h,l.distance))return this.handleStart()}if(wi(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 Zg={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,Zg,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 Qg={move:{name:"mousemove"},end:{name:"mouseup"}};var va;(function(e){e[e.RightClick=2]="RightClick"})(va||(va={}));class Jg extends ba{constructor(t){super(t,Qg,Mr(t.event.target))}}Jg.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 Rg 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(){}}}Rg.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 eh(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:c,delta:i,threshold:u}=e;const g=rh({delta:i,disabled:!a}),[p,m]=fg(),w=k.useRef({x:0,y:0}),C=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]),v=k.useRef(null),E=k.useCallback(()=>{const _=v.current;if(!_)return;const M=w.current.x*C.current.x,x=w.current.y*C.current.y;_.scrollBy(M,x)},[]),I=k.useMemo(()=>l===jn.TreeOrder?[...h].reverse():h,[l,h]);k.useEffect(()=>{if(!a||!h.length||!O){m();return}for(const _ of I){if(n?.(_)===!1)continue;const M=h.indexOf(_),x=c[M];if(!x)continue;const{direction:y,speed:T}=Gg(_,x,O,t,u);for(const A of["x","y"])g[A][y[A]]||(T[A]=0,y[A]=0);if(T.x>0||T.y>0){m(),v.current=_,p(E,s),w.current=T,C.current=y;return}}w.current={x:0,y:0},C.current={x:0,y:0},m()},[t,E,n,m,a,s,JSON.stringify(O),JSON.stringify(g),p,h,I,c,JSON.stringify(u)])}const th={x:{[ot.Backward]:!1,[ot.Forward]:!1},y:{[ot.Backward]:!1,[ot.Forward]:!1}};function rh(e){let{delta:t,disabled:r}=e;const n=ia(t);return Rr(o=>{if(r||!n||!o)return th;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 nh(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 oh(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 xi=new Map;function ah(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=k.useState(null),{frequency:l,measure:f,strategy:h}=o,c=k.useRef(e),i=w(),u=Jr(i),g=k.useCallback(function(C){C===void 0&&(C=[]),!u.current&&s(O=>O===null?C:O.concat(C.filter(v=>!O.includes(v))))},[u]),p=k.useRef(null),m=Rr(C=>{if(i&&!r)return xi;if(!C||C===xi||c.current!==e||a!=null){const O=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){O.set(v.id,v.rect.current);continue}const E=v.node.current,I=E?new ha(f(E),E):null;v.rect.current=I,I&&O.set(v.id,I)}return O}return C},[e,a,r,i,f]);return k.useEffect(()=>{c.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 ki(e,t){return Rr(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function sh(e,t){return ki(e,t)}function lh(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 ih(e){return new ha(Ir(e),e)}function Ci(e,t,r){t===void 0&&(t=ih);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 c=t(e);return JSON.stringify(f)===JSON.stringify(c)?f:c})}const s=lh({callback(f){if(e)for(const h of f){const{type:c,target:i}=h;if(c==="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 ch(e){const t=ki(e);return ci(e,t)}const Si=[];function dh(e){const t=k.useRef(e),r=Rr(n=>e?n&&n!==Si&&e&&t.current&&e.parentNode===t.current.parentNode?n:Gn(e):Si,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function uh(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):mi(e):Gt,[e,t])}function _i(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 fh(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 gh(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 Ei(e){return k.useMemo(()=>e?Fg(e):null,[e])}const Ti=[];function hh(e,t){t===void 0&&(t=Ir);const[r]=e,n=Ei(r?yt(r):null),[o,a]=k.useState(Ti);function s(){a(()=>e.length?e.map(f=>hi(f)?n:new ha(t(f),f)):Ti)}const l=Bn({callback:s});return Yt(()=>{l?.disconnect(),s(),e.forEach(f=>l?.observe(f))},[e]),o}function ph(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qr(t)?t:e}function mh(e){let{measure:t}=e;const[r,n]=k.useState(null),o=k.useCallback(h=>{for(const{target:c}of h)if(Qr(c)){n(i=>{const u=t(c);return i?{...i,width:u.width,height:u.height}:u});break}},[t]),a=Bn({callback:o}),s=k.useCallback(h=>{const c=ph(h);a?.disconnect(),c&&a?.observe(c),n(c?t(c):null)},[t,a]),[l,f]=zn(s);return k.useMemo(()=>({nodeRef:l,rect:r,setRef:f}),[r,l,f])}const bh=[{sensor:ya,options:{}},{sensor:ma,options:{}}],yh={current:{}},Wn={draggable:{measure:di},droppable:{measure:di,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 vh={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},wh={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Hn,draggableNodes:new Map,over:null,measureDroppableContainers:Hn},Vn=k.createContext(wh),Ni=k.createContext(vh);function xh(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new sn}}}function kh(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 Ch(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=k.useContext(Vn),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 c of[f.current,h.current]){if(!c)continue;const i=pg(c);if(i){i.focus();break}}})}},[n,t,o,s,a]),null}function Sh(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function _h(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 Eh(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 c=r(h),i=ci(c,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=ui(h);u&&u.scrollBy({top:i.y,left:i.x})}},[t,s,l,n,r])}const Ai=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 Th=k.memo(function(t){var r,n,o,a;let{id:s,accessibility:l,autoScroll:f=!0,children:h,sensors:c=bh,collisionDetection:i=Mg,measuring:u,modifiers:g,...p}=t;const m=k.useReducer(kh,void 0,xh),[w,C]=m,[O,v]=xg(),[E,I]=k.useState(tr.Uninitialized),_=E===tr.Initialized,{draggable:{active:M,nodes:x,translate:y},droppable:{containers:T}}=w,A=M!=null?x.get(M):null,P=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var Ee;return M!=null?{id:M,data:(Ee=A?.data)!=null?Ee:yh,rect:P}:null},[M,A]),L=k.useRef(null),[U,S]=k.useState(null),[b,F]=k.useState(null),$=Jr(p,Object.values(p)),G=en("DndDescribedBy",s),Y=k.useMemo(()=>T.getEnabled(),[T]),B=_h(u),{droppableRects:K,measureDroppableContainers:j,measuringScheduled:H}=ah(Y,{dragging:_,dependencies:[y.x,y.y],config:B.droppable}),q=nh(x,M),ue=k.useMemo(()=>b?ua(b):null,[b]),te=je(),fe=sh(q,B.draggable.measure);Eh({activeNode:M!=null?x.get(M):null,config:te.layoutShiftCompensation,initialRect:fe,measure:B.draggable.measure});const ee=Ci(q,B.draggable.measure,fe),ke=Ci(q?q.parentElement:null),me=k.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=T.getNodeFor((r=me.current.over)==null?void 0:r.id),De=mh({measure:B.dragOverlay.measure}),ye=(n=De.nodeRef.current)!=null?n:q,Me=_?(o=De.rect)!=null?o:ee:null,Ce=!!(De.nodeRef.current&&De.rect),we=ch(Ce?null:ee),Fe=Ei(ye?yt(ye):null),Le=dh(_?Ge??q:null),V=hh(Le),re=Sh(g,{transform:{x:y.x-we.x,y:y.y-we.y,scaleX:1,scaleY:1},activatorEvent:b,active:D,activeNodeRect:ee,containerNodeRect:ke,draggingNodeRect:Me,over:me.current.over,overlayNodeRect:De.rect,scrollableAncestors:Le,scrollableAncestorRects:V,windowRect:Fe}),oe=ue?Or(ue,y):null,ae=uh(Le),be=_i(ae),xe=_i(ae,[ee]),He=Or(re,be),Pe=Me?Dg(Me,re):null,Ve=D&&Pe?i({active:D,collisionRect:Pe,droppableRects:K,droppableContainers:Y,pointerCoordinates:oe}):null,Oe=li(Ve,"id"),[X,se]=k.useState(null),ie=Ce?re:Or(re,xe),le=Og(ie,(a=X?.rect)!=null?a:null,ee),ne=k.useRef(null),Te=k.useCallback((Ee,he)=>{let{sensor:Ne,options:Ke}=he;if(L.current==null)return;const $e=x.get(L.current);if(!$e)return;const Be=Ee.nativeEvent,Ze=new Ne({active:L.current,activeNode:$e,event:Be,options:Ke,context:me,onAbort(qe){if(!x.get(qe))return;const{onDragAbort:_t}=$.current,Bt={id:qe};_t?.(Bt),O({type:"onDragAbort",event:Bt})},onPending(qe,jt,_t,Bt){if(!x.get(qe))return;const{onDragPending:Et}=$.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=x.get(jt);if(!_t)return;const{onDragStart:Bt}=$.current,dt={activatorEvent:Be,active:{id:jt,data:_t.data,rect:P}};Jt.unstable_batchedUpdates(()=>{Bt?.(dt),I(tr.Initializing),C({type:et.DragStart,initialCoordinates:qe,active:jt}),O({type:"onDragStart",event:dt}),S(ne.current),F(Be)})},onMove(qe){C({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}=$.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(()=>{C({type:qe}),I(tr.Uninitialized),se(null),S(null),F(null),ne.current=null;const nr=qe===et.DragEnd?"onDragEnd":"onDragCancel";if(Wt){const mr=$.current[nr];mr?.(Wt),O({type:nr,event:Wt})}})}}},[x]),ve=k.useCallback((Ee,he)=>(Ne,Ke)=>{const $e=Ne.nativeEvent,Be=x.get(Ke);if(L.current!==null||!Be||$e.dndKit||$e.defaultPrevented)return;const Ze={active:Be};Ee(Ne,he.options,Ze)===!0&&($e.dndKit={capturedBy:he.sensor},L.current=Ke,Te(Ne,he))},[x,Te]),Se=oh(c,ve);fh(c),Yt(()=>{ee&&E===tr.Initializing&&I(tr.Initialized)},[ee,E]),k.useEffect(()=>{const{onDragMove:Ee}=$.current,{active:he,activatorEvent:Ne,collisions:Ke,over:$e}=me.current;if(!he||!Ne)return;const Be={active:he,activatorEvent:Ne,collisions:Ke,delta:{x:He.x,y:He.y},over:$e};Jt.unstable_batchedUpdates(()=>{Ee?.(Be),O({type:"onDragMove",event:Be})})},[He.x,He.y]),k.useEffect(()=>{const{active:Ee,activatorEvent:he,collisions:Ne,droppableContainers:Ke,scrollAdjustedTranslate:$e}=me.current;if(!Ee||L.current==null||!he||!$e)return;const{onDragOver:Be}=$.current,Ze=Ke.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:$e.x,y:$e.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:Ve,droppableRects:K,draggableNodes:x,draggingNode:ye,draggingNodeRect:Me,droppableContainers:T,over:X,scrollableAncestors:Le,scrollAdjustedTranslate:He},P.current={initial:Me,translated:Pe}},[D,q,Ve,Pe,x,ye,Me,K,T,X,Le,He]),eh({...te,delta:y,draggingRect:Pe,pointerCoordinates:oe,scrollableAncestors:Le,scrollableAncestorRects:V});const _e=k.useMemo(()=>({active:D,activeNode:q,activeNodeRect:ee,activatorEvent:b,collisions:Ve,containerNodeRect:ke,dragOverlay:De,draggableNodes:x,droppableContainers:T,droppableRects:K,over:X,measureDroppableContainers:j,scrollableAncestors:Le,scrollableAncestorRects:V,measuringConfiguration:B,measuringScheduled:H,windowRect:Fe}),[D,q,ee,b,Ve,ke,De,x,T,K,X,j,Le,V,B,H,Fe]),Ue=k.useMemo(()=>({activatorEvent:b,activators:Se,active:D,activeNodeRect:ee,ariaDescribedById:{draggable:G},dispatch:C,draggableNodes:x,over:X,measureDroppableContainers:j}),[b,Se,D,ee,C,G,x,X,j]);return k.createElement(ri.Provider,{value:v},k.createElement(Vn.Provider,{value:Ue},k.createElement(Ni.Provider,{value:_e},k.createElement(Ai.Provider,{value:le},h)),k.createElement(Ch,{disabled:l?.restoreFocus===!1})),k.createElement(Sg,{...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}}}),Nh=k.createContext(null),Mi="button",Ah="Draggable";function Mh(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=en(Ah),{activators:s,activatorEvent:l,active:f,activeNodeRect:h,ariaDescribedById:c,draggableNodes:i,over:u}=k.useContext(Vn),{role:g=Mi,roleDescription:p="draggable",tabIndex:m=0}=o??{},w=f?.id===t,C=k.useContext(w?Ai:Nh),[O,v]=zn(),[E,I]=zn(),_=gh(s,t),M=Jr(r);Yt(()=>(i.set(t,{id:t,key:a,node:O,activatorNode:E,data:M}),()=>{const y=i.get(t);y&&y.key===a&&i.delete(t)}),[i,t]);const x=k.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":n,"aria-pressed":w&&g===Mi?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[n,g,m,w,p,c.draggable]);return{active:f,activatorEvent:l,activeNodeRect:h,attributes:x,isDragging:w,listeners:n?void 0:_,node:O,over:u,setNodeRef:v,setActivatorNodeRef:I,transform:C}}function Oh(){return k.useContext(Ni)}const Ih="Droppable",Dh={timeout:25};function Lh(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=en(Ih),{active:s,dispatch:l,over:f,measureDroppableContainers:h}=k.useContext(Vn),c=k.useRef({disabled:r}),i=k.useRef(!1),u=k.useRef(null),g=k.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:w}={...Dh,...o},C=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(C.current)?C.current:[C.current]),g.current=null},w)},[w]),v=Bn({callback:O,disabled:p||!s}),E=k.useCallback((x,y)=>{v&&(y&&(v.unobserve(y),i.current=!1),x&&v.observe(x))},[v]),[I,_]=zn(E),M=Jr(t);return k.useEffect(()=>{!v||!I.current||(v.disconnect(),i.current=!1,v.observe(I.current))},[I,v]),k.useEffect(()=>(l({type:et.RegisterDroppable,element:{id:n,key:a,disabled:r,node:I,rect:u,data:M}}),()=>l({type:et.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==c.current.disabled&&(l({type:et.SetDroppableDisabled,id:n,key:a,disabled:r}),c.current.disabled=r)},[n,a,r,l]),{active:s,rect:u,isOver:f?.id===n,node:I,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 Ph(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function Kn(e){return e!==null&&e>=0}function $h(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}},Oi="Sortable",Ii=k.createContext({activeIndex:-1,containerId:Oi,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Yn,disabled:{draggable:!1,droppable:!1}});function Di(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:c}=Oh(),i=en(Oi,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,C=k.useRef(g),O=!$h(g,C.current),v=w!==-1&&m===-1||O,E=Fh(a);Yt(()=>{O&&p&&c(g)},[O,g,p,c]),k.useEffect(()=>{C.current=g},[g]);const I=k.useMemo(()=>({activeIndex:m,containerId:i,disabled:E,disableTransforms:v,items:g,overIndex:w,useDragOverlay:u,sortedRects:Ph(g,f),strategy:o}),[m,i,E.draggable,E.droppable,v,g,w,f,u,o]);return k.createElement(Ii.Provider,{value:I},t)}const Li=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return ka(r,n,o).indexOf(t)},Pi=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},Uh={duration:200,easing:"ease"},$i="transform",zh=rn.Transition.toString({property:$i,duration:0,easing:"linear"}),Hh={roleDescription:"sortable"};function Gh(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}),c={x:f.left-h.left,y:f.top-h.top,scaleX:f.width/h.width,scaleY:f.height/h.height};(c.x||c.y)&&s(c)}}r!==l.current&&(l.current=r)},[t,r,n,o]),k.useEffect(()=>{a&&s(null)},[a]),a}function Fi(e){let{animateLayoutChanges:t=Pi,attributes:r,disabled:n,data:o,getNewIndex:a=Li,id:s,strategy:l,resizeObserverConfig:f,transition:h=Uh}=e;const{items:c,containerId:i,activeIndex:u,disabled:g,disableTransforms:p,sortedRects:m,overIndex:w,useDragOverlay:C,strategy:O}=k.useContext(Ii),v=jh(n,g),E=c.indexOf(s),I=k.useMemo(()=>({sortable:{containerId:i,index:E,items:c},...o}),[i,o,E,c]),_=k.useMemo(()=>c.slice(c.indexOf(s)),[c,s]),{rect:M,node:x,isOver:y,setNodeRef:T}=Lh({id:s,data:I,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...f}}),{active:A,activatorEvent:P,activeNodeRect:D,attributes:L,setNodeRef:U,listeners:S,isDragging:b,over:F,setActivatorNodeRef:$,transform:G}=Mh({id:s,data:I,attributes:{...Hh,...r},disabled:v.draggable}),Y=ug(T,U),B=!!A,K=B&&!p&&Kn(u)&&Kn(w),j=!C&&b,H=j&&K?G:null,ue=K?H??(l??O)({rects:m,activeNodeRect:D,activeIndex:u,overIndex:w,index:E}):null,te=Kn(u)&&Kn(w)?a({id:s,items:c,activeIndex:u,overIndex:w}):E,fe=A?.id,ee=k.useRef({activeId:fe,items:c,newIndex:te,containerId:i}),ke=c!==ee.current.items,me=t({active:A,containerId:i,isDragging:b,isSorting:B,id:s,index:E,items:c,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:h,wasDragging:ee.current.activeId!=null}),Ge=Gh({disabled:!me,index:E,node:x,rect:M});return k.useEffect(()=>{B&&ee.current.newIndex!==te&&(ee.current.newIndex=te),i!==ee.current.containerId&&(ee.current.containerId=i),c!==ee.current.items&&(ee.current.items=c)},[B,te,i,c]),k.useEffect(()=>{if(fe===ee.current.activeId)return;if(fe!=null&&ee.current.activeId==null){ee.current.activeId=fe;return}const ye=setTimeout(()=>{ee.current.activeId=fe},50);return()=>clearTimeout(ye)},[fe]),{active:A,activeIndex:u,attributes:L,data:I,rect:M,index:E,newIndex:te,items:c,isOver:y,isSorting:B,isDragging:b,listeners:S,node:x,overIndex:w,over:F,setNodeRef:Y,setActivatorNodeRef:$,setDroppableNodeRef:T,setDraggableNodeRef:U,transform:Ge??ue,transition:De()};function De(){if(Ge||ke&&ee.current.newIndex===E)return zh;if(!(j&&!da(P)||!h)&&(B||me))return rn.Transition.toString({...h,property:$i})}}function jh(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 Bh=[ze.Down,ze.Right,ze.Up,ze.Left],Ui=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(Bh.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=Ng({collisionRect:n,droppableRects:o,droppableContainers:f});let c=li(h,"id");if(c===s?.id&&h.length>1&&(c=h[1].id),c!=null){const i=a.get(r.id),u=a.get(c),g=u?o.get(u.id):null,p=u?.node.current;if(p&&g&&i&&u){const w=Gn(p).some((_,M)=>l[M]!==_),C=zi(i,u),O=Wh(i,u),v=w||!C?{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 v.x&&v.y?E:tn(E,v)}}}};function zi(e,t){return!ln(e)||!ln(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Wh(e,t){return!ln(e)||!ln(t)||!zi(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Vh=Object.freeze(Object.defineProperty({__proto__:null,SortableContext:Di,arrayMove:ka,defaultAnimateLayoutChanges:Pi,defaultNewIndexGetter:Li,hasSortableData:ln,rectSortingStrategy:Yn,sortableKeyboardCoordinates:Ui,useSortable:Fi},Symbol.toStringTag,{value:"Module"})),Kh=window.G7Core,Hi=({file:e,onRemove:t,onRetry:r,onImageClick:n,onDownload:o,isPrimary:a,onPrimaryClick:s})=>{const{attributes:l,listeners:f,setNodeRef:h,transform:c,transition:i,isDragging:u}=Fi({id:"hash"in e?e.hash:e.id}),g={transform:rn.Transform.toString(c),transition:i,opacity:u?.5:1},p="status"in e&&e.status!==void 0,m=p?e.status:"done",w=m==="uploading",C=m==="compressing",O=m==="error",v=p?e.progress:100,E=p?e.preview:void 0,I=p?e.mime_type?.startsWith("image/")??!1:e.is_image,[_,M]=k.useState(void 0),x=!p&&I?e.download_url:void 0;k.useEffect(()=>{if(!x){M(void 0);return}let T=!0,A;return(async()=>{try{const D=await Kh.api.get(x,{responseType:"blob"});T&&D&&(A=URL.createObjectURL(D),M(A))}catch(D){console.error("Failed to load authenticated image:",D)}})(),()=>{T=!1,A&&URL.revokeObjectURL(A)}},[x]);const y=_;return d.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:[d.jsxs(W,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${I||!p?"cursor-pointer":""}`,onClick:()=>{w||C||(I&&n?n():!p&&o&&o())},children:[E||y?d.jsx(Lt,{src:E||y,alt:e.original_filename,className:"w-full h-full object-cover"}):d.jsx(Ct,{className:`fa-solid ${Zl(e.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(w||C)&&d.jsxs(W,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[d.jsx(W,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:d.jsx(W,{className:"h-full bg-blue-500 transition-all",style:{width:`${v}%`}})}),d.jsxs(R,{className:"text-white text-xs mt-1",children:[v,"%"]})]}),O&&d.jsx(W,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:d.jsx(Ct,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),s&&d.jsx(Q,{type:"button",onClick:T=>{T.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:d.jsx(Ct,{className:"fa-solid fa-star text-xs"})}),d.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:[d.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:T=>T.stopPropagation(),children:d.jsx(Ct,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&o&&d.jsx(Q,{type:"button",onClick:T=>{T.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:d.jsx(Ct,{className:"fa-solid fa-download text-sm"})}),O&&r&&d.jsx(Q,{type:"button",onClick:T=>{T.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:d.jsx(Ct,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),d.jsx(Q,{type:"button",onClick:T=>{T.stopPropagation(),t()},disabled:w||C,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:d.jsx(Ct,{className:"fa-solid fa-times text-sm"})})]})]}),d.jsxs(W,{className:`p-2 ${!p&&o?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&o&&o()},children:[d.jsx(Dt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:e.original_filename,children:e.original_filename}),d.jsx(Dt,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.size_formatted})]})]})},Gi=({allItems:e,canAddMore:t,totalCount:r,maxFiles:n,maxSize:o,accept:a,onRemove:s,onRetry:l,onImageClick:f,onDownload:h,onDragEnd:c,onAddClick:i,enablePrimarySelection:u,primaryFileId:g,onPrimaryChange:p})=>{const m=_g(ni(ya,{activationConstraint:{distance:8}}),ni(ma,{coordinateGetter:Ui}));return d.jsxs(W,{className:"p-3",children:[d.jsx(Th,{sensors:m,collisionDetection:Tg,onDragEnd:c,children:d.jsx(Di,{items:e.map(w=>"hash"in w?w.hash:w.id),strategy:Yn,children:d.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 C="hash"in w,O=C?w.is_image:w.mime_type?.startsWith("image/")??!1;return d.jsx(Hi,{file:w,onRemove:()=>s(w),onRetry:"status"in w&&w.status==="error"?()=>l(w):void 0,onImageClick:O?()=>f(w):void 0,onDownload:C?()=>h(w):void 0,isPrimary:u&&C&&(w.hash||w.id)===g,onPrimaryClick:u&&C?()=>p?.(w.hash||w.id):void 0},C?w.hash:w.id)}),t&&d.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:[d.jsx(Ct,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),d.jsx(R,{className:"text-xs text-gray-500 dark:text-gray-400",children:Re("common.add")})]})]})})}),d.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:[d.jsx(R,{children:Re("attachment.attached_count",{count:r,max:n})}),d.jsxs(R,{children:[Re("attachment.max_size",{size:o}),a&&` (${a})`]})]})]})},Yh=[],Xh=[],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=Xh,autoUpload:c=!0,onFilesChange:i,onChange:u,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:w,initialFiles:C=Yh,className:O="",confirmBeforeRemove:v=!1,confirmRemoveTitle:E,confirmRemoveMessage:I,apiEndpoints:_,uploadParams:M,enablePrimarySelection:x=!1,primaryFileId:y,onPrimaryChange:T,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=Ql({attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:h,autoUpload:c,initialFiles:C,endpoints:L,onFilesChange:S,onUploadComplete:g,onUploadError:p,onRemove:m,onReorder:w,uploadTriggerEvent:e,confirmBeforeRemove:v,uploadParams:M});k.useImperativeHandle(D,()=>({uploadAll:b.handleUploadAll,clear:b.clear,getPendingFiles:b.getPendingFiles}));const F=k.useMemo(()=>b.imageFiles.map(G=>{const Y=!("hash"in G),B=G,K=G;return Y?{src:B.preview||"",filename:B.original_filename,title:B.original_filename,downloadRequiresAuth:!1}:{src:b.authenticatedImageUrls.get(K.id)||K.download_url,downloadUrl:K.download_url,filename:K.original_filename,title:K.original_filename,downloadRequiresAuth:!0}}),[b.imageFiles,b.authenticatedImageUrls]),$=k.useMemo(()=>({existingFiles:b.existingFiles,pendingFiles:b.pendingFiles,isDragOver:b.isDragOver,isDeleting:b.isDeleting,maxFiles:o,maxSize:a,accept:l,endpoints:L,confirmBeforeRemove:v,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,v]);return d.jsx($l,{value:$,children:d.jsxs(W,{id:A,className:O,...P,children:[d.jsx(Jl,{isDragOver:b.isDragOver,canAddMore:b.canAddMore,onFiles:b.handleFiles,setIsDragOver:b.setIsDragOver,inputRef:b.inputRef,accept:l,maxFiles:o,maxSize:a,children:b.hasFiles&&d.jsx(Gi,{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:x,primaryFileId:y,onPrimaryChange:T})}),v&&d.jsx(ta,{isOpen:b.confirmDialogOpen,onClose:()=>{b.isDeleting||b.setConfirmDialogOpen(!1)},title:E??Re("attachment.delete_confirm_title"),message:I??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")}),F.length>0&&b.galleryOpen&&d.jsx(Tr,{images:F,isOpen:!0,onClose:()=>b.setGalleryOpen(!1),startIndex:b.galleryStartIndex,showDownload:!0},`gallery-${b.galleryKeyRef.current}`)]})})});Xn.displayName="FileUploader";const qh=Object.freeze(Object.defineProperty({__proto__:null,FileDropZone:Jl,FileList:Gi,FileUploader:Xn,FileUploaderProvider:$l,SortableThumbnailItem:Hi,default:Xn,extractErrorMessage:ql,fileUploaderT:Re,formatFileSize:Fn,getFileIcon:Zl,useFileUploader:Ql,useFileUploaderContext:tg},Symbol.toStringTag,{value:"Module"})),ji=({provider:e,className:t="w-5 h-5"})=>{switch(e){case"google":return d.jsxs("svg",{className:t,viewBox:"0 0 24 24",children:[d.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"}),d.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"}),d.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"}),d.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 d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"currentColor",d:"M16.273 12.845L7.376 0H0v24h7.727V11.155L16.624 24H24V0h-7.727z"})});case"kakao":return d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.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 d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.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 d.jsx("svg",{className:t,viewBox:"0 0 24 24",children:d.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}},Bi=(e,t)=>window.G7Core?.t?.(e,t)??e,Zh=[{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"}],Wi=({providers:e=["google","naver","kakao"],mode:t="login",variant:r="full",className:n="",id:o,editorAttrs:a})=>{const s=h=>{const c=encodeURIComponent(window.location.href);window.location.href=`/api/auth/${h}?redirect=${c}`},l=h=>t==="register"?Bi("auth.social.register_with",{provider:h}):Bi("auth.social.login_with",{provider:h}),f=Zh.filter(h=>e.includes(h.id));return r==="icon"?d.jsx(W,{className:`flex justify-center gap-4 ${n}`,id:o,...a,children:f.map(h=>d.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:d.jsx(ji,{provider:h.id,className:"w-5 h-5"})},h.id))}):d.jsx(W,{className:`space-y-3 ${n}`,id:o,...a,children:f.map(h=>d.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:[d.jsx(ji,{provider:h.id,className:"w-5 h-5"}),d.jsx(R,{children:l(h.name)})]},h.id))})},Qh=Object.freeze(Object.defineProperty({__proto__:null,default:Wi},Symbol.toStringTag,{value:"Module"})),Jh=(e,t)=>window.G7Core?.t?.(e,t)??e,Rh={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"}},e0={"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 c=new Map(h);return c.set(l.id,!0),c});const f=l.duration||r;f>0&&setTimeout(()=>{s(l.id)},f)})},[e,r,s,o]),!e||e.length===0?null:d.jsx(W,{className:`fixed z-[9999] flex flex-col gap-2 ${e0[t]}`,"aria-live":"polite","aria-atomic":"true",children:e.map(l=>d.jsx(t0,{toast:l,position:t,isVisible:o.get(l.id)??!0,onClose:()=>s(l.id)},l.id))})},t0=({toast:e,position:t,isVisible:r,onClose:n})=>{const o=Vi[e.type]||Vi.info,a=e.icon?e.icon:Rh[e.type],s=t.startsWith("bottom")?"translate-y-2":"-translate-y-2";return d.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:[d.jsx(de,{name:a,className:`w-5 h-5 flex-shrink-0 ${o.text}`}),d.jsx(R,{className:`flex-1 text-sm font-medium ${o.text}`,children:e.message}),d.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":Jh("common.close"),children:d.jsx(de,{name:Je.Times,className:"w-4 h-4"})})]})},r0=Object.freeze(Object.defineProperty({__proto__:null,Toast:Ca,default:Ca},Symbol.toStringTag,{value:"Module"})),n0=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){n0.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{n(s)})},[]),r?d.jsxs(W,{className:`fixed top-0 left-0 right-0 z-50 ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[d.jsx(W,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:d.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"}})}),d.jsx("style",{children:`
|
||
@keyframes loading {
|
||
0% {
|
||
transform: translateX(-100%);
|
||
}
|
||
50% {
|
||
transform: translateX(300%);
|
||
}
|
||
100% {
|
||
transform: translateX(-100%);
|
||
}
|
||
}
|
||
`})]}):null},o0=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:Sa,default:Sa},Symbol.toStringTag,{value:"Module"})),Ki=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){Ki.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{Ki.log("isPending changed:",s),n(s)})},[]),r?d.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},a0=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:_a,default:_a},Symbol.toStringTag,{value:"Module"})),Yi={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xi=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),s0=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),l0=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),i0=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),c0=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),qi={DataGrid:(e,t)=>d.jsxs("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsx("div",{className:`h-10 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${e}`,children:d.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[d.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-24 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-20 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"})]})}),Array.from({length:t},(r,n)=>d.jsx("div",{className:`h-12 border-b border-gray-100 dark:border-gray-800 ${e}`,style:{animationDelay:`${n*75}ms`},children:d.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[d.jsx("div",{className:"h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded"}),d.jsx("div",{className:"h-3 flex-1 bg-gray-200 dark:bg-gray-700 rounded"}),d.jsx("div",{className:"h-3 w-16 bg-gray-100 dark:bg-gray-800 rounded"}),d.jsx("div",{className:"h-3 w-14 bg-gray-100 dark:bg-gray-800 rounded"})]})},n))]}),Pagination:e=>d.jsx("div",{className:"flex justify-center gap-1.5 py-3",children:Array.from({length:5},(t,r)=>d.jsx("div",{className:`w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),Tabs:e=>d.jsxs("div",{children:[d.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)=>d.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),d.jsx("div",{className:`h-32 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]}),TabNavigation:e=>d.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),ProductCard:e=>d.jsxs("div",{className:"rounded-lg overflow-hidden",children:[d.jsx("div",{className:`h-48 w-full bg-gray-200 dark:bg-gray-700 ${e}`}),d.jsxs("div",{className:"p-3 space-y-2",children:[d.jsx("div",{className:`h-3.5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:`h-4 w-1/3 bg-gray-300 dark:bg-gray-600 rounded ${e}`})]})]}),UserInfo:e=>d.jsx("div",{className:`h-3 w-14 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),QuantitySelector:e=>d.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=>d.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs("div",{className:"flex items-center justify-between h-16",children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("div",{className:`h-8 w-24 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:"hidden lg:flex items-center gap-6",children:Array.from({length:4},(t,r)=>d.jsx("div",{className:`h-3.5 w-16 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))})]}),d.jsx("div",{className:"flex items-center gap-4",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-8 w-8 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))})]})})}),Footer:e=>d.jsx("footer",{className:"bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 mt-auto",children:d.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx("div",{className:`h-4 w-32 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:`h-3 w-48 bg-gray-100 dark:bg-gray-800 rounded ${e}`}),d.jsx("div",{className:"flex gap-3",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-6 w-6 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))}),d.jsx("div",{className:`h-3 w-40 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]})})}),Modal:()=>d.jsx(d.Fragment,{}),Toast:()=>d.jsx(d.Fragment,{}),ConfirmDialog:()=>d.jsx(d.Fragment,{})};function d0(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=>!Zi(o.if));return n.length>1&&u0(n)?[...r,Qi(n)]:[...r,...n]}if(t.length>1&&r.length===0){const n=t.filter(o=>!Zi(o.if));return n.length===0?[]:n.length===1?n:[Qi(n)]}return e}function Zi(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 u0(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 Qi(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 f0(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 g0(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 c=r.wrap||"nowrap",i={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};i[c]&&n.push(i[c]),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 h0(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?[]:d0(e).map((a,s)=>Ji(a,t,r,s,n))}function p0(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 m0(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[,c,i]=h;if(Xi.has(i)){n.push({breakpoint:Yi[c]||0,display:i});continue}(Yi[c]||0)<=t&&o.push(i);continue}if(Xi.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 b0(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 Ji(e,t,r,n,o){const{name:a,children:s,iteration:l}=e,f=p0(e,o),h=g0(e),c=h?`${h} ${f}`.trim():f,i=f0(c),u=m0(i,o);if(!a||!u.visible)return null;const g=u.className;if(l)return d.jsx(k.Fragment,{children:Array.from({length:r},(m,w)=>Ji({...e,iteration:void 0},t,r,w,o))},n);if(qi[a])return d.jsx("div",{className:g,children:qi[a](t,r)},n);if(s0.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 d.jsx("div",{className:E},n)}const w=qn(s,t,r,o);if(!(w.length>0&&w.some(v=>v!==null)))return null;const O=b0(m);return d.jsx("div",{className:O.className,style:O.style,children:w},n)}const p=Ta(g,a);if(l0.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"},C=m[a]||"h-3.5",O=w[a]||"w-full",v=a.startsWith("H")?"mb-2 mt-1":"mb-1.5";return d.jsx("div",{className:`${C} ${O} bg-gray-200 dark:bg-gray-700 rounded ${t} ${v} ${p}`.trim()},n)}if(i0.has(a))return a==="Textarea"?d.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"?d.jsx("div",{className:`h-5 w-5 bg-gray-200 dark:bg-gray-700 rounded mb-1.5 ${t}`},n):d.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(c0.has(a))return a==="Avatar"||a==="AvatarUploader"?d.jsx("div",{className:`h-10 w-10 bg-gray-200 dark:bg-gray-700 rounded-full ${t}`},n):a==="ProductImageViewer"?d.jsx("div",{className:`h-80 w-full bg-gray-200 dark:bg-gray-700 rounded ${t}`},n):d.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 v=/\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 d.jsx("div",{className:`${m} ${v}`.trim(),children:w},n)}return d.jsx("div",{className:`h-9 w-24 bg-gray-200 dark:bg-gray-700 rounded ${t}`},n)}return a==="Icon"?d.jsx("div",{className:`h-5 w-5 bg-gray-200 dark:bg-gray-700 rounded ${t}`},n):s&&s.length>0?d.jsx("div",{className:p,children:qn(s,t,r,o)},n):d.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=h0(t.animation),o=window.G7Core?.useResponsive,a=o?.(),s=a?a.width:typeof window<"u"?window.innerWidth:1024;return d.jsx("div",{className:"w-full",role:"status","aria-busy":"true","aria-label":"Loading...",children:qn(e,r,t.iteration_count,s)})},y0=Object.freeze(Object.defineProperty({__proto__:null,PageSkeleton:Na,default:Na},Symbol.toStringTag,{value:"Module"})),v0=(e,t)=>window.G7Core?.t?.(e,t)??e,Ri=({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 d.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:[d.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${n}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),d.jsx("span",{style:{color:o,fontSize:"14px"},children:e?.text||v0("nav.loading")})]})},w0=Object.freeze(Object.defineProperty({__proto__:null,default:Ri},Symbol.toStringTag,{value:"Module"})),Dr=(e,t)=>window.G7Core?.t?.(e,t)??e,ec=({currentPage:e,totalPages:t,onPageChange:r,maxVisiblePages:n=5,showFirstLast:o=!0,showFirst:a,showLast:s,hasMorePages:l,className:f="",style:h,prevText:c,nextText:i,id:u,editorAttrs:g})=>{const p=t!=null,m=p?t:0,w=p?e<m:l??!1,C=(a??o)&&p,O=(s??o)&&p,v=k.useMemo(()=>{const M=[];if(!p)return M;if(m<=n+2)for(let x=1;x<=m;x++)M.push(x);else{const x=Math.floor(n/2);let y=Math.max(2,e-x),T=Math.min(m-1,e+x);e<=x+1?T=n:e>=m-x&&(y=m-n+1),M.push(1),y>2&&M.push("...");for(let A=y;A<=T;A++)M.push(A);T<m-1&&M.push("..."),m>1&&M.push(m)}return M},[e,m,p,n]),E=M=>{M<1||M===e||p&&M>m||r(M)},I=()=>{e>1&&r(e-1)},_=()=>{w&&r(e+1)};return d.jsxs(W,{className:`flex items-center gap-2 ${f}`,style:h,role:"navigation","aria-label":Dr("common.pagination"),id:u,...g,children:[C&&d.jsx(Q,{onClick:()=>E(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:"«"}),d.jsx(Q,{onClick:I,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:c||d.jsx(d.Fragment,{children:"‹"})}),d.jsxs(W,{className:"flex items-center gap-1",children:[!p&&d.jsx(R,{className:"px-3 py-1 text-sm text-gray-700 dark:text-gray-300",children:e}),v.map((M,x)=>{if(M==="...")return d.jsx(R,{className:"px-3 py-1 text-sm text-gray-500 dark:text-gray-400",children:"..."},`ellipsis-${x}`);const y=M,T=y===e;return d.jsx(Q,{onClick:()=>E(y),className:`px-3 py-1 text-sm border rounded ${T?"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:y}),"aria-current":T?"page":void 0,children:y},y)})]}),d.jsx(Q,{onClick:_,disabled:!w,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:i||d.jsx(d.Fragment,{children:"›"})}),O&&d.jsx(Q,{onClick:()=>E(m),disabled:e===m,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:"»"})]})},x0=Object.freeze(Object.defineProperty({__proto__:null,Pagination:ec},Symbol.toStringTag,{value:"Module"})),tc=(e,t)=>window.G7Core?.t?.(e,t)??e,rc=({name:e="search",placeholder:t,value:r,onChange:n,onSubmit:o,showButton:a=!1,suggestions:s=[],onSuggestionClick:l,showSuggestions:f=!1,className:h="",style:c,id:i,editorAttrs:u})=>{const g=t??tc("common.search_placeholder"),[p,m]=k.useState(""),[w,C]=k.useState(!1),O=k.useRef(null),v=k.useRef(""),E=r!==void 0?r:p,I=f&&w&&s.length>0&&E.length>0;k.useEffect(()=>{r!==void 0&&(v.current=r)},[r]);const _=y=>{const T=y.target.value;m(T),n?.(y),v.current!==""&&T===""&&!y.nativeEvent.inputType&&setTimeout(()=>{const A=O.current?.querySelector("form");A&&A.requestSubmit()},0),v.current=T},M=y=>{m(y.text);const T={target:{value:y.text,name:e}};n?.(T),l?.(y),C(!1)},x=y=>{y.preventDefault(),o?.(y)};return d.jsxs(W,{ref:O,className:`relative ${h}`,style:c,id:i,...u,children:[d.jsx(so,{onSubmit:x,className:"relative",children:d.jsxs(W,{className:`relative flex items-center ${a?"gap-2":""}`,children:[d.jsxs(W,{className:"relative flex-1",children:[d.jsx(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:d.jsx(de,{name:Je.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),d.jsx(xt,{type:"search",name:e,value:E,onChange:_,onFocus:()=>C(!0),onBlur:()=>setTimeout(()=>C(!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&&d.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:tc("common.search")})]})}),I&&d.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(y=>d.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:()=>M(y),children:d.jsxs(W,{className:"flex items-center gap-2",children:[d.jsx(de,{name:Je.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),d.jsx(R,{className:"text-sm text-gray-700 dark:text-gray-300",children:y.text})]})},y.id))})]})},k0=Object.freeze(Object.defineProperty({__proto__:null,SearchBar:rc},Symbol.toStringTag,{value:"Module"})),vt=window.G7Core,C0={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:c="image/*",maxSize:i=5,className:u="",uploadButtonText:g,deleteButtonText:p,readOnly:m=!1,confirmDelete:w=!0,deleteConfirmMessage:C,confirmUpload:O=!0,uploadConfirmMessage:v,uploadSuccessActions:E,uploadErrorActions:I,deleteSuccessActions:_,deleteErrorActions:M,id:x,editorAttrs:y}){const T=k.useRef(null),[A,P]=k.useState(!1),[D,L]=k.useState(!1),[U,S]=k.useState(void 0),[b,F]=k.useState(null),[$,G]=k.useState(!1),[Y,B]=k.useState(!1),[K,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(K){const oe=URL.createObjectURL(K);return q(oe),()=>URL.revokeObjectURL(oe)}else q(null)},[K]);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},[]),ee=k.useCallback(()=>vt?.api?.getToken?.()??null,[]),ke=k.useCallback(async oe=>{B(!1),j(null),P(!0),F(null);try{const ae=new FormData;ae.append("avatar",oe);const be=fe(),xe=ee(),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(),Ve=Pe.data||Pe;Ve.avatar&&S(Ve.avatar),a?.(Ve),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));F(be.message),s?.(be),vt?.toast?.error?.(be.message),I?.length&&I.forEach(xe=>vt?.dispatch?.(xe))}finally{P(!1),T.current&&(T.current.value="")}},[n,a,s,fe,ee,te]),me=k.useCallback(async oe=>{const ae=oe.target.files?.[0];if(!ae)return;F(null);const be=i*1024*1024;if(ae.size>be){const xe=new Error(te("attachment.file_too_large").replace(":max",`${i}MB`));F(xe.message),s?.(xe),vt?.toast?.error?.(xe.message);return}if(c&&!ae.type.match(c.replace("*",".*"))){const xe=new Error(te("attachment.invalid_file_type"));F(xe.message),s?.(xe),vt?.toast?.error?.(xe.message);return}O?(j(ae),B(!0)):ke(ae)},[i,c,s,O,ke,te]),Ge=k.useCallback(async()=>{G(!1),L(!0),F(null);try{const oe=fe(),ae=ee(),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));F(ae.message),f?.(ae),vt?.toast?.error?.(ae.message),M?.length&&M.forEach(be=>vt?.dispatch?.(be))}finally{L(!1)}},[o,l,f,fe,ee,te]),De=k.useCallback(()=>{w?G(!0):Ge()},[w,Ge]),ye=k.useCallback(()=>{G(!1)},[]),Me=k.useCallback(()=>{B(!1),j(null),T.current&&(T.current.value="")},[]),Ce=k.useCallback(()=>{K&&ke(K)},[K,ke]),we=U===void 0?e:U,Fe=!!we,Le=C0[r]||"lg",V=$||Y,re=()=>d.jsxs(W,{className:"flex items-center justify-center gap-2",children:[d.jsx(xt,{ref:T,id:ue,type:"file",accept:c,className:"hidden",onChange:me,disabled:A}),!Fe&&d.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?d.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(de,{name:"image",size:"sm"}),d.jsx(R,{children:g||te("mypage.profile.register_avatar")})]}),Fe&&d.jsxs(d.Fragment,{children:[d.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?d.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(de,{name:"upload",size:"sm"}),d.jsx(R,{children:g||te("common.change")})]}),h&&d.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?d.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(de,{name:"trash-2",size:"sm"}),d.jsx(R,{children:p||te("common.delete")})]})]})]});return d.jsxs(W,{className:`flex flex-col items-center gap-3 ${u}`,id:x,...y,children:[Y&&H?d.jsxs(W,{className:"relative",children:[d.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"}`}),d.jsx(W,{className:"absolute inset-0 rounded-full bg-blue-500/20 border-2 border-blue-500 border-dashed"})]}):d.jsx(Ur,{avatar:we||void 0,name:t,size:Le}),!m&&d.jsxs(W,{className:"w-[220px] flex flex-col items-center gap-2",children:[Y&&K&&d.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:[d.jsxs(W,{className:"flex items-center gap-2 mb-2",children:[d.jsx(de,{name:"upload",size:"sm",className:"text-blue-600 dark:text-blue-400 shrink-0"}),d.jsx(R,{className:"text-sm font-medium text-blue-800 dark:text-blue-300",children:v||te("mypage.profile.upload_avatar_confirm")})]}),d.jsxs(W,{className:"text-xs text-blue-600 dark:text-blue-400 truncate mb-3",title:K.name,children:[K.name," (",(K.size/1024/1024).toFixed(2),"MB)"]}),d.jsxs(W,{className:"grid grid-cols-2 gap-2",children:[d.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?d.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(de,{name:"check",size:"sm"}),d.jsx(R,{children:te("common.confirm")})]}),d.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:d.jsx(R,{children:te("common.cancel")})})]})]}),$&&d.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:[d.jsxs(W,{className:"flex items-center gap-2 mb-2",children:[d.jsx(de,{name:"alert-triangle",size:"sm",className:"text-red-600 dark:text-red-400 shrink-0"}),d.jsx(R,{className:"text-sm font-medium text-red-800 dark:text-red-300",children:C||te("mypage.profile.delete_avatar_confirm")})]}),d.jsxs(W,{className:"grid grid-cols-2 gap-2",children:[d.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?d.jsx(de,{name:"spinner",size:"sm",className:"animate-spin"}):d.jsx(de,{name:"trash-2",size:"sm"}),d.jsx(R,{children:te("common.delete")})]}),d.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:d.jsx(R,{children:te("common.cancel")})})]})]}),!V&&re()]}),b&&!V&&d.jsxs(W,{className:"flex items-center gap-2 text-sm text-red-600 dark:text-red-400",children:[d.jsx(de,{name:"alert-circle",size:"sm"}),d.jsx(R,{children:b})]})]})}const S0=Object.freeze(Object.defineProperty({__proto__:null,AvatarUploader:Aa,default:Aa},Symbol.toStringTag,{value:"Module"})),nc=()=>window.G7Core,Zn=(e,t)=>window.G7Core?.t?.(e,t)??e,oc={horizontal:"flex items-center gap-1.5",vertical:"flex flex-col items-start"},_0=()=>[{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?d.jsx(R,{className:"text-sm text-gray-500 dark:text-gray-400",title:t,children:e}):null,ac=({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:c="",layout:i="vertical",text:u,stopPropagation:g=!1,menuItems:p,hideMenuItems:m=[],appendMenuItems:w=[],id:C,editorAttrs:O})=>{const v=r??e?.uuid,E=a||e?.is_guest||!1,I=s||e?.status==="withdrawn",_=I?Zn("userinfo.withdrawn_user"):u??t??e?.name??"",[M,x]=k.useState(!1),[y,T]=k.useState({top:0,left:0}),A=k.useRef(null),P=k.useRef(null),D=k.useRef(null),L=h.replace("{userId}",String(v??"")),U=`${oc[i]} ${c}`;k.useEffect(()=>{if(!M)return;const j=q=>{const ue=q.target,te=A.current?.contains(ue),fe=P.current?.contains(ue);!te&&!fe&&x(!1)},H=()=>x(!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)}},[M]);const S=k.useCallback(()=>{if(p&&p.length>0)return p.filter(q=>q.show!==!1);let H=_0().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();T({top:j.bottom+4,left:j.left})}},[]),F=k.useCallback((j,H)=>{if(H.stopPropagation(),H.preventDefault(),x(!1),j.onClick)j.onClick();else if(j.path){const q=j.path.replace(/\{\{userId\}\}/g,String(v??"")),ue=nc();ue?.navigate?ue.navigate(q):window.location.href=q}},[v]),$=k.useCallback(j=>{j.preventDefault(),g&&j.stopPropagation(),!(E||!v)&&(l?(M||b(),x(H=>!H)):f&&nc()?.navigate?.(L))},[g,E,v,l,M,b,f,L]);if(E||!v)return d.jsxs(W,{className:U,id:C,...O,children:[d.jsxs(W,{className:"flex items-center gap-1.5 text-gray-400 dark:text-gray-500",children:[d.jsx(R,{children:_}),d.jsx(R,{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")})]}),d.jsx(Ma,{text:n,title:o})]});if(I)return d.jsxs(W,{className:U,id:C,...O,children:[d.jsx(R,{className:"text-gray-400 dark:text-gray-500 line-through",children:_}),d.jsx(Ma,{text:n,title:o})]});const G=S(),B=/\btext-\S+/.test(c)?"":"text-gray-900 dark:text-white",K=l||f?`${B} hover:text-blue-600 dark:hover:text-blue-400 cursor-pointer font-medium`.trim():`${B} font-medium`.trim();return d.jsxs(W,{ref:A,className:`relative inline-block ${c}`,id:C,...O,children:[d.jsxs(W,{className:oc[i],children:[d.jsx(Q,{ref:D,onClick:$,className:K,children:_}),d.jsx(Ma,{text:n,title:o})]}),l&&M&&G.length>0&&Jt.createPortal(d.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:y.top,left:y.left},"data-testid":"author-dropdown-menu",children:G.map(j=>d.jsxs(Q,{onClick:H=>F(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&&d.jsx(de,{name:j.icon,className:"w-4 h-4"}),d.jsx(R,{children:j.label})]},j.key))}),document.body)]})},E0=Object.freeze(Object.defineProperty({__proto__:null,UserInfo:ac},Symbol.toStringTag,{value:"Module"})),sc=({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=v=>{!v.disabled&&v.id!==t&&r?.(v.id)},m=v=>{const E=v.target.value,I=Number(E),_=typeof E=="string"&&E!==""&&!Number.isNaN(I)?I:E,M=e.find(x=>String(x.id)===String(_));M&&p(M)},w=s.length>0?e.filter(v=>!s.includes(v.id)):e;if(g)return d.jsx(W,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(Ya,{value:t!==void 0?String(t):"",onChange:m,options:w.map(v=>({value:String(v.id),label:v.badge!==void 0?`${v.label} (${v.badge})`:v.label,disabled:v.disabled})),className:"w-full"})});const C=v=>{const E=v.id===t,I="flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap";if(v.disabled)return`${I} opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600`;switch(n){case"pills":return E?`${I} bg-blue-600 dark:bg-blue-500 text-white rounded-lg`:`${I} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`;case"underline":return E?`${I} text-gray-900 dark:text-white border-b-2 border-gray-900 dark:border-white`:`${I} 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?`${I} 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`:`${I} 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 d.jsx(W,{className:`relative ${o}`,style:a,id:f,...h,children:d.jsx(Fr,{className:O,children:w.map(v=>d.jsxs(Q,{type:"button",onClick:()=>p(v),disabled:v.disabled,className:C(v),children:[v.iconName&&d.jsx(de,{name:v.iconName,size:"sm"}),d.jsx(R,{children:v.label}),v.badge!==void 0&&d.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:d.jsx(R,{children:v.badge})})]},v.id))})})},T0=Object.freeze(Object.defineProperty({__proto__:null,TabNavigation:sc},Symbol.toStringTag,{value:"Module"})),N0={Header:()=>Promise.resolve().then(()=>ad),Footer:()=>Promise.resolve().then(()=>cd),MobileNav:()=>Promise.resolve().then(()=>dd),SlotContainer:()=>Promise.resolve().then(()=>nd),NotificationCenter:()=>Promise.resolve().then(()=>od),ProductCard:()=>Promise.resolve().then(()=>Pd),BrandMark:()=>Promise.resolve().then(()=>Fd),ImageGallery:()=>Promise.resolve().then(()=>Nl),ProductImageViewer:()=>Promise.resolve().then(()=>Bf),QuantitySelector:()=>Promise.resolve().then(()=>Wf),PostReactions:()=>Promise.resolve().then(()=>Yf),RichTextEditor:()=>Promise.resolve().then(()=>Xf),HtmlContent:()=>Promise.resolve().then(()=>qf),HtmlEditor:()=>Promise.resolve().then(()=>Zf),ExpandableContent:()=>Promise.resolve().then(()=>Qf),FileUploader:()=>Promise.resolve().then(()=>qh),ConfirmDialog:()=>Promise.resolve().then(()=>eg),SocialLoginButtons:()=>Promise.resolve().then(()=>Qh),Toast:()=>Promise.resolve().then(()=>r0),PageTransitionIndicator:()=>Promise.resolve().then(()=>o0),PageTransitionBlur:()=>Promise.resolve().then(()=>a0),PageSkeleton:()=>Promise.resolve().then(()=>y0),PageLoading:()=>Promise.resolve().then(()=>w0),ThemeToggle:()=>Promise.resolve().then(()=>Jc),Pagination:()=>Promise.resolve().then(()=>x0),SearchBar:()=>Promise.resolve().then(()=>k0),Avatar:()=>Promise.resolve().then(()=>td),AvatarUploader:()=>Promise.resolve().then(()=>S0),UserInfo:()=>Promise.resolve().then(()=>E0),Modal:()=>Promise.resolve().then(()=>Rf),TabNavigation:()=>Promise.resolve().then(()=>T0)},A0=({id:e,className:t,style:r,children:n,editorAttrs:o})=>d.jsx(W,{id:e,className:t,style:r,...o,children:n}),M0=({id:e,children:t,cols:r=1,responsive:n,gap:o,rowGap:a,colGap:s,autoRows:l,autoCols:f,flow:h="row",className:c="",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]),c&&p.push(c),d.jsx(W,{id:e,className:p.join(" "),style:i,onClick:u,...g,children:t})},O0=({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:c,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 C={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(C[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),d.jsx(W,{id:e,className:g.join(" "),style:c,onClick:i,...u,children:t})},I0=({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:c=!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 C={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(C[a]),s){const v={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(v[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]),c&&m.push("rounded-lg"),i&&m.push(i),d.jsxs(qa,{id:e,className:m.join(" "),style:u,onClick:g,...p,children:[(t||r)&&d.jsxs(W,{className:"mb-4",children:[t&&d.jsx(Va,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),r&&d.jsx(Dt,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:r})]}),n]})},D0=({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(),c={width:t,flexShrink:0},i={flex:1,minWidth:0},u={width:r,flexShrink:0};return d.jsxs(W,{id:e,className:h,style:l,...f,children:[d.jsx(W,{className:"flex flex-col",style:c,children:n}),d.jsx(W,{className:"flex flex-col",style:i,children:o}),d.jsx(W,{className:"flex flex-col",style:u,children:a})]})},L0={identifier:"sirsoft-basic",vendor:"sirsoft",name:{ko:"Basic",en:"Basic"},version:"1.1.0",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.6",dependencies:{modules:{"sirsoft-board":">=1.0.0","sirsoft-ecommerce":">=1.1.0","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"}]},P0={KRW:0,JPY:0};function $0(){try{const t=(window.G7Core?.state?.get?.()||{})?.modules?.["sirsoft-ecommerce"]?.language_currency;return Array.isArray(t?.currencies)?t.currencies:[]}catch{return[]}}function Lr(e,t){if(!Number.isFinite(e))return"0";const r=$0(),n=t||r.find(a=>a.is_default)?.code;if(!n)return e.toLocaleString();const o=r.find(a=>a.code===n)?.decimal_places??P0[n]??2;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:n,minimumFractionDigits:o,maximumFractionDigits:o}).format(e)}catch{return`${e.toLocaleString(void 0,{minimumFractionDigits:o,maximumFractionDigits:o})} ${n}`}}function Qn(e,t,r,n=0){if(!e)return;const o=f=>f?.value??f?.price??0;let a;for(const[f,h]of Object.entries(e))if(h?.is_default){a=f;break}a=a??(e.KRW?"KRW":void 0);const s=a?o(e[a]):0,l={};for(const[f,h]of Object.entries(e)){const c=o(h);let i;r?i=r[f]?.value??0:n>0&&f===a?i=n:n>0&&s>0?i=n*c/s:i=0;const u=(c+i)*t;l[f]={value:u,formatted:Lr(u,f)}}return l}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 lc(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 ic(e,t){if(!e||!t?.length)return;const r={};let n=!1;for(const a of t){const s=e[a.id];if(s==null)continue;const f=a.values?.find(h=>h.id===Number(s))?.multi_currency_price_adjustment;if(f){n=!0;for(const[h,c]of Object.entries(f)){const i=c?.value??c?.price??0;r[h]=(r[h]??0)+i}}}if(!n)return;const o={};for(const[a,s]of Object.entries(r))o[a]={value:s};return o}function Rn(e){return e.name_localized?e.name_localized:typeof e.name=="string"?e.name:e.name?.ko??""}function F0(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 U0(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 z0(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 F0(n.option_values,n.option_values_localized,a)===s}))}function H0(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(_=>{const M=Rn(_);return l?.[M]}))return;const h=z0(n,l,o??[]);if(!h){t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const c=n.map(_=>l[Rn(_)]).join("_"),i=a??[];if(i.find(_=>_.id===c)){const _=window.G7Core;_?.toast?.warning?.(_?.t?.("sirsoft-ecommerce.shop.already_added_option")??"이미 추가된 옵션입니다."),t.setState?.({currentSelection:{},__mergeMode:"shallow"});return}const g=h.selling_price??0,p={};n.forEach(_=>{const M=Rn(_);p[M]=l[M]});const m=r.additionalOptionGroups??[],w={};for(const _ of m){if(!_.is_required)continue;const M=_.values?.find(x=>x.is_default);M&&(w[_.id]=M.id)}const C=lc(w,m),O=ic(w,m),v=g+C,E={id:c,optionId:h.id,options:p,optionValues:U0(h.option_values,h.option_values_localized),quantity:1,stock:h.stock_quantity??999,unitPrice:g,unitPriceFormatted:Lr(g,s),totalPrice:v,totalPriceFormatted:Lr(v,s),multiCurrencyUnitPrice:h.multi_currency_selling_price,multiCurrencyTotalPrice:Qn(h.multi_currency_selling_price,1,O,C),additionalOptionSelections:w,additionalOptionsTotal:C,additionalOptionsMultiCurrencyTotal:O},I=[...i,E];t.setState?.({selectedOptionItems:I,selectedTotalMultiCurrency:Jn(I),currentSelection:{},__mergeMode:"shallow"})}function G0(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 c=f?.unitPrice??0,i=f?.additionalOptionsTotal??0,u=(c+i)*s;return{...f,quantity:s,totalPrice:u,totalPriceFormatted:Lr(u,o),multiCurrencyTotalPrice:Qn(f?.multiCurrencyUnitPrice,s,f?.additionalOptionsMultiCurrencyTotal,i)}});t.setState?.({selectedOptionItems:l,selectedTotalMultiCurrency:Jn(l)})}function j0(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),c=(n??[]).map((i,u)=>{if(u!==s)return i;const g={...i.additionalOptionSelections??{}},p={...i.additionalOptionCustomTexts??{}};if(f){const E=String(r.customText??"");E.trim()===""?delete p[l]:p[l]=E}else h==null?(delete g[l],delete p[l]):(g[l]=h,(o??[]).find(_=>_.id===l)?.values?.find(_=>_.id===h)?.allow_custom_text||delete p[l]);const m=lc(g,o),w=ic(g,o),C=i?.unitPrice??0,O=i?.quantity??1,v=(C+m)*O;return{...i,additionalOptionSelections:g,additionalOptionCustomTexts:p,additionalOptionsTotal:m,additionalOptionsMultiCurrencyTotal:w,totalPrice:v,totalPriceFormatted:Lr(v,a),multiCurrencyTotalPrice:Qn(i?.multiCurrencyUnitPrice,O,w,m)}});t.setState?.({selectedOptionItems:c,selectedTotalMultiCurrency:Jn(c)})}function B0(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 W0(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 cc(){return window.G7Core?.state?.getLocal?.()||{}}function V0(){return window.G7Core?.state?.get?.()||{}}function K0(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 Y0(e){const t=window.G7Core;return t?.t?t.t(e):e}function dc(){const e=window.G7Core;if(e?.dispatch){const r=cc().selectedItems||[];e.dispatch({handler:"refetchDataSource",params:{dataSourceId:"cartItems"}}),cn.log("Refetching cartItems with selected_ids:",r)}else cn.warn("G7Core.dispatch not available")}function X0(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=V0().cartItems?.data?.items||[],f=l.length>0&&a.length===l.length;hr({selectedItems:a,allSelected:f,selectedCount:a.length}),dc()}function q0(e,t){const{allItemIds:r,isSelected:n}=e?.params||{};hr({selectedItems:n?r:[],allSelected:n,selectedCount:n?r.length:0}),dc()}function Z0(e,t){const{optionName:r,optionValue:n}=e?.params||{},a=cc().selectedOptions||{};hr({selectedOptions:{...a,[r]:n}})}function Q0(e,t){const{targetIds:r}=e?.params||{};if(!r||r.length===0){K0(Y0("shop.cart.select_items_to_delete"),"warning");return}hr({deleteModal:{visible:!0,targetIds:r}})}function J0(e,t){const{targetItem:r}=e?.params||{};hr({optionModal:{visible:!0,targetItem:r},selectedOptions:r?.options||{},selectedQuantity:r?.quantity})}function R0(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 ep(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 uc(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 ep(a.option_values,a.option_values_localized,l)===e[l]}))||null:(pr.log("Not all options selected yet"),null)}function tp(e,t){const{selectedOptions:r,optionGroups:n,options:o}=e?.params||{};pr.log("findMatchingOption called:",{selectedOptions:r,optionGroups:n,optionsCount:o?.length});const a=uc(r,n,o);return pr.log("Matched option:",a),{matchedOption:a}}function rp(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],c=l.values_localized??(Array.isArray(l.values)?l.values.map(i=>typeof i=="string"?i:i?.ko??""):[]);h&&c.includes(h)&&(a[f]=h)}pr.log("Initial selectedOptions:",a);const s=uc(a,n,o||[]);return pr.log("Matched option:",s),{selectedOptions:a,matchedOption:s}}const dn="g7_cart_key",np="/api/modules/sirsoft-ecommerce/cart/key",Ia="g7_guest_order_token",fc="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 gc(){try{const e=await fetch(np,{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 op(){try{const e=window.G7Config;return e?.user?e.user:(window.G7Core?.state?.get?.()||{}).currentUser||null}catch{return null}}async function ap(e,t){let r=null;try{r=localStorage.getItem(dn)}catch{}if(r)at.log("Existing cartKey loaded:",r);else if(r=await gc(),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 sp(e,t){try{return localStorage.getItem(dn)}catch{return null}}function hc(e,t){try{localStorage.removeItem(dn),at.log("cartKey removed from localStorage")}catch{}rr({cartKey:null})}async function lp(e,t){if(op()){hc();return}const n=await gc();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 ip(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 cp(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(fc),sessionStorage.removeItem(Da)}catch{}}function dp(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 up(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(fc,n),sessionStorage.setItem(Da,o)}catch{}rr({guestOrderToken:r})}function fp(e,t){La(),rr({guestOrderToken:null})}function gp(e,t){La(),rr({guestOrderToken:null})}function hp(e,t){const{product:r,priceField:n,currencyCode:o}=e,a=o||t.getState("_global.preferredCurrency")||t.getState("_global.defaultCurrency")||"",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 pc={KRW:"₩",USD:"$",JPY:"¥",CNY:"元",EUR:"€",GBP:"£"},pp={KRW:0,JPY:0};function mc(){try{const t=(window.G7Core?.state?.get?.()||{})?.modules?.["sirsoft-ecommerce"]?.language_currency;return Array.isArray(t?.currencies)?t.currencies:[]}catch{return[]}}function mp(e,t){const{value:r,currencyCode:n,locale:o}=e,a=mc(),s=n||t.getState("_global.preferredCurrency")||t.getState("_global.defaultCurrency")||a.find(i=>i.is_default)?.code;if(!s)return r.toLocaleString(o);const l=a.find(i=>i.code===s),f=l?.symbol&&l.symbol.length>0?l.symbol:pc[s]??"",h=l?.decimal_places??pp[s]??2,c=r.toLocaleString(o,{minimumFractionDigits:h,maximumFractionDigits:h});return f?s==="KRW"||f==="₩"||f==="원"?`${c}원`:`${f}${c}`:`${c} ${s}`}function bp(e){const t=mc().find(r=>r.code===e);return t?.symbol&&t.symbol.length>0?t.symbol:pc[e]||e}const Pa=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)},bc="g7_preferred_currency";function yp(){try{const e=window.G7Core?.state?.get?.()||{};return e.defaultCurrency||e?.modules?.["sirsoft-ecommerce"]?.language_currency?.default_currency||""}catch{return""}}function vp(e,t){const{defaultCurrency:r=yp()}=e;let n=r;try{if(typeof window<"u"&&window.localStorage){const o=localStorage.getItem(bc);o&&yc(o)&&(n=o)}}catch{Pa.warn("localStorage 접근 불가, 기본 통화 사용:",r)}return t.setState("global",{preferredCurrency:n}),n}function wp(e,t){const{currencyCode:r}=e;if(!yc(r)){Pa.warn("유효하지 않은 통화 코드:",r);return}try{typeof window<"u"&&window.localStorage&&localStorage.setItem(bc,r)}catch{Pa.warn("localStorage 저장 실패")}t.setState("global",{preferredCurrency:r})}function yc(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"],vc="g7_color_scheme",xp=e=>e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e,eo=e=>{const t=xp(e);document.documentElement.setAttribute("data-theme",t),t==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function kp(){try{const e=localStorage.getItem(vc),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 Cp(e,t){const r=e?.target;if(r&&typeof r=="string"&&$a.includes(r)){eo(r);return}kp()}async function Sp(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(vc,n)}catch(o){Pr.error("Failed to save theme to localStorage:",o);return}eo(n),Pr.log("Theme changed to:",n)}const _p=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 Ep(e,t){const r=window.G7Core;if(!r?.dispatch){_p.error("G7Core.dispatch 가 초기화되지 않아 로그인 리다이렉트를 실행할 수 없습니다.");return}const n=window.location.pathname+window.location.search;await r.dispatch({handler:"navigate",params:{path:"/login",query:{redirect:n}}})}const Fa=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 Tp(e,t){const r=window.G7Core,{url:n,filename:o}=e?.params||{};if(!n){Fa.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!r?.api?.get){Fa.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){Fa.error("첨부파일 다운로드 실패",a),r?.toast?.error?.(r?.t?.("common.download_failed")??"Download failed")}}const to={"sirsoft-basic.addSelectedItemIfComplete":H0,"sirsoft-basic.updateSelectedItemQuantity":G0,"sirsoft-basic.removeSelectedItem":B0,"sirsoft-basic.updateNoOptionQuantity":W0,"sirsoft-basic.setBlockAdditionalOption":j0,"sirsoft-basic.getDisplayPrice":hp,"sirsoft-basic.formatCurrency":mp,"sirsoft-basic.getCurrencySymbol":bp,"sirsoft-basic.loadPreferredCurrency":vp,"sirsoft-basic.savePreferredCurrency":wp,setTheme:Sp,initTheme:Cp,redirectToLoginWithReturn:Ep,downloadAttachment:Tp,toggleCartItemSelection:X0,selectAllCartItems:q0,setCartOption:Z0,openCartDeleteModal:Q0,openCartOptionModal:J0,recalculateCart:R0,findMatchingOption:tp,initCartOptionSelection:rp,initCartKey:ap,getCartKey:sp,clearCartKey:hc,regenerateCartKey:lp,saveToStorage:ip,loadFromStorage:cp,initGuestOrderToken:dp,saveGuestOrderToken:up,clearGuestOrderToken:fp,clearGuestTokenOnEntry:gp},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 Np(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 Ap(){const t=window.G7Core?.api?.getToken?.()??null;return t?{Authorization:`Bearer ${t}`}:{}}function Mp(){try{const e=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return e?{"Accept-Language":e}:{}}catch{return{}}}async function Op(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",...Mp(),...Ap()},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 Ip(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=Np(e);let o;try{o=await Op(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 c=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 C=new Date(m).getTime();Number.isFinite(C)&&C!==f&&(f=C)}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(c),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(c),i?.(),g}function Dp(){const e=window.G7Core?.identity;if(!e?.setLauncher){un.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}e.setLauncher(Ip),un.log("IDV launcher registered (sirsoft-basic)")}const wc=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 Lp(){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 Pp(){const e=window.G7Core;if(!e?.state?.get||!e?.state?.set){wc.warn("G7Core.state not available; skip iOS device correction");return}if(!Lp())return;const r=(e.state.get()||{}).appConfig||{};r.isIos!==!0&&(e.state.set({appConfig:{...r,isIos:!0}}),wc.log("appConfig.isIos corrected to true by client signals (iPadOS desktop-UA)"))}function $p(e){const t=e.icons;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.value=="string"):[]}function Fp(e,t){const r=e.label;return typeof r=="string"?r.startsWith("$t:")?t(r.slice(3)):r:e.value}function Up(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 zp({entry:e}){const t=e.preview;return t?.html?d.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:t.html},style:za}):t?.className?d.jsx("span",{className:`g7le-icon-preview ${t.className}`,style:za}):d.jsx("i",{className:`fas fa-${e.value}`,style:za,"aria-hidden":"true"})}function Hp({control:e,value:t,onChange:r,t:n}){const o=$p(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,c]=k.useState("");if(o.length===0)return d.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:xc,children:d.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:kc})});const i=g=>Fp(g,n),u=o.filter(g=>Up(g,i(g),h));return d.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:xc,children:[d.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:h,placeholder:f,onChange:g=>c(g.target.value),style:kc}),d.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...Gp,gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`},children:[d.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===""?Cc:Ua,children:d.jsx("span",{style:jp,children:"—"})}),u.map(g=>{const p=g.value===a;return d.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:i(g),"aria-pressed":p,onClick:()=>r(g.value),style:p?Cc:Ua,children:d.jsx(zp,{entry:g})},g.value)})]}),u.length===0&&d.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:Bp,children:n("layout_editor.icon_picker.no_results")})]})}const xc={display:"flex",flexDirection:"column",gap:6,width:"100%"},kc={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},Gp={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},Ua={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Cc={...Ua,border:"2px solid #2563eb",background:"#eff6ff"},za={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},jp={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},Bp={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},Sc=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 Wp(){if(typeof window>"u")return;const e=window.G7Core?.layoutEditor;if(!e?.registerWidget){Sc.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}e.registerWidget("icon-picker",Hp),Sc.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)")}const Ha=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 _c(){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)}),Ha.log(`${Object.keys(to).length} custom handler(s) registered:`,Object.keys(to)),Dp(),Pp()):(e++,e<=t?(Ha.warn(`ActionDispatcher not found, retrying... (${e}/${t})`),setTimeout(r,100)):Ha.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?r():window.addEventListener("load",r)}}return Wp(),_c(),J.A=ao,J.Avatar=Ur,J.AvatarUploader=Aa,J.BrandMark=xo,J.Button=Q,J.Checkbox=Xa,J.Code=qc,J.ConfirmDialog=ta,J.Container=A0,J.Div=W,J.ExpandableContent=Jo,J.FileInput=ja,J.FileUploader=Xn,J.Flex=O0,J.Footer=ts,J.Form=so,J.Grid=M0,J.H1=Fc,J.H2=Va,J.H3=gn,J.H4=Ka,J.Header=Ra,J.Hr=lo,J.HtmlContent=qo,J.HtmlEditor=Dl,J.Icon=de,J.IconName=Je,J.ImageGallery=Tr,J.Img=Lt,J.Input=xt,J.Label=yr,J.Li=Xt,J.MobileNav=rs,J.Modal=Ro,J.Nav=Fr,J.NotificationCenter=mn,J.Ol=Uc,J.Optgroup=jc,J.Option=Gc,J.P=Dt,J.PageLoading=Ri,J.PageSkeleton=Na,J.PageTransitionBlur=_a,J.PageTransitionIndicator=Sa,J.Pagination=ec,J.PasswordInput=Wa,J.PostReactions=Ol,J.ProductCard=ps,J.ProductImageViewer=An,J.QuantitySelector=Al,J.RichTextEditor=Il,J.SearchBar=rc,J.Section=qa,J.SectionLayout=I0,J.Select=Ya,J.SlotContainer=pn,J.SocialLoginButtons=Wi,J.Span=R,J.Svg=fn,J.TabNavigation=sc,J.Table=Bc,J.Tbody=Vc,J.Td=Xc,J.Textarea=no,J.Th=Yc,J.Thead=Wc,J.ThemeToggle=hn,J.ThreeColumnLayout=D0,J.Toast=Ca,J.Tr=Kc,J.Ul=oo,J.UserInfo=ac,J.availablePasswordRules=ro,J.compositeComponents=N0,J.defaultPasswordRules=Ba,J.initTemplate=_c,J.templateMetadata=L0,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),J})({},ReactJSXRuntime,React,ReactDOM);
|
||
//# sourceMappingURL=components.iife.js.map
|