관리자·유저 화면 왕복 이동 수단을 추가하고, 상품/게시판 URL 식별자를 사람이 읽을 수 있는 값(상품코드/슬러그)으로 전환한다. 크로스 이동 링크 (전부 새 탭): - 관리자 사이드바 "사이트 보기" + 모바일 드로어 상단 잘림 수정 - 관리자 게시물 조회 ↔ 유저 게시판, 유저 상품 상세 ↔ 관리자 상품 수정 - 유저 화면의 관리자 진입은 is_admin 이 아니라 세부 권한 플래그로 게이트 (게시판 can_access_admin, 상품 can_update) 상품 라우팅 id → product_code: - Product::resolveRouteBinding(code/id) + 공개 라우트 정규식 확장 - 모든 상품 링크(목록·최근본·검색·장바구니·주문내역·문의내역·관리자) 전환 - 상품 검색을 상품코드·번호 양쪽 조회 가능하게 확장(관리자+통합검색) 게시판 라우팅 board id → slug: - Board::resolveRouteBinding(slug/id) + 관리자 라우트 slug 전환 - 생성 후 리다이렉트·토글·삭제·수정·add-to-menu·편집기 스코프 전수 정정 - BoardController::addToAdminMenu 를 Board 바인딩으로 정합 검증: 프론트 레이아웃 Vitest 36건 green, 백엔드 회귀 테스트 추가, g7.dev 라이브 실측(생성/삭제/메뉴추가 slug, 문의내역·검색 상품코드 URL).
284 lines
699 KiB
JavaScript
284 lines
699 KiB
JavaScript
var SirsoftAdminBasic=(function(R,h,v,Nn){"use strict";var _T=Object.defineProperty;var ET=(R,h,v)=>h in R?_T(R,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):R[h]=v;var $e=(R,h,v)=>ET(R,typeof h!="symbol"?h+"":h,v);var Na,cr;function Xm(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const P=Xm(v),Km=()=>window.G7Core,oe=v.forwardRef(({children:t,variant:e="primary",size:n="md",className:r="",...s},o)=>{const i="button",a=Km()?.style?.mergeClasses?.(i,r)??`${i} ${r}`;return h.jsx("button",{ref:o,className:a,...s,children:t})});oe.displayName="Button";const Sd=v.forwardRef(({accept:t,maxSize:e,onChange:n,onError:r,buttonText:s="Browse",placeholder:o="No file selected",className:i="",disabled:a,...l},c)=>{const d=v.useRef(null),u=c||d,[f,g]=v.useState(""),m={},p={};Object.entries(l).forEach(([x,E])=>{x.startsWith("data-editor-")||x==="id"||x==="onMouseMove"||x==="onMouseLeave"?m[x]=E:p[x]=E});const y=v.useCallback(()=>{!a&&u.current&&u.current.click()},[a,u]),b=v.useCallback(x=>{const E=x.target.files?.[0]||null;if(!E){g(""),n?.({target:{value:null,name:""}});return}if(e&&E.size>e*1024*1024){const k=`File size exceeds ${e}MB limit`;r?.(k),u.current&&(u.current.value=""),g("");return}g(E.name),n?.({target:{value:E,name:E.name}})},[e,n,r,u]),S=v.useCallback(x=>{x.stopPropagation(),u.current&&(u.current.value=""),g(""),n?.({target:{value:null,name:""}})},[n,u]);return h.jsxs("div",{className:`flex items-center gap-2 ${i}`,...m,children:[h.jsx("input",{ref:u,type:"file",accept:t,onChange:b,disabled:a,className:"hidden",...p}),h.jsx("button",{type:"button",onClick:y,disabled:a,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:s}),h.jsx("span",{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:f||o}),f&&!a&&h.jsx("button",{type:"button",onClick:S,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Sd.displayName="FileInput";const qm=t=>t==="checkbox"?"checkbox":t==="radio"?"radio":"input",Zm=(t,e)=>{const n=qm(t);return e?e.split(/\s+/).filter(Boolean).includes(n)?e:`${n} ${e}`:n},wt=v.forwardRef(({label:t,error:e,className:n="",onChange:r,onKeyPress:s,value:o,defaultValue:i,type:a="text",checked:l,defaultChecked:c,...d},u)=>{const f=a==="radio"||a==="checkbox",g=Zm(a,n),m=v.useRef(!1),p=v.useRef(null);v.useImperativeHandle(u,()=>p.current);const[y,b]=v.useState(o??i??"");v.useEffect(()=>{if(!f&&!m.current&&o!==void 0){if(p.current&&document.activeElement===p.current)return;b(o)}},[o,f]);const S=v.useCallback(()=>{m.current=!0},[]),x=v.useCallback(M=>{if(m.current=!1,r){const O=M.target.value;b(O);const L=new Event("change",{bubbles:!0});Object.defineProperty(L,"target",{writable:!1,value:{value:O}}),Object.defineProperty(L,"currentTarget",{writable:!1,value:{value:O}}),r(L)}},[r]),E=v.useCallback(M=>{const O=M.target.value;b(O),!m.current&&r&&r(M)},[r]),k=v.useCallback(M=>{m.current||s&&s(M)},[s]),{loadingactions:C,formdata:N,..._}=d;if(f)return h.jsx("input",{ref:p,type:a,className:g,onChange:r,checked:l,defaultChecked:c,value:o,..._});const w=o!==void 0?{value:y}:{defaultValue:i};return h.jsx("input",{ref:p,type:a,className:g,onChange:E,onKeyPress:k,onCompositionStart:S,onCompositionEnd:x,...w,..._})});wt.displayName="Input";const qn=({label:t,error:e,className:n="",onChange:r,value:s,defaultValue:o,...i})=>{const a=v.useRef(!1),l=v.useRef(null),[c,d]=v.useState(s??o??"");v.useEffect(()=>{!a.current&&s!==void 0&&d(s)},[s]);const u=v.useCallback(()=>{a.current=!0},[]),f=v.useCallback(E=>{if(a.current=!1,r){const k=E.target.value;d(k);const C=new Event("change",{bubbles:!0});Object.defineProperty(C,"target",{writable:!1,value:{value:k}}),Object.defineProperty(C,"currentTarget",{writable:!1,value:{value:k}}),r(C)}},[r]),g=v.useCallback(E=>{const k=E.target.value;d(k),!a.current&&r&&r(E)},[r]),{loadingactions:m,formdata:p,...y}=i,b=s!==void 0?{value:c}:{defaultValue:o},x=(n??"").split(/\s+/).filter(Boolean).includes("textarea")?n??"":["textarea",n].filter(Boolean).join(" ");return h.jsx("textarea",{ref:l,className:x,onChange:g,onCompositionStart:u,onCompositionEnd:f,...b,...y})},en=({children:t,className:e="",...n})=>h.jsx("label",{className:e,...n,children:t}),I=v.forwardRef(({children:t,className:e="",...n},r)=>h.jsx("div",{ref:r,className:e,...n,children:t})),Q=({children:t,className:e="",...n})=>h.jsx("span",{className:e,...n,children:t}),bt=({children:t,className:e="",...n})=>h.jsx("p",{className:e,...n,children:t}),yn=({className:t="",alt:e="",...n})=>h.jsx("img",{className:t,alt:e,...n}),Ta=({children:t,className:e="",...n})=>h.jsx("h1",{className:e,...n,children:t}),Zn=({children:t,className:e="",...n})=>h.jsx("h2",{className:e,...n,children:t}),Ir=({children:t,className:e="",...n})=>h.jsx("h3",{className:e,...n,children:t}),_d=({children:t,className:e="",...n})=>h.jsx("h4",{className:e,...n,children:t}),Aa=({children:t,className:e="",...n})=>h.jsx("ul",{className:e,...n,children:t}),Qm=({children:t,className:e="",...n})=>h.jsx("ol",{className:e,...n,children:t}),Da=({children:t,className:e="",...n})=>h.jsx("li",{className:e,...n,children:t}),Lr=({children:t,className:e="",...n})=>h.jsx("a",{className:e,...n,children:t}),Ia=({children:t,className:e="",...n})=>h.jsx("form",{className:e,...n,children:t}),Hn=({children:t,className:e="",...n})=>h.jsx("svg",{className:e,...n,children:t}),Jm=window.G7Core?.createLogger?.("Comp:Select")??{log:(...t)=>console.log("[Comp:Select]",...t),warn:(...t)=>console.warn("[Comp:Select]",...t),error:(...t)=>console.error("[Comp:Select]",...t)};function Rm(t){const e=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[t];return e||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[t]||t}const Pr=({children:t,label:e,error:n,options:r,className:s="",value:o,onChange:i,disabled:a,searchable:l=!1,searchPlaceholder:c,editorAttrs:d,...u})=>{const[f,g]=v.useState(!1),[m,p]=v.useState(""),[y,b]=v.useState(null),S=v.useRef(null),x=v.useRef(null),E=v.useRef(null),k=v.useRef(null),C=v.useMemo(()=>r?Array.isArray(r)?r.length===0?[]:typeof r[0]=="string"?r.map(T=>({value:T,label:Rm(T)})):r:(Jm.warn("options prop is not an array:",r),null):null,[r]),N=v.useMemo(()=>C&&C.find(V=>String(V.value)===String(o))?.label||"",[C,o]),_=v.useMemo(()=>{if(!C)return null;if(!l||m.trim()==="")return C;const T=m.trim().toLowerCase();return C.filter(V=>V.label.toLowerCase().includes(T)||String(V.value).toLowerCase().includes(T))},[C,l,m]);v.useEffect(()=>{if(f&&l){p("");const T=setTimeout(()=>E.current?.focus(),0);return()=>clearTimeout(T)}f||p("")},[f,l]);const w=v.useCallback(()=>{if(!x.current)return;const T=x.current.getBoundingClientRect(),V=window.innerHeight-T.bottom,W=V<280&&T.top>V;b(W?{bottom:window.innerHeight-T.top+4,left:T.left,width:T.width}:{top:T.bottom+4,left:T.left,width:T.width})},[]);v.useEffect(()=>{if(!f){b(null);return}return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[f,w]),v.useEffect(()=>{const T=V=>{const H=V.target;S.current&&!S.current.contains(H)&&(!k.current||!k.current.contains(H))&&g(!1)};return f&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T)}},[f]),v.useEffect(()=>{const T=V=>{V.key==="Escape"&&f&&(g(!1),x.current?.focus())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f]);const M=()=>{a||g(!f)},O=T=>{i&&i({target:{value:T},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),x.current?.focus()};if(!C){const V=(s??"").split(/\s+/).filter(Boolean).includes("select")?s??"":["select",s].filter(Boolean).join(" ");return h.jsx("select",{className:V,value:o,onChange:i,disabled:a,...d,...u,children:t})}const L=(s??"").split(/\s+/).filter(T=>T&&!T.includes(":")).join(" "),$=L.includes("bg-"),F=/text-(gray|red|blue|green|yellow|white|black|indigo|purple|pink|orange|amber|emerald|teal|cyan|slate)-\d+|text-white|text-black/.test(L),D=$?`${s}${F?"":" text-gray-700 dark:text-gray-200"}`:`w-full px-4 py-2.5 bg-gray-100 dark:bg-gray-700 border-0 rounded-xl text-sm text-gray-700 dark:text-gray-200 font-medium focus:ring-2 focus:ring-blue-500 focus:outline-none ${s}`,A={...d,...u};return h.jsxs(I,{ref:S,className:"relative",...A,children:[h.jsxs(oe,{ref:x,type:"button",onClick:M,disabled:a,className:`${D} flex items-center justify-between gap-2 text-left cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(Q,{className:"truncate",children:N||" "}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&y&&Nn.createPortal(h.jsxs(I,{ref:k,className:"fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",style:{top:y.top,bottom:y.bottom,left:y.left,width:y.width},role:"listbox",children:[l&&h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:h.jsx(wt,{ref:E,type:"text",value:m,onChange:T=>p(T.target.value),placeholder:c??"Search...",className:"w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none",role:"searchbox","aria-label":c??"Search"})}),h.jsxs(I,{className:"py-2 max-h-60 overflow-auto",children:[_&&_.length===0&&h.jsx(I,{className:"px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center",children:m?"No results":""}),(_??[]).map(T=>{const V=String(T.value)===String(o);return h.jsxs(oe,{type:"button",onClick:()=>!T.disabled&&O(T.value),disabled:T.disabled,className:`w-full px-4 py-3 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${V?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-200"} ${T.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,role:"option","aria-selected":V,children:[h.jsx(Q,{children:T.label}),V&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},T.value)})]})]}),document.body)]})},eb=({children:t,className:e="",...n})=>h.jsx("option",{className:e,...n,children:t}),tb=({children:t,className:e="",...n})=>h.jsx("optgroup",{className:e,...n,children:t}),vn=v.forwardRef(({label:t,className:e="",indeterminate:n=!1,...r},s)=>{const o=v.useRef(null),i=a=>{o.current=a,typeof s=="function"?s(a):s&&(s.current=a)};return v.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]),h.jsx("input",{ref:i,type:"checkbox",className:e,...r})});vn.displayName="Checkbox";const La=({children:t,className:e="",...n})=>h.jsx("table",{className:e,...n,children:t}),Pa=({children:t,className:e="",...n})=>h.jsx("thead",{className:e,...n,children:t}),$a=({children:t,className:e="",...n})=>h.jsx("tbody",{className:e,...n,children:t}),Fa=({children:t,className:e="",...n})=>h.jsx("tfoot",{className:e,...n,children:t}),Qn=({children:t,className:e="",...n})=>h.jsx("tr",{className:e,...n,children:t}),$r=({children:t,className:e="",...n})=>h.jsx("th",{className:e,...n,children:t}),Yt=({children:t,className:e="",...n})=>h.jsx("td",{className:e,...n,children:t}),Io=({children:t,className:e="",...n})=>h.jsx("nav",{className:e,...n,children:t}),Ed=({children:t,className:e="",...n})=>h.jsx("section",{className:e,...n,children:t}),re=({name:t,iconStyle:e="solid",size:n,color:r,spin:s=!1,pulse:o=!1,fixedWidth:i=!1,ariaLabel:a,className:l="",style:c,...d})=>{const u={solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"},f={"fa-solid":"solid","fa-regular":"regular","fa-light":"light","fa-duotone":"duotone","fa-brands":"brands"},g=typeof t=="string"?t:String(t);let m=e,p=g;for(const[S,x]of Object.entries(f))if(g.startsWith(S+" ")){m=x,p=g.substring(S.length+1);break}p=p.replace(/^fa-/,"");const y=[u[m],`fa-${p}`,n&&`fa-${n}`,s&&"fa-spin",o&&"fa-pulse",i&&"fa-fw",r,l].filter(Boolean).join(" "),b=a||p.replace(/-/g," ");return h.jsx("i",{className:y,style:c,"aria-label":b,role:"img",...d})},nb={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"},Md={xs:"xs",sm:"sm",md:void 0,lg:"lg",xl:"2x"},rb=({icon:t,size:e="md",className:n="",color:r,ariaLabel:s})=>{const o=t.indexOf(":"),i=t.startsWith("fa-")||t.startsWith("fas ")||t.startsWith("far ")||t.startsWith("fab ")||t.startsWith("fal ")||t.startsWith("fad ");let a,l;i?(a="fa",l=t):o>0?(a=t.substring(0,o),l=t.substring(o+1)):(a="fa",l=t);const c=nb[e],d=r||"";switch(a){case"fa":return h.jsx(re,{name:l,size:Md[e],className:n,color:r,ariaLabel:s});case"svg":return h.jsx("img",{src:l,className:`${c} ${d} ${n}`.trim(),alt:s||"","aria-label":s,role:"img"});case"img":return h.jsx("img",{src:l,className:`${c} ${n}`.trim(),alt:s||"",role:"img"});default:return h.jsx(re,{name:t,size:Md[e],className:n,color:r,ariaLabel:s})}},sb=({children:t,className:e="",...n})=>h.jsx("code",{className:e,...n,children:t}),ob=({children:t,className:e="",...n})=>h.jsx("pre",{className:e,...n,children:t}),ib=({children:t})=>h.jsx(h.Fragment,{children:t}),ab=({className:t="",...e})=>h.jsx("hr",{className:t,...e}),pt=({className:t="",children:e,style:n,...r})=>h.jsx("i",{className:t,style:n,...r,children:e});var de=(t=>(t.User="fa-user",t.Users="fa-users",t.UserCircle="fa-user-circle",t.UserPlus="fa-user-plus",t.UserMinus="fa-user-minus",t.UserShield="fa-user-shield",t.Search="fa-search",t.Edit="fa-edit",t.Pencil="fa-pencil-alt",t.Trash="fa-trash",t.Save="fa-save",t.Plus="fa-plus",t.Minus="fa-minus",t.Check="fa-check",t.Times="fa-times",t.Download="fa-download",t.Upload="fa-upload",t.Copy="fa-copy",t.ExternalLink="fa-external-link-alt",t.Home="fa-home",t.CaretRight="fa-caret-right",t.CaretDown="fa-caret-down",t.ChevronLeft="fa-chevron-left",t.ChevronRight="fa-chevron-right",t.ChevronUp="fa-chevron-up",t.ChevronDown="fa-chevron-down",t.AngleLeft="fa-angle-left",t.AngleRight="fa-angle-right",t.AngleUp="fa-angle-up",t.AngleDown="fa-angle-down",t.ArrowUp="fa-arrow-up",t.ArrowDown="fa-arrow-down",t.ArrowLeft="fa-arrow-left",t.ArrowRight="fa-arrow-right",t.Bars="fa-bars",t.EllipsisVertical="fa-ellipsis-v",t.EllipsisHorizontal="fa-ellipsis-h",t.CheckCircle="fa-check-circle",t.TimesCircle="fa-times-circle",t.ExclamationCircle="fa-exclamation-circle",t.ExclamationTriangle="fa-exclamation-triangle",t.InfoCircle="fa-info-circle",t.QuestionCircle="fa-question-circle",t.XCircle="fa-times-circle",t.ShoppingCart="fa-shopping-cart",t.ShoppingBag="fa-shopping-bag",t.CreditCard="fa-credit-card",t.Tag="fa-tag",t.Tags="fa-tags",t.File="fa-file",t.FileAlt="fa-file-alt",t.Folder="fa-folder",t.FolderOpen="fa-folder-open",t.Envelope="fa-envelope",t.Phone="fa-phone",t.Comment="fa-comment",t.Comments="fa-comments",t.Cog="fa-cog",t.Cogs="fa-cogs",t.Settings="fa-cog",t.Wrench="fa-wrench",t.Sliders="fa-sliders-h",t.Image="fa-image",t.Images="fa-images",t.Video="fa-video",t.Camera="fa-camera",t.Heart="fa-heart",t.Star="fa-star",t.ThumbsUp="fa-thumbs-up",t.ThumbsDown="fa-thumbs-down",t.Share="fa-share",t.Clock="fa-clock",t.Calendar="fa-calendar",t.CalendarAlt="fa-calendar-alt",t.Lock="fa-lock",t.Unlock="fa-unlock",t.Eye="fa-eye",t.EyeSlash="fa-eye-slash",t.Bell="fa-bell",t.Flag="fa-flag",t.Map="fa-map",t.MapMarker="fa-map-marker-alt",t.Globe="fa-globe",t.Link="fa-link",t.Unlink="fa-unlink",t.Sun="fa-sun",t.Moon="fa-moon",t.ChartBar="fa-chart-bar",t.ChartLine="fa-chart-line",t.ChartPie="fa-chart-pie",t.ChartArea="fa-chart-area",t.Spinner="fa-spinner",t.CircleNotch="fa-circle-notch",t.CheckBadge="fa-badge-check",t.Cube="fa-cube",t.Cubes="fa-cubes",t.Plug="fa-plug",t.PuzzlePiece="fa-puzzle-piece",t.Palette="fa-palette",t))(de||{});const lb=({title:t,content:e,imageUrl:n,imageAlt:r="",className:s="",onClick:o,style:i,id:a,editorAttrs:l})=>h.jsxs(I,{className:`card-clickable ${s}`,onClick:o,style:i,id:a,...l,children:[n&&h.jsx(I,{className:"w-full",children:h.jsx(yn,{src:n,alt:r,className:"card-image"})}),h.jsxs(I,{className:"p-4",children:[t&&h.jsx(Zn,{className:"card-title",children:t}),e&&h.jsx(bt,{className:"card-content",children:e})]})]}),bs=({items:t,triggerLabel:e="작업",triggerIconName:n=de.EllipsisVertical,position:r="right",className:s="",style:o,children:i,onItemClick:a,id:l,editorAttrs:c})=>{const[d,u]=v.useState(!1),[f,g]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),y=v.useCallback(()=>{if(!m.current)return;const x=m.current.getBoundingClientRect(),E=224;let k=r==="right"?x.right-E:x.left;const C=x.bottom+8;k<8&&(k=8),k+E>window.innerWidth-8&&(k=window.innerWidth-E-8),g({top:C,left:k})},[r]);v.useEffect(()=>{d&&y()},[d,y]),v.useEffect(()=>{if(!d)return;const x=()=>{u(!1)};return window.addEventListener("scroll",x,!0),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)}},[d]),v.useEffect(()=>{const x=E=>{const k=E.target,C=m.current?.contains(k),N=p.current?.contains(k);!C&&!N&&u(!1)};return d&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[d]);const b=x=>{x.disabled||(x.onClick&&x.onClick(),a&&a(x.id,x),u(!1))},S=d?Nn.createPortal(h.jsx("div",{ref:p,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:f.top,left:f.left},children:t.filter(x=>x.if!==!1).map(x=>{if(x.divider)return h.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600 my-1"},x.id);const E=x.variant==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",k=x.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer";return h.jsxs("div",{onClick:()=>b(x),className:`flex items-center gap-3 px-4 py-3 transition-colors ${E} ${k}`,children:[x.iconName&&h.jsx(re,{name:x.iconName,className:"w-4 h-4"}),h.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.id)})}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,id:l,...c,children:[i?h.jsx(I,{ref:m,onClick:()=>u(!d),className:"cursor-pointer",children:i}):h.jsxs(oe,{ref:m,onClick:()=>u(!d),className:"flex items-center gap-2 px-2 py-1 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[e&&h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:e}),n&&h.jsx(re,{name:n,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})]}),S]})},Fr=(t,e)=>window.G7Core?.t?.(t,e)??t,Lo=({currentPage:t,totalPages:e,onPageChange:n,maxVisiblePages:r=5,showFirstLast:s=!0,className:o="",style:i,prevText:a,nextText:l,id:c,editorAttrs:d})=>{const u=v.useMemo(()=>{const p=[];if(e<=r+2)for(let y=1;y<=e;y++)p.push(y);else{const y=Math.floor(r/2);let b=Math.max(2,t-y),S=Math.min(e-1,t+y);t<=y+1?S=r:t>=e-y&&(b=e-r+1),p.push(1),b>2&&p.push("...");for(let x=b;x<=S;x++)p.push(x);S<e-1&&p.push("..."),e>1&&p.push(e)}return p},[t,e,r]),f=p=>{p<1||p>e||p===t||n(p)},g=()=>{t>1&&n(t-1)},m=()=>{t<e&&n(t+1)};return h.jsxs(I,{className:`pagination ${o}`,style:i,role:"navigation","aria-label":Fr("common.pagination"),id:c,...d,children:[s&&h.jsx(oe,{onClick:()=>f(1),disabled:t===1,className:"pagination-btn","aria-label":Fr("common.first_page"),children:"«"}),h.jsx(oe,{onClick:g,disabled:t===1,className:"pagination-btn","aria-label":Fr("common.prev_page"),children:a||h.jsx(h.Fragment,{children:"‹"})}),h.jsx(I,{className:"pagination",children:u.map((p,y)=>{if(p==="...")return h.jsx(Q,{className:"pagination-ellipsis",children:"..."},`ellipsis-${y}`);const b=p,S=b===t;return h.jsx(oe,{onClick:()=>f(b),className:S?"pagination-btn-active":"pagination-btn","aria-label":Fr("common.page_n",{n:b}),"aria-current":S?"page":void 0,children:b},b)})}),h.jsx(oe,{onClick:m,disabled:t===e,className:"pagination-btn","aria-label":Fr("common.next_page"),children:l||h.jsx(h.Fragment,{children:"›"})}),s&&h.jsx(oe,{onClick:()=>f(e),disabled:t===e,className:"pagination-btn","aria-label":Fr("common.last_page"),children:"»"})]})},Nd=(t,e)=>window.G7Core?.t?.(t,e)??t,cb=()=>window.G7Core?.locale?.supported?.()??["ko","en"],db=()=>window.G7Core?.locale?.current?.()??"ko",Od=t=>{const e=Nd(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},ub=()=>cb().map(e=>({code:e,name:Od(e),nativeName:Od(e)})),Va=({value:t={},onChange:e,inputType:n="text",layout:r="inline",availableLocales:s,defaultLocale:o,placeholder:i="",required:a=!1,disabled:l=!1,maxLength:c,rows:d=4,className:u="",name:f="multilingual_input",showCodeOnMobile:g=!1,error:m,id:p,editorAttrs:y})=>{const b=!!m,S=v.useMemo(()=>s??ub(),[s]),x=v.useMemo(()=>o??db(),[o]),E=v.useRef(t),[k,C]=v.useState(t),N=v.useRef(JSON.stringify(t));v.useEffect(()=>{const X=JSON.stringify(t);X!==N.current&&(N.current=X,E.current=t,C(t))},[t]);const _=v.useCallback((X,Z)=>{const ee={target:{name:f,value:X}};Z&&(ee._changedKeys=Z),e?.(ee)},[e,f]),[w,M]=v.useState(()=>{if(r==="tabs"||r==="compact"){const ee=S.map(he=>he.code);return[x,...ee.filter(he=>he!==x)]}const X=Object.keys(t).filter(ee=>t[ee]!==void 0);if(X.length===0)return[x];const Z=[];return X.includes(x)&&Z.push(x),X.forEach(ee=>{ee!==x&&Z.push(ee)}),Z}),[O,L]=v.useState(x),$=v.useMemo(()=>S.filter(X=>!w.includes(X.code)),[S,w]),[F,D]=v.useState(!1);v.useEffect(()=>{if(r==="tabs"||r==="compact"){const he=S.map(ie=>ie.code),J=[x,...he.filter(ie=>ie!==x)],ce=w.join(","),ue=J.join(",");ce!==ue&&M(J);return}const X=Object.keys(t).filter(he=>t[he]!==void 0);if(X.length===0){M([x]);return}const Z=[];X.includes(x)&&Z.push(x),X.forEach(he=>{he!==x&&Z.push(he)});const ee=w.join(","),ne=Z.join(",");ee!==ne&&M(Z)},[t,x,r,S]);const A=v.useCallback((X,Z)=>{const ee={...E.current,[X]:Z};E.current=ee,C(ee),_(ee,[X])},[_]),T=v.useCallback(X=>{M(ee=>[...ee,X]),L(X),D(!1);const Z={...E.current,[X]:""};E.current=Z,C(Z),_(Z)},[_]),V=v.useCallback(X=>{if(X===x)return;M(ee=>ee.filter(ne=>ne!==X)),O===X&&L(x);const Z={...E.current};delete Z[X],E.current=Z,C(Z),_(Z)},[O,x,_]),H=v.useCallback(X=>{const Z=S.find(ee=>ee.code===X);return Z?.nativeName||Z?.name||X.toUpperCase()},[S]),W=v.useCallback(X=>!!k[X]?.trim(),[k]),j=v.useCallback(()=>$.length===0?null:h.jsxs(I,{className:"relative",children:[h.jsxs(oe,{type:"button",className:"inline-flex items-center gap-1 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/50 rounded-full border border-dashed border-blue-300 dark:border-blue-600 transition-colors",onClick:()=>D(!F),disabled:l,children:[h.jsx(re,{name:"plus",className:"w-3 h-3"}),h.jsx(Q,{children:Nd("common.add_language")})]}),F&&h.jsx(I,{className:"absolute top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-10 min-w-[120px]",children:$.map(X=>h.jsxs(oe,{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 first:rounded-t-lg last:rounded-b-lg transition-colors",onClick:()=>T(X.code),children:[h.jsx(re,{name:"globe",className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{children:X.nativeName||X.name})]},X.code))})]}),[$,F,l,T]),U=v.useCallback((X,Z=!1)=>{const ee=b?"input input-error":"input",ne=b?"textarea input-error":"textarea",he=X===x,J=`${i}${i?" (":""}${H(X)}${i?")":""}`;return h.jsxs(I,{className:"space-y-2",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsxs(Q,{className:`
|
||
inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium
|
||
${he?"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"}
|
||
`,children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),H(X),he&&h.jsx(Q,{className:"text-red-500 dark:text-red-400",children:"*"}),!he&&h.jsx(oe,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",onClick:()=>V(X),disabled:l,children:h.jsx(re,{name:"xmark",className:"w-3 h-3"})})]}),he&&Z&&j()]}),n==="textarea"?h.jsx(qn,{name:`${f}[${X}]`,value:k[X]||"",onChange:ce=>A(X,ce.target.value),placeholder:J,required:a&&he,disabled:l,maxLength:c,rows:d,className:`${ne} resize-vertical`}):h.jsx(wt,{type:"text",name:`${f}[${X}]`,value:k[X]||"",onChange:ce=>A(X,ce.target.value),placeholder:J,required:a&&he,disabled:l,maxLength:c,className:ee})]},X)},[f,k,A,i,a,l,c,d,n,H,x,V,j,b]),B=v.useCallback(X=>{const Z=b?"input input-error":"input",ee=b?"textarea input-error":"textarea",ne=`${i}${i?" (":""}${H(X)}${i?")":""}`;return h.jsx(I,{children:n==="textarea"?h.jsx(qn,{name:`${f}[${X}]`,value:k[X]||"",onChange:he=>A(X,he.target.value),placeholder:ne,required:a&&X===x,disabled:l,maxLength:c,rows:d,className:`${ee} resize-vertical`}):h.jsx(wt,{type:"text",name:`${f}[${X}]`,value:k[X]||"",onChange:he=>A(X,he.target.value),placeholder:ne,required:a&&X===x,disabled:l,maxLength:c,className:Z})},X)},[f,k,A,i,a,l,c,d,n,x,H,b]),G=()=>h.jsx(I,{className:u,children:h.jsx(I,{className:"space-y-4",children:w.map((X,Z)=>U(X,Z===0))})}),z=()=>h.jsxs(I,{className:u,children:[h.jsxs(I,{className:"flex items-center gap-2 mb-3",children:[w.map(X=>h.jsxs(oe,{type:"button",className:`
|
||
inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all
|
||
${O===X?X===x?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":X===x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
||
`,onClick:()=>L(X),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),g?h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:H(X)}),h.jsx(Q,{className:"inline md:hidden",children:X.toUpperCase()})]}):H(X),X===x&&h.jsx(Q,{className:"text-red-500 dark:text-red-400",children:"*"}),W(X)&&O!==X&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"}),X!==x&&h.jsx(oe,{type:"button",className:"ml-0.5 p-0.5 rounded-full hover:bg-gray-300 dark:hover:bg-gray-500 transition-colors",onClick:Z=>{Z.stopPropagation(),V(X)},disabled:l,children:h.jsx(re,{name:"xmark",className:"w-3 h-3"})})]},X)),j()]}),w.map(X=>h.jsx(I,{className:O===X?"block":"hidden",children:B(X)},X))]}),K=()=>{const X=b?"input input-error":"input",Z=b?"textarea input-error":"textarea";return h.jsx(I,{className:u,children:h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(I,{className:"flex items-center shrink-0",children:w.map(ee=>h.jsxs(oe,{type:"button",className:`
|
||
px-2 py-1.5 text-xs font-medium border-y border-l first:rounded-l last:rounded-r last:border-r transition-colors
|
||
${O===ee?"bg-blue-500 text-white border-blue-500 dark:bg-blue-600 dark:border-blue-600":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700"}
|
||
`,onClick:()=>L(ee),title:H(ee),children:[ee.toUpperCase(),ee===x&&h.jsx(Q,{className:"text-red-400 ml-0.5",children:"*"})]},ee))}),h.jsx(I,{className:"flex-1 min-w-0",children:n==="textarea"?h.jsx(qn,{name:`${f}[${O}]`,value:k[O]||"",onChange:ee=>A(O,ee.target.value),placeholder:i,required:a&&O===x,disabled:l,maxLength:c,rows:d,className:Z}):h.jsx(wt,{type:"text",name:`${f}[${O}]`,value:k[O]||"",onChange:ee=>A(O,ee.target.value),placeholder:i,required:a&&O===x,disabled:l,maxLength:c,className:X})})]})})};return h.jsxs(I,{className:l?"opacity-50 cursor-not-allowed":void 0,id:p,...y,children:[r==="compact"?K():r==="tabs"?z():G(),b&&m&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:m})]})};Va.displayName="MultilingualInput";const fb=()=>window.G7Core,za=({checked:t,value:e,onChange:n,disabled:r=!1,label:s,description:o,size:i="md",className:a="",name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(()=>t??e??!1);v.useEffect(()=>{f(t??e??!1)},[t,e]);const g=b=>{const S=b.target.checked;f(S),n&&!r&&n(b)},p={sm:{track:"w-9 h-5",thumb:"after:h-4 after:w-4"},md:{track:"w-11 h-6",thumb:"after:h-5 after:w-5"},lg:{track:"w-14 h-7",thumb:"after:h-6 after:w-6"}}[i],y=()=>{if(!r){const b=!u;if(f(b),n){const S=fb();S?.createChangeEvent&&n(S.createChangeEvent({checked:b,name:l}))}}};return h.jsxs("div",{className:`toggle-container ${a}`,id:c,...d,children:[h.jsxs("div",{className:`toggle-switch-wrapper ${r?"cursor-not-allowed opacity-50":"cursor-pointer"}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),y()},children:[h.jsx("input",{type:"checkbox",id:l,name:l,checked:u,onChange:g,disabled:r,className:"sr-only peer",tabIndex:-1}),h.jsx("div",{className:`toggle-switch-track ${p.track} ${p.thumb}`})]}),s&&h.jsx("span",{className:`toggle-label ${r?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:y,children:s}),o&&h.jsx("p",{className:"toggle-description",children:o})]})},Po=({status:t,label:e,showIcon:n=!0,iconName:r,className:s="",style:o,id:i,editorAttrs:a})=>{const l={success:"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-400 border-green-200 dark:border-green-800",warning:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800",error:"bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-400 border-red-200 dark:border-red-800",info:"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 border-blue-200 dark:border-blue-800",pending:"bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-200 dark:border-gray-600",default:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600"},c={success:de.CheckCircle,warning:de.ExclamationTriangle,error:de.XCircle,info:de.InfoCircle,pending:de.Clock,default:de.QuestionCircle},d={success:"성공",warning:"경고",error:"오류",info:"정보",pending:"대기 중",default:"기본"},u=r||c[t],f=e||d[t],g=l[t];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border ${g} ${s}`,style:o,id:i,...a,children:[n&&h.jsx(re,{name:u,className:"w-4 h-4"}),h.jsx(Q,{children:f})]})},Td={blue:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",green:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",red:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",gray:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",yellow:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",purple:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",orange:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",teal:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",cyan:"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300"},hb={success:"green",warning:"yellow",danger:"red",error:"red",info:"blue",primary:"blue",secondary:"gray",text:"gray",default:"gray"},Ad={sm:"px-1.5 py-0.5 text-[10px]",md:"px-2 py-0.5 text-xs",lg:"px-2.5 py-1 text-sm"},Dd=({color:t,variant:e,text:n,size:r="md",className:s="",style:o,children:i,id:a,editorAttrs:l})=>{const c=t||(e?hb[e]:void 0)||"gray",d=Td[c]||Td.gray,u=Ad[r]||Ad.md;return h.jsxs(Q,{className:`inline-flex items-center rounded-full font-medium ${u} ${d} ${s}`,style:o,id:a,...l,children:[n,i]})};/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:Id,setPrototypeOf:Ld,isFrozen:gb,getPrototypeOf:pb,getOwnPropertyDescriptor:mb}=Object;let{freeze:Bt,seal:an,create:Pd}=Object,{apply:Ha,construct:Ua}=typeof Reflect<"u"&&Reflect;Bt||(Bt=function(e){return e}),an||(an=function(e){return e}),Ha||(Ha=function(e,n,r){return e.apply(n,r)}),Ua||(Ua=function(e,n){return new e(...n)});const $o=tn(Array.prototype.forEach),$d=tn(Array.prototype.pop),ys=tn(Array.prototype.push),Fo=tn(String.prototype.toLowerCase),Ba=tn(String.prototype.toString),Fd=tn(String.prototype.match),vs=tn(String.prototype.replace),bb=tn(String.prototype.indexOf),yb=tn(String.prototype.trim),xn=tn(Object.prototype.hasOwnProperty),jt=tn(RegExp.prototype.test),xs=vb(TypeError);function tn(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return Ha(t,e,r)}}function vb(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Ua(t,n)}}function Ge(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fo;Ld&&Ld(t,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const o=n(s);o!==s&&(gb(e)||(e[r]=o),s=o)}t[s]=!0}return t}function xb(t){for(let e=0;e<t.length;e++)xn(t,e)||(t[e]=null);return t}function ur(t){const e=Pd(null);for(const[n,r]of Id(t))xn(t,n)&&(Array.isArray(r)?e[n]=xb(r):r&&typeof r=="object"&&r.constructor===Object?e[n]=ur(r):e[n]=r);return e}function ws(t,e){for(;t!==null;){const r=mb(t,e);if(r){if(r.get)return tn(r.get);if(typeof r.value=="function")return tn(r.value)}t=pb(t)}function n(){return null}return n}const Vd=Bt(["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","section","select","shadow","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"]),ja=Bt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Wa=Bt(["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"]),wb=Bt(["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"]),Ga=Bt(["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"]),kb=Bt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),zd=Bt(["#text"]),Hd=Bt(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ya=Bt(["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","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"]),Ud=Bt(["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"]),Vo=Bt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cb=an(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Sb=an(/<%[\w\W]*|[\w\W]*%>/gm),_b=an(/\${[\w\W]*}/gm),Eb=an(/^data-[\-\w.\u00B7-\uFFFF]/),Mb=an(/^aria-[\-\w]+$/),Bd=an(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nb=an(/^(?:\w+script|data):/i),Ob=an(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jd=an(/^html$/i),Tb=an(/^[a-z][.\w]*(-[.\w]+)+$/i);var Wd=Object.freeze({__proto__:null,MUSTACHE_EXPR:Cb,ERB_EXPR:Sb,TMPLIT_EXPR:_b,DATA_ATTR:Eb,ARIA_ATTR:Mb,IS_ALLOWED_URI:Bd,IS_SCRIPT_OR_DATA:Nb,ATTR_WHITESPACE:Ob,DOCTYPE_NAME:jd,CUSTOM_ELEMENT:Tb});const ks={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ab=function(){return typeof window>"u"?null:window},Db=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}};function Gd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ab();const e=Ce=>Gd(Ce);if(e.version="3.1.7",e.removed=[],!t||!t.document||t.document.nodeType!==ks.document)return e.isSupported=!1,e;let{document:n}=t;const r=n,s=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:i,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:g}=t,m=l.prototype,p=ws(m,"cloneNode"),y=ws(m,"remove"),b=ws(m,"nextSibling"),S=ws(m,"childNodes"),x=ws(m,"parentNode");if(typeof i=="function"){const Ce=n.createElement("template");Ce.content&&Ce.content.ownerDocument&&(n=Ce.content.ownerDocument)}let E,k="";const{implementation:C,createNodeIterator:N,createDocumentFragment:_,getElementsByTagName:w}=n,{importNode:M}=r;let O={};e.isSupported=typeof Id=="function"&&typeof x=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:L,ERB_EXPR:$,TMPLIT_EXPR:F,DATA_ATTR:D,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:H}=Wd;let{IS_ALLOWED_URI:W}=Wd,j=null;const U=Ge({},[...Vd,...ja,...Wa,...Ga,...zd]);let B=null;const G=Ge({},[...Hd,...Ya,...Ud,...Vo]);let z=Object.seal(Pd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,X=null,Z=!0,ee=!0,ne=!1,he=!0,J=!1,ce=!0,ue=!1,ie=!1,ve=!1,fe=!1,ye=!1,Se=!1,He=!0,se=!1;const Ae="user-content-";let Le=!0,Ie=!1,Be={},st=null;const ft=Ge({},["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 je=null;const Je=Ge({},["audio","video","img","source","image","track"]);let Xe=null;const te=Ge({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",me="http://www.w3.org/1999/xhtml";let be=me,Ue=!1,Me=null;const Fe=Ge({},[ge,pe,me],Ba);let _e=null;const ot=["application/xhtml+xml","text/html"],it="text/html";let we=null,Ee=null;const ze=n.createElement("form"),qe=function(Y){return Y instanceof RegExp||Y instanceof Function},Re=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ee&&Ee===Y)){if((!Y||typeof Y!="object")&&(Y={}),Y=ur(Y),_e=ot.indexOf(Y.PARSER_MEDIA_TYPE)===-1?it:Y.PARSER_MEDIA_TYPE,we=_e==="application/xhtml+xml"?Ba:Fo,j=xn(Y,"ALLOWED_TAGS")?Ge({},Y.ALLOWED_TAGS,we):U,B=xn(Y,"ALLOWED_ATTR")?Ge({},Y.ALLOWED_ATTR,we):G,Me=xn(Y,"ALLOWED_NAMESPACES")?Ge({},Y.ALLOWED_NAMESPACES,Ba):Fe,Xe=xn(Y,"ADD_URI_SAFE_ATTR")?Ge(ur(te),Y.ADD_URI_SAFE_ATTR,we):te,je=xn(Y,"ADD_DATA_URI_TAGS")?Ge(ur(Je),Y.ADD_DATA_URI_TAGS,we):Je,st=xn(Y,"FORBID_CONTENTS")?Ge({},Y.FORBID_CONTENTS,we):ft,K=xn(Y,"FORBID_TAGS")?Ge({},Y.FORBID_TAGS,we):{},X=xn(Y,"FORBID_ATTR")?Ge({},Y.FORBID_ATTR,we):{},Be=xn(Y,"USE_PROFILES")?Y.USE_PROFILES:!1,Z=Y.ALLOW_ARIA_ATTR!==!1,ee=Y.ALLOW_DATA_ATTR!==!1,ne=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,he=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,J=Y.SAFE_FOR_TEMPLATES||!1,ce=Y.SAFE_FOR_XML!==!1,ue=Y.WHOLE_DOCUMENT||!1,fe=Y.RETURN_DOM||!1,ye=Y.RETURN_DOM_FRAGMENT||!1,Se=Y.RETURN_TRUSTED_TYPE||!1,ve=Y.FORCE_BODY||!1,He=Y.SANITIZE_DOM!==!1,se=Y.SANITIZE_NAMED_PROPS||!1,Le=Y.KEEP_CONTENT!==!1,Ie=Y.IN_PLACE||!1,W=Y.ALLOWED_URI_REGEXP||Bd,be=Y.NAMESPACE||me,z=Y.CUSTOM_ELEMENT_HANDLING||{},Y.CUSTOM_ELEMENT_HANDLING&&qe(Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&qe(Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),J&&(ee=!1),ye&&(fe=!0),Be&&(j=Ge({},zd),B=[],Be.html===!0&&(Ge(j,Vd),Ge(B,Hd)),Be.svg===!0&&(Ge(j,ja),Ge(B,Ya),Ge(B,Vo)),Be.svgFilters===!0&&(Ge(j,Wa),Ge(B,Ya),Ge(B,Vo)),Be.mathMl===!0&&(Ge(j,Ga),Ge(B,Ud),Ge(B,Vo))),Y.ADD_TAGS&&(j===U&&(j=ur(j)),Ge(j,Y.ADD_TAGS,we)),Y.ADD_ATTR&&(B===G&&(B=ur(B)),Ge(B,Y.ADD_ATTR,we)),Y.ADD_URI_SAFE_ATTR&&Ge(Xe,Y.ADD_URI_SAFE_ATTR,we),Y.FORBID_CONTENTS&&(st===ft&&(st=ur(st)),Ge(st,Y.FORBID_CONTENTS,we)),Le&&(j["#text"]=!0),ue&&Ge(j,["html","head","body"]),j.table&&(Ge(j,["tbody"]),delete K.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=Y.TRUSTED_TYPES_POLICY,k=E.createHTML("")}else E===void 0&&(E=Db(g,s)),E!==null&&typeof k=="string"&&(k=E.createHTML(""));Bt&&Bt(Y),Ee=Y}},nt=Ge({},["mi","mo","mn","ms","mtext"]),gt=Ge({},["annotation-xml"]),mn=Ge({},["title","style","font","a","script"]),mt=Ge({},[...ja,...Wa,...wb]),xt=Ge({},[...Ga,...kb]),Dt=function(Y){let ae=x(Y);(!ae||!ae.tagName)&&(ae={namespaceURI:be,tagName:"template"});const xe=Fo(Y.tagName),lt=Fo(ae.tagName);return Me[Y.namespaceURI]?Y.namespaceURI===pe?ae.namespaceURI===me?xe==="svg":ae.namespaceURI===ge?xe==="svg"&&(lt==="annotation-xml"||nt[lt]):!!mt[xe]:Y.namespaceURI===ge?ae.namespaceURI===me?xe==="math":ae.namespaceURI===pe?xe==="math"&>[lt]:!!xt[xe]:Y.namespaceURI===me?ae.namespaceURI===pe&&!gt[lt]||ae.namespaceURI===ge&&!nt[lt]?!1:!xt[xe]&&(mn[xe]||!mt[xe]):!!(_e==="application/xhtml+xml"&&Me[Y.namespaceURI]):!1},Ve=function(Y){ys(e.removed,{element:Y});try{x(Y).removeChild(Y)}catch{y(Y)}},sn=function(Y,ae){try{ys(e.removed,{attribute:ae.getAttributeNode(Y),from:ae})}catch{ys(e.removed,{attribute:null,from:ae})}if(ae.removeAttribute(Y),Y==="is"&&!B[Y])if(fe||ye)try{Ve(ae)}catch{}else try{ae.setAttribute(Y,"")}catch{}},on=function(Y){let ae=null,xe=null;if(ve)Y="<remove></remove>"+Y;else{const le=Fd(Y,/^[\r\n\t ]+/);xe=le&&le[0]}_e==="application/xhtml+xml"&&be===me&&(Y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Y+"</body></html>");const lt=E?E.createHTML(Y):Y;if(be===me)try{ae=new f().parseFromString(lt,_e)}catch{}if(!ae||!ae.documentElement){ae=C.createDocument(be,"template",null);try{ae.documentElement.innerHTML=Ue?k:lt}catch{}}const q=ae.body||ae.documentElement;return Y&&xe&&q.insertBefore(n.createTextNode(xe),q.childNodes[0]||null),be===me?w.call(ae,ue?"html":"body")[0]:ue?ae.documentElement:q},Rt=function(Y){return N.call(Y.ownerDocument||Y,Y,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},zn=function(Y){return Y instanceof u&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof d)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},dr=function(Y){return typeof a=="function"&&Y instanceof a},bn=function(Y,ae,xe){O[Y]&&$o(O[Y],lt=>{lt.call(e,ae,xe,Ee)})},To=function(Y){let ae=null;if(bn("beforeSanitizeElements",Y,null),zn(Y))return Ve(Y),!0;const xe=we(Y.nodeName);if(bn("uponSanitizeElement",Y,{tagName:xe,allowedTags:j}),Y.hasChildNodes()&&!dr(Y.firstElementChild)&&jt(/<[/\w]/g,Y.innerHTML)&&jt(/<[/\w]/g,Y.textContent)||Y.nodeType===ks.progressingInstruction||ce&&Y.nodeType===ks.comment&&jt(/<[/\w]/g,Y.data))return Ve(Y),!0;if(!j[xe]||K[xe]){if(!K[xe]&&Do(xe)&&(z.tagNameCheck instanceof RegExp&&jt(z.tagNameCheck,xe)||z.tagNameCheck instanceof Function&&z.tagNameCheck(xe)))return!1;if(Le&&!st[xe]){const lt=x(Y)||Y.parentNode,q=S(Y)||Y.childNodes;if(q&<){const le=q.length;for(let ke=le-1;ke>=0;--ke){const We=p(q[ke],!0);We.__removalCount=(Y.__removalCount||0)+1,lt.insertBefore(We,b(Y))}}}return Ve(Y),!0}return Y instanceof l&&!Dt(Y)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&jt(/<\/no(script|embed|frames)/i,Y.innerHTML)?(Ve(Y),!0):(J&&Y.nodeType===ks.text&&(ae=Y.textContent,$o([L,$,F],lt=>{ae=vs(ae,lt," ")}),Y.textContent!==ae&&(ys(e.removed,{element:Y.cloneNode()}),Y.textContent=ae)),bn("afterSanitizeElements",Y,null),!1)},Ao=function(Y,ae,xe){if(He&&(ae==="id"||ae==="name")&&(xe in n||xe in ze))return!1;if(!(ee&&!X[ae]&&jt(D,ae))){if(!(Z&&jt(A,ae))){if(!B[ae]||X[ae]){if(!(Do(Y)&&(z.tagNameCheck instanceof RegExp&&jt(z.tagNameCheck,Y)||z.tagNameCheck instanceof Function&&z.tagNameCheck(Y))&&(z.attributeNameCheck instanceof RegExp&&jt(z.attributeNameCheck,ae)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(ae))||ae==="is"&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&jt(z.tagNameCheck,xe)||z.tagNameCheck instanceof Function&&z.tagNameCheck(xe))))return!1}else if(!Xe[ae]){if(!jt(W,vs(xe,V,""))){if(!((ae==="src"||ae==="xlink:href"||ae==="href")&&Y!=="script"&&bb(xe,"data:")===0&&je[Y])){if(!(ne&&!jt(T,vs(xe,V,"")))){if(xe)return!1}}}}}}return!0},Do=function(Y){return Y!=="annotation-xml"&&Fd(Y,H)},Dr=function(Y){bn("beforeSanitizeAttributes",Y,null);const{attributes:ae}=Y;if(!ae)return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:B};let lt=ae.length;for(;lt--;){const q=ae[lt],{name:le,namespaceURI:ke,value:We}=q,Pe=we(le);let Pt=le==="value"?We:yb(We);if(xe.attrName=Pe,xe.attrValue=Pt,xe.keepAttr=!0,xe.forceKeepAttr=void 0,bn("uponSanitizeAttribute",Y,xe),Pt=xe.attrValue,xe.forceKeepAttr||(sn(le,Y),!xe.keepAttr))continue;if(!he&&jt(/\/>/i,Pt)){sn(le,Y);continue}J&&$o([L,$,F],Ym=>{Pt=vs(Pt,Ym," ")});const Gm=we(Y.nodeName);if(Ao(Gm,Pe,Pt)){if(se&&(Pe==="id"||Pe==="name")&&(sn(le,Y),Pt=Ae+Pt),ce&&jt(/((--!?|])>)|<\/(style|title)/i,Pt)){sn(le,Y);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!ke)switch(g.getAttributeType(Gm,Pe)){case"TrustedHTML":{Pt=E.createHTML(Pt);break}case"TrustedScriptURL":{Pt=E.createScriptURL(Pt);break}}try{ke?Y.setAttributeNS(ke,le,Pt):Y.setAttribute(le,Pt),zn(Y)?Ve(Y):$d(e.removed)}catch{}}}bn("afterSanitizeAttributes",Y,null)},Oa=function Ce(Y){let ae=null;const xe=Rt(Y);for(bn("beforeSanitizeShadowDOM",Y,null);ae=xe.nextNode();)bn("uponSanitizeShadowNode",ae,null),!To(ae)&&(ae.content instanceof o&&Ce(ae.content),Dr(ae));bn("afterSanitizeShadowDOM",Y,null)};return e.sanitize=function(Ce){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=null,xe=null,lt=null,q=null;if(Ue=!Ce,Ue&&(Ce="<!-->"),typeof Ce!="string"&&!dr(Ce))if(typeof Ce.toString=="function"){if(Ce=Ce.toString(),typeof Ce!="string")throw xs("dirty is not a string, aborting")}else throw xs("toString is not a function");if(!e.isSupported)return Ce;if(ie||Re(Y),e.removed=[],typeof Ce=="string"&&(Ie=!1),Ie){if(Ce.nodeName){const We=we(Ce.nodeName);if(!j[We]||K[We])throw xs("root node is forbidden and cannot be sanitized in-place")}}else if(Ce instanceof a)ae=on("<!---->"),xe=ae.ownerDocument.importNode(Ce,!0),xe.nodeType===ks.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?ae=xe:ae.appendChild(xe);else{if(!fe&&!J&&!ue&&Ce.indexOf("<")===-1)return E&&Se?E.createHTML(Ce):Ce;if(ae=on(Ce),!ae)return fe?null:Se?k:""}ae&&ve&&Ve(ae.firstChild);const le=Rt(Ie?Ce:ae);for(;lt=le.nextNode();)To(lt)||(lt.content instanceof o&&Oa(lt.content),Dr(lt));if(Ie)return Ce;if(fe){if(ye)for(q=_.call(ae.ownerDocument);ae.firstChild;)q.appendChild(ae.firstChild);else q=ae;return(B.shadowroot||B.shadowrootmode)&&(q=M.call(r,q,!0)),q}let ke=ue?ae.outerHTML:ae.innerHTML;return ue&&j["!doctype"]&&ae.ownerDocument&&ae.ownerDocument.doctype&&ae.ownerDocument.doctype.name&&jt(jd,ae.ownerDocument.doctype.name)&&(ke="<!DOCTYPE "+ae.ownerDocument.doctype.name+`>
|
||
`+ke),J&&$o([L,$,F],We=>{ke=vs(ke,We," ")}),E&&Se?E.createHTML(ke):ke},e.setConfig=function(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Re(Ce),ie=!0},e.clearConfig=function(){Ee=null,ie=!1},e.isValidAttribute=function(Ce,Y,ae){Ee||Re({});const xe=we(Ce),lt=we(Y);return Ao(xe,lt,ae)},e.addHook=function(Ce,Y){typeof Y=="function"&&(O[Ce]=O[Ce]||[],ys(O[Ce],Y))},e.removeHook=function(Ce){if(O[Ce])return $d(O[Ce])},e.removeHooks=function(Ce){O[Ce]&&(O[Ce]=[])},e.removeAllHooks=function(){O={}},e}var Ib=Gd();const Xa=({content:t,text:e,isHtml:n=!0,className:r="",purifyConfig:s,id:o,editorAttrs:i})=>{const a=e??t??"";if(!a||a.trim()==="")return null;if(!n){const u=`
|
||
whitespace-pre-wrap
|
||
text-gray-900 dark:text-gray-100
|
||
font-sans
|
||
${r}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(I,{className:u,id:o,...i,children:a})}const l={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},c=v.useMemo(()=>{const u=s?{...l,...s,FORBID_TAGS:[...l.FORBID_TAGS,...s.FORBID_TAGS||[]],FORBID_ATTR:[...l.FORBID_ATTR,...s.FORBID_ATTR||[]]}:l;return Ib.sanitize(a,u).replace(/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,(g,m,p,y)=>(p.startsWith("http://")||p.startsWith("https://"))&&!g.includes("rel=")?`<a ${m}href="${p}"${y} rel="noopener noreferrer">`:g)},[a,s]),d=`
|
||
prose dark:prose-invert max-w-none
|
||
prose-p:my-2
|
||
prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4
|
||
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
|
||
${r}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(I,{className:d,dangerouslySetInnerHTML:{__html:c},id:o,...i})},zo=window.G7Core?.createLogger?.("Comp:DataGrid")??{log:(...t)=>console.log("[Comp:DataGrid]",...t),warn:(...t)=>console.warn("[Comp:DataGrid]",...t),error:(...t)=>console.error("[Comp:DataGrid]",...t)},Cs=(t,e)=>window.G7Core?.t?.(t,e)??t,Ka={Div:I,Span:Q,Button:oe,Icon:re,Checkbox:vn,P:bt,A:Lr,Label:en,Input:wt,H1:Ta,H2:Zn,H3:Ir,H4:_d,Img:yn,Select:Pr,Textarea:qn,Table:La,Thead:Pa,Tbody:$a,Tfoot:Fa,Tr:Qn,Th:$r,Td:Yt,MultilingualInput:Va,Toggle:za,StatusBadge:Po,Badge:Dd,HtmlContent:Xa,ActionMenu:bs},qa=t=>{if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.map(e=>qa(e)).join(", ");if(typeof t=="object"){if(v.isValidElement(t))return t;if(Object.keys(t).length===0)return"";try{return JSON.stringify(t)}catch{return zo.warn("객체를 문자열로 변환할 수 없습니다:",t),"[Object]"}}return String(t)},Yd=(t,e)=>{if(!t)return!0;const n=t.match(/^\{\{(.+)\}\}$/);if(!n)return!0;const r=n[1].trim();try{return!!new Function("row",`return ${r}`)(e)}catch(s){return zo.warn("subRow 조건 평가 실패:",t,s),!0}},Ss=(t,e,n,r="",s)=>{const o=window.G7Core;if(o?.renderItemChildren){const i={row:e,value:n,$value:n};return o.renderItemChildren(t,i,Ka,r,s?{componentContext:s}:void 0)}return zo.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Za=(t,e,n="",r)=>{const s=window.G7Core;if(s?.renderItemChildren){const o={row:e,$value:e};return s.renderItemChildren(t,o,Ka,n,r?{componentContext:r}:void 0)}return zo.warn("G7Core.renderItemChildren을 사용할 수 없습니다."),null},Lb=({id:t,columns:e,data:n,sortable:r=!0,pagination:s=!1,pageSize:o=10,onRowClick:i,className:a="",style:l,sortField:c,sortDirection:d,onSortChange:u,selectable:f=!1,selectedIds:g=[],onSelectionChange:m,idField:p="id",showColumnSelector:y=!1,visibleColumns:b,onColumnVisibilityChange:S,responsiveBreakpoint:x=768,cardRenderer:E,rowActions:k,onRowAction:C,alwaysShowPagination:N=!1,serverSidePagination:_=!1,serverCurrentPage:w,serverTotalPages:M,onPageChange:O,prevText:L,nextText:$,columnSelectorText:F,emptyMessage:D,actionsColumnHeader:A,requiredText:T,selectedCountText:V,showFirstLast:H=!0,expandable:W=!1,expandedRowIds:j,onExpandChange:U,expandChildren:B,expandedRowRender:G,expandColumnWidth:z="48px",expandIconExpanded:K=de.ChevronDown,expandIconCollapsed:X=de.ChevronRight,expandConditionField:Z,dynamicColumns:ee,dynamicColumnsInsertAfter:ne,expandContext:he,__componentContext:J,subRowChildren:ce,subRowCondition:ue,subRowClassName:ie="px-6 py-2 bg-gray-50 dark:bg-gray-900",subRowRender:ve,footerCells:fe,footerClassName:ye="bg-gray-50 dark:bg-gray-800/50 font-medium",footerCardChildren:Se,editorAttrs:He})=>{const se=L||void 0,Ae=$||void 0,Le=F??Cs("common.column_selector"),Ie=D??Cs("common.no_data"),Be=A??Cs("common.actions"),st=T??Cs("common.required"),ft=V??Cs("common.selected_count"),je=window.G7Core,Je=je?.useControllableState,Xe=je?.shallowArrayEqual,[te,ge]=Je?Je(c,null,q=>{q!==null&&u?.(q,pe)}):[c??null,()=>{}],[pe,me]=Je?Je(d,"asc",q=>{te!==null&&u?.(te,q)}):[d??"asc",()=>{}],[be,Ue]=v.useState(1),[Me,Fe]=Je?Je(j,[],U,{isEqual:Xe}):[j??[],()=>{}],[_e,ot]=v.useState(!1),it=v.useRef(null),we=je?.useResponsive,Ee=we?.(),ze=Ee?Ee.width<x:typeof window<"u"&&window.innerWidth<x,qe=v.useMemo(()=>{if(!ee||!Array.isArray(ee)||ee.length===0)return e;if(ne){const q=e.findIndex(le=>le.field===ne);if(q!==-1)return[...e.slice(0,q+1),...ee,...e.slice(q+1)]}return[...e,...ee]},[e,ee,ne]),[Re,nt]=v.useState(()=>b&&b.length>0?b:e.filter(q=>!q.hidden).map(q=>q.field));v.useEffect(()=>{b&&b.length>0&&nt(b)},[b]);const gt=v.useRef("");v.useEffect(()=>{const q=e.map(le=>le.field).join(",");gt.current&&q!==gt.current&&(!b||b.length===0)&&nt(e.filter(le=>!le.hidden).map(le=>le.field)),gt.current=q},[e,b]);const mn=v.useRef([]),mt=v.useRef(null);v.useEffect(()=>{if(ee&&ee.length>0){const q=ee.map(We=>We.field);if(mt.current===null&&(mt.current=b!==void 0&&b.length>0,mt.current)){mn.current=q;return}const le=mn.current,ke=q.filter(We=>!le.includes(We));if(ke.length>0){const We=ke.filter(Pe=>!Re.includes(Pe));if(We.length>0){const Pe=[...Re,...We];nt(Pe),S?.(Pe)}}mn.current=q}},[ee]),v.useEffect(()=>{_||Ue(1)},[n,_]),v.useEffect(()=>{const q=le=>{it.current&&!it.current.contains(le.target)&&ot(!1)};return _e&&document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[_e]);const xt=v.useMemo(()=>!y&&(!b||b.length===0)?qe.filter(q=>!q.hidden):qe.filter(q=>Re.includes(q.field)),[qe,Re,y,b]),Dt=v.useMemo(()=>!te||!r||!n?n||[]:u?n:[...n].sort((q,le)=>{const ke=q[te],We=le[te];if(ke===We)return 0;const Pe=ke>We?1:-1;return pe==="asc"?Pe:-Pe}),[n,te,pe,r,u]),Ve=v.useMemo(()=>{if(_||!s)return Dt;const q=(be-1)*o,le=q+o;return Dt.slice(q,le)},[Dt,be,o,s,_]),sn=_?w||1:be,on=_?M||1:Math.ceil((Dt?.length||0)/o),Rt=v.useCallback(q=>{_&&O?O(q):Ue(q)},[_,O]),zn=q=>{if(!r||e.find(We=>We.field===q)?.sortable===!1)return;const ke=te===q&&pe==="asc"?"desc":"asc";Je?(ge(q),me(ke)):u&&u(q,ke)},dr=v.useCallback(()=>{if(!m||!Ve)return;const q=Ve.map(ke=>ke[p]);if(q.every(ke=>g.includes(ke)))m(g.filter(ke=>!q.includes(ke)));else{const ke=[...new Set([...g,...q])];m(ke)}},[Ve,g,m,p]),bn=v.useCallback(q=>{m&&(g.includes(q)?m(g.filter(le=>le!==q)):m([...g,q]))},[g,m]),To=v.useCallback(q=>{if(qe.find(We=>We.field===q)?.required)return;const ke=Re.includes(q)?Re.filter(We=>We!==q):[...Re,q];nt(ke),S?.(ke)},[qe,Re,S]),Ao=v.useCallback((q,le)=>{C?.(q,le)},[C]),Do=v.useCallback(q=>k?k.map(le=>{let ke=le.disabled??!1;if(le.disabledField&&!ke){const We=le.disabledField.split(".");let Pe=q;for(const Pt of We)Pe=Pe?.[Pt];Pe||(ke=!0)}return{...le,disabled:ke,onClick:()=>Ao(le.id,q)}}):[],[k,Ao]),Dr=v.useCallback(q=>{if(!Z)return!0;const le=q[Z];return Array.isArray(le)?le.length>0:!!le},[Z]),Oa=v.useCallback(q=>{const le=Me.includes(q)?Me.filter(ke=>ke!==q):[...Me,q];Je?Fe(le):U&&U(le)},[Me,U,Je,Fe]),Ce=v.useCallback(q=>Me.includes(q),[Me]),Y=v.useCallback(q=>G?G(q):B&&B.length>0&&je?.renderExpandContent?je.renderExpandContent({children:B,row:q,expandContext:he,componentContext:J,componentMap:Ka,keyPrefix:`expand-${q[p]}`}):null,[G,B,p,he,J,J?.state]),ae=v.useMemo(()=>!Ve||Ve.length===0?!1:Ve.every(q=>g.includes(q[p])),[Ve,g,p]),xe=v.useMemo(()=>{if(!Ve||Ve.length===0)return!1;const q=Ve.filter(le=>g.includes(le[p])).length;return q>0&&q<Ve.length},[Ve,g,p]),lt=(q,le)=>{const ke=q[p],We=Ce(ke);return h.jsxs(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 mb-4",children:[h.jsxs(I,{className:"flex items-start justify-between",children:[W&&Dr(q)&&h.jsx(oe,{onClick:()=>Oa(ke),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors mr-2","aria-label":We?"Collapse card":"Expand card",children:h.jsx(re,{name:We?K:X,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}),f&&h.jsx(vn,{checked:g.includes(q[p]),onChange:()=>bn(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded mr-3 mt-1"}),h.jsx(I,{className:"flex-1",children:h.jsx(I,{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:le.map(Pe=>h.jsxs(I,{className:"min-w-0",children:[h.jsx(Q,{className:"text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:Pe.header}),h.jsx(I,{className:"text-sm text-gray-900 dark:text-gray-200 mt-0.5 break-words",children:Pe.cellChildren&&Pe.cellChildren.length>0?Ss(Pe.cellChildren,q,q[Pe.field],`card-${q[p]}-${Pe.field}`,J):Pe.render?Pe.render(q[Pe.field],q):qa(q[Pe.field])})]},Pe.field))})}),k&&k.length>0&&h.jsx(I,{className:"ml-2",children:h.jsx(bs,{items:Do(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal})})]}),W&&We&&Dr(q)&&h.jsx(I,{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:Y(q)}),(ce&&ce.length>0||ve)&&Yd(ue,q)&&h.jsx(I,{className:ie?`mt-3 ${ie}`:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-700",children:ve?ve(q):Za(ce,q,`card-subrow-${ke}`,J)})]})};return ze?h.jsxs(I,{id:t,className:`w-full ${a}`,style:l,...He,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:it,className:"relative",children:[h.jsxs(oe,{onClick:()=>ot(!_e),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Le})]}),_e&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:qe.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&To(q.field),children:[h.jsx(vn,{checked:Re.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",st,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ft&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:ft.replace("{count}",String(g.length))}),h.jsx(I,{id:t?`${t}__body`:void 0,children:Ve&&Ve.length>0?Ve.map((q,le)=>h.jsx(I,{children:E?E(q,xt):lt(q,xt)},q[p]||le)):h.jsx(I,{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:Ie})}),fe&&fe.length>0&&Ve&&Ve.length>0&&h.jsx(I,{className:`rounded-lg p-4 mt-2 ${ye}`,children:Se&&Se.length>0?Ss(Se,{},null,"footer-card",J):h.jsx(I,{className:"space-y-1",children:fe.filter(q=>q.text||q.children&&q.children.length>0).map((q,le)=>{const ke=xt.find(We=>We.field===q.field);return h.jsxs(I,{className:"flex justify-between text-sm",children:[h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:ke?.header||""}),h.jsx(Q,{className:q.className||"text-gray-900 dark:text-gray-100",children:q.children&&q.children.length>0?Ss(q.children,{},null,`footer-mobile-${le}`,J):q.text||""})]},`footer-mobile-${le}`)})})}),s&&(N||on>1)&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Lo,{currentPage:sn,totalPages:on,onPageChange:Rt,showFirstLast:H,maxVisiblePages:5,prevText:se,nextText:Ae})})]}):h.jsxs(I,{id:t,className:`w-full ${a}`,style:l,...He,children:[y&&h.jsx(I,{className:"mb-4 flex justify-end",children:h.jsxs(I,{ref:it,className:"relative",children:[h.jsxs(oe,{onClick:()=>ot(!_e),className:"flex items-center gap-2 px-4 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700",children:[h.jsx(re,{name:de.Cog,className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:Le})]}),_e&&h.jsx(I,{className:"absolute right-0 z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",children:h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:qe.map(q=>h.jsxs(I,{className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${q.required?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,onClick:()=>!q.required&&To(q.field),children:[h.jsx(vn,{checked:Re.includes(q.field),disabled:q.required,onChange:()=>{},className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"}),h.jsxs(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:[q.header,q.required&&h.jsxs(Q,{className:"text-xs text-gray-500 dark:text-gray-400 ml-1",children:["(",st,")"]})]})]},q.field))})})]})}),f&&g.length>0&&ft&&h.jsx(I,{className:"mb-4 text-sm text-gray-600 dark:text-gray-400",children:ft.replace("{count}",String(g.length))}),h.jsx(I,{id:t?`${t}__body`:void 0,className:"overflow-x-auto border border-gray-200 dark:border-gray-700 rounded-lg",children:h.jsxs(La,{className:"w-full",children:[h.jsx(Pa,{className:"bg-gray-50 dark:bg-gray-700",children:h.jsxs(Qn,{children:[W&&h.jsx($r,{className:"px-2 py-3",style:{width:z}}),f&&h.jsx($r,{className:"px-4 py-3 w-10",children:h.jsx(vn,{checked:ae,ref:q=>{q&&(q.indeterminate=xe)},onChange:dr,className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),xt.map(q=>h.jsxs($r,{className:`px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider ${r&&q.sortable!==!1?"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600":""}`,style:{width:q.width,minWidth:q.width},onClick:()=>zn(q.field),children:[q.header,te===q.field&&h.jsx(Q,{className:"ml-1",children:pe==="asc"?"↑":"↓"})]},q.field)),k&&k.length>0&&h.jsx($r,{className:"px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider w-24",children:Be})]})}),h.jsx($a,{className:`bg-white dark:bg-gray-800 ${ie?"":"divide-y divide-gray-200 dark:divide-gray-700"}`,children:Ve&&Ve.length>0?Ve.map((q,le)=>{const ke=q[p]||le,We=Ce(ke);return h.jsxs(v.Fragment,{children:[h.jsxs(Qn,{className:`${i?"cursor-pointer":""} hover:bg-gray-50 dark:hover:bg-gray-700 ${g.includes(q[p])?"bg-blue-50 dark:bg-blue-900/20":""} ${ie&&le>0?"border-t border-gray-200 dark:border-gray-700":""}`,onClick:()=>i?.(q),children:[W&&h.jsx(Yt,{className:"px-2 py-4 text-center",onClick:Pe=>Pe.stopPropagation(),children:Dr(q)?h.jsx(oe,{onClick:()=>Oa(ke),className:"p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors","aria-label":We?"Collapse row":"Expand row",children:h.jsx(re,{name:We?K:X,className:"w-4 h-4 text-gray-500 dark:text-gray-400"})}):null}),f&&h.jsx(Yt,{className:"px-4 py-4",onClick:Pe=>Pe.stopPropagation(),children:h.jsx(vn,{checked:g.includes(q[p]),onChange:()=>bn(q[p]),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded"})}),xt.map(Pe=>h.jsx(Yt,{className:"px-6 py-4 align-top whitespace-nowrap text-sm text-gray-900 dark:text-gray-200",style:{width:Pe.width,minWidth:Pe.width},children:Pe.cellChildren&&Pe.cellChildren.length>0?Ss(Pe.cellChildren,q,q[Pe.field],`${q[p]}-${Pe.field}`,J):Pe.render?Pe.render(q[Pe.field],q):qa(q[Pe.field])},Pe.field)),k&&k.length>0&&h.jsx(Yt,{className:"px-6 py-4 text-right",onClick:Pe=>Pe.stopPropagation(),children:h.jsx(bs,{items:Do(q),triggerLabel:"",triggerIconName:de.EllipsisHorizontal,position:"right"})})]}),W&&We&&Dr(q)&&h.jsx(Qn,{className:"bg-gray-50 dark:bg-gray-900",children:h.jsx(Yt,{colSpan:xt.length+1+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-4",children:Y(q)})}),(ce&&ce.length>0||ve)&&Yd(ue,q)&&h.jsx(Qn,{className:ie?"!border-t-0":"",children:h.jsx(Yt,{colSpan:xt.length+(W?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:ie?"p-2":ie||"px-6 py-2 bg-gray-50 dark:bg-gray-900",children:ie?h.jsx(I,{className:ie,children:ve?ve(q):Za(ce,q,`subrow-${ke}`,J)}):ve?ve(q):Za(ce,q,`subrow-${ke}`,J)})})]},ke)}):h.jsx(Qn,{children:h.jsx(Yt,{colSpan:xt.length+(W?1:0)+(f?1:0)+(k&&k.length>0?1:0),className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400",children:Ie})})}),fe&&fe.length>0&&Ve&&Ve.length>0&&h.jsx(Fa,{children:h.jsxs(Qn,{className:ye,children:[W&&h.jsx(Yt,{className:"px-2 py-4"}),f&&h.jsx(Yt,{className:"px-4 py-4"}),(()=>{const q=new Map(fe.filter(le=>le.field).map(le=>[le.field,le]));return xt.map(le=>{const ke=q.get(le.field);return ke?h.jsx(Yt,{className:`px-6 py-4 text-sm text-gray-900 dark:text-gray-200 ${ke.className||""}`,colSpan:ke.colSpan,style:{width:le.width,minWidth:le.width},children:ke.children&&ke.children.length>0?Ss(ke.children,{},null,`footer-${le.field}`,J):ke.text||""},`footer-${le.field}`):h.jsx(Yt,{className:"px-6 py-4",style:{width:le.width,minWidth:le.width}},`footer-${le.field}`)})})(),k&&k.length>0&&h.jsx(Yt,{className:"px-6 py-4"})]})})]})}),s&&(N||on>1)&&h.jsx(I,{className:"flex justify-center mt-4",children:h.jsx(Lo,{currentPage:sn,totalPages:on,onPageChange:Rt,showFirstLast:H,maxVisiblePages:5,prevText:se,nextText:Ae})})]})},Qa=window.G7Core?.createLogger?.("Comp:CardGrid")??{log:(...t)=>console.log("[Comp:CardGrid]",...t),warn:(...t)=>console.warn("[Comp:CardGrid]",...t),error:(...t)=>console.error("[Comp:CardGrid]",...t)},Pb=(t,e)=>window.G7Core?.t?.(t,e)??t,$b=()=>window.G7Core?.getComponentMap?.()||{},Fb=(t,e)=>{if(!t)return!0;const n=t.match(/^\{\{(.+)\}\}$/);if(!n)return!0;const r=n[1].trim();if(Qa.log("evaluateCondition:",{condition:t,expr:r,row:e,rowStatus:e?.status}),/[&|<>=!]/.test(r)||r.includes(".length"))try{const o=!!new Function("row",`return ${r}`)(e);return Qa.log("evaluateCondition result:",o),o}catch(s){return Qa.warn("evaluateCondition: 표현식 평가 실패:",r,s),!1}if(r.startsWith("!row.")){const s=r.slice(5);return!e[s]}if(r.startsWith("row.")){const s=r.slice(4);return!!e[s]}return!0},Xd=(t,e,n,r,s)=>{const o=window.G7Core;if(t.name==="ActionMenu"){if(r&&r.length>0&&s)return{...t,props:{...t.props,items:r.map(i=>({...i,onClick:()=>s(i.id,e)}))}};if(t.actions&&Array.isArray(t.actions)){const i=t.props?.items||[],a=new Map(t.actions.map(c=>[c.id,c])),l=i.map(c=>{if(typeof c.onClick=="string"){const d=c.onClick,u=a.get(d);if(u&&o?.ActionDispatcher)return{...c,onClick:()=>{const f={...n};o.ActionDispatcher.dispatch(u,f)}}}return c});return{...t,props:{...t.props,items:l}}}}return t.children&&Array.isArray(t.children)?{...t,children:t.children.map(i=>Xd(i,e,n,r,s))}:t},Vb=(t,e,n,r="",s,o)=>{const i=window.G7Core;if(i?.renderItemChildren){const a=t.filter(d=>{const u=d.condition||d.if;return u?Fb(u,e):!0}),l={row:e,$value:e,index:n},c=a.map(d=>Xd(d,e,l,s,o));try{const d=$b();return i.renderItemChildren(c,l,d,r)}catch{return h.jsxs(I,{className:"text-red-600 dark:text-red-400 p-4",children:[h.jsx(bt,{children:"컴포넌트 로드 실패"}),h.jsx(bt,{className:"text-sm",children:"[CardGrid] 데이터를 표시할 수 없습니다."})]})}}return null},Ja=(t,e)=>{if(t.name==="Div"&&t.children&&t.children.length>0){const n=t.children.map((r,s)=>Ja(r,`${e}-child-${s}`)).filter(Boolean);return h.jsx(I,{className:t.props?.className||"",children:n},e)}return h.jsx(I,{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-full animate-pulse"},e)},Kd=(t,e="skeleton")=>!t||t.length===0?null:t.map((n,r)=>{const s=`${e}-${n.id||n.name}-${r}`;return n.condition||n.if?null:(n.iteration,Ja(n,s))}).filter(Boolean),zb=({data:t,cardColumns:e=[],gridColumns:n=3,gap:r=4,responsiveColumns:s,cardClassName:o="",idField:i="id",pagination:a=!0,pageSize:l=12,serverSidePagination:c=!1,serverCurrentPage:d,serverTotalPages:u,alwaysShowPagination:f=!1,onPageChange:g,paginationInfoText:m,rowActions:p,onRowAction:y,className:b="",style:S,emptyMessage:x,prevText:E,nextText:k,showSkeleton:C=!0,skeletonCount:N,skeletonCellChildren:_,id:w,editorAttrs:M})=>{const O=x??Pb("common.no_data"),L=e[0]?.cellChildren||[],[$,F]=v.useState(1);window.G7Core?.useResponsive?.();const A=c?d??1:$,T=c?u??1:Math.ceil((t?.length??0)/l),V=G=>{c?g?.(G):F(G)},H=v.useCallback((G,z)=>{y?.(G,z)},[y]),W=v.useMemo(()=>{if(!t)return[];if(!a||c)return t;const G=($-1)*l,z=G+l;return t.slice(G,z)},[t,a,c,$,l]),j=v.useMemo(()=>{const G=[],z=s?.sm??1;G.push(`grid-cols-${z}`),s?.sm&&G.push(`sm:grid-cols-${s.sm}`);const K=s?.md??Math.min(n,2);G.push(`md:grid-cols-${K}`);const X=s?.lg??n;return G.push(`lg:grid-cols-${X}`),s?.xl&&G.push(`xl:grid-cols-${s.xl}`),G.join(" ")},[n,s]),U=v.useMemo(()=>C?_&&_.length>0?Kd(_,"custom-skeleton"):L&&L.length>0?Kd(L,"auto-skeleton"):null:null,[C,_,L]);if(!t){if(!C)return null;const G=N??n;return h.jsx(I,{className:`grid ${j} gap-${r} ${b}`,style:S,id:w,...M,children:Array.from({length:G}).map((z,K)=>h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6 space-y-4",children:U},`skeleton-${K}`))})}if(W.length===0)return h.jsx(I,{className:b,style:S,id:w,...M,children:h.jsx(I,{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-12",children:h.jsx(bt,{className:"text-center text-gray-600 dark:text-gray-400",children:O})})});const B=a&&(f||T>1);return h.jsxs(I,{className:b,style:S,id:w,...M,children:[h.jsx(I,{className:`grid ${j} gap-${r}`,children:W.map((G,z)=>h.jsx(I,{className:o,children:Vb(L,G,z,`card-${z}`,p,H)},G[i]||z))}),B&&h.jsxs(I,{className:"mt-6 space-y-4 flex flex-col items-center",children:[h.jsx(Lo,{currentPage:A,totalPages:T,onPageChange:V,showFirstLast:!1,maxVisiblePages:5,prevText:E,nextText:k}),m&&h.jsx(I,{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:m})]})]})},Hb=(t,e)=>window.G7Core?.t?.(t,e)??t,Ho=({isOpen:t,onClose:e,title:n,titlePrefix:r,titleSuffix:s,closeOnBackdropClick:o=!0,closeOnOverlayClick:i,showCloseButton:a=!0,closeOnEscape:l=!0,children:c,width:d="500px",className:u="",style:f,__dataContext:g,__translationContext:m})=>{const p=i!==void 0?i:o,y=v.useRef(null),b=v.useRef(null);if(v.useEffect(()=>{const E=k=>{k.key==="Escape"&&t&&l&&e()};if(t&&l)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[t,e,l]),v.useEffect(()=>{if(t&&y.current){b.current=document.activeElement;const E=y.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),k=E[0],C=E[E.length-1];k?.focus();const N=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===k&&(_.preventDefault(),C?.focus()):document.activeElement===C&&(_.preventDefault(),k?.focus()))};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N),b.current?.focus()}}},[t]),v.useEffect(()=>{if(t)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[t]),!t)return null;const S=f?.zIndex??50,x=(E,k)=>{if(!E||E.length===0)return null;const C=window.G7Core;if(!C)return null;const N=C.getDynamicRenderer?.();return N?E.map((_,w)=>h.jsx(N,{componentDef:_,dataContext:g||{},translationContext:m,registry:C.getComponentRegistry(),bindingEngine:C.getDataBindingEngine(),translationEngine:C.getTranslationEngine(),actionDispatcher:C.getActionDispatcher(),isRootRenderer:!1},`${k}-${w}`)):null};return h.jsxs(I,{className:"modal-wrapper",style:{zIndex:S},onClick:p?e:void 0,children:[h.jsx(I,{className:"modal-backdrop","aria-hidden":"true"}),h.jsxs(I,{ref:y,className:`modal-container ${u}`,style:{width:d,...f?{...f,zIndex:void 0}:{}},onClick:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":n?"modal-title":void 0,children:[(n||r||s||a)&&h.jsxs(I,{className:"modal-header-row",children:[h.jsxs(I,{className:"flex-center gap-sm",children:[x(r,"title-prefix"),n&&h.jsx(I,{id:"modal-title",className:"modal-title",children:n}),x(s,"title-suffix")]}),a&&h.jsx(oe,{onClick:e,className:"modal-close-btn","aria-label":Hb("common.close_modal"),children:h.jsx("svg",{className:"icon-lg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),h.jsx(I,{className:"modal-body-content",children:c})]})]})},Ub=({label:t,items:e,onItemClick:n,position:r="bottom-left",variant:s="default",className:o="",style:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(-1),g=v.useRef(null),m=v.useRef(null),[p,y]=v.useState(r);v.useEffect(()=>{const x=E=>{g.current&&!g.current.contains(E.target)&&(d(!1),f(-1))};if(c)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),v.useEffect(()=>{const x=E=>{if(!c)return;const k=e.map((C,N)=>C.disabled?-1:N).filter(C=>C!==-1);switch(E.key){case"ArrowDown":E.preventDefault(),f(C=>{const _=(k.indexOf(C)+1)%k.length;return k[_]});break;case"ArrowUp":E.preventDefault(),f(C=>{const N=k.indexOf(C),_=N<=0?k.length-1:N-1;return k[_]});break;case"Enter":E.preventDefault(),u>=0&&!e[u].disabled&&b(e[u]);break;case"Escape":E.preventDefault(),d(!1),f(-1);break}};if(c)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[c,u,e]),v.useEffect(()=>{if(c&&m.current&&g.current){const x=m.current.getBoundingClientRect(),E=g.current.getBoundingClientRect(),k=window.innerWidth,C=window.innerHeight,N=x.width||224,_=x.height||200;let w=r;r.includes("left")?E.left+N>k&&(w=w.replace("left","right")):E.right-N<0&&(w=w.replace("right","left")),r.includes("top")?E.top-_<0&&(w=w.replace("top","bottom")):E.bottom+_>C&&(w=w.replace("bottom","top")),y(w)}},[c,r]);const b=x=>{x.disabled||(x.onClick?.(),n?.(x.value,x),d(!1),f(-1))},S={"bottom-left":"dropdown-menu-bottom-left","bottom-right":"dropdown-menu-bottom-right","top-left":"dropdown-menu-top-left","top-right":"dropdown-menu-top-right"};return h.jsxs(I,{ref:g,className:`dropdown ${o}`,style:i,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:s==="text"?"dropdown-trigger-text":"dropdown-trigger","aria-haspopup":"true","aria-expanded":c,children:[t,s!=="text"&&h.jsx("svg",{className:`inline-block ml-2 w-4 h-4 transition-transform ${c?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),c&&h.jsx(I,{ref:m,className:`dropdown-menu ${S[p]}`,role:"menu","aria-orientation":"vertical",children:h.jsx(I,{className:"py-1",children:e.map((x,E)=>h.jsx(I,{className:`${x.disabled?"dropdown-item-disabled":"dropdown-item"} ${u===E?"dropdown-item-focused":""}`,onClick:()=>b(x),onMouseEnter:()=>!x.disabled&&f(E),role:"menuitem","aria-disabled":x.disabled,tabIndex:x.disabled?-1:0,children:x.label},x.value))})})]})},Bb=({imageUrl:t,imageAlt:e="",title:n,subtitle:r,description:s,price:o,originalPrice:i,discountRate:a,currency:l="₩",buttonText:c="자세히 보기",onButtonClick:d,className:u="",style:f,id:g,editorAttrs:m})=>{const p=a&&a>0,y=(o??0).toLocaleString(),b=i?.toLocaleString();return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md hover:shadow-xl transition-shadow border border-gray-200 dark:border-gray-700 overflow-hidden ${u}`,style:f,id:g,...m,children:[t&&h.jsxs(I,{className:"relative w-full",children:[h.jsx(yn,{src:t,alt:e||n,className:"w-full h-64 object-cover"}),p&&h.jsx(I,{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded-md",children:h.jsxs(Q,{className:"text-sm font-bold",children:["-",a,"%"]})})]}),h.jsxs(I,{className:"p-4",children:[r&&h.jsx(Ir,{className:"text-xs font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2",children:r}),h.jsx(Zn,{className:"text-xl font-bold text-gray-900 dark:text-white mb-2 line-clamp-2",children:n}),s&&h.jsx(bt,{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 line-clamp-3",children:s}),h.jsxs(I,{className:"flex items-center gap-2 mb-4",children:[h.jsxs(Q,{className:"text-2xl font-bold text-gray-900 dark:text-white",children:[l,y]}),i&&h.jsxs(Q,{className:"text-sm text-gray-400 dark:text-gray-500 line-through",children:[l,b]})]}),c&&h.jsx(oe,{onClick:d,className:"w-full bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition-colors",children:c})]})]})},jb=({value:t,label:e,change:n,changeLabel:r="전월 대비",iconName:s,trend:o="neutral",className:i="",style:a,id:l,editorAttrs:c})=>{const d=o==="up",u=o==="down",f=n!==void 0?Math.abs(n):0,g=d?"stats-trend-up":u?"stats-trend-down":"stats-trend-neutral",m=d?de.ArrowUp:u?de.ArrowDown:void 0;return h.jsxs(I,{className:`stat-card ${i}`,style:a,id:l,...c,children:[h.jsxs(I,{className:"flex-between mb-md",children:[s&&h.jsx(I,{className:"stats-icon stats-icon-blue",children:h.jsx(re,{name:s,className:"icon-lg"})}),n!==void 0&&h.jsxs(I,{className:`stats-change ${g}`,children:[m&&h.jsx(re,{name:m,className:"icon-sm"}),h.jsxs(Q,{className:"text-sm font-semibold",children:[f,"%"]})]})]}),h.jsx(Ir,{className:"stats-value-lg",children:typeof t=="number"?t.toLocaleString():t}),h.jsx(bt,{className:"stats-label",children:e}),n!==void 0&&r&&h.jsx(I,{className:"stats-sublabel",children:h.jsx(Q,{children:r})})]})},qd=()=>window.G7Core,Zd=(t,e)=>qd()?.t?.(t,e)??t,Wb=({name:t="search",placeholder:e,value:n,onChange:r,onSubmit:s,showButton:o=!1,suggestions:i=[],onSuggestionClick:a,showSuggestions:l=!1,className:c="",style:d,id:u,editorAttrs:f})=>{const g=e??Zd("common.search_placeholder"),[m,p]=v.useState(""),[y,b]=v.useState(!1),S=v.useRef(null),x=v.useRef(""),E=n!==void 0?n:m,k=l&&y&&i.length>0&&E.length>0,C="w-64 pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm",N=qd()?.style?.mergeClasses?.(C,c)??`${C} ${c}`;v.useEffect(()=>{n!==void 0&&(x.current=n)},[n]);const _=O=>{const L=O.target.value;p(L),r?.(O),x.current!==""&&L===""&&!O.nativeEvent.inputType&&setTimeout(()=>{const $=S.current?.querySelector("form");$&&$.requestSubmit()},0),x.current=L},w=O=>{p(O.text);const L={target:{value:O.text,name:t}};r?.(L),a?.(O),b(!1)},M=O=>{O.preventDefault(),s?.(O)};return h.jsxs(I,{ref:S,className:"relative",style:d,id:u,...f,children:[h.jsx(Ia,{onSubmit:M,className:"relative",children:h.jsxs(I,{className:`relative flex items-center ${o?"gap-2":""}`,children:[h.jsxs(I,{className:"relative flex-1",children:[h.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",children:h.jsx(re,{name:de.Search,className:"w-5 h-5 text-gray-400 dark:text-gray-500"})}),h.jsx(wt,{type:"search",name:t,value:E,onChange:_,onFocus:()=>b(!0),onBlur:()=>setTimeout(()=>b(!1),200),placeholder:g,className:N})]}),o&&h.jsx(oe,{type:"submit",className:"px-4 py-2 bg-gray-800 dark:bg-gray-600 text-white rounded-lg hover:bg-gray-900 dark:hover:bg-gray-500 transition-colors text-sm font-medium cursor-pointer h-[42px]",children:Zd("common.search")})]})}),k&&h.jsx(I,{className:"absolute z-10 w-full mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-64 overflow-y-auto",children:i.map(O=>h.jsx(I,{className:"px-4 py-3 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 transition-colors",onClick:()=>w(O),children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Search,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:O.text})]})},O.id))})]})},Ra=(t,e)=>window.G7Core?.t?.(t,e)??t,Gb=({title:t,filters:e,onChange:n,onReset:r,showResetButton:s=!0,className:o="",style:i,id:a,editorAttrs:l})=>{const c=t??Ra("common.filter"),d=(f,g)=>{n?.(f,g)},u=(f,g,m)=>{const p=e.find(b=>b.id===f);if(!p)return;const y=Array.isArray(p.value)?p.value:[];if(typeof g=="string"){const b=y.filter(x=>typeof x=="string"),S=m?[...b,g]:b.filter(x=>x!==g);n?.(f,S)}else{const b=y.filter(x=>typeof x=="number"),S=m?[...b,g]:b.filter(x=>x!==g);n?.(f,S)}};return h.jsxs(I,{className:`rounded-lg bg-white dark:bg-gray-800 shadow-md border border-gray-200 dark:border-gray-700 p-4 ${o}`,style:i,id:a,...l,children:[h.jsxs(I,{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(Q,{className:"text-lg font-semibold text-gray-900 dark:text-white",children:c}),s&&r&&h.jsx(oe,{onClick:r,className:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:Ra("common.reset")})]}),h.jsx(I,{className:"space-y-4",children:e.map(f=>h.jsxs(I,{className:"space-y-2",children:[h.jsx(en,{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:f.label}),f.type==="select"&&h.jsxs(Pr,{value:f.value,onChange:g=>d(f.id,g.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[h.jsx("option",{value:"",children:Ra("common.select_placeholder")}),f.options.map(g=>h.jsx("option",{value:g.value,children:g.label},g.id))]}),f.type==="checkbox"&&h.jsx(I,{className:"space-y-2",children:f.options.map(g=>{const m=Array.isArray(f.value)?f.value.some(p=>p===g.value):!1;return h.jsxs(en,{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 p-2 rounded-md transition-colors",children:[h.jsx(vn,{checked:m,onChange:p=>u(f.id,g.value,p.target.checked),className:"w-4 h-4 text-blue-600 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:g.label})]},g.id)})})]},f.id))})]})},Yb=({tabs:t,activeTabId:e,onTabChange:n,variant:r="default",className:s="",style:o,mobileBreakpoint:i=768,id:a,editorAttrs:l})=>{const d=window.G7Core?.useResponsive,u=d?.(),f=u?u.width<i:typeof window<"u"&&window.innerWidth<i,g=S=>{!S.disabled&&S.id!==e&&n?.(S.id)},m=S=>{const x=S.target.value,E=Number(x),k=typeof x=="string"&&x!==""&&!Number.isNaN(E)?E:x,C=t.find(N=>String(N.id)===String(k));C&&g(C)};if(f)return h.jsx(I,{className:s,style:o,id:a,...l,children:h.jsx(Pr,{value:e!==void 0?String(e):"",onChange:m,options:t.map(S=>({value:String(S.id),label:S.badge!==void 0?`${S.label} (${S.badge})`:S.label,disabled:S.disabled})),className:"w-full"})});const p=S=>{const x=S.id===e;if(S.disabled)return"tab-btn-base tab-btn-disabled";switch(r){case"pills":return x?"tab-btn-base tab-btn-pills-active":"tab-btn-base tab-btn-pills";case"underline":return x?"tab-btn-base tab-btn-underline-active":"tab-btn-base tab-btn-underline";case"default":default:return x?"tab-btn-base tab-btn-default-active":"tab-btn-base tab-btn-default"}},y=r==="underline"?"tab-nav-underline":"tab-nav-default",b=l?.["data-editor-path"];return h.jsx(Io,{className:`${y} ${s}`,style:o,id:a,...l,children:t.map((S,x)=>h.jsxs(oe,{type:"button",onClick:()=>g(S),disabled:S.disabled,className:p(S),...b?{"data-editor-item-path":`${b}.props.tabs.${x}`}:{},children:[S.iconName&&h.jsx(re,{name:S.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:S.label}),S.badge!==void 0&&h.jsx(I,{className:"flex items-center justify-center min-w-[20px] h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full",children:h.jsx(Q,{children:S.badge})})]},S.id))})},el=window.G7Core?.createLogger?.("Handler:ScrollToSection")??{log:(...t)=>console.log("[Handler:ScrollToSection]",...t),warn:(...t)=>console.warn("[Handler:ScrollToSection]",...t),error:(...t)=>console.error("[Handler:ScrollToSection]",...t)};async function Qd(t,e){const n=t.params||{},{targetId:r,offset:s=120,delay:o=100,scrollContainerId:i}=n;if(!r){el.warn("targetId is required");return}const a=await Xb(r,o);if(!a){el.warn(`Element not found: ${r}`);return}const l=Kb(a,i),c=qb(a,l,s);Zb(l,c)}async function Xb(t,e){await new Promise(s=>setTimeout(s,e));const n=10,r=50;for(let s=0;s<n;s++){const o=document.getElementById(t);if(o)return await new Promise(i=>setTimeout(i,50)),o;await new Promise(i=>setTimeout(i,r))}return null}function Kb(t,e){if(e){const o=document.getElementById(e);if(o&&Jd(o))return o;el.warn(`Container '${e}' ${o?"has no scroll":"not found"}, trying auto-detect`)}let n=t.parentElement,r=0;const s=10;for(;n&&n!==document.body&&r<s;){if(Jd(n))return n;n=n.parentElement,r++}return window}function Jd(t){const e=window.getComputedStyle(t);return(e.overflowY==="auto"||e.overflowY==="scroll")&&t.scrollHeight>t.clientHeight}function qb(t,e,n){if(e===window||!("getBoundingClientRect"in e))return t.getBoundingClientRect().top+window.pageYOffset-n;{const r=e.getBoundingClientRect(),s=t.getBoundingClientRect();return e.scrollTop+(s.top-r.top)-n}}function Zb(t,e){t===window||!("scrollTo"in t)?window.scrollTo({top:e,behavior:"smooth"}):t.scrollTo({top:e,behavior:"smooth"})}window.G7Core?.createLogger?.("Comp:TabNavigation");const Qb=({tabs:t,activeTabId:e,className:n="bg-white dark:bg-gray-800 flex gap-2 border-b border-gray-200 dark:border-gray-700 px-6",style:r,activeClassName:s="tab-btn-base tab-btn-default-active",inactiveClassName:o="tab-btn-base tab-btn-default",sectionIdPrefix:i="tab_content_",scrollOffset:a=120,scrollDelay:l=100,onTabChange:c,enableScrollSpy:d=!1,scrollSpyOffset:u=80,scrollContainerId:f,id:g,editorAttrs:m})=>{const[p,y]=v.useState(e??(t.length>0?t[0].id:"")),S=window.G7Core?.useResponsive,x=S?.(),E=x?x.width<768:typeof window<"u"&&window.innerWidth<768,k=v.useRef(!1),C=v.useRef(null),N=w=>{if(d&&(k.current=!0,C.current&&clearTimeout(C.current)),w.onClick){if(w.onClick(w.id),!d)return}else if(c){if(c(w.id),!d)return}else y(w.id);const M=w.scrollOffset??a,O=w.scrollDelay??l;Qd({params:{targetId:`${i}${w.id}`,offset:M,delay:O,scrollContainerId:f}}),d&&(C.current=setTimeout(()=>{k.current=!1},O+500))};v.useEffect(()=>{if(!d)return;const w=f?document.getElementById(f):null,M={root:w??null,rootMargin:`-${u}px 0px -30% 0px`,threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},O=new Map,L=()=>{const A=w,T=A?A.scrollTop:window.pageYOffset||document.documentElement.scrollTop,V=A?A.scrollHeight:document.documentElement.scrollHeight,H=A?A.clientHeight:document.documentElement.clientHeight;return T+H>=V-10},$=A=>{if(k.current)return;A.forEach(U=>{const B=U.target.id;U.isIntersecting?O.set(B,U.intersectionRatio):O.delete(B)});let T=0,V="";O.forEach((U,B)=>{U>T&&(T=U,V=B)});const H=t[t.length-1],W=`${i}${H?.id}`,j=O.has(W);if(L()&&j&&H){y(H.id);return}if(V){const U=V.replace(i,""),B=Number(U),G=isNaN(B)?U:B;t.some(K=>K.id===G)&&y(G)}},F=()=>{},D=new IntersectionObserver($,M);return t.forEach(A=>{const T=document.getElementById(`${i}${A.id}`);T&&D.observe(T)}),window.addEventListener("scroll",F,{passive:!0}),()=>{D.disconnect(),window.removeEventListener("scroll",F),C.current&&clearTimeout(C.current)}},[d,t,i,u,f]);const _=w=>{const M=w.target.value,O=Number(M),L=isNaN(O)?M:O,$=t.find(F=>F.id===L);$&&N($)};return E?h.jsx(I,{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3",id:g,...m,children:h.jsx(Pr,{value:String(p),onChange:_,options:t.map(w=>({value:String(w.id),label:w.label,disabled:w.disabled})),className:"w-full"})}):h.jsx(I,{className:n,style:r,id:g,...m,children:t.map(w=>h.jsxs(oe,{className:p===w.id?s:o,disabled:w.disabled,onClick:()=>N(w),children:[w.iconName&&h.jsx(re,{name:w.iconName,size:"sm"}),h.jsx(Q,{children:w.label})]},w.id))})},Jb=()=>window.G7Core,Rb=({iconName:t,label:e,onClick:n,variant:r="primary",size:s="md",disabled:o=!1,className:i="",style:a,id:l,editorAttrs:c})=>{const d={sm:e?"px-3 py-1.5 text-sm":"w-8 h-8",md:e?"px-4 py-2 text-base":"w-10 h-10",lg:e?"px-5 py-2.5 text-lg":"w-12 h-12"},u={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},f={primary:"bg-blue-600 hover:bg-blue-700 text-white border-transparent",secondary:"bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600",danger:"bg-red-600 hover:bg-red-700 text-white border-transparent",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-transparent",outline:"bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600"},g="inline-flex items-center justify-center gap-2 font-medium rounded-lg border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 dark:focus:ring-blue-400",m=o?"opacity-50 cursor-not-allowed":"",p=`${g} ${d[s]} ${f[r]} ${m}`,y=Jb()?.style?.mergeClasses?.(p,i)??`${p} ${i}`;return h.jsxs(oe,{onClick:n,disabled:o,className:y,style:a,id:l,...c,children:[h.jsx(re,{name:t,className:u[s]}),e]})},ey=(t,e)=>window.G7Core?.t?.(t,e)??t,Rd=({isOpen:t,onClose:e,title:n,content:r,actions:s=[],width:o="500px",closeOnOverlay:i=!0,showCloseButton:a=!0,className:l="",style:c})=>{const d=()=>{i&&e()},u={primary:"dialog-btn-primary",secondary:"dialog-btn-secondary",danger:"dialog-btn-danger",ghost:"dialog-btn-ghost"};return h.jsxs(Ho,{isOpen:t,onClose:d,width:o,className:l,style:c,children:[h.jsxs(I,{className:"dialog-header",children:[h.jsx(Zn,{className:"dialog-title",children:n}),a&&h.jsx(oe,{onClick:e,className:"dialog-close","aria-label":ey("common.close_dialog"),children:h.jsx(re,{name:de.Times,className:"icon-md"})})]}),h.jsx(I,{className:"dialog-body",children:r}),s.length>0&&h.jsx(I,{className:"dialog-footer",children:s.map((f,g)=>h.jsxs(oe,{onClick:f.onClick,disabled:f.disabled,className:u[f.variant||"primary"],children:[f.iconName&&h.jsx(re,{name:f.iconName,className:"icon-sm mr-2 inline-block"}),f.label]},g))})]})},tl=(t,e)=>window.G7Core?.t?.(t,e)??t,eu=({isOpen:t,onClose:e,title:n,message:r,confirmText:s,cancelText:o,onConfirm:i,onCancel:a,confirmButtonVariant:l="primary",cancelButtonVariant:c="secondary",width:d="500px",closeOnOverlay:u=!0,isLoading:f=!1,loadingText:g})=>{const m=s??tl("common.confirm"),p=o??tl("common.cancel"),y=g??tl("common.loading"),b=()=>{i()},S=()=>{f||(a?.(),e())},x=()=>{f||e()},E={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return h.jsxs(Ho,{isOpen:t,onClose:x,title:n,width:d,children:[h.jsx(I,{className:"py-2",children:typeof r=="string"?h.jsx(bt,{className:"text-gray-700 dark:text-gray-300",children:r}):r}),h.jsxs(I,{className:"flex justify-end gap-3 mt-6",children:[h.jsx(oe,{onClick:S,disabled:f,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:h.jsx(Q,{children:p})}),h.jsxs(oe,{onClick:b,disabled:f,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${E[l]}`,children:[f&&h.jsx(re,{name:de.Spinner,className:"w-4 h-4 animate-spin"}),h.jsx(Q,{children:f?y:m})]})]})]})},ty=(t,e)=>window.G7Core?.t?.(t,e)??t,ny=({isOpen:t,onClose:e,title:n,message:r,confirmText:s,onConfirm:o,confirmButtonVariant:i="primary",width:a="500px",closeOnOverlay:l=!0})=>{const u=[{label:s??ty("common.confirm"),onClick:()=>{o?.(),e()},variant:i}],f=typeof r=="string"?h.jsx(bt,{className:"text-gray-700 dark:text-gray-300",children:r}):r;return h.jsx(Rd,{isOpen:t,onClose:e,title:n,content:f,actions:u,width:a,closeOnOverlay:l})},ry=(t,e)=>window.G7Core?.t?.(t,e)??t,sy={success:de.CheckCircle,error:de.XCircle,warning:de.ExclamationTriangle,info:de.InfoCircle},tu={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"}},oy={"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"},iy=({toasts:t,position:e="bottom-center",duration:n=3e3,onRemove:r})=>{const[s,o]=v.useState(new Map),i=v.useCallback(a=>{o(l=>{const c=new Map(l);return c.set(a,!1),c}),setTimeout(()=>{if(r)r(a);else{const l=window.G7Core;l?.state?.update&&l.state.update(c=>({toasts:(Array.isArray(c.toasts)?c.toasts:[]).filter(u=>u.id!==a)}))}},300)},[r]);return v.useEffect(()=>{!t||t.length===0||t.forEach(a=>{if(s.has(a.id))return;o(c=>{const d=new Map(c);return d.set(a.id,!0),d});const l=a.duration||n;l>0&&setTimeout(()=>{i(a.id)},l)})},[t,n,i,s]),!t||t.length===0?null:h.jsx(I,{className:`fixed z-[9999] flex flex-col gap-2 ${oy[e]}`,"aria-live":"polite","aria-atomic":"true",children:t.map(a=>h.jsx(ay,{toast:a,position:e,isVisible:s.get(a.id)??!0,onClose:()=>i(a.id)},a.id))})},ay=({toast:t,position:e,isVisible:n,onClose:r})=>{const s=tu[t.type]||tu.info,o=t.icon?t.icon:sy[t.type],i=e.startsWith("bottom")?"translate-y-2":"-translate-y-2";return h.jsxs(I,{className:`
|
||
flex items-center gap-3 p-4 rounded-lg border shadow-lg
|
||
min-w-[300px] max-w-md
|
||
transition-all duration-300
|
||
${s.bg}
|
||
${n?"opacity-100 translate-y-0":`opacity-0 ${i}`}
|
||
`,role:"alert",children:[h.jsx(re,{name:o,className:`w-5 h-5 flex-shrink-0 ${s.text}`}),h.jsx(Q,{className:`flex-1 text-sm font-medium ${s.text}`,children:t.message}),h.jsx(oe,{onClick:r,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${s.text} focus:outline-none`,"aria-label":ry("common.close_notification"),children:h.jsx(re,{name:de.Times,className:"w-4 h-4"})})]})},nu=({items:t,separator:e=h.jsx(re,{name:de.ChevronRight,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),showHome:n=!1,homeHref:r="/",maxItems:s,className:o="",id:i,editorAttrs:a})=>{let c=n?[{label:"Home",href:r},...t]:t,d=c,u=!1;if(s&&c.length>s){u=!0;const f=c.slice(0,1),g=c.slice(-(s-2));d=[...f,...g]}return h.jsx(Io,{className:`flex items-center space-x-2 text-sm ${o}`,"aria-label":"Breadcrumb",id:i,...a,children:h.jsx(I,{className:"flex items-center space-x-2",children:d.map((f,g)=>{const m=g===d.length-1,p=g===0;return h.jsxs(v.Fragment,{children:[u&&p&&h.jsxs(h.Fragment,{children:[h.jsx(ru,{item:f,isLast:!1}),h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e}),h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"..."}),d.length>1&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e})]}),(!u||!p)&&h.jsxs(h.Fragment,{children:[h.jsx(ru,{item:f,isLast:m}),!m&&h.jsx(Q,{className:"text-gray-400 dark:text-gray-500","aria-hidden":"true",children:e})]})]},g)})})})},ru=({item:t,isLast:e})=>e||!t.href&&!t.onClick?h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white","aria-current":e?"page":void 0,children:t.label}):t.onClick?h.jsx(Lr,{href:"#",onClick:n=>{n.preventDefault(),t.onClick?.()},className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:t.label}):h.jsx(Lr,{href:t.href,className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 transition-colors",children:t.label}),ly=({title:t,description:e,iconName:n,illustrationSrc:r,illustrationAlt:s="Empty state illustration",actions:o=[],className:i="",id:a,editorAttrs:l})=>{const c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-gray-500"};return h.jsxs(I,{className:`flex flex-col items-center justify-center p-8 text-center ${i}`,role:"status","aria-live":"polite",id:a,...l,children:[r?h.jsx(yn,{src:r,alt:s,className:"w-48 h-48 mb-6 object-contain"}):n?h.jsx(I,{className:"mb-6 p-4 rounded-full bg-gray-100 dark:bg-gray-700",children:h.jsx(re,{name:n,className:"w-12 h-12 text-gray-400 dark:text-gray-500"})}):null,h.jsx(Zn,{className:"text-xl font-semibold text-gray-900 dark:text-white mb-2",children:t}),e&&h.jsx(bt,{className:"text-gray-600 dark:text-gray-400 mb-6 max-w-md",children:e}),o.length>0&&h.jsx(I,{className:"flex flex-wrap gap-3 justify-center",children:o.map((d,u)=>h.jsxs(oe,{onClick:d.onClick,className:`
|
||
px-4 py-2 rounded-md font-medium transition-colors
|
||
focus:outline-none focus:ring-2 focus:ring-offset-2
|
||
${c[d.variant||"primary"]}
|
||
`,children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4 mr-2 inline-block"}),d.label]},u))})]})},cy=(t,e)=>window.G7Core?.t?.(t,e)??t,dy=({id:t,size:e="md",color:n="text-blue-600",fullscreen:r=!1,text:s,className:o="",editorAttrs:i})=>{const a={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-2",lg:"w-12 h-12 border-3",xl:"w-16 h-16 border-4"},l={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg"},c=h.jsxs(I,{className:`flex flex-col items-center justify-center gap-3 ${o}`,children:[h.jsx(I,{className:`
|
||
${a[e]}
|
||
border-gray-200 dark:border-gray-700 border-t-current
|
||
rounded-full animate-spin
|
||
${n}
|
||
`,role:"status","aria-label":cy("common.loading")}),s&&h.jsx(Q,{className:`${l[e]} ${n} font-medium`,children:s})]});return r?h.jsx(I,{id:t,className:"fixed inset-0 z-50 flex items-center justify-center bg-white dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90","aria-live":"polite","aria-busy":"true",...i,children:c}):h.jsx(I,{id:t,className:"flex items-center justify-center p-4","aria-live":"polite","aria-busy":"true",...i,children:c})},Vr=()=>window.G7Core,nl=(t,e)=>window.G7Core?.t?.(t,e)??t,uy=({logo:t,logoAlt:e="Logo",menu:n=[],collapsed:r=!1,onToggleCollapse:s,className:o="",currentLocale:i,id:a,editorAttrs:l})=>{const[c,d]=v.useState(new Set),[u,f]=v.useState(i||Vr()?.locale?.current?.()||"ko"),[g,m]=v.useState(window.location.pathname),p=v.useMemo(()=>{const w=[],M=O=>{for(const L of O)L.url&&w.push(L.url),L.children&&M(L.children)};return M(n),w},[n]),y=v.useCallback(w=>{let M=null;for(const O of p)(w===O||w.startsWith(O+"/"))&&(!M||O.length>M.length)&&(M=O);return M},[p]);v.useEffect(()=>{const w=Vr();return w?.state?.subscribe?w.state.subscribe(O=>{const L=O?._global?.locale||w?.locale?.current?.()||"ko";f(L);const $=O?._global?.currentPath||window.location.pathname;m($)}):void 0},[]),v.useEffect(()=>{const w=()=>{m(window.location.pathname)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]),v.useEffect(()=>{i&&f(i)},[i]);const b=(w,M)=>!w||typeof M!="string"?!1:M===w?!0:M.startsWith(w+"/")?y(M)===w:!1,S=(w,M)=>{const O=new Set,L=$=>{for(const F of $)if(F.children&&F.children.length>0){if(L(F.children)||b(F.url,M))return O.add(F.id),!0}else if(b(F.url,M))return!0;return!1};return L(w),O};v.useEffect(()=>{if(n.length>0&&g){const w=S(n,g);w.size>0&&d(M=>new Set([...M,...w]))}},[g,n]);const x=w=>b(w,g),E=w=>w.children?w.children.some(M=>x(M.url)||E(M)):!1,k=w=>{d(M=>{const O=new Set(M);return O.has(w)?O.delete(w):O.add(w),O})},C=w=>typeof w=="string"?w:w[u]||w.en||Object.values(w)[0]||"",N=(w,M)=>{Vr()?.dispatch?(w.preventDefault(),Vr().navigation?.onComplete(()=>{Vr().dispatch({handler:"setState",params:{target:"global",sidebarOpen:!1}})}),Vr().dispatch({handler:"navigate",params:{path:M}})):window.location.href=M},_=(w,M=0,O=!1)=>{const L=w.children&&w.children.length>0,$=c.has(w.id),F=C(w.name),D=M>0,A=x(w.url),T=E(w),V=D?"admin-sidebar-subitem":"admin-sidebar-item",H="admin-sidebar-item-active",W="admin-sidebar-item-active-parent",j="admin-sidebar-item-default";return h.jsxs(I,{className:D?"relative group":"",children:[D&&h.jsxs(h.Fragment,{children:[!O&&h.jsx(I,{className:"admin-sidebar-tree-line-vertical"}),h.jsx(I,{className:"admin-sidebar-tree-line-curve"})]}),L&&w.url?h.jsxs(I,{className:`
|
||
${V}
|
||
${A?H:T?W:j}
|
||
${r?"justify-center":""}
|
||
`,children:[h.jsxs(oe,{onClick:B=>N(B,w.url),className:"flex items-center justify-start flex-1 min-w-0",children:[w.icon&&h.jsx(pt,{className:`${w.icon} ${r?"":"mr-3"} w-5 h-5 flex items-center justify-center`}),!r&&h.jsx(Q,{className:"truncate",children:F})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(oe,{onClick:()=>k(w.id),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600","aria-label":nl($?"common.collapse":"common.expand"),children:h.jsx(pt,{className:`fas fa-chevron-down w-4 h-4 transition-transform ${$?"rotate-180":""}`})})]})]}):L?h.jsxs(oe,{onClick:()=>k(w.id),className:`
|
||
${V}
|
||
${T?W:j}
|
||
${r?"justify-center":""}
|
||
`,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(Q,{children:F})]}),!r&&h.jsxs(I,{className:"admin-sidebar-chevron-trail",children:[w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"}),h.jsx(pt,{className:`fas fa-chevron-right w-4 h-4 text-slate-400 transition-transform duration-200 ${$?"rotate-90":""}`})]})]}):w.url?h.jsxs(oe,{onClick:B=>N(B,w.url),className:`
|
||
${V}
|
||
${A?H:j}
|
||
${r?"justify-center":""}
|
||
text-left
|
||
`,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(Q,{children:F})]}),!r&&w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}):h.jsxs(oe,{className:`
|
||
${V}
|
||
admin-sidebar-item-disabled
|
||
${r?"justify-center":""}
|
||
text-left
|
||
`,children:[h.jsxs(I,{className:"admin-sidebar-item-content",children:[w.icon&&h.jsx(I,{className:"admin-sidebar-icon-box",children:h.jsx(pt,{className:w.icon})}),!r&&h.jsx(Q,{children:F})]}),!r&&w.module_id&&h.jsx(pt,{className:"fas fa-cube admin-sidebar-module-icon",title:"모듈 메뉴"})]}),L&&!r&&$&&h.jsx(I,{className:"relative ml-2",children:w.children.map((B,G)=>_(B,M+1,G===w.children.length-1))})]},w.id)};return h.jsxs(I,{className:o,id:a,...l,children:[(t||s)&&h.jsxs(I,{className:"admin-sidebar-header",children:[t&&!r&&h.jsx(yn,{src:t,alt:e,className:"h-8"}),s&&h.jsx(oe,{onClick:s,className:"admin-sidebar-collapse-btn","aria-label":nl(r?"common.expand_sidebar":"common.collapse_sidebar"),children:h.jsx(pt,{className:`${r?"fas fa-chevron-right":"fas fa-chevron-left"} w-5 h-5 text-slate-600 dark:text-slate-400`})})]}),h.jsx(I,{className:"admin-sidebar-menu-list",children:n.map((w,M)=>_(w,0,M===n.length-1))})]})},_s=(t,e)=>window.G7Core?.t?.(t,e)??t,fy=({user:t={name:"",email:""},notifications:e=[],onNotificationClick:n,onProfileClick:r,onLogoutClick:s,className:o=""})=>{const[i,a]=v.useState(!1),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),f=e.filter(g=>!g.read).length;return v.useEffect(()=>{const g=m=>{d.current&&!d.current.contains(m.target)&&a(!1),u.current&&!u.current.contains(m.target)&&c(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),h.jsxs(I,{className:`
|
||
bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4 flex items-center justify-end gap-4
|
||
${o}
|
||
`,children:[h.jsxs(I,{ref:d,className:"relative",children:[h.jsxs(oe,{onClick:()=>a(!i),className:"relative p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors","aria-label":_s("common.notifications"),children:[h.jsx(re,{name:de.Bell,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),f>0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 rounded-full",children:f>9?"9+":f})]}),i&&h.jsxs(I,{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsx(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:_s("common.notifications")})}),h.jsx(I,{className:"max-h-96 overflow-y-auto",children:e.length===0?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:_s("common.no_notifications")})}):e.map(g=>h.jsx(oe,{onClick:()=>{g.onClick?.(),n?.(g.id),a(!1)},className:`
|
||
w-full px-4 py-3 text-left hover:bg-gray-50 dark:hover:bg-gray-700 border-b border-gray-100 dark:border-gray-700 transition-colors
|
||
${g.read?"":"bg-blue-50 dark:bg-blue-900/20"}
|
||
`,children:h.jsxs(I,{className:"flex items-start gap-3",children:[g.iconName&&h.jsx(re,{name:g.iconName,className:"w-5 h-5 text-gray-600 dark:text-gray-400 mt-0.5"}),h.jsxs(I,{className:"flex-1",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:g.title}),h.jsx(I,{className:"text-gray-600 dark:text-gray-400 text-sm mt-1",children:g.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1",children:g.time})]}),!g.read&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 rounded-full mt-1.5"})]})},g.id))})]})]}),h.jsxs(I,{ref:u,className:"relative",children:[h.jsxs(oe,{onClick:()=>c(!l),className:"flex items-center gap-3 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[t.avatar?h.jsx(yn,{src:t.avatar,alt:t.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"hidden md:block text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:t.name}),t.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:t.role})]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]}),l&&h.jsxs(I,{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:t.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:t.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{r?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors text-gray-900 dark:text-white",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{children:_s("common.profile_settings")})]}),h.jsxs(oe,{onClick:()=>{s?.(),c(!1)},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 text-red-600 dark:text-red-400 transition-colors",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:_s("common.logout")})]})]})]})]})]})},hy=({notifications:t=[],unreadCount:e=0,hasMore:n=!1,loading:r=!1,titleText:s="Notifications",emptyText:o="No notifications",markAllReadText:i="Mark all as read",deleteAllText:a="Delete all",unreadOnlyText:l="Unread only",unreadOnly:c=!1,onNotificationClick:d,onClose:u,onLoadMore:f,onMarkAllRead:g,onDeleteAll:m,onDelete:p,onUnreadOnlyToggle:y,dropdownAlign:b="right",className:S="",id:x,editorAttrs:E})=>{const[k,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),w=v.useRef(null),M=v.useRef(null),O=v.useRef(new Set),L=v.useRef(f),$=v.useRef(n),F=v.useRef(r),D=v.useRef(t.length),A=v.useRef(-1);v.useEffect(()=>{L.current=f,$.current=n,F.current=r,D.current=t.length}),v.useEffect(()=>{if(!M.current||!w.current||!k)return;A.current=-1;const W=new IntersectionObserver(([j])=>{j.isIntersecting&&(F.current||!$.current||A.current!==D.current&&(A.current=D.current,L.current?.()))},{root:w.current,threshold:.1});return W.observe(M.current),()=>W.disconnect()},[k]),v.useEffect(()=>{if(!w.current||!k)return;const W=new IntersectionObserver(U=>{U.forEach(B=>{const G=B.target.getAttribute("data-notification-id"),z=B.target.getAttribute("data-unread")==="true";G&&z&&B.isIntersecting&&O.current.add(G)})},{root:w.current,threshold:.5});return w.current.querySelectorAll("[data-notification-id]").forEach(U=>W.observe(U)),()=>W.disconnect()},[k,t]);const T=e>0?e:t.filter(W=>!W.read).length,V=v.useCallback(()=>{if(k){if(T>0){const W=Array.from(O.current).filter(j=>{const U=t.find(B=>String(B.id)===String(j));return U&&!U.read});W.length>0&&u?.(W)}O.current.clear(),C(!1)}},[k,u,T,t]);v.useEffect(()=>{if(!k)return;const W=j=>{N.current&&!N.current.contains(j.target)&&V()};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[k,V]);const H=v.useCallback(()=>{k?V():C(!0)},[k,V]);return v.useLayoutEffect(()=>{const W=_.current;if(!k||!W)return;W.style.transform="";const j=W.getBoundingClientRect(),U=typeof window<"u"?window.innerWidth:0;if(j.width===0&&j.height===0)return;const B=8;let G=0;j.right>U-B?G=-(j.right-(U-B)):j.left<B&&(G=B-j.left),G!==0&&(W.style.transform=`translateX(${G}px)`)},[k,b,t.length]),h.jsxs(I,{ref:N,className:`relative ${S}`,id:x,...E,children:[h.jsxs(oe,{onClick:H,className:"relative w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors cursor-pointer","aria-label":s,children:[h.jsx(re,{name:de.Bell,className:"text-sm text-slate-500 dark:text-slate-400"}),T>0&&h.jsx(Q,{className:"absolute top-0 right-0 flex items-center justify-center w-5 h-5 text-xs font-bold text-white bg-red-500 dark:bg-red-600 rounded-full",children:T>99?"99+":T})]}),k&&h.jsxs(I,{ref:_,className:`absolute ${b==="left"?"left-0":"right-0"} mt-2 w-80 max-w-[calc(100vw-1rem)] bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[h.jsxs(I,{className:"flex items-center gap-3 min-w-0",children:[h.jsx(Q,{className:"font-semibold text-gray-900 dark:text-white",children:s}),y&&h.jsxs(I,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>y(!c),children:[h.jsx(wt,{type:"checkbox",checked:c,onChange:W=>{W.stopPropagation(),y(W.target.checked)},onClick:W=>W.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-400 focus:ring-blue-500 dark:focus:ring-blue-400 cursor-pointer"}),h.jsx(Q,{className:"text-xs text-gray-600 dark:text-gray-400",children:l})]})]}),h.jsxs(I,{className:"flex items-center gap-3 flex-shrink-0",children:[g&&T>0&&h.jsx(oe,{onClick:()=>{g(),O.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer",children:i}),m&&t.length>0&&h.jsx(oe,{onClick:()=>{m()},className:"text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer",children:a})]})]}),h.jsx(I,{ref:w,className:"max-h-96 overflow-y-auto",children:t.length===0&&!r?h.jsx(I,{className:"px-4 py-8 text-center text-gray-500 dark:text-gray-400",children:h.jsx(Q,{children:o})}):h.jsxs(h.Fragment,{children:[t.map(W=>{const j=!W.read;return h.jsxs(I,{"data-notification-id":W.id,"data-unread":j?"true":"false",onClick:()=>{W.onClick?.(),d?.(W),C(!1)},className:`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${j?"bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30":"bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70"}`,children:[W.iconName&&h.jsx(re,{name:W.iconName,className:`w-5 h-5 mt-0.5 flex-shrink-0 ${j?"text-blue-600 dark:text-blue-400":"text-gray-400 dark:text-gray-500"}`}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`text-sm truncate ${j?"font-semibold text-gray-900 dark:text-white":"font-normal text-gray-600 dark:text-gray-400"}`,children:W.title}),h.jsx(I,{className:`text-sm mt-1 line-clamp-2 ${j?"text-gray-700 dark:text-gray-300":"text-gray-500 dark:text-gray-500"}`,children:W.message}),h.jsx(I,{className:"text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono",children:W.time})]}),h.jsxs(I,{className:"flex flex-col items-center gap-2 flex-shrink-0",children:[j&&h.jsx(Q,{className:"w-2 h-2 bg-blue-500 dark:bg-blue-400 rounded-full mt-1.5"}),p&&h.jsx(oe,{onClick:U=>{U.stopPropagation(),p(W)},className:"p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Delete notification",children:h.jsx(re,{name:de.Trash,className:"w-4 h-4"})})]})]},W.id)}),n&&h.jsx(I,{ref:M,className:"px-4 py-3 text-center",children:r?h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."}):h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500"})}),r&&!n&&t.length>0&&h.jsx(I,{className:"px-4 py-2 text-center",children:h.jsx(Q,{className:"text-sm text-gray-400 dark:text-gray-500",children:"..."})})]})})]})]})},su=window.G7Core?.createLogger?.("Comp:UserProfile")??{log:(...t)=>console.log("[Comp:UserProfile]",...t),warn:(...t)=>console.warn("[Comp:UserProfile]",...t),error:(...t)=>console.error("[Comp:UserProfile]",...t)},gy=({user:t={name:"",email:""},profileText:e="Profile Settings",logoutText:n="Logout",onProfileClick:r,onLogoutClick:s,className:o="",logoutEndpoint:i="/api/admin/auth/logout",redirectPath:a="/admin/login",showChevron:l=!0,dropdownDirection:c="up",dropdownOnly:d=!1,id:u,editorAttrs:f})=>{const[g,m]=v.useState(!1),[p,y]=v.useState(!1),b=v.useRef(null);v.useEffect(()=>{const k=C=>{b.current&&!b.current.contains(C.target)&&m(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]);const S=()=>{const C=`; ${document.cookie}`.split("; XSRF-TOKEN=");return C.length===2?decodeURIComponent(C.pop()?.split(";").shift()||""):null},x=()=>localStorage.getItem("auth_token"),E=async()=>{if(!p)try{if(y(!0),m(!1),s){s();return}const k=S(),C=x(),N=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...k&&{"X-XSRF-TOKEN":k},...C&&{Authorization:`Bearer ${C}`}},credentials:"include"});N.ok?(localStorage.removeItem("auth_token"),window.location.href=a):(su.error("로그아웃 실패:",N.statusText),localStorage.removeItem("auth_token"),window.location.href=a)}catch(k){su.error("로그아웃 오류:",k),localStorage.removeItem("auth_token"),window.location.href=a}finally{y(!1)}};return h.jsxs(I,{ref:b,className:d?`absolute inset-0 ${o}`:`relative ${o}`,id:u,...f,children:[h.jsx(oe,{onClick:()=>m(!g),className:d?"w-full h-full opacity-0 cursor-pointer":"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors w-full",children:!d&&h.jsxs(h.Fragment,{children:[t.avatar?h.jsx(yn,{src:t.avatar,alt:t.name,className:"w-8 h-8 rounded-full object-cover"}):h.jsx(I,{className:"w-8 h-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center",children:h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:"flex-1 text-left",children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white text-sm",children:t.name}),t.role&&h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-xs",children:t.role})]}),l&&h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-600 dark:text-gray-400"})]})}),g&&h.jsxs(I,{className:`absolute ${c==="down"?"top-full mt-2":"bottom-full mb-2"} ${d?"right-0 w-72":"left-0 w-full"} bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[h.jsxs(I,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",onClick:()=>{m(!1),window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${t.uuid}`}})},children:[h.jsx(I,{className:"font-semibold text-gray-900 dark:text-white",children:t.name}),h.jsx(I,{className:"text-gray-500 dark:text-gray-400 text-sm",children:t.email})]}),h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>{m(!1),r?r():window.G7Core?.dispatch({handler:"navigate",params:{path:`/admin/users/${t.uuid}/edit`}})},className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 transition-colors",children:[h.jsx(re,{name:de.User,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:e})]}),h.jsxs(oe,{onClick:E,disabled:p,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center justify-start gap-3 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[h.jsx(re,{name:de.ArrowRight,className:"w-5 h-5"}),h.jsx(Q,{children:p?"Logging out...":n})]})]})]})]})},Uo=window.G7Core?.createLogger?.("Comp:LanguageSelector")??{log:(...t)=>console.log("[Comp:LanguageSelector]",...t),warn:(...t)=>console.warn("[Comp:LanguageSelector]",...t),error:(...t)=>console.error("[Comp:LanguageSelector]",...t)},ou=t=>{const e=window.G7Core?.state?.get?.("_global.appConfig.localeNames")?.[t];return e||{ko:"한국어",en:"English",ja:"日本語",zh:"中文",es:"Español",fr:"Français",de:"Deutsch"}[t]||t},py=({availableLocales:t=["ko","en"],languageText:e="Language",apiEndpoint:n="/api/admin/users/me/language",onLanguageChange:r,className:s="",inline:o=!1,showCode:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(!1),[u,f]=v.useState(!1),[g,m]=v.useState(()=>localStorage.getItem("g7_locale")||"ko"),p=v.useRef(null);v.useEffect(()=>{if(o)return;const x=E=>{p.current&&!p.current.contains(E.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const y=()=>{const E=`; ${document.cookie}`.split("; XSRF-TOKEN=");return E.length===2?decodeURIComponent(E.pop()?.split(";").shift()||""):null},b=()=>localStorage.getItem("auth_token"),S=async x=>{if(!(u||x===g))try{f(!0);const E=y(),k=b();try{const C=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json",...E&&{"X-XSRF-TOKEN":E},...k&&{Authorization:`Bearer ${k}`}},credentials:"include",body:JSON.stringify({language:x})});C.ok||Uo.warn("언어 설정 저장 실패 (UI는 변경됨):",C.statusText)}catch(C){Uo.warn("언어 설정 API 호출 실패 (UI는 변경됨):",C)}m(x),d(!1),r?.(x),window.__templateApp?await window.__templateApp.changeLocale(x):(Uo.warn("TemplateApp not found, reloading page"),window.location.reload())}catch(E){Uo.error("언어 변경 오류:",E)}finally{f(!1)}};return o?h.jsxs(I,{className:`${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),disabled:u,className:"w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors",children:[h.jsx(re,{name:de.Globe,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:e}),h.jsx(Q,{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 rounded",children:g.toUpperCase()}),h.jsx(re,{name:de.ChevronDown,className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${c?"rotate-180":""}`})]}),c&&h.jsx(I,{className:"px-4 py-2 flex flex-wrap gap-2",children:t.map(x=>h.jsx(oe,{onClick:()=>S(x),disabled:u,className:`
|
||
px-3 py-1.5 text-sm font-medium rounded-md transition-colors
|
||
${g===x?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
||
${u?"opacity-50 cursor-not-allowed":""}
|
||
`,children:ou(x)},x))})]}):h.jsxs(I,{ref:p,className:`relative ${s}`,id:a,...l,children:[h.jsxs(oe,{onClick:()=>d(!c),className:i?"flex items-center gap-1.5 px-2.5 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors cursor-pointer":"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors","aria-haspopup":"listbox","aria-expanded":c,"aria-label":e,children:[h.jsx(re,{name:de.Globe,className:i?"w-4 h-4":"w-5 h-5 text-gray-600 dark:text-gray-400"}),i&&h.jsx(Q,{className:"font-medium uppercase",children:g}),i&&h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3"})]}),c&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsx(I,{className:"py-2",children:t.map(x=>h.jsxs(oe,{onClick:()=>S(x),disabled:u,className:`
|
||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||
${g===x?"bg-gray-50 dark:bg-gray-700":""}
|
||
${u?"opacity-50 cursor-not-allowed":""}
|
||
`,children:[h.jsx(Q,{className:"text-gray-900 dark:text-white flex-1",children:ou(x)}),g===x&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400"})]},x))})})]})},my=({copyright:t="© 2026 G7",version:e,quickLinks:n=[],className:r="",changelogModalId:s,copyrightModalId:o,id:i,editorAttrs:a})=>{const l=v.useCallback(()=>{s&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/changelog",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreChangelogContent:"{{response.data.content}}"}},{handler:"openModal",target:s}],onError:[{handler:"openModal",target:s}]}]})},[s]),c=v.useCallback(()=>{o&&window.G7Core?.dispatch?.({handler:"sequence",actions:[{handler:"apiCall",auth_required:!0,target:"/api/admin/license",params:{method:"GET"},onSuccess:[{handler:"setState",params:{target:"global",coreLicenseContent:"{{response.data.content}}"}},{handler:"openModal",target:o}],onError:[{handler:"openModal",target:o}]}]})},[o]);return h.jsx(I,{className:`admin-footer ${r}`,id:i,...a,children:h.jsxs(I,{className:"admin-footer-row",children:[h.jsxs(I,{className:"admin-footer-group",children:[h.jsx(Q,{className:o?"admin-footer-link-hover":"",onClick:o?c:void 0,children:t}),e&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{className:"hidden md:inline",children:"•"}),h.jsxs(Q,{className:`flex-center gap-2 ${s?"admin-footer-link-hover":""}`,onClick:s?l:void 0,children:[h.jsx(re,{name:de.Tag,className:"w-4 h-4"}),h.jsxs(Q,{children:["v",e]})]})]})]}),n.length>0&&h.jsx(I,{className:"flex-center gap-4",children:n.map(d=>h.jsxs(Lr,{href:d.url,className:"admin-footer-link",children:[d.iconName&&h.jsx(re,{name:d.iconName,className:"w-4 h-4"}),h.jsx(Q,{children:d.label})]},d.id))})]})})},by=({title:t,description:e,breadcrumbItems:n,tabs:r,onTabChange:s,actions:o,className:i="",children:a,id:l,editorAttrs:c})=>{const d=(u="secondary")=>({primary:"page-action-primary",secondary:"page-action-secondary",danger:"page-action-danger",ghost:"page-action-ghost"})[u];return h.jsxs(I,{className:i,id:l,...c,children:[n&&n.length>0&&h.jsx(I,{className:"mb-md",children:h.jsx(nu,{items:n})}),h.jsxs(I,{className:"flex-between mb-lg",children:[h.jsxs(I,{children:[h.jsx(Ta,{className:"page-title",children:t}),e&&h.jsx(bt,{className:"page-description",children:e})]}),a?h.jsx(I,{className:"page-actions",children:a}):o&&o.length>0?h.jsx(I,{className:"page-actions",children:o.map(u=>h.jsxs(oe,{onClick:u.onClick,disabled:u.disabled,className:d(u.variant),children:[u.iconName&&h.jsx(re,{name:u.iconName,className:"icon-md"}),u.variant!=="ghost"&&u.label&&h.jsx(I,{children:u.label})]},u.id))}):null]}),r&&r.length>0&&h.jsx(I,{className:"tab-container",children:r.map(u=>h.jsxs(oe,{onClick:()=>s?.(u.value),className:u.active?"tab-btn-active":"tab-btn",children:[h.jsx(I,{children:u.label}),u.badge!==void 0&&h.jsx(I,{className:u.active?"tab-badge-active":"tab-badge",children:u.badge})]},u.id))})]})},yy=()=>window.G7Core,vy=({title:t,description:e,className:n="",style:r,children:s,id:o,editorAttrs:i})=>{const a="flex items-center justify-between",l=yy()?.style?.mergeClasses?.(a,n)??`${a} ${n}`;return h.jsxs(I,{className:l,style:r,id:o,...i,children:[h.jsxs(I,{children:[t&&h.jsx(Zn,{className:"text-base font-semibold text-gray-900 dark:text-white",children:t}),e&&h.jsx(bt,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:e})]}),s&&h.jsx(I,{className:"flex items-center gap-2",children:s})]})},Jn=(t,e)=>window.G7Core?.t?.(t,e)??t,xy=({image:t,imageAlt:e,vendor:n,name:r,version:s,status:o,updateAvailable:i=!1,latestVersion:a,dependencies:l=[],showLayoutEditButton:c=!1,actions:d=[],onLayoutEditClick:u,className:f="",id:g,editorAttrs:m})=>{const p=b=>({active:"success",inactive:"default",pending:"pending",error:"error"})[b],y=b=>({active:Jn("common.status_active"),inactive:Jn("common.status_inactive"),pending:Jn("common.status_pending"),error:Jn("common.status_error")})[b];return h.jsxs(I,{className:`
|
||
bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden hover:shadow-lg transition-shadow
|
||
${f}
|
||
`,id:g,...m,children:[t&&h.jsxs(I,{className:"relative",children:[h.jsx(yn,{src:t,alt:e||Jn("common.template_preview",{vendor:n,name:r}),className:"w-full h-48 object-cover"}),h.jsx(I,{className:"absolute top-3 right-3",children:h.jsx(Po,{status:p(o),label:y(o),showIcon:!0})}),i&&h.jsx(I,{className:"absolute top-3 left-3",children:h.jsxs(Q,{className:"flex items-center gap-1 px-2 py-1 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800 rounded-md text-xs font-semibold",children:[h.jsx(re,{name:de.ExclamationTriangle,className:"w-3 h-3"}),h.jsx(Q,{children:Jn("common.update_available")})]})})]}),h.jsxs(I,{className:"p-4",children:[h.jsxs(I,{className:"flex items-start justify-between mb-3",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Ir,{className:"text-lg font-bold text-gray-900 dark:text-white",children:[n,"/",r]}),h.jsxs(I,{className:"flex items-center gap-2 mt-1 text-sm text-gray-600 dark:text-gray-400",children:[h.jsxs(Q,{children:["v",s]}),i&&a&&h.jsxs(h.Fragment,{children:[h.jsx(Q,{children:"→"}),h.jsxs(Q,{className:"text-yellow-600 dark:text-yellow-400 font-semibold",children:["v",a]})]})]}),!t&&h.jsx(I,{className:"mt-2",children:h.jsx(Po,{status:p(o),label:y(o),showIcon:!0})})]}),d.length>0&&h.jsx(bs,{items:d,triggerIconName:de.EllipsisVertical,position:"left"})]}),l.length>0&&h.jsxs(I,{className:"mb-3",children:[h.jsxs(bt,{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:[Jn("common.dependencies"),":"]}),h.jsx(I,{className:"flex flex-wrap gap-1",children:l.map((b,S)=>h.jsx(Q,{className:"px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs rounded",children:b},S))})]}),c&&u&&h.jsxs(oe,{onClick:u,className:"w-full px-4 py-2 bg-blue-600 dark:bg-blue-500 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-600 transition-colors flex items-center justify-center gap-2 font-medium",children:[h.jsx(re,{name:de.Edit,className:"w-4 h-4"}),h.jsx(Q,{children:Jn("common.edit_layout")})]})]})]})},iu=({type:t,message:e,dismissible:n=!1,onDismiss:r,className:s="",id:o,editorAttrs:i})=>{const a={info:{containerClass:"alert-info",iconClass:"alert-icon-info",textClass:"alert-text-info",icon:de.InfoCircle},success:{containerClass:"alert-success",iconClass:"alert-icon-success",textClass:"alert-text-success",icon:de.CheckCircle},warning:{containerClass:"alert-warning",iconClass:"alert-icon-warning",textClass:"alert-text-warning",icon:de.ExclamationTriangle},error:{containerClass:"alert-error",iconClass:"alert-icon-error",textClass:"alert-text-error",icon:de.TimesCircle}},l=a[t]??a.info;return h.jsxs(I,{className:`${l.containerClass} ${s}`,role:"alert","aria-live":"polite",id:o,...i,children:[h.jsx(re,{name:l.icon,className:l.iconClass,ariaLabel:`${t} icon`}),h.jsx(bt,{className:l.textClass,children:e}),n&&h.jsx(oe,{onClick:r,className:`alert-dismiss ${l.textClass}`,"aria-label":"Close alert",children:h.jsx(re,{name:de.Times,className:l.iconClass,ariaLabel:"Close"})})]})},wy=({layoutName:t,onBack:e,onPreview:n,onSave:r,isSaving:s=!1,className:o=""})=>{const i=`
|
||
flex items-center justify-between gap-4 p-4 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700
|
||
${o}
|
||
`.trim().replace(/\s+/g," ");return h.jsxs(I,{className:i,children:[h.jsxs(I,{className:"flex items-center gap-3",children:[h.jsx(oe,{onClick:e,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors bg-transparent border-0 cursor-pointer","aria-label":"뒤로가기",children:h.jsx(re,{name:de.ArrowLeft,className:"text-gray-700 dark:text-gray-300",ariaLabel:"뒤로가기"})}),h.jsx(Zn,{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t})]}),h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(oe,{onClick:n,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors border-0 cursor-pointer","aria-label":"미리보기",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:de.Eye,className:"text-gray-700 dark:text-gray-300",ariaLabel:"미리보기 아이콘"}),h.jsx("span",{children:"미리보기"})]})}),h.jsx(oe,{onClick:r,disabled:s,className:`
|
||
px-4 py-2 rounded-lg transition-colors border-0 cursor-pointer
|
||
${s?"bg-blue-400 dark:bg-blue-600 cursor-not-allowed":"bg-blue-600 dark:bg-blue-500 hover:bg-blue-700 dark:hover:bg-blue-600"}
|
||
text-white
|
||
`.trim().replace(/\s+/g," "),"aria-label":s?"저장 중...":"저장",children:h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(re,{name:s?de.Spinner:de.Save,className:`text-white ${s?"animate-spin":""}`,ariaLabel:s?"저장 중 아이콘":"저장 아이콘"}),h.jsx("span",{children:s?"저장 중...":"저장"})]})})]})]})},ky=({files:t,selectedId:e,onSelect:n,className:r=""})=>{const s=a=>{try{const l=new Date(a);if(isNaN(l.getTime()))return a;const c=l.getFullYear(),d=String(l.getMonth()+1).padStart(2,"0"),u=String(l.getDate()).padStart(2,"0"),f=String(l.getHours()).padStart(2,"0"),g=String(l.getMinutes()).padStart(2,"0");return`${c}-${d}-${u} ${f}:${g}`}catch{return a}},o=a=>{n(a)},i=`
|
||
w-full
|
||
${r}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(I,{className:i,children:t.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"파일이 없습니다."}):h.jsx(Aa,{className:"divide-y divide-gray-200 dark:divide-gray-700",role:"listbox","aria-label":"레이아웃 파일 목록",children:t.map(a=>{const l=a.id===e,c=`
|
||
flex items-center justify-between p-4 cursor-pointer
|
||
transition-colors duration-150
|
||
${l?"bg-blue-100 dark:bg-blue-900 border-l-4 border-blue-500":"hover:bg-gray-100 dark:hover:bg-gray-800"}
|
||
`.trim().replace(/\s+/g," "),d=`
|
||
font-medium
|
||
${l?"text-blue-900 dark:text-blue-100":"text-gray-900 dark:text-gray-100"}
|
||
`.trim().replace(/\s+/g," "),u=`
|
||
text-sm
|
||
${l?"text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400"}
|
||
`.trim().replace(/\s+/g," ");return h.jsx(Da,{className:c,onClick:()=>o(a.id),role:"option","aria-selected":l,tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(a.id))},children:h.jsxs(I,{className:"flex flex-col gap-1",children:[h.jsx(Q,{className:d,children:a.name}),h.jsx(Q,{className:u,children:s(a.updated_at)})]})},a.id)})})})};function au(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cy(t){if(Array.isArray(t))return t}function Sy(t,e,n){return(e=Ay(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _y(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,o,i,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,e!==0)for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,s=d}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw s}}return a}}function Ey(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function cu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lu(Object(n),!0).forEach(function(r){Sy(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lu(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function My(t,e){if(t==null)return{};var n,r,s=Ny(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function Ny(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Oy(t,e){return Cy(t)||_y(t,e)||Dy(t,e)||Ey()}function Ty(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ay(t){var e=Ty(t,"string");return typeof e=="symbol"?e:e+""}function Dy(t,e){if(t){if(typeof t=="string")return au(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?au(t,e):void 0}}function Iy(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function du(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function uu(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?du(Object(n),!0).forEach(function(r){Iy(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ly(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){return e.reduceRight(function(s,o){return o(s)},r)}}function Es(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=t.length?t.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return e.apply(n,[].concat(s,a))}}}function Bo(t){return{}.toString.call(t).includes("Object")}function Py(t){return!Object.keys(t).length}function Ms(t){return typeof t=="function"}function $y(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Fy(t,e){return Bo(e)||Rn("changeType"),Object.keys(e).some(function(n){return!$y(t,n)})&&Rn("changeField"),e}function Vy(t){Ms(t)||Rn("selectorType")}function zy(t){Ms(t)||Bo(t)||Rn("handlerType"),Bo(t)&&Object.values(t).some(function(e){return!Ms(e)})&&Rn("handlersType")}function Hy(t){t||Rn("initialIsRequired"),Bo(t)||Rn("initialType"),Py(t)&&Rn("initialContent")}function Uy(t,e){throw new Error(t[e]||t.default)}var By={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Rn=Es(Uy)(By),jo={changes:Fy,selector:Vy,handler:zy,initial:Hy};function jy(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};jo.initial(t),jo.handler(e);var n={current:t},r=Es(Yy)(n,e),s=Es(Gy)(n),o=Es(jo.changes)(t),i=Es(Wy)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return jo.selector(c),c(n.current)}function l(c){Ly(r,s,o,i)(c)}return[a,l]}function Wy(t,e){return Ms(e)?e(t.current):e}function Gy(t,e){return t.current=uu(uu({},t.current),e),e}function Yy(t,e,n){return Ms(e)?e(t.current):Object.keys(n).forEach(function(r){var s;return(s=e[r])===null||s===void 0?void 0:s.call(e,t.current[r])}),n}var Xy={create:jy},Ky={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function qy(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return s.length>=t.length?t.apply(this,s):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return e.apply(n,[].concat(s,a))}}}function Zy(t){return{}.toString.call(t).includes("Object")}function Qy(t){return t||hu("configIsRequired"),Zy(t)||hu("configType"),t.urls?(Jy(),{paths:{vs:t.urls.monacoBase}}):t}function Jy(){console.warn(fu.deprecation)}function Ry(t,e){throw new Error(t[e]||t.default)}var fu={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
||
You are using deprecated way of configuration.
|
||
|
||
Instead of using
|
||
monaco.config({ urls: { monacoBase: '...' } })
|
||
use
|
||
monaco.config({ paths: { vs: '...' } })
|
||
|
||
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
||
`},hu=qy(Ry)(fu),ev={config:Qy},tv=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(o,i){return i(o)},s)}};function gu(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],gu(t[n],e[n]))}),cu(cu({},t),e)}var nv={type:"cancelation",msg:"operation is manually canceled"};function rl(t){var e=!1,n=new Promise(function(r,s){t.then(function(o){return e?s(nv):r(o)}),t.catch(s)});return n.cancel=function(){return e=!0},n}var rv=["monaco"],sv=Xy.create({config:Ky,isInitialized:!1,resolve:null,reject:null,monaco:null}),pu=Oy(sv,2),Ns=pu[0],Wo=pu[1];function ov(t){var e=ev.config(t),n=e.monaco,r=My(e,rv);Wo(function(s){return{config:gu(s.config,r),monaco:n}})}function iv(){var t=Ns(function(e){var n=e.monaco,r=e.isInitialized,s=e.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!t.isInitialized){if(Wo({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),rl(sl);if(window.monaco&&window.monaco.editor)return mu(window.monaco),t.resolve(window.monaco),rl(sl);tv(av,cv)(dv)}return rl(sl)}function av(t){return document.body.appendChild(t)}function lv(t){var e=document.createElement("script");return t&&(e.src=t),e}function cv(t){var e=Ns(function(r){var s=r.config,o=r.reject;return{config:s,reject:o}}),n=lv("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function dv(){var t=Ns(function(n){var r=n.config,s=n.resolve,o=n.reject;return{config:r,resolve:s,reject:o}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){var r=n.m;mu(r),t.resolve(r)},function(n){t.reject(n)})}function mu(t){Ns().monaco||Wo({monaco:t})}function uv(){return Ns(function(t){var e=t.monaco;return e})}var sl=new Promise(function(t,e){return Wo({resolve:t,reject:e})}),bu={config:ov,init:iv,__getMonacoInstance:uv},fv={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ol=fv,hv={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},gv=hv;function pv({children:t}){return v.createElement("div",{style:gv.container},t)}var mv=pv,bv=mv;function yv({width:t,height:e,isEditorReady:n,loading:r,_ref:s,className:o,wrapperProps:i}){return v.createElement("section",{style:{...ol.wrapper,width:t,height:e},...i},!n&&v.createElement(bv,null,r),v.createElement("div",{ref:s,style:{...ol.fullWidth,...!n&&ol.hide},className:o}))}var vv=yv,yu=v.memo(vv);function xv(t){v.useEffect(t,[])}var vu=xv;function wv(t,e,n=!0){let r=v.useRef(!0);v.useEffect(r.current||!n?()=>{r.current=!1}:t,e)}var nn=wv;function Os(){}function zr(t,e,n,r){return kv(t,r)||Cv(t,e,n,r)}function kv(t,e){return t.editor.getModel(xu(t,e))}function Cv(t,e,n,r){return t.editor.createModel(e,n,r?xu(t,r):void 0)}function xu(t,e){return t.Uri.parse(e)}function Sv({original:t,modified:e,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:f="100%",width:g="100%",className:m,wrapperProps:p={},beforeMount:y=Os,onMount:b=Os}){let[S,x]=v.useState(!1),[E,k]=v.useState(!0),C=v.useRef(null),N=v.useRef(null),_=v.useRef(null),w=v.useRef(b),M=v.useRef(y),O=v.useRef(!1);vu(()=>{let D=bu.init();return D.then(A=>(N.current=A)&&k(!1)).catch(A=>A?.type!=="cancelation"&&console.error("Monaco initialization: error:",A)),()=>C.current?F():D.cancel()}),nn(()=>{if(C.current&&N.current){let D=C.current.getOriginalEditor(),A=zr(N.current,t||"",r||n||"text",o||"");A!==D.getModel()&&D.setModel(A)}},[o],S),nn(()=>{if(C.current&&N.current){let D=C.current.getModifiedEditor(),A=zr(N.current,e||"",s||n||"text",i||"");A!==D.getModel()&&D.setModel(A)}},[i],S),nn(()=>{let D=C.current.getModifiedEditor();D.getOption(N.current.editor.EditorOption.readOnly)?D.setValue(e||""):e!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[e],S),nn(()=>{C.current?.getModel()?.original.setValue(t||"")},[t],S),nn(()=>{let{original:D,modified:A}=C.current.getModel();N.current.editor.setModelLanguage(D,r||n||"text"),N.current.editor.setModelLanguage(A,s||n||"text")},[n,r,s],S),nn(()=>{N.current?.editor.setTheme(c)},[c],S),nn(()=>{C.current?.updateOptions(u)},[u],S);let L=v.useCallback(()=>{if(!N.current)return;M.current(N.current);let D=zr(N.current,t||"",r||n||"text",o||""),A=zr(N.current,e||"",s||n||"text",i||"");C.current?.setModel({original:D,modified:A})},[n,e,s,t,r,o,i]),$=v.useCallback(()=>{!O.current&&_.current&&(C.current=N.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...u}),L(),N.current?.editor.setTheme(c),x(!0),O.current=!0)},[u,c,L]);v.useEffect(()=>{S&&w.current(C.current,N.current)},[S]),v.useEffect(()=>{!E&&!S&&$()},[E,S,$]);function F(){let D=C.current?.getModel();a||D?.original?.dispose(),l||D?.modified?.dispose(),C.current?.dispose()}return v.createElement(yu,{width:g,height:f,isEditorReady:S,loading:d,_ref:_,className:m,wrapperProps:p})}var _v=Sv;v.memo(_v);function Ev(t){let e=v.useRef();return v.useEffect(()=>{e.current=t},[t]),e.current}var Mv=Ev,Go=new Map;function Nv({defaultValue:t,defaultLanguage:e,defaultPath:n,value:r,language:s,path:o,theme:i="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:p,wrapperProps:y={},beforeMount:b=Os,onMount:S=Os,onChange:x,onValidate:E=Os}){let[k,C]=v.useState(!1),[N,_]=v.useState(!0),w=v.useRef(null),M=v.useRef(null),O=v.useRef(null),L=v.useRef(S),$=v.useRef(b),F=v.useRef(),D=v.useRef(r),A=Mv(o),T=v.useRef(!1),V=v.useRef(!1);vu(()=>{let j=bu.init();return j.then(U=>(w.current=U)&&_(!1)).catch(U=>U?.type!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>M.current?W():j.cancel()}),nn(()=>{let j=zr(w.current,t||r||"",e||s||"",o||n||"");j!==M.current?.getModel()&&(u&&Go.set(A,M.current?.saveViewState()),M.current?.setModel(j),u&&M.current?.restoreViewState(Go.get(o)))},[o],k),nn(()=>{M.current?.updateOptions(c)},[c],k),nn(()=>{!M.current||r===void 0||(M.current.getOption(w.current.editor.EditorOption.readOnly)?M.current.setValue(r):r!==M.current.getValue()&&(V.current=!0,M.current.executeEdits("",[{range:M.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),M.current.pushUndoStop(),V.current=!1))},[r],k),nn(()=>{let j=M.current?.getModel();j&&s&&w.current?.editor.setModelLanguage(j,s)},[s],k),nn(()=>{a!==void 0&&M.current?.revealLine(a)},[a],k),nn(()=>{w.current?.editor.setTheme(i)},[i],k);let H=v.useCallback(()=>{if(!(!O.current||!w.current)&&!T.current){$.current(w.current);let j=o||n,U=zr(w.current,r||t||"",e||s||"",j||"");M.current=w.current?.editor.create(O.current,{model:U,automaticLayout:!0,...c},d),u&&M.current.restoreViewState(Go.get(j)),w.current.editor.setTheme(i),a!==void 0&&M.current.revealLine(a),C(!0),T.current=!0}},[t,e,n,r,s,o,c,d,u,i,a]);v.useEffect(()=>{k&&L.current(M.current,w.current)},[k]),v.useEffect(()=>{!N&&!k&&H()},[N,k,H]),D.current=r,v.useEffect(()=>{k&&x&&(F.current?.dispose(),F.current=M.current?.onDidChangeModelContent(j=>{V.current||x(M.current.getValue(),j)}))},[k,x]),v.useEffect(()=>{if(k){let j=w.current.editor.onDidChangeMarkers(U=>{let B=M.current.getModel()?.uri;if(B&&U.find(G=>G.path===B.path)){let G=w.current.editor.getModelMarkers({resource:B});E?.(G)}});return()=>{j?.dispose()}}return()=>{}},[k,E]);function W(){F.current?.dispose(),f?u&&Go.set(o,M.current.saveViewState()):M.current.getModel()?.dispose(),M.current.dispose()}return v.createElement(yu,{width:g,height:m,isEditorReady:k,loading:l,_ref:O,className:p,wrapperProps:y})}var Ov=Nv,Tv=v.memo(Ov),Av=Tv;const Dv=({value:t,onChange:e,language:n="json",height:r="100%",readOnly:s=!1,theme:o="vs-dark"})=>{const i=v.useRef(null),a=(c,d)=>{i.current=c,n==="json"&&d.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemaValidation:"error",allowComments:!1}),c.updateOptions({readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0})},l=c=>{e&&c!==void 0&&e({target:{value:c}})};return v.useEffect(()=>{i.current&&i.current.updateOptions({readOnly:s})},[s]),h.jsx("div",{className:"border border-gray-300 dark:border-gray-700 rounded-lg overflow-hidden",children:h.jsx(Av,{height:r,language:n,value:t,theme:o,onChange:l,onMount:a,options:{readOnly:s,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:14,lineNumbers:"on",renderWhitespace:"selection",automaticLayout:!0}})})},Iv=t=>{const e=new Date(t);return new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(e)},wu=v.memo(({version:t,isSelected:e,onSelect:n})=>{const r=v.useCallback(()=>{n?.(t.id)},[n,t.id]);return h.jsx(Da,{role:"listitem","aria-selected":e,className:`
|
||
p-3 rounded-lg border cursor-pointer transition-colors
|
||
${e?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 hover:border-gray-400 dark:border-gray-600 dark:hover:border-gray-500"}
|
||
`,onClick:r,children:h.jsxs(I,{className:"flex justify-between items-start",children:[h.jsxs(I,{className:"flex-1",children:[h.jsxs(Q,{className:"font-semibold text-gray-900 dark:text-gray-100",children:["버전 ",t.version]}),h.jsx(Q,{className:"ml-2 text-sm text-gray-500 dark:text-gray-400",children:Iv(t.created_at)})]}),h.jsxs(I,{className:"flex gap-3 text-sm",children:[h.jsxs(Q,{className:"text-green-600 dark:text-green-400",children:["+",t.changes_summary.added]}),h.jsxs(Q,{className:"text-red-600 dark:text-red-400",children:["-",t.changes_summary.removed]})]})]})})});wu.displayName="VersionListItem";const ku=({versions:t,selectedId:e,onSelect:n})=>t.length===0?h.jsx(I,{className:"p-4 text-center text-gray-500 dark:text-gray-400",children:"버전이 없습니다."}):h.jsx(Aa,{role:"list",className:"space-y-2",children:t.map(r=>h.jsx(wu,{version:r,isSelected:e===r.id,onSelect:n},r.id))}),Lv=({layoutId:t,versions:e,onRestore:n})=>{const[r,s]=v.useState(),o=l=>{s(l)},i=()=>{r!==void 0&&n(r)},a=r===void 0;return h.jsxs(I,{className:"space-y-4",role:"region","aria-label":"레이아웃 히스토리 패널",children:[h.jsx(I,{className:"border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:h.jsx(ku,{versions:e,selectedId:r,onSelect:o})}),h.jsx(I,{className:"flex justify-end",children:h.jsx(oe,{variant:"primary",disabled:a,onClick:i,"aria-label":"선택한 버전으로 복원",children:"복원"})})]})},Pv=({emailLabel:t="Email",passwordLabel:e="Password",submitButtonText:n="Sign In",processingText:r="Processing...",emailPlaceholder:s="Email",passwordPlaceholder:o="Password",forgotPasswordText:i="Forgot your password?",forgotPasswordUrl:a="/admin/password/reset",emailRequiredError:l="Please enter your email.",emailInvalidError:c="Please enter a valid email address.",passwordRequiredError:d="Please enter your password.",onSubmit:u,loadingActions:f={},isLoading:g=!1,disabled:m=!1,apiError:p="",className:y="",style:b})=>{const[S,x]=v.useState(""),[E,k]=v.useState(""),[C,N]=v.useState({}),_=p,w=Object.values(f).some(F=>F===!0),M=g||w,O=m||M,L=()=>{const F={},D=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return!S||S.trim()===""?F.email=l:D.test(S)||(F.email=c),(!E||E.trim()==="")&&(F.password=d),N(F),Object.keys(F).length===0},$=async F=>{if(!L()){F.preventDefault();return}N({}),u?await u(F):F.preventDefault()};return h.jsx(I,{className:`w-full ${y}`,style:b,children:h.jsxs(Ia,{onSubmit:$,className:"space-y-6",noValidate:!0,children:[_&&h.jsx(I,{className:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:h.jsx(bt,{className:"text-sm text-red-600 dark:text-red-400",children:_})}),h.jsxs(I,{children:[h.jsx(en,{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:t}),h.jsx(wt,{id:"email",name:"email",type:"email",value:S,onChange:F=>x(F.target.value),placeholder:s,disabled:O,className:`
|
||
w-full px-4 py-3 rounded-lg border
|
||
${C.email?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"}
|
||
bg-white dark:bg-gray-800
|
||
text-gray-900 dark:text-white
|
||
placeholder-gray-400 dark:placeholder-gray-500
|
||
focus:outline-none focus:ring-2
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
transition-colors duration-200
|
||
`}),C.email&&h.jsx(bt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:C.email})]}),h.jsxs(I,{children:[h.jsx(en,{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e}),h.jsx(wt,{id:"password",name:"password",type:"password",value:E,onChange:F=>k(F.target.value),placeholder:o,disabled:O,className:`
|
||
w-full px-4 py-3 rounded-lg border
|
||
${C.password?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"}
|
||
bg-white dark:bg-gray-800
|
||
text-gray-900 dark:text-white
|
||
placeholder-gray-400 dark:placeholder-gray-500
|
||
focus:outline-none focus:ring-2
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
transition-colors duration-200
|
||
`}),C.password&&h.jsx(bt,{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:C.password})]}),a&&h.jsx(I,{className:"flex items-center justify-end",children:h.jsx(Lr,{href:a,className:"text-sm text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300 transition-colors duration-200",children:i})}),h.jsx(oe,{type:"submit",disabled:O,className:`
|
||
w-full px-4 py-3 rounded-lg font-medium
|
||
bg-blue-600 hover:bg-blue-700
|
||
dark:bg-blue-500 dark:hover:bg-blue-600
|
||
text-white
|
||
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
||
dark:focus:ring-offset-gray-900
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
transition-colors duration-200
|
||
flex items-center justify-center
|
||
`,children:M?h.jsxs(h.Fragment,{children:[h.jsxs(Hn,{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r]}):n})]})})},Cu=t=>t==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,il=t=>{const e=Cu(t);document.documentElement.setAttribute("data-theme",e),e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},$v=()=>{const t=localStorage.getItem("g7_color_scheme");return t&&["auto","light","dark"].includes(t)?t:"auto"},Fv=({onThemeChange:t,className:e="",autoText:n="System",lightText:r="Light",darkText:s="Dark",id:o,editorAttrs:i})=>{const a=$v(),[l,c]=v.useState(a),[d,u]=v.useState(!1),f=v.useRef(null);v.useEffect(()=>{il(l)},[]),v.useEffect(()=>{if(l!=="auto")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),y=()=>{il("auto")};return p.addEventListener("change",y),()=>p.removeEventListener("change",y)},[l]),v.useEffect(()=>{const p=y=>{f.current&&!f.current.contains(y.target)&&u(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const g=p=>{c(p),localStorage.setItem("g7_color_scheme",p),il(p),u(!1),t?.(p)},m=()=>Cu(l)==="dark"?de.Moon:de.Sun;return h.jsxs(I,{ref:f,className:`relative ${e}`,id:o,...i,children:[h.jsx(oe,{onClick:()=>u(!d),className:"w-9 h-9 flex items-center justify-center hover:bg-gray-100 dark:hover:bg-gray-800 rounded-full transition-colors","aria-label":"Toggle theme",children:h.jsx(re,{name:m(),className:"text-sm text-slate-500 dark:text-slate-400"})}),d&&h.jsx(I,{className:"absolute right-0 mt-2 w-48 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",children:h.jsxs(I,{className:"py-2",children:[h.jsxs(oe,{onClick:()=>g("auto"),className:`
|
||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||
${l==="auto"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[h.jsx(re,{name:de.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),l==="auto"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(oe,{onClick:()=>g("light"),className:`
|
||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||
${l==="light"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[h.jsx(re,{name:de.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),l==="light"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),h.jsxs(oe,{onClick:()=>g("dark"),className:`
|
||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||
${l==="dark"?"bg-gray-50 dark:bg-gray-700":""}
|
||
`,children:[h.jsx(re,{name:de.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"flex-1 text-left text-gray-900 dark:text-white",children:s}),l==="dark"&&h.jsx(re,{name:de.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Su=window.G7Core?.createLogger?.("Comp:ColumnSelector")??{log:(...t)=>console.log("[Comp:ColumnSelector]",...t),warn:(...t)=>console.warn("[Comp:ColumnSelector]",...t),error:(...t)=>console.error("[Comp:ColumnSelector]",...t)},_u=(t,e)=>window.G7Core?.t?.(t,e)??t,Vv=()=>window.G7Core,zv=({id:t,columns:e,visibleColumns:n,onColumnVisibilityChange:r,triggerLabel:s,triggerIconName:o=de.Sliders,position:i="right",className:a="",style:l,requiredText:c,menuTitle:d,menuDescription:u,defaultColumns:f,triggerClassName:g,labelClassName:m,dynamicColumns:p,dynamicColumnsInsertAfter:y,editorAttrs:b})=>{const S=s??_u("common.column_selector"),x=c??_u("common.required"),E=v.useMemo(()=>{if(!p||!Array.isArray(p)||p.length===0)return e;if(y){const z=e.findIndex(K=>K.field===y);if(z!==-1)return[...e.slice(0,z+1),...p,...e.slice(z+1)]}return[...e,...p]},[e,p,y]),[k,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),[w,M]=v.useState(!1),[O,L]=v.useState(i),$=v.useMemo(()=>{try{const z=window.G7Core?.AuthManager?.getInstance();return z?z.getUser()?.uuid:void 0}catch{return}},[]),F=t?`g7_columns_${t}${$!==void 0?`_${$}`:""}`:null,D=()=>{if(!F)return null;try{const z=localStorage.getItem(F);if(z){const K=JSON.parse(z);if(Array.isArray(K)&&K.length>0)return K}}catch(z){Su.warn("Failed to load from localStorage:",z)}return null},A=z=>{if(F)try{localStorage.setItem(F,JSON.stringify(z))}catch(K){Su.warn("Failed to save to localStorage:",K)}},T=()=>{const z=D();return z||(n&&n.length>0?n:f&&f.length>0?f:E.filter(K=>K.visible!==!1).map(K=>K.field))},[V,H]=v.useState(T);v.useEffect(()=>{w||(r&&V.length>0&&r(V),M(!0))},[w,r,V]),v.useEffect(()=>{w&&n&&n.length>0&&(D()||H(n))},[n,w]);const W=v.useRef([]),j=v.useRef(null);v.useEffect(()=>{if(w&&p&&p.length>0){const z=p.map(Z=>Z.field);if(j.current===null){const Z=D();if(j.current=Z!==null,Z!==null){W.current=z;return}}const K=W.current,X=z.filter(Z=>!K.includes(Z));if(X.length>0){const Z=n&&n.length>0?n:V,ee=X.filter(ne=>!Z.includes(ne));if(ee.length>0){const ne=[...Z,...ee];H(ne),A(ne),r?.(ne)}}W.current=z}},[p,w]);const U=n&&n.length>0?n:V;v.useEffect(()=>{const z=K=>{N.current&&!N.current.contains(K.target)&&C(!1)};return k&&document.addEventListener("mousedown",z),()=>{document.removeEventListener("mousedown",z)}},[k]),v.useEffect(()=>{if(k&&_.current&&N.current){const z=_.current.getBoundingClientRect(),K=N.current.getBoundingClientRect(),X=window.innerWidth,Z=z.width||256;i==="right"?K.right-Z<0?L("left"):L("right"):K.left+Z>X?L("right"):L("left")}},[k,i]);const B=z=>{if(E.find(Z=>Z.field===z)?.required)return;const X=U.includes(z)?U.filter(Z=>Z!==z):[...U,z];H(X),A(X),r?.(X)},G=O==="left"?"left-0":"right-0";return h.jsxs(I,{ref:N,className:`relative inline-block ${a}`,style:l,id:t,...b,children:[h.jsxs(oe,{onClick:()=>C(!k),className:Vv()?.style?.mergeClasses?.("flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors",g)??`flex items-center gap-2 px-3 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors ${g??""}`,children:[h.jsx(re,{name:o,className:"w-5 h-5"}),S&&h.jsx(Q,{className:`${m||"hidden sm:inline"} text-sm`,children:S})]}),k&&h.jsxs(I,{ref:_,className:`absolute ${G} z-50 mt-2 w-64 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg`,children:[(d||u)&&h.jsxs(I,{className:"px-4 pt-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[d&&h.jsx(Q,{className:"block text-sm font-medium text-gray-900 dark:text-white",children:d}),u&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-1",children:u})]}),h.jsx(I,{className:"p-2 max-h-64 overflow-y-auto",children:E.map(z=>{const K=U.includes(z.field),X=z.required===!0;return h.jsxs(I,{onClick:()=>!X&&B(z.field),className:`flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-50 dark:hover:bg-gray-700 ${X?"cursor-default":"cursor-pointer"}`,children:[h.jsx(vn,{checked:K,disabled:X,readOnly:!0,className:"h-4 w-4 text-blue-600 rounded border-gray-300 dark:border-gray-600 pointer-events-none"}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300",children:z.header}),X&&x&&h.jsx(Q,{className:"ml-auto text-xs text-gray-400 dark:text-gray-500",children:x})]},z.field)})})]})]})},Hv=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...t)=>console.log("[Comp:PageTransition]",...t),warn:(...t)=>console.warn("[Comp:PageTransition]",...t),error:(...t)=>console.error("[Comp:PageTransition]",...t)},Uv=({className:t="",style:e})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const s=window.G7Core?.TransitionManager;if(!s){Hv.warn("TransitionManager를 찾을 수 없습니다.");return}return r(s.getIsPending()),s.subscribe(i=>{r(i)})},[]),n?h.jsxs(I,{className:`fixed top-0 left-0 right-0 z-[999] ${t}`,style:e,role:"progressbar","aria-label":"페이지 로딩 중",children:[h.jsx(I,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:h.jsx(I,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),h.jsx("style",{children:`
|
||
@keyframes loading {
|
||
0% {
|
||
transform: translateX(-100%);
|
||
}
|
||
50% {
|
||
transform: translateX(300%);
|
||
}
|
||
100% {
|
||
transform: translateX(-100%);
|
||
}
|
||
}
|
||
`})]}):null},Bv=(t,e)=>window.G7Core?.t?.(t,e)??t,jv=({options:t})=>{const e=document.documentElement.classList.contains("dark"),n=e?"rgb(17,24,39)":"rgb(249,250,251)",r=e?"#6b7280":"#9ca3af",s=e?"#9ca3af":"#6b7280";return h.jsxs("div",{style:{position:"absolute",inset:0,zIndex:2147483647,overflow:"hidden",background:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-start",paddingTop:"15%",gap:"12px"},children:[h.jsx("div",{style:{width:"32px",height:"32px",border:`3px solid ${r}`,borderTopColor:"transparent",borderRadius:"50%",animation:"g7-spin 0.8s linear infinite"}}),h.jsx("span",{style:{color:s,fontSize:"14px"},children:t?.text||Bv("nav.loading")})]})};function fr(t){"@babel/helpers - typeof";return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fr(t)}function Wv(t,e){if(fr(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(fr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Eu(t){var e=Wv(t,"string");return fr(e)=="symbol"?e:e+""}function Ts(t,e,n){return(e=Eu(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Oe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Mu(Object(n),!0).forEach(function(r){Ts(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mu(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Gv(t){if(Array.isArray(t))return t}function Yv(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,o,i,a=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(d){c=!0,s=d}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw s}}return a}}function al(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Nu(t,e){if(t){if(typeof t=="string")return al(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?al(t,e):void 0}}function Xv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Un(t,e){return Gv(t)||Yv(t,e)||Nu(t,e)||Xv()}function Kv(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function On(t,e){if(t==null)return{};var n,r,s=Kv(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}var qv=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function Ou(t){var e=t.defaultInputValue,n=e===void 0?"":e,r=t.defaultMenuIsOpen,s=r===void 0?!1:r,o=t.defaultValue,i=o===void 0?null:o,a=t.inputValue,l=t.menuIsOpen,c=t.onChange,d=t.onInputChange,u=t.onMenuClose,f=t.onMenuOpen,g=t.value,m=On(t,qv),p=v.useState(a!==void 0?a:n),y=Un(p,2),b=y[0],S=y[1],x=v.useState(l!==void 0?l:s),E=Un(x,2),k=E[0],C=E[1],N=v.useState(g!==void 0?g:i),_=Un(N,2),w=_[0],M=_[1],O=v.useCallback(function(V,H){typeof c=="function"&&c(V,H),M(V)},[c]),L=v.useCallback(function(V,H){var W;typeof d=="function"&&(W=d(V,H)),S(W!==void 0?W:V)},[d]),$=v.useCallback(function(){typeof f=="function"&&f(),C(!0)},[f]),F=v.useCallback(function(){typeof u=="function"&&u(),C(!1)},[u]),D=a!==void 0?a:b,A=l!==void 0?l:k,T=g!==void 0?g:w;return Oe(Oe({},m),{},{inputValue:D,menuIsOpen:A,onChange:O,onInputChange:L,onMenuClose:F,onMenuOpen:$,value:T})}function De(){return De=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},De.apply(null,arguments)}function Zv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Eu(r.key),r)}}function Qv(t,e,n){return e&&Tu(t.prototype,e),n&&Tu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ll(t,e){return ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ll(t,e)}function Jv(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ll(t,e)}function Yo(t){return Yo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yo(t)}function Au(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Au=function(){return!!t})()}function Rv(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ex(t,e){if(e&&(fr(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rv(t)}function tx(t){var e=Au();return function(){var n,r=Yo(t);if(e){var s=Yo(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return ex(this,n)}}function nx(t){if(Array.isArray(t))return al(t)}function rx(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function sx(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hr(t){return nx(t)||rx(t)||Nu(t)||sx()}function ox(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function ix(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var ax=(function(){function t(n){var r=this;this._insertTag=function(s){var o;r.tags.length===0?r.insertionPoint?o=r.insertionPoint.nextSibling:r.prepend?o=r.container.firstChild:o=r.before:o=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(s,o),r.tags.push(s)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(r){r.forEach(this._insertTag)},e.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(ix(this));var s=this.tags[this.tags.length-1];if(this.isSpeedy){var o=ox(s);try{o.insertRule(r,o.cssRules.length)}catch{}}else s.appendChild(document.createTextNode(r));this.ctr++},e.flush=function(){this.tags.forEach(function(r){var s;return(s=r.parentNode)==null?void 0:s.removeChild(r)}),this.tags=[],this.ctr=0},t})(),$t="-ms-",Xo="-moz-",et="-webkit-",Du="comm",cl="rule",dl="decl",lx="@import",Iu="@keyframes",cx="@layer",dx=Math.abs,Ko=String.fromCharCode,ux=Object.assign;function fx(t,e){return It(t,0)^45?(((e<<2^It(t,0))<<2^It(t,1))<<2^It(t,2))<<2^It(t,3):0}function Lu(t){return t.trim()}function hx(t,e){return(t=e.exec(t))?t[0]:t}function tt(t,e,n){return t.replace(e,n)}function ul(t,e){return t.indexOf(e)}function It(t,e){return t.charCodeAt(e)|0}function As(t,e,n){return t.slice(e,n)}function Tn(t){return t.length}function fl(t){return t.length}function qo(t,e){return e.push(t),t}function gx(t,e){return t.map(e).join("")}var Zo=1,Ur=1,Pu=0,Xt=0,kt=0,Br="";function Qo(t,e,n,r,s,o,i){return{value:t,root:e,parent:n,type:r,props:s,children:o,line:Zo,column:Ur,length:i,return:""}}function Ds(t,e){return ux(Qo("",null,null,"",null,null,0),t,{length:-t.length},e)}function px(){return kt}function mx(){return kt=Xt>0?It(Br,--Xt):0,Ur--,kt===10&&(Ur=1,Zo--),kt}function rn(){return kt=Xt<Pu?It(Br,Xt++):0,Ur++,kt===10&&(Ur=1,Zo++),kt}function An(){return It(Br,Xt)}function Jo(){return Xt}function Is(t,e){return As(Br,t,e)}function Ls(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $u(t){return Zo=Ur=1,Pu=Tn(Br=t),Xt=0,[]}function Fu(t){return Br="",t}function Ro(t){return Lu(Is(Xt-1,hl(t===91?t+2:t===40?t+1:t)))}function bx(t){for(;(kt=An())&&kt<33;)rn();return Ls(t)>2||Ls(kt)>3?"":" "}function yx(t,e){for(;--e&&rn()&&!(kt<48||kt>102||kt>57&&kt<65||kt>70&&kt<97););return Is(t,Jo()+(e<6&&An()==32&&rn()==32))}function hl(t){for(;rn();)switch(kt){case t:return Xt;case 34:case 39:t!==34&&t!==39&&hl(kt);break;case 40:t===41&&hl(t);break;case 92:rn();break}return Xt}function vx(t,e){for(;rn()&&t+kt!==57;)if(t+kt===84&&An()===47)break;return"/*"+Is(e,Xt-1)+"*"+Ko(t===47?t:rn())}function xx(t){for(;!Ls(An());)rn();return Is(t,Xt)}function wx(t){return Fu(ei("",null,null,null,[""],t=$u(t),0,[0],t))}function ei(t,e,n,r,s,o,i,a,l){for(var c=0,d=0,u=i,f=0,g=0,m=0,p=1,y=1,b=1,S=0,x="",E=s,k=o,C=r,N=x;y;)switch(m=S,S=rn()){case 40:if(m!=108&&It(N,u-1)==58){ul(N+=tt(Ro(S),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:N+=Ro(S);break;case 9:case 10:case 13:case 32:N+=bx(m);break;case 92:N+=yx(Jo()-1,7);continue;case 47:switch(An()){case 42:case 47:qo(kx(vx(rn(),Jo()),e,n),l);break;default:N+="/"}break;case 123*p:a[c++]=Tn(N)*b;case 125*p:case 59:case 0:switch(S){case 0:case 125:y=0;case 59+d:b==-1&&(N=tt(N,/\f/g,"")),g>0&&Tn(N)-u&&qo(g>32?zu(N+";",r,n,u-1):zu(tt(N," ","")+";",r,n,u-2),l);break;case 59:N+=";";default:if(qo(C=Vu(N,e,n,c,d,s,a,x,E=[],k=[],u),o),S===123)if(d===0)ei(N,e,C,C,E,o,u,a,k);else switch(f===99&&It(N,3)===110?100:f){case 100:case 108:case 109:case 115:ei(t,C,C,r&&qo(Vu(t,C,C,0,0,s,a,x,s,E=[],u),k),s,k,u,a,r?E:k);break;default:ei(N,C,C,C,[""],k,0,a,k)}}c=d=g=0,p=b=1,x=N="",u=i;break;case 58:u=1+Tn(N),g=m;default:if(p<1){if(S==123)--p;else if(S==125&&p++==0&&mx()==125)continue}switch(N+=Ko(S),S*p){case 38:b=d>0?1:(N+="\f",-1);break;case 44:a[c++]=(Tn(N)-1)*b,b=1;break;case 64:An()===45&&(N+=Ro(rn())),f=An(),d=u=Tn(x=N+=xx(Jo())),S++;break;case 45:m===45&&Tn(N)==2&&(p=0)}}return o}function Vu(t,e,n,r,s,o,i,a,l,c,d){for(var u=s-1,f=s===0?o:[""],g=fl(f),m=0,p=0,y=0;m<r;++m)for(var b=0,S=As(t,u+1,u=dx(p=i[m])),x=t;b<g;++b)(x=Lu(p>0?f[b]+" "+S:tt(S,/&\f/g,f[b])))&&(l[y++]=x);return Qo(t,e,n,s===0?cl:a,l,c,d)}function kx(t,e,n){return Qo(t,e,n,Du,Ko(px()),As(t,2,-2),0)}function zu(t,e,n,r){return Qo(t,e,n,dl,As(t,0,r),As(t,r+1,-1),r)}function jr(t,e){for(var n="",r=fl(t),s=0;s<r;s++)n+=e(t[s],s,t,e)||"";return n}function Cx(t,e,n,r){switch(t.type){case cx:if(t.children.length)break;case lx:case dl:return t.return=t.return||t.value;case Du:return"";case Iu:return t.return=t.value+"{"+jr(t.children,r)+"}";case cl:t.value=t.props.join(",")}return Tn(n=jr(t.children,r))?t.return=t.value+"{"+n+"}":""}function Sx(t){var e=fl(t);return function(n,r,s,o){for(var i="",a=0;a<e;a++)i+=t[a](n,r,s,o)||"";return i}}function _x(t){return function(e){e.root||(e=e.return)&&t(e)}}function Ex(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var Mx=function(e,n,r){for(var s=0,o=0;s=o,o=An(),s===38&&o===12&&(n[r]=1),!Ls(o);)rn();return Is(e,Xt)},Nx=function(e,n){var r=-1,s=44;do switch(Ls(s)){case 0:s===38&&An()===12&&(n[r]=1),e[r]+=Mx(Xt-1,n,r);break;case 2:e[r]+=Ro(s);break;case 4:if(s===44){e[++r]=An()===58?"&\f":"",n[r]=e[r].length;break}default:e[r]+=Ko(s)}while(s=rn());return e},Ox=function(e,n){return Fu(Nx($u(e),n))},Hu=new WeakMap,Tx=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,r=e.parent,s=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!Hu.get(r))&&!s){Hu.set(e,!0);for(var o=[],i=Ox(n,o),a=r.props,l=0,c=0;l<i.length;l++)for(var d=0;d<a.length;d++,c++)e.props[c]=o[l]?i[l].replace(/&\f/g,a[d]):a[d]+" "+i[l]}}},Ax=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function Uu(t,e){switch(fx(t,e)){case 5103:return et+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return et+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return et+t+Xo+t+$t+t+t;case 6828:case 4268:return et+t+$t+t+t;case 6165:return et+t+$t+"flex-"+t+t;case 5187:return et+t+tt(t,/(\w+).+(:[^]+)/,et+"box-$1$2"+$t+"flex-$1$2")+t;case 5443:return et+t+$t+"flex-item-"+tt(t,/flex-|-self/,"")+t;case 4675:return et+t+$t+"flex-line-pack"+tt(t,/align-content|flex-|-self/,"")+t;case 5548:return et+t+$t+tt(t,"shrink","negative")+t;case 5292:return et+t+$t+tt(t,"basis","preferred-size")+t;case 6060:return et+"box-"+tt(t,"-grow","")+et+t+$t+tt(t,"grow","positive")+t;case 4554:return et+tt(t,/([^-])(transform)/g,"$1"+et+"$2")+t;case 6187:return tt(tt(tt(t,/(zoom-|grab)/,et+"$1"),/(image-set)/,et+"$1"),t,"")+t;case 5495:case 3959:return tt(t,/(image-set\([^]*)/,et+"$1$`$1");case 4968:return tt(tt(t,/(.+:)(flex-)?(.*)/,et+"box-pack:$3"+$t+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+et+t+t;case 4095:case 3583:case 4068:case 2532:return tt(t,/(.+)-inline(.+)/,et+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Tn(t)-1-e>6)switch(It(t,e+1)){case 109:if(It(t,e+4)!==45)break;case 102:return tt(t,/(.+:)(.+)-([^]+)/,"$1"+et+"$2-$3$1"+Xo+(It(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~ul(t,"stretch")?Uu(tt(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(It(t,e+1)!==115)break;case 6444:switch(It(t,Tn(t)-3-(~ul(t,"!important")&&10))){case 107:return tt(t,":",":"+et)+t;case 101:return tt(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+et+(It(t,14)===45?"inline-":"")+"box$3$1"+et+"$2$3$1"+$t+"$2box$3")+t}break;case 5936:switch(It(t,e+11)){case 114:return et+t+$t+tt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return et+t+$t+tt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return et+t+$t+tt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return et+t+$t+t+t}return t}var Dx=function(e,n,r,s){if(e.length>-1&&!e.return)switch(e.type){case dl:e.return=Uu(e.value,e.length);break;case Iu:return jr([Ds(e,{value:tt(e.value,"@","@"+et)})],s);case cl:if(e.length)return gx(e.props,function(o){switch(hx(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return jr([Ds(e,{props:[tt(o,/:(read-\w+)/,":"+Xo+"$1")]})],s);case"::placeholder":return jr([Ds(e,{props:[tt(o,/:(plac\w+)/,":"+et+"input-$1")]}),Ds(e,{props:[tt(o,/:(plac\w+)/,":"+Xo+"$1")]}),Ds(e,{props:[tt(o,/:(plac\w+)/,$t+"input-$1")]})],s)}return""})}},Ix=[Dx],Lx=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(p){var y=p.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(p),p.setAttribute("data-s",""))})}var s=e.stylisPlugins||Ix,o={},i,a=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(p){for(var y=p.getAttribute("data-emotion").split(" "),b=1;b<y.length;b++)o[y[b]]=!0;a.push(p)});var l,c=[Tx,Ax];{var d,u=[Cx,_x(function(p){d.insert(p)})],f=Sx(c.concat(s,u)),g=function(y){return jr(wx(y),f)};l=function(y,b,S,x){d=S,g(y?y+"{"+b.styles+"}":b.styles),x&&(m.inserted[b.name]=!0)}}var m={key:n,sheet:new ax({key:n,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:o,registered:{},insert:l};return m.sheet.hydrate(a),m},gl={exports:{}},rt={};/** @license React v16.13.1
|
||
* react-is.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var Bu;function Px(){if(Bu)return rt;Bu=1;var t=typeof Symbol=="function"&&Symbol.for,e=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,o=t?Symbol.for("react.profiler"):60114,i=t?Symbol.for("react.provider"):60109,a=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.async_mode"):60111,c=t?Symbol.for("react.concurrent_mode"):60111,d=t?Symbol.for("react.forward_ref"):60112,u=t?Symbol.for("react.suspense"):60113,f=t?Symbol.for("react.suspense_list"):60120,g=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,p=t?Symbol.for("react.block"):60121,y=t?Symbol.for("react.fundamental"):60117,b=t?Symbol.for("react.responder"):60118,S=t?Symbol.for("react.scope"):60119;function x(k){if(typeof k=="object"&&k!==null){var C=k.$$typeof;switch(C){case e:switch(k=k.type,k){case l:case c:case r:case o:case s:case u:return k;default:switch(k=k&&k.$$typeof,k){case a:case d:case m:case g:case i:return k;default:return C}}case n:return C}}}function E(k){return x(k)===c}return rt.AsyncMode=l,rt.ConcurrentMode=c,rt.ContextConsumer=a,rt.ContextProvider=i,rt.Element=e,rt.ForwardRef=d,rt.Fragment=r,rt.Lazy=m,rt.Memo=g,rt.Portal=n,rt.Profiler=o,rt.StrictMode=s,rt.Suspense=u,rt.isAsyncMode=function(k){return E(k)||x(k)===l},rt.isConcurrentMode=E,rt.isContextConsumer=function(k){return x(k)===a},rt.isContextProvider=function(k){return x(k)===i},rt.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===e},rt.isForwardRef=function(k){return x(k)===d},rt.isFragment=function(k){return x(k)===r},rt.isLazy=function(k){return x(k)===m},rt.isMemo=function(k){return x(k)===g},rt.isPortal=function(k){return x(k)===n},rt.isProfiler=function(k){return x(k)===o},rt.isStrictMode=function(k){return x(k)===s},rt.isSuspense=function(k){return x(k)===u},rt.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===r||k===c||k===o||k===s||k===u||k===f||typeof k=="object"&&k!==null&&(k.$$typeof===m||k.$$typeof===g||k.$$typeof===i||k.$$typeof===a||k.$$typeof===d||k.$$typeof===y||k.$$typeof===b||k.$$typeof===S||k.$$typeof===p)},rt.typeOf=x,rt}var ju;function $x(){return ju||(ju=1,gl.exports=Px()),gl.exports}var pl,Wu;function Fx(){if(Wu)return pl;Wu=1;var t=$x(),e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};o[t.ForwardRef]=r,o[t.Memo]=s;function i(m){return t.isMemo(m)?s:o[m.$$typeof]||e}var a=Object.defineProperty,l=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,u=Object.getPrototypeOf,f=Object.prototype;function g(m,p,y){if(typeof p!="string"){if(f){var b=u(p);b&&b!==f&&g(m,b,y)}var S=l(p);c&&(S=S.concat(c(p)));for(var x=i(m),E=i(p),k=0;k<S.length;++k){var C=S[k];if(!n[C]&&!(y&&y[C])&&!(E&&E[C])&&!(x&&x[C])){var N=d(p,C);try{a(m,C,N)}catch{}}}}return m}return pl=g,pl}Fx();var Vx=!0;function zx(t,e,n){var r="";return n.split(" ").forEach(function(s){t[s]!==void 0?e.push(t[s]+";"):s&&(r+=s+" ")}),r}var Gu=function(e,n,r){var s=e.key+"-"+n.name;(r===!1||Vx===!1)&&e.registered[s]===void 0&&(e.registered[s]=n.styles)},Hx=function(e,n,r){Gu(e,n,r);var s=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var o=n;do e.insert(n===o?"."+s:"",o,e.sheet,!0),o=o.next;while(o!==void 0)}};function Ux(t){for(var e=0,n,r=0,s=t.length;s>=4;++r,s-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(s){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var Bx={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},jx=/[A-Z]|^ms/g,Wx=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Yu=function(e){return e.charCodeAt(1)===45},Xu=function(e){return e!=null&&typeof e!="boolean"},ml=Ex(function(t){return Yu(t)?t:t.replace(jx,"-$&").toLowerCase()}),Ku=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(Wx,function(r,s,o){return Dn={name:s,styles:o,next:Dn},s})}return Bx[e]!==1&&!Yu(e)&&typeof n=="number"&&n!==0?n+"px":n};function Ps(t,e,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var s=n;if(s.anim===1)return Dn={name:s.name,styles:s.styles,next:Dn},s.name;var o=n;if(o.styles!==void 0){var i=o.next;if(i!==void 0)for(;i!==void 0;)Dn={name:i.name,styles:i.styles,next:Dn},i=i.next;var a=o.styles+";";return a}return Gx(t,e,n)}case"function":{if(t!==void 0){var l=Dn,c=n(t);return Dn=l,Ps(t,e,c)}break}}var d=n;return d}function Gx(t,e,n){var r="";if(Array.isArray(n))for(var s=0;s<n.length;s++)r+=Ps(t,e,n[s])+";";else for(var o in n){var i=n[o];if(typeof i!="object"){var a=i;Xu(a)&&(r+=ml(o)+":"+Ku(o,a)+";")}else if(Array.isArray(i)&&typeof i[0]=="string"&&e==null)for(var l=0;l<i.length;l++)Xu(i[l])&&(r+=ml(o)+":"+Ku(o,i[l])+";");else{var c=Ps(t,e,i);switch(o){case"animation":case"animationName":{r+=ml(o)+":"+c+";";break}default:r+=o+"{"+c+"}"}}}return r}var qu=/label:\s*([^\s;{]+)\s*(;|$)/g,Dn;function Zu(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var r=!0,s="";Dn=void 0;var o=t[0];if(o==null||o.raw===void 0)r=!1,s+=Ps(n,e,o);else{var i=o;s+=i[0]}for(var a=1;a<t.length;a++)if(s+=Ps(n,e,t[a]),r){var l=o;s+=l[a]}qu.lastIndex=0;for(var c="",d;(d=qu.exec(s))!==null;)c+="-"+d[1];var u=Ux(s)+c;return{name:u,styles:s,next:Dn}}var Yx=function(e){return e()},Xx=P.useInsertionEffect?P.useInsertionEffect:!1,Kx=Xx||Yx,Qu=P.createContext(typeof HTMLElement<"u"?Lx({key:"css"}):null);Qu.Provider;var qx=function(e){return v.forwardRef(function(n,r){var s=v.useContext(Qu);return e(n,s,r)})},Zx=P.createContext({}),bl={}.hasOwnProperty,yl="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Qx=function(e,n){var r={};for(var s in n)bl.call(n,s)&&(r[s]=n[s]);return r[yl]=e,r},Jx=function(e){var n=e.cache,r=e.serialized,s=e.isStringTag;return Gu(n,r,s),Kx(function(){return Hx(n,r,s)}),null},Rx=qx(function(t,e,n){var r=t.css;typeof r=="string"&&e.registered[r]!==void 0&&(r=e.registered[r]);var s=t[yl],o=[r],i="";typeof t.className=="string"?i=zx(e.registered,o,t.className):t.className!=null&&(i=t.className+" ");var a=Zu(o,void 0,P.useContext(Zx));i+=e.key+"-"+a.name;var l={};for(var c in t)bl.call(t,c)&&c!=="css"&&c!==yl&&(l[c]=t[c]);return l.className=i,n&&(l.ref=n),P.createElement(P.Fragment,null,P.createElement(Jx,{cache:e,serialized:a,isStringTag:typeof s=="string"}),P.createElement(s,l))}),ew=Rx,Ne=function(e,n){var r=arguments;if(n==null||!bl.call(n,"css"))return P.createElement.apply(void 0,r);var s=r.length,o=new Array(s);o[0]=ew,o[1]=Qx(e,n);for(var i=2;i<s;i++)o[i]=r[i];return P.createElement.apply(null,o)};(function(t){var e;e||(e=t.JSX||(t.JSX={}))})(Ne||(Ne={}));function vl(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Zu(e)}function tw(){var t=vl.apply(void 0,arguments),e="animation-"+t.name;return{name:e,styles:"@keyframes "+e+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function nw(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}const rw=Math.min,sw=Math.max,ti=Math.round,ni=Math.floor,ri=t=>({x:t,y:t});function ow(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function si(){return typeof window<"u"}function Ju(t){return ef(t)?(t.nodeName||"").toLowerCase():"#document"}function Bn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ru(t){var e;return(e=(ef(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ef(t){return si()?t instanceof Node||t instanceof Bn(t).Node:!1}function iw(t){return si()?t instanceof Element||t instanceof Bn(t).Element:!1}function xl(t){return si()?t instanceof HTMLElement||t instanceof Bn(t).HTMLElement:!1}function tf(t){return!si()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Bn(t).ShadowRoot}const aw=new Set(["inline","contents"]);function nf(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=wl(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!aw.has(s)}function lw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cw=new Set(["html","body","#document"]);function dw(t){return cw.has(Ju(t))}function wl(t){return Bn(t).getComputedStyle(t)}function uw(t){if(Ju(t)==="html")return t;const e=t.assignedSlot||t.parentNode||tf(t)&&t.host||Ru(t);return tf(e)?e.host:e}function rf(t){const e=uw(t);return dw(e)?t.ownerDocument?t.ownerDocument.body:t.body:xl(e)&&nf(e)?e:rf(e)}function oi(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=rf(t),o=s===((r=t.ownerDocument)==null?void 0:r.body),i=Bn(s);if(o){const a=kl(i);return e.concat(i,i.visualViewport||[],nf(s)?s:[],a&&n?oi(a):[])}return e.concat(s,oi(s,[],n))}function kl(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function fw(t){const e=wl(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=xl(t),o=s?t.offsetWidth:n,i=s?t.offsetHeight:r,a=ti(n)!==o||ti(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function Cl(t){return iw(t)?t:t.contextElement}function sf(t){const e=Cl(t);if(!xl(e))return ri(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:o}=fw(e);let i=(o?ti(n.width):n.width)/r,a=(o?ti(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const hw=ri(0);function gw(t){const e=Bn(t);return!lw()||!e.visualViewport?hw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function pw(t,e,n){return!1}function of(t,e,n,r){e===void 0&&(e=!1);const s=t.getBoundingClientRect(),o=Cl(t);let i=ri(1);e&&(i=sf(t));const a=pw()?gw(o):ri(0);let l=(s.left+a.x)/i.x,c=(s.top+a.y)/i.y,d=s.width/i.x,u=s.height/i.y;if(o){const f=Bn(o),g=r;let m=f,p=kl(m);for(;p&&r&&g!==m;){const y=sf(p),b=p.getBoundingClientRect(),S=wl(p),x=b.left+(p.clientLeft+parseFloat(S.paddingLeft))*y.x,E=b.top+(p.clientTop+parseFloat(S.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,u*=y.y,l+=x,c+=E,m=Bn(p),p=kl(m)}}return ow({width:d,height:u,x:l,y:c})}function af(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function mw(t,e){let n=null,r;const s=Ru(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=t.getBoundingClientRect(),{left:d,top:u,width:f,height:g}=c;if(a||e(),!f||!g)return;const m=ni(u),p=ni(s.clientWidth-(d+f)),y=ni(s.clientHeight-(u+g)),b=ni(d),x={rootMargin:-m+"px "+-p+"px "+-y+"px "+-b+"px",threshold:sw(0,rw(1,l))||1};let E=!0;function k(C){const N=C[0].intersectionRatio;if(N!==l){if(!E)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!af(c,t.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(k,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(k,x)}n.observe(t)}return i(!0),o}function bw(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Cl(t),d=s||o?[...c?oi(c):[],...oi(e)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const u=c&&a?mw(c,n):null;let f=-1,g=null;i&&(g=new ResizeObserver(b=>{let[S]=b;S&&S.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=g)==null||x.observe(e)})),n()}),c&&!l&&g.observe(c),g.observe(e));let m,p=l?of(t):null;l&&y();function y(){const b=of(t);p&&!af(p,b)&&n(),p=b,m=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(S=>{s&&S.removeEventListener("scroll",n),o&&S.removeEventListener("resize",n)}),u?.(),(b=g)==null||b.disconnect(),g=null,l&&cancelAnimationFrame(m)}}var Sl=v.useLayoutEffect,yw=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],ii=function(){};function vw(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function xw(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var o=[].concat(r);if(e&&t)for(var i in e)e.hasOwnProperty(i)&&e[i]&&o.push("".concat(vw(t,i)));return o.filter(function(a){return a}).map(function(a){return String(a).trim()}).join(" ")}var ai=function(e){return Ow(e)?e.filter(Boolean):fr(e)==="object"&&e!==null?[e]:[]},lf=function(e){e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme;var n=On(e,yw);return Oe({},n)},yt=function(e,n,r){var s=e.cx,o=e.getStyles,i=e.getClassNames,a=e.className;return{css:o(n,e),className:s(r??{},i(n,e),a)}};function li(t){return[document.documentElement,document.body,window].indexOf(t)>-1}function ww(t){return li(t)?window.innerHeight:t.clientHeight}function cf(t){return li(t)?window.pageYOffset:t.scrollTop}function ci(t,e){if(li(t)){window.scrollTo(0,e);return}t.scrollTop=e}function kw(t){var e=getComputedStyle(t),n=e.position==="absolute",r=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var s=t;s=s.parentElement;)if(e=getComputedStyle(s),!(n&&e.position==="static")&&r.test(e.overflow+e.overflowY+e.overflowX))return s;return document.documentElement}function Cw(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e}function di(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ii,s=cf(t),o=e-s,i=10,a=0;function l(){a+=i;var c=Cw(a,s,o,n);ci(t,c),a<n?window.requestAnimationFrame(l):r(t)}l()}function df(t,e){var n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=e.offsetHeight/3;r.bottom+s>n.bottom?ci(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+s,t.scrollHeight)):r.top-s<n.top&&ci(t,Math.max(e.offsetTop-s,0))}function Sw(t){var e=t.getBoundingClientRect();return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width}}function uf(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function _w(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var ff=!1,Ew={get passive(){return ff=!0}},ui=typeof window<"u"?window:{};ui.addEventListener&&ui.removeEventListener&&(ui.addEventListener("p",ii,Ew),ui.removeEventListener("p",ii,!1));var Mw=ff;function Nw(t){return t!=null}function Ow(t){return Array.isArray(t)}function $s(t,e,n){return t?e:n}function MT(t){return t}function NT(t){return t}var Tw=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=Object.entries(e).filter(function(i){var a=Un(i,1),l=a[0];return!r.includes(l)});return o.reduce(function(i,a){var l=Un(a,2),c=l[0],d=l[1];return i[c]=d,i},{})},Aw=["children","innerProps"],Dw=["children","innerProps"];function Iw(t){var e=t.maxHeight,n=t.menuEl,r=t.minHeight,s=t.placement,o=t.shouldScroll,i=t.isFixedPosition,a=t.controlHeight,l=kw(n),c={placement:"bottom",maxHeight:e};if(!n||!n.offsetParent)return c;var d=l.getBoundingClientRect(),u=d.height,f=n.getBoundingClientRect(),g=f.bottom,m=f.height,p=f.top,y=n.offsetParent.getBoundingClientRect(),b=y.top,S=i?window.innerHeight:ww(l),x=cf(l),E=parseInt(getComputedStyle(n).marginBottom,10),k=parseInt(getComputedStyle(n).marginTop,10),C=b-k,N=S-p,_=C+x,w=u-x-p,M=g-S+x+E,O=x+p-k,L=160;switch(s){case"auto":case"bottom":if(N>=m)return{placement:"bottom",maxHeight:e};if(w>=m&&!i)return o&&di(l,M,L),{placement:"bottom",maxHeight:e};if(!i&&w>=r||i&&N>=r){o&&di(l,M,L);var $=i?N-E:w-E;return{placement:"bottom",maxHeight:$}}if(s==="auto"||i){var F=e,D=i?C:_;return D>=r&&(F=Math.min(D-E-a,e)),{placement:"top",maxHeight:F}}if(s==="bottom")return o&&ci(l,M),{placement:"bottom",maxHeight:e};break;case"top":if(C>=m)return{placement:"top",maxHeight:e};if(_>=m&&!i)return o&&di(l,O,L),{placement:"top",maxHeight:e};if(!i&&_>=r||i&&C>=r){var A=e;return(!i&&_>=r||i&&C>=r)&&(A=i?C-k:_-k),o&&di(l,O,L),{placement:"top",maxHeight:A}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(s,'".'))}return c}function Lw(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var hf=function(e){return e==="auto"?"bottom":e},Pw=function(e,n){var r,s=e.placement,o=e.theme,i=o.borderRadius,a=o.spacing,l=o.colors;return Oe((r={label:"menu"},Ts(r,Lw(s),"100%"),Ts(r,"position","absolute"),Ts(r,"width","100%"),Ts(r,"zIndex",1),r),n?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},gf=v.createContext(null),$w=function(e){var n=e.children,r=e.minMenuHeight,s=e.maxMenuHeight,o=e.menuPlacement,i=e.menuPosition,a=e.menuShouldScrollIntoView,l=e.theme,c=v.useContext(gf)||{},d=c.setPortalPlacement,u=v.useRef(null),f=v.useState(s),g=Un(f,2),m=g[0],p=g[1],y=v.useState(null),b=Un(y,2),S=b[0],x=b[1],E=l.spacing.controlHeight;return Sl(function(){var k=u.current;if(k){var C=i==="fixed",N=a&&!C,_=Iw({maxHeight:s,menuEl:k,minHeight:r,placement:o,shouldScroll:N,isFixedPosition:C,controlHeight:E});p(_.maxHeight),x(_.placement),d?.(_.placement)}},[s,o,i,a,r,d,E]),n({ref:u,placerProps:Oe(Oe({},e),{},{placement:S||hf(o),maxHeight:m})})},Fw=function(e){var n=e.children,r=e.innerRef,s=e.innerProps;return Ne("div",De({},yt(e,"menu",{menu:!0}),{ref:r},s),n)},Vw=Fw,zw=function(e,n){var r=e.maxHeight,s=e.theme.spacing.baseUnit;return Oe({maxHeight:r,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},n?{}:{paddingBottom:s,paddingTop:s})},Hw=function(e){var n=e.children,r=e.innerProps,s=e.innerRef,o=e.isMulti;return Ne("div",De({},yt(e,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:s},r),n)},pf=function(e,n){var r=e.theme,s=r.spacing.baseUnit,o=r.colors;return Oe({textAlign:"center"},n?{}:{color:o.neutral40,padding:"".concat(s*2,"px ").concat(s*3,"px")})},Uw=pf,Bw=pf,jw=function(e){var n=e.children,r=n===void 0?"No options":n,s=e.innerProps,o=On(e,Aw);return Ne("div",De({},yt(Oe(Oe({},o),{},{children:r,innerProps:s}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),s),r)},Ww=function(e){var n=e.children,r=n===void 0?"Loading...":n,s=e.innerProps,o=On(e,Dw);return Ne("div",De({},yt(Oe(Oe({},o),{},{children:r,innerProps:s}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),s),r)},Gw=function(e){var n=e.rect,r=e.offset,s=e.position;return{left:n.left,position:s,top:r,width:n.width,zIndex:1}},Yw=function(e){var n=e.appendTo,r=e.children,s=e.controlElement,o=e.innerProps,i=e.menuPlacement,a=e.menuPosition,l=v.useRef(null),c=v.useRef(null),d=v.useState(hf(i)),u=Un(d,2),f=u[0],g=u[1],m=v.useMemo(function(){return{setPortalPlacement:g}},[]),p=v.useState(null),y=Un(p,2),b=y[0],S=y[1],x=v.useCallback(function(){if(s){var N=Sw(s),_=a==="fixed"?0:window.pageYOffset,w=N[f]+_;(w!==b?.offset||N.left!==b?.rect.left||N.width!==b?.rect.width)&&S({offset:w,rect:N})}},[s,a,f,b?.offset,b?.rect.left,b?.rect.width]);Sl(function(){x()},[x]);var E=v.useCallback(function(){typeof c.current=="function"&&(c.current(),c.current=null),s&&l.current&&(c.current=bw(s,l.current,x,{elementResize:"ResizeObserver"in window}))},[s,x]);Sl(function(){E()},[E]);var k=v.useCallback(function(N){l.current=N,E()},[E]);if(!n&&a!=="fixed"||!b)return null;var C=Ne("div",De({ref:k},yt(Oe(Oe({},e),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),o),r);return Ne(gf.Provider,{value:m},n?Nn.createPortal(C,n):C)},Xw=function(e){var n=e.isDisabled,r=e.isRtl;return{label:"container",direction:r?"rtl":void 0,pointerEvents:n?"none":void 0,position:"relative"}},Kw=function(e){var n=e.children,r=e.innerProps,s=e.isDisabled,o=e.isRtl;return Ne("div",De({},yt(e,"container",{"--is-disabled":s,"--is-rtl":o}),r),n)},qw=function(e,n){var r=e.theme.spacing,s=e.isMulti,o=e.hasValue,i=e.selectProps.controlShouldRenderValue;return Oe({alignItems:"center",display:s&&o&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},n?{}:{padding:"".concat(r.baseUnit/2,"px ").concat(r.baseUnit*2,"px")})},Zw=function(e){var n=e.children,r=e.innerProps,s=e.isMulti,o=e.hasValue;return Ne("div",De({},yt(e,"valueContainer",{"value-container":!0,"value-container--is-multi":s,"value-container--has-value":o}),r),n)},Qw=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Jw=function(e){var n=e.children,r=e.innerProps;return Ne("div",De({},yt(e,"indicatorsContainer",{indicators:!0}),r),n)},mf,Rw=["size"],e1=["innerProps","isRtl","size"],t1={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},bf=function(e){var n=e.size,r=On(e,Rw);return Ne("svg",De({height:n,width:n,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:t1},r))},_l=function(e){return Ne(bf,De({size:20},e),Ne("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},yf=function(e){return Ne(bf,De({size:20},e),Ne("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},vf=function(e,n){var r=e.isFocused,s=e.theme,o=s.spacing.baseUnit,i=s.colors;return Oe({label:"indicatorContainer",display:"flex",transition:"color 150ms"},n?{}:{color:r?i.neutral60:i.neutral20,padding:o*2,":hover":{color:r?i.neutral80:i.neutral40}})},n1=vf,r1=function(e){var n=e.children,r=e.innerProps;return Ne("div",De({},yt(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),r),n||Ne(yf,null))},s1=vf,o1=function(e){var n=e.children,r=e.innerProps;return Ne("div",De({},yt(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),r),n||Ne(_l,null))},i1=function(e,n){var r=e.isDisabled,s=e.theme,o=s.spacing.baseUnit,i=s.colors;return Oe({label:"indicatorSeparator",alignSelf:"stretch",width:1},n?{}:{backgroundColor:r?i.neutral10:i.neutral20,marginBottom:o*2,marginTop:o*2})},a1=function(e){var n=e.innerProps;return Ne("span",De({},n,yt(e,"indicatorSeparator",{"indicator-separator":!0})))},l1=tw(mf||(mf=nw([`
|
||
0%, 80%, 100% { opacity: 0; }
|
||
40% { opacity: 1; }
|
||
`]))),c1=function(e,n){var r=e.isFocused,s=e.size,o=e.theme,i=o.colors,a=o.spacing.baseUnit;return Oe({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:s,lineHeight:1,marginRight:s,textAlign:"center",verticalAlign:"middle"},n?{}:{color:r?i.neutral60:i.neutral20,padding:a*2})},El=function(e){var n=e.delay,r=e.offset;return Ne("span",{css:vl({animation:"".concat(l1," 1s ease-in-out ").concat(n,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},d1=function(e){var n=e.innerProps,r=e.isRtl,s=e.size,o=s===void 0?4:s,i=On(e,e1);return Ne("div",De({},yt(Oe(Oe({},i),{},{innerProps:n,isRtl:r,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),n),Ne(El,{delay:0,offset:r}),Ne(El,{delay:160,offset:!0}),Ne(El,{delay:320,offset:!r}))},u1=function(e,n){var r=e.isDisabled,s=e.isFocused,o=e.theme,i=o.colors,a=o.borderRadius,l=o.spacing;return Oe({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},n?{}:{backgroundColor:r?i.neutral5:i.neutral0,borderColor:r?i.neutral10:s?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:s?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:s?i.primary:i.neutral30}})},f1=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,o=e.innerRef,i=e.innerProps,a=e.menuIsOpen;return Ne("div",De({ref:o},yt(e,"control",{control:!0,"control--is-disabled":r,"control--is-focused":s,"control--menu-is-open":a}),i,{"aria-disabled":r||void 0}),n)},h1=f1,g1=["data"],p1=function(e,n){var r=e.theme.spacing;return n?{}:{paddingBottom:r.baseUnit*2,paddingTop:r.baseUnit*2}},m1=function(e){var n=e.children,r=e.cx,s=e.getStyles,o=e.getClassNames,i=e.Heading,a=e.headingProps,l=e.innerProps,c=e.label,d=e.theme,u=e.selectProps;return Ne("div",De({},yt(e,"group",{group:!0}),l),Ne(i,De({},a,{selectProps:u,theme:d,getStyles:s,getClassNames:o,cx:r}),c),Ne("div",null,n))},b1=function(e,n){var r=e.theme,s=r.colors,o=r.spacing;return Oe({label:"group",cursor:"default",display:"block"},n?{}:{color:s.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:o.baseUnit*3,paddingRight:o.baseUnit*3,textTransform:"uppercase"})},y1=function(e){var n=lf(e);n.data;var r=On(n,g1);return Ne("div",De({},yt(e,"groupHeading",{"group-heading":!0}),r))},v1=m1,x1=["innerRef","isDisabled","isHidden","inputClassName"],w1=function(e,n){var r=e.isDisabled,s=e.value,o=e.theme,i=o.spacing,a=o.colors;return Oe(Oe({visibility:r?"hidden":"visible",transform:s?"translateZ(0)":""},k1),n?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},xf={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},k1={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Oe({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},xf)},C1=function(e){return Oe({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},xf)},S1=function(e){var n=e.cx,r=e.value,s=lf(e),o=s.innerRef,i=s.isDisabled,a=s.isHidden,l=s.inputClassName,c=On(s,x1);return Ne("div",De({},yt(e,"input",{"input-container":!0}),{"data-value":r||""}),Ne("input",De({className:n({input:!0},l),ref:o,style:C1(a),disabled:i},c)))},_1=S1,E1=function(e,n){var r=e.theme,s=r.spacing,o=r.borderRadius,i=r.colors;return Oe({label:"multiValue",display:"flex",minWidth:0},n?{}:{backgroundColor:i.neutral10,borderRadius:o/2,margin:s.baseUnit/2})},M1=function(e,n){var r=e.theme,s=r.borderRadius,o=r.colors,i=e.cropWithEllipsis;return Oe({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},n?{}:{borderRadius:s/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},N1=function(e,n){var r=e.theme,s=r.spacing,o=r.borderRadius,i=r.colors,a=e.isFocused;return Oe({alignItems:"center",display:"flex"},n?{}:{borderRadius:o/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:s.baseUnit,paddingRight:s.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},wf=function(e){var n=e.children,r=e.innerProps;return Ne("div",r,n)},O1=wf,T1=wf;function A1(t){var e=t.children,n=t.innerProps;return Ne("div",De({role:"button"},n),e||Ne(_l,{size:14}))}var D1=function(e){var n=e.children,r=e.components,s=e.data,o=e.innerProps,i=e.isDisabled,a=e.removeProps,l=e.selectProps,c=r.Container,d=r.Label,u=r.Remove;return Ne(c,{data:s,innerProps:Oe(Oe({},yt(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),o),selectProps:l},Ne(d,{data:s,innerProps:Oe({},yt(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},n),Ne(u,{data:s,innerProps:Oe(Oe({},yt(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(n||"option")},a),selectProps:l}))},I1=D1,L1=function(e,n){var r=e.isDisabled,s=e.isFocused,o=e.isSelected,i=e.theme,a=i.spacing,l=i.colors;return Oe({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},n?{}:{backgroundColor:o?l.primary:s?l.primary25:"transparent",color:r?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:r?void 0:o?l.primary:l.primary50}})},P1=function(e){var n=e.children,r=e.isDisabled,s=e.isFocused,o=e.isSelected,i=e.innerRef,a=e.innerProps;return Ne("div",De({},yt(e,"option",{option:!0,"option--is-disabled":r,"option--is-focused":s,"option--is-selected":o}),{ref:i,"aria-disabled":r},a),n)},$1=P1,F1=function(e,n){var r=e.theme,s=r.spacing,o=r.colors;return Oe({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},n?{}:{color:o.neutral50,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},V1=function(e){var n=e.children,r=e.innerProps;return Ne("div",De({},yt(e,"placeholder",{placeholder:!0}),r),n)},z1=V1,H1=function(e,n){var r=e.isDisabled,s=e.theme,o=s.spacing,i=s.colors;return Oe({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n?{}:{color:r?i.neutral40:i.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},U1=function(e){var n=e.children,r=e.isDisabled,s=e.innerProps;return Ne("div",De({},yt(e,"singleValue",{"single-value":!0,"single-value--is-disabled":r}),s),n)},B1=U1,fi={ClearIndicator:o1,Control:h1,DropdownIndicator:r1,DownChevron:yf,CrossIcon:_l,Group:v1,GroupHeading:y1,IndicatorsContainer:Jw,IndicatorSeparator:a1,Input:_1,LoadingIndicator:d1,Menu:Vw,MenuList:Hw,MenuPortal:Yw,LoadingMessage:Ww,NoOptionsMessage:jw,MultiValue:I1,MultiValueContainer:O1,MultiValueLabel:T1,MultiValueRemove:A1,Option:$1,Placeholder:z1,SelectContainer:Kw,SingleValue:B1,ValueContainer:Zw},j1=function(e){return Oe(Oe({},fi),e.components)},kf=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function W1(t,e){return!!(t===e||kf(t)&&kf(e))}function G1(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!W1(t[n],e[n]))return!1;return!0}function Y1(t,e){e===void 0&&(e=G1);var n=null;function r(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];if(n&&n.lastThis===this&&e(s,n.lastArgs))return n.lastResult;var i=t.apply(this,s);return n={lastResult:i,lastArgs:s,lastThis:this},i}return r.clear=function(){n=null},r}for(var X1={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},K1=function(e){return Ne("span",De({css:X1},e))},Cf=K1,q1={guidance:function(e){var n=e.isSearchable,r=e.isMulti,s=e.tabSelectsValue,o=e.context,i=e.isInitialFocus;switch(o){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(s?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(e["aria-label"]||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var n=e.action,r=e.label,s=r===void 0?"":r,o=e.labels,i=e.isDisabled;switch(n){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(s,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(o.length>1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return i?"option ".concat(s," is disabled. Select another option."):"option ".concat(s,", selected.");default:return""}},onFocus:function(e){var n=e.context,r=e.focused,s=e.options,o=e.label,i=o===void 0?"":o,a=e.selectValue,l=e.isDisabled,c=e.isSelected,d=e.isAppleDevice,u=function(p,y){return p&&p.length?"".concat(p.indexOf(y)+1," of ").concat(p.length):""};if(n==="value"&&a)return"value ".concat(i," focused, ").concat(u(a,r),".");if(n==="menu"&&d){var f=l?" disabled":"",g="".concat(c?" selected":"").concat(f);return"".concat(i).concat(g,", ").concat(u(s,r),".")}return""},onFilter:function(e){var n=e.inputValue,r=e.resultsMessage;return"".concat(r).concat(n?" for search term "+n:"",".")}},Z1=function(e){var n=e.ariaSelection,r=e.focusedOption,s=e.focusedValue,o=e.focusableOptions,i=e.isFocused,a=e.selectValue,l=e.selectProps,c=e.id,d=e.isAppleDevice,u=l.ariaLiveMessages,f=l.getOptionLabel,g=l.inputValue,m=l.isMulti,p=l.isOptionDisabled,y=l.isSearchable,b=l.menuIsOpen,S=l.options,x=l.screenReaderStatus,E=l.tabSelectsValue,k=l.isLoading,C=l["aria-label"],N=l["aria-live"],_=v.useMemo(function(){return Oe(Oe({},q1),u||{})},[u]),w=v.useMemo(function(){var D="";if(n&&_.onChange){var A=n.option,T=n.options,V=n.removedValue,H=n.removedValues,W=n.value,j=function(Z){return Array.isArray(Z)?null:Z},U=V||A||j(W),B=U?f(U):"",G=T||H||void 0,z=G?G.map(f):[],K=Oe({isDisabled:U&&p(U,a),label:B,labels:z},n);D=_.onChange(K)}return D},[n,_,p,a,f]),M=v.useMemo(function(){var D="",A=r||s,T=!!(r&&a&&a.includes(r));if(A&&_.onFocus){var V={focused:A,label:f(A),isDisabled:p(A,a),isSelected:T,options:o,context:A===r?"menu":"value",selectValue:a,isAppleDevice:d};D=_.onFocus(V)}return D},[r,s,f,p,_,o,a,d]),O=v.useMemo(function(){var D="";if(b&&S.length&&!k&&_.onFilter){var A=x({count:o.length});D=_.onFilter({inputValue:g,resultsMessage:A})}return D},[o,g,b,_,S,x,k]),L=n?.action==="initial-input-focus",$=v.useMemo(function(){var D="";if(_.guidance){var A=s?"value":b?"menu":"input";D=_.guidance({"aria-label":C,context:A,isDisabled:r&&p(r,a),isMulti:m,isSearchable:y,tabSelectsValue:E,isInitialFocus:L})}return D},[C,r,s,m,p,y,b,_,a,E,L]),F=Ne(v.Fragment,null,Ne("span",{id:"aria-selection"},w),Ne("span",{id:"aria-focused"},M),Ne("span",{id:"aria-results"},O),Ne("span",{id:"aria-guidance"},$));return Ne(v.Fragment,null,Ne(Cf,{id:c},L&&F),Ne(Cf,{"aria-live":N,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!L&&F))},Q1=Z1,Ml=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],J1=new RegExp("["+Ml.map(function(t){return t.letters}).join("")+"]","g"),Sf={},Nl=0;Nl<Ml.length;Nl++)for(var Ol=Ml[Nl],Tl=0;Tl<Ol.letters.length;Tl++)Sf[Ol.letters[Tl]]=Ol.base;var _f=function(e){return e.replace(J1,function(n){return Sf[n]})},R1=Y1(_f),Ef=function(e){return e.replace(/^\s+|\s+$/g,"")},ek=function(e){return"".concat(e.label," ").concat(e.value)},tk=function(e){return function(n,r){if(n.data.__isNew__)return!0;var s=Oe({ignoreCase:!0,ignoreAccents:!0,stringify:ek,trim:!0,matchFrom:"any"},e),o=s.ignoreCase,i=s.ignoreAccents,a=s.stringify,l=s.trim,c=s.matchFrom,d=l?Ef(r):r,u=l?Ef(a(n)):a(n);return o&&(d=d.toLowerCase(),u=u.toLowerCase()),i&&(d=R1(d),u=_f(u)),c==="start"?u.substr(0,d.length)===d:u.indexOf(d)>-1}},nk=["innerRef"];function rk(t){var e=t.innerRef,n=On(t,nk),r=Tw(n,"onExited","in","enter","exit","appear");return Ne("input",De({ref:e},r,{css:vl({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var sk=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function ok(t){var e=t.isEnabled,n=t.onBottomArrive,r=t.onBottomLeave,s=t.onTopArrive,o=t.onTopLeave,i=v.useRef(!1),a=v.useRef(!1),l=v.useRef(0),c=v.useRef(null),d=v.useCallback(function(y,b){if(c.current!==null){var S=c.current,x=S.scrollTop,E=S.scrollHeight,k=S.clientHeight,C=c.current,N=b>0,_=E-k-x,w=!1;_>b&&i.current&&(r&&r(y),i.current=!1),N&&a.current&&(o&&o(y),a.current=!1),N&&b>_?(n&&!i.current&&n(y),C.scrollTop=E,w=!0,i.current=!0):!N&&-b>x&&(s&&!a.current&&s(y),C.scrollTop=0,w=!0,a.current=!0),w&&sk(y)}},[n,r,s,o]),u=v.useCallback(function(y){d(y,y.deltaY)},[d]),f=v.useCallback(function(y){l.current=y.changedTouches[0].clientY},[]),g=v.useCallback(function(y){var b=l.current-y.changedTouches[0].clientY;d(y,b)},[d]),m=v.useCallback(function(y){if(y){var b=Mw?{passive:!1}:!1;y.addEventListener("wheel",u,b),y.addEventListener("touchstart",f,b),y.addEventListener("touchmove",g,b)}},[g,f,u]),p=v.useCallback(function(y){y&&(y.removeEventListener("wheel",u,!1),y.removeEventListener("touchstart",f,!1),y.removeEventListener("touchmove",g,!1))},[g,f,u]);return v.useEffect(function(){if(e){var y=c.current;return m(y),function(){p(y)}}},[e,m,p]),function(y){c.current=y}}var Mf=["boxSizing","height","overflow","paddingRight","position"],Nf={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Of(t){t.cancelable&&t.preventDefault()}function Tf(t){t.stopPropagation()}function Af(){var t=this.scrollTop,e=this.scrollHeight,n=t+this.offsetHeight;t===0?this.scrollTop=1:n===e&&(this.scrollTop=t-1)}function Df(){return"ontouchstart"in window||navigator.maxTouchPoints}var If=!!(typeof window<"u"&&window.document&&window.document.createElement),Fs=0,Wr={capture:!1,passive:!1};function ik(t){var e=t.isEnabled,n=t.accountForScrollbars,r=n===void 0?!0:n,s=v.useRef({}),o=v.useRef(null),i=v.useCallback(function(l){if(If){var c=document.body,d=c&&c.style;if(r&&Mf.forEach(function(m){var p=d&&d[m];s.current[m]=p}),r&&Fs<1){var u=parseInt(s.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,g=window.innerWidth-f+u||0;Object.keys(Nf).forEach(function(m){var p=Nf[m];d&&(d[m]=p)}),d&&(d.paddingRight="".concat(g,"px"))}c&&Df()&&(c.addEventListener("touchmove",Of,Wr),l&&(l.addEventListener("touchstart",Af,Wr),l.addEventListener("touchmove",Tf,Wr))),Fs+=1}},[r]),a=v.useCallback(function(l){if(If){var c=document.body,d=c&&c.style;Fs=Math.max(Fs-1,0),r&&Fs<1&&Mf.forEach(function(u){var f=s.current[u];d&&(d[u]=f)}),c&&Df()&&(c.removeEventListener("touchmove",Of,Wr),l&&(l.removeEventListener("touchstart",Af,Wr),l.removeEventListener("touchmove",Tf,Wr)))}},[r]);return v.useEffect(function(){if(e){var l=o.current;return i(l),function(){a(l)}}},[e,i,a]),function(l){o.current=l}}var ak=function(e){var n=e.target;return n.ownerDocument.activeElement&&n.ownerDocument.activeElement.blur()},lk={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function ck(t){var e=t.children,n=t.lockEnabled,r=t.captureEnabled,s=r===void 0?!0:r,o=t.onBottomArrive,i=t.onBottomLeave,a=t.onTopArrive,l=t.onTopLeave,c=ok({isEnabled:s,onBottomArrive:o,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),d=ik({isEnabled:n}),u=function(g){c(g),d(g)};return Ne(v.Fragment,null,n&&Ne("div",{onClick:ak,css:lk}),e(u))}var dk={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},uk=function(e){var n=e.name,r=e.onFocus;return Ne("input",{required:!0,name:n,tabIndex:-1,"aria-hidden":"true",onFocus:r,css:dk,value:"",onChange:function(){}})},fk=uk;function Al(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function hk(){return Al(/^iPhone/i)}function Lf(){return Al(/^Mac/i)}function gk(){return Al(/^iPad/i)||Lf()&&navigator.maxTouchPoints>1}function pk(){return hk()||gk()}function mk(){return Lf()||pk()}var bk=function(e){return e.label},Pf=function(e){return e.label},$f=function(e){return e.value},yk=function(e){return!!e.isDisabled},vk={clearIndicator:s1,container:Xw,control:u1,dropdownIndicator:n1,group:p1,groupHeading:b1,indicatorsContainer:Qw,indicatorSeparator:i1,input:w1,loadingIndicator:c1,loadingMessage:Bw,menu:Pw,menuList:zw,menuPortal:Gw,multiValue:E1,multiValueLabel:M1,multiValueRemove:N1,noOptionsMessage:Uw,option:L1,placeholder:F1,singleValue:H1,valueContainer:qw},xk={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},wk=4,Ff=4,kk=38,Ck=Ff*2,Sk={baseUnit:Ff,controlHeight:kk,menuGutter:Ck},Dl={borderRadius:wk,colors:xk,spacing:Sk},_k={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:uf(),captureMenuScroll:!uf(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:tk(),formatGroupLabel:bk,getOptionLabel:Pf,getOptionValue:$f,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:yk,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!_w(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var n=e.count;return"".concat(n," result").concat(n!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Vf(t,e,n,r){var s=jf(t,e,n),o=Wf(t,e,n),i=Bf(t,e),a=gi(t,e);return{type:"option",data:e,isDisabled:s,isSelected:o,label:i,value:a,index:r}}function hi(t,e){return t.options.map(function(n,r){if("options"in n){var s=n.options.map(function(i,a){return Vf(t,i,e,a)}).filter(function(i){return Uf(t,i)});return s.length>0?{type:"group",data:n,options:s,index:r}:void 0}var o=Vf(t,n,e,r);return Uf(t,o)?o:void 0}).filter(Nw)}function zf(t){return t.reduce(function(e,n){return n.type==="group"?e.push.apply(e,Hr(n.options.map(function(r){return r.data}))):e.push(n.data),e},[])}function Hf(t,e){return t.reduce(function(n,r){return r.type==="group"?n.push.apply(n,Hr(r.options.map(function(s){return{data:s.data,id:"".concat(e,"-").concat(r.index,"-").concat(s.index)}}))):n.push({data:r.data,id:"".concat(e,"-").concat(r.index)}),n},[])}function Ek(t,e){return zf(hi(t,e))}function Uf(t,e){var n=t.inputValue,r=n===void 0?"":n,s=e.data,o=e.isSelected,i=e.label,a=e.value;return(!Yf(t)||!o)&&Gf(t,{label:i,value:a,data:s},r)}function Mk(t,e){var n=t.focusedValue,r=t.selectValue,s=r.indexOf(n);if(s>-1){var o=e.indexOf(n);if(o>-1)return n;if(s<e.length)return e[s]}return null}function Nk(t,e){var n=t.focusedOption;return n&&e.indexOf(n)>-1?n:e[0]}var Il=function(e,n){var r,s=(r=e.find(function(o){return o.data===n}))===null||r===void 0?void 0:r.id;return s||null},Bf=function(e,n){return e.getOptionLabel(n)},gi=function(e,n){return e.getOptionValue(n)};function jf(t,e,n){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,n):!1}function Wf(t,e,n){if(n.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,n);var r=gi(t,e);return n.some(function(s){return gi(t,s)===r})}function Gf(t,e,n){return t.filterOption?t.filterOption(e,n):!0}var Yf=function(e){var n=e.hideSelectedOptions,r=e.isMulti;return n===void 0?r:n},Ok=1,Ll=(function(t){Jv(n,t);var e=tx(n);function n(r){var s;if(Zv(this,n),s=e.call(this,r),s.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},s.blockOptionHover=!1,s.isComposing=!1,s.commonProps=void 0,s.initialTouchX=0,s.initialTouchY=0,s.openAfterFocus=!1,s.scrollToFocusedOptionOnUpdate=!1,s.userIsDragging=void 0,s.controlRef=null,s.getControlRef=function(l){s.controlRef=l},s.focusedOptionRef=null,s.getFocusedOptionRef=function(l){s.focusedOptionRef=l},s.menuListRef=null,s.getMenuListRef=function(l){s.menuListRef=l},s.inputRef=null,s.getInputRef=function(l){s.inputRef=l},s.focus=s.focusInput,s.blur=s.blurInput,s.onChange=function(l,c){var d=s.props,u=d.onChange,f=d.name;c.name=f,s.ariaOnChange(l,c),u(l,c)},s.setValue=function(l,c,d){var u=s.props,f=u.closeMenuOnSelect,g=u.isMulti,m=u.inputValue;s.onInputChange("",{action:"set-value",prevInputValue:m}),f&&(s.setState({inputIsHiddenAfterUpdate:!g}),s.onMenuClose()),s.setState({clearFocusValueOnUpdate:!0}),s.onChange(l,{action:c,option:d})},s.selectOption=function(l){var c=s.props,d=c.blurInputOnSelect,u=c.isMulti,f=c.name,g=s.state.selectValue,m=u&&s.isOptionSelected(l,g),p=s.isOptionDisabled(l,g);if(m){var y=s.getOptionValue(l);s.setValue(g.filter(function(b){return s.getOptionValue(b)!==y}),"deselect-option",l)}else if(!p)u?s.setValue([].concat(Hr(g),[l]),"select-option",l):s.setValue(l,"select-option");else{s.ariaOnChange(l,{action:"select-option",option:l,name:f});return}d&&s.blurInput()},s.removeValue=function(l){var c=s.props.isMulti,d=s.state.selectValue,u=s.getOptionValue(l),f=d.filter(function(m){return s.getOptionValue(m)!==u}),g=$s(c,f,f[0]||null);s.onChange(g,{action:"remove-value",removedValue:l}),s.focusInput()},s.clearValue=function(){var l=s.state.selectValue;s.onChange($s(s.props.isMulti,[],null),{action:"clear",removedValues:l})},s.popValue=function(){var l=s.props.isMulti,c=s.state.selectValue,d=c[c.length-1],u=c.slice(0,c.length-1),f=$s(l,u,u[0]||null);d&&s.onChange(f,{action:"pop-value",removedValue:d})},s.getFocusedOptionId=function(l){return Il(s.state.focusableOptionsWithIds,l)},s.getFocusableOptionsWithIds=function(){return Hf(hi(s.props,s.state.selectValue),s.getElementId("option"))},s.getValue=function(){return s.state.selectValue},s.cx=function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];return xw.apply(void 0,[s.props.classNamePrefix].concat(c))},s.getOptionLabel=function(l){return Bf(s.props,l)},s.getOptionValue=function(l){return gi(s.props,l)},s.getStyles=function(l,c){var d=s.props.unstyled,u=vk[l](c,d);u.boxSizing="border-box";var f=s.props.styles[l];return f?f(u,c):u},s.getClassNames=function(l,c){var d,u;return(d=(u=s.props.classNames)[l])===null||d===void 0?void 0:d.call(u,c)},s.getElementId=function(l){return"".concat(s.state.instancePrefix,"-").concat(l)},s.getComponents=function(){return j1(s.props)},s.buildCategorizedOptions=function(){return hi(s.props,s.state.selectValue)},s.getCategorizedOptions=function(){return s.props.menuIsOpen?s.buildCategorizedOptions():[]},s.buildFocusableOptions=function(){return zf(s.buildCategorizedOptions())},s.getFocusableOptions=function(){return s.props.menuIsOpen?s.buildFocusableOptions():[]},s.ariaOnChange=function(l,c){s.setState({ariaSelection:Oe({value:l},c)})},s.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),s.focusInput())},s.onMenuMouseMove=function(l){s.blockOptionHover=!1},s.onControlMouseDown=function(l){if(!l.defaultPrevented){var c=s.props.openMenuOnClick;s.state.isFocused?s.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&s.onMenuClose():c&&s.openMenu("first"):(c&&(s.openAfterFocus=!0),s.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},s.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!s.props.isDisabled){var c=s.props,d=c.isMulti,u=c.menuIsOpen;s.focusInput(),u?(s.setState({inputIsHiddenAfterUpdate:!d}),s.onMenuClose()):s.openMenu("first"),l.preventDefault()}},s.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(s.clearValue(),l.preventDefault(),s.openAfterFocus=!1,l.type==="touchend"?s.focusInput():setTimeout(function(){return s.focusInput()}))},s.onScroll=function(l){typeof s.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&li(l.target)&&s.props.onMenuClose():typeof s.props.closeMenuOnScroll=="function"&&s.props.closeMenuOnScroll(l)&&s.props.onMenuClose()},s.onCompositionStart=function(){s.isComposing=!0},s.onCompositionEnd=function(){s.isComposing=!1},s.onTouchStart=function(l){var c=l.touches,d=c&&c.item(0);d&&(s.initialTouchX=d.clientX,s.initialTouchY=d.clientY,s.userIsDragging=!1)},s.onTouchMove=function(l){var c=l.touches,d=c&&c.item(0);if(d){var u=Math.abs(d.clientX-s.initialTouchX),f=Math.abs(d.clientY-s.initialTouchY),g=5;s.userIsDragging=u>g||f>g}},s.onTouchEnd=function(l){s.userIsDragging||(s.controlRef&&!s.controlRef.contains(l.target)&&s.menuListRef&&!s.menuListRef.contains(l.target)&&s.blurInput(),s.initialTouchX=0,s.initialTouchY=0)},s.onControlTouchEnd=function(l){s.userIsDragging||s.onControlMouseDown(l)},s.onClearIndicatorTouchEnd=function(l){s.userIsDragging||s.onClearIndicatorMouseDown(l)},s.onDropdownIndicatorTouchEnd=function(l){s.userIsDragging||s.onDropdownIndicatorMouseDown(l)},s.handleInputChange=function(l){var c=s.props.inputValue,d=l.currentTarget.value;s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange(d,{action:"input-change",prevInputValue:c}),s.props.menuIsOpen||s.onMenuOpen()},s.onInputFocus=function(l){s.props.onFocus&&s.props.onFocus(l),s.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(s.openAfterFocus||s.props.openMenuOnFocus)&&s.openMenu("first"),s.openAfterFocus=!1},s.onInputBlur=function(l){var c=s.props.inputValue;if(s.menuListRef&&s.menuListRef.contains(document.activeElement)){s.inputRef.focus();return}s.props.onBlur&&s.props.onBlur(l),s.onInputChange("",{action:"input-blur",prevInputValue:c}),s.onMenuClose(),s.setState({focusedValue:null,isFocused:!1})},s.onOptionHover=function(l){if(!(s.blockOptionHover||s.state.focusedOption===l)){var c=s.getFocusableOptions(),d=c.indexOf(l);s.setState({focusedOption:l,focusedOptionId:d>-1?s.getFocusedOptionId(l):null})}},s.shouldHideSelectedOptions=function(){return Yf(s.props)},s.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),s.focus()},s.onKeyDown=function(l){var c=s.props,d=c.isMulti,u=c.backspaceRemovesValue,f=c.escapeClearsValue,g=c.inputValue,m=c.isClearable,p=c.isDisabled,y=c.menuIsOpen,b=c.onKeyDown,S=c.tabSelectsValue,x=c.openMenuOnFocus,E=s.state,k=E.focusedOption,C=E.focusedValue,N=E.selectValue;if(!p&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(s.blockOptionHover=!0,l.key){case"ArrowLeft":if(!d||g)return;s.focusValue("previous");break;case"ArrowRight":if(!d||g)return;s.focusValue("next");break;case"Delete":case"Backspace":if(g)return;if(C)s.removeValue(C);else{if(!u)return;d?s.popValue():m&&s.clearValue()}break;case"Tab":if(s.isComposing||l.shiftKey||!y||!S||!k||x&&s.isOptionSelected(k,N))return;s.selectOption(k);break;case"Enter":if(l.keyCode===229)break;if(y){if(!k||s.isComposing)return;s.selectOption(k);break}return;case"Escape":y?(s.setState({inputIsHiddenAfterUpdate:!1}),s.onInputChange("",{action:"menu-close",prevInputValue:g}),s.onMenuClose()):m&&f&&s.clearValue();break;case" ":if(g)return;if(!y){s.openMenu("first");break}if(!k)return;s.selectOption(k);break;case"ArrowUp":y?s.focusOption("up"):s.openMenu("last");break;case"ArrowDown":y?s.focusOption("down"):s.openMenu("first");break;case"PageUp":if(!y)return;s.focusOption("pageup");break;case"PageDown":if(!y)return;s.focusOption("pagedown");break;case"Home":if(!y)return;s.focusOption("first");break;case"End":if(!y)return;s.focusOption("last");break;default:return}l.preventDefault()}},s.state.instancePrefix="react-select-"+(s.props.instanceId||++Ok),s.state.selectValue=ai(r.value),r.menuIsOpen&&s.state.selectValue.length){var o=s.getFocusableOptionsWithIds(),i=s.buildFocusableOptions(),a=i.indexOf(s.state.selectValue[0]);s.state.focusableOptionsWithIds=o,s.state.focusedOption=i[a],s.state.focusedOptionId=Il(o,i[a])}return s}return Qv(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&df(this.menuListRef,this.focusedOptionRef),mk()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(s){var o=this.props,i=o.isDisabled,a=o.menuIsOpen,l=this.state.isFocused;(l&&!i&&s.isDisabled||l&&a&&!s.menuIsOpen)&&this.focusInput(),l&&i&&!s.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&s.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(df(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(s,o){this.props.onInputChange(s,o)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(s){var o=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),d=s==="first"?0:c.length-1;if(!this.props.isMulti){var u=c.indexOf(a[0]);u>-1&&(d=u)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[d],focusedOptionId:this.getFocusedOptionId(c[d])},function(){return o.onMenuOpen()})}},{key:"focusValue",value:function(s){var o=this.state,i=o.selectValue,a=o.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,d=-1;if(i.length){switch(s){case"previous":l===0?d=0:l===-1?d=c:d=l-1;break;case"next":l>-1&&l<c&&(d=l+1);break}this.setState({inputIsHidden:d!==-1,focusedValue:i[d]})}}}},{key:"focusOption",value:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",o=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),s==="up"?l=c>0?c-1:a.length-1:s==="down"?l=(c+1)%a.length:s==="pageup"?(l=c-o,l<0&&(l=0)):s==="pagedown"?(l=c+o,l>a.length-1&&(l=a.length-1)):s==="last"&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Dl):Oe(Oe({},Dl),this.props.theme):Dl})},{key:"getCommonProps",value:function(){var s=this.clearValue,o=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,d=this.setValue,u=this.props,f=u.isMulti,g=u.isRtl,m=u.options,p=this.hasValue();return{clearValue:s,cx:o,getStyles:i,getClassNames:a,getValue:l,hasValue:p,isMulti:f,isRtl:g,options:m,selectOption:c,selectProps:u,setValue:d,theme:this.getTheme()}}},{key:"hasValue",value:function(){var s=this.state.selectValue;return s.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var s=this.props,o=s.isClearable,i=s.isMulti;return o===void 0?i:o}},{key:"isOptionDisabled",value:function(s,o){return jf(this.props,s,o)}},{key:"isOptionSelected",value:function(s,o){return Wf(this.props,s,o)}},{key:"filterOption",value:function(s,o){return Gf(this.props,s,o)}},{key:"formatOptionLabel",value:function(s,o){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(s,{context:o,inputValue:i,selectValue:a})}else return this.getOptionLabel(s)}},{key:"formatGroupLabel",value:function(s){return this.props.formatGroupLabel(s)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var s=this.props,o=s.isDisabled,i=s.isSearchable,a=s.inputId,l=s.inputValue,c=s.tabIndex,d=s.form,u=s.menuIsOpen,f=s.required,g=this.getComponents(),m=g.Input,p=this.state,y=p.inputIsHidden,b=p.ariaSelection,S=this.commonProps,x=a||this.getElementId("input"),E=Oe(Oe(Oe({"aria-autocomplete":"list","aria-expanded":u,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":f,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},u&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?P.createElement(m,De({},S,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:x,innerRef:this.getInputRef,isDisabled:o,isHidden:y,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:d,type:"text",value:l},E)):P.createElement(rk,De({id:x,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:ii,onFocus:this.onInputFocus,disabled:o,tabIndex:c,inputMode:"none",form:d,value:""},E))})},{key:"renderPlaceholderOrValue",value:function(){var s=this,o=this.getComponents(),i=o.MultiValue,a=o.MultiValueContainer,l=o.MultiValueLabel,c=o.MultiValueRemove,d=o.SingleValue,u=o.Placeholder,f=this.commonProps,g=this.props,m=g.controlShouldRenderValue,p=g.isDisabled,y=g.isMulti,b=g.inputValue,S=g.placeholder,x=this.state,E=x.selectValue,k=x.focusedValue,C=x.isFocused;if(!this.hasValue()||!m)return b?null:P.createElement(u,De({},f,{key:"placeholder",isDisabled:p,isFocused:C,innerProps:{id:this.getElementId("placeholder")}}),S);if(y)return E.map(function(_,w){var M=_===k,O="".concat(s.getOptionLabel(_),"-").concat(s.getOptionValue(_));return P.createElement(i,De({},f,{components:{Container:a,Label:l,Remove:c},isFocused:M,isDisabled:p,key:O,index:w,removeProps:{onClick:function(){return s.removeValue(_)},onTouchEnd:function(){return s.removeValue(_)},onMouseDown:function($){$.preventDefault()}},data:_}),s.formatOptionLabel(_,"value"))});if(b)return null;var N=E[0];return P.createElement(d,De({},f,{data:N,isDisabled:p}),this.formatOptionLabel(N,"value"))}},{key:"renderClearIndicator",value:function(){var s=this.getComponents(),o=s.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!this.isClearable()||!o||l||!this.hasValue()||c)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return P.createElement(o,De({},i,{innerProps:u,isFocused:d}))}},{key:"renderLoadingIndicator",value:function(){var s=this.getComponents(),o=s.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,d=this.state.isFocused;if(!o||!c)return null;var u={"aria-hidden":"true"};return P.createElement(o,De({},i,{innerProps:u,isDisabled:l,isFocused:d}))}},{key:"renderIndicatorSeparator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator,i=s.IndicatorSeparator;if(!o||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return P.createElement(i,De({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var s=this.getComponents(),o=s.DropdownIndicator;if(!o)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return P.createElement(o,De({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var s=this,o=this.getComponents(),i=o.Group,a=o.GroupHeading,l=o.Menu,c=o.MenuList,d=o.MenuPortal,u=o.LoadingMessage,f=o.NoOptionsMessage,g=o.Option,m=this.commonProps,p=this.state.focusedOption,y=this.props,b=y.captureMenuScroll,S=y.inputValue,x=y.isLoading,E=y.loadingMessage,k=y.minMenuHeight,C=y.maxMenuHeight,N=y.menuIsOpen,_=y.menuPlacement,w=y.menuPosition,M=y.menuPortalTarget,O=y.menuShouldBlockScroll,L=y.menuShouldScrollIntoView,$=y.noOptionsMessage,F=y.onMenuScrollToTop,D=y.onMenuScrollToBottom;if(!N)return null;var A=function(B,G){var z=B.type,K=B.data,X=B.isDisabled,Z=B.isSelected,ee=B.label,ne=B.value,he=p===K,J=X?void 0:function(){return s.onOptionHover(K)},ce=X?void 0:function(){return s.selectOption(K)},ue="".concat(s.getElementId("option"),"-").concat(G),ie={id:ue,onClick:ce,onMouseMove:J,onMouseOver:J,tabIndex:-1,role:"option","aria-selected":s.state.isAppleDevice?void 0:Z};return P.createElement(g,De({},m,{innerProps:ie,data:K,isDisabled:X,isSelected:Z,key:ue,label:ee,type:z,value:ne,isFocused:he,innerRef:he?s.getFocusedOptionRef:void 0}),s.formatOptionLabel(B.data,"menu"))},T;if(this.hasOptions())T=this.getCategorizedOptions().map(function(U){if(U.type==="group"){var B=U.data,G=U.options,z=U.index,K="".concat(s.getElementId("group"),"-").concat(z),X="".concat(K,"-heading");return P.createElement(i,De({},m,{key:K,data:B,options:G,Heading:a,headingProps:{id:X,data:U.data},label:s.formatGroupLabel(U.data)}),U.options.map(function(Z){return A(Z,"".concat(z,"-").concat(Z.index))}))}else if(U.type==="option")return A(U,"".concat(U.index))});else if(x){var V=E({inputValue:S});if(V===null)return null;T=P.createElement(u,m,V)}else{var H=$({inputValue:S});if(H===null)return null;T=P.createElement(f,m,H)}var W={minMenuHeight:k,maxMenuHeight:C,menuPlacement:_,menuPosition:w,menuShouldScrollIntoView:L},j=P.createElement($w,De({},m,W),function(U){var B=U.ref,G=U.placerProps,z=G.placement,K=G.maxHeight;return P.createElement(l,De({},m,W,{innerRef:B,innerProps:{onMouseDown:s.onMenuMouseDown,onMouseMove:s.onMenuMouseMove},isLoading:x,placement:z}),P.createElement(ck,{captureEnabled:b,onTopArrive:F,onBottomArrive:D,lockEnabled:O},function(X){return P.createElement(c,De({},m,{innerRef:function(ee){s.getMenuListRef(ee),X(ee)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:s.getElementId("listbox")},isLoading:x,maxHeight:K,focusedOption:p}),T)}))});return M||w==="fixed"?P.createElement(d,De({},m,{appendTo:M,controlElement:this.controlRef,menuPlacement:_,menuPosition:w}),j):j}},{key:"renderFormField",value:function(){var s=this,o=this.props,i=o.delimiter,a=o.isDisabled,l=o.isMulti,c=o.name,d=o.required,u=this.state.selectValue;if(d&&!this.hasValue()&&!a)return P.createElement(fk,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=u.map(function(p){return s.getOptionValue(p)}).join(i);return P.createElement("input",{name:c,type:"hidden",value:f})}else{var g=u.length>0?u.map(function(p,y){return P.createElement("input",{key:"i-".concat(y),name:c,type:"hidden",value:s.getOptionValue(p)})}):P.createElement("input",{name:c,type:"hidden",value:""});return P.createElement("div",null,g)}else{var m=u[0]?this.getOptionValue(u[0]):"";return P.createElement("input",{name:c,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var s=this.commonProps,o=this.state,i=o.ariaSelection,a=o.focusedOption,l=o.focusedValue,c=o.isFocused,d=o.selectValue,u=this.getFocusableOptions();return P.createElement(Q1,De({},s,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:d,focusableOptions:u,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var s=this.getComponents(),o=s.Control,i=s.IndicatorsContainer,a=s.SelectContainer,l=s.ValueContainer,c=this.props,d=c.className,u=c.id,f=c.isDisabled,g=c.menuIsOpen,m=this.state.isFocused,p=this.commonProps=this.getCommonProps();return P.createElement(a,De({},p,{className:d,innerProps:{id:u,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:m}),this.renderLiveRegion(),P.createElement(o,De({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:m,menuIsOpen:g}),P.createElement(l,De({},p,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),P.createElement(i,De({},p,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(s,o){var i=o.prevProps,a=o.clearFocusValueOnUpdate,l=o.inputIsHiddenAfterUpdate,c=o.ariaSelection,d=o.isFocused,u=o.prevWasFocused,f=o.instancePrefix,g=s.options,m=s.value,p=s.menuIsOpen,y=s.inputValue,b=s.isMulti,S=ai(m),x={};if(i&&(m!==i.value||g!==i.options||p!==i.menuIsOpen||y!==i.inputValue)){var E=p?Ek(s,S):[],k=p?Hf(hi(s,S),"".concat(f,"-option")):[],C=a?Mk(o,S):null,N=Nk(o,E),_=Il(k,N);x={selectValue:S,focusedOption:N,focusedOptionId:_,focusableOptionsWithIds:k,focusedValue:C,clearFocusValueOnUpdate:!1}}var w=l!=null&&s!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},M=c,O=d&&u;return d&&!O&&(M={value:$s(b,S,S[0]||null),options:S,action:"initial-input-focus"},O=!u),c?.action==="initial-input-focus"&&(M=null),Oe(Oe(Oe({},x),w),{},{prevProps:s,ariaSelection:M,prevWasFocused:O})}}]),n})(v.Component);Ll.defaultProps=_k;var Tk=v.forwardRef(function(t,e){var n=Ou(t);return P.createElement(Ll,De({ref:e},n))}),Xf=Tk,Ak=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],Kf=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,s=String(e).toLowerCase(),o=String(r.getOptionValue(n)).toLowerCase(),i=String(r.getOptionLabel(n)).toLowerCase();return o===s||i===s},Pl={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,n,r,s){return!(!e||n.some(function(o){return Kf(e,o,s)})||r.some(function(o){return Kf(e,o,s)}))},getNewOptionData:function(e,n){return{label:n,value:e,__isNew__:!0}}};function Dk(t){var e=t.allowCreateWhileLoading,n=e===void 0?!1:e,r=t.createOptionPosition,s=r===void 0?"last":r,o=t.formatCreateLabel,i=o===void 0?Pl.formatCreateLabel:o,a=t.isValidNewOption,l=a===void 0?Pl.isValidNewOption:a,c=t.getNewOptionData,d=c===void 0?Pl.getNewOptionData:c,u=t.onCreateOption,f=t.options,g=f===void 0?[]:f,m=t.onChange,p=On(t,Ak),y=p.getOptionValue,b=y===void 0?$f:y,S=p.getOptionLabel,x=S===void 0?Pf:S,E=p.inputValue,k=p.isLoading,C=p.isMulti,N=p.value,_=p.name,w=v.useMemo(function(){return l(E,ai(N),g,{getOptionValue:b,getOptionLabel:x})?d(E,i(E)):void 0},[i,d,x,b,E,l,g,N]),M=v.useMemo(function(){return(n||!k)&&w?s==="first"?[w].concat(Hr(g)):[].concat(Hr(g),[w]):g},[n,s,k,w,g]),O=v.useCallback(function(L,$){if($.action!=="select-option")return m(L,$);var F=Array.isArray(L)?L:[L];if(F[F.length-1]===w){if(u)u(E);else{var D=d(E,E),A={action:"create-option",name:_,option:D};m($s(C,[].concat(Hr(ai(N)),[D]),D),A)}return}m(L,$)},[d,E,C,_,w,u,m,N]);return Oe(Oe({},p),{},{options:M,onChange:O})}var Ik=v.forwardRef(function(t,e){var n=Ou(t),r=Dk(n);return P.createElement(Ll,De({ref:e},r))}),qf=Ik;const Lt={control:"input-tag",valueContainer:"gap-1 flex flex-wrap",multiValue:{blue:"bg-blue-100 dark:bg-blue-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",green:"bg-green-100 dark:bg-green-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",amber:"bg-amber-100 dark:bg-amber-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",red:"bg-red-100 dark:bg-red-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",purple:"bg-purple-100 dark:bg-purple-900/20 rounded px-1.5 py-0.5 flex items-center gap-1",gray:"bg-gray-100 dark:bg-gray-700/50 rounded px-1.5 py-0.5 flex items-center gap-1"},multiValueLabel:{blue:"text-blue-700 dark:text-blue-300 text-xs",green:"text-green-700 dark:text-green-300 text-xs font-semibold",amber:"text-amber-700 dark:text-amber-300 text-xs font-semibold",red:"text-red-700 dark:text-red-300 text-xs font-semibold",purple:"text-purple-700 dark:text-purple-300 text-xs font-semibold",gray:"text-gray-700 dark:text-gray-300 text-xs"},multiValueRemove:{blue:"text-blue-700 dark:text-blue-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",green:"text-green-700 dark:text-green-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",amber:"text-amber-700 dark:text-amber-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",red:"text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",purple:"text-purple-700 dark:text-purple-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1",gray:"text-gray-700 dark:text-gray-300 hover:bg-red-100 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400 rounded px-1"},input:"text-gray-900 dark:text-white text-sm",placeholder:"text-gray-400 dark:text-gray-500 text-sm",menu:"mt-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg",menuList:"py-1",option:{base:"px-3 py-2 cursor-pointer text-gray-900 dark:text-white text-[13px]",selected:"bg-blue-100 dark:bg-blue-900/20",focused:"bg-gray-100 dark:bg-gray-700",default:"bg-white dark:bg-gray-800"},noOptionsMessage:"px-3 py-2 text-gray-500 dark:text-gray-400 text-[13px]",checkbox:{base:"w-4 h-4 rounded border flex items-center justify-center text-white text-[10px] shrink-0",selected:"bg-blue-500 border-blue-500",unselected:"border-gray-400 dark:border-gray-500"}},Zf=t=>{const{data:e,isSelected:n}=t;return h.jsx(fi.Option,{...t,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:`${Lt.checkbox.base} ${n?Lt.checkbox.selected:Lt.checkbox.unselected}`,children:n?"✓":""}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"text-[13px]",children:e.label}),e.count!==void 0&&e.count>0&&h.jsxs("span",{className:"text-gray-500 dark:text-gray-400 text-[10px]",children:["(",e.count,")"]})]}),e.description&&h.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.description})]})]})})},Qf=t=>h.jsx(fi.GroupHeading,{...t,children:h.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 border-b border-gray-200 dark:border-gray-700",children:t.data.label})}),Lk=t=>{const{data:e}=t;return h.jsxs(fi.MultiValueLabel,{...t,children:[h.jsx("span",{children:e.label}),e.count!==void 0&&e.count>0&&h.jsxs("span",{className:"text-xs opacity-60 ml-1",children:["(",e.count,")"]})]})},Pk=({value:t,options:e=[],onChange:n,creatable:r=!1,placeholder:s="검색 또는 입력...",noOptionsMessage:o="검색 결과가 없습니다",formatCreateLabel:i,createLabelSuffix:a="추가",maxItems:l,disabled:c=!1,onBeforeRemove:d,onCreateOption:u,className:f="",tagVariants:g,defaultVariant:m="blue",name:p,isMulti:y=!0,isClearable:b=!0,isSearchable:S=!0,delimiters:x=[","],splitOnPaste:E=!0,onInputChange:k,id:C,editorAttrs:N})=>{const _=c===!0||c==="true",w=v.useCallback(J=>J==null?[]:Array.isArray(J)?J:[J],[]),[M,O]=v.useState(()=>w(t)),[L,$]=v.useState(""),F=v.useRef(void 0);v.useEffect(()=>{const J=(ue,ie)=>!ue&&!ie?!0:!ue||!ie||ue.length!==ie.length?!1:ue.every((ve,fe)=>ve===ie[fe]),ce=w(t);J(ce,F.current)||(O(ce),F.current=ce)},[t,w]);const D=v.useMemo(()=>i?typeof i=="string"?J=>`${i} "${J}"`:i:J=>h.jsxs("span",{className:"text-[13px]",children:[h.jsx("strong",{children:J})," ",a]}),[i,a]),A=v.useMemo(()=>!M||!Array.isArray(M)?[]:M.map(J=>e.find(ue=>ue.value===J)||{value:J,label:String(J)}).filter(J=>J!==void 0),[M,e]),T=v.useMemo(()=>{const J=new Set(e.map(Se=>Se.value)),ce=M?M.filter(Se=>!J.has(Se)).map(Se=>({value:Se,label:String(Se)})):[],ue=[...e,...ce];if(!ue.some(Se=>Se.group))return ue;const ve=new Map,fe=[];ue.forEach(Se=>{if(Se.group){const He=ve.get(Se.group)||[];He.push(Se),ve.set(Se.group,He)}else fe.push(Se)});const ye=[];return ve.forEach((Se,He)=>{ye.push({label:He,options:Se})}),fe.length>0&&ye.push({label:"",options:fe}),ye},[e,M]),V=v.useCallback(J=>({target:{value:J},currentTarget:{value:J},preventDefault:()=>{},stopPropagation:()=>{}}),[]),H=v.useCallback(J=>{if(!x?.length)return[J.trim()].filter(Boolean);const ce=x.map(ie=>ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ue=new RegExp(`[${ce.join("")}]`);return J.split(ue).map(ie=>ie.trim()).filter(Boolean)},[x]),W=v.useCallback((J,ce)=>{if(ce.action!=="input-change"){$(J);return}if(k&&k(V(J)),!x?.some(fe=>J.includes(fe))||!r||!y){$(J);return}const ve=H(J).filter(fe=>fe&&!M.includes(fe));if(ve.length>0){const fe=l?l-M.length:1/0,ye=ve.slice(0,fe);if(ye.length>0){const Se=[...M,...ye];O(Se),n(V(Se))}}$("")},[x,r,y,H,M,l,n,V,k]),j=v.useCallback(J=>{if(!E||!r||!y)return;const ce=J.clipboardData.getData("text"),ue=H(ce);if(ue.length<=1)return;J.preventDefault();const ie=ue.filter(ve=>ve&&!M.includes(ve));if(ie.length>0){const ve=l?l-M.length:1/0,fe=ie.slice(0,ve);if(fe.length>0){const ye=[...M,...fe];O(ye),n(V(ye))}}},[E,r,y,H,M,l,n,V]),U=v.useCallback((J,ce)=>{if((ce.action==="remove-value"||ce.action==="pop-value")&&ce.removedValue&&d){const ie=d(ce.removedValue);if(ie!==!0){const ve=typeof ie=="string"?ie:`"${ce.removedValue.label}"은(는) 제거할 수 없습니다.`;alert(ve);return}}if(l&&J.length>l)return;const ue=J.map(ie=>ie.value);O(ue),n(V(ue))},[n,d,l,V]),B=v.useCallback((J,ce)=>{if(ce.action==="clear"&&M.length>0&&d){const ve=e.find(ye=>ye.value===M[0])||{value:M[0],label:String(M[0])},fe=d(ve);if(fe!==!0){const ye=typeof fe=="string"?fe:`"${ve.label}"은(는) 제거할 수 없습니다.`;alert(ye);return}}const ue=J?J.value:null,ie=J?[J.value]:[];O(ie),n(V(ue))},[n,d,M,e,V]),G=v.useCallback(J=>{u&&u(J);const ce=[...M||[],J];O(ce),n(V(ce))},[n,u,M,V]),z=v.useCallback(J=>!J||!J.trim()?!1:!M?.includes(J.trim()),[M]),K=v.useCallback(J=>{const ce=L.trim();if(J.key==="Tab"&&r&&y&&ce){if(M.includes(ce))J.preventDefault(),$("");else if(!l||M.length<l){J.preventDefault();const ue=[...M,ce];O(ue),n(V(ue)),$("")}return}J.key==="Enter"&&(!ce||M&&M.includes(ce))&&(J.preventDefault(),J.stopPropagation())},[M,L,r,y,l,n,V]),X=v.useCallback(J=>g&&g[J]?g[J]:m,[g,m]),Z={control:()=>`${Lt.control} ${f} ${_?"opacity-60 cursor-not-allowed":""}`,valueContainer:()=>Lt.valueContainer,multiValue:J=>{const ce=X(J.data.value);return Lt.multiValue[ce]},multiValueLabel:J=>{const ce=X(J.data.value);return Lt.multiValueLabel[ce]},multiValueRemove:J=>{const ce=X(J.data.value);return`${Lt.multiValueRemove[ce]} ${_?"pointer-events-none":""}`},singleValue:()=>"text-gray-900 dark:text-white text-sm",input:()=>Lt.input,placeholder:()=>Lt.placeholder,menu:()=>Lt.menu,menuList:()=>Lt.menuList,menuPortal:()=>"z-[9999]",option:J=>`${Lt.option.base} ${J.isSelected?Lt.option.selected:J.isFocused?Lt.option.focused:Lt.option.default}`,noOptionsMessage:()=>Lt.noOptionsMessage,clearIndicator:()=>"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer px-1",dropdownIndicator:()=>"text-gray-400 dark:text-gray-500 px-1"},ee={options:T,onKeyDown:K,placeholder:s,noOptionsMessage:()=>o,isDisabled:_,isSearchable:S,menuIsOpen:void 0,openMenuOnClick:!0,openMenuOnFocus:!0,menuPortalTarget:typeof document<"u"?document.body:null,menuPosition:"fixed",classNamePrefix:"tag-input",unstyled:!0,classNames:Z,...r&&y||k?{inputValue:L,onInputChange:W}:{}},ne=y?M.join(","):M[0]??"";if(!y){const J={...ee,isMulti:!1,value:A[0]||null,onChange:B,isClearable:b,closeMenuOnSelect:!0,components:{Option:Zf,GroupHeading:Qf,IndicatorSeparator:()=>null,...b?{}:{ClearIndicator:()=>null}}};return r?h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(qf,{...J,onCreateOption:G,formatCreateLabel:D,isValidNewOption:z,createOptionPosition:"first"})]}):h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Xf,{...J})]})}const he={...ee,isMulti:!0,value:A,onChange:U,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!1,isClearable:!1,components:{Option:Zf,GroupHeading:Qf,MultiValueLabel:Lk,ClearIndicator:()=>null,DropdownIndicator:()=>null,IndicatorSeparator:()=>null}};return r?h.jsxs(I,{id:C,...N,onPaste:j,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(qf,{...he,onCreateOption:G,formatCreateLabel:D,isValidNewOption:z,createOptionPosition:"first"})]}):h.jsxs(I,{id:C,...N,children:[p&&h.jsx("input",{type:"hidden",name:p,value:ne}),h.jsx(Xf,{...he})]})},Gr=(t,e)=>window.G7Core?.t?.(t,e)??t,$k=()=>window.G7Core?.locale?.supported?.()??["ko","en"],Fk=()=>window.G7Core?.locale?.current?.()??"ko",$l=t=>{const e=Gr(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},Vk=({value:t=[],onChange:e,placeholder:n="입력 후 Enter",disabled:r=!1,creatable:s=!0,delimiters:o=[","],className:i="",name:a,error:l,maxItems:c,modalId:d,statePath:u,__componentContext:f,id:g,editorAttrs:m})=>{const p=v.useMemo(()=>$k(),[]),y=v.useMemo(()=>Fk(),[]),[b,S]=v.useState(()=>t||[]),[x,E]=v.useState(""),[k,C]=v.useState(!1),[N,_]=v.useState(null),[w,M]=v.useState({}),O=v.useRef(null),L=v.useRef(void 0);v.useEffect(()=>{const z=(X,Z)=>!X&&!Z?!0:!X||!Z||X.length!==Z.length?!1:JSON.stringify(X)===JSON.stringify(Z),K=t||[];z(K,L.current)||(S(K),L.current=K)},[t]);const $=v.useCallback(z=>({target:{name:a,value:z},currentTarget:{name:a,value:z},preventDefault:()=>{},stopPropagation:()=>{}}),[a]),F=v.useCallback(z=>{const K=[];for(const X of p){const Z=z[X];Z?.trim()&&K.push(`${X.toUpperCase()}: ${Z}`)}return K.length>0?K.join(" / "):""},[p]),D=v.useCallback(z=>{const K=b.filter((X,Z)=>Z!==z);S(K),e?.($(K))},[b,e,$]),A=v.useCallback((z,K,X)=>{const Z=window.G7Core;if(!Z?.dispatch)return;const ee=p.map(ne=>({code:ne,label:$l(ne)}));Z.dispatch({handler:"setState",params:{target:"global",multilingualTagEdit:{fieldName:a,editingIndex:z,values:K,supportedLocales:ee,defaultLocale:y,statePath:u,currentTags:X}}}),Z.dispatch({handler:"openModal",target:d},{componentContext:f})},[a,p,y,d,u,f]),T=v.useCallback(z=>{r||(d?A(z,{...b[z]},b):(_(z),M({...b[z]}),C(!0)))},[r,b,d,A]),V=v.useCallback((z="")=>{const K={};p.forEach(X=>{K[X]=X===y?z:""}),d?(A(null,K,b),E("")):(_(null),M(K),C(!0),E(""))},[p,y,d,A,b]),H=v.useCallback(()=>{if(!Object.values(w).some(X=>X.trim()!=="")){C(!1);return}let K;N!==null?K=b.map((X,Z)=>Z===N?w:X):K=[...b,w],S(K),e?.($(K)),C(!1),M({}),_(null)},[w,N,b,e,$]),W=v.useCallback(()=>{C(!1),M({}),_(null)},[]),j=v.useCallback(z=>{const K=z.target.value;if(o.some(Z=>K.includes(Z))&&s){const Z=o.map(he=>he.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ee=new RegExp(`[${Z.join("")}]`),ne=K.split(ee).map(he=>he.trim()).filter(Boolean);if(ne.length>0){V(ne[0]);return}}E(K)},[o,s,V]),U=v.useCallback(z=>{if(z.key==="Enter"&&x.trim()&&s){if(z.preventDefault(),c&&b.length>=c)return;V(x.trim())}},[x,s,c,b.length,V]),B=v.useCallback((z,K)=>{M(X=>({...X,[z]:K}))},[]),G=!!l;return h.jsxs(I,{className:i,id:g,...m,children:[h.jsxs(I,{className:`flex flex-wrap gap-1.5 p-2 border rounded-lg bg-white dark:bg-gray-700 min-h-[42px] ${G?"border-red-500 dark:border-red-400":"border-gray-300 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500"} ${r?"opacity-60 bg-gray-100 dark:bg-gray-800 cursor-not-allowed":""}`,children:[b.map((z,K)=>h.jsxs(I,{className:"flex items-center gap-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded px-2 py-0.5 text-sm",children:[h.jsx(Q,{className:`cursor-pointer hover:underline ${r?"cursor-not-allowed":""}`,onClick:()=>T(K),children:F(z)}),!r&&h.jsx(oe,{type:"button",className:"p-0 h-4 w-4 min-w-0 border-0 bg-transparent text-blue-600 dark:text-blue-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-transparent",onClick:X=>{X.stopPropagation(),D(K)},children:h.jsx(re,{name:"times",className:"text-xs"})})]},K)),s&&!r&&(!c||b.length<c)&&h.jsx("input",{ref:O,type:"text",value:x,onChange:j,onKeyDown:U,placeholder:b.length===0?n:"",disabled:r,className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500"})]}),l&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1",children:l}),!d&&h.jsx(Ho,{isOpen:k,onClose:W,title:Gr(N!==null?"common.edit":"common.add"),width:"400px",children:h.jsxs(I,{className:"space-y-4 p-4",children:[p.map(z=>h.jsxs(I,{className:"space-y-1",children:[h.jsxs(I,{className:"flex items-center gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300 w-16",children:$l(z)}),h.jsxs(Q,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",z.toUpperCase(),")"]})]}),h.jsx(wt,{type:"text",value:w[z]??"",onChange:K=>B(z,K.target.value),placeholder:`${$l(z)} 값 입력`,className:"w-full",autoFocus:z===y})]},z)),h.jsxs(I,{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[h.jsx(oe,{type:"button",variant:"secondary",onClick:W,children:Gr("common.cancel")}),h.jsx(oe,{type:"button",variant:"primary",onClick:H,children:Gr(N!==null?"common.save":"common.add")})]})]})}),a&&h.jsx("input",{type:"hidden",name:a,value:JSON.stringify(b)})]})},Jf=(t,e)=>window.G7Core?.t?.(t,e)??t,Rf=({type:t,identifier:e,name:n,installedModules:r=[],installedPlugins:s=[],className:o="",style:i,id:a,editorAttrs:l})=>{const c={module:de.Cubes,plugin:de.PuzzlePiece},d={module:Jf("common.module"),plugin:Jf("common.plugin")},u=v.useMemo(()=>{if(n)return n;if(e){const p=(t==="module"?r:s)?.find(y=>y.identifier===e);if(p)return p.name}},[n,e,t,r,s]),f=c[t],g=u?`${u} ${d[t]}`:d[t];return h.jsxs(Q,{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium text-gray-400 dark:text-gray-500 ${o}`,style:i,id:a,...l,children:[h.jsx(re,{name:f,className:"w-3.5 h-3.5"}),h.jsx(Q,{children:g})]})},zk=({options:t=[],value:e,onChange:n,multiple:r=!1,searchPlaceholder:s="Search...",onSearch:o,noResultsText:i="No results found",initialText:a="Type to search",triggerLabel:l="Select",triggerIcon:c,disabled:d=!1,className:u="",id:f,editorAttrs:g})=>{const[m,p]=v.useState(!1),[y,b]=v.useState(""),S=v.useRef(null),x=v.useRef(null),E=v.useRef(`searchable-dropdown-input-${Math.random().toString(36).slice(2,9)}`).current,k=v.useMemo(()=>e==null?[]:Array.isArray(e)?e:[e],[e]),C=v.useMemo(()=>{if(!y.trim())return t;const D=y.toLowerCase();return t.filter(A=>A.label.toLowerCase().includes(D)||A.description?.toLowerCase().includes(D))},[t,y]),N=v.useMemo(()=>{if(k.length===0)return l;if(r){const A=k.length;return A===1?t.find(V=>String(V.value)===String(k[0]))?.label||l:`${A} selected`}return t.find(A=>String(A.value)===String(k[0]))?.label||l},[k,t,r,l]);v.useEffect(()=>{const D=A=>{S.current&&!S.current.contains(A.target)&&p(!1)};return m&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[m]),v.useEffect(()=>{const D=A=>{A.key==="Escape"&&m&&(p(!1),x.current?.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m]),v.useEffect(()=>{if(!m){b("");return}const D=setTimeout(()=>{document.getElementById(E)?.focus()},50);return()=>{clearTimeout(D)}},[m,E]);const _=v.useCallback(()=>{d||p(D=>!D)},[d]),w=v.useCallback(D=>{const A=D.target.value;b(A),o?.(A)},[o]),M=v.useCallback(D=>{if(r){const T=k.some(V=>String(V)===String(D))?k.filter(V=>String(V)!==String(D)):[...k,D];n?.(T)}else n?.(D),p(!1),x.current?.focus()},[r,k,n]),O=D=>k.some(A=>String(A)===String(D)),L=y.length===0&&t.length===0,$=y.length>0&&C.length===0,F=C.length>0;return h.jsxs(I,{ref:S,className:`relative inline-block ${u}`,id:f,...g,children:[h.jsxs(oe,{ref:x,type:"button",onClick:_,disabled:d,className:`
|
||
px-4 py-2.5 bg-gray-100 dark:bg-gray-700
|
||
border-0 rounded-xl
|
||
text-gray-700 dark:text-gray-200 font-medium
|
||
focus:ring-2 focus:ring-blue-500 focus:outline-none
|
||
flex items-center justify-between gap-2
|
||
text-left cursor-pointer
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
min-w-[200px]
|
||
`,"aria-haspopup":"listbox","aria-expanded":m,children:[h.jsxs(I,{className:"flex items-center gap-2",children:[c,h.jsx(Q,{className:"truncate",children:N})]}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${m?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),m&&h.jsxs(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden min-w-[280px]",role:"listbox",children:[h.jsx(I,{className:"p-3 border-b border-gray-200 dark:border-gray-700",children:h.jsx("input",{id:E,type:"text",value:y,onChange:w,placeholder:s,className:"w-full px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent focus:outline-none"})}),h.jsxs(I,{className:"max-h-80 overflow-auto",children:[L&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:a}),$&&h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:i}),F&&h.jsx(I,{className:"py-2",children:C.map(D=>{const A=O(D.value);return h.jsxs(oe,{type:"button",onClick:()=>!D.disabled&&M(D.value),disabled:D.disabled,className:`
|
||
w-full px-4 py-3 text-left
|
||
flex items-start gap-3
|
||
hover:bg-gray-100 dark:hover:bg-gray-700
|
||
transition-colors
|
||
${D.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
||
`,role:"option","aria-selected":A,children:[h.jsx(I,{className:"w-5 h-5 flex-shrink-0 mt-0.5",children:A&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsx(I,{className:`font-medium ${A?"text-blue-600 dark:text-blue-400":"text-gray-900 dark:text-white"}`,children:D.label}),D.description&&h.jsx(I,{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:D.description})]})]},D.value)})})]})]})]})},Vs={container:{base:"tag-select",disabled:"opacity-50 cursor-not-allowed"},tag:"tag",tagRemove:"tag-remove",placeholder:"tag-select-placeholder"},Hk=({options:t=[],value:e=[],onChange:n,placeholder:r="No items selected",disabled:s=!1,className:o="",id:i,editorAttrs:a})=>{const l=v.useCallback(f=>t.find(m=>String(m.value)===String(f))?.label||String(f),[t]),c=v.useCallback(f=>{if(s)return;const g=e.filter(m=>String(m)!==String(f));n?.(g)},[e,n,s]),d=v.useMemo(()=>e.map(f=>({value:f,label:l(f)})),[e,l]),u=`${Vs.container.base} ${s?Vs.container.disabled:""} ${o}`.trim();return h.jsx(I,{className:u,id:i,...a,children:d.length===0?h.jsx(Q,{className:Vs.placeholder,children:r}):d.map(f=>h.jsxs(Q,{className:Vs.tag,children:[f.label,!s&&h.jsx(Q,{className:Vs.tagRemove,onClick:()=>c(f.value),role:"button","aria-label":`Remove ${f.label}`,children:h.jsx(Hn,{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},f.value))})};function Uk(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return v.useMemo(()=>r=>{e.forEach(s=>s(r))},e)}const pi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yr(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Fl(t){return"nodeType"in t}function Wt(t){var e,n;return t?Yr(t)?t:Fl(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Vl(t){const{Document:e}=Wt(t);return t instanceof e}function zs(t){return Yr(t)?!1:t instanceof Wt(t).HTMLElement}function eh(t){return t instanceof Wt(t).SVGElement}function Xr(t){return t?Yr(t)?t.document:Fl(t)?Vl(t)?t:zs(t)||eh(t)?t.ownerDocument:document:document:document}const wn=pi?v.useLayoutEffect:v.useEffect;function mi(t){const e=v.useRef(t);return wn(()=>{e.current=t}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function Bk(){const t=v.useRef(null),e=v.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=v.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Hs(t,e){e===void 0&&(e=[t]);const n=v.useRef(t);return wn(()=>{n.current!==t&&(n.current=t)},e),n}function Us(t,e){const n=v.useRef();return v.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function bi(t){const e=mi(t),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function yi(t){const e=v.useRef();return v.useEffect(()=>{e.current=t},[t]),e.current}let zl={};function Bs(t,e){return v.useMemo(()=>{if(e)return e;const n=zl[t]==null?0:zl[t]+1;return zl[t]=n,t+"-"+n},[t,e])}function th(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+t*c)}return o},{...e})}}const Kr=th(1),js=th(-1);function jk(t){return"clientX"in t&&"clientY"in t}function vi(t){if(!t)return!1;const{KeyboardEvent:e}=Wt(t.target);return e&&t instanceof e}function Wk(t){if(!t)return!1;const{TouchEvent:e}=Wt(t.target);return e&&t instanceof e}function xi(t){if(Wk(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return jk(t)?{x:t.clientX,y:t.clientY}:null}const In=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[In.Translate.toString(t),In.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),nh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Gk(t){return t.matches(nh)?t:t.querySelector(nh)}const Yk={display:"none"};function Xk(t){let{id:e,value:n}=t;return v.createElement("div",{id:e,style:Yk},n)}function Kk(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return v.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function qk(){const[t,e]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const rh=v.createContext(null);function Zk(t){const e=v.useContext(rh);v.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Qk(){const[t]=v.useState(()=>new Set),e=v.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[v.useCallback(r=>{let{type:s,event:o}=r;t.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[t]),e]}const Jk={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.
|
||
`},Rk={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function eC(t){let{announcements:e=Rk,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Jk}=t;const{announce:o,announcement:i}=qk(),a=Bs("DndLiveRegion"),[l,c]=v.useState(!1);if(v.useEffect(()=>{c(!0)},[]),Zk(v.useMemo(()=>({onDragStart(u){let{active:f}=u;o(e.onDragStart({active:f}))},onDragMove(u){let{active:f,over:g}=u;e.onDragMove&&o(e.onDragMove({active:f,over:g}))},onDragOver(u){let{active:f,over:g}=u;o(e.onDragOver({active:f,over:g}))},onDragEnd(u){let{active:f,over:g}=u;o(e.onDragEnd({active:f,over:g}))},onDragCancel(u){let{active:f,over:g}=u;o(e.onDragCancel({active:f,over:g}))}}),[o,e])),!l)return null;const d=v.createElement(v.Fragment,null,v.createElement(Xk,{id:r,value:s.draggable}),v.createElement(Kk,{id:a,announcement:i}));return n?Nn.createPortal(d,n):d}var St;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(St||(St={}));function wi(){}function qr(t,e){return v.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function Hl(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return v.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const kn=Object.freeze({x:0,y:0});function sh(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function tC(t,e){const n=xi(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function oh(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function nC(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function ih(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function ah(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function lh(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const Ul=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=lh(e,e.left,e.top),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=sh(lh(l),s);o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(oh)},rC=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=ih(e),o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=ih(l),d=s.reduce((f,g,m)=>f+sh(c[m],g),0),u=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(oh)};function sC(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),i=s-r,a=o-n;if(r<s&&n<o){const l=e.width*e.height,c=t.width*t.height,d=i*a,u=d/(l+c-d);return Number(u.toFixed(4))}return 0}const oC=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const o of r){const{id:i}=o,a=n.get(i);if(a){const l=sC(a,e);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(nC)};function iC(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function ch(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:kn}function aC(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>({...i,top:i.top+t*a.y,bottom:i.bottom+t*a.y,left:i.left+t*a.x,right:i.right+t*a.x}),{...n})}}const lC=aC(1);function dh(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function cC(t,e,n){const r=dh(e);if(!r)return t;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=t.left-i-(1-s)*parseFloat(n),c=t.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?t.width/s:t.width,u=o?t.height/o:t.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}const dC={ignoreTransform:!1};function Zr(t,e){e===void 0&&(e=dC);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Wt(t).getComputedStyle(t);c&&(n=cC(n,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=n;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function uh(t){return Zr(t,{ignoreTransform:!0})}function uC(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function fC(t,e){return e===void 0&&(e=Wt(t).getComputedStyle(t)),e.position==="fixed"}function hC(t,e){e===void 0&&(e=Wt(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=e[s];return typeof o=="string"?n.test(o):!1})}function ki(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(Vl(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!zs(s)||eh(s)||n.includes(s))return n;const o=Wt(t).getComputedStyle(s);return s!==t&&hC(s,o)&&n.push(s),fC(s,o)?n:r(s.parentNode)}return t?r(t):n}function fh(t){const[e]=ki(t,1);return e??null}function Bl(t){return!pi||!t?null:Yr(t)?t:Fl(t)?Vl(t)||t===Xr(t).scrollingElement?window:zs(t)?t:null:null}function hh(t){return Yr(t)?t.scrollX:t.scrollLeft}function gh(t){return Yr(t)?t.scrollY:t.scrollTop}function jl(t){return{x:hh(t),y:gh(t)}}var Mt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Mt||(Mt={}));function ph(t){return!pi||!t?!1:t===document.scrollingElement}function mh(t){const e={x:0,y:0},n=ph(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,i=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:e}}const gC={x:.2,y:.2};function pC(t,e,n,r,s){let{top:o,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=gC);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=mh(t),g={x:0,y:0},m={x:0,y:0},p={height:e.height*s.y,width:e.width*s.x};return!c&&o<=e.top+p.height?(g.y=Mt.Backward,m.y=r*Math.abs((e.top+p.height-o)/p.height)):!d&&l>=e.bottom-p.height&&(g.y=Mt.Forward,m.y=r*Math.abs((e.bottom-p.height-l)/p.height)),!f&&a>=e.right-p.width?(g.x=Mt.Forward,m.x=r*Math.abs((e.right-p.width-a)/p.width)):!u&&i<=e.left+p.width&&(g.x=Mt.Backward,m.x=r*Math.abs((e.left+p.width-i)/p.width)),{direction:g,speed:m}}function mC(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function bh(t){return t.reduce((e,n)=>Kr(e,jl(n)),kn)}function bC(t){return t.reduce((e,n)=>e+hh(n),0)}function yC(t){return t.reduce((e,n)=>e+gh(n),0)}function yh(t,e){if(e===void 0&&(e=Zr),!t)return;const{top:n,left:r,bottom:s,right:o}=e(t);fh(t)&&(s<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const vC=[["x",["left","right"],bC],["y",["top","bottom"],yC]];class Wl{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ki(n),s=bh(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,i,a]of vC)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ws{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function xC(t){const{EventTarget:e}=Wt(t);return t instanceof e?t:Xr(t)}function Gl(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var ln;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ln||(ln={}));function vh(t){t.preventDefault()}function wC(t){t.stopPropagation()}var Ke;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ke||(Ke={}));const xh={start:[Ke.Space,Ke.Enter],cancel:[Ke.Esc],end:[Ke.Space,Ke.Enter,Ke.Tab]},kC=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Ke.Right:return{...n,x:n.x+25};case Ke.Left:return{...n,x:n.x-25};case Ke.Down:return{...n,y:n.y+25};case Ke.Up:return{...n,y:n.y-25}}};class Gs{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Ws(Xr(n)),this.windowListeners=new Ws(Wt(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ln.Resize,this.handleCancel),this.windowListeners.add(ln.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ln.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&yh(r),n(kn)}handleKeyDown(e){if(vi(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:o=xh,coordinateGetter:i=kC,scrollBehavior:a="smooth"}=s,{code:l}=e;if(o.end.includes(l)){this.handleEnd(e);return}if(o.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:kn;this.referenceCoordinates||(this.referenceCoordinates=d);const u=i(e,{active:n,context:r.current,currentCoordinates:d});if(u){const f=js(u,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const p of m){const y=e.code,{isTop:b,isRight:S,isLeft:x,isBottom:E,maxScroll:k,minScroll:C}=mh(p),N=mC(p),_={x:Math.min(y===Ke.Right?N.right-N.width/2:N.right,Math.max(y===Ke.Right?N.left:N.left+N.width/2,u.x)),y:Math.min(y===Ke.Down?N.bottom-N.height/2:N.bottom,Math.max(y===Ke.Down?N.top:N.top+N.height/2,u.y))},w=y===Ke.Right&&!S||y===Ke.Left&&!x,M=y===Ke.Down&&!E||y===Ke.Up&&!b;if(w&&_.x!==u.x){const O=p.scrollLeft+f.x,L=y===Ke.Right&&O<=k.x||y===Ke.Left&&O>=C.x;if(L&&!f.y){p.scrollTo({left:O,behavior:a});return}L?g.x=p.scrollLeft-O:g.x=y===Ke.Right?p.scrollLeft-k.x:p.scrollLeft-C.x,g.x&&p.scrollBy({left:-g.x,behavior:a});break}else if(M&&_.y!==u.y){const O=p.scrollTop+f.y,L=y===Ke.Down&&O<=k.y||y===Ke.Up&&O>=C.y;if(L&&!f.x){p.scrollTo({top:O,behavior:a});return}L?g.y=p.scrollTop-O:g.y=y===Ke.Down?p.scrollTop-k.y:p.scrollTop-C.y,g.y&&p.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(e,Kr(js(u,this.referenceCoordinates),g))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Gs.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=xh,onActivation:s}=e,{active:o}=n;const{code:i}=t.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function wh(t){return!!(t&&"distance"in t)}function kh(t){return!!(t&&"delay"in t)}class Yl{constructor(e,n,r){var s;r===void 0&&(r=xC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:o}=e,{target:i}=o;this.props=e,this.events=n,this.document=Xr(i),this.documentListeners=new Ws(this.document),this.listeners=new Ws(r),this.windowListeners=new Ws(Wt(i)),this.initialCoordinates=(s=xi(o))!=null?s:kn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ln.Resize,this.handleCancel),this.windowListeners.add(ln.DragStart,vh),this.windowListeners.add(ln.VisibilityChange,this.handleCancel),this.windowListeners.add(ln.ContextMenu,vh),this.documentListeners.add(ln.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kh(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wh(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(ln.Click,wC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ln.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(n=xi(e))!=null?n:kn,c=js(s,l);if(!r&&a){if(wh(a)){if(a.tolerance!=null&&Gl(c,a.tolerance))return this.handleCancel();if(Gl(c,a.distance))return this.handleStart()}if(kh(a)&&Gl(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===Ke.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const CC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ys extends Yl{constructor(e){const{event:n}=e,r=Xr(n.target);super(e,CC,r)}}Ys.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const SC={move:{name:"mousemove"},end:{name:"mouseup"}};var Xl;(function(t){t[t.RightClick=2]="RightClick"})(Xl||(Xl={}));class _C extends Yl{constructor(e){super(e,SC,Xr(e.event.target))}}_C.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Xl.RightClick?!1:(r?.({event:n}),!0)}}];const Kl={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class EC extends Yl{constructor(e){super(e,Kl)}static setup(){return window.addEventListener(Kl.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Kl.move.name,e)};function e(){}}}EC.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Xs;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Xs||(Xs={}));var Ci;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ci||(Ci={}));function MC(t){let{acceleration:e,activator:n=Xs.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=Ci.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:u,threshold:f}=t;const g=OC({delta:u,disabled:!o}),[m,p]=Bk(),y=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),S=v.useMemo(()=>{switch(n){case Xs.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xs.DraggableRect:return s}},[n,s,l]),x=v.useRef(null),E=v.useCallback(()=>{const C=x.current;if(!C)return;const N=y.current.x*b.current.x,_=y.current.y*b.current.y;C.scrollBy(N,_)},[]),k=v.useMemo(()=>a===Ci.TreeOrder?[...c].reverse():c,[a,c]);v.useEffect(()=>{if(!o||!c.length||!S){p();return}for(const C of k){if(r?.(C)===!1)continue;const N=c.indexOf(C),_=d[N];if(!_)continue;const{direction:w,speed:M}=pC(C,_,S,e,f);for(const O of["x","y"])g[O][w[O]]||(M[O]=0,w[O]=0);if(M.x>0||M.y>0){p(),x.current=C,m(E,i),y.current=M,b.current=w;return}}y.current={x:0,y:0},b.current={x:0,y:0},p()},[e,E,r,p,o,i,JSON.stringify(S),JSON.stringify(g),m,c,k,d,JSON.stringify(f)])}const NC={x:{[Mt.Backward]:!1,[Mt.Forward]:!1},y:{[Mt.Backward]:!1,[Mt.Forward]:!1}};function OC(t){let{delta:e,disabled:n}=t;const r=yi(e);return Us(s=>{if(n||!r||!s)return NC;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Mt.Backward]:s.x[Mt.Backward]||o.x===-1,[Mt.Forward]:s.x[Mt.Forward]||o.x===1},y:{[Mt.Backward]:s.y[Mt.Backward]||o.y===-1,[Mt.Forward]:s.y[Mt.Forward]||o.y===1}}},[n,e,r])}function TC(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Us(s=>{var o;return e==null?null:(o=r??s)!=null?o:null},[r,e])}function AC(t,e){return v.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:e(i.handler,r)}));return[...n,...o]},[]),[t,e])}var Ks;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Ks||(Ks={}));var ql;(function(t){t.Optimized="optimized"})(ql||(ql={}));const Ch=new Map;function DC(t,e){let{dragging:n,dependencies:r,config:s}=e;const[o,i]=v.useState(null),{frequency:a,measure:l,strategy:c}=s,d=v.useRef(t),u=y(),f=Hs(u),g=v.useCallback(function(b){b===void 0&&(b=[]),!f.current&&i(S=>S===null?b:S.concat(b.filter(x=>!S.includes(x))))},[f]),m=v.useRef(null),p=Us(b=>{if(u&&!n)return Ch;if(!b||b===Ch||d.current!==t||o!=null){const S=new Map;for(let x of t){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){S.set(x.id,x.rect.current);continue}const E=x.node.current,k=E?new Wl(l(E),E):null;x.rect.current=k,k&&S.set(x.id,k)}return S}return b},[t,o,n,u,l]);return v.useEffect(()=>{d.current=t},[t]),v.useEffect(()=>{u||g()},[n,u]),v.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),v.useEffect(()=>{u||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,u,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:o!=null};function y(){switch(c){case Ks.Always:return!1;case Ks.BeforeDragging:return n;default:return!n}}}function Zl(t,e){return Us(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function IC(t,e){return Zl(t,e)}function LC(t){let{callback:e,disabled:n}=t;const r=mi(e),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function Si(t){let{callback:e,disabled:n}=t;const r=mi(e),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return v.useEffect(()=>()=>s?.disconnect(),[s]),s}function PC(t){return new Wl(Zr(t),t)}function Sh(t,e,n){e===void 0&&(e=PC);const[r,s]=v.useState(null);function o(){s(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=LC({callback(l){if(t)for(const c of l){const{type:d,target:u}=c;if(d==="childList"&&u instanceof HTMLElement&&u.contains(t)){o();break}}}}),a=Si({callback:o});return wn(()=>{o(),t?(a?.observe(t),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[t]),r}function $C(t){const e=Zl(t);return ch(t,e)}const _h=[];function FC(t){const e=v.useRef(t),n=Us(r=>t?r&&r!==_h&&t&&e.current&&t.parentNode===e.current.parentNode?r:ki(t):_h,[t]);return v.useEffect(()=>{e.current=t},[t]),n}function VC(t){const[e,n]=v.useState(null),r=v.useRef(t),s=v.useCallback(o=>{const i=Bl(o.target);i&&n(a=>a?(a.set(i,jl(i)),new Map(a)):null)},[]);return v.useEffect(()=>{const o=r.current;if(t!==o){i(o);const a=t.map(l=>{const c=Bl(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,jl(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{i(t),i(o)};function i(a){a.forEach(l=>{const c=Bl(l);c?.removeEventListener("scroll",s)})}},[s,t]),v.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,i)=>Kr(o,i),kn):bh(t):kn,[t,e])}function Eh(t,e){e===void 0&&(e=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},e),v.useEffect(()=>{const r=t!==kn;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?js(t,n.current):kn}function zC(t){v.useEffect(()=>{if(!pi)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function HC(t,e){return v.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:o}=r;return n[s]=i=>{o(i,e)},n},{}),[t,e])}function Mh(t){return v.useMemo(()=>t?uC(t):null,[t])}const Nh=[];function UC(t,e){e===void 0&&(e=Zr);const[n]=t,r=Mh(n?Wt(n):null),[s,o]=v.useState(Nh);function i(){o(()=>t.length?t.map(l=>ph(l)?r:new Wl(e(l),l)):Nh)}const a=Si({callback:i});return wn(()=>{a?.disconnect(),i(),t.forEach(l=>a?.observe(l))},[t]),s}function Oh(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return zs(e)?e:t}function BC(t){let{measure:e}=t;const[n,r]=v.useState(null),s=v.useCallback(c=>{for(const{target:d}of c)if(zs(d)){r(u=>{const f=e(d);return u?{...u,width:f.width,height:f.height}:f});break}},[e]),o=Si({callback:s}),i=v.useCallback(c=>{const d=Oh(c);o?.disconnect(),d&&o?.observe(d),r(d?e(d):null)},[e,o]),[a,l]=bi(i);return v.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const jC=[{sensor:Ys,options:{}},{sensor:Gs,options:{}}],WC={current:{}},_i={draggable:{measure:uh},droppable:{measure:uh,strategy:Ks.WhileDragging,frequency:ql.Optimized},dragOverlay:{measure:Zr}};class qs extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const GC={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wi},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:_i,measureDroppableContainers:wi,windowRect:null,measuringScheduled:!1},Th={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wi,draggableNodes:new Map,over:null,measureDroppableContainers:wi},Zs=v.createContext(Th),Ah=v.createContext(GC);function YC(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qs}}}function XC(t,e){switch(e.type){case St.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case St.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case St.DragEnd:case St.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case St.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new qs(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case St.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const i=new qs(t.droppable.containers);return i.set(n,{...o,disabled:s}),{...t,droppable:{...t.droppable,containers:i}}}case St.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new qs(t.droppable.containers);return o.delete(n),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function KC(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(Zs),o=yi(r),i=yi(n?.id);return v.useEffect(()=>{if(!e&&!r&&o&&i!=null){if(!vi(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const u=Gk(d);if(u){u.focus();break}}})}},[r,e,s,i,o]),null}function Dh(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,o)=>o({transform:s,...r}),n):n}function qC(t){return v.useMemo(()=>({draggable:{..._i.draggable,...t?.draggable},droppable:{..._i.droppable,...t?.droppable},dragOverlay:{..._i.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function ZC(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const o=v.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;wn(()=>{if(!i&&!a||!e){o.current=!1;return}if(o.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),u=ch(d,r);if(i||(u.x=0),a||(u.y=0),o.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=fh(c);f&&f.scrollBy({top:u.y,left:u.x})}},[e,i,a,r,n])}const Ei=v.createContext({...kn,scaleX:1,scaleY:1});var er;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(er||(er={}));const Ql=v.memo(function(e){var n,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=jC,collisionDetection:u=oC,measuring:f,modifiers:g,...m}=e;const p=v.useReducer(XC,void 0,YC),[y,b]=p,[S,x]=Qk(),[E,k]=v.useState(er.Uninitialized),C=E===er.Initialized,{draggable:{active:N,nodes:_,translate:w},droppable:{containers:M}}=y,O=N!=null?_.get(N):null,L=v.useRef({initial:null,translated:null}),$=v.useMemo(()=>{var we;return N!=null?{id:N,data:(we=O?.data)!=null?we:WC,rect:L}:null},[N,O]),F=v.useRef(null),[D,A]=v.useState(null),[T,V]=v.useState(null),H=Hs(m,Object.values(m)),W=Bs("DndDescribedBy",i),j=v.useMemo(()=>M.getEnabled(),[M]),U=qC(f),{droppableRects:B,measureDroppableContainers:G,measuringScheduled:z}=DC(j,{dragging:C,dependencies:[w.x,w.y],config:U.droppable}),K=TC(_,N),X=v.useMemo(()=>T?xi(T):null,[T]),Z=it(),ee=IC(K,U.draggable.measure);ZC({activeNode:N!=null?_.get(N):null,config:Z.layoutShiftCompensation,initialRect:ee,measure:U.draggable.measure});const ne=Sh(K,U.draggable.measure,ee),he=Sh(K?K.parentElement:null),J=v.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=M.getNodeFor((n=J.current.over)==null?void 0:n.id),ue=BC({measure:U.dragOverlay.measure}),ie=(r=ue.nodeRef.current)!=null?r:K,ve=C?(s=ue.rect)!=null?s:ne:null,fe=!!(ue.nodeRef.current&&ue.rect),ye=$C(fe?null:ne),Se=Mh(ie?Wt(ie):null),He=FC(C?ce??K:null),se=UC(He),Ae=Dh(g,{transform:{x:w.x-ye.x,y:w.y-ye.y,scaleX:1,scaleY:1},activatorEvent:T,active:$,activeNodeRect:ne,containerNodeRect:he,draggingNodeRect:ve,over:J.current.over,overlayNodeRect:ue.rect,scrollableAncestors:He,scrollableAncestorRects:se,windowRect:Se}),Le=X?Kr(X,w):null,Ie=VC(He),Be=Eh(Ie),st=Eh(Ie,[ne]),ft=Kr(Ae,Be),je=ve?lC(ve,Ae):null,Je=$&&je?u({active:$,collisionRect:je,droppableRects:B,droppableContainers:j,pointerCoordinates:Le}):null,Xe=ah(Je,"id"),[te,ge]=v.useState(null),pe=fe?Ae:Kr(Ae,st),me=iC(pe,(o=te?.rect)!=null?o:null,ne),be=v.useRef(null),Ue=v.useCallback((we,Ee)=>{let{sensor:ze,options:qe}=Ee;if(F.current==null)return;const Re=_.get(F.current);if(!Re)return;const nt=we.nativeEvent,gt=new ze({active:F.current,activeNode:Re,event:nt,options:qe,context:J,onAbort(mt){if(!_.get(mt))return;const{onDragAbort:Dt}=H.current,Ve={id:mt};Dt?.(Ve),S({type:"onDragAbort",event:Ve})},onPending(mt,xt,Dt,Ve){if(!_.get(mt))return;const{onDragPending:on}=H.current,Rt={id:mt,constraint:xt,initialCoordinates:Dt,offset:Ve};on?.(Rt),S({type:"onDragPending",event:Rt})},onStart(mt){const xt=F.current;if(xt==null)return;const Dt=_.get(xt);if(!Dt)return;const{onDragStart:Ve}=H.current,sn={activatorEvent:nt,active:{id:xt,data:Dt.data,rect:L}};Nn.unstable_batchedUpdates(()=>{Ve?.(sn),k(er.Initializing),b({type:St.DragStart,initialCoordinates:mt,active:xt}),S({type:"onDragStart",event:sn}),A(be.current),V(nt)})},onMove(mt){b({type:St.DragMove,coordinates:mt})},onEnd:mn(St.DragEnd),onCancel:mn(St.DragCancel)});be.current=gt;function mn(mt){return async function(){const{active:Dt,collisions:Ve,over:sn,scrollAdjustedTranslate:on}=J.current;let Rt=null;if(Dt&&on){const{cancelDrop:zn}=H.current;Rt={activatorEvent:nt,active:Dt,collisions:Ve,delta:on,over:sn},mt===St.DragEnd&&typeof zn=="function"&&await Promise.resolve(zn(Rt))&&(mt=St.DragCancel)}F.current=null,Nn.unstable_batchedUpdates(()=>{b({type:mt}),k(er.Uninitialized),ge(null),A(null),V(null),be.current=null;const zn=mt===St.DragEnd?"onDragEnd":"onDragCancel";if(Rt){const dr=H.current[zn];dr?.(Rt),S({type:zn,event:Rt})}})}}},[_]),Me=v.useCallback((we,Ee)=>(ze,qe)=>{const Re=ze.nativeEvent,nt=_.get(qe);if(F.current!==null||!nt||Re.dndKit||Re.defaultPrevented)return;const gt={active:nt};we(ze,Ee.options,gt)===!0&&(Re.dndKit={capturedBy:Ee.sensor},F.current=qe,Ue(ze,Ee))},[_,Ue]),Fe=AC(d,Me);zC(d),wn(()=>{ne&&E===er.Initializing&&k(er.Initialized)},[ne,E]),v.useEffect(()=>{const{onDragMove:we}=H.current,{active:Ee,activatorEvent:ze,collisions:qe,over:Re}=J.current;if(!Ee||!ze)return;const nt={active:Ee,activatorEvent:ze,collisions:qe,delta:{x:ft.x,y:ft.y},over:Re};Nn.unstable_batchedUpdates(()=>{we?.(nt),S({type:"onDragMove",event:nt})})},[ft.x,ft.y]),v.useEffect(()=>{const{active:we,activatorEvent:Ee,collisions:ze,droppableContainers:qe,scrollAdjustedTranslate:Re}=J.current;if(!we||F.current==null||!Ee||!Re)return;const{onDragOver:nt}=H.current,gt=qe.get(Xe),mn=gt&>.rect.current?{id:gt.id,rect:gt.rect.current,data:gt.data,disabled:gt.disabled}:null,mt={active:we,activatorEvent:Ee,collisions:ze,delta:{x:Re.x,y:Re.y},over:mn};Nn.unstable_batchedUpdates(()=>{ge(mn),nt?.(mt),S({type:"onDragOver",event:mt})})},[Xe]),wn(()=>{J.current={activatorEvent:T,active:$,activeNode:K,collisionRect:je,collisions:Je,droppableRects:B,draggableNodes:_,draggingNode:ie,draggingNodeRect:ve,droppableContainers:M,over:te,scrollableAncestors:He,scrollAdjustedTranslate:ft},L.current={initial:ve,translated:je}},[$,K,Je,je,_,ie,ve,B,M,te,He,ft]),MC({...Z,delta:w,draggingRect:je,pointerCoordinates:Le,scrollableAncestors:He,scrollableAncestorRects:se});const _e=v.useMemo(()=>({active:$,activeNode:K,activeNodeRect:ne,activatorEvent:T,collisions:Je,containerNodeRect:he,dragOverlay:ue,draggableNodes:_,droppableContainers:M,droppableRects:B,over:te,measureDroppableContainers:G,scrollableAncestors:He,scrollableAncestorRects:se,measuringConfiguration:U,measuringScheduled:z,windowRect:Se}),[$,K,ne,T,Je,he,ue,_,M,B,te,G,He,se,U,z,Se]),ot=v.useMemo(()=>({activatorEvent:T,activators:Fe,active:$,activeNodeRect:ne,ariaDescribedById:{draggable:W},dispatch:b,draggableNodes:_,over:te,measureDroppableContainers:G}),[T,Fe,$,ne,b,W,_,te,G]);return v.createElement(rh.Provider,{value:x},v.createElement(Zs.Provider,{value:ot},v.createElement(Ah.Provider,{value:_e},v.createElement(Ei.Provider,{value:me},c)),v.createElement(KC,{disabled:a?.restoreFocus===!1})),v.createElement(eC,{...a,hiddenTextDescribedById:W}));function it(){const we=D?.autoScrollEnabled===!1,Ee=typeof l=="object"?l.enabled===!1:l===!1,ze=C&&!we&&!Ee;return typeof l=="object"?{...l,enabled:ze}:{enabled:ze}}}),QC=v.createContext(null),Ih="button",JC="Draggable";function RC(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const o=Bs(JC),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:f}=v.useContext(Zs),{role:g=Ih,roleDescription:m="draggable",tabIndex:p=0}=s??{},y=l?.id===e,b=v.useContext(y?Ei:QC),[S,x]=bi(),[E,k]=bi(),C=HC(i,e),N=Hs(n);wn(()=>(u.set(e,{id:e,key:o,node:S,activatorNode:E,data:N}),()=>{const w=u.get(e);w&&w.key===o&&u.delete(e)}),[u,e]);const _=v.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&g===Ih?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,p,y,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:_,isDragging:y,listeners:r?void 0:C,node:S,over:f,setNodeRef:x,setActivatorNodeRef:k,transform:b}}function Lh(){return v.useContext(Ah)}const eS="Droppable",tS={timeout:25};function nS(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const o=Bs(eS),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=v.useContext(Zs),d=v.useRef({disabled:n}),u=v.useRef(!1),f=v.useRef(null),g=v.useRef(null),{disabled:m,updateMeasurementsFor:p,timeout:y}={...tS,...s},b=Hs(p??r),S=v.useCallback(()=>{if(!u.current){u.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),g.current=null},y)},[y]),x=Si({callback:S,disabled:m||!i}),E=v.useCallback((_,w)=>{x&&(w&&(x.unobserve(w),u.current=!1),_&&x.observe(_))},[x]),[k,C]=bi(E),N=Hs(e);return v.useEffect(()=>{!x||!k.current||(x.disconnect(),u.current=!1,x.observe(k.current))},[k,x]),v.useEffect(()=>(a({type:St.RegisterDroppable,element:{id:r,key:o,disabled:n,node:k,rect:f,data:N}}),()=>a({type:St.UnregisterDroppable,key:o,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(a({type:St.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:i,rect:f,isOver:l?.id===r,node:k,over:l,setNodeRef:C}}function rS(t){let{animation:e,children:n}=t;const[r,s]=v.useState(null),[o,i]=v.useState(null),a=yi(n);return!n&&!r&&a&&s(a),wn(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(e(c,o)).then(()=>{s(null)})},[e,r,o]),v.createElement(v.Fragment,null,n,r?v.cloneElement(r,{ref:i}):null)}const sS={x:0,y:0,scaleX:1,scaleY:1};function oS(t){let{children:e}=t;return v.createElement(Zs.Provider,{value:Th},v.createElement(Ei.Provider,{value:sS},e))}const iS={position:"fixed",touchAction:"none"},aS=t=>vi(t)?"transform 250ms ease":void 0,lS=v.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=aS}=t;if(!a)return null;const u=s?c:{...c,scaleX:1,scaleY:1},f={...iS,width:a.width,height:a.height,top:a.top,left:a.left,transform:In.Transform.toString(u),transformOrigin:s&&r?tC(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return v.createElement(n,{className:i,style:f,ref:e},o)}),cS={duration:250,easing:"ease",keyframes:t=>{let{transform:{initial:e,final:n}}=t;return[{transform:In.Transform.toString(e)},{transform:In.Transform.toString(n)}]},sideEffects:(t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:o,className:i}=t;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&n.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);i!=null&&i.active&&n.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function dS(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return mi((o,i)=>{if(e===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Oh(i);if(!c)return;const{transform:d}=Wt(i).getComputedStyle(i),u=dh(d);if(!u)return;const f=typeof e=="function"?e:uS(e);return yh(l,s.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:u})})}function uS(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...cS,...t};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!e)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},u={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-d.x,y:l.y-d.y,...u},g=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:f}}),[m]=g,p=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(p))return;const y=r?.({active:i,dragOverlay:a,...c}),b=a.node.animate(g,{duration:e,easing:n,fill:"forwards"});return new Promise(S=>{b.onfinish=()=>{y?.(),S()}})}}let Ph=0;function fS(t){return v.useMemo(()=>{if(t!=null)return Ph++,Ph},[t])}const hS=v.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggableNodes:m,droppableContainers:p,dragOverlay:y,over:b,measuringConfiguration:S,scrollableAncestors:x,scrollableAncestorRects:E,windowRect:k}=Lh(),C=v.useContext(Ei),N=fS(u?.id),_=Dh(i,{activatorEvent:d,active:u,activeNodeRect:f,containerNodeRect:g,draggingNodeRect:y.rect,over:b,overlayNodeRect:y.rect,scrollableAncestors:x,scrollableAncestorRects:E,transform:C,windowRect:k}),w=Zl(f),M=dS({config:r,draggableNodes:m,droppableContainers:p,measuringConfiguration:S}),O=w?y.setRef:void 0;return v.createElement(oS,null,v.createElement(rS,{animation:M},u&&N?v.createElement(lS,{key:N,id:u.id,ref:O,as:a,activatorEvent:d,adjustScale:e,className:l,transition:o,rect:w,style:{zIndex:c,...s},transform:_},n):null))});function Qr(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function gS(t,e){return t.reduce((n,r,s)=>{const o=e.get(r);return o&&(n[s]=o),n},Array(t.length))}function Mi(t){return t!==null&&t>=0}function pS(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function mS(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Ni=t=>{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const o=Qr(e,r,n),i=e[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},Oi={scaleX:1,scaleY:1},Jl=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:s,rects:o,overIndex:i}=t;const a=(e=o[n])!=null?e:r;if(!a)return null;if(s===n){const c=o[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...Oi}:null}const l=bS(o,s,n);return s>n&&s<=i?{x:0,y:-a.height-l,...Oi}:s<n&&s>=i?{x:0,y:a.height+l,...Oi}:{x:0,y:0,...Oi}};function bS(t,e,n){const r=t[e],s=t[e-1],o=t[e+1];return r?n<e?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const $h="Sortable",Fh=v.createContext({activeIndex:-1,containerId:$h,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ni,disabled:{draggable:!1,droppable:!1}});function Ti(t){let{children:e,id:n,items:r,strategy:s=Ni,disabled:o=!1}=t;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Lh(),u=Bs($h,n),f=a.rect!==null,g=v.useMemo(()=>r.map(C=>typeof C=="object"&&"id"in C?C.id:C),[r]),m=i!=null,p=i?g.indexOf(i.id):-1,y=c?g.indexOf(c.id):-1,b=v.useRef(g),S=!pS(g,b.current),x=y!==-1&&p===-1||S,E=mS(o);wn(()=>{S&&m&&d(g)},[S,g,m,d]),v.useEffect(()=>{b.current=g},[g]);const k=v.useMemo(()=>({activeIndex:p,containerId:u,disabled:E,disableTransforms:x,items:g,overIndex:y,useDragOverlay:f,sortedRects:gS(g,l),strategy:s}),[p,u,E.draggable,E.droppable,x,g,y,l,f,s]);return v.createElement(Fh.Provider,{value:k},e)}const Vh=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return Qr(n,r,s).indexOf(e)},zh=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==o&&s===i?!1:n?!0:i!==s&&e===l},yS={duration:200,easing:"ease"},Hh="transform",vS=In.Transition.toString({property:Hh,duration:0,easing:"linear"}),xS={roleDescription:"sortable"};function wS(t){let{disabled:e,index:n,node:r,rect:s}=t;const[o,i]=v.useState(null),a=v.useRef(n);return wn(()=>{if(!e&&n!==a.current&&r.current){const l=s.current;if(l){const c=Zr(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}n!==a.current&&(a.current=n)},[e,n,r,s]),v.useEffect(()=>{o&&i(null)},[o]),o}function Ai(t){let{animateLayoutChanges:e=zh,attributes:n,disabled:r,data:s,getNewIndex:o=Vh,id:i,strategy:a,resizeObserverConfig:l,transition:c=yS}=t;const{items:d,containerId:u,activeIndex:f,disabled:g,disableTransforms:m,sortedRects:p,overIndex:y,useDragOverlay:b,strategy:S}=v.useContext(Fh),x=kS(r,g),E=d.indexOf(i),k=v.useMemo(()=>({sortable:{containerId:u,index:E,items:d},...s}),[u,s,E,d]),C=v.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:N,node:_,isOver:w,setNodeRef:M}=nS({id:i,data:k,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...l}}),{active:O,activatorEvent:L,activeNodeRect:$,attributes:F,setNodeRef:D,listeners:A,isDragging:T,over:V,setActivatorNodeRef:H,transform:W}=RC({id:i,data:k,attributes:{...xS,...n},disabled:x.draggable}),j=Uk(M,D),U=!!O,B=U&&!m&&Mi(f)&&Mi(y),G=!b&&T,z=G&&B?W:null,X=B?z??(a??S)({rects:p,activeNodeRect:$,activeIndex:f,overIndex:y,index:E}):null,Z=Mi(f)&&Mi(y)?o({id:i,items:d,activeIndex:f,overIndex:y}):E,ee=O?.id,ne=v.useRef({activeId:ee,items:d,newIndex:Z,containerId:u}),he=d!==ne.current.items,J=e({active:O,containerId:u,isDragging:T,isSorting:U,id:i,index:E,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),ce=wS({disabled:!J,index:E,node:_,rect:N});return v.useEffect(()=>{U&&ne.current.newIndex!==Z&&(ne.current.newIndex=Z),u!==ne.current.containerId&&(ne.current.containerId=u),d!==ne.current.items&&(ne.current.items=d)},[U,Z,u,d]),v.useEffect(()=>{if(ee===ne.current.activeId)return;if(ee!=null&&ne.current.activeId==null){ne.current.activeId=ee;return}const ie=setTimeout(()=>{ne.current.activeId=ee},50);return()=>clearTimeout(ie)},[ee]),{active:O,activeIndex:f,attributes:F,data:k,rect:N,index:E,newIndex:Z,items:d,isOver:w,isSorting:U,isDragging:T,listeners:A,node:_,overIndex:y,over:V,setNodeRef:j,setActivatorNodeRef:H,setDroppableNodeRef:M,setDraggableNodeRef:D,transform:ce??X,transition:ue()};function ue(){if(ce||he&&ne.current.newIndex===E)return vS;if(!(G&&!vi(L)||!c)&&(U||J))return In.Transition.toString({...c,property:Hh})}}function kS(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function Qs(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const CS=[Ke.Down,Ke.Right,Ke.Up,Ke.Left],Di=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:o,over:i,scrollableAncestors:a}}=e;if(CS.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(u=>{if(!u||u!=null&&u.disabled)return;const f=s.get(u.id);if(f)switch(t.code){case Ke.Down:r.top<f.top&&l.push(u);break;case Ke.Up:r.top>f.top&&l.push(u);break;case Ke.Left:r.left>f.left&&l.push(u);break;case Ke.Right:r.left<f.left&&l.push(u);break}});const c=rC({collisionRect:r,droppableRects:s,droppableContainers:l});let d=ah(c,"id");if(d===i?.id&&c.length>1&&(d=c[1].id),d!=null){const u=o.get(n.id),f=o.get(d),g=f?s.get(f.id):null,m=f?.node.current;if(m&&g&&u&&f){const y=ki(m).some((C,N)=>a[N]!==C),b=Uh(u,f),S=SS(u,f),x=y||!b?{x:0,y:0}:{x:S?r.width-g.width:0,y:S?r.height-g.height:0},E={x:g.left,y:g.top};return x.x&&x.y?E:js(E,x)}}}};function Uh(t,e){return!Qs(t)||!Qs(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function SS(t,e){return!Qs(t)||!Qs(e)||!Uh(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}const _S=Object.freeze(Object.defineProperty({__proto__:null,SortableContext:Ti,arrayMove:Qr,defaultAnimateLayoutChanges:zh,defaultNewIndexGetter:Vh,hasSortableData:Qs,rectSortingStrategy:Ni,sortableKeyboardCoordinates:Di,useSortable:Ai,verticalListSortingStrategy:Jl},Symbol.toStringTag,{value:"Module"})),ES=()=>window.G7Core,Bh=({item:t,isSelected:e=!1,isExpanded:n=!1,level:r=0,onClick:s,onToggle:o,onExpandToggle:i,className:a="",selectedClassName:l="bg-blue-50 dark:bg-blue-900/30 border-blue-500",defaultClassName:c="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600",dragHandleClassName:d="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",iconContainerClassName:u="bg-gray-100 dark:bg-gray-700",contentClassName:f="",enableDrag:g=!0,toggleDisabled:m=!1})=>{const{attributes:p,listeners:y,setNodeRef:b,transform:S,transition:x,isDragging:E}=Ai({id:t.id}),k={transform:In.Transform.toString(S),transition:x,opacity:E?.5:1},C=r*24+12,_=`flex items-center gap-2 cursor-pointer transition-colors ${e?l:c}`,w=ES()?.style?.mergeClasses?.(_,a)??`${_} ${a}`.trim();return h.jsxs(I,{ref:b,style:k,className:w,onClick:s,children:[g&&h.jsx(I,{...p,...y,className:`flex-shrink-0 cursor-grab active:cursor-grabbing p-1 ${d}`,style:{paddingLeft:`${C}px`},children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),!g&&r>0&&h.jsx(I,{style:{paddingLeft:`${C}px`}}),g&&h.jsx(h.Fragment,{children:t.hasChildren?h.jsx(oe,{type:"button",onClick:M=>{M.stopPropagation(),i?.()},className:`flex-shrink-0 p-1 ${d}`,children:h.jsx(re,{name:n?"chevron-down":"chevron-right",className:"w-4 h-4"})}):h.jsx(I,{className:"flex-shrink-0 w-6"})}),h.jsx(I,{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center rounded ${u}`,children:h.jsx(re,{name:t.icon||"file",className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),h.jsxs(I,{className:`flex-1 min-w-0 ${f}`,children:[h.jsxs(I,{className:"flex items-center gap-1",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:t.name}),t.isModuleMenu&&h.jsx(re,{name:"cube",className:"w-2 h-2 text-gray-300 dark:text-gray-500 ml-2",title:t.moduleName})]}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400 truncate block",children:t.url})]}),h.jsx(I,{className:"flex-shrink-0",onClick:M=>M.stopPropagation(),children:h.jsx(za,{checked:t.isActive,onChange:()=>o?.(new MouseEvent("click")),size:"sm",disabled:m})})]})},MS=()=>window.G7Core;function jh(t,e,n=0,r=null){const s=[];for(const o of t)s.push({item:o,depth:n,parentId:r}),o.children?.length>0&&e.has(o.id)&&s.push(...jh(o.children,e,n+1,o.id));return s}function Rl(t,e){for(const n of t){if(n.id===e)return n;if(n.children){const r=Rl(n.children,e);if(r)return r}}return null}function Wh(t){const e=[];if(t.children)for(const n of t.children)e.push(n.id),e.push(...Wh(n));return e}function Gh(t,e){return t.filter(n=>n.id!==e).map(n=>n.children?.length>0?{...n,children:Gh(n.children,e)}:n)}function Yh(t,e,n,r){if(n===null){const s=[...t];return s.splice(r,0,e),s}return t.map(s=>{if(s.id===n){const o=[...s.children||[]];return o.splice(r,0,e),{...s,children:o}}return s.children?.length>0?{...s,children:Yh(s.children,e,n,r)}:s})}function Xh(t,e,n,r){if(e===null){const s=t.findIndex(i=>i.id===n),o=t.findIndex(i=>i.id===r);return s===-1||o===-1?t:Qr(t,s,o)}return t.map(s=>{if(s.id===e&&s.children){const o=s.children.findIndex(a=>a.id===n),i=s.children.findIndex(a=>a.id===r);return o===-1||i===-1?s:{...s,children:Qr(s.children,o,i)}}return s.children?.length>0?{...s,children:Xh(s.children,e,n,r)}:s})}function Kh(t){const e=t.map((s,o)=>({id:s.id,order:o+1})),n={},r=s=>{s.forEach(o=>{o.children?.length>0&&(n[o.id]=o.children.map((i,a)=>({id:i.id,order:a+1})),r(o.children))})};return r(t),{parent_menus:e,child_menus:n}}const NS=({items:t=[],selectedId:e,onSelect:n,onOrderChange:r,onToggleStatus:s,title:o,className:i="",listClassName:a="",childrenContainerClassName:l="bg-gray-50 dark:bg-gray-900/50",itemClassName:c="py-2.5 px-3 mx-4 my-2 rounded-lg border",itemSelectedClassName:d,itemDefaultClassName:u,titleClassName:f="px-4 py-3 border-b border-gray-200 dark:border-gray-700",enableDrag:g=!0,toggleDisabled:m=!1,id:p,editorAttrs:y})=>{const[b,S]=v.useState(new Set),[x,E]=v.useState(null),[k,C]=v.useState(t),N=v.useRef(!1),_=v.useRef(""),w=v.useRef(""),M=v.useCallback(B=>JSON.stringify(B),[]),O=v.useCallback(B=>B.map(G=>{const z=G.children?.map(K=>K.id).join(",")||"";return`${G.id}:${z}`}).join("|"),[]);v.useEffect(()=>{const B=O(t),G=M(t);if(N.current){const z=O(k);(B===z||B!==_.current)&&(N.current=!1,_.current=B,w.current=G,(B!==z||G!==M(k))&&C(t));return}G!==w.current&&(_.current=B,w.current=G,C(t))},[t,O,M,k]);const L=Hl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Di})),$=v.useCallback(B=>{if(typeof B=="string")return B;const z=MS()?.locale?.current?.()||"ko";return B[z]||B.en||Object.values(B)[0]||""},[]),F=v.useCallback(B=>{S(G=>{const z=new Set(G);return z.has(B)?z.delete(B):z.add(B),z})},[]),D=v.useCallback(B=>{n?.(B)},[n]),A=v.useCallback((B,G,z)=>{z.stopPropagation(),s?.(B,G)},[s]),T=B=>{E(B.active.id)},V=B=>{const{active:G,over:z}=B;if(E(null),!z||G.id===z.id)return;const K=W.find(Z=>Z.item.id===Number(G.id)),X=W.find(Z=>Z.item.id===Number(z.id));if(!(!K||!X))if(K.parentId===X.parentId){const Z=Xh(k,K.parentId,Number(G.id),Number(z.id));C(Z),N.current=!0,r?.(Kh(Z))}else{const Z=K.item;if(Wh(Z).includes(Number(z.id)))return;let ne=Gh(k,Z.id);const he=W.findIndex(ye=>ye.item.id===Number(G.id)),J=W.findIndex(ye=>ye.item.id===Number(z.id)),ce=he>J,ue=X.parentId;let ie;if(ue===null)ie=ne.findIndex(ye=>ye.id===Number(z.id)),ie===-1?ie=ne.length:ce||(ie+=1);else{const Se=Rl(ne,ue)?.children||[];ie=Se.findIndex(He=>He.id===Number(z.id)),ie===-1?ie=Se.length:ce||(ie+=1)}const ve={...Z,parent_id:ue,children:Z.children||[]};ne=Yh(ne,ve,ue,ie),C(ne),N.current=!0;const fe=Kh(ne);fe.moved_items=[{id:Z.id,new_parent_id:ue}],r?.(fe)}},H=B=>({id:B.id,name:$(B.name),slug:B.slug,url:B.url,icon:B.icon,isActive:B.is_active,isModuleMenu:!!B.module_id,moduleName:B.module?$(B.module.name):void 0,hasChildren:B.children&&B.children.length>0}),W=v.useMemo(()=>jh(k,b),[k,b]),j=v.useMemo(()=>W.map(B=>B.item.id),[W]),U=x?Rl(k,Number(x)):null;return h.jsxs(I,{className:i,id:p,...y,children:[o&&h.jsx(I,{className:f,children:h.jsx(Ir,{className:"text-sm font-medium text-gray-900 dark:text-white",children:o})}),h.jsxs(Ql,{sensors:L,collisionDetection:Ul,onDragStart:T,onDragEnd:V,children:[h.jsx(Ti,{items:j,strategy:Jl,children:h.jsx(I,{className:a,children:W.map(B=>h.jsx(I,{className:B.depth>0?l:"",children:h.jsx(Bh,{item:H(B.item),isSelected:e===B.item.id,isExpanded:b.has(B.item.id),level:B.depth,onClick:()=>D(B.item),onToggle:G=>A(B.item.id,B.item.is_active,G),onExpandToggle:()=>F(B.item.id),className:c,selectedClassName:d,defaultClassName:u,enableDrag:g,toggleDisabled:m})},B.item.id))})}),h.jsx(hS,{children:U?h.jsx(I,{className:"bg-white dark:bg-gray-800 shadow-lg rounded-lg border border-blue-500 p-3",children:h.jsx(I,{className:"flex items-center gap-2",children:h.jsx(I,{className:"text-sm font-medium text-gray-900 dark:text-white",children:$(U.name)})})}):null})]})]})},OS=[{value:"LayoutDashboard",label:"LayoutDashboard",faIcon:"tachometer-alt"},{value:"Settings",label:"Settings",faIcon:"cog"},{value:"Menu",label:"Menu",faIcon:"bars"},{value:"Users",label:"Users",faIcon:"users"},{value:"Package",label:"Package",faIcon:"cube"},{value:"Puzzle",label:"Puzzle",faIcon:"puzzle-piece"},{value:"FileText",label:"FileText",faIcon:"file-alt"},{value:"ShoppingCart",label:"ShoppingCart",faIcon:"shopping-cart"},{value:"MessageSquare",label:"MessageSquare",faIcon:"comment"},{value:"Home",label:"Home",faIcon:"home"},{value:"User",label:"User",faIcon:"user"},{value:"Search",label:"Search",faIcon:"search"},{value:"Bell",label:"Bell",faIcon:"bell"},{value:"Mail",label:"Mail",faIcon:"envelope"},{value:"Calendar",label:"Calendar",faIcon:"calendar"},{value:"Chart",label:"Chart",faIcon:"chart-bar"},{value:"Database",label:"Database",faIcon:"database"},{value:"Lock",label:"Lock",faIcon:"lock"},{value:"Globe",label:"Globe",faIcon:"globe"},{value:"Image",label:"Image",faIcon:"image"}],TS=({value:t,onChange:e,options:n=OS,placeholder:r,searchPlaceholder:s,noResultsText:o,className:i="",disabled:a=!1,name:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),[g,m]=v.useState(""),p=v.useRef(null),y=n.find(x=>{if(!t)return!1;if(t.includes("fa-")){const E=t.replace(/^(fas|far|fab|fal|fad)\s+fa-/,"");return x.faIcon===E||x.faIcon===t}return x.value===t||x.faIcon===t}),b=n.filter(x=>x.label.toLowerCase().includes(g.toLowerCase()));v.useEffect(()=>{const x=E=>{p.current&&!p.current.contains(E.target)&&(f(!1),m(""))};if(u)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);const S=x=>{const E=`fas fa-${x.faIcon}`;e?.(E),f(!1),m("")};return h.jsxs(I,{ref:p,className:`relative ${i}`,id:c,...d,children:[h.jsxs(oe,{type:"button",onClick:()=>!a&&f(!u),disabled:a,className:`
|
||
w-full flex items-center justify-between px-3 py-2
|
||
bg-white dark:bg-gray-800
|
||
border border-gray-300 dark:border-gray-600 rounded-lg
|
||
text-left text-sm
|
||
${a?"opacity-50 cursor-not-allowed":"hover:border-gray-400 dark:hover:border-gray-500"}
|
||
focus:outline-none focus:ring-2 focus:ring-blue-500
|
||
`,children:[h.jsx(I,{className:"flex items-center gap-2",children:y?h.jsxs(h.Fragment,{children:[h.jsx(re,{name:y.faIcon,className:"w-4 h-4 text-gray-600 dark:text-gray-400"}),h.jsx(Q,{className:"text-gray-900 dark:text-white",children:y.label})]}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:r})}),h.jsx(re,{name:"chevron-down",className:`w-4 h-4 text-gray-400 dark:text-gray-500 transition-transform ${u?"rotate-180":""}`})]}),l&&h.jsx("input",{type:"hidden",name:l,value:t||""}),u&&h.jsxs(I,{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-72 overflow-hidden",children:[h.jsx(I,{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:h.jsx(wt,{type:"text",value:g,onChange:x=>m(x.target.value),placeholder:s,className:"w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white",autoFocus:!0})}),h.jsx(I,{className:"max-h-56 overflow-y-auto",children:b.length>0?b.map(x=>h.jsxs(oe,{type:"button",onClick:()=>S(x),className:`
|
||
w-full flex items-center gap-3 px-3 py-2 text-left text-sm
|
||
${y?.faIcon===x.faIcon?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"}
|
||
`,children:[h.jsx(re,{name:x.faIcon,className:"w-4 h-4"}),h.jsx(Q,{children:x.label}),y?.faIcon===x.faIcon&&h.jsx(re,{name:"check",className:"w-4 h-4 ml-auto text-blue-600"})]},x.value)):h.jsx(I,{className:"px-3 py-4 text-sm text-gray-500 dark:text-gray-400 text-center",children:o})})]})]})},ec=({defaultOpen:t=!1,isOpen:e,onToggle:n,className:r="",style:s,children:o,disabled:i=!1,id:a,editorAttrs:l})=>{const[c,d]=v.useState(t),u=e!==void 0,f=u?e:c,g=v.useRef(null),[m,p]=v.useState(t?void 0:0),y=()=>{if(i)return;const S=!f;u||d(S),n?.(S)};v.useEffect(()=>{if(g.current)if(f){p(g.current.scrollHeight);const S=setTimeout(()=>{p(void 0)},300);return()=>clearTimeout(S)}else p(g.current.scrollHeight),requestAnimationFrame(()=>{p(0)})},[f]);const b={};if(v.Children.forEach(o,S=>{if(v.isValidElement(S)){const x=S.props?.slot;x==="trigger"?b.trigger=S:x==="content"&&(b.content=S)}}),!b.trigger&&!b.content){const S=v.Children.toArray(o);S.length>=2?(b.trigger=S[0],b.content=S.slice(1)):S.length===1&&(b.content=S[0])}return h.jsxs(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${r}`,style:s,id:a,...l,children:[h.jsxs(oe,{type:"button",onClick:y,disabled:i,className:`w-full flex items-center justify-between p-3 text-left bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${i?"opacity-50 cursor-not-allowed":""} ${f?"border-b border-gray-200 dark:border-gray-700":""}`,"aria-expanded":f,children:[h.jsx(I,{className:"flex-1",children:b.trigger}),!b.trigger&&h.jsx("svg",{className:`w-5 h-5 text-gray-500 dark:text-gray-400 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h.jsx(I,{ref:g,className:"overflow-hidden transition-all duration-300 ease-in-out",style:{height:m!==void 0?`${m}px`:"auto"},children:h.jsx(I,{className:"bg-white dark:bg-gray-800",children:b.content})})]})},Js=window.G7Core,qh=Js?.useControllableState,Zh=(t,e)=>window.G7Core?.t?.(t,e)??t,AS={"":"common.scope_type_all_desc",self:"common.scope_type_self_desc",role:"common.scope_type_role_desc"},DS=({options:t,value:e,onChange:n,disabled:r=!1})=>{const[s,o]=v.useState(!1),[i,a]=v.useState({}),l=v.useRef(null),c=t.find(u=>u.value===e)??t[0];v.useEffect(()=>{if(!s)return;const u=g=>{l.current&&!l.current.contains(g.target)&&o(!1)},f=()=>{if(!l.current)return;const g=l.current.getBoundingClientRect();a({position:"fixed",top:g.bottom+4,right:window.innerWidth-g.right,zIndex:9999})};return document.addEventListener("mousedown",u),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s]);const d=v.useCallback(()=>{if(r||!l.current)return;const u=l.current.getBoundingClientRect();a({position:"fixed",top:u.bottom+4,right:window.innerWidth-u.right,zIndex:9999}),o(f=>!f)},[r]);return h.jsxs(I,{ref:l,className:"relative flex-shrink-0",children:[h.jsxs(I,{role:"button",tabIndex:0,onClick:u=>{u.stopPropagation(),u.preventDefault(),d()},onMouseDown:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.stopPropagation(),u.preventDefault(),d()),u.key==="Escape"&&o(!1)},className:`flex items-center gap-1 text-xs px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-pointer select-none ${r?"opacity-50 cursor-not-allowed":"hover:border-blue-400 dark:hover:border-blue-500"}`,children:[h.jsx(Q,{children:c?.label??""}),h.jsx(re,{name:de.ChevronDown,className:"w-3 h-3 text-gray-400 dark:text-gray-500"})]}),s&&h.jsx(I,{style:i,className:"w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg py-1",children:t.map(u=>{const f=u.value??"",g=AS[f],m=g?Zh(g):"",p=u.value===e;return h.jsxs(I,{role:"option","aria-selected":p,onClick:y=>{y.stopPropagation(),y.preventDefault(),n(u.value),o(!1)},onMouseDown:y=>y.stopPropagation(),className:`px-3 py-2 cursor-pointer transition-colors ${p?"bg-blue-50 dark:bg-blue-900/30":"hover:bg-gray-50 dark:hover:bg-gray-700/50"}`,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[h.jsx(Q,{className:`text-xs font-medium ${p?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-white"}`,children:u.label}),p&&h.jsx(re,{name:de.Check,className:"w-3.5 h-3.5 text-blue-600 dark:text-blue-400"})]}),m&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:m})]},f||"__null__")})})]})},IS=(t,e)=>{if(t.length!==e.length)return!1;const n=[...t].sort((s,o)=>s.id-o.id),r=[...e].sort((s,o)=>s.id-o.id);return n.every((s,o)=>s.id===r[o].id&&s.scope_type===r[o].scope_type)},LS=({data:t=[],value:e=[],onChange:n,scopeOptions:r=[],className:s="",disabled:o=!1,desktopColumns:i=2,installedModules:a=[],installedPlugins:l=[],id:c,editorAttrs:d})=>{const u=v.useCallback(M=>{if(n){const O=Js?.createChangeEvent?Js.createChangeEvent({value:M}):{target:{value:M}};n(O)}},[n]),[f,g]=qh?qh(e,[],u,{isEqual:IS}):(()=>{const[M,O]=v.useState(e),L=v.useRef(n);L.current=n;const $=v.useRef(!1);v.useEffect(()=>{if($.current){$.current=!1;return}O(e)},[e]);const F=v.useCallback(D=>{$.current=!0,O(A=>{const T=typeof D=="function"?D(A):D;if(L.current){const V=Js?.createChangeEvent?Js.createChangeEvent({value:T}):{target:{value:T}};L.current(V)}return T})},[]);return[M,F]})(),m=v.useMemo(()=>new Set(f.map(M=>M.id)),[f]),p=v.useCallback(M=>M.is_assignable?[M.id]:M.children.flatMap(O=>p(O)),[]),y=v.useCallback(M=>{const O=p(M);return O.length>0&&O.every(L=>m.has(L))},[m,p]),b=v.useCallback(M=>{const O=p(M),L=O.filter($=>m.has($)).length;return L>0&&L<O.length},[m,p]),S=v.useCallback(M=>p(M).filter(L=>m.has(L)).length,[m,p]),x=v.useCallback((M,O)=>{o||g(L=>O?[...L,{id:M,scope_type:null}]:L.filter($=>$.id!==M))},[o,g]),E=v.useCallback((M,O)=>{if(o)return;const L=p(M),$=new Set(L);g(F=>{if(O){const D=new Set(F.map(T=>T.id)),A=L.filter(T=>!D.has(T)).map(T=>({id:T,scope_type:null}));return[...F,...A]}else return F.filter(D=>!$.has(D.id))})},[o,p,g]),k=v.useCallback((M,O)=>{o||g(L=>L.map($=>$.id===M?{...$,scope_type:O}:$))},[o,g]),C=M=>{const O=m.has(M.id),L=!!M.resource_route_key,$=O&&L&&r.length>0,F=f.find(D=>D.id===M.id)?.scope_type??null;return h.jsxs(en,{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${O?"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50"} ${o?"opacity-50 cursor-not-allowed":""}`,children:[h.jsx(wt,{type:"checkbox",checked:O,onChange:D=>{D.stopPropagation(),x(M.id,D.target.checked)},disabled:o,className:"w-4 h-4 mt-0.5 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsxs(I,{className:"flex-1 min-w-0",children:[h.jsxs(I,{className:"flex items-center justify-between gap-2",children:[h.jsx(Q,{className:"text-sm font-medium text-gray-900 dark:text-white",children:M.name}),$&&h.jsx(DS,{options:r,value:F,onChange:D=>k(M.id,D),disabled:o})]}),M.description&&h.jsx(Q,{className:"block text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:M.description})]})]},M.id)},N=(M,O)=>{const L=y(M),$=b(M),F=S(M),D=M.children.filter(V=>V.is_assignable);if(D.length===0&&M.children.length===0)return null;const A=M.children.some(V=>!V.is_assignable),T=i===1?"grid-cols-1":i===3?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2";return h.jsxs(ec,{defaultOpen:!1,className:"border-0 rounded-none",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:L,ref:V=>{V&&(V.indeterminate=$)},onChange:V=>{V.stopPropagation(),E(M,V.target.checked)},onClick:V=>V.stopPropagation(),onMouseDown:V=>V.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:de.Folder,className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:M.name}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-1",children:[F,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:`pl-8 grid ${T} gap-2 py-2`,children:A?M.children.map(V=>V.is_assignable?C(V):N(V)):D.map(V=>C(V))})]},M.id)},_=M=>{if(M.extension_type==="core")return"core";if(M.extension_type==="module")return"module";if(M.extension_type==="plugin")return"plugin";const O=M.extension_identifier??M.module??"";return O==="core"||!O?"core":l?.some($=>$.identifier===O)?"plugin":"module"},w=M=>{const O=y(M),L=b(M),$=S(M),F=_(M);return h.jsxs(ec,{defaultOpen:!1,className:"mb-2",children:[h.jsxs(I,{slot:"trigger",className:"flex items-center gap-3 w-full py-2",children:[h.jsx("input",{type:"checkbox",checked:O,ref:D=>{D&&(D.indeterminate=L)},onChange:D=>{D.stopPropagation(),E(M,D.target.checked)},onClick:D=>D.stopPropagation(),onMouseDown:D=>D.stopPropagation(),disabled:o,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(re,{name:F==="core"?de.Cog:de.Cube,className:"w-5 h-5 text-gray-400 dark:text-gray-500"}),h.jsx(Q,{className:"font-medium text-gray-900 dark:text-white",children:M.name}),F!=="core"&&h.jsx(Rf,{type:F,identifier:M.extension_identifier??M.module,installedModules:a,installedPlugins:l}),h.jsxs(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 ml-2",children:[$,"/",M.leaf_count]}),h.jsx(re,{name:de.ChevronDown,className:"w-4 h-4 text-gray-400 dark:text-gray-500 ml-auto"})]}),h.jsx(I,{slot:"content",className:"pl-8 space-y-2 pb-2",children:M.children.map(D=>D.is_assignable?C(D):N(D))})]},M.id)};return t.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${s}`,id:c,...d,children:Zh("common.no_data")??"데이터가 없습니다."}):h.jsx(I,{className:`space-y-2 ${s}`,id:c,...d,children:t.map(M=>w(M))})};function PS({text:t,keyword:e}){if(!e||!t)return h.jsx(h.Fragment,{children:t});const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=t.split(new RegExp(`(${n})`,"gi"));return h.jsx(h.Fragment,{children:r.map((s,o)=>s.toLowerCase()===e.toLowerCase()?h.jsx(Q,{className:"bg-yellow-200 dark:bg-yellow-700 rounded px-0.5",children:s},o):s)})}const $S=({data:t=[],expandedIds:e=[],selectedIds:n=[],searchKeyword:r="",showProductCount:s=!1,selectable:o=!1,className:i="",onToggle:a,onSelectionChange:l,id:c,editorAttrs:d})=>{const u=v.useCallback(y=>{if(!a)return;const b=e.includes(y)?e.filter(S=>S!==y):[...e,y];a(b)},[e,a]),f=v.useCallback((y,b)=>{if(!l)return;const S=b?[...n,y]:n.filter(x=>x!==y);l(S)},[n,l]),g=v.useMemo(()=>{if(!r)return null;const y=new Set,b=S=>{for(const x of S)(x.localized_name||x.name).toLowerCase().includes(r.toLowerCase())&&y.add(x.id),x.children&&b(x.children)};return b(t),y},[t,r]),m=v.useCallback(y=>!g||g.has(y.id)?!0:(y.children??[]).some(b=>m(b)),[g]),p=(y,b=0)=>{const S=(y.children??[]).length>0,x=e.includes(y.id),E=n.includes(y.id),k=y.localized_name||y.name;return r&&!m(y)?null:h.jsxs(I,{"data-testid":`category-node-${y.id}`,children:[h.jsxs(I,{className:`flex items-center gap-2 py-1.5 px-2 rounded cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors ${b>0?"ml-"+Math.min(b*5,20):""}`,style:b>0?{marginLeft:`${b*20}px`}:void 0,children:[S?h.jsx(I,{className:"flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-400 dark:text-gray-500",onClick:()=>u(y.id),"data-testid":`toggle-${y.id}`,children:h.jsx(re,{name:x?de.CaretDown:de.CaretRight,className:"text-xs"})}):h.jsx(I,{className:"flex-shrink-0 w-5 h-5"}),o&&h.jsx(vn,{checked:E,onChange:C=>{C.stopPropagation(),f(y.id,C.target.checked)},className:"flex-shrink-0","data-testid":`checkbox-${y.id}`}),h.jsx(re,{name:de.Folder,className:`flex-shrink-0 text-sm ${S?"text-yellow-500 dark:text-yellow-400":"text-gray-400 dark:text-gray-500"}`}),h.jsx(Q,{className:"text-sm text-gray-700 dark:text-gray-300 select-none",onClick:()=>S&&u(y.id),children:h.jsx(PS,{text:k,keyword:r})}),s&&y.products_count!==void 0&&h.jsx(Q,{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-500 dark:bg-gray-700 dark:text-gray-400 ml-1",children:y.products_count})]}),S&&x&&h.jsx(I,{"data-testid":`children-${y.id}`,children:(y.children??[]).map(C=>p(C,b+1))})]},y.id)};return t.length===0?h.jsx(I,{className:`text-sm text-gray-400 dark:text-gray-500 py-4 text-center ${i}`,id:c,...d,children:"데이터가 없습니다."}):h.jsx(I,{className:`border border-gray-200 dark:border-gray-700 rounded-lg p-2 max-h-80 overflow-y-auto ${i}`,id:c,...d,children:t.map(y=>p(y,0))})},Qh="carousel",Rs="controller",FS="navigation",VS="no-scroll",tc="portal",zS="root",Jh="toolbar",HS="counter",eo="fullscreen",Rh="slideshow",to="thumbnails",eg="zoom",Jr="loading",nc="playing",no="error",ro="complete",US="placeholder",so=t=>`active-slide-${t}`,BS=so(Jr),jS=so(nc),WS=so(no),GS=so(ro),tg="fullsize",Rr="flex_center",YS="no_scroll",ng="no_scroll_padding",rc="slide",rg="slide_wrapper",XS="slide_wrapper_interactive",tr="prev",nr="next",sc="swipe",es="close",sg="onPointerDown",og="onPointerMove",ig="onPointerUp",ag="onPointerLeave",lg="onPointerCancel",oc="onKeyDown",KS="onKeyUp",ic="onWheel",qS="Escape",ZS="ArrowLeft",QS="ArrowRight",JS="button",Ii="icon",cg="contain",dg="cover",ug="Unknown action type",fg="yarl__";function Ft(...t){return[...t].filter(Boolean).join(" ")}function Te(t){return`${fg}${t}`}function ut(t){return`--${fg}${t}`}function hr(t,e){return`${t}${e?`_${e}`:""}`}function gr(t){return e=>hr(t,e)}function pr(t,e){var n;return(n=t?.[e])!==null&&n!==void 0?n:e}function hg(t,e,n){return pr(t,"{index} of {total}").replace(/\{index}/g,`${dc(n,e.length)+1}`).replace(/\{total}/g,`${e.length}`)}function ts(...t){return()=>{t.forEach(e=>{e()})}}function cn(t,e,n){return()=>{const r=P.useContext(n);if(!r)throw new Error(`${t} must be used within a ${e}.Provider`);return r}}function ac(){return typeof window<"u"}function lc(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function mr(t){return t.type===void 0||t.type==="image"}function cc(t,e){return t.imageFit===dg||t.imageFit!==cg&&e===dg}function Li(t){return typeof t=="string"?Number.parseInt(t,10):t}function Pi(t){if(typeof t=="number")return{pixel:t};if(typeof t=="string"){const e=Li(t);return t.endsWith("%")?{percent:e}:{pixel:e}}return{pixel:0}}function RS(t,e){const n=Pi(e),r=n.percent!==void 0?t.width/100*n.percent:n.pixel;return{width:Math.max(t.width-2*r,0),height:Math.max(t.height-2*r,0)}}function e_(){return(ac()?window?.devicePixelRatio:void 0)||1}function dc(t,e){return e>0?(t%e+e)%e:0}function uc(t){return t.length>0}function fc(t,e){return t[dc(e,t.length)]}function hc(t,e){return uc(t)?fc(t,e):void 0}function gg(t){return mr(t)?t.src:void 0}function $i(t,e,n){if(!n)return t;const{buttons:r,...s}=t,o=r.findIndex(a=>a===e),i=P.isValidElement(n)?P.cloneElement(n,{key:e},null):n;if(o>=0){const a=[...r];return a.splice(o,1,i),{buttons:a,...s}}return{buttons:[i,...r],...s}}function pg(t,e,n=0){return Math.min(t.preload,Math.max(t.finite?e.length-1:Math.floor(e.length/2),n))}const t_=Number(P.version.split(".")[0])>=19;function n_(t){return{inert:t_?t:t?"":void 0}}function r_(t){t.scrollTop}const gc={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[es]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:cg,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 dn(t,e){return{name:t,component:e}}function Nt(t,e){return{module:t,children:e}}function mg(t,e,n){return t.module.name===e?n(t):t.children?[Nt(t.module,t.children.flatMap(r=>{var s;return(s=mg(r,e,n))!==null&&s!==void 0?s:[]}))]:[t]}function ns(t,e,n){return t.flatMap(r=>{var s;return(s=mg(r,e,n))!==null&&s!==void 0?s:[]})}function s_(t,e=[],n=[]){let r=t;const s=g=>{const m=[...r];for(;m.length>0;){const p=m.pop();if(p?.module.name===g)return!0;p?.children&&m.push(...p.children)}return!1},o=(g,m)=>{if(g===""){r=[Nt(m,r)];return}r=ns(r,g,p=>[Nt(m,[p])])},i=(g,m)=>{r=ns(r,g,p=>[Nt(p.module,[Nt(m,p.children)])])},a=(g,m,p)=>{r=ns(r,g,y=>{var b;return[Nt(y.module,[...p?[Nt(m)]:[],...(b=y.children)!==null&&b!==void 0?b:[],...p?[]:[Nt(m)]])]})},l=(g,m,p)=>{r=ns(r,g,y=>[...p?[Nt(m)]:[],y,...p?[]:[Nt(m)]])},c=g=>{i(Rs,g)},d=(g,m)=>{r=ns(r,g,p=>[Nt(m,p.children)])},u=g=>{r=ns(r,g,m=>m.children)},f=g=>{n.push(g)};return e.forEach(g=>{g({contains:s,addParent:o,append:i,addChild:a,addSibling:l,addModule:c,replace:d,remove:u,augment:f})}),{config:r,augmentation:g=>n.reduce((m,p)=>p(m),g)}}const bg=P.createContext(null),pc=cn("useA11yContext","A11yContext",bg);function o_({children:t}){const[e,n]=P.useState(!1),[r,s]=P.useState(!1),o=P.useMemo(()=>({focusWithin:e,trackFocusWithin:(a,l)=>{const c=d=>u=>{var f;u.currentTarget.contains(u.relatedTarget)||n(d),(f=d?a:l)===null||f===void 0||f(u)};return{onFocus:c(!0),onBlur:c(!1)}},autoPlaying:r,setAutoPlaying:s}),[e,r]);return P.createElement(bg.Provider,{value:o},t)}const yg=P.createContext(null),rs=cn("useDocument","DocumentContext",yg);function i_({nodeRef:t,children:e}){const n=P.useMemo(()=>{const r=o=>{var i;return((i=o||t.current)===null||i===void 0?void 0:i.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var i;return((i=r(o))===null||i===void 0?void 0:i.defaultView)||window}}},[t]);return P.createElement(yg.Provider,{value:n},e)}const vg=P.createContext(null),ss=cn("useEvents","EventsContext",vg);function a_({children:t}){const[e]=P.useState({});P.useEffect(()=>()=>{Object.keys(e).forEach(r=>delete e[r])},[e]);const n=P.useMemo(()=>{const r=(i,a)=>{var l;(l=e[i])===null||l===void 0||l.splice(0,e[i].length,...e[i].filter(c=>c!==a))};return{publish:(...[i,a])=>{var l;(l=e[i])===null||l===void 0||l.forEach(c=>c(a))},subscribe:(i,a)=>(e[i]||(e[i]=[]),e[i].push(a),()=>r(i,a)),unsubscribe:r}},[e]);return P.createElement(vg.Provider,{value:n},t)}const xg=P.createContext(null),Ot=cn("useLightboxProps","LightboxPropsContext",xg);function wg({children:t,...e}){return P.createElement(xg.Provider,{value:e},t)}const kg=P.createContext(null),un=cn("useLightboxState","LightboxStateContext",kg),Cg=P.createContext(null),l_=cn("useLightboxDispatch","LightboxDispatchContext",Cg);function c_(t,e){switch(e.type){case"swipe":{const{slides:n}=t,r=e?.increment||0,s=t.globalIndex+r,o=dc(s,n.length),i=hc(n,o),a=r||e.duration!==void 0?{increment:r,duration:e.duration,easing:e.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:s,currentSlide:i,animation:a}}case"update":return e.slides!==t.slides||e.index!==t.currentIndex?{slides:e.slides,currentIndex:e.index,globalIndex:e.index,currentSlide:hc(e.slides,e.index)}:t;default:throw new Error(ug)}}function d_({slides:t,index:e,children:n}){const[r,s]=P.useReducer(c_,{slides:t,currentIndex:e,globalIndex:e,currentSlide:hc(t,e)});P.useEffect(()=>{s({type:"update",slides:t,index:e})},[t,e]);const o=P.useMemo(()=>({...r,state:r,dispatch:s}),[r,s]);return P.createElement(Cg.Provider,{value:s},P.createElement(kg.Provider,{value:o},n))}const Sg=P.createContext(null),oo=cn("useTimeouts","TimeoutsContext",Sg);function u_({children:t}){const[e]=P.useState([]);P.useEffect(()=>()=>{e.forEach(r=>window.clearTimeout(r)),e.splice(0,e.length)},[e]);const n=P.useMemo(()=>{const r=i=>{e.splice(0,e.length,...e.filter(a=>a!==i))};return{setTimeout:(i,a)=>{const l=window.setTimeout(()=>{r(l),i()},a);return e.push(l),l},clearTimeout:i=>{i!==void 0&&(r(i),window.clearTimeout(i))}}},[e]);return P.createElement(Sg.Provider,{value:n},t)}const os=P.forwardRef(function({label:e,className:n,icon:r,renderIcon:s,onClick:o,style:i,...a},l){const{styles:c,labels:d}=Ot(),u=pr(d,e);return P.createElement("button",{ref:l,type:"button",title:u,"aria-label":u,className:Ft(Te(JS),n),onClick:o,style:{...i,...c.button},...a},s?s():P.createElement(r,{className:Te(Ii),style:c.icon}))});function _g(t,e){const n=r=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},e);return n.displayName=t,n}function Kt(t,e){return _g(t,P.createElement("g",{fill:"currentColor"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e))}function f_(t,e){return _g(t,P.createElement(P.Fragment,null,P.createElement("defs",null,P.createElement("mask",{id:"strike"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),P.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),P.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),P.createElement("g",{fill:"currentColor",mask:"url(#strike)"},P.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),e)))}const h_=Kt("Close",P.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),g_=Kt("Previous",P.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),p_=Kt("Next",P.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),m_=Kt("Loading",P.createElement(P.Fragment,null,Array.from({length:8}).map((t,e,n)=>P.createElement("line",{key:e,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(e+1),transform:`rotate(${360/n.length*e}, 12, 12)`})))),b_=Kt("Error",P.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),Cn=ac()?P.useLayoutEffect:P.useEffect;function mc(){const[t,e]=P.useState(!1);return P.useEffect(()=>{var n,r;const s=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");e(s?.matches);const o=i=>e(i.matches);return(r=s?.addEventListener)===null||r===void 0||r.call(s,"change",o),()=>{var i;return(i=s?.removeEventListener)===null||i===void 0?void 0:i.call(s,"change",o)}},[]),t}function y_(t){let e=0,n=0,r=0;const o=window.getComputedStyle(t).transform.match(/matrix.*\((.+)\)/);if(o){const i=o[1].split(",").map(Li);i.length===6?(e=i[4],n=i[5]):i.length===16&&(e=i[12],n=i[13],r=i[14])}return{x:e,y:n,z:r}}function bc(t,e){const n=P.useRef(void 0),r=P.useRef(void 0),s=mc();return Cn(()=>{var o,i,a;if(t.current&&n.current!==void 0&&!s){const{keyframes:l,duration:c,easing:d,onfinish:u}=e(n.current,t.current.getBoundingClientRect(),y_(t.current))||{};if(l&&c){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(i=t.current).animate)===null||a===void 0?void 0:a.call(i,l,{duration:c,easing:d})}catch(f){console.error(f)}r.current&&(r.current.onfinish=()=>{r.current=void 0,u?.()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function Eg(){const t=P.useRef(null),e=P.useRef(void 0),[n,r]=P.useState();return{setContainerRef:P.useCallback(o=>{t.current=o,e.current&&(e.current.disconnect(),e.current=void 0);const i=()=>{if(o){const a=window.getComputedStyle(o),l=c=>parseFloat(c)||0;r({width:Math.round(o.clientWidth-l(a.paddingLeft)-l(a.paddingRight)),height:Math.round(o.clientHeight-l(a.paddingTop)-l(a.paddingBottom))})}else r(void 0)};i(),o&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(i),e.current.observe(o))},[]),containerRef:t,containerRect:n}}function Fi(){const t=P.useRef(void 0),{setTimeout:e,clearTimeout:n}=oo();return P.useCallback((r,s)=>{n(t.current),t.current=e(r,s>0?s:0)},[e,n])}function Ye(t){const e=P.useRef(t);return Cn(()=>{e.current=t}),P.useCallback((...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Mg(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function yc(t,e){return P.useMemo(()=>t==null&&e==null?null:n=>{Mg(t,n),Mg(e,n)},[t,e])}function Ng(t,e=!1){const n=P.useRef(!1);Cn(()=>{e&&n.current&&(n.current=!1,t())},[e,t]);const r=P.useCallback(()=>{n.current=!0},[]),s=P.useCallback(()=>{n.current=!1},[]);return{onFocus:r,onBlur:s}}function Vi(){const[t,e]=P.useState(!1);return Cn(()=>{e(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),t}function Og(){const[t]=P.useState({}),e=P.useCallback((s,o)=>{var i;(i=t[s])===null||i===void 0||i.forEach(a=>{o.isPropagationStopped()||a(o)})},[t]),n=P.useMemo(()=>({onPointerDown:s=>e(sg,s),onPointerMove:s=>e(og,s),onPointerUp:s=>e(ig,s),onPointerLeave:s=>e(ag,s),onPointerCancel:s=>e(lg,s),onKeyDown:s=>e(oc,s),onKeyUp:s=>e(KS,s),onWheel:s=>e(ic,s)}),[e]),r=P.useCallback((s,o)=>(t[s]||(t[s]=[]),t[s].unshift(o),()=>{const i=t[s];i&&i.splice(0,i.length,...i.filter(a=>a!==o))}),[t]);return{registerSensors:n,subscribeSensors:r}}function Tg(t,e){const n=P.useRef(0),r=Fi(),s=Ye((...o)=>{n.current=Date.now(),t(o)});return P.useCallback((...o)=>{r(()=>{s(o)},e-(Date.now()-n.current))},[e,s,r])}const vc=gr("slide"),xc=gr("slide_image");function br({slide:t,offset:e,render:n,rect:r,imageFit:s,imageProps:o,onClick:i,onLoad:a,onError:l,style:c}){var d,u,f,g,m,p,y,b;const[S,x]=P.useState(Jr),{publish:E}=ss(),{setTimeout:k}=oo(),C=P.useRef(null);P.useEffect(()=>{e===0&&E(so(S))},[e,S,E]);const N=Ye(U=>{("decode"in U?U.decode():Promise.resolve()).catch(()=>{}).then(()=>{U.parentNode&&(x(ro),k(()=>{a?.(U)},0))})}),_=P.useCallback(U=>{C.current=U,U?.complete&&N(U)},[N]),w=P.useCallback(U=>{N(U.currentTarget)},[N]),M=Ye(()=>{x(no),l?.()}),O=cc(t,s),L=(U,B)=>Number.isFinite(U)?U:B,$=L(Math.max(...((u=(d=t.srcSet)===null||d===void 0?void 0:d.map(U=>U.width))!==null&&u!==void 0?u:[]).concat(t.width?[t.width]:[]).filter(Boolean)),((f=C.current)===null||f===void 0?void 0:f.naturalWidth)||0),F=L(Math.max(...((m=(g=t.srcSet)===null||g===void 0?void 0:g.map(U=>U.height))!==null&&m!==void 0?m:[]).concat(t.height?[t.height]:[]).filter(Boolean)),((p=C.current)===null||p===void 0?void 0:p.naturalHeight)||0),D=$&&F?{maxWidth:`min(${$}px, 100%)`,maxHeight:`min(${F}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},A=(y=t.srcSet)===null||y===void 0?void 0:y.sort((U,B)=>U.width-B.width).map(U=>`${U.src} ${U.width}w`).join(", "),T=()=>r&&!O&&t.width&&t.height?r.height/t.height*t.width:Number.MAX_VALUE,V=A&&r&&ac()?`${Math.round(Math.min(T(),r.width))}px`:void 0,{style:H,className:W,...j}=o||{};return P.createElement(P.Fragment,null,P.createElement("img",{ref:_,onLoad:w,onError:M,onClick:i,draggable:!1,className:Ft(Te(xc()),O&&Te(xc("cover")),S!==ro&&Te(xc("loading")),W),style:{...D,...c,...H},...j,alt:(b=t.alt)!==null&&b!==void 0?b:"",sizes:V,srcSet:A,src:t.src}),S!==ro&&P.createElement("div",{className:Te(vc(US))},S===Jr&&(n?.iconLoading?n.iconLoading():P.createElement(m_,{className:Ft(Te(Ii),Te(vc(Jr)))})),S===no&&(n?.iconError?n.iconError():P.createElement(b_,{className:Ft(Te(Ii),Te(vc(no)))}))))}const v_=P.forwardRef(function({className:e,children:n,onFocus:r,onBlur:s,...o},i){const a=P.useRef(null),{trackFocusWithin:l}=pc();return P.createElement(i_,{nodeRef:a},P.createElement("div",{ref:yc(i,a),className:Ft(Te("root"),e),...l(r,s),...o},n))});var Vt;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL",t[t.ANIMATION=3]="ANIMATION"})(Vt||(Vt={}));function Ag(t,e,n,r,s){P.useEffect(()=>s?()=>{}:ts(t(sg,e),t(og,n),t(ig,r),t(ag,r),t(lg,r)),[t,e,n,r,s])}var Sn;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL"})(Sn||(Sn={}));const wc=30;function x_({disableSwipeNavigation:t,closeOnBackdropClick:e},n,r,s,o,i,a,l,c,d,u,f,g,m,p,y){const b=P.useRef(0),S=P.useRef([]),x=P.useRef(void 0),E=P.useRef(0),k=P.useRef(Sn.NONE),C=P.useCallback($=>{x.current===$.pointerId&&(x.current=void 0,k.current=Sn.NONE);const F=S.current;F.splice(0,F.length,...F.filter(D=>D.pointerId!==$.pointerId))},[]),N=P.useCallback($=>{C($),$.persist(),S.current.push($)},[C]),_=P.useCallback($=>S.current.find(({pointerId:F})=>$.pointerId===F),[]),w=Ye($=>{N($)}),M=($,F)=>u&&$>F||d&&$<-F,O=Ye($=>{const F=_($);if(F)if(x.current===$.pointerId){const D=Date.now()-E.current,A=b.current;k.current===Sn.SWIPE?Math.abs(A)>.3*s||Math.abs(A)>5&&D<o?l(A,D):c(A):k.current===Sn.PULL&&(M(A,2*wc)?m(A,D):p(A)),b.current=0,k.current=Sn.NONE}else{const{target:D}=$;e&&D instanceof HTMLElement&&D===F.target&&(D.classList.contains(Te(rc))||D.classList.contains(Te(rg)))&&y()}C($)}),L=Ye($=>{const F=_($);if(F){const D=x.current===$.pointerId;if($.buttons===0){D&&b.current!==0?O($):C(F);return}const A=$.clientX-F.clientX,T=$.clientY-F.clientY;if(x.current===void 0){const V=H=>{N($),x.current=$.pointerId,E.current=Date.now(),k.current=H};Math.abs(A)>Math.abs(T)&&Math.abs(A)>wc&&r(A)?t||(V(Sn.SWIPE),i()):Math.abs(T)>Math.abs(A)&&M(T,wc)&&(V(Sn.PULL),f())}else D&&(k.current===Sn.SWIPE?(b.current=A,a(A)):k.current===Sn.PULL&&(b.current=T,g(T)))}});Ag(n,w,L,O)}function w_({preventDefaultWheelX:t,preventDefaultWheelY:e}){const n=P.useRef(null),r=Ye(s=>{const o=Math.abs(s.deltaX)>Math.abs(s.deltaY);(o&&t||!o&&e||s.ctrlKey)&&s.preventDefault()});return P.useCallback(s=>{var o;s?s.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=s},[r])}function k_(t,e,n,r,s,o,i,a,l){const c=P.useRef(0),d=P.useRef(0),u=P.useRef(void 0),f=P.useRef(void 0),g=P.useRef(0),m=P.useRef(void 0),p=P.useRef(0),{setTimeout:y,clearTimeout:b}=oo(),S=P.useCallback(()=>{u.current&&(b(u.current),u.current=void 0)},[b]),x=P.useCallback(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),E=Ye(()=>{t!==Vt.SWIPE&&(c.current=0,p.current=0,S(),x())});P.useEffect(E,[t,E]);const k=Ye(N=>{f.current=void 0,c.current===N&&l(c.current)}),C=Ye(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const _=w=>{g.current=w,b(m.current),m.current=w>0?y(()=>{g.current=0,m.current=void 0},300):void 0};if(t===Vt.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){_(N.deltaX);return}if(!n(-N.deltaX))return;if(d.current+=N.deltaX,S(),Math.abs(d.current)>30)d.current=0,_(0),p.current=Date.now(),o();else{const w=d.current;u.current=y(()=>{u.current=void 0,w===d.current&&(d.current=0)},s)}}else if(t===Vt.SWIPE){let w=c.current-N.deltaX;if(w=Math.min(Math.abs(w),r)*Math.sign(w),c.current=w,i(w),x(),Math.abs(w)>.2*r){_(N.deltaX),a(w,Date.now()-p.current);return}f.current=y(()=>k(w),2*s)}else _(N.deltaX)});P.useEffect(()=>e(ic,C),[e,C])}const Dg=gr("container"),Ig=P.createContext(null),_n=cn("useController","ControllerContext",Ig);function C_({children:t,...e}){var n;const{carousel:r,animation:s,controller:o,on:i,styles:a,render:l}=e,{closeOnPullUp:c,closeOnPullDown:d,preventDefaultWheelX:u,preventDefaultWheelY:f}=o,[g,m]=P.useState(),p=un(),y=l_(),[b,S]=P.useState(Vt.NONE),x=P.useRef(0),E=P.useRef(0),k=P.useRef(1),{registerSensors:C,subscribeSensors:N}=Og(),{subscribe:_,publish:w}=ss(),M=Fi(),O=Fi(),L=Fi(),{containerRef:$,setContainerRef:F,containerRect:D}=Eg(),A=yc(w_({preventDefaultWheelX:u,preventDefaultWheelY:f}),F),T=P.useRef(null),V=yc(T,void 0),{getOwnerDocument:H}=rs(),W=Vi(),j=se=>(W?-1:1)*(typeof se=="number"?se:1),U=Ye(()=>{var se;return(se=$.current)===null||se===void 0?void 0:se.focus()}),B=Ye(()=>e),G=Ye(()=>p),z=P.useCallback(se=>w(tr,se),[w]),K=P.useCallback(se=>w(nr,se),[w]),X=P.useCallback(()=>w(es),[w]),Z=se=>!(r.finite&&(j(se)>0&&p.currentIndex===0||j(se)<0&&p.currentIndex===p.slides.length-1)),ee=se=>{var Ae;x.current=se,(Ae=$.current)===null||Ae===void 0||Ae.style.setProperty(ut("swipe_offset"),`${Math.round(se)}px`)},ne=se=>{var Ae,Le;E.current=se,k.current=(()=>{const st=d&&se>0?se:c&&se<0?-se:0;return Math.min(Math.max(lc(1-st/60*(1-.5),2),.5),1)})(),(Ae=$.current)===null||Ae===void 0||Ae.style.setProperty(ut("pull_offset"),`${Math.round(se)}px`),(Le=$.current)===null||Le===void 0||Le.style.setProperty(ut("pull_opacity"),`${k.current}`)},{prepareAnimation:he}=bc(T,(se,Ae,Le)=>{if(T.current&&D)return{keyframes:[{transform:`translate(0, ${se.rect.y-Ae.y+Le.y}px)`,opacity:se.opacity},{transform:"translate(0, 0)",opacity:1}],duration:se.duration,easing:s.easing.fade}}),J=(se,Ae)=>{if(c||d){ne(se);let Le=0;T.current&&(Le=s.fade*(Ae?2:1),he({rect:T.current.getBoundingClientRect(),opacity:k.current,duration:Le})),L(()=>{ne(0),S(Vt.NONE)},Le),S(Vt.ANIMATION),Ae||X()}},{prepareAnimation:ce,isAnimationPlaying:ue}=bc(T,(se,Ae,Le)=>{var Ie;if(T.current&&D&&(!((Ie=p.animation)===null||Ie===void 0)&&Ie.duration)){const Be=Pi(r.spacing),st=(Be.percent?Be.percent*D.width/100:Be.pixel)||0;return{keyframes:[{transform:`translate(${j(p.globalIndex-se.index)*(D.width+st)+se.rect.x-Ae.x+Le.x}px, 0)`},{transform:"translate(0, 0)"}],duration:p.animation.duration,easing:p.animation.easing}}}),ie=Ye(se=>{var Ae,Le;const Ie=se.offset||0,Be=Ie?s.swipe:(Ae=s.navigation)!==null&&Ae!==void 0?Ae:s.swipe,st=!Ie&&!ue()?s.easing.navigation:s.easing.swipe;let{direction:ft}=se;const je=(Le=se.count)!==null&&Le!==void 0?Le:1;let Je=Vt.ANIMATION,Xe=Be*je;if(!ft){const ge=D?.width,pe=se.duration||0,me=ge?Be/ge*Math.abs(Ie):Be;je!==0?(pe<me?Xe=Xe/me*Math.max(pe,me/5):ge&&(Xe=Be/ge*(ge-Math.abs(Ie))),ft=j(Ie)>0?tr:nr):Xe=Be/2}let te=0;ft===tr?Z(j(1))?te=-je:(Je=Vt.NONE,Xe=Be):ft===nr&&(Z(j(-1))?te=je:(Je=Vt.NONE,Xe=Be)),Xe=Math.round(Xe),O(()=>{ee(0),S(Vt.NONE)},Xe),T.current&&ce({rect:T.current.getBoundingClientRect(),index:p.globalIndex}),S(Je),w(sc,{type:"swipe",increment:te,duration:Xe,easing:st})});P.useEffect(()=>{var se,Ae;!((se=p.animation)===null||se===void 0)&&se.increment&&(!((Ae=p.animation)===null||Ae===void 0)&&Ae.duration)&&M(()=>y({type:"swipe",increment:0}),p.animation.duration)},[p.animation,y,M]);const ve=[N,Z,D?.width||0,s.swipe,()=>S(Vt.SWIPE),se=>ee(se),(se,Ae)=>ie({offset:se,duration:Ae,count:1}),se=>ie({offset:se,count:0})],fe=[()=>{d&&S(Vt.PULL)},se=>ne(se),se=>J(se),se=>J(se,!0)];x_(o,...ve,c,d,...fe,X),k_(b,...ve);const ye=Ye(()=>{o.focus&&H().querySelector(`.${Te(tc)} .${Te(Dg())}`)&&U()});P.useEffect(ye,[ye]);const Se=Ye(()=>{var se;(se=i.view)===null||se===void 0||se.call(i,{index:p.currentIndex})});P.useEffect(Se,[p.globalIndex,Se]),P.useEffect(()=>ts(_(tr,se=>ie({direction:tr,...se})),_(nr,se=>ie({direction:nr,...se})),_(sc,se=>y(se))),[_,ie,y]);const He=P.useMemo(()=>({prev:z,next:K,close:X,focus:U,slideRect:D?RS(D,r.padding):{width:0,height:0},containerRect:D||{width:0,height:0},subscribeSensors:N,containerRef:$,setCarouselRef:V,toolbarWidth:g,setToolbarWidth:m}),[z,K,X,U,N,D,$,V,g,m,r.padding]);return P.useImperativeHandle(o.ref,()=>({prev:z,next:K,close:X,focus:U,getLightboxProps:B,getLightboxState:G}),[z,K,X,U,B,G]),P.createElement("div",{ref:A,className:Ft(Te(Dg()),Te(Rr)),style:{...b===Vt.SWIPE?{[ut("swipe_offset")]:`${Math.round(x.current)}px`}:null,...b===Vt.PULL?{[ut("pull_offset")]:`${Math.round(E.current)}px`,[ut("pull_opacity")]:`${k.current}`}:null,...o.touchAction!=="none"?{[ut("controller_touch_action")]:o.touchAction}:null,...a.container},tabIndex:-1,...C},D&&P.createElement(Ig.Provider,{value:He},t,(n=l.controls)===null||n===void 0?void 0:n.call(l)))}const S_=dn(Rs,C_);function yr(t){return hr(Qh,t)}function Lg(t){return hr(rc,t)}function __({slide:t,offset:e}){const n=P.useRef(null),{currentIndex:r,slides:s}=un(),{slideRect:o,focus:i}=_n(),{render:a,carousel:{imageFit:l,imageProps:c},on:{click:d},styles:{slide:u},labels:f}=Ot(),{getOwnerDocument:g}=rs(),m=e!==0;P.useEffect(()=>{var y;m&&(!((y=n.current)===null||y===void 0)&&y.contains(g().activeElement))&&i()},[m,i,g]);const p=()=>{var y,b,S,x;let E=(y=a.slide)===null||y===void 0?void 0:y.call(a,{slide:t,offset:e,rect:o});return!E&&mr(t)&&(E=P.createElement(br,{slide:t,offset:e,render:a,rect:o,imageFit:l,imageProps:c,onClick:m?void 0:()=>d?.({index:r})})),E?P.createElement(P.Fragment,null,(b=a.slideHeader)===null||b===void 0?void 0:b.call(a,{slide:t}),((S=a.slideContainer)!==null&&S!==void 0?S:(({children:k})=>k))({slide:t,children:E}),(x=a.slideFooter)===null||x===void 0?void 0:x.call(a,{slide:t})):null};return P.createElement("div",{ref:n,className:Ft(Te(Lg()),!m&&Te(Lg("current")),Te(Rr)),...n_(m),style:u,role:"group","aria-roledescription":pr(f,"Slide"),"aria-label":hg(f,s,r+e)},p())}function E_(){const t=Ot().styles.slide;return P.createElement("div",{className:Te(rc),style:t})}function M_({carousel:t,labels:e}){const{slides:n,currentIndex:r,globalIndex:s}=un(),{setCarouselRef:o}=_n(),{autoPlaying:i,focusWithin:a}=pc(),l=Pi(t.spacing),c=Pi(t.padding),d=pg(t,n,1),u=[];if(uc(n))for(let f=r-d;f<=r+d;f+=1){const g=fc(n,f),m=s-r+f,p=t.finite&&(f<0||f>n.length-1);u.push(p?{key:m}:{key:[`${m}`,gg(g)].filter(Boolean).join("|"),offset:f-r,slide:g})}return P.createElement("div",{ref:o,className:Ft(Te(yr()),u.length>0&&Te(yr("with_slides"))),style:{[`${ut(yr("slides_count"))}`]:u.length,[`${ut(yr("spacing_px"))}`]:l.pixel||0,[`${ut(yr("spacing_percent"))}`]:l.percent||0,[`${ut(yr("padding_px"))}`]:c.pixel||0,[`${ut(yr("padding_percent"))}`]:c.percent||0},role:"region","aria-live":i&&!a?"off":"polite","aria-roledescription":pr(e,"Carousel"),"aria-label":pr(e,"Photo gallery")},u.map(({key:f,slide:g,offset:m})=>g?P.createElement(__,{key:f,slide:g,offset:m}):P.createElement(E_,{key:f})))}const N_=dn(Qh,M_);function Pg(){const{carousel:t}=Ot(),{slides:e,currentIndex:n}=un(),r=e.length===0||t.finite&&n===0,s=e.length===0||t.finite&&n===e.length-1;return{prevDisabled:r,nextDisabled:s}}function $g(t){var e;const n=Vi(),{publish:r}=ss(),{animation:s}=Ot(),{prevDisabled:o,nextDisabled:i}=Pg(),a=((e=s.navigation)!==null&&e!==void 0?e:s.swipe)/2,l=Tg(()=>r(tr),a),c=Tg(()=>r(nr),a),d=Ye(u=>{switch(u.key){case qS:r(es);break;case ZS:(n?i:o)||(n?c:l)();break;case QS:(n?o:i)||(n?l:c)();break}});P.useEffect(()=>t(oc,d),[t,d])}function Fg({label:t,icon:e,renderIcon:n,action:r,onClick:s,disabled:o,style:i}){return P.createElement(os,{label:t,icon:e,renderIcon:n,className:Te(`navigation_${r}`),disabled:o,onClick:s,style:i,...Ng(_n().focus,o)})}function O_({render:{buttonPrev:t,buttonNext:e,iconPrev:n,iconNext:r},styles:s}){const{prev:o,next:i,subscribeSensors:a}=_n(),{prevDisabled:l,nextDisabled:c}=Pg();return $g(a),P.createElement(P.Fragment,null,t?t():P.createElement(Fg,{label:"Previous",action:tr,icon:g_,renderIcon:n,style:s.navigationPrev,disabled:l,onClick:o}),e?e():P.createElement(Fg,{label:"Next",action:nr,icon:p_,renderIcon:r,style:s.navigationNext,disabled:c,onClick:i}))}const T_=dn(FS,O_),Vg=Te(YS),A_=Te(ng);function D_(t){return"style"in t}function zg(t,e,n){const r=window.getComputedStyle(t),s=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,i=t.style.getPropertyValue(s);return t.style.setProperty(s,`${(Li(o)||0)+e}px`),()=>{i?t.style.setProperty(s,i):t.style.removeProperty(s)}}function I_({noScroll:{disabled:t},children:e}){const n=Vi(),{getOwnerDocument:r,getOwnerWindow:s}=rs();return P.useEffect(()=>{if(t)return()=>{};const o=[],i=s(),{body:a,documentElement:l}=r(),c=Math.round(i.innerWidth-l.clientWidth);if(c>0){o.push(zg(a,c,n));const d=a.getElementsByTagName("*");for(let u=0;u<d.length;u+=1){const f=d[u];D_(f)&&i.getComputedStyle(f).getPropertyValue("position")==="fixed"&&!f.classList.contains(A_)&&o.push(zg(f,c,n))}}return a.classList.add(Vg),()=>{a.classList.remove(Vg),o.forEach(d=>d())}},[n,t,r,s]),P.createElement(P.Fragment,null,e)}const L_=dn(VS,I_);function Hg(t){return hr(tc,t)}function Ug(t,e,n){const r=t.getAttribute(e);return t.setAttribute(e,n),()=>{r?t.setAttribute(e,r):t.removeAttribute(e)}}function P_({children:t,animation:e,styles:n,className:r,on:s,portal:o,close:i,labels:a}){const[l,c]=P.useState(!1),[d,u]=P.useState(!1),f=P.useRef([]),g=P.useRef(null),{setTimeout:m}=oo(),{subscribe:p}=ss(),b=mc()?0:e.fade;P.useEffect(()=>(c(!0),()=>{c(!1),u(!1)}),[]);const S=Ye(()=>{f.current.forEach(C=>C()),f.current=[]}),x=Ye(()=>{var C;u(!1),S(),(C=s.exiting)===null||C===void 0||C.call(s),m(()=>{var N;(N=s.exited)===null||N===void 0||N.call(s),i()},b)});P.useEffect(()=>p(es,x),[p,x]);const E=Ye(C=>{var N,_,w;r_(C),u(!0),(N=s.entering)===null||N===void 0||N.call(s);const M=(w=(_=C.parentNode)===null||_===void 0?void 0:_.children)!==null&&w!==void 0?w:[];for(let O=0;O<M.length;O+=1){const L=M[O];["TEMPLATE","SCRIPT","STYLE"].indexOf(L.tagName)===-1&&L!==C&&(f.current.push(Ug(L,"inert","")),f.current.push(Ug(L,"aria-hidden","true")))}f.current.push(()=>{var O,L;(L=(O=g.current)===null||O===void 0?void 0:O.focus)===null||L===void 0||L.call(O)}),m(()=>{var O;(O=s.entered)===null||O===void 0||O.call(s)},b)}),k=P.useCallback(C=>{C?E(C):S()},[E,S]);return l?Nn.createPortal(P.createElement(v_,{ref:k,className:Ft(r,Te(Hg()),Te(ng),d&&Te(Hg("open"))),"aria-modal":!0,role:"dialog","aria-label":pr(a,"Lightbox"),style:{...e.fade!==gc.animation.fade?{[ut("fade_animation_duration")]:`${b}ms`}:null,...e.easing.fade!==gc.animation.easing.fade?{[ut("fade_animation_timing_function")]:e.easing.fade}:null,...n.root},onFocus:C=>{g.current||(g.current=C.relatedTarget)}},t),o.root||document.body):null}const $_=dn(tc,P_);function F_({children:t}){return P.createElement(P.Fragment,null,t)}const V_=dn(zS,F_);function z_(t){return hr(Jh,t)}function H_({toolbar:{buttons:t},render:{buttonClose:e,iconClose:n},styles:r}){const{close:s,setToolbarWidth:o}=_n(),{setContainerRef:i,containerRect:a}=Eg();Cn(()=>{o(a?.width)},[o,a?.width]);const l=()=>e?e():P.createElement(os,{key:es,label:"Close",icon:h_,renderIcon:n,onClick:s});return P.createElement("div",{ref:i,style:r.toolbar,className:Te(z_())},t?.map(c=>c===es?l():c))}const U_=dn(Jh,H_);function Bg(t,e){var n;return P.createElement(t.module.component,{key:t.module.name,...e},(n=t.children)===null||n===void 0?void 0:n.map(r=>Bg(r,e)))}function B_(t,e={}){const{easing:n,...r}=t,{easing:s,...o}=e;return{easing:{...n,...s},...r,...o}}function j_({carousel:t,animation:e,render:n,toolbar:r,controller:s,noScroll:o,on:i,plugins:a,slides:l,index:c,...d}){const{animation:u,carousel:f,render:g,toolbar:m,controller:p,noScroll:y,on:b,slides:S,index:x,plugins:E,...k}=gc,{config:C,augmentation:N}=s_([Nt($_,[Nt(L_,[Nt(S_,[Nt(N_),Nt(U_),Nt(T_)])])])],a||E),_=N({animation:B_(u,e),carousel:{...f,...t},render:{...g,...n},toolbar:{...m,...r},controller:{...p,...s},noScroll:{...y,...o},on:{...b,...i},...k,...d});return _.open?P.createElement(wg,{..._},P.createElement(d_,{slides:l||S,index:Li(c||x)},P.createElement(u_,null,P.createElement(a_,null,P.createElement(o_,null,Bg(Nt(V_,C),_)))))):null}const W_={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1};function G_(t){return Math.min(Math.max(t,Number.EPSILON),1)}function jg(t){const{minZoom:e,...n}={...W_,...t};return{minZoom:G_(e),...n}}function Y_(t,e,n,r){const s=P.useRef(void 0),o=P.useRef(void 0),{zoom:i}=Ot().animation,a=mc(),l=Ye(()=>{var c,d,u;if((c=s.current)===null||c===void 0||c.cancel(),s.current=void 0,o.current&&r?.current){try{s.current=(u=(d=r.current).animate)===null||u===void 0?void 0:u.call(d,[{transform:o.current},{transform:`scale(${t}) translateX(${e}px) translateY(${n}px)`}],{duration:a?0:i??500,easing:s.current?"ease-out":"ease-in-out"})}catch(f){console.error(f)}o.current=void 0,s.current&&(s.current.onfinish=()=>{s.current=void 0})}});return Cn(l,[t,e,n,l]),P.useCallback(()=>{o.current=r?.current?window.getComputedStyle(r.current).transform:void 0},[r])}function X_(t,e){const{on:n}=Ot(),r=Ye(()=>{var s;e||(s=n.zoom)===null||s===void 0||s.call(n,{zoom:t})});P.useEffect(r,[t,r])}function zi(){const{zoom:t}=Ot();return jg(t)}function K_(t,e){var n,r;let s={width:0,height:0},o={width:0,height:0};const{currentSlide:i}=un(),{imageFit:a}=Ot().carousel,{maxZoomPixelRatio:l}=zi();if(t&&i){const d={...i,...e};if(mr(d)){const u=cc(d,a),f=Math.max(...(((n=d.srcSet)===null||n===void 0?void 0:n.map(m=>m.width))||[]).concat(d.width?[d.width]:[])),g=Math.max(...(((r=d.srcSet)===null||r===void 0?void 0:r.map(m=>m.height))||[]).concat(d.height?[d.height]:[]));f>0&&g>0&&t.width>0&&t.height>0&&(o=u?{width:Math.round(Math.min(f,t.width/t.height*g)),height:Math.round(Math.min(g,t.height/t.width*f))}:{width:f,height:g},o={width:o.width*l,height:o.height*l},s=u?{width:Math.min(t.width,o.width,f),height:Math.min(t.height,o.height,g)}:{width:Math.round(Math.min(t.width,t.height/g*f,f)),height:Math.round(Math.min(t.height,t.width/f*g,g))})}}const c=s.width?Math.max(lc(o.width/s.width,5),1):1;return{imageRect:s,maxZoom:c}}function Wg(t,e){return Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)}function Gg(t,e,n=100,r=2){return t*Math.min(1+Math.abs(e/n),r)**Math.sign(e)}function q_(t,e,n,r,s,o,i,a,l){const c=P.useRef([]),d=P.useRef(0),u=P.useRef(void 0),{globalIndex:f}=un(),{getOwnerWindow:g}=rs(),{containerRef:m,subscribeSensors:p}=_n(),{keyboardMoveDistance:y,zoomInMultiplier:b,wheelZoomDistanceFactor:S,scrollToZoom:x,doubleTapDelay:E,doubleClickDelay:k,doubleClickMaxStops:C,pinchZoomDistanceFactor:N,pinchZoomV4:_}=zi(),w=P.useCallback(V=>{if(m.current){const{pageX:H,pageY:W}=V,{scrollX:j,scrollY:U}=g(),{left:B,top:G,width:z,height:K}=m.current.getBoundingClientRect();return[H-B-j-z/2,W-G-U-K/2]}return[]},[m,g]),M=Ye(V=>{const{key:H,metaKey:W,ctrlKey:j}=V,U=W||j,B=()=>{V.preventDefault(),V.stopPropagation()};if(t>1){const G=(z,K)=>{B(),a(z,K)};H==="ArrowDown"?G(0,y):H==="ArrowUp"?G(0,-y):H==="ArrowLeft"?G(-y,0):H==="ArrowRight"&&G(y,0)}H==="+"||U&&H==="="?(B(),s()):H==="-"||U&&H==="_"?(B(),o()):U&&H==="0"&&(B(),i(1))}),O=Ye(V=>{if((V.ctrlKey||x)&&Math.abs(V.deltaY)>Math.abs(V.deltaX)){V.stopPropagation(),i(Gg(t,-V.deltaY,S),!0,...w(V));return}t>1&&(V.stopPropagation(),x||a(V.deltaX,V.deltaY))}),L=P.useCallback(V=>{const H=c.current;H.splice(0,H.length,...H.filter(W=>W.pointerId!==V.pointerId))},[]),$=P.useCallback(V=>{L(V),V.persist(),c.current.push(V)},[L]),F=Ye(V=>{var H;const W=c.current;if(V.pointerType==="mouse"&&V.buttons>1||!(!((H=l?.current)===null||H===void 0)&&H.contains(V.target)))return;t>1&&V.stopPropagation();const{timeStamp:j}=V;if(W.length===0&&j-d.current<(V.pointerType==="touch"?E:k)){d.current=0;const U=t>=1?t!==n?t*Math.max(n**(1/C),b):1:t!==e?t/Math.max(e**(-1/C),b):1;i(U,!1,...w(V))}else d.current=j;if($(V),W.length===2){const U=Wg(W[0],W[1]);u.current={previousDistance:U,initialDistance:Math.max(U,1),initialZoom:t}}}),D=Ye(V=>{const H=c.current,W=H.find(j=>j.pointerId===V.pointerId);if(H.length===2&&u.current){V.stopPropagation(),$(V);const j=Wg(H[0],H[1]),U=_?u.current.initialZoom/u.current.initialDistance*j:Gg(t,j-u.current.previousDistance,N);i(U,!0,...H.map(B=>w(B)).reduce((B,G)=>G.map((z,K)=>B[K]+z/2))),u.current.previousDistance=j;return}t>1&&(V.stopPropagation(),W&&(H.length===1&&a((W.clientX-V.clientX)/t,(W.clientY-V.clientY)/t),$(V)))}),A=P.useCallback(V=>{const H=c.current;H.length===2&&H.find(W=>W.pointerId===V.pointerId)&&(u.current=void 0),L(V)},[L]),T=P.useCallback(()=>{const V=c.current;V.splice(0,V.length),d.current=0,u.current=void 0},[]);Ag(p,F,D,A,r),P.useEffect(T,[f,T]),P.useEffect(()=>r?()=>{}:ts(T,p(oc,M),p(ic,O)),[r,p,T,M,O])}function Z_(t,e,n){const[r,s]=P.useState(1),[o,i]=P.useState(0),[a,l]=P.useState(0),c=Y_(r,o,a,n),{currentSlide:d,globalIndex:u}=un(),{containerRect:f,slideRect:g}=_n(),{minZoom:m,zoomInMultiplier:p}=zi(),y=d&&mr(d)?d.src:void 0,b=!y||!n?.current;Cn(()=>{s(1),i(0),l(0)},[u,y]);const S=P.useCallback((N,_,w)=>{const M=w||r,O=o-(N||0),L=a-(_||0),$=(t.width*M-g.width)/2/M,F=(t.height*M-g.height)/2/M;i(Math.min(Math.abs(O),Math.max($,0))*Math.sign(O)),l(Math.min(Math.abs(L),Math.max(F,0))*Math.sign(L))},[r,o,a,g,t.width,t.height]),x=P.useCallback((N,_,w,M)=>{const O=lc(N+.01<e?N-.01>m?N:m:e,5);_||c(),S(w?w*(1/r-1/O):0,M?M*(1/r-1/O):0,O),s(O)},[r,m,e,S,c]),E=Ye(()=>{r>1&&(r>e&&x(e,!0),S())});Cn(E,[f.width,f.height,E]);const k=P.useCallback(()=>{const N=r*p;x(r<1&&N>1?1:N)},[r,p,x]),C=P.useCallback(()=>{const N=r/p;x(r>1&&N<1?1:N)},[r,p,x]);return{zoom:r,offsetX:o,offsetY:a,disabled:b,changeOffsets:S,changeZoom:x,zoomIn:k,zoomOut:C}}const Yg=P.createContext(null),kc=cn("useZoom","ZoomControllerContext",Yg);function Q_({children:t}){const[e,n]=P.useState(),{slideRect:r}=_n(),{ref:s,minZoom:o}=zi(),{imageRect:i,maxZoom:a}=K_(r,e?.imageDimensions),{zoom:l,offsetX:c,offsetY:d,disabled:u,changeZoom:f,changeOffsets:g,zoomIn:m,zoomOut:p}=Z_(i,a,e?.zoomWrapperRef);X_(l,u),q_(l,o,a,u,m,p,f,g,e?.zoomWrapperRef);const y=P.useMemo(()=>({zoom:l,minZoom:o,maxZoom:a,offsetX:c,offsetY:d,disabled:u,zoomIn:m,zoomOut:p,changeZoom:f}),[l,o,a,c,d,u,m,p,f]);P.useImperativeHandle(s,()=>y,[y]);const b=P.useMemo(()=>({...y,setZoomWrapper:n}),[y,n]);return P.createElement(Yg.Provider,{value:b},t)}const J_=Kt("ZoomIn",P.createElement(P.Fragment,null,P.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),P.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),R_=Kt("ZoomOut",P.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),Xg=P.forwardRef(function({zoomIn:e,onLoseFocus:n},r){const s=P.useRef(!1),o=P.useRef(!1),{zoom:i,minZoom:a,maxZoom:l,zoomIn:c,zoomOut:d,disabled:u}=kc(),{render:f}=Ot(),g=u||(e?i>=l:i<=a);return P.useEffect(()=>{g&&s.current&&o.current&&n(),g||(s.current=!0)},[g,n]),P.createElement(os,{ref:r,disabled:g,label:e?"Zoom in":"Zoom out",icon:e?J_:R_,renderIcon:e?f.iconZoomIn:f.iconZoomOut,onClick:e?c:d,onFocus:()=>{o.current=!0},onBlur:()=>{o.current=!1}})});function e2(){const t=P.useRef(null),e=P.useRef(null),{focus:n}=_n(),r=P.useCallback(i=>{var a,l;!((a=i.current)===null||a===void 0)&&a.disabled?n():(l=i.current)===null||l===void 0||l.focus()},[n]),s=P.useCallback(()=>r(t),[r]),o=P.useCallback(()=>r(e),[r]);return P.createElement(P.Fragment,null,P.createElement(Xg,{zoomIn:!0,ref:t,onLoseFocus:o}),P.createElement(Xg,{ref:e,onLoseFocus:s}))}function t2(){const{render:t}=Ot(),e=kc();return t.buttonZoom?P.createElement(P.Fragment,null,t.buttonZoom(e)):P.createElement(e2,null)}function n2(t){var e;return(((e=t.srcSet)===null||e===void 0?void 0:e.length)||0)>0}function r2({current:t,preload:e},{type:n,source:r}){switch(n){case"fetch":return t?{current:t,preload:r}:{current:r};case"done":return r===e?{current:r}:{current:t,preload:e};default:throw new Error(ug)}}function s2(t){var e,n;const[{current:r,preload:s},o]=P.useReducer(r2,{}),{slide:i,rect:a,imageFit:l,render:c,interactive:d}=t,u=i.srcSet.sort((k,C)=>k.width-C.width),f=(e=i.width)!==null&&e!==void 0?e:u[u.length-1].width,g=(n=i.height)!==null&&n!==void 0?n:u[u.length-1].height,m=cc(i,l),p=Math.max(...u.map(k=>k.width)),y=Math.min((m?Math.max:Math.min)(a.width,f*(a.height/g)),p),b=e_(),S=Ye(()=>{var k;const C=(k=u.find(N=>N.width>=y*b))!==null&&k!==void 0?k:u[u.length-1];(!r||u.findIndex(N=>N.src===r)<u.findIndex(N=>N===C))&&o({type:"fetch",source:C.src})});Cn(S,[a.width,a.height,b,S]);const x=Ye(k=>o({type:"done",source:k})),E={WebkitTransform:d?"initial":"translateZ(0)"};return m||Object.assign(E,a.width/a.height<f/g?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),P.createElement(P.Fragment,null,s&&s!==r&&P.createElement(br,{key:"preload",...t,offset:void 0,slide:{...i,src:s,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...E},onLoad:()=>x(s),render:{...c,iconLoading:()=>null,iconError:()=>null}}),r&&P.createElement(br,{key:"current",...t,slide:{...i,src:r,srcSet:void 0},style:E}))}function o2({render:t,slide:e,offset:n,rect:r}){var s;const[o,i]=P.useState(),a=P.useRef(null),{zoom:l,maxZoom:c,offsetX:d,offsetY:u,setZoomWrapper:f}=kc(),g=l>1,{carousel:m,on:p}=Ot(),{currentIndex:y}=un();Cn(()=>n===0?(f({zoomWrapperRef:a,imageDimensions:o}),()=>f(void 0)):()=>{},[n,o,f]);let b=(s=t.slide)===null||s===void 0?void 0:s.call(t,{slide:e,offset:n,rect:r,zoom:l,maxZoom:c});if(!b&&mr(e)){const S={slide:e,offset:n,rect:r,render:t,imageFit:m.imageFit,imageProps:m.imageProps,onClick:n===0?()=>{var x;return(x=p.click)===null||x===void 0?void 0:x.call(p,{index:y})}:void 0};b=n2(e)?P.createElement(s2,{...S,slide:e,interactive:g,rect:n===0?{width:r.width*l,height:r.height*l}:r}):P.createElement(br,{onLoad:x=>i({width:x.naturalWidth,height:x.naturalHeight}),...S})}return b?P.createElement("div",{ref:a,className:Ft(Te(tg),Te(Rr),Te(rg),g&&Te(XS)),style:n===0?{transform:`scale(${l}) translateX(${d}px) translateY(${u}px)`}:void 0},b):null}const i2=({augment:t,addModule:e})=>{t(({zoom:n,toolbar:r,render:s,controller:o,...i})=>{const a=jg(n);return{zoom:a,toolbar:$i(r,eg,P.createElement(t2,null)),render:{...s,slide:l=>{var c;return mr(l.slide)?P.createElement(o2,{render:s,...l}):(c=s.slide)===null||c===void 0?void 0:c.call(s,l)}},controller:{...o,preventDefaultWheelY:a.scrollToZoom},...i}}),e(dn(eg,Q_))},a2={separator:"/",container:{}},Kg=t=>({...a2,...t});function l2({counter:t}){const{slides:e,currentIndex:n}=un(),{separator:r,container:{className:s,...o},className:i,...a}=Kg(t);return e.length===0?null:P.createElement("div",{className:Ft(Te("counter"),s||i),...a,...o,"aria-hidden":!0},n+1," ",r," ",e.length)}function c2({augment:t,addChild:e}){t(({counter:n,...r})=>({counter:Kg(n),...r})),e(Rs,dn(HS,l2))}const d2={autoplay:!1,delay:3e3,ref:null},qg=t=>({...d2,...t}),Zg=P.createContext(null),u2=cn("useSlideshow","SlideshowContext",Zg);function f2({slideshow:t,carousel:{finite:e},on:n,children:r}){const{autoplay:s,delay:o,ref:i}=qg(t),a=P.useRef(s),[l,c]=P.useState(s),d=P.useRef(void 0),u=P.useRef(void 0),{slides:f,currentIndex:g}=un(),{setTimeout:m,clearTimeout:p}=oo(),{subscribe:y}=ss(),{next:b}=_n(),{setAutoPlaying:S}=pc();P.useEffect(()=>S(l),[l,S]);const x=f.length===0||e&&g===f.length-1,E=P.useCallback(()=>{!l&&!x&&c(!0)},[l,x]),k=P.useCallback(()=>{l&&c(!1)},[l]),C=P.useCallback(()=>{p(d.current),d.current=void 0},[p]),N=Ye(()=>{C(),!(!l||x||u.current===Jr||u.current===nc)&&(d.current=m(()=>{l&&(u.current=void 0,b())},o))});P.useEffect(N,[g,l,N]),P.useEffect(()=>{l&&x&&c(!1)},[g,l,x]);const _=Ye(()=>{var O;return(O=n.slideshowStart)===null||O===void 0?void 0:O.call(n)}),w=Ye(()=>{var O;return(O=n.slideshowStop)===null||O===void 0?void 0:O.call(n)});P.useEffect(()=>{l?_():a.current&&w(),a.current=l},[l,_,w]),P.useEffect(()=>ts(C,y(BS,()=>{u.current=Jr,C()}),y(jS,()=>{u.current=nc,C()}),y(WS,()=>{u.current=no,N()}),y(GS,()=>{u.current=ro,N()})),[y,C,N]);const M=P.useMemo(()=>({playing:l,disabled:x,play:E,pause:k}),[l,x,E,k]);return P.useImperativeHandle(i,()=>M,[M]),P.createElement(Zg.Provider,{value:M},r)}const h2=Kt("Play",P.createElement("path",{d:"M8 5v14l11-7z"})),g2=Kt("Pause",P.createElement("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}));function p2(){const{playing:t,disabled:e,play:n,pause:r}=u2(),{render:s}=Ot(),o=Ng(_n().focus,e);return s.buttonSlideshow?P.createElement(P.Fragment,null,s.buttonSlideshow({playing:t,disabled:e,play:n,pause:r})):P.createElement(os,{label:t?"Pause":"Play",icon:t?g2:h2,renderIcon:t?s.iconSlideshowPause:s.iconSlideshowPlay,onClick:t?r:n,disabled:e,...o})}function m2({augment:t,addModule:e}){t(({slideshow:n,toolbar:r,...s})=>({toolbar:$i(r,Rh,P.createElement(p2,null)),slideshow:qg(n),...s})),e(dn(Rh,f2))}const b2={auto:!1,ref:null},Qg=t=>({...b2,...t}),Jg=P.createContext(null),y2=cn("useFullscreen","FullscreenContext",Jg);function v2({fullscreen:t,on:e,children:n}){const{auto:r,ref:s}=Qg(t),o=P.useRef(null),[i,a]=P.useState(),[l,c]=P.useState(!1),d=P.useRef(!1),{getOwnerDocument:u}=rs();Cn(()=>{var x,E,k,C;const N=u();a(!((C=(k=(E=(x=N.fullscreenEnabled)!==null&&x!==void 0?x:N.webkitFullscreenEnabled)!==null&&E!==void 0?E:N.mozFullScreenEnabled)!==null&&k!==void 0?k:N.msFullscreenEnabled)!==null&&C!==void 0&&C))},[u]);const f=P.useCallback(()=>{var x;const E=u(),k=E.fullscreenElement||E.webkitFullscreenElement||E.mozFullScreenElement||E.msFullscreenElement;return((x=k?.shadowRoot)===null||x===void 0?void 0:x.fullscreenElement)||k},[u]),g=P.useCallback(()=>{const x=o.current;try{x.requestFullscreen?x.requestFullscreen().catch(()=>{}):x.webkitRequestFullscreen?x.webkitRequestFullscreen():x.mozRequestFullScreen?x.mozRequestFullScreen():x.msRequestFullscreen&&x.msRequestFullscreen()}catch{}},[]),m=P.useCallback(()=>{if(!f())return;const x=u();try{x.exitFullscreen?x.exitFullscreen().catch(()=>{}):x.webkitExitFullscreen?x.webkitExitFullscreen():x.mozCancelFullScreen?x.mozCancelFullScreen():x.msExitFullscreen&&x.msExitFullscreen()}catch{}},[f,u]);P.useEffect(()=>{const x=u(),E=()=>{c(f()===o.current)};return ts(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map(k=>(x.addEventListener(k,E),()=>x.removeEventListener(k,E))))},[f,u]);const p=Ye(()=>{var x;return(x=e.enterFullscreen)===null||x===void 0?void 0:x.call(e)}),y=Ye(()=>{var x;return(x=e.exitFullscreen)===null||x===void 0?void 0:x.call(e)});P.useEffect(()=>{l&&(d.current=!0),d.current&&(l?p:y)()},[l,p,y]);const b=Ye(()=>{var x;return(x=r?g:null)===null||x===void 0||x(),m});P.useEffect(b,[b]);const S=P.useMemo(()=>({fullscreen:l,disabled:i,enter:g,exit:m}),[l,i,g,m]);return P.useImperativeHandle(s,()=>S,[S]),P.createElement("div",{ref:o,className:Ft(Te(eo),Te(tg))},P.createElement(Jg.Provider,{value:S},n))}const x2=Kt("EnterFullscreen",P.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),w2=Kt("ExitFullscreen",P.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function k2(){var t;const{fullscreen:e,disabled:n,enter:r,exit:s}=y2(),{render:o}=Ot();return n?null:o.buttonFullscreen?P.createElement(P.Fragment,null,(t=o.buttonFullscreen)===null||t===void 0?void 0:t.call(o,{fullscreen:e,disabled:n,enter:r,exit:s})):P.createElement(os,{disabled:n,label:e?"Exit Fullscreen":"Enter Fullscreen",icon:e?w2:x2,renderIcon:e?o.iconExitFullscreen:o.iconEnterFullscreen,onClick:e?s:r})}function C2({augment:t,contains:e,addParent:n}){t(({fullscreen:r,toolbar:s,...o})=>({toolbar:$i(s,eo,P.createElement(k2,null)),fullscreen:Qg(r),...o})),n(e(to)?to:Rs,dn(eo,v2))}const vr={ref:null,position:"bottom",width:120,height:80,border:1,borderRadius:4,padding:4,gap:16,imageFit:"contain",vignette:!0,hidden:!1,showToggle:!1},Cc=t=>({...vr,...t});function Rg(){const{thumbnails:t}=Ot();return Cc(t)}const xr=t=>hr(to,t),Tt=t=>xr(hr("thumbnail",t)),S2=Kt("VideoThumbnail",P.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"})),_2=Kt("UnknownThumbnail",P.createElement("path",{d:"M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"}));function E2({slide:t,render:e,rect:n,imageFit:r}){var s;const o=(s=e.thumbnail)===null||s===void 0?void 0:s.call(e,{slide:t,render:e,rect:n,imageFit:r});if(o)return o;const i={render:e,rect:n,imageFit:r};if(t.thumbnail)return P.createElement(br,{slide:{src:t.thumbnail},...i});if(mr(t))return P.createElement(br,{slide:t,...i});const a=Te(Tt(Ii));return t.type==="video"?P.createElement(P.Fragment,null,t.poster&&P.createElement(br,{slide:{src:t.poster},...i}),P.createElement(S2,{className:a})):P.createElement(_2,{className:a})}const M2=gr("active"),Sc=gr("fadein"),_c=gr("fadeout"),N2=gr("placeholder"),ep="delay",tp="duration";function O2({slide:t,index:e,onClick:n,fadeIn:r,fadeOut:s,placeholder:o,onLoseFocus:i}){const a=P.useRef(null),{render:l,styles:c,labels:d}=Ot(),{slides:u,globalIndex:f}=un(),{getOwnerDocument:g}=rs(),{width:m,height:p,imageFit:y}=Rg(),b={width:m,height:p},S=e===f,x=Ye(i);return P.useEffect(()=>{s&&g().activeElement===a.current&&x()},[s,x,g]),P.createElement("button",{ref:a,type:"button",className:Ft(Te(Rr),Te(Tt()),S&&Te(Tt(M2())),r&&Te(Tt(Sc())),s&&Te(Tt(_c())),o&&Te(Tt(N2()))),style:{...r?{[ut(Tt(Sc(tp)))]:`${r.duration}ms`,[ut(Tt(Sc(ep)))]:`${r.delay}ms`}:null,...s?{[ut(Tt(_c(tp)))]:`${s.duration}ms`,[ut(Tt(_c(ep)))]:`${s.delay}ms`}:null,...c.thumbnail},onClick:n,"aria-current":S?!0:void 0,"aria-label":hg(d,u,e)},t&&E2({slide:t,render:l,rect:b,imageFit:y}))}function np(t){return["top","bottom"].includes(t)}function rp(t,e){return e+2*(t.border+t.padding)+t.gap}function T2(t){const{thumbnail:e,poster:n}=t||{thumbnail:"placeholder"};return typeof e=="string"&&e||typeof n=="string"&&n||t&&gg(t)||void 0}function sp({visible:t,containerRef:e}){const n=P.useRef(null),r=Vi(),{publish:s,subscribe:o}=ss(),{carousel:i,styles:a,labels:l}=Ot(),{slides:c,globalIndex:d,animation:u}=un(),{registerSensors:f,subscribeSensors:g}=Og();$g(g);const m=Rg(),{position:p,width:y,height:b,border:S,borderStyle:x,borderColor:E,borderRadius:k,padding:C,gap:N,vignette:_}=m,w=u?.duration!==void 0&&u?.increment||0,M=u?.duration||0,{prepareAnimation:O}=bc(n,A=>({keyframes:np(p)?[{transform:`translateX(${(r?-1:1)*rp(m,y)*w+A}px)`},{transform:"translateX(0)"}]:[{transform:`translateY(${rp(m,b)*w+A}px)`},{transform:"translateY(0)"}],duration:M,easing:u?.easing})),L=Ye(()=>{let A=0;if(e.current&&n.current){const T=e.current.getBoundingClientRect(),V=n.current.getBoundingClientRect();A=np(p)?V.left-T.left-(T.width-V.width)/2:V.top-T.top-(T.height-V.height)/2}O(A)});P.useEffect(()=>ts(o(sc,L)),[o,L]);const $=pg(i,c),F=[];if(uc(c))for(let A=d-$-Math.abs(w);A<=d+$+Math.abs(w);A+=1){const V=i.finite&&(A<0||A>c.length-1)||w<0&&A<d-$||w>0&&A>d+$?null:fc(c,A),H=[`${A}`,T2(V)].filter(Boolean).join("|");F.push({key:H,index:A,slide:V})}const D=A=>()=>{A>d?s(nr,{count:A-d}):A<d&&s(tr,{count:d-A})};return P.createElement("div",{className:Ft(Te(xr("container")),Te(Rr)),style:{...t?null:{display:"none"},...y!==vr.width?{[ut(Tt("width"))]:`${y}px`}:null,...b!==vr.height?{[ut(Tt("height"))]:`${b}px`}:null,...S!==vr.border?{[ut(Tt("border"))]:`${S}px`}:null,...x?{[ut(Tt("border_style"))]:x}:null,...E?{[ut(Tt("border_color"))]:E}:null,...k!==vr.borderRadius?{[ut(Tt("border_radius"))]:`${k}px`}:null,...C!==vr.padding?{[ut(Tt("padding"))]:`${C}px`}:null,...N!==vr.gap?{[ut(Tt("gap"))]:`${N}px`}:null,...a.thumbnailsContainer}},P.createElement("nav",{ref:n,style:a.thumbnailsTrack,className:Ft(Te(xr("track")),Te(Rr)),"aria-label":pr(l,"Thumbnails"),tabIndex:-1,...f},F.map(({key:A,index:T,slide:V})=>{const H=M/Math.abs(w||1),W=w>0&&T>d+$-w&&T<=d+$||w<0&&T<d-$-w&&T>=d-$?{duration:H,delay:((w>0?T-(d+$-w):d-$-w-T)-1)*H}:void 0,j=w>0&&T<d-$||w<0&&T>d+$?{duration:H,delay:(w>0?w-(d-$-T):-w-(T-(d+$)))*H}:void 0;return P.createElement(O2,{key:A,index:T,slide:V,fadeIn:W,fadeOut:j,placeholder:!V,onClick:D(T),onLoseFocus:()=>{var U;return(U=n.current)===null||U===void 0?void 0:U.focus()}})})),_&&P.createElement("div",{className:Te(xr("vignette"))}))}const op=P.createContext(null),A2=cn("useThumbnails","ThumbnailsContext",op);function D2({children:t,...e}){const{ref:n,position:r,hidden:s}=Cc(e.thumbnails),[o,i]=P.useState(!s),a=P.useRef(null),l=P.useMemo(()=>({visible:o,show:()=>i(!0),hide:()=>i(!1)}),[o]);return P.useImperativeHandle(n,()=>l,[l]),P.createElement(wg,{...e},P.createElement(op.Provider,{value:l},P.createElement("div",{ref:a,className:Ft(Te(xr()),Te(xr(`${r}`)))},["start","top"].includes(r)&&P.createElement(sp,{containerRef:a,visible:o}),P.createElement("div",{className:Te(xr("wrapper"))},t),["end","bottom"].includes(r)&&P.createElement(sp,{containerRef:a,visible:o}))))}const ip=()=>P.createElement(P.Fragment,null,P.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),P.createElement("path",{d:"M5 14h4v3h-4zM10 14h4v3h-4zM15 14h4v3h-4z"})),I2=Kt("ThumbnailsVisible",ip()),L2=f_("ThumbnailsHidden",ip());function P2(){const{visible:t,show:e,hide:n}=A2(),{render:r}=Ot();return r.buttonThumbnails?P.createElement(P.Fragment,null,r.buttonThumbnails({visible:t,show:e,hide:n})):P.createElement(os,{label:t?"Hide thumbnails":"Show thumbnails",icon:t?I2:L2,renderIcon:t?r.iconThumbnailsVisible:r.iconThumbnailsHidden,onClick:t?n:e})}function $2({augment:t,contains:e,append:n,addParent:r}){t(({thumbnails:o,toolbar:i,...a})=>{const l=Cc(o);return{toolbar:$i(i,to,l.showToggle?P.createElement(P2,null):null),thumbnails:l,...a}});const s=dn(to,D2);e(eo)?n(eo,s):r(Rs,s)}const F2=window.G7Core?.createLogger?.("Comp:ImageGallery")??{log:(...t)=>console.log("[Comp:ImageGallery]",...t),warn:(...t)=>console.warn("[Comp:ImageGallery]",...t),error:(...t)=>console.error("[Comp:ImageGallery]",...t)},Ec=window.G7Core,Hi=(t,e)=>Ec?.t?.(t,e)??t,V2=async(t,e)=>{try{const n=await Ec.api.get(t,{responseType:"blob"});if(n){const r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}catch(n){F2.error("Failed to download file:",n),Ec?.toast?.error?.(Hi("common.download_failed"))}},z2=(t,e)=>{const n=document.createElement("a");n.href=t,n.download=e,n.target="_blank",document.body.appendChild(n),n.click(),document.body.removeChild(n)},Mc=async t=>{const e=t.downloadUrl||t.src,n=t.filename||t.title||"image";t.downloadRequiresAuth?await V2(e,n):z2(e,n)},H2=({image:t,index:e,onDownload:n})=>{const[r,s]=v.useState(!1),o=async i=>{if(i.stopPropagation(),n){n(t,e);return}s(!0);try{await Mc(t)}finally{s(!1)}};return h.jsx(oe,{type:"button",onClick:o,disabled:r,className:"yarl__button flex items-center justify-center","aria-label":Hi("common.download"),title:Hi("common.download"),children:r?h.jsx(pt,{className:"fa-solid fa-spinner fa-spin text-white"}):h.jsx(pt,{className:"fa-solid fa-download text-white"})})},Ui=({images:t,isOpen:e,onClose:n,startIndex:r=0,enableZoom:s=!0,enableSlideshow:o=!1,enableFullscreen:i=!0,showCounter:a=!0,showDownload:l=!0,showThumbnails:c=!0,onDownload:d,editorAttrs:u,id:f})=>{const[g,m]=v.useState(r),p=v.useRef(r),y=t.map(x=>({src:x.src,title:x.title,description:x.description})),b=[];s&&b.push(i2),o&&b.push(m2),i&&b.push(C2),a&&b.push(c2),c&&b.push($2);const S=t[g];if(v.useEffect(()=>{p.current=g},[g]),u){const x=(t??[]).slice(0,4);return h.jsx(I,{id:f,className:"grid grid-cols-2 gap-2 p-3 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",...u,children:x.length>0?x.map((E,k)=>h.jsx(yn,{src:E.thumbnail||E.src,alt:E.title||"",className:"w-full aspect-square object-cover rounded bg-gray-200 dark:bg-gray-700"},k)):h.jsxs(I,{className:"col-span-2 flex items-center justify-center py-6 text-sm text-gray-400 dark:text-gray-500",children:[h.jsx(pt,{className:"fa-regular fa-images mr-2"}),Hi("editor.component.image_gallery")]})})}return h.jsx(j_,{open:e,close:n,slides:y,index:g,plugins:b,on:{view:({index:x})=>{x!==p.current&&m(x)}},zoom:{maxZoomPixelRatio:3,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:300,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,scrollToZoom:!0},carousel:{finite:!0,preload:2,padding:"16px",spacing:"30%"},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},controller:{closeOnBackdropClick:!0,closeOnPullDown:!0,closeOnPullUp:!0},thumbnails:{position:"bottom",width:120,height:80,border:2,borderRadius:4,padding:4,gap:16,showToggle:!1,vignette:!0},toolbar:{buttons:[l&&S&&h.jsx(H2,{image:S,index:g,onDownload:d},"download"),"close"].filter(Boolean)},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.9)"}}})},ap=()=>{const[t,e]=v.useState(!1),[n,r]=v.useState([]),[s,o]=v.useState(0),i=v.useCallback((l,c=0)=>{r(l),o(c),e(!0)},[]),a=v.useCallback(()=>{e(!1)},[]);return{isOpen:t,openGallery:i,closeGallery:a,galleryProps:{images:n,isOpen:t,onClose:a,startIndex:s}}};Ui.displayName="ImageGallery";const U2=Object.freeze(Object.defineProperty({__proto__:null,ImageGallery:Ui,executeImageDownload:Mc,useImageGallery:ap},Symbol.toStringTag,{value:"Module"})),B2=v.createContext(null),j2=({value:t,children:e})=>h.jsx(B2.Provider,{value:t,children:e});function W2(t,e){return e.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in t)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(t)}function lp(t,e){return new Promise((function(n,r){let s;return G2(t).then((function(o){try{return s=o,n(new Blob([e.slice(0,2),s,e.slice(2)],{type:"image/jpeg"}))}catch(i){return r(i)}}),r)}))}const G2=t=>new Promise(((e,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let i=0;if(o.getUint16(i)!==65496)return n("not a valid JPEG");for(i+=2;;){const a=o.getUint16(i);if(a===65498)break;const l=o.getUint16(i+2);if(a===65505&&o.getUint32(i+4)===1165519206){const c=i+10;let d;switch(o.getUint16(c)){case 18761:d=!0;break;case 19789:d=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(c+2,d)!==42)return n("TIFF header contains invalid version");const u=o.getUint32(c+4,d),f=c+u+2+12*o.getUint16(c+u,d);for(let g=c+u+2;g<f;g+=12)if(o.getUint16(g,d)==274){if(o.getUint16(g+2,d)!==3)return n("Orientation data type is invalid");if(o.getUint32(g+4,d)!==1)return n("Orientation data count is invalid");o.setUint16(g+8,1,d);break}return e(s.slice(i,i+2+l))}i+=2+l}return e(new Blob)})),r.readAsArrayBuffer(t)}));var Bi={},Y2={get exports(){return Bi},set exports(t){Bi=t}};(function(t){var e,n,r={};Y2.exports=r,r.parse=function(s,o){for(var i=r.bin.readUshort,a=r.bin.readUint,l=0,c={},d=new Uint8Array(s),u=d.length-4;a(d,u)!=101010256;)u--;l=u,l+=4;var f=i(d,l+=4);i(d,l+=2);var g=a(d,l+=2),m=a(d,l+=4);l+=4,l=m;for(var p=0;p<f;p++){a(d,l),l+=4,l+=4,l+=4,a(d,l+=4),g=a(d,l+=4);var y=a(d,l+=4),b=i(d,l+=4),S=i(d,l+2),x=i(d,l+4);l+=6;var E=a(d,l+=8);l+=4,l+=b+S+x,r._readLocal(d,E,c,g,y,o)}return c},r._readLocal=function(s,o,i,a,l,c){var d=r.bin.readUshort,u=r.bin.readUint;u(s,o),d(s,o+=4),d(s,o+=2);var f=d(s,o+=2);u(s,o+=2),u(s,o+=4),o+=4;var g=d(s,o+=8),m=d(s,o+=2);o+=2;var p=r.bin.readUTF8(s,o,g);if(o+=g,o+=m,c)i[p]={size:l,csize:a};else{var y=new Uint8Array(s.buffer,o);if(f==0)i[p]=new Uint8Array(y.buffer.slice(o,o+a));else{if(f!=8)throw"unknown compression method: "+f;var b=new Uint8Array(l);r.inflateRaw(y,b),i[p]=b}}},r.inflateRaw=function(s,o){return r.F.inflate(s,o)},r.inflate=function(s,o){return s[0],s[1],r.inflateRaw(new Uint8Array(s.buffer,s.byteOffset+2,s.length-6),o)},r.deflate=function(s,o){o==null&&(o={level:6});var i=0,a=new Uint8Array(50+Math.floor(1.1*s.length));a[i]=120,a[i+1]=156,i+=2,i=r.F.deflateRaw(s,a,i,o.level);var l=r.adler(s,0,s.length);return a[i+0]=l>>>24&255,a[i+1]=l>>>16&255,a[i+2]=l>>>8&255,a[i+3]=l>>>0&255,new Uint8Array(a.buffer,0,i+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var i=new Uint8Array(50+Math.floor(1.1*s.length)),a=r.F.deflateRaw(s,i,a,o.level);return new Uint8Array(i.buffer,0,a)},r.encode=function(s,o){o==null&&(o=!1);var i=0,a=r.bin.writeUint,l=r.bin.writeUshort,c={};for(var d in s){var u=!r._noNeed(d)&&!o,f=s[d],g=r.crc.crc(f,0,f.length);c[d]={cpr:u,usize:f.length,crc:g,file:u?r.deflateRaw(f):f}}for(var d in c)i+=c[d].file.length+30+46+2*r.bin.sizeUTF8(d);i+=22;var m=new Uint8Array(i),p=0,y=[];for(var d in c){var b=c[d];y.push(p),p=r._writeHeader(m,p,d,b,0)}var S=0,x=p;for(var d in c)b=c[d],y.push(p),p=r._writeHeader(m,p,d,b,1,y[S++]);var E=p-x;return a(m,p,101010256),p+=4,l(m,p+=4,S),l(m,p+=2,S),a(m,p+=2,E),a(m,p+=4,x),p+=4,p+=2,m.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,i,a,l,c){var d=r.bin.writeUint,u=r.bin.writeUshort,f=a.file;return d(s,o,l==0?67324752:33639248),o+=4,l==1&&(o+=2),u(s,o,20),u(s,o+=2,0),u(s,o+=2,a.cpr?8:0),d(s,o+=2,0),d(s,o+=4,a.crc),d(s,o+=4,f.length),d(s,o+=4,a.usize),u(s,o+=4,r.bin.sizeUTF8(i)),u(s,o+=2,0),o+=2,l==1&&(o+=2,o+=2,d(s,o+=6,c),o+=4),o+=r.bin.writeUTF8(s,o,i),l==0&&(s.set(f,o),o+=f.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var i=o,a=0;a<8;a++)1&i?i=3988292384^i>>>1:i>>>=1;s[o]=i}return s})(),update:function(s,o,i,a){for(var l=0;l<a;l++)s=r.crc.table[255&(s^o[i+l])]^s>>>8;return s},crc:function(s,o,i){return 4294967295^r.crc.update(4294967295,s,o,i)}},r.adler=function(s,o,i){for(var a=1,l=0,c=o,d=o+i;c<d;){for(var u=Math.min(c+5552,d);c<u;)l+=a+=s[c++];a%=65521,l%=65521}return l<<16|a},r.bin={readUshort:function(s,o){return s[o]|s[o+1]<<8},writeUshort:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,i){s[o]=255&i,s[o+1]=i>>8&255,s[o+2]=i>>16&255,s[o+3]=i>>24&255},readASCII:function(s,o,i){for(var a="",l=0;l<i;l++)a+=String.fromCharCode(s[o+l]);return a},writeASCII:function(s,o,i){for(var a=0;a<i.length;a++)s[o+a]=i.charCodeAt(a)},pad:function(s){return s.length<2?"0"+s:s},readUTF8:function(s,o,i){for(var a,l="",c=0;c<i;c++)l+="%"+r.bin.pad(s[o+c].toString(16));try{a=decodeURIComponent(l)}catch{return r.bin.readASCII(s,o,i)}return a},writeUTF8:function(s,o,i){for(var a=i.length,l=0,c=0;c<a;c++){var d=i.charCodeAt(c);if((4294967168&d)==0)s[o+l]=d,l++;else if((4294965248&d)==0)s[o+l]=192|d>>6,s[o+l+1]=128|d>>0&63,l+=2;else if((4294901760&d)==0)s[o+l]=224|d>>12,s[o+l+1]=128|d>>6&63,s[o+l+2]=128|d>>0&63,l+=3;else{if((4292870144&d)!=0)throw"e";s[o+l]=240|d>>18,s[o+l+1]=128|d>>12&63,s[o+l+2]=128|d>>6&63,s[o+l+3]=128|d>>0&63,l+=4}}return l},sizeUTF8:function(s){for(var o=s.length,i=0,a=0;a<o;a++){var l=s.charCodeAt(a);if((4294967168&l)==0)i++;else if((4294965248&l)==0)i+=2;else if((4294901760&l)==0)i+=3;else{if((4292870144&l)!=0)throw"e";i+=4}}return i}},r.F={},r.F.deflateRaw=function(s,o,i,a){var l=[[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]][a],c=r.F.U,d=r.F._goodIndex;r.F._hash;var u=r.F._putsE,f=0,g=i<<3,m=0,p=s.length;if(a==0){for(;f<p;)u(o,g,f+(O=Math.min(65535,p-f))==p?1:0),g=r.F._copyExact(s,f,O,o,g+8),f+=O;return g>>>3}var y=c.lits,b=c.strt,S=c.prev,x=0,E=0,k=0,C=0,N=0,_=0;for(p>2&&(b[_=r.F._hash(s,0)]=0),f=0;f<p;f++){if(N=_,f+1<p-2){_=r.F._hash(s,f+1);var w=f+1&32767;S[w]=b[_],b[_]=w}if(m<=f){(x>14e3||E>26697)&&p-f>100&&(m<f&&(y[x]=f-m,x+=2,m=f),g=r.F._writeBlock(f==p-1||m==p?1:0,y,x,C,s,k,f-k,o,g),x=E=C=0,k=f);var M=0;f<p-2&&(M=r.F._bestMatch(s,f,S,N,Math.min(l[2],p-f),l[3]));var O=M>>>16,L=65535&M;if(M!=0){L=65535&M;var $=d(O=M>>>16,c.of0);c.lhst[257+$]++;var F=d(L,c.df0);c.dhst[F]++,C+=c.exb[$]+c.dxb[F],y[x]=O<<23|f-m,y[x+1]=L<<16|$<<8|F,x+=2,m=f+O}else c.lhst[s[f]]++;E++}}for(k==f&&s.length!=0||(m<f&&(y[x]=f-m,x+=2,m=f),g=r.F._writeBlock(1,y,x,C,s,k,f-k,o,g),x=0,E=0,x=E=C=0,k=f);(7&g)!=0;)g++;return g>>>3},r.F._bestMatch=function(s,o,i,a,l,c){var d=32767&o,u=i[d],f=d-u+32768&32767;if(u==d||a!=r.F._hash(s,o-f))return 0;for(var g=0,m=0,p=Math.min(32767,o);f<=p&&--c!=0&&u!=d;){if(g==0||s[o+g]==s[o+g-f]){var y=r.F._howLong(s,o,f);if(y>g){if(m=f,(g=y)>=l)break;f+2<y&&(y=f+2);for(var b=0,S=0;S<y-2;S++){var x=o-f+S+32768&32767,E=x-i[x]+32768&32767;E>b&&(b=E,u=x)}}}f+=(d=u)-(u=i[d])+32768&32767}return g<<16|m},r.F._howLong=function(s,o,i){if(s[o]!=s[o-i]||s[o+1]!=s[o+1-i]||s[o+2]!=s[o+2-i])return 0;var a=o,l=Math.min(s.length,o+258);for(o+=3;o<l&&s[o]==s[o-i];)o++;return o-a},r.F._hash=function(s,o){return(s[o]<<8|s[o+1])+(s[o+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(s,o,i,a,l,c,d,u,f){var g,m,p,y,b,S,x,E,k,C=r.F.U,N=r.F._putsF,_=r.F._putsE;C.lhst[256]++,m=(g=r.F.getTrees())[0],p=g[1],y=g[2],b=g[3],S=g[4],x=g[5],E=g[6],k=g[7];var w=32+((f+3&7)==0?0:8-(f+3&7))+(d<<3),M=a+r.F.contSize(C.fltree,C.lhst)+r.F.contSize(C.fdtree,C.dhst),O=a+r.F.contSize(C.ltree,C.lhst)+r.F.contSize(C.dtree,C.dhst);O+=14+3*x+r.F.contSize(C.itree,C.ihst)+(2*C.ihst[16]+3*C.ihst[17]+7*C.ihst[18]);for(var L=0;L<286;L++)C.lhst[L]=0;for(L=0;L<30;L++)C.dhst[L]=0;for(L=0;L<19;L++)C.ihst[L]=0;var $=w<M&&w<O?0:M<O?1:2;if(N(u,f,s),N(u,f+1,$),f+=3,$==0){for(;(7&f)!=0;)f++;f=r.F._copyExact(l,c,d,u,f)}else{var F,D;if($==1&&(F=C.fltree,D=C.fdtree),$==2){r.F.makeCodes(C.ltree,m),r.F.revCodes(C.ltree,m),r.F.makeCodes(C.dtree,p),r.F.revCodes(C.dtree,p),r.F.makeCodes(C.itree,y),r.F.revCodes(C.itree,y),F=C.ltree,D=C.dtree,_(u,f,b-257),_(u,f+=5,S-1),_(u,f+=5,x-4),f+=4;for(var A=0;A<x;A++)_(u,f+3*A,C.itree[1+(C.ordr[A]<<1)]);f+=3*x,f=r.F._codeTiny(E,C.itree,u,f),f=r.F._codeTiny(k,C.itree,u,f)}for(var T=c,V=0;V<i;V+=2){for(var H=o[V],W=H>>>23,j=T+(8388607&H);T<j;)f=r.F._writeLit(l[T++],F,u,f);if(W!=0){var U=o[V+1],B=U>>16,G=U>>8&255,z=255&U;_(u,f=r.F._writeLit(257+G,F,u,f),W-C.of0[G]),f+=C.exb[G],N(u,f=r.F._writeLit(z,D,u,f),B-C.df0[z]),f+=C.dxb[z],T+=W}}f=r.F._writeLit(256,F,u,f)}return f},r.F._copyExact=function(s,o,i,a,l){var c=l>>>3;return a[c]=i,a[c+1]=i>>>8,a[c+2]=255-a[c],a[c+3]=255-a[c+1],c+=4,a.set(new Uint8Array(s.buffer,o,i),c),l+(i+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),i=r.F._hufTree(s.dhst,s.dtree,15),a=[],l=r.F._lenCodes(s.ltree,a),c=[],d=r.F._lenCodes(s.dtree,c),u=0;u<a.length;u+=2)s.ihst[a[u]]++;for(u=0;u<c.length;u+=2)s.ihst[c[u]]++;for(var f=r.F._hufTree(s.ihst,s.itree,7),g=19;g>4&&s.itree[1+(s.ordr[g-1]<<1)]==0;)g--;return[o,i,f,l,d,g,a,c]},r.F.getSecond=function(s){for(var o=[],i=0;i<s.length;i+=2)o.push(s[i+1]);return o},r.F.nonZero=function(s){for(var o="",i=0;i<s.length;i+=2)s[i+1]!=0&&(o+=(i>>1)+",");return o},r.F.contSize=function(s,o){for(var i=0,a=0;a<o.length;a++)i+=o[a]*s[1+(a<<1)];return i},r.F._codeTiny=function(s,o,i,a){for(var l=0;l<s.length;l+=2){var c=s[l],d=s[l+1];a=r.F._writeLit(c,o,i,a);var u=c==16?2:c==17?3:7;c>15&&(r.F._putsE(i,a,d,u),a+=u)}return a},r.F._lenCodes=function(s,o){for(var i=s.length;i!=2&&s[i-1]==0;)i-=2;for(var a=0;a<i;a+=2){var l=s[a+1],c=a+3<i?s[a+3]:-1,d=a+5<i?s[a+5]:-1,u=a==0?-1:s[a-1];if(l==0&&c==l&&d==l){for(var f=a+5;f+2<i&&s[f+2]==l;)f+=2;(g=Math.min(f+1-a>>>1,138))<11?o.push(17,g-3):o.push(18,g-11),a+=2*g-2}else if(l==u&&c==l&&d==l){for(f=a+5;f+2<i&&s[f+2]==l;)f+=2;var g=Math.min(f+1-a>>>1,6);o.push(16,g-3),a+=2*g-2}else o.push(l,0)}return i>>>1},r.F._hufTree=function(s,o,i){var a=[],l=s.length,c=o.length,d=0;for(d=0;d<c;d+=2)o[d]=0,o[d+1]=0;for(d=0;d<l;d++)s[d]!=0&&a.push({lit:d,f:s[d]});var u=a.length,f=a.slice(0);if(u==0)return 0;if(u==1){var g=a[0].lit;return f=g==0?1:0,o[1+(g<<1)]=1,o[1+(f<<1)]=1,1}a.sort((function(E,k){return E.f-k.f}));var m=a[0],p=a[1],y=0,b=1,S=2;for(a[0]={lit:-1,f:m.f+p.f,l:m,r:p,d:0};b!=u-1;)m=y!=b&&(S==u||a[y].f<a[S].f)?a[y++]:a[S++],p=y!=b&&(S==u||a[y].f<a[S].f)?a[y++]:a[S++],a[b++]={lit:-1,f:m.f+p.f,l:m,r:p};var x=r.F.setDepth(a[b-1],0);for(x>i&&(r.F.restrictDepth(f,i,x),x=i),d=0;d<u;d++)o[1+(f[d].lit<<1)]=f[d].d;return x},r.F.setDepth=function(s,o){return s.lit!=-1?(s.d=o,o):Math.max(r.F.setDepth(s.l,o+1),r.F.setDepth(s.r,o+1))},r.F.restrictDepth=function(s,o,i){var a=0,l=1<<i-o,c=0;for(s.sort((function(u,f){return f.d==u.d?u.f-f.f:f.d-u.d})),a=0;a<s.length&&s[a].d>o;a++){var d=s[a].d;s[a].d=o,c+=l-(1<<i-d)}for(c>>>=i-o;c>0;)(d=s[a].d)<o?(s[a].d++,c-=1<<o-d-1):a++;for(;a>=0;a--)s[a].d==o&&c<0&&(s[a].d--,c++);c!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var i=0;return o[16|i]<=s&&(i|=16),o[8|i]<=s&&(i|=8),o[4|i]<=s&&(i|=4),o[2|i]<=s&&(i|=2),o[1|i]<=s&&(i|=1),i},r.F._writeLit=function(s,o,i,a){return r.F._putsF(i,a,o[s<<1]),a+o[1+(s<<1)]},r.F.inflate=function(s,o){var i=Uint8Array;if(s[0]==3&&s[1]==0)return o||new i(0);var a=r.F,l=a._bitsF,c=a._bitsE,d=a._decodeTiny,u=a.makeCodes,f=a.codes2map,g=a._get17,m=a.U,p=o==null;p&&(o=new i(s.length>>>2<<3));for(var y,b,S=0,x=0,E=0,k=0,C=0,N=0,_=0,w=0,M=0;S==0;)if(S=l(s,M,1),x=l(s,M+1,2),M+=3,x!=0){if(p&&(o=r.F._check(o,w+131072)),x==1&&(y=m.flmap,b=m.fdmap,N=511,_=31),x==2){E=c(s,M,5)+257,k=c(s,M+5,5)+1,C=c(s,M+10,4)+4,M+=14;for(var O=0;O<38;O+=2)m.itree[O]=0,m.itree[O+1]=0;var L=1;for(O=0;O<C;O++){var $=c(s,M+3*O,3);m.itree[1+(m.ordr[O]<<1)]=$,$>L&&(L=$)}M+=3*C,u(m.itree,L),f(m.itree,L,m.imap),y=m.lmap,b=m.dmap,M=d(m.imap,(1<<L)-1,E+k,s,M,m.ttree);var F=a._copyOut(m.ttree,0,E,m.ltree);N=(1<<F)-1;var D=a._copyOut(m.ttree,E,k,m.dtree);_=(1<<D)-1,u(m.ltree,F),f(m.ltree,F,y),u(m.dtree,D),f(m.dtree,D,b)}for(;;){var A=y[g(s,M)&N];M+=15&A;var T=A>>>4;if(!(T>>>8))o[w++]=T;else{if(T==256)break;var V=w+T-254;if(T>264){var H=m.ldef[T-257];V=w+(H>>>3)+c(s,M,7&H),M+=7&H}var W=b[g(s,M)&_];M+=15&W;var j=W>>>4,U=m.ddef[j],B=(U>>>4)+l(s,M,15&U);for(M+=15&U,p&&(o=r.F._check(o,w+131072));w<V;)o[w]=o[w++-B],o[w]=o[w++-B],o[w]=o[w++-B],o[w]=o[w++-B];w=V}}}else{(7&M)!=0&&(M+=8-(7&M));var G=4+(M>>>3),z=s[G-4]|s[G-3]<<8;p&&(o=r.F._check(o,w+z)),o.set(new i(s.buffer,s.byteOffset+G,z),w),M=G+z<<3,w+=z}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var i=s.length;if(o<=i)return s;var a=new Uint8Array(Math.max(i<<1,o));return a.set(s,0),a},r.F._decodeTiny=function(s,o,i,a,l,c){for(var d=r.F._bitsE,u=r.F._get17,f=0;f<i;){var g=s[u(a,l)&o];l+=15&g;var m=g>>>4;if(m<=15)c[f]=m,f++;else{var p=0,y=0;m==16?(y=3+d(a,l,2),l+=2,p=c[f-1]):m==17?(y=3+d(a,l,3),l+=3):m==18&&(y=11+d(a,l,7),l+=7);for(var b=f+y;f<b;)c[f]=p,f++}}return l},r.F._copyOut=function(s,o,i,a){for(var l=0,c=0,d=a.length>>>1;c<i;){var u=s[c+o];a[c<<1]=0,a[1+(c<<1)]=u,u>l&&(l=u),c++}for(;c<d;)a[c<<1]=0,a[1+(c<<1)]=0,c++;return l},r.F.makeCodes=function(s,o){for(var i,a,l,c,d=r.F.U,u=s.length,f=d.bl_count,g=0;g<=o;g++)f[g]=0;for(g=1;g<u;g+=2)f[s[g]]++;var m=d.next_code;for(i=0,f[0]=0,a=1;a<=o;a++)i=i+f[a-1]<<1,m[a]=i;for(l=0;l<u;l+=2)(c=s[l+1])!=0&&(s[l]=m[c],m[c]++)},r.F.codes2map=function(s,o,i){for(var a=s.length,l=r.F.U.rev15,c=0;c<a;c+=2)if(s[c+1]!=0)for(var d=c>>1,u=s[c+1],f=d<<4|u,g=o-u,m=s[c]<<g,p=m+(1<<g);m!=p;)i[l[m]>>>15-o]=f,m++},r.F.revCodes=function(s,o){for(var i=r.F.U.rev15,a=15-o,l=0;l<s.length;l+=2){var c=s[l]<<o-s[l+1];s[l]=i[c]>>>a}},r.F._putsE=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8},r.F._putsF=function(s,o,i){i<<=7&o;var a=o>>>3;s[a]|=i,s[a+1]|=i>>>8,s[a+2]|=i>>>16},r.F._bitsE=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<<i)-1},r.F._bitsF=function(s,o,i){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<<i)-1},r.F._get17=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(e=Uint16Array,n=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new e(65536),prev:new e(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var i=o;i=(4278255360&(i=(4042322160&(i=(3435973836&(i=(2863311530&i)>>>1|(1431655765&i)<<1))>>>2|(858993459&i)<<2))>>>4|(252645135&i)<<4))>>>8|(16711935&i)<<8,s.rev15[o]=(i>>>16|i<<16)>>>17}function a(l,c,d){for(;c--!=0;)l.push(0,d)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];a(s.fltree,144,8),a(s.fltree,112,9),a(s.fltree,24,7),a(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),a(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),a(s.itree,19,0),a(s.ltree,286,0),a(s.dtree,30,0),a(s.ttree,320,0)})()})();var X2=W2({__proto__:null,default:Bi},[Bi]);const En=(function(){var t={nextZero(d,u){for(;d[u]!=0;)u++;return u},readUshort:(d,u)=>d[u]<<8|d[u+1],writeUshort(d,u,f){d[u]=f>>8&255,d[u+1]=255&f},readUint:(d,u)=>16777216*d[u]+(d[u+1]<<16|d[u+2]<<8|d[u+3]),writeUint(d,u,f){d[u]=f>>24&255,d[u+1]=f>>16&255,d[u+2]=f>>8&255,d[u+3]=255&f},readASCII(d,u,f){let g="";for(let m=0;m<f;m++)g+=String.fromCharCode(d[u+m]);return g},writeASCII(d,u,f){for(let g=0;g<f.length;g++)d[u+g]=f.charCodeAt(g)},readBytes(d,u,f){const g=[];for(let m=0;m<f;m++)g.push(d[u+m]);return g},pad:d=>d.length<2?`0${d}`:d,readUTF8(d,u,f){let g,m="";for(let p=0;p<f;p++)m+=`%${t.pad(d[u+p].toString(16))}`;try{g=decodeURIComponent(m)}catch{return t.readASCII(d,u,f)}return g}};function e(d,u,f,g){const m=u*f,p=o(g),y=Math.ceil(u*p/8),b=new Uint8Array(4*m),S=new Uint32Array(b.buffer),{ctype:x}=g,{depth:E}=g,k=t.readUshort;if(x==6){const H=m<<2;if(E==8)for(var C=0;C<H;C+=4)b[C]=d[C],b[C+1]=d[C+1],b[C+2]=d[C+2],b[C+3]=d[C+3];if(E==16)for(C=0;C<H;C++)b[C]=d[C<<1]}else if(x==2){const H=g.tabs.tRNS;if(H==null){if(E==8)for(C=0;C<m;C++){var N=3*C;S[C]=255<<24|d[N+2]<<16|d[N+1]<<8|d[N]}if(E==16)for(C=0;C<m;C++)N=6*C,S[C]=255<<24|d[N+4]<<16|d[N+2]<<8|d[N]}else{var _=H[0];const W=H[1],j=H[2];if(E==8)for(C=0;C<m;C++){var w=C<<2;N=3*C,S[C]=255<<24|d[N+2]<<16|d[N+1]<<8|d[N],d[N]==_&&d[N+1]==W&&d[N+2]==j&&(b[w+3]=0)}if(E==16)for(C=0;C<m;C++)w=C<<2,N=6*C,S[C]=255<<24|d[N+4]<<16|d[N+2]<<8|d[N],k(d,N)==_&&k(d,N+2)==W&&k(d,N+4)==j&&(b[w+3]=0)}}else if(x==3){const H=g.tabs.PLTE,W=g.tabs.tRNS,j=W?W.length:0;if(E==1)for(var M=0;M<f;M++){var O=M*y,L=M*u;for(C=0;C<u;C++){w=L+C<<2;var $=3*(F=d[O+(C>>3)]>>7-((7&C)<<0)&1);b[w]=H[$],b[w+1]=H[$+1],b[w+2]=H[$+2],b[w+3]=F<j?W[F]:255}}if(E==2)for(M=0;M<f;M++)for(O=M*y,L=M*u,C=0;C<u;C++)w=L+C<<2,$=3*(F=d[O+(C>>2)]>>6-((3&C)<<1)&3),b[w]=H[$],b[w+1]=H[$+1],b[w+2]=H[$+2],b[w+3]=F<j?W[F]:255;if(E==4)for(M=0;M<f;M++)for(O=M*y,L=M*u,C=0;C<u;C++)w=L+C<<2,$=3*(F=d[O+(C>>1)]>>4-((1&C)<<2)&15),b[w]=H[$],b[w+1]=H[$+1],b[w+2]=H[$+2],b[w+3]=F<j?W[F]:255;if(E==8)for(C=0;C<m;C++){var F;w=C<<2,$=3*(F=d[C]),b[w]=H[$],b[w+1]=H[$+1],b[w+2]=H[$+2],b[w+3]=F<j?W[F]:255}}else if(x==4){if(E==8)for(C=0;C<m;C++){w=C<<2;var D=d[A=C<<1];b[w]=D,b[w+1]=D,b[w+2]=D,b[w+3]=d[A+1]}if(E==16)for(C=0;C<m;C++){var A;w=C<<2,D=d[A=C<<2],b[w]=D,b[w+1]=D,b[w+2]=D,b[w+3]=d[A+2]}}else if(x==0)for(_=g.tabs.tRNS?g.tabs.tRNS:-1,M=0;M<f;M++){const H=M*y,W=M*u;if(E==1)for(var T=0;T<u;T++){var V=(D=255*(d[H+(T>>>3)]>>>7-(7&T)&1))==255*_?0:255;S[W+T]=V<<24|D<<16|D<<8|D}else if(E==2)for(T=0;T<u;T++)V=(D=85*(d[H+(T>>>2)]>>>6-((3&T)<<1)&3))==85*_?0:255,S[W+T]=V<<24|D<<16|D<<8|D;else if(E==4)for(T=0;T<u;T++)V=(D=17*(d[H+(T>>>1)]>>>4-((1&T)<<2)&15))==17*_?0:255,S[W+T]=V<<24|D<<16|D<<8|D;else if(E==8)for(T=0;T<u;T++)V=(D=d[H+T])==_?0:255,S[W+T]=V<<24|D<<16|D<<8|D;else if(E==16)for(T=0;T<u;T++)D=d[H+(T<<1)],V=k(d,H+(T<<1))==_?0:255,S[W+T]=V<<24|D<<16|D<<8|D}return b}function n(d,u,f,g){const m=o(d),p=Math.ceil(f*m/8),y=new Uint8Array((p+1+d.interlace)*g);return u=d.tabs.CgBI?s(u,y):r(u,y),d.interlace==0?u=i(u,d,0,f,g):d.interlace==1&&(u=(function(S,x){const E=x.width,k=x.height,C=o(x),N=C>>3,_=Math.ceil(E*C/8),w=new Uint8Array(k*_);let M=0;const O=[0,0,4,0,2,0,1],L=[0,4,0,2,0,1,0],$=[8,8,8,4,4,2,2],F=[8,8,4,4,2,2,1];let D=0;for(;D<7;){const T=$[D],V=F[D];let H=0,W=0,j=O[D];for(;j<k;)j+=T,W++;let U=L[D];for(;U<E;)U+=V,H++;const B=Math.ceil(H*C/8);i(S,x,M,H,W);let G=0,z=O[D];for(;z<k;){let K=L[D],X=M+G*B<<3;for(;K<E;){var A;if(C==1&&(A=(A=S[X>>3])>>7-(7&X)&1,w[z*_+(K>>3)]|=A<<7-((7&K)<<0)),C==2&&(A=(A=S[X>>3])>>6-(7&X)&3,w[z*_+(K>>2)]|=A<<6-((3&K)<<1)),C==4&&(A=(A=S[X>>3])>>4-(7&X)&15,w[z*_+(K>>1)]|=A<<4-((1&K)<<2)),C>=8){const Z=z*_+K*N;for(let ee=0;ee<N;ee++)w[Z+ee]=S[(X>>3)+ee]}X+=C,K+=V}G++,z+=T}H*W!=0&&(M+=W*(1+B)),D+=1}return w})(u,d)),u}function r(d,u){return s(new Uint8Array(d.buffer,2,d.length-6),u)}var s=(function(){const d={H:{}};return d.H.N=function(u,f){const g=Uint8Array;let m,p,y=0,b=0,S=0,x=0,E=0,k=0,C=0,N=0,_=0;if(u[0]==3&&u[1]==0)return f||new g(0);const w=d.H,M=w.b,O=w.e,L=w.R,$=w.n,F=w.A,D=w.Z,A=w.m,T=f==null;for(T&&(f=new g(u.length>>>2<<5));y==0;)if(y=M(u,_,1),b=M(u,_+1,2),_+=3,b!=0){if(T&&(f=d.H.W(f,N+(1<<17))),b==1&&(m=A.J,p=A.h,k=511,C=31),b==2){S=O(u,_,5)+257,x=O(u,_+5,5)+1,E=O(u,_+10,4)+4,_+=14;let H=1;for(var V=0;V<38;V+=2)A.Q[V]=0,A.Q[V+1]=0;for(V=0;V<E;V++){const U=O(u,_+3*V,3);A.Q[1+(A.X[V]<<1)]=U,U>H&&(H=U)}_+=3*E,$(A.Q,H),F(A.Q,H,A.u),m=A.w,p=A.d,_=L(A.u,(1<<H)-1,S+x,u,_,A.v);const W=w.V(A.v,0,S,A.C);k=(1<<W)-1;const j=w.V(A.v,S,x,A.D);C=(1<<j)-1,$(A.C,W),F(A.C,W,m),$(A.D,j),F(A.D,j,p)}for(;;){const H=m[D(u,_)&k];_+=15&H;const W=H>>>4;if(!(W>>>8))f[N++]=W;else{if(W==256)break;{let j=N+W-254;if(W>264){const K=A.q[W-257];j=N+(K>>>3)+O(u,_,7&K),_+=7&K}const U=p[D(u,_)&C];_+=15&U;const B=U>>>4,G=A.c[B],z=(G>>>4)+M(u,_,15&G);for(_+=15&G;N<j;)f[N]=f[N++-z],f[N]=f[N++-z],f[N]=f[N++-z],f[N]=f[N++-z];N=j}}}}else{(7&_)!=0&&(_+=8-(7&_));const H=4+(_>>>3),W=u[H-4]|u[H-3]<<8;T&&(f=d.H.W(f,N+W)),f.set(new g(u.buffer,u.byteOffset+H,W),N),_=H+W<<3,N+=W}return f.length==N?f:f.slice(0,N)},d.H.W=function(u,f){const g=u.length;if(f<=g)return u;const m=new Uint8Array(g<<1);return m.set(u,0),m},d.H.R=function(u,f,g,m,p,y){const b=d.H.e,S=d.H.Z;let x=0;for(;x<g;){const E=u[S(m,p)&f];p+=15&E;const k=E>>>4;if(k<=15)y[x]=k,x++;else{let C=0,N=0;k==16?(N=3+b(m,p,2),p+=2,C=y[x-1]):k==17?(N=3+b(m,p,3),p+=3):k==18&&(N=11+b(m,p,7),p+=7);const _=x+N;for(;x<_;)y[x]=C,x++}}return p},d.H.V=function(u,f,g,m){let p=0,y=0;const b=m.length>>>1;for(;y<g;){const S=u[y+f];m[y<<1]=0,m[1+(y<<1)]=S,S>p&&(p=S),y++}for(;y<b;)m[y<<1]=0,m[1+(y<<1)]=0,y++;return p},d.H.n=function(u,f){const g=d.H.m,m=u.length;let p,y,b,S;const x=g.j;for(var E=0;E<=f;E++)x[E]=0;for(E=1;E<m;E+=2)x[u[E]]++;const k=g.K;for(p=0,x[0]=0,y=1;y<=f;y++)p=p+x[y-1]<<1,k[y]=p;for(b=0;b<m;b+=2)S=u[b+1],S!=0&&(u[b]=k[S],k[S]++)},d.H.A=function(u,f,g){const m=u.length,p=d.H.m.r;for(let y=0;y<m;y+=2)if(u[y+1]!=0){const b=y>>1,S=u[y+1],x=b<<4|S,E=f-S;let k=u[y]<<E;const C=k+(1<<E);for(;k!=C;)g[p[k]>>>15-f]=x,k++}},d.H.l=function(u,f){const g=d.H.m.r,m=15-f;for(let p=0;p<u.length;p+=2){const y=u[p]<<f-u[p+1];u[p]=g[y]>>>m}},d.H.M=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8},d.H.I=function(u,f,g){g<<=7&f;const m=f>>>3;u[m]|=g,u[m+1]|=g>>>8,u[m+2]|=g>>>16},d.H.e=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8)>>>(7&f)&(1<<g)-1},d.H.b=function(u,f,g){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)&(1<<g)-1},d.H.Z=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16)>>>(7&f)},d.H.i=function(u,f){return(u[f>>>3]|u[1+(f>>>3)]<<8|u[2+(f>>>3)]<<16|u[3+(f>>>3)]<<24)>>>(7&f)},d.H.m=(function(){const u=Uint16Array,f=Uint32Array;return{K:new u(16),j:new u(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new u(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new f(32),J:new u(512),_:[],h:new u(32),$:[],w:new u(32768),C:[],v:[],d:new u(32768),D:[],u:new u(512),Q:[],r:new u(32768),s:new f(286),Y:new f(30),a:new f(19),t:new f(15e3),k:new u(65536),g:new u(32768)}})(),(function(){const u=d.H.m;for(var f=0;f<32768;f++){let m=f;m=(2863311530&m)>>>1|(1431655765&m)<<1,m=(3435973836&m)>>>2|(858993459&m)<<2,m=(4042322160&m)>>>4|(252645135&m)<<4,m=(4278255360&m)>>>8|(16711935&m)<<8,u.r[f]=(m>>>16|m<<16)>>>17}function g(m,p,y){for(;p--!=0;)m.push(0,y)}for(f=0;f<32;f++)u.q[f]=u.S[f]<<3|u.T[f],u.c[f]=u.p[f]<<4|u.z[f];g(u._,144,8),g(u._,112,9),g(u._,24,7),g(u._,8,8),d.H.n(u._,9),d.H.A(u._,9,u.J),d.H.l(u._,9),g(u.$,32,5),d.H.n(u.$,5),d.H.A(u.$,5,u.h),d.H.l(u.$,5),g(u.Q,19,0),g(u.C,286,0),g(u.D,30,0),g(u.v,320,0)})(),d.H.N})();function o(d){return[1,null,3,1,2,null,4][d.ctype]*d.depth}function i(d,u,f,g,m){let p=o(u);const y=Math.ceil(g*p/8);let b,S;p=Math.ceil(p/8);let x=d[f],E=0;if(x>1&&(d[f]=[0,0,1][x-2]),x==3)for(E=p;E<y;E++)d[E+1]=d[E+1]+(d[E+1-p]>>>1)&255;for(let k=0;k<m;k++)if(b=f+k*y,S=b+k+1,x=d[S-1],E=0,x==0)for(;E<y;E++)d[b+E]=d[S+E];else if(x==1){for(;E<p;E++)d[b+E]=d[S+E];for(;E<y;E++)d[b+E]=d[S+E]+d[b+E-p]}else if(x==2)for(;E<y;E++)d[b+E]=d[S+E]+d[b+E-y];else if(x==3){for(;E<p;E++)d[b+E]=d[S+E]+(d[b+E-y]>>>1);for(;E<y;E++)d[b+E]=d[S+E]+(d[b+E-y]+d[b+E-p]>>>1)}else{for(;E<p;E++)d[b+E]=d[S+E]+a(0,d[b+E-y],0);for(;E<y;E++)d[b+E]=d[S+E]+a(d[b+E-p],d[b+E-y],d[b+E-p-y])}return d}function a(d,u,f){const g=d+u-f,m=g-d,p=g-u,y=g-f;return m*m<=p*p&&m*m<=y*y?d:p*p<=y*y?u:f}function l(d,u,f){f.width=t.readUint(d,u),u+=4,f.height=t.readUint(d,u),u+=4,f.depth=d[u],u++,f.ctype=d[u],u++,f.compress=d[u],u++,f.filter=d[u],u++,f.interlace=d[u],u++}function c(d,u,f,g,m,p,y,b,S){const x=Math.min(u,m),E=Math.min(f,p);let k=0,C=0;for(let D=0;D<E;D++)for(let A=0;A<x;A++)if(y>=0&&b>=0?(k=D*u+A<<2,C=(b+D)*m+y+A<<2):(k=(-b+D)*u-y+A<<2,C=D*m+A<<2),S==0)g[C]=d[k],g[C+1]=d[k+1],g[C+2]=d[k+2],g[C+3]=d[k+3];else if(S==1){var N=d[k+3]*.00392156862745098,_=d[k]*N,w=d[k+1]*N,M=d[k+2]*N,O=g[C+3]*(1/255),L=g[C]*O,$=g[C+1]*O,F=g[C+2]*O;const T=1-N,V=N+O*T,H=V==0?0:1/V;g[C+3]=255*V,g[C+0]=(_+L*T)*H,g[C+1]=(w+$*T)*H,g[C+2]=(M+F*T)*H}else if(S==2)N=d[k+3],_=d[k],w=d[k+1],M=d[k+2],O=g[C+3],L=g[C],$=g[C+1],F=g[C+2],N==O&&_==L&&w==$&&M==F?(g[C]=0,g[C+1]=0,g[C+2]=0,g[C+3]=0):(g[C]=_,g[C+1]=w,g[C+2]=M,g[C+3]=N);else if(S==3){if(N=d[k+3],_=d[k],w=d[k+1],M=d[k+2],O=g[C+3],L=g[C],$=g[C+1],F=g[C+2],N==O&&_==L&&w==$&&M==F)continue;if(N<220&&O>20)return!1}return!0}return{decode:function(u){const f=new Uint8Array(u);let g=8;const m=t,p=m.readUshort,y=m.readUint,b={tabs:{},frames:[]},S=new Uint8Array(f.length);let x,E=0,k=0;const C=[137,80,78,71,13,10,26,10];for(var N=0;N<8;N++)if(f[N]!=C[N])throw"The input is not a PNG file!";for(;g<f.length;){const D=m.readUint(f,g);g+=4;const A=m.readASCII(f,g,4);if(g+=4,A=="IHDR")l(f,g,b);else if(A=="iCCP"){for(var _=g;f[_]!=0;)_++;m.readASCII(f,g,_-g),f[_+1];const T=f.slice(_+2,g+D);let V=null;try{V=r(T)}catch{V=s(T)}b.tabs[A]=V}else if(A=="CgBI")b.tabs[A]=f.slice(g,g+4);else if(A=="IDAT"){for(N=0;N<D;N++)S[E+N]=f[g+N];E+=D}else if(A=="acTL")b.tabs[A]={num_frames:y(f,g),num_plays:y(f,g+4)},x=new Uint8Array(f.length);else if(A=="fcTL"){k!=0&&((F=b.frames[b.frames.length-1]).data=n(b,x.slice(0,k),F.rect.width,F.rect.height),k=0);const T={x:y(f,g+12),y:y(f,g+16),width:y(f,g+4),height:y(f,g+8)};let V=p(f,g+22);V=p(f,g+20)/(V==0?100:V);const H={rect:T,delay:Math.round(1e3*V),dispose:f[g+24],blend:f[g+25]};b.frames.push(H)}else if(A=="fdAT"){for(N=0;N<D-4;N++)x[k+N]=f[g+N+4];k+=D-4}else if(A=="pHYs")b.tabs[A]=[m.readUint(f,g),m.readUint(f,g+4),f[g+8]];else if(A=="cHRM")for(b.tabs[A]=[],N=0;N<8;N++)b.tabs[A].push(m.readUint(f,g+4*N));else if(A=="tEXt"||A=="zTXt"){b.tabs[A]==null&&(b.tabs[A]={});var w=m.nextZero(f,g),M=m.readASCII(f,g,w-g),O=g+D-w-1;if(A=="tEXt")$=m.readASCII(f,w+1,O);else{var L=r(f.slice(w+2,w+2+O));$=m.readUTF8(L,0,L.length)}b.tabs[A][M]=$}else if(A=="iTXt"){b.tabs[A]==null&&(b.tabs[A]={}),w=0,_=g,w=m.nextZero(f,_),M=m.readASCII(f,_,w-_);const T=f[_=w+1];var $;f[_+1],_+=2,w=m.nextZero(f,_),m.readASCII(f,_,w-_),_=w+1,w=m.nextZero(f,_),m.readUTF8(f,_,w-_),O=D-((_=w+1)-g),T==0?$=m.readUTF8(f,_,O):(L=r(f.slice(_,_+O)),$=m.readUTF8(L,0,L.length)),b.tabs[A][M]=$}else if(A=="PLTE")b.tabs[A]=m.readBytes(f,g,D);else if(A=="hIST"){const T=b.tabs.PLTE.length/3;for(b.tabs[A]=[],N=0;N<T;N++)b.tabs[A].push(p(f,g+2*N))}else if(A=="tRNS")b.ctype==3?b.tabs[A]=m.readBytes(f,g,D):b.ctype==0?b.tabs[A]=p(f,g):b.ctype==2&&(b.tabs[A]=[p(f,g),p(f,g+2),p(f,g+4)]);else if(A=="gAMA")b.tabs[A]=m.readUint(f,g)/1e5;else if(A=="sRGB")b.tabs[A]=f[g];else if(A=="bKGD")b.ctype==0||b.ctype==4?b.tabs[A]=[p(f,g)]:b.ctype==2||b.ctype==6?b.tabs[A]=[p(f,g),p(f,g+2),p(f,g+4)]:b.ctype==3&&(b.tabs[A]=f[g]);else if(A=="IEND")break;g+=D,m.readUint(f,g),g+=4}var F;return k!=0&&((F=b.frames[b.frames.length-1]).data=n(b,x.slice(0,k),F.rect.width,F.rect.height)),b.data=n(b,S,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(u){const f=u.width,g=u.height;if(u.tabs.acTL==null)return[e(u.data,f,g,u).buffer];const m=[];u.frames[0].data==null&&(u.frames[0].data=u.data);const p=f*g*4,y=new Uint8Array(p),b=new Uint8Array(p),S=new Uint8Array(p);for(let E=0;E<u.frames.length;E++){const k=u.frames[E],C=k.rect.x,N=k.rect.y,_=k.rect.width,w=k.rect.height,M=e(k.data,_,w,u);if(E!=0)for(var x=0;x<p;x++)S[x]=y[x];if(k.blend==0?c(M,_,w,y,f,g,C,N,0):k.blend==1&&c(M,_,w,y,f,g,C,N,1),m.push(y.buffer.slice(0)),k.dispose!=0){if(k.dispose==1)c(b,_,w,y,f,g,C,N,0);else if(k.dispose==2)for(x=0;x<p;x++)y[x]=S[x]}}return m},_paeth:a,_copyTile:c,_bin:t}})();(function(){const{_copyTile:t}=En,{_bin:e}=En,n=En._paeth;var r={table:(function(){const _=new Uint32Array(256);for(let w=0;w<256;w++){let M=w;for(let O=0;O<8;O++)1&M?M=3988292384^M>>>1:M>>>=1;_[w]=M}return _})(),update(_,w,M,O){for(let L=0;L<O;L++)_=r.table[255&(_^w[M+L])]^_>>>8;return _},crc:(_,w,M)=>4294967295^r.update(4294967295,_,w,M)};function s(_,w,M,O){w[M]+=_[0]*O>>4,w[M+1]+=_[1]*O>>4,w[M+2]+=_[2]*O>>4,w[M+3]+=_[3]*O>>4}function o(_){return Math.max(0,Math.min(255,_))}function i(_,w){const M=_[0]-w[0],O=_[1]-w[1],L=_[2]-w[2],$=_[3]-w[3];return M*M+O*O+L*L+$*$}function a(_,w,M,O,L,$,F){F==null&&(F=1);const D=O.length,A=[];for(var T=0;T<D;T++){const z=O[T];A.push([z>>>0&255,z>>>8&255,z>>>16&255,z>>>24&255])}for(T=0;T<D;T++){let z=4294967295;for(var V=0,H=0;H<D;H++){var W=i(A[T],A[H]);H!=T&&W<z&&(z=W,V=H)}}const j=new Uint32Array(L.buffer),U=new Int16Array(w*M*4),B=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(T=0;T<B.length;T++)B[T]=255*((B[T]+.5)/16-.5);for(let z=0;z<M;z++)for(let K=0;K<w;K++){var G;T=4*(z*w+K),F!=2?G=[o(_[T]+U[T]),o(_[T+1]+U[T+1]),o(_[T+2]+U[T+2]),o(_[T+3]+U[T+3])]:(W=B[4*(3&z)+(3&K)],G=[o(_[T]+W),o(_[T+1]+W),o(_[T+2]+W),o(_[T+3]+W)]),V=0;let X=16777215;for(H=0;H<D;H++){const ne=i(G,A[H]);ne<X&&(X=ne,V=H)}const Z=A[V],ee=[G[0]-Z[0],G[1]-Z[1],G[2]-Z[2],G[3]-Z[3]];F==1&&(K!=w-1&&s(ee,U,T+4,7),z!=M-1&&(K!=0&&s(ee,U,T+4*w-4,3),s(ee,U,T+4*w,5),K!=w-1&&s(ee,U,T+4*w+4,1))),$[T>>2]=V,j[T>>2]=O[V]}}function l(_,w,M,O,L){L==null&&(L={});const{crc:$}=r,F=e.writeUint,D=e.writeUshort,A=e.writeASCII;let T=8;const V=_.frames.length>1;let H,W=!1,j=33+(V?20:0);if(L.sRGB!=null&&(j+=13),L.pHYs!=null&&(j+=21),L.iCCP!=null&&(H=pako.deflate(L.iCCP),j+=21+H.length+4),_.ctype==3){for(var U=_.plte.length,B=0;B<U;B++)_.plte[B]>>>24!=255&&(W=!0);j+=8+3*U+4+(W?8+1*U+4:0)}for(var G=0;G<_.frames.length;G++)V&&(j+=38),j+=(Z=_.frames[G]).cimg.length+12,G!=0&&(j+=4);j+=12;const z=new Uint8Array(j),K=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)z[B]=K[B];if(F(z,T,13),T+=4,A(z,T,"IHDR"),T+=4,F(z,T,w),T+=4,F(z,T,M),T+=4,z[T]=_.depth,T++,z[T]=_.ctype,T++,z[T]=0,T++,z[T]=0,T++,z[T]=0,T++,F(z,T,$(z,T-17,17)),T+=4,L.sRGB!=null&&(F(z,T,1),T+=4,A(z,T,"sRGB"),T+=4,z[T]=L.sRGB,T++,F(z,T,$(z,T-5,5)),T+=4),L.iCCP!=null){const ee=13+H.length;F(z,T,ee),T+=4,A(z,T,"iCCP"),T+=4,A(z,T,"ICC profile"),T+=11,T+=2,z.set(H,T),T+=H.length,F(z,T,$(z,T-(ee+4),ee+4)),T+=4}if(L.pHYs!=null&&(F(z,T,9),T+=4,A(z,T,"pHYs"),T+=4,F(z,T,L.pHYs[0]),T+=4,F(z,T,L.pHYs[1]),T+=4,z[T]=L.pHYs[2],T++,F(z,T,$(z,T-13,13)),T+=4),V&&(F(z,T,8),T+=4,A(z,T,"acTL"),T+=4,F(z,T,_.frames.length),T+=4,F(z,T,L.loop!=null?L.loop:0),T+=4,F(z,T,$(z,T-12,12)),T+=4),_.ctype==3){for(F(z,T,3*(U=_.plte.length)),T+=4,A(z,T,"PLTE"),T+=4,B=0;B<U;B++){const ee=3*B,ne=_.plte[B],he=255&ne,J=ne>>>8&255,ce=ne>>>16&255;z[T+ee+0]=he,z[T+ee+1]=J,z[T+ee+2]=ce}if(T+=3*U,F(z,T,$(z,T-3*U-4,3*U+4)),T+=4,W){for(F(z,T,U),T+=4,A(z,T,"tRNS"),T+=4,B=0;B<U;B++)z[T+B]=_.plte[B]>>>24&255;T+=U,F(z,T,$(z,T-U-4,U+4)),T+=4}}let X=0;for(G=0;G<_.frames.length;G++){var Z=_.frames[G];V&&(F(z,T,26),T+=4,A(z,T,"fcTL"),T+=4,F(z,T,X++),T+=4,F(z,T,Z.rect.width),T+=4,F(z,T,Z.rect.height),T+=4,F(z,T,Z.rect.x),T+=4,F(z,T,Z.rect.y),T+=4,D(z,T,O[G]),T+=2,D(z,T,1e3),T+=2,z[T]=Z.dispose,T++,z[T]=Z.blend,T++,F(z,T,$(z,T-30,30)),T+=4);const ee=Z.cimg;F(z,T,(U=ee.length)+(G==0?0:4)),T+=4;const ne=T;A(z,T,G==0?"IDAT":"fdAT"),T+=4,G!=0&&(F(z,T,X++),T+=4),z.set(ee,T),T+=U,F(z,T,$(z,ne,T-ne)),T+=4}return F(z,T,0),T+=4,A(z,T,"IEND"),T+=4,F(z,T,$(z,T-4,4)),T+=4,z.buffer}function c(_,w,M){for(let O=0;O<_.frames.length;O++){const L=_.frames[O];L.rect.width;const $=L.rect.height,F=new Uint8Array($*L.bpl+$);L.cimg=g(L.img,$,L.bpp,L.bpl,F,w,M)}}function d(_,w,M,O,L){const $=L[0],F=L[1],D=L[2],A=L[3],T=L[4],V=L[5];let H=6,W=8,j=255;for(var U=0;U<_.length;U++){const ve=new Uint8Array(_[U]);for(var B=ve.length,G=0;G<B;G+=4)j&=ve[G+3]}const z=j!=255,K=(function(fe,ye,Se,He,se,Ae){const Le=[];for(var Ie=0;Ie<fe.length;Ie++){const Xe=new Uint8Array(fe[Ie]),te=new Uint32Array(Xe.buffer);var Be;let ge=0,pe=0,me=ye,be=Se,Ue=He?1:0;if(Ie!=0){const Me=Ae||He||Ie==1||Le[Ie-2].dispose!=0?1:2;let Fe=0,_e=1e9;for(let ot=0;ot<Me;ot++){var st=new Uint8Array(fe[Ie-1-ot]);const it=new Uint32Array(fe[Ie-1-ot]);let we=ye,Ee=Se,ze=-1,qe=-1;for(let nt=0;nt<Se;nt++)for(let gt=0;gt<ye;gt++)te[je=nt*ye+gt]!=it[je]&&(gt<we&&(we=gt),gt>ze&&(ze=gt),nt<Ee&&(Ee=nt),nt>qe&&(qe=nt));ze==-1&&(we=Ee=ze=qe=0),se&&((1&we)==1&&we--,(1&Ee)==1&&Ee--);const Re=(ze-we+1)*(qe-Ee+1);Re<_e&&(_e=Re,Fe=ot,ge=we,pe=Ee,me=ze-we+1,be=qe-Ee+1)}st=new Uint8Array(fe[Ie-1-Fe]),Fe==1&&(Le[Ie-1].dispose=2),Be=new Uint8Array(me*be*4),t(st,ye,Se,Be,me,be,-ge,-pe,0),Ue=t(Xe,ye,Se,Be,me,be,-ge,-pe,3)?1:0,Ue==1?f(Xe,ye,Se,Be,{x:ge,y:pe,width:me,height:be}):t(Xe,ye,Se,Be,me,be,-ge,-pe,0)}else Be=Xe.slice(0);Le.push({rect:{x:ge,y:pe,width:me,height:be},img:Be,blend:Ue,dispose:0})}if(He)for(Ie=0;Ie<Le.length;Ie++){if((Je=Le[Ie]).blend==1)continue;const Xe=Je.rect,te=Le[Ie-1].rect,ge=Math.min(Xe.x,te.x),pe=Math.min(Xe.y,te.y),me={x:ge,y:pe,width:Math.max(Xe.x+Xe.width,te.x+te.width)-ge,height:Math.max(Xe.y+Xe.height,te.y+te.height)-pe};Le[Ie-1].dispose=1,Ie-1!=0&&u(fe,ye,Se,Le,Ie-1,me,se),u(fe,ye,Se,Le,Ie,me,se)}let ft=0;if(fe.length!=1)for(var je=0;je<Le.length;je++){var Je;ft+=(Je=Le[je]).rect.width*Je.rect.height}return Le})(_,w,M,$,F,D),X={},Z=[],ee=[];if(O!=0){const ve=[];for(G=0;G<K.length;G++)ve.push(K[G].img.buffer);const fe=(function(se){let Ae=0;for(var Le=0;Le<se.length;Le++)Ae+=se[Le].byteLength;const Ie=new Uint8Array(Ae);let Be=0;for(Le=0;Le<se.length;Le++){const st=new Uint8Array(se[Le]),ft=st.length;for(let je=0;je<ft;je+=4){let Je=st[je],Xe=st[je+1],te=st[je+2];const ge=st[je+3];ge==0&&(Je=Xe=te=0),Ie[Be+je]=Je,Ie[Be+je+1]=Xe,Ie[Be+je+2]=te,Ie[Be+je+3]=ge}Be+=ft}return Ie.buffer})(ve),ye=p(fe,O);for(G=0;G<ye.plte.length;G++)Z.push(ye.plte[G].est.rgba);let Se=0;for(G=0;G<K.length;G++){const He=(he=K[G]).img.length;var ne=new Uint8Array(ye.inds.buffer,Se>>2,He>>2);ee.push(ne);const se=new Uint8Array(ye.abuf,Se,He);V&&a(he.img,he.rect.width,he.rect.height,Z,se,ne),he.img.set(se),Se+=He}}else for(U=0;U<K.length;U++){var he=K[U];const ve=new Uint32Array(he.img.buffer);var J=he.rect.width;for(B=ve.length,ne=new Uint8Array(B),ee.push(ne),G=0;G<B;G++){const fe=ve[G];if(G!=0&&fe==ve[G-1])ne[G]=ne[G-1];else if(G>J&&fe==ve[G-J])ne[G]=ne[G-J];else{let ye=X[fe];if(ye==null&&(X[fe]=ye=Z.length,Z.push(fe),Z.length>=300))break;ne[G]=ye}}}const ce=Z.length;for(ce<=256&&T==0&&(W=ce<=2?1:ce<=4?2:ce<=16?4:8,W=Math.max(W,A)),U=0;U<K.length;U++){(he=K[U]).rect.x,he.rect.y,J=he.rect.width;const ve=he.rect.height;let fe=he.img;new Uint32Array(fe.buffer);let ye=4*J,Se=4;if(ce<=256&&T==0){ye=Math.ceil(W*J/8);var ue=new Uint8Array(ye*ve);const He=ee[U];for(let se=0;se<ve;se++){G=se*ye;const Ae=se*J;if(W==8)for(var ie=0;ie<J;ie++)ue[G+ie]=He[Ae+ie];else if(W==4)for(ie=0;ie<J;ie++)ue[G+(ie>>1)]|=He[Ae+ie]<<4-4*(1&ie);else if(W==2)for(ie=0;ie<J;ie++)ue[G+(ie>>2)]|=He[Ae+ie]<<6-2*(3&ie);else if(W==1)for(ie=0;ie<J;ie++)ue[G+(ie>>3)]|=He[Ae+ie]<<7-1*(7&ie)}fe=ue,H=3,Se=1}else if(z==0&&K.length==1){ue=new Uint8Array(J*ve*3);const He=J*ve;for(G=0;G<He;G++){const se=3*G,Ae=4*G;ue[se]=fe[Ae],ue[se+1]=fe[Ae+1],ue[se+2]=fe[Ae+2]}fe=ue,H=2,Se=3,ye=3*J}he.img=fe,he.bpl=ye,he.bpp=Se}return{ctype:H,depth:W,plte:Z,frames:K}}function u(_,w,M,O,L,$,F){const D=Uint8Array,A=Uint32Array,T=new D(_[L-1]),V=new A(_[L-1]),H=L+1<_.length?new D(_[L+1]):null,W=new D(_[L]),j=new A(W.buffer);let U=w,B=M,G=-1,z=-1;for(let X=0;X<$.height;X++)for(let Z=0;Z<$.width;Z++){const ee=$.x+Z,ne=$.y+X,he=ne*w+ee,J=j[he];J==0||O[L-1].dispose==0&&V[he]==J&&(H==null||H[4*he+3]!=0)||(ee<U&&(U=ee),ee>G&&(G=ee),ne<B&&(B=ne),ne>z&&(z=ne))}G==-1&&(U=B=G=z=0),F&&((1&U)==1&&U--,(1&B)==1&&B--),$={x:U,y:B,width:G-U+1,height:z-B+1};const K=O[L];K.rect=$,K.blend=1,K.img=new Uint8Array($.width*$.height*4),O[L-1].dispose==0?(t(T,w,M,K.img,$.width,$.height,-$.x,-$.y,0),f(W,w,M,K.img,$)):t(W,w,M,K.img,$.width,$.height,-$.x,-$.y,0)}function f(_,w,M,O,L){t(_,w,M,O,L.width,L.height,-L.x,-L.y,2)}function g(_,w,M,O,L,$,F){const D=[];let A,T=[0,1,2,3,4];$!=-1?T=[$]:(w*O>5e5||M==1)&&(T=[0]),F&&(A={level:0});const V=X2;for(var H=0;H<T.length;H++){for(let U=0;U<w;U++)m(L,_,U,O,M,T[H]);D.push(V.deflate(L,A))}let W,j=1e9;for(H=0;H<D.length;H++)D[H].length<j&&(W=H,j=D[H].length);return D[W]}function m(_,w,M,O,L,$){const F=M*O;let D=F+M;if(_[D]=$,D++,$==0)if(O<500)for(var A=0;A<O;A++)_[D+A]=w[F+A];else _.set(new Uint8Array(w.buffer,F,O),D);else if($==1){for(A=0;A<L;A++)_[D+A]=w[F+A];for(A=L;A<O;A++)_[D+A]=w[F+A]-w[F+A-L]+256&255}else if(M==0){for(A=0;A<L;A++)_[D+A]=w[F+A];if($==2)for(A=L;A<O;A++)_[D+A]=w[F+A];if($==3)for(A=L;A<O;A++)_[D+A]=w[F+A]-(w[F+A-L]>>1)+256&255;if($==4)for(A=L;A<O;A++)_[D+A]=w[F+A]-n(w[F+A-L],0,0)+256&255}else{if($==2)for(A=0;A<O;A++)_[D+A]=w[F+A]+256-w[F+A-O]&255;if($==3){for(A=0;A<L;A++)_[D+A]=w[F+A]+256-(w[F+A-O]>>1)&255;for(A=L;A<O;A++)_[D+A]=w[F+A]+256-(w[F+A-O]+w[F+A-L]>>1)&255}if($==4){for(A=0;A<L;A++)_[D+A]=w[F+A]+256-n(0,w[F+A-O],0)&255;for(A=L;A<O;A++)_[D+A]=w[F+A]+256-n(w[F+A-L],w[F+A-O],w[F+A-L-O])&255}}}function p(_,w){const M=new Uint8Array(_),O=M.slice(0),L=new Uint32Array(O.buffer),$=y(O,w),F=$[0],D=$[1],A=M.length,T=new Uint8Array(A>>2);let V;if(M.length<2e7)for(var H=0;H<A;H+=4)V=b(F,W=M[H]*.00392156862745098,j=M[H+1]*.00392156862745098,U=M[H+2]*.00392156862745098,B=M[H+3]*.00392156862745098),T[H>>2]=V.ind,L[H>>2]=V.est.rgba;else for(H=0;H<A;H+=4){var W=M[H]*.00392156862745098,j=M[H+1]*(1/255),U=M[H+2]*(1/255),B=M[H+3]*(1/255);for(V=F;V.left;)V=S(V.est,W,j,U,B)<=0?V.left:V.right;T[H>>2]=V.ind,L[H>>2]=V.est.rgba}return{abuf:O.buffer,inds:T,plte:D}}function y(_,w,M){M==null&&(M=1e-4);const O=new Uint32Array(_.buffer),L={i0:0,i1:_.length,bst:null,est:null,tdst:0,left:null,right:null};L.bst=k(_,L.i0,L.i1),L.est=C(L.bst);const $=[L];for(;$.length<w;){let D=0,A=0;for(var F=0;F<$.length;F++)$[F].est.L>D&&(D=$[F].est.L,A=F);if(D<M)break;const T=$[A],V=x(_,O,T.i0,T.i1,T.est.e,T.est.eMq255);if(T.i0>=V||T.i1<=V){T.est.L=0;continue}const H={i0:T.i0,i1:V,bst:null,est:null,tdst:0,left:null,right:null};H.bst=k(_,H.i0,H.i1),H.est=C(H.bst);const W={i0:V,i1:T.i1,bst:null,est:null,tdst:0,left:null,right:null};for(W.bst={R:[],m:[],N:T.bst.N-H.bst.N},F=0;F<16;F++)W.bst.R[F]=T.bst.R[F]-H.bst.R[F];for(F=0;F<4;F++)W.bst.m[F]=T.bst.m[F]-H.bst.m[F];W.est=C(W.bst),T.left=H,T.right=W,$[A]=H,$.push(W)}for($.sort(((D,A)=>A.bst.N-D.bst.N)),F=0;F<$.length;F++)$[F].ind=F;return[L,$]}function b(_,w,M,O,L){if(_.left==null)return _.tdst=(function(H,W,j,U,B){const G=W-H[0],z=j-H[1],K=U-H[2],X=B-H[3];return G*G+z*z+K*K+X*X})(_.est.q,w,M,O,L),_;const $=S(_.est,w,M,O,L);let F=_.left,D=_.right;$>0&&(F=_.right,D=_.left);const A=b(F,w,M,O,L);if(A.tdst<=$*$)return A;const T=b(D,w,M,O,L);return T.tdst<A.tdst?T:A}function S(_,w,M,O,L){const{e:$}=_;return $[0]*w+$[1]*M+$[2]*O+$[3]*L-_.eMq}function x(_,w,M,O,L,$){for(O-=4;M<O;){for(;E(_,M,L)<=$;)M+=4;for(;E(_,O,L)>$;)O-=4;if(M>=O)break;const F=w[M>>2];w[M>>2]=w[O>>2],w[O>>2]=F,M+=4,O-=4}for(;E(_,M,L)>$;)M-=4;return M+4}function E(_,w,M){return _[w]*M[0]+_[w+1]*M[1]+_[w+2]*M[2]+_[w+3]*M[3]}function k(_,w,M){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],L=[0,0,0,0],$=M-w>>2;for(let F=w;F<M;F+=4){const D=_[F]*.00392156862745098,A=_[F+1]*(1/255),T=_[F+2]*(1/255),V=_[F+3]*(1/255);L[0]+=D,L[1]+=A,L[2]+=T,L[3]+=V,O[0]+=D*D,O[1]+=D*A,O[2]+=D*T,O[3]+=D*V,O[5]+=A*A,O[6]+=A*T,O[7]+=A*V,O[10]+=T*T,O[11]+=T*V,O[15]+=V*V}return O[4]=O[1],O[8]=O[2],O[9]=O[6],O[12]=O[3],O[13]=O[7],O[14]=O[11],{R:O,m:L,N:$}}function C(_){const{R:w}=_,{m:M}=_,{N:O}=_,L=M[0],$=M[1],F=M[2],D=M[3],A=O==0?0:1/O,T=[w[0]-L*L*A,w[1]-L*$*A,w[2]-L*F*A,w[3]-L*D*A,w[4]-$*L*A,w[5]-$*$*A,w[6]-$*F*A,w[7]-$*D*A,w[8]-F*L*A,w[9]-F*$*A,w[10]-F*F*A,w[11]-F*D*A,w[12]-D*L*A,w[13]-D*$*A,w[14]-D*F*A,w[15]-D*D*A],V=T,H=N;let W=[Math.random(),Math.random(),Math.random(),Math.random()],j=0,U=0;if(O!=0)for(let G=0;G<16&&(W=H.multVec(V,W),U=Math.sqrt(H.dot(W,W)),W=H.sml(1/U,W),!(G!=0&&Math.abs(U-j)<1e-9));G++)j=U;const B=[L*A,$*A,F*A,D*A];return{Cov:T,q:B,e:W,L:j,eMq255:H.dot(H.sml(255,B),W),eMq:H.dot(W,B),rgba:(Math.round(255*B[3])<<24|Math.round(255*B[2])<<16|Math.round(255*B[1])<<8|Math.round(255*B[0])<<0)>>>0}}var N={multVec:(_,w)=>[_[0]*w[0]+_[1]*w[1]+_[2]*w[2]+_[3]*w[3],_[4]*w[0]+_[5]*w[1]+_[6]*w[2]+_[7]*w[3],_[8]*w[0]+_[9]*w[1]+_[10]*w[2]+_[11]*w[3],_[12]*w[0]+_[13]*w[1]+_[14]*w[2]+_[15]*w[3]],dot:(_,w)=>_[0]*w[0]+_[1]*w[1]+_[2]*w[2]+_[3]*w[3],sml:(_,w)=>[_*w[0],_*w[1],_*w[2],_*w[3]]};En.encode=function(w,M,O,L,$,F,D){L==null&&(L=0),D==null&&(D=!1);const A=d(w,M,O,L,[!1,!1,!1,0,D,!1]);return c(A,-1),l(A,M,O,$,F)},En.encodeLL=function(w,M,O,L,$,F,D,A){const T={ctype:0+(L==1?0:2)+($==0?0:4),depth:F,frames:[]},V=(L+$)*F,H=V*M;for(let W=0;W<w.length;W++)T.frames.push({rect:{x:0,y:0,width:M,height:O},img:new Uint8Array(w[W]),blend:0,dispose:1,bpp:Math.ceil(V/8),bpl:Math.ceil(H/8)});return c(T,0,!0),l(T,M,O,D,A)},En.encode.compress=d,En.encode.dither=a,En.quantize=p,En.quantize.getKDtree=y,En.quantize.getNearest=b})();const cp={toArrayBuffer(t,e){const n=t.width,r=t.height,s=n<<2,o=t.getContext("2d").getImageData(0,0,n,r),i=new Uint32Array(o.data.buffer),a=(32*n+31)/32<<2,l=a*r,c=122+l,d=new ArrayBuffer(c),u=new DataView(d),f=1<<20;let g,m,p,y,b=f,S=0,x=0,E=0;function k(_){u.setUint16(x,_,!0),x+=2}function C(_){u.setUint32(x,_,!0),x+=4}function N(_){x+=_}k(19778),C(c),N(4),C(122),C(108),C(n),C(-r>>>0),k(1),k(32),C(3),C(l),C(2835),C(2835),N(8),C(16711680),C(65280),C(255),C(4278190080),C(1466527264),(function _(){for(;S<r&&b>0;){for(y=122+S*a,g=0;g<s;)b--,m=i[E++],p=m>>>24,u.setUint32(y+g,m<<8|p),g+=4;S++}E<i.length?(b=f,setTimeout(_,cp._dly)):e(d)})()},toBlob(t,e){this.toArrayBuffer(t,(n=>{e(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var qt={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},K2={[qt.CHROME]:16384,[qt.FIREFOX]:11180,[qt.DESKTOP_SAFARI]:16384,[qt.IE]:8192,[qt.IOS]:4096,[qt.ETC]:8192};const Nc=typeof window<"u",dp=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,ji=Nc&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),q2=(Nc||dp)&&(ji&&ji.getOriginalSymbol(window,"File")||typeof File<"u"&&File),up=(Nc||dp)&&(ji&&ji.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Oc(t,e,n=Date.now()){return new Promise((r=>{const s=t.split(","),o=s[0].match(/:(.*?);/)[1],i=globalThis.atob(s[1]);let a=i.length;const l=new Uint8Array(a);for(;a--;)l[a]=i.charCodeAt(a);const c=new Blob([l],{type:o});c.name=e,c.lastModified=n,r(c)}))}function fp(t){return new Promise(((e,n)=>{const r=new up;r.onload=()=>e(r.result),r.onerror=s=>n(s),r.readAsDataURL(t)}))}function hp(t){return new Promise(((e,n)=>{const r=new Image;r.onload=()=>e(r),r.onerror=s=>n(s),r.src=t}))}function wr(){if(wr.cachedResult!==void 0)return wr.cachedResult;let t=qt.ETC;const{userAgent:e}=navigator;return/Chrom(e|ium)/i.test(e)?t=qt.CHROME:/iP(ad|od|hone)/i.test(e)&&/WebKit/i.test(e)?t=qt.IOS:/Safari/i.test(e)?t=qt.DESKTOP_SAFARI:/Firefox/i.test(e)?t=qt.FIREFOX:(/MSIE/i.test(e)||document.documentMode)&&(t=qt.IE),wr.cachedResult=t,wr.cachedResult}function gp(t,e){const n=wr(),r=K2[n];let s=t,o=e,i=s*o;const a=s>o?o/s:s/o;for(;i>r*r;){const l=(r+s)/2,c=(r+o)/2;l<c?(o=c,s=c*a):(o=l*a,s=l),i=s*o}return{width:s,height:o}}function Wi(t,e){let n,r;try{if(n=new OffscreenCanvas(t,e),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=t,n.height=e,[n,r]}function pp(t,e){const{width:n,height:r}=gp(t.width,t.height),[s,o]=Wi(n,r);return e&&/jpe?g/.test(e)&&(o.fillStyle="white",o.fillRect(0,0,s.width,s.height)),o.drawImage(t,0,0,s.width,s.height),s}function Gi(){return Gi.cachedResult!==void 0||(Gi.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Gi.cachedResult}function Yi(t,e={}){return new Promise((function(n,r){let s,o;var i=function(){try{return o=pp(s,e.fileType||t.type),n([s,o])}catch(l){return r(l)}},a=function(l){try{var c=function(d){try{throw d}catch(u){return r(u)}};try{let d;return fp(t).then((function(u){try{return d=u,hp(d).then((function(f){try{return s=f,(function(){try{return i()}catch(g){return r(g)}})()}catch(g){return c(g)}}),c)}catch(f){return c(f)}}),c)}catch(d){c(d)}}catch(d){return r(d)}};try{if(Gi()||[qt.DESKTOP_SAFARI,qt.MOBILE_SAFARI].includes(wr()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(t).then((function(l){try{return s=l,i()}catch{return a()}}),a)}catch{a()}}))}function Xi(t,e,n,r,s=1){return new Promise((function(o,i){let a;if(e==="image/png"){let c,d,u;return c=t.getContext("2d"),{data:d}=c.getImageData(0,0,t.width,t.height),u=En.encode([d.buffer],t.width,t.height,4096*s),a=new Blob([u],{type:e}),a.name=n,a.lastModified=r,l.call(this)}{let c=function(){return l.call(this)};if(e==="image/bmp")return new Promise((d=>cp.toBlob(t,d))).then(function(d){try{return a=d,a.name=n,a.lastModified=r,c.call(this)}catch(u){return i(u)}}.bind(this),i);{let d=function(){return c.call(this)};if(typeof OffscreenCanvas=="function"&&t instanceof OffscreenCanvas)return t.convertToBlob({type:e,quality:s}).then(function(u){try{return a=u,a.name=n,a.lastModified=r,d.call(this)}catch(f){return i(f)}}.bind(this),i);{let u;return u=t.toDataURL(e,s),Oc(u,n,r).then(function(f){try{return a=f,d.call(this)}catch(g){return i(g)}}.bind(this),i)}}}function l(){return o(a)}}))}function Ln(t){t.width=0,t.height=0}function is(){return new Promise((function(t,e){let n,r,s,o;return is.cachedResult!==void 0?t(is.cachedResult):Oc("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(i){try{return n=i,Yi(n).then((function(a){try{return r=a[1],Xi(r,n.type,n.name,n.lastModified).then((function(l){try{return s=l,Ln(r),Yi(s).then((function(c){try{return o=c[0],is.cachedResult=o.width===1&&o.height===2,t(is.cachedResult)}catch(d){return e(d)}}),e)}catch(c){return e(c)}}),e)}catch(l){return e(l)}}),e)}catch(a){return e(a)}}),e)}))}function mp(t){return new Promise(((e,n)=>{const r=new up;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return e(-2);const i=o.byteLength;let a=2;for(;a<i;){if(o.getUint16(a+2,!1)<=8)return e(-1);const l=o.getUint16(a,!1);if(a+=2,l==65505){if(o.getUint32(a+=2,!1)!=1165519206)return e(-1);const c=o.getUint16(a+=6,!1)==18761;a+=o.getUint32(a+4,c);const d=o.getUint16(a,c);a+=2;for(let u=0;u<d;u++)if(o.getUint16(a+12*u,c)==274)return e(o.getUint16(a+12*u+8,c))}else{if((65280&l)!=65280)break;a+=o.getUint16(a,!1)}}return e(-1)},r.onerror=s=>n(s),r.readAsArrayBuffer(t)}))}function bp(t,e){const{width:n}=t,{height:r}=t,{maxWidthOrHeight:s}=e;let o,i=t;return isFinite(s)&&(n>s||r>s)&&([i,o]=Wi(n,r),n>r?(i.width=s,i.height=r/n*s):(i.width=n/r*s,i.height=s),o.drawImage(t,0,0,i.width,i.height),Ln(t)),i}function yp(t,e){const{width:n}=t,{height:r}=t,[s,o]=Wi(n,r);switch(e>4&&e<9?(s.width=r,s.height=n):(s.width=n,s.height=r),e){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(t,0,0,n,r),Ln(t),s}function vp(t,e,n=0){return new Promise((function(r,s){let o,i,a,l,c,d,u,f,g,m,p,y,b,S,x,E,k,C,N,_;function w(O=5){if(e.signal&&e.signal.aborted)throw e.signal.reason;o+=O,e.onProgress(Math.min(o,100))}function M(O){if(e.signal&&e.signal.aborted)throw e.signal.reason;o=Math.min(Math.max(O,o),100),e.onProgress(o)}return o=n,i=e.maxIteration||10,a=1024*e.maxSizeMB*1024,w(),Yi(t,e).then(function(O){try{return[,l]=O,w(),c=bp(l,e),w(),new Promise((function(L,$){var F;if(!(F=e.exifOrientation))return mp(t).then(function(A){try{return F=A,D.call(this)}catch(T){return $(T)}}.bind(this),$);function D(){return L(F)}return D.call(this)})).then(function(L){try{return d=L,w(),is().then(function($){try{return u=$?c:yp(c,d),w(),f=e.initialQuality||1,g=e.fileType||t.type,Xi(u,g,t.name,t.lastModified,f).then(function(F){try{{let A=function(){if(i--&&(x>a||x>b)){let V,H;return V=_?.95*N.width:N.width,H=_?.95*N.height:N.height,[k,C]=Wi(V,H),C.drawImage(N,0,0,V,H),f*=g==="image/png"?.85:.95,Xi(k,g,t.name,t.lastModified,f).then((function(W){try{return E=W,Ln(N),N=k,x=E.size,M(Math.min(99,Math.floor((S-x)/(S-a)*100))),A}catch(j){return s(j)}}),s)}return[1]},T=function(){return Ln(N),Ln(k),Ln(c),Ln(u),Ln(l),M(100),r(E)};if(m=F,w(),p=m.size>a,y=m.size>t.size,!p&&!y)return M(100),r(m);var D;return b=t.size,S=m.size,x=S,N=u,_=!e.alwaysKeepResolution&&p,(D=function(V){for(;V;){if(V.then)return void V.then(D,s);try{if(V.pop){if(V.length)return V.pop()?T.call(this):V;V=A}else V=V.call(this)}catch(H){return s(H)}}}.bind(this))(A)}}catch(A){return s(A)}}.bind(this),s)}catch(F){return s(F)}}.bind(this),s)}catch($){return s($)}}.bind(this),s)}catch(L){return s(L)}}.bind(this),s)}))}const Z2=`
|
||
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 Tc;function Q2(t,e){return new Promise(((n,r)=>{Tc||(Tc=(function(i){const a=[];return a.push(i),URL.createObjectURL(new Blob(a))})(Z2));const s=new Worker(Tc);s.addEventListener("message",(function(i){if(e.signal&&e.signal.aborted)s.terminate();else if(i.data.progress===void 0){if(i.data.error)return r(new Error(i.data.error)),void s.terminate();n(i.data.file),s.terminate()}else e.onProgress(i.data.progress)})),s.addEventListener("error",r),e.signal&&e.signal.addEventListener("abort",(()=>{r(e.signal.reason),s.terminate()})),s.postMessage({file:t,imageCompressionLibUrl:e.libURL,options:{...e,onProgress:void 0,signal:void 0}})}))}function zt(t,e){return new Promise((function(n,r){let s,o,i,a,l,c;if(s={...e},i=0,{onProgress:a}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,l=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=g=>{i=g,typeof a=="function"&&a(i)},!(t instanceof Blob||t instanceof q2))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(t.type))return r(new Error("The file given is not an image"));if(c=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!l||typeof Worker!="function"||c)return vp(t,s).then(function(g){try{return o=g,f.call(this)}catch(m){return r(m)}}.bind(this),r);var d=function(){try{return f.call(this)}catch(g){return r(g)}}.bind(this),u=function(g){try{return vp(t,s).then((function(m){try{return o=m,d()}catch(p){return r(p)}}),r)}catch(m){return r(m)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Q2(t,s).then((function(g){try{return o=g,d()}catch{return u()}}),u)}catch{u()}function f(){try{o.name=t.name,o.lastModified=t.lastModified}catch{}try{s.preserveExif&&t.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===t.type)&&(o=lp(t,o))}catch{}return n(o)}}))}zt.getDataUrlFromFile=fp,zt.getFilefromDataUrl=Oc,zt.loadImage=hp,zt.drawImageInCanvas=pp,zt.drawFileInCanvas=Yi,zt.canvasToFile=Xi,zt.getExifOrientation=mp,zt.handleMaxWidthOrHeight=bp,zt.followExifOrientation=yp,zt.cleanupCanvasMemory=Ln,zt.isAutoOrientationInBrowser=is,zt.approximateBelowMaximumCanvasSizeOfBrowser=gp,zt.copyExifWithoutOrientation=lp,zt.getBrowserName=wr,zt.version="2.0.2";const J2=window.G7Core,Ac=t=>{const e=["B","KB","MB","GB"];let n=0,r=t;for(;r>=1024&&n<e.length-1;)r/=1024,n++;return`${r.toFixed(2)} ${e[n]}`},R2=t=>{if(t&&typeof t=="object"){const e=t;if(e.response?.data?.message)return e.response.data.message;if(e.response?.data?.errors){const n=Object.values(e.response.data.errors)[0];if(Array.isArray(n)&&n[0])return n[0]}if(e.message)return e.message}return t instanceof Error?t.message:"업로드 실패"},eE=t=>t?t.startsWith("image/")?"fa-file-image":t.startsWith("video/")?"fa-file-video":t.startsWith("audio/")?"fa-file-audio":t==="application/pdf"?"fa-file-pdf":t.includes("word")||t.includes("document")?"fa-file-word":t.includes("excel")||t.includes("spreadsheet")?"fa-file-excel":t.includes("zip")||t.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",At=(t,e)=>J2?.t?.(t,e)??t,xp=window.G7Core?.createLogger?.("Comp:FileUploader")??{log:(...t)=>console.log("[Comp:FileUploader]",...t),warn:(...t)=>console.warn("[Comp:FileUploader]",...t),error:(...t)=>console.error("[Comp:FileUploader]",...t)},kr=window.G7Core;function tE(t){const{attachmentableType:e,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:u,endpoints:f,onFilesChange:g,onUploadComplete:m,onUploadError:p,onRemove:y,onReorder:b,uploadTriggerEvent:S,confirmBeforeRemove:x,uploadParams:E}=t,[k,C]=v.useState(u),[N,_]=v.useState([]),[w,M]=v.useState(!1),O=v.useRef(null),L=v.useRef(0),$=v.useRef(new Set),F=v.useRef(new Map),D=v.useRef(null),[A,T]=v.useState(!1),[V,H]=v.useState(null),[W,j]=v.useState(!1),U=v.useRef(!1),[B,G]=v.useState([]),[z,K]=v.useState(!1),[X,Z]=v.useState(0),ee=v.useRef(0),[ne,he]=v.useState(new Map),J=v.useRef(new Map),ce=v.useRef(g);ce.current=g,v.useEffect(()=>{ce.current?.(N)},[N]),v.useEffect(()=>{if(U.current)return;const te=u.filter(me=>!$.current.has(me.id)&&(!me.hash||!$.current.has(me.hash))),ge=new Set(te.map(me=>me.id)),pe=Array.from(F.current.values()).filter(me=>!ge.has(me.id)&&!$.current.has(me.id));C([...te,...pe])},[u]);const ue=v.useCallback(async te=>{const ge={maxSizeMB:l?.maxSizeMB??1,maxWidthOrHeight:l?.maxWidthOrHeight??1920,useWebWorker:!0};return await zt(te,ge)},[l]),ie=v.useCallback(async te=>{const ge=k.length+N.length,pe=Math.max(0,s-ge),me=Array.from(te).slice(0,pe);if(te.length>pe){const be=Array.from(te).slice(pe),Ue=At("attachment.upload_limit_exceeded",{max:s});p?.(Ue,be[0]??te[0])}for(const be of me){if(be.size>o*1024*1024){p?.(`[${be.name}] 파일 크기(${Ac(be.size)})가 최대 허용 크기(${o}MB)를 초과합니다.`,be);continue}if(a){const Me="."+be.name.split(".").pop()?.toLowerCase();if(!a.split(",").map(_e=>_e.trim().toLowerCase()).includes(Me)){p?.(`[${be.name}] 허용되지 않는 파일 형식입니다. (허용: ${a})`,be);continue}}const Ue={id:`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:be,original_filename:be.name,mime_type:be.type,size:be.size,size_formatted:Ac(be.size),status:"pending",progress:0};if(be.type.startsWith("image/")&&(Ue.preview=URL.createObjectURL(be)),_(Me=>[...Me,Ue]),be.type.startsWith("image/")&&l){_(Me=>Me.map(Fe=>Fe.id===Ue.id?{...Fe,status:"compressing"}:Fe));try{const Me=await ue(be);_(Fe=>Fe.map(_e=>_e.id===Ue.id?{..._e,compressedBlob:Me,size:Me.size,size_formatted:Ac(Me.size),status:"pending",progress:0}:_e))}catch{_(Me=>Me.map(Fe=>Fe.id===Ue.id?{...Fe,status:"error",error:"이미지 압축 실패"}:Fe))}}}},[k.length,N.length,s,o,a,l,ue,p]),ve=v.useCallback(async te=>{const ge=new FormData,pe=te.compressedBlob?new File([te.compressedBlob],te.original_filename,{type:te.mime_type}):te.file;ge.append("file",pe),e&&ge.append("attachmentable_type",e),n&&ge.append("attachmentable_id",String(n)),ge.append("collection",r),c.forEach(me=>{ge.append("role_ids[]",String(me))}),E&&Object.entries(E).forEach(([me,be])=>{ge.append(me,be)});try{const me=await kr.api.post(f.upload,ge,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:Ue=>{const Me=Math.round(Ue.loaded*100/(Ue.total??1));_(Fe=>Fe.map(_e=>_e.id===te.id?{..._e,progress:Me}:_e))}});return me?.data?.data??me?.data}catch(me){const be=R2(me);throw new Error(be)}},[e,n,r,c,f.upload]),fe=v.useCallback(async()=>{const te=N.filter(Me=>Me.status==="pending"||Me.status==="error");if(te.length===0)return D.current=k,[];const ge=[],pe=new Map,me=[...te],be=async()=>{for(;me.length>0&&L.current<i;){const Me=me.shift();L.current++,_(Fe=>Fe.map(_e=>_e.id===Me.id?{..._e,status:"uploading",progress:0}:_e));try{const Fe=await ve(Me);if(Fe)ge.push(Fe),pe.set(String(Me.id),String(Fe.hash)),F.current.set(Fe.id,Fe),_(_e=>_e.filter(ot=>ot.id!==Me.id)),C(_e=>[..._e,Fe]),G(_e=>{if(_e.length===0)return _e;const ot=String(Me.id);return _e.some(we=>String(we)===ot)?_e.map(we=>String(we)===ot?String(Fe.hash):we):_e}),Me.preview&&URL.revokeObjectURL(Me.preview);else{const _e=At("attachment.upload_response_invalid");_(ot=>ot.map(it=>it.id===Me.id?{...it,status:"error",error:_e}:it)),p?.(`[${Me.original_filename}] ${_e}`,Me.file)}}catch(Fe){const _e=Fe instanceof Error?Fe.message:"업로드 실패";_(ot=>ot.map(it=>it.id===Me.id?{...it,status:"error",error:_e}:it)),p?.(`[${Me.original_filename}] ${_e}`,Me.file)}finally{L.current--}}},Ue=Array(Math.min(i,te.length)).fill(null).map(()=>be());if(await Promise.all(Ue),ge.length>0){m?.(ge);const Me=[...k,...ge];if(B.length>0){const Fe=B.map(it=>pe.get(String(it))??it),_e=new Map(Fe.map((it,we)=>[String(it),we])),ot=[...Me].sort((it,we)=>{const Ee=_e.get(String(it.hash))??Me.length,ze=_e.get(String(we.hash))??Me.length;return Ee-ze}).map((it,we)=>({...it,sort_order:we,order:we+1}));D.current=ot,f.reorder&&b&&b(ot)}else D.current=Me.map((Fe,_e)=>({...Fe,sort_order:_e,order:_e+1}))}else D.current=k;return ge},[N,i,ve,m,p,B,k,b,f.reorder]);v.useEffect(()=>{if(!S)return;const te=kr.componentEvent.on(S,async()=>{const ge=await fe(),pe=D.current??[...k,...ge];return{uploadedAttachments:ge,existingFiles:k,allFiles:pe}});return()=>{te()}},[S,fe,k]),v.useEffect(()=>{d&&N.some(te=>te.status==="pending")&&fe()},[d,N,fe]);const ye=v.useCallback(async te=>{j(!0);try{if(te.id&&f.delete){const pe=f.delete.replace(":id",String(te.id));await kr.api.delete(pe)}const ge=te.hash||te.id;te.id&&($.current.add(te.id),F.current.delete(te.id)),te.hash&&$.current.add(te.hash),C(pe=>pe.filter(me=>(me.hash||me.id)!==ge)),y?.(te.hash||te.id),T(!1),H(null)}catch{xp.error("첨부파일 삭제 실패")}finally{j(!1)}},[y,f.delete]),Se=v.useCallback(async te=>{"hash"in te?x?(H(te),T(!0)):await ye(te):(te.preview&&URL.revokeObjectURL(te.preview),_(ge=>ge.filter(pe=>pe.id!==te.id)))},[x,ye]),He=v.useCallback(te=>{_(ge=>ge.map(pe=>pe.id===te.id?{...pe,status:"pending",error:void 0}:pe))},[]),se=v.useCallback(async te=>{const{arrayMove:ge}=await Promise.resolve().then(()=>_S),{active:pe,over:me}=te;if(!me||pe.id===me.id)return;const be=[...k,...N];let Ue;if(B.length===0)Ue=be;else{const Ee=new Map(B.map((ze,qe)=>[String(ze),qe]));Ue=[...be].sort((ze,qe)=>{const Re="hash"in ze?String(ze.hash):String(ze.id),nt="hash"in qe?String(qe.hash):String(qe.id);return(Ee.get(Re)??be.length)-(Ee.get(nt)??be.length)})}const Me=Ue.findIndex(Ee=>"hash"in Ee?Ee.hash===pe.id:Ee.id===pe.id),Fe=Ue.findIndex(Ee=>"hash"in Ee?Ee.hash===me.id:Ee.id===me.id),_e=ge(Ue,Me,Fe);G(_e.map(Ee=>"hash"in Ee?Ee.hash:Ee.id));const ot=_e.filter(Ee=>"hash"in Ee),it=_e.filter(Ee=>!("hash"in Ee));U.current=!0,C(ot),_(it);const we=ot.map((Ee,ze)=>({...Ee,sort_order:ze,order:ze+1}));if(ot.length>0&&f.reorder){const Ee=ot.map((ze,qe)=>({id:ze.id,order:qe+1}));try{const ze=await kr.api.patch(f.reorder,{order:Ee});kr.toast.success(ze.message)}catch(ze){const qe=ze instanceof Error?ze.message:At("attachment.reorder_failed");kr.toast.error(qe)}}b?.(we)},[k,N,B,f.reorder,b]),Ae=v.useMemo(()=>[...k,...N].filter(te=>"is_image"in te?te.is_image:te.mime_type?.startsWith("image/")??!1),[k,N]),Le=v.useCallback(te=>{const ge=Ae.findIndex(pe=>"hash"in te&&"hash"in pe?pe.hash===te.hash:"id"in te&&"id"in pe&&!("hash"in te)&&!("hash"in pe)?pe.id===te.id:!1);ge!==-1&&(ee.current+=1,Z(ge),K(!0))},[Ae]);v.useEffect(()=>{let te=!1;return(async()=>{const pe=k.filter(be=>be.is_image),me=new Set(pe.map(be=>be.id));for(const[be,Ue]of J.current)me.has(be)||(URL.revokeObjectURL(Ue),J.current.delete(be));for(const be of pe){if(te)break;if(!J.current.has(be.id))try{const Ue=await kr.api.get(be.download_url,{responseType:"blob"});if(!te&&Ue){const Me=URL.createObjectURL(Ue);J.current.set(be.id,Me),he(new Map(J.current))}}catch(Ue){xp.error("Failed to load authenticated image:",Ue)}}})(),()=>{te=!0}},[k]),v.useEffect(()=>()=>{J.current.forEach(te=>URL.revokeObjectURL(te)),J.current.clear()},[]);const Ie=v.useCallback(async te=>{const{executeImageDownload:ge}=await Promise.resolve().then(()=>U2);await ge({src:te.download_url,downloadUrl:te.download_url,filename:te.original_filename,downloadRequiresAuth:!0})},[]),Be=v.useMemo(()=>{const te=[...k,...N];if(B.length===0)return te;const ge=new Map(B.map((pe,me)=>[String(pe),me]));return[...te].sort((pe,me)=>{const be="hash"in pe?String(pe.hash):String(pe.id),Ue="hash"in me?String(me.hash):String(me.id),Me=ge.get(be)??te.length,Fe=ge.get(Ue)??te.length;return Me-Fe})},[k,N,B]),st=Be.length,ft=st>0,je=st<s,Je=v.useCallback(()=>_([]),[]),Xe=v.useCallback(()=>N,[N]);return{existingFiles:k,pendingFiles:N,isDragOver:w,setIsDragOver:M,isDeleting:W,totalCount:st,hasFiles:ft,canAddMore:je,allItems:Be,imageFiles:Ae,handleFiles:ie,handleRemove:Se,handleRetry:He,handleUploadAll:fe,handleOpenGallery:Le,handleDownload:Ie,handleDragEnd:se,inputRef:O,galleryOpen:z,setGalleryOpen:K,galleryStartIndex:X,galleryKeyRef:ee,confirmDialogOpen:A,setConfirmDialogOpen:T,itemToDelete:V,executeRemoveAttachment:ye,authenticatedImageUrls:ne,clear:Je,getPendingFiles:Xe}}const nE=({isDragOver:t,canAddMore:e,onFiles:n,setIsDragOver:r,inputRef:s,accept:o,maxFiles:i,maxSize:a,disabled:l,children:c})=>{const d=e&&!l;return h.jsxs(I,{className:`
|
||
relative border-2 border-dashed rounded-lg transition-colors
|
||
${l?"opacity-60 cursor-not-allowed":""}
|
||
${t&&!l?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"}
|
||
`,onDragOver:u=>{u.preventDefault(),d&&r(!0)},onDragLeave:()=>r(!1),onDrop:u=>{u.preventDefault(),r(!1),d&&n(u.dataTransfer.files)},children:[h.jsx("input",{ref:s,type:"file",multiple:!0,accept:o,onChange:u=>u.target.files&&!l&&n(u.target.files),className:"hidden",disabled:l}),!c&&h.jsxs(I,{className:`p-8 text-center transition-colors ${l?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,onClick:()=>!l&&s.current?.click(),children:[h.jsx(pt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),h.jsx(bt,{className:"text-sm text-gray-600 dark:text-gray-400",children:At("attachment.drop_or_click")}),h.jsxs(bt,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[At("attachment.upload_limit",{maxFiles:i,maxSize:a}),o&&` (${o})`]})]}),c]})},rE=window.G7Core,sE=window.G7Core?.createLogger?.("Comp:SortableThumbnail")??{log:(...t)=>console.log("[Comp:SortableThumbnail]",...t),warn:(...t)=>console.warn("[Comp:SortableThumbnail]",...t),error:(...t)=>console.error("[Comp:SortableThumbnail]",...t)},oE=({file:t,onRemove:e,onRetry:n,onImageClick:r,onDownload:s,isPrimary:o,onPrimaryClick:i,disabled:a})=>{const{attributes:l,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:g}=Ai({id:"hash"in t?t.hash:t.id}),m={transform:In.Transform.toString(u),transition:f,opacity:g?.5:1},p="status"in t&&t.status!==void 0,y=p?t.status:"done",b=y==="uploading",S=y==="compressing",x=y==="error",E=p?t.progress:100,k=p?t.preview:void 0,C=p?t.mime_type?.startsWith("image/")??!1:t.is_image,[N,_]=v.useState(void 0),w=!p&&C?t.download_url:void 0;v.useEffect(()=>{if(!w){_(void 0);return}let O=!0,L;return(async()=>{try{const F=await rE.api.get(w,{responseType:"blob"});O&&F&&(L=URL.createObjectURL(F),_(L))}catch(F){sE.error("Failed to load authenticated image:",F)}})(),()=>{O=!1,L&&URL.revokeObjectURL(L)}},[w]);const M=N;return h.jsxs(I,{ref:d,style:m,className:"relative group bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[h.jsxs(I,{className:`aspect-square w-full flex items-center justify-center bg-gray-50 dark:bg-gray-900 relative ${C||!p?"cursor-pointer":""}`,onClick:()=>{b||S||(C&&r?r():!p&&s&&s())},children:[k||M?h.jsx(yn,{src:k||M,alt:t.original_filename,className:"w-full h-full object-cover"}):h.jsx(pt,{className:`fa-solid ${eE(t.mime_type)} text-4xl text-gray-400 dark:text-gray-500`}),(b||S)&&h.jsxs(I,{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center",children:[h.jsx(I,{className:"w-3/4 h-2 bg-gray-700 rounded-full overflow-hidden",children:h.jsx(I,{className:"h-full bg-blue-500 transition-all",style:{width:`${E}%`}})}),h.jsxs(Q,{className:"text-white text-xs mt-1",children:[E,"%"]})]}),x&&h.jsx(I,{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:h.jsx(pt,{className:"fa-solid fa-exclamation-triangle text-2xl text-white"})}),i&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),i()},className:`absolute top-1.5 left-1.5 z-10 p-1 rounded-full transition-colors ${o?"bg-yellow-500 text-white":"bg-gray-800/50 text-gray-300 hover:bg-yellow-500 hover:text-white opacity-0 group-hover:opacity-100"}`,title:At(o?"attachment.primary_image":"attachment.set_as_primary"),children:h.jsx(pt,{className:"fa-solid fa-star text-xs"})}),h.jsxs(I,{className:`absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-start justify-end p-1 gap-1 opacity-0 group-hover:opacity-100 ${a?"hidden":""}`,children:[h.jsx(oe,{type:"button",...l,...c,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-gray-600 dark:text-gray-300 hover:bg-white cursor-grab active:cursor-grabbing",title:At("attachment.drag_to_reorder"),onClick:O=>O.stopPropagation(),children:h.jsx(pt,{className:"fa-solid fa-grip-vertical text-sm"})}),!p&&s&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),s()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-blue-500 hover:bg-white",title:At("common.download"),children:h.jsx(pt,{className:"fa-solid fa-download text-sm"})}),x&&n&&h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),n()},className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-orange-500 hover:bg-white",title:At("common.retry"),children:h.jsx(pt,{className:"fa-solid fa-arrow-rotate-right text-sm"})}),h.jsx(oe,{type:"button",onClick:O=>{O.stopPropagation(),e()},disabled:b||S,className:"p-1.5 bg-white/90 dark:bg-gray-800/90 rounded text-red-500 hover:bg-white disabled:opacity-50",title:At("common.delete"),children:h.jsx(pt,{className:"fa-solid fa-times text-sm"})})]})]}),h.jsxs(I,{className:`p-2 ${!p&&s?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,onClick:()=>{!p&&s&&s()},children:[h.jsx(bt,{className:"text-xs font-medium text-gray-900 dark:text-white truncate",title:t.original_filename,children:t.original_filename}),h.jsx(bt,{className:"text-xs text-gray-500 dark:text-gray-400",children:t.size_formatted})]})]})},iE=({allItems:t,canAddMore:e,totalCount:n,maxFiles:r,maxSize:s,accept:o,onRemove:i,onRetry:a,onImageClick:l,onDownload:c,onDragEnd:d,onAddClick:u,enablePrimarySelection:f,primaryFileId:g,onPrimaryChange:m,disabled:p})=>{const y=Hl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Di}));return h.jsxs(I,{className:"p-3",children:[h.jsx(Ql,{sensors:y,collisionDetection:Ul,onDragEnd:d,children:h.jsx(Ti,{items:t.map(b=>"hash"in b?b.hash:b.id),strategy:Ni,children:h.jsxs(I,{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[t.map(b=>{const S="hash"in b,x=S?b.is_image:b.mime_type?.startsWith("image/")??!1;return h.jsx(oE,{file:b,onRemove:()=>i(b),onRetry:"status"in b&&b.status==="error"?()=>a(b):void 0,onImageClick:x?()=>l(b):void 0,onDownload:S?()=>c(b):void 0,isPrimary:f&&S&&(b.hash||b.id)===g,onPrimaryClick:f&&S?()=>m?.(b.hash||b.id):void 0,disabled:p},S?b.hash:b.id)}),e&&!p&&h.jsxs(I,{className:"aspect-square flex flex-col items-center justify-center border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-gray-400 dark:hover:border-gray-500 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:u,children:[h.jsx(pt,{className:"fa-solid fa-plus text-2xl text-gray-400 dark:text-gray-500 mb-1"}),h.jsx(Q,{className:"text-xs text-gray-500 dark:text-gray-400",children:At("common.add")})]})]})})}),h.jsxs(I,{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700 flex justify-between items-center text-xs text-gray-500 dark:text-gray-400",children:[h.jsx(Q,{children:At("attachment.attached_count",{count:n,max:r})}),h.jsxs(Q,{children:[At("attachment.max_size",{size:s}),o&&` (${o})`]})]})]})},wp=v.forwardRef(({uploadTriggerEvent:t,attachmentableType:e,attachmentableId:n,collection:r="default",maxFiles:s=10,maxSize:o=10,maxConcurrentUploads:i=3,accept:a,imageCompression:l,roleIds:c=[],autoUpload:d=!0,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,initialFiles:y=[],disabled:b=!1,className:S="",confirmBeforeRemove:x=!1,confirmRemoveTitle:E,confirmRemoveMessage:k,apiEndpoints:C,uploadParams:N,enablePrimarySelection:_=!1,primaryFileId:w,onPrimaryChange:M,id:O,editorAttrs:L},$)=>{const F={upload:C?.upload??"/api/admin/attachments",delete:C?.delete??"/api/admin/attachments/:id",reorder:C?.reorder??"/api/admin/attachments/reorder"},D=tE({attachmentableType:e,attachmentableId:n,collection:r,maxFiles:s,maxSize:o,maxConcurrentUploads:i,accept:a,imageCompression:l,roleIds:c,autoUpload:d,initialFiles:y,endpoints:F,onFilesChange:u,onUploadComplete:f,onUploadError:g,onRemove:m,onReorder:p,uploadTriggerEvent:t,confirmBeforeRemove:x,uploadParams:N});v.useImperativeHandle($,()=>({uploadAll:D.handleUploadAll,clear:D.clear,getPendingFiles:D.getPendingFiles}));const A=v.useMemo(()=>D.imageFiles.map(V=>{const H=!("hash"in V),W=V,j=V;return H?{src:W.preview||"",filename:W.original_filename,title:W.original_filename,downloadRequiresAuth:!1}:{src:D.authenticatedImageUrls.get(j.id)||j.download_url,downloadUrl:j.download_url,filename:j.original_filename,title:j.original_filename,downloadRequiresAuth:!0}}),[D.imageFiles,D.authenticatedImageUrls]),T=v.useMemo(()=>({existingFiles:D.existingFiles,pendingFiles:D.pendingFiles,isDragOver:D.isDragOver,isDeleting:D.isDeleting,maxFiles:s,maxSize:o,accept:a,endpoints:F,confirmBeforeRemove:x,totalCount:D.totalCount,hasFiles:D.hasFiles,canAddMore:D.canAddMore,allItems:D.allItems,imageFiles:D.imageFiles,handleFiles:D.handleFiles,handleRemove:D.handleRemove,handleRetry:D.handleRetry,handleUploadAll:D.handleUploadAll,handleOpenGallery:D.handleOpenGallery,handleDownload:D.handleDownload,handleDragEnd:D.handleDragEnd,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,galleryOpen:D.galleryOpen,setGalleryOpen:D.setGalleryOpen,galleryStartIndex:D.galleryStartIndex,galleryKeyRef:D.galleryKeyRef,confirmDialogOpen:D.confirmDialogOpen,setConfirmDialogOpen:D.setConfirmDialogOpen,itemToDelete:D.itemToDelete,executeRemoveAttachment:D.executeRemoveAttachment,authenticatedImageUrls:D.authenticatedImageUrls}),[D,s,o,a,F,x]);return h.jsx(j2,{value:T,children:h.jsxs(I,{id:O,className:S,...L,children:[h.jsx(nE,{isDragOver:D.isDragOver,canAddMore:D.canAddMore,onFiles:D.handleFiles,setIsDragOver:D.setIsDragOver,inputRef:D.inputRef,accept:a,maxFiles:s,maxSize:o,disabled:b,children:D.hasFiles&&h.jsx(iE,{allItems:D.allItems,canAddMore:D.canAddMore,totalCount:D.totalCount,maxFiles:s,maxSize:o,accept:a,onRemove:D.handleRemove,onRetry:D.handleRetry,onImageClick:D.handleOpenGallery,onDownload:D.handleDownload,onDragEnd:D.handleDragEnd,onAddClick:()=>D.inputRef.current?.click(),enablePrimarySelection:_,primaryFileId:w,onPrimaryChange:M,disabled:b})}),x&&h.jsx(eu,{isOpen:D.confirmDialogOpen,onClose:()=>{D.isDeleting||D.setConfirmDialogOpen(!1)},title:E??At("attachment.delete_confirm_title"),message:k??At("attachment.delete_confirm_message"),confirmText:At("common.delete"),confirmButtonVariant:"danger",onConfirm:()=>{D.itemToDelete&&D.executeRemoveAttachment(D.itemToDelete)},isLoading:D.isDeleting,loadingText:At("attachment.deleting")}),A.length>0&&D.galleryOpen&&h.jsx(Ui,{images:A,isOpen:!0,onClose:()=>D.setGalleryOpen(!1),startIndex:D.galleryStartIndex,showDownload:!0},`gallery-${D.galleryKeyRef.current}`)]})})});wp.displayName="FileUploader";const aE=({name:t,value:e,options:n,onChange:r,disabled:s=!1,inline:o=!1,className:i="",size:a="md",label:l,error:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(()=>e??"");v.useEffect(()=>{g(e??"")},[e]);const m=S=>{const x=S.target.value;g(x),r&&!s&&r(S)},y={sm:{radio:"w-3.5 h-3.5",label:"text-xs",gap:"gap-1.5"},md:{radio:"w-4 h-4",label:"text-sm",gap:"gap-2"},lg:{radio:"w-5 h-5",label:"text-base",gap:"gap-2.5"}}[a],b=o?"flex flex-wrap items-center gap-4":"flex flex-col gap-2";return h.jsxs(I,{className:i,id:d,...u,children:[l&&h.jsx(Q,{className:`block mb-2 font-medium text-gray-700 dark:text-gray-300 ${y.label}`,children:l}),h.jsx(I,{className:b,children:n.map(S=>{const x=String(S.value)===String(f),E=s||S.disabled;return h.jsxs(en,{className:`inline-flex items-center ${y.gap} ${E?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:[h.jsx("input",{type:"radio",name:t,value:S.value,checked:x,onChange:m,disabled:E,className:`
|
||
${y.radio}
|
||
text-blue-600
|
||
bg-gray-100 dark:bg-gray-700
|
||
border-gray-300 dark:border-gray-600
|
||
focus:ring-blue-500 dark:focus:ring-blue-600
|
||
focus:ring-2
|
||
dark:ring-offset-gray-800
|
||
${E?"cursor-not-allowed":"cursor-pointer"}
|
||
`}),h.jsx(Q,{className:`
|
||
${y.label}
|
||
font-medium
|
||
text-gray-900 dark:text-gray-300
|
||
`,children:S.label})]},S.value)})}),c&&h.jsx(Q,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:c})]})},as=()=>window.G7Core,Ki=(t,e)=>as()?.t?.(t,e)??t,lE=()=>as()?.locale?.supported?.()??["ko","en"],cE=()=>as()?.locale?.current?.()??"ko",kp=t=>{const e=Ki(`common.language_${t}`);return e===`common.language_${t}`?{ko:"한국어",en:"English",ja:"日本語",zh:"中文"}[t]||t.toUpperCase():e},dE=({content:t="",value:e,onChange:n,multilingual:r=!1,isHtml:s=!1,onIsHtmlChange:o,rows:i=15,placeholder:a="",label:l,showHtmlModeToggle:c=!0,contentClassName:d="",purifyConfig:u,className:f="",name:g="content",htmlFieldName:m="content_mode",readOnly:p=!1,id:y,editorAttrs:b})=>{const S=v.useMemo(()=>lE(),[]),x=v.useMemo(()=>cE(),[]),[E,k]=v.useState(x),[C,N]=v.useState(s),[_,w]=v.useState(t),[M,O]=v.useState(e??{}),[L,$]=v.useState(!1);v.useEffect(()=>{N(s)},[s]),v.useEffect(()=>{r||w(t)},[t,r]),v.useEffect(()=>{r&&e&&O(e)},[e,r]);const F=v.useCallback(j=>{const U=j.target.value;if(w(U),n){const B=as()?.createChangeEvent?.({value:U,name:g,type:"textarea"})??{target:{name:g,value:U}};n(B)}},[n,g]),D=v.useCallback((j,U)=>{const B={...M,[j]:U};if(O(B),n){const G=as()?.createChangeEvent?.({value:B,name:g,type:"multilingual"})??{target:{name:g,value:B}};n(G)}},[n,g,M]),A=v.useCallback(j=>{const U=j.target.checked;if(N(U),U||$(!1),o){const B=as()?.createChangeEvent?.({checked:U,name:m,type:"checkbox"})??{target:{name:m,checked:U}};o(B)}},[o,m]),T=v.useCallback(()=>{$(j=>!j)},[]),V=r?M[E]??"":_,H=v.useCallback(j=>!!M[j]?.trim(),[M]),W=()=>h.jsx(I,{className:"flex items-center gap-2 mb-3",children:S.map(j=>{const U=j===x,B=E===j;return h.jsxs(oe,{type:"button",className:`
|
||
inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-all
|
||
${B?U?"bg-blue-500 text-white dark:bg-blue-600 dark:text-white shadow-md scale-105":"bg-gray-500 text-white dark:bg-gray-600 dark:text-white shadow-md scale-105":U?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}
|
||
`,onClick:()=>k(j),children:[h.jsx(re,{name:"globe",className:"w-3 h-3"}),h.jsx(Q,{children:kp(j)}),U&&h.jsx(Q,{className:"text-red-500",children:"*"}),H(j)&&!B&&h.jsx(re,{name:"check",className:"w-3 h-3 text-green-500 dark:text-green-400"})]},j)})});return h.jsxs(I,{className:`space-y-2 ${f}`,id:y,...b,children:[h.jsxs(I,{className:"flex items-center justify-between",children:[l&&h.jsx(en,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:l}),h.jsxs(I,{className:"flex items-center gap-3",children:[C&&!p&&h.jsx(oe,{type:"button",onClick:T,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${L?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:Ki(L?"common.preview_off":"common.preview")}),c&&h.jsxs(en,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[h.jsx(wt,{type:"checkbox",name:m,checked:C,onChange:A,disabled:p,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),h.jsx(I,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Ki("common.html_mode")})]})]})]}),r&&W(),!L&&(r?S.map(j=>h.jsx(I,{className:E===j?"block":"hidden",children:h.jsx(qn,{name:`${g}[${j}]`,value:M[j]??"",onChange:U=>D(j,U.target.value),placeholder:`${a} (${kp(j)})`,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${C?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})},j)):h.jsx(qn,{name:g,value:_,onChange:F,placeholder:a,rows:i,readOnly:p,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${C?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`})),L&&h.jsx(I,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:h.jsx(Xa,{content:V,isHtml:!0,className:d||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:u})})]})},Cp="g7_dismissed_warnings";function Sp(){try{const t=sessionStorage.getItem(Cp);return t?JSON.parse(t):[]}catch{return[]}}function uE(t){try{const e=Sp();e.includes(t)||(e.push(t),sessionStorage.setItem(Cp,JSON.stringify(e)))}catch{}}function fE(t){switch(t){case"error":return"error";case"warning":return"warning";case"info":default:return"info"}}const hE=({warnings:t,className:e=""})=>{const[n,r]=v.useState([]);v.useEffect(()=>{r(Sp())},[]);const s=v.useCallback(i=>{uE(i),r(a=>[...a,i])},[]);if(!t||t.length===0)return null;const o=t.filter(i=>!n.includes(i.id));return o.length===0?null:h.jsx(I,{className:`space-y-2 ${e}`.trim(),children:o.map(i=>h.jsx(iu,{type:fE(i.level),message:i.message,dismissible:!0,onDismiss:()=>s(i.id)},i.id))})},_p=window.G7Core?.createLogger?.("Comp:FilterVisibility")??{log:(...t)=>console.log("[Comp:FilterVisibility]",...t),warn:(...t)=>console.warn("[Comp:FilterVisibility]",...t),error:(...t)=>console.error("[Comp:FilterVisibility]",...t)},gE=({id:t,visibleFilters:e,defaultFilters:n=[],onFilterVisibilityChange:r})=>{const[s,o]=v.useState(!1),i=v.useRef(!0),a=v.useMemo(()=>{try{const f=window.G7Core?.AuthManager?.getInstance();return f?f.getUser()?.uuid:void 0}catch{return}},[]),l=v.useMemo(()=>`g7_filters_${t}${a!==void 0?`_${a}`:""}`,[t,a]),c=v.useCallback(()=>{try{const f=localStorage.getItem(l);if(f){const g=JSON.parse(f);if(Array.isArray(g))return g}}catch(f){_p.warn("Failed to load from localStorage:",f)}return null},[l]),d=v.useCallback(f=>{try{localStorage.setItem(l,JSON.stringify(f))}catch(g){_p.warn("Failed to save to localStorage:",g)}},[l]),u=v.useCallback(()=>{const f=c();return f||(e&&e.length>0?e:n)},[c,e,n]);return v.useEffect(()=>{if(!s){const f=u();r&&f.length>0&&r(f),o(!0)}},[s,r,u]),v.useEffect(()=>{if(s&&e&&e.length>0){if(i.current){i.current=!1;return}d(e)}},[s,e,d]),null},pE=window.G7Core?.createLogger?.("Comp:SlotContainer")??{log:(...t)=>console.log("[Comp:SlotContainer]",...t),warn:(...t)=>console.warn("[Comp:SlotContainer]",...t),error:(...t)=>console.error("[Comp:SlotContainer]",...t)};function mE(t,e){return e&&t&&typeof t.id=="string"&&t.id.length>0?{...t,id:`${t.id}__${e}`}:t}const bE=({slotId:t,className:e="",emptyContent:n,style:r,id:s,children:o})=>{const[i,a]=v.useState([]),[,l]=v.useState({}),c=v.useCallback(()=>{const m=window.__slotContextValue;if(m)return m;const p=window.G7Core;return p&&p.getSlotContext?.()||null},[]),d=v.useCallback(()=>{const m=c();m&&m.isEnabled&&a(m.getSlotComponents(t))},[t,c]);v.useEffect(()=>{const m=c();return!m||!m.isEnabled?void 0:(d(),m.subscribeToSlot(t,()=>{d(),l({})}))},[t,c,d]);const u=v.useCallback(()=>{const m=window.G7Core;return m?m.getDynamicRenderer?.():null},[]);if(i.length===0)return n?h.jsx(I,{className:e,style:r,id:s,children:n}):o?h.jsx(I,{className:e,style:r,id:s,children:o}):null;const f=u(),g=window.G7Core;return!f||!g?(pE.error("G7Core or DynamicRenderer not available"),null):h.jsxs(I,{className:e,style:r,id:s,children:[i.map(m=>{const{componentDef:p,dataContext:y,parentFormContext:b,getParentComponentContext:S,translationContext:x}=m,E=mE(p,s);return h.jsx(f,{componentDef:E,dataContext:y,translationContext:x,registry:g.getComponentRegistry(),bindingEngine:g.getDataBindingEngine(),translationEngine:g.getTranslationEngine(),actionDispatcher:g.getActionDispatcher(),parentComponentContext:S?.(),parentFormContextProp:b,isRootRenderer:!1},E.id||`slot-${t}-${m.order}`)}),o]})},Ep=(t,e)=>window.G7Core?.t?.(t,e)??t,Mp=(t,e,n)=>window.G7Core?.renderComponentLayout?.(t,e,n)??null,yE=({options:t=[],value:e,onChange:n,placeholder:r,disabled:s=!1,className:o="",maxHeight:i="320px",children:a,selectedChildren:l,__componentLayoutDefs:c,id:d,editorAttrs:u})=>{const[f,g]=v.useState(!1),m=v.useRef(null),p=v.useRef(null),y=v.useMemo(()=>e==null?null:t.find(C=>String(C.value)===String(e))||null,[t,e]);v.useEffect(()=>{const C=N=>{m.current&&!m.current.contains(N.target)&&g(!1)};return f&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[f]),v.useEffect(()=>{const C=N=>{N.key==="Escape"&&f&&(g(!1),p.current?.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[f]);const b=v.useCallback(()=>{s||g(C=>!C)},[s]),S=v.useCallback(C=>{n&&n({target:{value:C},preventDefault:()=>{},stopPropagation:()=>{},type:"change"}),g(!1),p.current?.focus()},[n]),x=r??Ep("common.select"),E=()=>{if(!y)return h.jsx(Q,{className:"text-gray-400 dark:text-gray-500",children:x});if(c?.selected){const C=Mp(c.selected,{item:y,isSelected:!0},"selected");if(C)return C}return l||h.jsx(Q,{className:"truncate",children:y.label})},k=(C,N)=>h.jsxs(I,{className:"flex items-center justify-between w-full",children:[h.jsx(Q,{className:N?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-900 dark:text-white",children:C.label}),N&&h.jsx(Hn,{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]});return h.jsxs(I,{ref:m,className:`relative ${o}`,id:d,...u,children:[h.jsxs(oe,{ref:p,type:"button",onClick:b,disabled:s,className:`
|
||
w-full px-4 py-2.5
|
||
bg-gray-100 dark:bg-gray-700
|
||
border-0 rounded-xl
|
||
text-sm text-gray-700 dark:text-gray-200 font-medium
|
||
focus:ring-2 focus:ring-blue-500 focus:outline-none
|
||
flex items-center justify-between gap-2
|
||
text-left cursor-pointer
|
||
disabled:opacity-50 disabled:cursor-not-allowed
|
||
`,"aria-haspopup":"listbox","aria-expanded":f,children:[h.jsx(I,{className:"flex-1 min-w-0",children:E()}),h.jsx(Hn,{className:`w-4 h-4 flex-shrink-0 transition-transform duration-200 ${f?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),f&&h.jsx(I,{className:"absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden",role:"listbox",children:h.jsx(I,{className:"overflow-auto",style:{maxHeight:i},children:t.length===0?h.jsx(I,{className:"px-4 py-6 text-center text-gray-500 dark:text-gray-400",children:Ep("common.no_options")}):t.map((C,N)=>{const _=String(C.value)===String(e);return h.jsx(oe,{type:"button",onClick:()=>!C.disabled&&S(C.value),disabled:C.disabled,className:`
|
||
w-full px-4 py-3 text-left text-sm
|
||
hover:bg-gray-100 dark:hover:bg-gray-700
|
||
transition-colors
|
||
${_?"bg-blue-50 dark:bg-blue-900/20":""}
|
||
${C.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
||
`,role:"option","aria-selected":_,"data-item-value":C.value,"data-item-index":N,"data-item-selected":_,children:c?.item?Mp(c.item,{item:C,index:N,isSelected:_},`item-${N}`):a||k(C,_)},C.value)})})})]})};function vE(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}const xE=({value:t,checked:e=!1,icon:n,label:r,variant:s="blue",customColor:o,className:i="",style:a,onChange:l,id:c,editorAttrs:d})=>{const[u,f]=v.useState(!1),g="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border cursor-pointer transition-all";if(o){const b=vE(o),S=document.documentElement.classList.contains("dark");let x;return e?x={backgroundColor:o,color:"#ffffff",borderColor:o,opacity:u?.85:1}:x=b?{backgroundColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${u?S?.25:.12:S?.15:.06})`,color:o,borderColor:`rgba(${b.r}, ${b.g}, ${b.b}, ${S?.3:.2})`}:{},h.jsxs(en,{className:`${g} ${i}`,style:{...x,...a},onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:t,checked:e,onChange:E=>{l?.(E)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})}const y=e?{green:"bg-green-600 dark:bg-green-600 text-white dark:text-white border-green-700 dark:border-green-500 hover:bg-green-700 dark:hover:bg-green-500",orange:"bg-orange-600 dark:bg-orange-600 text-white dark:text-white border-orange-700 dark:border-orange-500 hover:bg-orange-700 dark:hover:bg-orange-500",yellow:"bg-yellow-600 dark:bg-yellow-600 text-white dark:text-white border-yellow-700 dark:border-yellow-500 hover:bg-yellow-700 dark:hover:bg-yellow-500",gray:"bg-gray-600 dark:bg-gray-500 text-white dark:text-white border-gray-700 dark:border-gray-400 hover:bg-gray-700 dark:hover:bg-gray-400",blue:"bg-blue-600 dark:bg-blue-600 text-white dark:text-white border-blue-700 dark:border-blue-500 hover:bg-blue-700 dark:hover:bg-blue-500"}[s]:{green:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 hover:bg-green-100 dark:hover:bg-green-900/30",orange:"bg-orange-50 dark:bg-orange-900/20 text-orange-600 dark:text-orange-400 border-orange-200 dark:border-orange-800 hover:bg-orange-100 dark:hover:bg-orange-900/30",yellow:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/30",gray:"bg-gray-50 dark:bg-gray-700 text-gray-600 dark:text-gray-300 border-gray-200 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600",blue:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 hover:bg-blue-100 dark:hover:bg-blue-900/30"}[s];return h.jsxs(en,{className:`${g} ${y} ${i}`,style:a,id:c,...d,children:[h.jsx(wt,{type:"checkbox",value:t,checked:e,onChange:b=>{l?.(b)},className:"hidden"}),n&&h.jsx(re,{name:n,className:"w-4 h-4"}),h.jsx(I,{children:r})]})},wE=({label:t,icon:e,iconPosition:n="left",position:r="right",className:s="",style:o,children:i})=>{const[a,l]=v.useState(!1),[c,d]=v.useState({top:0,left:0}),u=v.useRef(null),f=v.useRef(null),g=v.useCallback(()=>{if(!u.current)return;const p=u.current.getBoundingClientRect(),y=224;let b=r==="right"?p.right-y:p.left;const S=p.bottom+8;b<8&&(b=8),b+y>window.innerWidth-8&&(b=window.innerWidth-y-8),d({top:S,left:b})},[r]);v.useEffect(()=>{a&&g()},[a,g]),v.useEffect(()=>{if(!a)return;const p=()=>{l(!1)};return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]),v.useEffect(()=>{const p=y=>{const b=y.target,S=u.current?.contains(b),x=f.current?.contains(b);!S&&!x&&l(!1)};return a&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[a]);const m=a?Nn.createPortal(h.jsx("div",{ref:f,className:"fixed z-[9999] w-56 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden",style:{top:c.top,left:c.left},onClick:()=>l(!1),children:i}),document.body):null;return h.jsxs(I,{className:`relative inline-block ${s}`,style:o,children:[h.jsxs(oe,{ref:u,onClick:()=>l(!a),className:"flex items-center gap-2",children:[n==="left"&&e&&h.jsx(re,{name:e,className:"w-4 h-4"}),t&&h.jsx(Q,{className:"text-sm font-medium",children:t}),n==="right"&&e&&h.jsx(re,{name:e,className:"w-4 h-4"})]}),m]})},kE=({label:t,icon:e,variant:n="default",disabled:r=!1,divider:s=!1,className:o="",style:i,onClick:a})=>{if(s)return h.jsx(I,{className:"h-px bg-gray-200 dark:bg-gray-700 my-1",style:i});const l=n==="danger"?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700",c=r?"opacity-50 cursor-not-allowed":"cursor-pointer",d=()=>{!r&&a&&a()};return h.jsxs(I,{onClick:d,className:`flex items-center gap-3 px-4 py-3 transition-colors ${l} ${c} ${o}`,style:i,children:[e&&h.jsx(re,{name:e,className:"w-4 h-4"}),t&&h.jsx(Q,{className:"text-sm font-medium",children:t})]})},CE=()=>window.G7Core,Dc=v.createContext(null),Np=()=>{const t=v.useContext(Dc);if(!t){const e=CE(),n=e?.locale?.current?.()||"ko",r=e?.locale?.supported?.()||["ko","en"];return{activeLocale:n,getActiveLocale:()=>e?.locale?.current?.()||"ko",supportedLocales:r,isInsideMultilingualTabPanel:!1}}return{...t,isInsideMultilingualTabPanel:!0}},SE=()=>window.G7Core,_E=({value:t,onChange:e,placeholder:n,readOnly:r,disabled:s,hasError:o})=>{const{activeLocale:i,getActiveLocale:a}=Np(),l=typeof t=="string"?{[i]:t}:t||{},c=v.useCallback(u=>{const f=a();e({...l,[f]:u.target.value})},[l,a,e]),d=o?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500";return h.jsx(wt,{type:"text",value:l[i]||"",onChange:c,placeholder:n,readOnly:r,disabled:s,className:`w-full px-3 py-2 text-sm border ${d} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2`})},EE=(t,e)=>{if(!e)return!1;const n=e.startsWith("!"),r=n?e.slice(1):e,s=!!t[r];return n?!s:s},ME=({column:t,item:e,index:n,onValueChange:r,readOnly:s,error:o})=>{const i=e[t.key],a=s||t.readOnly||EE(e,t.readOnlyCondition)||t.disabled,l=!!o,c=l?"border-red-500 dark:border-red-500 focus:ring-red-500 focus:border-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500 focus:border-blue-500",d=v.useCallback(f=>{r(t.key,f)},[t.key,r]),u=f=>h.jsxs(I,{className:"w-full",children:[f,l&&h.jsx(Q,{className:"text-xs text-red-500 dark:text-red-400 mt-1 block",children:o})]});switch(t.type){case"input":return u(h.jsx(wt,{type:"text",value:i||"",onChange:f=>d(f.target.value),placeholder:t.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`}));case"number":return u(h.jsx(wt,{type:"number",value:i??"",onChange:f=>d(f.target.value?Number(f.target.value):null),placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`}));case"select":return u(h.jsxs(Pr,{value:i??"",onChange:f=>d(f.target.value),disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 ${t.className||""}`,children:[h.jsx("option",{value:"",children:"선택하세요"}),t.options?.map(f=>h.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}));case"textarea":return u(h.jsx(qn,{value:i||"",onChange:f=>d(f.target.value),placeholder:t.placeholder,readOnly:a,disabled:a,className:`w-full px-3 py-2 text-sm border ${c} rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 resize-none ${t.className||""}`,rows:2}));case"multilingual":return u(h.jsx(_E,{value:i,onChange:f=>d(f),placeholder:t.placeholder,readOnly:a,disabled:a,hasError:l}));case"custom":return t.render?h.jsx(h.Fragment,{children:t.render(e,n,d)}):h.jsx(Q,{className:"text-gray-500 dark:text-gray-400",children:"-"});default:return h.jsx(Q,{className:"text-gray-900 dark:text-white text-sm",children:String(i??"")})}},NE=(t,e,n)=>{if(!t)return;if(n==="multilingual"){const o=SE()?.locale?.current?.()||"ko",i=`${e}.${o}`;return t[i]?.[0]}return t[e]?.[0]},OE=({item:t,index:e,id:n,columns:r,enableDrag:s=!0,showIndex:o=!0,canRemove:i=!0,rowActions:a,readOnly:l=!1,onValueChange:c,onRemove:d,className:u="",level:f=0,errors:g})=>{const{attributes:m,listeners:p,setNodeRef:y,transform:b,transition:S,isDragging:x}=Ai({id:n,disabled:!s||l}),E={transform:In.Transform.toString(b),transition:S,opacity:x?.5:1},k=v.useCallback((_,w)=>{c?.(_,w)},[c]),C=v.useCallback(_=>{_.onClick?.(t,e)},[t,e]),N=f>0?{paddingLeft:`${f*24}px`}:{};return h.jsxs(I,{ref:y,style:E,className:`flex items-center gap-2 py-2 px-2 border-b border-gray-100 dark:border-gray-700 last:border-b-0 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors ${x?"bg-blue-50 dark:bg-blue-900/20 shadow-lg rounded-lg z-10":""} ${u}`,children:[s&&!l&&h.jsx(I,{...m,...p,className:"flex-shrink-0 w-6 h-6 flex items-center justify-center cursor-grab active:cursor-grabbing text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400",style:N,children:h.jsx(re,{name:"grip-vertical",className:"w-4 h-4"})}),o&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-sm text-gray-500 dark:text-gray-400 font-medium",children:e+1}),r.map(_=>{const w=NE(g,_.key,_.type);return h.jsx(I,{className:`flex-1 min-w-0 ${_.width||""}`,style:_.width?{flex:"none",width:_.width}:{},children:h.jsx(ME,{column:_,item:t,index:e,onValueChange:k,readOnly:l,error:w})},_.key)}),a&&a.length>0&&!l&&h.jsx(I,{className:"flex-shrink-0 flex items-center gap-1",children:a.map(_=>{const w=typeof _.disabled=="function"?_.disabled(t,e):_.disabled;return h.jsx(oe,{type:"button",onClick:()=>C(_),disabled:w,className:`p-1.5 rounded transition-colors ${_.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600":"text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300"} disabled:opacity-50 disabled:cursor-not-allowed`,title:_.label,children:_.icon?h.jsx(re,{name:_.icon,className:"w-4 h-4"}):h.jsx(Q,{className:"text-xs",children:_.label})},_.key)})}),i&&!a&&!l&&h.jsx(I,{className:"flex-shrink-0",children:h.jsx(oe,{type:"button",onClick:d,className:"p-1.5 text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-600 dark:hover:text-gray-300 rounded transition-colors",title:"삭제",children:h.jsx(re,{name:"minus",className:"w-4 h-4"})})})]})},Op=()=>window.G7Core,Ic=()=>`item_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,TE=t=>{const e={_id:Ic()};return t.forEach(n=>{if(n.type==="multilingual"){const s=Op()?.locale?.all?.()||["ko","en"],o={};s.forEach(i=>{o[i]=""}),e[n.key]=o}else n.type==="number"?e[n.key]=null:(n.type,e[n.key]="")}),e},AE=(t,e)=>{if(!t)return{};const n=`fields.${e}.`,r={};return Object.keys(t).forEach(s=>{if(s.startsWith(n)){const o=s.substring(n.length);r[o]=t[s]}}),r},DE=({items:t=[],columns:e,onChange:n,onAddItem:r,onRemoveItem:s,onReorder:o,addLabel:i="항목 추가",enableDrag:a=!0,showIndex:l=!0,minItems:c=0,maxItems:d,rowActions:u,emptyMessage:f="항목이 없습니다.",className:g="",headerClassName:m="",rowClassName:p="",name:y,readOnly:b=!1,createDefaultItem:S,childrenKey:x,itemIdKey:E="_id",errors:k,id:C,editorAttrs:N})=>{const _=v.useRef(null),w=v.useRef([]),M=v.useRef(null),O=v.useMemo(()=>{let j=!1;for(const U of t)if(U[E]==null){j=!0;break}return j?t.map(U=>U[E]!=null?U:{...U,[E]:Ic()}):t},[t,E]);w.current=O,v.useEffect(()=>{M.current=null},[O]);const L=v.useCallback(j=>String(j[E]??""),[E]);v.useEffect(()=>{if(y){const j=Op();j?.form&&(_.current=j.form)}},[y]);const $=Hl(qr(Ys,{activationConstraint:{distance:8}}),qr(Gs,{coordinateGetter:Di})),F=v.useMemo(()=>O.map(j=>L(j)),[O,L]),D=v.useCallback(j=>{const{active:U,over:B}=j;if(B&&U.id!==B.id){const G=M.current??w.current,z=G.map(Z=>String(Z[E]??"")),K=z.indexOf(String(U.id)),X=z.indexOf(String(B.id));if(K!==-1&&X!==-1){const Z=Qr([...G],K,X);M.current=Z,n?.(Z),o?.(Z)}}},[n,o,E]),A=v.useCallback((j,U,B)=>{const z=[...M.current??w.current];z[j]={...z[j],[U]:B},M.current=z,n?.(z)},[n]),T=v.useCallback(()=>{const j=M.current??w.current;if(d&&j.length>=d)return;if(r){r();return}const U=S?S():TE(e);U[E]||(U[E]=Ic());const B=[...j,U];M.current=B,n?.(B)},[d,r,S,e,E,n]),V=v.useCallback(j=>{const U=M.current??w.current;if(U.length<=c)return;const B=U[j];if(s){s(j,B);return}const G=U.filter((z,K)=>K!==j);M.current=G,n?.(G)},[c,s,n]),H=O.length>c,W=!d||O.length<d;return h.jsxs(I,{className:`dynamic-field-list ${g}`,id:C,...N,children:[h.jsxs(I,{className:`flex items-center gap-2 py-2 px-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 rounded-t-lg ${m}`,children:[a&&!b&&h.jsx(I,{className:"flex-shrink-0 w-6"}),l&&h.jsx(I,{className:"flex-shrink-0 w-8 text-center text-xs font-medium text-gray-500 dark:text-gray-400 uppercase",children:"#"}),e.map(j=>h.jsxs(I,{className:`flex-1 min-w-0 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase ${j.width||""}`,style:j.width?{flex:"none",width:j.width}:{},children:[j.label,j.required&&h.jsx(Q,{className:"text-red-500 dark:text-red-400 ml-0.5",children:"*"})]},j.key)),(u||!b&&H)&&h.jsx(I,{className:"flex-shrink-0 w-8"})]}),O.length>0?h.jsx(Ql,{sensors:$,collisionDetection:Ul,onDragEnd:D,children:h.jsx(Ti,{items:F,strategy:Jl,children:h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700",children:O.map((j,U)=>{const B=L(j),G=AE(k,U);return h.jsx(OE,{id:B,item:j,index:U,columns:e,enableDrag:a,showIndex:l,canRemove:H,rowActions:u,readOnly:b,onValueChange:(z,K)=>A(U,z,K),onRemove:()=>V(U),className:p,errors:G},B)})})})}):h.jsx(I,{className:"border-x border-gray-200 dark:border-gray-700 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:f}),!b&&W&&h.jsx(I,{className:"relative border border-gray-200 dark:border-gray-700 border-t-0 rounded-b-lg",children:h.jsx(I,{className:"flex items-center justify-center py-2",children:h.jsxs(oe,{type:"button",onClick:T,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:[h.jsx(re,{name:"plus",className:"w-4 h-4"}),h.jsx(Q,{children:i})]})})}),(b||!W)&&O.length>0&&h.jsx(I,{className:"border-x border-b border-gray-200 dark:border-gray-700 rounded-b-lg h-1"})]})},Tp=()=>window.G7Core,IE=()=>Tp()?.locale?.supported?.()??["ko","en"],LE=()=>Tp()?.locale?.current?.()??"ko",PE={ko:"한국어",en:"English",ja:"日本語",zh:"中文"},$E=({children:t,className:e="",style:n,variant:r="default",defaultLocale:s,onLocaleChange:o,locales:i})=>{const a=v.useMemo(()=>i&&i.length>0?i:IE(),[i]),[l,c]=v.useState(s||LE());v.useEffect(()=>{if(a.length>0&&!a.includes(l)){const p=a[0];c(p),o?.(p)}},[a,l,o]);const d=v.useRef(l);d.current=l;const u=v.useCallback(()=>d.current,[]),f=v.useCallback(p=>{c(p),o?.(p)},[o]),g=v.useMemo(()=>({activeLocale:l,getActiveLocale:u,supportedLocales:a}),[l,u,a]),m=p=>{const y=p===l,b="px-4 py-2 text-sm font-medium transition-all";return r==="pills"?y?`${b} bg-blue-600 text-white rounded-lg`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg`:r==="underline"?y?`${b} text-blue-600 dark:text-blue-400 border-b-2 border-blue-600 dark:border-blue-400`:`${b} text-gray-600 dark:text-gray-400 border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-500`:y?`${b} text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 border-b-2 border-blue-600`:`${b} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 border-b-2 border-transparent`};return h.jsxs(I,{className:e,style:n,children:[h.jsx(Io,{className:"flex gap-1 border-b border-gray-200 dark:border-gray-700 mb-4",children:a.map(p=>h.jsx(oe,{type:"button",onClick:()=>f(p),className:m(p),children:h.jsx(Q,{children:PE[p]||p})},p))}),h.jsx(Dc.Provider,{value:g,children:t})]})},FE=({label:t,required:e=!1,error:n,helperText:r,className:s="",labelClassName:o="",children:i,horizontal:a=!1,labelWidth:l="w-1/3",id:c,editorAttrs:d})=>{const u=a?`flex items-start gap-4 ${s}`:`space-y-1 ${s}`,f=a?`${l} flex-shrink-0 pt-2`:"",g=a?"flex-1":"";return h.jsxs(I,{className:u,id:c,...d,children:[t&&h.jsx(I,{className:f,children:h.jsxs(en,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 ${o}`,children:[t,e&&h.jsx("span",{className:"ml-1 text-red-500 dark:text-red-400",children:"*"})]})}),h.jsxs(I,{className:`${g} ${n?"form-field-error":""}`.trim(),children:[i,r&&!n&&h.jsx(I,{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:r}),n&&h.jsx(I,{className:"mt-1 text-xs text-red-600 dark:text-red-400",children:n})]})]})};/*!
|
||
* @kurkle/color v0.3.4
|
||
* https://github.com/kurkle/color#readme
|
||
* (c) 2024 Jukka Kurkela
|
||
* Released under the MIT License
|
||
*/function io(t){return t+.5|0}const rr=(t,e,n)=>Math.max(Math.min(t,n),e);function ao(t){return rr(io(t*2.55),0,255)}function sr(t){return rr(io(t*255),0,255)}function jn(t){return rr(io(t/2.55)/100,0,1)}function Ap(t){return rr(io(t*100),0,100)}const fn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Lc=[..."0123456789ABCDEF"],VE=t=>Lc[t&15],zE=t=>Lc[(t&240)>>4]+Lc[t&15],qi=t=>(t&240)>>4===(t&15),HE=t=>qi(t.r)&&qi(t.g)&&qi(t.b)&&qi(t.a);function UE(t){var e=t.length,n;return t[0]==="#"&&(e===4||e===5?n={r:255&fn[t[1]]*17,g:255&fn[t[2]]*17,b:255&fn[t[3]]*17,a:e===5?fn[t[4]]*17:255}:(e===7||e===9)&&(n={r:fn[t[1]]<<4|fn[t[2]],g:fn[t[3]]<<4|fn[t[4]],b:fn[t[5]]<<4|fn[t[6]],a:e===9?fn[t[7]]<<4|fn[t[8]]:255})),n}const BE=(t,e)=>t<255?e(t):"";function jE(t){var e=HE(t)?VE:zE;return t?"#"+e(t.r)+e(t.g)+e(t.b)+BE(t.a,e):void 0}const WE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Dp(t,e,n){const r=e*Math.min(n,1-n),s=(o,i=(o+t/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return[s(0),s(8),s(4)]}function GE(t,e,n){const r=(s,o=(s+t/60)%6)=>n-n*e*Math.max(Math.min(o,4-o,1),0);return[r(5),r(3),r(1)]}function YE(t,e,n){const r=Dp(t,1,.5);let s;for(e+n>1&&(s=1/(e+n),e*=s,n*=s),s=0;s<3;s++)r[s]*=1-e-n,r[s]+=e;return r}function XE(t,e,n,r,s){return t===s?(e-n)/r+(e<n?6:0):e===s?(n-t)/r+2:(t-e)/r+4}function Pc(t){const n=t.r/255,r=t.g/255,s=t.b/255,o=Math.max(n,r,s),i=Math.min(n,r,s),a=(o+i)/2;let l,c,d;return o!==i&&(d=o-i,c=a>.5?d/(2-o-i):d/(o+i),l=XE(n,r,s,d,o),l=l*60+.5),[l|0,c||0,a]}function $c(t,e,n,r){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,n,r)).map(sr)}function Fc(t,e,n){return $c(Dp,t,e,n)}function KE(t,e,n){return $c(YE,t,e,n)}function qE(t,e,n){return $c(GE,t,e,n)}function Ip(t){return(t%360+360)%360}function ZE(t){const e=WE.exec(t);let n=255,r;if(!e)return;e[5]!==r&&(n=e[6]?ao(+e[5]):sr(+e[5]));const s=Ip(+e[2]),o=+e[3]/100,i=+e[4]/100;return e[1]==="hwb"?r=KE(s,o,i):e[1]==="hsv"?r=qE(s,o,i):r=Fc(s,o,i),{r:r[0],g:r[1],b:r[2],a:n}}function QE(t,e){var n=Pc(t);n[0]=Ip(n[0]+e),n=Fc(n),t.r=n[0],t.g=n[1],t.b=n[2]}function JE(t){if(!t)return;const e=Pc(t),n=e[0],r=Ap(e[1]),s=Ap(e[2]);return t.a<255?`hsla(${n}, ${r}%, ${s}%, ${jn(t.a)})`:`hsl(${n}, ${r}%, ${s}%)`}const Lp={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Pp={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function RE(){const t={},e=Object.keys(Pp),n=Object.keys(Lp);let r,s,o,i,a;for(r=0;r<e.length;r++){for(i=a=e[r],s=0;s<n.length;s++)o=n[s],a=a.replace(o,Lp[o]);o=parseInt(Pp[i],16),t[a]=[o>>16&255,o>>8&255,o&255]}return t}let Zi;function eM(t){Zi||(Zi=RE(),Zi.transparent=[0,0,0,0]);const e=Zi[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const tM=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function nM(t){const e=tM.exec(t);let n=255,r,s,o;if(e){if(e[7]!==r){const i=+e[7];n=e[8]?ao(i):rr(i*255,0,255)}return r=+e[1],s=+e[3],o=+e[5],r=255&(e[2]?ao(r):rr(r,0,255)),s=255&(e[4]?ao(s):rr(s,0,255)),o=255&(e[6]?ao(o):rr(o,0,255)),{r,g:s,b:o,a:n}}}function rM(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${jn(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}const Vc=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,ls=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function sM(t,e,n){const r=ls(jn(t.r)),s=ls(jn(t.g)),o=ls(jn(t.b));return{r:sr(Vc(r+n*(ls(jn(e.r))-r))),g:sr(Vc(s+n*(ls(jn(e.g))-s))),b:sr(Vc(o+n*(ls(jn(e.b))-o))),a:t.a+n*(e.a-t.a)}}function Qi(t,e,n){if(t){let r=Pc(t);r[e]=Math.max(0,Math.min(r[e]+r[e]*n,e===0?360:1)),r=Fc(r),t.r=r[0],t.g=r[1],t.b=r[2]}}function $p(t,e){return t&&Object.assign(e||{},t)}function Fp(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=sr(t[3]))):(e=$p(t,{r:0,g:0,b:0,a:1}),e.a=sr(e.a)),e}function oM(t){return t.charAt(0)==="r"?nM(t):ZE(t)}class lo{constructor(e){if(e instanceof lo)return e;const n=typeof e;let r;n==="object"?r=Fp(e):n==="string"&&(r=UE(e)||eM(e)||oM(e)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=$p(this._rgb);return e&&(e.a=jn(e.a)),e}set rgb(e){this._rgb=Fp(e)}rgbString(){return this._valid?rM(this._rgb):void 0}hexString(){return this._valid?jE(this._rgb):void 0}hslString(){return this._valid?JE(this._rgb):void 0}mix(e,n){if(e){const r=this.rgb,s=e.rgb;let o;const i=n===o?.5:n,a=2*i-1,l=r.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,r.r=255&c*r.r+o*s.r+.5,r.g=255&c*r.g+o*s.g+.5,r.b=255&c*r.b+o*s.b+.5,r.a=i*r.a+(1-i)*s.a,this.rgb=r}return this}interpolate(e,n){return e&&(this._rgb=sM(this._rgb,e._rgb,n)),this}clone(){return new lo(this.rgb)}alpha(e){return this._rgb.a=sr(e),this}clearer(e){const n=this._rgb;return n.a*=1-e,this}greyscale(){const e=this._rgb,n=io(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=n,this}opaquer(e){const n=this._rgb;return n.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Qi(this._rgb,2,e),this}darken(e){return Qi(this._rgb,2,-e),this}saturate(e){return Qi(this._rgb,1,e),this}desaturate(e){return Qi(this._rgb,1,-e),this}rotate(e){return QE(this._rgb,e),this}}/*!
|
||
* Chart.js v4.5.1
|
||
* https://www.chartjs.org
|
||
* (c) 2025 Chart.js Contributors
|
||
* Released under the MIT License
|
||
*/function Wn(){}const iM=(()=>{let t=0;return()=>t++})();function ct(t){return t==null}function _t(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function Ze(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function hn(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Pn(t,e){return hn(t)?t:e}function Qe(t,e){return typeof t>"u"?e:t}const aM=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,Vp=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function ht(t,e,n){if(t&&typeof t.call=="function")return t.apply(n,e)}function at(t,e,n,r){let s,o,i;if(_t(t))for(o=t.length,s=0;s<o;s++)e.call(n,t[s],s);else if(Ze(t))for(i=Object.keys(t),o=i.length,s=0;s<o;s++)e.call(n,t[i[s]],i[s])}function Ji(t,e){let n,r,s,o;if(!t||!e||t.length!==e.length)return!1;for(n=0,r=t.length;n<r;++n)if(s=t[n],o=e[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function Ri(t){if(_t(t))return t.map(Ri);if(Ze(t)){const e=Object.create(null),n=Object.keys(t),r=n.length;let s=0;for(;s<r;++s)e[n[s]]=Ri(t[n[s]]);return e}return t}function zp(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function lM(t,e,n,r){if(!zp(t))return;const s=e[t],o=n[t];Ze(s)&&Ze(o)?co(s,o,r):e[t]=Ri(o)}function co(t,e,n){const r=_t(e)?e:[e],s=r.length;if(!Ze(t))return t;n=n||{};const o=n.merger||lM;let i;for(let a=0;a<s;++a){if(i=r[a],!Ze(i))continue;const l=Object.keys(i);for(let c=0,d=l.length;c<d;++c)o(l[c],t,i,n)}return t}function uo(t,e){return co(t,e,{merger:cM})}function cM(t,e,n){if(!zp(t))return;const r=e[t],s=n[t];Ze(r)&&Ze(s)?uo(r,s):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Ri(s))}const Hp={"":t=>t,x:t=>t.x,y:t=>t.y};function dM(t){const e=t.split("."),n=[];let r="";for(const s of e)r+=s,r.endsWith("\\")?r=r.slice(0,-1)+".":(n.push(r),r="");return n}function uM(t){const e=dM(t);return n=>{for(const r of e){if(r==="")break;n=n&&n[r]}return n}}function Cr(t,e){return(Hp[e]||(Hp[e]=uM(e)))(t)}function zc(t){return t.charAt(0).toUpperCase()+t.slice(1)}const fo=t=>typeof t<"u",or=t=>typeof t=="function",Up=(t,e)=>{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0};function fM(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}const dt=Math.PI,Ct=2*dt,ea=Number.POSITIVE_INFINITY,hM=dt/180,Et=dt/2,Sr=dt/4,Bp=dt*2/3,jp=Math.log10,ir=Math.sign;function ta(t,e,n){return Math.abs(t-e)<n}function Wp(t){const e=Math.round(t);t=ta(t,e,t/1e3)?e:t;const n=Math.pow(10,Math.floor(jp(t))),r=t/n;return(r<=1?1:r<=2?2:r<=5?5:10)*n}function gM(t){const e=[],n=Math.sqrt(t);let r;for(r=1;r<n;r++)t%r===0&&(e.push(r),e.push(t/r));return n===(n|0)&&e.push(n),e.sort((s,o)=>s-o).pop(),e}function pM(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function na(t){return!pM(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function mM(t,e){const n=Math.round(t);return n-e<=t&&n+e>=t}function bM(t,e,n){let r,s,o;for(r=0,s=t.length;r<s;r++)o=t[r][n],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function Gn(t){return t*(dt/180)}function yM(t){return t*(180/dt)}function Gp(t){if(!hn(t))return;let e=1,n=0;for(;Math.round(t*e)/e!==t;)e*=10,n++;return n}function Yp(t,e){const n=e.x-t.x,r=e.y-t.y,s=Math.sqrt(n*n+r*r);let o=Math.atan2(r,n);return o<-.5*dt&&(o+=Ct),{angle:o,distance:s}}function vM(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $n(t){return(t%Ct+Ct)%Ct}function ra(t,e,n,r){const s=$n(t),o=$n(e),i=$n(n),a=$n(o-s),l=$n(i-s),c=$n(s-o),d=$n(s-i);return s===o||s===i||r&&o===i||a>l&&c<d}function Zt(t,e,n){return Math.max(e,Math.min(n,t))}function xM(t){return Zt(t,-32768,32767)}function _r(t,e,n,r=1e-6){return t>=Math.min(e,n)-r&&t<=Math.max(e,n)+r}function Hc(t,e,n){n=n||(i=>t[i]<e);let r=t.length-1,s=0,o;for(;r-s>1;)o=s+r>>1,n(o)?s=o:r=o;return{lo:s,hi:r}}const Uc=(t,e,n,r)=>Hc(t,n,r?s=>{const o=t[s][e];return o<n||o===n&&t[s+1][e]===n}:s=>t[s][e]<n),wM=(t,e,n)=>Hc(t,n,r=>t[r][e]>=n);function kM(t,e,n){let r=0,s=t.length;for(;r<s&&t[r]<e;)r++;for(;s>r&&t[s-1]>n;)s--;return r>0||s<t.length?t.slice(r,s):t}const Xp=["push","pop","shift","splice","unshift"];function CM(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),Xp.forEach(n=>{const r="_onData"+zc(n),s=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!1,value(...o){const i=s.apply(this,o);return t._chartjs.listeners.forEach(a=>{typeof a[r]=="function"&&a[r](...o)}),i}})})}function Kp(t,e){const n=t._chartjs;if(!n)return;const r=n.listeners,s=r.indexOf(e);s!==-1&&r.splice(s,1),!(r.length>0)&&(Xp.forEach(o=>{delete t[o]}),delete t._chartjs)}function qp(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const Zp=(function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame})();function Qp(t,e){let n=[],r=!1;return function(...s){n=s,r||(r=!0,Zp.call(window,()=>{r=!1,t.apply(e,n)}))}}function SM(t,e){let n;return function(...r){return e?(clearTimeout(n),n=setTimeout(t,e,r)):t.apply(this,r),e}}const Bc=t=>t==="start"?"left":t==="end"?"right":"center",Ht=(t,e,n)=>t==="start"?e:t==="end"?n:(e+n)/2,_M=(t,e,n,r)=>t===(r?"left":"right")?n:t==="center"?(e+n)/2:e,sa=t=>t===0||t===1,Jp=(t,e,n)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*Ct/n)),Rp=(t,e,n)=>Math.pow(2,-10*t)*Math.sin((t-e)*Ct/n)+1,ho={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*Et)+1,easeOutSine:t=>Math.sin(t*Et),easeInOutSine:t=>-.5*(Math.cos(dt*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>sa(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>sa(t)?t:Jp(t,.075,.3),easeOutElastic:t=>sa(t)?t:Rp(t,.075,.3),easeInOutElastic(t){return sa(t)?t:t<.5?.5*Jp(t*2,.1125,.45):.5+.5*Rp(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-ho.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?ho.easeInBounce(t*2)*.5:ho.easeOutBounce(t*2-1)*.5+.5};function e0(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function t0(t){return e0(t)?t:new lo(t)}function jc(t){return e0(t)?t:new lo(t).saturate(.5).darken(.1).hexString()}const EM=["x","y","borderWidth","radius","tension"],MM=["color","borderColor","backgroundColor"];function NM(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:MM},numbers:{type:"number",properties:EM}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function OM(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const n0=new Map;function TM(t,e){e=e||{};const n=t+JSON.stringify(e);let r=n0.get(n);return r||(r=new Intl.NumberFormat(t,e),n0.set(n,r)),r}function Wc(t,e,n){return TM(e,n).format(t)}const AM={values(t){return _t(t)?t:""+t},numeric(t,e,n){if(t===0)return"0";const r=this.chart.options.locale;let s,o=t;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=DM(t,n)}const i=jp(Math.abs(o)),a=isNaN(i)?1:Math.max(Math.min(-1*Math.floor(i),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Wc(t,r,l)}};function DM(t,e){let n=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(n)>=1&&t!==Math.floor(t)&&(n=t-Math.floor(t)),n}var r0={formatters:AM};function IM(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,n)=>n.lineWidth,tickColor:(e,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:r0.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const Er=Object.create(null),Gc=Object.create(null);function go(t,e){if(!e)return t;const n=e.split(".");for(let r=0,s=n.length;r<s;++r){const o=n[r];t=t[o]||(t[o]=Object.create(null))}return t}function Yc(t,e,n){return typeof e=="string"?co(go(t,e),n):co(go(t,""),e)}class LM{constructor(e,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=r=>r.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(r,s)=>jc(s.backgroundColor),this.hoverBorderColor=(r,s)=>jc(s.borderColor),this.hoverColor=(r,s)=>jc(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(n)}set(e,n){return Yc(this,e,n)}get(e){return go(this,e)}describe(e,n){return Yc(Gc,e,n)}override(e,n){return Yc(Er,e,n)}route(e,n,r,s){const o=go(this,e),i=go(this,r),a="_"+n;Object.defineProperties(o,{[a]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[a],c=i[s];return Ze(l)?Object.assign({},c,l):Qe(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(n=>n(this))}}var vt=new LM({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[NM,OM,IM]);function PM(t){return!t||ct(t.size)||ct(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function s0(t,e,n,r,s){let o=e[s];return o||(o=e[s]=t.measureText(s).width,n.push(s)),o>r&&(r=o),r}function Mr(t,e,n){const r=t.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((e-s)*r)/r+s}function o0(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function i0(t,e,n,r){a0(t,e,n,r,null)}function a0(t,e,n,r,s){let o,i,a,l,c,d,u,f;const g=e.pointStyle,m=e.rotation,p=e.radius;let y=(m||0)*hM;if(g&&typeof g=="object"&&(o=g.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){t.save(),t.translate(n,r),t.rotate(y),t.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),t.restore();return}if(!(isNaN(p)||p<=0)){switch(t.beginPath(),g){default:s?t.ellipse(n,r,s/2,p,0,0,Ct):t.arc(n,r,p,0,Ct),t.closePath();break;case"triangle":d=s?s/2:p,t.moveTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Bp,t.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),y+=Bp,t.lineTo(n+Math.sin(y)*d,r-Math.cos(y)*p),t.closePath();break;case"rectRounded":c=p*.516,l=p-c,i=Math.cos(y+Sr)*l,u=Math.cos(y+Sr)*(s?s/2-c:l),a=Math.sin(y+Sr)*l,f=Math.sin(y+Sr)*(s?s/2-c:l),t.arc(n-u,r-a,c,y-dt,y-Et),t.arc(n+f,r-i,c,y-Et,y),t.arc(n+u,r+a,c,y,y+Et),t.arc(n-f,r+i,c,y+Et,y+dt),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,d=s?s/2:l,t.rect(n-d,r-l,2*d,2*l);break}y+=Sr;case"rectRot":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+f,r-i),t.lineTo(n+u,r+a),t.lineTo(n-f,r+i),t.closePath();break;case"crossRot":y+=Sr;case"cross":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i);break;case"star":u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i),y+=Sr,u=Math.cos(y)*(s?s/2:p),i=Math.cos(y)*p,a=Math.sin(y)*p,f=Math.sin(y)*(s?s/2:p),t.moveTo(n-u,r-a),t.lineTo(n+u,r+a),t.moveTo(n+f,r-i),t.lineTo(n-f,r+i);break;case"line":i=s?s/2:Math.cos(y)*p,a=Math.sin(y)*p,t.moveTo(n-i,r-a),t.lineTo(n+i,r+a);break;case"dash":t.moveTo(n,r),t.lineTo(n+Math.cos(y)*(s?s/2:p),r+Math.sin(y)*p);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function l0(t,e,n){return n=n||.5,!e||t&&t.x>e.left-n&&t.x<e.right+n&&t.y>e.top-n&&t.y<e.bottom+n}function Xc(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Kc(t){t.restore()}function $M(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),ct(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function FM(t,e,n,r,s){if(s.strikethrough||s.underline){const o=t.measureText(r),i=e-o.actualBoundingBoxLeft,a=e+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=s.decorationWidth||2,t.moveTo(i,d),t.lineTo(a,d),t.stroke()}}function VM(t,e){const n=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=n}function po(t,e,n,r,s,o={}){const i=_t(e)?e:[e],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(t.save(),t.font=s.string,$M(t,o),l=0;l<i.length;++l)c=i[l],o.backdrop&&VM(t,o.backdrop),a&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),ct(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(c,n,r,o.maxWidth)),t.fillText(c,n,r,o.maxWidth),FM(t,n,r,c,o),r+=Number(s.lineHeight);t.restore()}function oa(t,e){const{x:n,y:r,w:s,h:o,radius:i}=e;t.arc(n+i.topLeft,r+i.topLeft,i.topLeft,1.5*dt,dt,!0),t.lineTo(n,r+o-i.bottomLeft),t.arc(n+i.bottomLeft,r+o-i.bottomLeft,i.bottomLeft,dt,Et,!0),t.lineTo(n+s-i.bottomRight,r+o),t.arc(n+s-i.bottomRight,r+o-i.bottomRight,i.bottomRight,Et,0,!0),t.lineTo(n+s,r+i.topRight),t.arc(n+s-i.topRight,r+i.topRight,i.topRight,0,-Et,!0),t.lineTo(n+i.topLeft,r)}const zM=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,HM=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function UM(t,e){const n=(""+t).match(zM);if(!n||n[1]==="normal")return e*1.2;switch(t=+n[2],n[3]){case"px":return t;case"%":t/=100;break}return e*t}const BM=t=>+t||0;function qc(t,e){const n={},r=Ze(e),s=r?Object.keys(e):e,o=Ze(t)?r?i=>Qe(t[i],t[e[i]]):i=>t[i]:()=>t;for(const i of s)n[i]=BM(o(i));return n}function c0(t){return qc(t,{top:"y",right:"x",bottom:"y",left:"x"})}function cs(t){return qc(t,["topLeft","topRight","bottomLeft","bottomRight"])}function gn(t){const e=c0(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ut(t,e){t=t||{},e=e||vt.font;let n=Qe(t.size,e.size);typeof n=="string"&&(n=parseInt(n,10));let r=Qe(t.style,e.style);r&&!(""+r).match(HM)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);const s={family:Qe(t.family,e.family),lineHeight:UM(Qe(t.lineHeight,e.lineHeight),n),size:n,style:r,weight:Qe(t.weight,e.weight),string:""};return s.string=PM(s),s}function ia(t,e,n,r){let s,o,i;for(s=0,o=t.length;s<o;++s)if(i=t[s],i!==void 0&&i!==void 0)return i}function jM(t,e,n){const{min:r,max:s}=t,o=Vp(e,(s-r)/2),i=(a,l)=>n&&a===0?0:a+l;return{min:i(r,-Math.abs(o)),max:i(s,o)}}function ds(t,e){return Object.assign(Object.create(t),e)}function Zc(t,e=[""],n,r,s=()=>t[0]){const o=n||t;typeof r>"u"&&(r=g0("_fallback",t));const i={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:r,_getTarget:s,override:a=>Zc([a,...t],e,o,r)};return new Proxy(i,{deleteProperty(a,l){return delete a[l],delete a._keys,delete t[0][l],!0},get(a,l){return u0(a,l,()=>QM(l,e,t,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,l){return p0(a).includes(l)},ownKeys(a){return p0(a)},set(a,l,c){const d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function us(t,e,n,r){const s={_cacheable:!1,_proxy:t,_context:e,_subProxy:n,_stack:new Set,_descriptors:d0(t,r),setContext:o=>us(t,o,n,r),override:o=>us(t.override(o),e,n,r)};return new Proxy(s,{deleteProperty(o,i){return delete o[i],delete t[i],!0},get(o,i,a){return u0(o,i,()=>GM(o,i,a))},getOwnPropertyDescriptor(o,i){return o._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(o,i){return Reflect.has(t,i)},ownKeys(){return Reflect.ownKeys(t)},set(o,i,a){return t[i]=a,delete o[i],!0}})}function d0(t,e={scriptable:!0,indexable:!0}){const{_scriptable:n=e.scriptable,_indexable:r=e.indexable,_allKeys:s=e.allKeys}=t;return{allKeys:s,scriptable:n,indexable:r,isScriptable:or(n)?n:()=>n,isIndexable:or(r)?r:()=>r}}const WM=(t,e)=>t?t+zc(e):e,Qc=(t,e)=>Ze(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function u0(t,e,n){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const r=n();return t[e]=r,r}function GM(t,e,n){const{_proxy:r,_context:s,_subProxy:o,_descriptors:i}=t;let a=r[e];return or(a)&&i.isScriptable(e)&&(a=YM(e,a,t,n)),_t(a)&&a.length&&(a=XM(e,a,t,i.isIndexable)),Qc(e,a)&&(a=us(a,s,o&&o[e],i)),a}function YM(t,e,n,r){const{_proxy:s,_context:o,_subProxy:i,_stack:a}=n;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(o,i||r);return a.delete(t),Qc(t,l)&&(l=Jc(s._scopes,s,t,l)),l}function XM(t,e,n,r){const{_proxy:s,_context:o,_subProxy:i,_descriptors:a}=n;if(typeof o.index<"u"&&r(t))return e[o.index%e.length];if(Ze(e[0])){const l=e,c=s._scopes.filter(d=>d!==l);e=[];for(const d of l){const u=Jc(c,s,t,d);e.push(us(u,o,i&&i[t],a))}}return e}function f0(t,e,n){return or(t)?t(e,n):t}const KM=(t,e)=>t===!0?e:typeof t=="string"?Cr(e,t):void 0;function qM(t,e,n,r,s){for(const o of e){const i=KM(n,o);if(i){t.add(i);const a=f0(i._fallback,n,s);if(typeof a<"u"&&a!==n&&a!==r)return a}else if(i===!1&&typeof r<"u"&&n!==r)return null}return!1}function Jc(t,e,n,r){const s=e._rootScopes,o=f0(e._fallback,n,r),i=[...t,...s],a=new Set;a.add(r);let l=h0(a,i,n,o||n,r);return l===null||typeof o<"u"&&o!==n&&(l=h0(a,i,o,l,r),l===null)?!1:Zc(Array.from(a),[""],s,o,()=>ZM(e,n,r))}function h0(t,e,n,r,s){for(;n;)n=qM(t,e,n,r,s);return n}function ZM(t,e,n){const r=t._getTarget();e in r||(r[e]={});const s=r[e];return _t(s)&&Ze(n)?n:s||{}}function QM(t,e,n,r){let s;for(const o of e)if(s=g0(WM(o,t),n),typeof s<"u")return Qc(t,s)?Jc(n,r,t,s):s}function g0(t,e){for(const n of e){if(!n)continue;const r=n[t];if(typeof r<"u")return r}}function p0(t){let e=t._keys;return e||(e=t._keys=JM(t._scopes)),e}function JM(t){const e=new Set;for(const n of t)for(const r of Object.keys(n).filter(s=>!s.startsWith("_")))e.add(r);return Array.from(e)}function Rc(){return typeof window<"u"&&typeof document<"u"}function ed(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function aa(t,e,n){let r;return typeof t=="string"?(r=parseInt(t,10),t.indexOf("%")!==-1&&(r=r/100*e.parentNode[n])):r=t,r}const la=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function RM(t,e){return la(t).getPropertyValue(e)}const eN=["top","right","bottom","left"];function Nr(t,e,n){const r={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=eN[s];r[o]=parseFloat(t[e+"-"+o+n])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}const tN=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function nN(t,e){const n=t.touches,r=n&&n.length?n[0]:t,{offsetX:s,offsetY:o}=r;let i=!1,a,l;if(tN(s,o,t.target))a=s,l=o;else{const c=e.getBoundingClientRect();a=r.clientX-c.left,l=r.clientY-c.top,i=!0}return{x:a,y:l,box:i}}function Or(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:r}=e,s=la(n),o=s.boxSizing==="border-box",i=Nr(s,"padding"),a=Nr(s,"border","width"),{x:l,y:c,box:d}=nN(t,n),u=i.left+(d&&a.left),f=i.top+(d&&a.top);let{width:g,height:m}=e;return o&&(g-=i.width+a.width,m-=i.height+a.height),{x:Math.round((l-u)/g*n.width/r),y:Math.round((c-f)/m*n.height/r)}}function rN(t,e,n){let r,s;if(e===void 0||n===void 0){const o=t&&ed(t);if(!o)e=t.clientWidth,n=t.clientHeight;else{const i=o.getBoundingClientRect(),a=la(o),l=Nr(a,"border","width"),c=Nr(a,"padding");e=i.width-c.width-l.width,n=i.height-c.height-l.height,r=aa(a.maxWidth,o,"clientWidth"),s=aa(a.maxHeight,o,"clientHeight")}}return{width:e,height:n,maxWidth:r||ea,maxHeight:s||ea}}const ar=t=>Math.round(t*10)/10;function sN(t,e,n,r){const s=la(t),o=Nr(s,"margin"),i=aa(s.maxWidth,t,"clientWidth")||ea,a=aa(s.maxHeight,t,"clientHeight")||ea,l=rN(t,e,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=Nr(s,"border","width"),g=Nr(s,"padding");c-=g.width+f.width,d-=g.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,r?c/r:d-o.height),c=ar(Math.min(c,i,l.maxWidth)),d=ar(Math.min(d,a,l.maxHeight)),c&&!d&&(d=ar(c/2)),(e!==void 0||n!==void 0)&&r&&l.height&&d>l.height&&(d=l.height,c=ar(Math.floor(d*r))),{width:c,height:d}}function m0(t,e,n){const r=e||1,s=ar(t.height*r),o=ar(t.width*r);t.height=ar(t.height),t.width=ar(t.width);const i=t.canvas;return i.style&&(n||!i.style.height&&!i.style.width)&&(i.style.height=`${t.height}px`,i.style.width=`${t.width}px`),t.currentDevicePixelRatio!==r||i.height!==s||i.width!==o?(t.currentDevicePixelRatio=r,i.height=s,i.width=o,t.ctx.setTransform(r,0,0,r,0,0),!0):!1}const oN=(function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Rc()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t})();function b0(t,e){const n=RM(t,e),r=n&&n.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}const iN=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,r){return n-r},leftForLtr(n,r){return n-r}}},aN=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function fs(t,e,n){return t?iN(e,n):aN()}function y0(t,e){let n,r;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,r=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=r)}function v0(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function ca(t,e,n){return t.options.clip?t[n]:e[n]}function lN(t,e){const{xScale:n,yScale:r}=t;return n&&r?{left:ca(n,e,"left"),right:ca(n,e,"right"),top:ca(r,e,"top"),bottom:ca(r,e,"bottom")}:e}function cN(t,e){const n=e._clip;if(n.disabled)return!1;const r=lN(e,t.chartArea);return{left:n.left===!1?0:r.left-(n.left===!0?0:n.left),right:n.right===!1?t.width:r.right+(n.right===!0?0:n.right),top:n.top===!1?0:r.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?t.height:r.bottom+(n.bottom===!0?0:n.bottom)}}/*!
|
||
* Chart.js v4.5.1
|
||
* https://www.chartjs.org
|
||
* (c) 2025 Chart.js Contributors
|
||
* Released under the MIT License
|
||
*/class dN{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,s){const o=n.listeners[s],i=n.duration;o.forEach(a=>a({chart:e,initial:n.initial,numSteps:i,currentStep:Math.min(r-n.start,i)}))}_refresh(){this._request||(this._running=!0,this._request=Zp.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const o=r.items;let i=o.length-1,a=!1,l;for(;i>=0;--i)l=o[i],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(e),a=!0):(o[i]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,r,e,"progress")),o.length||(r.running=!1,this._notify(s,r,e,"complete"),r.initial=!1),n+=o.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,s)=>Math.max(r,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var Yn=new dN;const x0="transparent",uN={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=t0(t||x0),s=r.valid&&t0(e||x0);return s&&s.valid?s.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class fN{constructor(e,n,r,s){const o=n[r];s=ia([e.to,s,o,e.from]);const i=ia([e.from,o,s]);this._active=!0,this._fn=e.fn||uN[e.type||typeof i],this._easing=ho[e.easing]||ho.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=r,this._from=i,this._to=s,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],o=r-this._start,i=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(i,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=ia([e.to,n,s,e.from]),this._from=ia([e.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,s=this._prop,o=this._from,i=this._loop,a=this._to;let l;if(this._active=o!==a&&(i||n<r),!this._active){this._target[s]=a,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/r%2,l=i&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let s=0;s<r.length;s++)r[s][n]()}}class w0{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!Ze(e))return;const n=Object.keys(vt.animation),r=this._properties;Object.getOwnPropertyNames(e).forEach(s=>{const o=e[s];if(!Ze(o))return;const i={};for(const a of n)i[a]=o[a];(_t(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!r.has(a))&&r.set(a,i)})})}_animateOptions(e,n){const r=n.options,s=gN(e,r);if(!s)return[];const o=this._createAnimations(s,r);return r.$shared&&hN(e.options.$animations,r).then(()=>{e.options=r},()=>{}),o}_createAnimations(e,n){const r=this._properties,s=[],o=e.$animations||(e.$animations={}),i=Object.keys(n),a=Date.now();let l;for(l=i.length-1;l>=0;--l){const c=i[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(e,n));continue}const d=n[c];let u=o[c];const f=r.get(c);if(u)if(f&&u.active()){u.update(f,d,a);continue}else u.cancel();if(!f||!f.duration){e[c]=d;continue}o[c]=u=new fN(f,e,c,d),s.push(u)}return s}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return Yn.add(this._chart,r),!0}}function hN(t,e){const n=[],r=Object.keys(e);for(let s=0;s<r.length;s++){const o=t[r[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function gN(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function k0(t,e){const n=t&&t.options||{},r=n.reverse,s=n.min===void 0?e:0,o=n.max===void 0?e:0;return{start:r?o:s,end:r?s:o}}function pN(t,e,n){if(n===!1)return!1;const r=k0(t,n),s=k0(e,n);return{top:s.end,right:r.end,bottom:s.start,left:r.start}}function mN(t){let e,n,r,s;return Ze(t)?(e=t.top,n=t.right,r=t.bottom,s=t.left):e=n=r=s=t,{top:e,right:n,bottom:r,left:s,disabled:t===!1}}function C0(t,e){const n=[],r=t._getSortedDatasetMetas(e);let s,o;for(s=0,o=r.length;s<o;++s)n.push(r[s].index);return n}function S0(t,e,n,r={}){const s=t.keys,o=r.mode==="single";let i,a,l,c;if(e===null)return;let d=!1;for(i=0,a=s.length;i<a;++i){if(l=+s[i],l===n){if(d=!0,r.all)continue;break}c=t.values[l],hn(c)&&(o||e===0||ir(e)===ir(c))&&(e+=c)}return!d&&!r.all?0:e}function bN(t,e){const{iScale:n,vScale:r}=e,s=n.axis==="x"?"x":"y",o=r.axis==="x"?"x":"y",i=Object.keys(t),a=new Array(i.length);let l,c,d;for(l=0,c=i.length;l<c;++l)d=i[l],a[l]={[s]:d,[o]:t[d]};return a}function td(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function yN(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function vN(t){const{min:e,max:n,minDefined:r,maxDefined:s}=t.getUserBounds();return{min:r?e:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function xN(t,e,n){const r=t[e]||(t[e]={});return r[n]||(r[n]={})}function _0(t,e,n,r){for(const s of e.getMatchingVisibleMetas(r).reverse()){const o=t[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function E0(t,e){const{chart:n,_cachedMeta:r}=t,s=n._stacks||(n._stacks={}),{iScale:o,vScale:i,index:a}=r,l=o.axis,c=i.axis,d=yN(o,i,r),u=e.length;let f;for(let g=0;g<u;++g){const m=e[g],{[l]:p,[c]:y}=m,b=m._stacks||(m._stacks={});f=b[c]=xN(s,d,p),f[a]=y,f._top=_0(f,i,!0,r.type),f._bottom=_0(f,i,!1,r.type);const S=f._visualValues||(f._visualValues={});S[a]=y}}function nd(t,e){const n=t.scales;return Object.keys(n).filter(r=>n[r].axis===e).shift()}function wN(t,e){return ds(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function kN(t,e,n){return ds(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function mo(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const s of e){const o=s._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const rd=t=>t==="reset"||t==="none",M0=(t,e)=>e?t:Object.assign({},t),CN=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:C0(n,!0),values:null};class hs{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=td(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&mo(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(u,f,g,m)=>u==="x"?f:u==="r"?m:g,o=n.xAxisID=Qe(r.xAxisID,nd(e,"x")),i=n.yAxisID=Qe(r.yAxisID,nd(e,"y")),a=n.rAxisID=Qe(r.rAxisID,nd(e,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,i,a),d=n.vAxisID=s(l,i,o,a);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(i),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Kp(this._data,this),e._stacked&&mo(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(Ze(n)){const s=this._cachedMeta;this._data=bN(n,s)}else if(r!==n){if(r){Kp(r,this);const s=this._cachedMeta;mo(s),s._parsed=[]}n&&Object.isExtensible(n)&&CM(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,r=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=td(n.vScale,n),n.stack!==r.stack&&(s=!0,mo(n),n.stack=r.stack),this._resyncElements(e),(s||o!==n._stacked)&&(E0(this,n._parsed),n._stacked=td(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:s}=this,{iScale:o,_stacked:i}=r,a=o.axis;let l=e===0&&n===s.length?!0:r._sorted,c=e>0&&r._parsed[e-1],d,u,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{_t(s[e])?f=this.parseArrayData(r,s,e,n):Ze(s[e])?f=this.parseObjectData(r,s,e,n):f=this.parsePrimitiveData(r,s,e,n);const g=()=>u[a]===null||c&&u[a]<c[a];for(d=0;d<n;++d)r._parsed[d+e]=u=f[d],l&&(g()&&(l=!1),c=u);r._sorted=l}i&&E0(this,f)}parsePrimitiveData(e,n,r,s){const{iScale:o,vScale:i}=e,a=o.axis,l=i.axis,c=o.getLabels(),d=o===i,u=new Array(s);let f,g,m;for(f=0,g=s;f<g;++f)m=f+r,u[f]={[a]:d||o.parse(c[m],m),[l]:i.parse(n[m],m)};return u}parseArrayData(e,n,r,s){const{xScale:o,yScale:i}=e,a=new Array(s);let l,c,d,u;for(l=0,c=s;l<c;++l)d=l+r,u=n[d],a[l]={x:o.parse(u[0],d),y:i.parse(u[1],d)};return a}parseObjectData(e,n,r,s){const{xScale:o,yScale:i}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let d,u,f,g;for(d=0,u=s;d<u;++d)f=d+r,g=n[f],c[d]={x:o.parse(Cr(g,a),f),y:i.parse(Cr(g,l),f)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,r){const s=this.chart,o=this._cachedMeta,i=n[e.axis],a={keys:C0(s,!0),values:n._stacks[e.axis]._visualValues};return S0(a,i,o.index,{mode:r})}updateRangeFromParsed(e,n,r,s){const o=r[n.axis];let i=o===null?NaN:o;const a=s&&r._stacks[n.axis];s&&a&&(s.values=a,i=S0(s,o,this._cachedMeta.index)),e.min=Math.min(e.min,i),e.max=Math.max(e.max,i)}getMinMax(e,n){const r=this._cachedMeta,s=r._parsed,o=r._sorted&&e===r.iScale,i=s.length,a=this._getOtherScale(e),l=CN(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:u}=vN(a);let f,g;function m(){g=s[f];const p=g[a.axis];return!hn(g[e.axis])||d>p||u<p}for(f=0;f<i&&!(!m()&&(this.updateRangeFromParsed(c,e,g,l),o));++f);if(o){for(f=i-1;f>=0;--f)if(!m()){this.updateRangeFromParsed(c,e,g,l);break}}return c}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let s,o,i;for(s=0,o=n.length;s<o;++s)i=n[s][e.axis],hn(i)&&r.push(i);return r}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,r=n.iScale,s=n.vScale,o=this.getParsed(e);return{label:r?""+r.getLabelForValue(o[r.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=mN(Qe(this.options.clip,pN(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,r=this._cachedMeta,s=r.data||[],o=n.chartArea,i=[],a=this._drawStart||0,l=this._drawCount||s.length-a,c=this.options.drawActiveElementsOnTop;let d;for(r.dataset&&r.dataset.draw(e,o,a,l),d=a;d<a+l;++d){const u=s[d];u.hidden||(u.active&&c?i.push(u):u.draw(e,o))}for(d=0;d<i.length;++d)i[d].draw(e,o)}getStyle(e,n){const r=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(e||0,r)}getContext(e,n,r){const s=this.getDataset();let o;if(e>=0&&e<this._cachedMeta.data.length){const i=this._cachedMeta.data[e];o=i.$context||(i.$context=kN(this.getContext(),e,i)),o.parsed=this.getParsed(e),o.raw=s.data[e],o.index=o.dataIndex=e}else o=this.$context||(this.$context=wN(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=r,o}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",r){const s=n==="active",o=this._cachedDataOpts,i=e+"-"+n,a=o[i],l=this.enableOptionSharing&&fo(r);if(a)return M0(a,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,e),u=s?[`${e}Hover`,"hover",e,""]:[e,""],f=c.getOptionScopes(this.getDataset(),d),g=Object.keys(vt.elements[e]),m=()=>this.getContext(r,s,n),p=c.resolveNamedOptions(f,g,m,u);return p.$shared&&(p.$shared=l,o[i]=Object.freeze(M0(p,l))),p}_resolveAnimations(e,n,r){const s=this.chart,o=this._cachedDataOpts,i=`animation-${n}`,a=o[i];if(a)return a;let l;if(s.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(f,this.getContext(e,r,n))}const c=new w0(s,l&&l.animations);return l&&l._cacheable&&(o[i]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||rd(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),s=this._sharedOptions,o=this.getSharedOptions(r),i=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:i}}updateElement(e,n,r,s){rd(s)?Object.assign(e,r):this._resolveAnimations(n,s).update(e,r)}updateSharedOptions(e,n,r){e&&!rd(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,s){e.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(e,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=r.length,o=n.length,i=Math.min(o,s);i&&this.parse(0,i),o>s?this._insertElements(s,o-s,e):o<s&&this._removeElements(o,s-o)}_insertElements(e,n,r=!0){const s=this._cachedMeta,o=s.data,i=e+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=i;a--)c[a]=c[a-n]};for(l(o),a=e;a<i;++a)o[a]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(e,n),r&&this.updateElements(o,e,n,"reset")}updateElements(e,n,r,s){}_removeElements(e,n){const r=this._cachedMeta;if(this._parsing){const s=r._parsed.splice(e,n);r._stacked&&mo(r,s)}r.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,r,s]=e;this[n](r,s)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",e,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}$e(hs,"defaults",{}),$e(hs,"datasetElementType",null),$e(hs,"dataElementType",null);function SN(t,e){if(!t._cache.$bar){const n=t.getMatchingVisibleMetas(e);let r=[];for(let s=0,o=n.length;s<o;s++)r=r.concat(n[s].controller.getAllParsedValues(t));t._cache.$bar=qp(r.sort((s,o)=>s-o))}return t._cache.$bar}function _N(t){const e=t.iScale,n=SN(e,t.type);let r=e._length,s,o,i,a;const l=()=>{i===32767||i===-32768||(fo(a)&&(r=Math.min(r,Math.abs(i-a)||r)),a=i)};for(s=0,o=n.length;s<o;++s)i=e.getPixelForValue(n[s]),l();for(a=void 0,s=0,o=e.ticks.length;s<o;++s)i=e.getPixelForTick(s),l();return r}function EN(t,e,n,r){const s=n.barThickness;let o,i;return ct(s)?(o=e.min*n.categoryPercentage,i=n.barPercentage):(o=s*r,i=1),{chunk:o/r,ratio:i,start:e.pixels[t]-o/2}}function MN(t,e,n,r){const s=e.pixels,o=s[t];let i=t>0?s[t-1]:null,a=t<s.length-1?s[t+1]:null;const l=n.categoryPercentage;i===null&&(i=o-(a===null?e.end-e.start:a-o)),a===null&&(a=o+o-i);const c=o-(o-Math.min(i,a))/2*l;return{chunk:Math.abs(a-i)/2*l/r,ratio:n.barPercentage,start:c}}function NN(t,e,n,r){const s=n.parse(t[0],r),o=n.parse(t[1],r),i=Math.min(s,o),a=Math.max(s,o);let l=i,c=a;Math.abs(i)>Math.abs(a)&&(l=a,c=i),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:s,end:o,min:i,max:a}}function N0(t,e,n,r){return _t(t)?NN(t,e,n,r):e[n.axis]=n.parse(t,r),e}function O0(t,e,n,r){const s=t.iScale,o=t.vScale,i=s.getLabels(),a=s===o,l=[];let c,d,u,f;for(c=n,d=n+r;c<d;++c)f=e[c],u={},u[s.axis]=a||s.parse(i[c],c),l.push(N0(f,u,o,c));return l}function sd(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function ON(t,e,n){return t!==0?ir(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function TN(t){let e,n,r,s,o;return t.horizontal?(e=t.base>t.x,n="left",r="right"):(e=t.base<t.y,n="bottom",r="top"),e?(s="end",o="start"):(s="start",o="end"),{start:n,end:r,reverse:e,top:s,bottom:o}}function AN(t,e,n,r){let s=e.borderSkipped;const o={};if(!s){t.borderSkipped=o;return}if(s===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:i,end:a,reverse:l,top:c,bottom:d}=TN(t);s==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===r?s=c:(n._bottom||0)===r?s=d:(o[T0(d,i,a,l)]=!0,s=c)),o[T0(s,i,a,l)]=!0,t.borderSkipped=o}function T0(t,e,n,r){return r?(t=DN(t,e,n),t=A0(t,n,e)):t=A0(t,e,n),t}function DN(t,e,n){return t===e?n:t===n?e:t}function A0(t,e,n){return t==="start"?e:t==="end"?n:t}function IN(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class da extends hs{parsePrimitiveData(e,n,r,s){return O0(e,n,r,s)}parseArrayData(e,n,r,s){return O0(e,n,r,s)}parseObjectData(e,n,r,s){const{iScale:o,vScale:i}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,d=i.axis==="x"?a:l,u=[];let f,g,m,p;for(f=r,g=r+s;f<g;++f)p=n[f],m={},m[o.axis]=o.parse(Cr(p,c),f),u.push(N0(Cr(p,d),m,i,f));return u}updateRangeFromParsed(e,n,r,s){super.updateRangeFromParsed(e,n,r,s);const o=r._custom;o&&n===this._cachedMeta.vScale&&(e.min=Math.min(e.min,o.min),e.max=Math.max(e.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const n=this._cachedMeta,{iScale:r,vScale:s}=n,o=this.getParsed(e),i=o._custom,a=sd(i)?"["+i.start+", "+i.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+r.getLabelForValue(o[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,e)}updateElements(e,n,r,s){const o=s==="reset",{index:i,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),d=this._getRuler(),{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,s);for(let g=n;g<n+r;g++){const m=this.getParsed(g),p=o||ct(m[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(g),y=this._calculateBarIndexPixels(g,d),b=(m._stacks||{})[a.axis],S={horizontal:c,base:p.base,enableBorderRadius:!b||sd(m._custom)||i===b._top||i===b._bottom,x:c?p.head:y.center,y:c?y.center:p.head,height:c?y.size:Math.abs(p.size),width:c?Math.abs(p.size):y.size};f&&(S.options=u||this.resolveDataElementOptions(g,e[g].active?"active":s));const x=S.options||e[g].options;AN(S,x,b,i),IN(S,x,d.ratio),this.updateElement(e[g],g,S,s)}}_getStacks(e,n){const{iScale:r}=this._cachedMeta,s=r.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=r.options.stacked,i=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=d=>{const u=d._parsed.find(g=>g[r.axis]===l),f=u&&u[d.vScale.axis];if(ct(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||i.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&i.push(d.stack),d.index===e))break;return i.length||i.push(void 0),i}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const e=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(e).filter(r=>e[r].axis===n).shift()}_getAxis(){const e={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)e[Qe(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(e)}_getStackIndex(e,n,r){const s=this._getStacks(e,r),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const e=this.options,n=this._cachedMeta,r=n.iScale,s=[];let o,i;for(o=0,i=n.data.length;o<i;++o)s.push(r.getPixelForValue(this.getParsed(o)[r.axis],o));const a=e.barThickness;return{min:a||_N(n),pixels:s,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:n,_stacked:r,index:s},options:{base:o,minBarLength:i}}=this,a=o||0,l=this.getParsed(e),c=l._custom,d=sd(c);let u=l[n.axis],f=0,g=r?this.applyStack(n,l,r):u,m,p;g!==u&&(f=g-u,g=u),d&&(u=c.barStart,g=c.barEnd-c.barStart,u!==0&&ir(u)!==ir(c.barEnd)&&(f=0),f+=u);const y=!ct(o)&&!d?o:f;let b=n.getPixelForValue(y);if(this.chart.getDataVisibility(e)?m=n.getPixelForValue(f+g):m=b,p=m-b,Math.abs(p)<i){p=ON(p,n,a)*i,u===a&&(b-=p/2);const S=n.getPixelForDecimal(0),x=n.getPixelForDecimal(1),E=Math.min(S,x),k=Math.max(S,x);b=Math.max(Math.min(b,k),E),m=b+p,r&&!d&&(l._stacks[n.axis]._visualValues[s]=n.getValueForPixel(m)-n.getValueForPixel(b))}if(b===n.getPixelForValue(a)){const S=ir(p)*n.getLineWidthForValue(a)/2;b+=S,p-=S}return{size:p,base:b,head:m,center:m+p/2}}_calculateBarIndexPixels(e,n){const r=n.scale,s=this.options,o=s.skipNull,i=Qe(s.maxBarThickness,1/0);let a,l;const c=this._getAxisCount();if(n.grouped){const d=o?this._getStackCount(e):n.stackCount,u=s.barThickness==="flex"?MN(e,n,s,d*c):EN(e,n,s,d*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,g=this._getAxis().indexOf(Qe(f,this.getFirstScaleIdForIndexAxis())),m=this._getStackIndex(this.index,this._cachedMeta.stack,o?e:void 0)+g;a=u.start+u.chunk*m+u.chunk/2,l=Math.min(i,u.chunk*u.ratio)}else a=r.getPixelForValue(this.getParsed(e)[r.axis],e),l=Math.min(i,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const e=this._cachedMeta,n=e.vScale,r=e.data,s=r.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!r[o].hidden&&r[o].draw(this._ctx)}}$e(da,"id","bar"),$e(da,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),$e(da,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function LN(t,e,n){let r=1,s=1,o=0,i=0;if(e<Ct){const a=t,l=a+e,c=Math.cos(a),d=Math.sin(a),u=Math.cos(l),f=Math.sin(l),g=(x,E,k)=>ra(x,a,l,!0)?1:Math.max(E,E*n,k,k*n),m=(x,E,k)=>ra(x,a,l,!0)?-1:Math.min(E,E*n,k,k*n),p=g(0,c,u),y=g(Et,d,f),b=m(dt,c,u),S=m(dt+Et,d,f);r=(p-b)/2,s=(y-S)/2,o=-(p+b)/2,i=-(y+S)/2}return{ratioX:r,ratioY:s,offsetX:o,offsetY:i}}class bo extends hs{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const r=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=r;else{let o=l=>+r[l];if(Ze(r[e])){const{key:l="value"}=this._parsing;o=c=>+Cr(r[c],l)}let i,a;for(i=e,a=e+n;i<a;++i)s._parsed[i]=o(i)}}_getRotation(){return Gn(this.options.rotation-90)}_getCircumference(){return Gn(this.options.circumference)}_getRotationExtents(){let e=Ct,n=-Ct;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const s=this.chart.getDatasetMeta(r).controller,o=s._getRotation(),i=s._getCircumference();e=Math.min(e,o),n=Math.max(n,o+i)}return{rotation:e,circumference:n-e}}update(e){const n=this.chart,{chartArea:r}=n,s=this._cachedMeta,o=s.data,i=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(r.width,r.height)-i)/2,0),l=Math.min(aM(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:m,offsetY:p}=LN(u,d,l),y=(r.width-i)/f,b=(r.height-i)/g,S=Math.max(Math.min(y,b)/2,0),x=Vp(this.options.radius,S),E=Math.max(x*l,0),k=(x-E)/this._getVisibleDatasetWeightTotal();this.offsetX=m*x,this.offsetY=p*x,s.total=this.calculateTotal(),this.outerRadius=x-k*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-k*c,0),this.updateElements(o,0,o.length,e)}_circumference(e,n){const r=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(e)||s._parsed[e]===null||s.data[e].hidden?0:this.calculateCircumference(s._parsed[e]*o/Ct)}updateElements(e,n,r,s){const o=s==="reset",i=this.chart,a=i.chartArea,c=i.options.animation,d=(a.left+a.right)/2,u=(a.top+a.bottom)/2,f=o&&c.animateScale,g=f?0:this.innerRadius,m=f?0:this.outerRadius,{sharedOptions:p,includeOptions:y}=this._getSharedOptions(n,s);let b=this._getRotation(),S;for(S=0;S<n;++S)b+=this._circumference(S,o);for(S=n;S<n+r;++S){const x=this._circumference(S,o),E=e[S],k={x:d+this.offsetX,y:u+this.offsetY,startAngle:b,endAngle:b+x,circumference:x,outerRadius:m,innerRadius:g};y&&(k.options=p||this.resolveDataElementOptions(S,E.active?"active":s)),b+=x,this.updateElement(E,S,k,s)}}calculateTotal(){const e=this._cachedMeta,n=e.data;let r=0,s;for(s=0;s<n.length;s++){const o=e._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(r+=Math.abs(o))}return r}calculateCircumference(e){const n=this._cachedMeta.total;return n>0&&!isNaN(e)?Ct*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,r=this.chart,s=r.data.labels||[],o=Wc(n._parsed[e],r.options.locale);return{label:s[e]||"",value:o}}getMaxBorderWidth(e){let n=0;const r=this.chart;let s,o,i,a,l;if(!e){for(s=0,o=r.data.datasets.length;s<o;++s)if(r.isDatasetVisible(s)){i=r.getDatasetMeta(s),e=i.data,a=i.controller;break}}if(!e)return 0;for(s=0,o=e.length;s<o;++s)l=a.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(e){let n=0;for(let r=0,s=e.length;r<s;++r){const o=this.resolveDataElementOptions(r);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(e){let n=0;for(let r=0;r<e;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(e){return Math.max(Qe(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}$e(bo,"id","doughnut"),$e(bo,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),$e(bo,"descriptors",{_scriptable:e=>e!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),$e(bo,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data,{labels:{pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=e.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const u=e.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:u.backgroundColor,fontColor:o,hidden:!e.getDataVisibility(c),lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:u.borderWidth,strokeStyle:u.borderColor,textAlign:s,pointStyle:r,borderRadius:i&&(a||u.borderRadius),index:c}}):[]}},onClick(e,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});function Tr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class od{constructor(e){$e(this,"options");this.options=e||{}}static override(e){Object.assign(od.prototype,e)}init(){}formats(){return Tr()}parse(){return Tr()}format(){return Tr()}add(){return Tr()}diff(){return Tr()}startOf(){return Tr()}endOf(){return Tr()}}var PN={_date:od};function $N(t,e,n,r){const{controller:s,data:o,_sorted:i}=t,a=s._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&i&&o.length){const c=a._reversePixels?wM:Uc;if(r){if(s._sharedOptions){const d=o[0],u=typeof d.getRange=="function"&&d.getRange(e);if(u){const f=c(o,e,n-u),g=c(o,e,n+u);return{lo:f.lo,hi:g.hi}}}}else{const d=c(o,e,n);if(l){const{vScale:u}=s._cachedMeta,{_parsed:f}=t,g=f.slice(0,d.lo+1).reverse().findIndex(p=>!ct(p[u.axis]));d.lo-=Math.max(0,g);const m=f.slice(d.hi).findIndex(p=>!ct(p[u.axis]));d.hi+=Math.max(0,m)}return d}}return{lo:0,hi:o.length-1}}function ua(t,e,n,r,s){const o=t.getSortedVisibleDatasetMetas(),i=n[e];for(let a=0,l=o.length;a<l;++a){const{index:c,data:d}=o[a],{lo:u,hi:f}=$N(o[a],e,i,s);for(let g=u;g<=f;++g){const m=d[g];m.skip||r(m,c,g)}}}function FN(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(r,s){const o=e?Math.abs(r.x-s.x):0,i=n?Math.abs(r.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(i,2))}}function id(t,e,n,r,s){const o=[];return!s&&!t.isPointInArea(e)||ua(t,n,e,function(a,l,c){!s&&!l0(a,t.chartArea,0)||a.inRange(e.x,e.y,r)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function VN(t,e,n,r){let s=[];function o(i,a,l){const{startAngle:c,endAngle:d}=i.getProps(["startAngle","endAngle"],r),{angle:u}=Yp(i,{x:e.x,y:e.y});ra(u,c,d)&&s.push({element:i,datasetIndex:a,index:l})}return ua(t,n,e,o),s}function zN(t,e,n,r,s,o){let i=[];const a=FN(n);let l=Number.POSITIVE_INFINITY;function c(d,u,f){const g=d.inRange(e.x,e.y,s);if(r&&!g)return;const m=d.getCenterPoint(s);if(!(!!o||t.isPointInArea(m))&&!g)return;const y=a(e,m);y<l?(i=[{element:d,datasetIndex:u,index:f}],l=y):y===l&&i.push({element:d,datasetIndex:u,index:f})}return ua(t,n,e,c),i}function ad(t,e,n,r,s,o){return!o&&!t.isPointInArea(e)?[]:n==="r"&&!r?VN(t,e,n,s):zN(t,e,n,r,s,o)}function D0(t,e,n,r,s){const o=[],i=n==="x"?"inXRange":"inYRange";let a=!1;return ua(t,n,e,(l,c,d)=>{l[i]&&l[i](e[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,s))}),r&&!a?[]:o}var HN={modes:{index(t,e,n,r){const s=Or(e,t),o=n.axis||"x",i=n.includeInvisible||!1,a=n.intersect?id(t,s,o,r,i):ad(t,s,o,!1,r,i),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const d=a[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(t,e,n,r){const s=Or(e,t),o=n.axis||"xy",i=n.includeInvisible||!1;let a=n.intersect?id(t,s,o,r,i):ad(t,s,o,!1,r,i);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(t,e,n,r){const s=Or(e,t),o=n.axis||"xy",i=n.includeInvisible||!1;return id(t,s,o,r,i)},nearest(t,e,n,r){const s=Or(e,t),o=n.axis||"xy",i=n.includeInvisible||!1;return ad(t,s,o,n.intersect,r,i)},x(t,e,n,r){const s=Or(e,t);return D0(t,s,"x",n.intersect,r)},y(t,e,n,r){const s=Or(e,t);return D0(t,s,"y",n.intersect,r)}}};const I0=["left","top","right","bottom"];function yo(t,e){return t.filter(n=>n.pos===e)}function L0(t,e){return t.filter(n=>I0.indexOf(n.pos)===-1&&n.box.axis===e)}function vo(t,e){return t.sort((n,r)=>{const s=e?r:n,o=e?n:r;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function UN(t){const e=[];let n,r,s,o,i,a;for(n=0,r=(t||[]).length;n<r;++n)s=t[n],{position:o,options:{stack:i,stackWeight:a=1}}=s,e.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:i&&o+i,stackWeight:a});return e}function BN(t){const e={};for(const n of t){const{stack:r,pos:s,stackWeight:o}=n;if(!r||!I0.includes(s))continue;const i=e[r]||(e[r]={count:0,placed:0,weight:0,size:0});i.count++,i.weight+=o}return e}function jN(t,e){const n=BN(t),{vBoxMaxWidth:r,hBoxMaxHeight:s}=e;let o,i,a;for(o=0,i=t.length;o<i;++o){a=t[o];const{fullSize:l}=a.box,c=n[a.stack],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*r:l&&e.availableWidth,a.height=s):(a.width=r,a.height=d?d*s:l&&e.availableHeight)}return n}function WN(t){const e=UN(t),n=vo(e.filter(c=>c.box.fullSize),!0),r=vo(yo(e,"left"),!0),s=vo(yo(e,"right")),o=vo(yo(e,"top"),!0),i=vo(yo(e,"bottom")),a=L0(e,"x"),l=L0(e,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:s.concat(l).concat(i).concat(a),chartArea:yo(e,"chartArea"),vertical:r.concat(s).concat(l),horizontal:o.concat(i).concat(a)}}function P0(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function $0(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function GN(t,e,n,r){const{pos:s,box:o}=n,i=t.maxPadding;if(!Ze(s)){n.size&&(t[s]-=n.size);const u=r[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?o.height:o.width),n.size=u.size/u.count,t[s]+=n.size}o.getPadding&&$0(i,o.getPadding());const a=Math.max(0,e.outerWidth-P0(i,t,"left","right")),l=Math.max(0,e.outerHeight-P0(i,t,"top","bottom")),c=a!==t.w,d=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function YN(t){const e=t.maxPadding;function n(r){const s=Math.max(e[r]-t[r],0);return t[r]+=s,s}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function XN(t,e){const n=e.maxPadding;function r(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(i=>{o[i]=Math.max(e[i],n[i])}),o}return r(t?["left","right"]:["top","bottom"])}function xo(t,e,n,r){const s=[];let o,i,a,l,c,d;for(o=0,i=t.length,c=0;o<i;++o){a=t[o],l=a.box,l.update(a.width||e.w,a.height||e.h,XN(a.horizontal,e));const{same:u,other:f}=GN(e,n,a,r);c|=u&&s.length,d=d||f,l.fullSize||s.push(a)}return c&&xo(s,e,n,r)||d}function fa(t,e,n,r,s){t.top=n,t.left=e,t.right=e+r,t.bottom=n+s,t.width=r,t.height=s}function F0(t,e,n,r){const s=n.padding;let{x:o,y:i}=e;for(const a of t){const l=a.box,c=r[a.stack]||{placed:0,weight:1},d=a.stackWeight/c.weight||1;if(a.horizontal){const u=e.w*d,f=c.size||l.height;fo(c.start)&&(i=c.start),l.fullSize?fa(l,s.left,i,n.outerWidth-s.right-s.left,f):fa(l,e.left+c.placed,i,u,f),c.start=i,c.placed+=u,i=l.bottom}else{const u=e.h*d,f=c.size||l.width;fo(c.start)&&(o=c.start),l.fullSize?fa(l,o,s.top,f,n.outerHeight-s.bottom-s.top):fa(l,o,e.top+c.placed,f,u),c.start=o,c.placed+=u,o=l.right}}e.x=o,e.y=i}var pn={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,r){if(!t)return;const s=gn(t.options.layout.padding),o=Math.max(e-s.width,0),i=Math.max(n-s.height,0),a=WN(t.boxes),l=a.vertical,c=a.horizontal;at(t.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});const d=l.reduce((p,y)=>y.box.options&&y.box.options.display===!1?p:p+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:n,padding:s,availableWidth:o,availableHeight:i,vBoxMaxWidth:o/2/d,hBoxMaxHeight:i/2}),f=Object.assign({},s);$0(f,gn(r));const g=Object.assign({maxPadding:f,w:o,h:i,x:s.left,y:s.top},s),m=jN(l.concat(c),u);xo(a.fullSize,g,u,m),xo(l,g,u,m),xo(c,g,u,m)&&xo(l,g,u,m),YN(g),F0(a.leftAndTop,g,u,m),g.x+=g.w,g.y+=g.h,F0(a.rightAndBottom,g,u,m),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},at(a.chartArea,p=>{const y=p.box;Object.assign(y,t.chartArea),y.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class V0{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,s){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(e){return!0}updateConfig(e){}}class KN extends V0{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ha="$chartjs",qN={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},z0=t=>t===null||t==="";function ZN(t,e){const n=t.style,r=t.getAttribute("height"),s=t.getAttribute("width");if(t[ha]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",z0(s)){const o=b0(t,"width");o!==void 0&&(t.width=o)}if(z0(r))if(t.style.height==="")t.height=t.width/(e||2);else{const o=b0(t,"height");o!==void 0&&(t.height=o)}return t}const H0=oN?{passive:!0}:!1;function QN(t,e,n){t&&t.addEventListener(e,n,H0)}function JN(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,H0)}function RN(t,e){const n=qN[t.type]||t.type,{x:r,y:s}=Or(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:s!==void 0?s:null}}function ga(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function eO(t,e,n){const r=t.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||ga(a.addedNodes,r),i=i&&!ga(a.removedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function tO(t,e,n){const r=t.canvas,s=new MutationObserver(o=>{let i=!1;for(const a of o)i=i||ga(a.removedNodes,r),i=i&&!ga(a.addedNodes,r);i&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const wo=new Map;let U0=0;function B0(){const t=window.devicePixelRatio;t!==U0&&(U0=t,wo.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function nO(t,e){wo.size||window.addEventListener("resize",B0),wo.set(t,e)}function rO(t){wo.delete(t),wo.size||window.removeEventListener("resize",B0)}function sO(t,e,n){const r=t.canvas,s=r&&ed(r);if(!s)return;const o=Qp((a,l)=>{const c=s.clientWidth;n(a,l),c<s.clientWidth&&n()},window),i=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return i.observe(s),nO(t,o),i}function ld(t,e,n){n&&n.disconnect(),e==="resize"&&rO(t)}function oO(t,e,n){const r=t.canvas,s=Qp(o=>{t.ctx!==null&&n(RN(o,t))},t);return QN(r,e,s),s}class iO extends V0{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(ZN(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[ha])return!1;const r=n[ha].initial;["height","width"].forEach(o=>{const i=r[o];ct(i)?n.removeAttribute(o):n.setAttribute(o,i)});const s=r.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[ha],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const s=e.$proxies||(e.$proxies={}),i={attach:eO,detach:tO,resize:sO}[n]||oO;s[n]=i(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),s=r[n];if(!s)return;({attach:ld,detach:ld,resize:ld}[n]||JN)(e,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,s){return sN(e,n,r,s)}isAttached(e){const n=e&&ed(e);return!!(n&&n.isConnected)}}function aO(t){return!Rc()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?KN:iO}let Ar=(Na=class{constructor(){$e(this,"x");$e(this,"y");$e(this,"active",!1);$e(this,"options");$e(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return na(this.x)&&na(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const s={};return e.forEach(o=>{s[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),s}},$e(Na,"defaults",{}),$e(Na,"defaultRoutes"),Na);function lO(t,e){const n=t.options.ticks,r=cO(t),s=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?uO(e):[],i=o.length,a=o[0],l=o[i-1],c=[];if(i>s)return fO(e,c,o,i/s),c;const d=dO(o,e,s);if(i>0){let u,f;const g=i>1?Math.round((l-a)/(i-1)):null;for(pa(e,c,d,ct(g)?0:a-g,a),u=0,f=i-1;u<f;u++)pa(e,c,d,o[u],o[u+1]);return pa(e,c,d,l,ct(g)?e.length:l+g),c}return pa(e,c,d),c}function cO(t){const e=t.options.offset,n=t._tickSize(),r=t._length/n+(e?0:1),s=t._maxLength/n;return Math.floor(Math.min(r,s))}function dO(t,e,n){const r=hO(t),s=e.length/n;if(!r)return Math.max(s,1);const o=gM(r);for(let i=0,a=o.length-1;i<a;i++){const l=o[i];if(l>s)return l}return Math.max(s,1)}function uO(t){const e=[];let n,r;for(n=0,r=t.length;n<r;n++)t[n].major&&e.push(n);return e}function fO(t,e,n,r){let s=0,o=n[0],i;for(r=Math.ceil(r),i=0;i<t.length;i++)i===o&&(e.push(t[i]),s++,o=n[s*r])}function pa(t,e,n,r,s){const o=Qe(r,0),i=Math.min(Qe(s,t.length),t.length);let a=0,l,c,d;for(n=Math.ceil(n),s&&(l=s-r,n=l/Math.floor(l/n)),d=o;d<0;)a++,d=Math.round(o+a*n);for(c=Math.max(o,0);c<i;c++)c===d&&(e.push(t[c]),a++,d=Math.round(o+a*n))}function hO(t){const e=t.length;let n,r;if(e<2)return!1;for(r=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==r)return!1;return r}const gO=t=>t==="left"?"right":t==="right"?"left":t,j0=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,W0=(t,e)=>Math.min(e||t,t);function G0(t,e){const n=[],r=t.length/e,s=t.length;let o=0;for(;o<s;o+=r)n.push(t[Math.floor(o)]);return n}function pO(t,e,n){const r=t.ticks.length,s=Math.min(e,r-1),o=t._startPixel,i=t._endPixel,a=1e-6;let l=t.getPixelForTick(s),c;if(!(n&&(r===1?c=Math.max(l-o,i-l):e===0?c=(t.getPixelForTick(1)-l)/2:c=(l-t.getPixelForTick(s-1))/2,l+=s<e?c:-c,l<o-a||l>i+a)))return l}function mO(t,e){at(t,n=>{const r=n.gc,s=r.length/2;let o;if(s>e){for(o=0;o<s;++o)delete n.data[r[o]];r.splice(0,s)}})}function ko(t){return t.drawTicks?t.tickLength:0}function Y0(t,e){if(!t.display)return 0;const n=Ut(t.font,e),r=gn(t.padding);return(_t(t.text)?t.text.length:1)*n.lineHeight+r.height}function bO(t,e){return ds(t,{scale:e,type:"scale"})}function yO(t,e,n){return ds(t,{tick:n,index:e,type:"tick"})}function vO(t,e,n){let r=Bc(t);return(n&&e!=="right"||!n&&e==="right")&&(r=gO(r)),r}function xO(t,e,n,r){const{top:s,left:o,bottom:i,right:a,chart:l}=t,{chartArea:c,scales:d}=l;let u=0,f,g,m;const p=i-s,y=a-o;if(t.isHorizontal()){if(g=Ht(r,o,a),Ze(n)){const b=Object.keys(n)[0],S=n[b];m=d[b].getPixelForValue(S)+p-e}else n==="center"?m=(c.bottom+c.top)/2+p-e:m=j0(t,n,e);f=a-o}else{if(Ze(n)){const b=Object.keys(n)[0],S=n[b];g=d[b].getPixelForValue(S)-y+e}else n==="center"?g=(c.left+c.right)/2-y+e:g=j0(t,n,e);m=Ht(r,i,s),u=n==="left"?-Et:Et}return{titleX:g,titleY:m,maxWidth:f,rotation:u}}class gs extends Ar{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:r,_suggestedMax:s}=this;return e=Pn(e,Number.POSITIVE_INFINITY),n=Pn(n,Number.NEGATIVE_INFINITY),r=Pn(r,Number.POSITIVE_INFINITY),s=Pn(s,Number.NEGATIVE_INFINITY),{min:Pn(e,r),max:Pn(n,s),minDefined:hn(e),maxDefined:hn(n)}}getMinMax(e){let{min:n,max:r,minDefined:s,maxDefined:o}=this.getUserBounds(),i;if(s&&o)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)i=a[l].controller.getMinMax(this,e),s||(n=Math.min(n,i.min)),o||(r=Math.max(r,i.max));return n=o&&n>r?r:n,r=s&&n>r?n:r,{min:Pn(n,Pn(r,n)),max:Pn(r,Pn(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ht(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:s,grace:o,ticks:i}=this.options,a=i.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=jM(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?G0(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),i.display&&(i.autoSkip||i.source==="auto")&&(this.ticks=lO(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,e=!e),this._startPixel=n,this._endPixel=r,this._reversePixels=e,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ht(this.options.afterUpdate,[this])}beforeSetDimensions(){ht(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ht(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),ht(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ht(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let r,s,o;for(r=0,s=e.length;r<s;r++)o=e[r],o.label=ht(n.callback,[o.value,r,e],this)}afterTickToLabelConversion(){ht(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ht(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,r=W0(this.ticks.length,e.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let i=s,a,l,c;if(!this._isVisible()||!n.display||s>=o||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),u=d.widest.width,f=d.highest.height,g=Zt(this.chart.width-u,0,this.maxWidth);a=e.offset?this.maxWidth/r:g/(r-1),u+6>a&&(a=g/(r-(e.offset?.5:1)),l=this.maxHeight-ko(e.grid)-n.padding-Y0(e.title,this.chart.options.font),c=Math.sqrt(u*u+f*f),i=yM(Math.min(Math.asin(Zt((d.highest.height+6)/a,-1,1)),Math.asin(Zt(l/c,-1,1))-Math.asin(Zt(f/c,-1,1)))),i=Math.max(s,Math.min(o,i))),this.labelRotation=i}afterCalculateLabelRotation(){ht(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ht(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:o}}=this,i=this._isVisible(),a=this.isHorizontal();if(i){const l=Y0(s,n.options.font);if(a?(e.width=this.maxWidth,e.height=ko(o)+l):(e.height=this.maxHeight,e.width=ko(o)+l),r.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:f}=this._getLabelSizes(),g=r.padding*2,m=Gn(this.labelRotation),p=Math.cos(m),y=Math.sin(m);if(a){const b=r.mirror?0:y*u.width+p*f.height;e.height=Math.min(this.maxHeight,e.height+b+g)}else{const b=r.mirror?0:p*u.width+y*f.height;e.width=Math.min(this.maxWidth,e.width+b+g)}this._calculatePadding(c,d,y,p)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,r,s){const{ticks:{align:o,padding:i},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,g=0;l?c?(f=s*e.width,g=r*n.height):(f=r*e.height,g=s*n.width):o==="start"?g=n.width:o==="end"?f=e.width:o!=="inner"&&(f=e.width/2,g=n.width/2),this.paddingLeft=Math.max((f-d+i)*this.width/(this.width-d),0),this.paddingRight=Math.max((g-u+i)*this.width/(this.width-u),0)}else{let d=n.height/2,u=e.height/2;o==="start"?(d=0,u=e.height):o==="end"&&(d=n.height,u=0),this.paddingTop=d+i,this.paddingBottom=u+i}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ht(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,r;for(n=0,r=e.length;n<r;n++)ct(e[n].label)&&(e.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=G0(r,n)),this._labelSizes=e=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,r){const{ctx:s,_longestTextCache:o}=this,i=[],a=[],l=Math.floor(n/W0(n,r));let c=0,d=0,u,f,g,m,p,y,b,S,x,E,k;for(u=0;u<n;u+=l){if(m=e[u].label,p=this._resolveTickFontOptions(u),s.font=y=p.string,b=o[y]=o[y]||{data:{},gc:[]},S=p.lineHeight,x=E=0,!ct(m)&&!_t(m))x=s0(s,b.data,b.gc,x,m),E=S;else if(_t(m))for(f=0,g=m.length;f<g;++f)k=m[f],!ct(k)&&!_t(k)&&(x=s0(s,b.data,b.gc,x,k),E+=S);i.push(x),a.push(E),c=Math.max(x,c),d=Math.max(E,d)}mO(o,n);const C=i.indexOf(c),N=a.indexOf(d),_=w=>({width:i[w]||0,height:a[w]||0});return{first:_(0),last:_(n-1),widest:_(C),highest:_(N),widths:i,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return xM(this._alignToPixels?Mr(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&e<n.length){const r=n[e];return r.$context||(r.$context=yO(this.getContext(),e,r))}return this.$context||(this.$context=bO(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=Gn(this.labelRotation),r=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),i=e.autoSkipPadding||0,a=o?o.widest.width+i:0,l=o?o.highest.height+i:0;return this.isHorizontal()?l*r>a*s?a/r:l/s:l*s<a*r?l/r:a/s}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,r=this.chart,s=this.options,{grid:o,position:i,border:a}=s,l=o.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),f=ko(o),g=[],m=a.setContext(this.getContext()),p=m.display?m.width:0,y=p/2,b=function(A){return Mr(r,A,p)};let S,x,E,k,C,N,_,w,M,O,L,$;if(i==="top")S=b(this.bottom),N=this.bottom-f,w=S-y,O=b(e.top)+y,$=e.bottom;else if(i==="bottom")S=b(this.top),O=e.top,$=b(e.bottom)-y,N=S+y,w=this.top+f;else if(i==="left")S=b(this.right),C=this.right-f,_=S-y,M=b(e.left)+y,L=e.right;else if(i==="right")S=b(this.left),M=e.left,L=b(e.right)-y,C=S+y,_=this.left+f;else if(n==="x"){if(i==="center")S=b((e.top+e.bottom)/2+.5);else if(Ze(i)){const A=Object.keys(i)[0],T=i[A];S=b(this.chart.scales[A].getPixelForValue(T))}O=e.top,$=e.bottom,N=S+y,w=N+f}else if(n==="y"){if(i==="center")S=b((e.left+e.right)/2);else if(Ze(i)){const A=Object.keys(i)[0],T=i[A];S=b(this.chart.scales[A].getPixelForValue(T))}C=S-y,_=C-f,M=e.left,L=e.right}const F=Qe(s.ticks.maxTicksLimit,u),D=Math.max(1,Math.ceil(u/F));for(x=0;x<u;x+=D){const A=this.getContext(x),T=o.setContext(A),V=a.setContext(A),H=T.lineWidth,W=T.color,j=V.dash||[],U=V.dashOffset,B=T.tickWidth,G=T.tickColor,z=T.tickBorderDash||[],K=T.tickBorderDashOffset;E=pO(this,x,l),E!==void 0&&(k=Mr(r,E,H),c?C=_=M=L=k:N=w=O=$=k,g.push({tx1:C,ty1:N,tx2:_,ty2:w,x1:M,y1:O,x2:L,y2:$,width:H,color:W,borderDash:j,borderDashOffset:U,tickWidth:B,tickColor:G,tickBorderDash:z,tickBorderDashOffset:K}))}return this._ticksLength=u,this._borderValue=S,g}_computeLabelItems(e){const n=this.axis,r=this.options,{position:s,ticks:o}=r,i=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:d,mirror:u}=o,f=ko(r.grid),g=f+d,m=u?-d:g,p=-Gn(this.labelRotation),y=[];let b,S,x,E,k,C,N,_,w,M,O,L,$="middle";if(s==="top")C=this.bottom-m,N=this._getXAxisLabelAlignment();else if(s==="bottom")C=this.top+m,N=this._getXAxisLabelAlignment();else if(s==="left"){const D=this._getYAxisLabelAlignment(f);N=D.textAlign,k=D.x}else if(s==="right"){const D=this._getYAxisLabelAlignment(f);N=D.textAlign,k=D.x}else if(n==="x"){if(s==="center")C=(e.top+e.bottom)/2+g;else if(Ze(s)){const D=Object.keys(s)[0],A=s[D];C=this.chart.scales[D].getPixelForValue(A)+g}N=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")k=(e.left+e.right)/2-g;else if(Ze(s)){const D=Object.keys(s)[0],A=s[D];k=this.chart.scales[D].getPixelForValue(A)}N=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(l==="start"?$="top":l==="end"&&($="bottom"));const F=this._getLabelSizes();for(b=0,S=a.length;b<S;++b){x=a[b],E=x.label;const D=o.setContext(this.getContext(b));_=this.getPixelForTick(b)+o.labelOffset,w=this._resolveTickFontOptions(b),M=w.lineHeight,O=_t(E)?E.length:1;const A=O/2,T=D.color,V=D.textStrokeColor,H=D.textStrokeWidth;let W=N;i?(k=_,N==="inner"&&(b===S-1?W=this.options.reverse?"left":"right":b===0?W=this.options.reverse?"right":"left":W="center"),s==="top"?c==="near"||p!==0?L=-O*M+M/2:c==="center"?L=-F.highest.height/2-A*M+M:L=-F.highest.height+M/2:c==="near"||p!==0?L=M/2:c==="center"?L=F.highest.height/2-A*M:L=F.highest.height-O*M,u&&(L*=-1),p!==0&&!D.showLabelBackdrop&&(k+=M/2*Math.sin(p))):(C=_,L=(1-O)*M/2);let j;if(D.showLabelBackdrop){const U=gn(D.backdropPadding),B=F.heights[b],G=F.widths[b];let z=L-U.top,K=0-U.left;switch($){case"middle":z-=B/2;break;case"bottom":z-=B;break}switch(N){case"center":K-=G/2;break;case"right":K-=G;break;case"inner":b===S-1?K-=G:b>0&&(K-=G/2);break}j={left:K,top:z,width:G+U.width,height:B+U.height,color:D.backdropColor}}y.push({label:E,font:w,textOffset:L,options:{rotation:p,color:T,strokeColor:V,strokeWidth:H,textAlign:W,textBaseline:$,translation:[k,C],backdrop:j}})}return y}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-Gn(this.labelRotation))return e==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:s,padding:o}}=this.options,i=this._getLabelSizes(),a=e+o,l=i.widest.width;let c,d;return n==="left"?s?(d=this.right+o,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,r==="near"?c="right":r==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,r==="near"?c="left":r==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:r,top:s,width:o,height:i}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,s,o,i),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===e);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,i;const a=(l,c,d)=>{!d.width||!d.color||(r.save(),r.lineWidth=d.width,r.strokeStyle=d.color,r.setLineDash(d.borderDash||[]),r.lineDashOffset=d.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,i=s.length;o<i;++o){const l=s[o];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:n,options:{border:r,grid:s}}=this,o=r.setContext(this.getContext()),i=r.display?o.width:0;if(!i)return;const a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,d,u,f;this.isHorizontal()?(c=Mr(e,this.left,i)-i/2,d=Mr(e,this.right,a)+a/2,u=f=l):(u=Mr(e,this.top,i)-i/2,f=Mr(e,this.bottom,a)+a/2,c=d=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,u),n.lineTo(d,f),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const r=this.ctx,s=this._computeLabelArea();s&&Xc(r,s);const o=this.getLabelItems(e);for(const i of o){const a=i.options,l=i.font,c=i.label,d=i.textOffset;po(r,c,0,d,l,a)}s&&Kc(r)}drawTitle(){const{ctx:e,options:{position:n,title:r,reverse:s}}=this;if(!r.display)return;const o=Ut(r.font),i=gn(r.padding),a=r.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||Ze(n)?(l+=i.bottom,_t(r.text)&&(l+=o.lineHeight*(r.text.length-1))):l+=i.top;const{titleX:c,titleY:d,maxWidth:u,rotation:f}=xO(this,l,n,a);po(e,r.text,0,0,o,{color:r.color,maxWidth:u,rotation:f,textAlign:vO(a,n,s),textBaseline:"middle",translation:[c,d]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,r=Qe(e.grid&&e.grid.z,-1),s=Qe(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==gs.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let o,i;for(o=0,i=n.length;o<i;++o){const a=n[o];a[r]===this.id&&(!e||a.type===e)&&s.push(a)}return s}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return Ut(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class ma{constructor(e,n,r){this.type=e,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let r;CO(n)&&(r=this.register(n));const s=this.items,o=e.id,i=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+e);return o in s||(s[o]=e,wO(e,i,r),this.override&&vt.override(e.id,e.overrides)),i}get(e){return this.items[e]}unregister(e){const n=this.items,r=e.id,s=this.scope;r in n&&delete n[r],s&&r in vt[s]&&(delete vt[s][r],this.override&&delete Er[r])}}function wO(t,e,n){const r=co(Object.create(null),[n?vt.get(n):{},vt.get(e),t.defaults]);vt.set(e,r),t.defaultRoutes&&kO(e,t.defaultRoutes),t.descriptors&&vt.describe(e,t.descriptors)}function kO(t,e){Object.keys(e).forEach(n=>{const r=n.split("."),s=r.pop(),o=[t].concat(r).join("."),i=e[n].split("."),a=i.pop(),l=i.join(".");vt.route(o,s,l,a)})}function CO(t){return"id"in t&&"defaults"in t}class SO{constructor(){this.controllers=new ma(hs,"datasets",!0),this.elements=new ma(Ar,"elements"),this.plugins=new ma(Object,"plugins"),this.scales=new ma(gs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,r){[...n].forEach(s=>{const o=r||this._getRegistryForType(s);r||o.isForType(s)||o===this.plugins&&s.id?this._exec(e,o,s):at(s,i=>{const a=r||this._getRegistryForType(i);this._exec(e,a,i)})})}_exec(e,n,r){const s=zc(e);ht(r["before"+s],[],r),n[e](r),ht(r["after"+s],[],r)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(e))return r}return this.plugins}_get(e,n,r){const s=n.get(e);if(s===void 0)throw new Error('"'+e+'" is not a registered '+r+".");return s}}var Fn=new SO;class _O{constructor(){this._init=void 0}notify(e,n,r,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install")),this._init===void 0)return;const o=s?this._descriptors(e).filter(s):this._descriptors(e),i=this._notify(o,e,n,r);return n==="afterDestroy"&&(this._notify(o,e,"stop"),this._notify(this._init,e,"uninstall"),this._init=void 0),i}_notify(e,n,r,s){s=s||{};for(const o of e){const i=o.plugin,a=i[r],l=[n,s,o.options];if(ht(a,l,i)===!1&&s.cancelable)return!1}return!0}invalidate(){ct(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const r=e&&e.config,s=Qe(r.options&&r.options.plugins,{}),o=EO(r);return s===!1&&!n?[]:NO(e,o,s,n)}_notifyStateChanges(e){const n=this._oldCache||[],r=this._cache,s=(o,i)=>o.filter(a=>!i.some(l=>a.plugin.id===l.plugin.id));this._notify(s(n,r),e,"stop"),this._notify(s(r,n),e,"start")}}function EO(t){const e={},n=[],r=Object.keys(Fn.plugins.items);for(let o=0;o<r.length;o++)n.push(Fn.getPlugin(r[o]));const s=t.plugins||[];for(let o=0;o<s.length;o++){const i=s[o];n.indexOf(i)===-1&&(n.push(i),e[i.id]=!0)}return{plugins:n,localIds:e}}function MO(t,e){return!e&&t===!1?null:t===!0?{}:t}function NO(t,{plugins:e,localIds:n},r,s){const o=[],i=t.getContext();for(const a of e){const l=a.id,c=MO(r[l],s);c!==null&&o.push({plugin:a,options:OO(t.config,{plugin:a,local:n[l]},c,i)})}return o}function OO(t,{plugin:e,local:n},r,s){const o=t.pluginScopeKeys(e),i=t.getOptionScopes(r,o);return n&&e.defaults&&i.push(e.defaults),t.createResolver(i,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function cd(t,e){const n=vt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function TO(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function AO(t,e){return t===e?"_index_":"_value_"}function X0(t){if(t==="x"||t==="y"||t==="r")return t}function DO(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function dd(t,...e){if(X0(t))return t;for(const n of e){const r=n.axis||DO(n.position)||t.length>1&&X0(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function K0(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function IO(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return K0(t,"x",n[0])||K0(t,"y",n[0])}return{}}function LO(t,e){const n=Er[t.type]||{scales:{}},r=e.scales||{},s=cd(t.type,e),o=Object.create(null);return Object.keys(r).forEach(i=>{const a=r[i];if(!Ze(a))return console.error(`Invalid scale configuration for scale: ${i}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const l=dd(i,a,IO(i,t),vt.scales[a.type]),c=AO(l,s),d=n.scales||{};o[i]=uo(Object.create(null),[{axis:l},a,d[l],d[c]])}),t.data.datasets.forEach(i=>{const a=i.type||t.type,l=i.indexAxis||cd(a,e),d=(Er[a]||{}).scales||{};Object.keys(d).forEach(u=>{const f=TO(u,l),g=i[f+"AxisID"]||f;o[g]=o[g]||Object.create(null),uo(o[g],[{axis:f},r[g],d[u]])})}),Object.keys(o).forEach(i=>{const a=o[i];uo(a,[vt.scales[a.type],vt.scale])}),o}function q0(t){const e=t.options||(t.options={});e.plugins=Qe(e.plugins,{}),e.scales=LO(t,e)}function Z0(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function PO(t){return t=t||{},t.data=Z0(t.data),q0(t),t}const Q0=new Map,J0=new Set;function ba(t,e){let n=Q0.get(t);return n||(n=e(),Q0.set(t,n),J0.add(n)),n}const Co=(t,e,n)=>{const r=Cr(e,n);r!==void 0&&t.add(r)};class $O{constructor(e){this._config=PO(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Z0(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),q0(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return ba(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return ba(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return ba(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return ba(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let s=r.get(e);return(!s||n)&&(s=new Map,r.set(e,s)),s}getOptionScopes(e,n,r){const{options:s,type:o}=this,i=this._cachedScopes(e,r),a=i.get(n);if(a)return a;const l=new Set;n.forEach(d=>{e&&(l.add(e),d.forEach(u=>Co(l,e,u))),d.forEach(u=>Co(l,s,u)),d.forEach(u=>Co(l,Er[o]||{},u)),d.forEach(u=>Co(l,vt,u)),d.forEach(u=>Co(l,Gc,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),J0.has(n)&&i.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,Er[n]||{},vt.datasets[n]||{},{type:n},vt,Gc]}resolveNamedOptions(e,n,r,s=[""]){const o={$shared:!0},{resolver:i,subPrefixes:a}=R0(this._resolverCache,e,s);let l=i;if(VO(i,n)){o.$shared=!1,r=or(r)?r():r;const c=this.createResolver(e,r,a);l=us(i,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(e,n,r=[""],s){const{resolver:o}=R0(this._resolverCache,e,r);return Ze(n)?us(o,n,void 0,s):o}}function R0(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const s=n.join();let o=r.get(s);return o||(o={resolver:Zc(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(s,o)),o}const FO=t=>Ze(t)&&Object.getOwnPropertyNames(t).some(e=>or(t[e]));function VO(t,e){const{isScriptable:n,isIndexable:r}=d0(t);for(const s of e){const o=n(s),i=r(s),a=(i||o)&&t[s];if(o&&(or(a)||FO(a))||i&&_t(a))return!0}return!1}var zO="4.5.1";const HO=["top","bottom","left","right","chartArea"];function em(t,e){return t==="top"||t==="bottom"||HO.indexOf(t)===-1&&e==="x"}function tm(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function nm(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),ht(n&&n.onComplete,[t],e)}function UO(t){const e=t.chart,n=e.options.animation;ht(n&&n.onProgress,[t],e)}function rm(t){return Rc()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const ya={},sm=t=>{const e=rm(t);return Object.values(ya).filter(n=>n.canvas===e).pop()};function BO(t,e,n){const r=Object.keys(t);for(const s of r){const o=+s;if(o>=e){const i=t[s];delete t[s],(n>0||o>e)&&(t[o+n]=i)}}}function jO(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}let So=(cr=class{static register(...e){Fn.add(...e),om()}static unregister(...e){Fn.remove(...e),om()}constructor(e,n){const r=this.config=new $O(n),s=rm(e),o=sm(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const i=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||aO(s)),this.platform.updateConfig(r);const a=this.platform.acquireContext(s,i.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=iM(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=i,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new _O,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=SM(u=>this.update(u),i.resizeDelay||0),this._dataChanges=[],ya[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Yn.listen(this,"complete",nm),Yn.listen(this,"progress",UO),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:s,_aspectRatio:o}=this;return ct(e)?n&&o?o:s?r/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return Fn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():m0(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return o0(this.canvas,this.ctx),this}stop(){return Yn.stop(this),this}resize(e,n){Yn.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,s=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,i=this.platform.getMaximumSize(s,e,n,o),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=i.width,this.height=i.height,this._aspectRatio=this.aspectRatio,m0(this,a,!0)&&(this.notifyPlugins("resize",{size:i}),ht(r.onResize,[this,i],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,s=Object.keys(r).reduce((i,a)=>(i[a]=!1,i),{});let o=[];n&&(o=o.concat(Object.keys(n).map(i=>{const a=n[i],l=dd(i,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),at(o,i=>{const a=i.options,l=a.id,c=dd(l,a),d=Qe(a.type,i.dtype);(a.position===void 0||em(a.position,c)!==em(i.dposition))&&(a.position=i.dposition),s[l]=!0;let u=null;if(l in r&&r[l].type===d)u=r[l];else{const f=Fn.getScale(d);u=new f({id:l,type:d,ctx:this.ctx,chart:this}),r[u.id]=u}u.init(a,e)}),at(s,(i,a)=>{i||delete r[a]}),at(r,i=>{pn.configure(this,i,i.options),pn.addBox(this,i)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((s,o)=>s.index-o.index),r>n){for(let s=n;s<r;++s)this._destroyDatasetMeta(s);e.splice(n,r-n)}this._sortedMetasets=e.slice(0).sort(tm("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((r,s)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r<s;r++){const o=n[r];let i=this.getDatasetMeta(r);const a=o.type||this.config.type;if(i.type&&i.type!==a&&(this._destroyDatasetMeta(r),i=this.getDatasetMeta(r)),i.type=a,i.indexAxis=o.indexAxis||cd(a,this.options),i.order=o.order||0,i.index=r,i.label=""+o.label,i.visible=this.isDatasetVisible(r),i.controller)i.controller.updateIndex(r),i.controller.linkScales();else{const l=Fn.getController(a),{datasetElementType:c,dataElementType:d}=vt.datasets[a];Object.assign(l,{dataElementType:Fn.getElement(d),datasetElementType:c&&Fn.getElement(c)}),i.controller=new l(this,r),e.push(i.controller)}}return this._updateMetasets(),e}_resetElements(){at(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let c=0,d=this.data.datasets.length;c<d;c++){const{controller:u}=this.getDatasetMeta(c),f=!s&&o.indexOf(u)===-1;u.buildOrUpdateElements(f),i=Math.max(+u.getMaxOverflow(),i)}i=this._minPadding=r.layout.autoPadding?i:0,this._updateLayout(i),s||at(o,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(tm("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,e=>{pn.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!Up(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:o}of n){const i=r==="_removeElements"?-o:o;BO(e,s,i)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(e.filter(i=>i[0]===o).map((i,a)=>a+","+i.splice(1).join(","))),s=r(0);for(let o=1;o<n;o++)if(!Up(s,r(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;pn.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,or(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const r=this.getDatasetMeta(e),s={meta:r,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(r.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Yn.has(this)?this.attached&&!Yn.running(this)&&Yn.start(this):(this.draw(),nm({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:r,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,r=[];let s,o;for(s=0,o=n.length;s<o;++s){const i=n[s];(!e||i.visible)&&r.push(i)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r={meta:e,index:e.index,cancelable:!0},s=cN(this,e);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&Xc(n,s),e.controller.draw(),s&&Kc(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return l0(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,s){const o=HN.modes[n];return typeof o=="function"?o(this,e,r,s):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let s=r.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},r.push(s)),s}getContext(){return this.$context||(this.$context=ds(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const s=r?"show":"hide",o=this.getDatasetMeta(e),i=o.controller._resolveAnimations(void 0,s);fo(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),i.update(o,{visible:r}),this.update(a=>a.datasetIndex===e?s:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),Yn.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),o0(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete ya[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,r=(o,i)=>{n.addEventListener(this,o,i),e[o]=i},s=(o,i,a)=>{o.offsetX=i,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>r(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),e[l]=c},s=(l,c)=>{e[l]&&(n.removeEventListener(this,l,c),delete e[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let i;const a=()=>{s("attach",a),this.attached=!0,this.resize(),r("resize",o),r("detach",i)};i=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():i()}unbindEvents(){at(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},at(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const s=r?"set":"remove";let o,i,a,l;for(n==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=e.length;a<l;++a){i=e[a];const c=i&&this.getDatasetMeta(i.datasetIndex).controller;c&&c[s+"HoverStyle"](i.element,i.datasetIndex,i.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],r=e.map(({datasetIndex:o,index:i})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[i],index:i}});!Ji(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),i=o(n,e),a=r?e:o(e,n);i.length&&this.updateHoverStyle(i,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},s=i=>(i.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const o=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(o||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:s=[],options:o}=this,i=n,a=this._getActiveElements(e,s,r,i),l=fM(e),c=jO(e,this._lastEvent,r,l);r&&(this._lastEvent=null,ht(o.onHover,[e,a,this],this),l&&ht(o.onClick,[e,a,this],this));const d=!Ji(a,s);return(d||n)&&(this._active=a,this._updateHoverStyles(a,s,n)),this._lastEvent=c,d}_getActiveElements(e,n,r,s){if(e.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,s)}},$e(cr,"defaults",vt),$e(cr,"instances",ya),$e(cr,"overrides",Er),$e(cr,"registry",Fn),$e(cr,"version",zO),$e(cr,"getChart",sm),cr);function om(){return at(So.instances,t=>t._plugins.invalidate())}function WO(t,e,n){const{startAngle:r,x:s,y:o,outerRadius:i,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,u=Math.min(c/i,$n(r-n));if(t.beginPath(),t.arc(s,o,i-c/2,r+u/2,n-u/2),a>0){const f=Math.min(c/a,$n(r-n));t.arc(s,o,a+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,i*$n(r-n));if(d==="round")t.arc(s,o,f,n-dt/2,r+dt/2,!0);else if(d==="bevel"){const g=2*f*f,m=-g*Math.cos(n+dt/2)+s,p=-g*Math.sin(n+dt/2)+o,y=g*Math.cos(r+dt/2)+s,b=g*Math.sin(r+dt/2)+o;t.lineTo(m,p),t.lineTo(y,b)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}function GO(t,e,n){const{startAngle:r,pixelMargin:s,x:o,y:i,outerRadius:a,innerRadius:l}=e;let c=s/a;t.beginPath(),t.arc(o,i,a,r-c,n+c),l>s?(c=s/l,t.arc(o,i,l,n+c,r-c,!0)):t.arc(o,i,s,n+Et,r-Et),t.closePath(),t.clip()}function YO(t){return qc(t,["outerStart","outerEnd","innerStart","innerEnd"])}function XO(t,e,n,r){const s=YO(t.options.borderRadius),o=(n-e)/2,i=Math.min(o,r*e/2),a=l=>{const c=(n-Math.min(o,l))*r/2;return Zt(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:Zt(s.innerStart,0,i),innerEnd:Zt(s.innerEnd,0,i)}}function ps(t,e,n,r){return{x:n+t*Math.cos(e),y:r+t*Math.sin(e)}}function va(t,e,n,r,s,o){const{x:i,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,u=Math.max(e.outerRadius+r+n-c,0),f=d>0?d+r+n+c:0;let g=0;const m=s-l;if(r){const D=d>0?d-r:0,A=u>0?u-r:0,T=(D+A)/2,V=T!==0?m*T/(T+r):m;g=(m-V)/2}const p=Math.max(.001,m*u-n/dt)/u,y=(m-p)/2,b=l+y+g,S=s-y-g,{outerStart:x,outerEnd:E,innerStart:k,innerEnd:C}=XO(e,f,u,S-b),N=u-x,_=u-E,w=b+x/N,M=S-E/_,O=f+k,L=f+C,$=b+k/O,F=S-C/L;if(t.beginPath(),o){const D=(w+M)/2;if(t.arc(i,a,u,w,D),t.arc(i,a,u,D,M),E>0){const H=ps(_,M,i,a);t.arc(H.x,H.y,E,M,S+Et)}const A=ps(L,S,i,a);if(t.lineTo(A.x,A.y),C>0){const H=ps(L,F,i,a);t.arc(H.x,H.y,C,S+Et,F+Math.PI)}const T=(S-C/f+(b+k/f))/2;if(t.arc(i,a,f,S-C/f,T,!0),t.arc(i,a,f,T,b+k/f,!0),k>0){const H=ps(O,$,i,a);t.arc(H.x,H.y,k,$+Math.PI,b-Et)}const V=ps(N,b,i,a);if(t.lineTo(V.x,V.y),x>0){const H=ps(N,w,i,a);t.arc(H.x,H.y,x,b-Et,w)}}else{t.moveTo(i,a);const D=Math.cos(w)*u+i,A=Math.sin(w)*u+a;t.lineTo(D,A);const T=Math.cos(M)*u+i,V=Math.sin(M)*u+a;t.lineTo(T,V)}t.closePath()}function KO(t,e,n,r,s){const{fullCircles:o,startAngle:i,circumference:a}=e;let l=e.endAngle;if(o){va(t,e,n,r,l,s);for(let c=0;c<o;++c)t.fill();isNaN(a)||(l=i+(a%Ct||Ct))}return va(t,e,n,r,l,s),t.fill(),l}function qO(t,e,n,r,s){const{fullCircles:o,startAngle:i,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:d,borderDash:u,borderDashOffset:f,borderRadius:g}=l,m=l.borderAlign==="inner";if(!c)return;t.setLineDash(u||[]),t.lineDashOffset=f,m?(t.lineWidth=c*2,t.lineJoin=d||"round"):(t.lineWidth=c,t.lineJoin=d||"bevel");let p=e.endAngle;if(o){va(t,e,n,r,p,s);for(let y=0;y<o;++y)t.stroke();isNaN(a)||(p=i+(a%Ct||Ct))}m&&GO(t,e,p),l.selfJoin&&p-i>=dt&&g===0&&d!=="miter"&&WO(t,e,p),o||(va(t,e,n,r,p,s),t.stroke())}class _o extends Ar{constructor(n){super();$e(this,"circumference");$e(this,"endAngle");$e(this,"fullCircles");$e(this,"innerRadius");$e(this,"outerRadius");$e(this,"pixelMargin");$e(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,s){const o=this.getProps(["x","y"],s),{angle:i,distance:a}=Yp(o,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:u,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),g=(this.options.spacing+this.options.borderWidth)/2,m=Qe(f,c-l),p=ra(i,l,c)&&l!==c,y=m>=Ct||p,b=_r(a,d+g,u+g);return y&&b}getCenterPoint(n){const{x:r,y:s,startAngle:o,endAngle:i,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(o+i)/2,f=(a+l+d+c)/2;return{x:r+Math.cos(u)*f,y:s+Math.sin(u)*f}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:s}=this,o=(r.offset||0)/4,i=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=s>Ct?Math.floor(s/Ct):0,s===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(dt,s||0)),d=o*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,KO(n,this,d,i,a),qO(n,this,d,i,a),n.restore()}}$e(_o,"id","arc"),$e(_o,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),$e(_o,"defaultRoutes",{backgroundColor:"backgroundColor"}),$e(_o,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function im(t,e){const{x:n,y:r,base:s,width:o,height:i}=t.getProps(["x","y","base","width","height"],e);let a,l,c,d,u;return t.horizontal?(u=i/2,a=Math.min(n,s),l=Math.max(n,s),c=r-u,d=r+u):(u=o/2,a=n-u,l=n+u,c=Math.min(r,s),d=Math.max(r,s)),{left:a,top:c,right:l,bottom:d}}function lr(t,e,n,r){return t?0:Zt(e,n,r)}function ZO(t,e,n){const r=t.options.borderWidth,s=t.borderSkipped,o=c0(r);return{t:lr(s.top,o.top,0,n),r:lr(s.right,o.right,0,e),b:lr(s.bottom,o.bottom,0,n),l:lr(s.left,o.left,0,e)}}function QO(t,e,n){const{enableBorderRadius:r}=t.getProps(["enableBorderRadius"]),s=t.options.borderRadius,o=cs(s),i=Math.min(e,n),a=t.borderSkipped,l=r||Ze(s);return{topLeft:lr(!l||a.top||a.left,o.topLeft,0,i),topRight:lr(!l||a.top||a.right,o.topRight,0,i),bottomLeft:lr(!l||a.bottom||a.left,o.bottomLeft,0,i),bottomRight:lr(!l||a.bottom||a.right,o.bottomRight,0,i)}}function JO(t){const e=im(t),n=e.right-e.left,r=e.bottom-e.top,s=ZO(t,n/2,r/2),o=QO(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r,radius:o},inner:{x:e.left+s.l,y:e.top+s.t,w:n-s.l-s.r,h:r-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function ud(t,e,n,r){const s=e===null,o=n===null,a=t&&!(s&&o)&&im(t,r);return a&&(s||_r(e,a.left,a.right))&&(o||_r(n,a.top,a.bottom))}function RO(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function e5(t,e){t.rect(e.x,e.y,e.w,e.h)}function fd(t,e,n={}){const r=t.x!==n.x?-e:0,s=t.y!==n.y?-e:0,o=(t.x+t.w!==n.x+n.w?e:0)-r,i=(t.y+t.h!==n.y+n.h?e:0)-s;return{x:t.x+r,y:t.y+s,w:t.w+o,h:t.h+i,radius:t.radius}}class xa extends Ar{constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:r,backgroundColor:s}}=this,{inner:o,outer:i}=JO(this),a=RO(i.radius)?oa:e5;e.save(),(i.w!==o.w||i.h!==o.h)&&(e.beginPath(),a(e,fd(i,n,o)),e.clip(),a(e,fd(o,-n,i)),e.fillStyle=r,e.fill("evenodd")),e.beginPath(),a(e,fd(o,n)),e.fillStyle=s,e.fill(),e.restore()}inRange(e,n,r){return ud(this,e,n,r)}inXRange(e,n){return ud(this,e,null,n)}inYRange(e,n){return ud(this,null,e,n)}getCenterPoint(e){const{x:n,y:r,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{x:o?(n+s)/2:n,y:o?r:(r+s)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}$e(xa,"id","bar"),$e(xa,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),$e(xa,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const am=(t,e)=>{let{boxHeight:n=e,boxWidth:r=e}=t;return t.usePointStyle&&(n=Math.min(n,e),r=t.pointStyleWidth||Math.min(r,e)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(e,n)}},t5=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class lm extends Ar{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,r){this.maxWidth=e,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=ht(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(r=>e.filter(r,this.chart.data))),e.sort&&(n=n.sort((r,s)=>e.sort(r,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const r=e.labels,s=Ut(r.font),o=s.size,i=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=am(r,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(i,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(i,s,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,n,r,s){const{ctx:o,maxWidth:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a;let u=e;o.textAlign="left",o.textBaseline="middle";let f=-1,g=-d;return this.legendItems.forEach((m,p)=>{const y=r+n/2+o.measureText(m.text).width;(p===0||c[c.length-1]+y+2*a>i)&&(u+=d,c[c.length-(p>0?0:1)]=0,g+=d,f++),l[p]={left:0,top:g,row:f,width:y,height:s},c[c.length-1]+=y+a}),u}_fitCols(e,n,r,s){const{ctx:o,maxHeight:i,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=i-e;let u=a,f=0,g=0,m=0,p=0;return this.legendItems.forEach((y,b)=>{const{itemWidth:S,itemHeight:x}=n5(r,n,o,y,s);b>0&&g+x+2*a>d&&(u+=f+a,c.push({width:f,height:g}),m+=f+a,p++,f=g=0),l[b]={left:m,top:g,col:p,width:S,height:x},f=Math.max(f,S),g+=x+a}),u+=f,c.push({width:f,height:g}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:s},rtl:o}}=this,i=fs(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ht(r,this.left+s,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Ht(r,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+e+s,c.left=i.leftForLtr(i.x(l),c.width),l+=c.width+s}else{let a=0,l=Ht(r,this.top+e+s,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Ht(r,this.top+e+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=i.leftForLtr(i.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;Xc(e,this),this._draw(),Kc(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:r,ctx:s}=this,{align:o,labels:i}=e,a=vt.color,l=fs(e.rtl,this.left,this.width),c=Ut(i.font),{padding:d}=i,u=c.size,f=u/2;let g;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:p,itemHeight:y}=am(i,u),b=function(C,N,_){if(isNaN(m)||m<=0||isNaN(p)||p<0)return;s.save();const w=Qe(_.lineWidth,1);if(s.fillStyle=Qe(_.fillStyle,a),s.lineCap=Qe(_.lineCap,"butt"),s.lineDashOffset=Qe(_.lineDashOffset,0),s.lineJoin=Qe(_.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=Qe(_.strokeStyle,a),s.setLineDash(Qe(_.lineDash,[])),i.usePointStyle){const M={radius:p*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:w},O=l.xPlus(C,m/2),L=N+f;a0(s,M,O,L,i.pointStyleWidth&&m)}else{const M=N+Math.max((u-p)/2,0),O=l.leftForLtr(C,m),L=cs(_.borderRadius);s.beginPath(),Object.values(L).some($=>$!==0)?oa(s,{x:O,y:M,w:m,h:p,radius:L}):s.rect(O,M,m,p),s.fill(),w!==0&&s.stroke()}s.restore()},S=function(C,N,_){po(s,_.text,C,N+y/2,c,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},x=this.isHorizontal(),E=this._computeTitleHeight();x?g={x:Ht(o,this.left+d,this.right-r[0]),y:this.top+d+E,line:0}:g={x:this.left+d,y:Ht(o,this.top+E+d,this.bottom-n[0].height),line:0},y0(this.ctx,e.textDirection);const k=y+d;this.legendItems.forEach((C,N)=>{s.strokeStyle=C.fontColor,s.fillStyle=C.fontColor;const _=s.measureText(C.text).width,w=l.textAlign(C.textAlign||(C.textAlign=i.textAlign)),M=m+f+_;let O=g.x,L=g.y;l.setWidth(this.width),x?N>0&&O+M+d>this.right&&(L=g.y+=k,g.line++,O=g.x=Ht(o,this.left+d,this.right-r[g.line])):N>0&&L+k>this.bottom&&(O=g.x=O+n[g.line].width+d,g.line++,L=g.y=Ht(o,this.top+E+d,this.bottom-n[g.line].height));const $=l.x(O);if(b($,L,C),O=_M(w,O+m+f,x?O+M:this.right,e.rtl),S(l.x(O),L,C),x)g.x+=M+d;else if(typeof C.text!="string"){const F=c.lineHeight;g.y+=cm(C,F)+d}else g.y+=k}),v0(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,r=Ut(n.font),s=gn(n.padding);if(!n.display)return;const o=fs(e.rtl,this.left,this.width),i=this.ctx,a=n.position,l=r.size/2,c=s.top+l;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=Ht(e.align,u,this.right-f);else{const m=this.columnSizes.reduce((p,y)=>Math.max(p,y.height),0);d=c+Ht(e.align,this.top,this.bottom-m-e.labels.padding-this._computeTitleHeight())}const g=Ht(a,u,u+f);i.textAlign=o.textAlign(Bc(a)),i.textBaseline="middle",i.strokeStyle=n.color,i.fillStyle=n.color,i.font=r.string,po(i,n.text,g,d,r)}_computeTitleHeight(){const e=this.options.title,n=Ut(e.font),r=gn(e.padding);return e.display?n.lineHeight+r.height:0}_getLegendItemAt(e,n){let r,s,o;if(_r(e,this.left,this.right)&&_r(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;r<o.length;++r)if(s=o[r],_r(e,s.left,s.left+s.width)&&_r(n,s.top,s.top+s.height))return this.legendItems[r]}return null}handleEvent(e){const n=this.options;if(!o5(e.type,n))return;const r=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const s=this._hoveredItem,o=t5(s,r);s&&!o&&ht(n.onLeave,[e,s,this],this),this._hoveredItem=r,r&&!o&&ht(n.onHover,[e,r,this],this)}else r&&ht(n.onClick,[e,r,this],this)}}function n5(t,e,n,r,s){const o=r5(r,t,e,n),i=s5(s,r,e.lineHeight);return{itemWidth:o,itemHeight:i}}function r5(t,e,n,r){let s=t.text;return s&&typeof s!="string"&&(s=s.reduce((o,i)=>o.length>i.length?o:i)),e+n.size/2+r.measureText(s).width}function s5(t,e,n){let r=t;return typeof e.text!="string"&&(r=cm(e,n)),r}function cm(t,e){const n=t.text?t.text.length:0;return e*n}function o5(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var dm={id:"legend",_element:lm,start(t,e,n){const r=t.legend=new lm({ctx:t.ctx,options:n,chart:t});pn.configure(t,r,n),pn.addBox(t,r)},stop(t){pn.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const r=t.legend;pn.configure(t,r,n),r.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const r=e.datasetIndex,s=n.chart;s.isDatasetVisible(r)?(s.hide(r),e.hidden=!0):(s.show(r),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:s,color:o,useBorderRadius:i,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=gn(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:i&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class um extends Ar{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const s=_t(r.text)?r.text.length:1;this._padding=gn(r.padding);const o=s*Ut(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:r,bottom:s,right:o,options:i}=this,a=i.align;let l=0,c,d,u;return this.isHorizontal()?(d=Ht(a,r,o),u=n+e,c=o-r):(i.position==="left"?(d=r+e,u=Ht(a,s,n),l=dt*-.5):(d=o-e,u=Ht(a,n,s),l=dt*.5),c=s-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const r=Ut(n.font),o=r.lineHeight/2+this._padding.top,{titleX:i,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);po(e,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:Bc(n.align),textBaseline:"middle",translation:[i,a]})}}function i5(t,e){const n=new um({ctx:t.ctx,options:e,chart:t});pn.configure(t,n,e),pn.addBox(t,n),t.titleBlock=n}var a5={id:"title",_element:um,start(t,e,n){i5(t,n)},stop(t){const e=t.titleBlock;pn.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const r=t.titleBlock;pn.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Eo={average(t){if(!t.length)return!1;let e,n,r=new Set,s=0,o=0;for(e=0,n=t.length;e<n;++e){const a=t[e].element;if(a&&a.hasValue()){const l=a.tooltipPosition();r.add(l.x),s+=l.y,++o}}return o===0||r.size===0?!1:{x:[...r].reduce((a,l)=>a+l)/r.size,y:s/o}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,s=Number.POSITIVE_INFINITY,o,i,a;for(o=0,i=t.length;o<i;++o){const l=t[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),d=vM(e,c);d<s&&(s=d,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function Vn(t,e){return e&&(_t(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Xn(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
|
||
`)>-1?t.split(`
|
||
`):t}function l5(t,e){const{element:n,datasetIndex:r,index:s}=e,o=t.getDatasetMeta(r).controller,{label:i,value:a}=o.getLabelAndValue(s);return{chart:t,label:i,parsed:o.getParsed(s),raw:t.data.datasets[r].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function fm(t,e){const n=t.chart.ctx,{body:r,footer:s,title:o}=t,{boxWidth:i,boxHeight:a}=e,l=Ut(e.bodyFont),c=Ut(e.titleFont),d=Ut(e.footerFont),u=o.length,f=s.length,g=r.length,m=gn(e.padding);let p=m.height,y=0,b=r.reduce((E,k)=>E+k.before.length+k.lines.length+k.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(p+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){const E=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=g*E+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(p+=e.footerMarginTop+f*d.lineHeight+(f-1)*e.footerSpacing);let S=0;const x=function(E){y=Math.max(y,n.measureText(E).width+S)};return n.save(),n.font=c.string,at(t.title,x),n.font=l.string,at(t.beforeBody.concat(t.afterBody),x),S=e.displayColors?i+2+e.boxPadding:0,at(r,E=>{at(E.before,x),at(E.lines,x),at(E.after,x)}),S=0,n.font=d.string,at(t.footer,x),n.restore(),y+=m.width,{width:y,height:p}}function c5(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function d5(t,e,n,r){const{x:s,width:o}=r,i=n.caretSize+n.caretPadding;if(t==="left"&&s+o+i>e.width||t==="right"&&s-o-i<0)return!0}function u5(t,e,n,r){const{x:s,width:o}=n,{width:i,chartArea:{left:a,right:l}}=t;let c="center";return r==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=i-o/2&&(c="right"),d5(c,t,e,n)&&(c="center"),c}function hm(t,e,n){const r=n.yAlign||e.yAlign||c5(t,n);return{xAlign:n.xAlign||e.xAlign||u5(t,e,n,r),yAlign:r}}function f5(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function h5(t,e,n){let{y:r,height:s}=t;return e==="top"?r+=n:e==="bottom"?r-=s+n:r-=s/2,r}function gm(t,e,n,r){const{caretSize:s,caretPadding:o,cornerRadius:i}=t,{xAlign:a,yAlign:l}=n,c=s+o,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=cs(i);let m=f5(e,a);const p=h5(e,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(d,f)+s:a==="right"&&(m+=Math.max(u,g)+s),{x:Zt(m,0,r.width-e.width),y:Zt(p,0,r.height-e.height)}}function wa(t,e,n){const r=gn(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function pm(t){return Vn([],Xn(t))}function g5(t,e,n){return ds(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function mm(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const bm={beforeTitle:Wn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:Wn,beforeBody:Wn,beforeLabel:Wn,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return ct(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Wn,afterBody:Wn,beforeFooter:Wn,footer:Wn,afterFooter:Wn};function Qt(t,e,n,r){const s=t[e].call(n,r);return typeof s>"u"?bm[e].call(n,r):s}class hd extends Ar{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,o=new w0(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=g5(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,s=Qt(r,"beforeTitle",this,e),o=Qt(r,"title",this,e),i=Qt(r,"afterTitle",this,e);let a=[];return a=Vn(a,Xn(s)),a=Vn(a,Xn(o)),a=Vn(a,Xn(i)),a}getBeforeBody(e,n){return pm(Qt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,s=[];return at(e,o=>{const i={before:[],lines:[],after:[]},a=mm(r,o);Vn(i.before,Xn(Qt(a,"beforeLabel",this,o))),Vn(i.lines,Qt(a,"label",this,o)),Vn(i.after,Xn(Qt(a,"afterLabel",this,o))),s.push(i)}),s}getAfterBody(e,n){return pm(Qt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,s=Qt(r,"beforeFooter",this,e),o=Qt(r,"footer",this,e),i=Qt(r,"afterFooter",this,e);let a=[];return a=Vn(a,Xn(s)),a=Vn(a,Xn(o)),a=Vn(a,Xn(i)),a}_createItems(e){const n=this._active,r=this.chart.data,s=[],o=[],i=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(l5(this.chart,n[l]));return e.filter&&(a=a.filter((d,u,f)=>e.filter(d,u,f,r))),e.itemSort&&(a=a.sort((d,u)=>e.itemSort(d,u,r))),at(a,d=>{const u=mm(e.callbacks,d);s.push(Qt(u,"labelColor",this,d)),o.push(Qt(u,"labelPointStyle",this,d)),i.push(Qt(u,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=i,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),s=this._active;let o,i=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Eo[r.position].call(this,s,this._eventPosition);i=this._createItems(r),this.title=this.getTitle(i,r),this.beforeBody=this.getBeforeBody(i,r),this.body=this.getBody(i,r),this.afterBody=this.getAfterBody(i,r),this.footer=this.getFooter(i,r);const l=this._size=fm(this,r),c=Object.assign({},a,l),d=hm(this.chart,r,c),u=gm(r,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=i,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,s){const o=this.getCaretPosition(e,r,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(e,n,r){const{xAlign:s,yAlign:o}=this,{caretSize:i,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=cs(a),{x:f,y:g}=e,{width:m,height:p}=n;let y,b,S,x,E,k;return o==="center"?(E=g+p/2,s==="left"?(y=f,b=y-i,x=E+i,k=E-i):(y=f+m,b=y+i,x=E-i,k=E+i),S=y):(s==="left"?b=f+Math.max(l,d)+i:s==="right"?b=f+m-Math.max(c,u)-i:b=this.caretX,o==="top"?(x=g,E=x-i,y=b-i,S=b+i):(x=g+p,E=x+i,y=b+i,S=b-i),k=x),{x1:y,x2:b,x3:S,y1:x,y2:E,y3:k}}drawTitle(e,n,r){const s=this.title,o=s.length;let i,a,l;if(o){const c=fs(r.rtl,this.x,this.width);for(e.x=wa(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",i=Ut(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=i.string,l=0;l<o;++l)n.fillText(s[l],c.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+a,l+1===o&&(e.y+=r.titleMarginBottom-a)}}_drawColorBox(e,n,r,s,o){const i=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=o,d=Ut(o.bodyFont),u=wa(this,"left",o),f=s.x(u),g=l<d.lineHeight?(d.lineHeight-l)/2:0,m=n.y+g;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},y=s.leftForLtr(f,c)+c/2,b=m+l/2;e.strokeStyle=o.multiKeyBackground,e.fillStyle=o.multiKeyBackground,i0(e,p,y,b),e.strokeStyle=i.borderColor,e.fillStyle=i.backgroundColor,i0(e,p,y,b)}else{e.lineWidth=Ze(i.borderWidth)?Math.max(...Object.values(i.borderWidth)):i.borderWidth||1,e.strokeStyle=i.borderColor,e.setLineDash(i.borderDash||[]),e.lineDashOffset=i.borderDashOffset||0;const p=s.leftForLtr(f,c),y=s.leftForLtr(s.xPlus(f,1),c-2),b=cs(i.borderRadius);Object.values(b).some(S=>S!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,oa(e,{x:p,y:m,w:c,h:l,radius:b}),e.fill(),e.stroke(),e.fillStyle=i.backgroundColor,e.beginPath(),oa(e,{x:y,y:m+1,w:c-2,h:l-2,radius:b}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(p,m,c,l),e.strokeRect(p,m,c,l),e.fillStyle=i.backgroundColor,e.fillRect(y,m+1,c-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:s}=this,{bodySpacing:o,bodyAlign:i,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=r,u=Ut(r.bodyFont);let f=u.lineHeight,g=0;const m=fs(r.rtl,this.x,this.width),p=function(_){n.fillText(_,m.x(e.x+g),e.y+f/2),e.y+=f+o},y=m.textAlign(i);let b,S,x,E,k,C,N;for(n.textAlign=i,n.textBaseline="middle",n.font=u.string,e.x=wa(this,y,r),n.fillStyle=r.bodyColor,at(this.beforeBody,p),g=a&&y!=="right"?i==="center"?c/2+d:c+2+d:0,E=0,C=s.length;E<C;++E){for(b=s[E],S=this.labelTextColors[E],n.fillStyle=S,at(b.before,p),x=b.lines,a&&x.length&&(this._drawColorBox(n,e,E,m,r),f=Math.max(u.lineHeight,l)),k=0,N=x.length;k<N;++k)p(x[k]),f=u.lineHeight;at(b.after,p)}g=0,f=u.lineHeight,at(this.afterBody,p),e.y-=o}drawFooter(e,n,r){const s=this.footer,o=s.length;let i,a;if(o){const l=fs(r.rtl,this.x,this.width);for(e.x=wa(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",i=Ut(r.footerFont),n.fillStyle=r.footerColor,n.font=i.string,a=0;a<o;++a)n.fillText(s[a],l.x(e.x),e.y+i.lineHeight/2),e.y+=i.lineHeight+r.footerSpacing}}drawBackground(e,n,r,s){const{xAlign:o,yAlign:i}=this,{x:a,y:l}=e,{width:c,height:d}=r,{topLeft:u,topRight:f,bottomLeft:g,bottomRight:m}=cs(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(a+u,l),i==="top"&&this.drawCaret(e,n,r,s),n.lineTo(a+c-f,l),n.quadraticCurveTo(a+c,l,a+c,l+f),i==="center"&&o==="right"&&this.drawCaret(e,n,r,s),n.lineTo(a+c,l+d-m),n.quadraticCurveTo(a+c,l+d,a+c-m,l+d),i==="bottom"&&this.drawCaret(e,n,r,s),n.lineTo(a+g,l+d),n.quadraticCurveTo(a,l+d,a,l+d-g),i==="center"&&o==="left"&&this.drawCaret(e,n,r,s),n.lineTo(a,l+u),n.quadraticCurveTo(a,l,a+u,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,s=r&&r.x,o=r&&r.y;if(s||o){const i=Eo[e.position].call(this,this._active,this._eventPosition);if(!i)return;const a=this._size=fm(this,e),l=Object.assign({},i,this._size),c=hm(n,e,l),d=gm(e,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const i=gn(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(o,e,s,n),y0(e,n.textDirection),o.y+=i.top,this.drawTitle(o,e,n),this.drawBody(o,e,n),this.drawFooter(o,e,n),v0(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,s=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ji(r,s),i=this._positionChanged(s,n);(o||i)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],i=this._getActiveElements(e,o,n,r),a=this._positionChanged(i,e),l=n||!Ji(i,o)||a;return l&&(this._active=i,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,s){const o=this.options;if(e.type==="mouseout")return[];if(!s)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const i=this.chart.getElementsAtEventForMode(e,o.mode,o,r);return o.reverse&&i.reverse(),i}_positionChanged(e,n){const{caretX:r,caretY:s,options:o}=this,i=Eo[o.position].call(this,e,n);return i!==!1&&(r!==i.x||s!==i.y)}}$e(hd,"positioners",Eo);var ym={id:"tooltip",_element:hd,positioners:Eo,afterInit(t,e,n){n&&(t.tooltip=new hd({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:bm},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const p5=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function m5(t,e,n,r){const s=t.indexOf(e);if(s===-1)return p5(t,e,n,r);const o=t.lastIndexOf(e);return s!==o?n:s}const b5=(t,e)=>t===null?null:Zt(Math.round(t),0,e);function vm(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class gd extends gs{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:s,label:o}of n)r[s]===o&&r.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(ct(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:m5(r,e,Qe(n,e),this._addedLabels),b5(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(s=this.getLabels().length-1)),this.min=r,this.max=s}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,s=[];let o=this.getLabels();o=e===0&&n===o.length-1?o:o.slice(e,n+1),this._valueRange=Math.max(o.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let i=e;i<=n;i++)s.push({value:i});return s}getLabelForValue(e){return vm.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}$e(gd,"id","category"),$e(gd,"defaults",{ticks:{callback:vm}});function y5(t,e){const n=[],{bounds:s,step:o,min:i,max:a,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:f}=t,g=o||1,m=d-1,{min:p,max:y}=e,b=!ct(i),S=!ct(a),x=!ct(c),E=(y-p)/(u+1);let k=Wp((y-p)/m/g)*g,C,N,_,w;if(k<1e-14&&!b&&!S)return[{value:p},{value:y}];w=Math.ceil(y/k)-Math.floor(p/k),w>m&&(k=Wp(w*k/m/g)*g),ct(l)||(C=Math.pow(10,l),k=Math.ceil(k*C)/C),s==="ticks"?(N=Math.floor(p/k)*k,_=Math.ceil(y/k)*k):(N=p,_=y),b&&S&&o&&mM((a-i)/o,k/1e3)?(w=Math.round(Math.min((a-i)/k,d)),k=(a-i)/w,N=i,_=a):x?(N=b?i:N,_=S?a:_,w=c-1,k=(_-N)/w):(w=(_-N)/k,ta(w,Math.round(w),k/1e3)?w=Math.round(w):w=Math.ceil(w));const M=Math.max(Gp(k),Gp(N));C=Math.pow(10,ct(l)?M:l),N=Math.round(N*C)/C,_=Math.round(_*C)/C;let O=0;for(b&&(f&&N!==i?(n.push({value:i}),N<i&&O++,ta(Math.round((N+O*k)*C)/C,i,xm(i,E,t))&&O++):N<i&&O++);O<w;++O){const L=Math.round((N+O*k)*C)/C;if(S&&L>a)break;n.push({value:L})}return S&&f&&_!==a?n.length&&ta(n[n.length-1].value,a,xm(a,E,t))?n[n.length-1].value=a:n.push({value:a}):(!S||_===a)&&n.push({value:_}),n}function xm(t,e,{horizontal:n,minRotation:r}){const s=Gn(r),o=(n?Math.sin(s):Math.cos(s))||.001,i=.75*e*(""+t).length;return Math.min(e/o,i)}class v5 extends gs{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return ct(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:o}=this;const i=l=>s=n?s:l,a=l=>o=r?o:l;if(e){const l=ir(s),c=ir(o);l<0&&c<0?a(0):l>0&&c>0&&i(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||i(s-l)}this.min=s,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,i=y5(s,o);return e.bounds==="ticks"&&bM(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const s=(r-n)/Math.max(e.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return Wc(e,this.chart.options.locale,this.options.ticks.format)}}class pd extends v5{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=hn(e)?e:0,this.max=hn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=Gn(this.options.ticks.minRotation),s=(e?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}$e(pd,"id","linear"),$e(pd,"defaults",{ticks:{callback:r0.formatters.numeric}});const ka={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Jt=Object.keys(ka);function wm(t,e){return t-e}function km(t,e){if(ct(e))return null;const n=t._adapter,{parser:r,round:s,isoWeekday:o}=t._parseOpts;let i=e;return typeof r=="function"&&(i=r(i)),hn(i)||(i=typeof r=="string"?n.parse(i,r):n.parse(i)),i===null?null:(s&&(i=s==="week"&&(na(o)||o===!0)?n.startOf(i,"isoWeek",o):n.startOf(i,s)),+i)}function Cm(t,e,n,r){const s=Jt.length;for(let o=Jt.indexOf(t);o<s-1;++o){const i=ka[Jt[o]],a=i.steps?i.steps:Number.MAX_SAFE_INTEGER;if(i.common&&Math.ceil((n-e)/(a*i.size))<=r)return Jt[o]}return Jt[s-1]}function x5(t,e,n,r,s){for(let o=Jt.length-1;o>=Jt.indexOf(n);o--){const i=Jt[o];if(ka[i].common&&t._adapter.diff(s,r,i)>=e-1)return i}return Jt[n?Jt.indexOf(n):0]}function w5(t){for(let e=Jt.indexOf(t)+1,n=Jt.length;e<n;++e)if(ka[Jt[e]].common)return Jt[e]}function Sm(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:s}=Hc(n,e),o=n[r]>=e?n[r]:n[s];t[o]=!0}}function k5(t,e,n,r){const s=t._adapter,o=+s.startOf(e[0].value,r),i=e[e.length-1].value;let a,l;for(a=o;a<=i;a=+s.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function _m(t,e,n){const r=[],s={},o=e.length;let i,a;for(i=0;i<o;++i)a=e[i],s[a]=i,r.push({value:a,major:!1});return o===0||!n?r:k5(t,r,s,n)}class Ca extends gs{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),s=this._adapter=new PN._date(e.adapters.date);s.init(n),uo(r.displayFormats,s.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:km(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:s,max:o,minDefined:i,maxDefined:a}=this.getUserBounds();function l(c){!i&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!i||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=hn(s)&&!isNaN(s)?s:+n.startOf(Date.now(),r),o=hn(o)&&!isNaN(o)?o:+n.endOf(Date.now(),r)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,s=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,i=this.max,a=kM(s,o,i);return this._unit=n.unit||(r.autoSkip?Cm(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):x5(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:w5(this._unit),this.initOffsets(s),e.reverse&&a.reverse(),_m(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,s,o;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?n=1-s:n=(this.getDecimalForValue(e[1])-s)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?r=o:r=(o-this.getDecimalForValue(e[e.length-2]))/2);const i=e.length<3?.5:.25;n=Zt(n,0,i),r=Zt(r,0,i),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,s=this.options,o=s.time,i=o.unit||Cm(o.minUnit,n,r,this._getLabelCapacity(n)),a=Qe(s.ticks.stepSize,1),l=i==="week"?o.isoWeekday:!1,c=na(l)||l===!0,d={};let u=n,f,g;if(c&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,c?"day":i),e.diff(r,n,i)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+i);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(f=u,g=0;f<r;f=+e.add(f,a,i),g++)Sm(d,f,m);return(f===r||s.bounds==="ticks"||g===1)&&Sm(d,f,m),Object.keys(d).sort(wm).map(p=>+p)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const s=this.options.time.displayFormats,o=this._unit,i=n||s[o];return this._adapter.format(e,i)}_tickFormatFunction(e,n,r,s){const o=this.options,i=o.ticks.callback;if(i)return ht(i,[e,n,r],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],u=c&&a[c],f=r[n],g=c&&u&&f&&f.major;return this._adapter.format(e,s||(g?u:d))}generateTickLabels(e){let n,r,s;for(n=0,r=e.length;n<r;++n)s=e[n],s.label=this._tickFormatFunction(s.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,s=Gn(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),i=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:r*o+a*i,h:r*i+a*o}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,s=r[n.unit]||r.millisecond,o=this._tickFormatFunction(e,0,_m(this,[e],this._majorUnit),s),i=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/i.w:this.height/i.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n<r;++n)e=e.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const s=this.getLabels();for(n=0,r=s.length;n<r;++n)e.push(km(this,s[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return qp(e.sort(wm))}}$e(Ca,"id","time"),$e(Ca,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Sa(t,e,n){let r=0,s=t.length-1,o,i,a,l;n?(e>=t[r].pos&&e<=t[s].pos&&({lo:r,hi:s}=Uc(t,"pos",e)),{pos:o,time:a}=t[r],{pos:i,time:l}=t[s]):(e>=t[r].time&&e<=t[s].time&&({lo:r,hi:s}=Uc(t,"time",e)),{time:o,pos:a}=t[r],{time:i,pos:l}=t[s]);const c=i-o;return c?a+(l-a)*(e-o)/c:a}class Em extends Ca{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Sa(n,this.min),this._tableRange=Sa(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,s=[],o=[];let i,a,l,c,d;for(i=0,a=e.length;i<a;++i)c=e[i],c>=n&&c<=r&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(i=0,a=s.length;i<a;++i)d=s[i+1],l=s[i-1],c=s[i],Math.round((d+l)/2)!==c&&o.push({time:c,pos:i/(a-1)});return o}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((s,o)=>s-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Sa(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Sa(this._table,r*this._tableRange+this._minPos,!0)}}$e(Em,"id","timeseries"),$e(Em,"defaults",Ca.defaults);const Mm="label";function Nm(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function C5(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function Om(t,e){t.labels=e}function Tm(t,e,n=Mm){const r=[];t.datasets=e.map(s=>{const o=t.datasets.find(i=>i[n]===s[n]);return!o||!s.data||r.includes(o)?{...s}:(r.push(o),Object.assign(o,s),o)})}function S5(t,e=Mm){const n={labels:[],datasets:[]};return Om(n,t.labels),Tm(n,t.datasets,e),n}function _5(t,e){const{height:n=150,width:r=300,redraw:s=!1,datasetIdKey:o,type:i,data:a,options:l,plugins:c=[],fallbackContent:d,updateMode:u,...f}=t,g=v.useRef(null),m=v.useRef(null),p=()=>{g.current&&(m.current=new So(g.current,{type:i,data:S5(a,o),options:l&&{...l},plugins:c}),Nm(e,m.current))},y=()=>{Nm(e,null),m.current&&(m.current.destroy(),m.current=null)};return v.useEffect(()=>{!s&&m.current&&l&&C5(m.current,l)},[s,l]),v.useEffect(()=>{!s&&m.current&&Om(m.current.config.data,a.labels)},[s,a.labels]),v.useEffect(()=>{!s&&m.current&&a.datasets&&Tm(m.current.config.data,a.datasets,o)},[s,a.datasets]),v.useEffect(()=>{m.current&&(s?(y(),setTimeout(p)):m.current.update(u))},[s,l,a.labels,a.datasets,u]),v.useEffect(()=>{m.current&&(y(),setTimeout(p))},[i]),v.useEffect(()=>(p(),()=>y()),[]),h.jsx("canvas",{ref:g,role:"img",height:n,width:r,...f,children:d})}const E5=v.forwardRef(_5);function Am(t,e){return So.register(e),v.forwardRef((n,r)=>h.jsx(E5,{...n,ref:r,type:t}))}const M5=Am("bar",da),N5=Am("doughnut",bo);So.register(gd,pd,xa,a5,ym,dm);const O5=({labels:t,datasets:e,height:n=200,showLegend:r=!1,showGrid:s=!1,showYGrid:o=!1,showYAxis:i=!1,className:a="",id:l,editorAttrs:c})=>{const d=v.useMemo(()=>({labels:t??[],datasets:(e??[]).map((m,p)=>({label:m.label,data:m.data,backgroundColor:m.backgroundColor||(p===0?"#7C3AED":"#DDD6FE"),borderRadius:m.borderRadius??4,barThickness:16,maxBarThickness:20,yAxisID:m.yAxisID??"y"}))}),[t,e]),u=v.useMemo(()=>(e??[]).some(m=>m.yAxisID==="y1"),[e]),f=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:750,easing:"easeOutQuart"},animations:{x:{duration:0},y:{from:m=>{if(m.type==="data")return m.chart.scales.y.getPixelForValue(0)}}},transitions:{active:{animation:{duration:200}},resize:{animation:{duration:0}}},plugins:{legend:{display:r,position:"top"},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8}},scales:{x:{grid:{display:s},border:{display:!1},ticks:{color:"#94a3b8",font:{size:11}}},y:{type:"linear",position:"left",grid:{display:o,color:"#e2e8f0"},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"},...u?{y1:{type:"linear",position:"right",grid:{display:!1},border:{display:!1},ticks:{display:i,color:"#94a3b8",font:{size:11},padding:8},beginAtZero:!0,grace:"5%"}}:{}}}),[r,s,o,i,u]),g=typeof n=="number"?n:/^\d+$/.test(String(n))?`${n}px`:n;return h.jsx("div",{className:`bar-chart-container ${a}`,style:{height:g},id:l,...c,children:h.jsx(M5,{data:d,options:f})})},T5=v.memo(O5,(t,e)=>JSON.stringify(t.labels)===JSON.stringify(e.labels)&&JSON.stringify(t.datasets)===JSON.stringify(e.datasets)&&t.height===e.height&&t.showLegend===e.showLegend&&t.showGrid===e.showGrid&&t.showYGrid===e.showYGrid&&t.showYAxis===e.showYAxis&&t.className===e.className&&t.id===e.id&&t.editorAttrs===e.editorAttrs);So.register(_o,ym,dm);const A5=({data:t,centerLabel:e,centerValue:n,size:r=200,cutout:s="70%",showLegend:o=!1,className:i="",id:a,editorAttrs:l})=>{const c=v.useMemo(()=>({labels:(t??[]).map(f=>f.name),datasets:[{data:(t??[]).map(f=>f.value),backgroundColor:(t??[]).map(f=>f.color),borderWidth:0,hoverOffset:4}]}),[t]),d=v.useMemo(()=>({responsive:!0,maintainAspectRatio:!1,cutout:s,plugins:{legend:{display:o},tooltip:{backgroundColor:"#1e293b",titleColor:"#fff",bodyColor:"#fff",padding:12,cornerRadius:8,callbacks:{label:f=>` $${f.parsed.toLocaleString()}`}}}}),[s,o]),u=typeof r=="number"?r:/^\d+$/.test(String(r))?`${r}px`:r;return h.jsx("div",{className:`donut-chart-wrapper ${i}`,id:a,...l,children:h.jsxs("div",{className:"relative",style:{width:u,height:u},children:[h.jsx(N5,{data:c,options:d}),(e||n)&&h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e&&h.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:e}),n&&h.jsx("span",{className:"text-lg font-bold text-slate-900 dark:text-white",children:n})]})]})})},D5=({id:t,className:e,style:n,children:r,editorAttrs:s})=>h.jsx("div",{id:t,className:e,style:n,...s,children:r}),I5=({children:t,cols:e=1,responsive:n,gap:r,rowGap:s,colGap:o,autoRows:i,autoCols:a,flow:l="row",className:c="",style:d,onClick:u,id:f,editorAttrs:g})=>{const m=["grid"];if(e&&m.push(`grid-cols-${e}`),n&&(n.sm&&m.push(`sm:grid-cols-${n.sm}`),n.md&&m.push(`md:grid-cols-${n.md}`),n.lg&&m.push(`lg:grid-cols-${n.lg}`),n.xl&&m.push(`xl:grid-cols-${n.xl}`),n["2xl"]&&m.push(`2xl:grid-cols-${n["2xl"]}`)),r!==void 0&&r>0&&m.push(`gap-${r}`),s!==void 0&&s>0&&m.push(`gap-y-${s}`),o!==void 0&&o>0&&m.push(`gap-x-${o}`),i){const y={auto:"auto-rows-auto",min:"auto-rows-min",max:"auto-rows-max",fr:"auto-rows-fr"};m.push(y[i])}if(a){const y={auto:"auto-cols-auto",min:"auto-cols-min",max:"auto-cols-max",fr:"auto-cols-fr"};m.push(y[a])}const p={row:"grid-flow-row",col:"grid-flow-col",dense:"grid-flow-dense","row-dense":"grid-flow-row-dense","col-dense":"grid-flow-col-dense"};return m.push(p[l]),c&&m.push(c),h.jsx(I,{className:m.join(" "),style:d,onClick:u,id:f,...g,children:t})},L5=({children:t,direction:e="row",justify:n="start",align:r="stretch",wrap:s="nowrap",gap:o=0,grow:i=!1,shrink:a=!0,className:l="",style:c,onClick:d,id:u,editorAttrs:f})=>{const g=["flex"],m={row:"flex-row","row-reverse":"flex-row-reverse",col:"flex-col","col-reverse":"flex-col-reverse"};g.push(m[e]);const p={wrap:"flex-wrap",nowrap:"flex-nowrap","wrap-reverse":"flex-wrap-reverse"};g.push(p[s]);const y={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};g.push(y[n]);const b={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"};return g.push(b[r]),o>0&&g.push(`gap-${o}`),i===!0?g.push("flex-grow"):typeof i=="number"&&i>0&&g.push(`flex-grow-${i}`),a===!1?g.push("shrink-0"):a===!0?g.push("flex-shrink"):typeof a=="number"&&a>0&&g.push(`flex-shrink-${a}`),l&&g.push(l),h.jsx(I,{className:g.join(" "),style:c,onClick:d,id:u,...f,children:t})},P5=({title:t,subtitle:e,children:n,padding:r="none",background:s="none",maxWidth:o,centered:i=!1,border:a=!1,shadow:l="none",rounded:c=!1,className:d="",style:u,onClick:f,id:g,editorAttrs:m})=>{const p=[],y={none:"",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8"};y[r]&&p.push(y[r]);const b={none:"",white:"bg-white dark:bg-gray-700",gray:"bg-gray-50 dark:bg-gray-800",primary:"bg-blue-50 dark:bg-blue-900/20",secondary:"bg-gray-50 dark:bg-gray-800"};if(s!=="none"&&p.push(b[s]),o){const x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl","4xl":"max-w-4xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};p.push(x[o])}i&&p.push("mx-auto"),a&&p.push("border","border-gray-200","dark:border-gray-700");const S={none:"",sm:"shadow-sm",md:"shadow-md",lg:"shadow-lg",xl:"shadow-xl"};return l!=="none"&&p.push(S[l]),c&&p.push("rounded-lg"),d&&p.push(d),h.jsxs(Ed,{className:p.join(" "),style:u,onClick:f,id:g,...m,children:[(t||e)&&h.jsxs("div",{className:"mb-4",children:[t&&h.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:t}),e&&h.jsx("p",{className:"mt-1 text-sm text-gray-600 dark:text-gray-400",children:e})]}),n]})},$5=({leftWidth:t="250px",rightWidth:e="300px",leftSlot:n,centerSlot:r,rightSlot:s,className:o="",style:i,id:a,editorAttrs:l})=>{const c=`flex flex-row w-full h-full ${o}`.trim(),d={width:t,flexShrink:0},u={flex:1,minWidth:0},f={width:e,flexShrink:0};return h.jsxs(I,{className:c,style:i,id:a,...l,children:[h.jsx(I,{className:"flex flex-col",style:d,children:n}),h.jsx(I,{className:"flex flex-col",style:u,children:r}),h.jsx(I,{className:"flex flex-col",style:f,children:s})]})},F5={language:"json",theme:"vs-dark",options:{automaticLayout:!0,minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,tabSize:2,formatOnPaste:!0,formatOnType:!0,wordWrap:"on",folding:!0,lineNumbers:"on",renderWhitespace:"selection"}},Dm=[{uri:`${window.location.origin}/schemas/layout.json`,fileMatch:["*layout*.json"],schema:{type:"object",properties:{version:{type:"string"},endpoint:{type:"string"},components:{type:"array"}},required:["version","endpoint","components"]}}],V5={"vs/nls":{availableLanguages:{"*":"ko"}}};function z5(t){t.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:Dm,enableSchemaRequest:!0,schemaValidation:"error",schemaRequest:"error"})}const H5={identifier:"sirsoft-admin_basic",vendor:"sirsoft",name:{ko:"Admin Basic",en:"Admin Basic"},version:"1.0.1",license:"MIT",description:{ko:"그누보드7 기본 관리자 템플릿",en:"Gnuboard7 default admin template"},type:"admin",locales:["ko","en"],author:{name:"sirsoft",email:"contact@sirsoft.com",url:"https://sirsoft.com"},release_date:"2026-05-15",g7_version:">=7.0.0",dependencies:{modules:{},plugins:{}},assets:{css:["assets/css/main.css","assets/css/ui-system.css"],js:["dist/components.js"],fonts:["assets/fonts/"],images:["assets/images/"]},components:{basic:["a","button","checkbox","div","form","h1","h2","h3","hr","icon","img","input","label","li","nav","p","section","select","span","svg","table","tbody","td","textarea","th","thead","tr","ul"],composite:["action-menu","admin-footer","admin-header","admin-sidebar","alert-dialog","breadcrumb","card","confirm-dialog","data-grid","dialog","dropdown","empty-state","filter-group","icon-button","loading-spinner","modal","page-header","pagination","product-card","search-bar","stat-card","status-badge","tab-navigation","template-card","toast"],layout:["container","flex","grid","section"]},preview:{thumbnail:"preview/thumbnail.png",screenshots:["preview/screenshot1.png","preview/screenshot2.png"]},error_config:{layouts:{401:"errors/401",403:"errors/403",404:"errors/404",500:"errors/500",503:"errors/503",maintenance:"errors/maintenance"}},github_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic",github_changelog_url:"https://github.com/gnuboard/g7-template-sirsoft-admin_basic/blob/main/CHANGELOG.md",externals:[{id:"fontawesome",type:"style",url:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",preconnect:"https://cdnjs.cloudflare.com"},{id:"pretendard",type:"webfont",url:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css",preconnect:"https://cdn.jsdelivr.net",crossorigin:"anonymous"},{id:"flag-icons",type:"style",url:"https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/css/flag-icons.min.css"}]},md=window.G7Core?.createLogger?.("Handler:SetLocale")??{log:(...t)=>console.log("[Handler:SetLocale]",...t),warn:(...t)=>console.warn("[Handler:SetLocale]",...t),error:(...t)=>console.error("[Handler:SetLocale]",...t)};async function U5(t,e){let n;const r=e?.event;if(r?.target?.value!==void 0&&r.target.value!==null?n=r.target.value:r?.value!==void 0&&r.value!==null?n=r.value:t?.target&&typeof t.target=="string"&&!t.target.includes("{{")&&(n=t.target),!n||typeof n!="string"){md.warn("Invalid locale:",n);return}const s=window.G7Core;if(!(s?.config?.("app.supported_locales")??s?.state?.get?.("_global.appConfig.supportedLocales")??["ko","en"]).includes(n)){md.warn("Unsupported locale:",n);return}try{localStorage.setItem("g7_locale",n)}catch(i){md.error("Failed to save locale to localStorage:",i);return}window.location.reload()}const Kn=window.G7Core?.createLogger?.("Handler:SetTheme")??{log:(...t)=>console.log("[Handler:SetTheme]",...t),warn:(...t)=>console.warn("[Handler:SetTheme]",...t),error:(...t)=>console.error("[Handler:SetTheme]",...t)},bd=["auto","light","dark"],Im="g7_color_scheme",B5=t=>t==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,_a=t=>{const e=B5(t);document.documentElement.setAttribute("data-theme",e),e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};function j5(){try{const t=localStorage.getItem(Im),e=t&&bd.includes(t)?t:"auto";_a(e);try{window.G7Core?.state?.setGlobal?.({theme:e})}catch(n){Kn.warn("Failed to set global theme state:",n)}Kn.log("Initial theme applied:",e)}catch(t){Kn.warn("Failed to load initial theme:",t),_a("auto")}}async function W5(t,e){const n=t?.target;if(n&&typeof n=="string"&&bd.includes(n)){_a(n);try{window.G7Core?.state?.setGlobal?.({theme:n})}catch(r){Kn.warn("Failed to set global theme state:",r)}return}j5()}async function G5(t,e){let n;if(t?.target&&typeof t.target=="string"&&!t.target.includes("{{")&&(n=t.target),!n||typeof n!="string"){Kn.warn("Invalid theme:",n);return}if(!bd.includes(n)){Kn.warn("Unsupported theme:",n);return}const r=n;try{localStorage.setItem(Im,r)}catch(s){Kn.error("Failed to save theme to localStorage:",s);return}_a(r);try{window.G7Core?.state?.setGlobal?.({theme:r})}catch(s){Kn.warn("Failed to set global theme state:",s)}Kn.log("Theme changed to:",r)}const Mo=window.G7Core?.createLogger?.("Handler:InitMenu")??{log:(...t)=>console.log("[Handler:InitMenu]",...t),warn:(...t)=>console.warn("[Handler:InitMenu]",...t),error:(...t)=>console.error("[Handler:InitMenu]",...t)};function Lm(t,e){for(const n of t){if(n.slug===e)return n;if(n.children&&n.children.length>0){const r=Lm(n.children,e);if(r)return r}}return null}function Pm(t){return new URLSearchParams(window.location.search).get(t)}function Y5(t){return window.G7Core?.state?.getDataSource?.(t)}async function X5(t,e=30,n=100){for(let r=0;r<e;r++){const o=Y5(t)?.data;if(Array.isArray(o)&&o.length>0)return o;await new Promise(i=>setTimeout(i,n))}return null}async function K5(t,e){const n=window.G7Core,r=Pm("menu"),s=Pm("mode");if(!r){Mo.log("[initMenuFromUrl] No menu parameter in URL");return}if(!n?.state?.set){Mo.warn("[initMenuFromUrl] G7Core.state.set not available");return}const o=await X5("menus");if(!o){Mo.warn("[initMenuFromUrl] menus data not available after waiting");return}const i=Lm(o,r);if(!i){Mo.warn("[initMenuFromUrl] Menu not found with slug:",r);return}const a=s==="edit"?"edit":"view";n.state.set({selectedMenuId:i.id,selectedMenu:i,panelMode:a}),a==="edit"&&n.state.set({formData:{name:i.name,slug:i.slug,url:i.url,icon:i.icon,parent_id:i.parent_id,module_id:i.module_id,is_active:i.is_active}}),Mo.log("[initMenuFromUrl] Menu initialized from URL:",{slug:r,mode:a,menuId:i.id})}const Gt=window.G7Core?.createLogger?.("Handler:FilterVisibility")??{log:(...t)=>console.log("[Handler:FilterVisibility]",...t),warn:(...t)=>console.warn("[Handler:FilterVisibility]",...t),error:(...t)=>console.error("[Handler:FilterVisibility]",...t)},Ea="g7_filter_visibility_";async function q5(t,e){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=t?.params||{};if(!n){Gt.warn("[initFilterVisibility] storageKey is required");return}const o=`${Ea}${n}`;try{const i=localStorage.getItem(o);let a;if(i){const l=JSON.parse(i);Array.isArray(l)?(a=l,Gt.log(`[initFilterVisibility] Loaded from localStorage: ${a.join(", ")}`)):(a=r,Gt.warn("[initFilterVisibility] Invalid saved data format, using defaults"))}else a=r,Gt.log(`[initFilterVisibility] No saved data, using defaults: ${r.join(", ")}`);e?.setState&&e.setState({[s]:a})}catch(i){Gt.error("[initFilterVisibility] Failed to load filter visibility:",i),e?.setState&&e.setState({[s]:r})}}async function Z5(t,e){const{storageKey:n,filters:r}=t?.params||{};if(!n){Gt.warn("[saveFilterVisibility] storageKey is required");return}if(!Array.isArray(r)){Gt.warn("[saveFilterVisibility] filters must be an array");return}const s=`${Ea}${n}`;try{localStorage.setItem(s,JSON.stringify(r)),Gt.log(`[saveFilterVisibility] Saved to localStorage: ${r.join(", ")}`)}catch(o){Gt.error("[saveFilterVisibility] Failed to save filter visibility:",o)}}async function Q5(t,e){const{storageKey:n,filterId:r,stateKey:s="visibleFilters"}=t?.params||{};if(!n||!r){Gt.warn("[toggleFilterVisibility] storageKey and filterId are required");return}const o=e?.state?.[s]||[];let i;o.includes(r)?i=o.filter(l=>l!==r):i=[...o,r],e?.setState&&e.setState({[s]:i});const a=`${Ea}${n}`;try{localStorage.setItem(a,JSON.stringify(i)),Gt.log(`[toggleFilterVisibility] Toggled ${r}: ${i.join(", ")}`)}catch(l){Gt.error("[toggleFilterVisibility] Failed to save:",l)}}async function J5(t,e){const{storageKey:n,defaultFilters:r=[],stateKey:s="visibleFilters"}=t?.params||{};if(!n){Gt.warn("[resetFilterVisibility] storageKey is required");return}const o=`${Ea}${n}`;try{localStorage.setItem(o,JSON.stringify(r)),e?.setState&&e.setState({[s]:r}),Gt.log(`[resetFilterVisibility] Reset to defaults: ${r.join(", ")}`)}catch(i){Gt.error("[resetFilterVisibility] Failed to reset:",i)}}const ms=window.G7Core?.createLogger?.("Handler:MultilingualTag")??{log:(...t)=>console.log("[Handler:MultilingualTag]",...t),warn:(...t)=>console.warn("[Handler:MultilingualTag]",...t),error:(...t)=>console.error("[Handler:MultilingualTag]",...t)};async function R5(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}const r=n.state?.getGlobal?.()?.multilingualTagEdit;if(!r){ms.warn("No multilingualTagEdit state found"),n.modal?.close?.();return}const{fieldName:s,editingIndex:o,values:i,statePath:a,currentTags:l}=r;if(!Object.values(i||{}).some(g=>typeof g=="string"&&g.trim()!=="")){ms.warn("No values to save"),n.modal?.close?.(),yd(n);return}const d=Array.isArray(l)?l:[];let u;o==null?u=[...d,i]:u=d.map((g,m)=>m===o?i:g);const f=a||(s?.startsWith("form.")?s:`form.${s}`);n.state?.setParentLocal?.({[f]:u}),n.modal?.close?.(),yd(n)}async function eT(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}n.modal?.close?.(),yd(n)}async function tT(t,e){const n=window.G7Core;if(!n){ms.error("G7Core not available");return}const r=t?.params?.locale;if(!r){ms.warn("No locale specified");return}const s=e?.event;let o="";s?.target?.value!==void 0?o=s.target.value:s?.value!==void 0&&(o=s.value);const a=(n.state?.getGlobal?.()||{}).multilingualTagEdit||{},l={...a.values||{},[r]:o};n.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:{...a,values:l}}})}function yd(t){t.dispatch?.({handler:"setState",params:{target:"global",multilingualTagEdit:null}})}function $m(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return`${e}-${n}-${r}T${s}:${o}:${i}`}function nT(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59),r=$m(n),s=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);switch(t){case"today":break;case"week":s.setDate(s.getDate()-6);break;case"month":s.setMonth(s.getMonth()-1);break;case"3months":s.setMonth(s.getMonth()-3);break;case"6months":s.setMonth(s.getMonth()-6);break;case"1year":s.setFullYear(s.getFullYear()-1);break}return{startDate:$m(s),endDate:r}}function rT(t){const{preset:e}=t.params||{preset:"today"},{startDate:n,endDate:r}=nT(e);return{startDate:n,endDate:r,preset:e}}const No=window.G7Core?.createLogger?.("Handler:Sidebar")??{log:(...t)=>console.log("[Handler:Sidebar]",...t),warn:(...t)=>console.warn("[Handler:Sidebar]",...t),error:(...t)=>console.error("[Handler:Sidebar]",...t)},Fm="g7_admin_sidebar_collapsed";function Vm(){try{return localStorage.getItem(Fm)==="1"}catch{return!1}}function sT(t){try{localStorage.setItem(Fm,t?"1":"0")}catch(e){No.error("Failed to save sidebar state to localStorage:",e)}try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:t})}catch(e){No.warn("Failed to set global sidebar state:",e)}}function zm(){const t=Vm();try{window.G7Core?.state?.setGlobal?.({sidebarCollapsed:t})}catch(e){No.warn("Failed to restore sidebar state:",e)}No.log("Initial sidebar collapsed state restored:",t)}async function oT(t,e){zm()}async function iT(t,e){const r=!(()=>{try{return!!window.G7Core?.state?.getGlobal?.()?.sidebarCollapsed}catch{return Vm()}})();sT(r),No.log("Sidebar collapsed toggled to:",r)}const vd=window.G7Core?.createLogger?.("Handler:DownloadAttachment")??{log:(...t)=>console.log("[Handler:DownloadAttachment]",...t),warn:(...t)=>console.warn("[Handler:DownloadAttachment]",...t),error:(...t)=>console.error("[Handler:DownloadAttachment]",...t)};async function aT(t,e){const n=window.G7Core,{url:r,filename:s}=t?.params||{};if(!r){vd.warn("다운로드 URL 이 없어 요청을 건너뜁니다.");return}if(!n?.api?.get){vd.error("G7Core.api.get 이 초기화되지 않아 다운로드를 실행할 수 없습니다.");return}try{const o=await n.api.get(r,{responseType:"blob"});if(o){const i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=s||"",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}catch(o){vd.error("첨부파일 다운로드 실패",o),n?.toast?.error?.(n?.t?.("common.download_failed")??"Download failed")}}const Ma={setLocale:U5,setTheme:G5,initTheme:W5,scrollToSection:Qd,initMenuFromUrl:K5,initFilterVisibility:q5,saveFilterVisibility:Z5,toggleFilterVisibility:Q5,resetFilterVisibility:J5,saveMultilingualTag:R5,cancelMultilingualTag:eT,updateMultilingualTagValue:tT,setDateRange:rT,toggleSidebar:iT,initSidebar:oT,downloadAttachment:aT},Oo=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:IdentityLauncher")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic:IdentityLauncher]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic:IdentityLauncher]",...t),error:(...t)=>console.error("[Template:sirsoft-admin_basic:IdentityLauncher]",...t)};function lT(){const e=window.G7Core?.api?.getToken?.()??null;return e?{Authorization:`Bearer ${e}`}:{}}function cT(){try{const t=typeof window<"u"?window.localStorage?.getItem("g7_locale"):null;return t?{"Accept-Language":t}:{}}catch{return{}}}async function dT(t,e=null){const n={purpose:t.purpose};t.provider_id&&(n.provider_id=t.provider_id),e&&(n.target=e);const r=t.challenge_start_url||"/api/identity/challenges",s=await fetch(r,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...cT(),...lT()},body:JSON.stringify(n)}),o=await s.json().catch(()=>null);if(!s.ok||!o?.success){const a=o?.message??`Challenge 시작 실패 (HTTP ${s.status})`;throw new Error(a)}const i=o.data??o;return{id:i.id,expires_at:i.expires_at,render_hint:i.render_hint??t.render_hint??"text_code",public_payload:i.public_payload,redirect_url:i.redirect_url,max_attempts:typeof i.max_attempts=="number"?i.max_attempts:void 0}}async function uT(t){const e=window.G7Core,n=e?.identity;if(!e?.dispatch||!e?.state||!n)return Oo.error("G7Core 또는 G7Core.identity 가 초기화되지 않아 launcher 를 실행할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};if(t.render_hint==="external_redirect"||t.redirect_url)return n.redirectExternally(t);const r=t.target&&(t.target.email||t.target.phone)?t.target:null;let s;try{s=await dT(t,r)}catch(m){Oo.error("Challenge 시작 실패:",m);try{await e.dispatch({handler:"toast",params:{type:"error",message:m instanceof Error?m.message:"본인인증 시작에 실패했습니다."}})}catch{}return{status:"failed",failureCode:"CHALLENGE_START_FAILED",reason:m instanceof Error?m.message:String(m)}}if(s.redirect_url)return n.redirectExternally({...t,render_hint:"external_redirect",redirect_url:s.redirect_url});const o=s.expires_at?new Date(s.expires_at).getTime():0,i=o>0?Math.max(0,Math.floor((o-Date.now())/1e3)):0,a=typeof s.max_attempts=="number"?s.max_attempts:0;e.state.set({identityChallenge:{policy_key:t.policy_key,purpose:t.purpose,provider_id:t.provider_id??null,render_hint:s.render_hint,challenge_id:s.id,expires_at:s.expires_at,public_payload:s.public_payload??{},target:r,code:"",error:null,attempts:0,maxAttempts:a,remainingSeconds:i,resendCooldown:0}});let l=o,c=0;const d=window.setInterval(()=>{const m=l>0?Math.max(0,Math.floor((l-Date.now())/1e3)):0;c=Math.max(0,c-1),e.state.set({identityChallenge:{remainingSeconds:m,resendCooldown:c}})},1e3);let u=null;try{u=e.state.subscribe?.(m=>{const p=m?.identityChallenge?.expires_at;if(typeof p=="string"){const b=new Date(p).getTime();Number.isFinite(b)&&b!==l&&(l=b)}const y=m?.identityChallenge?.resendCooldown;typeof y=="number"&&y>c&&(c=y)})??null}catch{}const f=n.createDeferred();try{await e.dispatch({handler:"openModal",target:"identity-challenge-modal"})}catch(m){return Oo.error("openModal 실패 — 풀페이지로 폴백:",m),window.clearInterval(d),u?.(),n.redirectExternally({...t,render_hint:"external_redirect",redirect_url:`/admin/identity/challenge?challenge_id=${encodeURIComponent(s.id)}&return=${encodeURIComponent(window.location.href)}`})}const g=await f;return window.clearInterval(d),u?.(),g}function fT(){const t=window.G7Core?.identity;if(!t?.setLauncher){Oo.warn("G7Core.identity 가 아직 초기화되지 않아 launcher 등록을 건너뜁니다. 코어 부트스트랩 순서를 확인하세요.");return}t.setLauncher(uT),Oo.log("IDV launcher registered (sirsoft-admin_basic)")}function hT(t){const e=t.icons;return Array.isArray(e)?e.filter(n=>!!n&&typeof n=="object"&&typeof n.value=="string"):[]}function gT(t,e){const n=t.label;return typeof n=="string"?n.startsWith("$t:")?e(n.slice(3)):n:t.value}function pT(t,e,n){if(n==="")return!0;const r=n.toLowerCase();return t.value.toLowerCase().includes(r)||e.toLowerCase().includes(r)?!0:(t.keywords??[]).some(s=>s.toLowerCase().includes(r))}function mT({entry:t}){const e=t.preview;return e?.html?h.jsx("span",{className:"g7le-icon-preview",dangerouslySetInnerHTML:{__html:e.html},style:wd}):e?.className?h.jsx("span",{className:`g7le-icon-preview ${e.className}`,style:wd}):h.jsx("i",{className:`fas fa-${t.value}`,style:wd,"aria-hidden":"true"})}function bT({control:t,value:e,onChange:n,t:r}){const s=hT(t),o=e==null?"":String(e),i=typeof t.iconColumns=="number"?t.iconColumns:6,a=t.iconSearchPlaceholder,l=typeof a=="string"&&a.startsWith("$t:")?r(a.slice(3)):r("layout_editor.icon_picker.search_placeholder"),[c,d]=v.useState("");if(s.length===0)return h.jsx("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Hm,children:h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-free","data-testid":"g7le-widget-icon-picker-free",value:o,placeholder:r("layout_editor.icon_picker.free_input_hint"),onChange:g=>n(g.target.value===""?void 0:g.target.value),style:Um})});const u=g=>gT(g,r),f=s.filter(g=>pT(g,u(g),c));return h.jsxs("div",{className:"g7le-widget g7le-widget--icon-picker","data-testid":"g7le-widget-icon-picker",style:Hm,children:[h.jsx("input",{type:"text",className:"g7le-widget g7le-widget--icon-search","data-testid":"g7le-widget-icon-picker-search",value:c,placeholder:l,onChange:g=>d(g.target.value),style:Um}),h.jsxs("div",{className:"g7le-icon-grid","data-testid":"g7le-widget-icon-picker-grid",style:{...yT,gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[h.jsx("button",{type:"button","data-testid":"g7le-icon-cell-none",title:r("layout_editor.icon_picker.none"),onClick:()=>n(void 0),"aria-pressed":o==="",style:o===""?Bm:xd,children:h.jsx("span",{style:vT,children:"—"})}),f.map(g=>{const m=g.value===o;return h.jsx("button",{type:"button","data-testid":`g7le-icon-cell-${g.value}`,title:u(g),"aria-pressed":m,onClick:()=>n(g.value),style:m?Bm:xd,children:h.jsx(mT,{entry:g})},g.value)})]}),f.length===0&&h.jsx("div",{"data-testid":"g7le-widget-icon-picker-empty",style:xT,children:r("layout_editor.icon_picker.no_results")})]})}const Hm={display:"flex",flexDirection:"column",gap:6,width:"100%"},Um={padding:"5px 8px",fontSize:12,border:"1px solid #cbd5e1",borderRadius:6,width:"100%"},yT={display:"grid",gap:4,maxHeight:220,overflowY:"auto",padding:2},xd={display:"flex",alignItems:"center",justifyContent:"center",minHeight:34,padding:4,border:"1px solid #e2e8f0",borderRadius:6,background:"#fff",cursor:"pointer"},Bm={...xd,border:"2px solid #2563eb",background:"#eff6ff"},wd={display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:16,lineHeight:1},vT={fontSize:10,color:"#475569",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},xT={fontSize:11,color:"#94a3b8",fontStyle:"italic",padding:"4px 2px"},jm=130,Mn=20;function wT(t){const e=t?.arrayProp;return typeof e=="string"&&e?e:"tabs"}function kT(t){let e=0;for(const n of t){const r=typeof n.id=="number"?n.id:Number(n.id);Number.isFinite(r)&&r>e&&(e=r)}return e+1}function CT({node:t,params:e,cellBoxes:n,t:r,onPatchNode:s}){const o=wT(e),i=v.useMemo(()=>{const g=(t.props??{})[o];return typeof g=="string"||!Array.isArray(g)?null:g},[t,o]),a=v.useMemo(()=>{const g=new Map,m=`props.${o}.`;for(const p of n??[]){if(!p.path.startsWith(m))continue;const y=Number(p.path.slice(m.length));Number.isInteger(y)&&g.set(y,{top:p.top,left:p.left,width:p.width,height:p.height})}return g},[n,o]),l=v.useCallback(g=>{const m=t.props??{};s({...t,props:{...m,[o]:g}})},[t,o,s]),c=v.useCallback(g=>{if(!i)return;const p={id:kT(i),label:r("editor.tabnav_inplace.new_tab")},y=i.slice();y.splice(g,0,p),l(y)},[i,l,r]),d=v.useCallback(g=>{if(!i)return;const m=i.slice();m.splice(g,1),l(m)},[i,l]),u=v.useCallback((g,m)=>{if(!i)return;const p=g+m;if(p<0||p>=i.length)return;const y=i.slice(),[b]=y.splice(g,1);y.splice(p,0,b),l(y)},[i,l]);if(!i||a.size===0)return null;const f={position:"absolute",width:Mn,height:Mn,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1,border:"1px solid rgba(0,0,0,0.15)",borderRadius:4,background:"#ffffff",color:"#1f2937",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.18)",pointerEvents:"auto",padding:0,zIndex:jm};return h.jsx("div",{className:"g7le-tabnav-inplace","data-testid":"g7le-tabnav-inplace",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:jm},children:i.map((g,m)=>{const p=a.get(m);if(!p)return null;const y=p.left+p.width;return h.jsxs("div",{"data-testid":`g7le-tabnav-aff-${m}`,children:[h.jsx("button",{type:"button","data-testid":`g7le-tabnav-remove-${m}`,title:r("editor.tabnav_inplace.remove"),"aria-label":r("editor.tabnav_inplace.remove"),style:{...f,left:y-Mn/2,top:p.top-Mn/2,color:"#b91c1c"},onClick:b=>{b.preventDefault(),b.stopPropagation(),d(m)},children:"✕"}),m>0&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-left-${m}`,title:r("editor.tabnav_inplace.move_left"),"aria-label":r("editor.tabnav_inplace.move_left"),style:{...f,left:p.left,top:p.top+p.height-Mn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,-1)},children:"◀"}),m<i.length-1&&h.jsx("button",{type:"button","data-testid":`g7le-tabnav-move-right-${m}`,title:r("editor.tabnav_inplace.move_right"),"aria-label":r("editor.tabnav_inplace.move_right"),style:{...f,left:y-Mn,top:p.top+p.height-Mn/2},onClick:b=>{b.preventDefault(),b.stopPropagation(),u(m,1)},children:"▶"}),m===0&&h.jsx("button",{type:"button","data-testid":"g7le-tabnav-add-0",title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:p.left-Mn,top:p.top+p.height/2-Mn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(0)},children:"+"}),h.jsx("button",{type:"button","data-testid":`g7le-tabnav-add-${m+1}`,title:r("editor.tabnav_inplace.add"),"aria-label":r("editor.tabnav_inplace.add"),style:{...f,left:y-Mn/2,top:p.top+p.height/2-Mn/2,color:"#15803d"},onClick:b=>{b.preventDefault(),b.stopPropagation(),c(m+1)},children:"+"})]},`tab-aff-${g.id}-${m}`)})})}const kd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic:EditorWidgets")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic:EditorWidgets]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic:EditorWidgets]",...t)};function ST(){if(typeof window>"u")return;const t=window.G7Core?.layoutEditor;if(!t?.registerWidget){kd.warn("G7Core.layoutEditor 미노출 — icon-picker 위젯 등록 보류");return}t.registerWidget("icon-picker",bT),kd.log("편집기 위젯 'icon-picker' 등록됨(Font Awesome 검색 그리드)"),t.registerCanvasOverlay&&(t.registerCanvasOverlay("tabnav",CT),kd.log("편집기 캔버스 오버레이 'tabnav' 등록됨(TabNavigation 탭 인플레이스)"))}const Cd=window.G7Core?.createLogger?.("Template:sirsoft-admin_basic")??{log:(...t)=>console.log("[Template:sirsoft-admin_basic]",...t),warn:(...t)=>console.warn("[Template:sirsoft-admin_basic]",...t),error:(...t)=>console.error("[Template:sirsoft-admin_basic]",...t)};typeof window<"u"&&(window.G7TemplateHandlers=Ma);function Wm(){if(typeof window<"u"){let t=0;const e=50,n=()=>{const r=window.G7Core?.getActionDispatcher?.();r?(Object.entries(Ma).forEach(([s,o])=>{r.registerHandler(s,o)}),Cd.log(`${Object.keys(Ma).length} custom handler(s) registered:`,Object.keys(Ma)),fT(),zm()):(t++,t<=e?(Cd.warn(`ActionDispatcher not found, retrying... (${t}/${e})`),setTimeout(n,100)):Cd.error("Failed to register handlers: ActionDispatcher not available after maximum retries"))};document.readyState==="complete"?n():window.addEventListener("load",n)}}return ST(),Wm(),R.A=Lr,R.Accordion=ec,R.ActionMenu=bs,R.AdminFooter=my,R.AdminHeader=fy,R.AdminSidebar=uy,R.Alert=iu,R.AlertDialog=ny,R.Badge=Dd,R.BarChart=T5,R.Breadcrumb=nu,R.Button=oe,R.Card=lb,R.CardGrid=zb,R.CategoryTree=$S,R.Checkbox=vn,R.ChipCheckbox=xE,R.Code=sb,R.CodeEditor=Dv,R.ColumnSelector=zv,R.ConfirmDialog=eu,R.Container=D5,R.DataGrid=Lb,R.Dialog=Rd,R.Div=I,R.DonutChart=A5,R.Dropdown=Ub,R.DropdownButton=wE,R.DropdownMenuItem=kE,R.DynamicFieldList=DE,R.EmptyState=ly,R.ExtensionBadge=Rf,R.FileInput=Sd,R.FileUploader=wp,R.FilterGroup=Gb,R.FilterVisibilitySelector=gE,R.Flex=L5,R.Form=Ia,R.FormField=FE,R.Fragment=ib,R.Grid=I5,R.H1=Ta,R.H2=Zn,R.H3=Ir,R.H4=_d,R.Hr=ab,R.HtmlContent=Xa,R.HtmlEditor=dE,R.I=pt,R.Icon=re,R.IconButton=Rb,R.IconName=de,R.IconSelect=TS,R.ImageGallery=Ui,R.Img=yn,R.Input=wt,R.Label=en,R.LanguageSelector=py,R.LayoutEditorHeader=wy,R.LayoutFileList=ky,R.LayoutHistoryPanel=Lv,R.LayoutWarnings=hE,R.Li=Da,R.LoadingSpinner=dy,R.LoginForm=Pv,R.Modal=Ho,R.MultilingualInput=Va,R.MultilingualLocaleContext=Dc,R.MultilingualTabPanel=$E,R.MultilingualTagInput=Vk,R.Nav=Io,R.NotificationCenter=hy,R.Ol=Qm,R.Optgroup=tb,R.Option=eb,R.P=bt,R.PageHeader=by,R.PageLoading=jv,R.PageTransitionIndicator=Uv,R.Pagination=Lo,R.PermissionTree=LS,R.Pre=ob,R.ProductCard=Bb,R.RadioGroup=aE,R.RichSelect=yE,R.SearchBar=Wb,R.SearchableDropdown=zk,R.Section=Ed,R.SectionHeader=vy,R.SectionLayout=P5,R.Select=Pr,R.SlotContainer=bE,R.SortableMenuItem=Bh,R.SortableMenuList=NS,R.Span=Q,R.StatCard=jb,R.StatusBadge=Po,R.Svg=Hn,R.TabNavigation=Yb,R.TabNavigationScroll=Qb,R.Table=La,R.TagInput=Pk,R.TagSelect=Hk,R.Tbody=$a,R.Td=Yt,R.TemplateCard=xy,R.Textarea=qn,R.Tfoot=Fa,R.Th=$r,R.Thead=Pa,R.ThemeToggle=Fv,R.ThreeColumnLayout=$5,R.Toast=iy,R.Toggle=za,R.Tr=Qn,R.Ul=Aa,R.UnifiedIcon=rb,R.UserProfile=gy,R.VersionList=ku,R.configureJSONLanguageService=z5,R.defaultJSONSchemas=Dm,R.executeImageDownload=Mc,R.initTemplate=Wm,R.jsonEditorDefaults=F5,R.monacoInitOptions=V5,R.templateMetadata=H5,R.useCurrentMultilingualLocale=Np,R.useImageGallery=ap,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({},ReactJSXRuntime,React,ReactDOM);
|
||
//# sourceMappingURL=components.iife.js.map
|