@designbasekorea/ui-wc 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/animation-background/canvas-controller.js +1 -1
- package/dist/esm/components/animation-background/controls.js +1 -0
- package/dist/esm/components/animation-background/graphite-controller.js +1 -0
- package/dist/esm/components/animation-background/graphite-presets.js +1 -0
- package/dist/esm/components/animation-background/graphite-shader.js +1 -0
- package/dist/esm/components/animation-background/layers.js +1 -1
- package/dist/esm/components/animation-background/lumina-shaders.js +1 -1
- package/dist/esm/components/animation-background/lumina-utils.js +1 -1
- package/dist/esm/components/animation-background/renderers.js +1 -1
- package/dist/esm/components/animation-background/shader-controller.js +1 -1
- package/dist/esm/components/db-accordion.d.ts +2 -0
- package/dist/esm/components/db-accordion.js +1 -1
- package/dist/esm/components/db-ad-banner.d.ts +26 -1
- package/dist/esm/components/db-ad-banner.js +1 -1
- package/dist/esm/components/db-animation-background.d.ts +23 -2
- package/dist/esm/components/db-animation-background.js +1 -1
- package/dist/esm/components/db-animation-text.d.ts +11 -0
- package/dist/esm/components/db-animation-text.js +1 -1
- package/dist/esm/components/db-breadcrumbs.d.ts +29 -0
- package/dist/esm/components/db-breadcrumbs.js +1 -1
- package/dist/esm/components/db-calendar.js +1 -1
- package/dist/esm/components/db-context-menu.js +1 -1
- package/dist/esm/components/db-cursor-follower.d.ts +1 -2
- package/dist/esm/components/db-cursor-follower.js +1 -1
- package/dist/esm/components/db-dropdown.js +1 -1
- package/dist/esm/components/db-footer.d.ts +74 -0
- package/dist/esm/components/db-footer.js +1 -0
- package/dist/esm/components/db-gantt.d.ts +96 -0
- package/dist/esm/components/db-gantt.js +1 -0
- package/dist/esm/components/db-grid-background.d.ts +93 -0
- package/dist/esm/components/db-grid-background.js +1 -0
- package/dist/esm/components/db-icons.js +1 -1
- package/dist/esm/components/db-indicator.d.ts +12 -0
- package/dist/esm/components/db-indicator.js +1 -1
- package/dist/esm/components/db-kanban.d.ts +70 -0
- package/dist/esm/components/db-kanban.js +1 -0
- package/dist/esm/components/db-lightbox.d.ts +1 -0
- package/dist/esm/components/db-lightbox.js +1 -1
- package/dist/esm/components/db-marquee.d.ts +26 -4
- package/dist/esm/components/db-marquee.js +1 -1
- package/dist/esm/components/db-masonry.js +1 -1
- package/dist/esm/components/db-navbar.d.ts +32 -1
- package/dist/esm/components/db-navbar.js +1 -1
- package/dist/esm/components/db-popover.js +1 -1
- package/dist/esm/components/db-progress.d.ts +10 -0
- package/dist/esm/components/db-progress.js +1 -1
- package/dist/esm/components/db-range-slider.d.ts +7 -0
- package/dist/esm/components/db-range-slider.js +1 -1
- package/dist/esm/components/db-section-app-download.d.ts +0 -2
- package/dist/esm/components/db-section-app-download.js +1 -1
- package/dist/esm/components/db-section-contact.d.ts +1 -3
- package/dist/esm/components/db-section-contact.js +1 -1
- package/dist/esm/components/db-section-cta.d.ts +24 -0
- package/dist/esm/components/db-section-cta.js +1 -0
- package/dist/esm/components/db-section-faq.d.ts +20 -0
- package/dist/esm/components/db-section-faq.js +1 -0
- package/dist/esm/components/db-section-feature-grid.d.ts +20 -0
- package/dist/esm/components/db-section-feature-grid.js +1 -0
- package/dist/esm/components/db-section-feature.d.ts +2 -2
- package/dist/esm/components/db-section-feature.js +1 -1
- package/dist/esm/components/db-section-logo-cloud.d.ts +20 -0
- package/dist/esm/components/db-section-logo-cloud.js +1 -0
- package/dist/esm/components/db-section-pricing.d.ts +20 -0
- package/dist/esm/components/db-section-pricing.js +1 -0
- package/dist/esm/components/db-section-stats.d.ts +20 -0
- package/dist/esm/components/db-section-stats.js +1 -0
- package/dist/esm/components/db-section-testimonials.d.ts +34 -0
- package/dist/esm/components/db-section-testimonials.js +1 -0
- package/dist/esm/components/db-share-icons.js +1 -1
- package/dist/esm/components/db-tooltip.d.ts +3 -0
- package/dist/esm/components/db-tooltip.js +1 -1
- package/dist/esm/components/marketing-block-host-utils.js +1 -0
- package/dist/esm/components/section-block-header-utils.js +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +664 -18
- package/dist/index.esm.js +1 -1
- package/dist/react/chunks/lottie-14e7addb.js +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +1165 -27
- package/dist/react/index.esm.js +1 -1
- package/package.json +1 -1
- package/dist/react/chunks/lottie-eed75107.js +0 -1
- /package/dist/chunks/{lottie-e741cdda.js → lottie-3b3dac01.js} +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t,g as e}from"./chunks/lottie-e741cdda.js";function _mergeNamespaces(t,e){return e.forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(s){if("default"!==s&&!(s in t)){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}})}),Object.freeze(t)}const s={"arrow-bar-left":'<path fill="currentColor" d="M20.75 20h-1.5V4h1.5zM11.03 6.53l-4.72 4.72H16v1.5H6.31l4.72 4.72-1.06 1.06L3.44 12l6.53-6.53z"/>',"arrow-bar-right":'<path fill="currentColor" d="M4.75 20h-1.5V4h1.5zm15.81-8-6.53 6.53-1.06-1.06 4.72-4.72H8v-1.5h9.69l-4.72-4.72 1.06-1.06z"/>',award:'<path fill="currentColor" d="M11.753 15.5c-1.8 0-3.5-.7-4.77-1.98a6.74 6.74 0 0 1-1.98-4.77c0-1.8.7-3.5 1.98-4.77A6.74 6.74 0 0 1 11.753 2c1.8 0 3.5.7 4.77 1.98a6.74 6.74 0 0 1 1.98 4.77c0 1.8-.7 3.5-1.98 4.77a6.74 6.74 0 0 1-4.77 1.98m0-12c-1.4 0-2.72.55-3.71 1.54a5.22 5.22 0 0 0-1.54 3.71c0 1.4.55 2.72 1.54 3.71a5.22 5.22 0 0 0 3.71 1.54c1.4 0 2.72-.55 3.71-1.54a5.22 5.22 0 0 0 1.54-3.71c0-1.4-.55-2.72-1.54-3.71a5.22 5.22 0 0 0-3.71-1.54"/><path fill="currentColor" d="M15.313 21.5a.74.74 0 0 1-.64-.37l-3.56-5.96a.751.751 0 1 1 1.29-.77l2.86 4.8 1.06-2.07a.76.76 0 0 1 .72-.41l2.33.17-2.95-4.99a.76.76 0 0 1 .26-1.03c.36-.21.82-.09 1.03.26l3.68 6.22c.14.24.14.54 0 .78s-.4.37-.69.35l-3.27-.23-1.45 2.83c-.12.24-.37.4-.64.41h-.02z"/><path fill="currentColor" d="M8.193 21.5h-.02c-.27 0-.52-.17-.64-.41l-1.45-2.83-3.28.23a.75.75 0 0 1-.69-.35.73.73 0 0 1 0-.78l3.69-6.18c.21-.36.67-.47 1.03-.26s.47.67.26 1.03l-2.95 4.95 2.34-.17c.31-.01.58.14.72.41l1.06 2.07 2.86-4.8c.21-.36.67-.47 1.03-.26s.47.67.26 1.03l-3.56 5.96c-.14.23-.38.37-.64.37z"/>',apple:'<path fill="currentColor" fill-rule="evenodd" d="M18.644 18.648q-.807 1.15-1.316 1.592-.787.723-1.692.744-.649.001-1.562-.373-.914-.372-1.683-.371-.805-.001-1.73.371-.924.375-1.495.393-.866.038-1.729-.764-.55-.48-1.377-1.648-.885-1.245-1.455-2.891-.61-1.78-.611-3.447 0-1.91.826-3.292a4.86 4.86 0 0 1 1.73-1.751 4.65 4.65 0 0 1 2.34-.662q.69.001 1.81.422t1.436.422q.237 0 1.593-.498 1.279-.46 2.163-.384 2.4.192 3.6 1.895-2.145 1.301-2.123 3.637.02 1.82 1.317 3.023a4.3 4.3 0 0 0 1.315.863q-.159.46-.336.882a10.3 10.3 0 0 1-1.021 1.837M14.959 5.039c-.836.976-1.846 1.541-2.941 1.452a3 3 0 0 1-.021-.36c0-.913.396-1.889 1.103-2.688q.528-.607 1.343-1.009.813-.397 1.536-.435.02.192.019.381-.001 1.426-1.039 2.659" clip-rule="evenodd"/>',"play-store":'<path fill="currentColor" fill-rule="evenodd" d="M15.911 8.659 6.36 3.29c-.633-.342-1.226-.39-1.746-.016l8.34 8.34zm3.578 4.69c.6-.336.929-.812.929-1.34 0-.527-.329-1.004-.928-1.34l-2.783-1.563-3.133 3.132 2.841 2.84zM4 4.659v14.706c0 .38.084.709.236.97l8.097-8.098L4.1 4.002c-.064.197-.1.417-.1.658m.902 16.25q.232.09.495.09.47 0 .968-.275l9.255-5.197-2.666-2.67z" clip-rule="evenodd"/>',"arrow-right":'<path fill="currentColor" d="m20.06 12-7.53 7.53-1.06-1.06 5.72-5.72H4v-1.5h13.19l-5.72-5.72 1.06-1.06z"/>',star:'<path fill="currentColor" fill-rule="evenodd" d="M12 1.25a.75.75 0 0 1 .673.419l2.926 5.945 6.509.944a.75.75 0 0 1 .417 1.278l-4.718 4.624 1.132 6.511a.75.75 0 0 1-1.083.796L12 18.744l-5.856 3.023a.75.75 0 0 1-1.083-.796l1.133-6.511-4.719-4.624a.75.75 0 0 1 .417-1.278l6.51-.944 2.925-5.945A.75.75 0 0 1 12 1.25m0 2.449L9.573 8.63a.75.75 0 0 1-.565.411l-5.4.783 3.917 3.84a.75.75 0 0 1 .214.664l-.941 5.412 4.858-2.508a.75.75 0 0 1 .688 0l4.858 2.508-.94-5.412a.75.75 0 0 1 .213-.665l3.918-3.84-5.4-.782a.75.75 0 0 1-.566-.41z" clip-rule="evenodd"/>',"star-filled":'<path fill="currentColor" d="M23 9c-.1-.4-.4-.6-.8-.7l-6.4-.9-2.9-5.8c-.3-.7-1.5-.7-1.8 0L8.2 7.4l-6.4.9c-.4 0-.7.3-.8.7s0 .8.3 1l4.6 4.5-1.1 6.4c0 .4 0 .8.4 1 .3.2.7.3 1.1 0l5.7-3 5.7 3c.1 0 .3.1.5.1s.4 0 .6-.2c.3-.2.5-.6.4-1l-1.1-6.4 4.6-4.5c.3-.3.4-.7.3-1z"/>',"star-half":'<path fill="currentColor" d="M8.9 8.3 2 9.3l5 4.8L5.8 21l6.2-3.2V2z"/><path fill="currentColor" fill-rule="evenodd" d="M12 1.25a.75.75 0 0 1 .673.419l2.926 5.945 6.509.944a.75.75 0 0 1 .417 1.278l-4.718 4.624 1.132 6.511a.75.75 0 0 1-1.083.796L12 18.744l-5.856 3.023a.75.75 0 0 1-1.083-.796l1.133-6.511-4.719-4.624a.75.75 0 0 1 .417-1.278l6.51-.944 2.925-5.945A.75.75 0 0 1 12 1.25m0 2.449L9.573 8.63a.75.75 0 0 1-.565.411l-5.4.783 3.917 3.84a.75.75 0 0 1 .214.664l-.941 5.412 4.858-2.508a.75.75 0 0 1 .688 0l4.858 2.508-.94-5.412a.75.75 0 0 1 .213-.665l3.918-3.84-5.4-.782a.75.75 0 0 1-.566-.41z" clip-rule="evenodd"/>',"trending-up":'<path fill="currentColor" d="M22 11V5h-6"/><path fill="currentColor" fill-rule="evenodd" d="M21.53 6.53 13 15.06l-3-3-6.47 6.47-1.06-1.06L10 9.94l3 3 7.47-7.47z" clip-rule="evenodd"/>',cart:'<path fill="currentColor" d="M3 2.25c.945 0 1.714.75 1.747 1.688L4.94 6.25h16.899l-1.167 10.5h-2.093a2.75 2.75 0 1 1-3.156 0H9.578a2.75 2.75 0 1 1-3.156 0H4.31L3.253 4.063 3.25 4.03V4A.25.25 0 0 0 3 3.75H1v-1.5zm5 15.5a1.25 1.25 0 1 0-.001 2.499A1.25 1.25 0 0 0 8 17.75m9 0a1.25 1.25 0 1 0-.001 2.499A1.25 1.25 0 0 0 17 17.75m-11.31-2.5h13.64l.832-7.5H5.064z"/>',"bell-active":'<path fill="currentColor" fill-rule="evenodd" d="M6.75 10.015V13c0 1.445-.466 2.453-1.06 3.25h12.62c-.594-.797-1.06-1.805-1.06-3.25v-2.985c-.047-1.117-.55-2.449-1.465-3.497C14.879 5.479 13.6 4.75 12 4.75s-2.879.73-3.785 1.768c-.914 1.048-1.418 2.38-1.465 3.497m.335-4.483C8.229 4.221 9.9 3.25 12 3.25s3.771.97 4.915 2.282c1.132 1.298 1.777 2.96 1.834 4.44l.001.028v3c0 1.67.788 2.477 1.78 3.47a.75.75 0 0 1-.53 1.28H4a.75.75 0 0 1-.53-1.28c.992-.992 1.78-1.8 1.78-3.47V9.971c.057-1.48.703-3.141 1.835-4.439" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M9 16.25a.75.75 0 0 1 .75.75v1c0 1.286.964 2.25 2.25 2.25s2.25-.964 2.25-2.25v-1a.75.75 0 0 1 1.5 0v1c0 2.114-1.636 3.75-3.75 3.75S8.25 20.114 8.25 18v-1a.75.75 0 0 1 .75-.75M17.424 2.52a.75.75 0 0 1 1.056-.096c1.307 1.089 2.463 2.786 3.19 4.24a.75.75 0 1 1-1.34.671c-.673-1.345-1.717-2.848-2.81-3.759a.75.75 0 0 1-.096-1.056M6.576 2.52a.75.75 0 0 1-.096 1.056c-1.093.911-2.137 2.414-2.81 3.76a.75.75 0 0 1-1.34-.671c.727-1.455 1.883-3.152 3.19-4.241a.75.75 0 0 1 1.056.096M12 1.25a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0V2a.75.75 0 0 1 .75-.75" clip-rule="evenodd"/>',"caret-down-filled":'<path fill="currentColor" d="m12 14.5 5-5H7z"/>',"caret-updown-filled":'<path fill="currentColor" fill-rule="evenodd" d="m7 10 5-5 5 5zM17 14l-5 5-5-5z" clip-rule="evenodd"/>',"chevron-down":'<path fill="currentColor" fill-rule="evenodd" d="m5.47 9.53 1.06-1.06L12 13.94l5.47-5.47 1.06 1.06L12 16.06z" clip-rule="evenodd"/>',"chevron-up":'<path fill="currentColor" fill-rule="evenodd" d="m12 7.94 6.53 6.53-1.06 1.06L12 10.06l-5.47 5.47-1.06-1.06z" clip-rule="evenodd"/>',"chevron-left":'<path fill="currentColor" fill-rule="evenodd" d="m10.06 12 5.47-5.47-1.06-1.06L7.94 12l6.53 6.53 1.06-1.06z" clip-rule="evenodd"/>',"chevron-right":'<path fill="currentColor" fill-rule="evenodd" d="M9.53 5.47 16.06 12l-6.53 6.53-1.06-1.06L13.94 12 8.47 6.53z" clip-rule="evenodd"/>',calendar:'<path fill="currentColor" fill-rule="evenodd" d="M16.25 8V2h1.5v6zM6.25 8V2h1.5v6zM21 11.75H3v-1.5h18z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 5.75a.25.25 0 0 0-.25.25v14c0 .138.112.25.25.25h16a.25.25 0 0 0 .25-.25V6a.25.25 0 0 0-.25-.25zM2.25 6c0-.966.784-1.75 1.75-1.75h16c.966 0 1.75.784 1.75 1.75v14A1.75 1.75 0 0 1 20 21.75H4A1.75 1.75 0 0 1 2.25 20z" clip-rule="evenodd"/>',clock:'<path fill="currentColor" fill-rule="evenodd" d="M12.75 11.25V6h-1.5v6.75H16v-1.5z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12" clip-rule="evenodd"/>',bulb:'<path fill="currentColor" d="M15.5 17.5H8v-.75s-.02-1.79-1.06-3.21l-.29-.39C5.88 12.12 5 10.95 5 8.93 5 5.11 8.03 2 11.75 2s6.75 3.11 6.75 6.93c0 2-.87 3.17-1.65 4.2l-.29.39c-1.05 1.45-1.06 3.21-1.06 3.23zM9.44 16h4.62c.11-.81.42-2.16 1.29-3.36l.31-.41c.69-.93 1.35-1.8 1.35-3.31 0-2.99-2.36-5.43-5.25-5.43S6.5 5.93 6.5 8.93c0 1.52.66 2.4 1.35 3.32l.31.41c.86 1.19 1.17 2.53 1.28 3.34M15.75 20h-8v1.5h8z"/>',"circle-checked":'<path fill="currentColor" fill-rule="evenodd" d="m10.32 14.27 6.15-6.134 1.06 1.062-7.22 7.2L6.467 12.5l1.068-1.054z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M1.25 12C1.25 6.086 6.086 1.25 12 1.25S22.75 6.086 22.75 12 17.914 22.75 12 22.75 1.25 17.914 1.25 12M12 2.75c-5.086 0-9.25 4.164-9.25 9.25s4.164 9.25 9.25 9.25 9.25-4.164 9.25-9.25S17.086 2.75 12 2.75" clip-rule="evenodd"/>',"cloud-close":'<path fill="currentColor" fill-rule="evenodd" d="M5.23 9.323A7.75 7.75 0 0 1 12.5 4.25c3.782 0 6.923 2.71 7.606 6.291A4.74 4.74 0 0 1 23.25 15a4.75 4.75 0 0 1-4.75 4.75H6A5.25 5.25 0 0 1 .75 14.5c0-2.64 1.95-4.805 4.48-5.177M12.5 5.75a6.25 6.25 0 0 0-5.993 4.483l-.15.512-.534.025A3.74 3.74 0 0 0 2.25 14.5 3.75 3.75 0 0 0 6 18.25h12.5a3.243 3.243 0 0 0 .763-6.398l-.504-.122-.064-.514A6.25 6.25 0 0 0 12.5 5.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m14.47 15.53-5-5 1.06-1.06 5 5z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m9.47 14.47 5-5 1.06 1.06-5 5z" clip-rule="evenodd"/>',close:'<path fill="currentColor" fill-rule="evenodd" d="m5.47 17.47 12-12 1.06 1.06-12 12z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m6.53 5.47 12 12-1.06 1.06-12-12z" clip-rule="evenodd"/>',done:'<path fill="currentColor" fill-rule="evenodd" d="M9.476 15.936 18.97 6.47l1.06 1.062L9.468 18.064l-5.502-5.58 1.068-1.053z" clip-rule="evenodd"/>',"error-filled":'<path fill="currentColor" fill-rule="evenodd" d="M12 2.25a9.75 9.75 0 1 0 0 19.5 9.75 9.75 0 0 0 0-19.5M8.47 9.53l1.06-1.06L12 10.94l2.47-2.47 1.06 1.06L13.06 12l2.47 2.47-1.06 1.06L12 13.06l-2.47 2.47-1.06-1.06L10.94 12z" clip-rule="evenodd"/>',edit:'<path fill="currentColor" fill-rule="evenodd" d="M15.506 3.322a3.655 3.655 0 0 1 5.172 0 3.655 3.655 0 0 1 0 5.172L7.466 21.75H2.25v-5.215zm2.586.428c-.572 0-1.121.227-1.525.632l-.002.001L3.75 17.157v3.093h3.093L19.618 7.434a2.16 2.16 0 0 0-1.526-3.684" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M17.7 10.453 13.548 6.3l1.06-1.06 4.154 4.154z" clip-rule="evenodd"/>',eyedropper:'<path fill="currentColor" d="M17.889 11.615a.25.25 0 0 0 0-.353l-5.657-5.657a.25.25 0 0 0-.354 0l-1.414 1.414a.25.25 0 0 0 0 .354l5.657 5.656a.25.25 0 0 0 .354 0zm-.354 2.475a1.75 1.75 0 0 1-2.475 0L9.404 8.433a1.75 1.75 0 0 1 0-2.475l1.414-1.414a1.75 1.75 0 0 1 2.475 0l5.657 5.657a1.75 1.75 0 0 1 0 2.475z"/><path fill="currentColor" d="m15.951 12.86-7.077 7.076-.262.03-1.009.11-.453.454a2.85 2.85 0 0 1-4.03-4.03l.42-.42v-1.41l7.11-7.11zM5.04 15.291v1.41l-.86.86a1.35 1.35 0 0 0 1.91 1.909l.826-.826.262-.03 1.007-.111 5.644-5.644-3.18-3.178zM15.36 2.84a2.754 2.754 0 0 1 3.89 0l1.41 1.41a2.754 2.754 0 0 1 0 3.89l-2.94 2.941-5.3-5.3zm2.83 1.06a1.254 1.254 0 0 0-1.77 0l-1.88 1.88 3.18 3.18 1.88-1.88a1.255 1.255 0 0 0 0-1.77z"/><path fill="currentColor" d="m12.743 14.25-.006 1.5-8.46-.03.006-1.5z"/>',gallery:'<path fill="currentColor" d="M7.5 11c.8 0 1.5-.7 1.5-1.5S8.3 8 7.5 8 6 8.7 6 9.5 6.7 11 7.5 11"/><path fill="currentColor" fill-rule="evenodd" d="m16.698 9.015 5.787 4.913-.97 1.144-4.813-4.087L5.487 20.57l-.974-1.14z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 4.75c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h16c.69 0 1.25-.56 1.25-1.25V6c0-.69-.56-1.25-1.25-1.25zM1.25 6A2.75 2.75 0 0 1 4 3.25h16A2.75 2.75 0 0 1 22.75 6v12A2.75 2.75 0 0 1 20 20.75H4A2.75 2.75 0 0 1 1.25 18z" clip-rule="evenodd"/>',hide:'<path fill="currentColor" fill-rule="evenodd" d="M8.343 11.2c.056-.27.147-.581.284-.842l1.328.696c-.047.09-.102.252-.145.454-.041.199-.06.381-.06.492A2.27 2.27 0 0 0 12 14.25c.284 0 .685-.056.983-.2l.65 1.352c-.57.274-1.217.348-1.633.348-2.056 0-3.75-1.694-3.75-3.75 0-.238.035-.527.093-.8" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M2.833 12c.477-.936 1.58-2.68 3.626-3.843l-.742-1.304c-2.695 1.534-3.975 3.906-4.4 4.835L1.176 12l.143.312c.685 1.5 3.5 6.438 10.682 6.438 1.62 0 3.026-.253 4.242-.667l-.484-1.42c-1.054.36-2.297.587-3.758.587-5.874 0-8.377-3.707-9.167-5.25M12 6.75c-.673 0-1.6.084-2.202.227l-.346-1.46c.746-.177 1.797-.267 2.548-.267 7.182 0 9.997 4.939 10.682 6.438l.143.312-.143.312a11.1 11.1 0 0 1-3.22 4.037l-.923-1.184A9.7 9.7 0 0 0 21.166 12c-.79-1.544-3.292-5.25-9.166-5.25" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m19.763 22.237-18-18 1.06-1.06 18 18z" clip-rule="evenodd"/>',"info-filled":'<path fill="currentColor" fill-rule="evenodd" d="M12 2.25a9.75 9.75 0 1 0 0 19.5 9.75 9.75 0 0 0 0-19.5m-.75 5h1.5v1.5h-1.5zm0 3h1.5v6.5h-1.5z" clip-rule="evenodd"/>',lock:'<path fill="currentColor" fill-rule="evenodd" d="M5 11.75a.25.25 0 0 0-.25.25v8c0 .138.112.25.25.25h14a.25.25 0 0 0 .25-.25v-8a.25.25 0 0 0-.25-.25zM3.25 12c0-.966.784-1.75 1.75-1.75h14c.966 0 1.75.784 1.75 1.75v8A1.75 1.75 0 0 1 19 21.75H5A1.75 1.75 0 0 1 3.25 20z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M12 3.75A3.26 3.26 0 0 0 8.75 7v4h-1.5V7A4.76 4.76 0 0 1 12 2.25 4.76 4.76 0 0 1 16.75 7v4h-1.5V7A3.26 3.26 0 0 0 12 3.75" clip-rule="evenodd"/>',mail:'<path fill="currentColor" fill-rule="evenodd" d="m1.665 8.67.67-1.34L12 12.161l9.665-4.833.67 1.342L12 13.839z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h16c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25zM1.25 7A2.75 2.75 0 0 1 4 4.25h16A2.75 2.75 0 0 1 22.75 7v10A2.75 2.75 0 0 1 20 19.75H4A2.75 2.75 0 0 1 1.25 17z" clip-rule="evenodd"/>',minus:'<path fill="currentColor" fill-rule="evenodd" d="M6 10.75h12v1.5H6z" clip-rule="evenodd"/>',"more-vertical":'<path fill="currentColor" d="M11.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M11.5 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M11.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"/>',pause:'<path fill="currentColor" fill-rule="evenodd" d="M8 6.75h2.5v10.5H8zm5.5 0H16v10.5h-2.5z" clip-rule="evenodd"/>',play:'<path fill="currentColor" fill-rule="evenodd" d="M9.5 7.21v9.58l7.5-4.79z" clip-rule="evenodd"/>',plus:'<path fill="currentColor" fill-rule="evenodd" d="M11.25 11.25v-7h1.5v7h7v1.5h-7v7h-1.5v-7h-7v-1.5z" clip-rule="evenodd"/>',copy:'<path fill="currentColor" fill-rule="evenodd" d="M8 3.75a.25.25 0 0 0-.25.25v12c0 .138.112.25.25.25h12a.25.25 0 0 0 .25-.25V4a.25.25 0 0 0-.25-.25zM6.25 4c0-.966.784-1.75 1.75-1.75h12c.966 0 1.75.784 1.75 1.75v12A1.75 1.75 0 0 1 20 17.75H8A1.75 1.75 0 0 1 6.25 16z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M3.75 9v9A2.25 2.25 0 0 0 6 20.25h9v1.5H6A3.75 3.75 0 0 1 2.25 18V9z" clip-rule="evenodd"/>',code:'<path fill="currentColor" fill-rule="evenodd" d="m6.47 7.47 1.06 1.06L4.06 12l3.47 3.47-1.06 1.06L1.94 12zM19.94 12l-3.47-3.47 1.06-1.06L22.06 12l-4.53 4.53-1.06-1.06zM8.31 18.705l6-14 1.38.59-6 14z" clip-rule="evenodd"/>',write:'<path fill="currentColor" fill-rule="evenodd" d="M3.056 6.056A2.75 2.75 0 0 1 5 5.25h3v1.5H5A1.25 1.25 0 0 0 3.75 8v11A1.25 1.25 0 0 0 5 20.25h11A1.25 1.25 0 0 0 17.25 19v-3h1.5v3A2.75 2.75 0 0 1 16 21.75H5A2.75 2.75 0 0 1 2.25 19V8c0-.73.29-1.429.806-1.944" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M16.885 3.084a2.85 2.85 0 0 1 4.03 4.03l-9.604 9.636H7.25v-4.061zm2.015.666a1.35 1.35 0 0 0-.955.395L8.75 13.311v1.939h1.939l9.166-9.195A1.35 1.35 0 0 0 18.9 3.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m18.47 8.53-3-3 1.06-1.06 3 3z" clip-rule="evenodd"/>',upload:'<path fill="currentColor" d="m12 2.94 5.53 5.53-1.06 1.06-3.72-3.72V17h-1.5V5.81L7.53 9.53 6.47 8.47z"/><path fill="currentColor" d="M2.25 15h1.5v4.25h16.5V15h1.5v5.75H2.25z"/>',video:'<path fill="currentColor" fill-rule="evenodd" d="M21.37 6.347a.75.75 0 0 1 .38.653v10a.75.75 0 0 1-1.136.643l-5-3a.75.75 0 1 1 .772-1.286l3.864 2.318v-7.35l-3.864 2.318a.75.75 0 1 1-.772-1.286l5-3a.75.75 0 0 1 .755-.01" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M2.25 6A.75.75 0 0 1 3 5.25h13a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H3a.75.75 0 0 1-.75-.75zm1.5.75v10.5h11.5V6.75z" clip-rule="evenodd"/>',"volume-up":'<path fill="currentColor" fill-rule="evenodd" d="M12.325 4.324A.75.75 0 0 1 12.75 5v14a.75.75 0 0 1-1.219.586L6.738 15.75H3a.75.75 0 0 1-.75-.75V9A.75.75 0 0 1 3 8.25h3.737l4.794-3.836a.75.75 0 0 1 .794-.09M11.25 6.56 7.469 9.586A.75.75 0 0 1 7 9.75H3.75v4.5H7a.75.75 0 0 1 .469.164l3.781 3.025zM17.57 4.37a.75.75 0 0 1 1.06 0c2.046 2.046 3.12 4.739 3.12 7.63 0 2.908-1.185 5.589-3.105 7.616a.75.75 0 1 1-1.09-1.032c1.68-1.773 2.695-4.092 2.695-6.584 0-2.508-.926-4.815-2.68-6.57a.75.75 0 0 1 0-1.06" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M14.97 7.97a.75.75 0 0 1 1.06 0c1.025 1.025 1.72 2.51 1.72 4.03 0 1.485-.571 2.998-1.748 4.058a.75.75 0 1 1-1.004-1.115c.823-.741 1.252-1.828 1.252-2.943 0-1.08-.505-2.195-1.28-2.97a.75.75 0 0 1 0-1.06" clip-rule="evenodd"/>',"mute-filled":'<path fill="currentColor" d="M12.3 4.1h.1c-.3-.2-.8 0-1.1.1L6.6 8H3c-.6 0-1 .4-1 1v6c0 .6.4 1 1 1h3.6l4.7 3.8c.2.1.4.2.6.2h.4c.3-.2.6-.5.6-.9V5q0-.6-.6-.9M21.9 9.7l-1.4-1.4-2.3 2.3-2.3-2.3-1.4 1.4 2.3 2.3-2.3 2.3 1.4 1.4 2.3-2.3 2.3 2.3 1.4-1.4-2.3-2.3z"/>',package:'<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M12 1.14 21.65 6.56v9.78L12 21.76 2.35 16.44V6.56zm-8.15 6.3v8.12L12 20.04l7.8-4.48V7.44L12 2.86z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M21.27 7.75 12.37 12.75l-.74-1.31 8.9-5z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M11.25 21v-8.9h1.5V21z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M3.47 6.35 12.37 11.45l-.75 1.3-8.9-5.1z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M7.23 8.85 16.13 3.85l.74 1.3-8.9 5z"/>',"delivery-filled":'<path fill="currentColor" d="M22.68 11.13 21.45 8.66A2.25 2.25 0 0 0 18.76 7H18a3 3 0 0 0-3-3H4a3 3 0 0 0-3 3v9c0 .87.39 1.67 1.02 2.23.14 1.54 1.43 2.77 3 2.77 1.3 0 2.4-.84 2.82-2h6.37c.42 1.16 1.52 2 2.82 2 1.65 0 3-1.35 3-3h1c1.1 0 2-.9 2-2v-3.53c0-.46-.11-.92-.32-1.34M5 19c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m12 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-3h-1.78c-.33-.37-.75-.65-1.22-.82V9h.76c.38 0 .73.21.9.55l1.24 2.47c.07.14.1.3.1.47z"/>',repeat:'<path fill="currentColor" fill-rule="evenodd" d="m18.94 6-3.47-3.47 1.06-1.06L21.06 6l-4.53 4.53-1.06-1.06z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M5.532 7.433c.587-.488 1.3-.783 1.968-.783h12.4v-1.5H7.5c-1.116 0-2.183.49-2.988 1.18l-.044.038-.037.044C3.757 7.197 3.25 8.164 3.25 9.3V11h1.5V9.3c0-.648.279-1.267.782-1.867M5.06 18l3.47-3.47-1.06-1.06L2.94 18l4.53 4.53 1.06-1.06z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M19.25 14.7V13h1.5v1.7c0 1.136-.508 2.103-1.18 2.888l-.038.044-.044.037c-.805.69-1.872 1.181-2.988 1.181H4v-1.5h12.5c.668 0 1.381-.295 1.968-.783.503-.6.782-1.22.782-1.867" clip-rule="evenodd"/>',settings:'<path fill="currentColor" fill-rule="evenodd" d="M8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0M12 9.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M9.757 1.888a.75.75 0 0 1 .742-.639h3a.75.75 0 0 1 .742.639l.425 2.836q.303.11.594.244l2.304-1.703a.75.75 0 0 1 .976.073l2.121 2.12a.75.75 0 0 1 .073.977l-1.702 2.304q.134.291.244.594l2.835.425a.75.75 0 0 1 .639.742v3a.75.75 0 0 1-.639.742l-2.836.425q-.11.303-.243.594l1.702 2.304a.75.75 0 0 1-.073.976l-2.12 2.121a.75.75 0 0 1-.977.073l-2.304-1.702q-.291.134-.594.244l-.425 2.835a.75.75 0 0 1-.742.639h-3a.75.75 0 0 1-.742-.639l-.425-2.836a8 8 0 0 1-.594-.244l-2.304 1.703a.75.75 0 0 1-.976-.073l-2.121-2.12a.75.75 0 0 1-.073-.977l1.702-2.304a8 8 0 0 1-.244-.594l-2.835-.425a.75.75 0 0 1-.639-.742v-3a.75.75 0 0 1 .639-.742l2.836-.425q.11-.303.244-.594L3.264 6.435a.75.75 0 0 1 .073-.976l2.12-2.121a.75.75 0 0 1 .977-.073l2.304 1.702q.291-.134.594-.244zm1.388.861-.398 2.653a.75.75 0 0 1-.53.608 6 6 0 0 0-1.197.493.75.75 0 0 1-.804-.056L6.062 4.855 4.854 6.063l1.592 2.154a.75.75 0 0 1 .056.804 6.2 6.2 0 0 0-.493 1.2.75.75 0 0 1-.608.527l-2.653.398v1.708l2.653.398a.75.75 0 0 1 .608.53q.188.634.493 1.197a.75.75 0 0 1-.056.804l-1.592 2.154 1.208 1.208 2.154-1.592a.75.75 0 0 1 .804-.056q.562.304 1.2.493a.75.75 0 0 1 .527.608l.398 2.653h1.708l.398-2.653a.75.75 0 0 1 .53-.608q.634-.188 1.197-.493a.75.75 0 0 1 .804.056l2.154 1.592 1.208-1.208-1.592-2.154a.75.75 0 0 1-.056-.804q.304-.562.493-1.2a.75.75 0 0 1 .608-.527l2.653-.398v-1.708l-2.653-.398a.75.75 0 0 1-.608-.53 6 6 0 0 0-.493-1.197.75.75 0 0 1 .056-.804l1.592-2.154-1.208-1.208-2.154 1.592a.75.75 0 0 1-.804.056 6.2 6.2 0 0 0-1.2-.493.75.75 0 0 1-.527-.608l-.398-2.653z" clip-rule="evenodd"/>',refresh:'<path fill="currentColor" fill-rule="evenodd" d="M20.25 8.25V3h1.5v6.75H16v-1.5z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M12 3.75A8.25 8.25 0 0 0 3.75 12 8.25 8.25 0 0 0 12 20.25 8.25 8.25 0 0 0 20.25 12h1.5A9.75 9.75 0 0 1 12 21.75 9.75 9.75 0 0 1 2.25 12 9.75 9.75 0 0 1 12 2.25a9.75 9.75 0 0 1 8.628 5.205l.094.106.324.361.011.012.462.517a3 3 0 0 1 .098.123c.007.01.03.044.054.09l-1.342.671a.586.586 0 0 0 .068.11l.009.012-.021-.025q-.037-.043-.107-.12l-.335-.373-.013-.015-.494-.554-.05-.065a1 1 0 0 1-.05-.084l-.002-.004A8.25 8.25 0 0 0 12 3.75" clip-rule="evenodd"/>',expand:'<path fill="currentColor" fill-rule="evenodd" d="M17.25 6.75H12v-1.5h6.75V12h-1.5zM6.75 17.25V12h-1.5v6.75H12v-1.5z" clip-rule="evenodd"/>',shrink:'<path fill="currentColor" fill-rule="evenodd" d="M9.25 14.75H4v-1.5h6.75V20h-1.5zM13.75 10.25V5h-1.5v6.75H19v-1.5z" clip-rule="evenodd"/>',"grip-vertical":'<path fill="currentColor" d="M9.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M14.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M14.5 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M14.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"/>',"grip-horizontal":'<path fill="currentColor" d="M8 9.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M13.5 9.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M19 9.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M8 14.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M13.5 14.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M19 14.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0"/>',search:'<path fill="currentColor" fill-rule="evenodd" d="M2.25 11c0-4.814 3.936-8.75 8.75-8.75s8.75 3.936 8.75 8.75-3.936 8.75-8.75 8.75S2.25 15.814 2.25 11M11 3.75c-3.986 0-7.25 3.264-7.25 7.25s3.264 7.25 7.25 7.25 7.25-3.264 7.25-7.25S14.986 3.75 11 3.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m17.13 16.07 4.4 4.4-1.06 1.06-4.4-4.4z" clip-rule="evenodd"/>',"share-alt":'<path fill="currentColor" fill-rule="evenodd" d="M13.69 3.317a.75.75 0 0 1 .804.119l8 7a.75.75 0 0 1 0 1.128l-8 7A.75.75 0 0 1 13.25 18v-3.24c-1.925.051-3.579.315-5.062.932-1.659.692-3.157 1.85-4.588 3.758A.75.75 0 0 1 2.25 19c0-4.145 1.147-6.888 3.291-8.698 1.96-1.655 4.655-2.437 7.709-2.943V4a.75.75 0 0 1 .44-.683m1.06 2.336V8a.75.75 0 0 1-.638.742c-3.283.497-5.85 1.225-7.603 2.706-1.359 1.147-2.303 2.812-2.631 5.39 1.153-1.15 2.386-1.969 3.734-2.53 1.928-.804 4.04-1.058 6.388-1.058a.75.75 0 0 1 .75.75v2.347L20.861 11z" clip-rule="evenodd"/>',show:'<path fill="currentColor" fill-rule="evenodd" d="M8.25 12c0-2.055 1.695-3.75 3.75-3.75s3.75 1.694 3.75 3.75-1.694 3.75-3.75 3.75S8.25 14.056 8.25 12M12 9.75A2.27 2.27 0 0 0 9.75 12 2.27 2.27 0 0 0 12 14.25 2.27 2.27 0 0 0 14.25 12 2.27 2.27 0 0 0 12 9.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M2.833 12c.791 1.543 3.297 5.25 9.167 5.25 5.872 0 8.374-3.704 9.167-5.25-.791-1.543-3.297-5.25-9.167-5.25-5.871 0-8.374 3.704-9.167 5.25m-1.515-.312C2.006 10.183 4.823 5.25 12 5.25s9.997 4.938 10.682 6.438l.143.312-.143.312C21.994 13.817 19.177 18.75 12 18.75s-9.997-4.938-10.682-6.438L1.175 12z" clip-rule="evenodd"/>',sparkle:'<path fill="currentColor" fill-rule="evenodd" d="M12 2.25 14.08 8 19.75 10l-5.67 2L12 17.75 9.92 12 4.25 10l5.67-2zm0 4.4-.9 2.49-2.45.86 2.45.86.9 2.49.9-2.49 2.45-.86-2.45-.86zM18.5 15.25l.88 2.37 2.37.88-2.37.88-.88 2.37-.88-2.37-2.37-.88 2.37-.88z" clip-rule="evenodd"/>',trash:'<path fill="currentColor" fill-rule="evenodd" d="M6.75 6v13c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25V6h1.5v13A2.75 2.75 0 0 1 16 21.75H8A2.75 2.75 0 0 1 5.25 19V6z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M21 6.75H3v-1.5h18z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M7.25 4c0-.966.784-1.75 1.75-1.75h6c.966 0 1.75.784 1.75 1.75v2h-1.5V4a.25.25 0 0 0-.25-.25H9a.25.25 0 0 0-.25.25v2h-1.5zM9.25 16V9h1.5v7zM13.25 16V9h1.5v7z" clip-rule="evenodd"/>',user:'<path fill="currentColor" fill-rule="evenodd" d="M8.652 3.687C9.52 2.708 10.833 2.25 12 2.25c1.198 0 2.38.478 3.313 1.402.979.868 1.437 2.181 1.437 3.348 0 1.198-.477 2.38-1.402 3.313-.868.979-2.181 1.437-3.348 1.437-1.198 0-2.38-.477-3.313-1.402C7.715 9.488 7.25 8.277 7.25 7c0-1.198.478-2.38 1.402-3.313M12 3.75c-.826 0-1.703.336-2.236.944l-.016.019-.018.017c-.664.664-.98 1.475-.98 2.27 0 .915.329 1.697.944 2.236l.019.016.017.018c.664.664 1.475.98 2.27.98.826 0 1.703-.336 2.236-.944l.016-.019.018-.017c.664-.664.98-1.475.98-2.27 0-.826-.336-1.703-.944-2.236l-.019-.016-.017-.018c-.664-.664-1.475-.98-2.27-.98M8 15.75c-.795 0-1.606.317-2.27.98l-.017.018-.02.016c-.614.539-.943 1.321-.943 2.236v3h-1.5v-3c0-1.277.465-2.487 1.437-3.348.934-.925 2.115-1.402 3.313-1.402h8c1.277 0 2.487.465 3.348 1.437.925.934 1.402 2.115 1.402 3.313v3h-1.5v-3c0-.795-.317-1.606-.98-2.27l-.018-.017-.016-.02c-.539-.614-1.321-.943-2.236-.943z" clip-rule="evenodd"/>',"warning-filled":'<path fill="currentColor" fill-rule="evenodd" d="M10.34 3.78a1.9 1.9 0 0 1 3.32 0l8.06 14.5A1.9 1.9 0 0 1 20.06 21H3.94a1.9 1.9 0 0 1-1.66-2.72zm.91 5.47h1.5v5.5h-1.5zm0 7h1.5v1.5h-1.5z" clip-rule="evenodd"/>'};function isDbIconName(t){return Object.prototype.hasOwnProperty.call(s,t)}function getDbComponentIconSize(t){return"s"===t?12:"l"===t?20:16}function createDbIcon(t,e=16){const i=document.createElement("template");return i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" width="${e}" height="${e}" aria-hidden="true" focusable="false" data-designbase-icon="${t}">${s[t]}</svg>`,i.content.firstElementChild}const i=["disabled","loading","icon-only","full-width"],n=["primary","secondary","tertiary","danger","ghost","accent"],a=["s","m","l"],r=["none","s","m","l","pill"],l=["gradient","backlight"];class DbButton extends HTMLElement{constructor(){super(...arguments),this.handleClick=t=>{if(this.disabled||this.loading)return t.preventDefault(),void t.stopPropagation();this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.disabled||this.loading||this.classList.add("designbase-wc-button--pressed"),this.click())},this.handleKeyUp=t=>{"Enter"!==t.key&&" "!==t.key||this.classList.remove("designbase-wc-button--pressed")},this.handlePointerDown=()=>{this.disabled||this.loading||this.classList.add("designbase-wc-button--pressed")},this.handlePointerUp=()=>{this.classList.remove("designbase-wc-button--pressed")}}static get observedAttributes(){return["variant","size","radius","accent-style","type","loading-text","start-icon","end-icon",...i]}get variant(){return this.getAttribute("variant")||"primary"}set variant(t){this.setAttribute("variant",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get radius(){return this.getAttribute("radius")||""}set radius(t){t?this.setAttribute("radius",t):this.removeAttribute("radius")}get accentStyle(){return this.getAttribute("accent-style")||"gradient"}set accentStyle(t){t?this.setAttribute("accent-style",t):this.removeAttribute("accent-style")}get type(){return this.getAttribute("type")||"button"}set type(t){this.setAttribute("type",t)}get loadingText(){return this.getAttribute("loading-text")||""}set loadingText(t){t?this.setAttribute("loading-text",t):this.removeAttribute("loading-text")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}get loading(){return this.hasAttribute("loading")}set loading(t){this.toggleAttribute("loading",t)}get iconOnly(){return this.hasAttribute("icon-only")}set iconOnly(t){this.toggleAttribute("icon-only",t)}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(t){this.toggleAttribute("full-width",t)}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("keyup",this.handleKeyUp),this.addEventListener("pointerdown",this.handlePointerDown),this.addEventListener("pointerup",this.handlePointerUp),this.addEventListener("pointerleave",this.handlePointerUp),this.addEventListener("pointercancel",this.handlePointerUp),this.syncAttributes()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("keyup",this.handleKeyUp),this.removeEventListener("pointerdown",this.handlePointerDown),this.removeEventListener("pointerup",this.handlePointerUp),this.removeEventListener("pointerleave",this.handlePointerUp),this.removeEventListener("pointercancel",this.handlePointerUp)}attributeChangedCallback(){this.syncAttributes()}syncAttributes(){this.classList.add("designbase-wc-button"),this.setAttribute("role","button"),this.setAttribute("aria-disabled",String(this.disabled||this.loading)),this.disabled||this.loading?this.removeAttribute("tabindex"):this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.syncModifier("variant",this.variant),this.syncModifier("size",this.size),this.syncRadius(),this.syncAccentStyle(),this.syncAccentField(),this.syncBooleanModifier("disabled"),this.syncBooleanModifier("icon-only"),this.syncBooleanModifier("full-width"),this.syncLoadingVisual(),this.loading?(this.querySelector(":scope > .designbase-wc-button__start-icon")?.remove(),this.querySelector(":scope > .designbase-wc-button__end-icon")?.remove()):this.syncIcons()}getIconSize(){return"s"===this.size?16:"l"===this.size?24:20}resolveIconName(t){if(t&&isDbIconName(t))return t}isManagedIconNode(t){return t instanceof HTMLElement&&(t.classList.contains("designbase-wc-button__start-icon")||t.classList.contains("designbase-wc-button__end-icon")||t.classList.contains("designbase-wc-button__spinner")||t.classList.contains("designbase-wc-button__accent-field")||t.classList.contains("designbase-wc-button__accent-glass")||t.classList.contains("designbase-wc-button__accent-orb"))}syncIcons(){const t=this.resolveIconName(this.getAttribute("start-icon")),e=this.resolveIconName(this.getAttribute("end-icon")),s=this.getIconSize();let i=this.querySelector(":scope > .designbase-wc-button__start-icon");if(t){if(!i){i=document.createElement("span"),i.className="designbase-wc-button__start-icon",i.setAttribute("aria-hidden","true");const t=Array.from(this.childNodes).find(t=>!this.isManagedIconNode(t));t?this.insertBefore(i,t):this.append(i)}i.replaceChildren(createDbIcon(t,s))}else i?.remove();let n=this.querySelector(":scope > .designbase-wc-button__end-icon");e?(n||(n=document.createElement("span"),n.className="designbase-wc-button__end-icon",n.setAttribute("aria-hidden","true")),n.replaceChildren(createDbIcon(e,s)),this.append(n)):n?.remove()}getDefaultRadiusClass(){return r.includes(this.radius)?`designbase-wc-button--radius-${this.radius}`:"designbase-wc-button--radius-pill"}syncRadius(){r.forEach(t=>this.classList.remove(`designbase-wc-button--radius-${t}`)),this.classList.add(this.getDefaultRadiusClass())}syncAccentStyle(){if(l.forEach(t=>this.classList.remove(`designbase-wc-button--accent-${t}`)),"accent"!==this.variant)return;const t=this.accentStyle,e=l.includes(t)?t:"gradient";this.classList.add(`designbase-wc-button--accent-${e}`)}syncAccentField(){const t="accent"===this.variant&&"gradient"===this.accentStyle,e=this.querySelector(":scope > .designbase-wc-button__accent-field"),s=this.querySelector(":scope > .designbase-wc-button__accent-glass");if(!t)return e?.remove(),void s?.remove();let i=e;if(!i){i=document.createElement("span"),i.className="designbase-wc-button__accent-field",i.setAttribute("aria-hidden","true");for(let t=1;t<=5;t+=1){const e=document.createElement("span");e.className=`designbase-wc-button__accent-orb designbase-wc-button__accent-orb--${t}`,i.appendChild(e)}this.insertBefore(i,this.firstChild)}if(!s){const t=document.createElement("span");t.className="designbase-wc-button__accent-glass",t.setAttribute("aria-hidden","true"),i.insertAdjacentElement("afterend",t)}}syncModifier(t,e){if(Array.from(this.classList).filter(e=>e.startsWith(`designbase-wc-button--${t}-`)).forEach(t=>this.classList.remove(t)),"variant"===t||"size"===t){("variant"===t?n:a).forEach(t=>this.classList.remove(`designbase-wc-button--${t}`)),this.classList.add(`designbase-wc-button--${e}`)}}syncBooleanModifier(t){const e=`designbase-wc-button--${t}`;this.classList.toggle(e,this.hasAttribute(t))}getSpinnerSize(){return a.includes(this.size)?this.size:"m"}syncLoadingVisual(){this.classList.toggle("designbase-wc-button--loading",this.loading);const t=this.querySelector(":scope > .designbase-wc-button__spinner");if(!this.loading)return void t?.remove();const e=`designbase-wc-button__spinner designbase-wc-spinner designbase-wc-spinner--circular designbase-wc-spinner--${this.getSpinnerSize()}`;if(t)return t.className=e,void t.setAttribute("aria-hidden","true");const s=document.createElement("span");s.className=e,s.setAttribute("aria-hidden","true"),s.innerHTML='<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>',this.insertBefore(s,this.firstChild)}}customElements.get("db-button")||customElements.define("db-button",DbButton);const o={weak:"약함",fair:"보통",good:"강함","very-strong":"아주 강함"};function getPasswordScore(t){switch(t){case"weak":return 1;case"fair":return 2;case"good":return 3;case"very-strong":return 4;default:return 0}}function getStepDecimalPlaces(t){const e=String(t),s=e.indexOf(".");return-1===s?0:e.length-s-1}function readNumericAttribute(t,e){const s=t.getAttribute(e);if(null===s||""===s)return;const i=Number(s);return Number.isFinite(i)?i:void 0}function attachNumberScrub(t,e){let s=null;const endScrub=()=>{s=null,e.onScrubStateChange?.(!1),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")},applyScrub=(t,i)=>{if(!s)return;const n=t-s.startX,a=e.getStep(),r=function computeScrubValue(t,e,s,i,n,a,r){const l=i*(n.shiftKey?10:n.altKey?.1:1);let o=t+Math.round(e/s)*l;void 0!==a&&(o=Math.max(a,o)),void 0!==r&&(o=Math.min(r,o));const d=getStepDecimalPlaces(l);return o=d>0?Number(o.toFixed(d)):Math.round(o),o}(s.startValue,n,e.getSensitivity(),a,i,e.getMin(),e.getMax());e.onValueChange(function formatScrubValue(t,e){const s=getStepDecimalPlaces(e);return s>0?t.toFixed(s):String(Math.round(t))}(r,a))},handlePointerDown=i=>{if(!e.isEnabled()||!e.isInteractive()||0!==i.button)return;const n=function parseScrubNumericValue(t){const e=t.trim();if(""===e)return 0;const s=Number(e);return Number.isFinite(s)?s:null}(e.getValue());null!==n&&(s={pointerId:i.pointerId,startX:i.clientX,startValue:n,moved:!1},t.setPointerCapture(i.pointerId))},handlePointerMove=t=>{if(!s||s.pointerId!==t.pointerId)return;const i=t.clientX-s.startX;!s.moved&&Math.abs(i)<3||(s.moved||(s.moved=!0,e.onScrubStateChange?.(!0),document.body.style.cursor="ew-resize",document.body.style.userSelect="none"),t.preventDefault(),applyScrub(t.clientX,t))},handlePointerEnd=e=>{s&&s.pointerId===e.pointerId&&(s.moved&&e.preventDefault(),t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),endScrub())};return t.addEventListener("pointerdown",handlePointerDown),t.addEventListener("pointermove",handlePointerMove),t.addEventListener("pointerup",handlePointerEnd),t.addEventListener("pointercancel",handlePointerEnd),()=>{endScrub(),t.removeEventListener("pointerdown",handlePointerDown),t.removeEventListener("pointermove",handlePointerMove),t.removeEventListener("pointerup",handlePointerEnd),t.removeEventListener("pointercancel",handlePointerEnd)}}const d=["text","email","password","url","search","tel","number"],u=["s","m","l"],b=new Set(["arrow-bar-left","arrow-bar-right","caret-down-filled","chevron-down","chevron-left","chevron-right","circle-checked","close","error-filled","edit","hide","info-filled","lock","mail","plus","search","share-alt","show","sparkle","trash","user","warning-filled"]);class DbInput extends HTMLElement{constructor(){super(...arguments),this.passwordVisible=!1,this.isFocused=!1,this.touched=!1,this.isScrubbing=!1,this.handleInput=t=>{t.stopPropagation();const e=t.target;this.updateDynamicUI(),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:e.value,nativeEvent:t},bubbles:!0,composed:!0}))},this.handleChange=t=>{t.stopPropagation();const e=t.target;this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e.value,nativeEvent:t},bubbles:!0,composed:!0}))},this.handleFocus=t=>{this.isFocused=!0,this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-focus",{detail:{nativeEvent:t},bubbles:!0,composed:!0}))},this.handleBlur=t=>{this.isFocused=!1,this.touched=!0,this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-blur",{detail:{nativeEvent:t},bubbles:!0,composed:!0}))},this.handlePasswordToggle=()=>{this.passwordVisible=!this.passwordVisible,this.render()},this.handleSearchClear=()=>{this.input&&(this.input.value="",this.setAttribute("value",""),this.input.focus(),this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:"",nativeEvent:null},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-clear",{bubbles:!0,composed:!0})))}}static get observedAttributes(){return["type","label","placeholder","value","default-value","size","disabled","readonly","required","error","error-message","helper-text","full-width","name","start-icon","end-icon","validate","validation-visibility","validate-on-blur","password-min-length","scrubbable","scrub-step","scrub-sensitivity","min","max","step"]}get value(){return this.input?.value??this.getAttribute("value")??""}set value(t){this.setAttribute("value",t),this.input&&(this.input.value=t),this.updateDynamicUI()}get type(){return this.getAttribute("type")||"text"}set type(t){this.setAttribute("type",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}get readOnly(){return this.hasAttribute("readonly")}set readOnly(t){this.toggleAttribute("readonly",t)}connectedCallback(){this.render()}disconnectedCallback(){this.detachScrub?.(),this.detachScrub=void 0}attributeChangedCallback(t){if("value"!==t||!this.isScrubbing){if("value"===t&&this.input){const t=this.getAttribute("value")??"";return this.input.value!==t&&(this.input.value=t),void this.updateDynamicUI()}this.render()}}focus(){this.input?.focus()}get passwordMinLength(){return Number(this.getAttribute("password-min-length")||8)}get validationVisibility(){return this.getAttribute("validation-visibility")||"focus"}get validateOnBlur(){return!this.hasAttribute("validate-on-blur")||"false"!==this.getAttribute("validate-on-blur")}get isValidationEnabled(){return this.hasAttribute("validate")}getIconSize(){return getDbComponentIconSize(this.size)}resolveIconName(t){const e=this.getAttribute(t);if(e&&b.has(e))return e}resolveStartIcon(){const t=this.resolveIconName("start-icon");return t||("search"===this.type?"search":void 0)}getCurrentValue(){return this.input?.value??this.getAttribute("value")??this.getAttribute("default-value")??""}render(){const t=this.getCurrentValue(),e=d.includes(this.type)?this.type:"text",s="search"===e,i="password"===e,n=i&&this.passwordVisible||s?"text":e,a=this.getAttribute("label")||"",r=this.getAttribute("helper-text")||"",l=this.getAttribute("error-message")||"",o=this.hasAttribute("error"),b=this.resolveStartIcon(),p=this.resolveIconName("end-icon");this.classList.add("designbase-wc-input"),u.forEach(t=>this.classList.remove(`designbase-wc-input--${t}`)),this.classList.add(`designbase-wc-input--${u.includes(this.size)?this.size:"m"}`),this.classList.toggle("designbase-wc-input--error",o),this.classList.toggle("designbase-wc-input--disabled",this.disabled),this.classList.toggle("designbase-wc-input--readonly",this.readOnly),this.classList.toggle("designbase-wc-input--full-width",this.hasAttribute("full-width")),this.classList.toggle("designbase-wc-input--with-start-icon",Boolean(b));const m=s&&t.length>0&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--with-end-icon",Boolean(p&&!i&&!s)||i||m),this.classList.toggle("designbase-wc-input--with-password-toggle",i),this.classList.toggle("designbase-wc-input--with-search-clear",m);const g=this.hasAttribute("scrubbable")&&"number"===e&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--scrubbable",g),this.classList.toggle("designbase-wc-input--scrubbing",this.isScrubbing);const v=this.getAttribute("id")||`db-input-${Math.random().toString(36).slice(2)}`;this.hasAttribute("id")||this.setAttribute("id",v);const E=`${v}-field`,f=`${v}-helper`,w=`${v}-error`,y=`${v}-validation`,A=this.getAttribute("min"),_=this.getAttribute("max"),C=this.getAttribute("step");this.innerHTML=`\n ${a?`<label class="designbase-wc-input__label" for="${E}">${this.escape(a)}${this.hasAttribute("required")?'<span aria-hidden="true"> *</span>':""}</label>`:""}\n <span class="designbase-wc-input__wrapper">\n ${b?'<span class="designbase-wc-input__start-icon" aria-hidden="true"></span>':""}\n <input\n id="${E}"\n class="designbase-wc-input__field"\n type="${n}"\n value="${this.escape(t)}"\n placeholder="${this.escape(this.getAttribute("placeholder")||"")}"\n ${s?'role="searchbox"':""}\n ${this.getAttribute("name")?`name="${this.escape(this.getAttribute("name")||"")}"`:""}\n ${this.disabled?"disabled":""}\n ${this.readOnly?"readonly":""}\n ${this.hasAttribute("required")?"required":""}\n ${null!==A?`min="${this.escape(A)}"`:""}\n ${null!==_?`max="${this.escape(_)}"`:""}\n ${null!==C?`step="${this.escape(C)}"`:""}\n aria-invalid="${String(o)}"\n />\n ${i?`<button type="button" class="designbase-wc-input__password-toggle" ${this.disabled?"disabled":""} aria-label="${this.passwordVisible?"비밀번호 숨기기":"비밀번호 보기"}"></button>`:""}\n ${s?'<button type="button" class="designbase-wc-input__clear-button" hidden aria-label="검색어 지우기"></button>':""}\n ${!p||i||s?"":'<span class="designbase-wc-input__end-icon" aria-hidden="true"></span>'}\n </span>\n ${this.isValidationEnabled&&i?`<div class="designbase-wc-input__validation-slot" id="${y}"></div>`:""}\n ${r&&!o?`<p id="${f}" class="designbase-wc-input__helper-text">${this.escape(r)}</p>`:""}\n ${o&&l?`<p id="${w}" class="designbase-wc-input__error-message">${this.escape(l)}</p>`:""}\n `,this.mountIcons(b,!p||i||s?void 0:p,i),this.input=this.querySelector("input")||void 0,this.input&&(this.input.value=t,this.input.addEventListener("input",this.handleInput),this.input.addEventListener("change",this.handleChange),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("blur",this.handleBlur)),this.querySelector(".designbase-wc-input__password-toggle")?.addEventListener("click",this.handlePasswordToggle),this.querySelector(".designbase-wc-input__clear-button")?.addEventListener("click",this.handleSearchClear),this.detachScrub?.(),this.detachScrub=void 0,g&&this.input&&(this.detachScrub=attachNumberScrub(this.input,{isEnabled:()=>this.hasAttribute("scrubbable")&&"number"===this.type,isInteractive:()=>!this.disabled&&!this.readOnly,getValue:()=>this.getCurrentValue(),getStep:()=>readNumericAttribute(this,"scrub-step")??readNumericAttribute(this,"step")??1,getMin:()=>readNumericAttribute(this,"min"),getMax:()=>readNumericAttribute(this,"max"),getSensitivity:()=>readNumericAttribute(this,"scrub-sensitivity")??4,onValueChange:t=>this.applyScrubValue(t),onScrubStateChange:t=>{this.isScrubbing=t,this.classList.toggle("designbase-wc-input--scrubbing",t),!t&&this.input&&this.dispatchEvent(new CustomEvent("db-change",{detail:{value:this.input.value,nativeEvent:null},bubbles:!0,composed:!0}))}})),this.updateDynamicUI()}mountIcons(t,e,s=!1){const i=this.getIconSize();if(t){const e=this.querySelector(".designbase-wc-input__start-icon");e?.replaceChildren(createDbIcon(t,i))}if(e){const t=this.querySelector(".designbase-wc-input__end-icon");t?.replaceChildren(createDbIcon(e,i))}if(s){const t=this.querySelector(".designbase-wc-input__password-toggle");t?.replaceChildren(createDbIcon(this.passwordVisible?"hide":"show",i))}const n=this.querySelector(".designbase-wc-input__clear-button");n?.replaceChildren(createDbIcon("close",i))}shouldShowPasswordValidation(t){return!(!this.isValidationEnabled||"password"!==this.type)&&("never"!==this.validationVisibility&&("always"===this.validationVisibility||(this.isFocused||t.length>0)))}renderValidationMarkup(t){const e=function getPasswordValidation(t,e=8){const s=[{id:"length",label:`최소 ${e}자 이상`,met:t.length>=e},{id:"lowercase",label:"소문자 포함",met:/[a-z]/.test(t)},{id:"uppercase",label:"대문자 포함",met:/[A-Z]/.test(t)},{id:"number",label:"숫자 포함",met:/\d/.test(t)},{id:"special",label:"특수문자 포함",met:/[!@#$%^&*(),.?":{}|<>]/.test(t)}],i=function getPasswordStrengthLevel(t,e){return!e||t<=1?"weak":2===t?"fair":3===t?"good":"very-strong"}(s.filter(t=>t.met).length,t.length>0);return{requirements:s,score:getPasswordScore(i),level:i,levelLabel:o[i],isValid:s.every(t=>t.met),isStrongEnough:"good"===i||"very-strong"===i}}(t,this.passwordMinLength),s=Array.from({length:4},(t,s)=>`<span class="designbase-wc-input__password-strength-segment${s<e.score?` designbase-wc-input__password-strength-segment--${e.level}`:""}"></span>`).join(""),i=e.requirements.map(t=>`<li class="designbase-wc-input__password-requirement${t.met?" designbase-wc-input__password-requirement--met":""}">${t.met?'<span class="designbase-wc-input__password-requirement-icon" aria-hidden="true"></span>':'<span class="designbase-wc-input__password-requirement-icon" aria-hidden="true"><span class="designbase-wc-input__password-requirement-dot"></span></span>'}<span class="designbase-wc-input__password-requirement-label">${this.escape(t.label)}</span></li>`).join("");return`\n <div class="designbase-wc-input__validation" aria-live="polite">\n <div class="designbase-wc-input__password-strength">\n <div class="designbase-wc-input__password-strength-bar" role="progressbar" aria-valuemin="0" aria-valuemax="4" aria-valuenow="${e.score}" aria-label="비밀번호 강도">${s}</div>\n <span class="designbase-wc-input__password-strength-label designbase-wc-input__password-strength-label--${e.level}">${e.levelLabel}</span>\n </div>\n <ul class="designbase-wc-input__password-requirements">${i}</ul>\n </div>\n `}updateDynamicUI(){const t=this.getCurrentValue(),e="search"===this.type&&t.length>0&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--with-search-clear",e);const s=this.querySelector(".designbase-wc-input__clear-button");s&&(s.hidden=!e,s.replaceChildren(createDbIcon("close",this.getIconSize())));const i=this.querySelector(".designbase-wc-input__validation-slot");if(i&&(this.shouldShowPasswordValidation(t)?(i.innerHTML=this.renderValidationMarkup(t),i.querySelectorAll(".designbase-wc-input__password-requirement--met .designbase-wc-input__password-requirement-icon").forEach(t=>{t.replaceChildren(createDbIcon("circle-checked",12))})):i.innerHTML=""),this.input){const e=`${this.getAttribute("id")}-helper`,s=`${this.getAttribute("id")}-error`,i=`${this.getAttribute("id")}-validation`,n=this.getAttribute("helper-text")||"",a=this.getAttribute("error-message")||"",r=this.hasAttribute("error"),l=[n&&!r?e:"",this.shouldShowPasswordValidation(t)?i:"",r&&a?s:""].filter(Boolean).join(" ")||void 0;l?this.input.setAttribute("aria-describedby",l):this.input.removeAttribute("aria-describedby")}}applyScrubValue(t){this.input&&(this.input.value=t,this.setAttribute("value",t),this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:t,nativeEvent:null},bubbles:!0,composed:!0})))}escape(t){return t.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]||t))}}customElements.get("db-input")||customElements.define("db-input",DbInput);const p=["s","m","l"];class DbCheckbox extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleChange=()=>{if(!this.input)return;const t=this.input.checked;this.toggleAttribute("checked",t),this.indeterminate&&(this.removeAttribute("indeterminate"),this.input.indeterminate=!1),this.syncVisual(),this.syncClasses(),this.dispatchEvent(new CustomEvent("db-change",{detail:{checked:t,selected:t},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["checked","selected","default-checked","default-selected","indeterminate","size","disabled","readonly","required","name","value","has-label"]}get checked(){return this.input?.checked??(this.hasAttribute("checked")||this.hasAttribute("selected"))}set checked(t){this.toggleAttribute("checked",t),this.input&&(this.input.checked=t,this.syncVisual(),this.syncClasses())}get indeterminate(){return this.hasAttribute("indeterminate")}set indeterminate(t){this.toggleAttribute("indeterminate",t),this.input&&(this.input.indeterminate=t,this.syncVisual(),this.syncClasses())}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t),this.input&&(this.input.disabled=t),this.syncClasses()}get readOnly(){return this.hasAttribute("readonly")}set readOnly(t){this.toggleAttribute("readonly",t),this.input&&(this.input.readOnly=t),this.syncClasses()}get required(){return this.hasAttribute("required")}set required(t){this.toggleAttribute("required",t),this.input&&(this.input.required=t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}connectedCallback(){this.style.display="contents",this.built||this.build(),this.syncState()}attributeChangedCallback(t){if(this.built)return"checked"===t||"selected"===t?(this.input&&(this.input.checked=this.hasAttribute("checked")||this.hasAttribute("selected")),this.syncVisual(),void this.syncClasses()):void this.syncState()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}build(){for(this.root=document.createElement("label"),this.root.className="designbase-wc-checkbox",this.input=document.createElement("input"),this.input.type="checkbox",this.input.className="designbase-wc-checkbox__input",this.visual=document.createElement("span"),this.visual.className="designbase-wc-checkbox__visual",this.visual.setAttribute("aria-hidden","true"),this.labelEl=document.createElement("span"),this.labelEl.className="designbase-wc-checkbox__label";this.firstChild;)this.labelEl.appendChild(this.firstChild);this.root.append(this.input,this.visual,this.labelEl),this.appendChild(this.root),this.input.addEventListener("change",this.handleChange),this.built=!0}syncState(){if(!this.root||!this.input||!this.visual)return;const t=this.hasAttribute("checked")||this.hasAttribute("selected")||!this.hasAttribute("checked")&&!this.hasAttribute("selected")&&(this.hasAttribute("default-checked")||this.hasAttribute("default-selected")),e=this.hasAttribute("indeterminate");this.input.checked=t,this.input.indeterminate=e,this.input.disabled=this.disabled,this.input.readOnly=this.readOnly,this.input.required=this.required,this.input.name=this.getAttribute("name")||"",this.input.value=this.getAttribute("value")||"",this.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncVisual(),this.syncClasses()}syncVisual(){if(this.visual&&this.input){if(this.visual.replaceChildren(),this.input.indeterminate){const t=document.createElement("span");return t.className="designbase-wc-checkbox__indeterminate-icon",t.appendChild(createDbIcon("minus",16)),void this.visual.appendChild(t)}if(this.input.checked){const t=document.createElement("span");t.className="designbase-wc-checkbox__check-icon",t.appendChild(createDbIcon("done",16)),this.visual.appendChild(t)}}}syncClasses(){if(!this.root||!this.input)return;const t=p.includes(this.size)?this.size:"m",e=this.hasLabel&&Boolean(this.labelEl?.textContent?.trim());this.root.className=["designbase-wc-checkbox",`designbase-wc-checkbox--${t}`,this.input.checked&&"designbase-wc-checkbox--selected",this.input.indeterminate&&"designbase-wc-checkbox--indeterminate",this.disabled&&"designbase-wc-checkbox--disabled",this.readOnly&&"designbase-wc-checkbox--readonly",!e&&"designbase-wc-checkbox--no-label"].filter(Boolean).join(" ")}}customElements.get("db-checkbox")||customElements.define("db-checkbox",DbCheckbox);const m=["s","m","l"];class DbToggle extends HTMLElement{constructor(){super(...arguments),this.internals=this.attachInternals(),this.built=!1,this.handleClick=()=>{if(this.disabled||this.readOnly)return;const t=!this.checked;this.toggleAttribute("checked",t),this.syncFormValue(),this.syncState(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{checked:t,selected:t},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["checked","selected","default-checked","default-selected","size","disabled","readonly","has-label","name","value"]}get checked(){return this.hasAttribute("checked")||this.hasAttribute("selected")}set checked(t){this.toggleAttribute("checked",t),this.syncFormValue(),this.syncClasses()}get name(){return this.getAttribute("name")??""}set name(t){this.setAttribute("name",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t),this.root&&(this.root.disabled=t),this.syncClasses()}get readOnly(){return this.hasAttribute("readonly")}set readOnly(t){this.toggleAttribute("readonly",t),this.syncClasses()}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}connectedCallback(){this.style.display="contents",this.built||this.build(),this.syncState()}attributeChangedCallback(){this.built&&this.syncState()}formResetCallback(){const t=this.hasAttribute("default-checked")||this.hasAttribute("default-selected");this.toggleAttribute("checked",t),this.syncFormValue(),this.syncState()}formDisabledCallback(t){this.toggleAttribute("disabled",t),this.root&&(this.root.disabled=t),this.syncClasses()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}syncFormValue(){const t=this.hasAttribute("checked")||this.hasAttribute("selected");this.internals.setFormValue(t?this.getAttribute("value")||"on":null)}build(){this.root=document.createElement("button"),this.root.type="button",this.root.className="designbase-wc-toggle";const t=document.createElement("span");t.className="designbase-wc-toggle__track",t.setAttribute("aria-hidden","true");const e=document.createElement("span");for(e.className="designbase-wc-toggle__thumb",t.appendChild(e),this.labelEl=document.createElement("span"),this.labelEl.className="designbase-wc-toggle__label";this.firstChild;)this.labelEl.appendChild(this.firstChild);this.root.append(t,this.labelEl),this.appendChild(this.root),this.root.addEventListener("click",this.handleClick),this.built=!0}syncState(){this.root&&(this.root.disabled=this.disabled,this.syncFormValue(),this.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncClasses())}syncClasses(){if(!this.root)return;const t=m.includes(this.size)?this.size:"m",e=this.hasLabel&&Boolean(this.labelEl?.textContent?.trim()),s=this.hasAttribute("checked")||this.hasAttribute("selected")||!this.hasAttribute("checked")&&!this.hasAttribute("selected")&&(this.hasAttribute("default-checked")||this.hasAttribute("default-selected"));this.root.className=["designbase-wc-toggle",`designbase-wc-toggle--${t}`,s&&"designbase-wc-toggle--selected",this.disabled&&"designbase-wc-toggle--disabled",this.readOnly&&"designbase-wc-toggle--readonly",!e&&"designbase-wc-toggle--no-label"].filter(Boolean).join(" "),this.root.setAttribute("aria-pressed",String(s))}}DbToggle.formAssociated=!0,customElements.get("db-toggle")||customElements.define("db-toggle",DbToggle);const g="designbase-wc-badge",v=["primary","secondary","info","success","warning","danger"],E=["s","m","l"],f=["dot","number","text","outlined"];class DbBadge extends HTMLElement{static get observedAttributes(){return["variant","size","badge-style","count","max-count","disabled"]}get variant(){return this.getAttribute("variant")||"primary"}set variant(t){this.setAttribute("variant",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get badgeStyle(){return this.getAttribute("badge-style")||"text"}set badgeStyle(t){this.setAttribute("badge-style",t)}get count(){const t=this.getAttribute("count");return null===t?void 0:Number(t)}set count(t){void 0===t?this.removeAttribute("count"):this.setAttribute("count",String(t))}get maxCount(){return Number(this.getAttribute("max-count")||99)}set maxCount(t){this.setAttribute("max-count",String(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}connectedCallback(){this.syncAttributes()}attributeChangedCallback(t,e,s){"count"!==t&&"max-count"!==t&&"badge-style"!==t||this.syncContent(),this.syncAttributes()}syncAttributes(){this.classList.add(g),this.setAttribute("aria-disabled",String(this.disabled)),this.syncEnum("variant",this.variant,v),this.syncEnum("size",this.size,E),this.syncEnum("style",this.badgeStyle,f),this.classList.toggle(`${g}--disabled`,this.disabled),this.syncContent()}syncContent(){"number"!==this.badgeStyle||void 0===this.count?"dot"===this.badgeStyle&&(this.textContent=""):this.textContent=this.count>this.maxCount?`${this.maxCount}+`:String(this.count)}syncEnum(t,e,s){s.forEach(t=>this.classList.remove(`${g}--${t}`)),s.includes(e)?this.classList.add(`${g}--${e}`):"style"===t&&this.classList.add(`${g}--text`)}}customElements.get("db-badge")||customElements.define("db-badge",DbBadge);const w={primary:"primary",secondary:"secondary",outline:"tertiary",ghost:"ghost"},y={s:"s",sm:"s",m:"m",md:"m",l:"l",lg:"l"};class DbBanner extends HTMLElement{static get observedAttributes(){return["title","description","icon","image","image-alt","actions","size","variant","background-image"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}parseActions(){const t=this.getAttribute("actions");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}getIconSize(t){return"s"===t?16:"l"===t?24:20}getActionIconSize(t){return"s"===t?16:"l"===t?20:18}resolveIconName(t){if(t)return t in{close:1,"info-filled":1}?t:void 0}createActionControl(t,e,s,i){const n=this.resolveIconName(t.icon),a=Boolean(t.iconOnly&&n);if(t.href){const e=document.createElement("a");return e.className=`designbase-wc-button designbase-wc-button--${s} designbase-wc-button--${i}`,a&&e.classList.add("designbase-wc-button--icon-only"),e.href=t.href,e.setAttribute("aria-label",t.text),a&&n?e.append(createDbIcon(n,this.getActionIconSize(i))):e.textContent=t.text,t.external&&(e.target="_blank",e.rel="noopener noreferrer"),e}const r=document.createElement("db-button");return r.setAttribute("variant",s),r.setAttribute("size",i),a?(r.setAttribute("icon-only",""),r.setAttribute("aria-label",t.text),n&&r.append(createDbIcon(n,this.getActionIconSize(i)))):r.textContent=t.text,(s=>{s.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-action",{bubbles:!0,composed:!0,detail:{index:e,action:t}}))})})(r),r}render(){const t=this.getAttribute("title")||"",e=this.getAttribute("description")||"",s=this.getAttribute("icon"),i=this.getAttribute("image"),n=this.getAttribute("image-alt")||t||"Banner image",a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"primary",l=this.getAttribute("background-image"),o=this.parseActions();if(this.className=`designbase-wc-banner designbase-wc-banner--${a} designbase-wc-banner--${r}`,this.replaceChildren(),"image"===r&&l){const t=document.createElement("div");t.className="designbase-wc-banner__background",t.style.backgroundImage=`url(${l})`,t.style.backgroundSize="cover",t.style.backgroundPosition="center",t.style.backgroundRepeat="no-repeat",this.append(t);const e=document.createElement("div");e.className="designbase-wc-banner__overlay",this.append(e)}const d=document.createElement("div");if(d.className="designbase-wc-banner__container",s){const t=document.createElement("div");t.className="designbase-wc-banner__icon",t.append(createDbIcon(s,this.getIconSize(a))),d.append(t)}if(i){const t=document.createElement("div");t.className="designbase-wc-banner__image";const e=document.createElement("img");e.src=i,e.alt=n,t.append(e),d.append(t)}const u=document.createElement("div");if(u.className="designbase-wc-banner__content",t){const e=document.createElement("h3");e.className="designbase-wc-banner__title",e.textContent=t,u.append(e)}if(e){const t=document.createElement("p");t.className="designbase-wc-banner__description",t.textContent=e,u.append(t)}if(d.append(u),o.length>0){const t=document.createElement("div");t.className="designbase-wc-banner__actions",o.forEach((e,s)=>{const i=w[e.variant||"primary"]||"primary",n=y[e.size||"sm"]||"s";t.append(this.createActionControl(e,s,i,n))}),d.append(t)}this.append(d)}}customElements.get("db-banner")||customElements.define("db-banner",DbBanner);const A=["circular","dots","bars","pulse","ripple"],_=["xs","s","m","l","xl"];class DbSpinner extends HTMLElement{static get observedAttributes(){return["type","size","color","speed","label","show-label"]}get type(){return this.getAttribute("type")||"circular"}set type(t){this.setAttribute("type",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get color(){return this.getAttribute("color")||""}set color(t){t?this.setAttribute("color",t):this.removeAttribute("color")}get speed(){return Number(this.getAttribute("speed")||1)}set speed(t){this.setAttribute("speed",String(t))}get label(){return this.getAttribute("label")||"로딩 중..."}set label(t){this.setAttribute("label",t)}get showLabel(){return this.hasAttribute("show-label")}set showLabel(t){this.toggleAttribute("show-label",t)}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){this.className=Array.from(this.classList).filter(t=>!t.startsWith("designbase-wc-spinner")).join(" "),this.classList.add("designbase-wc-spinner"),this.classList.add(`designbase-wc-spinner--${A.includes(this.type)?this.type:"circular"}`),this.classList.add(`designbase-wc-spinner--${_.includes(this.size)?this.size:"m"}`),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-busy","true"),this.showLabel&&this.setAttribute("aria-label",this.label),this.style.setProperty("--spinner-speed",`${this.speed}s`),this.color?this.style.setProperty("--spinner-color",this.color):this.style.removeProperty("--spinner-color"),this.innerHTML=`${this.renderSpinner()}${this.showLabel&&this.label?`<span class="designbase-wc-spinner__label" aria-hidden="true">${this.escape(this.label)}</span>`:""}`}renderSpinner(){switch(this.type){case"dots":return'<span class="designbase-wc-spinner__dots" aria-hidden="true"><span class="designbase-wc-spinner__dot"></span><span class="designbase-wc-spinner__dot"></span><span class="designbase-wc-spinner__dot"></span></span>';case"bars":return'<span class="designbase-wc-spinner__bars" aria-hidden="true"><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span></span>';case"pulse":return'<span class="designbase-wc-spinner__pulse" aria-hidden="true"></span>';case"ripple":return'<span class="designbase-wc-spinner__ripple" aria-hidden="true"><span class="designbase-wc-spinner__ripple-circle"></span><span class="designbase-wc-spinner__ripple-circle"></span></span>';default:return'<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>'}}escape(t){return t.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]||t))}}customElements.get("db-spinner")||customElements.define("db-spinner",DbSpinner);const C=["default","flat"],x=["s","m","l"];class DbCard extends HTMLElement{constructor(){super(...arguments),this.selectCheckbox=null,this.imageNode=null,this.handleClick=t=>{if(this.disabled||this.loading)return t.preventDefault(),void t.stopPropagation();this.clickable&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=t=>{!this.clickable||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.click())},this.handleSelect=t=>{if(t?.stopPropagation(),this.disabled||this.loading||!this.selectable)return;const e=!this.selected;this.toggleAttribute("selected",e),this.selectCheckbox&&(e?this.selectCheckbox.setAttribute("checked",""):this.selectCheckbox.removeAttribute("checked")),this.dispatchEvent(new CustomEvent("db-select",{bubbles:!0,composed:!0,detail:{selected:e}}))}}static get observedAttributes(){return["variant","size","full-width","clickable","hoverable","selectable","selected","disabled","loading","image","image-alt"]}get variant(){return this.getAttribute("variant")||"default"}set variant(t){this.setAttribute("variant",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get clickable(){return this.hasAttribute("clickable")}set clickable(t){this.toggleAttribute("clickable",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}get loading(){return this.hasAttribute("loading")}set loading(t){this.toggleAttribute("loading",t)}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(t){this.toggleAttribute("full-width",t)}get hoverable(){return this.hasAttribute("hoverable")}set hoverable(t){this.toggleAttribute("hoverable",t)}get selectable(){return this.hasAttribute("selectable")}set selectable(t){this.toggleAttribute("selectable",t)}get selected(){return this.hasAttribute("selected")}set selected(t){this.toggleAttribute("selected",t)}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.sync()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(t){this.isConnected&&(this.sync(),"selected"===t&&this.selectCheckbox&&(this.selected?this.selectCheckbox.setAttribute("checked",""):this.selectCheckbox.removeAttribute("checked")))}hasMediaSection(){return!!this.getAttribute("image")||null!==this.querySelector(':scope > .designbase-wc-card__thumbnail, :scope > .designbase-wc-card__media, :scope > [slot="media"], :scope > [slot="thumbnail"]')}hasFooterSection(){return null!==this.querySelector(':scope > .designbase-wc-card__footer, :scope > [slot="footer"]')}syncImageMedia(){const t=this.getAttribute("image"),e=this.querySelector(':scope > .designbase-wc-card__thumbnail, :scope > .designbase-wc-card__media, :scope > [slot="media"], :scope > [slot="thumbnail"]');if(!t)return void(this.imageNode&&(this.imageNode.remove(),this.imageNode=null));if(e&&e!==this.imageNode)return void(this.imageNode&&(this.imageNode.remove(),this.imageNode=null));if(!this.imageNode){this.imageNode=document.createElement("div"),this.imageNode.className="designbase-wc-card__media designbase-wc-card__thumbnail",this.imageNode.setAttribute("slot","media");const t=document.createElement("img");t.className="designbase-wc-card__thumbnail-image",this.imageNode.append(t);const e=this.querySelector(':scope > .designbase-wc-card__body, :scope > [slot="body"], :scope > .designbase-wc-card__footer, :scope > [slot="footer"]');e?this.insertBefore(this.imageNode,e):this.insertBefore(this.imageNode,this.firstChild)}const s=this.imageNode.querySelector("img");s&&(s.src=t,s.alt=this.getAttribute("image-alt")||"")}sync(){this.syncImageMedia(),this.syncAttributes(),this.syncOverlays()}syncOverlays(){const t=this.querySelector(":scope > .designbase-wc-card__loading-overlay"),e=this.querySelector(":scope > .designbase-wc-card__select-overlay");if(this.loading){if(!t){const t=document.createElement("div");t.className="designbase-wc-card__loading-overlay",t.setAttribute("aria-live","polite"),t.setAttribute("aria-busy","true");const e=document.createElement("div");e.className="designbase-wc-card__loading-spinner",t.append(e),this.append(t)}}else t?.remove();if(this.selectable)if(e)this.selectCheckbox&&(this.selected?this.selectCheckbox.setAttribute("checked",""):this.selectCheckbox.removeAttribute("checked"));else{const t=document.createElement("div");t.className="designbase-wc-card__select-overlay",t.addEventListener("click",t=>this.handleSelect(t));const e=document.createElement("db-checkbox");e.className="designbase-wc-card__select-checkbox",e.setAttribute("size","s"),e.setAttribute("has-label","false"),e.setAttribute("aria-label","카드 선택"),this.selected&&e.setAttribute("checked",""),e.addEventListener("click",t=>t.stopPropagation()),e.addEventListener("db-change",t=>{t.stopPropagation(),this.handleSelect()}),t.append(e),this.append(t),this.selectCheckbox=e}else e?.remove(),this.selectCheckbox=null}syncAttributes(){this.classList.add("designbase-wc-card"),this.setAttribute("aria-disabled",String(this.disabled||this.loading)),!this.clickable||this.disabled||this.loading?(this.removeAttribute("role"),this.removeAttribute("tabindex")):(this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")),C.forEach(t=>this.classList.remove(`designbase-wc-card--${t}`)),x.forEach(t=>this.classList.remove(`designbase-wc-card--${t}`)),this.classList.add(`designbase-wc-card--${C.includes(this.variant)?this.variant:"default"}`),this.classList.add(`designbase-wc-card--${x.includes(this.size)?this.size:"m"}`),this.classList.toggle("designbase-wc-card--full-width",this.hasAttribute("full-width")),this.classList.toggle("designbase-wc-card--clickable",this.clickable),this.classList.toggle("designbase-wc-card--hoverable",this.hasAttribute("hoverable")),this.classList.toggle("designbase-wc-card--selectable",this.hasAttribute("selectable")),this.classList.toggle("designbase-wc-card--selected",this.hasAttribute("selected")),this.classList.toggle("designbase-wc-card--disabled",this.disabled),this.classList.toggle("designbase-wc-card--loading",this.loading),this.classList.toggle("designbase-wc-card--with-media",this.hasMediaSection()),this.classList.toggle("designbase-wc-card--with-thumbnail",this.hasMediaSection()),this.classList.toggle("designbase-wc-card--with-footer",this.hasFooterSection())}}customElements.get("db-card")||customElements.define("db-card",DbCard);const k=["s","m","l"],S=["horizontal","vertical"],N=["default","pills"];class DbTabs extends HTMLElement{constructor(){super(...arguments),this.tabButtons=[],this.inactivePanels=document.createDocumentFragment(),this.isRendering=!1,this.handleListScroll=()=>{if(!this.list)return;const t=this.list.scrollWidth>this.list.clientWidth,e=this.list.scrollLeft+this.list.clientWidth>=this.list.scrollWidth-5;this.list.classList.toggle("designbase-wc-tabs__list--show-gradient",t&&!e&&"horizontal"===this.orientation)}}static get observedAttributes(){return["labels","items","active-index","selected-id","orientation","size","variant","full-width"]}get labels(){const t=this.tabItems.map(t=>t.label);return t.length?t:(this.getAttribute("labels")||"").split(",").map(t=>t.trim()).filter(Boolean)}set labels(t){this.setAttribute("labels",Array.isArray(t)?t.join(","):t)}get tabItems(){try{const t=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}get items(){return this.tabItems}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}set tabItems(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}get activeIndex(){const t=this.getAttribute("selected-id");if(t){const e=this.tabItems.findIndex((e,s)=>(e.id||String(s))===t);if(e>=0)return e}return Number(this.getAttribute("active-index")||0)}set activeIndex(t){this.setAttribute("active-index",String(t))}get orientation(){return this.getAttribute("orientation")||"horizontal"}set orientation(t){this.setAttribute("orientation",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get variant(){return this.getAttribute("variant")||"default"}set variant(t){this.setAttribute("variant",t)}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(t){this.toggleAttribute("full-width",Boolean(t))}connectedCallback(){this.render(),this.list?.addEventListener("scroll",this.handleListScroll,{passive:!0}),window.addEventListener("resize",this.handleListScroll),this.childObserver=new MutationObserver(t=>{if(this.isRendering)return;t.some(t=>Array.from(t.addedNodes).some(t=>t instanceof HTMLElement&&(t.hasAttribute("slot")||void 0!==t.dataset.panelIndex)))&&this.render()}),this.childObserver.observe(this,{childList:!0})}disconnectedCallback(){this.list?.removeEventListener("scroll",this.handleListScroll),window.removeEventListener("resize",this.handleListScroll),this.childObserver?.disconnect()}attributeChangedCallback(){this.isConnected&&this.render()}collectPanelContent(){const t=new Map,register=(e,s)=>{if(!(e instanceof HTMLElement)||"SLOT"===e.tagName)return;t.has(s)||t.set(s,[]);const i=t.get(s);i.includes(e)||i.push(e)};return Array.from(this.children).forEach(t=>{const e=t.getAttribute("slot")?.match(/^panel-(\d+)$/);if(e)return void register(t,Number(e[1]));const s=t.dataset.panelIndex;void 0!==s&®ister(t,Number(s))}),this.panel?.querySelectorAll(":scope > .designbase-wc-tabs__panel-inner > [data-panel-index]").forEach(t=>{t instanceof HTMLElement&®ister(t,Number(t.dataset.panelIndex))}),Array.from(this.inactivePanels.children).forEach(t=>{t instanceof HTMLElement&&void 0!==t.dataset.panelIndex&®ister(t,Number(t.dataset.panelIndex))}),t}render(){this.isRendering=!0;const t=this.collectPanelContent(),e=this.labels,s=this.tabItems,i=Math.min(Math.max(this.activeIndex,0),Math.max(e.length-1,0)),n=k.includes(this.size)?this.size:"m",a=S.includes(this.orientation)?this.orientation:"horizontal",r=N.includes(this.variant)?this.variant:"default",l="default"===r;this.className=["designbase-wc-tabs",`designbase-wc-tabs--${a}`,`designbase-wc-tabs--${n}`,`designbase-wc-tabs--${r}`,this.fullWidth&&"designbase-wc-tabs--full-width"].filter(Boolean).join(" "),this.querySelectorAll(":scope > .designbase-wc-tabs__list, :scope > .designbase-wc-tabs__panel").forEach(t=>t.remove()),this.list=document.createElement("div"),this.list.className=["designbase-wc-tabs__list",`designbase-wc-tabs__list--${a}`,this.fullWidth&&"designbase-wc-tabs__list--full-width"].filter(Boolean).join(" "),this.list.setAttribute("role","tablist"),this.list.setAttribute("aria-orientation",a),this.list.setAttribute("aria-label","탭 목록"),this.tabButtons=[],e.forEach((t,e)=>{const a=s[e],r=Boolean(a?.disabled),l=e===i,o=document.createElement("button");if(o.type="button",o.className=["designbase-wc-tabs__tab",l&&"designbase-wc-tabs__tab--selected",r&&"designbase-wc-tabs__tab--disabled"].filter(Boolean).join(" "),o.setAttribute("role","tab"),o.setAttribute("aria-selected",String(l)),o.setAttribute("aria-controls",`panel-${e}`),o.id=`tab-${e}`,o.tabIndex=l?0:-1,o.disabled=r,a?.icon){const t=document.createElement("span");t.className="designbase-wc-tabs__tab-icon";const e="s"===n?16:"l"===n?20:18;t.append(createDbIcon(a.icon,e)),o.append(t)}const d=document.createElement("span");d.className="designbase-wc-tabs__tab-label",d.textContent=t,o.append(d),o.addEventListener("click",()=>this.select(e)),o.addEventListener("keydown",t=>this.handleKeyDown(t,e)),this.list?.append(o),this.tabButtons.push(o)}),l?(this.indicator=document.createElement("span"),this.indicator.className="designbase-wc-tabs__indicator designbase-wc-tabs__indicator--no-transition",this.list.append(this.indicator),requestAnimationFrame(()=>this.updateIndicator(!1))):this.indicator=void 0,this.panel=document.createElement("div"),this.panel.className="designbase-wc-tabs__panel",this.panel.setAttribute("role","tabpanel"),this.panel.id=`panel-${i}`,this.panel.setAttribute("aria-labelledby",`tab-${i}`),this.panel.tabIndex=0;const o=document.createElement("div");o.className="designbase-wc-tabs__panel-inner",t.forEach((t,e)=>{t.forEach(t=>{t.removeAttribute("slot"),t.dataset.panelIndex=String(e),e===i?o.append(t):this.inactivePanels.append(t)})}),this.panel.append(o),this.append(this.list,this.panel),requestAnimationFrame(()=>{this.handleListScroll(),l&&this.updateIndicator(!1)}),this.isRendering=!1}select(t){const e=this.labels,s=this.tabItems;if(!e[t]||s[t]?.disabled)return;this.activeIndex=t;const i=s[t]?.id||String(t);this.setAttribute("selected-id",i),this.dispatchEvent(new CustomEvent("db-change",{detail:{index:t,label:e[t],id:i},bubbles:!0,composed:!0})),this.render()}handleKeyDown(t,e){const s=this.labels,i=this.tabItems;let n=e;if("ArrowRight"===t.key||"ArrowDown"===t.key)n=(e+1)%s.length;else if("ArrowLeft"===t.key||"ArrowUp"===t.key)n=(e-1+s.length)%s.length;else if("Home"===t.key)n=0;else{if("End"!==t.key)return"Enter"===t.key||" "===t.key?(t.preventDefault(),void this.select(e)):void 0;n=s.length-1}t.preventDefault();let a=0;for(;i[n]?.disabled&&a<s.length;)n="ArrowLeft"===t.key||"ArrowUp"===t.key?(n-1+s.length)%s.length:(n+1)%s.length,a+=1;this.tabButtons[n]?.focus()}updateIndicator(t=!1){const e=this.list?.querySelector(".designbase-wc-tabs__tab--selected");if(!e||!this.indicator)return;const s="vertical"===this.orientation;this.indicator.classList.toggle("designbase-wc-tabs__indicator--no-transition",!t),this.indicator.classList.add(s?"designbase-wc-tabs__indicator--vertical":"designbase-wc-tabs__indicator--horizontal"),this.indicator.classList.add("designbase-wc-tabs__indicator--ready"),s?(this.indicator.style.width="2px",this.indicator.style.height=`${e.offsetHeight}px`,this.indicator.style.transform=`translate3d(0, ${e.offsetTop}px, 0)`):(this.indicator.style.width=`${e.offsetWidth}px`,this.indicator.style.height="2px",this.indicator.style.transform=`translate3d(${e.offsetLeft}px, 0, 0)`)}}customElements.get("db-tabs")||customElements.define("db-tabs",DbTabs);const $=["s","m","l","xl","full"],I=["default","tabs","segment"],D=["s","m","l"];class DbModal extends HTMLElement{constructor(){super(...arguments),this.titleId=`db-modal-title-${Math.random().toString(36).slice(2,9)}`,this.isMounted=!1,this.internalTabId="",this.internalSegment="",this.exitTimerId=null,this.handleDocumentKeyDown=t=>{"Escape"===t.key&&this.open&&"false"!==this.getAttribute("close-on-escape")&&(t.preventDefault(),this.close())}}static get observedAttributes(){return["open","title","size","header-variant","tabs","segments","selected-tab-id","default-selected-tab-id","segment-value","default-segment-value","nav-size","segment-full-width","close-on-outside-click","close-on-escape","show-close-button"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open","true"):this.removeAttribute("open")}connectedCallback(){this.classList.add("designbase-wc-modal-host"),document.addEventListener("keydown",this.handleDocumentKeyDown),this.childObserver=new MutationObserver(()=>{this.open&&this.render()}),this.childObserver.observe(this,{childList:!0}),this.syncOpenState()}disconnectedCallback(){this.childObserver?.disconnect(),document.removeEventListener("keydown",this.handleDocumentKeyDown),this.exitTimerId&&clearTimeout(this.exitTimerId),this.teardown()}attributeChangedCallback(t){if(this.isConnected)if("open"!==t){if("selected-tab-id"===t||"segment-value"===t){const t=this.getClassifiedChildren();return this.renderBodyContent(t.body),void this.renderHeader(t.header)}this.render(),this.isMounted&&this.syncVisibility()}else this.syncOpenState()}resolvedSize(){return $.includes(this.size)?this.size:"m"}get size(){return this.getAttribute("size")||"m"}set size(t){t?this.setAttribute("size",t):this.removeAttribute("size")}resolvedHeaderVariant(){const t=this.getAttribute("header-variant")||"default";return I.includes(t)?t:"default"}parsedTabs(){const t=this.getAttribute("tabs");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}parsedSegments(){const t=this.getAttribute("segments");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}usesIntegratedNav(){const t=this.resolvedHeaderVariant();return"tabs"===t&&this.parsedTabs().length>0||"segment"===t&&this.parsedSegments().length>0}closeIconSize(){const t=this.resolvedSize();return"s"===t?16:"l"===t?20:"xl"===t?24:18}activeTabId(){return this.getAttribute("selected-tab-id")||this.internalTabId||this.getAttribute("default-selected-tab-id")||this.parsedTabs()[0]?.id||""}activeSegmentValue(){return this.getAttribute("segment-value")||this.internalSegment||this.getAttribute("default-segment-value")||this.parsedSegments()[0]?.value||""}collectUserChildren(){return Array.from(this.children).filter(t=>!t.hasAttribute("data-wc-internal"))}classifyChildren(t){const isPart=(t,e,s)=>t.classList.contains(s)||t.getAttribute("data-modal-part")===e,e=t.filter(t=>isPart(t,"header","designbase-wc-modal__header")),s=t.filter(t=>isPart(t,"footer","designbase-wc-modal__footer")||"footer"===t.getAttribute("slot")),i=t.filter(t=>isPart(t,"body","designbase-wc-modal__body")),n=t.filter(t=>!e.includes(t)&&!s.includes(t)&&!i.includes(t));return{header:e,body:[...i,...n],footer:s}}getClassifiedChildren(){const t=this.classifyChildren(this.collectUserChildren());if(t.header.length||t.body.length||t.footer.length)return t;return{header:Array.from(this.headerEl?.children||[]).filter(t=>t!==this.closeButton&&!t.classList.contains("designbase-wc-modal__header-row")&&("header"===t.getAttribute("data-modal-part")||t.classList.contains("designbase-wc-modal__header"))),body:this.collectContentParts("body"),footer:this.collectContentParts("footer")}}isBodyPart(t){return t.classList.contains("designbase-wc-modal__body")||"body"===t.getAttribute("data-modal-part")}isFooterPart(t){return t.classList.contains("designbase-wc-modal__footer")||"footer"===t.getAttribute("data-modal-part")||"footer"===t.getAttribute("slot")}collectContentParts(t){if(!this.contentEl)return[];const e=Array.from(this.contentEl.children).filter(e=>"body"===t?this.isBodyPart(e):this.isFooterPart(e));return e.length>0?e:Array.from(this.children).filter(e=>"body"===t?this.isBodyPart(e):this.isFooterPart(e))}placeContentParts(t,e){this.contentEl&&e.forEach(e=>{if(e.parentElement!==this.contentEl){if("body"===t){const t=this.contentEl.querySelector(':scope > .designbase-wc-modal__footer, :scope > [data-modal-part="footer"]')||null;return void this.contentEl.insertBefore(e,t)}this.contentEl.append(e)}})}restorePartsToHost(){this.contentEl&&Array.from(this.contentEl.children).filter(t=>!t.classList.contains("designbase-wc-modal__integrated-content")&&!t.hasAttribute("data-wc-internal")).forEach(t=>{t.parentElement!==this&&this.append(t)})}bindFooterActions(){if(!this.contentEl||"true"===this.contentEl.dataset.modalActionsBound)return;this.contentEl.dataset.modalActionsBound="true";const handleClose=t=>{const e=t.target?.closest("[data-modal-close]");e&&this.contentEl?.contains(e)&&this.close()};this.contentEl.addEventListener("click",handleClose),this.contentEl.addEventListener("db-click",handleClose)}ensureStructure(){this.root||(this.root=document.createElement("div"),this.root.className="designbase-wc-modal__overlay",this.root.setAttribute("data-wc-internal",""),this.root.addEventListener("click",t=>{t.target===this.root&&"false"!==this.getAttribute("close-on-outside-click")&&this.close()}),this.panel=document.createElement("div"),this.panel.className="designbase-wc-modal",this.panel.setAttribute("role","dialog"),this.panel.setAttribute("aria-modal","true"),this.panel.addEventListener("click",t=>t.stopPropagation()),this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-modal__header",this.headerContentEl=document.createElement("div"),this.headerContentEl.className="designbase-wc-modal__header-content",this.titleEl=document.createElement("h2"),this.titleEl.className="designbase-wc-modal__title",this.titleEl.id=this.titleId,this.closeButton=document.createElement("button"),this.closeButton.type="button",this.closeButton.className="designbase-wc-modal__close-button",this.closeButton.setAttribute("aria-label","모달 닫기"),this.closeButton.addEventListener("click",()=>this.close()),this.navEl=document.createElement("div"),this.navEl.className="designbase-wc-modal__header-nav",this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-modal__content",this.panel.append(this.headerEl,this.contentEl),this.root.append(this.panel))}renderCloseButton(){if(!this.closeButton)return;const t=this.closeIconSize();this.closeButton.replaceChildren(createDbIcon("close",t)),this.closeButton.hidden="false"===this.getAttribute("show-close-button")}renderDefaultHeader(t){if(!(this.headerEl&&this.headerContentEl&&this.titleEl&&this.closeButton))return;if(this.headerEl.className="designbase-wc-modal__header",this.headerEl.replaceChildren(),t.length>0)return t.forEach(t=>this.headerEl.append(t)),void("false"!==this.getAttribute("show-close-button")&&this.headerEl.append(this.closeButton));const e=this.getAttribute("title")||"";this.titleEl.textContent=e,this.titleEl.hidden=!e,this.headerContentEl.replaceChildren(),e&&this.headerContentEl.append(this.titleEl),this.renderCloseButton(),this.headerEl.append(this.headerContentEl),"false"!==this.getAttribute("show-close-button")&&this.headerEl.append(this.closeButton),this.panel&&(e?this.panel.setAttribute("aria-labelledby",this.titleId):this.panel.removeAttribute("aria-labelledby"))}renderNavHeader(){if(!(this.headerEl&&this.headerContentEl&&this.titleEl&&this.closeButton&&this.navEl))return;const t=this.resolvedHeaderVariant(),e=this.parsedTabs(),s=this.parsedSegments(),i=D.includes(this.getAttribute("nav-size")||"m")?this.getAttribute("nav-size")||"m":"s";this.headerEl.className=["designbase-wc-modal__header","tabs"===t&&"designbase-wc-modal__header--tabs","segment"===t&&"designbase-wc-modal__header--segment"].filter(Boolean).join(" ");const n=this.getAttribute("title")||"";this.titleEl.textContent=n,this.titleEl.hidden=!n,this.headerContentEl.replaceChildren(),n&&this.headerContentEl.append(this.titleEl),this.renderCloseButton();const a=document.createElement("div");if(a.className="designbase-wc-modal__header-row",a.append(this.headerContentEl),"false"!==this.getAttribute("show-close-button")&&a.append(this.closeButton),this.headerEl.replaceChildren(a),this.navEl.replaceChildren(),"tabs"===t&&e.length>0){const t=document.createElement("db-tabs");t.setAttribute("size",i),t.setAttribute("items",JSON.stringify(e.map(t=>({id:t.id,label:t.label,disabled:t.disabled})))),t.setAttribute("selected-id",this.activeTabId()),t.addEventListener("db-change",t=>{const e=t.detail?.id;e&&(this.hasAttribute("selected-tab-id")||(this.internalTabId=e),this.dispatchEvent(new CustomEvent("db-tab-change",{detail:{tabId:e},bubbles:!0,composed:!0})),this.renderBodyContent(this.getClassifiedChildren().body))}),this.tabsEl=t,this.navEl.append(t),this.headerEl.append(this.navEl)}if("segment"===t&&s.length>0){const t=document.createElement("db-segment-control");t.setAttribute("size",i),t.setAttribute("options",JSON.stringify(s.map(t=>({value:t.value,label:t.label,disabled:t.disabled})))),t.setAttribute("value",this.activeSegmentValue()),"false"!==this.getAttribute("segment-full-width")&&t.setAttribute("full-width",""),t.addEventListener("db-change",t=>{const e=t.detail?.value;e&&(this.hasAttribute("segment-value")||(this.internalSegment=e),this.dispatchEvent(new CustomEvent("db-segment-change",{detail:{value:e},bubbles:!0,composed:!0})),this.renderBodyContent(this.getClassifiedChildren().body))}),this.segmentEl=t,this.navEl.append(t),this.headerEl.append(this.navEl)}this.panel&&(n?this.panel.setAttribute("aria-labelledby",this.titleId):this.panel.removeAttribute("aria-labelledby"))}renderHeader(t){if(!this.headerEl)return;if(t.length>0)return this.headerEl.hidden=!1,void this.renderDefaultHeader(t);if(this.usesIntegratedNav())return this.headerEl.hidden=!1,void this.renderNavHeader();this.getAttribute("title")||""?(this.headerEl.hidden=!1,this.renderDefaultHeader([])):this.headerEl.hidden=!0}renderBodyContent(t=[]){if(!this.contentEl)return;let e=this.contentEl.querySelector(":scope > .designbase-wc-modal__integrated-content"),s="";if(this.usesIntegratedNav()){const t=this.resolvedHeaderVariant();if("tabs"===t){const t=this.parsedTabs().find(t=>t.id===this.activeTabId());s=t?.content||""}if("segment"===t){const t=this.parsedSegments().find(t=>t.value===this.activeSegmentValue());s=t?.content||""}}s?(e||(e=document.createElement("div"),e.className="designbase-wc-modal__integrated-content designbase-wc-modal__body",this.contentEl.insertBefore(e,this.contentEl.firstChild)),e.textContent=s):e?.remove();const i=t.filter(t=>this.isBodyPart(t)),n=t.filter(t=>!this.isBodyPart(t)&&!this.isFooterPart(t));this.placeContentParts("body",i.length>0?i:n)}renderFooter(t){if(!this.contentEl)return;const e=t.filter(t=>this.isFooterPart(t)),s=t.filter(t=>!this.isFooterPart(t)&&!this.isBodyPart(t)),i=e.length>0?e:s;this.placeContentParts("footer",i),i.forEach(t=>{t.hidden=!1}),this.bindFooterActions()}render(){this.ensureStructure();const{header:t,body:e,footer:s}=this.getClassifiedChildren();$.forEach(t=>this.panel?.classList.remove(`designbase-wc-modal--${t}`)),this.panel?.classList.add(`designbase-wc-modal--${this.resolvedSize()}`),this.renderHeader(t),this.renderBodyContent(e),this.renderFooter(s)}syncVisibility(){if(this.root&&this.panel){if(this.open)return this.root.setAttribute("data-state","entering"),this.panel.setAttribute("data-state","entering"),void requestAnimationFrame(()=>{this.panel,requestAnimationFrame(()=>{this.open&&this.root&&this.panel&&(this.root.setAttribute("data-state","entered"),this.panel.setAttribute("data-state","entered"))})});this.root.setAttribute("data-state","exiting"),this.panel.setAttribute("data-state","exiting")}}syncOpenState(){if(this.open)return this.render(),this.root&&!this.root.isConnected&&document.body.append(this.root),document.body.style.overflow="hidden",this.isMounted=!0,void this.syncVisibility();this.isMounted&&(this.syncVisibility(),document.body.style.overflow="",this.exitTimerId&&clearTimeout(this.exitTimerId),this.exitTimerId=window.setTimeout(()=>{this.open||this.teardown()},200))}teardown(){this.restorePartsToHost(),this.root?.remove(),this.isMounted=!1,document.body.style.overflow=""}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}}customElements.get("db-modal")||customElements.define("db-modal",DbModal);const L=["s","m","l"],M=["bottom-left","bottom-right","top-left","top-right"],z=["primary","secondary","tertiary","danger","ghost"];class DbDropdown extends HTMLElement{constructor(){super(...arguments),this.focusedIndex=-1,this.onTriggerActivate=null,this.lastTriggerSignature="",this.handleTriggerKeyDown=t=>{if(("Enter"===t.key||" "===t.key||"ArrowDown"===t.key)&&!this.open)return t.preventDefault(),this.open=!0,requestAnimationFrame(()=>this.focusItem(0)),void this.render();"Escape"===t.key&&this.open&&(t.preventDefault(),this.open=!1,this.render())},this.handleDocumentKeyDown=t=>{if(!this.open)return;if("Escape"===t.key)return t.preventDefault(),this.open=!1,this.render(),void this.triggerWrap?.querySelector("[aria-haspopup]")?.focus();const e=this.enabledItems();if(!e.length)return;const s=e.findIndex(t=>this.parsedItems.indexOf(t)===this.focusedIndex);switch(t.key){case"ArrowDown":t.preventDefault(),this.focusItem(s<0?0:this.parsedItems.indexOf(e[(s+1)%e.length]));break;case"ArrowUp":t.preventDefault(),this.focusItem(s<0?0:this.parsedItems.indexOf(e[(s-1+e.length)%e.length]));break;case"Home":t.preventDefault(),this.focusItem(this.parsedItems.indexOf(e[0]));break;case"End":t.preventDefault(),this.focusItem(this.parsedItems.indexOf(e[e.length-1]));break;case"Enter":case" ":{t.preventDefault();const e=this.parsedItems[this.focusedIndex];!e||e.divider||e.disabled||this.selectItem(e);break}}},this.handleDocumentMouseDown=t=>{this.open&&(this.contains(t.target)||(this.open=!1,this.render()))}}static get observedAttributes(){return["options","items","placeholder","label","value","size","placement","full-width","disabled","open","trigger-variant","trigger-icon","icon-only"]}get parsedItems(){const t=this.getAttribute("items");if(t)try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return(this.getAttribute("options")||"").split(",").map(t=>t.trim()).filter(Boolean).map((t,e)=>({id:`option-${e}`,label:t}))}get options(){return this.parsedItems.map(t=>t.label||t.id)}set options(t){this.setAttribute("options",Array.isArray(t)?t.join(","):t)}get items(){return this.parsedItems}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}get value(){return this.getAttribute("value")||""}set value(t){t?this.setAttribute("value",t):this.removeAttribute("value")}get open(){return this.hasAttribute("open")}set open(t){const e=this.open;this.toggleAttribute("open",t),e!==t&&this.dispatchEvent(new CustomEvent("db-open",{detail:{open:t},bubbles:!0,composed:!0}))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get placement(){return this.getAttribute("placement")||"bottom-left"}set placement(t){this.setAttribute("placement",t)}get placeholder(){return this.getAttribute("placeholder")||""}set placeholder(t){t?this.setAttribute("placeholder",t):this.removeAttribute("placeholder")}get label(){return this.getAttribute("label")||""}set label(t){t?this.setAttribute("label",t):this.removeAttribute("label")}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(t){this.toggleAttribute("full-width",t)}connectedCallback(){requestAnimationFrame(()=>this.render()),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown),this.unbindTrigger()}attributeChangedCallback(t){this.isConnected&&("open"!==t||this.open||(this.focusedIndex=-1),this.render())}resolvedSize(){return L.includes(this.size)?this.size:"m"}resolvedPlacement(){return M.includes(this.placement)?this.placement:"bottom-left"}menuItemIconSize(){const t=this.resolvedSize();return"s"===t?14:"l"===t?18:16}triggerLabel(){return this.label?this.label:this.placeholder?this.placeholder:this.value?this.value:"메뉴"}enabledItems(){return this.parsedItems.filter(t=>!t.disabled&&!t.divider)}collectTriggerChildren(){const isInternalNode=t=>t.hasAttribute("data-wc-internal")||t===this.triggerWrap||t===this.menu||t===this.defaultTrigger,t=Array.from(this.children).filter(t=>!isInternalNode(t));return t.length>0?t:Array.from(this.triggerWrap?.children||[]).filter(t=>!isInternalNode(t))}hasCustomTrigger(){return this.collectTriggerChildren().length>0}bindTrigger(){this.triggerWrap&&(this.unbindTrigger(),this.onTriggerActivate=t=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this.toggleOpen())},this.triggerWrap.addEventListener("click",this.onTriggerActivate),this.triggerWrap.addEventListener("keydown",this.handleTriggerKeyDown))}unbindTrigger(){this.triggerWrap&&this.onTriggerActivate&&this.triggerWrap.removeEventListener("click",this.onTriggerActivate),this.triggerWrap&&this.triggerWrap.removeEventListener("keydown",this.handleTriggerKeyDown),this.onTriggerActivate=null}toggleOpen(){this.disabled||(this.open=!this.open,this.open&&requestAnimationFrame(()=>this.focusItem(0)),this.render())}triggerSignature(){return[this.resolvedSize(),this.getAttribute("trigger-variant")||"tertiary",this.hasAttribute("icon-only")?"1":"0",this.getAttribute("trigger-icon")||"",this.fullWidth?"1":"0"].join("|")}renderDefaultTrigger(){const t=this.resolvedSize(),e=this.getAttribute("trigger-variant")||"tertiary",s=z.includes(e)?e:"tertiary",i=this.hasAttribute("icon-only"),n=this.getAttribute("trigger-icon"),a=document.createElement("db-button");if(a.setAttribute("type","button"),a.setAttribute("variant",s),a.setAttribute("size",t),a.className="designbase-wc-dropdown__trigger",a.setAttribute("aria-haspopup","menu"),a.setAttribute("aria-label",this.triggerLabel()),this.fullWidth&&a.setAttribute("full-width",""),i)a.setAttribute("icon-only",""),a.setAttribute("start-icon",n&&isDbIconName(n)?n:"edit"),a.removeAttribute("end-icon");else{a.removeAttribute("icon-only"),n&&isDbIconName(n)?a.setAttribute("start-icon",n):a.removeAttribute("start-icon");const t=document.createElement("span");t.className="designbase-wc-dropdown__trigger-label",t.textContent=this.triggerLabel(),a.append(t),a.setAttribute("end-icon","chevron-down")}return a}syncDefaultTriggerState(t){t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-label",this.triggerLabel()),t.classList.toggle("designbase-wc-dropdown__trigger--open",this.open),this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled");const e=t.querySelector(".designbase-wc-dropdown__trigger-label");e&&(e.textContent=this.triggerLabel())}ensureStructure(){this.triggerWrap||(this.triggerWrap=document.createElement("div"),this.triggerWrap.className="designbase-wc-dropdown__trigger-wrap",this.triggerWrap.setAttribute("data-wc-internal","")),this.menu||(this.menu=document.createElement("div"),this.menu.className="designbase-wc-dropdown__menu",this.menu.setAttribute("data-wc-internal",""),this.menu.setAttribute("role","menu")),this.contains(this.triggerWrap)||this.append(this.triggerWrap),this.triggerWrap.contains(this.menu)||this.triggerWrap.append(this.menu),Array.from(this.children).forEach(t=>{t===this.triggerWrap||t.hasAttribute("data-wc-internal")||this.triggerWrap.insertBefore(t,this.menu)})}renderTrigger(){const t=this.collectTriggerChildren();if(t.length>0){this.defaultTrigger?.remove(),this.defaultTrigger=void 0;Array.from(this.triggerWrap.children).filter(t=>t!==this.menu&&t!==this.defaultTrigger).forEach(t=>t.remove()),t.forEach(t=>{t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded",String(this.open)),t.classList.toggle("designbase-wc-dropdown__trigger--open",this.open),this.triggerWrap.insertBefore(t,this.menu||null)})}else{Array.from(this.triggerWrap.children).filter(t=>t!==this.menu&&t!==this.defaultTrigger).forEach(t=>t.remove()),this.defaultTrigger&&this.triggerSignature()===this.lastTriggerSignature?this.syncDefaultTriggerState(this.defaultTrigger):(this.defaultTrigger?.remove(),this.defaultTrigger=this.renderDefaultTrigger(),this.lastTriggerSignature=this.triggerSignature(),this.triggerWrap.insertBefore(this.defaultTrigger,this.menu||null))}this.bindTrigger()}renderMenu(){const t=this.resolvedPlacement();this.menu.className=`designbase-wc-dropdown__menu designbase-wc-dropdown__menu--${t}${this.open?" designbase-wc-dropdown__menu--open":""}`,this.menu.setAttribute("aria-hidden",String(!this.open)),this.menu.setAttribute("aria-label",this.triggerLabel()),this.menu.replaceChildren();const e=this.menuItemIconSize();this.parsedItems.forEach((t,s)=>{if(t.divider){const t=document.createElement("div");return t.className="designbase-wc-dropdown__divider",t.setAttribute("role","separator"),void this.menu?.append(t)}t.id||t.label||String(s);const i=t.label||t.id,n=Boolean(t.disabled||this.disabled),a=this.focusedIndex===s,r=document.createElement("button");if(r.type="button",r.className=["designbase-wc-dropdown__item",n&&"designbase-wc-dropdown__item--disabled",a&&"designbase-wc-dropdown__item--focused"].filter(Boolean).join(" "),r.setAttribute("role","menuitem"),r.disabled=n,r.tabIndex=a?0:-1,r.dataset.index=String(s),t.icon){const s=createDbIcon(t.icon,e);s.classList.add("designbase-wc-dropdown__item-icon"),r.append(s)}const l=document.createElement("span");l.className="designbase-wc-dropdown__item-label",l.textContent=i,r.append(l),r.addEventListener("click",e=>{e.stopPropagation(),this.selectItem(t)}),this.menu?.append(r)})}render(){const t=this.resolvedSize();this.className=["designbase-wc-dropdown",`designbase-wc-dropdown--${t}`,this.open&&"designbase-wc-dropdown--open",this.fullWidth&&"designbase-wc-dropdown--full-width",this.disabled&&"designbase-wc-dropdown--disabled"].filter(Boolean).join(" "),this.ensureStructure(),this.renderTrigger(),this.renderMenu()}selectItem(t){t.disabled||t.divider||(this.open=!1,this.focusedIndex=-1,this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t.label||t.id,id:t.id,item:t},bubbles:!0,composed:!0})),this.render(),this.triggerWrap?.querySelector("[aria-haspopup]")?.focus())}focusItem(t){const e=this.enabledItems();if(!e.length)return;const s=e[Math.max(0,Math.min(t,e.length-1))],i=this.parsedItems.indexOf(s);this.focusedIndex=i;Array.from(this.menu?.querySelectorAll(".designbase-wc-dropdown__item")||[]).forEach(t=>{const e=Number(t.dataset.index)===i;t.classList.toggle("designbase-wc-dropdown__item--focused",e),t.tabIndex=e?0:-1,e&&t.focus()})}}customElements.get("db-dropdown")||customElements.define("db-dropdown",DbDropdown);const T=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],B=["s","m","l"],P=["default","primary","success","warning","danger","info"],F=-10;class DbTooltip extends HTMLElement{constructor(){super(...arguments),this.tooltipId=`db-tooltip-${Math.random().toString(36).slice(2,9)}`,this.visible=!1,this.handleShow=()=>{this.disabled||this.alwaysShow||(this.clearTimers(),this.showTimer=setTimeout(()=>this.setVisible(!0),Math.max(0,this.delay)))},this.handleHide=()=>{this.alwaysShow||(this.clearTimers(),this.hideTimer=setTimeout(()=>this.setVisible(!1),Math.max(0,this.hideDelay)))},this.handleKeyDown=t=>{"Escape"===t.key&&(this.clearTimers(),this.setVisible(!1))},this.handleReposition=()=>{(this.visible||this.alwaysShow)&&(this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.repositionRaf=requestAnimationFrame(()=>this.calculatePosition()))}}static get observedAttributes(){return["content","position","size","variant","disabled","always-show","delay","hide-delay","max-width","show-arrow"]}get content(){return this.getAttribute("content")||""}set content(t){this.setAttribute("content",t)}get position(){return this.getAttribute("position")||"top"}set position(t){this.setAttribute("position",t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}get variant(){return this.getAttribute("variant")||"default"}set variant(t){this.setAttribute("variant",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t)}get alwaysShow(){return this.hasAttribute("always-show")}set alwaysShow(t){this.toggleAttribute("always-show",t)}get delay(){return Number(this.getAttribute("delay")??"200")}get hideDelay(){return Number(this.getAttribute("hide-delay")??"80")}get maxWidth(){return Number(this.getAttribute("max-width")??"240")}get showArrow(){return"false"!==this.getAttribute("show-arrow")}connectedCallback(){this.render(),this.childObserver=new MutationObserver(()=>this.render()),this.childObserver.observe(this,{childList:!0}),window.addEventListener("scroll",this.handleReposition,!0),window.addEventListener("resize",this.handleReposition)}disconnectedCallback(){this.childObserver?.disconnect(),this.clearTimers(),this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),window.removeEventListener("scroll",this.handleReposition,!0),window.removeEventListener("resize",this.handleReposition),this.tooltip?.remove(),this.tooltip=void 0}attributeChangedCallback(){this.isConnected&&(this.render(),this.alwaysShow?this.setVisible(!0):this.visible||this.removeTooltip())}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=void 0,this.hideTimer=void 0}groupOf(t){return t.startsWith("top")?"top":t.startsWith("bottom")?"bottom":t.startsWith("left")?"left":"right"}resolvedPosition(){return T.includes(this.position)?this.position:"top"}collectTriggerChildren(){const isInternalNode=t=>t.hasAttribute("data-wc-internal")||t===this.trigger,t=Array.from(this.children).filter(t=>!isInternalNode(t));return t.length>0?t:Array.from(this.trigger?.children||[])}ensureTrigger(){this.trigger||(this.trigger=document.createElement("span"),this.trigger.className="designbase-wc-tooltip__trigger",this.trigger.setAttribute("data-wc-internal",""),this.trigger.tabIndex=0,this.trigger.addEventListener("mouseenter",this.handleShow),this.trigger.addEventListener("mouseleave",this.handleHide),this.trigger.addEventListener("focus",this.handleShow),this.trigger.addEventListener("blur",this.handleHide),this.trigger.addEventListener("keydown",this.handleKeyDown)),this.trigger.parentElement!==this&&this.append(this.trigger)}mountTriggerChildren(t){this.trigger&&t.forEach(t=>{t.parentElement!==this.trigger&&this.trigger.append(t)})}render(){this.ensureTrigger(),this.mountTriggerChildren(this.collectTriggerChildren()),this.alwaysShow&&this.setVisible(!0)}ensureTooltip(){this.tooltip||(this.tooltip=document.createElement("div"),this.tooltip.className="designbase-wc-tooltip",this.tooltip.setAttribute("data-wc-internal",""),this.tooltip.setAttribute("role","tooltip"),this.tooltip.id=this.tooltipId,this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-tooltip__content",this.arrow=document.createElement("div"),this.arrow.className="designbase-wc-tooltip__arrow",this.tooltip.append(this.contentEl,this.arrow),document.body.append(this.tooltip))}syncTooltipClasses(){if(!this.tooltip||!this.arrow)return;const t=this.resolvedPosition(),e=B.includes(this.size)?this.size:"m",s=P.includes(this.variant)?this.variant:"default";this.tooltip.className=["designbase-wc-tooltip",`designbase-wc-tooltip--${e}`,`designbase-wc-tooltip--${s}`,`designbase-wc-tooltip--${t}`,(this.visible||this.alwaysShow)&&"designbase-wc-tooltip--visible",this.disabled&&"designbase-wc-tooltip--disabled"].filter(Boolean).join(" "),this.arrow.className=`designbase-wc-tooltip__arrow designbase-wc-tooltip__arrow--${t}`,this.arrow.hidden=!this.showArrow,this.tooltip.setAttribute("data-placement-group",this.groupOf(t)),this.tooltip.setAttribute("aria-hidden",String(!(this.visible||this.alwaysShow))),this.tooltip.style.maxWidth=`${this.maxWidth}px`,this.tooltip.style.zIndex="9999",this.tooltip.style.pointerEvents="none",this.contentEl&&(this.contentEl.textContent=this.content)}calculatePosition(){if(!this.trigger||!this.tooltip||!this.arrow)return;const t=this.resolvedPosition(),e=this.trigger.getBoundingClientRect(),s=this.tooltip.getBoundingClientRect();let i=0,n=0,a=0,r=0;switch(t){case"top":i=e.top-s.height-8,n=e.left+e.width/2-s.width/2,a=s.height-2,r=s.width/2-6;break;case"top-start":i=e.top-s.height-8,n=e.left,a=s.height-2,r=8;break;case"top-end":i=e.top-s.height-8,n=e.right-s.width,a=s.height-2,r=s.width-8-6;break;case"bottom":i=e.bottom+8,n=e.left+e.width/2-s.width/2,a=F,r=s.width/2-6;break;case"bottom-start":i=e.bottom+8,n=e.left,a=F,r=8;break;case"bottom-end":i=e.bottom+8,n=e.right-s.width,a=F,r=s.width-8-6;break;case"left":i=e.top+e.height/2-s.height/2,n=e.left-s.width-8,a=s.height/2-6,r=s.width-2;break;case"left-start":i=e.top,n=e.left-s.width-8,a=8,r=s.width-2;break;case"left-end":i=e.bottom-s.height,n=e.left-s.width-8,a=s.height-8-6,r=s.width-2;break;case"right":i=e.top+e.height/2-s.height/2,n=e.right+8,a=s.height/2-6,r=F;break;case"right-start":i=e.top,n=e.right+8,a=8,r=F;break;case"right-end":i=e.bottom-s.height,n=e.right+8,a=s.height-8-6,r=F}const l=window.innerWidth,o=window.innerHeight;n<8&&(n=8),n+s.width>l-8&&(n=l-s.width-8),i<8&&(i=8),i+s.height>o-8&&(i=o-s.height-8);const d=this.groupOf(t);if("top"===d||"bottom"===d){const t=e.left+e.width/2-n-6;r=Math.min(s.width-8-6,Math.max(8,t))}else{const t=e.top+e.height/2-i-6;a=Math.min(s.height-8-6,Math.max(8,t))}this.tooltip.style.position="fixed",this.tooltip.style.top=`${i}px`,this.tooltip.style.left=`${n}px`,this.arrow.style.position="absolute",this.arrow.style.top=`${a}px`,this.arrow.style.left=`${r}px`}setVisible(t){if(!this.disabled||!t){if(this.visible=t,!t&&!this.alwaysShow)return this.removeTooltip(),void this.trigger?.removeAttribute("aria-describedby");this.ensureTooltip(),this.syncTooltipClasses(),this.trigger?.setAttribute("aria-describedby",this.tooltipId),requestAnimationFrame(()=>{this.syncTooltipClasses(),this.calculatePosition()})}}removeTooltip(){this.tooltip?.remove(),this.tooltip=void 0,this.contentEl=void 0,this.arrow=void 0}}customElements.get("db-tooltip")||customElements.define("db-tooltip",DbTooltip);class DbAccordion extends HTMLElement{constructor(){super(...arguments),this.expanded=new Set,this.isRendering=!1,this.suppressExpandedAttrCallback=!1}static get observedAttributes(){return["items","variant","size","allow-multiple","expand-mode","expanded-items","default-item-type"]}get items(){try{const t=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}get allowMultiple(){return this.hasAttribute("allow-multiple")}set allowMultiple(t){this.toggleAttribute("allow-multiple",t)}get expandedItems(){const t=(this.getAttribute("expanded-items")||"").trim();if(!t)return[];if("all"===t)return this.items.map((t,e)=>this.resolveItemKey(t,e));try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(t=>String(t).trim()).filter(Boolean)}catch{}return t.split(",").map(t=>t.trim()).filter(Boolean)}set expandedItems(t){Array.isArray(t)?this.setAttribute("expanded-items",t.join(",")):this.setAttribute("expanded-items",t)}connectedCallback(){this.syncExpandedFromAttributes(),this.render(),this.childObserver=new MutationObserver(t=>{if(this.isRendering)return;t.some(t=>Array.from(t.addedNodes).some(t=>t instanceof HTMLElement&&t.hasAttribute("slot")))&&this.render()}),this.childObserver.observe(this,{childList:!0})}disconnectedCallback(){this.childObserver?.disconnect()}attributeChangedCallback(t){if(this.isConnected){if("expanded-items"===t){if(this.suppressExpandedAttrCallback)return;return this.syncExpandedFromAttributes(),void this.syncExpandedState()}return"expand-mode"===t||"allow-multiple"===t?(this.syncExpandedFromAttributes(),void this.syncExpandedState()):"items"===t?(this.syncExpandedFromAttributes(),void this.render()):void this.render()}}resolveItemKey(t,e){return t.id??String(e)}getExpandMode(){const t=this.getAttribute("expand-mode");return"single"===t||"multiple"===t||"all"===t?t:(this.hasAttribute("allow-multiple"),"multiple")}syncExpandedFromAttributes(){const t=this.items.map((t,e)=>this.resolveItemKey(t,e)),e=this.expandedItems,s=this.getExpandMode();e.length>0?this.expanded=new Set(e.filter(e=>t.includes(e))):this.expanded="all"!==s?new Set:new Set(t)}iconSize(t){return"s"===t?16:"l"===t?24:20}collectPanelContent(){const t=new Map,register=(e,s)=>{if(!(e instanceof HTMLElement)||"SLOT"===e.tagName)return;t.has(s)||t.set(s,[]);const i=t.get(s);i.includes(e)||i.push(e)};return Array.from(this.children).forEach(t=>{const e=t.getAttribute("slot")?.match(/^content-(\d+)$/);e&®ister(t,Number(e[1]))}),this.querySelectorAll(":scope > .designbase-wc-accordion__item").forEach((t,e)=>{const s=t.querySelector(":scope > .designbase-wc-accordion__content > .designbase-wc-accordion__content-inner");s&&Array.from(s.children).forEach(t=>register(t,e))}),t}isItemExpanded(t,e){return this.expanded.has(this.resolveItemKey(t,e))}syncExpandedState(){const t=this.items;this.querySelectorAll(":scope > .designbase-wc-accordion__item").forEach((e,s)=>{const i=t[s];if(!i)return;const n=this.isItemExpanded(i,s);e.classList.toggle("designbase-wc-accordion__item--expanded",n),e.classList.toggle("designbase-wc-accordion__item--disabled",Boolean(i.disabled));const a=e.querySelector(".designbase-wc-accordion__trigger"),r=e.querySelector(".designbase-wc-accordion__content");a?.setAttribute("aria-expanded",String(n)),r?.setAttribute("aria-hidden",String(!n))})}render(){this.isRendering=!0;const t=this.collectPanelContent(),e=this.getAttribute("variant")||"default",s=this.getAttribute("size")||"m",i=this.getExpandMode(),n=this.getAttribute("default-item-type")||"none",a=this.items,r=this.iconSize(s);this.className=["designbase-wc-accordion",`designbase-wc-accordion--${e}`,`designbase-wc-accordion--${s}`,"multiple"===i&&"designbase-wc-accordion--multiple","single"===i&&"designbase-wc-accordion--single","all"===i&&"designbase-wc-accordion--all"].filter(Boolean).join(" "),this.setAttribute("role","region"),this.setAttribute("aria-label","아코디언"),this.querySelectorAll(":scope > .designbase-wc-accordion__item").forEach(t=>t.remove()),a.forEach((s,i)=>{const a=this.resolveItemKey(s,i),l=this.isItemExpanded(s,i),o=document.createElement("div");o.className=["designbase-wc-accordion__item",`designbase-wc-accordion__item--${e}`,l&&"designbase-wc-accordion__item--expanded",s.disabled&&"designbase-wc-accordion__item--disabled"].filter(Boolean).join(" "),o.dataset.itemKey=a;const d=document.createElement("button");d.type="button",d.className="designbase-wc-accordion__trigger",d.disabled=Boolean(s.disabled),d.setAttribute("aria-expanded",String(l)),d.setAttribute("aria-controls",`accordion-content-${a}`),d.addEventListener("click",()=>{s.disabled||this.toggle(a)});const u=s.itemType||n;if("number"===u){const t=document.createElement("div");t.className="designbase-wc-accordion__number",t.textContent=`${i+1}.`,d.append(t)}else if("question"===u){const t=document.createElement("div");t.className="designbase-wc-accordion__question",t.textContent="Q.",d.append(t)}else if("icon"===u&&s.icon){const t=document.createElement("div");t.className="designbase-wc-accordion__icon",t.append(createDbIcon(s.icon,r)),d.append(t)}const b=document.createElement("span");b.className="designbase-wc-accordion__title",b.textContent=s.title;const p=document.createElement("div");p.className="designbase-wc-accordion__chevron",p.append(createDbIcon("chevron-down",r)),d.append(b,p);const m=document.createElement("div");m.id=`accordion-content-${a}`,m.className="designbase-wc-accordion__content",m.setAttribute("aria-hidden",String(!l));const g=document.createElement("div");g.className="designbase-wc-accordion__content-inner",(t.get(i)||[]).forEach(t=>{t.removeAttribute("slot"),g.append(t)}),m.append(g),o.append(d,m),this.append(o)}),this.isRendering=!1}toggle(t){const e=this.getExpandMode();this.expanded.has(t)?this.expanded.delete(t):"single"===e?this.expanded=new Set([t]):this.expanded.add(t);const s=Array.from(this.expanded);this.syncExpandedState(),this.suppressExpandedAttrCallback=!0,this.expandedItems=s,this.suppressExpandedAttrCallback=!1,this.dispatchEvent(new CustomEvent("db-change",{detail:{expandedItems:s},bubbles:!0,composed:!0}))}}customElements.get("db-accordion")||customElements.define("db-accordion",DbAccordion);const O=["xs","s","m","l","xl","2xl"],H=["default","primary","success","warning","danger","info"],V=["online","offline","away","busy"],R=["#E3F2FD","#F3E5F5","#E8F5E8","#FFF3E0","#FCE4EC","#E0F2F1","#FFF8E1","#F1F8E9","#E8EAF6","#FFEBEE"],q=["#1976D2","#7B1FA2","#388E3C","#F57C00","#C2185B","#00796B","#F9A825","#689F38","#3F51B5","#D32F2F"];class DbAvatar extends HTMLElement{constructor(){super(...arguments),this.imageFailed=!1,this.imageLoaded=!1,this.handleClick=()=>{!this.hasAttribute("disabled")&&this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=t=>{this.hasAttribute("clickable")&&!this.hasAttribute("disabled")&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["src","alt","initials","size","variant","status","disabled","clickable","badge","badge-max-count","badge-variant","badge-style","badge-text"]}connectedCallback(){this.render(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(t){"src"===t&&(this.imageFailed=!1,this.imageLoaded=!1),this.render()}render(){const t=O.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",e=H.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default",s=this.hasAttribute("disabled"),i=this.hasAttribute("clickable"),n=this.getAttribute("src"),a=this.getAttribute("initials")||"",r=Boolean(n&&!this.imageFailed),l=r&&!this.imageLoaded;if(this.className=["designbase-wc-avatar",`designbase-wc-avatar--${t}`,`designbase-wc-avatar--${e}`,i&&"designbase-wc-avatar--clickable",s&&"designbase-wc-avatar--disabled",l&&"designbase-wc-avatar--loading"].filter(Boolean).join(" "),i&&!s?(this.setAttribute("role","button"),this.tabIndex=0):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.toggleAttribute("aria-disabled",s),this.replaceChildren(),l){const t=document.createElement("div");t.className="designbase-wc-avatar__loading";const e=document.createElement("div");e.className="designbase-wc-avatar__skeleton",t.append(e),this.append(t)}if(r){const t=document.createElement("img");t.className="designbase-wc-avatar__image",t.src=n,t.alt=this.getAttribute("alt")||"아바타 이미지",t.loading="lazy",t.addEventListener("load",()=>{this.imageLoaded=!0,this.classList.remove("designbase-wc-avatar--loading"),this.querySelector(".designbase-wc-avatar__loading")?.remove()}),t.addEventListener("error",()=>{this.imageFailed=!0,this.imageLoaded=!1,this.render()}),this.append(t)}else if(a){const t=document.createElement("div");if(t.className="designbase-wc-avatar__initials","default"===e){const e=function initialsColor(t){let e=0;for(let s=0;s<t.length;s++)e=t.charCodeAt(s)+((e<<5)-e);const s=Math.abs(e)%R.length;return{backgroundColor:R[s],color:q[s]}}(a);t.style.backgroundColor=e.backgroundColor,t.style.color=e.color}t.textContent=a.charAt(0).toUpperCase(),this.append(t)}else{const e=document.createElement("div");e.className="designbase-wc-avatar__icon",e.append(createDbIcon("user",function iconSize(t){return"xs"===t?12:"s"===t?16:"m"===t?20:"l"===t?24:"xl"===t?32:40}(t))),this.append(e)}const o=this.getAttribute("status")||"";if(V.includes(o)){const t=document.createElement("span");t.className=`designbase-wc-avatar__status designbase-wc-avatar__status--${o}`,this.append(t)}if(this.hasAttribute("badge")){const e=document.createElement("div");e.className="designbase-wc-avatar__badge";const s=document.createElement("db-badge");s.setAttribute("count",this.getAttribute("badge")||"0");const i=this.getAttribute("badge-style")||"number";s.setAttribute("badge-style",i),this.hasAttribute("badge-max-count")&&s.setAttribute("max-count",this.getAttribute("badge-max-count")),s.setAttribute("variant",this.getAttribute("badge-variant")||"danger"),this.hasAttribute("badge-text")&&(s.textContent=this.getAttribute("badge-text"));const n="xl"===t||"2xl"===t?"m":"s";s.setAttribute("size",n),e.append(s),this.append(e)}}}customElements.get("db-avatar")||customElements.define("db-avatar",DbAvatar);const j=["primary","secondary","success","warning","danger","muted"];class DbDivider extends HTMLElement{static get observedAttributes(){return["orientation","thickness","color","length","variant","margin"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const t=this.getAttribute("orientation")||"horizontal",e=this.getAttribute("variant")||"solid",s=Number(this.getAttribute("thickness")||1),i=this.getAttribute("color"),n=this.getAttribute("length"),a=this.getAttribute("margin");this.className=["designbase-wc-divider",`designbase-wc-divider--${t}`,`designbase-wc-divider--${e}`,i&&j.includes(i)?`designbase-wc-divider--${i}`:""].filter(Boolean).join(" "),this.setAttribute("role","separator"),this.setAttribute("aria-orientation",t),this.style.border="none",this.style.background="none",this.style.margin="",this.style.width="",this.style.height="","vertical"===t?(this.style.display="inline-block",this.style.borderLeft=`${s}px ${e} var(--db-border-base)`,this.style.verticalAlign="middle",n&&(this.style.height=n.endsWith("px")||n.endsWith("%")?n:`${n}px`)):(this.style.display="block",this.style.width="100%",this.style.borderTop=`${s}px ${e} var(--db-border-base)`),i&&!j.includes(i)&&("vertical"===t?this.style.borderLeftColor=i:this.style.borderTopColor=i),a&&(this.style.margin=/^\d+$/.test(a)?`${a}px`:a)}}customElements.get("db-divider")||customElements.define("db-divider",DbDivider);const W=["s","m","l"],U=["default","success","warning","danger"],J=["default","minimal"];function createSvgCircle(t,e,s,i,n,a){const r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("class",t),r.setAttribute("cx",String(e)),r.setAttribute("cy",String(s)),r.setAttribute("r",String(i)),r.setAttribute("stroke-width",String(n)),a&&Object.entries(a).forEach(([t,e])=>r.setAttribute(t,e)),r}class DbProgress extends HTMLElement{static get observedAttributes(){return["value","max","size","variant","type","circular-style","show-value","animated","striped"]}get value(){return Number(this.getAttribute("value")||0)}set value(t){this.setAttribute("value",String(t))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const t=Number(this.getAttribute("max")||100),e=Math.min(Math.max(this.value/t*100,0),100),s=this.getAttribute("size")||"m",i=this.getAttribute("variant")||"default",n=this.getAttribute("type")||"linear",a=this.getAttribute("circular-style")||"default",r=W.includes(s)?s:"m",l=U.includes(i)?i:"default",o=J.includes(a)?a:"default";if(this.className=["designbase-wc-progress",`designbase-wc-progress--size-${r}`,`designbase-wc-progress--variant-${l}`,`designbase-wc-progress--type-${n}`,"circular"===n&&"minimal"===o?"designbase-wc-progress--circular-minimal":"",this.hasAttribute("animated")?"designbase-wc-progress--animated":"",this.hasAttribute("striped")?"designbase-wc-progress--striped":""].filter(Boolean).join(" "),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax",String(t)),this.setAttribute("aria-valuenow",String(this.value)),this.replaceChildren(),"circular"===n){const{svgSize:t,radius:s,strokeWidth:i,center:n}=function getCircularMetrics(t,e){if("minimal"===t)return{svgSize:20,radius:8,strokeWidth:2,center:10};switch(e){case"s":return{svgSize:64,radius:26,strokeWidth:4,center:32};case"l":return{svgSize:160,radius:62,strokeWidth:10,center:80};default:return{svgSize:120,radius:45,strokeWidth:8,center:60}}}(o,r),a=2*Math.PI*s,l=a-e/100*a,d=document.createElement("div");d.className="designbase-wc-progress__circular";const u=document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.setAttribute("class","designbase-wc-progress__circular-svg"),u.setAttribute("width",String(t)),u.setAttribute("height",String(t)),u.setAttribute("viewBox",`0 0 ${t} ${t}`),u.setAttribute("aria-hidden","true"),u.append(createSvgCircle("designbase-wc-progress__circular-track",n,n,s,i),createSvgCircle("designbase-wc-progress__circular-bar",n,n,s,i,{"stroke-dasharray":String(a),"stroke-dashoffset":String(l),transform:`rotate(-90 ${n} ${n})`})),d.append(u),this.hasAttribute("show-value")&&"minimal"!==o){const t=document.createElement("span");t.className="designbase-wc-progress__circular-value",t.textContent=`${Math.round(e)}%`,d.append(t)}return void this.append(d)}const d=document.createElement("div");d.className="designbase-wc-progress__linear";const u=document.createElement("div");u.className="designbase-wc-progress__track";const b=document.createElement("div");if(b.className="designbase-wc-progress__bar",b.style.width=`${e}%`,u.append(b),d.append(u),this.hasAttribute("show-value")){const t=document.createElement("span");t.className="designbase-wc-progress__value",t.textContent=`${Math.round(e)}%`,d.append(t)}this.append(d)}}customElements.get("db-progress")||customElements.define("db-progress",DbProgress);const K=["s","m","l"];class DbSelect extends HTMLElement{constructor(){super(...arguments),this.internals=this.attachInternals(),this.built=!1,this.searchTerm="",this.focusedIndex=-1,this.handleTriggerClick=()=>{this.hasAttribute("disabled")||this.hasAttribute("readonly")||(this.open=!this.open,this.open&&this.searchable&&setTimeout(()=>this.searchInput?.focus(),0))},this.handleTriggerFocus=()=>{this.trigger?.classList.add("designbase-wc-select__trigger--focused")},this.handleTriggerBlur=()=>{this.trigger?.classList.remove("designbase-wc-select__trigger--focused")},this.handleClear=t=>{t.stopPropagation();const e=[];this.setSelectedValues(e),this.syncTrigger(),this.syncOptions(),this.dispatchChange(e)},this.handleSearchInput=()=>{this.searchTerm=this.searchInput?.value||"",this.focusedIndex=-1,this.syncOptions()},this.handleDocumentMouseDown=t=>{this.contains(t.target)||(this.open=!1,this.searchTerm="",this.searchInput&&(this.searchInput.value=""),this.focusedIndex=-1,this.syncOptions())},this.handleDocumentKeyDown=t=>{if(!this.contains(document.activeElement))return;if(!this.open)return void("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.open=!0));const e=this.getFilteredOptions();switch(t.key){case"Escape":t.preventDefault(),this.open=!1,this.searchTerm="",this.searchInput&&(this.searchInput.value=""),this.focusedIndex=-1,this.syncOptions();break;case"ArrowDown":t.preventDefault(),this.focusedIndex=Math.min(this.focusedIndex+1,e.length-1),this.syncOptions();break;case"ArrowUp":t.preventDefault(),this.focusedIndex=Math.max(this.focusedIndex-1,0),this.syncOptions();break;case"Enter":t.preventDefault(),this.focusedIndex>=0&&e[this.focusedIndex]&&this.selectOption(e[this.focusedIndex])}}}static get observedAttributes(){return["options","value","placeholder","label","size","full-width","disabled","readonly","required","error","error-message","helper-text","multiple","searchable","show-clear-button","open","max-height","position","dropdown-width","name"]}get name(){return this.getAttribute("name")??""}set name(t){this.setAttribute("name",t)}get open(){return this.hasAttribute("open")}set open(t){this.toggleAttribute("open",t),this.syncOpenState()}get value(){return this.getAttribute("value")||""}set value(t){t?this.setAttribute("value",t):this.removeAttribute("value"),this.syncTrigger(),this.syncOptions()}connectedCallback(){this.built||this.build(),this.syncState(),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown)}formResetCallback(){this.removeAttribute("value"),this.internals.setFormValue(null),this.built&&(this.syncTrigger(),this.syncOptions())}formDisabledCallback(t){this.toggleAttribute("disabled",t)}attributeChangedCallback(t){if(this.built){if("open"!==t)return"value"===t?(this.syncTrigger(),void this.syncOptions()):void this.syncState();this.syncOpenState()}}get multiple(){return this.hasAttribute("multiple")}set multiple(t){this.toggleAttribute("multiple",Boolean(t))}get searchable(){return this.hasAttribute("searchable")}set searchable(t){this.toggleAttribute("searchable",Boolean(t))}get showClearButton(){return!this.hasAttribute("show-clear-button")||"false"!==this.getAttribute("show-clear-button")}parseOptions(){const t=this.getAttribute("options")||"[]";try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return t.split(",").map(t=>t.trim()).filter(Boolean).map(t=>({value:t,label:t}))}}parseSelectedValues(){const t=this.getAttribute("value")||"";if(!t)return[];if(this.multiple)try{const e=JSON.parse(t);return Array.isArray(e)?e.map(String):[]}catch{return t.split(",").map(t=>t.trim()).filter(Boolean)}return t?[t]:[]}setSelectedValues(t){this.multiple?t.length?this.setAttribute("value",JSON.stringify(t)):this.removeAttribute("value"):t[0]?this.setAttribute("value",t[0]):this.removeAttribute("value")}getIconSize(){const t=this.getAttribute("size")||"m";return getDbComponentIconSize(K.includes(t)?t:"m")}syncIndicatorIcons(){const t=this.getIconSize();this.clearButton?.replaceChildren(createDbIcon("close",t)),this.chevronEl&&this.chevronEl.replaceChildren(createDbIcon(this.open?"chevron-up":"chevron-down",t))}build(){const t=this.getAttribute("id")||`db-select-${Math.random().toString(36).slice(2)}`,e=`${t}-listbox`;this.hasAttribute("id")||this.setAttribute("id",t),this.labelEl=document.createElement("label"),this.labelEl.className="designbase-wc-select__label",this.trigger=document.createElement("div"),this.trigger.className="designbase-wc-select__trigger",this.trigger.tabIndex=0,this.trigger.setAttribute("role","combobox"),this.trigger.setAttribute("aria-haspopup","listbox"),this.trigger.setAttribute("aria-controls",e),this.trigger.addEventListener("click",this.handleTriggerClick),this.trigger.addEventListener("focus",this.handleTriggerFocus),this.trigger.addEventListener("blur",this.handleTriggerBlur),this.valueEl=document.createElement("div"),this.valueEl.className="designbase-wc-select__value",this.indicatorsEl=document.createElement("div"),this.indicatorsEl.className="designbase-wc-select__indicators",this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="designbase-wc-select__clear-button",this.clearButton.setAttribute("aria-label","모든 값 지우기"),this.clearButton.hidden=!0,this.clearButton.appendChild(createDbIcon("close",this.getIconSize())),this.clearButton.addEventListener("click",this.handleClear),this.chevronEl=document.createElement("div"),this.chevronEl.className="designbase-wc-select__chevron",this.indicatorsEl.append(this.clearButton,this.chevronEl),this.trigger.append(this.valueEl,this.indicatorsEl),this.dropdown=document.createElement("div"),this.dropdown.className="designbase-wc-select__dropdown",this.searchWrap=document.createElement("div"),this.searchWrap.className="designbase-wc-select__search",this.searchWrap.hidden=!0,this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="designbase-wc-select__search-input",this.searchInput.placeholder="옵션 검색",this.searchInput.addEventListener("input",this.handleSearchInput),this.searchInput.addEventListener("mousedown",t=>t.stopPropagation()),this.searchInput.addEventListener("click",t=>t.stopPropagation()),this.searchWrap.appendChild(this.searchInput),this.optionsEl=document.createElement("div"),this.optionsEl.className="designbase-wc-select__options",this.optionsEl.id=e,this.optionsEl.setAttribute("role","listbox"),this.dropdown.append(this.searchWrap,this.optionsEl),this.helperEl=document.createElement("p"),this.helperEl.className="designbase-wc-select__helper-text",this.errorEl=document.createElement("p"),this.errorEl.className="designbase-wc-select__error-message",this.append(this.labelEl,this.trigger,this.dropdown,this.helperEl,this.errorEl),this.built=!0}getFilteredOptions(){const t=this.parseOptions();if(!this.searchable||!this.searchTerm)return t;const e=this.searchTerm.toLowerCase();return t.filter(t=>t.label.toLowerCase().includes(e))}selectOption(t){if(t.disabled)return;const e=this.parseSelectedValues();let s;this.multiple?s=e.includes(t.value)?e.filter(e=>e!==t.value):[...e,t.value]:(s=[t.value],this.open=!1,this.searchTerm="",this.searchInput&&(this.searchInput.value=""),this.focusedIndex=-1),this.setSelectedValues(s),this.syncTrigger(),this.syncOptions(),this.dispatchChange(s)}dispatchChange(t){const e=this.parseOptions();if(this.multiple){const s=new FormData;return t.forEach(t=>s.append(this.name||"select",t)),this.internals.setFormValue(t.length?s:null),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t,labels:t.map(t=>e.find(e=>e.value===t)?.label||t)},bubbles:!0,composed:!0}))}const s=t[0]||"",i=e.find(t=>t.value===s)?.label||"";this.internals.setFormValue(s||null),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:s,label:i},bubbles:!0,composed:!0}))}syncState(){if(!this.trigger||!this.dropdown||!this.optionsEl)return;const t=K.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",e="top"===this.getAttribute("position")?"top":"bottom",s="full"===this.getAttribute("dropdown-width")?"full":"auto",i=Number(this.getAttribute("max-height")||200),n=this.getAttribute("label")||"",a=this.getAttribute("helper-text")||"",r=this.getAttribute("error-message")||"",l=this.hasAttribute("error"),o=this.getAttribute("id")||"";this.className=["designbase-wc-select",`designbase-wc-select--${t}`,this.open&&"designbase-wc-select--open",l&&"designbase-wc-select--error",this.hasAttribute("disabled")&&"designbase-wc-select--disabled",this.hasAttribute("readonly")&&"designbase-wc-select--readonly",this.hasAttribute("full-width")&&"designbase-wc-select--full-width",this.multiple&&"designbase-wc-select--multiple",this.searchable&&"designbase-wc-select--searchable"].filter(Boolean).join(" ");const d=this.parseSelectedValues();if(this.classList.toggle("designbase-wc-select--has-value",d.length>0),this.labelEl){const t=this.hasAttribute("required")?'<span class="designbase-wc-select__required" aria-hidden="true">*</span>':"";this.labelEl.innerHTML=n?`${this.escape(n)}${t}`:"",this.labelEl.hidden=!n}this.dropdown.className=["designbase-wc-select__dropdown",`designbase-wc-select__dropdown--${s}`,`designbase-wc-select__dropdown--${e}`,this.open&&"designbase-wc-select__dropdown--open"].filter(Boolean).join(" "),this.optionsEl.style.maxHeight=`${i}px`,this.searchWrap&&(this.searchWrap.hidden=!this.searchable);const u=`${o}-helper`,b=`${o}-error`;l&&r?(this.errorEl.id=b,this.errorEl.textContent=r,this.errorEl.hidden=!1,this.helperEl.hidden=!0,this.trigger.setAttribute("aria-describedby",b),this.trigger.setAttribute("aria-invalid","true")):a?(this.helperEl.id=u,this.helperEl.textContent=a,this.helperEl.hidden=!1,this.errorEl.hidden=!0,this.trigger.setAttribute("aria-describedby",u),this.trigger.removeAttribute("aria-invalid")):(this.helperEl.hidden=!0,this.errorEl.hidden=!0,this.trigger.removeAttribute("aria-describedby"),this.trigger.removeAttribute("aria-invalid")),this.hasAttribute("disabled")||this.hasAttribute("readonly")?this.trigger.tabIndex=-1:this.trigger.tabIndex=0,this.syncOpenState(),this.syncTrigger(),this.syncOptions(),this.syncIndicatorIcons()}syncOpenState(){this.trigger&&this.dropdown&&this.chevronEl&&(this.trigger.setAttribute("aria-expanded",String(this.open)),this.classList.toggle("designbase-wc-select--open",this.open),this.dropdown.classList.toggle("designbase-wc-select__dropdown--open",this.open),this.syncIndicatorIcons())}syncTrigger(){if(!this.valueEl||!this.clearButton)return;const t=this.parseOptions(),e=this.parseSelectedValues(),s=this.getAttribute("placeholder")||"선택하세요",i=e.length>0,n=i&&this.showClearButton&&!this.hasAttribute("disabled")&&!this.hasAttribute("readonly");if(this.valueEl.replaceChildren(),this.multiple)if(0===e.length){const t=document.createElement("span");t.className="designbase-wc-select__placeholder",t.textContent=s,this.valueEl.appendChild(t)}else{const s=document.createElement("div");s.className="designbase-wc-select__tags",e.forEach(i=>{const n=t.find(t=>t.value===i),a=document.createElement("span");a.className="designbase-wc-select__tag";const r=document.createElement("span");r.className="designbase-wc-select__tag-label",r.textContent=n?.label||i;const l=document.createElement("button");l.type="button",l.className="designbase-wc-select__tag-remove",l.setAttribute("aria-label",`${n?.label||i} 제거`),l.appendChild(createDbIcon("close",12)),l.addEventListener("click",t=>{t.stopPropagation();const s=e.filter(t=>t!==i);this.setSelectedValues(s),this.syncTrigger(),this.syncOptions(),this.dispatchChange(s)}),a.append(r,l),s.appendChild(a)}),this.valueEl.appendChild(s)}else{const n=document.createElement("span");n.className="designbase-wc-select__single-value";const a=t.find(t=>t.value===e[0]);n.textContent=i?a?.label||e[0]:s,i||n.classList.add("designbase-wc-select__placeholder"),this.valueEl.appendChild(n)}this.clearButton.hidden=!n,this.clearButton.setAttribute("aria-hidden",n?"false":"true"),this.classList.toggle("designbase-wc-select--has-value",i)}syncOptions(){if(!this.optionsEl)return;const t=this.getFilteredOptions(),e=this.parseSelectedValues(),s=this.getAttribute("id")||"db-select";if(this.optionsEl.replaceChildren(),0===t.length){const t=document.createElement("div");return t.className="designbase-wc-select__no-options",t.textContent=this.searchTerm?"검색 결과가 없습니다.":"옵션이 없습니다.",void this.optionsEl.appendChild(t)}t.forEach((t,i)=>{const n=e.includes(t.value),a=i===this.focusedIndex,r=document.createElement("div");if(r.className=["designbase-wc-select__option",n&&"designbase-wc-select__option--selected",a&&"designbase-wc-select__option--focused",t.disabled&&"designbase-wc-select__option--disabled"].filter(Boolean).join(" "),r.id=`${s}-option-${i}`,r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n)),r.addEventListener("click",()=>this.selectOption(t)),this.multiple){const e=document.createElement("div");e.className="designbase-wc-select__checkbox";const s=document.createElement("db-checkbox");s.setAttribute("size","s"),s.setAttribute("has-label","false"),n&&s.setAttribute("checked",""),t.disabled&&s.setAttribute("disabled",""),e.appendChild(s),r.appendChild(e)}const l=document.createElement("span");l.className="designbase-wc-select__option-label",l.textContent=t.label,r.appendChild(l),this.optionsEl.appendChild(r)}),this.focusedIndex>=0?this.trigger?.setAttribute("aria-activedescendant",`${s}-option-${this.focusedIndex}`):this.trigger?.removeAttribute("aria-activedescendant")}escape(t){return t.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]||t))}}DbSelect.formAssociated=!0,customElements.get("db-select")||customElements.define("db-select",DbSelect);const G=["s","m","l"];class DbTextarea extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleInput=t=>{t.stopPropagation(),this.field&&(this.updateCharacterCount(),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:this.field.value,nativeEvent:t},bubbles:!0,composed:!0})))},this.handleChange=t=>{if(t.stopPropagation(),!this.field)return;const e=this.field.value;this.getAttribute("value")!==e&&this.setAttribute("value",e),this.updateCharacterCount(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e,nativeEvent:t},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["label","placeholder","value","default-value","name","size","rows","max-length","show-character-count","character-count-position","disabled","readonly","required","error","error-message","helper-text","full-width","resizable"]}get value(){return this.field?.value??this.getAttribute("value")??""}set value(t){this.setAttribute("value",t),this.field&&(this.field.value=t,this.updateCharacterCount())}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}connectedCallback(){this.built||this.build(),this.syncState()}attributeChangedCallback(t){if(this.built){if("value"===t&&this.field){const t=this.getAttribute("value")||"";return this.field.value!==t&&(this.field.value=t),void this.updateCharacterCount()}this.syncState()}}focus(){this.field?.focus()}get showCharacterCount(){return this.hasAttribute("show-character-count")}get characterCountPosition(){return this.getAttribute("character-count-position")||"bottom"}build(){const t=this.getAttribute("id")||`db-textarea-${Math.random().toString(36).slice(2)}`;this.hasAttribute("id")||this.setAttribute("id",t),this.labelEl=document.createElement("label"),this.labelEl.className="designbase-wc-textarea__label",this.labelEl.htmlFor=t,this.countTop=document.createElement("div"),this.countTop.className="designbase-wc-textarea__character-count designbase-wc-textarea__character-count--top",this.countTop.hidden=!0;const e=document.createElement("div");e.className="designbase-wc-textarea__wrapper",this.field=document.createElement("textarea"),this.field.id=t,this.field.className="designbase-wc-textarea__field",this.field.addEventListener("input",this.handleInput),this.field.addEventListener("change",this.handleChange),e.appendChild(this.field),this.footerEl=document.createElement("div"),this.footerEl.className="designbase-wc-textarea__footer",this.errorEl=document.createElement("div"),this.errorEl.className="designbase-wc-textarea__error-message",this.errorEl.setAttribute("role","alert"),this.helperEl=document.createElement("div"),this.helperEl.className="designbase-wc-textarea__helper-text",this.countBottom=document.createElement("div"),this.countBottom.className="designbase-wc-textarea__character-count designbase-wc-textarea__character-count--bottom",this.countBottom.hidden=!0,this.footerEl.append(this.errorEl,this.helperEl,this.countBottom),this.append(this.labelEl,this.countTop,e,this.footerEl),this.built=!0}syncState(){if(!this.field)return;const t=G.includes(this.size)?this.size:"m",e=this.getAttribute("label")||"",s=this.getAttribute("helper-text")||"",i=this.getAttribute("error-message")||"",n=this.hasAttribute("error"),a=this.getAttribute("value")??this.getAttribute("default-value")??"";if(this.className=["designbase-wc-textarea",`designbase-wc-textarea--${t}`,n&&"designbase-wc-textarea--error",this.hasAttribute("disabled")&&"designbase-wc-textarea--disabled",this.hasAttribute("readonly")&&"designbase-wc-textarea--readonly",this.hasAttribute("full-width")&&"designbase-wc-textarea--full-width",this.hasAttribute("resizable")?"":"designbase-wc-textarea--not-resizable"].filter(Boolean).join(" "),this.labelEl){const t=this.hasAttribute("required")?'<span aria-hidden="true"> *</span>':"";this.labelEl.innerHTML=e?`${this.escape(e)}${t}`:"",this.labelEl.hidden=!e}this.field.placeholder=this.getAttribute("placeholder")||"",this.field.name=this.getAttribute("name")||"",this.field.value!==a&&(this.field.value=a),this.field.rows=Number(this.getAttribute("rows")||4),this.field.disabled=this.hasAttribute("disabled"),this.field.readOnly=this.hasAttribute("readonly"),this.field.required=this.hasAttribute("required"),this.field.setAttribute("aria-invalid",String(n));const r=this.getAttribute("max-length");r?this.field.maxLength=Number(r):this.field.removeAttribute("maxLength");const l=`${this.getAttribute("id")}-helper`,o=`${this.getAttribute("id")}-error`;n&&i?(this.errorEl.id=o,this.errorEl.textContent=i,this.errorEl.hidden=!1,this.helperEl.hidden=!0,this.field.setAttribute("aria-describedby",o)):s?(this.helperEl.id=l,this.helperEl.textContent=s,this.helperEl.hidden=!1,this.errorEl.hidden=!0,this.field.setAttribute("aria-describedby",l)):(this.helperEl.hidden=!0,this.errorEl.hidden=!0,this.field.removeAttribute("aria-describedby")),this.updateCharacterCount()}updateCharacterCount(){if(!this.field||!this.countTop||!this.countBottom)return;const t=this.field.value.length,e=this.getAttribute("max-length"),s=Boolean(e&&t>Number(e)),i=`${t}${e?` / ${e}`:""}`,renderCount=t=>{t.innerHTML=`<span class="designbase-wc-textarea__character-count-text${s?" designbase-wc-textarea__character-count-text--error":""}">${i}</span>`};this.showCharacterCount&&"top"===this.characterCountPosition?(renderCount(this.countTop),this.countTop.hidden=!1,this.countBottom.hidden=!0):this.showCharacterCount?(renderCount(this.countBottom),this.countBottom.hidden=!1,this.countTop.hidden=!0):(this.countTop.hidden=!0,this.countBottom.hidden=!0)}escape(t){return t.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]||t))}}customElements.get("db-textarea")||customElements.define("db-textarea",DbTextarea);const Y=["s","m","l"];class DbRadio extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleChange=()=>{if(!this.input||this.disabled||this.readOnly)return;const t=this.input.checked;this.toggleAttribute("checked",t),this.syncVisual(),this.syncClasses(),this.dispatchEvent(new CustomEvent("db-change",{detail:{checked:t,selected:t,value:this.getAttribute("value")||""},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["checked","selected","default-checked","default-selected","size","disabled","readonly","required","name","value","has-label"]}get checked(){return this.input?.checked??(this.hasAttribute("checked")||this.hasAttribute("selected"))}set checked(t){this.toggleAttribute("checked",t),this.input&&(this.input.checked=t,this.syncVisual(),this.syncClasses())}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",t),this.input&&(this.input.disabled=t),this.syncClasses()}get readOnly(){return this.hasAttribute("readonly")}set readOnly(t){this.toggleAttribute("readonly",t),this.input&&(this.input.readOnly=t),this.syncClasses()}get required(){return this.hasAttribute("required")}set required(t){this.toggleAttribute("required",t),this.input&&(this.input.required=t)}get size(){return this.getAttribute("size")||"m"}set size(t){this.setAttribute("size",t)}connectedCallback(){this.style.display="contents",this.built||this.build(),this.syncState()}attributeChangedCallback(t){if(this.built)return"checked"===t||"selected"===t?(this.input&&(this.input.checked=this.hasAttribute("checked")||this.hasAttribute("selected")),this.syncVisual(),void this.syncClasses()):void this.syncState()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}build(){for(this.root=document.createElement("label"),this.root.className="designbase-wc-radio",this.input=document.createElement("input"),this.input.type="radio",this.input.className="designbase-wc-radio__input",this.visual=document.createElement("span"),this.visual.className="designbase-wc-radio__visual",this.visual.setAttribute("aria-hidden","true"),this.dot=document.createElement("span"),this.dot.className="designbase-wc-radio__dot",this.visual.appendChild(this.dot),this.labelEl=document.createElement("span"),this.labelEl.className="designbase-wc-radio__label";this.firstChild;)this.labelEl.appendChild(this.firstChild);this.root.append(this.input,this.visual,this.labelEl),this.appendChild(this.root),this.input.addEventListener("change",this.handleChange),this.built=!0}syncState(){if(!this.root||!this.input||!this.visual)return;const t=this.hasAttribute("checked")||this.hasAttribute("selected")||!this.hasAttribute("checked")&&!this.hasAttribute("selected")&&(this.hasAttribute("default-checked")||this.hasAttribute("default-selected"));this.input.checked=t,this.input.disabled=this.disabled,this.input.readOnly=this.readOnly,this.input.required=this.required,this.input.name=this.getAttribute("name")||"",this.input.value=this.getAttribute("value")||"",this.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncVisual(),this.syncClasses()}syncVisual(){}syncClasses(){if(!this.root||!this.input)return;const t=Y.includes(this.size)?this.size:"m",e=this.hasLabel&&Boolean(this.labelEl?.textContent?.trim());this.root.className=["designbase-wc-radio",`designbase-wc-radio--${t}`,this.input.checked&&"designbase-wc-radio--selected",this.disabled&&"designbase-wc-radio--disabled",this.readOnly&&"designbase-wc-radio--readonly",!e&&"designbase-wc-radio--no-label"].filter(Boolean).join(" ")}}customElements.get("db-radio")||customElements.define("db-radio",DbRadio);class DbPagination extends HTMLElement{static get observedAttributes(){return["current-page","total-pages","total-items","page-size","page-size-options","size","variant","alignment","show-first-last","show-previous-next","show-page-size-selector","show-total","sibling-count","boundary-count","disabled","full-width"]}get currentPage(){return Number(this.getAttribute("current-page")||1)}set currentPage(t){this.setAttribute("current-page",String(t))}get totalPages(){return Number(this.getAttribute("total-pages")||1)}set totalPages(t){this.setAttribute("total-pages",String(t))}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}iconSize(){const t=this.getAttribute("size")||"m";return"s"===t?12:"l"===t?16:14}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("alignment")||"center",i=this.hasAttribute("disabled"),n=this.hasAttribute("show-first-last"),a="false"!==this.getAttribute("show-previous-next"),r=this.hasAttribute("show-page-size-selector"),l=this.hasAttribute("show-total"),o=this.hasAttribute("full-width")||r||l,d=Number(this.getAttribute("total-items")||0),u=Number(this.getAttribute("page-size")||10),b=this.currentPage,p=this.totalPages,m=b<=1,g=b>=p;this.className=["designbase-wc-pagination",`designbase-wc-pagination--${t}`,`designbase-wc-pagination--${e}`,`designbase-wc-pagination--${s}`,i&&"designbase-wc-pagination--disabled",o&&"designbase-wc-pagination--full-width"].filter(Boolean).join(" "),this.setAttribute("role","navigation"),this.setAttribute("aria-label","페이지 네비게이션"),this.replaceChildren();const v=document.createElement("div");if(v.className=["designbase-wc-pagination__container",o&&"designbase-wc-pagination__container--full-width"].filter(Boolean).join(" "),l&&d>0){const t=document.createElement("div");t.className="designbase-wc-pagination__total",t.textContent=this.getTotalLabel(d,u,b),v.append(t)}const E=document.createElement("nav");E.className="designbase-wc-pagination__nav",E.setAttribute("aria-label","페이지 네비게이션");const f=document.createElement("ul");f.className="designbase-wc-pagination__list",n&&!m&&f.append(this.createIconButton("arrow-bar-left",1,"첫 페이지로 이동","first")),a&&!m&&f.append(this.createIconButton("chevron-left",b-1,"이전 페이지로 이동","previous")),this.getPageNumbers().forEach((t,e)=>{if("..."===t){const t=document.createElement("li");t.className="designbase-wc-pagination__ellipsis";const e=document.createElement("span");return e.className="designbase-wc-pagination__ellipsis-text",e.textContent="...",t.append(e),void f.append(t)}"number"==typeof t&&f.append(this.createPageButton(t,i))}),a&&!g&&f.append(this.createIconButton("chevron-right",b+1,"다음 페이지로 이동","next")),n&&!g&&f.append(this.createIconButton("arrow-bar-right",p,"마지막 페이지로 이동","last")),E.append(f),v.append(E),r&&v.append(this.createPageSizeSelector(t,u,i)),this.append(v)}getPageSizeOptions(){const t=this.getAttribute("page-size-options");if(!t)return[10,20,50,100];try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(t=>Number(t)).filter(t=>!Number.isNaN(t))}catch{}return[10,20,50,100]}getTotalLabel(t,e,s){return`${(s-1)*e+1}-${Math.min(s*e,t)} / ${t}개`}createPageSizeSelector(t,e,s){const i=document.createElement("div");i.className="designbase-wc-pagination__page-size";const n=document.createElement("label");n.className="designbase-wc-pagination__page-size-label";const a=document.createElement("span");a.className="designbase-wc-pagination__page-size-text",a.textContent="페이지당";const r=document.createElement("db-select");return r.className="designbase-wc-pagination__page-size-select",r.setAttribute("size",t),r.setAttribute("show-clear-button","false"),r.setAttribute("searchable","false"),r.setAttribute("options",JSON.stringify(this.getPageSizeOptions().map(t=>({value:String(t),label:String(t)})))),r.setAttribute("value",String(e)),s&&r.setAttribute("disabled",""),r.addEventListener("db-change",t=>{const s=t.detail,i=Number(s?.value);Number.isNaN(i)||i===e||(this.setAttribute("page-size",String(i)),this.dispatchEvent(new CustomEvent("db-page-size-change",{detail:{pageSize:i},bubbles:!0,composed:!0})))}),n.append(a,r),i.append(n),i}getPageNumbers(){const t=Number(this.getAttribute("sibling-count")||1),e=Number(this.getAttribute("boundary-count")||1),s=this.totalPages,i=this.currentPage;if(s<=2*t+3+2)return Array.from({length:s},(t,e)=>e+1);const n=Math.max(i-t,e),a=Math.min(i+t,s-e+1),r=n>e+2,l=a<s-e-1;if(!r&&l){const e=3+2*t;return[...Array.from({length:e},(t,e)=>e+1),"...",s]}if(r&&!l){const e=3+2*t;return[1,"...",...Array.from({length:e},(t,i)=>s-e+i+1)]}if(r&&l){return[1,"...",...Array.from({length:a-n+1},(t,e)=>n+e),"...",s]}return Array.from({length:s},(t,e)=>e+1)}createPageButton(t,e){const s=t===this.currentPage,i=document.createElement("li");i.className="designbase-wc-pagination__item";const n=document.createElement("button");return n.type="button",n.className=["designbase-wc-pagination__button",s&&"designbase-wc-pagination__button--active"].filter(Boolean).join(" "),n.textContent=String(t),n.disabled=e,s&&n.setAttribute("aria-current","page"),n.setAttribute("aria-label",`페이지 ${t}로 이동`),n.addEventListener("click",()=>this.select(t)),i.append(n),i}createIconButton(t,e,s,i){const n=document.createElement("li");n.className="designbase-wc-pagination__item";const a=document.createElement("button");return a.type="button",a.className=`designbase-wc-pagination__button designbase-wc-pagination__button--${i}`,a.disabled=this.hasAttribute("disabled"),a.setAttribute("aria-label",s),a.append(createDbIcon(t,this.iconSize())),a.addEventListener("click",()=>this.select(e)),n.append(a),n}select(t){this.hasAttribute("disabled")||t===this.currentPage||t<1||t>this.totalPages||(this.currentPage=t,this.dispatchEvent(new CustomEvent("db-change",{detail:{page:t},bubbles:!0,composed:!0})))}}customElements.get("db-pagination")||customElements.define("db-pagination",DbPagination);class DbBreadcrumbs extends HTMLElement{static get observedAttributes(){return["items","size","variant","breadcrumb-style","max-items"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}visibleItems(){const t=this.items,e=Number(this.getAttribute("max-items")||0);if(!e||t.length<=e)return t;const s=t[0],i=t[t.length-1],n=t.slice(1,-1),a=e-2;if(a<=0)return[s,i];const r=Math.floor(n.length/2)-Math.floor(a/2);return[s,...n.slice(r,r+a),i]}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("breadcrumb-style")||this.getAttribute("variant")||"default",s=this.visibleItems(),i=s.length<this.items.length;this.className=["designbase-wc-breadcrumbs",`designbase-wc-breadcrumbs--${t}`,`designbase-wc-breadcrumbs--${e}`,i&&"designbase-wc-breadcrumbs--collapsed"].filter(Boolean).join(" "),this.setAttribute("role","navigation"),this.setAttribute("aria-label","브레드크럼 네비게이션"),this.replaceChildren();const n=document.createElement("ol");n.className="designbase-wc-breadcrumbs__list",s.forEach((t,e)=>{const i=e===s.length-1,a=document.createElement("li");a.className="designbase-wc-breadcrumbs__item";const r=!t.href||i||t.disabled?document.createElement("span"):document.createElement("a");if(r.className=r instanceof HTMLAnchorElement?["designbase-wc-breadcrumbs__link",t.active&&"designbase-wc-breadcrumbs__link--active",t.disabled&&"designbase-wc-breadcrumbs__link--disabled"].filter(Boolean).join(" "):["designbase-wc-breadcrumbs__text",i&&"designbase-wc-breadcrumbs__text--active",t.disabled&&"designbase-wc-breadcrumbs__text--disabled"].filter(Boolean).join(" "),t.icon){const e=document.createElement("span");e.className="designbase-wc-breadcrumbs__icon",e.append(createDbIcon(t.icon,16)),r.append(e)}const l=document.createElement("span");if(l.className="designbase-wc-breadcrumbs__label",l.textContent=t.label,r.append(l),r instanceof HTMLAnchorElement&&(r.href=t.href||"#"),r.addEventListener("click",e=>{(t.disabled||t.active||i)&&e.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{detail:{item:t},bubbles:!0,composed:!0}))}),a.append(r),!i){const t=document.createElement("span");t.className="designbase-wc-breadcrumbs__separator",t.setAttribute("aria-hidden","true"),t.append(createDbIcon("chevron-right",16)),a.append(t)}n.append(a)}),this.append(n)}}customElements.get("db-breadcrumbs")||customElements.define("db-breadcrumbs",DbBreadcrumbs);const X=["s","m","l"],Z=["default","striped","hoverable"];class DbTable extends HTMLElement{constructor(){super(...arguments),this.internalSelectedRows=[],this.internalSortDirection=null,this.internalPage=1}static get observedAttributes(){return["columns","data","title","size","variant","empty-message","sortable","sort-column","sort-direction","selectable","multi-select","selected-rows","row-key","loading","pagination","page","page-size","total-items","show-count-badge","clickable"]}get columns(){try{return JSON.parse(this.getAttribute("columns")||"[]")}catch{return[]}}set columns(t){this.setAttribute("columns","string"==typeof t?t:JSON.stringify(t))}get data(){try{return JSON.parse(this.getAttribute("data")||"[]")}catch{return[]}}set data(t){this.setAttribute("data","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.render()}attributeChangedCallback(t){"selected-rows"===t&&this.syncSelectedRowsFromAttribute(),"sort-column"!==t&&"sort-direction"!==t||this.syncSortFromAttributes(),"page"===t&&(this.internalPage=Number(this.getAttribute("page")||1)),this.render()}syncSelectedRowsFromAttribute(){try{this.internalSelectedRows=JSON.parse(this.getAttribute("selected-rows")||"[]")}catch{this.internalSelectedRows=[]}}syncSortFromAttributes(){const t=this.getAttribute("sort-column"),e=this.getAttribute("sort-direction");this.internalSortColumn=t||void 0,this.internalSortDirection="asc"===e||"desc"===e?e:null}getRowKey(t,e){const s=t[this.getAttribute("row-key")||"id"];return String(null!=s?s:e)}getSortedData(){const t=this.data,e=this.getAttribute("sort-column")||this.internalSortColumn,s=this.getAttribute("sort-direction")||this.internalSortDirection;if(!e||!s)return t;const i=this.columns.find(t=>t.key===e);return i?.sortable?[...t].sort((t,i)=>{const n=t[e],a=i[e];return n===a?0:null==n?1:null==a?-1:n<a?"asc"===s?-1:1:"asc"===s?1:-1}):t}handleSort(t){if(!this.hasAttribute("sortable")||!t.sortable)return;let e="asc";this.internalSortColumn===t.key&&("asc"===this.internalSortDirection?e="desc":"desc"===this.internalSortDirection&&(e=null)),this.internalSortColumn=e?t.key:void 0,this.internalSortDirection=e,this.dispatchEvent(new CustomEvent("db-sort-change",{bubbles:!0,composed:!0,detail:{column:t.key,direction:e}})),this.render()}handleRowSelect(t,e,s){s?.stopPropagation();let i;i=this.hasAttribute("multi-select")?e?[...this.internalSelectedRows,t]:this.internalSelectedRows.filter(e=>e!==t):e?[t]:[],this.internalSelectedRows=i,this.dispatchEvent(new CustomEvent("db-selection-change",{bubbles:!0,composed:!0,detail:{selectedRows:i}})),this.render()}handleSelectAll(t){const e=t?this.data.map((t,e)=>this.getRowKey(t,e)):[];this.internalSelectedRows=e,this.dispatchEvent(new CustomEvent("db-selection-change",{bubbles:!0,composed:!0,detail:{selectedRows:e}})),this.render()}getPaginatedData(){const t=this.getSortedData();if(!this.hasAttribute("pagination"))return t;const e=Number(this.getAttribute("page-size")||10),s=Number(this.getAttribute("total-items")||t.length),i=Math.max(1,Math.ceil(s/e)),n=(Math.min(this.internalPage,i)-1)*e;return t.slice(n,n+e)}createSortIcon(t){const e=document.createElement("span");e.className="designbase-wc-table__sort-icon";if(!(this.internalSortColumn===t.key&&Boolean(this.internalSortDirection))){e.classList.add("designbase-wc-table__sort-icon--idle");const t=document.createElement("span");return t.className="designbase-wc-table__sort-icon-stack",t.append(createDbIcon("chevron-up",10),createDbIcon("chevron-down",10)),e.append(t),e}return e.classList.add("asc"===this.internalSortDirection?"designbase-wc-table__sort-icon--asc":"designbase-wc-table__sort-icon--desc"),e.append(createDbIcon("asc"===this.internalSortDirection?"chevron-up":"chevron-down",14)),e}createCheckbox(t){const e=document.createElement("db-checkbox");return e.setAttribute("size","s"),e.setAttribute("has-label","false"),t.checked&&e.setAttribute("checked",""),t.indeterminate&&e.setAttribute("indeterminate",""),t.stopPropagation&&e.addEventListener("click",t=>t.stopPropagation()),e.addEventListener("db-change",e=>{const s=e.detail;t.onChange?.(s.checked)}),e}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=X.includes(t)?t:"m",i=Z.includes(e)?e:"default",n=this.columns,a=this.getPaginatedData(),r=this.getSortedData(),l=this.hasAttribute("loading"),o=this.hasAttribute("selectable"),d=this.hasAttribute("sortable"),u=this.getAttribute("empty-message")||"데이터가 없습니다.";if(this.className=["designbase-wc-table",`designbase-wc-table--${s}`,`designbase-wc-table--${i}`,o&&"designbase-wc-table--selectable",d&&"designbase-wc-table--sortable",l&&"designbase-wc-table--loading"].filter(Boolean).join(" "),this.replaceChildren(),l){const t=document.createElement("div");t.className="designbase-wc-table__loading";const e=document.createElement("div");e.className="designbase-wc-table__loading-spinner";const s=document.createElement("span");return s.textContent="로딩 중...",t.append(e,s),void this.append(t)}const b=this.getAttribute("title"),p=this.hasAttribute("show-count-badge");if(b||p){const t=document.createElement("div");t.className="designbase-wc-table__header";const e=document.createElement("div");if(e.className="designbase-wc-table__header-left",b){const t=document.createElement("h3");t.className="designbase-wc-table__title",t.textContent=b,e.append(t)}if(p){const t=document.createElement("db-badge");t.setAttribute("count",String(this.data.length)),t.setAttribute("badge-style","number"),t.setAttribute("variant","primary"),t.setAttribute("size","s"),e.append(t)}t.append(e),this.append(t)}const m=document.createElement("div");m.className="designbase-wc-table__container";const g=document.createElement("table");g.className="designbase-wc-table__table";const v=document.createElement("thead");v.className="designbase-wc-table__thead";const E=document.createElement("tr");E.className="designbase-wc-table__tr";const f=a.map((t,e)=>this.getRowKey(t,e)),w=f.filter(t=>this.internalSelectedRows.includes(t)),y=this.hasAttribute("clickable");if(o){const t=document.createElement("th");t.className="designbase-wc-table__th designbase-wc-table__th--checkbox";const e=this.createCheckbox({checked:f.length>0&&w.length===f.length,indeterminate:w.length>0&&w.length<f.length,onChange:t=>this.handleSelectAll(t)});t.append(e),E.append(t)}n.forEach(t=>{const e=document.createElement("th");e.className=["designbase-wc-table__th",`designbase-wc-table__th--${t.align||"left"}`,d&&t.sortable&&"designbase-wc-table__th--sortable",this.internalSortColumn===t.key&&this.internalSortDirection&&"designbase-wc-table__th--sorted"].filter(Boolean).join(" "),t.width&&(e.style.width="number"==typeof t.width?`${t.width}px`:t.width);const s=document.createElement("div");s.className="designbase-wc-table__th-content";const i=document.createElement("span");i.className="designbase-wc-table__th-text",i.textContent=t.header,s.append(i),d&&t.sortable&&s.append(this.createSortIcon(t)),e.append(s),d&&t.sortable&&e.addEventListener("click",()=>this.handleSort(t)),E.append(e)}),v.append(E);const A=document.createElement("tbody");if(A.className="designbase-wc-table__tbody",0===r.length){const t=document.createElement("tr");t.className="designbase-wc-table__tr";const e=document.createElement("td");e.className="designbase-wc-table__td designbase-wc-table__td--empty",e.colSpan=Math.max(n.length+(o?1:0),1);const s=document.createElement("db-empty-state");s.setAttribute("title","데이터가 없습니다"),s.setAttribute("description",u),s.setAttribute("variant","no-data"),s.setAttribute("size","m"),e.append(s),t.append(e),A.append(t)}else a.forEach((t,e)=>{const s=this.getRowKey(t,e),i=this.internalSelectedRows.includes(s),a=document.createElement("tr");if(a.className=["designbase-wc-table__tr",y&&"designbase-wc-table__tr--clickable",i&&"designbase-wc-table__tr--selected"].filter(Boolean).join(" "),y&&a.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-row-click",{detail:{item:t,index:e},bubbles:!0,composed:!0}))}),o){const t=document.createElement("td");t.className="designbase-wc-table__td designbase-wc-table__td--checkbox";const e=this.createCheckbox({checked:i,stopPropagation:!0,onChange:t=>this.handleRowSelect(s,t)});t.append(e),a.append(t)}n.forEach(e=>{const s=document.createElement("td");s.className=["designbase-wc-table__td",`designbase-wc-table__td--${e.align||"left"}`].join(" "),s.textContent=String(t[e.key]??""),a.append(s)}),A.append(a)});if(g.append(v,A),m.append(g),this.append(m),this.hasAttribute("pagination")){const t=Number(this.getAttribute("page-size")||10),e=Number(this.getAttribute("total-items")||r.length),i=Math.max(1,Math.ceil(e/t)),n=document.createElement("div");n.className="designbase-wc-table__footer";const a=document.createElement("db-pagination");a.setAttribute("current-page",String(this.internalPage)),a.setAttribute("total-pages",String(i)),a.setAttribute("size",s),a.setAttribute("show-first-last",""),a.addEventListener("db-change",t=>{const e=Number(t.detail?.page||1);this.internalPage=e,this.dispatchEvent(new CustomEvent("db-page-change",{bubbles:!0,composed:!0,detail:{page:e}})),this.render()}),n.append(a),this.append(n)}}}customElements.get("db-table")||customElements.define("db-table",DbTable);const Q="designbase-wc-alert";class DbAlert extends HTMLElement{static get observedAttributes(){return["title","message","variant","size","show-icon","closable","action-label","action-variant","action-buttons"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getIconName(t){return"success"===t?"circle-checked":"warning"===t?"warning-filled":"danger"===t?"error-filled":"info-filled"}parseActionButtons(){const t=this.getAttribute("action-buttons");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}render(){const t=this.getAttribute("variant")||"default",e=this.getAttribute("size")||"m",s="false"!==this.getAttribute("show-icon"),i="false"!==this.getAttribute("closable"),n=this.getAttribute("title")?.trim()||"",a=this.getAttribute("message")?.trim()||"",r=this.getAttribute("action-label"),l=this.getAttribute("action-variant")||"tertiary",o=this.parseActionButtons(),d=Boolean(a),u=Boolean(n),b=u&&!d||!u&&d,p=o.length>0?o:r?[{label:r,variant:l}]:[];this.className=[Q,`${Q}--${t}`,`${Q}--${e}`,s&&`${Q}--with-icon`,i&&`${Q}--closable`,b&&`${Q}--text-single`,p.length>0&&`${Q}--has-actions`].filter(Boolean).join(" "),this.setAttribute("role","alert"),this.setAttribute("aria-live","polite"),this.querySelector(`.${Q}__content`)?.remove(),this.querySelector(`.${Q}__actions`)?.remove(),Array.from(this.childNodes).forEach(t=>{t.nodeType===Node.TEXT_NODE&&t.remove()});const m=document.createElement("div");if(m.className=`${Q}__content`,s){const s=document.createElement("div");s.className=`${Q}__icon`,s.append(createDbIcon(this.getIconName(t),"s"===e?16:"l"===e?24:20)),m.append(s)}const g=document.createElement("div");if(g.className=`${Q}__body`,u){const t=document.createElement("div");t.className=`${Q}__title`,t.textContent=n,g.append(t)}if(d){const t=document.createElement("div");t.className=`${Q}__message`,t.textContent=a,g.append(t)}if(m.append(g),p.length>0){const t=document.createElement("div");t.className=`${Q}__actions`;const s=document.createElement("div");s.className=`${Q}__action-buttons`,p.forEach((t,i)=>{const n=document.createElement("db-button");n.setAttribute("variant",t.variant||"tertiary"),n.setAttribute("size",t.size||e),n.textContent=t.label,t.disabled&&n.setAttribute("disabled",""),n.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-action",{bubbles:!0,composed:!0,detail:{index:i,label:t.label}}))}),s.append(n)}),t.append(s),m.append(t)}if(i){const t=document.createElement("button");t.type="button",t.className=`${Q}__close`,t.setAttribute("aria-label","알림 닫기"),t.append(createDbIcon("close",20)),t.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}),m.append(t)}this.replaceChildren(m)}}customElements.get("db-alert")||customElements.define("db-alert",DbAlert);const tt=["s","m","l"],et=["default","primary","success","warning","danger","info","neutral"];class DbChip extends HTMLElement{static get observedAttributes(){return["label","size","variant","deletable","disabled","selected","full-width","clickable","start-icon","end-icon"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}iconSize(t){return"s"===t?12:"l"===t?20:16}render(){const t=this.getAttribute("label")||this.textContent?.trim()||"",e=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"default",i=this.hasAttribute("disabled"),n=this.hasAttribute("deletable"),a=this.hasAttribute("selected"),r=this.hasAttribute("full-width"),l=this.hasAttribute("clickable"),o=this.getAttribute("start-icon"),d=this.getAttribute("end-icon"),u=tt.includes(e)?e:"m",b=et.includes(s)?s:"default",p=this.iconSize(u);if(this.className=["designbase-wc-chip",`designbase-wc-chip--${u}`,`designbase-wc-chip--${b}`,n&&"designbase-wc-chip--deletable",i&&"designbase-wc-chip--disabled",a&&"designbase-wc-chip--selected",l&&"designbase-wc-chip--clickable",r&&"designbase-wc-chip--full-width"].filter(Boolean).join(" "),this.replaceChildren(),l&&!i?(this.setAttribute("role","button"),this.tabIndex=0):(this.removeAttribute("role"),this.removeAttribute("tabindex")),o){const t=document.createElement("span");t.className="designbase-wc-chip__start-icon",t.append(createDbIcon(o,p)),this.append(t)}const m=document.createElement("span");if(m.className="designbase-wc-chip__label",m.textContent=t,this.append(m),d&&!n){const t=document.createElement("span");t.className="designbase-wc-chip__end-icon",t.append(createDbIcon(d,p)),this.append(t)}if(n){const e=document.createElement("button");e.type="button",e.className="designbase-wc-chip__delete-button",e.disabled=i,e.setAttribute("aria-label",`${t} 삭제`),e.append(createDbIcon("close",p)),e.addEventListener("click",t=>{t.stopPropagation(),i||this.dispatchEvent(new CustomEvent("db-delete",{bubbles:!0,composed:!0}))}),this.append(e)}this.onclick=()=>{!i&&l&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.onkeydown=t=>{"Enter"!==t.key&&" "!==t.key||i||!l||(t.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})))}}}customElements.get("db-chip")||customElements.define("db-chip",DbChip);const st=["text","circular","rectangular","rounded"],it=["xs","s","m","l","xl"];function getDefaultSize(t,e){if("circular"===t)switch(e){case"xs":return"16px";case"s":return"24px";case"l":return"48px";case"xl":return"64px";default:return"32px"}switch(e){case"xs":return"12px";case"s":return"16px";case"l":return"24px";case"xl":return"32px";default:return"20px"}}function toCssSize(t){return/^\d+$/.test(t)?`${t}px`:t}class DbSkeleton extends HTMLElement{static get observedAttributes(){return["variant","size","width","height","animation","lines","line-spacing","last-line-width","aria-label"]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}render(){const t=this.getAttribute("variant")||"text",e=this.getAttribute("size")||"m",s=this.getAttribute("animation")||"pulse",i=Number(this.getAttribute("lines")||1),n=this.getAttribute("width"),a=this.getAttribute("height"),r=this.getAttribute("line-spacing")||"8px",l=this.getAttribute("last-line-width")||"60%",o=st.includes(t)?t:"text",d=it.includes(e)?e:"m",u=["designbase-wc-skeleton",`designbase-wc-skeleton--${o}`,`designbase-wc-skeleton--${d}`,`designbase-wc-skeleton--${s}`,(n||a)&&"designbase-wc-skeleton--custom-size"].filter(Boolean).join(" ");this.className!==u&&(this.className=u);const b=this.getAttribute("aria-label")??`${o} 스켈레톤 로딩 중`;if(this.getAttribute("aria-label")!==b&&this.setAttribute("aria-label",b),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.replaceChildren(),this.style.width=n?toCssSize(n):"circular"===o?getDefaultSize(o,d):"100%",this.style.height=a?toCssSize(a):"circular"===o?getDefaultSize(o,d):function getTextLineHeight(t){switch(t){case"xs":return"12px";case"s":return"16px";case"l":return"24px";case"xl":return"32px";default:return"20px"}}(d),"text"===o&&i>1)for(let t=1;t<i;t+=1){const e=document.createElement("div");e.className="designbase-wc-skeleton__line",e.style.marginTop=toCssSize(r),t===i-1&&(e.style.width=toCssSize(l)),this.append(e)}}}customElements.get("db-skeleton")||customElements.define("db-skeleton",DbSkeleton);class DbLabel extends HTMLElement{static get observedAttributes(){return["label","html-for","id","size","required","disabled","error"]}connectedCallback(){this.sync()}attributeChangedCallback(){this.sync()}sync(){const t=this.getAttribute("size")||"s",e=this.hasAttribute("required"),s=this.hasAttribute("disabled"),i=this.hasAttribute("error"),n=this.getAttribute("html-for"),a=this.getAttribute("id"),r=this.getAttribute("label");this.className=["designbase-wc-label",`designbase-wc-label--${t}`,s&&"designbase-wc-label--disabled",i&&"designbase-wc-label--error"].filter(Boolean).join(" ");let l=this.querySelector(":scope > label.designbase-wc-label__text");if(null!==r&&""!==r)l||(this.replaceChildren(),l=document.createElement("label"),l.className="designbase-wc-label__text",this.append(l)),l.textContent=r;else if(!l&&this.childNodes.length>0){l=document.createElement("label"),l.className="designbase-wc-label__text";Array.from(this.childNodes).forEach(t=>l.append(t)),this.append(l)}if(l&&(n?l.htmlFor=n:l.removeAttribute("for"),a?l.id=a:l.removeAttribute("id"),l.querySelector(".designbase-wc-label__required")?.remove(),e)){const t=document.createElement("span");t.className="designbase-wc-label__required",t.textContent="*",l.append(t)}}}customElements.get("db-label")||customElements.define("db-label",DbLabel);const nt={xs:{width:96,height:20,markSize:19},s:{width:125,height:26,markSize:25},m:{width:193,height:40,markSize:38},l:{width:256,height:53,markSize:50},xl:{width:320,height:66,markSize:63}};class DbLogo extends HTMLElement{static get observedAttributes(){return["type","text","src","alt","size","variant","clickable","href","target","full-width"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}handleClick(t){(this.hasAttribute("clickable")||this.getAttribute("href"))&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})))}renderLogoContent(t){const e=this.getAttribute("type")||"designbase",s=this.getAttribute("text")||"Logo",i=this.getAttribute("src"),n=this.getAttribute("alt")||s,a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"original",{width:l,height:o,markSize:d}=function getLogoDimensions(t){return nt[t]||nt.m}(a),u=function getLogoColor(t){if("original"===t)return;const e={light:"#ffffff",dark:"#000000",default:"var(--db-text-primary)",primary:"var(--db-brand-primary)",secondary:"var(--db-text-secondary)",white:"#ffffff"};return e[t]??e.default}(r);if("designbase"===e){const e=document.createElement("div");return e.className="designbase-wc-logo__svg",e.append(function createDesignBaseLogoSvg(t,e,s,i){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("width",String(t)),n.setAttribute("height",String(e)),n.setAttribute("viewBox","0 0 386 40"),n.setAttribute("fill","none"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("aria-label","DesignBase Logo"),i&&n.setAttribute("class",i);const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.setAttribute("fill",s||"#000000"),a.innerHTML='\n<polygon points="58.4,23.6 77.3,23.6 77.3,16.2 58.4,16.2 58.4,7.7 79.4,7.7 79.4,0.4 49.5,0.4 49.5,39.6 80,39.6 80,32.3 58.4,32.3"/>\n<path d="M95.6,10.8c0-2.1,2-3.2,5-3.2s8.1,1.6,12.2,4l3.4-7.3c-4.5-2.8-9.6-4.2-14.9-4.2c-9.1,0-15.2,4.5-15.2,11.6 c0,13.9,20.9,9.6,20.9,17c0,2.4-2.2,3.8-5.8,3.8c-4.2,0-9.9-2.3-13.9-5.9l-3.5,7.2c4.9,4,11,6.2,17.3,6.2c8.7,0,15.4-4.1,15.4-11.8 C116.5,13.9,95.6,18,95.6,10.8z"/>\n<rect x="122.7" y="0.4" width="8.8" height="39.2"/>\n<path d="M158.8,7.8c4,0.1,7.8,1.7,10.8,4.4l5-6.3c-4.4-3.7-10-5.7-15.7-5.7c-12.2,0-21.4,8.5-21.4,19.9s9,20,20.9,20 c5.7-0.1,11.2-1.9,15.9-5.1V19.8h-7.6v10.3c-2.4,1.3-5,2-7.7,2.1h-0.4c-6.7-0.1-12.1-5.6-12-12.3v-0.4 C146.7,13,152.2,7.7,158.8,7.8z"/>\n<polygon points="209.1,25.6 190.1,0.4 182,0.4 182,39.6 190.5,39.6 190.5,14.5 209.5,39.6 217.5,39.6 217.5,0.4 209.1,0.4"/>\n<path d="M263.3,18.8c4-0.9,6.9-4.5,6.8-8.6c0-6-5.4-9.8-14-9.8h-24.5v6.5l6.4,1v31.8h18.7c9.1,0,14.8-4.2,14.8-10.9 C271.7,23.8,268.2,19.5,263.3,18.8z M246.9,7.6h8.7c3.4-0.1,5.4,1.5,5.4,4.2s-2,4.4-5.4,4.4h-8.7V7.6z M255.7,32.4h-8.7v-9.3h8.7 c4.1,0,6.7,1.7,6.7,4.5C262.4,30.6,259.8,32.4,255.7,32.4z"/>\n<path d="M290.5,0.4l-17,39.2h9.1l3.1-7.6h18.2l3,7.6h9.5L299.6,0.4H290.5z M288.6,24.9l6.2-15.2l6.2,15.2L288.6,24.9z"/>\n<path d="M328.9,10.8c0-2.1,2-3.2,5-3.2s8.1,1.6,12.2,4l3.4-7.3C345,1.4,339.9,0,334.6,0c-9.1,0-15.2,4.5-15.2,11.6 c0,13.9,20.9,9.6,20.9,17c0,2.4-2.2,3.8-5.8,3.8c-4.1,0-9.9-2.3-13.9-5.9l-3.5,7.2c4.9,4,11,6.2,17.3,6.2c8.7,0,15.4-4.1,15.4-11.8 C349.8,13.9,328.9,18,328.9,10.8z"/>\n<polygon points="364.4,32.3 364.4,23.6 383.3,23.6 383.3,16.2 364.4,16.2 364.4,7.7 385.4,7.7 385.4,0.4 355.5,0.4 355.5,39.6 386,39.6 386,32.3"/>\n<path d="M23.1,0.4H0v6.5l6.5,1v31.8h16.3c12.4,0,21-8.1,21-19.6S35.2,0.4,23.1,0.4z M34.7,20.1c0,7.2-4.8,12.1-11.4,12.1h-8V7.8H23 C29.8,7.8,34.8,12.8,34.7,20.1L34.7,20.1z"/>\n',n.append(a),n}(l,o,u)),void t.append(e)}if("designbase-mark"===e){const e=document.createElement("div");return e.className="designbase-wc-logo__svg",e.append(function createDesignBaseLogoMarkSvg(t,e,s){const i=.95*t,n=t,a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width",String(i)),a.setAttribute("height",String(n)),a.setAttribute("viewBox","0 0 95 100"),a.setAttribute("fill","none"),a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("aria-label","DesignBase Mark"),s&&a.setAttribute("class",s);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("fill",e||"#000000"),r.setAttribute("d","M45,0H0V8l10,2V90L0,92v8H45A50,50,0,0,0,45,0ZM43.12,90H20V10H38.33a15,15,0,0,1,0,30H30.11V50h13a20,20,0,0,1,0,40ZM71.4,80A30,30,0,0,0,55.83,42.83,24.93,24.93,0,0,0,60.27,13,40,40,0,0,1,71.4,80Z"),a.append(r),a}(d,u)),void t.append(e)}if(i){const e=document.createElement("img");return e.className="designbase-wc-logo__image",e.src=i,e.alt=n,void t.append(e)}const b=document.createElement("span");b.className="designbase-wc-logo__text",b.textContent=s,t.append(b)}render(){const t=this.getAttribute("type")||"designbase",e=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"original",i=this.hasAttribute("clickable")||Boolean(this.getAttribute("href")),n=this.hasAttribute("full-width"),a=this.getAttribute("href"),r=this.getAttribute("target")||"_self";this.className="",this.replaceChildren();const l=document.createElement("div");if(l.className=["designbase-wc-logo",`designbase-wc-logo--${e}`,s?`designbase-wc-logo--${s}`:"",i?"designbase-wc-logo--clickable":"",n?"designbase-wc-logo--full-width":"","custom"!==t?"designbase-wc-logo--svg":""].filter(Boolean).join(" "),i&&(l.addEventListener("click",t=>this.handleClick(t)),a||l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick(t))})),this.renderLogoContent(l),a){const t=document.createElement("a");return t.className="designbase-wc-logo__link",t.href=a,t.target=r,"_blank"===r&&(t.rel="noopener noreferrer"),t.append(l),void this.append(t)}this.append(l)}}customElements.get("db-logo")||customElements.define("db-logo",DbLogo);class DbEmptyState extends HTMLElement{static get observedAttributes(){return["variant","size","title","description","action-text","secondary-action-text","image","image-alt"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getIconName(t){return"no-results"===t?"search":"no-access"===t?"user":"error"===t?"cloud-close":"onboarding"===t?"bulb":"plus"}render(){const t=this.getAttribute("variant")||"no-data",e=this.getAttribute("size")||"m",s=this.getAttribute("title")||"",i=this.getAttribute("description")||"",n=this.getAttribute("action-text"),a=this.getAttribute("secondary-action-text"),r=this.getAttribute("image"),l=this.getAttribute("image-alt")||s,o="s"===e?24:"l"===e?48:32;this.className=`designbase-wc-empty-state designbase-wc-empty-state--${t} designbase-wc-empty-state--${e}`,this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.replaceChildren();const d=document.createElement("div");if(d.className="designbase-wc-empty-state__content",r){const t=document.createElement("div");t.className="designbase-wc-empty-state__image";const e=document.createElement("img");e.className="designbase-wc-empty-state__image-element",e.src=r,e.alt=l,t.append(e),d.append(t)}else{const e=document.createElement("div");e.className="designbase-wc-empty-state__icon",e.append(createDbIcon(this.getIconName(t),o)),d.append(e)}const u=document.createElement("h3");if(u.className="designbase-wc-empty-state__title",u.textContent=s,d.append(u),i){const t=document.createElement("p");t.className="designbase-wc-empty-state__description",t.textContent=i,d.append(t)}if(n||a){const s=document.createElement("div");if(s.className="designbase-wc-empty-state__actions",n){const i=document.createElement("db-button");i.setAttribute("variant","onboarding"===t?"primary":"secondary"),i.setAttribute("size",e),i.textContent=n,i.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-action",{bubbles:!0,composed:!0}))}),s.append(i)}if(a){const t=document.createElement("db-button");t.setAttribute("variant","tertiary"),t.setAttribute("size",e),t.textContent=a,t.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-secondary-action",{bubbles:!0,composed:!0}))}),s.append(t)}d.append(s)}this.append(d)}}customElements.get("db-empty-state")||customElements.define("db-empty-state",DbEmptyState);const at=["fade","slide","zoom","none"];class DbBackdrop extends HTMLElement{constructor(){super(...arguments),this.keyHandler=null,this.handlePortalClick=t=>{t.target===this.portal&&"true"!==this.getAttribute("disable-backdrop-click")&&(this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})))}}static get observedAttributes(){return["open","blur","opacity","blur-amount","animation","animation-duration","z-index","background-color","disable-backdrop-click","disable-escape-key-down"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}connectedCallback(){this.style.display="contents",this.syncOpenState()}disconnectedCallback(){this.detachListeners(),this.portal?.remove(),this.portal=void 0,document.body.style.overflow=""}attributeChangedCallback(){this.isConnected&&this.syncOpenState()}isOpen(){return this.open}syncOpenState(){this.isOpen()?this.render():(document.body.style.overflow="",this.detachListeners(),this.portal?.remove())}collectChildren(){return Array.from(this.children).filter(t=>!t.hasAttribute("data-wc-internal"))}attachListeners(){this.keyHandler||(this.keyHandler=t=>{"Escape"===t.key&&"true"!==this.getAttribute("disable-escape-key-down")&&(this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})))},document.addEventListener("keydown",this.keyHandler))}detachListeners(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}render(){if(!this.isOpen())return void this.syncOpenState();const t=this.hasAttribute("blur"),e=this.getAttribute("opacity")||"0.5",s=this.getAttribute("blur-amount")||"4",i=at.includes(this.getAttribute("animation")||"fade")&&this.getAttribute("animation")||"fade",n=this.getAttribute("animation-duration")||"300",a=this.getAttribute("z-index")||"1000",r=this.getAttribute("background-color"),l=this.collectChildren();document.body.style.overflow="hidden",this.attachListeners(),this.portal||(this.portal=document.createElement("div"),this.portal.setAttribute("data-wc-internal",""),this.portal.addEventListener("click",this.handlePortalClick)),this.portal.className=["designbase-wc-backdrop",`designbase-wc-backdrop--${i}`,"designbase-wc-backdrop--open",t?"designbase-wc-backdrop--blur":""].filter(Boolean).join(" "),this.portal.setAttribute("role","presentation"),this.portal.setAttribute("aria-hidden","false"),this.portal.style.setProperty("--backdrop-opacity",e),this.portal.style.setProperty("--backdrop-blur-amount",`${s}px`),this.portal.style.setProperty("--backdrop-animation-duration",`${n}ms`),this.portal.style.setProperty("--backdrop-z-index",a),r?this.portal.style.backgroundColor=r:this.portal.style.removeProperty("background-color"),this.portal.replaceChildren(...l),this.portal.isConnected||document.body.append(this.portal)}}customElements.get("db-backdrop")||customElements.define("db-backdrop",DbBackdrop);const rt=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],lt=["click","hover","focus","manual"];class DbPopover extends HTMLElement{constructor(){super(...arguments),this.onDocMouseDown=null,this.onDocKeyDown=null,this.onExternalTriggerClick=null,this.handleTriggerClick=t=>{"click"===this.resolvedTrigger()&&(t.preventDefault(),t.stopPropagation(),this.setOpen(!this.isOpen()))},this.handleTriggerMouseEnter=()=>{"hover"===this.resolvedTrigger()&&this.scheduleOpen()},this.handleTriggerMouseLeave=()=>{"hover"===this.resolvedTrigger()&&this.scheduleClose()},this.handleTriggerFocus=()=>{"focus"===this.resolvedTrigger()&&this.scheduleOpen()},this.handleTriggerBlur=()=>{"focus"===this.resolvedTrigger()&&this.scheduleClose()},this.handleReposition=()=>{this.isOpen()&&(this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.repositionRaf=requestAnimationFrame(()=>{this.positionPanel(),this.repositionRaf=void 0}))}}static get observedAttributes(){return["open","placement","position","title","content","size","variant","trigger","delay","hide-delay","always-show","disabled","max-width","show-arrow","close-on-outside-click","close-on-escape","trigger-id"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}connectedCallback(){this.classList.add("designbase-wc-popover-host"),this.hasAttribute("placement")||this.hasAttribute("position")||this.setAttribute("placement","top"),this.render(),this.childObserver=new MutationObserver(()=>this.render()),this.childObserver.observe(this,{childList:!0}),this.bindExternalTrigger(),this.attachGlobalListeners(),this.syncOpenFromAttributes()}disconnectedCallback(){this.childObserver?.disconnect(),this.clearTimers(),this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.unbindExternalTrigger(),this.detachGlobalListeners(),this.removePanel()}attributeChangedCallback(t){this.isConnected&&("trigger-id"===t&&(this.unbindExternalTrigger(),this.bindExternalTrigger()),"open"!==t&&"always-show"!==t&&"disabled"!==t?("content"===t&&this.bodyEl&&(this.bodyEl.textContent=this.getAttribute("content")||""),this.isOpen()&&(this.updatePanelMetadata(),requestAnimationFrame(()=>this.positionPanel()))):this.syncOpenFromAttributes())}resolvedPlacement(){const t=this.getAttribute("position")||this.getAttribute("placement")||"top";return rt.includes(t)?t:"top"}resolvedTrigger(){const t=this.getAttribute("trigger")||"click";return lt.includes(t)?t:"click"}isControlled(){return this.hasAttribute("open")}isOpen(){return!this.hasAttribute("disabled")&&(!!this.hasAttribute("always-show")||(this.isControlled()?"false"!==this.getAttribute("open"):this.panel?.classList.contains("designbase-wc-popover--visible")??!1))}setOpen(t){this.hasAttribute("disabled")||this.hasAttribute("always-show")||(this.isControlled()?t?this.setAttribute("open",""):this.removeAttribute("open"):t?this.showPanel():this.hidePanel(),this.dispatchEvent(new CustomEvent("db-open-change",{bubbles:!0,composed:!0,detail:{open:t}})),t||this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})))}syncOpenFromAttributes(){this.hasAttribute("always-show")?this.showPanel():this.isControlled()&&("false"!==this.getAttribute("open")?this.showPanel():this.hidePanel())}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=void 0,this.hideTimer=void 0}groupOf(t){return t.startsWith("top")?"top":t.startsWith("bottom")?"bottom":t.startsWith("left")?"left":"right"}collectTriggerChildren(){const isInternalNode=t=>t.hasAttribute("data-wc-internal")||t===this.triggerWrap,t=Array.from(this.children).filter(t=>!isInternalNode(t));return t.length>0?t:Array.from(this.triggerWrap?.children||[])}ensureTriggerWrap(){this.triggerWrap||(this.triggerWrap=document.createElement("span"),this.triggerWrap.className="designbase-wc-popover__trigger",this.triggerWrap.setAttribute("data-wc-internal",""),this.triggerWrap.tabIndex=0,this.triggerWrap.addEventListener("click",this.handleTriggerClick),this.triggerWrap.addEventListener("mouseenter",this.handleTriggerMouseEnter),this.triggerWrap.addEventListener("mouseleave",this.handleTriggerMouseLeave),this.triggerWrap.addEventListener("focus",this.handleTriggerFocus),this.triggerWrap.addEventListener("blur",this.handleTriggerBlur))}mountTriggerChildren(t){this.triggerWrap&&t.forEach(t=>{t.parentElement!==this.triggerWrap&&this.triggerWrap.append(t)})}collectBodyChildren(){return Array.from(this.querySelectorAll('[slot="content"]'))}bindExternalTrigger(){const t=this.getAttribute("trigger-id");t&&(this.triggerEl=document.getElementById(t),this.triggerEl&&(this.onExternalTriggerClick=()=>{"click"===this.resolvedTrigger()&&this.setOpen(!this.isOpen())},this.triggerEl.addEventListener("click",this.onExternalTriggerClick)))}unbindExternalTrigger(){this.triggerEl&&this.onExternalTriggerClick&&this.triggerEl.removeEventListener("click",this.onExternalTriggerClick),this.triggerEl=null,this.onExternalTriggerClick=null}attachGlobalListeners(){this.onDocMouseDown=t=>{if(!this.isOpen()||"false"===this.getAttribute("close-on-outside-click"))return;const e=t.target;this.panel?.contains(e)||this.triggerWrap?.contains(e)||this.triggerEl?.contains(e)||this.setOpen(!1)},this.onDocKeyDown=t=>{"Escape"===t.key&&this.isOpen()&&"false"!==this.getAttribute("close-on-escape")&&this.setOpen(!1)},document.addEventListener("mousedown",this.onDocMouseDown),document.addEventListener("keydown",this.onDocKeyDown)}detachGlobalListeners(){this.onDocMouseDown&&document.removeEventListener("mousedown",this.onDocMouseDown),this.onDocKeyDown&&document.removeEventListener("keydown",this.onDocKeyDown),this.onDocMouseDown=null,this.onDocKeyDown=null}scheduleOpen(){this.clearTimers();const t="hover"===this.resolvedTrigger()?Math.max(0,Number(this.getAttribute("delay")||0)):0;this.showTimer=setTimeout(()=>this.showPanel(),t)}scheduleClose(){this.clearTimers();const t="hover"===this.resolvedTrigger()?Math.max(0,Number(this.getAttribute("hide-delay")||80)):0;this.hideTimer=setTimeout(()=>this.setOpen(!1),t)}getTriggerRect(){const t=this.triggerEl||this.triggerWrap;return t?.getBoundingClientRect()}flipPlacementIfNeeded(t,e,s){const i=window.innerHeight,n=window.innerWidth,a=this.groupOf(t),r=e.top-s.height-8>=8,l=e.bottom+8+s.height<=i-8,o=e.left-s.width-8>=8,d=e.right+8+s.width<=n-8;return"top"===a&&!r&&l?t.replace(/^top/,"bottom"):"bottom"===a&&!l&&r?t.replace(/^bottom/,"top"):"left"===a&&!o&&d?t.replace(/^left/,"right"):"right"===a&&!d&&o?t.replace(/^right/,"left"):t}applyCoords(t,e,s){let i=0,n=0,a=0,r=0;switch(t){case"top":i=e.top-s.height-8,n=e.left+e.width/2-s.width/2,a=s.height,r=s.width/2-4;break;case"top-start":i=e.top-s.height-8,n=e.left,a=s.height,r=12;break;case"top-end":i=e.top-s.height-8,n=e.right-s.width,a=s.height,r=s.width-12;break;case"bottom":i=e.bottom+8,n=e.left+e.width/2-s.width/2,a=-4,r=s.width/2-4;break;case"bottom-start":i=e.bottom+8,n=e.left,a=-4,r=12;break;case"bottom-end":i=e.bottom+8,n=e.right-s.width,a=-4,r=s.width-12;break;case"left":i=e.top+e.height/2-s.height/2,n=e.left-s.width-8,a=s.height/2-4,r=s.width;break;case"left-start":i=e.top,n=e.left-s.width-8,a=12,r=s.width;break;case"left-end":i=e.bottom-s.height,n=e.left-s.width-8,a=s.height-12,r=s.width;break;case"right":i=e.top+e.height/2-s.height/2,n=e.right+8,a=s.height/2-4,r=-4;break;case"right-start":i=e.top,n=e.right+8,a=12,r=-4;break;case"right-end":i=e.bottom-s.height,n=e.right+8,a=s.height-12,r=-4}const l=window.innerWidth,o=window.innerHeight;return n<8&&(n=8),n+s.width>l-8&&(n=l-s.width-8),i<8&&(i=8),i+s.height>o-8&&(i=o-s.height-8),{top:i,left:n,aTop:a,aLeft:r,placement:t}}positionPanel(){if(!this.panel)return;const t=this.getTriggerRect();if(!t)return;this.panel.offsetHeight;const e=this.panel.getBoundingClientRect(),s=this.resolvedPlacement(),i=this.flipPlacementIfNeeded(s,t,e),{top:n,left:a,aTop:r,aLeft:l}=this.applyCoords(i,t,e),o=Number(this.getAttribute("max-width")||300);this.panel.style.top=`${n}px`,this.panel.style.left=`${a}px`,this.panel.style.maxWidth=`${o}px`,this.panel.dataset.placementGroup=this.groupOf(i),rt.forEach(t=>{this.panel.classList.toggle(`designbase-wc-popover--${t}`,t===i)}),this.arrowEl&&(this.arrowEl.className=`designbase-wc-popover__arrow designbase-wc-popover__arrow--${i}`,this.arrowEl.style.top=`${r}px`,this.arrowEl.style.left=`${l}px`)}revealPanel(){this.panel&&(this.panel.classList.remove("designbase-wc-popover--visible"),this.positionPanel(),this.panel.offsetHeight,this.positionPanel(),this.panel.classList.add("designbase-wc-popover--visible"))}updatePanelMetadata(){if(!this.panel)return;const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.resolvedPlacement();this.panel.className=["designbase-wc-popover",`designbase-wc-popover--${t}`,`designbase-wc-popover--${e}`,`designbase-wc-popover--${s}`,this.isOpen()?"designbase-wc-popover--visible":"",this.hasAttribute("disabled")?"designbase-wc-popover--disabled":""].filter(Boolean).join(" ")}ensurePanel(){if(this.panel)return;const t=document.createElement("div");t.className="designbase-wc-popover",t.setAttribute("data-wc-internal",""),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.style.position="fixed",t.style.zIndex="9999";const e=document.createElement("div");e.className="designbase-wc-popover__content";const s=document.createElement("div");s.className="designbase-wc-popover__header";const i=document.createElement("h3");i.className="designbase-wc-popover__title";const n=document.createElement("db-button");n.className="designbase-wc-popover__close-button",n.setAttribute("variant","ghost"),n.setAttribute("size","s"),n.setAttribute("icon-only",""),n.setAttribute("start-icon","close"),n.setAttribute("aria-label","팝오버 닫기"),n.addEventListener("db-click",t=>{t.stopPropagation(),this.setOpen(!1)}),s.append(i,n),this.bodyEl=document.createElement("div"),this.bodyEl.className="designbase-wc-popover__body",e.append(s,this.bodyEl),t.append(e),"false"!==this.getAttribute("show-arrow")&&(this.arrowEl=document.createElement("div"),this.arrowEl.className=`designbase-wc-popover__arrow designbase-wc-popover__arrow--${this.resolvedPlacement()}`,t.append(this.arrowEl)),this.panel=t,this.panel.querySelector(".designbase-wc-popover__title").textContent=this.getAttribute("title")||"",this.panel.querySelector(".designbase-wc-popover__title").hidden=!this.getAttribute("title"),document.body.append(t),t.addEventListener("mouseenter",()=>{"hover"===this.resolvedTrigger()&&this.clearTimers()}),t.addEventListener("mouseleave",()=>{"hover"===this.resolvedTrigger()&&this.scheduleClose()})}showPanel(){if(this.hasAttribute("disabled"))return;this.ensurePanel(),this.updatePanelMetadata();const t=this.collectBodyChildren();t.length>0?this.bodyEl.replaceChildren(...t.map(t=>t.cloneNode(!0))):this.bodyEl.textContent=this.getAttribute("content")||"";const e=this.panel.querySelector(".designbase-wc-popover__title");e.textContent=this.getAttribute("title")||"",e.hidden=!this.getAttribute("title"),requestAnimationFrame(()=>{this.revealPanel(),window.addEventListener("scroll",this.handleReposition,!0),window.addEventListener("resize",this.handleReposition)})}hidePanel(){this.panel?.classList.remove("designbase-wc-popover--visible"),window.removeEventListener("scroll",this.handleReposition,!0),window.removeEventListener("resize",this.handleReposition),this.hasAttribute("always-show")||this.removePanel()}removePanel(){this.panel?.remove(),this.panel=void 0,this.bodyEl=void 0,this.arrowEl=void 0}render(){this.ensureTriggerWrap();const t=this.collectTriggerChildren();this.mountTriggerChildren(t);const e=Boolean(this.getAttribute("trigger-id"));this.triggerWrap&&(t.length>0||!e?this.triggerWrap.parentElement!==this&&this.append(this.triggerWrap):this.triggerWrap.parentElement===this&&this.triggerWrap.remove()),this.hasAttribute("always-show")&&this.showPanel()}}customElements.get("db-popover")||customElements.define("db-popover",DbPopover);const ot=["left","right","top","bottom"],dt=["s","m","l","xl","full"];class DbDrawer extends HTMLElement{constructor(){super(...arguments),this.isMounted=!1,this.isActive=!1,this.previousActiveElement=null,this.keyHandler=null}static get observedAttributes(){return["open","title","position","size","show-close-button","close-on-backdrop-click","close-on-escape","animation-duration","show-overlay","overlay-closable","z-index","trap-focus","drawer-id"]}connectedCallback(){this.style.display="contents",this.render(),this.syncOpenState()}disconnectedCallback(){this.clearTimers(),this.detachEscape(),this.root?.remove(),this.root=void 0,document.body.style.overflow="",this.previousActiveElement&&this.previousActiveElement.focus()}attributeChangedCallback(t){this.isConnected&&("open"!==t?(this.render(),this.isMounted&&this.syncActiveClasses()):this.syncOpenState())}isOpenRequested(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}clearTimers(){null!=this.enterFrame&&(cancelAnimationFrame(this.enterFrame),this.enterFrame=void 0),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=void 0)}attachEscape(){this.keyHandler||(this.keyHandler=t=>{"Escape"===t.key&&"false"!==this.getAttribute("close-on-escape")&&this.close()},document.addEventListener("keydown",this.keyHandler))}detachEscape(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}close(){this.setAttribute("open","false"),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}collectChildren(){return Array.from(this.children).filter(t=>!t.hasAttribute("data-wc-internal"))}syncOpenState(){const t=this.isOpenRequested(),e=Number(this.getAttribute("animation-duration")||300);if(this.clearTimers(),t)return this.render(),this.isMounted=!0,this.isActive=!1,this.syncActiveClasses(),this.root&&!this.root.isConnected&&document.body.append(this.root),"false"!==this.getAttribute("trap-focus")&&(this.previousActiveElement=document.activeElement),this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=void 0,this.isActive=!0,this.syncActiveClasses(),"false"!==this.getAttribute("trap-focus")&&this.container?.focus()})}),document.body.style.overflow="hidden",void this.attachEscape();this.isActive=!1,this.syncActiveClasses(),this.exitTimer=setTimeout(()=>{this.exitTimer=void 0,this.isMounted=!1,this.syncActiveClasses(),this.root?.remove(),document.body.style.overflow="",this.detachEscape(),"false"!==this.getAttribute("trap-focus")&&this.previousActiveElement&&(this.previousActiveElement.focus(),this.previousActiveElement=null)},e),this.detachEscape()}syncActiveClasses(){this.root&&(this.root.classList.toggle("designbase-wc-drawer--open",this.isActive),this.root.classList.toggle("designbase-wc-drawer--closing",this.isMounted&&!this.isActive),this.overlay?.classList.toggle("designbase-wc-drawer__overlay--open",this.isActive),this.container?.classList.toggle("designbase-wc-drawer__container--open",this.isActive))}render(){const t=ot.includes(this.getAttribute("position")||"right")&&this.getAttribute("position")||"right",e=dt.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",s=this.getAttribute("title"),i="false"!==this.getAttribute("show-close-button"),n="false"!==this.getAttribute("show-overlay"),a=this.getAttribute("animation-duration")||"300",r=this.getAttribute("z-index")||"1000",l=this.getAttribute("drawer-id")||"drawer",o=this.collectChildren();this.root||(this.root=document.createElement("div"),this.root.setAttribute("data-wc-internal",""),this.overlay=document.createElement("div"),this.overlay.className="designbase-wc-drawer__overlay",this.overlay.setAttribute("aria-hidden","true"),this.overlay.addEventListener("click",t=>{if(t.target!==this.overlay)return;const e="false"!==this.getAttribute("overlay-closable"),s="false"!==this.getAttribute("close-on-backdrop-click");e&&s&&this.close()}),this.container=document.createElement("div"),this.container.className=`designbase-wc-drawer__container designbase-wc-drawer__container--${t}`,this.container.setAttribute("role","dialog"),this.container.setAttribute("aria-modal","true"),this.container.tabIndex=-1,this.container.addEventListener("click",t=>t.stopPropagation()),this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-drawer__content",this.container.append(this.contentEl)),this.root.className=["designbase-wc-drawer",`designbase-wc-drawer--${t}`,`designbase-wc-drawer--${e}`].join(" "),this.root.style.setProperty("--drawer-animation-duration",`${a}ms`),this.root.style.setProperty("--drawer-z-index",r),this.container.className=`designbase-wc-drawer__container designbase-wc-drawer__container--${t}`,this.container.id=l,s?this.container.setAttribute("aria-labelledby",`${l}-title`):this.container.removeAttribute("aria-labelledby"),this.contentEl.id=`${l}-content`,this.root.replaceChildren(),n&&this.overlay&&this.root.append(this.overlay);if(Boolean(s)||i){const t=document.createElement("div");if(t.className="designbase-wc-drawer__header",s){const e=document.createElement("h2");e.className="designbase-wc-drawer__title",e.id=`${l}-title`,e.textContent=s,t.append(e)}if(i){const e=document.createElement("db-button");e.className="designbase-wc-drawer__close-button",e.setAttribute("variant","ghost"),e.setAttribute("size","s"),e.setAttribute("icon-only",""),e.setAttribute("start-icon","close"),e.setAttribute("aria-label","닫기"),e.addEventListener("db-click",t=>{t.stopPropagation(),this.close()}),t.append(e)}this.container.replaceChildren(t,this.contentEl)}else this.container.replaceChildren(this.contentEl);this.contentEl.replaceChildren(...o),this.root.append(this.container),this.isMounted&&!this.root.isConnected&&document.body.append(this.root)}}customElements.get("db-drawer")||customElements.define("db-drawer",DbDrawer);class DbToast extends HTMLElement{constructor(){super(...arguments),this.timeoutId=null,this.progressInterval=null,this.closeTimerId=null,this.closed=!1}static get observedAttributes(){return["toast-id","status","title","description","duration","show-close","show-progress","auto-remove"]}connectedCallback(){this.closed=!1,this.render(),this.startTimers(),requestAnimationFrame(()=>this.classList.add("designbase-wc-toast--visible"))}disconnectedCallback(){this.clearTimers(),this.closeTimerId&&clearTimeout(this.closeTimerId),this.closeTimerId=null}attributeChangedCallback(t){if(!this.isConnected||this.closed)return;const e=this.classList.contains("designbase-wc-toast--visible");this.render(),e&&requestAnimationFrame(()=>this.classList.add("designbase-wc-toast--visible")),"duration"!==t&&"show-progress"!==t||(this.clearTimers(),this.startTimers())}clearTimers(){this.timeoutId&&clearTimeout(this.timeoutId),this.progressInterval&&clearInterval(this.progressInterval),this.timeoutId=null,this.progressInterval=null}startTimers(){const t=Number(this.getAttribute("duration")??"5000");if(!Number.isFinite(t)||t<=0)return;if("false"!==this.getAttribute("show-progress")&&this.hasAttribute("show-progress")){const e=this.querySelector(".designbase-wc-toast__progress-bar");e&&(e.style.width="0%");const s=Date.now();return void(this.progressInterval=setInterval(()=>{const i=Date.now()-s,n=Math.min(100,i/t*100);e&&(e.style.width=`${n}%`),n>=100&&this.close()},16))}this.timeoutId=setTimeout(()=>this.close(),t)}close(){this.closed||(this.closed=!0,this.clearTimers(),this.classList.remove("designbase-wc-toast--visible"),this.classList.add("designbase-wc-toast--closing"),this.closeTimerId&&clearTimeout(this.closeTimerId),this.closeTimerId=setTimeout(()=>{this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0,detail:{id:this.getAttribute("toast-id")||""}}));("true"===this.getAttribute("auto-remove")||this.hasAttribute("auto-remove")&&"false"!==this.getAttribute("auto-remove"))&&this.remove()},300))}iconForStatus(t){return"success"===t?"circle-checked":"warning"===t?"warning-filled":"error"===t?"error-filled":"info-filled"}render(){const t=this.getAttribute("status")||"info",e=this.getAttribute("title")||"",s=this.getAttribute("description")||"",i="false"!==this.getAttribute("show-close"),n="false"!==this.getAttribute("show-progress")&&this.hasAttribute("show-progress");if(this.className=["designbase-wc-toast",`designbase-wc-toast--${t}`,this.closed&&"designbase-wc-toast--closing"].filter(Boolean).join(" "),this.setAttribute("role","alert"),this.setAttribute("aria-live","assertive"),this.replaceChildren(),n){const t=document.createElement("div");t.className="designbase-wc-toast__progress";const e=document.createElement("div");e.className="designbase-wc-toast__progress-bar",e.style.width="0%",t.append(e),this.append(t)}const a=document.createElement("div");a.className=`designbase-wc-toast__icon designbase-wc-toast__icon--${t}`,a.append(createDbIcon(this.iconForStatus(t),20));const r=document.createElement("div");r.className="designbase-wc-toast__content";const l=document.createElement("div");if(l.className="designbase-wc-toast__title",l.textContent=e,r.append(l),s){const t=document.createElement("div");t.className="designbase-wc-toast__description",t.textContent=s,r.append(t)}if(this.append(a,r),i){const t=document.createElement("button");t.type="button",t.className="designbase-wc-toast__close-button",t.setAttribute("aria-label","토스트 닫기"),t.append(createDbIcon("close",20)),t.addEventListener("click",()=>this.close()),this.append(t)}}}customElements.get("db-toast")||customElements.define("db-toast",DbToast);class DbConfirm extends HTMLElement{constructor(){super(...arguments),this.root=null,this.keyHandler=null}static get observedAttributes(){return["open","title","message","confirm-text","cancel-text","confirm-variant","variant","size","show-icon","initial-focus","confirm-disabled","cancel-disabled","close-on-escape","close-on-backdrop"]}connectedCallback(){this.render()}disconnectedCallback(){this.detachEscape(),document.body.style.overflow="",this.root?.remove(),this.root=null}attributeChangedCallback(){this.render()}isOpen(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}attachEscape(){this.keyHandler||(this.keyHandler=t=>{"Escape"===t.key&&"false"!==this.getAttribute("close-on-escape")&&this.dispatchCancel()},document.addEventListener("keydown",this.keyHandler))}detachEscape(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}dispatchCancel(){this.setAttribute("open","false"),this.dispatchEvent(new CustomEvent("db-cancel",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}dispatchConfirm(){this.setAttribute("open","false"),this.dispatchEvent(new CustomEvent("db-confirm",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}iconForVariant(t){return"success"===t?"award":"warning"===t?"bell-active":"danger"===t?"cloud-close":"bulb"}iconSize(t){return"s"===t?20:"l"===t?32:24}render(){if(this.root?.remove(),this.root=null,this.detachEscape(),!this.isOpen())return document.body.style.overflow="",void this.replaceChildren();document.body.style.overflow="hidden",this.attachEscape();const t=this.getAttribute("title")||"",e=this.getAttribute("message")||this.textContent?.trim()||"",s=this.getAttribute("confirm-text")||"확인",i=this.getAttribute("cancel-text")||"취소",n=this.getAttribute("confirm-variant")||"primary",a=this.getAttribute("variant")||"info",r=this.getAttribute("size")||"s",l="false"!==this.getAttribute("show-icon"),o=this.getAttribute("initial-focus")||"confirm",d="true"===this.getAttribute("confirm-disabled"),u="true"===this.getAttribute("cancel-disabled"),b=document.createElement("div");b.className="designbase-wc-confirm__overlay",b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),t&&b.setAttribute("aria-labelledby","confirm-title"),b.setAttribute("aria-describedby","confirm-content"),b.addEventListener("click",t=>{t.target===b&&"false"!==this.getAttribute("close-on-backdrop")&&this.dispatchCancel()});const p=document.createElement("div");p.className=["designbase-wc-confirm__modal",`designbase-wc-confirm__modal--${a}`,`designbase-wc-confirm__modal--${r}`,!l&&"designbase-wc-confirm__modal--no-icon"].filter(Boolean).join(" ");const m=document.createElement("div");if(m.className=["designbase-wc-confirm__header",!l&&"designbase-wc-confirm__header--no-icon"].filter(Boolean).join(" "),l){const t=document.createElement("div");t.className="designbase-wc-confirm__icon",t.append(createDbIcon(this.iconForVariant(a),this.iconSize(r))),m.append(t)}const g=document.createElement("div");if(g.className="designbase-wc-confirm__title-area",t){const e=document.createElement("h2");e.id="confirm-title",e.className="designbase-wc-confirm__title",e.textContent=t,g.append(e)}m.append(g),p.append(m);const v=document.createElement("div");v.id="confirm-content",v.className="designbase-wc-confirm__content",v.textContent=e,p.append(v);const E=document.createElement("div");E.className="designbase-wc-confirm__footer";const f=document.createElement("db-button");f.setAttribute("variant","tertiary"),f.setAttribute("full-width",""),f.textContent=i,u&&f.setAttribute("disabled",""),f.addEventListener("db-click",()=>this.dispatchCancel());const w=document.createElement("db-button");w.setAttribute("variant",n),w.setAttribute("full-width",""),w.textContent=s,d&&w.setAttribute("disabled",""),w.addEventListener("db-click",()=>this.dispatchConfirm()),E.append(f,w),p.append(E),b.append(p),document.body.append(b),this.root=b,requestAnimationFrame(()=>{("cancel"===o?f:w).focus()})}}customElements.get("db-confirm")||customElements.define("db-confirm",DbConfirm);const ct=["dots","numbers","line","dot-line","slide","combined"],ht=["s","m","l"],ut=["horizontal","vertical"];class DbIndicator extends HTMLElement{constructor(){super(...arguments),this.timerFrame=0,this.progress=0,this.pausedProgress=0,this.activeStep=0,this.isPlayingInternal=!1}static get observedAttributes(){return["total","current","default-current","indicator-type","type","size","direction","clickable","timer","timer-duration","auto-roll","playing","default-playing","playback-disabled"]}get total(){return Math.max(1,Number(this.getAttribute("total")||1))}set total(t){this.setAttribute("total",String(t))}normalizeStep(t){const e=this.total;return(t%e+e)%e}get isCurrentControlled(){return this.hasAttribute("current")}get isPlayingControlled(){return this.hasAttribute("playing")}get resolvedCurrent(){return this.isCurrentControlled?this.normalizeStep(Number(this.getAttribute("current")||0)):this.activeStep}get resolvedPlaying(){return!!this.isPlayingControlled||this.isPlayingInternal}get indicatorType(){const t=this.getAttribute("indicator-type")||this.getAttribute("type")||"dots";return ct.includes(t)?t:"dots"}get size(){const t=this.getAttribute("size")||"m";return ht.includes(t)?t:"m"}set size(t){this.setAttribute("size",t)}get direction(){const t=this.getAttribute("direction")||"horizontal";return ut.includes(t)?t:"horizontal"}set direction(t){this.setAttribute("direction",t)}get clickable(){return this.hasAttribute("clickable")}set clickable(t){this.toggleAttribute("clickable",Boolean(t))}get timer(){return this.hasAttribute("timer")}set timer(t){this.toggleAttribute("timer",Boolean(t))}connectedCallback(){this.activeStep=this.normalizeStep(Number(this.getAttribute("default-current")||0)),this.isPlayingInternal=this.hasAttribute("default-playing"),this.render(),this.startTimer()}disconnectedCallback(){cancelAnimationFrame(this.timerFrame)}attributeChangedCallback(t){if(this.isConnected){if("current"===t&&this.isCurrentControlled)return this.resetProgress(),this.render(),void this.startTimer();if("playing"===t)return this.resolvedPlaying||(this.pausedProgress=this.progress),this.syncRootClasses(),this.syncPlaybackButton(),void this.startTimer();if("default-current"===t&&!this.isCurrentControlled)return this.activeStep=this.normalizeStep(Number(this.getAttribute("default-current")||0)),this.resetProgress(),this.render(),void this.startTimer();if("default-playing"===t&&!this.isPlayingControlled)return this.isPlayingInternal=this.hasAttribute("default-playing"),this.syncRootClasses(),this.syncPlaybackButton(),void this.startTimer();if("timer"===t||"timer-duration"===t||"auto-roll"===t)return this.resetProgress(),this.render(),void this.startTimer();this.render(),this.startTimer()}}resetProgress(){this.pausedProgress=0,this.progress=0}emitChange(t){const e={current:t,index:t};this.dispatchEvent(new CustomEvent("db-change",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-current-change",{detail:e,bubbles:!0,composed:!0}))}goToStep(t){const e=this.normalizeStep(t);this.isCurrentControlled||(this.activeStep=e,this.resetProgress(),this.render(),this.startTimer()),this.emitChange(e)}startTimer(){if(cancelAnimationFrame(this.timerFrame),!this.timer||!this.resolvedPlaying||!this.isConnected)return;const t=Number(this.getAttribute("timer-duration")||3e3),e=Date.now()-this.pausedProgress*t,tick=()=>{const s=Date.now()-e,i=Math.min(s/t,1);this.progress=i,this.pausedProgress=i,this.updateTimerVisuals(),i<1?this.timerFrame=requestAnimationFrame(tick):(this.dispatchEvent(new CustomEvent("db-timer-complete",{detail:{step:this.resolvedCurrent},bubbles:!0,composed:!0})),this.resetProgress(),"false"===this.getAttribute("auto-roll")?this.render():this.goToStep(this.resolvedCurrent+1))};this.timerFrame=requestAnimationFrame(tick)}updateTimerVisuals(){this.querySelectorAll(".designbase-wc-indicator__line-fill, .designbase-wc-indicator__track-fill").forEach(t=>{t.style.transform="vertical"===this.direction?`scaleY(${this.progress})`:`scaleX(${this.progress})`});const t=this.querySelector(".designbase-wc-indicator__dot-ring-progress");if(t){const e=15.9155,s=2*Math.PI*e;t.setAttribute("stroke-dashoffset",String(s*(1-this.progress)))}}syncRootClasses(){const t=this.indicatorType;this.className=["designbase-wc-indicator",`designbase-wc-indicator--${t}`,"combined"===t&&"designbase-wc-indicator--dots",`designbase-wc-indicator--${this.size}`,`designbase-wc-indicator--${this.direction}`,this.clickable&&"designbase-wc-indicator--clickable",this.timer&&!this.resolvedPlaying&&"designbase-wc-indicator--paused"].filter(Boolean).join(" ")}syncPlaybackButton(){const t=this.querySelector(".designbase-wc-indicator__playback-button");t&&(t.disabled=this.hasAttribute("playback-disabled"),t.setAttribute("aria-label",this.resolvedPlaying?"일시정지":"재생"),t.replaceChildren(createDbIcon(this.resolvedPlaying?"pause":"play")))}renderDotRing(){const t=15.9155,e=2*Math.PI*t,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("class","designbase-wc-indicator__dot-ring"),s.setAttribute("viewBox","0 0 36 36"),s.setAttribute("aria-hidden","true");const i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("class","designbase-wc-indicator__dot-ring-bg"),i.setAttribute("cx","18"),i.setAttribute("cy","18"),i.setAttribute("r",String(t)),i.setAttribute("fill","none");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttribute("class","designbase-wc-indicator__dot-ring-progress"),n.setAttribute("cx","18"),n.setAttribute("cy","18"),n.setAttribute("r",String(t)),n.setAttribute("fill","none"),n.setAttribute("stroke-dasharray",String(e)),n.setAttribute("stroke-dashoffset",String(e*(1-this.progress))),n.setAttribute("stroke-linecap","round"),s.append(i,n),s}renderStep(t,e,s){const i=t===this.resolvedCurrent,n=this.clickable?document.createElement("button"):document.createElement("span");return n.className=e,this.clickable&&n instanceof HTMLButtonElement?(n.type="button",n.setAttribute("aria-label",`${t+1}단계`),i&&n.setAttribute("aria-current","step"),n.addEventListener("click",()=>{this.goToStep(t),this.dispatchEvent(new CustomEvent("db-step-click",{detail:{current:t,index:t},bubbles:!0,composed:!0}))})):i||n.setAttribute("aria-hidden","true"),s&&n.append(s),n}renderDots(){const t=document.createDocumentFragment(),e=this.indicatorType,s="combined"===e?"dots":e,i=this.timer,n=this.resolvedPlaying,a=this.resolvedCurrent;this.direction;const r=this.total;if("dots"!==s)return t;for(let e=0;e<r;e+=1){const s=e===a,r=i&&s&&n,l=r||i&&s&&!n&&this.progress>0,o=document.createElement("span");o.className="designbase-wc-indicator__dot-core";const d=document.createDocumentFragment();d.append(o),i&&s&&(r||this.progress>0)&&d.append(this.renderDotRing()),t.append(this.renderStep(e,["designbase-wc-indicator__dot",s&&"designbase-wc-indicator__dot--active",l&&"designbase-wc-indicator__dot--with-ring"].filter(Boolean).join(" "),d))}return t}renderPlaybackButton(){const t=document.createElement("button");return t.type="button",t.className="designbase-wc-indicator__playback-button",t.disabled=this.hasAttribute("playback-disabled"),t.setAttribute("aria-label",this.resolvedPlaying?"일시정지":"재생"),t.append(createDbIcon(this.resolvedPlaying?"pause":"play")),t.addEventListener("click",()=>{if(this.hasAttribute("playback-disabled"))return;const t=!this.resolvedPlaying;this.isPlayingControlled?t?this.setAttribute("playing",""):(this.removeAttribute("playing"),this.pausedProgress=this.progress):(this.isPlayingInternal=t,t||(this.pausedProgress=this.progress)),this.syncRootClasses(),this.syncPlaybackButton(),this.startTimer(),this.dispatchEvent(new CustomEvent("db-playing-change",{detail:{playing:t},bubbles:!0,composed:!0}))}),t}render(){const t=this.indicatorType,e="combined"===t?"dots":t,s=this.direction,i=this.resolvedCurrent,n=this.total,a=this.timer,r=this.resolvedPlaying;if(this.syncRootClasses(),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","1"),this.setAttribute("aria-valuemax",String(n)),this.setAttribute("aria-valuenow",String(i+1)),this.replaceChildren(),"numbers"===e){const t=document.createElement("span");t.className="designbase-wc-indicator__current",t.textContent=String(i+1);const e=document.createElement("span");e.className="designbase-wc-indicator__separator",e.textContent="/";const s=document.createElement("span");return s.className="designbase-wc-indicator__total",s.textContent=String(n),void this.append(t,e,s)}if("slide"===e){const t=document.createElement("div");t.className="designbase-wc-indicator__track";const e=document.createElement("div");e.className="designbase-wc-indicator__track-thumb";const l=100/n;if("vertical"===s?(e.style.height=`${l}%`,e.style.transform=`translateY(${100*i}%)`):(e.style.width=`${l}%`,e.style.transform=`translateX(${100*i}%)`),a&&r){const t=document.createElement("div");t.className="designbase-wc-indicator__track-fill",t.style.transform="vertical"===s?`scaleY(${this.progress})`:`scaleX(${this.progress})`,e.append(t)}return t.append(e),void this.append(t)}if("line"===e){const t=document.createDocumentFragment();for(let e=0;e<n;e+=1){const n=e===i,l=a&&n&&r?(()=>{const t=document.createElement("span");return t.className="designbase-wc-indicator__line-fill",t.style.transform="vertical"===s?`scaleY(${this.progress})`:`scaleX(${this.progress})`,t})():void 0;t.append(this.renderStep(e,["designbase-wc-indicator__line-segment",n&&!a&&"designbase-wc-indicator__line-segment--active",n&&a&&"designbase-wc-indicator__line-segment--current"].filter(Boolean).join(" "),l))}return void this.append(t)}if("dot-line"===e){const t=document.createDocumentFragment();for(let e=0;e<n;e+=1){const s=e===i;t.append(this.renderStep(e,["designbase-wc-indicator__dot-line-item",s&&"designbase-wc-indicator__dot-line-item--active"].filter(Boolean).join(" ")))}return void this.append(t)}if("combined"===t){const t=document.createElement("div");return t.className="designbase-wc-indicator__steps",t.append(this.renderDots()),void this.append(t,this.renderPlaybackButton())}this.append(this.renderDots())}}customElements.get("db-indicator")||customElements.define("db-indicator",DbIndicator);class DbList extends HTMLElement{constructor(){super(...arguments),this.groupName=`db-list-${Math.random().toString(36).slice(2,9)}`}static get observedAttributes(){return["items","size","variant","layout","spacing","selectable","multiple","selected-items","empty-message","show-description","show-arrow","show-badge","loading","loading-count"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}get selectedItems(){const t=this.getAttribute("selected-items")||"[]";try{const e=JSON.parse(t);return Array.isArray(e)?e.map(String):[]}catch{return[]}}set selectedItems(t){this.setAttribute("selected-items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.render()}attributeChangedCallback(t){this.isConnected&&("selected-items"!==t?this.render():this.syncSelectionState())}flag(t,e=!0){return this.hasAttribute(t)?"false"!==this.getAttribute(t):e}controlSize(){return"l"===(this.getAttribute("size")||"m")?"m":"s"}parseBadge(t){return t?"string"==typeof t?{text:t,variant:"primary",style:"text"}:{text:t.text,variant:t.variant||"primary",style:t.style||"text"}:null}isSelected(t){return t.selected||this.selectedItems.includes(t.id)}setSelection(t){const e=JSON.stringify(t);this.getAttribute("selected-items")!==e?(this.setAttribute("selected-items",e),this.syncSelectionState(),this.dispatchEvent(new CustomEvent("db-select",{detail:{selectedItems:t},bubbles:!0,composed:!0}))):this.syncSelectionState()}toggleSelection(t){const e=this.hasAttribute("multiple"),s=this.selectedItems;let i;i=e?s.includes(t)?s.filter(e=>e!==t):[...s,t]:s.includes(t)?[]:[t],this.setSelection(i)}syncSelectionState(){const t=new Set(this.selectedItems);this.querySelectorAll(":scope > .designbase-wc-list__item").forEach(e=>{const s=e.dataset.itemId;if(!s)return;const i=t.has(s);e.classList.toggle("designbase-wc-list__item--selected",i),e.setAttribute("aria-selected",String(i));const n=e.querySelector("db-checkbox, db-radio");n&&(i?n.setAttribute("checked",""):n.removeAttribute("checked"))})}createSelectControl(t,e){const s=document.createElement("div");s.className="designbase-wc-list__item-select";const i=document.createElement(e?"db-checkbox":"db-radio");return i.setAttribute("has-label","false"),i.setAttribute("size",this.controlSize()),i.setAttribute("value",t.id),e||i.setAttribute("name",this.groupName),this.isSelected(t)&&i.setAttribute("checked",""),t.disabled&&i.setAttribute("disabled",""),i.addEventListener("click",t=>t.stopPropagation()),i.addEventListener("db-change",e=>{e.stopPropagation(),t.disabled||this.toggleSelection(t.id)}),s.append(i),s}createBadge(t){const e=document.createElement("db-badge");return e.setAttribute("size","s"),e.setAttribute("variant",t.variant),e.setAttribute("badge-style",t.style),"number"===t.style?e.setAttribute("count",t.text):e.textContent=t.text,e}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"navigation",s=this.getAttribute("layout")||"vertical",i=this.getAttribute("spacing")||"s",n=this.hasAttribute("selectable"),a=this.hasAttribute("multiple"),r=this.hasAttribute("loading"),l=Number(this.getAttribute("loading-count")||3),o=this.flag("show-description",!1),d=this.flag("show-arrow",!0),u=this.flag("show-badge",!0),b=this.items,p="s"===t?16:"l"===t?24:20;if(this.className=["designbase-wc-list",`designbase-wc-list--size-${t}`,`designbase-wc-list--variant-${e}`,`designbase-wc-list--layout-${s}`,`designbase-wc-list--spacing-${i}`,n&&"designbase-wc-list--selectable",a&&"designbase-wc-list--multiple",r&&"designbase-wc-list--loading"].filter(Boolean).join(" "),this.replaceChildren(),r)for(let t=0;t<l;t+=1){const t=document.createElement("div");t.className="designbase-wc-list__item designbase-wc-list__item--loading",t.innerHTML='\n <div class="designbase-wc-list__item-skeleton">\n <div class="designbase-wc-list__item-skeleton-icon"></div>\n <div class="designbase-wc-list__item-skeleton-content">\n <div class="designbase-wc-list__item-skeleton-title"></div>\n <div class="designbase-wc-list__item-skeleton-description"></div>\n </div>\n </div>\n ',this.append(t)}else{if(0===b.length){const t=document.createElement("div");return t.className="designbase-wc-list__empty",t.textContent=this.getAttribute("empty-message")||"항목이 없습니다.",void this.append(t)}b.forEach((r,l)=>{const b=this.isSelected(r),m=o&&Boolean(r.description),g=Boolean(r.meta?.length),v=this.parseBadge(r.badge),E=Boolean(u&&v||d),f=document.createElement("div");if(f.className=["designbase-wc-list__item",`designbase-wc-list__item--size-${t}`,`designbase-wc-list__item--variant-${e}`,`designbase-wc-list__item--layout-${s}`,`designbase-wc-list__item--spacing-${i}`,b&&"designbase-wc-list__item--selected",r.disabled&&"designbase-wc-list__item--disabled",(n||!r.disabled)&&"designbase-wc-list__item--clickable",r.icon&&"designbase-wc-list__item--with-leading",(m||g)&&"designbase-wc-list__item--with-secondary",E&&"designbase-wc-list__item--with-trailing"].filter(Boolean).join(" "),f.dataset.itemId=r.id,f.tabIndex=r.disabled?-1:0,n&&f.setAttribute("aria-selected",String(b)),n&&f.append(this.createSelectControl(r,a)),r.icon){const t=document.createElement("div");t.className="designbase-wc-list__item-icon",t.append(createDbIcon(r.icon,p)),f.append(t)}else if(r.image){const t=document.createElement("div");t.className="designbase-wc-list__item-image";const e=document.createElement("img");e.src=r.image,e.alt=r.title,t.append(e),f.append(t)}const w=document.createElement("div");w.className="designbase-wc-list__item-content";const y=document.createElement("div");y.className="designbase-wc-list__item-header";const A=document.createElement("h4");if(A.className="designbase-wc-list__item-title",A.textContent=r.title,y.append(A),w.append(y),m){const t=document.createElement("p");t.className="designbase-wc-list__item-description",t.textContent=r.description||"",w.append(t)}if(g&&r.meta){const t=document.createElement("div");t.className="designbase-wc-list__item-meta",r.meta.forEach(e=>{const s=document.createElement("div");s.className="designbase-wc-list__item-meta-item";const i=document.createElement("span");i.className="designbase-wc-list__item-meta-label",i.textContent=`${e.label}:`;const n=document.createElement("span");n.className="designbase-wc-list__item-meta-value",n.textContent=e.value,s.append(i,n),t.append(s)}),w.append(t)}if(f.append(w),E){const t=document.createElement("div");if(t.className="designbase-wc-list__item-trailing",u&&v&&t.append(this.createBadge(v)),d){const e=document.createElement("div");e.className="designbase-wc-list__item-arrow",e.setAttribute("aria-hidden","true"),e.append(createDbIcon("chevron-right",16)),t.append(e)}f.append(t)}const handleActivate=()=>{r.disabled||(this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:r,index:l},bubbles:!0,composed:!0})),n&&this.toggleSelection(r.id))};f.addEventListener("click",handleActivate),f.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),handleActivate())}),this.append(f)})}}}customElements.get("db-list")||customElements.define("db-list",DbList);class DbMenuItem extends HTMLElement{static get observedAttributes(){return["label","href","icon","active","disabled","badge","badge-color","size","variant","type","menu-style","expanded","expandable","sub-items","depth"]}get subItems(){try{return JSON.parse(this.getAttribute("sub-items")||"[]")}catch{return[]}}set subItems(t){this.setAttribute("sub-items","string"==typeof t?t:JSON.stringify(t))}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t)}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}iconSize(t){return"s"===t?16:"l"===t?24:20}render(){const t=this.getAttribute("label")||"",e=this.getAttribute("href")||"",s=this.getAttribute("icon"),i=this.getAttribute("size")||"m",n=this.getAttribute("variant")||"default",a=this.getAttribute("type")||"block",r=this.getAttribute("menu-style")||"accordion",l=Number(this.getAttribute("depth")||0),o=this.hasAttribute("active"),d=this.hasAttribute("disabled"),u=this.getAttribute("badge")||"",b=this.getAttribute("badge-color")||"primary",p=this.subItems,m=p.length>0,g=this.hasAttribute("expandable")||m,v=this.expanded,E=this.iconSize(i);this.className=["designbase-wc-menu-item",`designbase-wc-menu-item--${a}`,`designbase-wc-menu-item--${i}`,`designbase-wc-menu-item--${n}`,`designbase-wc-menu-item--${r}`,`designbase-wc-menu-item--depth-${l}`,o&&"designbase-wc-menu-item--active",d&&"designbase-wc-menu-item--disabled",g&&"designbase-wc-menu-item--expandable",v&&"designbase-wc-menu-item--expanded",m&&"designbase-wc-menu-item--with-children",u&&"designbase-wc-menu-item--with-badge",s&&"designbase-wc-menu-item--with-icon"].filter(Boolean).join(" "),this.replaceChildren();const f=document.createElement("div");if(f.className=["designbase-wc-menu-item__content","designbase-wc-menu-item__content--clickable"].join(" "),s){const t=document.createElement("div");t.className=["designbase-wc-menu-item__icon",`designbase-wc-menu-item__icon--${n}`,o&&"designbase-wc-menu-item__icon--active",d&&"designbase-wc-menu-item__icon--disabled"].filter(Boolean).join(" "),t.append(createDbIcon(s,E)),f.append(t)}const w=document.createElement("span");if(w.className="designbase-wc-menu-item__label",w.textContent=t,f.append(w),u){const t=document.createElement("db-badge");t.setAttribute("size","s"),t.setAttribute("variant",b),t.setAttribute("badge-style","number"),t.setAttribute("count",u),f.append(t)}if(m){const t=document.createElement("div");t.className="designbase-wc-menu-item__expand-icon",t.append(createDbIcon(v?"chevron-up":"chevron-down",16)),f.append(t)}if(f.addEventListener("click",s=>{d||(m&&g?(s.preventDefault(),this.expanded=!this.expanded):e&&(window.location.href=e),this.dispatchEvent(new CustomEvent("db-click",{detail:{label:t,href:e,expanded:this.expanded},bubbles:!0,composed:!0})))}),this.append(f),m&&v){const t=document.createElement("div");t.className=`designbase-wc-menu-item__children designbase-wc-menu-item__children--${r}`,p.forEach(e=>{const s=document.createElement("db-menu-item");s.setAttribute("label",e.label),s.setAttribute("type","block"),s.setAttribute("menu-style",r),s.setAttribute("size",i),s.setAttribute("depth",String(l+1)),e.href&&s.setAttribute("href",e.href),e.icon&&s.setAttribute("icon",e.icon),e.active&&s.setAttribute("active",""),e.disabled&&s.setAttribute("disabled",""),void 0!==e.badge&&s.setAttribute("badge",String(e.badge)),e.badgeColor&&s.setAttribute("badge-color",e.badgeColor),e.variant&&s.setAttribute("variant",e.variant),s.addEventListener("db-click",t=>{t.stopPropagation(),e.disabled||this.dispatchEvent(new CustomEvent("db-child-click",{detail:{child:e},bubbles:!0,composed:!0}))}),t.append(s)}),this.append(t)}}}customElements.get("db-menu-item")||customElements.define("db-menu-item",DbMenuItem);const bt=["s","m","l"],pt=["vertical","horizontal"];class DbSearchBar extends HTMLElement{constructor(){super(...arguments),this.recentSearches=[],this.isFocused=!1,this.currentSuggestion=0,this.scrollParents=[]}static get observedAttributes(){return["value","default-value","placeholder","size","disabled","readonly","full-width","show-shortcut","shortcut-label","enable-recent-searches","recent-searches-key","recent-searches-layout","suggested-searches","suggestion-rolling-interval","categories","selected-category","search-results","empty-state-message"]}getResolvedSize(){const t=this.getAttribute("size")||"m";return bt.includes(t)?t:"m"}getIconPx(){return getDbComponentIconSize(this.getResolvedSize())}syncIcons(){const t=this.getIconPx();this.querySelector(".designbase-wc-search-bar__search-icon")?.replaceChildren(createDbIcon("search",t)),this.clearButton?.replaceChildren(createDbIcon("close",t))}hasInputValue(){return Boolean((this.input?.value??this.getAttribute("value")??"").trim())}get value(){return this.input?.value??this.getAttribute("value")??""}set value(t){this.setAttribute("value",t),this.input&&(this.input.value=t)}connectedCallback(){this.loadRecentSearches(),this.render(),this.bindGlobalShortcut()}disconnectedCallback(){this.clearSuggestionInterval(),this.unbindGlobalShortcut(),this.detachDropdownPortal(),this.blurTimer&&clearTimeout(this.blurTimer)}attributeChangedCallback(t){if(this.isConnected)return"value"===t&&this.input?(this.input.value=this.getAttribute("value")||"",this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),void this.syncSuggestionRolling()):"disabled"===t||"readonly"===t||"placeholder"===t||"show-shortcut"===t||"shortcut-label"===t||"selected-category"===t||"search-results"===t||"empty-state-message"===t||"suggested-searches"===t?(this.syncAttributes(),this.syncPlaceholder(),this.updateDropdown(),void this.syncSuggestionRolling()):"enable-recent-searches"===t||"recent-searches-key"===t?(this.loadRecentSearches(),void this.updateDropdown()):void("categories"!==t&&"recent-searches-layout"!==t?this.render():this.updateDropdown())}focus(){this.input?.focus()}parseJsonArray(t){try{const e=JSON.parse(this.getAttribute(t)||"[]");return Array.isArray(e)?e:[]}catch{return[]}}getRecentSearchesKey(){return this.getAttribute("recent-searches-key")||"searchbar-recent-searches"}loadRecentSearches(){if(this.hasAttribute("enable-recent-searches"))try{const t=localStorage.getItem(this.getRecentSearchesKey());this.recentSearches=t?JSON.parse(t):[],Array.isArray(this.recentSearches)||(this.recentSearches=[])}catch{this.recentSearches=[]}else this.recentSearches=[]}saveRecentSearches(){try{localStorage.setItem(this.getRecentSearchesKey(),JSON.stringify(this.recentSearches))}catch{}}clearSuggestionInterval(){this.suggestionInterval&&(clearInterval(this.suggestionInterval),this.suggestionInterval=void 0)}syncSuggestionRolling(){this.clearSuggestionInterval();const t=this.parseJsonArray("suggested-searches"),e=this.hasInputValue(),s=Number(this.getAttribute("suggestion-rolling-interval")||5e3);t.length>0&&!e&&(this.suggestionInterval=setInterval(()=>{this.currentSuggestion=(this.currentSuggestion+1)%t.length,this.syncPlaceholder(),this.updateDropdown()},s))}syncPlaceholder(){if(!this.input)return;const t=this.parseJsonArray("suggested-searches"),e=this.hasInputValue(),s=this.getAttribute("placeholder")||"검색...";t.length>0&&!e?this.input.placeholder=t[this.currentSuggestion]||s:this.input.placeholder=s}syncValueState(){const t=this.hasInputValue();this.classList.toggle("designbase-wc-search-bar--has-value",t),this.clearButton&&(this.clearButton.hidden=!t||this.hasAttribute("disabled")||this.hasAttribute("readonly")),this.shortcutBadge&&(this.shortcutBadge.hidden=!this.hasAttribute("show-shortcut")||t||this.hasAttribute("disabled")||this.hasAttribute("readonly")),this.syncIcons()}syncAttributes(){const t=this.getAttribute("size")||"m",e=this.hasAttribute("disabled"),s=this.hasAttribute("readonly"),i=this.hasAttribute("show-shortcut");this.className=["designbase-wc-search-bar",`designbase-wc-search-bar--${bt.includes(t)?t:"m"}`,e&&"designbase-wc-search-bar--disabled",s&&"designbase-wc-search-bar--readonly",this.hasAttribute("full-width")&&"designbase-wc-search-bar--full-width",Boolean(this.hasInputValue())&&"designbase-wc-search-bar--has-value"].filter(Boolean).join(" "),this.input&&(this.input.disabled=e,this.input.readOnly=s),this.shortcutBadge&&(this.shortcutBadge.hidden=!i||this.hasInputValue()||e||s,this.shortcutBadge.textContent=this.getAttribute("shortcut-label")||"⌘K"),this.syncValueState()}bindGlobalShortcut(){this.unbindGlobalShortcut(),!this.hasAttribute("show-shortcut")||this.hasAttribute("disabled")||this.hasAttribute("readonly")||(this.globalKeyHandler=t=>{const e=t.metaKey||t.ctrlKey;let s="k";const i=(this.getAttribute("shortcut-label")||"⌘K").slice(-1).toLowerCase();i&&(s=i),e&&t.key.toLowerCase()===s&&(t.preventDefault(),this.focus())},window.addEventListener("keydown",this.globalKeyHandler))}unbindGlobalShortcut(){this.globalKeyHandler&&(window.removeEventListener("keydown",this.globalKeyHandler),this.globalKeyHandler=void 0)}positionDropdown(){if(!this.dropdown||this.dropdown.hidden)return;const t=this.getBoundingClientRect(),e=this.input?.getBoundingClientRect(),s=e??t;this.dropdown.style.top=`${s.bottom+4}px`,this.dropdown.style.left=`${t.left}px`,this.dropdown.style.width=`${t.width}px`,this.dropdown.style.right="auto"}bindRepositionListeners(){if(this.repositionHandler)return;this.repositionHandler=()=>{requestAnimationFrame(()=>this.positionDropdown())},window.addEventListener("scroll",this.repositionHandler,!0),window.addEventListener("resize",this.repositionHandler),this.scrollParents=[];let t=this.parentElement;for(;t&&t!==document.body;){const e=getComputedStyle(t),s=/(auto|scroll|overlay)/.test(e.overflowY),i=/(auto|scroll|overlay)/.test(e.overflow);(s||i)&&t.scrollHeight>t.clientHeight&&(t.addEventListener("scroll",this.repositionHandler,{passive:!0}),this.scrollParents.push(t)),t=t.parentElement}}unbindRepositionListeners(){this.repositionHandler&&(window.removeEventListener("scroll",this.repositionHandler,!0),window.removeEventListener("resize",this.repositionHandler),this.scrollParents.forEach(t=>t.removeEventListener("scroll",this.repositionHandler)),this.scrollParents=[],this.repositionHandler=void 0)}attachDropdownPortal(){this.dropdown&&!this.dropdown.hidden&&(this.dropdown.classList.add("designbase-wc-search-bar__dropdown--portal"),this.dropdown.parentElement!==document.body&&document.body.append(this.dropdown),requestAnimationFrame(()=>this.positionDropdown()),this.repositionHandler||this.bindRepositionListeners())}detachDropdownPortal(){this.unbindRepositionListeners(),this.dropdown&&(this.dropdown.classList.remove("designbase-wc-search-bar__dropdown--portal"),this.dropdown.style.top="",this.dropdown.style.left="",this.dropdown.style.width="",this.dropdown.style.right="",this.dropdown.parentElement===document.body&&this.isConnected&&this.append(this.dropdown))}shouldShowDropdown(){const t=this.hasInputValue(),e=this.parseJsonArray("categories"),s=this.parseJsonArray("suggested-searches"),i=this.getAttribute("search-results"),n=this.getAttribute("empty-state-message");return this.isFocused&&(e.length>0||this.hasAttribute("enable-recent-searches")&&this.recentSearches.length>0&&!t||s.length>0&&!t||null!==i&&t||Boolean(n)&&!t&&(!this.hasAttribute("enable-recent-searches")||0===this.recentSearches.length)&&0===s.length)}formatSearchResult(t){if("string"==typeof t||"number"==typeof t)return String(t);if(t&&"object"==typeof t){const e=t;if("string"==typeof e.title)return e.title;if("string"==typeof e.label)return e.label}return String(t)}handleSearch(t){const e=(t??this.value).trim();e&&(this.dispatchEvent(new CustomEvent("db-search",{detail:{value:e},bubbles:!0,composed:!0})),this.hasAttribute("enable-recent-searches")&&(this.recentSearches=[e,...this.recentSearches.filter(t=>t!==e)].slice(0,10),this.saveRecentSearches(),this.updateDropdown()))}updateDropdown(){if(!this.dropdown)return;const t=this.shouldShowDropdown();if(this.dropdown.hidden=!t,this.classList.toggle("designbase-wc-search-bar--dropdown-open",t),!t)return this.dropdown.replaceChildren(),void this.detachDropdownPortal();this.dropdown.replaceChildren();const e=this.hasInputValue(),s=this.parseJsonArray("categories"),i=this.parseJsonArray("suggested-searches"),n=this.getAttribute("selected-category")||"",a=this.parseJsonArray("search-results"),r=this.getAttribute("empty-state-message"),l=pt.includes(this.getAttribute("recent-searches-layout")||"vertical")&&this.getAttribute("recent-searches-layout")||"vertical";if(s.length>0){const t=document.createElement("div");t.className="designbase-wc-search-bar__categories",s.forEach(e=>{const s=document.createElement("db-chip");s.setAttribute("label",e),s.setAttribute("size","s"),s.setAttribute("variant",e===n?"primary":"default"),s.setAttribute("clickable",""),s.addEventListener("mousedown",t=>{t.preventDefault(),this.setAttribute("selected-category",e),this.dispatchEvent(new CustomEvent("db-category-change",{detail:{category:e},bubbles:!0,composed:!0})),this.updateDropdown()}),t.append(s)}),this.dropdown.append(t)}if(e&&this.hasAttribute("search-results")){const t=document.createElement("div");if(t.className="designbase-wc-search-bar__results",a.length>0){const e=document.createElement("ul");e.className="designbase-wc-search-bar__results-list",a.forEach((t,s)=>{const i=document.createElement("li");i.className="designbase-wc-search-bar__result-item",i.textContent=this.formatSearchResult(t),i.addEventListener("mousedown",e=>{e.preventDefault(),this.isFocused=!1,this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-search-result-click",{detail:{result:t,index:s},bubbles:!0,composed:!0}))}),e.append(i)}),t.append(e)}else{const e=document.createElement("div");e.className="designbase-wc-search-bar__results-empty",e.textContent="검색 결과가 없습니다.",t.append(e)}return this.dropdown.append(t),void this.attachDropdownPortal()}if(this.hasAttribute("enable-recent-searches")&&!e&&this.recentSearches.length>0){const t=document.createElement("div");t.className=`designbase-wc-search-bar__recent-searches designbase-wc-search-bar__recent-searches--${l}`;const e=document.createElement("div");e.className="designbase-wc-search-bar__recent-header";const s=document.createElement("span");s.className="designbase-wc-search-bar__recent-title",s.textContent="최근 검색어";const i=document.createElement("button");i.type="button",i.className="designbase-wc-search-bar__clear-all-button",i.setAttribute("aria-label","모든 최근 검색어 삭제"),i.textContent="전체 삭제",i.addEventListener("mousedown",t=>{t.preventDefault(),this.recentSearches=[];try{localStorage.removeItem(this.getRecentSearchesKey())}catch{}this.updateDropdown()}),e.append(s,i);const n=document.createElement("div");n.className="designbase-wc-search-bar__recent-list",this.recentSearches.forEach(t=>{const e=document.createElement("div");e.className="designbase-wc-search-bar__recent-item";const s=document.createElement("button");s.type="button",s.className="designbase-wc-search-bar__recent-search-button",s.textContent=t,s.addEventListener("mousedown",e=>{if(e.preventDefault(),!this.input)return;this.input.value=t,this.setAttribute("value",t),this.syncValueState(),this.syncPlaceholder(),this.handleSearch(t);const s={value:t};this.dispatchEvent(new CustomEvent("db-input",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:s,bubbles:!0,composed:!0})),this.isFocused=!1,this.updateDropdown()});const i=document.createElement("button");i.type="button",i.className="designbase-wc-search-bar__recent-remove-button",i.setAttribute("aria-label",`${t} 삭제`),i.append(createDbIcon("close",getDbComponentIconSize("s"))),i.addEventListener("mousedown",e=>{e.preventDefault(),this.recentSearches=this.recentSearches.filter(e=>e!==t),this.saveRecentSearches(),this.updateDropdown()}),e.append(s,i),n.append(e)}),t.append(e,n),this.dropdown.append(t)}if(i.length>0&&!e){const t=document.createElement("div");t.className="designbase-wc-search-bar__suggestions";const e=document.createElement("div");e.className="designbase-wc-search-bar__suggestions-header";const s=document.createElement("span");s.className="designbase-wc-search-bar__suggestions-title",s.textContent="추천 검색어",e.append(s);const n=document.createElement("div");n.className="designbase-wc-search-bar__suggestions-list",i.forEach((t,e)=>{const s=document.createElement("button");s.type="button",s.className=["designbase-wc-search-bar__suggestion-item",e===this.currentSuggestion&&"designbase-wc-search-bar__suggestion-item--active"].filter(Boolean).join(" "),s.textContent=t,s.addEventListener("mousedown",e=>{if(e.preventDefault(),!this.input)return;this.clearSuggestionInterval(),this.input.value=t,this.setAttribute("value",t),this.syncValueState(),this.syncPlaceholder(),this.handleSearch(t);const s={value:t};this.dispatchEvent(new CustomEvent("db-input",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:s,bubbles:!0,composed:!0})),this.isFocused=!1,this.updateDropdown()}),n.append(s)}),t.append(e,n),this.dropdown.append(t)}if(r&&!e&&(!this.hasAttribute("enable-recent-searches")||0===this.recentSearches.length)&&0===i.length){const t=document.createElement("div");t.className="designbase-wc-search-bar__empty-state",t.textContent=r,this.dropdown.append(t)}this.attachDropdownPortal()}render(){const t=this.getAttribute("size")||"m",e=this.hasAttribute("disabled"),s=this.hasAttribute("readonly"),i=this.hasAttribute("full-width"),n=this.hasAttribute("show-shortcut"),a=this.getAttribute("value")??this.getAttribute("default-value")??"",r=Boolean(a.trim()),l=this.getIconPx();this.className=["designbase-wc-search-bar",`designbase-wc-search-bar--${bt.includes(t)?t:"m"}`,e&&"designbase-wc-search-bar--disabled",s&&"designbase-wc-search-bar--readonly",i&&"designbase-wc-search-bar--full-width",r&&"designbase-wc-search-bar--has-value",this.shouldShowDropdown()&&"designbase-wc-search-bar--dropdown-open"].filter(Boolean).join(" "),this.setAttribute("role","search"),this.clearSuggestionInterval(),this.detachDropdownPortal(),this.replaceChildren();const o=document.createElement("div");o.className="designbase-wc-search-bar__container";const d=document.createElement("div");d.className="designbase-wc-search-bar__search-icon",d.setAttribute("aria-hidden","true"),d.append(createDbIcon("search",l));const u=document.createElement("input");if(u.type="text",u.className="designbase-wc-search-bar__input",u.value=a,u.disabled=e,u.readOnly=s,u.setAttribute("aria-label","검색어 입력"),this.input=u,n){const i=document.createElement("db-badge");i.className="designbase-wc-search-bar__shortcut-badge",i.setAttribute("size","l"===t?"m":"s"),i.setAttribute("variant","secondary"),i.setAttribute("badge-style","text"),i.setAttribute("aria-hidden","true"),i.textContent=this.getAttribute("shortcut-label")||"⌘K",i.hidden=r||e||s,this.shortcutBadge=i,o.append(d,u,i)}else o.append(d,u);const b=document.createElement("button");b.type="button",b.className="designbase-wc-search-bar__clear-button",b.setAttribute("aria-label","검색어 지우기"),b.hidden=!r||e||s,b.append(createDbIcon("close",l)),this.clearButton=b,o.append(b);const p=document.createElement("div");p.className="designbase-wc-search-bar__dropdown",p.hidden=!0,p.addEventListener("mousedown",t=>{t.preventDefault()}),this.dropdown=p,u.addEventListener("input",()=>{this.setAttribute("value",u.value),this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),this.syncSuggestionRolling();const t={value:u.value};this.dispatchEvent(new CustomEvent("db-input",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:t,bubbles:!0,composed:!0}))}),u.addEventListener("keydown",t=>{"Enter"===t.key&&this.handleSearch()}),u.addEventListener("focus",()=>{this.isFocused=!0,this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-focus",{bubbles:!0,composed:!0}))}),u.addEventListener("blur",()=>{this.isFocused=!1,this.blurTimer&&clearTimeout(this.blurTimer),this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-blur",{bubbles:!0,composed:!0}))}),b.addEventListener("click",()=>{u.value="",this.setAttribute("value",""),this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),this.syncSuggestionRolling(),u.focus(),this.dispatchEvent(new CustomEvent("db-clear",{bubbles:!0,composed:!0}));const t={value:""};this.dispatchEvent(new CustomEvent("db-input",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:t,bubbles:!0,composed:!0}))}),this.append(o,p),this.syncIcons(),this.syncPlaceholder(),this.syncSuggestionRolling(),this.bindGlobalShortcut(),this.updateDropdown()}}customElements.get("db-search-bar")||customElements.define("db-search-bar",DbSearchBar);const mt={facebook:'<path fill="currentColor" d="M2.002 12.001c0 4.99 3.656 9.126 8.437 9.879v-6.988h-2.54v-2.891h2.54V9.798c0-2.508 1.493-3.891 3.776-3.891q1.095 0 2.24.195V8.56h-1.264c-1.24 0-1.628.772-1.628 1.563v1.875h2.771l-.443 2.891h-2.328v6.988C18.344 21.129 22 16.992 22 12.001c0-5.522-4.477-10-9.999-10-5.522.001-10 4.478-10 10"/>',x:'<path fill="currentColor" d="M17.801 3h3.066l-6.731 7.638L22 21h-6.171l-4.832-6.297L5.466 21H2.4l7.13-8.17L2 3h6.325l4.365 5.752zm-1.073 16.207h1.7L7.432 4.727H5.605z"/>',instagram:'<path fill="currentColor" fill-rule="evenodd" d="M7.376 12a4.623 4.623 0 1 0 9.246.002A4.623 4.623 0 0 0 7.376 12m1.619 0a3.003 3.003 0 1 1 6.007.001 3.003 3.003 0 0 1-6.007 0m8.889-4.793a1.078 1.078 0 1 0-2.156 0 1.078 1.078 0 0 0 2.156 0m.016-3.728a6.6 6.6 0 0 0-2.186-.42c-.963-.042-1.268-.054-3.71-.054s-2.755 0-3.71.054a6.6 6.6 0 0 0-2.184.42A4.6 4.6 0 0 0 3.477 6.11a6.6 6.6 0 0 0-.419 2.186c-.043.962-.056 1.267-.056 3.71s0 2.753.056 3.71c.015.748.156 1.486.419 2.187a4.6 4.6 0 0 0 2.634 2.632 6.6 6.6 0 0 0 2.185.45c.963.042 1.268.055 3.71.055s2.755 0 3.71-.055a6.6 6.6 0 0 0 2.186-.42 4.61 4.61 0 0 0 2.633-2.632c.263-.7.404-1.438.419-2.186.043-.962.056-1.267.056-3.71s0-2.753-.056-3.71a6.6 6.6 0 0 0-.421-2.217A4.6 4.6 0 0 0 17.9 3.479m1.104 13.852a2.99 2.99 0 0 1-1.712 1.71 5 5 0 0 1-1.67.312c-.95.044-1.218.055-3.654.055-2.438 0-2.687 0-3.655-.055a5 5 0 0 1-1.67-.311 2.99 2.99 0 0 1-1.718-1.711 5.1 5.1 0 0 1-.311-1.67c-.043-.95-.053-1.217-.053-3.653s0-2.686.053-3.655a5 5 0 0 1 .311-1.687c.305-.79.93-1.41 1.719-1.712a5 5 0 0 1 1.669-.311c.95-.043 1.218-.055 3.655-.055s2.687 0 3.654.055a5 5 0 0 1 1.67.31 3 3 0 0 1 1.712 1.713 5.1 5.1 0 0 1 .311 1.669c.043.95.054 1.218.054 3.655s0 2.698-.043 3.654h-.011v-.001a5 5 0 0 1-.311 1.688" clip-rule="evenodd"/>',linkedin:'<path fill="currentColor" fill-rule="evenodd" d="M17 21v-6.75c0-1.059-1.188-1.944-2.246-1.944-1.06 0-1.754.885-1.754 1.944V21H9V9h4v2c.662-1.071 2.356-1.763 3.525-1.763C18.997 9.237 21 11.28 21 13.75V21zM3 21V9h4v12zM7 5a2 2 0 1 1-4 0 2 2 0 0 1 4 0" clip-rule="evenodd"/>',pinterest:'<path fill="currentColor" d="M12 2C6.474 2 2 6.478 2 12.008a10 10 0 0 0 6.351 9.316c-.09-.797-.165-1.999.03-2.87.18-.782 1.172-4.974 1.172-4.974s-.3-.601-.3-1.488c0-1.397.81-2.434 1.801-2.434.856 0 1.261.646 1.261 1.413 0 .856-.54 2.149-.825 3.335-.24.992.495 1.804 1.486 1.804 1.772 0 3.138-1.879 3.138-4.583 0-2.39-1.727-4.072-4.174-4.072-2.838 0-4.52 2.133-4.52 4.342 0 .857.33 1.788.751 2.284.075.105.09.18.075.286-.075.315-.24.991-.27 1.127-.045.18-.15.225-.33.135-1.247-.586-2.027-2.404-2.027-3.877 0-3.155 2.297-6.056 6.606-6.056 3.469 0 6.156 2.48 6.156 5.77 0 3.442-2.177 6.222-5.18 6.222-1.006 0-1.967-.526-2.297-1.142l-.616 2.374c-.225.871-.84 1.953-1.246 2.63.931.285 1.922.45 2.958.45 5.526 0 10-4.478 10-10.007C22 6.478 17.526 2 12 2"/>',whatsapp:'<path fill="currentColor" d="M12.042 2a9.92 9.92 0 0 1 7.044 2.906A9.83 9.83 0 0 1 22 11.918c-.003 5.464-4.47 9.91-9.958 9.91h-.005a10 10 0 0 1-4.758-1.206L2 22l1.413-5.136a9.86 9.86 0 0 1-1.329-4.954C2.086 6.446 6.553 2 12.042 2M8.516 7.333a.92.92 0 0 0-.663.31c-.228.249-.872.848-.872 2.066s.89 2.394 1.016 2.562c.124.165 1.722 2.746 4.251 3.739 2.101.825 2.53.661 2.985.62.457-.041 1.473-.6 1.68-1.178s.208-1.074.146-1.178-.229-.165-.478-.289-1.472-.723-1.7-.805-.394-.124-.56.124-.643.805-.788.97c-.145.166-.29.187-.539.063s-1.05-.386-2-1.23c-.74-.656-1.239-1.466-1.385-1.714s-.015-.383.11-.506c.111-.111.248-.29.373-.434.124-.144.166-.248.249-.413s.04-.31-.022-.434c-.062-.123-.545-1.348-.766-1.838-.187-.413-.383-.422-.56-.43z"/>',telegram:'<path fill="currentColor" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m4.08 6.012c-.375.008-.958.209-3.73 1.366-.975.408-2.915 1.248-5.829 2.514-.466.191-.716.375-.74.558-.042.35.457.458 1.081.657.517.167 1.2.358 1.558.367.325.008.682-.125 1.082-.4 2.72-1.838 4.118-2.77 4.213-2.789.066-.017.15-.033.208.017s.059.15.05.175c-.05.208-2.604 2.537-2.755 2.689-.566.583-1.208.94-.217 1.59.858.566 1.349.924 2.231 1.499.558.366 1 .799 1.583.749.266-.025.54-.275.682-1.024.333-1.765.982-5.603 1.132-7.185.017-.133 0-.308-.017-.392a.44.44 0 0 0-.141-.274c-.125-.1-.308-.117-.39-.117"/>',mail:'<path fill="currentColor" fill-rule="evenodd" d="m1.665 8.67.67-1.34L12 12.161l9.665-4.833.67 1.342L12 13.839z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h16c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25zM1.25 7A2.75 2.75 0 0 1 4 4.25h16A2.75 2.75 0 0 1 22.75 7v10A2.75 2.75 0 0 1 20 19.75H4A2.75 2.75 0 0 1 1.25 17z" clip-rule="evenodd"/>',link:'<path fill="currentColor" fill-rule="evenodd" d="m15.344 9.698-5.657 5.657-1.06-1.06 5.657-5.657z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M17.819 6.163a4.25 4.25 0 0 0-6.01 0l-1.415 1.414-1.06-1.06 1.414-1.414a5.75 5.75 0 0 1 8.132 8.132l-1.416 1.414-1.06-1.062 1.415-1.413a4.25 4.25 0 0 0 0-6.01M6.154 11.818l1.412-1.412-.53-.531-.53-.53-1.414 1.414-.003.003c-2.22 2.244-2.211 5.86.029 8.075 2.245 2.22 5.824 2.31 8.102.056l.003-.003 1.414-1.414-1.06-1.06-1.412 1.41v.002c-1.67 1.65-4.308 1.608-5.993-.057-1.645-1.627-1.659-4.293-.018-5.953" clip-rule="evenodd"/>',copy:'<path fill="currentColor" fill-rule="evenodd" d="M8 3.75a.25.25 0 0 0-.25.25v12c0 .138.112.25.25.25h12a.25.25 0 0 0 .25-.25V4a.25.25 0 0 0-.25-.25zM6.25 4c0-.966.784-1.75 1.75-1.75h12c.966 0 1.75.784 1.75 1.75v12A1.75 1.75 0 0 1 20 17.75H8A1.75 1.75 0 0 1 6.25 16z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M3.75 9v9A2.25 2.25 0 0 0 6 20.25h9v1.5H6A3.75 3.75 0 0 1 2.25 18V9z" clip-rule="evenodd"/>',"scan-qrcode":'<path fill="currentColor" d="M2.25 4c0-.964.786-1.75 1.75-1.75h3v1.5H4a.253.253 0 0 0-.25.25v3h-1.5zM20.25 4a.253.253 0 0 0-.25-.25h-3v-1.5h3c.964 0 1.75.786 1.75 1.75v3h-1.5zM20.25 20v-3h1.5v3c0 .964-.786 1.75-1.75 1.75h-3v-1.5h3c.136 0 .25-.114.25-.25M2.25 20v-3h1.5v3c0 .136.114.25.25.25h3v1.5H4c-.964 0-1.75-.786-1.75-1.75M9.5 7.5v2h-2v-2zM11 6H6v5h5zM16.5 7.5v2h-2v-2zM18 6h-5v5h5zM9.5 14.5v2h-2v-2zM11 13H6v5h5zM14.5 16.5H13V18h1.5zM18 15h-1.5v3H18z"/><path fill="currentColor" d="M18 15h-3v1.5h3zM14.5 13H13v1.5h1.5z"/>',"share-alt":'<path fill="currentColor" fill-rule="evenodd" d="M13.69 3.317a.75.75 0 0 1 .804.119l8 7a.75.75 0 0 1 0 1.128l-8 7A.75.75 0 0 1 13.25 18v-3.24c-1.925.051-3.579.315-5.062.932-1.659.692-3.157 1.85-4.588 3.758A.75.75 0 0 1 2.25 19c0-4.145 1.147-6.888 3.291-8.698 1.96-1.655 4.655-2.437 7.709-2.943V4a.75.75 0 0 1 .44-.683m1.06 2.336V8a.75.75 0 0 1-.638.742c-3.283.497-5.85 1.225-7.603 2.706-1.359 1.147-2.303 2.812-2.631 5.39 1.153-1.15 2.386-1.969 3.734-2.53 1.928-.804 4.04-1.058 6.388-1.058a.75.75 0 0 1 .75.75v2.347L20.861 11z" clip-rule="evenodd"/>'},gt={facebook:"facebook",x:"x",instagram:"instagram",linkedin:"linkedin",pinterest:"pinterest",whatsapp:"whatsapp",telegram:"telegram",email:"mail",link:"link",qr:"scan-qrcode"};function createShareIcon(t,e=24){const s=document.createElement("template");return s.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" width="${e}" height="${e}" aria-hidden="true" focusable="false" data-designbase-icon="${t}">${mt[t]}</svg>`,s.content.firstElementChild}const vt=["facebook","x","linkedin","whatsapp","email","link"],Et={facebook:{name:"Facebook",color:"#1877f2",shareUrl:"https://www.facebook.com/sharer/sharer.php?u={url}"},x:{name:"X",color:"#000000",shareUrl:"https://twitter.com/intent/tweet?url={url}&text={title}&hashtags={hashtags}"},instagram:{name:"Instagram",color:"#e4405f",shareUrl:"https://www.instagram.com/",customShare:()=>{window.alert("Instagram에 직접 공유하려면 링크를 복사하여 사용하세요.")}},linkedin:{name:"LinkedIn",color:"#0077b5",shareUrl:"https://www.linkedin.com/sharing/share-offsite/?url={url}"},pinterest:{name:"Pinterest",color:"#bd081c",shareUrl:"https://pinterest.com/pin/create/button/?url={url}&description={title}&media={imageUrl}"},whatsapp:{name:"WhatsApp",color:"#25d366",shareUrl:"https://wa.me/?text={title}%20{url}"},telegram:{name:"Telegram",color:"#0088cc",shareUrl:"https://t.me/share/url?url={url}&text={title}"},email:{name:"이메일",color:"#ea4335",shareUrl:"mailto:?subject={title}&body={description}%20{url}"},link:{name:"링크 복사",color:"#6c757d",shareUrl:""},qr:{name:"QR 코드",color:"#6c757d",shareUrl:""}};class DbShare extends HTMLElement{constructor(){super(...arguments),this.isCopied=!1,this.qrCodeData="",this.copyResetTimer=null,this.modalEl=null,this.contentSlot=null,this.dropdownEl=null}static get observedAttributes(){return["url","title","description","image-url","hashtags","variant","size","position","platforms","button-text","modal-title","show-qr-code","qr-code-size","copy-success-message","open"]}connectedCallback(){this.render()}disconnectedCallback(){this.copyResetTimer&&clearTimeout(this.copyResetTimer)}attributeChangedCallback(t){"open"===t&&"modal"===this.getAttribute("variant")&&this.modalEl?this.syncModalOpen():"url"===t&&this.contentSlot?this.refreshLinkInputValue():this.render()}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open","true"):this.removeAttribute("open")}parseListAttribute(t){const e=this.getAttribute(t);if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(t=>String(t).trim()).filter(Boolean)}catch{}return e.split(",").map(t=>t.trim()).filter(Boolean)}getResolvedUrl(){const t=this.getAttribute("url");return t||("undefined"!=typeof window&&window.location?.href?window.location.href:"")}getContext(){return{url:this.getResolvedUrl(),title:this.getAttribute("share-title")||this.getAttribute("title")||"",description:this.getAttribute("description")||"",imageUrl:this.getAttribute("image-url")||"",hashtags:this.parseListAttribute("hashtags"),host:this}}getActivePlatforms(){const t=this.parseListAttribute("platforms");return(t.length>0?t:vt).filter(t=>t in Et)}replaceUrlVariables(t,e){return t.replace("{url}",encodeURIComponent(e.url)).replace("{title}",encodeURIComponent(e.title)).replace("{description}",encodeURIComponent(e.description)).replace("{imageUrl}",encodeURIComponent(e.imageUrl)).replace("{hashtags}",e.hashtags.join(","))}async handleCopyLink(t){try{await navigator.clipboard.writeText(t.url),this.isCopied=!0,this.dispatchEvent(new CustomEvent("db-copy-success",{bubbles:!0,composed:!0,detail:{url:t.url}})),this.refreshContent(),this.copyResetTimer&&clearTimeout(this.copyResetTimer),this.copyResetTimer=setTimeout(()=>{this.isCopied=!1,this.refreshContent()},3e3)}catch(t){this.dispatchEvent(new CustomEvent("db-copy-error",{bubbles:!0,composed:!0,detail:{error:t}}))}}handleShowQrCode(t){if(this.qrCodeData=t.url,"modal"===this.getAttribute("variant"))return this.open=!0,void this.refreshContent();this.refreshContent()}handlePlatformShare(t){const e=this.getContext(),s=Et[t];if(s)try{if("link"===t)this.handleCopyLink(e);else if("qr"===t)this.handleShowQrCode(e);else if(s.customShare)s.customShare(e);else if(s.shareUrl){const t=this.replaceUrlVariables(s.shareUrl,e);window.open(t,"_blank","width=600,height=400")}this.dispatchEvent(new CustomEvent("db-share",{bubbles:!0,composed:!0,detail:{platform:t,url:e.url}}))}catch(e){this.dispatchEvent(new CustomEvent("db-share-error",{bubbles:!0,composed:!0,detail:{platform:t,error:e}}))}}getPlacement(){const t=this.getAttribute("position")||"bottom";return"top"===t||"left"===t?"top-left":"right"===t?"bottom-right":"bottom-left"}mapButtonSize(){const t=this.getAttribute("size")||"m";return"s"===t?"s":"l"===t?"l":"m"}createTriggerButton(t){const e=document.createElement("db-button");return e.className=t||"designbase-wc-share__trigger",e.setAttribute("variant","secondary"),e.setAttribute("size",this.mapButtonSize()),e.textContent=this.getAttribute("button-text")||"공유",e.prepend(createShareIcon("share-alt",16)),e.addEventListener("db-click",()=>{"modal"!==this.getAttribute("variant")?this.open=!this.open:this.open=!0}),e}createPlatformIcon(t){const e=document.createElement("span");return e.className="designbase-wc-share__platform-icon",e.append(function createSharePlatformIcon(t,e=24){return createShareIcon(gt[t],e)}(t,24)),e}createPlatformButton(t){const e=Et[t],s=document.createElement("button");s.type="button",s.className=["designbase-wc-share__platform-button",`designbase-wc-share__platform-button--${t}`,"link"===t&&this.isCopied?"designbase-wc-share__platform-button--copied":""].filter(Boolean).join(" "),s.style.setProperty("--platform-color",e.color),s.title=e.name,s.setAttribute("aria-label",`${e.name}에 공유하기`),s.append(this.createPlatformIcon(t));const i=document.createElement("span");if(i.className="designbase-wc-share__platform-name",i.textContent=e.name,s.append(i),"link"===t&&this.isCopied){const t=document.createElement("span");t.className="designbase-wc-share__copy-success",t.append(createShareIcon("copy",12));const e=document.createElement("span");e.textContent="복사됨!",t.append(e),s.append(t)}return s.addEventListener("click",()=>this.handlePlatformShare(t)),s}createLinkInput(t){const e=document.createElement("db-input");return e.className="designbase-wc-share__link-input",e.setAttribute("type","text"),e.setAttribute("readonly",""),e.setAttribute("size","s"),e.setAttribute("full-width",""),e.setAttribute("value",t),customElements.whenDefined("db-input").then(()=>{e.setAttribute("value",t),e.value=t}),e}refreshLinkInputValue(){const t=this.getResolvedUrl(),e=this.contentSlot?.querySelector("db-input.designbase-wc-share__link-input");e&&(e.setAttribute("value",t),e.value=t)}createCopyButton(t){const e=document.createElement("db-button");e.className="designbase-wc-share__copy-button",e.setAttribute("size","s"),e.setAttribute("variant","primary");const s=document.createElement("span");return s.className="designbase-wc-button__start-icon",s.setAttribute("aria-hidden","true"),s.append(createShareIcon(this.isCopied?"copy":"link",16)),e.append(s),e.append(document.createTextNode(this.isCopied?"복사됨!":"복사")),e.addEventListener("db-click",()=>{this.handleCopyLink(t)}),e}generateQrCodeUrl(){const t=Number(this.getAttribute("qr-code-size")||200);return`https://api.qrserver.com/v1/create-qr-code/?size=${t}x${t}&data=${encodeURIComponent(this.qrCodeData)}`}createShareContent(){const t=document.createElement("div");return t.className="designbase-wc-share__content",this.populateShareContent(t),t}populateShareContent(t){const e=document.createElement("div");e.className="designbase-wc-share__platforms",this.getActivePlatforms().forEach(t=>{e.append(this.createPlatformButton(t))}),t.append(e);if("false"!==this.getAttribute("show-qr-code")&&this.qrCodeData){const e=document.createElement("div");e.className="designbase-wc-share__qr-section";const s=document.createElement("h4");s.className="designbase-wc-share__qr-title",s.textContent="QR 코드",e.append(s);const i=document.createElement("div");i.className="designbase-wc-share__qr-code";const n=document.createElement("img"),a=Number(this.getAttribute("qr-code-size")||200);n.src=this.generateQrCodeUrl(),n.alt="QR Code",n.width=a,n.height=a,i.append(n),e.append(i);const r=document.createElement("p");r.className="designbase-wc-share__qr-description",r.textContent="QR 코드를 스캔하여 링크에 접속하세요",e.append(r),t.append(e)}const s=this.getContext(),i=document.createElement("div");i.className="designbase-wc-share__link-preview";const n=document.createElement("h4");n.className="designbase-wc-share__link-title",n.textContent="공유 링크",i.append(n);const a=document.createElement("div");a.className="designbase-wc-share__link-container",a.append(this.createLinkInput(s.url)),a.append(this.createCopyButton(s)),i.append(a),t.append(i)}refreshContent(){const t=this.getAttribute("variant");if("inline"===t){const t=this.querySelector(":scope > .designbase-wc-share__content");return void t?.replaceWith(this.createShareContent())}"modal"===t&&this.contentSlot&&(this.contentSlot.replaceChildren(),this.populateShareContent(this.contentSlot))}syncModalOpen(){this.modalEl&&(this.open?(this.refreshLinkInputValue(),this.modalEl.setAttribute("open","true")):this.modalEl.removeAttribute("open"))}renderDropdown(){const t=document.createElement("db-dropdown");t.className="designbase-wc-share__dropdown",t.setAttribute("placement",this.getPlacement()),t.setAttribute("label",this.getAttribute("button-text")||"공유"),t.setAttribute("trigger-variant","secondary"),t.setAttribute("trigger-icon","share-alt"),t.setAttribute("size",this.mapButtonSize()),t.setAttribute("items",JSON.stringify(this.getActivePlatforms().map(t=>({id:t,label:Et[t].name})))),t.addEventListener("db-change",t=>{const e=t.detail,s=e?.id;s&&this.handlePlatformShare(s)}),this.dropdownEl=t,this.append(t)}renderModal(){const t=this.createTriggerButton();this.append(t);const e=document.createElement("db-modal");e.className="designbase-wc-share__modal",e.setAttribute("title",this.getAttribute("modal-title")||"공유하기"),e.setAttribute("size","m"),this.contentSlot=document.createElement("div"),this.contentSlot.className="designbase-wc-share designbase-wc-share__content",this.contentSlot.setAttribute("data-modal-part","body"),this.populateShareContent(this.contentSlot),e.append(this.contentSlot),e.addEventListener("db-close",()=>{this.open=!1,this.qrCodeData="",this.contentSlot&&(this.contentSlot.replaceChildren(),this.populateShareContent(this.contentSlot))}),this.modalEl=e,this.append(e),this.syncModalOpen()}render(){const t=this.getAttribute("variant")||"button";this.className=`designbase-wc-share designbase-wc-share--${t}`,this.replaceChildren(),this.modalEl=null,this.contentSlot=null,this.dropdownEl=null,"inline"!==t?"dropdown"!==t?"modal"!==t?this.append(this.createTriggerButton()):this.renderModal():this.renderDropdown():this.append(this.createShareContent())}}customElements.get("db-share")||customElements.define("db-share",DbShare);const ft=["primary","white","dark"];class DbTopBanner extends HTMLElement{static get observedAttributes(){return["badge-text","content","image","link-text","variant","fixed","dismissed"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}isDarkBg(t){return"primary"===t||"dark"===t}createLinkButton(t,e){const s=this.isDarkBg(t),i=document.createElement("db-button");i.setAttribute("variant",s?"secondary":"ghost"),i.setAttribute("size","s"),i.classList.add("designbase-wc-top-banner__link");const n=document.createElement("span");n.textContent=e;const a=document.createElement("span");return a.className="designbase-wc-button__end-icon",a.append(createDbIcon("chevron-right",16)),i.append(n,a),i.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-link",{bubbles:!0,composed:!0}))}),i}createCloseButton(){const t=document.createElement("db-button");return t.setAttribute("variant","ghost"),t.setAttribute("size","m"),t.setAttribute("icon-only",""),t.setAttribute("aria-label","닫기"),t.classList.add("designbase-wc-top-banner__close"),t.append(createDbIcon("close",20)),t.addEventListener("db-click",()=>{this.setAttribute("dismissed",""),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})),this.render()}),t}createBadge(t,e){const s=document.createElement("db-badge");return s.setAttribute("size","s"),s.setAttribute("variant",e?"secondary":"primary"),s.setAttribute("badge-style","text"),s.textContent=t,s.classList.add("designbase-wc-top-banner__badge"),s}render(){if(this.hasAttribute("dismissed"))return this.replaceChildren(),this.className="designbase-wc-top-banner designbase-wc-top-banner--dismissed",void(this.style.display="none");this.style.display="";const t=this.getAttribute("badge-text")||"",e=this.getAttribute("content")||"",s=this.getAttribute("image")||"",i=this.getAttribute("link-text")||"",n=this.getAttribute("variant")||"primary",a=ft.includes(n)?n:"primary",r=this.hasAttribute("fixed"),l=this.isDarkBg(a);if(this.className=["designbase-wc-top-banner",`designbase-wc-top-banner--${a}`,r&&"designbase-wc-top-banner--fixed",s&&"designbase-wc-top-banner--has-image"].filter(Boolean).join(" "),this.setAttribute("role","alert"),s?this.style.setProperty("--db-top-banner-bg-image",`url("${s}")`):this.style.removeProperty("--db-top-banner-bg-image"),this.replaceChildren(),s){const t=document.createElement("div");t.className="designbase-wc-top-banner__background",t.setAttribute("aria-hidden","true");const e=document.createElement("div");e.className="designbase-wc-top-banner__overlay",e.setAttribute("aria-hidden","true"),this.append(t,e)}const o=document.createElement("div");o.className="designbase-wc-top-banner__container";const d=document.createElement("div");d.className="designbase-wc-top-banner__content",t&&d.append(this.createBadge(t,l));const u=document.createElement("span");u.className="designbase-wc-top-banner__text",u.textContent=e,d.append(u),i&&d.append(this.createLinkButton(a,i)),o.append(d),o.append(this.createCloseButton()),this.append(o)}}customElements.get("db-top-banner")||customElements.define("db-top-banner",DbTopBanner);const wt=["s","m","l"],yt=["default","minimal","card","colored","iconBox"],At=["horizontal","vertical","reverse"],_t=["primary","secondary","success","warning","error","info","custom"],Ct={s:16,m:20,l:24};class DbStat extends HTMLElement{constructor(){super(...arguments),this.handleClick=()=>{!this.hasAttribute("disabled")&&this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=t=>{this.hasAttribute("clickable")&&!this.hasAttribute("disabled")&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["value","label","icon","icon-position","size","variant","layout","color","custom-color","progress","show-progress","change","show-change","description","show-description","clickable","disabled","animated"]}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.render()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(){this.render()}parseChange(){const t=this.getAttribute("change");if(!t)return null;try{const e=JSON.parse(t);if(e&&"number"==typeof e.value&&e.type)return e}catch{}return null}getChangeText(t){const e="increase"===t.type?"+":"-",s=t.period?` ${t.period}`:"";return`${e}${Math.abs(t.value)}%${s}`}resolveIconName(t){if(!t)return;return t in{user:1,sparkle:1,award:1,bulb:1,edit:1,search:1}?t:void 0}getProgressVariant(t){return"primary"===t?"primary":"success"===t?"success":"warning"===t?"warning":"error"===t?"danger":"default"}render(){const t=this.getAttribute("value")??"",e=this.getAttribute("label")||"",s=this.getAttribute("icon")||"",i=this.getAttribute("icon-position")||"left",n=this.getAttribute("size")||"m",a=wt.includes(n)?n:"m",r=this.getAttribute("variant")||"default",l=yt.includes(r)?r:"default",o=this.getAttribute("layout")||"horizontal",d=At.includes(o)?o:"horizontal",u=this.getAttribute("color")||"primary",b=_t.includes(u)?u:"primary",p=this.getAttribute("custom-color")||"",m=this.getAttribute("progress"),g=null!==m?Number(m):NaN,v=this.hasAttribute("show-progress"),E=this.parseChange(),f=this.hasAttribute("show-change"),w=this.getAttribute("description")||"",y=this.hasAttribute("show-description"),A=this.hasAttribute("clickable"),_=this.hasAttribute("disabled"),C=this.hasAttribute("animated");this.className=["designbase-wc-stat",`designbase-wc-stat--size-${a}`,`designbase-wc-stat--variant-${l}`,`designbase-wc-stat--layout-${d}`,`designbase-wc-stat--color-${b}`,A&&"designbase-wc-stat--clickable",_&&"designbase-wc-stat--disabled",C&&"designbase-wc-stat--animated",v&&"designbase-wc-stat--with-progress",f&&E&&"designbase-wc-stat--with-change",y&&w&&"designbase-wc-stat--with-description"].filter(Boolean).join(" "),p?this.style.setProperty("--stat-color",p):this.style.removeProperty("--stat-color"),A&&!_?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.replaceChildren();const x=document.createElement("div");x.className="designbase-wc-stat__body";const k=this.resolveIconName(s);if(k){const t=document.createElement("div");t.className=`designbase-wc-stat__icon designbase-wc-stat__icon--${i}`;const e="iconBox"===l?Ct[a]:20;t.append(createDbIcon(k,e)),x.append(t)}const S=document.createElement("div");S.className="designbase-wc-stat__content";const N=document.createElement("div");N.className="designbase-wc-stat__main";const $=document.createElement("div");$.className="designbase-wc-stat__label",$.textContent=e;const I=document.createElement("div");if(I.className="designbase-wc-stat__value",I.textContent=String(t),N.append($,I),S.append(N),f&&E){const t=document.createElement("div");t.className=["designbase-wc-stat__change","increase"===E.type?"designbase-wc-stat__change--increase":"designbase-wc-stat__change--decrease"].join(" "),t.textContent=this.getChangeText(E),S.append(t)}if(y&&w){const t=document.createElement("div");t.className="designbase-wc-stat__description",t.textContent=w,S.append(t)}if(x.append(S),this.append(x),v&&!Number.isNaN(g)){const t=Math.min(Math.max(g,0),100),e=document.createElement("div");e.className="designbase-wc-stat__progress";const s=document.createElement("db-progressbar");s.setAttribute("value",String(t)),s.setAttribute("size","s"),s.setAttribute("variant",this.getProgressVariant(b)),s.setAttribute("full-width",""),e.append(s),this.append(e)}}}customElements.get("db-stat")||customElements.define("db-stat",DbStat);const xt=["1:1","16:9","4:3","3:2","3:4","2:1","auto"],kt=["cover","contain","fill","none","scale-down"],St=["lazy","eager"],Nt=["skeleton","blur","none"],$t=["s","m","l","full"],It=["s","m","l"];class DbImage extends HTMLElement{constructor(){super(...arguments),this.imageState="loading",this.currentSrc="",this.showPlaceholder=!1,this.imgEl=null,this.placeholderEl=null,this.errorEl=null,this.initialized=!1,this.handleLoad=()=>{"loaded"!==this.imageState&&(this.imageState="loaded",this.showPlaceholder=!1,this.syncVisualState(),this.dispatchEvent(new CustomEvent("db-load",{bubbles:!0,composed:!0})))},this.handleError=()=>{const t=this.getAttribute("fallback-src")||"";if(t&&this.currentSrc!==t)return this.currentSrc=t,this.imageState="loading",this.updateImageSource(),void this.syncVisualState();this.imageState="error",this.showPlaceholder=!1,this.syncVisualState(),this.dispatchEvent(new CustomEvent("db-error",{bubbles:!0,composed:!0}))},this.handleClick=()=>{this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=t=>{this.hasAttribute("clickable")&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["src","alt","ratio","fit","loading","fallback-src","placeholder","rounded","width","height","max-width","max-height","full-width","full-height","shadow","hover","clickable"]}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.resetFromAttributes(),this.ensureStructure(),this.syncVisualState()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(t,e,s){if(e!==s||"src"===t){if("src"===t){const t=s||"";if(t!==this.currentSrc){this.currentSrc=t,this.imageState="loading";const e=this.getAttribute("placeholder")||"none";this.showPlaceholder="none"!==e,this.updateImageSource()}}"placeholder"===t&&(this.showPlaceholder="none"!==(s||"none")&&"loading"===this.imageState),this.ensureStructure(),this.syncVisualState()}else this.syncVisualState()}resetFromAttributes(){this.currentSrc=this.getAttribute("src")||"";const t=this.getAttribute("placeholder")||"none";this.showPlaceholder="none"!==t,this.imageState="loading"}getRoundedClass(){const t=this.getAttribute("rounded");return t?"true"===t||""===t?"designbase-wc-image--rounded":"s"===t?"designbase-wc-image--rounded-sm":"m"===t?"designbase-wc-image--rounded-md":"l"===t?"designbase-wc-image--rounded-lg":$t.includes(t)?"full"===t?"designbase-wc-image--rounded-full":`designbase-wc-image--rounded-${t}`:"":""}getShadowClass(){const t=this.getAttribute("shadow");return t?"true"===t||""===t?"designbase-wc-image--shadow":It.includes(t)?`designbase-wc-image--shadow-${t}`:"":""}getRatioClass(){const t=this.getAttribute("ratio")||"auto";return"auto"===t?"designbase-wc-image--ratio-auto":xt.includes(t)?`designbase-wc-image--ratio-${t.replace(":","-")}`:"designbase-wc-image--ratio-auto"}applyContainerStyle(){const t=this.style,e=this.hasAttribute("full-width"),s=this.hasAttribute("full-height"),i=this.getAttribute("width"),n=this.getAttribute("height"),a=this.getAttribute("max-width"),r=this.getAttribute("max-height");t.width=e?"100%":i||"",t.height=s?"100%":n||"",t.maxWidth=a||"",t.maxHeight=r||""}ensureStructure(){if(!this.initialized){this.placeholderEl=document.createElement("div"),this.placeholderEl.className="designbase-wc-image__placeholder",this.errorEl=document.createElement("div"),this.errorEl.className="designbase-wc-image__error",this.errorEl.append(createDbIcon("gallery",20));const t=document.createElement("span");t.className="designbase-wc-image__error-text",this.errorEl.append(t),this.imgEl=document.createElement("img"),this.imgEl.className="designbase-wc-image__img",this.imgEl.draggable=!1,this.imgEl.addEventListener("load",this.handleLoad),this.imgEl.addEventListener("error",this.handleError),this.append(this.placeholderEl,this.errorEl,this.imgEl),this.initialized=!0}this.updateImageSource(),this.updatePlaceholderContent(),this.updateErrorContent()}updateImageSource(){if(!this.imgEl)return;const t=this.getAttribute("alt")||"",e=this.getAttribute("loading")||"lazy",s=St.includes(e)?e:"lazy";this.imgEl.alt=t,this.imgEl.loading=s;const i=this.currentSrc;if(!i)return void this.imgEl.removeAttribute("src");const n=new URL(i,window.location.href).href;this.imgEl.src!==n?this.imgEl.src=i:this.imgEl.complete&&this.imgEl.naturalWidth>0&&"loading"===this.imageState&&this.handleLoad()}updatePlaceholderContent(){if(!this.placeholderEl)return;const t=this.getAttribute("placeholder")||"none",e=Nt.includes(t)?t:"none";if(this.placeholderEl.className=["designbase-wc-image__placeholder",`designbase-wc-image__placeholder--${e}`].join(" "),this.placeholderEl.replaceChildren(),"skeleton"===e){const t=document.createElement("div");t.className="designbase-wc-image__skeleton",this.placeholderEl.append(t)}if("blur"===e){const t=document.createElement("div");t.className="designbase-wc-image__blur",this.placeholderEl.append(t)}}updateErrorContent(){if(!this.errorEl)return;const t=this.errorEl.querySelector(".designbase-wc-image__error-text");t&&(t.textContent=this.getAttribute("alt")||"이미지를 불러올 수 없습니다")}syncVisualState(){const t=this.getAttribute("fit")||"cover",e=kt.includes(t)?t:"cover",s=this.hasAttribute("clickable"),i=this.hasAttribute("hover");if(this.className=["designbase-wc-image",this.getRatioClass(),`designbase-wc-image--fit-${e}`,this.getRoundedClass(),this.getShadowClass(),i&&"designbase-wc-image--hover",this.hasAttribute("full-width")&&"designbase-wc-image--full-width",this.hasAttribute("full-height")&&"designbase-wc-image--full-height",s&&"designbase-wc-image--clickable","loading"===this.imageState&&"designbase-wc-image--loading","error"===this.imageState&&"designbase-wc-image--error"].filter(Boolean).join(" "),this.applyContainerStyle(),s?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.placeholderEl){const t=this.showPlaceholder&&"loading"===this.imageState;this.placeholderEl.classList.toggle("designbase-wc-image__placeholder--visible",t),this.placeholderEl.hidden=!t}if(this.errorEl){const t="error"===this.imageState;this.errorEl.hidden=!t}if(this.imgEl){const t=Boolean(this.currentSrc)&&"error"!==this.imageState;this.imgEl.hidden=!t,this.imgEl.classList.toggle("designbase-wc-image__img--loaded","loaded"===this.imageState),this.imgEl.classList.toggle("designbase-wc-image__img--error","error"===this.imageState)}}}customElements.get("db-image")||customElements.define("db-image",DbImage);class DbImagePlaceholder extends HTMLElement{constructor(){super(...arguments),this.handleClick=()=>{this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=t=>{this.hasAttribute("clickable")&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["label","show-label","pattern-size","pattern-color","background-color","width","height","aspect-ratio","hover-effect","clickable"]}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.render()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(){this.render()}render(){const t=this.getAttribute("label")||"",e=this.hasAttribute("show-label"),s=Number(this.getAttribute("pattern-size")||20),i=this.getAttribute("pattern-color")||"#f3f3f3",n=this.getAttribute("background-color")||"#e7e7e7",a=this.getAttribute("width")||"100%",r=this.getAttribute("height")||"",l=this.getAttribute("aspect-ratio")||"",o=this.hasAttribute("hover-effect"),d=this.hasAttribute("clickable");this.className=["designbase-wc-image-placeholder",o&&"designbase-wc-image-placeholder--hover",d&&"designbase-wc-image-placeholder--clickable"].filter(Boolean).join(" "),this.style.width=a,this.style.height=r,this.style.aspectRatio=l,d?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.replaceChildren();const u=document.createElement("div");if(u.className="designbase-wc-image-placeholder__pattern",u.style.setProperty("--db-placeholder-bg",n),u.style.setProperty("--db-placeholder-pattern",i),u.style.setProperty("--db-placeholder-size",`${s}px`),u.style.setProperty("--db-placeholder-half-size",s/2+"px"),this.append(u),e&&t){const e=document.createElement("div");e.className="designbase-wc-image-placeholder__label-wrap";const s=document.createElement("span");s.className="designbase-wc-image-placeholder__label",s.textContent=t,e.append(s),this.append(e)}}}customElements.get("db-image-placeholder")||customElements.define("db-image-placeholder",DbImagePlaceholder);const Dt=["grid","list","gallery","carousel"],Lt=["1","2","3","4","5","6"],Mt=["xs","s","m","l","xl"];class DbImageList extends HTMLElement{constructor(){super(...arguments),this.lightboxEl=null,this.selectedIndex=null}static get observedAttributes(){return["images","layout","columns","spacing","ratio","fit","rounded","shadow","hover","clickable","lightbox","loading","responsive"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}parseImages(){const t=this.getAttribute("images");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}mapRoundedAttr(){const t=this.getAttribute("rounded");if(t&&"false"!==t)return"true"===t||""===t?"m":t}createImageItem(t,e){const s=document.createElement("div");s.className="designbase-wc-image-list__item";const i=document.createElement("db-image");i.className="designbase-wc-image-list__image",i.setAttribute("src",t.thumbnail||t.src),i.setAttribute("alt",t.alt||t.title||`이미지 ${e+1}`),i.setAttribute("ratio",this.getAttribute("ratio")||"16:9"),i.setAttribute("fit",this.getAttribute("fit")||"cover"),i.setAttribute("loading",this.getAttribute("loading")||"lazy"),i.setAttribute("full-width","");const n=this.mapRoundedAttr();n&&i.setAttribute("rounded",n);const a=this.getAttribute("shadow");if(a&&"false"!==a&&i.setAttribute("shadow","true"===a?"":a),"false"!==this.getAttribute("hover")&&i.setAttribute("hover",""),t.thumbnail&&t.thumbnail!==t.src&&i.setAttribute("fallback-src",t.src),i.addEventListener("db-load",()=>{this.dispatchEvent(new CustomEvent("db-image-load",{bubbles:!0,composed:!0,detail:{image:t,index:e}}))}),i.addEventListener("db-error",()=>{this.dispatchEvent(new CustomEvent("db-image-error",{bubbles:!0,composed:!0,detail:{image:t,index:e}}))}),s.append(i),t.title||t.description){const e=document.createElement("div");if(e.className="designbase-wc-image-list__overlay",t.title){const s=document.createElement("h3");s.className="designbase-wc-image-list__title",s.textContent=t.title,e.append(s)}if(t.description){const s=document.createElement("p");s.className="designbase-wc-image-list__description",s.textContent=t.description,e.append(s)}s.append(e)}if(t.metadata?.date||t.metadata?.size){const e=document.createElement("div");if(e.className="designbase-wc-image-list__metadata",t.metadata.date){const s=document.createElement("span");s.className="designbase-wc-image-list__date",s.textContent=t.metadata.date,e.append(s)}if(t.metadata.size){const s=document.createElement("span");s.className="designbase-wc-image-list__size",s.textContent=t.metadata.size,e.append(s)}s.append(e)}return"false"!==this.getAttribute("clickable")&&s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-image-click",{bubbles:!0,composed:!0,detail:{image:t,index:e}})),"false"!==this.getAttribute("lightbox")&&this.openLightbox(e)}),s}openLightbox(t){this.selectedIndex=t,this.lightboxEl||(this.lightboxEl=document.createElement("db-lightbox"),this.lightboxEl.addEventListener("db-close",()=>{this.selectedIndex=null,this.lightboxEl?.removeAttribute("open")}),this.lightboxEl.addEventListener("db-image-change",t=>{const e=t.detail;"number"==typeof e?.index&&(this.selectedIndex=e.index)}),this.append(this.lightboxEl));const e=this.parseImages();this.lightboxEl.setAttribute("images",JSON.stringify(e.map((t,e)=>({id:t.id||`image-${e}`,src:t.src,alt:t.alt||t.title||"",title:t.title,description:t.description,thumbnail:t.thumbnail})))),this.lightboxEl.setAttribute("current-index",String(t)),this.lightboxEl.setAttribute("open","")}render(){const t=this.parseImages(),e=this.getAttribute("layout")||"grid",s=this.getAttribute("columns")||"3",i=this.getAttribute("spacing")||"m",n="false"!==this.getAttribute("responsive");this.className=["designbase-wc-image-list",`designbase-wc-image-list--${Dt.includes(e)?e:"grid"}`,`designbase-wc-image-list--columns-${Lt.includes(s)?s:"3"}`,`designbase-wc-image-list--spacing-${Mt.includes(i)?i:"m"}`,n&&"designbase-wc-image-list--responsive","false"!==this.getAttribute("clickable")&&"designbase-wc-image-list--clickable","false"!==this.getAttribute("hover")&&"designbase-wc-image-list--hover"].filter(Boolean).join(" ");const a=this.lightboxEl;if(this.replaceChildren(),"carousel"===e){const e=document.createElement("div");e.className="designbase-wc-image-list__carousel",t.forEach((t,s)=>{const i=document.createElement("div");i.className="designbase-wc-image-list__carousel-item",i.append(this.createImageItem(t,s)),e.append(i)}),this.append(e)}else t.forEach((t,e)=>{this.append(this.createImageItem(t,e))});a&&(this.lightboxEl=a,this.append(a),null!==this.selectedIndex&&(a.setAttribute("current-index",String(this.selectedIndex)),a.setAttribute("open","")))}}customElements.get("db-image-list")||customElements.define("db-image-list",DbImageList);const zt=["s","m","l","xl"];class DbLightbox extends HTMLElement{constructor(){super(...arguments),this.portalEl=null,this.imageEl=null,this.loadingEl=null,this.errorEl=null,this.counterBadge=null,this.prevNav=null,this.nextNav=null,this.currentIndex=0,this.imageLoaded=!1,this.imageError=!1,this.keydownHandler=null,this.boundSrc="",this.handleImageLoad=()=>{this.imageLoaded=!0,this.imageError=!1,this.syncImageLayers()},this.handleImageError=()=>{this.imageLoaded=!1,this.imageError=!0,this.syncImageLayers()}}static get observedAttributes(){return["images","current-index","size","open","enable-keyboard","show-thumbnails","show-counter","show-close-button","show-navigation-buttons","show-toolbar","close-on-backdrop-click","close-on-escape"]}connectedCallback(){this.classList.add("designbase-wc-lightbox-host"),this.syncOpenState()}disconnectedCallback(){this.unmount()}attributeChangedCallback(t,e,s){if("current-index"===t)return this.currentIndex=Number(s||0),this.resetImageState(),void(this.open&&this.refreshView());"open"!==t?"images"===t&&this.open&&this.refreshView():this.syncOpenState()}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}parseImages(){const t=this.getAttribute("images");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}getCurrentImage(){return this.parseImages()[this.currentIndex]||null}resetImageState(){this.imageLoaded=!1,this.imageError=!1,this.boundSrc=""}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}goTo(t){const e=this.parseImages();if(!e.length)return;const s=(t%e.length+e.length)%e.length;s!==this.currentIndex&&(this.currentIndex=s,this.setAttribute("current-index",String(s)),this.resetImageState(),this.refreshView(),this.dispatchEvent(new CustomEvent("db-image-change",{bubbles:!0,composed:!0,detail:{index:s}})))}createIconButton(t,e,s,i,n,a={}){const r=document.createElement("db-button");r.className=t,r.setAttribute("variant",a.variant||"ghost"),r.setAttribute("size","m"),r.setAttribute("icon-only",""),r.setAttribute("aria-label",i),a.radius&&r.setAttribute("radius",a.radius);const l=document.createElement("span");return l.className="designbase-wc-button__start-icon",l.append(createDbIcon(e,s)),r.append(l),r.addEventListener("db-click",n),r}buildPortal(){const t=this.getAttribute("size")||"l",e=zt.includes(t)?t:"l",s=document.createElement("div");s.className=`designbase-wc-lightbox designbase-wc-lightbox--size-${e}`,s.setAttribute("data-wc-internal","");const i=document.createElement("div");i.className="designbase-wc-lightbox__overlay";const n=document.createElement("div");n.className="designbase-wc-lightbox__modal";const a=document.createElement("div");a.className="designbase-wc-lightbox__header";const r=document.createElement("div");r.className="designbase-wc-lightbox__title";const l=document.createElement("h3");l.className="designbase-wc-lightbox__title-text";const o=document.createElement("db-badge");o.className="designbase-wc-lightbox__counter",o.setAttribute("size","s"),o.setAttribute("variant","secondary"),o.setAttribute("badge-style","text"),r.append(l,o);const d=document.createElement("div");d.className="designbase-wc-lightbox__header-actions","false"!==this.getAttribute("show-close-button")&&d.append(this.createIconButton("designbase-wc-lightbox__close-button","close",20,"닫기",()=>this.close())),a.append(r,d);const u=document.createElement("div");u.className="designbase-wc-lightbox__content",this.prevNav=this.createIconButton("designbase-wc-lightbox__nav-button designbase-wc-lightbox__nav-button--prev","chevron-left",24,"이전 이미지",()=>this.goTo(this.currentIndex-1),{radius:"pill"}),this.nextNav=this.createIconButton("designbase-wc-lightbox__nav-button designbase-wc-lightbox__nav-button--next","chevron-right",24,"다음 이미지",()=>this.goTo(this.currentIndex+1),{radius:"pill"});const b=document.createElement("div");b.className="designbase-wc-lightbox__image-container",this.errorEl=document.createElement("div"),this.errorEl.className="designbase-wc-lightbox__error",this.errorEl.hidden=!0;const p=createDbIcon("gallery",24);p.classList.add("designbase-wc-lightbox__error-icon"),this.errorEl.append(p);const m=document.createElement("p");m.className="designbase-wc-lightbox__error-text",m.textContent="이미지를 불러올 수 없습니다",this.errorEl.append(m),this.loadingEl=document.createElement("div"),this.loadingEl.className="designbase-wc-lightbox__loading";const g=document.createElement("db-spinner");g.setAttribute("type","circular"),g.setAttribute("size","m"),g.setAttribute("show-label",""),g.setAttribute("label","이미지 로딩 중..."),this.loadingEl.append(g),this.imageEl=document.createElement("img"),this.imageEl.className="designbase-wc-lightbox__image",this.imageEl.draggable=!1,this.imageEl.addEventListener("load",this.handleImageLoad),this.imageEl.addEventListener("error",this.handleImageError),b.append(this.errorEl,this.loadingEl,this.imageEl);const v=document.createElement("div");v.className="designbase-wc-lightbox__description";const E=document.createElement("p");E.className="designbase-wc-lightbox__description-text",v.append(E),"false"!==this.getAttribute("show-navigation-buttons")&&u.append(this.prevNav,this.nextNav),u.append(b,v);const f=document.createElement("div");f.className="designbase-wc-lightbox__thumbnails";const w=document.createElement("div");return w.className="designbase-wc-lightbox__thumbnails-container",f.append(w),n.append(a,u,f),i.append(n),s.append(i),i.addEventListener("click",t=>{t.target===i&&"false"!==this.getAttribute("close-on-backdrop-click")&&this.close()}),this.portalEl=s,this.counterBadge=o,s}syncImageLayers(){this.imageEl&&this.loadingEl&&this.errorEl&&(this.imageEl.classList.toggle("designbase-wc-lightbox__image--loaded",this.imageLoaded),this.loadingEl.hidden=this.imageLoaded||this.imageError,this.errorEl.hidden=!this.imageError,this.imageEl.hidden=this.imageError)}updateThumbnails(){if(!this.portalEl)return;const t=this.portalEl.querySelector(".designbase-wc-lightbox__thumbnails-container"),e=this.portalEl.querySelector(".designbase-wc-lightbox__thumbnails");if(!t||!e)return;const s=this.parseImages(),i="false"!==this.getAttribute("show-thumbnails")&&s.length>1;e.hidden=!i,t.replaceChildren(),i&&s.forEach((e,s)=>{const i=document.createElement("button");i.type="button",i.className=["designbase-wc-lightbox__thumbnail",s===this.currentIndex&&"designbase-wc-lightbox__thumbnail--active"].filter(Boolean).join(" "),i.title=e.title||`이미지 ${s+1}`,i.setAttribute("aria-label",e.alt||e.title||`이미지 ${s+1}`),i.setAttribute("aria-current",s===this.currentIndex?"true":"false");const n=document.createElement("img");n.className="designbase-wc-lightbox__thumbnail-image",n.src=e.thumbnail||e.src,n.alt="",n.draggable=!1,n.loading="lazy",n.decoding="async",i.append(n),i.addEventListener("click",()=>this.goTo(s)),t.append(i)})}loadCurrentImage(){if(!this.imageEl)return;const t=this.getCurrentImage();if(!t?.src)return this.imageEl.removeAttribute("src"),this.resetImageState(),void this.syncImageLayers();this.boundSrc!==t.src&&(this.boundSrc=t.src,this.resetImageState(),this.imageEl.src=t.src,this.imageEl.alt=t.alt||t.title||`이미지 ${this.currentIndex+1}`,this.syncImageLayers(),this.imageEl.complete&&this.imageEl.naturalWidth>0&&this.handleImageLoad())}refreshView(){if(!this.portalEl)return;const t=this.getCurrentImage(),e=this.parseImages(),s=this.portalEl.querySelector(".designbase-wc-lightbox__title-text"),i=this.portalEl.querySelector(".designbase-wc-lightbox__description-text"),n=this.portalEl.querySelector(".designbase-wc-lightbox__description");if(s&&(s.textContent=t?.title||"",s.hidden=!t?.title),this.counterBadge){const t="false"!==this.getAttribute("show-counter")&&e.length>1?`${this.currentIndex+1} / ${e.length}`:"";this.counterBadge.textContent=t,this.counterBadge.hidden=!t}n&&i&&(i.textContent=t?.description||"",n.hidden=!t?.description);const a="false"!==this.getAttribute("show-navigation-buttons")&&e.length>1;this.prevNav&&(this.prevNav.hidden=!a),this.nextNav&&(this.nextNav.hidden=!a),this.loadCurrentImage(),this.updateThumbnails()}mount(){this.portalEl||(this.portalEl=this.buildPortal()),this.portalEl.isConnected||document.body.append(this.portalEl),document.body.style.overflow="hidden",this.keydownHandler||(this.keydownHandler=t=>{this.open&&"false"!==this.getAttribute("enable-keyboard")&&("Escape"===t.key&&"false"!==this.getAttribute("close-on-escape")&&(t.preventDefault(),this.close()),"ArrowLeft"===t.key&&this.goTo(this.currentIndex-1),"ArrowRight"===t.key&&this.goTo(this.currentIndex+1))},document.addEventListener("keydown",this.keydownHandler)),this.currentIndex=Number(this.getAttribute("current-index")||0),this.refreshView()}unmount(){this.portalEl?.remove(),document.body.style.overflow="",this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}syncOpenState(){this.open?this.mount():this.unmount()}}customElements.get("db-lightbox")||customElements.define("db-lightbox",DbLightbox);const Tt=["s","m","l"],Bt=["default","glass","transparent"];class DbBottomNavigation extends HTMLElement{static get observedAttributes(){return["items","active-item-id","size","background-color","fixed"]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}get items(){return this.parseItems()}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}parseItems(){try{const t=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}iconSize(t){return"s"===t?20:"l"===t?28:24}syncHostClasses(){const t=this.getAttribute("size")||"m",e=Tt.includes(t)?t:"m",s=this.getAttribute("background-color")||"default",i=Bt.includes(s)?s:"default";this.className=["designbase-wc-bottom-navigation",`designbase-wc-bottom-navigation--${e}`,`designbase-wc-bottom-navigation--${i}`,"false"!==this.getAttribute("fixed")&&"designbase-wc-bottom-navigation--fixed"].filter(Boolean).join(" ")}render(){this.syncHostClasses(),this.setAttribute("role","navigation"),this.setAttribute("aria-label","하단 네비게이션");const t=this.parseItems(),e=this.getAttribute("active-item-id")||"",s=this.getAttribute("size")||"m",i=this.iconSize(s);let n=this.querySelector(".designbase-wc-bottom-navigation__container");n?n.replaceChildren():(n=document.createElement("div"),n.className="designbase-wc-bottom-navigation__container",this.replaceChildren(n)),t.forEach(t=>{const s=e===t.id||Boolean(t.isActive),a=function resolveIcon$1(t){if(t)return t}(s&&t.activeIcon?t.activeIcon:t.icon),r=document.createElement("button");r.type="button",r.className=["designbase-wc-bottom-navigation__item",s&&"designbase-wc-bottom-navigation__item--active",t.disabled&&"designbase-wc-bottom-navigation__item--disabled"].filter(Boolean).join(" "),r.disabled=Boolean(t.disabled),r.setAttribute("aria-label",t.label),s&&r.setAttribute("aria-current","page");const l=document.createElement("div");l.className="designbase-wc-bottom-navigation__item-content";const o=document.createElement("div");if(o.className="designbase-wc-bottom-navigation__icon-wrapper",a){const t=createDbIcon(a,i);t.classList.add("designbase-wc-bottom-navigation__icon"),o.append(t)}if(void 0!==t.badge&&""!==t.badge){const e=document.createElement("db-badge");e.className="designbase-wc-bottom-navigation__badge",e.setAttribute("size","s"),e.setAttribute("variant",function mapBadgeVariant(t){return"error"===t?"danger":"warning"===t?"warning":"success"===t?"success":"info"===t?"info":"primary"===t?"primary":"secondary"}(t.badgeColor)),e.setAttribute("badge-style","number"),e.setAttribute("count",String(t.badge)),o.append(e)}const d=document.createElement("span");d.className="designbase-wc-bottom-navigation__label",d.textContent=t.label,l.append(o,d),r.append(l),r.addEventListener("click",()=>{t.disabled||this.dispatchEvent(new CustomEvent("db-item-click",{bubbles:!0,composed:!0,detail:{item:t}}))}),n.append(r)})}}customElements.get("db-bottom-navigation")||customElements.define("db-bottom-navigation",DbBottomNavigation);const Pt=["s","m","l"],Ft=["default","transparent"],Ot=["fixed","sticky","static"];function resolveIcon(t){if(t)return t}class DbNavbar extends HTMLElement{constructor(){super(...arguments),this.mobileOpen=!1,this.userMenuOpen=!1,this.expandedMobile={},this.outsideHandler=null}static get observedAttributes(){return["items","user-menu-items","user-profile","size","variant","position","is-authenticated","show-search","search-placeholder","full-width","shadow"]}connectedCallback(){this.render(),this.bindOutsideClick()}disconnectedCallback(){this.unbindOutsideClick()}attributeChangedCallback(){this.isConnected&&this.render()}get items(){return this.parseItems("items")}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}get userMenuItems(){return this.parseItems("user-menu-items")}set userMenuItems(t){this.setAttribute("user-menu-items","string"==typeof t?t:JSON.stringify(t))}get userProfile(){return this.parseUserProfile()}set userProfile(t){null==t?this.removeAttribute("user-profile"):this.setAttribute("user-profile","string"==typeof t?t:JSON.stringify(t))}parseItems(t="items"){try{const e=JSON.parse(this.getAttribute(t)||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseUserProfile(){const t=this.getAttribute("user-profile");if(!t)return null;try{return JSON.parse(t)}catch{return null}}iconSize(t){return"s"===t?16:"l"===t?24:20}bindOutsideClick(){this.outsideHandler||(this.outsideHandler=t=>{this.contains(t.target)||(this.userMenuOpen=!1,this.updateUserMenuVisibility())},document.addEventListener("mousedown",this.outsideHandler))}unbindOutsideClick(){this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler),this.outsideHandler=null)}dispatchItemClick(t,e){this.dispatchEvent(new CustomEvent("user"===e?"db-user-menu-item-click":"db-item-click",{bubbles:!0,composed:!0,detail:{item:t,source:e}}))}syncHostClasses(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("position")||"static";this.className=["designbase-wc-navbar",`designbase-wc-navbar--${Pt.includes(t)?t:"m"}`,`designbase-wc-navbar--${Ft.includes(e)?e:"default"}`,`designbase-wc-navbar--${Ot.includes(s)?s:"static"}`,this.hasAttribute("full-width")&&"designbase-wc-navbar--full-width",this.hasAttribute("shadow")&&"designbase-wc-navbar--shadow",this.mobileOpen&&"designbase-wc-navbar--mobile-open"].filter(Boolean).join(" ")}createDesktopNavItem(t,e){const s=document.createElement("li");s.className="designbase-wc-navbar__nav-item";if(Boolean(t.children?.length)){const i=document.createElement("div");i.className="designbase-wc-navbar__dropdown";const n=document.createElement("button");n.type="button",n.className=["designbase-wc-navbar__nav-link","designbase-wc-navbar__nav-link--has-children",t.active&&"designbase-wc-navbar__nav-link--active",t.disabled&&"designbase-wc-navbar__nav-link--disabled"].filter(Boolean).join(" "),n.disabled=Boolean(t.disabled);const a=resolveIcon(t.icon);a&&n.append(createDbIcon(a,e)),n.append(document.createTextNode(t.label));const r=createDbIcon("chevron-down",12);r.classList.add("designbase-wc-navbar__chevron"),n.append(r);const l=document.createElement("ul");return l.className="designbase-wc-navbar__dropdown-menu",t.children.forEach(t=>{const s=document.createElement("li"),i=document.createElement("a");i.href=t.href||"#",i.className=["designbase-wc-navbar__dropdown-item",t.active&&"designbase-wc-navbar__dropdown-item--active",t.disabled&&"designbase-wc-navbar__dropdown-item--disabled"].filter(Boolean).join(" ");const n=resolveIcon(t.icon);n&&i.append(createDbIcon(n,e)),i.append(document.createTextNode(t.label)),i.addEventListener("click",e=>{t.disabled?e.preventDefault():(e.preventDefault(),this.dispatchItemClick(t,"nav"))}),s.append(i),l.append(s)}),i.append(n,l),s.append(i),s}const i=document.createElement("a");i.href=t.href||"#",i.className=["designbase-wc-navbar__nav-link",t.active&&"designbase-wc-navbar__nav-link--active",t.disabled&&"designbase-wc-navbar__nav-link--disabled"].filter(Boolean).join(" ");const n=resolveIcon(t.icon);return n&&i.append(createDbIcon(n,e)),i.append(document.createTextNode(t.label)),i.addEventListener("click",e=>{t.disabled?e.preventDefault():(e.preventDefault(),this.dispatchItemClick(t,"nav"))}),s.append(i),s}createUserMenuItemElement(t,e,s){const i=document.createElement("db-menu-item");return i.setAttribute("label",t.label),i.setAttribute("type","block"),i.setAttribute("menu-style","dropdown"),i.setAttribute("size",e),t.href&&i.setAttribute("href",t.href),t.icon&&i.setAttribute("icon",t.icon),t.disabled&&i.setAttribute("disabled",""),i.addEventListener("db-click",()=>{t.disabled||(s(),this.dispatchItemClick(t,"user"))}),i}bindSearchEvents(t){t.addEventListener("db-search",t=>{const e=t.detail,s=e.query??e.value??"";this.dispatchEvent(new CustomEvent("db-search",{bubbles:!0,composed:!0,detail:{query:s,value:s}}))})}applyAvatarProfile(t,e,s){t.setAttribute("size","s"===s?"s":"l"===s?"l":"m"),t.setAttribute("initials",e.name),t.setAttribute("alt",e.name),e.avatar&&t.setAttribute("src",e.avatar),void 0!==e.badge&&t.setAttribute("badge",String(e.badge)),e.badgeVariant&&t.setAttribute("badge-variant",e.badgeVariant),e.badgeStyle&&t.setAttribute("badge-style",e.badgeStyle),e.badgeText&&t.setAttribute("badge-text",e.badgeText)}createMobileMenuItem(t,e){const s=Boolean(t.children?.length),i=Boolean(this.expandedMobile[t.id]),n=document.createElement("db-menu-item");return n.setAttribute("label",t.label),n.setAttribute("type","block"),n.setAttribute("menu-style","accordion"),n.setAttribute("size",e),t.href&&n.setAttribute("href",t.href),t.icon&&n.setAttribute("icon",t.icon),t.active&&n.setAttribute("active",""),t.disabled&&n.setAttribute("disabled",""),s&&(n.setAttribute("expandable",""),n.subItems=(t.children||[]).map(t=>({id:t.id,label:t.label,href:t.href,icon:t.icon,active:t.active,disabled:t.disabled})),i&&n.setAttribute("expanded","")),n.addEventListener("db-click",()=>{if(!t.disabled){if(s)return this.expandedMobile[t.id]=!i,void this.renderMobileMenu();this.mobileOpen=!1,this.dispatchItemClick(t,"mobile"),this.render()}}),n.addEventListener("db-child-click",t=>{const e=t.detail;this.mobileOpen=!1,this.dispatchItemClick(e.child,"mobile"),this.render()}),n}updateUserMenuVisibility(){const t=this.querySelector(".designbase-wc-navbar__user-dropdown-menu");t&&(t.hidden=!this.userMenuOpen)}renderMobileMenu(){const t=this.querySelector(".designbase-wc-navbar__mobile-nav-list");if(!t)return;const e=this.getAttribute("size")||"m",s=this.parseItems();t.replaceChildren(...s.map(t=>this.createMobileMenuItem(t,e)))}render(){this.syncHostClasses(),this.setAttribute("role","navigation"),this.setAttribute("aria-label","메인 네비게이션");const t=this.getAttribute("size")||"m",e=this.iconSize(t),s=this.parseItems(),i=this.parseItems("user-menu-items"),n=this.parseUserProfile(),a=this.hasAttribute("is-authenticated"),r=this.hasAttribute("show-search");this.replaceChildren();const l=document.createElement("div");l.className=["designbase-wc-navbar__container",this.hasAttribute("full-width")&&"designbase-wc-navbar__container--full-width"].filter(Boolean).join(" ");const o=document.createElement("div");o.className="designbase-wc-navbar__left";const d=document.createElement("div");d.className="designbase-wc-navbar__brand";const u=document.createElement("div");u.className="designbase-wc-navbar__logo";const b=document.createElement("db-logo");b.setAttribute("type","designbase"),b.setAttribute("size","s"),b.setAttribute("clickable",""),b.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-logo-click",{bubbles:!0,composed:!0}))}),u.append(b),d.append(u),o.append(d);const p=document.createElement("div");p.className="designbase-wc-navbar__right";const m=document.createElement("div");m.className="designbase-wc-navbar__nav designbase-wc-navbar__nav--desktop";const g=document.createElement("ul");if(g.className="designbase-wc-navbar__nav-list",s.forEach(t=>g.append(this.createDesktopNavItem(t,e))),m.append(g),p.append(m),r){const e=document.createElement("div");e.className="designbase-wc-navbar__search";const s=document.createElement("db-search-bar");s.setAttribute("variant","outlined"),s.setAttribute("size","s"===t?"s":"l"===t?"l":"m"),s.setAttribute("placeholder",this.getAttribute("search-placeholder")||"검색..."),this.bindSearchEvents(s),e.append(s),p.append(e)}const v=document.createElement("div");if(v.className="designbase-wc-navbar__user-menu",a&&n){const e=document.createElement("div");e.className="designbase-wc-navbar__user-dropdown";const s=document.createElement("button");s.type="button",s.className="designbase-wc-navbar__user-toggle",s.setAttribute("aria-expanded",String(this.userMenuOpen));const a=document.createElement("db-avatar");this.applyAvatarProfile(a,n,t);const r=document.createElement("span");r.className="designbase-wc-navbar__user-name",r.textContent=n.name,s.append(a,r,createDbIcon("chevron-down",12)),s.addEventListener("click",()=>{this.userMenuOpen=!this.userMenuOpen,s.setAttribute("aria-expanded",String(this.userMenuOpen)),this.updateUserMenuVisibility()});const l=document.createElement("ul");if(l.className="designbase-wc-navbar__user-dropdown-menu",l.hidden=!this.userMenuOpen,n.email){const t=document.createElement("li");t.className="designbase-wc-navbar__user-info";const e=document.createElement("span");e.className="designbase-wc-navbar__user-email",e.textContent=n.email,t.append(e),l.append(t)}i.forEach(e=>{const s=document.createElement("li");s.append(this.createUserMenuItemElement(e,t,()=>{this.userMenuOpen=!1,this.updateUserMenuVisibility()})),l.append(s)}),e.append(s,l),v.append(e)}else{const e=document.createElement("db-button");e.setAttribute("variant","primary"),e.setAttribute("size","s"===t?"s":"l"===t?"l":"m"),e.textContent="로그인",e.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-login-click",{bubbles:!0,composed:!0}))}),v.append(e)}p.append(v);const E=document.createElement("button");E.type="button",E.className="designbase-wc-navbar__mobile-toggle",E.setAttribute("aria-expanded",String(this.mobileOpen)),E.setAttribute("aria-label","메뉴 열기");for(let t=0;t<3;t+=1){const t=document.createElement("span");t.className="designbase-wc-navbar__mobile-toggle-line",E.append(t)}if(E.addEventListener("click",()=>{this.mobileOpen=!this.mobileOpen,this.render()}),l.append(o,p,E),this.append(l),this.mobileOpen){const t=document.createElement("div");if(t.className="designbase-wc-navbar__mobile-menu",r){const e=document.createElement("div");e.className="designbase-wc-navbar__mobile-search";const s=document.createElement("db-search-bar");s.setAttribute("variant","outlined"),s.setAttribute("size","s"),s.setAttribute("full-width",""),s.setAttribute("placeholder",this.getAttribute("search-placeholder")||"검색..."),this.bindSearchEvents(s),e.append(s),t.append(e)}const e=document.createElement("ul");e.className="designbase-wc-navbar__mobile-nav-list",t.append(e);const s=document.createElement("div");if(s.className="designbase-wc-navbar__mobile-user",a&&n){const t=document.createElement("div");t.className="designbase-wc-navbar__mobile-user-info";const e=document.createElement("db-avatar");this.applyAvatarProfile(e,n,"m");const a=document.createElement("div"),r=document.createElement("div");if(r.className="designbase-wc-navbar__mobile-user-name",r.textContent=n.name,a.append(r),n.email){const t=document.createElement("div");t.className="designbase-wc-navbar__mobile-user-email",t.textContent=n.email,a.append(t)}if(t.append(e,a),s.append(t),i.length){const t=document.createElement("ul");t.className="designbase-wc-navbar__mobile-user-menu",i.forEach(e=>{const s=document.createElement("li");s.append(this.createUserMenuItemElement(e,"m",()=>{this.mobileOpen=!1,this.render()})),t.append(s)}),s.append(t)}}else{const t=document.createElement("db-button");t.setAttribute("variant","primary"),t.setAttribute("size","m"),t.setAttribute("full-width",""),t.textContent="로그인",t.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-login-click",{bubbles:!0,composed:!0}))}),s.append(t)}t.append(s),this.append(t),this.renderMobileMenu()}}}customElements.get("db-navbar")||customElements.define("db-navbar",DbNavbar);const Ht=["s","m","l"],Vt=["default","dark","light"],Rt=["left","right"];class DbSidebar extends HTMLElement{constructor(){super(...arguments),this.expandedItems=new Set,this.userMenuOpen=!1,this.outsideHandler=null}static get observedAttributes(){return["items","sections","user-menu-items","user-profile","default-expanded-ids","size","variant","position","collapsed","collapsible","show-logo","full-height","shadow"]}connectedCallback(){this.seedExpanded(),this.render(),this.bindOutsideClick()}disconnectedCallback(){this.unbindOutsideClick()}attributeChangedCallback(t){this.isConnected&&("default-expanded-ids"===t&&this.seedExpanded(),"collapsed"===t&&this.hasAttribute("collapsed")&&(this.userMenuOpen=!1),this.render())}seedExpanded(){try{const t=JSON.parse(this.getAttribute("default-expanded-ids")||"[]");Array.isArray(t)&&(this.expandedItems=new Set(t))}catch{this.expandedItems=new Set}}get items(){try{const t=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}get sections(){return this.parseSections()}set sections(t){this.setAttribute("sections","string"==typeof t?t:JSON.stringify(t))}get userMenuItems(){return this.parseUserMenuItems()}set userMenuItems(t){this.setAttribute("user-menu-items","string"==typeof t?t:JSON.stringify(t))}get userProfile(){return this.parseUserProfile()}set userProfile(t){null==t?this.removeAttribute("user-profile"):this.setAttribute("user-profile","string"==typeof t?t:JSON.stringify(t))}parseSections(){const t=this.getAttribute("sections");if(t)try{const e=JSON.parse(t);if(Array.isArray(e)&&e.length)return e}catch{}try{const t=JSON.parse(this.getAttribute("items")||"[]");return[{id:"main",items:Array.isArray(t)?t:[]}]}catch{return[{id:"main",items:[]}]}}parseUserMenuItems(){try{const t=JSON.parse(this.getAttribute("user-menu-items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}parseUserProfile(){const t=this.getAttribute("user-profile");if(!t)return null;try{return JSON.parse(t)}catch{return null}}bindOutsideClick(){this.outsideHandler||(this.outsideHandler=t=>{const e=this.querySelector(".designbase-wc-sidebar__user");e&&!e.contains(t.target)&&(this.userMenuOpen=!1,this.updateUserMenuVisibility())},document.addEventListener("mousedown",this.outsideHandler))}unbindOutsideClick(){this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler),this.outsideHandler=null)}syncHostClasses(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("position")||"left";this.className=["designbase-wc-sidebar",`designbase-wc-sidebar--${Ht.includes(t)?t:"m"}`,`designbase-wc-sidebar--${Vt.includes(e)?e:"default"}`,`designbase-wc-sidebar--${Rt.includes(s)?s:"left"}`,this.hasAttribute("collapsed")&&"designbase-wc-sidebar--collapsed",this.hasAttribute("full-height")&&"designbase-wc-sidebar--full-height",this.hasAttribute("shadow")&&"designbase-wc-sidebar--shadow"].filter(Boolean).join(" ")}dispatchItemClick(t){this.dispatchEvent(new CustomEvent("db-item-click",{bubbles:!0,composed:!0,detail:{item:t}}))}dispatchUserMenuItemClick(t){this.dispatchEvent(new CustomEvent("db-user-menu-item-click",{bubbles:!0,composed:!0,detail:{item:t}}))}updateUserMenuVisibility(){const t=this.querySelector(".designbase-wc-sidebar__user-dropdown");t&&(t.hidden=!this.userMenuOpen)}createSidebarMenuItem(t,e,s=0){const i=Boolean(t.children?.length),n=this.expandedItems.has(t.id),a=this.hasAttribute("collapsed"),r=document.createElement("li");r.className="designbase-wc-sidebar__item";const l=document.createElement("db-menu-item");return l.setAttribute("label",t.label),l.setAttribute("type","block"),l.setAttribute("menu-style","accordion"),l.setAttribute("size",e),l.setAttribute("depth",String(s)),t.href&&l.setAttribute("href",t.href),t.icon&&l.setAttribute("icon",t.icon),t.active&&l.setAttribute("active",""),t.disabled&&l.setAttribute("disabled",""),void 0!==t.badge&&l.setAttribute("badge",String(t.badge)),t.badgeColor&&l.setAttribute("badge-color",t.badgeColor),i&&(l.setAttribute("expandable",""),l.subItems=(t.children||[]).map(t=>({id:t.id,label:t.label,href:t.href,icon:t.icon,active:t.active,disabled:t.disabled,badge:t.badge,badgeColor:t.badgeColor})),n&&!a&&l.setAttribute("expanded","")),l.addEventListener("db-click",()=>{if(!t.disabled)return i&&!a?(this.expandedItems.has(t.id)?this.expandedItems.delete(t.id):this.expandedItems.add(t.id),void this.renderNav()):void this.dispatchItemClick(t)}),l.addEventListener("db-child-click",t=>{const e=t.detail;this.dispatchItemClick(e.child)}),r.append(l),r}renderNav(){const t=this.querySelector(".designbase-wc-sidebar__nav");if(!t)return;const e=this.getAttribute("size")||"m",s=this.parseSections();t.replaceChildren(),s.forEach(s=>{const i=document.createElement("div");if(i.className="designbase-wc-sidebar__section",!this.hasAttribute("collapsed")&&s.title){const t=document.createElement("div");t.className="designbase-wc-sidebar__section-title",t.textContent=s.title,i.append(t)}const n=document.createElement("ul");n.className="designbase-wc-sidebar__nav-list",s.items.forEach(t=>n.append(this.createSidebarMenuItem(t,e))),i.append(n),t.append(i)})}render(){this.syncHostClasses(),this.setAttribute("role","complementary"),this.setAttribute("aria-label","사이드바 네비게이션");const t=this.getAttribute("size")||"m",e="false"!==this.getAttribute("collapsible"),s="false"!==this.getAttribute("show-logo"),i=this.hasAttribute("collapsed"),n=this.parseUserProfile(),a=this.parseUserMenuItems(),r="l"===t?"m":"s"===t?"xs":"s";this.replaceChildren();const l=document.createElement("div");if(l.className="designbase-wc-sidebar__container",e||s&&!i){const t=document.createElement("div");if(t.className=["designbase-wc-sidebar__header",(i||!s)&&"designbase-wc-sidebar__header--collapsed-only"].filter(Boolean).join(" "),!i&&s){const e=document.createElement("div");e.className="designbase-wc-sidebar__logo";const s=document.createElement("db-logo");s.setAttribute("type","designbase"),s.setAttribute("size",r),e.append(s),e.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-logo-click",{bubbles:!0,composed:!0}))}),t.append(e)}if(e){const e=document.createElement("db-button");e.className="designbase-wc-sidebar__toggle",e.setAttribute("variant","tertiary"),e.setAttribute("size","s"),e.setAttribute("icon-only",""),e.setAttribute("start-icon",i?"arrow-bar-right":"arrow-bar-left"),e.setAttribute("aria-label",i?"사이드바 펼치기":"사이드바 접기"),e.addEventListener("db-click",()=>{const t=!this.hasAttribute("collapsed");t?this.setAttribute("collapsed",""):this.removeAttribute("collapsed"),this.dispatchEvent(new CustomEvent("db-toggle",{bubbles:!0,composed:!0,detail:{collapsed:t}}))}),t.append(e)}l.append(t)}const o=document.createElement("div");o.className="designbase-wc-sidebar__nav-wrapper";const d=document.createElement("nav");d.className="designbase-wc-sidebar__nav",d.setAttribute("aria-label","주 메뉴"),o.append(d),l.append(o);const u=document.createElement("div");if(u.className="designbase-wc-sidebar__footer",n&&!i){const t=document.createElement("div");t.className="designbase-wc-sidebar__user";const e=document.createElement("div");if(e.className="designbase-wc-sidebar__user-dropdown",e.setAttribute("role","menu"),e.setAttribute("aria-label","사용자 메뉴"),e.hidden=!this.userMenuOpen,a.length){const t=document.createElement("ul");t.className="designbase-wc-sidebar__user-menu",a.forEach(e=>{const s=document.createElement("li");s.className="designbase-wc-sidebar__user-menu-item";const i=document.createElement("db-menu-item");i.setAttribute("label",e.label),i.setAttribute("type","block"),i.setAttribute("menu-style","accordion"),i.setAttribute("size","s"),e.icon&&i.setAttribute("icon",e.icon),e.href&&i.setAttribute("href",e.href),i.addEventListener("db-click",()=>{this.userMenuOpen=!1,this.updateUserMenuVisibility(),this.dispatchUserMenuItemClick(e)}),s.append(i),t.append(s)}),e.append(t)}const s=document.createElement("div");s.className="designbase-wc-sidebar__user-info",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",String(this.userMenuOpen));const i=document.createElement("db-avatar");i.className="designbase-wc-sidebar__user-avatar",i.setAttribute("size","s"),i.setAttribute("initials",n.name),i.setAttribute("alt",n.name),n.avatar&&i.setAttribute("src",n.avatar);const r=document.createElement("div");r.className="designbase-wc-sidebar__user-details";const l=document.createElement("div");if(l.className="designbase-wc-sidebar__user-name",l.textContent=n.name,r.append(l),n.email){const t=document.createElement("div");t.className="designbase-wc-sidebar__user-email",t.textContent=n.email,r.append(t)}if(s.append(i,r),a.length){const t=document.createElement("span");t.className="designbase-wc-sidebar__user-more",t.setAttribute("aria-hidden","true"),t.append(createDbIcon("more-vertical",16)),s.append(t),s.setAttribute("aria-haspopup","menu")}s.addEventListener("click",()=>{a.length&&(this.userMenuOpen=!this.userMenuOpen,s.setAttribute("aria-expanded",String(this.userMenuOpen)),this.updateUserMenuVisibility())}),t.append(e,s),u.append(t)}else if(n&&i){const t=document.createElement("div");t.className="designbase-wc-sidebar__user-collapsed",t.setAttribute("role","button"),t.setAttribute("tabindex","0");const e=document.createElement("db-avatar");e.className="designbase-wc-sidebar__user-avatar-collapsed",e.setAttribute("size","m"),e.setAttribute("initials",n.name),e.setAttribute("alt",n.name),n.avatar&&e.setAttribute("src",n.avatar),t.append(e),u.append(t)}l.append(u),this.append(l),this.renderNav()}}customElements.get("db-sidebar")||customElements.define("db-sidebar",DbSidebar);class DbContextMenu extends HTMLElement{constructor(){super(...arguments),this.externalTarget=null,this.activeSubMenu=null,this.onExternalContextMenu=null,this.handleDocumentMouseDown=t=>{if(!this.open)return;const e=t.target;this.menuEl?.contains(e)||this.targetWrap?.contains(e)||this.externalTarget?.contains(e)||this.close()},this.handleKeyDown=t=>{this.open&&"Escape"===t.key&&this.close()},this.handleContextMenu=t=>{this.hasAttribute("disabled")||(t.preventDefault(),t.stopPropagation(),this.openAt(t.clientX,t.clientY))}}static get observedAttributes(){return["open","x","y","items","target-id","disabled"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open","true"):this.removeAttribute("open")}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.style.display="contents",requestAnimationFrame(()=>{this.renderTarget(),this.syncMenu()}),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleKeyDown),this.unbindExternalTarget(),this.menuEl?.remove(),this.menuEl=void 0}attributeChangedCallback(t){if(this.isConnected)return"target-id"===t?(this.unbindExternalTarget(),void this.bindExternalTarget()):void("open"!==t&&"x"!==t&&"y"!==t&&"items"!==t||this.syncMenu())}openAt(t,e){this.setAttribute("x",String(t)),this.setAttribute("y",String(e)),this.setAttribute("open","true"),this.dispatchEvent(new CustomEvent("db-open",{bubbles:!0,composed:!0,detail:{x:t,y:e}})),this.syncMenu()}close(){this.activeSubMenu=null,this.removeAttribute("open"),this.menuEl?.remove(),this.menuEl=void 0,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}collectTargetChildren(){const t=Array.from(this.children).filter(t=>!t.hasAttribute("data-wc-internal")&&t!==this.targetWrap);return t.length>0?t:Array.from(this.targetWrap?.children||[])}bindExternalTarget(){const t=this.getAttribute("target-id");t&&(this.externalTarget=document.getElementById(t),this.externalTarget&&(this.onExternalContextMenu=t=>this.handleContextMenu(t),this.externalTarget.addEventListener("contextmenu",this.onExternalContextMenu)))}unbindExternalTarget(){this.externalTarget&&this.onExternalContextMenu&&this.externalTarget.removeEventListener("contextmenu",this.onExternalContextMenu),this.externalTarget=null,this.onExternalContextMenu=null}renderTarget(){const t=this.collectTargetChildren();this.getAttribute("target-id")?(this.replaceChildren(),this.bindExternalTarget()):(this.targetWrap||(this.targetWrap=document.createElement("div"),this.targetWrap.className="designbase-wc-context-menu__target",this.targetWrap.addEventListener("contextmenu",this.handleContextMenu)),this.replaceChildren(),t.forEach(t=>this.targetWrap.append(t)),t.length>0&&this.append(this.targetWrap))}adjustPosition(){if(!this.menuEl)return;const t=Number(this.getAttribute("x")||0),e=Number(this.getAttribute("y")||0),s=this.menuEl.getBoundingClientRect();let i=t,n=e;t+s.width>window.innerWidth&&(i=t-s.width),e+s.height>window.innerHeight&&(n=e-s.height),this.menuEl.style.left=`${Math.max(0,i)}px`,this.menuEl.style.top=`${Math.max(0,n)}px`}createMenuItem(t){const e=document.createElement("db-menu-item");return e.setAttribute("label",t.label||t.id),e.setAttribute("type","block"),e.setAttribute("menu-style","dropdown"),t.icon&&e.setAttribute("icon",t.icon),t.disabled&&e.setAttribute("disabled",""),t.variant&&e.setAttribute("variant",t.variant),t.subItems?.length&&(e.setAttribute("sub-items",JSON.stringify(t.subItems)),e.setAttribute("expandable","")),e.addEventListener("db-click",()=>{t.disabled||t.subItems?.length||(this.dispatchEvent(new CustomEvent("db-select",{detail:{item:t},bubbles:!0,composed:!0})),this.close())}),e.addEventListener("db-child-click",t=>{const e=t.detail?.child;this.dispatchEvent(new CustomEvent("db-select",{detail:{item:e},bubbles:!0,composed:!0})),this.close()}),e}renderItem(t,e){if(t.divider||t.isDivider){const t=document.createElement("db-divider");return t.className="designbase-wc-divider",t}const s=document.createElement("div");s.className="designbase-wc-context-menu__item-wrapper",s.append(this.createMenuItem(t));if(Boolean(t.subItems?.length)){const e=document.createElement("div");e.className=["designbase-wc-context-menu__submenu",this.activeSubMenu===t.id&&"designbase-wc-context-menu__submenu--open"].filter(Boolean).join(" "),t.subItems?.forEach((t,s)=>{const i=this.renderItem(t,s);i&&e.append(i)}),s.addEventListener("mouseenter",()=>{this.activeSubMenu=t.id,e.classList.add("designbase-wc-context-menu__submenu--open")}),s.addEventListener("mouseleave",()=>{this.activeSubMenu=null,e.classList.remove("designbase-wc-context-menu__submenu--open")}),s.append(e)}return s}syncMenu(){if(this.menuEl?.remove(),this.menuEl=void 0,!this.open)return;const t=Number(this.getAttribute("x")||0),e=Number(this.getAttribute("y")||0),s=this.items,i=document.createElement("div");i.className="designbase-wc-context-menu",i.setAttribute("data-wc-internal",""),i.style.position="fixed",i.style.left=`${t}px`,i.style.top=`${e}px`,i.style.zIndex="1000",i.setAttribute("role","menu"),i.setAttribute("aria-orientation","vertical"),s.forEach((t,e)=>{const s=this.renderItem(t,e);s&&i.append(s)}),document.body.append(i),this.menuEl=i,requestAnimationFrame(()=>this.adjustPosition())}}customElements.get("db-context-menu")||customElements.define("db-context-menu",DbContextMenu);const qt=["s","m","l"],jt=["default","primary","success","warning","danger"],Wt=["solid","striped","animated"];class DbProgressbar extends HTMLElement{static get observedAttributes(){return["value","min","max","size","variant","bar-style","show-label","label","label-position","full-width","disabled"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const t=Number(this.getAttribute("min")||0),e=Number(this.getAttribute("max")||100),s=Number(this.getAttribute("value")||0),i=Math.max(t,Math.min(e,s)),n=e===t?0:(i-t)/(e-t)*100,a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"default",l=this.getAttribute("bar-style")||"solid",o=this.getAttribute("label-position")||"top",d=this.hasAttribute("show-label"),u=this.getAttribute("label")||(d?`${Math.round(n)}%`:""),b=this.hasAttribute("disabled");this.className=["designbase-wc-progressbar",`designbase-wc-progressbar--${qt.includes(a)?a:"m"}`,`designbase-wc-progressbar--${jt.includes(r)?r:"default"}`,`designbase-wc-progressbar--${Wt.includes(l)?l:"solid"}`,this.hasAttribute("full-width")&&"designbase-wc-progressbar--full-width",b&&"designbase-wc-progressbar--disabled",100===n&&"designbase-wc-progressbar--completed"].filter(Boolean).join(" "),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin",String(t)),this.setAttribute("aria-valuemax",String(e)),this.setAttribute("aria-valuenow",String(i)),u&&this.setAttribute("aria-label",u),this.replaceChildren();const p=document.createElement("div");if(p.className=`designbase-wc-progressbar__container designbase-wc-progressbar__container--${o}`,u&&"inside"!==o){const t=document.createElement("span");t.className=`designbase-wc-progressbar__label designbase-wc-progressbar__label--${o}`,t.textContent=u,p.append(t)}const m=document.createElement("div");m.className="designbase-wc-progressbar__track";const g=document.createElement("div");if(g.className="designbase-wc-progressbar__fill",g.style.width=`${n}%`,u&&"inside"===o){const t=document.createElement("span");t.className="designbase-wc-progressbar__fill-label",t.textContent=u,g.append(t)}m.append(g),p.append(m),this.append(p)}}customElements.get("db-progressbar")||customElements.define("db-progressbar",DbProgressbar);class DbProgressStep extends HTMLElement{static get observedAttributes(){return["items","size","layout","current-step","clickable","full-width","disabled"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}resolveStatus(t,e){const s=e.status??"pending";if("pending"!==s)return s;const i=Number(this.getAttribute("current-step")||0);return t<i?"completed":t===i?"active":"pending"}iconSize(t){return"s"===t?12:"l"===t?20:16}renderIndicatorContent(t,e,s){const i=document.createElement("div");if(i.className="designbase-wc-progress-step__icon","completed"===t)i.append(createDbIcon("done",this.iconSize(s)));else if("error"===t)i.append(createDbIcon("warning-filled",this.iconSize(s)));else{const t=document.createElement("span");t.className="designbase-wc-progress-step__number",t.textContent=String(e+1),i.append(t)}return i}handleStepClick(t,e){const s=this.hasAttribute("disabled"),i=this.hasAttribute("clickable");s||t.disabled||!i||this.dispatchEvent(new CustomEvent("db-step-click",{detail:{item:t,index:e},bubbles:!0,composed:!0}))}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("layout")||"horizontal",s=this.hasAttribute("clickable"),i=this.hasAttribute("disabled"),n=this.items;this.className=["designbase-wc-progress-step",`designbase-wc-progress-step--${t}`,`designbase-wc-progress-step--${e}`,s&&"designbase-wc-progress-step--clickable",this.hasAttribute("full-width")&&"designbase-wc-progress-step--full-width",i&&"designbase-wc-progress-step--disabled"].filter(Boolean).join(" "),this.replaceChildren(),n.forEach((e,a)=>{const r=this.resolveStatus(a,e),l=a===n.length-1,o=s&&!i&&!e.disabled,d="completed"===(a>0?this.resolveStatus(a-1,n[a-1]):"pending")?"completed":r,u=document.createElement("div");u.className=["designbase-wc-progress-step__item",`designbase-wc-progress-step__item--${r}`,o&&"designbase-wc-progress-step__item--clickable",e.disabled&&"designbase-wc-progress-step__item--disabled"].filter(Boolean).join(" ");const b=document.createElement("div");b.className="designbase-wc-progress-step__indicator-container";const p=document.createElement("div");if(p.className="designbase-wc-progress-step__indicator",o?(p.tabIndex=0,p.setAttribute("role","button"),p.setAttribute("aria-label",`${e.title} 단계로 이동`),p.addEventListener("click",()=>this.handleStepClick(e,a)),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleStepClick(e,a))})):p.tabIndex=-1,"active"===r){const t=document.createElement("div");t.className="designbase-wc-progress-step__pulse",p.append(t)}if(p.append(this.renderIndicatorContent(r,a,t)),b.append(p),!l){const t=document.createElement("div");t.className=["designbase-wc-progress-step__connector",`designbase-wc-progress-step__connector--${d}`].join(" "),b.append(t)}u.append(b);const m=document.createElement("div");m.className="designbase-wc-progress-step__content";const g=document.createElement("div");g.className="designbase-wc-progress-step__header";const v=document.createElement("h3");if(v.className="designbase-wc-progress-step__title",v.textContent=e.title,g.append(v),m.append(g),e.description){const t=document.createElement("p");t.className="designbase-wc-progress-step__description",t.textContent=e.description,m.append(t)}if(e.timestamp){const t=document.createElement("span");t.className="designbase-wc-progress-step__timestamp",t.textContent=e.timestamp,m.append(t)}u.append(m),this.append(u)})}}customElements.get("db-progress-step")||customElements.define("db-progress-step",DbProgressStep);const Ut="designbase-wc-range-slider";class DbRangeSlider extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.valuesEl=null,this.containerEl=null,this.trackEl=null,this.fillEl=null,this.thumbEls=[],this.currentValue=50,this.currentRange=[25,75],this.isDragging=!1,this.activeThumb=null,this.boundTrackClick=t=>this.handleTrackClick(t),this.boundPointerMove=t=>this.handlePointerMove(t),this.boundPointerUp=()=>this.handlePointerUp(),this.boundContainerKeyDown=t=>this.handleKeyDown(t),this.eventsBound=!1}static get observedAttributes(){return["value","range","min","max","step","size","variant","show-value","value-position","show-marks","marks","mark-labels","disabled","readonly","full-width","vertical"]}connectedCallback(){this.built||(this.build(),this.built=!0),this.readAttributeValues(),this.syncClasses(),this.syncStructure(),this.syncVisuals(),this.syncA11y(),this.bindEvents()}disconnectedCallback(){this.unbindEvents()}attributeChangedCallback(t){this.built&&(this.readAttributeValues(),this.syncClasses(),this.isStructuralAttribute(t)&&this.syncStructure(),this.syncVisuals(),this.syncA11y())}isStructuralAttribute(t){return["range","show-value","show-marks","marks","mark-labels","vertical"].includes(t)}get value(){return this.currentValue}set value(t){this.currentValue=this.clamp(t),this.setAttribute("value",String(this.currentValue)),this.syncVisuals()}get range(){if(this.hasAttribute("range"))return[...this.currentRange]}set range(t){if(null==t)return this.removeAttribute("range"),void(this.built&&(this.syncStructure(),this.syncVisuals()));const e=this.normalizeRangeInput(t);if(!e)return;const s=[Math.min(e[0],e[1]),Math.max(e[0],e[1])];this.currentRange=[this.clamp(s[0]),this.clamp(s[1])];const i=`${this.currentRange[0]},${this.currentRange[1]}`;this.getAttribute("range")!==i&&this.setAttribute("range",i),this.built&&this.syncVisuals()}build(){this.classList.add(Ut),this.valuesEl=document.createElement("div"),this.valuesEl.className=`${Ut}__values`,this.containerEl=document.createElement("div"),this.containerEl.className=`${Ut}__container`,this.containerEl.setAttribute("role","slider"),this.containerEl.setAttribute("tabindex","0"),this.trackEl=document.createElement("div"),this.trackEl.className=`${Ut}__track`,this.fillEl=document.createElement("div"),this.fillEl.className=`${Ut}__fill`,this.trackEl.appendChild(this.fillEl),this.containerEl.appendChild(this.trackEl),this.appendChild(this.valuesEl),this.appendChild(this.containerEl)}bindEvents(){this.eventsBound||(this.trackEl?.addEventListener("click",this.boundTrackClick),this.containerEl?.addEventListener("keydown",this.boundContainerKeyDown),this.eventsBound=!0)}unbindEvents(){this.eventsBound&&(this.trackEl?.removeEventListener("click",this.boundTrackClick),this.containerEl?.removeEventListener("keydown",this.boundContainerKeyDown),document.removeEventListener("pointermove",this.boundPointerMove),document.removeEventListener("pointerup",this.boundPointerUp),this.eventsBound=!1)}readAttributeValues(){const t=this.getNumberAttr("min",0),e=this.getNumberAttr("max",100),s=this.getNumberAttr("step",1);if(this.hasAttribute("range")){const i=this.parseRangeAttr(this.getAttribute("range"));i?this.currentRange=[this.clamp(i[0],t,e,s),this.clamp(i[1],t,e,s)]:this.currentRange.every(Number.isFinite)||(this.currentRange=[25,75])}else this.currentValue=this.clamp(this.getNumberAttr("value",50),t,e,s)}syncClasses(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.hasAttribute("range"),i=this.getAttribute("value-position")||"top",n=[Ut,`${Ut}--${t}`,`${Ut}--${e}`,`${Ut}--value-${s?"top":"top"===i?"right":i}`,this.hasAttribute("disabled")?`${Ut}--disabled`:"",this.hasAttribute("readonly")?`${Ut}--readonly`:"",this.hasAttribute("full-width")?`${Ut}--full-width`:"",this.hasAttribute("vertical")?`${Ut}--vertical`:"",s?`${Ut}--range`:""].filter(Boolean);if(this.className=n.join(" "),this.trackEl){const t=[`${Ut}__track`];this.hasAttribute("disabled")&&t.push(`${Ut}__track--disabled`),this.hasAttribute("readonly")&&t.push(`${Ut}__track--readonly`),this.trackEl.className=t.join(" ")}}syncStructure(){if(!this.valuesEl||!this.trackEl||!this.fillEl)return;const t=this.hasAttribute("show-value"),e=this.hasAttribute("range"),s=this.hasAttribute("show-marks");if(this.valuesEl.innerHTML="",this.valuesEl.hidden=!t,t)if(e){const t=document.createElement("span");t.className=`${Ut}__value ${Ut}__value--min`;const e=document.createElement("span");e.className=`${Ut}__value ${Ut}__value--max`,this.valuesEl.append(t,e)}else{const t=document.createElement("span");t.className=`${Ut}__value ${Ut}__value--single`,this.valuesEl.appendChild(t)}if(this.thumbEls.forEach(t=>t.remove()),this.thumbEls=[],this.trackEl.querySelectorAll(`.${Ut}__mark`).forEach(t=>t.remove()),s){const t=this.parseMarks();if(t.length>0){const e=this.parseMarkLabels();t.forEach(t=>{const s=document.createElement("div");if(s.className=`${Ut}__mark`,s.setAttribute("aria-hidden","true"),this.isMarkActive(t)&&s.classList.add(`${Ut}__mark--active`),this.hasAttribute("vertical")?s.style.bottom=`${this.valueToPercent(t)}%`:s.style.left=`${this.valueToPercent(t)}%`,void 0!==e[t]){const i=document.createElement("span");i.className=`${Ut}__mark-label`,i.textContent=e[t],s.appendChild(i)}this.trackEl.insertBefore(s,this.fillEl)})}}const i=e?2:1,n=this.hasAttribute("disabled")||this.hasAttribute("readonly");for(let t=0;t<i;t++){const s=document.createElement("div");s.className=`${Ut}__thumb`,s.setAttribute("role","slider"),s.setAttribute("draggable","false"),s.setAttribute("tabindex",n?"-1":"0");const i=e?0===t?"min":"max":"single";e&&(s.dataset.thumb=i),s.addEventListener("pointerdown",t=>this.handleThumbPointerDown(t,i)),s.addEventListener("keydown",t=>this.handleKeyDown(t,i)),this.trackEl.appendChild(s),this.thumbEls.push(s)}}isMarkActive(t){if(this.hasAttribute("range")){const[e,s]=this.currentRange;return t>=e&&t<=s}return t<=this.currentValue}syncVisuals(){if(!this.fillEl)return;const t=this.hasAttribute("range"),e=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100);if(t){const[t,i]=this.currentRange,n=this.valueToPercent(t),a=this.valueToPercent(i);this.hasAttribute("vertical")?(this.fillEl.style.left="",this.fillEl.style.width="",this.fillEl.style.bottom=`${n}%`,this.fillEl.style.height=a-n+"%"):(this.fillEl.style.bottom="",this.fillEl.style.height="",this.fillEl.style.left=`${n}%`,this.fillEl.style.width=a-n+"%"),this.thumbEls[0]&&(this.setThumbPosition(this.thumbEls[0],n),this.thumbEls[0].setAttribute("aria-valuemin",String(e)),this.thumbEls[0].setAttribute("aria-valuemax",String(i)),this.thumbEls[0].setAttribute("aria-valuenow",String(t))),this.thumbEls[1]&&(this.setThumbPosition(this.thumbEls[1],a),this.thumbEls[1].setAttribute("aria-valuemin",String(t)),this.thumbEls[1].setAttribute("aria-valuemax",String(s)),this.thumbEls[1].setAttribute("aria-valuenow",String(i)));const r=this.valuesEl?.querySelector(`.${Ut}__value--min`),l=this.valuesEl?.querySelector(`.${Ut}__value--max`);r&&(r.textContent=String(t)),l&&(l.textContent=String(i))}else{const t=this.valueToPercent(this.currentValue);this.hasAttribute("vertical")?(this.fillEl.style.left="",this.fillEl.style.width="",this.fillEl.style.bottom="0",this.fillEl.style.height=`${t}%`):(this.fillEl.style.bottom="",this.fillEl.style.height="",this.fillEl.style.left="0",this.fillEl.style.width=`${t}%`),this.thumbEls[0]&&(this.setThumbPosition(this.thumbEls[0],t),this.thumbEls[0].setAttribute("aria-valuemin",String(e)),this.thumbEls[0].setAttribute("aria-valuemax",String(s)),this.thumbEls[0].setAttribute("aria-valuenow",String(this.currentValue)));const i=this.valuesEl?.querySelector(`.${Ut}__value--single`);i&&(i.textContent=String(this.currentValue))}this.trackEl?.querySelectorAll(`.${Ut}__mark`).forEach(t=>{const e=t instanceof HTMLElement?parseFloat(t.style.left):NaN,s=t instanceof HTMLElement?parseFloat(t.style.bottom):NaN,i=Number.isFinite(e)?e:s;if(!Number.isFinite(i))return;const n=this.percentToValue(i);t.classList.toggle(`${Ut}__mark--active`,this.isMarkActive(n))})}syncA11y(){if(!this.containerEl)return;const t=this.getNumberAttr("min",0),e=this.getNumberAttr("max",100),s=this.hasAttribute("range"),i=this.hasAttribute("disabled"),n=this.hasAttribute("readonly");this.containerEl.setAttribute("aria-valuemin",String(t)),this.containerEl.setAttribute("aria-valuemax",String(e)),this.containerEl.setAttribute("aria-valuenow",String(s?this.currentRange[0]:this.currentValue)),this.containerEl.setAttribute("aria-valuetext",s?`${this.currentRange[0]} to ${this.currentRange[1]}`:String(this.currentValue)),this.containerEl.setAttribute("aria-disabled",String(i)),this.containerEl.setAttribute("aria-readonly",String(n)),this.containerEl.setAttribute("tabindex",i||n?"-1":"0")}setThumbPosition(t,e){this.hasAttribute("vertical")?(t.style.left="",t.style.bottom=`${e}%`):(t.style.bottom="",t.style.left=`${e}%`)}valueToPercent(t){const e=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100);return s===e?0:(t-e)/(s-e)*100}percentToValue(t){const e=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100),i=this.getNumberAttr("step",1),n=e+t/100*(s-e);return this.snapToStep(n,e,s,i)}snapToStep(t,e,s,i){const n=Math.round(t/i)*i;return Math.min(s,Math.max(e,n))}clamp(t,e=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100),i=this.getNumberAttr("step",1)){return this.snapToStep(Math.min(s,Math.max(e,t)),e,s,i)}getNumberAttr(t,e){const s=this.getAttribute(t);if(null===s||""===s)return e;const i=Number(s);return Number.isFinite(i)?i:e}normalizeRangeInput(t){if("string"==typeof t)return this.parseRangeAttr(t);if(!Array.isArray(t)||t.length<2)return null;const e=Number(t[0]),s=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null}parseRangeAttr(t){if(!t)return null;if(t.startsWith("[")){try{const e=JSON.parse(t);if(Array.isArray(e)&&2===e.length){const t=Number(e[0]),s=Number(e[1]);if(Number.isFinite(t)&&Number.isFinite(s))return[t,s]}}catch{return null}return null}const e=t.split(",").map(t=>Number(t.trim()));return 2!==e.length||e.some(t=>!Number.isFinite(t))?null:[e[0],e[1]]}parseMarks(){const t=this.getAttribute("marks");if(!t)return[];if(t.startsWith("[")){try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(t=>Number(t)).filter(t=>Number.isFinite(t))}catch{return[]}return[]}return t.split(",").map(t=>Number(t.trim())).filter(t=>Number.isFinite(t))}parseMarkLabels(){const t=this.getAttribute("mark-labels");if(!t)return{};try{const e=JSON.parse(t),s={};return Object.entries(e).forEach(([t,e])=>{s[Number(t)]=e}),s}catch{return{}}}isInteractive(){return!this.hasAttribute("disabled")&&!this.hasAttribute("readonly")}getTrackPercent(t,e){if(!this.trackEl)return 0;const s=this.trackEl.getBoundingClientRect();if(this.hasAttribute("vertical")){const t=Math.max(s.top,Math.min(s.bottom,e));return(s.bottom-t)/s.height*100}return(Math.max(s.left,Math.min(s.right,t))-s.left)/s.width*100}handleThumbPointerDown(t,e){this.isInteractive()&&(t.preventDefault(),this.isDragging=!0,this.activeThumb=e,this.setThumbActive(e,!0),document.addEventListener("pointermove",this.boundPointerMove),document.addEventListener("pointerup",this.boundPointerUp))}handleTrackClick(t){if(!this.isInteractive()||!this.trackEl)return;if(t.target.closest(`.${Ut}__thumb`))return;const e=this.getTrackPercent(t.clientX,t.clientY),s=this.percentToValue(e);this.commitValueAtPosition(s)}handlePointerMove(t){if(!this.isDragging||!this.isInteractive())return;const e=this.getTrackPercent(t.clientX,t.clientY),s=this.percentToValue(e);this.applyDragValue(s)}handlePointerUp(){this.isDragging&&(this.activeThumb&&this.setThumbActive(this.activeThumb,!1),this.isDragging=!1,this.activeThumb=null,document.removeEventListener("pointermove",this.boundPointerMove),document.removeEventListener("pointerup",this.boundPointerUp),this.hasAttribute("range")?this.setAttribute("range",`${this.currentRange[0]},${this.currentRange[1]}`):this.setAttribute("value",String(this.currentValue)),this.syncA11y())}setThumbActive(t,e){if(this.hasAttribute("range")){const s=this.thumbEls["min"===t?0:1];return void s?.classList.toggle(`${Ut}__thumb--active`,e)}this.thumbEls[0]?.classList.toggle(`${Ut}__thumb--active`,e)}applyDragValue(t){const e=this.clamp(t);if(this.hasAttribute("range")){const[t,s]=this.currentRange;if("min"===this.activeThumb)this.currentRange=[Math.min(e,s),s];else if("max"===this.activeThumb)this.currentRange=[t,Math.max(e,t)];else{Math.abs(e-t)<=Math.abs(e-s)?(this.currentRange=[Math.min(e,s),s],this.activeThumb="min"):(this.currentRange=[t,Math.max(e,t)],this.activeThumb="max")}this.syncVisuals(),this.dispatchRangeChange()}else this.currentValue=e,this.syncVisuals(),this.syncA11y(),this.dispatchValueChange()}commitValueAtPosition(t){const e=this.clamp(t);if(this.hasAttribute("range")){const[t,s]=this.currentRange,i=Math.abs(e-t),n=Math.abs(e-s);this.currentRange=i<=n?[Math.min(e,s),s]:[t,Math.max(e,t)],this.setAttribute("range",`${this.currentRange[0]},${this.currentRange[1]}`),this.syncVisuals(),this.dispatchRangeChange()}else this.currentValue=e,this.setAttribute("value",String(this.currentValue)),this.syncVisuals(),this.syncA11y(),this.dispatchValueChange()}handleKeyDown(t,e="single"){if(!this.isInteractive())return;const s=this.getNumberAttr("step",1),i=this.getNumberAttr("min",0),n=this.getNumberAttr("max",100);let a;if(this.hasAttribute("range")&&"single"!==e){const r="min"===e?this.currentRange[0]:this.currentRange[1];switch(t.key){case"ArrowLeft":case"ArrowDown":a=this.clamp(r-s,i,n);break;case"ArrowRight":case"ArrowUp":a=this.clamp(r+s,i,n);break;case"Home":a=i;break;case"End":a=n;break;default:return}const l=[...this.currentRange];if("min"===e?l[0]=a:l[1]=a,l[0]>l[1])return;return t.preventDefault(),this.currentRange=l,void this.afterKeyboard()}if(!this.hasAttribute("range")){switch(t.key){case"ArrowLeft":case"ArrowDown":a=this.clamp(this.currentValue-s,i,n);break;case"ArrowRight":case"ArrowUp":a=this.clamp(this.currentValue+s,i,n);break;case"Home":a=i;break;case"End":a=n;break;default:return}t.preventDefault(),this.currentValue=a,this.afterKeyboard()}}afterKeyboard(){this.hasAttribute("range")?(this.setAttribute("range",`${this.currentRange[0]},${this.currentRange[1]}`),this.syncVisuals(),this.dispatchRangeChange()):(this.setAttribute("value",String(this.currentValue)),this.syncVisuals(),this.syncA11y(),this.dispatchValueChange())}dispatchValueChange(){this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{value:this.currentValue}}))}dispatchRangeChange(){this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{range:[...this.currentRange]}}))}}customElements.get("db-range-slider")||customElements.define("db-range-slider",DbRangeSlider);const Jt="designbase-wc-segment-control",Kt={bar:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="12" width="4" height="8"/><rect x="10" y="8" width="4" height="12"/><rect x="17" y="4" width="4" height="16"/></svg>',line:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 16 9 10 14 13 20 6"/></svg>',pie:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v10l8.66 5"/><circle cx="12" cy="12" r="10"/></svg>',donut:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="3"/></svg>',radar:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 20 8 17 20 7 20 4 8"/></svg>'};class DbSegmentControl extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.indicatorEl=null,this.segmentButtons=[],this.focusedIndex=-1,this.boundKeyDown=t=>this.handleKeyDown(t),this.boundResize=()=>this.updateIndicator(),this.resizeObserver=null}static get observedAttributes(){return["options","value","default-value","size","variant","appearance","full-width","disabled"]}connectedCallback(){this.built||(this.built=!0),this.render(),this.addEventListener("keydown",this.boundKeyDown),window.addEventListener("resize",this.boundResize),this.resizeObserver=new ResizeObserver(()=>this.updateIndicator()),this.resizeObserver.observe(this)}disconnectedCallback(){this.removeEventListener("keydown",this.boundKeyDown),window.removeEventListener("resize",this.boundResize),this.resizeObserver?.disconnect(),this.resizeObserver=null}attributeChangedCallback(t){this.built&&("value"!==t?this.render():this.updateSelection())}get options(){return this.parseOptions(this.getAttribute("options"))}set options(t){this.setAttribute("options","string"==typeof t?t:JSON.stringify(t))}get value(){return this.getAttribute("value")||this.getAttribute("default-value")||this.options[0]?.value||""}set value(t){this.setAttribute("value",t)}parseOptions(t){if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("appearance")||"pill",i=this.hasAttribute("disabled"),n=this.options,a=this.value;this.className=[Jt,`${Jt}--${t}`,`${Jt}--${e}`,"rounded"===s&&`${Jt}--appearance-rounded`,this.hasAttribute("full-width")&&`${Jt}--full-width`,i&&`${Jt}--disabled`].filter(Boolean).join(" "),this.setAttribute("role","tablist"),this.setAttribute("aria-label","세그먼트 컨트롤"),this.replaceChildren(),this.segmentButtons=[],n.forEach((t,s)=>{const n=t.value===a,r=Boolean(i||t.disabled),l=document.createElement("button");if(l.type="button",l.className=[`${Jt}__segment`,n&&`${Jt}__segment--selected`,r&&`${Jt}__segment--disabled`].filter(Boolean).join(" "),l.setAttribute("role","tab"),l.setAttribute("aria-selected",String(n)),l.setAttribute("aria-disabled",String(r)),l.setAttribute("tabindex",n?"0":"-1"),l.disabled=r,t.icon&&Kt[t.icon]){const e=document.createElement("span");e.className=`${Jt}__segment-icon`,e.innerHTML=Kt[t.icon],l.appendChild(e)}const o=document.createElement("span");o.className=`${Jt}__segment-label`,o.textContent=t.label,"icon-only"===e&&o.setAttribute("aria-label",t.label),l.appendChild(o),l.addEventListener("click",()=>this.select(t.value)),l.addEventListener("focus",()=>{this.focusedIndex=s,l.classList.add(`${Jt}__segment--focused`)}),l.addEventListener("blur",()=>{this.focusedIndex=-1,l.classList.remove(`${Jt}__segment--focused`)}),this.appendChild(l),this.segmentButtons.push(l)}),this.indicatorEl=document.createElement("div"),this.indicatorEl.className=`${Jt}__indicator`,this.appendChild(this.indicatorEl),this.updateSelection()}updateSelection(){const t=this.options,e=this.value,s=t.findIndex(t=>t.value===e);this.segmentButtons.forEach((s,i)=>{const n=t[i],a=n?.value===e;s.classList.toggle(`${Jt}__segment--selected`,a),s.setAttribute("aria-selected",String(a)),s.setAttribute("tabindex",a?"0":"-1")}),this.indicatorEl&&t.length>0&&s>=0&&requestAnimationFrame(()=>this.updateIndicator())}updateIndicator(){const t=this.options.findIndex(t=>t.value===this.value),e=this.segmentButtons[t];this.indicatorEl&&e&&(this.indicatorEl.style.width=`${e.offsetWidth}px`,this.indicatorEl.style.transform=`translateX(${e.offsetLeft}px)`)}select(t){if(this.hasAttribute("disabled"))return;const e=this.options.find(e=>e.value===t);e&&!e.disabled&&(this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t},bubbles:!0,composed:!0})))}handleKeyDown(t){if(this.hasAttribute("disabled"))return;const e=this.options,s=e.findIndex(t=>t.value===this.value);if(-1===s)return;let i=s;switch(t.key){case"ArrowLeft":t.preventDefault(),i=s>0?s-1:e.length-1;break;case"ArrowRight":t.preventDefault(),i=s<e.length-1?s+1:0;break;case"Home":t.preventDefault(),i=0;break;case"End":t.preventDefault(),i=e.length-1;break;case"Enter":case" ":return t.preventDefault(),void this.select(e[i]?.value??this.value);default:return}for(;i!==s;){const s=e[i];if(s&&!s.disabled){this.segmentButtons[i]?.focus();break}i="ArrowLeft"===t.key||"Home"===t.key?i>0?i-1:e.length-1:i<e.length-1?i+1:0}}}customElements.get("db-segment-control")||customElements.define("db-segment-control",DbSegmentControl);const Gt="designbase-wc-stepper",Yt=["s","m","l"],Xt={display:"block",width:"100%",minWidth:"0",height:"auto",padding:"0",margin:"0",border:"0",background:"transparent",color:"inherit",fontFamily:"inherit",fontWeight:"600",lineHeight:"1",textAlign:"center",outline:"none",boxShadow:"none",boxSizing:"border-box",appearance:"none"};class DbStepper extends HTMLElement{constructor(){super(...arguments),this.decrementBtn=null,this.incrementBtn=null,this.valueWrapEl=null,this.valueTextEl=null,this.valueInputEl=null,this.descriptionEl=null,this.boundInputKeyDown=t=>this.handleInputKeyDown(t),this.boundInputInput=()=>this.handleInputInput(),this.boundInputPaste=t=>this.handleInputPaste(t),this.boundInputBlur=()=>this.commitInputValue()}static get observedAttributes(){return["value","min","max","step","size","editable","full-width","disabled","readonly"]}connectedCallback(){this.querySelector(`.${Gt}__button`)||this.build(),this.syncFromAttributes()}attributeChangedCallback(t){this.decrementBtn&&this.syncFromAttributes()}get value(){return Number(this.getAttribute("value")||0)}set value(t){this.setAttribute("value",String(t))}build(){this.decrementBtn=document.createElement("button"),this.decrementBtn.type="button",this.decrementBtn.className=`${Gt}__button ${Gt}__button--decrement`,this.decrementBtn.setAttribute("aria-label","감소"),this.decrementBtn.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>',this.valueWrapEl=document.createElement("div"),this.valueWrapEl.className=`${Gt}__value`,this.valueTextEl=document.createElement("span"),this.valueTextEl.className=`${Gt}__value-text`,this.valueWrapEl.appendChild(this.valueTextEl),this.incrementBtn=document.createElement("button"),this.incrementBtn.type="button",this.incrementBtn.className=`${Gt}__button ${Gt}__button--increment`,this.incrementBtn.setAttribute("aria-label","증가"),this.incrementBtn.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>',this.descriptionEl=document.createElement("div"),this.descriptionEl.id="stepper-description",this.descriptionEl.className="sr-only",this.decrementBtn.addEventListener("click",()=>this.change(this.value-this.getStep())),this.incrementBtn.addEventListener("click",()=>this.change(this.value+this.getStep())),this.append(this.decrementBtn,this.valueWrapEl,this.incrementBtn,this.descriptionEl)}isEditable(){return!this.hasAttribute("disabled")&&!this.hasAttribute("readonly")&&"false"!==this.getAttribute("editable")}syncFromAttributes(){const t=this.getAttribute("size")||"m",e=this.hasAttribute("disabled"),s=this.hasAttribute("readonly"),i=this.getMin(),n=this.getMax(),a=this.getStep(),r=this.clamp(this.snapToStep(this.value));if(this.getAttribute("value")!==String(r)&&this.setAttribute("value",String(r)),this.className=[Gt,`${Gt}--${Yt.includes(t)?t:"m"}`,this.hasAttribute("full-width")&&`${Gt}--full-width`,this.isEditable()&&`${Gt}--editable`,e&&`${Gt}--disabled`,s&&`${Gt}--readonly`].filter(Boolean).join(" "),this.syncValueField(r),this.descriptionEl){const t=this.isEditable()?"값을 직접 입력할 수 있습니다. ":"";this.descriptionEl.textContent=`${t}숫자 조정기. +/- 버튼으로 값을 조정할 수 있습니다. 현재 값: ${r}, 최소값: ${i}, 최대값: ${n}, 단계: ${a}`}this.decrementBtn?.setAttribute("aria-describedby","stepper-description"),this.incrementBtn?.setAttribute("aria-describedby","stepper-description"),this.updateButtons()}applyValueInputAppearance(){this.valueInputEl&&(Object.assign(this.valueInputEl.style,Xt),this.valueInputEl.style.setProperty("-webkit-appearance","none"),this.valueInputEl.style.setProperty("-moz-appearance","textfield"))}syncValueField(t){if(this.valueWrapEl){if(this.isEditable())return this.valueInputEl||(this.valueInputEl=document.createElement("input"),this.valueInputEl.className=`${Gt}__value-input`,this.valueInputEl.type="text",this.valueInputEl.setAttribute("inputmode",this.allowsDecimal()?"decimal":"numeric"),this.valueInputEl.setAttribute("pattern",this.buildInputPattern()),this.valueInputEl.setAttribute("aria-label","값 입력"),this.valueInputEl.autocomplete="off",this.valueInputEl.spellcheck=!1,this.valueInputEl.addEventListener("keydown",this.boundInputKeyDown),this.valueInputEl.addEventListener("input",this.boundInputInput),this.valueInputEl.addEventListener("paste",this.boundInputPaste),this.valueInputEl.addEventListener("blur",this.boundInputBlur),this.applyValueInputAppearance()),this.applyValueInputAppearance(),this.valueInputEl.setAttribute("inputmode",this.allowsDecimal()?"decimal":"numeric"),this.valueInputEl.setAttribute("pattern",this.buildInputPattern()),this.valueInputEl.setAttribute("aria-valuemin",String(this.getMin())),this.valueInputEl.setAttribute("aria-valuemax",String(this.getMax())),this.valueInputEl.disabled=!1,document.activeElement!==this.valueInputEl&&(this.valueInputEl.value=String(t)),this.valueTextEl?.remove(),void(this.valueWrapEl.contains(this.valueInputEl)||this.valueWrapEl.appendChild(this.valueInputEl));this.valueInputEl&&(this.valueInputEl.removeEventListener("keydown",this.boundInputKeyDown),this.valueInputEl.removeEventListener("input",this.boundInputInput),this.valueInputEl.removeEventListener("paste",this.boundInputPaste),this.valueInputEl.removeEventListener("blur",this.boundInputBlur),this.valueInputEl.remove(),this.valueInputEl=null),this.valueTextEl||(this.valueTextEl=document.createElement("span"),this.valueTextEl.className=`${Gt}__value-text`),this.valueTextEl.textContent=String(t),this.valueWrapEl.contains(this.valueTextEl)||this.valueWrapEl.appendChild(this.valueTextEl)}}allowsNegative(){return this.getMin()<0}allowsDecimal(){const t=this.getStep();return!Number.isInteger(t)}buildInputPattern(){return`^${this.allowsNegative()?"-?":""}\\d*${this.allowsDecimal()?"(\\.\\d*)?":""}$`}sanitizeInputString(t){let e="",s=!1,i=!1;for(let n=0;n<t.length;n++){const a=t[n];"-"!==a||!this.allowsNegative()||0!==e.length||s?"."!==a||!this.allowsDecimal()||i?/\d/.test(a)&&(e+=a):(e+=a,i=!0):(e+=a,s=!0)}return e}parseInputValue(t){const e=t.trim();if(""===e||"-"===e||"."===e)return null;const s=Number(e);return Number.isFinite(s)?s:null}enforceInputBounds(t,e={}){const s=this.sanitizeInputString(t),i=this.parseInputValue(s);if(null===i)return s;const n=this.getMin(),a=this.getMax();return i>a?String(a):e.clampMin&&i<n?String(n):s}handleInputKeyDown(t){if(!["Backspace","Delete","Tab","Escape","ArrowLeft","ArrowRight","Home","End"].includes(t.key)){if("Enter"===t.key)return t.preventDefault(),this.commitInputValue(),void this.valueInputEl?.blur();if("-"===t.key&&this.allowsNegative()){const t=this.valueInputEl;if(t&&0===t.selectionStart&&0===t.selectionEnd&&!t.value.includes("-"))return}"."===t.key&&this.allowsDecimal()&&!this.valueInputEl?.value.includes(".")||/^\d$/.test(t.key)||t.preventDefault()}}handleInputInput(){if(!this.valueInputEl)return;const t=this.enforceInputBounds(this.valueInputEl.value);this.valueInputEl.value!==t&&(this.valueInputEl.value=t)}handleInputPaste(t){if(t.preventDefault(),!this.valueInputEl)return;const e=t.clipboardData?.getData("text")??"",s=this.enforceInputBounds(this.sanitizeInputString(this.valueInputEl.value+e));this.valueInputEl.value=s,this.handleInputInput()}commitInputValue(){if(!this.valueInputEl||!this.isEditable())return;const t=this.valueInputEl.value.trim();if(""===t||"-"===t||"."===t)return void(this.valueInputEl.value=String(this.value));const e=this.parseInputValue(t);if(null===e)return void(this.valueInputEl.value=String(this.value));const s=this.snapToStep(e);this.valueInputEl.value=String(s),this.change(s)}getMin(){return Number(this.getAttribute("min")??0)}getMax(){return Number(this.getAttribute("max")??100)}getStep(){return Number(this.getAttribute("step")??1)}snapToStep(t){const e=this.getStep(),s=Math.round(t/e)*e;return this.clamp(s)}clamp(t){return Math.max(this.getMin(),Math.min(this.getMax(),t))}updateButtons(){const t=this.getMin(),e=this.getMax(),s=this.hasAttribute("disabled"),i=this.hasAttribute("readonly"),n=this.value,a=n<=t,r=n>=e;if(this.decrementBtn){const t=s||i||a;this.decrementBtn.disabled=t,this.decrementBtn.classList.toggle(`${Gt}__button--disabled`,t)}if(this.incrementBtn){const t=s||i||r;this.incrementBtn.disabled=t,this.incrementBtn.classList.toggle(`${Gt}__button--disabled`,t)}}change(t){if(this.hasAttribute("disabled")||this.hasAttribute("readonly"))return;const e=this.getMin(),s=this.getMax(),i=this.clamp(this.snapToStep(t)),n=this.value;if(i!==n){if(this.setAttribute("value",String(i)),this.valueTextEl&&(this.valueTextEl.textContent=String(i)),this.valueInputEl&&(this.valueInputEl.value=String(i)),this.updateButtons(),this.descriptionEl){const t=this.getStep(),n=this.isEditable()?"값을 직접 입력할 수 있습니다. ":"";this.descriptionEl.textContent=`${n}숫자 조정기. +/- 버튼으로 값을 조정할 수 있습니다. 현재 값: ${i}, 최소값: ${e}, 최대값: ${s}, 단계: ${t}`}this.dispatchEvent(new CustomEvent("db-change",{detail:{value:i,minReached:i<=e,maxReached:i>=s},bubbles:!0,composed:!0})),i<=e&&n>e&&this.dispatchEvent(new CustomEvent("db-min-reached",{bubbles:!0,composed:!0,detail:{value:i}})),i>=s&&n<s&&this.dispatchEvent(new CustomEvent("db-max-reached",{bubbles:!0,composed:!0,detail:{value:i}}))}else this.valueInputEl&&(this.valueInputEl.value=String(i))}}customElements.get("db-stepper")||customElements.define("db-stepper",DbStepper);const Zt=["s","m","l","xl","full"],Qt=["none","s","m","l","xl"];class DbContainer extends HTMLElement{static get observedAttributes(){return["size","padding","max-width","full-width"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const t=this.getAttribute("size")||"l",e=this.getAttribute("padding")||"m",s=this.getAttribute("max-width");this.className=["designbase-wc-container",`designbase-wc-container--size-${Zt.includes(t)?t:"l"}`,Qt.includes(e)&&`designbase-wc-container--padding-${e}`,this.hasAttribute("full-width")&&"designbase-wc-container--full-width"].filter(Boolean).join(" "),this.hasAttribute("full-width")?this.style.maxWidth="100%":s?this.style.maxWidth=s.includes("px")||s.includes("%")?s:`${s}px`:this.style.removeProperty("max-width")}}customElements.get("db-container")||customElements.define("db-container",DbContainer);const te=["vertical","horizontal"],ee=["start","center","end","stretch"],se=["start","center","end","space-between","space-around","space-evenly"],ie=["none","xs","s","m","l","xl"];class DbStack extends HTMLElement{static get observedAttributes(){return["direction","alignment","justify","spacing","full-width","full-height","wrap"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const t=this.getAttribute("direction")||"vertical",e=this.getAttribute("alignment")||"start",s=this.getAttribute("justify")||"start",i=this.getAttribute("spacing")||"m",n=ie.includes(i)?i:"m";this.className=["designbase-wc-stack",`designbase-wc-stack--direction-${te.includes(t)?t:"vertical"}`,`designbase-wc-stack--alignment-${ee.includes(e)?e:"start"}`,`designbase-wc-stack--justify-${se.includes(s)?s:"start"}`,`designbase-wc-stack--spacing-${{none:"none",xs:"xs",s:"sm",m:"md",l:"lg",xl:"xl"}[n]||"md"}`,this.hasAttribute("full-width")&&"designbase-wc-stack--full-width",this.hasAttribute("full-height")&&"designbase-wc-stack--full-height",this.hasAttribute("wrap")&&"designbase-wc-stack--wrap"].filter(Boolean).join(" ")}}customElements.get("db-stack")||customElements.define("db-stack",DbStack);class DbGrid extends HTMLElement{static get observedAttributes(){return["columns","gap","fixed","no-padding","full-width"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const t=Math.max(1,Number(this.getAttribute("columns")||12)),e=this.getAttribute("gap")||"m",s=["none","xs","s","m","l","xl"].includes(e)?e:"m",i={none:"0",xs:"var(--db-gap-xs)",s:"var(--db-gap-s)",m:"var(--db-gap-m)",l:"var(--db-gap-l)",xl:"var(--db-gap-xl)"};this.className=["designbase-wc-grid",`designbase-wc-grid--gap-${s}`,this.hasAttribute("fixed")&&"designbase-wc-grid--fixed",this.hasAttribute("no-padding")&&"designbase-wc-grid--no-padding",this.hasAttribute("full-width")&&"designbase-wc-grid--full-width"].filter(Boolean).join(" "),this.style.setProperty("--db-wc-grid-columns",String(t)),this.style.display="grid",this.style.gridTemplateColumns=`repeat(${t}, minmax(0, 1fr))`,this.style.gap=i[s]||i.m,this.style.alignItems="start"}}class DbGridItem extends HTMLElement{static get observedAttributes(){return["span","span-sm","span-md","span-lg","span-xl"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const parseSpan=(t,e=12)=>{const s=Number(t??e);return Math.min(12,Math.max(1,Number.isFinite(s)?s:e))},t=parseSpan(this.getAttribute("span")),e=parseSpan(this.getAttribute("span-sm"),t),s=parseSpan(this.getAttribute("span-md"),e),i=parseSpan(this.getAttribute("span-lg"),s),n=parseSpan(this.getAttribute("span-xl"),i);this.className="designbase-wc-grid__item",this.style.gridColumn=`span ${t}`,this.style.setProperty("--db-wc-grid-item-span",String(t)),this.style.setProperty("--db-wc-grid-item-span-sm",String(e)),this.style.setProperty("--db-wc-grid-item-span-md",String(s)),this.style.setProperty("--db-wc-grid-item-span-lg",String(i)),this.style.setProperty("--db-wc-grid-item-span-xl",String(n))}}customElements.get("db-grid")||customElements.define("db-grid",DbGrid),customElements.get("db-grid-item")||customElements.define("db-grid-item",DbGridItem);class DbToolbar extends HTMLElement{static get observedAttributes(){return["items","size","variant","position","full-width","shadow","rounded","fixed"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.render()}attributeChangedCallback(t){"items"!==t?this.syncHostClasses():this.render()}syncHostClasses(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("position")||"top";this.className=["designbase-wc-toolbar",`designbase-wc-toolbar--size-${t}`,`designbase-wc-toolbar--variant-${e}`,`designbase-wc-toolbar--position-${s}`,this.hasAttribute("full-width")&&"designbase-wc-toolbar--full-width",this.hasAttribute("fixed")&&"designbase-wc-toolbar--fixed",this.hasAttribute("shadow")&&"designbase-wc-toolbar--shadow",this.hasAttribute("rounded")&&"designbase-wc-toolbar--rounded"].filter(Boolean).join(" ")}render(){this.syncHostClasses(),this.setAttribute("role","toolbar");let t=this.querySelector(".designbase-wc-toolbar__content");t?t.replaceChildren():(t=document.createElement("div"),t.className="designbase-wc-toolbar__content",this.replaceChildren(t));const e=document.createElement("div");e.className="designbase-wc-toolbar__group",t.append(e),this.items.forEach(t=>{if("separator"===t.type){const t=document.createElement("div");return t.className="designbase-wc-toolbar__item designbase-wc-toolbar__item--separator",t.setAttribute("role","separator"),void e.append(t)}const s=document.createElement("button");s.type="button",s.className=["designbase-wc-toolbar__item","designbase-wc-toolbar__item--button",t.active&&"designbase-wc-toolbar__item--active",t.disabled&&"designbase-wc-toolbar__item--disabled"].filter(Boolean).join(" "),s.textContent=t.label||t.id,s.disabled=Boolean(t.disabled),t.tooltip&&(s.title=t.tooltip),s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:t},bubbles:!0,composed:!0}))}),e.append(s)})}}customElements.get("db-toolbar")||customElements.define("db-toolbar",DbToolbar);const ne="designbase-wc-form";class DbForm extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.formEl=null,this.headerEl=null,this.fieldsEl=null,this.actionsEl=null,this.submitBtn=null,this.resetBtn=null,this.values={},this.errors={},this.touched={},this.initialValues={},this.fieldWrappers=new Map,this.boundSubmit=t=>this.handleSubmit(t),this.boundReset=t=>this.handleReset(t)}static get observedAttributes(){return["fields","columns","size","variant","title","description","submit-text","reset-text","show-reset","submit-loading","submit-disabled","initial-values"]}connectedCallback(){this.built||(this.buildShell(),this.built=!0),this.bootstrapValues(),this.syncAll()}attributeChangedCallback(t){this.built&&("initial-values"===t&&this.bootstrapValues(),"fields"===t&&this.bootstrapValues(),this.syncAll())}get fields(){return this.parseFields(this.getAttribute("fields"))}set fields(t){this.setAttribute("fields","string"==typeof t?t:JSON.stringify(t))}parseFields(t){if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}parseInitialValues(){const t=this.getAttribute("initial-values");if(!t)return{};try{const e=JSON.parse(t);return e&&"object"==typeof e?e:{}}catch{return{}}}bootstrapValues(){this.initialValues=this.parseInitialValues();const t={...this.initialValues};this.fields.forEach(e=>{void 0===t[e.name]&&(void 0===e.value?void 0===e.defaultValue?"checkbox"===e.type&&e.checkboxGroup?t[e.name]=[]:"checkbox"!==e.type?t[e.name]="":t[e.name]=!1:t[e.name]=e.defaultValue:t[e.name]=e.value)}),this.values=t}buildShell(){this.formEl=document.createElement("form"),this.formEl.className=`${ne}__native`,this.formEl.noValidate=!0,this.formEl.addEventListener("submit",this.boundSubmit),this.headerEl=document.createElement("div"),this.headerEl.className=`${ne}__header`,this.fieldsEl=document.createElement("div"),this.fieldsEl.className=`${ne}__fields`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${ne}__actions`,this.submitBtn=document.createElement("db-button"),this.submitBtn.setAttribute("type","submit"),this.submitBtn.setAttribute("variant","primary"),this.resetBtn=document.createElement("db-button"),this.resetBtn.setAttribute("type","button"),this.resetBtn.setAttribute("variant","secondary"),this.resetBtn.addEventListener("click",this.boundReset),this.actionsEl.append(this.submitBtn,this.resetBtn),this.formEl.append(this.fieldsEl,this.actionsEl),this.append(this.headerEl,this.formEl)}syncAll(){this.syncClasses(),this.syncHeader(),this.renderFields(),this.syncActions()}syncClasses(){const t=this.getAttribute("columns")||"1",e=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"default";this.className=[ne,`${ne}--columns-${t}`,`${ne}--${e}`,`${ne}--${s}`,this.hasAttribute("submit-loading")&&`${ne}--loading`].filter(Boolean).join(" ")}syncHeader(){if(!this.headerEl)return;const t=this.getAttribute("title")||"",e=this.getAttribute("description")||"";if(this.headerEl.innerHTML="",t||e){if(this.headerEl.hidden=!1,t){const e=document.createElement("h3");e.className=`${ne}__title`,e.textContent=t,this.headerEl.appendChild(e)}if(e){const t=document.createElement("p");t.className=`${ne}__description`,t.textContent=e,this.headerEl.appendChild(t)}}else this.headerEl.hidden=!0}syncActions(){const t=this.getAttribute("submit-text")||"제출",e=this.getAttribute("reset-text")||"리셋",s=this.hasAttribute("show-reset");this.submitBtn&&(this.submitBtn.textContent=t,this.hasAttribute("submit-loading")?this.submitBtn.setAttribute("loading",""):this.submitBtn.removeAttribute("loading"),this.hasAttribute("submit-disabled")?this.submitBtn.setAttribute("disabled",""):this.submitBtn.removeAttribute("disabled")),this.resetBtn&&(this.resetBtn.textContent=e,this.resetBtn.hidden=!s)}renderFields(){if(!this.fieldsEl)return;const t=this.getAttribute("size")||"m";this.fieldsEl.innerHTML="",this.fieldWrappers.clear(),this.fields.forEach(e=>{const s=document.createElement("div");if(s.className=`${ne}__field-wrapper ${ne}__field-wrapper--${e.type||"text"}`,s.dataset.field=e.name,e.label&&("checkbox"!==e.type||e.checkboxGroup)){const t=document.createElement("label");if(t.className=`${ne}__label`,t.htmlFor=`db-form-${e.name}`,t.textContent=e.label,e.required||e.validation?.required){const e=document.createElement("span");e.className=`${ne}__required`,e.textContent="*",e.setAttribute("aria-hidden","true"),t.appendChild(e)}s.appendChild(t)}s.appendChild(this.createFieldControl(e,t)),this.fieldsEl.appendChild(s),this.fieldWrappers.set(e.name,s),this.refreshFieldState(e.name)})}refreshFieldState(t){const e=this.fields.find(e=>e.name===t),s=this.fieldWrappers.get(t);if(!e||!s)return;const i=Boolean(this.touched[t]&&this.errors[t]);s.classList.toggle(`${ne}__field-wrapper--error`,i),s.querySelector(`.${ne}__error`)?.remove(),s.querySelector(`.${ne}__help`)?.remove();const n=s.querySelector(`.${ne}__field, db-input, db-textarea, db-select, db-checkbox`);if(n&&(i?(n.setAttribute("error",""),n.setAttribute("error-message",this.errors[t])):(n.removeAttribute("error"),n.removeAttribute("error-message"))),i){const e=document.createElement("div");return e.className=`${ne}__error`,e.textContent=this.errors[t],void s.appendChild(e)}if(e.helpText){const t=document.createElement("div");t.className=`${ne}__help`,t.textContent=e.helpText,s.appendChild(t)}}refreshAllFieldStates(){this.fields.forEach(t=>this.refreshFieldState(t.name))}createFieldControl(t,e){const s=t.type||"text",i=this.values[t.name],n=Boolean(this.touched[t.name]&&this.errors[t.name]),a=n?this.errors[t.name]:"";if("textarea"===s){const s=document.createElement("db-textarea");return s.className=`${ne}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",e),s.setAttribute("full-width",""),t.placeholder&&s.setAttribute("placeholder",t.placeholder),void 0!==i&&s.setAttribute("value",String(i)),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),t.maxLength&&s.setAttribute("max-length",String(t.maxLength)),n&&(s.setAttribute("error",""),s.setAttribute("error-message",a)),s.addEventListener("db-change",e=>{const s=e.detail;this.handleFieldChange(t,s.value)}),s.addEventListener("db-input",e=>{const s=e.detail;this.handleFieldChange(t,s.value,!1)}),s}if("select"===s){const s=document.createElement("db-select");return s.className=`${ne}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",e),s.setAttribute("full-width",""),t.placeholder&&s.setAttribute("placeholder",t.placeholder),t.options&&s.setAttribute("options",JSON.stringify(t.options)),t.multiple&&s.setAttribute("multiple",""),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),void 0!==i&&s.setAttribute("value",Array.isArray(i)?JSON.stringify(i):String(i)),n&&(s.setAttribute("error",""),s.setAttribute("error-message",a)),s.addEventListener("db-change",e=>{const s=e.detail;this.handleFieldChange(t,s.value)}),s}if("radio"===s&&t.radioGroup){const s=document.createElement("div");return s.className=`${ne}__radio-group`,s.setAttribute("role","radiogroup"),(t.options||[]).forEach(n=>{const a=document.createElement("db-radio");a.setAttribute("name",t.name),a.setAttribute("value",n.value),a.setAttribute("size",e),i===n.value&&a.setAttribute("checked",""),(t.disabled||n.disabled)&&a.setAttribute("disabled",""),a.textContent=n.label,a.addEventListener("db-change",e=>{e.detail.checked&&this.handleFieldChange(t,n.value)}),s.appendChild(a)}),s}if("checkbox"===s&&t.checkboxGroup){const s=document.createElement("div");s.className=`${ne}__checkbox-group`;const n=Array.isArray(i)?i:[];return(t.options||[]).forEach(i=>{const a=document.createElement("db-checkbox");a.setAttribute("name",t.name),a.setAttribute("value",i.value),a.setAttribute("size",e),n.includes(i.value)&&a.setAttribute("checked",""),(t.disabled||i.disabled)&&a.setAttribute("disabled",""),a.textContent=i.label,a.addEventListener("db-change",e=>{const s=e.detail,n=Array.isArray(this.values[t.name])?[...this.values[t.name]]:[],a=s.checked?[...new Set([...n,i.value])]:n.filter(t=>t!==i.value);this.handleFieldChange(t,a)}),s.appendChild(a)}),s}if("checkbox"===s){const s=document.createElement("db-checkbox");return s.className=`${ne}__field`,s.setAttribute("name",t.name),s.id=`db-form-${t.name}`,s.setAttribute("size",e),i&&s.setAttribute("checked",""),t.disabled&&s.setAttribute("disabled",""),t.readOnly&&s.setAttribute("readonly",""),t.required&&s.setAttribute("required",""),s.textContent=t.label||"",s.addEventListener("db-change",e=>{const s=e.detail;this.handleFieldChange(t,s.checked)}),s}const r=document.createElement("db-input");return r.className=`${ne}__field`,r.setAttribute("name",t.name),r.id=`db-form-${t.name}`,r.setAttribute("type",s),r.setAttribute("size",e),r.setAttribute("full-width",""),t.placeholder&&r.setAttribute("placeholder",t.placeholder),void 0!==i&&!1!==i&&r.setAttribute("value",String(i)),t.disabled&&r.setAttribute("disabled",""),t.readOnly&&r.setAttribute("readonly",""),t.required&&r.setAttribute("required",""),void 0!==t.min&&r.setAttribute("min",String(t.min)),void 0!==t.max&&r.setAttribute("max",String(t.max)),void 0!==t.minLength&&r.setAttribute("minlength",String(t.minLength)),void 0!==t.maxLength&&r.setAttribute("maxlength",String(t.maxLength)),t.pattern&&r.setAttribute("pattern",t.pattern),n&&(r.setAttribute("error",""),r.setAttribute("error-message",a)),r.addEventListener("db-change",e=>{const s=e.detail;this.handleFieldChange(t,s.value)}),r.addEventListener("db-input",e=>{const s=e.detail;this.handleFieldChange(t,s.value,!1)}),r}handleFieldChange(t,e,s=!0){this.values[t.name]=e,s&&(this.touched[t.name]=!0);const i=this.validateField(t,e);this.errors[t.name]=i||"",this.refreshFieldState(t.name),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}validateField(t,e){const s=t.validation||{};if((s.required??t.required)&&(null==e||""===e||!1===e||Array.isArray(e)&&0===e.length))return t.errorMessage||`${t.label||t.name}은(는) 필수입니다.`;if(void 0!==s.min&&Number(e)<s.min)return t.errorMessage||`최소값은 ${s.min}입니다.`;if(void 0!==s.max&&Number(e)>s.max)return t.errorMessage||`최대값은 ${s.max}입니다.`;if(void 0!==s.minLength&&String(e).length<s.minLength)return t.errorMessage||`최소 ${s.minLength}자 이상 입력해주세요.`;if(void 0!==s.maxLength&&String(e).length>s.maxLength)return t.errorMessage||`최대 ${s.maxLength}자까지 입력 가능합니다.`;const i=s.pattern||t.pattern;if(i&&String(e))try{if(!new RegExp(i).test(String(e)))return t.errorMessage||"올바른 형식으로 입력해주세요."}catch{}}validateForm(){let t=!0;return this.fields.forEach(e=>{const s=this.validateField(e,this.values[e.name]);s?(this.errors[e.name]=s,t=!1):this.errors[e.name]=""}),t}handleSubmit(t){t.preventDefault(),this.fields.forEach(t=>{this.touched[t.name]=!0}),this.validateForm()?this.dispatchEvent(new CustomEvent("db-submit",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})):this.refreshAllFieldStates()}handleReset(t){t.preventDefault(),this.values={...this.initialValues},this.bootstrapValues(),this.errors={},this.touched={},this.renderFields(),this.dispatchEvent(new CustomEvent("db-reset",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}}customElements.get("db-form")||customElements.define("db-form",DbForm);const ae=["default","minimal"],le=["center","left"];class DbPageHeader extends HTMLElement{constructor(){super(...arguments),this.internalTabId="",this.handleBack=()=>{const t=new CustomEvent("db-back",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||function navigatePageHeaderBack(t="/"){if("undefined"==typeof window)return;const e=window.history.state?.idx;if("number"==typeof e&&e>0)return void window.history.back();(()=>{try{return!!document.referrer&&new URL(document.referrer).origin===window.location.origin}catch{return!1}})()||window.history.length>1?window.history.back():window.location.assign(t)}(this.getAttribute("back-fallback-href")||"/")},this.handleTabChange=t=>{const e=t.detail,s=e?.selectedId??this.parseTabs()[e?.index??0]?.id??String(e?.index??0);this.hasAttribute("selected-tab-id")||(this.internalTabId=s),this.dispatchEvent(new CustomEvent("db-tab-change",{bubbles:!0,composed:!0,detail:{tabId:s}}))}}static get observedAttributes(){return["title","subtitle","description","breadcrumbs","variant","show-back-button","back-fallback-href","back-label","tabs","selected-tab-id","default-selected-tab-id","align"]}connectedCallback(){this.syncDefaultTab(),this.render()}attributeChangedCallback(t){this.isConnected&&("default-selected-tab-id"!==t&&"tabs"!==t||this.syncDefaultTab(),this.render())}syncDefaultTab(){if(this.internalTabId)return;const t=this.parseTabs(),e=this.getAttribute("default-selected-tab-id");this.internalTabId=e||t[0]?.id||""}parseTabs(){try{const t=JSON.parse(this.getAttribute("tabs")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}parseBreadcrumbs(){try{const t=JSON.parse(this.getAttribute("breadcrumbs")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}getActiveTabId(){return this.getAttribute("selected-tab-id")||this.internalTabId}getVariant(){const t=this.getAttribute("variant")||"default";return ae.includes(t)?t:"default"}getAlign(){const t=this.getAttribute("align")||"center";return le.includes(t)?t:"center"}collectActions(){const t=Array.from(this.querySelectorAll(':scope > [slot="actions"]'));if(t.length)return t;const e=this.querySelector(":scope > .designbase-wc-page-header__cta")||this.querySelector(":scope > .designbase-wc-page-header__actions");return e?Array.from(e.children):[]}collectDescriptionSlot(){const t=this.querySelector(':scope > [slot="description"]');if(t)return t;const e=this.querySelector(":scope .designbase-wc-page-header__description"),s=e?.firstElementChild;return s||null}renderTitleBlock(t){const e=document.createDocumentFragment(),s=this.getAttribute("title")||"",i=this.getAttribute("subtitle"),n=document.createElement("h1");if(n.className="designbase-wc-page-header__title",n.textContent=s,e.append(n),i){const t=document.createElement("h2");t.className="designbase-wc-page-header__subtitle",t.textContent=i,e.append(t)}const a=this.getAttribute("description");if(t||a){const s=document.createElement("div");s.className="designbase-wc-page-header__description",t?s.append(t):s.textContent=a,e.append(s)}return e}render(){const t=this.collectActions(),e=this.collectDescriptionSlot(),s="minimal"===this.getVariant(),i=this.getAlign(),n=this.parseBreadcrumbs(),a=this.parseTabs(),r=a.length>0,l=this.hasAttribute("show-back-button");if(this.className=["designbase-wc-page-header",s?"designbase-wc-page-header--minimal":`designbase-wc-page-header--${i}`].filter(Boolean).join(" "),this.replaceChildren(),n.length){const t=document.createElement("div");t.className="designbase-wc-page-header__breadcrumbs";const e=document.createElement("db-breadcrumbs");e.setAttribute("size","s"),e.setAttribute("items",JSON.stringify(n)),t.append(e),this.append(t)}const o=document.createElement("div");o.className="designbase-wc-page-header__main";const d=document.createElement("div");if(d.className="designbase-wc-page-header__content",s&&l){const t=document.createElement("div");t.className="designbase-wc-page-header__title-row";const s=document.createElement("db-button");s.className="designbase-wc-page-header__back-button",s.setAttribute("variant","tertiary"),s.setAttribute("size","m"),s.setAttribute("icon-only",""),s.setAttribute("start-icon","chevron-left"),s.setAttribute("aria-label",this.getAttribute("back-label")||"뒤로가기"),s.setAttribute("tooltip",this.getAttribute("back-label")||"뒤로가기"),s.addEventListener("db-click",this.handleBack),t.append(s);const i=document.createElement("div");i.className="designbase-wc-page-header__title-group",i.append(this.renderTitleBlock(e)),t.append(i),d.append(t)}else d.append(this.renderTitleBlock(e));if(o.append(d),s&&t.length){const e=document.createElement("div");e.className="designbase-wc-page-header__cta",t.forEach(t=>e.append(t)),o.append(e)}if(this.append(o),!s&&t.length){const e=document.createElement("div");e.className="designbase-wc-page-header__actions",t.forEach(t=>e.append(t)),this.append(e)}this.renderMinimalTabs(s,r,a)}renderMinimalTabs(t,e,s){if(!t||!e)return;const i=document.createElement("div");i.className="designbase-wc-page-header__toolbar";const n=document.createElement("div");n.className="designbase-wc-page-header__tabs";const a=document.createElement("db-tabs");a.setAttribute("size","m"),a.setAttribute("items",JSON.stringify(s)),a.setAttribute("selected-id",this.getActiveTabId()),a.addEventListener("db-change",this.handleTabChange),n.append(a),i.append(n),this.append(i)}}customElements.get("db-page-header")||customElements.define("db-page-header",DbPageHeader);const oe=["s","m","l","xl"];class DbSection extends HTMLElement{constructor(){super(...arguments),this.contentId=`db-section-${Math.random().toString(36).slice(2,9)}`,this.internalExpanded=!0,this.internalTabId="",this.handleToggle=()=>{if(!this.isCollapsible())return;const t=!this.isExpanded();this.hasAttribute("expanded")||(this.internalExpanded=t),this.dispatchEvent(new CustomEvent("db-expanded-change",{bubbles:!0,composed:!0,detail:{expanded:t}})),this.hasAttribute("expanded")||(this.syncHostClasses(),this.syncCollapsibleState())},this.handleTabChange=t=>{const e=t.detail,s=e?.id??this.parseTabs()[e?.index??0]?.id??String(e?.index??0);this.internalTabId=s,this.tabsEl?.setAttribute("selected-id",s),this.dispatchEvent(new CustomEvent("db-tab-change",{bubbles:!0,composed:!0,detail:{tabId:s}}))}}static get observedAttributes(){return["title","subtitle","description","size","collapsible","default-expanded","expanded","no-padding","full-width","full-height","overflow-visible","tabs","selected-tab-id","default-selected-tab-id"]}connectedCallback(){this.internalExpanded="false"!==this.getAttribute("default-expanded"),this.syncDefaultTab(),this.ensureStructure(),this.sync(),this.observer=new MutationObserver(()=>this.sync()),this.observer.observe(this,{childList:!0})}disconnectedCallback(){this.observer?.disconnect()}attributeChangedCallback(t){if(this.isConnected){if("default-expanded"!==t||this.hasAttribute("expanded")||(this.internalExpanded="false"!==this.getAttribute("default-expanded")),"default-selected-tab-id"!==t&&"tabs"!==t||this.syncDefaultTab(),"selected-tab-id"===t){const t=this.getAttribute("selected-tab-id");t&&(this.internalTabId=t)}this.sync()}}syncDefaultTab(){if(this.internalTabId)return;const t=this.parseTabs(),e=this.getAttribute("default-selected-tab-id")||"";this.internalTabId=e||t[0]?.id||""}parseTabs(){try{const t=JSON.parse(this.getAttribute("tabs")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}getActiveTabId(){const t=this.getAttribute("selected-tab-id");return t&&this.internalTabId&&t!==this.internalTabId?this.internalTabId:t||this.internalTabId||this.tabsEl?.getAttribute("selected-id")||""}hasHeaderTabs(){return this.parseTabs().length>0&&!this.isCollapsible()}isCollapsible(){return this.hasAttribute("collapsible")}isExpanded(){return!this.isCollapsible()||(this.hasAttribute("expanded")?"false"!==this.getAttribute("expanded"):this.internalExpanded)}isUserNode(t){return!t.hasAttribute("data-wc-internal")}collectSlotted(t){const e=Array.from(this.querySelectorAll(`:scope > [slot="${t}"]`)).filter(this.isUserNode);if(e.length)return e;if("actions"===t&&this.actionsHostEl)return Array.from(this.actionsHostEl.children);if("footer"===t&&this.footerEl)return Array.from(this.footerEl.children);if("header"===t){const t=this.headerEl?.querySelector(".designbase-wc-section__header-main");return t?Array.from(t.children):[]}if("description"===t){const t=this.headerEl?.querySelector(".designbase-wc-section__description"),e=t?.firstElementChild;return e?[e]:[]}return[]}collectContentNodes(){const t=Array.from(this.children).filter(t=>{if(!this.isUserNode(t))return!1;const e=t.getAttribute("slot");return!e||"default"===e});return t.length?t:this.contentEl?Array.from(this.contentEl.children):[]}ensureStructure(){this.headerEl||(this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section__header",this.headerEl.setAttribute("data-wc-internal","")),this.bodyEl||(this.bodyEl=document.createElement("div"),this.bodyEl.className="designbase-wc-section__body",this.bodyEl.id=this.contentId,this.bodyEl.setAttribute("data-wc-internal",""),this.bodyInnerEl=document.createElement("div"),this.bodyInnerEl.className="designbase-wc-section__body-inner",this.bodyInnerEl.setAttribute("data-wc-internal",""),this.bodyEl.append(this.bodyInnerEl)),this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-section__content",this.contentEl.setAttribute("data-wc-internal","")),this.footerEl||(this.footerEl=document.createElement("div"),this.footerEl.className="designbase-wc-section__footer",this.footerEl.setAttribute("data-wc-internal","")),this.headerEl.isConnected||this.append(this.headerEl)}mountBody(){const t=this.collectContentNodes(),e=this.collectSlotted("footer");if(this.contentEl.replaceChildren(...t),this.footerEl.replaceChildren(...e),this.footerEl.hidden=0===e.length,this.isCollapsible())return this.bodyInnerEl.replaceChildren(this.contentEl,this.footerEl),void(this.bodyEl.isConnected||this.append(this.bodyEl));this.bodyEl?.remove(),this.contentEl.isConnected||this.append(this.contentEl),e.length?this.footerEl.isConnected||this.append(this.footerEl):this.footerEl.remove()}getChevronSize(){const t=this.getAttribute("size")||"m";return"s"===t?16:"l"===t||"xl"===t?24:20}createTitleArea(){const t=this.getAttribute("title"),e=this.getAttribute("subtitle"),s=this.getAttribute("description"),i=this.collectSlotted("description")[0];if(!(t||e||s||i))return null;const n=document.createElement("div");if(n.className="designbase-wc-section__title-area",t){const e=document.createElement("h2");e.className="designbase-wc-section__title",e.textContent=t,n.append(e)}if(e){const t=document.createElement("h3");t.className="designbase-wc-section__subtitle",t.textContent=e,n.append(t)}if(i){const t=document.createElement("p");t.className="designbase-wc-section__description",t.append(i),n.append(t)}else if(s){const t=document.createElement("p");t.className="designbase-wc-section__description",t.textContent=s,n.append(t)}return n}createChevron(){const t=document.createElement("span");return t.className="designbase-wc-section__chevron",t.setAttribute("aria-hidden","true"),t.append(createDbIcon("chevron-down",this.getChevronSize())),t}renderHeader(){if(!this.headerEl)return;const t=this.collectSlotted("header")[0],e=this.collectSlotted("actions"),s=this.createTitleArea(),i=this.hasHeaderTabs(),n=Boolean(t||s||e.length);if(this.headerEl.replaceChildren(),this.headerEl.hidden=!n&&!i,this.headerEl.classList.toggle("designbase-wc-section__header--with-tabs",i),!n&&!i)return;if(this.isCollapsible()){if(t){const e=document.createElement("button");e.type="button",e.className="designbase-wc-section__header-trigger",e.setAttribute("aria-expanded",String(this.isExpanded())),e.setAttribute("aria-controls",this.contentId),e.addEventListener("click",this.handleToggle);const s=document.createElement("div");s.className="designbase-wc-section__header-main",s.append(t),e.append(s,this.createChevron()),this.headerEl.append(e)}else{const t=document.createElement("button");t.type="button",t.className="designbase-wc-section__header-trigger",t.setAttribute("aria-expanded",String(this.isExpanded())),t.setAttribute("aria-controls",this.contentId),t.addEventListener("click",this.handleToggle),s&&t.append(s),t.append(this.createChevron()),this.headerEl.append(t),e.length&&(this.actionsHostEl=document.createElement("div"),this.actionsHostEl.className="designbase-wc-section__actions",this.actionsHostEl.addEventListener("click",t=>t.stopPropagation()),e.forEach(t=>this.actionsHostEl.append(t)),this.headerEl.append(this.actionsHostEl))}return}const appendHeaderMain=i=>{t?i.append(t):(s&&i.append(s),e.length&&(this.actionsHostEl=document.createElement("div"),this.actionsHostEl.className="designbase-wc-section__actions",e.forEach(t=>this.actionsHostEl.append(t)),i.append(this.actionsHostEl)))};if(i){const t=document.createElement("div");t.className="designbase-wc-section__header-row",appendHeaderMain(t),this.headerEl.append(t);const e=document.createElement("div");return e.className="designbase-wc-section__header-tabs",this.tabsEl||(this.tabsEl=document.createElement("db-tabs"),this.tabsEl.setAttribute("size","m"),this.tabsEl.addEventListener("db-change",this.handleTabChange)),this.tabsEl.setAttribute("items",JSON.stringify(this.parseTabs())),this.tabsEl.setAttribute("selected-id",this.getActiveTabId()),e.append(this.tabsEl),void this.headerEl.append(e)}appendHeaderMain(this.headerEl)}syncHostClasses(){const t=this.getAttribute("size")||"m",e=oe.includes(t)?t:"m",s=this.isExpanded();this.className=["designbase-wc-section",`designbase-wc-section--size-${e}`,this.hasAttribute("no-padding")&&"designbase-wc-section--no-padding",this.hasHeaderTabs()&&"designbase-wc-section--has-header-tabs",this.hasAttribute("full-width")&&"designbase-wc-section--full-width",this.hasAttribute("full-height")&&"designbase-wc-section--full-height",this.hasAttribute("overflow-visible")&&"designbase-wc-section--overflow-visible",this.isCollapsible()&&"designbase-wc-section--collapsible",this.isCollapsible()&&s&&"designbase-wc-section--expanded",this.isCollapsible()&&!s&&"designbase-wc-section--collapsed"].filter(Boolean).join(" ")}syncCollapsibleState(){if(!this.isCollapsible()||!this.bodyEl)return;const t=this.isExpanded();this.bodyEl.setAttribute("aria-hidden",String(!t));const e=this.headerEl?.querySelector(".designbase-wc-section__header-trigger");e?.setAttribute("aria-expanded",String(t))}sync(){this.ensureStructure(),this.syncHostClasses(),this.renderHeader(),this.mountBody(),this.syncCollapsibleState()}}customElements.get("db-section")||customElements.define("db-section",DbSection);const de=["s","m","l"],ce=["primary","secondary","tertiary"],he={s:12,m:16,l:20},ue={s:"xs",m:"s",l:"m"};class DbFloatingActionButton extends HTMLElement{constructor(){super(...arguments),this.handleClick=t=>{if(this.disabled||this.loading)return t.preventDefault(),void t.stopPropagation();this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))}}static get observedAttributes(){return["size","variant","icon","loading","disabled","aria-label"]}get size(){const t=this.getAttribute("size")||"m";return de.includes(t)?t:"m"}set size(t){this.setAttribute("size",t)}get variant(){const t=this.getAttribute("variant")||"primary";return ce.includes(t)?t:"primary"}set variant(t){this.setAttribute("variant",t)}get loading(){return this.hasAttribute("loading")}set loading(t){this.toggleAttribute("loading",Boolean(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",Boolean(t))}connectedCallback(){"button"!==this.getAttribute("role")&&this.setAttribute("role","button"),this.hasAttribute("type")||this.setAttribute("type","button"),this.addEventListener("click",this.handleClick),this.sync()}disconnectedCallback(){this.removeEventListener("click",this.handleClick)}attributeChangedCallback(){this.isConnected&&this.sync()}resolveIconName(t){if(!t)return;return t in{plus:1,search:1,settings:1,edit:1,close:1}?t:void 0}sync(){this.className=["designbase-wc-fab",`designbase-wc-fab--${this.size}`,`designbase-wc-fab--${this.variant}`,this.disabled&&"designbase-wc-fab--disabled",this.loading&&"designbase-wc-fab--loading"].filter(Boolean).join(" ");const t=this.getAttribute("aria-label")||"Floating action button";this.getAttribute("aria-label")!==t&&this.setAttribute("aria-label",t);const e=String(this.loading);this.getAttribute("aria-busy")!==e&&this.setAttribute("aria-busy",e);const s=String(this.disabled||this.loading);this.getAttribute("aria-disabled")!==s&&this.setAttribute("aria-disabled",s);let i=this.querySelector(":scope > .designbase-wc-fab__icon");if(i||(i=document.createElement("div"),i.className="designbase-wc-fab__icon",this.append(i)),i.replaceChildren(),this.loading){const t=document.createElement("span");return t.className=`designbase-wc-spinner designbase-wc-spinner--circular designbase-wc-spinner--${ue[this.size]}`,t.setAttribute("aria-hidden","true"),t.innerHTML='<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>',void i.append(t)}const n=this.getAttribute("icon"),a=this.resolveIconName(n);if(a)return void i.append(createDbIcon(a,he[this.size]));const r=Array.from(this.children).find(t=>t!==i&&!t.hasAttribute("data-wc-internal"));r&&!r.isConnected&&i.append(r)}}customElements.get("db-floating-action-button")||customElements.define("db-floating-action-button",DbFloatingActionButton);const be={s:40,m:60,l:80,full:100},pe=["default","persistent","temporary","fullscreen"],me=["slide","fade","scale","none"];function resolveHeightPercent(t){if(!t)return be.m;const e=be[t];if(e)return Math.min(100,Math.max(20,e));const s=Number(t);return Number.isFinite(s)?Math.min(100,Math.max(20,s)):be.m}class DbBottomSheet extends HTMLElement{constructor(){super(...arguments),this.sheetHeightPercent=be.m,this.isDragging=!1,this.isVisible=!1,this.isMounted=!1,this.keyHandler=null,this.dragState={active:!1,pointerId:-1,startY:0,startHeight:be.m,lastY:0,lastTime:0},this.handlePointerDown=t=>{"true"!==this.getAttribute("disable-drag")&&0===t.button&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),this.dragState={active:!0,pointerId:t.pointerId,startY:t.clientY,startHeight:this.sheetHeightPercent,lastY:t.clientY,lastTime:Date.now()},this.isDragging=!0,this.syncActiveClasses())},this.handlePointerMove=t=>{const e=this.dragState;if(!e.active||t.pointerId!==e.pointerId)return;t.preventDefault(),e.lastY=t.clientY,e.lastTime=Date.now();const s=window.innerHeight||1,i=(e.startY-t.clientY)/s*100,n=this.getMaxHeightLimit(resolveHeightPercent(this.getAttribute("height")));this.sheetHeightPercent=Math.min(n,Math.max(20,e.startHeight+i)),this.applySheetDimensions()},this.handlePointerUp=t=>{const e=this.dragState;if(!e.active||t.pointerId!==e.pointerId)return;const s=t.currentTarget;s.hasPointerCapture(t.pointerId)&&s.releasePointerCapture(t.pointerId),this.finishDrag()}}static get observedAttributes(){return["open","title","subtitle","height","max-height","variant","disable-backdrop-click","disable-escape-key-down","disable-drag","show-close-button","animation","animation-duration","z-index","show-backdrop","backdrop-blur","backdrop-opacity","sticky-header","sticky-footer"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}shouldMountPortal(){return this.isOpenRequested()||this.isMounted}connectedCallback(){this.style.display="contents",this.childObserver=new MutationObserver(()=>{this.isOpenRequested()&&this.render()}),this.childObserver.observe(this,{childList:!0}),this.syncOpenState()}disconnectedCallback(){this.childObserver?.disconnect(),this.childObserver=void 0,this.clearTimers(),this.detachEscape(),this.root?.remove(),this.root=void 0,document.body.style.overflow=""}attributeChangedCallback(t){this.isConnected&&("open"!==t?("height"===t&&this.isOpenRequested()&&(this.sheetHeightPercent=resolveHeightPercent(this.getAttribute("height"))),this.shouldMountPortal()&&(this.render(),this.isMounted&&this.syncActiveClasses())):this.syncOpenState())}isOpenRequested(){return this.open}clearTimers(){this.enterFrame&&(cancelAnimationFrame(this.enterFrame),this.enterFrame=void 0),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=void 0)}scheduleEnterAnimation(){this.enterFrame&&cancelAnimationFrame(this.enterFrame),this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=void 0,this.isOpenRequested()&&this.sheet&&(this.sheet.offsetHeight,this.isVisible=!0,this.syncActiveClasses())})})}getMaxHeightLimit(t){const e=Number(this.getAttribute("max-height")||0),s=t>=100;return Math.min(100,Math.max(t,e||(s?100:90)))}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}attachEscape(){this.keyHandler||(this.keyHandler=t=>{"Escape"===t.key&&"true"!==this.getAttribute("disable-escape-key-down")&&this.close()},document.addEventListener("keydown",this.keyHandler))}detachEscape(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}collectSlotted(t){const e=Array.from(this.querySelectorAll(`:scope > [slot="${t}"]`));if(e.length)return e;if("header"===t){const t=this.sheet?.querySelector(".designbase-wc-bottom-sheet__header-main");return t?Array.from(t.children):[]}if("footer"===t){const t=this.sheet?.querySelector(".designbase-wc-bottom-sheet__footer");return t?Array.from(t.children):[]}return[]}collectContentNodes(){const t=Array.from(this.children).filter(t=>{const e=t.getAttribute("slot");return!e||"default"===e});return t.length?t:this.contentEl?Array.from(this.contentEl.children):[]}finishDrag(){const t=this.dragState;if(!t.active)return;t.active=!1,this.isDragging=!1;const e=t.lastY-t.startY,s=e/Math.max(1,Date.now()-t.lastTime),i=window.innerHeight||1,n=(t.startY-t.lastY)/i*100,a=this.getMaxHeightLimit(resolveHeightPercent(this.getAttribute("height"))),r=Math.min(a,Math.max(20,t.startHeight+n));r<=22||e>72||s>.6?this.close():(this.sheetHeightPercent=r,this.applySheetDimensions(),this.syncActiveClasses())}syncOpenState(){const t=this.isOpenRequested(),e=Number(this.getAttribute("animation-duration")||400);if(this.clearTimers(),t)return this.sheetHeightPercent=resolveHeightPercent(this.getAttribute("height")),this.render(),this.isMounted=!0,this.isVisible=!1,this.syncActiveClasses(),this.root&&!this.root.isConnected&&document.body.append(this.root),this.scheduleEnterAnimation(),document.body.style.overflow="hidden",void this.attachEscape();this.isVisible=!1,this.syncActiveClasses(),this.exitTimer=setTimeout(()=>{this.exitTimer=void 0,this.detachContentToHost(),this.isMounted=!1,this.syncActiveClasses(),this.root?.remove(),document.body.style.overflow="",this.detachEscape()},e),this.detachEscape()}syncActiveClasses(){if(!this.sheet)return;const t=resolveHeightPercent(this.getAttribute("height")),e=this.getAttribute("variant")||"default",s=this.getAttribute("animation")||"slide",i=pe.includes(e)?e:"default",n=me.includes(s)?s:"slide",a="false"!==this.getAttribute("show-backdrop"),r=this.hasAttribute("sticky-header"),l=this.hasAttribute("sticky-footer");this.sheet.className=["designbase-wc-bottom-sheet",`designbase-wc-bottom-sheet--${i}`,`designbase-wc-bottom-sheet--${n}`,this.isMounted&&this.isVisible&&"designbase-wc-bottom-sheet--open",this.isDragging&&"designbase-wc-bottom-sheet--dragging",r&&"designbase-wc-bottom-sheet--sticky-header",l&&"designbase-wc-bottom-sheet--sticky-footer",!a&&"designbase-wc-bottom-sheet--no-backdrop",(t>=100||this.sheetHeightPercent>=100)&&"designbase-wc-bottom-sheet--full"].filter(Boolean).join(" "),this.backdrop?.classList.toggle("designbase-wc-backdrop--open",this.isMounted&&this.isVisible)}applySheetDimensions(){if(!this.sheet)return;const t=this.getMaxHeightLimit(resolveHeightPercent(this.getAttribute("height")));this.sheet.style.height=`${this.sheetHeightPercent}vh`,this.sheet.style.maxHeight=`${t}vh`}detachContentToHost(){this.contentEl&&Array.from(this.contentEl.children).forEach(t=>this.append(t));const t=this.sheet?.querySelector(".designbase-wc-bottom-sheet__header-main");t&&Array.from(t.children).forEach(t=>{"bottom-sheet-title"!==t.id&&"bottom-sheet-subtitle"!==t.id&&this.append(t)});const e=this.sheet?.querySelector(".designbase-wc-bottom-sheet__footer");e&&Array.from(e.children).forEach(t=>this.append(t))}render(){if(!this.shouldMountPortal())return;const t=this.getAttribute("title"),e=this.getAttribute("subtitle"),s="false"!==this.getAttribute("show-close-button"),i="false"!==this.getAttribute("show-backdrop"),n=this.hasAttribute("backdrop-blur"),a=this.getAttribute("backdrop-opacity")||"0.5",r=this.getAttribute("animation-duration")||"400",l=this.getAttribute("z-index")||"1000",o=this.hasAttribute("sticky-header"),d=this.hasAttribute("sticky-footer"),u=this.collectSlotted("header"),b=this.collectSlotted("footer"),p=this.collectContentNodes();if(this.root||(this.root=document.createElement("div"),this.root.setAttribute("data-wc-internal",""),this.backdrop=document.createElement("div"),this.backdrop.className="designbase-wc-backdrop designbase-wc-backdrop--bottom-sheet",this.backdrop.setAttribute("role","presentation"),this.backdrop.addEventListener("click",t=>{t.target===this.backdrop&&"true"!==this.getAttribute("disable-backdrop-click")&&this.close()}),this.sheet=document.createElement("div"),this.sheet.setAttribute("role","dialog"),this.sheet.setAttribute("aria-modal","true"),this.grabBar=document.createElement("div"),this.grabBar.className="designbase-wc-bottom-sheet__grab-bar",this.grabBar.addEventListener("pointerdown",this.handlePointerDown),this.grabBar.addEventListener("pointermove",this.handlePointerMove),this.grabBar.addEventListener("pointerup",this.handlePointerUp),this.grabBar.addEventListener("pointercancel",this.handlePointerUp),this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-bottom-sheet__content"),this.root.replaceChildren(),i&&this.backdrop&&(this.backdrop.className=["designbase-wc-backdrop","designbase-wc-backdrop--bottom-sheet",n&&"designbase-wc-backdrop--blur"].filter(Boolean).join(" "),this.backdrop.style.setProperty("--backdrop-opacity",a),this.backdrop.style.setProperty("--bottom-sheet-animation-duration",`${r}ms`),this.backdrop.style.zIndex=l,this.backdrop.setAttribute("aria-hidden",String(!this.isOpenRequested())),this.root.append(this.backdrop)),!this.sheet||!this.grabBar||!this.contentEl)return;this.sheet.style.zIndex=String(Number(l)+1),this.sheet.style.setProperty("--bottom-sheet-animation-duration",`${r}ms`),this.applySheetDimensions(),t?this.sheet.setAttribute("aria-labelledby","bottom-sheet-title"):this.sheet.removeAttribute("aria-labelledby"),e?this.sheet.setAttribute("aria-describedby","bottom-sheet-subtitle"):this.sheet.removeAttribute("aria-describedby"),this.sheet.replaceChildren();const m="true"===this.getAttribute("disable-drag");if(this.grabBar.className=["designbase-wc-bottom-sheet__grab-bar",!m&&"designbase-wc-bottom-sheet__grab-bar--draggable"].filter(Boolean).join(" "),this.grabBar.replaceChildren(),!m){const t=document.createElement("div");t.className="designbase-wc-bottom-sheet__handle",t.setAttribute("aria-hidden","true"),this.grabBar.append(t)}this.sheet.append(this.grabBar);if(Boolean(t||e||u.length||s)){const i=document.createElement("div");i.className=["designbase-wc-bottom-sheet__header",o&&"designbase-wc-bottom-sheet__header--sticky"].filter(Boolean).join(" ");const n=document.createElement("div");if(n.className="designbase-wc-bottom-sheet__header-main",u.length)u.forEach(t=>n.append(t));else{if(t){const e=document.createElement("h2");e.id="bottom-sheet-title",e.className="designbase-wc-bottom-sheet__title",e.textContent=t,n.append(e)}if(e){const t=document.createElement("p");t.id="bottom-sheet-subtitle",t.className="designbase-wc-bottom-sheet__subtitle",t.textContent=e,n.append(t)}}if(i.append(n),s){const t=document.createElement("button");t.type="button",t.className="designbase-wc-bottom-sheet__close-button",t.setAttribute("aria-label","닫기"),t.append(createDbIcon("close",20)),t.addEventListener("click",()=>this.close()),i.append(t)}this.sheet.append(i)}if(this.contentEl.replaceChildren(...p),this.sheet.append(this.contentEl),b.length){const t=document.createElement("div");t.className=["designbase-wc-bottom-sheet__footer",d&&"designbase-wc-bottom-sheet__footer--sticky"].filter(Boolean).join(" "),b.forEach(e=>t.append(e)),this.sheet.append(t)}this.root.append(this.sheet),this.isMounted&&!this.root.isConnected&&document.body.append(this.root),this.syncActiveClasses()}}customElements.get("db-bottom-sheet")||customElements.define("db-bottom-sheet",DbBottomSheet);const ge=["vertical","horizontal","both"],ve=["auto","thin","none"];class DbScrollArea extends HTMLElement{static get observedAttributes(){return["direction","scrollbar-style","max-height","max-width","min-height","min-width","full-width","full-height","always-show-scrollbar","scrollbar-color","scrollbar-track-color"]}connectedCallback(){this.ensureStructure(),this.sync(),this.resizeObserver=new ResizeObserver(()=>{this.syncViewportSize(),this.syncScrollState()}),this.resizeObserver.observe(this),this.contentEl&&this.resizeObserver.observe(this.contentEl),this.observer=new MutationObserver(()=>this.syncChildren()),this.observer.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){this.resizeObserver?.disconnect(),this.observer?.disconnect()}attributeChangedCallback(){this.isConnected&&this.sync()}ensureStructure(){this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-scroll-area__content",this.contentEl.setAttribute("data-wc-internal","")),this.contentEl.isConnected||this.append(this.contentEl)}collectContentNodes(){return Array.from(this.children).filter(t=>t!==this.contentEl&&!t.hasAttribute("data-wc-internal"))}syncChildren(){const t=this.collectContentNodes();t.length&&this.contentEl?.append(...t),this.syncScrollState()}toCssSize(t){if(!t)return;if(t.includes("px")||t.includes("%")||t.includes("vh")||t.includes("rem"))return t;const e=Number(t);return Number.isFinite(e)?`${e}px`:t}syncScrollState(){const t=this.contentEl;if(!t)return;const e=t.scrollHeight>t.clientHeight,s=t.scrollWidth>t.clientWidth;this.classList.toggle("designbase-wc-scroll-area--has-vertical",e),this.classList.toggle("designbase-wc-scroll-area--has-horizontal",s)}syncViewportSize(){if(!this.contentEl)return;const t=this.toCssSize(this.getAttribute("max-height"))||this.style.maxHeight||void 0,e=this.toCssSize(this.getAttribute("max-width"))||this.style.maxWidth||void 0,s=this.toCssSize(this.getAttribute("min-height"))||this.style.minHeight||void 0,i=this.toCssSize(this.getAttribute("min-width"))||this.style.minWidth||void 0;this.contentEl.style.maxHeight=t||"",this.contentEl.style.maxWidth=e||"",this.contentEl.style.minHeight=s||"",this.contentEl.style.minWidth=i||""}sync(){this.ensureStructure();const t=this.getAttribute("direction")||"vertical",e=this.getAttribute("scrollbar-style")||"auto",s=ge.includes(t)?t:"vertical",i=ve.includes(e)?e:"auto";this.className=["designbase-wc-scroll-area",`designbase-wc-scroll-area--direction-${s}`,`designbase-wc-scroll-area--scrollbar-${i}`,this.hasAttribute("full-width")&&"designbase-wc-scroll-area--full-width",this.hasAttribute("full-height")&&"designbase-wc-scroll-area--full-height",this.hasAttribute("always-show-scrollbar")&&"designbase-wc-scroll-area--always-show"].filter(Boolean).join(" ");const n=this.getAttribute("scrollbar-color"),a=this.getAttribute("scrollbar-track-color");n?this.style.setProperty("--scrollbar-color",n):this.style.removeProperty("--scrollbar-color"),a?this.style.setProperty("--scrollbar-track-color",a):this.style.removeProperty("--scrollbar-track-color"),this.syncViewportSize(),this.syncChildren()}}customElements.get("db-scroll-area")||customElements.define("db-scroll-area",DbScrollArea);const Ee=["s","m","l"],fe=["default","outlined","filled"];class DbDropzone extends HTMLElement{constructor(){super(...arguments),this.internalDragOver=!1,this.handleFileInputChange=()=>{this.emitFiles(this.fileInput?.files??null),this.fileInput&&(this.fileInput.value="")},this.handleDragOver=t=>{t.preventDefault(),t.stopPropagation(),this.isDisabled()||(this.internalDragOver=!0,this.syncClasses(),this.dispatchEvent(new CustomEvent("db-drag-over",{bubbles:!0,composed:!0,detail:{event:t}})))},this.handleDragLeave=t=>{t.preventDefault(),t.stopPropagation(),this.isDisabled()||(this.internalDragOver=!1,this.syncClasses(),this.dispatchEvent(new CustomEvent("db-drag-leave",{bubbles:!0,composed:!0,detail:{event:t}})))},this.handleDrop=t=>{t.preventDefault(),t.stopPropagation(),this.isDisabled()||(this.internalDragOver=!1,this.syncClasses(),this.emitFiles(t.dataTransfer?.files??null),this.dispatchEvent(new CustomEvent("db-drop",{bubbles:!0,composed:!0,detail:{event:t}})))},this.handleClick=t=>{this.isDisabled()||t.target.closest(".designbase-wc-dropzone__button")||(this.fileInput?.click(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0,detail:{event:t}})))}}static get observedAttributes(){return["size","variant","show-icon","icon","image","title","description","button-text","show-button","accept","max-size","multiple","drag-over","disabled","readonly"]}connectedCallback(){this.ensureInput(),this.sync(),this.addEventListener("dragover",this.handleDragOver),this.addEventListener("dragleave",this.handleDragLeave),this.addEventListener("drop",this.handleDrop),this.addEventListener("click",this.handleClick)}disconnectedCallback(){this.removeEventListener("dragover",this.handleDragOver),this.removeEventListener("dragleave",this.handleDragLeave),this.removeEventListener("drop",this.handleDrop),this.removeEventListener("click",this.handleClick)}attributeChangedCallback(){this.isConnected&&this.sync()}ensureInput(){this.fileInput||(this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.style.display="none",this.fileInput.setAttribute("data-wc-internal",""),this.fileInput.addEventListener("change",this.handleFileInputChange),this.append(this.fileInput))}isDisabled(){return this.hasAttribute("disabled")||this.hasAttribute("readonly")}isDragOver(){return this.hasAttribute("drag-over")?"false"!==this.getAttribute("drag-over"):this.internalDragOver}validateFile(t){const e=this.getAttribute("accept");if(e){const s=e.split(",").map(t=>t.trim()),i=t.type,n=`.${t.name.split(".").pop()?.toLowerCase()}`;if(!s.some(t=>t.startsWith(".")?n===t.toLowerCase():i===t||i.startsWith(t.replace("*",""))))return!1}const s=Number(this.getAttribute("max-size")||0);return!(s>0&&t.size>s)}emitFiles(t){if(!t||0===t.length)return;const e=Array.from(t).filter(t=>this.validateFile(t));e.length&&this.dispatchEvent(new CustomEvent("db-file-select",{bubbles:!0,composed:!0,detail:{files:e}}))}getDescriptionText(){const t=this.getAttribute("description");if(t)return t;const e=this.getAttribute("accept");if(!e)return"모든 파일 형식 지원";let s=e.split(",").map(t=>{const e=t.trim();return e.startsWith(".")?e.toUpperCase():e.includes("*")?e.replace("*","").toUpperCase():e}).join(", ");const i=Number(this.getAttribute("max-size")||0);if(i>0){const t=1024,e=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(t));s+=` (최대 ${`${parseFloat((i/t**n).toFixed(2))} ${e[n]}`})`}return s}collectChildren(){return Array.from(this.children).filter(t=>t!==this.fileInput&&!t.hasAttribute("data-wc-internal"))}syncClasses(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=Ee.includes(t)?t:"m",i=fe.includes(e)?e:"default";this.className=["designbase-wc-dropzone",`designbase-wc-dropzone--size-${s}`,`designbase-wc-dropzone--variant-${i}`,this.isDragOver()&&"designbase-wc-dropzone--drag-over",this.hasAttribute("disabled")&&"designbase-wc-dropzone--disabled",this.hasAttribute("readonly")&&"designbase-wc-dropzone--readonly"].filter(Boolean).join(" ")}sync(){this.ensureInput(),this.syncClasses();const t=this.getAttribute("accept"),e=this.hasAttribute("multiple");this.fileInput&&(t?this.fileInput.setAttribute("accept",t):this.fileInput.removeAttribute("accept"),this.fileInput.toggleAttribute("multiple",e),this.fileInput.disabled=this.isDisabled());const s=this.collectChildren(),i=this.querySelector(":scope > .designbase-wc-dropzone__content[data-wc-internal]");if(s.length)return void i?.remove();let n=i;n||(n=document.createElement("div"),n.className="designbase-wc-dropzone__content",n.setAttribute("data-wc-internal",""),this.append(n)),n.replaceChildren();const a=this.getAttribute("size")||"m",r=Ee.includes(a)?a:"m",l=this.getAttribute("image"),o="false"!==this.getAttribute("show-icon"),d=this.getAttribute("icon")||"gallery",u=this.getAttribute("title")||"파일을 드래그하여 업로드하거나 클릭하여 선택하세요",b=this.getDescriptionText(),p=this.hasAttribute("show-button"),m=this.getAttribute("button-text")||"파일 선택";if(l){const t=document.createElement("div");t.className="designbase-wc-dropzone__image";const e=document.createElement("img");e.src=l,e.alt="Upload illustration",t.append(e),n.append(t)}else if(o){const t=document.createElement("div");t.className="designbase-wc-dropzone__icon";const e="s"===r?32:"l"===r?56:48;t.append(createDbIcon(d,e)),n.append(t)}if(u){const t=document.createElement("div");t.className="designbase-wc-dropzone__title",t.textContent=u,n.append(t)}if(b){const t=document.createElement("div");t.className="designbase-wc-dropzone__description",t.textContent=b,n.append(t)}if(p){const t=document.createElement("button");t.type="button",t.className="designbase-wc-dropzone__button",t.textContent=m,t.disabled=this.isDisabled(),t.addEventListener("click",t=>{t.stopPropagation(),this.isDisabled()||this.fileInput?.click()}),n.append(t)}}}customElements.get("db-dropzone")||customElements.define("db-dropzone",DbDropzone);class DbOnboardingModal extends HTMLElement{constructor(){super(...arguments),this.internalStep=0,this.keyHandler=null,this.isMounted=!1,this.handlePrev=()=>{this.getCurrentStep()>0&&this.goToStep(this.getCurrentStep()-1)},this.handleNext=()=>{const t=this.getSteps(),e=this.getCurrentStep();e>=t.length-1?this.dispatchEvent(new CustomEvent("db-complete",{bubbles:!0,composed:!0})):this.goToStep(e+1)}}static get observedAttributes(){return["open","steps","current-step","show-close-button","show-indicator","indicator-type","indicator-size"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}get steps(){return this.parseSteps()}set steps(t){const e="string"==typeof t?t:JSON.stringify(t);this.getAttribute("steps")!==e&&this.setAttribute("steps",e)}connectedCallback(){this.style.display="contents",this.syncStepFromAttribute(),this.syncOpenState()}disconnectedCallback(){this.detachKeyHandler(),this.unmount()}attributeChangedCallback(t){this.isConnected&&("open"!==t?("current-step"===t&&this.syncStepFromAttribute(),"steps"!==t?this.isMounted&&this.render():this.isOpenRequested()&&(this.isMounted?this.render():this.syncOpenState())):this.syncOpenState())}isOpenRequested(){return this.open}parseSteps(){const t=this.getAttribute("steps");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}syncStepFromAttribute(){if(!this.hasAttribute("current-step"))return;const t=Number(this.getAttribute("current-step")||0);Number.isFinite(t)&&(this.internalStep=Math.max(0,t))}getSteps(){return this.parseSteps()}getCurrentStep(){const t=this.getSteps();return t.length?Math.min(Math.max(this.internalStep,0),t.length-1):0}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}emitStepChange(t){this.dispatchEvent(new CustomEvent("db-step-change",{bubbles:!0,composed:!0,detail:{step:t}}))}goToStep(t){const e=this.getSteps();if(!e.length)return;const s=Math.min(Math.max(t,0),e.length-1);this.internalStep=s,this.emitStepChange(s),this.render()}attachKeyHandler(){this.keyHandler||(this.keyHandler=t=>{"Escape"!==t.key?"ArrowLeft"===t.key&&this.getCurrentStep()>0?this.handlePrev():"ArrowRight"===t.key&&this.getCurrentStep()<this.getSteps().length-1&&this.handleNext():this.close()},document.addEventListener("keydown",this.keyHandler))}detachKeyHandler(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}syncOpenState(){if(this.isOpenRequested())return this.mount(),void this.attachKeyHandler();this.detachKeyHandler(),this.unmount()}mount(){this.root||(this.root=document.createElement("div"),this.root.className="designbase-wc-onboarding-modal",this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.tabIndex=-1,this.ensureStructure()),this.root.isConnected||document.body.append(this.root),this.isMounted=!0,this.render()}unmount(){this.isMounted=!1,this.root?.remove()}ensureStructure(){this.root&&(this.contentEl&&this.root.contains(this.contentEl)||(this.overlayEl=void 0,this.contentEl=void 0,this.closeButtonEl=void 0,this.mainEl=void 0,this.imageWrapEl=void 0,this.imageEl=void 0,this.textEl=void 0,this.titleEl=void 0,this.descriptionEl=void 0,this.navigationEl=void 0,this.prevButtonEl=void 0,this.nextButtonEl=void 0,this.indicatorEl=void 0,this.root.replaceChildren(),this.overlayEl=document.createElement("div"),this.overlayEl.className="designbase-wc-onboarding-modal__overlay",this.overlayEl.addEventListener("click",()=>this.close()),this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-onboarding-modal__content",this.closeButtonEl=document.createElement("button"),this.closeButtonEl.type="button",this.closeButtonEl.className="designbase-wc-onboarding-modal__close-button",this.closeButtonEl.setAttribute("aria-label","닫기"),this.closeButtonEl.append(createDbIcon("close",20)),this.closeButtonEl.addEventListener("click",()=>this.close()),this.mainEl=document.createElement("div"),this.mainEl.className="designbase-wc-onboarding-modal__main",this.imageWrapEl=document.createElement("div"),this.imageWrapEl.className="designbase-wc-onboarding-modal__image",this.imageEl=document.createElement("img"),this.imageWrapEl.append(this.imageEl),this.textEl=document.createElement("div"),this.textEl.className="designbase-wc-onboarding-modal__text",this.titleEl=document.createElement("h2"),this.titleEl.id="onboarding-title",this.titleEl.className="designbase-wc-onboarding-modal__title",this.descriptionEl=document.createElement("p"),this.descriptionEl.id="onboarding-description",this.descriptionEl.className="designbase-wc-onboarding-modal__description",this.textEl.append(this.titleEl,this.descriptionEl),this.mainEl.append(this.imageWrapEl,this.textEl),this.navigationEl=document.createElement("div"),this.navigationEl.className="designbase-wc-onboarding-modal__navigation",this.prevButtonEl=document.createElement("db-button"),this.prevButtonEl.setAttribute("variant","secondary"),this.prevButtonEl.setAttribute("size","m"),this.prevButtonEl.setAttribute("start-icon","chevron-left"),this.prevButtonEl.setAttribute("aria-label","이전"),this.prevButtonEl.addEventListener("db-click",this.handlePrev),this.indicatorEl=document.createElement("db-indicator"),this.indicatorEl.addEventListener("db-step-click",t=>{const e=t.detail;this.goToStep(e.index??e.current)}),this.nextButtonEl=document.createElement("db-button"),this.nextButtonEl.setAttribute("variant","primary"),this.nextButtonEl.setAttribute("size","m"),this.nextButtonEl.addEventListener("db-click",this.handleNext),this.navigationEl.append(this.prevButtonEl,this.indicatorEl,this.nextButtonEl),this.contentEl.append(this.closeButtonEl,this.mainEl,this.navigationEl),this.root.append(this.overlayEl,this.contentEl)))}render(){if(!this.root||!this.isMounted)return;this.ensureStructure();const t=this.getSteps(),e=this.getCurrentStep(),s=t[e];if(!s)return;const i=!this.hasAttribute("show-close-button")||"false"!==this.getAttribute("show-close-button"),n=!this.hasAttribute("show-indicator")||"false"!==this.getAttribute("show-indicator"),a=this.getAttribute("indicator-type")||"dots",r=this.getAttribute("indicator-size")||"m",l=0===e,o=e===t.length-1;if(this.root.setAttribute("aria-labelledby","onboarding-title"),this.root.setAttribute("aria-describedby","onboarding-description"),this.closeButtonEl&&(this.closeButtonEl.style.display=i?"":"none"),this.imageWrapEl&&this.imageEl&&(s.image?(this.imageEl.src=s.image,this.imageEl.alt=s.title||"온보딩 이미지",this.imageWrapEl.style.display=""):this.imageWrapEl.style.display="none"),this.titleEl&&(this.titleEl.textContent=s.title||"",this.titleEl.style.display=s.title?"":"none"),this.descriptionEl&&(this.descriptionEl.textContent=s.description||"",this.descriptionEl.style.display=s.description?"":"none"),this.prevButtonEl&&(this.prevButtonEl.textContent="이전",l?this.prevButtonEl.setAttribute("disabled",""):this.prevButtonEl.removeAttribute("disabled")),this.nextButtonEl&&(this.nextButtonEl.textContent=o?"완료":"다음",this.nextButtonEl.setAttribute("aria-label",o?"완료":"다음"),o?this.nextButtonEl.removeAttribute("end-icon"):this.nextButtonEl.setAttribute("end-icon","chevron-right")),this.indicatorEl){const s=n&&t.length>1;this.indicatorEl.style.display=s?"":"none",s&&(this.indicatorEl.setAttribute("total",String(t.length)),this.indicatorEl.setAttribute("current",String(e)),this.indicatorEl.setAttribute("indicator-type",a),this.indicatorEl.setAttribute("size",r),this.indicatorEl.setAttribute("clickable",""))}}}customElements.get("db-onboarding-modal")||customElements.define("db-onboarding-modal",DbOnboardingModal);class DbSplitView extends HTMLElement{constructor(){super(...arguments),this.panelSizes=[],this.draggingIndex=null,this.panelSources=[],this.isSyncing=!1,this.isObserving=!1,this.handleMouseDown=t=>e=>{e.preventDefault(),this.draggingIndex=t,document.body.style.cursor="horizontal"===this.getDirection()?"col-resize":"row-resize",document.body.style.userSelect="none"},this.handleMouseMove=t=>{if(null===this.draggingIndex)return;if(!this.panelSources.length)return;const e=this.getDirection(),s=this.getMode(),i=this.getSplitterSize(),n=this.getBoundingClientRect(),a=this.panelSources[this.draggingIndex];if(!a)return;const r=this.readPanelConfig(a,this.draggingIndex,this.panelSources.length);let l=this.panelSizes[this.draggingIndex];if("horizontal"===e){const e=n.width,a=t.clientX-n.left;let o=0;for(let t=0;t<this.draggingIndex;t++){const n=this.panelSizes[t];o+="fixed"===s?n:n*e,o+=i}const d=a-o;if("fixed"===s)l=Math.max(r.minSize||0,Math.min(r.maxSize||e,d));else{l=d/e;const t=r.minSize?r.minSize/e:0,s=r.maxSize?r.maxSize/e:1;l=Math.max(t,Math.min(s,l))}}else{const e=n.height,a=t.clientY-n.top;let o=0;for(let t=0;t<this.draggingIndex;t++){const n=this.panelSizes[t];o+="fixed"===s?n:n*e,o+=i}const d=a-o;if("fixed"===s)l=Math.max(r.minSize||0,Math.min(r.maxSize||e,d));else{l=d/e;const t=r.minSize?r.minSize/e:0,s=r.maxSize?r.maxSize/e:1;l=Math.max(t,Math.min(s,l))}}this.panelSizes[this.draggingIndex]=l,this.applyPanelSizes(),this.classList.toggle("designbase-wc-split-view--dragging",!0)},this.handleMouseUp=()=>{null!==this.draggingIndex&&(this.draggingIndex=null,document.body.style.cursor="",document.body.style.userSelect="",this.classList.toggle("designbase-wc-split-view--dragging",!1))}}static get observedAttributes(){return["direction","mode","splitter-size","splitter-color","splitter-hover-color","gap","full-width","full-height"]}connectedCallback(){this.style.display="flex",this.style.boxSizing="border-box",this.collectPanelSources(),this.initPanelSizes(),this.sync(),this.observer=new MutationObserver(()=>{this.isSyncing||(this.collectPanelSources(),this.initPanelSizes(),this.sync())}),this.startObserving(),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){this.stopObserving(),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.draggingIndex=null,document.body.style.cursor="",document.body.style.userSelect=""}startObserving(){this.observer&&!this.isObserving&&(this.observer.observe(this,{childList:!0}),this.isObserving=!0)}stopObserving(){this.observer&&this.isObserving&&(this.observer.disconnect(),this.isObserving=!1)}attributeChangedCallback(){this.isConnected&&this.sync()}collectPanelSources(){this.panelSources=[];const t=Array.from(this.querySelectorAll('[slot="panel"]'));if(t.length)return void(this.panelSources=t);const e=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__panel > .designbase-wc-split-view__panel-body"));e.length&&(this.panelSources=e.map(t=>t.firstElementChild).filter(t=>t instanceof HTMLElement))}readPanelConfig(t,e,s){const i=t.getAttribute("data-size"),n=t.getAttribute("data-min-size"),a=t.getAttribute("data-max-size"),r=this.getMode();let l;return null!=i&&""!==i&&(l=Number(i)),{size:void 0!==l&&Number.isFinite(l)?l:"ratio"===r?1/s:200,minSize:n?Number(n):void 0,maxSize:a?Number(a):void 0,resizable:"false"!==t.getAttribute("data-resizable"),flexible:t.hasAttribute("data-flexible")||"false"!==t.getAttribute("data-flexible")&&e===s-1}}initPanelSizes(){const t=this.panelSources.length;if(!t)return;if(this.panelSizes.length===t)return;const e=this.getMode();this.panelSizes=this.panelSources.map((s,i)=>this.readPanelConfig(s,i,t).size??("ratio"===e?1/t:200))}getDirection(){return"vertical"===(this.getAttribute("direction")||"horizontal")?"vertical":"horizontal"}getMode(){return"fixed"===(this.getAttribute("mode")||"ratio")?"fixed":"ratio"}getSplitterSize(){return Number(this.getAttribute("splitter-size")||4)}getGap(){return Number(this.getAttribute("gap")||0)}applyPanelSizes(){if(!this.panelSources.length)return;const t=this.getDirection(),e=this.getMode();Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__panel")).forEach((s,i)=>{const n=this.panelSources[i];if(!n)return;const a=this.readPanelConfig(n,i,this.panelSources.length),r=this.panelSizes[i],l=a.flexible;if(s.style.width="",s.style.height="",s.style.flexBasis="",s.style.flexGrow="",s.style.flexShrink="",s.style.minHeight="",s.style.minWidth="",l)s.style.flex="1 1 0","vertical"===t?s.style.minHeight="0":s.style.minWidth="0";else{const t="fixed"===e?`${r}px`:100*r+"%";s.style.flex=`0 0 ${t}`}s.classList.toggle("designbase-wc-split-view__panel--flexible",Boolean(l)),s.classList.toggle("designbase-wc-split-view__panel--fixed",!l)})}sync(){if(this.isSyncing=!0,this.stopObserving(),this.collectPanelSources(),this.initPanelSizes(),!this.panelSources.length)return this.isSyncing=!1,void this.startObserving();const t=this.getDirection(),e=this.getMode(),s=this.getGap(),i=this.getSplitterSize(),n=this.getAttribute("splitter-color"),a=this.getAttribute("splitter-hover-color");this.className=["designbase-wc-split-view",`designbase-wc-split-view--direction-${t}`,`designbase-wc-split-view--mode-${e}`,this.hasAttribute("full-width")&&"designbase-wc-split-view--full-width",this.hasAttribute("full-height")&&"designbase-wc-split-view--full-height",null!==this.draggingIndex&&"designbase-wc-split-view--dragging"].filter(Boolean).join(" "),this.style.setProperty("--splitter-size",`${i}px`),n?this.style.setProperty("--splitter-color",n):this.style.removeProperty("--splitter-color"),a?this.style.setProperty("--splitter-hover-color",a):this.style.removeProperty("--splitter-hover-color"),this.style.gap=s>0?`${s}px`:"";const r=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__panel")),l=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__splitter"));r.forEach(t=>t.remove()),l.forEach(t=>t.remove()),this.panelSources.forEach((e,i)=>{const n=this.readPanelConfig(e,i,this.panelSources.length),a=i===this.panelSources.length-1,r=!1!==n.resizable&&!a,l=document.createElement("div");l.className="designbase-wc-split-view__panel";const o=document.createElement("div");if(o.className="designbase-wc-split-view__panel-body",e.parentElement!==o&&o.append(e),l.append(o),this.append(l),!a&&r&&0===s){const e=document.createElement("div");e.className=`designbase-wc-split-view__splitter designbase-wc-split-view__splitter--direction-${t}`,e.style.cursor="horizontal"===t?"col-resize":"row-resize",e.addEventListener("mousedown",this.handleMouseDown(i)),this.append(e)}}),this.applyPanelSizes(),this.isSyncing=!1,this.startObserving()}}customElements.get("db-split-view")||customElements.define("db-split-view",DbSplitView);const we=["s","m","l"],ye=["default","outlined","filled"];class DbFileUploader extends HTMLElement{constructor(){super(...arguments),this.uploadedFiles=[],this.uploadIntervals=new Map,this.handleFileSelect=t=>{if(this.isDisabled())return;const e=t.detail,s=e?.files??[];if(!s.length)return;const i=s.map(t=>({file:t,id:`${Date.now()}-${Math.random()}`,status:"pending",progress:0}));this.hasAttribute("multiple")?this.uploadedFiles=[...this.uploadedFiles,...i]:this.uploadedFiles=i,this.dispatchEvent(new CustomEvent("db-upload",{bubbles:!0,composed:!0,detail:{files:i}})),this.simulateUpload(i),this.renderFileList()},this.handleRemove=t=>{if(this.isDisabled())return;const e=this.uploadIntervals.get(t);e&&(clearInterval(e),this.uploadIntervals.delete(t)),this.uploadedFiles=this.uploadedFiles.filter(e=>e.id!==t),this.dispatchEvent(new CustomEvent("db-remove",{bubbles:!0,composed:!0,detail:{fileId:t}})),this.renderFileList()},this.handleRetry=t=>{if(this.isDisabled())return;const e=this.uploadedFiles.find(e=>e.id===t);e&&(this.updateFile(t,{status:"pending",progress:0,error:void 0}),this.dispatchEvent(new CustomEvent("db-retry",{bubbles:!0,composed:!0,detail:{fileId:t}})),this.simulateUpload([e]),this.renderFileList())}}static get observedAttributes(){return["size","variant","accept","max-size","multiple","show-file-list","show-progress","disabled","readonly"]}connectedCallback(){this.ensureDropzone(),this.sync(),this.dropzone?.addEventListener("db-file-select",this.handleFileSelect)}disconnectedCallback(){this.dropzone?.removeEventListener("db-file-select",this.handleFileSelect),this.uploadIntervals.forEach(t=>clearInterval(t)),this.uploadIntervals.clear()}attributeChangedCallback(){this.isConnected&&this.sync()}isDisabled(){return this.hasAttribute("disabled")||this.hasAttribute("readonly")}ensureDropzone(){this.dropzone||(this.dropzone=document.createElement("db-dropzone"),this.dropzone.setAttribute("data-wc-internal",""),this.prepend(this.dropzone))}formatFileSize(t){if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return`${parseFloat((t/1024**e).toFixed(2))} ${["Bytes","KB","MB","GB"][e]}`}simulateUpload(t){t.forEach((t,e)=>{this.updateFile(t.id,{status:"uploading",progress:0});let s=0;const i=setInterval(()=>{if(s+=20*Math.random(),s>=100)return s=100,clearInterval(i),this.uploadIntervals.delete(t.id),this.updateFile(t.id,{status:"success",progress:100}),void this.renderFileList();this.updateFile(t.id,{progress:s}),this.renderFileList()},100+50*e);this.uploadIntervals.set(t.id,i)})}updateFile(t,e){this.uploadedFiles=this.uploadedFiles.map(s=>s.id===t?{...s,...e}:s)}sync(){if(this.ensureDropzone(),!this.dropzone)return;const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=we.includes(t)?t:"m",i=ye.includes(e)?e:"default";this.className=["designbase-wc-file-uploader",`designbase-wc-file-uploader--size-${s}`,`designbase-wc-file-uploader--variant-${i}`,this.hasAttribute("disabled")&&"designbase-wc-file-uploader--disabled",this.hasAttribute("readonly")&&"designbase-wc-file-uploader--readonly"].filter(Boolean).join(" "),this.dropzone.setAttribute("size",s),this.dropzone.setAttribute("variant",i),this.getAttribute("accept")?this.dropzone.setAttribute("accept",this.getAttribute("accept")):this.dropzone.removeAttribute("accept"),this.getAttribute("max-size")?this.dropzone.setAttribute("max-size",this.getAttribute("max-size")):this.dropzone.removeAttribute("max-size"),this.dropzone.toggleAttribute("multiple",this.hasAttribute("multiple")),this.dropzone.toggleAttribute("disabled",this.hasAttribute("disabled")),this.dropzone.toggleAttribute("readonly",this.hasAttribute("readonly")),this.renderFileList()}renderStatusIcon(t){if("uploading"===t){const t=document.createElement("db-spinner");return t.setAttribute("type","circular"),t.setAttribute("size","s"),t}return createDbIcon("success"===t?"done":"error"===t?"error-filled":"gallery",20)}renderFileList(){const t=!this.hasAttribute("show-file-list")||"false"!==this.getAttribute("show-file-list"),e=!this.hasAttribute("show-progress")||"false"!==this.getAttribute("show-progress");if(this.querySelector(":scope > .designbase-wc-file-uploader__file-list")?.remove(),!t||!this.uploadedFiles.length)return;const s=document.createElement("div");s.className="designbase-wc-file-uploader__file-list";const i=document.createElement("div");i.className="designbase-wc-file-uploader__file-list-title",i.textContent=`업로드된 파일들 (${this.uploadedFiles.length}개)`,s.append(i);const n=document.createElement("div");n.className="designbase-wc-file-uploader__file-items",this.uploadedFiles.forEach(t=>{const s=document.createElement("div");s.className=`designbase-wc-file-uploader__file-item designbase-wc-file-uploader__file-item--${t.status}`;const i=document.createElement("div");i.className="designbase-wc-file-uploader__file-info";const a=document.createElement("div");a.className="designbase-wc-file-uploader__file-icon",a.append(this.renderStatusIcon(t.status));const r=document.createElement("div");r.className="designbase-wc-file-uploader__file-details";const l=document.createElement("div");l.className="designbase-wc-file-uploader__file-name",l.textContent=t.file.name;const o=document.createElement("div");if(o.className="designbase-wc-file-uploader__file-size",o.textContent=this.formatFileSize(t.file.size),r.append(l,o),t.error){const e=document.createElement("div");e.className="designbase-wc-file-uploader__file-error",e.textContent=t.error,r.append(e)}if(i.append(a,r),s.append(i),e&&"uploading"===t.status){const e=document.createElement("div");e.className="designbase-wc-file-uploader__progress";const i=document.createElement("db-progressbar");i.setAttribute("value",String(Math.round(t.progress||0))),i.setAttribute("size","s"),i.setAttribute("variant","primary"),i.setAttribute("bar-style","solid"),i.setAttribute("show-label",""),i.setAttribute("label-position","inside"),i.setAttribute("full-width",""),e.append(i),s.append(e)}const d=document.createElement("div");if(d.className="designbase-wc-file-uploader__file-actions","error"===t.status){const e=document.createElement("button");e.type="button",e.className="designbase-wc-file-uploader__retry-button",e.textContent="재시도",e.disabled=this.isDisabled(),e.addEventListener("click",()=>this.handleRetry(t.id)),d.append(e)}const u=document.createElement("button");u.type="button",u.className="designbase-wc-file-uploader__remove-button",u.textContent="삭제",u.disabled=this.isDisabled(),u.addEventListener("click",()=>this.handleRemove(t.id)),d.append(u),s.append(d),n.append(s)}),s.append(n),this.append(s)}}customElements.get("db-file-uploader")||customElements.define("db-file-uploader",DbFileUploader);const startOfDay=t=>{const e=new Date(t);return e.setHours(0,0,0,0),e},endOfDay=t=>{const e=new Date(t);return e.setHours(23,59,59,999),e},addDays=(t,e)=>{const s=new Date(t);return s.setDate(s.getDate()+e),startOfDay(s)},getMonthEnd=t=>endOfDay(new Date(t.getFullYear(),t.getMonth()+1,0)),getYearEnd=t=>endOfDay(new Date(t.getFullYear(),11,31)),clampRange=(t,e,s)=>{let{start:i,end:n}=t;return e&&i<e&&(i=startOfDay(e)),s&&n>s&&(n=endOfDay(s)),i>n?{start:n,end:i}:{start:i,end:n}},Ae=[{id:"today",label:"오늘",getRange:({today:t})=>clampRange({start:startOfDay(t),end:endOfDay(t)})},{id:"yesterday",label:"어제",getRange:({today:t})=>{const e=addDays(t,-1);return clampRange({start:e,end:endOfDay(e)})}},{id:"this-week",label:"이번 주",getRange:({today:t,startOfWeek:e,minDate:s,maxDate:i})=>{const n=((t,e)=>{const s=t.getDay();return addDays(t,-("monday"===e?(s+6)%7:s))})(t,e);return clampRange({start:n,end:(a=n,endOfDay(addDays(a,6)))},s,i);var a}},{id:"this-month",label:"이번 달",getRange:({today:t,minDate:e,maxDate:s})=>{return clampRange({start:(i=t,startOfDay(new Date(i.getFullYear(),i.getMonth(),1))),end:getMonthEnd(t)},e,s);var i}},{id:"this-year",label:"올해",getRange:({today:t,minDate:e,maxDate:s})=>{return clampRange({start:(i=t,startOfDay(new Date(i.getFullYear(),0,1))),end:getYearEnd(t)},e,s);var i}},{id:"custom",label:"사용자 지정",getRange:()=>null}],addMonths=(t,e)=>{const s=new Date(t);return s.setDate(1),s.setMonth(s.getMonth()+e),s},toISODate=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,parseISODate=t=>{if(!t)return null;const e=t.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!e)return null;const s=new Date(Number(e[1]),Number(e[2])-1,Number(e[3]));return Number.isNaN(s.getTime())?null:startOfDay(s)},formatDisplayDate=(t,e="ko-KR")=>t.toLocaleDateString(e),detectActivePresetId=(t,e,s)=>{if(!t)return"custom";const i=t.start.toDateString(),n=t.end.toDateString();for(const t of e){if("custom"===t.id)continue;const e=t.getRange(s);if(e&&(e.start.toDateString()===i&&e.end.toDateString()===n))return t.id}return"custom"},formatPanelInputDate=(t,e)=>t?t.toLocaleDateString(e,{year:"numeric",month:"short",day:"numeric"}):"",_e="designbase-wc-date-picker",Ce=["s","m","l"],xe=["default","outlined","filled"],isRangeValue=t=>Boolean(t)&&"object"==typeof t&&!Array.isArray(t)&&"start"in t&&"end"in t;class DbDatePicker extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.isOpen=!1,this.currentMonth=new Date,this.viewStartMonth=new Date,this.rangeStart=null,this.hoveredDate=null,this.activePresetId="custom",this.inputText="",this.boundDocumentMouseDown=t=>this.handleDocumentMouseDown(t)}static get observedAttributes(){return["mode","layout","type","inline","value","default-value","min-date","max-date","size","variant","disabled","readonly","label","full-width","error","locale","start-of-week","show-outside-days","dropdown-position","open","events"]}connectedCallback(){this.built||this.build(),this.readInitialValue(),this.render(),document.addEventListener("mousedown",this.boundDocumentMouseDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundDocumentMouseDown)}attributeChangedCallback(t){if(this.built){if("value"===t&&(this.readAttributeValue(),this.syncInputText()),"open"===t)return this.isOpen=this.hasAttribute("open"),void this.render();this.render()}}get value(){return this.getAttribute("value")||""}set value(t){t?this.setAttribute("value",t):this.removeAttribute("value")}get mode(){const t=this.getAttribute("mode")||"single";return"range"===t?"range":"multiple"===t?"multiple":"single"}set mode(t){this.setAttribute("mode",t)}get isPanelLayout(){return"panel"===this.getAttribute("layout")}get effectiveMode(){return this.isPanelLayout?"range":this.mode}get inline(){return this.hasAttribute("inline")}set inline(t){this.toggleAttribute("inline",Boolean(t))}get type(){return"modal"===this.getAttribute("type")?"modal":"dropdown"}get locale(){return this.getAttribute("locale")||"ko-KR"}get startOfWeek(){return"monday"===this.getAttribute("start-of-week")?"monday":"sunday"}get showOutsideDays(){return"false"!==this.getAttribute("show-outside-days")}get usesPendingValue(){return this.isPanelLayout||"modal"===this.type}get today(){return startOfDay(new Date)}get minDate(){return parseISODate(this.getAttribute("min-date"))}get maxDate(){return parseISODate(this.getAttribute("max-date"))}get presets(){return this.isPanelLayout?Ae:[]}get events(){const t=this.getAttribute("events");if(!t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}build(){this.built=!0,this.labelEl=document.createElement("label"),this.labelEl.className=`${_e}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${_e}__trigger`;const t=document.createElement("button");t.type="button",t.className=`${_e}__icon-display`,t.setAttribute("aria-label","날짜 선택 열기"),t.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${_e}__input`,this.inputEl.setAttribute("aria-label","날짜 입력"),this.inputEl.addEventListener("click",()=>this.openPicker()),this.inputEl.addEventListener("blur",()=>this.handleInputBlur()),this.inputEl.addEventListener("input",()=>{this.inputText=this.inputEl?.value||""});const e=document.createElement("button");e.type="button",e.className=`${_e}__toggle`,e.setAttribute("aria-label","날짜 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.triggerEl.append(t,this.inputEl,e),this.dropdownEl=document.createElement("div"),this.dropdownEl.className=`${_e}__dropdown`,this.dropdownEl.setAttribute("role","dialog"),this.dropdownEl.setAttribute("aria-modal","false"),this.calendarHost=document.createElement("div"),this.dropdownEl.appendChild(this.calendarHost)}readInitialValue(){const t=this.getAttribute("value")??this.getAttribute("default-value");if(t&&(this.selectedValue=this.parseValue(t)),this.tempValue=this.selectedValue,this.syncInputText(),isRangeValue(this.selectedValue)){const t=parseISODate(this.selectedValue.start);t&&(this.viewStartMonth=new Date(t))}else if("string"==typeof this.selectedValue){const t=parseISODate(this.selectedValue);t&&(this.currentMonth=new Date(t))}}readAttributeValue(){const t=this.getAttribute("value");if(!t)return this.selectedValue=void 0,void(this.tempValue=void 0);this.selectedValue=this.parseValue(t),this.isOpen&&this.usesPendingValue||(this.tempValue=this.selectedValue)}parseValue(t){if(t){if("multiple"===this.effectiveMode||t.trim().startsWith("["))try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter(t=>Boolean(parseISODate(t)))}catch{return}if("range"===this.effectiveMode||t.trim().startsWith("{"))try{const e=JSON.parse(t);if(e?.start&&e?.end)return{start:e.start,end:e.end}}catch{return}return parseISODate(t)?t:void 0}}serializeValue(t){return t?"string"==typeof t?t:JSON.stringify(t):""}formatDisplay(t){if(!t)return"";if("string"==typeof t){const e=parseISODate(t);return e?formatDisplayDate(e,this.locale):""}if(Array.isArray(t))return t.map(t=>parseISODate(t)).filter(Boolean).map(t=>formatDisplayDate(t,this.locale)).join(", ");const e=parseISODate(t.start),s=parseISODate(t.end);return e&&s?t.start===t.end?formatDisplayDate(e,this.locale):`${formatDisplayDate(e,this.locale)} ~ ${formatDisplayDate(s,this.locale)}`:""}syncInputText(){this.inputText=this.formatDisplay(this.selectedValue),this.inputEl&&(this.inputEl.value=this.inputText)}getWorkingValue(){return"range"===this.effectiveMode&&this.rangeStart?this.tempValue??this.selectedValue:this.usesPendingValue&&(this.isOpen||this.inline)?this.tempValue:this.selectedValue}presetContext(){return{today:this.today,startOfWeek:this.startOfWeek,minDate:this.minDate??void 0,maxDate:this.maxDate??void 0}}isDateValid(t){return!(this.minDate&&t<this.minDate)&&!(this.maxDate&&t>this.maxDate)}emitChange(t){const e=this.serializeValue(t);e?this.setAttribute("value",e):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t??null},bubbles:!0,composed:!0}))}applyValue(t,e=!this.usesPendingValue){if(e)return this.selectedValue=t,this.tempValue=t,this.syncInputText(),void this.emitChange(t);this.tempValue=t,this.renderCalendar()}handleDateClick(t){if(this.disabled||this.readonly||!this.isDateValid(t))return;this.isPanelLayout&&(this.activePresetId="custom");const e=this.getWorkingValue();if("single"===this.effectiveMode){const e=toISODate(t);return this.applyValue(e,!this.usesPendingValue),this.inline||this.isPanelLayout||this.closePicker(),void this.render()}if("multiple"===this.effectiveMode){const s=toISODate(t),i=Array.isArray(e)?e:[],n=i.includes(s)?i.filter(t=>t!==s):[...i,s];return this.applyValue(n,!this.usesPendingValue),void this.render()}if(!this.rangeStart)return this.rangeStart=t,this.applyValue({start:toISODate(t),end:toISODate(t)},!1),void this.renderCalendar();const s=this.rangeStart,i=t,n=s>i?{start:toISODate(i),end:toISODate(s)}:{start:toISODate(s),end:toISODate(i)};this.rangeStart=null,this.applyValue(n,!0),this.inline||this.isPanelLayout||this.closePicker(),this.render()}handlePresetSelect(t){if(this.activePresetId=t.id,this.rangeStart=null,"custom"===t.id)return void this.renderCalendar();const e=t.getRange(this.presetContext());if(!e)return;const s={start:toISODate(e.start),end:toISODate(e.end)};this.viewStartMonth=new Date(e.start),this.applyValue(s,!this.usesPendingValue),this.render()}handlePendingApply(){this.selectedValue=this.tempValue,this.syncInputText(),this.emitChange(this.tempValue),this.rangeStart=null,this.closePicker(),this.render()}handlePendingCancel(){this.tempValue=this.selectedValue,this.rangeStart=null,this.activePresetId=detectActivePresetId(isRangeValue(this.selectedValue)?{start:parseISODate(this.selectedValue.start),end:parseISODate(this.selectedValue.end)}:void 0,this.presets,this.presetContext()),this.closePicker(),this.render()}handleInputBlur(){if(!this.inputEl)return;const t=this.inputEl.value.trim();if(t.match(/^(\d{4})-(\d{2})-(\d{2})$/)){const e=parseISODate(t);if(e&&this.isDateValid(e)){const t=toISODate(e);return this.applyValue(t,!0),void this.render()}}this.syncInputText()}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",Boolean(t))}get readonly(){return this.hasAttribute("readonly")}set readonly(t){this.toggleAttribute("readonly",Boolean(t))}openPicker(){this.disabled||this.readonly||(this.isOpen=!0,this.usesPendingValue&&(this.tempValue=this.selectedValue,this.activePresetId=detectActivePresetId(isRangeValue(this.selectedValue)?{start:parseISODate(this.selectedValue.start),end:parseISODate(this.selectedValue.end)}:void 0,this.presets,this.presetContext())),this.render())}closePicker(){this.isOpen=!1,this.rangeStart=null,this.hoveredDate=null,this.render()}toggleOpen(){this.isOpen?this.closePicker():this.openPicker()}handleDocumentMouseDown(t){this.isOpen&&!this.inline&&(this.contains(t.target)||(this.usesPendingValue&&(this.tempValue=this.selectedValue),this.closePicker()))}isDateSelected(t){const e=toISODate(t),s=this.getWorkingValue();return"single"===this.effectiveMode?"string"==typeof s&&s===e:"multiple"===this.effectiveMode?Array.isArray(s)&&s.includes(e):!(!this.rangeStart||toISODate(this.rangeStart)!==e)||!!isRangeValue(s)&&(s.start===e||s.end===e)}isInRange(t){if("range"!==this.effectiveMode)return!1;let e=null,s=null;if(this.rangeStart)e=this.rangeStart,s=this.hoveredDate;else{const t=this.getWorkingValue();isRangeValue(t)&&(e=parseISODate(t.start),s=parseISODate(t.end))}if(!e)return!1;const i=toISODate(t),n=toISODate(e),a=s?toISODate(s):n;return i>=n&&i<=a}renderDateCell(t,e){const s=t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear(),i=t.toDateString()===this.today.toDateString(),n=this.isDateSelected(t),a=this.isInRange(t),r=0===t.getDay()||6===t.getDay(),l=this.events.filter(e=>{const s=parseISODate(e.date);return!!s&&s.toDateString()===t.toDateString()}),o=this.getWorkingValue(),d=isRangeValue(o)?parseISODate(o.end)?.toDateString():void 0,u=isRangeValue(o)?parseISODate(o.start)?.toDateString():void 0,b=document.createElement("button");b.type="button",b.className=[`${_e}__date`,!s&&this.showOutsideDays&&`${_e}__date--outside`,i&&`${_e}__date--today`,n&&`${_e}__date--selected`,a&&!n&&`${_e}__date--in-range`,"range"===this.effectiveMode&&(this.rangeStart?.toDateString()===t.toDateString()||u===t.toDateString())&&`${_e}__date--range-start`,"range"===this.effectiveMode&&d===t.toDateString()&&`${_e}__date--range-end`,r&&`${_e}__date--weekend`,!this.isDateValid(t)&&`${_e}__date--disabled`,l.length>0&&`${_e}__date--has-events`].filter(Boolean).join(" "),b.disabled=!this.isDateValid(t)||this.disabled||this.readonly,b.addEventListener("click",()=>this.handleDateClick(t));const p=document.createElement("span");if(p.className=`${_e}__date-number`,p.textContent=String(t.getDate()),b.appendChild(p),l.length>0){const t=document.createElement("div");t.className=`${_e}__events`,l.slice(0,3).forEach(e=>{const s=document.createElement("div");s.className=`${_e}__event ${_e}__event--${e.type||"dot"}`,e.color&&(s.style.backgroundColor=e.color),e.label&&(s.title=e.label),t.appendChild(s)}),b.appendChild(t)}return b}renderSingleMonth(t,e={}){const{showPrev:s=!1,showNext:i=!1}=e,n=getDbComponentIconSize(this.getAttribute("size")||"m"),a=document.createElement("div");a.className=`${_e}__month`;const r=document.createElement("div");if(r.className=`${_e}__header`,s){const t=document.createElement("button");t.type="button",t.className=`${_e}__nav-button`,t.setAttribute("aria-label","이전 달"),t.disabled=this.disabled||this.readonly,t.appendChild(createDbIcon("chevron-left",n)),t.addEventListener("click",()=>{this.isPanelLayout?this.viewStartMonth=addMonths(this.viewStartMonth,-1):this.currentMonth=addMonths(this.currentMonth,-1),this.renderCalendar()}),r.appendChild(t)}else{const t=document.createElement("span");t.className=`${_e}__nav-spacer`,t.setAttribute("aria-hidden","true"),r.appendChild(t)}const l=document.createElement("div");if(l.className=`${_e}__current-month`,l.textContent=t.toLocaleDateString(this.locale,{year:"numeric",month:"long"}),r.appendChild(l),i){const t=document.createElement("button");t.type="button",t.className=`${_e}__nav-button`,t.setAttribute("aria-label","다음 달"),t.disabled=this.disabled||this.readonly,t.appendChild(createDbIcon("chevron-right",n)),t.addEventListener("click",()=>{this.isPanelLayout?this.viewStartMonth=addMonths(this.viewStartMonth,1):this.currentMonth=addMonths(this.currentMonth,1),this.renderCalendar()}),r.appendChild(t)}else{const t=document.createElement("span");t.className=`${_e}__nav-spacer`,t.setAttribute("aria-hidden","true"),r.appendChild(t)}a.appendChild(r);const o=document.createElement("div");o.className=`${_e}__weekdays`,(t=>{const e=["일","월","화","수","목","금","토"];return"monday"===t&&e.push(e.shift()),e})(this.startOfWeek).forEach(t=>{const e=document.createElement("div");e.className=`${_e}__weekday`,e.textContent=t,o.appendChild(e)}),a.appendChild(o);const d=document.createElement("div");d.className=`${_e}__grid`;const u=this.isPanelLayout;return((t,e,s=!1)=>{const i=t.getFullYear(),n=t.getMonth(),a=new Date(i,n,1),r="monday"===e?(a.getDay()+6)%7:a.getDay();if(s){const t=[];for(let e=0;e<r;e+=1)t.push(null);const e=new Date(i,n+1,0).getDate();for(let s=1;s<=e;s+=1)t.push(new Date(i,n,s));return t}const l=new Date(a);return l.setDate(l.getDate()-r),Array.from({length:42},(t,e)=>{const s=new Date(l);return s.setDate(l.getDate()+e),s})})(t,this.startOfWeek,u).forEach((e,s)=>{if(!e){const t=document.createElement("span");return t.className=`${_e}__date ${_e}__date--empty`,t.setAttribute("aria-hidden","true"),t.dataset.index=String(s),void d.appendChild(t)}const i=e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear();if(!this.showOutsideDays&&!i){const t=document.createElement("span");return t.className=`${_e}__date ${_e}__date--empty`,t.setAttribute("aria-hidden","true"),t.dataset.index=String(s),void d.appendChild(t)}d.appendChild(this.renderDateCell(e,t))}),a.appendChild(d),a}renderDefaultCalendar(){const t=document.createElement("div");t.className=`${_e}__selector`;const e=this.isPanelLayout?this.viewStartMonth:this.currentMonth;if(t.appendChild(this.renderSingleMonth(e,{showPrev:!0,showNext:!0})),!this.isPanelLayout){const e=document.createElement("div");e.className=`${_e}__footer`;const s=document.createElement("button");s.type="button",s.className=`${_e}__today-button`,s.textContent="오늘",s.disabled=this.disabled||this.readonly,s.addEventListener("click",()=>{const t=new Date;this.isPanelLayout?this.viewStartMonth=t:this.currentMonth=t,this.renderCalendar()}),e.appendChild(s),t.appendChild(e)}return t}renderPanelCalendar(){const t=document.createElement("div");t.className=`${_e}__panel`;const e=document.createElement("div");e.className=`${_e}__presets`,e.setAttribute("role","listbox"),e.setAttribute("aria-label","기간 프리셋"),this.presets.forEach(t=>{const s=document.createElement("button");s.type="button",s.className=[`${_e}__preset`,this.activePresetId===t.id&&`${_e}__preset--active`].filter(Boolean).join(" "),s.setAttribute("role","option"),s.setAttribute("aria-selected",String(this.activePresetId===t.id)),s.textContent=t.label,s.addEventListener("click",()=>this.handlePresetSelect(t)),e.appendChild(s)}),t.appendChild(e);const s=document.createElement("div");s.className=`${_e}__panel-main`;const i=document.createElement("div");i.className=`${_e}__months ${_e}__months--count-2`,[0,1].forEach(t=>{const e=addMonths(this.viewStartMonth,t);i.appendChild(this.renderSingleMonth(e,{showPrev:0===t,showNext:1===t}))}),s.appendChild(i);const n=document.createElement("div");n.className=`${_e}__panel-footer`;const a=isRangeValue(this.tempValue)?this.tempValue:void 0,r=document.createElement("div");r.className=`${_e}__range-display`;const l=document.createElement("span");l.className=`${_e}__range-text`,l.textContent=a?.start&&parseISODate(a.start)?formatPanelInputDate(parseISODate(a.start),this.locale):"시작일";const o=document.createElement("span");o.className=`${_e}__range-separator`,o.textContent="–";const d=document.createElement("span");d.className=`${_e}__range-text`,d.textContent=a?.end&&parseISODate(a.end)?formatPanelInputDate(parseISODate(a.end),this.locale):"종료일",r.append(l,o,d),n.appendChild(r);const u=document.createElement("div");u.className=`${_e}__panel-actions`;const b=document.createElement("db-button");b.setAttribute("variant","secondary"),b.setAttribute("size","m"),b.textContent="취소",b.addEventListener("click",()=>this.handlePendingCancel());const p=document.createElement("db-button");return p.setAttribute("variant","primary"),p.setAttribute("size","m"),p.textContent="적용",p.addEventListener("click",()=>this.handlePendingApply()),u.append(b,p),n.appendChild(u),s.appendChild(n),t.appendChild(s),t}renderCalendar(){this.calendarHost&&(this.calendarHost.replaceChildren(),this.calendarHost.appendChild(this.isPanelLayout?this.renderPanelCalendar():this.renderDefaultCalendar()))}render(){const t=Ce.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",e=xe.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default",s=this.getAttribute("dropdown-position")||"bottom-start",i=getDbComponentIconSize(t);if(this.className=[_e,this.inline?`${_e}--size-${t}`:`${_e}--${t}`,`${_e}--variant-${e}`,this.hasAttribute("full-width")&&`${_e}--full-width`,this.disabled&&`${_e}--disabled`,this.readonly&&`${_e}--readonly`,this.isOpen&&`${_e}--open`,this.hasAttribute("error")&&`${_e}--error`,this.isPanelLayout&&`${_e}--panel`].filter(Boolean).join(" "),this.replaceChildren(),this.inline)return this.calendarHost=document.createElement("div"),this.appendChild(this.calendarHost),void this.renderCalendar();if(!(this.labelEl&&this.triggerEl&&this.inputEl&&this.dropdownEl))return;const n=this.getAttribute("label")||"";this.labelEl.textContent=n,this.labelEl.hidden=!n,this.inputEl.value=this.inputText,this.inputEl.placeholder=this.isPanelLayout?"기간을 선택하세요":"날짜를 선택하세요",this.inputEl.disabled=this.disabled,this.inputEl.readOnly=this.readonly;const a=this.triggerEl.querySelector(`.${_e}__icon-display`);a&&(a.innerHTML="",a.appendChild(createDbIcon("calendar",i)),a.disabled=this.disabled);const r=this.triggerEl.querySelector(`.${_e}__toggle`);if(r&&(r.innerHTML="",r.appendChild(createDbIcon("chevron-down",i)),r.disabled=this.disabled),this.dropdownEl.className=[`${_e}__dropdown`,`${_e}__dropdown--${s}`,this.isPanelLayout&&`${_e}__dropdown--panel`].filter(Boolean).join(" "),this.dropdownEl.hidden=!this.isOpen||"modal"===this.type,this.calendarHost=document.createElement("div"),this.dropdownEl.replaceChildren(this.calendarHost),this.renderCalendar(),this.append(this.labelEl,this.triggerEl),this.isOpen&&"dropdown"===this.type&&this.appendChild(this.dropdownEl),this.isOpen&&"modal"===this.type){const t=document.createElement("db-modal");t.setAttribute("open","true"),t.setAttribute("title",this.isPanelLayout?"기간 선택":"날짜 선택"),t.setAttribute("size",this.isPanelLayout?"l":"s"),t.addEventListener("db-close",()=>this.handlePendingCancel());const e=document.createElement("div");if(this.calendarHost=e,this.renderCalendar(),t.append(e),this.usesPendingValue){const e=document.createElement("div");e.className=`${_e}__modal-footer`;const s=document.createElement("db-button");s.setAttribute("variant","secondary"),s.setAttribute("size","m"),s.textContent="취소",s.addEventListener("click",()=>this.handlePendingCancel());const i=document.createElement("db-button");i.setAttribute("variant","primary"),i.setAttribute("size","m"),i.textContent="적용",i.addEventListener("click",()=>this.handlePendingApply()),e.append(s,i),t.append(e)}this.appendChild(t)}}}customElements.get("db-date-picker")||customElements.define("db-date-picker",DbDatePicker);const ke="designbase-wc-time-picker",Se=["s","m","l"],Ne=["12h","24h","12h-with-seconds","24h-with-seconds"];class DbTimePicker extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.isOpen=!1,this.hours=12,this.minutes=0,this.seconds=0,this.period="PM",this.inputText="",this.tempHours=12,this.tempMinutes=0,this.tempSeconds=0,this.tempPeriod="PM",this.boundDocumentMouseDown=t=>this.handleDocumentMouseDown(t)}static get observedAttributes(){return["value","default-value","type","format","minute-step","size","disabled","readonly","label","full-width","error","dropdown-position","open"]}connectedCallback(){this.built||this.build(),this.parseTimeString(this.getAttribute("value")??this.getAttribute("default-value")??"12:00"),this.syncInputText(),this.render(),document.addEventListener("mousedown",this.boundDocumentMouseDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundDocumentMouseDown)}attributeChangedCallback(t){if(this.built){if("value"===t){const t=this.getAttribute("value");t&&(this.parseTimeString(t),this.syncInputText())}if("open"===t)return this.isOpen=this.hasAttribute("open"),void this.render();this.render()}}get value(){return this.getAttribute("value")||""}set value(t){t?this.setAttribute("value",t):this.removeAttribute("value")}get format(){const t=this.getAttribute("format")||"24h";return Ne.includes(t)?t:"24h"}set format(t){this.setAttribute("format",t)}get type(){return"modal"===this.getAttribute("type")?"modal":"dropdown"}get is12h(){return"12h"===this.format||"12h-with-seconds"===this.format}get showSeconds(){return"12h-with-seconds"===this.format||"24h-with-seconds"===this.format}get minuteStep(){const t=Number(this.getAttribute("minute-step")||"1");return Number.isFinite(t)&&t>0?t:1}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",Boolean(t))}get readonly(){return this.hasAttribute("readonly")}set readonly(t){this.toggleAttribute("readonly",Boolean(t))}build(){this.built=!0,this.labelEl=document.createElement("label"),this.labelEl.className=`${ke}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${ke}__trigger`;const t=document.createElement("button");t.type="button",t.className=`${ke}__icon-display`,t.setAttribute("aria-label","시간 선택 열기"),t.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${ke}__input`,this.inputEl.setAttribute("aria-label","시간 입력"),this.inputEl.addEventListener("click",()=>this.openPicker()),this.inputEl.addEventListener("blur",()=>this.handleInputBlur()),this.inputEl.addEventListener("input",()=>{this.inputText=this.inputEl?.value||""});const e=document.createElement("button");e.type="button",e.className=`${ke}__toggle`,e.setAttribute("aria-label","시간 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.triggerEl.append(t,this.inputEl,e),this.dropdownEl=document.createElement("div"),this.dropdownEl.className=`${ke}__dropdown`,this.dropdownEl.setAttribute("role","dialog"),this.dropdownEl.setAttribute("aria-modal","false")}pad2(t){return String(t).padStart(2,"0")}to24Hour(t,e){return"AM"===e?12===t?0:t:12===t?12:t+12}formatTimeString(t,e,s,i){const n="AM"===(i||this.period)?"오전":"오후";return this.is12h?`${n} ${this.pad2(t)}:${this.pad2(e)}${this.showSeconds?`:${this.pad2(s)}`:""}`:`${this.pad2(t)}:${this.pad2(e)}${this.showSeconds?`:${this.pad2(s)}`:""}`}toValue24(t,e,s,i){const n=this.is12h?this.to24Hour(t,i||this.period):t;return`${this.pad2(n)}:${this.pad2(e)}${this.showSeconds?`:${this.pad2(s)}`:""}`}parseTimeString(t){const e=t.trim();if(this.is12h){const t=this.showSeconds?/^(오전|오후|AM|PM)?\s*(0?[1-9]|1[0-2]):([0-5]\d):([0-5]\d)\s*(AM|PM|오전|오후)?$/i:/^(오전|오후|AM|PM)?\s*(0?[1-9]|1[0-2]):([0-5]\d)\s*(AM|PM|오전|오후)?$/i,s=e.match(t);if(s){const t=s[1],e=this.showSeconds?s[5]:s[4],i=(t||e||"AM").toUpperCase();return this.hours=parseInt(s[2],10),this.minutes=parseInt(s[3],10),this.seconds=this.showSeconds?parseInt(s[4],10):0,void(this.period="오후"===i||"PM"===i?"PM":"AM")}}else{const t=this.showSeconds?/^([01]?\d|2[0-3]):([0-5]\d):([0-5]\d)$/:/^([01]?\d|2[0-3]):([0-5]\d)$/,s=e.match(t);s&&(this.hours=parseInt(s[1],10),this.minutes=parseInt(s[2],10),this.seconds=this.showSeconds?parseInt(s[3],10):0)}}syncInputText(){this.inputText=this.formatTimeString(this.hours,this.minutes,this.seconds),this.inputEl&&(this.inputEl.value=this.inputText)}emitChange(t){this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t},bubbles:!0,composed:!0}))}handleTimeChange(t,e,s=this.seconds,i){this.hours=t,this.minutes=e,this.seconds=s,i&&(this.period=i);const n=this.formatTimeString(t,e,s,i);this.inputText=n,this.inputEl&&(this.inputEl.value=n),this.emitChange(this.toValue24(t,e,s,i))}handleInputBlur(){if(!this.inputEl)return;const t=this.inputText;this.parseTimeString(this.inputEl.value);this.formatTimeString(this.hours,this.minutes,this.seconds)!==t||this.inputEl.value.trim()?this.handleTimeChange(this.hours,this.minutes,this.seconds,this.period):this.syncInputText()}openPicker(){this.disabled||this.readonly||(this.isOpen=!0,"modal"===this.type&&(this.tempHours=this.hours,this.tempMinutes=this.minutes,this.tempSeconds=this.seconds,this.tempPeriod=this.period),this.render())}closePicker(){this.isOpen=!1,this.render()}toggleOpen(){this.isOpen?this.closePicker():this.openPicker()}handleDocumentMouseDown(t){this.isOpen&&(this.contains(t.target)||this.closePicker())}createWheel(t){const{label:e,items:s,value:i,onChange:n,formatter:a}=t,r=document.createElement("div");r.className=`${ke}__wheel-container`;const l=document.createElement("div");l.className=`${ke}__wheel-label`,l.textContent=e,r.appendChild(l);const o=document.createElement("div");o.className=`${ke}__wheel-viewport`;const d=document.createElement("div");d.className=`${ke}__wheel`,d.setAttribute("role","listbox"),d.setAttribute("aria-label",e);let u=null,b=!1,p=!1,m=0,g=0;const indexOfValue=t=>s.findIndex(e=>e===t),scrollToIndex=(t,e=!0)=>{const s=40*t;b=!0,d.scrollTo({top:s,behavior:e?"smooth":"auto"}),window.setTimeout(()=>{b=!1},150)},fmt=t=>a?a(t):"number"==typeof t?this.pad2(t):String(t);s.forEach(t=>{const e=document.createElement("div");e.className=[`${ke}__wheel-item`,t===i&&`${ke}__wheel-item--selected`].filter(Boolean).join(" "),e.setAttribute("role","option"),e.setAttribute("aria-selected",String(t===i)),e.textContent=fmt(t),e.addEventListener("click",()=>{const e=indexOfValue(t);scrollToIndex(e,!0),t!==i&&n(t)}),d.appendChild(e)});const handleScroll=()=>{b||(u&&window.clearTimeout(u),u=window.setTimeout(()=>{const t=d.scrollTop,e=Math.round(t/40),a=Math.max(0,Math.min(s.length-1,e)),r=s[a];scrollToIndex(a,!0),r!==i&&n(r)},120))};d.addEventListener("scroll",handleScroll),d.addEventListener("pointerdown",t=>{p=!0,m=t.clientY,g=d.scrollTop,d.setPointerCapture(t.pointerId),d.style.cursor="grabbing"}),d.addEventListener("pointermove",t=>{p&&(d.scrollTop=g-(t.clientY-m))});const endDrag=t=>{p&&(p=!1,d.releasePointerCapture(t.pointerId),d.style.cursor="grab",handleScroll())};d.addEventListener("pointerup",endDrag),d.addEventListener("pointercancel",endDrag);const v=indexOfValue(i);v>=0&&requestAnimationFrame(()=>scrollToIndex(v,!1));const E=document.createElement("div");E.className=`${ke}__wheel-center-indicator`,E.setAttribute("aria-hidden","true");const f=document.createElement("div");f.className=`${ke}__wheel-fade wheel-fade--top`,f.setAttribute("aria-hidden","true");const w=document.createElement("div");return w.className=`${ke}__wheel-fade wheel-fade--bottom`,w.setAttribute("aria-hidden","true"),o.append(d,E,f,w),r.appendChild(o),r}renderSelector(t=!1){const e=document.createElement("div");e.className=`${ke}__selector`;const s=document.createElement("div");s.className=`${ke}__picker-wheels`;const i=this.is12h?Array.from({length:12},(t,e)=>e+1):Array.from({length:24},(t,e)=>e),n=Array.from({length:Math.floor(60/this.minuteStep)},(t,e)=>e*this.minuteStep),a=Array.from({length:60},(t,e)=>e),r=t?this.tempHours:this.hours,l=t?this.tempMinutes:this.minutes,o=t?this.tempSeconds:this.seconds,d=t?this.tempPeriod:this.period,onChange=(e,s,i,n)=>{if(t)return this.tempHours=e,this.tempMinutes=s,this.tempSeconds=i,void(this.tempPeriod=n);this.handleTimeChange(e,s,i,n)};if(s.appendChild(this.createWheel({label:"시간",items:i,value:r,onChange:t=>onChange(t,l,o,d)})),s.appendChild(this.createWheel({label:"분",items:n,value:n.includes(l)?l:n[0],onChange:t=>onChange(r,t,o,d)})),this.showSeconds&&s.appendChild(this.createWheel({label:"초",items:a,value:o,onChange:t=>onChange(r,l,t,d)})),this.is12h&&s.appendChild(this.createWheel({label:"오전/오후",items:["AM","PM"],value:d,onChange:t=>onChange(r,l,o,t),formatter:t=>"AM"===t?"오전":"오후"})),e.appendChild(s),t)return e;const u=document.createElement("div");u.className=`${ke}__dropdown-actions`;const b=document.createElement("div");b.className=`${ke}__preview`,b.setAttribute("aria-live","polite"),b.appendChild(createDbIcon("clock",16));const p=document.createElement("div");p.className=`${ke}__preview-time`,p.textContent=this.formatTimeString(r,l,o,d),b.appendChild(p);const m=document.createElement("db-button");return m.setAttribute("variant","primary"),m.setAttribute("size","m"),m.textContent="선택",m.addEventListener("click",()=>{this.handleTimeChange(r,l,o,d),this.closePicker()}),u.append(b,m),e.appendChild(u),e}render(){const t=Se.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",e=this.getAttribute("dropdown-position")||"bottom-start",s=getDbComponentIconSize(t);if(this.className=[ke,`${ke}--${t}`,this.hasAttribute("full-width")&&`${ke}--full-width`,this.disabled&&`${ke}--disabled`,this.readonly&&`${ke}--readonly`,this.isOpen&&`${ke}--open`,this.hasAttribute("error")&&`${ke}--error`].filter(Boolean).join(" "),this.replaceChildren(),!(this.labelEl&&this.triggerEl&&this.inputEl&&this.dropdownEl))return;const i=this.getAttribute("label")||"";this.labelEl.textContent=i,this.labelEl.hidden=!i,this.inputEl.value=this.inputText,this.inputEl.placeholder=this.is12h?this.showSeconds?"12:00:00 PM":"12:00 PM":this.showSeconds?"12:00:00":"12:00",this.inputEl.disabled=this.disabled,this.inputEl.readOnly=this.readonly;const n=this.triggerEl.querySelector(`.${ke}__icon-display`);n&&(n.innerHTML="",n.appendChild(createDbIcon("clock",s)),n.disabled=this.disabled);const a=this.triggerEl.querySelector(`.${ke}__toggle`);if(a&&(a.innerHTML="",a.appendChild(createDbIcon("chevron-down",s)),a.disabled=this.disabled),this.dropdownEl.className=[`${ke}__dropdown`,`${ke}__dropdown--${e}`].filter(Boolean).join(" "),this.dropdownEl.hidden=!this.isOpen,this.isOpen&&"dropdown"===this.type&&this.dropdownEl.replaceChildren(this.renderSelector(!1)),this.append(this.labelEl,this.triggerEl),this.isOpen&&"dropdown"===this.type&&this.appendChild(this.dropdownEl),this.isOpen&&"modal"===this.type){const t=document.createElement("db-modal");t.setAttribute("open","true"),t.setAttribute("title","시간 선택"),t.setAttribute("size","s"),t.addEventListener("db-close",()=>this.closePicker());const e=this.renderSelector(!0),s=document.createElement("div");s.className=`${ke}__modal-footer`;const i=document.createElement("db-button");i.setAttribute("variant","secondary"),i.setAttribute("size","m"),i.textContent="취소",i.addEventListener("click",()=>this.closePicker());const n=document.createElement("db-button");n.setAttribute("variant","primary"),n.setAttribute("size","m"),n.textContent="적용",n.addEventListener("click",()=>{this.handleTimeChange(this.tempHours,this.tempMinutes,this.tempSeconds,this.tempPeriod),this.closePicker()}),s.append(i,n),t.append(e,s),this.appendChild(t)}}}customElements.get("db-time-picker")||customElements.define("db-time-picker",DbTimePicker);const $e="designbase-wc-calendar",Ie=[{value:"meeting",label:"회의"},{value:"task",label:"업무"},{value:"reminder",label:"알림"},{value:"birthday",label:"생일"},{value:"holiday",label:"휴일"},{value:"custom",label:"기타"}],De=[{value:"#17a2b8",label:"청록"},{value:"#0d6efd",label:"파랑"},{value:"#198754",label:"초록"},{value:"#ffc107",label:"노랑"},{value:"#dc3545",label:"빨강"},{value:"#6f42c1",label:"보라"}];class DbCalendar extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.currentView="month",this.selectedDate=new Date,this._events=[],this.showEventModal=!1,this.selectedEvent=null,this.isEditing=!1,this.draggedEvent=null,this.dragOverDate=null,this.selectedDateRange={start:null,end:null},this.eventForm={title:"",description:"",startTime:"09:00",endTime:"10:00",type:"meeting",color:"#17a2b8",isAllDay:!1,location:""}}static get observedAttributes(){return["view","current-date","events","locale","show-weekends","highlight-today","show-outside-days"]}connectedCallback(){this.built||this.build(),this.readAttributes(),this.render()}attributeChangedCallback(){this.built&&(this.readAttributes(),this.render())}get locale(){return this.getAttribute("locale")||"ko-KR"}get showWeekends(){return"false"!==this.getAttribute("show-weekends")}get highlightToday(){return"false"!==this.getAttribute("highlight-today")}get showOutsideDays(){return"false"!==this.getAttribute("show-outside-days")}get events(){return this._events}set events(t){"string"!=typeof t?(this._events=Array.isArray(t)?t:[],this.setAttribute("events",JSON.stringify(this._events))):this.setAttribute("events",t)}build(){this.built=!0,this.headerEl=document.createElement("div"),this.headerEl.className=`${$e}__header`,this.bodyEl=document.createElement("div"),this.bodyEl.className=`${$e}__body`,this.modalEl=document.createElement("db-modal"),this.modalEl.setAttribute("size","m"),this.modalEl.addEventListener("db-close",()=>this.closeModal())}readAttributes(){this.currentView="month";const t=parseISODate(this.getAttribute("current-date"));t&&(this.selectedDate=t);const e=this.getAttribute("events");if(e)try{const t=JSON.parse(e);this._events=Array.isArray(t)?t:[]}catch{this._events=[]}else this._events=[]}isSameDate(t,e){return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}eventsForDate(t){return this._events.filter(e=>{const s=parseISODate(e.date);return!!s&&this.isSameDate(s,t)})}emit(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}handleViewChange(t){this.currentView="month",this.emit("db-view-change",{view:t}),this.render()}shiftMonth(t){const e=new Date(this.selectedDate);e.setMonth(e.getMonth()+t),this.selectedDate=e,this.emit("db-month-change",{date:toISODate(e)}),this.render()}shiftYear(t){const e=new Date(this.selectedDate);e.setFullYear(e.getFullYear()+t),this.selectedDate=e,this.emit("db-month-change",{date:toISODate(e)}),this.render()}handleDateClick(t){this.selectedDate=t,this.emit("db-date-click",{date:toISODate(t)}),!this.selectedDateRange.start||this.selectedDateRange.start&&this.selectedDateRange.end?this.selectedDateRange={start:t,end:null}:this.selectedDateRange.start&&!this.selectedDateRange.end&&(t<this.selectedDateRange.start?this.selectedDateRange={start:t,end:this.selectedDateRange.start}:this.selectedDateRange={start:this.selectedDateRange.start,end:t}),this.openAddModal(t)}handleDragStart(t,e){this.draggedEvent=t,e.dataTransfer?.setData("text/plain",t.id),e.dataTransfer?.setData("application/json",JSON.stringify(t)),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")}handleDragOver(t,e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this.dragOverDate=t,this.render()}handleDragLeave(t){const e=t.relatedTarget,s=t.currentTarget;s&&e&&s.contains(e)||(this.dragOverDate=null,this.render())}handleDrop(t,e){if(e.preventDefault(),!this.draggedEvent)return;const s={...this.draggedEvent,date:toISODate(t)};this.emit("db-event-edit",{event:s}),this.draggedEvent=null,this.dragOverDate=null,this.render()}handleDragEnd(){this.draggedEvent=null,this.dragOverDate=null,this.render()}handleEventClick(t,e){e.stopPropagation(),this.selectedEvent=t,this.isEditing=!0;const s=parseISODate(t.date);s&&(this.selectedDate=s),this.eventForm={title:t.title,description:t.description||"",startTime:t.startTime||"09:00",endTime:t.endTime||"10:00",type:t.type,color:t.color||"#17a2b8",isAllDay:t.isAllDay||!1,location:t.location||""},this.emit("db-event-click",{event:t}),this.showEventModal=!0,this.render()}openAddModal(t){this.selectedDate=t,this.selectedEvent=null,this.isEditing=!1,this.eventForm={title:"",description:"",startTime:"09:00",endTime:"10:00",type:"meeting",color:"#17a2b8",isAllDay:!1,location:""},this.showEventModal=!0,this.render()}closeModal(){this.showEventModal=!1,this.selectedEvent=null,this.isEditing=!1,this.render()}saveEvent(){if(!this.eventForm.title.trim())return void window.alert("제목을 입력해주세요.");const t={title:this.eventForm.title.trim(),description:this.eventForm.description,date:toISODate(this.selectedDate),startTime:this.eventForm.startTime,endTime:this.eventForm.endTime,type:this.eventForm.type,color:this.eventForm.color,isAllDay:this.eventForm.isAllDay,location:this.eventForm.location};if(this.isEditing&&this.selectedEvent){const e={...this.selectedEvent,...t};this.emit("db-event-edit",{event:e})}else this.emit("db-event-add",{event:t});this.closeModal()}deleteEvent(){this.selectedEvent&&window.confirm("정말로 이 일정을 삭제하시겠습니까?")&&(this.emit("db-event-delete",{eventId:this.selectedEvent.id}),this.closeModal())}renderHeader(){if(!this.headerEl)return;this.headerEl.replaceChildren();const t=document.createElement("div");t.className=`${$e}__navigation`;const e=getDbComponentIconSize("m"),s=document.createElement("button");s.type="button",s.className=`${$e}__nav-button`,s.setAttribute("aria-label","이전"),s.appendChild(createDbIcon("chevron-left",e)),s.addEventListener("click",()=>{this.shiftMonth(-1)});const i=document.createElement("div");i.className=`${$e}__title`,i.textContent=this.selectedDate.toLocaleDateString(this.locale,{year:"numeric",month:"long"});const n=document.createElement("button");n.type="button",n.className=`${$e}__nav-button`,n.setAttribute("aria-label","다음"),n.appendChild(createDbIcon("chevron-right",e)),n.addEventListener("click",()=>{this.shiftMonth(1)}),t.append(s,i,n),this.headerEl.appendChild(t)}renderMonthView(){const t=document.createElement("div");t.className=`${$e}__month-view`;const e=document.createElement("div");e.className=`${$e}__weekdays`,["일","월","화","수","목","금","토"].forEach(t=>{const s=document.createElement("div");s.className=`${$e}__weekday`,s.textContent=t,e.appendChild(s)}),t.appendChild(e);const s=document.createElement("div");s.className=`${$e}__days`;const i=this.selectedDate.getFullYear(),n=this.selectedDate.getMonth(),a=new Date(i,n,1),r=new Date(a);r.setDate(r.getDate()-a.getDay());const l=new Date;for(let t=0;t<42;t+=1){const e=new Date(r);e.setDate(r.getDate()+t);const i=e.getMonth()===n;if(!this.showOutsideDays&&!i)continue;const a=0===e.getDay()||6===e.getDay();if(!this.showWeekends&&a)continue;const o=document.createElement("div"),d=this.selectedDateRange.start&&this.selectedDateRange.end&&e>=this.selectedDateRange.start&&e<=this.selectedDateRange.end,u=this.selectedDateRange.start&&e.toDateString()===this.selectedDateRange.start.toDateString(),b=this.selectedDateRange.end&&e.toDateString()===this.selectedDateRange.end.toDateString(),p=Boolean(d&&!u&&!b);o.className=[`${$e}__day`,i&&`${$e}__day--current-month`,this.highlightToday&&e.toDateString()===l.toDateString()&&`${$e}__day--today`,this.isSameDate(e,this.selectedDate)&&`${$e}__day--selected`,u&&`${$e}__day--selected--start`,b&&`${$e}__day--selected--end`,p&&`${$e}__day--selected--middle`,!this.showWeekends&&a&&`${$e}__day--weekend`].filter(Boolean).join(" "),o.addEventListener("click",()=>this.handleDateClick(e));const m=document.createElement("span");m.className=`${$e}__day-number`,m.textContent=String(e.getDate()),o.appendChild(m);const g=this.eventsForDate(e);if(g.length){const t=document.createElement("div");if(t.className=`${$e}__day-events`,g.slice(0,2).forEach(e=>{const s=document.createElement("div");s.className=[`${$e}__event-bar`,`${$e}__event-bar--${e.type}`].filter(Boolean).join(" "),e.color&&(s.style.backgroundColor=e.color),this.draggedEvent?.id===e.id&&s.classList.add(`${$e}__event-bar--dragging`),s.title=e.title,s.draggable=!0;const i=document.createElement("span");i.className=`${$e}__event-title`,i.textContent=e.title,s.appendChild(i),s.addEventListener("click",t=>this.handleEventClick(e,t)),s.addEventListener("dragstart",t=>this.handleDragStart(e,t)),s.addEventListener("dragend",()=>this.handleDragEnd()),t.appendChild(s)}),g.length>2){const e=document.createElement("div");e.className=`${$e}__more-events`,e.textContent=`+${g.length-2} more`,t.appendChild(e)}o.appendChild(t)}const v=document.createElement("div");v.className=[`${$e}__drop-zone`,this.dragOverDate&&this.isSameDate(this.dragOverDate,e)&&`${$e}__drop-zone--active`].filter(Boolean).join(" "),v.addEventListener("dragover",t=>this.handleDragOver(e,t)),v.addEventListener("dragleave",t=>this.handleDragLeave(t)),v.addEventListener("drop",t=>this.handleDrop(e,t)),o.appendChild(v),s.appendChild(o)}return t.appendChild(s),t}renderYearView(){const t=document.createElement("div");t.className=`${$e}__year-view`;const e=this.selectedDate.getFullYear();for(let s=0;s<12;s+=1){const i=new Date(e,s,1),n=this._events.filter(t=>{const i=parseISODate(t.date);return i&&i.getFullYear()===e&&i.getMonth()===s}),a=document.createElement("div");a.className=`${$e}__year-month`,a.addEventListener("click",()=>{this.selectedDate=i,this.handleViewChange("month")});const r=document.createElement("h3");if(r.className=`${$e}__year-month-title`,r.textContent=i.toLocaleDateString(this.locale,{month:"long"}),a.appendChild(r),n.length){const t=document.createElement("div");if(t.className=`${$e}__year-month-events`,n.slice(0,4).forEach(e=>{const s=document.createElement("span");s.className=[`${$e}__year-event`,`${$e}__year-event--${e.type}`].join(" "),e.color&&(s.style.backgroundColor=e.color),t.appendChild(s)}),n.length>4){const e=document.createElement("span");e.className=`${$e}__year-more-events`,e.textContent=`+${n.length-4} more`,t.appendChild(e)}a.appendChild(t)}t.appendChild(a)}return t}renderWeekView(){const t=document.createElement("div");t.className=`${$e}__week-view`;const e=new Date,s=new Date(this.selectedDate);s.setDate(this.selectedDate.getDate()-this.selectedDate.getDay());const i=document.createElement("div");i.className=`${$e}__week-header`;const n=document.createElement("div");n.className=`${$e}__time-column-header`,i.appendChild(n);for(let t=0;t<7;t+=1){const n=new Date(s);n.setDate(s.getDate()+t);const a=document.createElement("div");a.className=[`${$e}__week-day-header`,n.toDateString()===e.toDateString()&&`${$e}__week-day-header--today`].filter(Boolean).join(" ");const r=document.createElement("span");r.className=`${$e}__week-day-name`,r.textContent=n.toLocaleDateString(this.locale,{weekday:"short"});const l=document.createElement("span");l.className=`${$e}__week-day-number`,l.textContent=String(n.getDate()),a.append(r,l),i.appendChild(a)}t.appendChild(i);const a=document.createElement("div");a.className=`${$e}__week-grid`;const r=document.createElement("div");r.className=`${$e}__week-time-column`;for(let t=6;t<=22;t+=1){const e=document.createElement("div");e.className=`${$e}__time-slot`;const s=document.createElement("span");s.className=`${$e}__time-label`,s.textContent=`${String(t).padStart(2,"0")}:00`,e.appendChild(s),r.appendChild(e)}a.appendChild(r);const l=document.createElement("div");l.className=`${$e}__week-columns`;for(let t=0;t<7;t+=1){const e=new Date(s);e.setDate(s.getDate()+t);const i=document.createElement("div");i.className=`${$e}__week-column`;for(let t=6;t<=22;t+=1){const s=document.createElement("div");s.className=`${$e}__week-cell`,s.title=`${e.toLocaleDateString()} ${String(t).padStart(2,"0")}:00`,s.addEventListener("click",()=>{this.selectedDate=new Date(e),this.eventForm.startTime=`${String(t).padStart(2,"0")}:00`,this.eventForm.endTime=`${String(t+1).padStart(2,"0")}:00`,this.openAddModal(this.selectedDate)}),i.appendChild(s)}this.eventsForDate(e).forEach(t=>{if(!t.startTime)return;const[e,s]=t.startTime.split(":").map(Number),n=.8*(60*(e-6)+(s||0)),a=(t.endTime||t.startTime).split(":").map(Number),r=60*(a[0]||e)+(a[1]||0),l=60*e+(s||0),o=Math.max(20,48*(r-l)/60),d=document.createElement("div");d.className=[`${$e}__week-event`,`${$e}__week-event--${t.type}`].filter(Boolean).join(" "),d.textContent=t.title,d.title=t.title,d.style.backgroundColor=t.color||"#17a2b8",d.style.top=`${n}px`,d.style.height=`${o}px`,d.addEventListener("click",e=>this.handleEventClick(t,e)),i.appendChild(d)}),l.appendChild(i)}return a.appendChild(l),t.appendChild(a),t}renderModal(){if(!this.modalEl)return;if(this.modalEl.replaceChildren(),!this.showEventModal)return void this.modalEl.removeAttribute("open");this.modalEl.setAttribute("open","true"),this.modalEl.setAttribute("title",this.isEditing?"일정 편집":"새 일정 추가");const t=document.createElement("div");t.className=`${$e}__event-form`;const e=document.createElement("db-input");e.setAttribute("label","제목 *"),e.setAttribute("placeholder","일정 제목을 입력하세요"),e.setAttribute("full-width",""),e.setAttribute("value",this.eventForm.title),e.addEventListener("db-input",t=>{this.eventForm.title=t.detail.value});const s=document.createElement("db-input");s.setAttribute("label","설명"),s.setAttribute("placeholder","일정 설명을 입력하세요"),s.setAttribute("full-width",""),s.setAttribute("value",this.eventForm.description),s.addEventListener("db-input",t=>{this.eventForm.description=t.detail.value});const i=document.createElement("db-date-picker");i.setAttribute("label","날짜"),i.setAttribute("full-width",""),i.setAttribute("value",toISODate(this.selectedDate)),i.addEventListener("db-change",t=>{const e=parseISODate(t.detail.value);e&&(this.selectedDate=e)});const n=document.createElement("db-select");n.setAttribute("label","일정 타입"),n.setAttribute("full-width",""),n.setAttribute("options",JSON.stringify(Ie)),n.setAttribute("value",this.eventForm.type),n.addEventListener("db-change",t=>{this.eventForm.type=t.detail.value});const a=document.createElement("db-select");a.setAttribute("label","색상"),a.setAttribute("full-width",""),a.setAttribute("options",JSON.stringify(De)),a.setAttribute("value",this.eventForm.color),a.addEventListener("db-change",t=>{this.eventForm.color=t.detail.value});const r=document.createElement("db-time-picker");r.setAttribute("label","시작 시간"),r.setAttribute("full-width",""),r.setAttribute("value",this.eventForm.startTime),r.addEventListener("db-change",t=>{this.eventForm.startTime=t.detail.value});const l=document.createElement("db-time-picker");l.setAttribute("label","종료 시간"),l.setAttribute("full-width",""),l.setAttribute("value",this.eventForm.endTime),l.addEventListener("db-change",t=>{this.eventForm.endTime=t.detail.value}),t.append(e,s,i,n,a,r,l);const o=document.createElement("div");if(o.className=`${$e}__event-form-footer`,o.style.display="flex",o.style.gap="8px",o.style.justifyContent="flex-end",o.style.marginTop="16px",this.isEditing){const t=document.createElement("db-button");t.setAttribute("variant","danger"),t.textContent="삭제",t.addEventListener("click",()=>this.deleteEvent()),o.appendChild(t)}const d=document.createElement("db-button");d.setAttribute("variant","secondary"),d.textContent="취소",d.addEventListener("click",()=>this.closeModal());const u=document.createElement("db-button");u.setAttribute("variant","primary"),u.textContent="저장",u.addEventListener("click",()=>this.saveEvent()),o.append(d,u),t.appendChild(o),this.modalEl.appendChild(t)}render(){this.className=$e,this.replaceChildren(),this.headerEl&&this.bodyEl&&(this.renderHeader(),this.bodyEl.replaceChildren(),this.bodyEl.appendChild(this.renderMonthView()),this.append(this.headerEl,this.bodyEl),this.renderModal(),this.showEventModal&&this.modalEl&&this.appendChild(this.modalEl))}}customElements.get("db-calendar")||customElements.define("db-calendar",DbCalendar);const Le=["s","m","l"],Me=["default","minimal","card","inline","large"],ze=["stars","number","both","reviews","detailed"],Te=["star","number","percentage","text"],Be=["primary","secondary","success","warning","error","custom"];class DbRating extends HTMLElement{constructor(){super(...arguments),this.hoverValue=null,this.starsEl=null,this.handlePointerMove=t=>{if(!this.isInteractive()||!this.getBooleanAttr("hover-effect",!0))return;const e=t.target?.closest(".designbase-wc-rating__star");if(!e||!this.contains(e))return;const s=Number(e.dataset.index);if(!Number.isFinite(s))return;const i=this.getNumberAttr("max-value",5),n=this.getPointerValue(s,t.clientX,e,i);this.hoverValue!==n&&(this.hoverValue=n,this.classList.toggle("designbase-wc-rating--hovering",!0),this.refreshStars(),this.dispatchEvent(new CustomEvent("db-hover",{detail:{value:n},bubbles:!0,composed:!0})))},this.handlePointerLeave=()=>{null!==this.hoverValue&&(this.hoverValue=null,this.classList.remove("designbase-wc-rating--hovering"),this.refreshStars())},this.handleClick=t=>{if(!this.isInteractive())return;const e=t.target?.closest(".designbase-wc-rating__star");if(!e||!this.contains(e))return;t.preventDefault();const s=Number(e.dataset.index);if(!Number.isFinite(s))return;const i=this.getNumberAttr("max-value",5),n=this.getPointerValue(s,t.clientX,e,i);this.hoverValue=null,this.classList.remove("designbase-wc-rating--hovering"),this.setAttribute("value",String(n)),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:n},bubbles:!0,composed:!0})),this.render()}}static get observedAttributes(){return["value","max-value","size","variant","type","display","review-count","rating-text","review-text","allow-half","readonly","disabled","clickable","color","custom-color","animated","hover-effect"]}connectedCallback(){this.addEventListener("mousemove",this.handlePointerMove),this.addEventListener("mouseleave",this.handlePointerLeave),this.addEventListener("click",this.handleClick),this.render()}disconnectedCallback(){this.removeEventListener("mousemove",this.handlePointerMove),this.removeEventListener("mouseleave",this.handlePointerLeave),this.removeEventListener("click",this.handleClick)}attributeChangedCallback(){this.isConnected&&this.render()}getNumberAttr(t,e){const s=this.getAttribute(t);if(null===s||""===s)return e;const i=Number(s);return Number.isFinite(i)?i:e}getBooleanAttr(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getOption(t,e,s){const i=this.getAttribute(t);return i&&e.includes(i)?i:s}normalizeSize(t){return"xs"===t||"s"===t?"s":"xl"===t||"l"===t?"l":"m"===t?"m":this.getOption("size",Le,"m")}getStarIconSize(){const t=this.normalizeSize(this.getAttribute("size"));return"s"===t?16:"l"===t?24:20}supportsHalfSteps(){return this.getBooleanAttr("allow-half")||this.getBooleanAttr("clickable")}isInteractive(){return this.getBooleanAttr("clickable")&&!this.getBooleanAttr("readonly")&&!this.getBooleanAttr("disabled")}getStarFill(t,e,s){const i=t+1;return e>=i?1:s&&e>=i-.5?.5:0}getPointerValue(t,e,s,i){const n=s.getBoundingClientRect();let a;return a=this.supportsHalfSteps()&&e-n.left<n.width/2?t+.5:t+1,a/5*i}formatRating(t,e,s,i){const n=t/e*5;return"percentage"===s?`${Math.round(t/e*100)}%`:"number"===s?i?n.toFixed(1):String(Math.round(n)):"text"===s?n>=4.5?"매우 좋음":n>=3?"보통":"낮음":`${n.toFixed(1)}/5`}updateStarElement(t,e,s,i,n){t.className=["designbase-wc-rating__star",0===e&&"designbase-wc-rating__star--empty",e>0&&n&&"designbase-wc-rating__star--hover-preview",i&&"designbase-wc-rating__star--clickable",this.getBooleanAttr("animated")&&"designbase-wc-rating__star--animated"].filter(Boolean).join(" "),t.dataset.index=String(s);const a=1===e?"star-filled":.5===e?"star-half":"star",r=this.getStarIconSize(),l=t.querySelector("svg");l?.getAttribute("data-designbase-icon")===a&&l.getAttribute("width")===String(r)||t.replaceChildren(createDbIcon(a,r))}refreshStars(){if(!this.starsEl)return;const t=this.getNumberAttr("value",0),e=this.getNumberAttr("max-value",5),s=this.getBooleanAttr("allow-half",!1),i=this.getBooleanAttr("hover-effect",!0),n=null!==this.hoverValue&&i,a=(n?this.hoverValue:t)/e*5,r=this.isInteractive(),l=s||n,o=Array.from(this.starsEl.querySelectorAll(":scope > .designbase-wc-rating__star"));for(let t=0;t<5;t+=1){const e=this.getStarFill(t,a,l),s=n&&e>0,i=o[t]??document.createElement("span");i.setAttribute("aria-hidden","true"),this.updateStarElement(i,e,t,r,s),o[t]||this.starsEl.append(i)}for(let t=o.length-1;t>=5;t-=1)o[t]?.remove()}render(){const t=this.getNumberAttr("value",0),e=this.getNumberAttr("max-value",5),s=this.normalizeSize(this.getAttribute("size")),i=this.getOption("variant",Me,"default"),n=this.getOption("type",Te,"star"),a=this.getOption("display",ze,"stars"),r=this.getOption("color",Be,"primary"),l=this.getNumberAttr("review-count",0),o=this.getBooleanAttr("allow-half",!1),d=this.getBooleanAttr("readonly",!1),u=this.getBooleanAttr("disabled",!1),b=this.getBooleanAttr("clickable",!1),p=this.getBooleanAttr("hover-effect",!0),m=null!==this.hoverValue&&p;this.className=["designbase-wc-rating",`designbase-wc-rating--size-${s}`,`designbase-wc-rating--variant-${i}`,`designbase-wc-rating--type-${n}`,`designbase-wc-rating--display-${a}`,`designbase-wc-rating--color-${r}`,d&&"designbase-wc-rating--readonly",u&&"designbase-wc-rating--disabled",b&&"designbase-wc-rating--clickable",this.getBooleanAttr("animated")&&"designbase-wc-rating--animated",m&&"designbase-wc-rating--hovering"].filter(Boolean).join(" ");const g=this.getAttribute("custom-color");"custom"===r&&g?this.style.setProperty("--rating-color",g):this.style.removeProperty("--rating-color");let v=this.querySelector(':scope > [role="img"]');v||(v=document.createElement("div"),this.replaceChildren(v)),v.setAttribute("role","img"),v.setAttribute("aria-label",`rating ${this.formatRating(t,e,n,o)}`);if("stars"===a||"both"===a||"detailed"===a){const t=v.querySelectorAll(":scope > .designbase-wc-rating__stars");t.forEach((t,e)=>{e>0&&t.remove()});const e=t[0];e?this.starsEl=e:(this.starsEl=document.createElement("div"),this.starsEl.className="designbase-wc-rating__stars",v.prepend(this.starsEl)),this.refreshStars()}else this.starsEl&&(this.starsEl.remove(),this.starsEl=null);const E=this.getAttribute("rating-text")||this.formatRating(t,e,n,o);let f=v.querySelector(".designbase-wc-rating__number-container");if("number"===a||"both"===a){if(!f){f=document.createElement("div"),f.className="designbase-wc-rating__number-container";const t=document.createElement("span");t.className="designbase-wc-rating__number",f.append(t),v.append(f)}const t=f.querySelector(".designbase-wc-rating__number");t&&(t.textContent=E)}else f?.remove();let w=v.querySelector(".designbase-wc-rating__review-count");if("reviews"===a||"detailed"===a){const t=this.getAttribute("review-text")||(l>0?`${l.toLocaleString()} 리뷰`:"");t?(w||(w=document.createElement("span"),w.className="designbase-wc-rating__review-count",v.append(w)),w.textContent=t):w?.remove()}else w?.remove()}}customElements.get("db-rating")||customElements.define("db-rating",DbRating);const Pe=["s","m","l"],Fe=["default","compact","minimal"];class DbCountdown extends HTMLElement{constructor(){super(...arguments),this.timer=null,this.targetTime=Date.now()}static get observedAttributes(){return["end-date","duration","size","variant","show-days","show-hours","show-minutes","show-seconds","show-labels"]}connectedCallback(){this.setupTargetTime(),this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(){this.setupTargetTime(),this.render()}boolAttr(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}optionAttr(t,e,s){const i=this.getAttribute(t);return i&&e.includes(i)?i:s}setupTargetTime(){const t=this.getAttribute("end-date"),e=Number(this.getAttribute("duration"));if(t){const e=new Date(t).getTime();return void(this.targetTime=Number.isFinite(e)?e:Date.now())}Number.isFinite(e)&&e>0?this.targetTime=Date.now()+1e3*e:this.targetTime=Date.now()}getRemaining(){const t=this.targetTime-Date.now();return t<=0?{days:0,hours:0,minutes:0,seconds:0,total:0}:{days:Math.floor(t/864e5),hours:Math.floor(t/36e5%24),minutes:Math.floor(t/6e4%60),seconds:Math.floor(t/1e3%60),total:t}}stop(){null!==this.timer&&(window.clearInterval(this.timer),this.timer=null)}start(){this.stop(),this.render(),this.timer=window.setInterval(()=>{const t=this.getRemaining();this.render(),this.dispatchEvent(new CustomEvent("db-tick",{detail:t,bubbles:!0,composed:!0})),t.total<=0&&(this.stop(),this.dispatchEvent(new CustomEvent("db-complete",{bubbles:!0,composed:!0})))},1e3)}two(t){return String(t).padStart(2,"0")}render(){const t=this.optionAttr("size",Pe,"m"),e=this.optionAttr("variant",Fe,"default"),s=this.boolAttr("show-labels",!0),i=this.getRemaining();this.className=["designbase-wc-countdown",`designbase-wc-countdown--${t}`,`designbase-wc-countdown--${e}`,s&&"designbase-wc-countdown--with-labels",i.total<=0&&"designbase-wc-countdown--expired"].filter(Boolean).join(" ");const n={days:this.getAttribute("label-days")||"일",hours:this.getAttribute("label-hours")||"시간",minutes:this.getAttribute("label-minutes")||"분",seconds:this.getAttribute("label-seconds")||"초"},a=[{key:"days",value:i.days,show:this.boolAttr("show-days",!0)},{key:"hours",value:i.hours,show:this.boolAttr("show-hours",!0)},{key:"minutes",value:i.minutes,show:this.boolAttr("show-minutes",!0)},{key:"seconds",value:i.seconds,show:this.boolAttr("show-seconds",!0)}].filter(t=>t.show),r=[];for(let t=0;t<a.length;t+=1){const i=a[t],l=document.createElement("div");l.className="designbase-wc-countdown__unit";const o=document.createElement("div");if(o.className="designbase-wc-countdown__value",o.textContent=this.two(i.value),l.append(o),s){const t=document.createElement("div");t.className="designbase-wc-countdown__label",t.textContent=n[i.key],l.append(t)}if(r.push(l),t<a.length-1&&"minimal"!==e){const t=document.createElement("div");t.className="designbase-wc-countdown__separator",t.textContent=":",r.push(t)}}this.replaceChildren(...r)}}customElements.get("db-countdown")||customElements.define("db-countdown",DbCountdown);const Oe=[1,2,3,4,5,6],He=["xs","s","m","l","xl"];class DbMasonry extends HTMLElement{static get observedAttributes(){return["images","columns","spacing","hover","clickable"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}get images(){try{const t=JSON.parse(this.getAttribute("images")||"[]");return Array.isArray(t)?t.filter(t=>t&&"string"==typeof t.src):[]}catch{return[]}}set images(t){this.setAttribute("images","string"==typeof t?t:JSON.stringify(t))}boolAttr(t,e=!0){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}render(){const t=Number(this.getAttribute("columns")||3),e=Oe.includes(t)?t:3,s=this.getAttribute("spacing")||"m",i=He.includes(s)?s:"m",n=this.boolAttr("hover",!0),a=this.boolAttr("clickable",!0);this.className=["designbase-wc-masonry",`designbase-wc-masonry--columns-${e}`,`designbase-wc-masonry--spacing-${i}`,n&&"designbase-wc-masonry--hover",a&&"designbase-wc-masonry--clickable"].filter(Boolean).join(" ");const r=Array.from({length:e},()=>[]),l=new Array(e).fill(0);this.images.forEach(t=>{const e=l.indexOf(Math.min(...l));r[e].push(t),l[e]+=1});const o=document.createDocumentFragment();r.forEach(t=>{const e=document.createElement("div");e.className="designbase-wc-masonry__column",t.forEach(t=>{const s=this.images.indexOf(t),i=document.createElement("figure");i.className="designbase-wc-masonry__item";const n=document.createElement("img");if(n.className="designbase-wc-masonry__image",n.src=t.thumbnail||t.src,n.alt=t.alt||t.title||`image-${s+1}`,n.loading="lazy",n.addEventListener("load",()=>{this.dispatchEvent(new CustomEvent("db-image-load",{detail:{image:t,index:s},bubbles:!0,composed:!0}))}),n.addEventListener("error",()=>{this.dispatchEvent(new CustomEvent("db-image-error",{detail:{image:t,index:s},bubbles:!0,composed:!0}))}),i.append(n),t.title||t.description){const e=document.createElement("figcaption");if(e.className="designbase-wc-masonry__overlay",t.title){const s=document.createElement("h3");s.className="designbase-wc-masonry__title",s.textContent=t.title,e.append(s)}if(t.description){const s=document.createElement("p");s.className="designbase-wc-masonry__description",s.textContent=t.description,e.append(s)}i.append(e)}a&&(i.tabIndex=0,i.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-image-click",{detail:{image:t,index:s},bubbles:!0,composed:!0}))})),e.append(i)}),o.append(e)}),this.replaceChildren(o)}}customElements.get("db-masonry")||customElements.define("db-masonry",DbMasonry);class DbCarousel extends HTMLElement{constructor(){super(...arguments),this.currentIndex=0,this.timer=null,this.isAutoPlaying=!1}static get observedAttributes(){return["items","size","variant","theme","transition","auto-play","auto-play-interval","infinite","show-navigation","show-indicators","indicator-style","show-auto-play-control","show-title","show-description","disabled","readonly"]}get items(){try{const t=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.style.display="block",this.clampCurrentIndex(),this.isAutoPlaying=this.getBool("auto-play"),this.startAutoPlay(),this.render()}disconnectedCallback(){this.stopAutoPlay()}attributeChangedCallback(t){"items"===t&&this.clampCurrentIndex(),"auto-play"!==t&&"auto-play-interval"!==t||(this.isAutoPlaying=this.getBool("auto-play"),this.startAutoPlay()),this.render()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}clampCurrentIndex(){this.currentIndex>=this.items.length&&(this.currentIndex=0)}stopAutoPlay(){this.timer&&(window.clearInterval(this.timer),this.timer=null)}startAutoPlay(){if(this.stopAutoPlay(),!this.isAutoPlaying||this.items.length<=1)return;const t=Math.max(1e3,Number(this.getAttribute("auto-play-interval")||5e3));this.timer=window.setInterval(()=>this.goToNext(),t)}getIndicatorType(){if(this.getBool("show-auto-play-control",!0)&&this.getBool("show-indicators",!0)&&this.items.length>1)return"combined";const t=this.getAttribute("indicator-style")||"dots";return"lines"===t?"line":"numbers"===t?"numbers":"dots"}getIndicatorSize(){const t=this.getAttribute("size")||"m";return"l"===t||"xl"===t?"m":"s"}goTo(t){t<0||t>=this.items.length||(this.currentIndex=t,this.dispatchEvent(new CustomEvent("db-slide-change",{detail:{index:t},bubbles:!0,composed:!0})),this.render())}goToPrev(){if(0===this.items.length)return;const t=this.getBool("infinite",!0),e=this.currentIndex-1;e<0?this.goTo(t?this.items.length-1:0):this.goTo(e)}goToNext(){if(0===this.items.length)return;const t=this.getBool("infinite",!0),e=this.currentIndex+1;e>=this.items.length?this.goTo(t?0:this.items.length-1):this.goTo(e)}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"light",i=this.getAttribute("transition")||"slide",n=this.getBool("show-navigation",!0),a=this.getBool("show-indicators",!0),r=this.getBool("show-auto-play-control",!0),l=this.getBool("show-title",!0),o=this.getBool("show-description",!0),d=this.getBool("disabled"),u=this.getBool("readonly"),b=this.getAttribute("indicator-style")||"dots",p=r&&a&&this.items.length>1;this.className=["designbase-wc-carousel",`designbase-wc-carousel--size-${t}`,`designbase-wc-carousel--variant-${e}`,`designbase-wc-carousel--theme-${s}`,`designbase-wc-carousel--transition-${i}`,`designbase-wc-carousel--indicator-${b}`,d&&"designbase-wc-carousel--disabled",u&&"designbase-wc-carousel--readonly"].filter(Boolean).join(" ");const m=document.createElement("div");m.className="designbase-wc-carousel__container";const g=document.createElement("div");if(g.className="designbase-wc-carousel__track",g.style.transform=`translateX(-${100*this.currentIndex}%)`,this.items.forEach((t,e)=>{const s=document.createElement("div");s.className="designbase-wc-carousel__slide"+(e===this.currentIndex?" designbase-wc-carousel__slide--active":""),s.style.flex="0 0 100%",s.style.width="100%",s.style.height="100%",s.style.minWidth="0";const i=t.image?"#ffffff":"";if(i&&(s.style.color=i),t.image){const i=document.createElement("div");i.className="designbase-wc-carousel__slide-image";const n=document.createElement("img");n.className="designbase-wc-carousel__slide-img",n.src=t.image,n.alt=t.alt||t.title||`Slide ${e+1}`,i.append(n),s.append(i)}if(l&&t.title||o&&t.description){const e=document.createElement("div");if(e.className="designbase-wc-carousel__slide-info",i&&(e.style.color=i),l&&t.title){const s=document.createElement("h3");s.className="designbase-wc-carousel__slide-title",s.textContent=t.title,i&&(s.style.color=i),e.append(s)}if(o&&t.description){const s=document.createElement("p");s.className="designbase-wc-carousel__slide-description",s.textContent=t.description,i&&(s.style.color=i),e.append(s)}s.append(e)}s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:t,index:e},bubbles:!0,composed:!0}))}),g.append(s)}),m.append(g),n&&this.items.length>1){const t=document.createElement("button");t.className="designbase-wc-carousel__nav-button designbase-wc-carousel__nav-button--prev",t.type="button",t.append(createDbIcon("chevron-left",20)),t.disabled=d||u,t.addEventListener("click",()=>this.goToPrev());const e=document.createElement("button");e.className="designbase-wc-carousel__nav-button designbase-wc-carousel__nav-button--next",e.type="button",e.append(createDbIcon("chevron-right",20)),e.disabled=d||u,e.addEventListener("click",()=>this.goToNext()),m.append(t,e)}const v=[m];if(a&&this.items.length>1){const t=document.createElement("div");t.className="designbase-wc-carousel__controls";const e=document.createElement("div");e.className="designbase-wc-carousel__indicators";const s=document.createElement("db-indicator");s.setAttribute("current",String(this.currentIndex)),s.setAttribute("total",String(this.items.length)),s.setAttribute("type",this.getIndicatorType()),s.setAttribute("size",this.getIndicatorSize()),s.setAttribute("clickable",""),p&&(s.setAttribute("timer",""),s.setAttribute("timer-duration",String(Math.max(1e3,Number(this.getAttribute("auto-play-interval")||5e3)))),s.setAttribute("auto-roll","false"),this.isAutoPlaying?s.setAttribute("playing",""):s.removeAttribute("playing"),(d||u)&&s.setAttribute("playback-disabled","")),s.addEventListener("db-step-click",t=>{const e=t;this.goTo(e.detail.index)}),s.addEventListener("db-playing-change",t=>{const e=t;this.isAutoPlaying=e.detail.playing,this.startAutoPlay(),this.render()}),e.append(s),t.append(e),v.push(t)}this.replaceChildren(...v)}}customElements.get("db-carousel")||customElements.define("db-carousel",DbCarousel);const clamp=(t,e,s)=>Math.max(e,Math.min(s,t)),normalizeHex=t=>{const e=(t||"").trim().toUpperCase();return e?e.startsWith("#")?e:`#${e}`:""},isHex=t=>/^#?[0-9A-Fa-f]{6}$/.test(t||""),hexToRgb$1=t=>{const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t.trim());return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},rgbToHsv=(t,e,s)=>{t/=255,e/=255,s/=255;const i=Math.max(t,e,s),n=i-Math.min(t,e,s);let a=0;if(0!==n){switch(i){case t:a=(e-s)/n+(e<s?6:0);break;case e:a=(s-t)/n+2;break;case s:a=(t-e)/n+4}a*=60}return{h:a,s:100*(0===i?0:n/i),v:100*i}},Ve=["s","m","l"],Re=["dropdown","modal"],qe=["bottom-start","bottom-end","top-start","top-end"],je="#006FFF",We=hexToRgb$1(je)??{r:0,g:111,b:255},Ue=rgbToHsv(We.r,We.g,We.b),Je=JSON.stringify([{label:"HEX",value:"hex"},{label:"RGB",value:"rgb"},{label:"RGBA",value:"rgba"},{label:"HSL",value:"hsl"},{label:"HSLA",value:"hsla"}]);class DbColorPicker extends HTMLElement{constructor(){super(...arguments),this.h=Ue.h,this.s=Ue.s,this.v=Ue.v,this.a=100,this.open=!1,this.format="hex",this.colorInput=je,this.alphaInput="100",this.isCopied=!1,this.tempColor="",this.dragging=null,this.mounted=!1,this.copiedTimer=null,this.debounceTimer=null,this.lastEmittedHex="",this.suppressNextValueSync=!1,this.didMount=!1,this.triggerInputFocused=!1,this.panelInputFocused=!1,this.panelAlphaInputFocused=!1,this.handleOutsideClick=t=>{if(!this.open||"dropdown"!==this.getOption("type",Re,"dropdown"))return;const e=t.target;this.contains(e)||this.formatSelectEl?.contains(e)||(this.open=!1,this.update())},this.handleDocumentMouseMove=t=>{"area"===this.dragging&&(this.getBool("disabled")||this.getBool("readonly")||this.updateFromArea(t.clientX,t.clientY))},this.handleDocumentMouseUp=()=>{"area"===this.dragging&&(this.dragging=null,this.onColorStateChanged(!0))},this.handleModalCancel=()=>{const t=hexToRgb$1(this.tempColor);if(t){const e=rgbToHsv(t.r,t.g,t.b);this.h=e.h,this.s=e.s,this.v=e.v}this.open=!1,this.update(),this.dispatchEvent(new CustomEvent("db-cancel",{bubbles:!0,composed:!0}))},this.handleModalApply=()=>{this.open=!1,this.actuallyEmit(),this.dispatchEvent(new CustomEvent("db-apply",{detail:{value:this.getOutward()},bubbles:!0,composed:!0})),this.update()}}static get observedAttributes(){return["size","type","position","value","default-value","show-input","show-alpha","show-format-selector","show-copy-button","show-eyedropper","disabled","readonly","full-width","error","on-change-format","change-debounce-ms","emit-during-drag"]}connectedCallback(){this.mounted||this.mount(),this.syncFromValueAttr(!0),this.update(),document.addEventListener("mousedown",this.handleOutsideClick),document.addEventListener("mousemove",this.handleDocumentMouseMove),document.addEventListener("mouseup",this.handleDocumentMouseUp)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleOutsideClick),document.removeEventListener("mousemove",this.handleDocumentMouseMove),document.removeEventListener("mouseup",this.handleDocumentMouseUp),this.copiedTimer&&clearTimeout(this.copiedTimer),this.debounceTimer&&clearTimeout(this.debounceTimer)}attributeChangedCallback(t){this.mounted&&("value"!==t&&"default-value"!==t||this.syncFromValueAttr(!1),this.update())}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getOption(t,e,s){const i=this.getAttribute(t);return i&&e.includes(i)?i:s}getIconSize(){return getDbComponentIconSize(this.getOption("size",Ve,"m"))}getRgb(){return((t,e,s)=>{const i=(s/=100)*(e/=100),n=i*(1-Math.abs(t/60%2-1)),a=s-i;let r=0,l=0,o=0;return t>=0&&t<60?(r=i,l=n,o=0):t<120?(r=n,l=i,o=0):t<180?(r=0,l=i,o=n):t<240?(r=0,l=n,o=i):t<300?(r=n,l=0,o=i):(r=i,l=0,o=n),{r:Math.round(255*(r+a)),g:Math.round(255*(l+a)),b:Math.round(255*(o+a))}})(this.h,this.s,this.v)}getHex(){const t=this.getRgb();return((t,e,s)=>{const h=t=>clamp(Math.round(t),0,255).toString(16).padStart(2,"0");return`#${h(t)}${h(e)}${h(s)}`.toUpperCase()})(t.r,t.g,t.b)}getHsl(){const t=this.getRgb();return((t,e,s)=>{t/=255,e/=255,s/=255;const i=Math.max(t,e,s),n=Math.min(t,e,s);let a=0,r=0;const l=(i+n)/2;if(i!==n){const o=i-n;switch(r=l>.5?o/(2-i-n):o/(i+n),i){case t:a=(e-s)/o+(e<s?6:0);break;case e:a=(s-t)/o+2;break;case s:a=(t-e)/o+4}a*=60}return{h:a,s:100*r,l:100*l}})(t.r,t.g,t.b)}getUiFormatted(){const t=this.getRgb(),e=this.getHex(),s=this.getHsl();return((t,e,s,i,n)=>{const a=n/100;switch(t){case"hex":default:return s;case"rgb":return`rgb(${e.r}, ${e.g}, ${e.b})`;case"rgba":return`rgba(${e.r}, ${e.g}, ${e.b}, ${a.toFixed(2)})`;case"hsl":return`hsl(${Math.round(i.h)}, ${Math.round(i.s)}%, ${Math.round(i.l)}%)`;case"hsla":return`hsla(${Math.round(i.h)}, ${Math.round(i.s)}%, ${Math.round(i.l)}%, ${a.toFixed(2)})`}})(this.format,t,e,s,this.a)}getOutward(){return"hex"===("ui"===this.getAttribute("on-change-format")?"ui":"hex")?this.getHex():this.getUiFormatted()}syncFromValueAttr(t){const e=this.getAttribute("value")??(t?this.getAttribute("default-value"):null)??(t?je:null);if(null==e)return;const s=normalizeHex(e);if(!isHex(s))return;if(!t&&this.suppressNextValueSync&&s===this.lastEmittedHex)return void(this.suppressNextValueSync=!1);const i=hexToRgb$1(s);if(!i)return;const n=rgbToHsv(i.r,i.g,i.b);this.h=n.h,this.s=n.s,this.v=n.v,this.colorInput=s,this.lastEmittedHex=s}actuallyEmit(){const t=normalizeHex(this.getHex()),e=this.hasAttribute("value")&&isHex(this.getAttribute("value")||"")?normalizeHex(this.getAttribute("value")||""):null;e&&e===t||this.lastEmittedHex!==t&&(this.lastEmittedHex=t,this.suppressNextValueSync=!0,this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:this.getOutward()},bubbles:!0,composed:!0})))}scheduleEmit(){const t=this.getBool("emit-during-drag",!0);if(this.dragging&&!t)return;const e=Number(this.getAttribute("change-debounce-ms")||"0");if(e>0)return this.debounceTimer&&clearTimeout(this.debounceTimer),void(this.debounceTimer=setTimeout(()=>this.actuallyEmit(),e));this.actuallyEmit()}onColorStateChanged(t=!1){this.didMount?(!t||this.getBool("emit-during-drag",!0),this.scheduleEmit()):this.didMount=!0}updateFromArea(t,e){const s=this.colorFieldEl;if(!s)return;const i=s.getBoundingClientRect(),n=clamp(t-i.left,0,i.width),a=clamp(e-i.top,0,i.height);this.s=n/i.width*100,this.v=100-a/i.height*100,this.updateVisuals(),this.onColorStateChanged()}getInputValue(t){return t?t.getAttribute("value")??"":""}setInputValue(t,e){t&&void 0!==e&&t.setAttribute("value",e)}getPanelControlSize(){return"s"===this.getOption("size",Ve,"m")?"s":"m"}commitColorInput(t){const e=("trigger"===t?this.triggerInputEl?.value:this.getInputValue(this.panelValueInputEl)??"").trim();if(/^#([0-9A-Fa-f]{6})$/.test(e)){const t=hexToRgb$1(e),s=rgbToHsv(t.r,t.g,t.b);return this.h=s.h,this.s=s.s,this.v=s.v,this.colorInput=normalizeHex(e),this.updateVisuals(),void this.onColorStateChanged()}let s=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e);if(s){const t=clamp(parseInt(s[1],10),0,255),e=clamp(parseInt(s[2],10),0,255),i=clamp(parseInt(s[3],10),0,255),n=rgbToHsv(t,e,i);return this.h=n.h,this.s=n.s,this.v=n.v,this.colorInput=`rgb(${t}, ${e}, ${i})`,this.updateVisuals(),void this.onColorStateChanged()}if(s=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i.exec(e),s){const t=clamp(parseInt(s[1],10),0,255),e=clamp(parseInt(s[2],10),0,255),i=clamp(parseInt(s[3],10),0,255),n=parseFloat(s[4]),a=rgbToHsv(t,e,i);this.h=a.h,this.s=a.s,this.v=a.v,this.a=Math.round(100*n),this.alphaInput=String(this.a),this.colorInput=`rgba(${t}, ${e}, ${i}, ${n})`,this.updateVisuals(),this.onColorStateChanged()}}commitAlphaInput(){const t=Number(this.getInputValue(this.panelAlphaInputEl).trim()||this.alphaInput);if(!Number.isNaN(t)&&t>=0&&t<=100){const e=Math.round(t);this.a=e,this.alphaInput=String(e),this.updateVisuals(),this.onColorStateChanged()}else this.alphaInput=String(this.a),this.panelAlphaInputEl&&this.setInputValue(this.panelAlphaInputEl,this.alphaInput)}async onCopy(){try{await navigator.clipboard.writeText(this.getUiFormatted()),this.isCopied=!0,this.updateCopyButtons(),this.copiedTimer&&clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout(()=>{this.isCopied=!1,this.updateCopyButtons()},1600)}catch{}}async onEyedrop(){try{if("EyeDropper"in window){const t=new window.EyeDropper,{sRGBHex:e}=await t.open(),s=hexToRgb$1(e);if(!s)return;const i=rgbToHsv(s.r,s.g,s.b);this.h=i.h,this.s=i.s,this.v=i.v,this.updateVisuals(),this.onColorStateChanged()}}catch{}}toggleOpen(){if(this.getBool("disabled")||this.getBool("readonly"))return;if("modal"===this.getOption("type",Re,"dropdown"))return this.tempColor=this.getHex(),this.open=!0,void this.update();this.open=!this.open,this.update()}mount(){this.mounted=!0;const t=this.getIconSize();this.triggerEl=document.createElement("div"),this.triggerEl.className="designbase-wc-color-picker__trigger",this.triggerEl.addEventListener("click",()=>this.toggleOpen());const e=document.createElement("div");e.className="designbase-wc-color-picker__color-display",this.colorBoxEl=document.createElement("div"),this.colorBoxEl.className="designbase-wc-color-picker__color-box",e.append(this.colorBoxEl),this.triggerInputEl=document.createElement("input"),this.triggerInputEl.type="text",this.triggerInputEl.className="designbase-wc-color-picker__input",this.triggerInputEl.placeholder="#000000",this.triggerInputEl.addEventListener("click",t=>t.stopPropagation()),this.triggerInputEl.addEventListener("focus",()=>{this.triggerInputFocused=!0}),this.triggerInputEl.addEventListener("blur",()=>{this.triggerInputFocused=!1;const t="hex"===this.format?normalizeHex(this.getUiFormatted()):this.getUiFormatted();this.triggerInputEl&&this.triggerInputEl.value!==t&&(this.triggerInputEl.value=t,this.colorInput=t)}),this.triggerInputEl.addEventListener("input",()=>{this.triggerInputEl&&(this.colorInput=this.triggerInputEl.value)}),this.triggerInputEl.addEventListener("keydown",t=>{"Enter"===t.key&&this.commitColorInput("trigger")});const s=document.createElement("div");s.className="designbase-wc-color-picker__trigger-actions",this.triggerCopyBtn=document.createElement("button"),this.triggerCopyBtn.type="button",this.triggerCopyBtn.className="designbase-wc-color-picker__copy-button-inline",this.triggerCopyBtn.setAttribute("aria-label","Copy color value"),this.triggerCopyBtn.addEventListener("click",t=>{t.stopPropagation(),this.onCopy()}),this.toggleBtn=document.createElement("button"),this.toggleBtn.type="button",this.toggleBtn.className="designbase-wc-color-picker__toggle",this.toggleBtn.setAttribute("aria-label","Toggle color picker"),this.toggleBtn.append(createDbIcon("chevron-down",t)),s.append(this.triggerCopyBtn,this.toggleBtn),this.triggerEl.append(e,this.triggerInputEl,s),this.dropdownEl=document.createElement("div"),this.dropdownEl.className="designbase-wc-color-picker__dropdown",this.dropdownEl.addEventListener("click",t=>t.stopPropagation()),this.dropdownEl.hidden=!0;const i=document.createElement("div");i.className="designbase-wc-color-picker__selector";const n=document.createElement("div");n.className="designbase-wc-color-picker__color-area",this.colorFieldEl=document.createElement("div"),this.colorFieldEl.className="designbase-wc-color-picker__color-field",this.colorPointerEl=document.createElement("div"),this.colorPointerEl.className="designbase-wc-color-picker__color-pointer",this.colorFieldEl.append(this.colorPointerEl),this.colorFieldEl.addEventListener("mousedown",t=>{this.getBool("disabled")||this.getBool("readonly")||(t.preventDefault(),this.dragging="area",this.updateFromArea(t.clientX,t.clientY))}),this.colorFieldEl.addEventListener("touchstart",t=>{if(this.getBool("disabled")||this.getBool("readonly"))return;this.dragging="area";const e=t.touches[0];this.updateFromArea(e.clientX,e.clientY)},{passive:!0}),this.colorFieldEl.addEventListener("touchmove",t=>{if("area"!==this.dragging)return;const e=t.touches[0];this.updateFromArea(e.clientX,e.clientY)},{passive:!0}),this.colorFieldEl.addEventListener("touchend",()=>{"area"===this.dragging&&(this.dragging=null,this.onColorStateChanged(!0))}),n.append(this.colorFieldEl);const a=document.createElement("div");a.className="designbase-wc-color-picker__controls",this.eyedropperBtnEl=document.createElement("db-button"),this.eyedropperBtnEl.setAttribute("variant","tertiary"),this.eyedropperBtnEl.setAttribute("size",this.getPanelControlSize()),this.eyedropperBtnEl.setAttribute("icon-only",""),this.eyedropperBtnEl.setAttribute("start-icon","eyedropper"),this.eyedropperBtnEl.setAttribute("aria-label","Eyedropper tool"),this.eyedropperBtnEl.addEventListener("click",()=>{this.onEyedrop()});const r=document.createElement("div");r.className="designbase-wc-color-picker__slider-container";const l=document.createElement("div");l.className="designbase-wc-color-picker__hue-slider",this.hueSliderEl=document.createElement("input"),this.hueSliderEl.type="range",this.hueSliderEl.min="0",this.hueSliderEl.max="360",this.hueSliderEl.className="designbase-wc-color-picker__slider designbase-wc-color-picker__slider--hue",this.hueSliderEl.addEventListener("input",()=>{this.h=parseFloat(this.hueSliderEl.value),this.updateVisuals(),this.onColorStateChanged()}),l.append(this.hueSliderEl),this.alphaSliderWrapEl=document.createElement("div"),this.alphaSliderWrapEl.className="designbase-wc-color-picker__alpha-slider",this.alphaSliderEl=document.createElement("input"),this.alphaSliderEl.type="range",this.alphaSliderEl.min="0",this.alphaSliderEl.max="100",this.alphaSliderEl.className="designbase-wc-color-picker__slider designbase-wc-color-picker__slider--alpha",this.alphaSliderEl.addEventListener("input",()=>{this.a=clamp(parseInt(this.alphaSliderEl.value,10),0,100),this.alphaInput=String(this.a),this.panelAlphaInputEl&&this.setInputValue(this.panelAlphaInputEl,this.alphaInput),this.updateVisuals(),this.onColorStateChanged()}),this.alphaSliderWrapEl.append(this.alphaSliderEl),r.append(l,this.alphaSliderWrapEl),a.append(this.eyedropperBtnEl,r);const o=document.createElement("div");o.className="designbase-wc-color-picker__value-display",this.formatSelectEl=document.createElement("db-select"),this.formatSelectEl.setAttribute("size","s"),this.formatSelectEl.setAttribute("position","top"),this.formatSelectEl.setAttribute("show-clear-button","false"),this.formatSelectEl.setAttribute("options",Je),this.formatSelectEl.addEventListener("db-change",t=>{const e=t.detail,s=e?.value;s&&(this.format=s,this.updateVisuals())}),this.panelValueInputEl=document.createElement("db-input"),this.panelValueInputEl.classList.add("designbase-wc-color-picker__value-input"),this.panelValueInputEl.setAttribute("size","s"),this.panelValueInputEl.setAttribute("placeholder","#000000"),this.panelValueInputEl.addEventListener("db-focus",()=>{this.panelInputFocused=!0}),this.panelValueInputEl.addEventListener("db-blur",()=>{this.panelInputFocused=!1;const t="hex"===this.format?normalizeHex(this.getUiFormatted()):this.getUiFormatted();this.getInputValue(this.panelValueInputEl)!==t&&(this.setInputValue(this.panelValueInputEl,t),this.colorInput=t)}),this.panelValueInputEl.addEventListener("db-input",t=>{const e=t.detail;void 0!==e?.value&&(this.colorInput=e.value)}),this.panelValueInputEl.addEventListener("keydown",t=>{"Enter"===t.key&&this.commitColorInput("panel")}),this.panelAlphaWrapEl=document.createElement("div"),this.panelAlphaWrapEl.className="designbase-wc-color-picker__alpha-input-wrap",this.panelAlphaInputEl=document.createElement("db-input"),this.panelAlphaInputEl.classList.add("designbase-wc-color-picker__alpha-input"),this.panelAlphaInputEl.setAttribute("size","s"),this.panelAlphaInputEl.setAttribute("placeholder","100"),this.panelAlphaInputEl.setAttribute("aria-label","Alpha percent"),this.panelAlphaInputEl.addEventListener("db-focus",()=>{this.panelAlphaInputFocused=!0}),this.panelAlphaInputEl.addEventListener("db-blur",()=>{this.panelAlphaInputFocused=!1,this.commitAlphaInput()}),this.panelAlphaInputEl.addEventListener("db-input",t=>{const e=t.detail,s=(e?.value??"").replace(/[^\d]/g,"").slice(0,3);s!==e?.value&&this.setInputValue(this.panelAlphaInputEl,s),this.alphaInput=s}),this.panelAlphaInputEl.addEventListener("keydown",t=>{"Enter"===t.key&&this.commitAlphaInput()});const d=document.createElement("span");d.className="designbase-wc-color-picker__alpha-suffix",d.textContent="%",this.panelAlphaWrapEl.append(this.panelAlphaInputEl,d),this.panelCopyBtnEl=document.createElement("db-button"),this.panelCopyBtnEl.setAttribute("variant","tertiary"),this.panelCopyBtnEl.setAttribute("size","s"),this.panelCopyBtnEl.setAttribute("icon-only",""),this.panelCopyBtnEl.setAttribute("start-icon","copy"),this.panelCopyBtnEl.setAttribute("aria-label","Copy color value"),this.panelCopyBtnEl.addEventListener("click",()=>{this.onCopy()}),o.append(this.formatSelectEl,this.panelValueInputEl,this.panelAlphaWrapEl,this.panelCopyBtnEl),i.append(n,a,o),this.selectorEl=i,this.dropdownEl.append(i),this.modalEl=document.createElement("db-modal"),this.modalEl.setAttribute("size","s"),this.modalEl.setAttribute("title","색상 선택"),this.modalEl.setAttribute("close-on-escape","true"),this.modalEl.addEventListener("db-close",this.handleModalCancel),this.modalBodyEl=document.createElement("div"),this.modalBodyEl.setAttribute("data-modal-part","body");const u=document.createElement("div");u.setAttribute("data-modal-part","footer"),u.style.display="flex",u.style.gap="8px",u.style.justifyContent="flex-end";const b=document.createElement("db-button");b.setAttribute("variant","tertiary"),b.setAttribute("size","m"),b.textContent="취소",b.addEventListener("click",this.handleModalCancel);const p=document.createElement("db-button");p.setAttribute("variant","primary"),p.setAttribute("size","m"),p.textContent="적용",p.addEventListener("click",this.handleModalApply),u.append(b,p),this.modalEl.append(this.modalBodyEl,u),this.replaceChildren(this.triggerEl,this.dropdownEl,this.modalEl)}updateCopyButtons(){const t=this.getIconSize(),e=this.isCopied?"done":"copy";this.triggerCopyBtn&&this.triggerCopyBtn.replaceChildren(createDbIcon(e,t)),this.panelCopyBtnEl&&this.panelCopyBtnEl.setAttribute("start-icon",e)}updateVisuals(){const t=this.getRgb(),e=this.getHex(),s=this.getBool("show-alpha",!0),i=this.getUiFormatted(),n="hex"===this.format?normalizeHex(i):i;!this.triggerInputFocused&&this.triggerInputEl&&(this.triggerInputEl.value=n),!this.panelInputFocused&&this.panelValueInputEl&&this.setInputValue(this.panelValueInputEl,n),this.colorBoxEl&&(this.colorBoxEl.style.backgroundColor=s?`rgba(${t.r}, ${t.g}, ${t.b}, ${this.a/100})`:e),this.colorFieldEl&&(this.colorFieldEl.style.backgroundImage=`\n linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0)),\n linear-gradient(to right, #ffffff, hsl(${this.h}, 100%, 50%))\n `),this.colorPointerEl&&(this.colorPointerEl.style.left=`${this.s}%`,this.colorPointerEl.style.top=100-this.v+"%",this.colorPointerEl.style.backgroundColor=`rgb(${t.r}, ${t.g}, ${t.b})`),this.hueSliderEl&&(this.hueSliderEl.value=String(this.h),this.hueSliderEl.style.background="linear-gradient(to right,\n hsl(0,100%,50%),\n hsl(60,100%,50%),\n hsl(120,100%,50%),\n hsl(180,100%,50%),\n hsl(240,100%,50%),\n hsl(300,100%,50%),\n hsl(360,100%,50%))"),this.alphaSliderEl&&(this.alphaSliderEl.value=String(this.a),this.alphaSliderEl.style.backgroundImage=`\n linear-gradient(45deg, var(--db-border-base) 25%, transparent 25%),\n linear-gradient(-45deg, var(--db-border-base) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--db-border-base) 75%),\n linear-gradient(-45deg, transparent 75%, var(--db-border-base) 75%),\n linear-gradient(to right, rgba(${t.r}, ${t.g}, ${t.b}, 0), rgba(${t.r}, ${t.g}, ${t.b}, 1))\n `,this.alphaSliderEl.style.backgroundSize="8px 8px,8px 8px,8px 8px,8px 8px,100% 100%",this.alphaSliderEl.style.backgroundPosition="0 0,0 4px,4px -4px,-4px 0,0 0",this.alphaSliderEl.style.backgroundColor="var(--db-surface-base)"),this.panelAlphaInputEl&&!this.panelAlphaInputFocused&&this.setInputValue(this.panelAlphaInputEl,this.alphaInput),this.formatSelectEl&&this.formatSelectEl.getAttribute("value")!==this.format&&this.formatSelectEl.setAttribute("value",this.format),this.colorInput=n}update(){if(!this.mounted)return;const t=this.getOption("size",Ve,"m"),e=this.getOption("type",Re,"dropdown"),s=this.getOption("position",qe,"bottom-start"),i=this.getBool("disabled"),n=this.getBool("readonly"),a=this.getBool("show-input",!0),r=this.getBool("show-alpha",!0),l=this.getBool("show-format-selector",!0),o=this.getBool("show-copy-button",!0),d=this.getBool("show-eyedropper",!0),u="undefined"!=typeof window&&"EyeDropper"in window;if(this.className=["designbase-wc-color-picker",`designbase-wc-color-picker--${t}`,`designbase-wc-color-picker--${s}`,this.open&&"dropdown"===e&&"designbase-wc-color-picker--open",this.getBool("full-width")&&"designbase-wc-color-picker--full-width",this.getBool("error")&&"designbase-wc-color-picker--error",i&&"designbase-wc-color-picker--disabled",n&&"designbase-wc-color-picker--readonly",!a&&"designbase-wc-color-picker--no-input"].filter(Boolean).join(" "),this.triggerInputEl&&(this.triggerInputEl.hidden=!a,this.triggerInputEl.disabled=i,this.triggerInputEl.readOnly=n),this.triggerCopyBtn&&(this.triggerCopyBtn.hidden=!(a&&o),this.triggerCopyBtn.disabled=i),this.toggleBtn&&(this.toggleBtn.disabled=i),this.dropdownEl&&(this.dropdownEl.className=`designbase-wc-color-picker__dropdown designbase-wc-color-picker__dropdown--${s}`,this.dropdownEl.hidden=!("dropdown"===e&&this.open)),this.alphaSliderWrapEl&&(this.alphaSliderWrapEl.hidden=!r),this.panelAlphaWrapEl&&(this.panelAlphaWrapEl.hidden=!r),this.formatSelectEl&&(this.formatSelectEl.hidden=!l),this.panelCopyBtnEl&&(this.panelCopyBtnEl.hidden=!o),this.eyedropperBtnEl&&(this.eyedropperBtnEl.hidden=!(d&&u)),this.selectorEl){const t="modal"===e?this.modalBodyEl:this.dropdownEl;t&&this.selectorEl.parentElement!==t&&t.append(this.selectorEl)}this.modalEl&&("modal"===e&&this.open?this.modalEl.setAttribute("open","true"):this.modalEl.removeAttribute("open")),this.updateCopyButtons(),this.updateVisuals()}}customElements.get("db-color-picker")||customElements.define("db-color-picker",DbColorPicker);const Ke=["default","bordered","filled","minimal"],Ge=["s","m","l"],Ye=["vertical","horizontal"];class DbReorder extends HTMLElement{constructor(){super(...arguments),this.draggedIndex=-1,this.dropIndex=-1,this.handleContainerDragOver=t=>{if(this.draggedIndex<0)return;const e=t.target;if(e instanceof Element&&e.closest(".designbase-wc-reorder__item"))return;t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move");const s=this.getDropIndexFromContainerPointer(t);this.setDropIndex(this.isValidDropIndex(s)?s:-1)},this.handleContainerDrop=t=>{if(this.draggedIndex<0)return;const e=t.target;if(e instanceof Element&&e.closest(".designbase-wc-reorder__item"))return;t.preventDefault();const s=this.dropIndex>=0?this.dropIndex:this.getDropIndexFromContainerPointer(t);this.commitDrop(s)}}static get observedAttributes(){return["items","variant","size","orientation","selectable","multi-select","show-drag-handle","show-drag-icon","full-width","disabled"]}get items(){try{const t=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}connectedCallback(){this.addEventListener("dragover",this.handleContainerDragOver),this.addEventListener("drop",this.handleContainerDrop),this.render()}disconnectedCallback(){this.removeEventListener("dragover",this.handleContainerDragOver),this.removeEventListener("drop",this.handleContainerDrop)}attributeChangedCallback(){this.render()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getOption(t,e,s){const i=this.getAttribute(t);return i&&e.includes(i)?i:s}emitReorder(t){this.items=t,this.dispatchEvent(new CustomEvent("db-reorder",{detail:{items:t},bubbles:!0,composed:!0}))}getItemElements(){return Array.from(this.children).filter(t=>t instanceof HTMLElement&&t.classList.contains("designbase-wc-reorder__item"))}updateDragClasses(){const t=this.getOption("orientation",Ye,"vertical"),e=this.draggedIndex>=0,s=this.items.length,i=e&&this.isValidDropIndex(this.dropIndex);this.classList.toggle("designbase-wc-reorder--dragging",e),this.getItemElements().forEach((n,a)=>{const r=e&&this.draggedIndex===a,l=i&&this.dropIndex===a,o=i&&this.dropIndex===s&&a===s-1,d=l||o;n.classList.toggle("designbase-wc-reorder__item--dragged",r),n.classList.toggle("designbase-wc-reorder__item--drag-over",d),n.classList.toggle("designbase-wc-reorder__item--drag-down",l&&"vertical"===t),n.classList.toggle("designbase-wc-reorder__item--drag-up",o&&"vertical"===t),n.classList.toggle("designbase-wc-reorder__item--drag-right",l&&"horizontal"===t),n.classList.toggle("designbase-wc-reorder__item--drag-left",o&&"horizontal"===t)})}getAdjustedDropIndex(t=this.dropIndex){return this.draggedIndex<0||t<0?-1:t>this.draggedIndex?t-1:t}isValidDropIndex(t=this.dropIndex){const e=this.getAdjustedDropIndex(t);return e>=0&&e!==this.draggedIndex}getDropIndexFromPointer(t,e,s,i){const n=e.getBoundingClientRect();return("horizontal"===i?t.clientX-n.left:t.clientY-n.top)<("horizontal"===i?n.width/2:n.height/2)?s:s+1}getDropIndexFromContainerPointer(t){const e=this.getOption("orientation",Ye,"vertical"),s=this.getItemElements();if(0===s.length)return-1;const i="horizontal"===e?t.clientX:t.clientY;for(let t=0;t<s.length;t+=1){const n=s[t].getBoundingClientRect();if(i<("horizontal"===e?n.left:n.top)+("horizontal"===e?n.width:n.height)/2)return t}return s.length}commitDrop(t){const e=this.getAdjustedDropIndex(t);if(this.draggedIndex<0||e<0||e===this.draggedIndex)return void this.resetDragState();const s=[...this.items],[i]=s.splice(this.draggedIndex,1);s.splice(e,0,i),this.draggedIndex=-1,this.dropIndex=-1,this.emitReorder(s)}setDropIndex(t){this.dropIndex!==t&&(this.dropIndex=t,this.updateDragClasses())}resetDragState(){this.draggedIndex=-1,this.dropIndex=-1,this.updateDragClasses()}render(){const t=this.getOption("variant",Ke,"default"),e=this.getOption("size",Ge,"m"),s=this.getOption("orientation",Ye,"vertical"),i=this.getBool("disabled"),n=this.getBool("selectable"),a=this.getBool("multi-select"),r=this.getBool("show-drag-handle",!0),l=this.getBool("show-drag-icon",!0);this.className=["designbase-wc-reorder",`designbase-wc-reorder--${t}`,`designbase-wc-reorder--${e}`,`designbase-wc-reorder--${s}`,this.getBool("full-width")&&"designbase-wc-reorder--full-width",i&&"designbase-wc-reorder--disabled",n&&"designbase-wc-reorder--selectable"].filter(Boolean).join(" ");const o=document.createDocumentFragment();this.items.forEach((t,d)=>{const u=document.createElement("div"),b=i||!!t.disabled,p=this.draggedIndex===d,m=this.draggedIndex>=0&&this.isValidDropIndex(this.dropIndex),g=m&&this.dropIndex===d,v=m&&this.dropIndex===this.items.length&&d===this.items.length-1,E=g||v;if(u.className=["designbase-wc-reorder__item",t.selected&&"designbase-wc-reorder__item--selected",p&&"designbase-wc-reorder__item--dragged",b&&"designbase-wc-reorder__item--disabled",E&&"designbase-wc-reorder__item--drag-over",g&&"vertical"===s&&"designbase-wc-reorder__item--drag-down",v&&"vertical"===s&&"designbase-wc-reorder__item--drag-up",g&&"horizontal"===s&&"designbase-wc-reorder__item--drag-right",v&&"horizontal"===s&&"designbase-wc-reorder__item--drag-left"].filter(Boolean).join(" "),u.draggable=!b,u.addEventListener("dragstart",e=>{b||(this.draggedIndex=d,this.dropIndex=-1,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.id)),this.updateDragClasses())}),u.addEventListener("dragover",t=>{if(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.draggedIndex<0)return void this.setDropIndex(-1);const e=this.getDropIndexFromPointer(t,u,d,s);this.setDropIndex(this.isValidDropIndex(e)?e:-1)}),u.addEventListener("dragleave",t=>{const e=u.getBoundingClientRect(),s=t.clientX-e.left,i=t.clientY-e.top;(s<0||s>e.width||i<0||i>e.height)&&this.setDropIndex(-1)}),u.addEventListener("drop",t=>{t.preventDefault();const e=this.dropIndex>=0?this.dropIndex:this.getDropIndexFromPointer(t,u,d,s);this.commitDrop(e)}),u.addEventListener("dragend",()=>{this.resetDragState()}),r&&!b){const t=document.createElement("div");if(t.className="designbase-wc-reorder__drag-handle",t.setAttribute("aria-hidden","true"),l){const i="horizontal"===s?"grip-horizontal":"grip-vertical",n="s"===e?14:"l"===e?18:16;t.append(createDbIcon(i,n))}else t.textContent="≡";u.append(t)}if(n){const e=document.createElement("div");e.className="designbase-wc-reorder__checkbox";const s=document.createElement("input");s.type=a?"checkbox":"radio",s.checked=!!t.selected,s.disabled=b,s.className="designbase-wc-reorder__checkbox-input",s.addEventListener("change",()=>{const e=this.items.map(e=>e.id!==t.id?a?e:{...e,selected:!1}:{...e,selected:!a||!e.selected});this.items=e,this.dispatchEvent(new CustomEvent("db-select",{detail:{items:e.filter(t=>t.selected)},bubbles:!0,composed:!0})),this.render()}),e.append(s),u.append(e)}const f=document.createElement("div");f.className="designbase-wc-reorder__content",f.textContent=t.content,u.append(f),o.append(u)}),this.replaceChildren(o)}}customElements.get("db-reorder")||customElements.define("db-reorder",DbReorder);const Xe=["both","horizontal","vertical"],Ze=["bottom-right","bottom-left","top-right","top-left","right","bottom"];class DbResizablePanels extends HTMLElement{constructor(){super(...arguments),this.isResizing=!1,this.startSize={width:0,height:0},this.startPos={x:0,y:0},this.currentSize={width:0,height:0},this.onMouseDown=t=>{t.preventDefault(),this.startResize(t.clientX,t.clientY),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},this.onTouchStart=t=>{t.preventDefault();const e=t.touches[0];this.startResize(e.clientX,e.clientY),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onTouchEnd)},this.onMouseMove=t=>{this.applyResize(t.clientX,t.clientY)},this.onTouchMove=t=>{t.preventDefault();const e=t.touches[0];this.applyResize(e.clientX,e.clientY)},this.onMouseUp=()=>{this.endResize(),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},this.onTouchEnd=()=>{this.endResize(),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd)}}static get observedAttributes(){return["initial-width","initial-height","min-width","min-height","max-width","max-height","direction","handle-position","handle-size","handle-color","handle-hover-color","snap-to-grid","show-guides","show-size-indicator","show-constraints","show-border","shadow","background-color","border-radius"]}connectedCallback(){this.ensureStructure(),this.initializeSize(),this.render()}attributeChangedCallback(){this.render()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getNumber(t,e){const s=Number(this.getAttribute(t)??e);return Number.isFinite(s)?s:e}getDirection(){const t=this.getAttribute("direction");return t&&Xe.includes(t)?t:"both"}getHandlePosition(){const t=this.getAttribute("handle-position");return t&&Ze.includes(t)?t:"bottom-right"}initializeSize(){const t=this.parentElement?.getBoundingClientRect();if(!t)return;const e=this.getAttribute("initial-width")||"100%",s=this.getAttribute("initial-height")||"100%";this.currentSize={width:"string"==typeof e&&e.endsWith("%")?t.width*Number(e.replace("%",""))/100:Number(e)||t.width,height:"string"==typeof s&&s.endsWith("%")?t.height*Number(s.replace("%",""))/100:Number(s)||t.height}}getMinSize(){return{width:this.getNumber("min-width",200),height:this.getNumber("min-height",150)}}getMaxSize(){const t=this.parentElement?.getBoundingClientRect();if(!t)return{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY};const e=this.getAttribute("max-width")||"100vw",s=this.getAttribute("max-height")||"100vh",toSize=(t,e,s)=>{if("100vw"===t||"100vh"===t)return e;if("100%"===t)return s;const i=Number(t);return Number.isFinite(i)?i:Number.POSITIVE_INFINITY};return{width:toSize(e,window.innerWidth,t.width),height:toSize(s,window.innerHeight,t.height)}}ensureStructure(){if(this.container)return;this.container=document.createElement("div"),this.container.className="designbase-wc-resizable-panels",this.guidesEl=document.createElement("div"),this.guidesEl.className="designbase-wc-resizable-panels__guides";const t=document.createElement("div");t.className="designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--horizontal";const e=document.createElement("div");e.className="designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--vertical",this.guidesEl.append(t,e),this.sizeIndicatorEl=document.createElement("div"),this.sizeIndicatorEl.className="designbase-wc-resizable-panels__size-indicator",this.constraintsEl=document.createElement("div"),this.constraintsEl.className="designbase-wc-resizable-panels__constraints",this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-resizable-panels__content",this.handleEl=document.createElement("div"),this.handleEl.className="designbase-wc-resizable-panels__handle",this.handleEl.addEventListener("mousedown",this.onMouseDown),this.handleEl.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.container.append(this.guidesEl,this.sizeIndicatorEl,this.constraintsEl,this.contentEl,this.handleEl),this.replaceChildren(this.container)}startResize(t,e){this.isResizing=!0,this.startSize={...this.currentSize},this.startPos={x:t,y:e},this.dispatchEvent(new CustomEvent("db-resize-start",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render()}applyResize(t,e){if(!this.isResizing)return;const s=t-this.startPos.x,i=e-this.startPos.y,n=this.getDirection();let a=this.startSize.width,r=this.startSize.height;"both"!==n&&"horizontal"!==n||(a+=s),"both"!==n&&"vertical"!==n||(r+=i);const l=this.getNumber("snap-to-grid",0);l>0&&(a=Math.round(a/l)*l,r=Math.round(r/l)*l);const o=this.getMinSize(),d=this.getMaxSize();a=Math.max(o.width,Math.min(d.width,a)),r=Math.max(o.height,Math.min(d.height,r)),this.currentSize={width:a,height:r},this.dispatchEvent(new CustomEvent("db-resize",{detail:this.currentSize,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-size-change",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render()}endResize(){this.isResizing&&(this.isResizing=!1,this.dispatchEvent(new CustomEvent("db-resize-end",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render())}renderHandleStyle(){if(!this.handleEl)return;const t=this.getDirection(),e=this.getHandlePosition(),s=this.getAttribute("handle-color"),i=this.getAttribute("handle-hover-color");s?this.handleEl.style.setProperty("--db-resize-handle-color",s):this.handleEl.style.removeProperty("--db-resize-handle-color"),i?this.handleEl.style.setProperty("--db-resize-handle-hover-color",i):this.handleEl.style.removeProperty("--db-resize-handle-hover-color"),this.handleEl.style.top="",this.handleEl.style.right="",this.handleEl.style.bottom="",this.handleEl.style.left="",this.handleEl.style.transform="",this.handleEl.style.width="",this.handleEl.style.height="",this.handleEl.style.backgroundColor="",this.handleEl.onmouseenter=null,this.handleEl.onmouseleave=null;let n=`corner-${e}`;"vertical"===t?n="edge-bottom":"horizontal"===t&&(n="edge-right"),this.handleEl.className=`designbase-wc-resizable-panels__handle designbase-wc-resizable-panels__handle--${n}`,this.handleEl.setAttribute("role","separator"),this.handleEl.setAttribute("aria-label","크기 조절"),this.handleEl.replaceChildren()}render(){if(this.ensureStructure(),!(this.container&&this.contentEl&&this.guidesEl&&this.sizeIndicatorEl&&this.constraintsEl))return;const t=["designbase-wc-resizable-panels",this.isResizing&&"designbase-wc-resizable-panels--resizing",this.getBool("show-border",!0)&&"designbase-wc-resizable-panels--border",this.getBool("shadow",!0)&&"designbase-wc-resizable-panels--shadow"].filter(Boolean).join(" ");this.container.className=t,this.container.style.width=`${this.currentSize.width}px`,this.container.style.height=`${this.currentSize.height}px`;const e=this.getAttribute("background-color");this.container.style.backgroundColor=e||"";const s=this.getAttribute("border-radius")||"8px";if(this.container.style.borderRadius=/^\d+$/.test(s)?`${s}px`:s,0===this.contentEl.children.length){const t=Array.from(this.childNodes).filter(t=>t!==this.container);this.contentEl.append(...t)}if(this.guidesEl.style.display=this.getBool("show-guides",!0)&&this.isResizing?"":"none",this.sizeIndicatorEl.style.display=this.getBool("show-size-indicator",!0)&&this.isResizing?"":"none",this.sizeIndicatorEl.textContent=`${Math.round(this.currentSize.width)} × ${Math.round(this.currentSize.height)}`,this.constraintsEl.style.display=this.getBool("show-constraints",!0)&&this.isResizing?"":"none",this.constraintsEl.replaceChildren(),"none"!==this.constraintsEl.style.display){const t=this.getMinSize(),e=this.getMaxSize();this.currentSize.width<=t.width&&this.constraintsEl.append(this.makeConstraint("최소 너비 도달","min")),this.currentSize.height<=t.height&&this.constraintsEl.append(this.makeConstraint("최소 높이 도달","min")),this.currentSize.width>=e.width&&this.constraintsEl.append(this.makeConstraint("최대 너비 도달","max")),this.currentSize.height>=e.height&&this.constraintsEl.append(this.makeConstraint("최대 높이 도달","max"))}this.renderHandleStyle()}makeConstraint(t,e){const s=document.createElement("div");return s.className=`designbase-wc-resizable-panels__constraint designbase-wc-resizable-panels__constraint--${e}`,s.textContent=t,s}}customElements.get("db-resizable-panels")||customElements.define("db-resizable-panels",DbResizablePanels);const Qe="designbase-wc-video-player",ts=20;class DbVideoPlayer extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.rafId=null,this.playlistIndex=0,this.isFullscreen=!1,this.showControlsOverlay=!1,this.isPlaying=!1,this.isMuted=!1,this.volume=1,this.lastVolumeBeforeMute=1,this.currentTime=0,this.duration=0,this.isLoading=!1,this.error=null,this.onFullscreenChange=()=>{this.isFullscreen=document.fullscreenElement===this,this.dispatchEvent(new CustomEvent("db-fullscreen-change",{detail:{isFullscreen:this.isFullscreen},bubbles:!0,composed:!0})),this.updateUI()},this.onMouseEnter=()=>{this.showControlsOverlay=!0,this.updateUI()},this.onMouseLeave=()=>{this.showControlsOverlay=!1,this.updateUI()}}static get observedAttributes(){return["src","poster","title","description","size","variant","theme","auto-play","loop","muted","show-controls","enable-fullscreen","show-progress","show-time","show-volume","playlist","current-index"]}connectedCallback(){this.built||(this.built=!0,this.build(),this.bindVideoEvents()),this.syncFromAttributes(),this.updateUI(),document.addEventListener("fullscreenchange",this.onFullscreenChange),this.addEventListener("mouseenter",this.onMouseEnter),this.addEventListener("mouseleave",this.onMouseLeave)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.removeEventListener("mouseenter",this.onMouseEnter),this.removeEventListener("mouseleave",this.onMouseLeave),this.stopProgressAnimation()}attributeChangedCallback(t){this.built&&("src"!==t&&"playlist"!==t&&"current-index"!==t?("muted"===t&&this.videoEl&&(this.videoEl.muted=this.getBool("muted")),this.updateUI()):this.loadVideoSource())}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getPlaylist(){try{const t=this.getAttribute("playlist"),e=t?JSON.parse(t):[];return Array.isArray(e)?e:[]}catch{return[]}}getCurrentSrc(){const t=this.getPlaylist();if(t.length>0){const e=Number(this.getAttribute("current-index")||this.playlistIndex||0);return t[Math.max(0,Math.min(t.length-1,e))]}return this.getAttribute("src")||""}formatTime(t){if(!Number.isFinite(t)||t<0)return"0:00";return`${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")}`}iconButton(t,e,s){const i=document.createElement("button");return i.type="button",i.className=`${Qe}__control-button`,i.append(createDbIcon(t,e)),i.addEventListener("click",t=>{t.stopPropagation(),s()}),i}skipButton(t,e){const s=document.createElement("button");return s.type="button",s.className=`${Qe}__skip-button`,s.textContent=t,s.setAttribute("aria-label",e<0?"10초 되감기":"10초 빨리감기"),s.addEventListener("click",t=>{t.stopPropagation(),this.seekBy(e)}),s}syncFromAttributes(){this.playlistIndex=Number(this.getAttribute("current-index")||0),this.isMuted=this.getBool("muted"),this.volume=this.isMuted?0:1,this.lastVolumeBeforeMute=this.volume>0?this.volume:1,this.loadVideoSource()}loadVideoSource(){if(!this.videoEl)return;const t=this.getCurrentSrc();if(!t)return;const e=new URL(t,window.location.href).href;this.videoEl.src!==e&&(this.videoEl.src=t,this.videoEl.load()),this.videoEl.poster=this.getAttribute("poster")||"",this.videoEl.autoplay=this.getBool("auto-play"),this.videoEl.loop=this.getBool("loop"),this.videoEl.muted=this.getBool("muted"),this.videoEl.playsInline=!0}bindVideoEvents(){const t=this.videoEl;t&&(t.addEventListener("play",()=>{this.isPlaying=!0,this.startProgressAnimation(),this.dispatchEvent(new CustomEvent("db-play",{bubbles:!0,composed:!0})),this.updateUI()}),t.addEventListener("pause",()=>{this.isPlaying=!1,this.stopProgressAnimation(),this.dispatchEvent(new CustomEvent("db-pause",{bubbles:!0,composed:!0})),this.updateUI()}),t.addEventListener("timeupdate",()=>{this.currentTime=t.currentTime,this.duration=Number.isFinite(t.duration)?t.duration:0,this.dispatchEvent(new CustomEvent("db-time-update",{detail:{currentTime:this.currentTime,duration:this.duration},bubbles:!0,composed:!0})),this.updateProgress(),this.updateTime()}),t.addEventListener("volumechange",()=>{this.volume=t.volume,this.isMuted=t.muted||0===t.volume,!this.isMuted&&this.volume>0&&(this.lastVolumeBeforeMute=this.volume),this.dispatchEvent(new CustomEvent("db-volume-change",{detail:{volume:this.volume},bubbles:!0,composed:!0})),this.updateVolumeUI()}),t.addEventListener("ended",()=>{this.isPlaying=!1,this.stopProgressAnimation(),this.dispatchEvent(new CustomEvent("db-ended",{bubbles:!0,composed:!0}));const e=this.getPlaylist(),s=this.playlistIndex+1;e.length>0&&s<e.length&&(this.playlistIndex=s,this.loadVideoSource(),t.play()),this.updateUI()}),t.addEventListener("error",()=>{this.error="비디오를 재생할 수 없습니다.",this.dispatchEvent(new CustomEvent("db-error",{detail:{error:this.error},bubbles:!0,composed:!0})),this.updateUI()}),t.addEventListener("loadstart",()=>{this.isLoading=!0,this.error=null,this.updateUI()}),t.addEventListener("loadedmetadata",()=>{this.duration=Number.isFinite(t.duration)?t.duration:0,this.updateTime()}),t.addEventListener("canplay",()=>{this.isLoading=!1,this.updateUI()}),t.addEventListener("click",()=>this.togglePlay()))}togglePlay(){this.videoEl&&(this.videoEl.paused?this.videoEl.play():this.videoEl.pause())}toggleMute(){if(this.videoEl){if(this.isMuted)return this.videoEl.muted=!1,void(this.videoEl.volume=this.lastVolumeBeforeMute>0?this.lastVolumeBeforeMute:1);this.videoEl.volume>0&&(this.lastVolumeBeforeMute=this.videoEl.volume),this.videoEl.muted=!0,this.videoEl.volume=0}}seekBy(t){if(!this.videoEl)return;const e=Number.isFinite(this.videoEl.duration)?this.videoEl.duration:0,s=e>0?e:Number.MAX_SAFE_INTEGER,i=Math.max(0,Math.min(s,this.videoEl.currentTime+t));this.videoEl.currentTime=i}toggleFullscreen(){this.getBool("enable-fullscreen",!0)&&(this.isFullscreen?document.exitFullscreen?.():this.requestFullscreen?.())}build(){this.videoEl=document.createElement("video"),this.videoEl.className=`${Qe}__video`;const t=document.createElement("div");t.className=`${Qe}__loading`;const e=document.createElement("div");e.className=`${Qe}__spinner`,t.append(e);const s=document.createElement("div");s.className=`${Qe}__error`;const i=document.createElement("p");i.textContent="비디오를 재생할 수 없습니다.";const n=document.createElement("button");n.type="button",n.textContent="다시 시도",n.addEventListener("click",()=>{this.error=null,this.loadVideoSource(),this.updateUI()}),s.append(i,n),this.dimOverlayEl=document.createElement("div"),this.dimOverlayEl.className=`${Qe}__dim-overlay`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${Qe}__overlay`;const a=document.createElement("div");a.className=`${Qe}__top-controls`;const r=document.createElement("div");r.className=`${Qe}__title`;const l=document.createElement("h3"),o=document.createElement("p");r.append(l,o),a.append(r),this._titleEl=l,this._descEl=o;const d=document.createElement("div");d.className=`${Qe}__center-controls`;const u=this.skipButton("-10",-10);this.centerPlayEl=document.createElement("button"),this.centerPlayEl.type="button",this.centerPlayEl.className=`${Qe}__play-button`,this.centerPlayEl.addEventListener("click",t=>{t.stopPropagation(),this.togglePlay()});const b=this.skipButton("+10",10);d.append(u,this.centerPlayEl,b);const p=document.createElement("div");p.className=`${Qe}__bottom-controls`,this.progressEl=document.createElement("div"),this.progressEl.className=`${Qe}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${Qe}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${Qe}__progress-handle`,this.progressEl.append(this.progressBarEl,this.progressHandleEl),this.progressEl.addEventListener("click",t=>{if(!this.videoEl||!Number.isFinite(this.duration)||this.duration<=0)return;const e=this.progressEl.getBoundingClientRect(),s=(t.clientX-e.left)/e.width;this.videoEl.currentTime=s*this.duration});const m=document.createElement("div");m.className=`${Qe}__controls`;const g=document.createElement("div");g.className=`${Qe}__left-controls`,this.togglePlayEl=this.iconButton("play",ts,()=>this.togglePlay()),this.volumeWrapEl=document.createElement("div"),this.volumeWrapEl.className=`${Qe}__volume`,this.muteButtonEl=this.iconButton("volume-up",ts,()=>this.toggleMute());const v=document.createElement("div");v.className=`${Qe}__volume-slider`,this.volumeInputEl=document.createElement("input"),this.volumeInputEl.type="range",this.volumeInputEl.min="0",this.volumeInputEl.max="1",this.volumeInputEl.step="0.1",this.volumeInputEl.addEventListener("input",()=>{if(!this.videoEl||!this.volumeInputEl)return;const t=parseFloat(this.volumeInputEl.value);t>0&&(this.lastVolumeBeforeMute=t),this.videoEl.volume=t,this.videoEl.muted=0===t}),v.append(this.volumeInputEl),this.volumeWrapEl.append(this.muteButtonEl,v),this.timeEl=document.createElement("div"),this.timeEl.className=`${Qe}__time`,this.timeCurrentEl=document.createElement("span");const E=document.createElement("span");E.textContent="/",this.timeDurationEl=document.createElement("span"),this.timeEl.append(this.timeCurrentEl,E,this.timeDurationEl),g.append(this.togglePlayEl,this.volumeWrapEl,this.timeEl);const f=document.createElement("div");f.className=`${Qe}__right-controls`,this.fullscreenButtonEl=this.iconButton("expand",ts,()=>this.toggleFullscreen()),f.append(this.fullscreenButtonEl),m.append(g,f),p.append(this.progressEl,m),this.overlayEl.append(a,d,p),this.append(this.videoEl,t,s,this.dimOverlayEl,this.overlayEl)}get titleEl(){return this._titleEl}get descEl(){return this._descEl}updateProgress(){const t=this.duration>0?this.currentTime/this.duration*100:0;this.progressBarEl&&(this.progressBarEl.style.width=`${t}%`),this.progressHandleEl&&(this.progressHandleEl.style.left=`${t}%`)}updateTime(){this.timeCurrentEl&&(this.timeCurrentEl.textContent=this.formatTime(this.currentTime)),this.timeDurationEl&&(this.timeDurationEl.textContent=this.formatTime(this.duration))}updateVolumeUI(){const t=this.isMuted?0:this.volume;this.volumeInputEl&&(this.volumeInputEl.value=String(t)),this.muteButtonEl&&this.muteButtonEl.replaceChildren(createDbIcon(this.isMuted||0===t?"mute-filled":"volume-up",ts))}startProgressAnimation(){this.stopProgressAnimation();const tick=()=>{!this.videoEl||this.videoEl.paused||this.videoEl.ended||(this.currentTime=this.videoEl.currentTime,this.duration=Number.isFinite(this.videoEl.duration)?this.videoEl.duration:0,this.updateProgress(),this.updateTime(),this.rafId=requestAnimationFrame(tick))};this.rafId=requestAnimationFrame(tick)}stopProgressAnimation(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null)}updatePlayIcons(){const t=this.isPlaying?"pause":"play";this.centerPlayEl&&this.centerPlayEl.replaceChildren(createDbIcon(t,48)),this.togglePlayEl&&this.togglePlayEl.replaceChildren(createDbIcon(t,ts))}updateUI(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto",i=this.getBool("show-controls",!0),n=this.getBool("show-progress",!0),a=this.getBool("show-time",!0),r=this.getBool("show-volume",!0),l=this.getBool("enable-fullscreen",!0);this.className=[Qe,`${Qe}--size-${t}`,`${Qe}--variant-${e}`,`${Qe}--theme-${s}`,this.isPlaying&&`${Qe}--playing`,!this.isPlaying&&`${Qe}--paused`,this.isMuted&&`${Qe}--muted`,this.isLoading&&`${Qe}--loading`,this.error&&`${Qe}--error`,i&&this.showControlsOverlay&&`${Qe}--show-controls`,this.isFullscreen&&`${Qe}--fullscreen`].filter(Boolean).join(" ");const o=this.getAttribute("title"),d=this.getAttribute("description");this.titleEl&&(o?(this.titleEl.textContent=o,this.titleEl.hidden=!1):this.titleEl.hidden=!0),this.descEl&&(d?(this.descEl.textContent=d,this.descEl.hidden=!1):this.descEl.hidden=!0),this.overlayEl&&(this.overlayEl.hidden=!i),this.dimOverlayEl&&(this.dimOverlayEl.hidden=!i),this.progressEl&&(this.progressEl.hidden=!n),this.timeEl&&(this.timeEl.hidden=!a),this.volumeWrapEl&&(this.volumeWrapEl.hidden=!r),this.fullscreenButtonEl&&(this.fullscreenButtonEl.hidden=!l),this.fullscreenButtonEl&&this.fullscreenButtonEl.replaceChildren(createDbIcon(this.isFullscreen?"shrink":"expand",ts)),this.updatePlayIcons(),this.updateProgress(),this.updateTime(),this.updateVolumeUI()}}customElements.get("db-video-player")||customElements.define("db-video-player",DbVideoPlayer);class DbYouTubePlayer extends HTMLElement{constructor(){super(...arguments),this.isFullscreen=!1,this.playlistIndex=0,this.onFullscreenChange=()=>{this.isFullscreen=!!document.fullscreenElement,this.dispatchEvent(new CustomEvent("db-fullscreen-change",{detail:{isFullscreen:this.isFullscreen},bubbles:!0,composed:!0})),this.render()}}static get observedAttributes(){return["video-id","title","description","size","variant","theme","auto-play","loop","muted","show-controls","enable-fullscreen","enable-keyboard","enable-touch","show-subtitles","default-subtitle-lang","playback-rate","start-time","end-time","show-related-videos","show-info","show-channel-info","show-like-buttons","show-comments","playlist","current-index"]}connectedCallback(){this.style.display="block",this.playlistIndex=Number(this.getAttribute("current-index")||0),this.render(),document.addEventListener("fullscreenchange",this.onFullscreenChange)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}attributeChangedCallback(){this.render()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}extractVideoId(t){if(!t)return"";if(11===t.length&&/^[a-zA-Z0-9_-]{11}$/.test(t))return t;const e=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/v\/|youtube\.com\/watch\?.*&v=)([^&\n?#]+)/,/youtube\.com\/watch\?.*v=([^&\n?#]+)/];for(const s of e){const e=t.match(s);if(e)return e[1]}return t}getPlaylist(){try{const t=this.getAttribute("playlist"),e=t?JSON.parse(t):[];return Array.isArray(e)?e:[]}catch{return[]}}getCurrentVideoId(){const t=this.getPlaylist();if(t.length>0){const e=Math.max(0,Math.min(t.length-1,this.playlistIndex));return this.extractVideoId(t[e])}return this.extractVideoId(this.getAttribute("video-id")||"")}generateEmbedUrl(t){const e=new URLSearchParams;if(this.getBool("auto-play")&&e.append("autoplay","1"),this.getBool("loop")&&e.append("loop","1"),this.getBool("muted")&&e.append("mute","1"),this.getBool("show-controls",!0)||e.append("controls","0"),this.getBool("enable-fullscreen",!0)||e.append("fs","0"),this.getBool("enable-keyboard",!0)||e.append("disablekb","1"),this.getBool("enable-touch",!0)||e.append("modestbranding","1"),this.getBool("show-subtitles")){e.append("cc_load_policy","1");const t=this.getAttribute("default-subtitle-lang")||"ko";t&&e.append("cc_lang_pref",t)}const s=this.getAttribute("playback-rate")||"1";"1"!==s&&e.append("vq",s);const i=Number(this.getAttribute("start-time")||0);i>0&&e.append("start",String(i));const n=Number(this.getAttribute("end-time")||0);n>0&&e.append("end",String(n)),this.getBool("show-related-videos",!0)||e.append("rel","0"),this.getBool("show-info",!0)||e.append("showinfo","0"),this.getBool("show-channel-info",!0)||e.append("modestbranding","1"),this.getBool("show-like-buttons",!0)||e.append("modestbranding","1"),this.getBool("show-comments",!1)||e.append("modestbranding","1");const a=this.getPlaylist().map(t=>this.extractVideoId(t)).filter(Boolean);a.length>0?e.append("playlist",a.join(",")):this.getBool("loop")&&e.append("playlist",t);const r=e.toString();return`https://www.youtube.com/embed/${t}${r?`?${r}`:""}`}render(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto";this.className=["designbase-wc-youtube-player",`designbase-wc-youtube-player--${t}`,`designbase-wc-youtube-player--${e}`,`designbase-wc-youtube-player--${s}`,this.isFullscreen&&"designbase-wc-youtube-player--fullscreen"].filter(Boolean).join(" ");const i=this.getCurrentVideoId();if(!i){const t=document.createElement("div");return t.className="designbase-wc-youtube-player__error",t.textContent="동영상을 불러올 수 없습니다.",void this.replaceChildren(t)}const n=document.createElement("div");n.className="designbase-wc-youtube-player__container";const a=document.createElement("iframe");a.className="designbase-wc-youtube-player__iframe",a.src=this.generateEmbedUrl(i),a.title=this.getAttribute("title")||`YouTube 동영상: ${i}`,a.setAttribute("frameborder","0"),a.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"),a.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),a.referrerPolicy="strict-origin-when-cross-origin",a.allowFullscreen=!0,n.append(a);const r=this.getAttribute("description"),l=document.createDocumentFragment();if(l.append(n),r&&"minimal"!==e){const t=document.createElement("div");t.className="designbase-wc-youtube-player__description";const e=document.createElement("p");e.textContent=r,t.append(e),l.append(t)}this.replaceChildren(l)}}customElements.get("db-youtube-player")||customElements.define("db-youtube-player",DbYouTubePlayer);const es="designbase-wc-audio-player";class DbAudioPlayer extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.isPlaying=!1,this.isMuted=!1,this.volume=1,this.currentTime=0,this.duration=0,this.showSettingsMenu=!1,this.playbackRate=1,this.currentRepeatMode="none",this.isShuffle=!1,this.isLoading=!1,this.error=null,this.playlistIndex=0,this.shuffledPlaylist=[],this.boundKeyDown=t=>this.handleKeyDown(t)}static get observedAttributes(){return["src","title","artist","album","album-art","size","variant","theme","auto-play","loop","muted","show-controls","enable-keyboard","show-progress","show-time","show-volume","show-settings","playlist","current-index","playback-rates","default-playback-rate","repeat-mode","shuffle"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build(),this.bindAudioEvents()),this.syncFromAttributes(),this.updateUI(),this.getBool("enable-keyboard",!0)&&document.addEventListener("keydown",this.boundKeyDown)}disconnectedCallback(){document.removeEventListener("keydown",this.boundKeyDown)}attributeChangedCallback(t){if(this.built){if("current-index"===t)return this.playlistIndex=Number(this.getAttribute("current-index")||0),void this.loadCurrentTrack();"repeat-mode"===t&&(this.currentRepeatMode=this.getAttribute("repeat-mode")||"none"),"shuffle"===t&&(this.isShuffle=this.getBool("shuffle"),this.refreshShuffledPlaylist()),"default-playback-rate"===t&&(this.playbackRate=Number(this.getAttribute("default-playback-rate")||1),this.audioEl&&(this.audioEl.playbackRate=this.playbackRate)),this.updateUI()}}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getPlaylist(){try{const t=this.getAttribute("playlist"),e=t?JSON.parse(t):[];return Array.isArray(e)?e:[]}catch{return[]}}getPlaybackRates(){try{const t=this.getAttribute("playback-rates"),e=t?JSON.parse(t):[.5,.75,1,1.25,1.5,2];return Array.isArray(e)&&e.length>0?e:[.5,.75,1,1.25,1.5,2]}catch{return[.5,.75,1,1.25,1.5,2]}}getIconSize(){const t=this.getAttribute("size")||"m";return"s"===t?16:"l"===t?24:"xl"===t?32:20}getCurrentTrack(){const t=this.getPlaylist();if(t.length>0){return t[this.isShuffle&&this.shuffledPlaylist.length>0?this.shuffledPlaylist[this.playlistIndex]??this.playlistIndex:this.playlistIndex]||t[0]}return{src:this.getAttribute("src")||"",title:this.getAttribute("title")||void 0,artist:this.getAttribute("artist")||void 0,album:this.getAttribute("album")||void 0,albumArt:this.getAttribute("album-art")||void 0}}refreshShuffledPlaylist(){const t=this.getPlaylist();if(t.length>0&&this.isShuffle){const e=Array.from({length:t.length},(t,e)=>e);this.shuffledPlaylist=[...e].sort(()=>Math.random()-.5)}else this.shuffledPlaylist=[]}formatTime(t){return`${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")}`}syncFromAttributes(){this.playlistIndex=Number(this.getAttribute("current-index")||0),this.currentRepeatMode=this.getAttribute("repeat-mode")||"none",this.isShuffle=this.getBool("shuffle"),this.playbackRate=Number(this.getAttribute("default-playback-rate")||1),this.isMuted=this.getBool("muted"),this.volume=this.isMuted?0:1,this.refreshShuffledPlaylist(),this.loadCurrentTrack()}loadCurrentTrack(){if(!this.audioEl)return;const t=this.getCurrentTrack(),e=t?.src||this.getAttribute("src")||"";this.audioEl.src!==e&&e&&(this.audioEl.src=e,this.audioEl.load()),this.updateTrackInfo(),this.updatePlaylistActive()}bindAudioEvents(){const t=this.audioEl;t&&(t.addEventListener("play",()=>{this.isPlaying=!0,this.dispatchEvent(new CustomEvent("db-play",{bubbles:!0,composed:!0})),this.updateUI()}),t.addEventListener("pause",()=>{this.isPlaying=!1,this.dispatchEvent(new CustomEvent("db-pause",{bubbles:!0,composed:!0})),this.updateUI()}),t.addEventListener("timeupdate",()=>{this.currentTime=t.currentTime,this.duration=t.duration||0,this.dispatchEvent(new CustomEvent("db-time-update",{detail:{currentTime:this.currentTime,duration:this.duration},bubbles:!0,composed:!0})),this.updateProgress(),this.updateTime()}),t.addEventListener("volumechange",()=>{this.volume=t.volume,this.isMuted=t.muted,this.dispatchEvent(new CustomEvent("db-volume-change",{detail:{volume:this.volume},bubbles:!0,composed:!0})),this.updateVolumeUI()}),t.addEventListener("ended",()=>this.handleEnded()),t.addEventListener("error",()=>{this.error="오디오를 재생할 수 없습니다.",this.dispatchEvent(new CustomEvent("db-error",{detail:{error:this.error},bubbles:!0,composed:!0})),this.updateUI()}),t.addEventListener("loadstart",()=>{this.isLoading=!0,this.error=null,this.updateUI()}),t.addEventListener("canplay",()=>{this.isLoading=!1,this.updateUI()}))}handleEnded(){this.isPlaying=!1,this.dispatchEvent(new CustomEvent("db-ended",{bubbles:!0,composed:!0}));const t=this.getPlaylist();if(t.length>0){if("one"===this.currentRepeatMode)this.audioEl&&(this.audioEl.currentTime=0,this.audioEl.play());else if("all"===this.currentRepeatMode||this.playlistIndex<t.length-1){const e=this.playlistIndex+1;e<t.length?this.setPlaylistIndex(e):"all"===this.currentRepeatMode&&this.setPlaylistIndex(0)}}else this.getBool("loop")&&this.audioEl&&(this.audioEl.currentTime=0,this.audioEl.play());this.updateUI()}setPlaylistIndex(t){this.playlistIndex=t,this.dispatchEvent(new CustomEvent("db-playlist-change",{detail:{index:t},bubbles:!0,composed:!0})),this.loadCurrentTrack(),this.audioEl&&this.audioEl.play()}togglePlay(){this.audioEl&&(this.isPlaying?this.audioEl.pause():this.audioEl.play())}toggleMute(){this.audioEl&&(this.audioEl.muted=!this.isMuted)}toggleRepeatMode(){const t=["none","one","all"],e=t[(t.indexOf(this.currentRepeatMode)+1)%t.length];this.currentRepeatMode=e,this.dispatchEvent(new CustomEvent("db-repeat-mode-change",{detail:{mode:e},bubbles:!0,composed:!0})),this.updateUI()}toggleShuffle(){this.isShuffle=!this.isShuffle,this.refreshShuffledPlaylist(),this.dispatchEvent(new CustomEvent("db-shuffle-change",{detail:{shuffle:this.isShuffle},bubbles:!0,composed:!0})),this.updateUI()}handlePlaybackRateChange(t){this.audioEl&&(this.audioEl.playbackRate=t,this.playbackRate=t,this.dispatchEvent(new CustomEvent("db-playback-rate-change",{detail:{rate:t},bubbles:!0,composed:!0})))}handleKeyDown(t){if(this.audioEl&&this.getBool("enable-keyboard",!0))switch(t.code){case"Space":t.preventDefault(),this.togglePlay();break;case"ArrowLeft":t.preventDefault(),this.audioEl.currentTime=Math.max(0,this.currentTime-10);break;case"ArrowRight":t.preventDefault(),this.audioEl.currentTime=Math.min(this.duration,this.currentTime+10);break;case"ArrowUp":t.preventDefault(),this.audioEl.volume=Math.min(1,this.volume+.1),this.audioEl.muted=!1;break;case"ArrowDown":t.preventDefault(),this.audioEl.volume=Math.max(0,this.volume-.1),this.audioEl.muted=0===this.audioEl.volume;break;case"KeyM":t.preventDefault(),this.toggleMute();break;case"KeyR":t.preventDefault(),this.toggleRepeatMode();break;case"KeyS":t.preventDefault(),this.toggleShuffle()}}iconButton(t,e,s){const i=document.createElement("button");return i.type="button",i.className=`${es}__control-button`,i.append(createDbIcon(t,this.getIconSize())),s?.disabled&&(i.disabled=!0),s?.data&&Object.entries(s.data).forEach(([t,e])=>i.setAttribute(`data-${t}`,e)),i.addEventListener("click",e),i}build(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto";this.className=[es,`${es}--size-${t}`,`${es}--variant-${e}`,`${es}--theme-${s}`].join(" "),this.audioEl=document.createElement("audio"),this.audioEl.preload="metadata",this.audioEl.hidden=!0;const i=document.createElement("div");i.className=`${es}__loading`;const n=document.createElement("div");n.className=`${es}__spinner`,i.append(n);const a=document.createElement("div");a.className=`${es}__error`;const r=document.createElement("p");r.textContent="오디오를 재생할 수 없습니다.";const l=document.createElement("button");l.type="button",l.textContent="다시 시도",l.addEventListener("click",()=>window.location.reload()),a.append(r,l);const o=document.createElement("div");o.className=`${es}__album-art`,this.albumImgEl=document.createElement("img"),this.albumImgEl.addEventListener("error",()=>{this.albumImgEl&&(this.albumImgEl.style.display="none"),this.albumPlaceholderEl?.classList.remove("album-placeholder")}),this.albumPlaceholderEl=document.createElement("div"),this.albumPlaceholderEl.className="album-placeholder",this.albumPlaceholderEl.textContent="🎵",o.append(this.albumImgEl,this.albumPlaceholderEl);const d=document.createElement("div");d.className=`${es}__main`;const u=document.createElement("div");u.className=`${es}__info`,this.titleEl=document.createElement("div"),this.titleEl.className=`${es}__title`,this.artistEl=document.createElement("div"),this.artistEl.className=`${es}__artist`,this.albumEl=document.createElement("div"),this.albumEl.className=`${es}__album`,u.append(this.titleEl,this.artistEl,this.albumEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${es}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${es}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${es}__progress-handle`,this.progressEl.append(this.progressBarEl,this.progressHandleEl),this.progressEl.addEventListener("click",t=>{if(!this.audioEl||!this.progressEl)return;const e=this.progressEl.getBoundingClientRect(),s=(t.clientX-e.left)/e.width;this.audioEl.currentTime=s*(this.duration||0)});const b=document.createElement("div");b.className=`${es}__controls`;const p=document.createElement("div");p.className=`${es}__left-controls`;const m=document.createElement("div");m.className=`${es}__center-controls`;const g=document.createElement("div");g.className=`${es}__right-controls`,this.playButtonEl=document.createElement("button"),this.playButtonEl.type="button",this.playButtonEl.className=`${es}__play-button`,this.playButtonEl.addEventListener("click",()=>this.togglePlay()),m.append(this.playButtonEl),b.append(p,m,g);const v=document.createElement("div");v.className=`${es}__bottom-controls`;const E=document.createElement("div");E.className=`${es}__left-bottom`;const f=document.createElement("div");f.className=`${es}__right-bottom`;const w=document.createElement("div");w.className=`${es}__time`,this.timeCurrentEl=document.createElement("span");const y=document.createElement("span");y.textContent="/",this.timeDurationEl=document.createElement("span"),w.append(this.timeCurrentEl,y,this.timeDurationEl),E.append(w);const A=document.createElement("div");A.className=`${es}__volume`;const _=this.iconButton(this.isMuted||0===this.volume?"mute-filled":"volume-up",()=>this.toggleMute());_.title=this.isMuted||0===this.volume?"음소거 해제":"음소거";const C=document.createElement("div");C.className=`${es}__volume-slider`;const x=document.createElement("div");x.className="volume-label";const k=document.createElement("span");k.textContent="🔊";const S=document.createElement("span");x.append(k,S),this.volumeInputEl=document.createElement("input"),this.volumeInputEl.type="range",this.volumeInputEl.min="0",this.volumeInputEl.max="1",this.volumeInputEl.step="0.1",this.volumeInputEl.addEventListener("input",()=>{if(!this.audioEl||!this.volumeInputEl)return;const t=parseFloat(this.volumeInputEl.value);this.audioEl.volume=t,this.audioEl.muted=0===t}),C.append(x,this.volumeInputEl),A.append(_,C);const N=document.createElement("div");N.className=`${es}__settings`;const $=this.iconButton("settings",()=>{this.showSettingsMenu=!this.showSettingsMenu,this.updateSettingsMenu()});this.settingsMenuEl=document.createElement("div"),this.settingsMenuEl.className=`${es}__settings-menu`,this.settingsMenuEl.hidden=!0;const I=document.createElement("div");I.className=`${es}__setting-group`;const D=document.createElement("label");D.textContent="재생 속도";const L=document.createElement("select");L.addEventListener("change",()=>this.handlePlaybackRateChange(parseFloat(L.value))),I.append(D,L),this.settingsMenuEl.append(I),N.append($,this.settingsMenuEl),f.append(A,N),v.append(E,f),d.append(u,this.progressEl,b,v);const M=document.createElement("div");M.className=`${es}__playlist`,M.hidden=!0;const z=document.createElement("h4");z.textContent="플레이리스트",this.playlistTracksEl=document.createElement("div"),this.playlistTracksEl.className=`${es}__playlist-tracks`,M.append(z,this.playlistTracksEl),this.append(this.audioEl,i,a,o,d,M),this._leftControls=p,this._rightControls=g,this._controls=b,this._time=w,this._volumeWrap=A,this._settings=N,this._playlist=M,this._rateSelect=L,this._volumePercent=S,this._muteButton=_}get leftControls(){return this._leftControls}get rightControls(){return this._rightControls}get controlsEl(){return this._controls}get timeEl(){return this._time}get volumeWrap(){return this._volumeWrap}get settingsEl(){return this._settings}get playlistEl(){return this._playlist}get rateSelect(){return this._rateSelect}get volumePercent(){return this._volumePercent}get muteButton(){return this._muteButton}updateTrackInfo(){const t=this.getCurrentTrack();this.titleEl&&(this.titleEl.textContent=t?.title||"Unknown Track"),this.artistEl&&(this.artistEl.textContent=t?.artist||"Unknown Artist"),this.albumEl&&(t?.album?(this.albumEl.textContent=t.album,this.albumEl.hidden=!1):this.albumEl.hidden=!0),this.albumImgEl&&this.albumPlaceholderEl&&(t?.albumArt?(this.albumImgEl.src=t.albumArt,this.albumImgEl.alt=t.title||"Album Art",this.albumImgEl.style.display=""):(this.albumImgEl.removeAttribute("src"),this.albumImgEl.style.display="none"),this.albumPlaceholderEl.className="album-placeholder")}updateProgress(){const t=this.duration>0?this.currentTime/this.duration*100:0;this.progressBarEl&&(this.progressBarEl.style.width=`${t}%`),this.progressHandleEl&&(this.progressHandleEl.style.left=`${t}%`,this.progressHandleEl.style.transform=t<=0?"translate(0, -50%)":t>=100?"translate(-100%, -50%)":"translate(-50%, -50%)")}updateTime(){this.timeCurrentEl&&(this.timeCurrentEl.textContent=this.formatTime(this.currentTime)),this.timeDurationEl&&(this.timeDurationEl.textContent=this.formatTime(this.duration))}updateVolumeUI(){this.volumeInputEl&&(this.volumeInputEl.value=String(this.volume)),this.volumePercent&&(this.volumePercent.textContent=`${Math.round(100*this.volume)}%`),this.muteButton&&(this.muteButton.replaceChildren(createDbIcon(this.isMuted||0===this.volume?"mute-filled":"volume-up",this.getIconSize())),this.muteButton.title=this.isMuted||0===this.volume?"음소거 해제":"음소거")}updateSettingsMenu(){this.settingsMenuEl&&(this.settingsMenuEl.hidden=!this.showSettingsMenu)}rebuildControlButtons(){const t=this.getPlaylist(),e=1.2*this.getIconSize();this.leftControls.replaceChildren(),this.rightControls.replaceChildren(),t.length>0&&this.leftControls.append(this.iconButton("refresh",()=>this.toggleShuffle(),{data:{shuffle:"true"}})),this.leftControls.append(this.iconButton("chevron-left",()=>{if(t.length>0){const t=this.playlistIndex-1;t>=0&&this.setPlaylistIndex(t)}else this.audioEl&&(this.audioEl.currentTime=0)},{disabled:t.length>0&&0===this.playlistIndex})),this.playButtonEl&&this.playButtonEl.replaceChildren(createDbIcon(this.isPlaying?"pause":"play",e)),this.rightControls.append(this.iconButton("chevron-right",()=>{if(t.length>0){const e=this.playlistIndex+1;e<t.length&&this.setPlaylistIndex(e)}},{disabled:t.length>0&&this.playlistIndex===t.length-1})),t.length>0&&this.rightControls.append(this.iconButton("repeat",()=>this.toggleRepeatMode(),{data:{repeat:"true"}}))}rebuildPlaylist(){if(!this.playlistTracksEl)return;const t=this.getPlaylist(),e=this.getAttribute("variant")||"default";this.playlistEl.hidden=!("full"===e&&t.length>0),this.playlistTracksEl.replaceChildren(),t.forEach((t,e)=>{const s=document.createElement("div");if(s.className=`${es}__playlist-track${e===this.playlistIndex?` ${es}__playlist-track--active`:""}`,s.addEventListener("click",()=>this.setPlaylistIndex(e)),t.albumArt){const e=document.createElement("img");e.src=t.albumArt,e.alt=t.title||"Album Art",s.append(e)}const i=document.createElement("div");i.className=`${es}__playlist-track-info`;const n=document.createElement("div");n.className=`${es}__playlist-track-title`,n.textContent=t.title||"Unknown Track";const a=document.createElement("div");a.className=`${es}__playlist-track-artist`,a.textContent=t.artist||"Unknown Artist",i.append(n,a),s.append(i),this.playlistTracksEl?.append(s)})}updatePlaylistActive(){this.playlistTracksEl&&Array.from(this.playlistTracksEl.children).forEach((t,e)=>{t.classList.toggle(`${es}__playlist-track--active`,e===this.playlistIndex)})}updateUI(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto",i=this.getBool("show-controls",!0),n=this.getBool("show-progress",!0),a=this.getBool("show-time",!0),r=this.getBool("show-volume",!0),l=this.getBool("show-settings",!1);this.className=[es,`${es}--size-${t}`,`${es}--variant-${e}`,`${es}--theme-${s}`,this.isPlaying&&`${es}--playing`,!this.isPlaying&&`${es}--paused`,this.isMuted&&`${es}--muted`,this.isLoading&&`${es}--loading`,this.error&&`${es}--error`,this.isShuffle&&`${es}--shuffle`,`${es}--repeat-${this.currentRepeatMode}`].filter(Boolean).join(" "),this.audioEl&&(this.audioEl.autoplay=this.getBool("auto-play"),this.audioEl.loop=this.getBool("loop"),this.audioEl.muted=this.getBool("muted"),this.audioEl.playbackRate=this.playbackRate),this.progressEl&&(this.progressEl.hidden=!n),this.controlsEl&&(this.controlsEl.hidden=!i),this.timeEl&&(this.timeEl.hidden=!a),this.volumeWrap&&(this.volumeWrap.hidden=!r),this.settingsEl&&(this.settingsEl.hidden=!l),this.rateSelect.replaceChildren(...this.getPlaybackRates().map(t=>{const e=document.createElement("option");return e.value=String(t),e.textContent=`${t}x`,t===this.playbackRate&&(e.selected=!0),e})),this.rebuildControlButtons(),this.updateTrackInfo(),this.updateProgress(),this.updateTime(),this.updateVolumeUI(),this.updateSettingsMenu(),this.rebuildPlaylist()}}customElements.get("db-audio-player")||customElements.define("db-audio-player",DbAudioPlayer);var ss={exports:{}};!function(e){var s=function(t){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,i={},n={manual:t.Prism&&t.Prism.manual,disableWorkerMessageHandler:t.Prism&&t.Prism.disableWorkerMessageHandler,util:{encode:function encode(t){return t instanceof Token?new Token(t.type,encode(t.content),t.alias):Array.isArray(t)?t.map(encode):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(t){return Object.prototype.toString.call(t).slice(8,-1)},objId:function(t){return t.__id||Object.defineProperty(t,"__id",{value:++s}),t.__id},clone:function deepClone(t,e){var s,i;switch(e=e||{},n.util.type(t)){case"Object":if(i=n.util.objId(t),e[i])return e[i];for(var a in s={},e[i]=s,t)t.hasOwnProperty(a)&&(s[a]=deepClone(t[a],e));return s;case"Array":return i=n.util.objId(t),e[i]?e[i]:(s=[],e[i]=s,t.forEach(function(t,i){s[i]=deepClone(t,e)}),s);default:return t}},getLanguage:function(t){for(;t;){var s=e.exec(t.className);if(s)return s[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,s){t.className=t.className.replace(RegExp(e,"gi"),""),t.classList.add("language-"+s)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(i){var t=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(i.stack)||[])[1];if(t){var e=document.getElementsByTagName("script");for(var s in e)if(e[s].src==t)return e[s]}return null}},isActive:function(t,e,s){for(var i="no-"+e;t;){var n=t.classList;if(n.contains(e))return!0;if(n.contains(i))return!1;t=t.parentElement}return!!s}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(t,e){var s=n.util.clone(n.languages[t]);for(var i in e)s[i]=e[i];return s},insertBefore:function(t,e,s,i){var a=(i=i||n.languages)[t],r={};for(var l in a)if(a.hasOwnProperty(l)){if(l==e)for(var o in s)s.hasOwnProperty(o)&&(r[o]=s[o]);s.hasOwnProperty(l)||(r[l]=a[l])}var d=i[t];return i[t]=r,n.languages.DFS(n.languages,function(e,s){s===d&&e!=t&&(this[e]=r)}),r},DFS:function DFS(t,e,s,i){i=i||{};var a=n.util.objId;for(var r in t)if(t.hasOwnProperty(r)){e.call(t,r,t[r],s||r);var l=t[r],o=n.util.type(l);"Object"!==o||i[a(l)]?"Array"!==o||i[a(l)]||(i[a(l)]=!0,DFS(l,e,r,i)):(i[a(l)]=!0,DFS(l,e,null,i))}}},plugins:{},highlightAll:function(t,e){n.highlightAllUnder(document,t,e)},highlightAllUnder:function(t,e,s){var i={callback:s,container:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",i),i.elements=Array.prototype.slice.apply(i.container.querySelectorAll(i.selector)),n.hooks.run("before-all-elements-highlight",i);for(var a,r=0;a=i.elements[r++];)n.highlightElement(a,!0===e,i.callback)},highlightElement:function(e,s,i){var a=n.util.getLanguage(e),r=n.languages[a];n.util.setLanguage(e,a);var l=e.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&n.util.setLanguage(l,a);var o={element:e,language:a,grammar:r,code:e.textContent};function insertHighlightedCode(t){o.highlightedCode=t,n.hooks.run("before-insert",o),o.element.innerHTML=o.highlightedCode,n.hooks.run("after-highlight",o),n.hooks.run("complete",o),i&&i.call(o.element)}if(n.hooks.run("before-sanity-check",o),(l=o.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!o.code)return n.hooks.run("complete",o),void(i&&i.call(o.element));if(n.hooks.run("before-highlight",o),o.grammar)if(s&&t.Worker){var d=new Worker(n.filename);d.onmessage=function(t){insertHighlightedCode(t.data)},d.postMessage(JSON.stringify({language:o.language,code:o.code,immediateClose:!0}))}else insertHighlightedCode(n.highlight(o.code,o.grammar,o.language));else insertHighlightedCode(n.util.encode(o.code))},highlight:function(t,e,s){var i={code:t,grammar:e,language:s};if(n.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=n.tokenize(i.code,i.grammar),n.hooks.run("after-tokenize",i),Token.stringify(n.util.encode(i.tokens),i.language)},tokenize:function(t,e){var s=e.rest;if(s){for(var i in s)e[i]=s[i];delete e.rest}var n=new LinkedList;return addAfter(n,n.head,t),matchGrammar(t,n,e,n.head,0),function toArray(t){var e=[],s=t.head.next;for(;s!==t.tail;)e.push(s.value),s=s.next;return e}(n)},hooks:{all:{},add:function(t,e){var s=n.hooks.all;s[t]=s[t]||[],s[t].push(e)},run:function(t,e){var s=n.hooks.all[t];if(s&&s.length)for(var i,a=0;i=s[a++];)i(e)}},Token:Token};function Token(t,e,s,i){this.type=t,this.content=e,this.alias=s,this.length=0|(i||"").length}function matchPattern(t,e,s,i){t.lastIndex=e;var n=t.exec(s);if(n&&i&&n[1]){var a=n[1].length;n.index+=a,n[0]=n[0].slice(a)}return n}function matchGrammar(t,e,s,i,a,r){for(var l in s)if(s.hasOwnProperty(l)&&s[l]){var o=s[l];o=Array.isArray(o)?o:[o];for(var d=0;d<o.length;++d){if(r&&r.cause==l+","+d)return;var u=o[d],b=u.inside,p=!!u.lookbehind,m=!!u.greedy,g=u.alias;if(m&&!u.pattern.global){var v=u.pattern.toString().match(/[imsuy]*$/)[0];u.pattern=RegExp(u.pattern.source,v+"g")}for(var E=u.pattern||u,f=i.next,w=a;f!==e.tail&&!(r&&w>=r.reach);w+=f.value.length,f=f.next){var y=f.value;if(e.length>t.length)return;if(!(y instanceof Token)){var A,_=1;if(m){if(!(A=matchPattern(E,w,t,p))||A.index>=t.length)break;var C=A.index,x=A.index+A[0].length,k=w;for(k+=f.value.length;C>=k;)k+=(f=f.next).value.length;if(w=k-=f.value.length,f.value instanceof Token)continue;for(var S=f;S!==e.tail&&(k<x||"string"==typeof S.value);S=S.next)_++,k+=S.value.length;_--,y=t.slice(w,k),A.index-=w}else if(!(A=matchPattern(E,0,y,p)))continue;C=A.index;var N=A[0],$=y.slice(0,C),I=y.slice(C+N.length),D=w+y.length;r&&D>r.reach&&(r.reach=D);var L=f.prev;if($&&(L=addAfter(e,L,$),w+=$.length),removeRange(e,L,_),f=addAfter(e,L,new Token(l,b?n.tokenize(N,b):N,g,N)),I&&addAfter(e,f,I),_>1){var M={cause:l+","+d,reach:D};matchGrammar(t,e,s,f.prev,w,M),r&&M.reach>r.reach&&(r.reach=M.reach)}}}}}}function LinkedList(){var t={value:null,prev:null,next:null},e={value:null,prev:t,next:null};t.next=e,this.head=t,this.tail=e,this.length=0}function addAfter(t,e,s){var i=e.next,n={value:s,prev:e,next:i};return e.next=n,i.prev=n,t.length++,n}function removeRange(t,e,s){for(var i=e.next,n=0;n<s&&i!==t.tail;n++)i=i.next;e.next=i,i.prev=e,t.length-=n}if(t.Prism=n,Token.stringify=function stringify(t,e){if("string"==typeof t)return t;if(Array.isArray(t)){var s="";return t.forEach(function(t){s+=stringify(t,e)}),s}var i={type:t.type,content:stringify(t.content,e),tag:"span",classes:["token",t.type],attributes:{},language:e},a=t.alias;a&&(Array.isArray(a)?Array.prototype.push.apply(i.classes,a):i.classes.push(a)),n.hooks.run("wrap",i);var r="";for(var l in i.attributes)r+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+r+">"+i.content+"</"+i.tag+">"},!t.document)return t.addEventListener?(n.disableWorkerMessageHandler||t.addEventListener("message",function(e){var s=JSON.parse(e.data),i=s.language,a=s.code,r=s.immediateClose;t.postMessage(n.highlight(a,n.languages[i],i)),r&&t.close()},!1),n):n;var a=n.util.currentScript();function highlightAutomaticallyCallback(){n.manual||n.highlightAll()}if(a&&(n.filename=a.src,a.hasAttribute("data-manual")&&(n.manual=!0)),!n.manual){var r=document.readyState;"loading"===r||"interactive"===r&&a&&a.defer?document.addEventListener("DOMContentLoaded",highlightAutomaticallyCallback):window.requestAnimationFrame?window.requestAnimationFrame(highlightAutomaticallyCallback):window.setTimeout(highlightAutomaticallyCallback,16)}return n}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=s),void 0!==t&&(t.Prism=s),s.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function addInlined(t,e){var i={};i["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:s.languages[e]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};n["language-"+e]={pattern:/[\s\S]+/,inside:s.languages[e]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:n},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(t,e){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:s.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var s=t.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))}(s),s.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:s.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:s.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),s.languages.js=s.languages.javascript,function(){if(void 0!==s&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var t={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},e="data-src-status",i="loading",n="loaded",a="pre[data-src]:not(["+e+'="'+n+'"]):not(['+e+'="'+i+'"])';s.hooks.add("before-highlightall",function(t){t.selector+=", "+a}),s.hooks.add("before-sanity-check",function(r){var l=r.element;if(l.matches(a)){r.code="",l.setAttribute(e,i);var o=l.appendChild(document.createElement("CODE"));o.textContent="Loading…";var d=l.getAttribute("data-src"),u=r.language;if("none"===u){var b=(/\.(\w+)$/.exec(d)||[,"none"])[1];u=t[b]||b}s.util.setLanguage(o,u),s.util.setLanguage(l,u);var p=s.plugins.autoloader;p&&p.loadLanguages(u),function loadFile(t,e,s){var i=new XMLHttpRequest;i.open("GET",t,!0),i.onreadystatechange=function(){4==i.readyState&&(i.status<400&&i.responseText?e(i.responseText):i.status>=400?s("✖ Error "+i.status+" while fetching file: "+i.statusText):s("✖ Error: File does not exist or is empty"))},i.send(null)}(d,function(t){l.setAttribute(e,n);var i=function parseRange(t){var e=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(t||"");if(e){var s=Number(e[1]),i=e[2],n=e[3];return i?n?[s,Number(n)]:[s,void 0]:[s,s]}}(l.getAttribute("data-range"));if(i){var a=t.split(/\r\n?|\n/g),r=i[0],d=null==i[1]?a.length:i[1];r<0&&(r+=a.length),r=Math.max(0,Math.min(r-1,a.length)),d<0&&(d+=a.length),d=Math.max(0,Math.min(d,a.length)),t=a.slice(r,d).join("\n"),l.hasAttribute("data-start")||l.setAttribute("data-start",String(r+1))}o.textContent=t,s.highlightElement(o)},function(t){l.setAttribute(e,"failed"),o.textContent=t})}}),s.plugins.fileHighlight={highlight:function highlight(t){for(var e,i=(t||document).querySelectorAll(a),n=0;e=i[n++];)s.highlightElement(e)}};var r=!1;s.fileHighlight=function(){r||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),r=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}(ss);var is=ss.exports,ns=e(is),as=_mergeNamespaces({__proto__:null,default:ns},[is]);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function addInlined(t,e){var s={};s["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};i["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var n={};n[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:i},Prism.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(t,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var s=t.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))}(Prism),Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss,function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},i={bash:s,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=t.languages.bash;for(var n=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=i.variable[1].inside,r=0;r<n.length;r++)a[n[r]]=t.languages.bash[n[r]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash}(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript}(Prism),function(t){var e=t.util.clone(t.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,n=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function re(t,e){return t=t.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return i}).replace(/<SPREAD>/g,function(){return n}),RegExp(t,e)}n=re(n).source,t.languages.jsx=t.languages.extend("markup",e),t.languages.jsx.tag.pattern=re(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=e.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:re(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:re(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var stringifyToken=function(t){return t?"string"==typeof t?t:"string"==typeof t.content?t.content:t.content.map(stringifyToken).join(""):""},walkTokens=function(e){for(var s=[],i=0;i<e.length;i++){var n=e[i],a=!1;if("string"!=typeof n&&("tag"===n.type&&n.content[0]&&"tag"===n.content[0].type?"</"===n.content[0].content[0].content?s.length>0&&s[s.length-1].tagName===stringifyToken(n.content[0].content[1])&&s.pop():"/>"===n.content[n.content.length-1].content||s.push({tagName:stringifyToken(n.content[0].content[1]),openedBraces:0}):s.length>0&&"punctuation"===n.type&&"{"===n.content?s[s.length-1].openedBraces++:s.length>0&&s[s.length-1].openedBraces>0&&"punctuation"===n.type&&"}"===n.content?s[s.length-1].openedBraces--:a=!0),(a||"string"==typeof n)&&s.length>0&&0===s[s.length-1].openedBraces){var r=stringifyToken(n);i<e.length-1&&("string"==typeof e[i+1]||"plain-text"===e[i+1].type)&&(r+=stringifyToken(e[i+1]),e.splice(i+1,1)),i>0&&("string"==typeof e[i-1]||"plain-text"===e[i-1].type)&&(r=stringifyToken(e[i-1])+r,e.splice(i-1,1),i--),e[i]=new t.Token("plain-text",r,null,r)}n.content&&"string"!=typeof n.content&&walkTokens(n.content)}};t.hooks.add("after-tokenize",function(t){"jsx"!==t.language&&"tsx"!==t.language||walkTokens(t.tokens)})}(Prism),function(t){var e=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",e),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var s=t.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0}(Prism);const rs={js:"javascript",ts:"typescript",sh:"bash",shell:"bash",html:"markup",xml:"markup",svg:"markup"},ls={javascript:"JavaScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",css:"CSS",scss:"SCSS",json:"JSON",bash:"Bash",markup:"HTML"},resolvePrismLanguage=t=>{const e=t.toLowerCase().trim();return rs[e]??e},formatLanguageLabel=t=>{const e=resolvePrismLanguage(t);return ls[e]??t.toUpperCase()},highlightWithPrism=(t,e)=>{const s=(()=>{const t=globalThis.Prism;return t?.languages?t:ns??as})(),i=resolvePrismLanguage(e),n=s.languages[i];if(!n)return null;try{return s.highlight(t,n,i)}catch{return null}},highlightCodeSync=(t,e)=>highlightWithPrism(t,e),os="designbase-wc-code-block";class DbCodeBlock extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.renderToken=0,this.internalActiveId="",this.copied=!1,this.editedCodes={},this.handleSegmentChange=t=>{const e=t,s=e.detail?.value;s&&(this.hasAttribute("active-id")||(this.internalActiveId=s),this.dispatchEvent(new CustomEvent("db-active-id-change",{detail:{activeId:s},bubbles:!0,composed:!0})),this.render())}}static get observedAttributes(){return["items","code","language","default-active-id","active-id","show-language","highlight","theme","show-copy","copied-label","copy-label","min-height","max-height","overflow","editable"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.internalActiveId=this.getAttribute("default-active-id")||this.getResolvedItems()[0]?.id||""),this.render(),Promise.resolve().then(()=>{this.isConnected&&this.built&&this.render()}),this.addEventListener("db-change",this.handleSegmentChange)}disconnectedCallback(){this.removeEventListener("db-change",this.handleSegmentChange),this.copyTimeout&&window.clearTimeout(this.copyTimeout)}attributeChangedCallback(t){if(this.built)if("active-id"!==t){if("items"===t||"code"===t||"language"===t){const t=this.getResolvedItems();t.find(t=>t.id===this.getActiveId())||(this.internalActiveId=t[0]?.id||"")}this.render()}else this.render()}getBool(t,e=!0){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getResolvedItems(){const t=this.getAttribute("items");if(t)try{const e=JSON.parse(t);if(Array.isArray(e)&&e.length>0)return e}catch{}const e=this.getAttribute("code");if(e){const t=this.getAttribute("language")||"tsx";return[{id:"default",label:t,code:e,language:t}]}return[]}getActiveId(){return this.getAttribute("active-id")||this.internalActiveId}getActiveItem(){const t=this.getResolvedItems();return t.find(t=>t.id===this.getActiveId())||t[0]}toCssSize(t){if(t)return/^\d+$/.test(t)?`${t}px`:t}async handleCopy(){const t=this.getActiveItem(),e=this.getBool("editable",!1),s=(e?this.editedCodes[t?.id??""]??t?.code:t?.code)?.trim();if(s){try{await navigator.clipboard.writeText(s)}catch{const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),t.remove()}this.copied=!0,this.render(),this.copyTimeout&&window.clearTimeout(this.copyTimeout),this.copyTimeout=window.setTimeout(()=>{this.copied=!1,this.render()},1600)}}render(){const t=++this.renderToken;this.renderNow(t)}renderNow(t){const e=this.getActiveItem();if(!e)return void this.replaceChildren();const s=this.getResolvedItems(),i=s.length>1,n=this.getAttribute("language")||"tsx",a=e.language??n,r=this.getBool("show-language",!0),l=this.getBool("highlight",!0),o=this.getAttribute("theme")||"auto",d=this.getBool("show-copy",!0),u=this.getAttribute("copied-label")||"복사됨",b=this.getAttribute("copy-label")||"복사",p=this.getAttribute("overflow")||"scroll-x",m=this.getBool("editable",!1),g=m?this.editedCodes[e.id]??e.code:e.code,v=g.trim();let E=null;if(l&&g)try{E=highlightCodeSync(g,a)}catch{E=null}if(t!==this.renderToken)return;const f=this.toCssSize(this.getAttribute("min-height")),w=this.toCssSize(this.getAttribute("max-height"));f?this.style.setProperty("--db-code-block-min-height",f):this.style.removeProperty("--db-code-block-min-height"),w?this.style.setProperty("--db-code-block-max-height",w):this.style.removeProperty("--db-code-block-max-height"),this.className=[os,`${os}--overflow-${p}`,"auto"!==o&&`${os}--theme-${o}`,m&&`${os}--editable`].filter(Boolean).join(" ");const y=document.createElement("div");y.className=`${os}__toolbar`;const A=document.createElement("div");if(A.className=`${os}__toolbar-left`,i){const t=document.createElement("db-segment-control");t.setAttribute("size","s"),t.setAttribute("options",JSON.stringify(s.map(t=>({value:t.id,label:t.label})))),t.setAttribute("value",this.getActiveId()),A.append(t)}if(r){const t=document.createElement("span");t.className=`${os}__language`,t.textContent=formatLanguageLabel(a),A.append(t)}if(y.append(A),d){const t=document.createElement("db-button");t.setAttribute("type","button"),t.setAttribute("variant","tertiary"),t.setAttribute("size","s"),t.setAttribute("start-icon",this.copied?"done":"copy"),t.textContent=this.copied?u:b,t.addEventListener("db-click",()=>this.handleCopy()),y.append(t)}const _=document.createElement("div");if(_.className=`${os}__body`,i&&e.description){const t=document.createElement("p");t.className=`${os}__caption`,t.textContent=e.description,_.append(t)}if(m){void 0===this.editedCodes[e.id]&&(this.editedCodes[e.id]=e.code);const t=document.createElement("div");t.className=`${os}__editor`;const s=document.createElement("pre");s.className=`${os}__pre ${os}__pre--mirror`,s.setAttribute("aria-hidden","true");const i=document.createElement("code");i.className=`${os}__code language-${a}`,E?i.innerHTML=E:i.textContent=g,s.append(i);const n=document.createElement("textarea");n.className=`${os}__textarea`,n.value=g,n.spellcheck=!1,n.setAttribute("autocapitalize","off"),n.setAttribute("autocorrect","off"),n.setAttribute("aria-label",`${formatLanguageLabel(a)} 코드 편집`),n.addEventListener("input",()=>{this.editedCodes[e.id]=n.value;const t=l&&n.value?highlightCodeSync(n.value,a):null;t?i.innerHTML=t:i.textContent=n.value,this.dispatchEvent(new CustomEvent("db-code-change",{detail:{code:n.value,itemId:e.id},bubbles:!0,composed:!0}))}),t.append(s,n),_.append(t)}else{const t=document.createElement("pre");t.className=`${os}__pre`;const e=document.createElement("code");e.className=`${os}__code language-${a}`,E?e.innerHTML=E:e.textContent=v,t.append(e),_.append(t)}this.replaceChildren(y,_)}}customElements.get("db-code-block")||customElements.define("db-code-block",DbCodeBlock);const ds="designbase-wc-markdown-editor";class DbMarkdownEditor extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.internalValue="",this.currentMode="preview",this.isFocused=!1,this.wordCount=0,this.lineCount=0,this.lastSaved=null,this.isSaving=!1,this.handleKeyDown=t=>{if(this.getBool("disabled")||this.getBool("readonly"))return;const{ctrlKey:e,shiftKey:s,key:i}=t;e&&"b"===i?(t.preventDefault(),this.insertText("**","**","**")):e&&"i"===i?(t.preventDefault(),this.insertText("*","*","*")):e&&"k"===i?(t.preventDefault(),this.insertText("[","](",")")):e&&"`"===i?(t.preventDefault(),this.insertText("`","`","`")):e&&s&&"S"===i?(t.preventDefault(),this.insertText("~~","~~","~~")):"Tab"===i&&(t.preventDefault(),this.insertText(" ","",""))}}static get observedAttributes(){return["size","variant","mode","theme","value","placeholder","min-height","max-height","auto-height","readonly","disabled","show-toolbar","show-status","show-word-count","show-line-count","auto-save","auto-save-interval","file-upload"]}connectedCallback(){this.built||(this.built=!0,this.build()),this.syncFromAttributes(),this.renderMode(),this.updateCounts(),this.updateStatus(),this.setupAutoSave()}disconnectedCallback(){this.autoSaveTimer&&window.clearInterval(this.autoSaveTimer)}attributeChangedCallback(t){if(this.built){if("value"===t&&this.textareaEl)return this.internalValue=this.getAttribute("value")||"",this.textareaEl.value=this.internalValue,this.updatePreview(),this.updateCodeView(),void this.updateCounts();if("mode"===t)return this.currentMode=this.getAttribute("mode")||"preview",void this.renderMode();"auto-save"!==t&&"auto-save-interval"!==t||this.setupAutoSave(),this.updateRootClasses()}}get value(){return this.internalValue}set value(t){this.internalValue=t,this.setAttribute("value",t),this.textareaEl&&(this.textareaEl.value=t),this.updatePreview(),this.updateCodeView(),this.updateCounts()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}syncFromAttributes(){if(this.internalValue=this.getAttribute("value")||"",this.currentMode=this.getAttribute("mode")||"preview",this.textareaEl){this.textareaEl.value=this.internalValue,this.textareaEl.placeholder=this.getAttribute("placeholder")||"마크다운을 입력하세요...",this.textareaEl.readOnly=this.getBool("readonly"),this.textareaEl.disabled=this.getBool("disabled");const t=Number(this.getAttribute("min-height")||200),e=Number(this.getAttribute("max-height")||600),s=this.getBool("auto-height");this.textareaEl.style.minHeight=s?"auto":`${t}px`,this.textareaEl.style.maxHeight=s?"none":`${e}px`}this.updateRootClasses(),this.updatePreview(),this.updateCodeView()}updateRootClasses(){const t=this.getAttribute("size")||"m",e=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"light";this.className=[ds,`${ds}--size-${t}`,`${ds}--variant-${e}`,`${ds}--mode-${this.currentMode}`,`${ds}--theme-${s}`,this.isFocused&&`${ds}--focused`,this.getBool("disabled")&&`${ds}--disabled`,this.getBool("readonly")&&`${ds}--readonly`].filter(Boolean).join(" ")}markdownToHtml(t){return t.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/~~(.*)~~/gim,"<del>$1</del>").replace(/`(.*)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/!\[([^\]]*)\]\(([^)]+)\)/gim,'<img alt="$1" src="$2" />').replace(/^> (.*$)/gim,"<blockquote>$1</blockquote>").replace(/^- (.*$)/gim,"<ul><li>$1</li></ul>").replace(/^(\d+)\. (.*$)/gim,"<ol><li>$2</li></ol>").replace(/\n/gim,"<br />")}updatePreview(){this.previewEl&&(this.previewEl.innerHTML=this.markdownToHtml(this.internalValue))}updateCodeView(){if(this.codeViewEl){const t=this.codeViewEl.querySelector("code");t&&(t.textContent=this.internalValue)}}updateCounts(){this.wordCount=this.internalValue.trim()?this.internalValue.trim().split(/\s+/).length:0,this.lineCount=this.internalValue?this.internalValue.split("\n").length:0,this.wordCountEl&&(this.wordCountEl.textContent=`단어: ${this.wordCount}`),this.lineCountEl&&(this.lineCountEl.textContent=`라인: ${this.lineCount}`)}updateStatus(){if(!this.statusEl)return;const t=this.getBool("show-status",!0);this.statusEl.hidden=!t,this.wordCountEl&&(this.wordCountEl.hidden=!this.getBool("show-word-count",!0)),this.lineCountEl&&(this.lineCountEl.hidden=!this.getBool("show-line-count",!0)),this.lastSavedEl&&(this.lastSavedEl.hidden=!this.lastSaved,this.lastSaved&&(this.lastSavedEl.textContent=`저장됨: ${this.lastSaved.toLocaleTimeString()}`)),this.savingEl&&(this.savingEl.hidden=!this.isSaving)}emitChange(){this.dispatchEvent(new CustomEvent("db-change",{detail:{value:this.internalValue},bubbles:!0,composed:!0}))}insertText(t,e="",s=""){if(!this.textareaEl||this.getBool("disabled")||this.getBool("readonly"))return;const{selectionStart:i,selectionEnd:n}=this.textareaEl,a=this.internalValue.substring(i,n),r=e+(a||t)+s,l=this.internalValue.substring(0,i)+r+this.internalValue.substring(n);this.internalValue=l,this.textareaEl.value=l,this.emitChange(),this.updatePreview(),this.updateCodeView(),this.updateCounts();const o=i+e.length+(a?a.length:t.length);window.setTimeout(()=>{this.textareaEl&&(this.textareaEl.setSelectionRange(o,o),this.textareaEl.focus())},0)}getDefaultToolbarActions(){return[{id:"bold",label:"B",tooltip:"굵게 (Ctrl+B)",shortcut:"Ctrl+B",action:()=>this.insertText("**","**","**")},{id:"italic",label:"I",tooltip:"기울임 (Ctrl+I)",shortcut:"Ctrl+I",action:()=>this.insertText("*","*","*")},{id:"strikethrough",label:"S",tooltip:"취소선 (Ctrl+Shift+S)",shortcut:"Ctrl+Shift+S",action:()=>this.insertText("~~","~~","~~")},{id:"separator1",label:"|",separator:!0,action:()=>{}},{id:"heading1",label:"H1",tooltip:"제목 1",action:()=>this.insertText("# ","","")},{id:"heading2",label:"H2",tooltip:"제목 2",action:()=>this.insertText("## ","","")},{id:"heading3",label:"H3",tooltip:"제목 3",action:()=>this.insertText("### ","","")},{id:"separator2",label:"|",separator:!0,action:()=>{}},{id:"link",label:"",icon:"share-alt",tooltip:"링크 (Ctrl+K)",shortcut:"Ctrl+K",action:()=>this.insertText("[","](",")")},{id:"image",label:"",icon:"video",tooltip:"이미지",action:()=>this.insertText("")},{id:"code",label:"",icon:"code",tooltip:"인라인 코드 (Ctrl+`)",shortcut:"Ctrl+`",action:()=>this.insertText("`","`","`")},{id:"codeBlock",label:"```",tooltip:"코드 블록",action:()=>this.insertText("\n```\n","","\n```\n")},{id:"separator3",label:"|",separator:!0,action:()=>{}},{id:"list",label:"•",tooltip:"순서 없는 목록",action:()=>this.insertText("- ","","")},{id:"orderedList",label:"1.",tooltip:"순서 있는 목록",action:()=>this.insertText("1. ","","")},{id:"quote",label:'"',tooltip:"인용구",action:()=>this.insertText("> ","","")},{id:"separator4",label:"|",separator:!0,action:()=>{}},{id:"table",label:"⊞",tooltip:"테이블",action:()=>this.insertText("\n| 헤더1 | 헤더2 | 헤더3 |\n|-------|-------|-------|\n| 셀1 | 셀2 | 셀3 |\n","","")},{id:"horizontalRule",label:"—",tooltip:"수평선",action:()=>this.insertText("\n---\n","","")}]}renderToolbar(){if(!this.toolbarEl)return;const t=this.getBool("show-toolbar",!0);this.toolbarEl.hidden=!t,this.toolbarEl.replaceChildren();const e=document.createElement("div");e.className=`${ds}__mode-buttons`;[{mode:"edit",icon:"write",title:"편집 모드"},{mode:"preview",icon:"show",title:"미리보기 모드"},{mode:"split",icon:"hide",title:"분할 모드"},{mode:"code",icon:"code",title:"코드 보기"}].forEach(({mode:t,icon:s,title:i})=>{const n=document.createElement("button");n.type="button",n.className=`${ds}__mode-button${this.currentMode===t?` ${ds}__mode-button--active`:""}`,n.title=i,n.append(createDbIcon(s,16)),n.addEventListener("click",()=>{this.currentMode=t,this.updateRootClasses(),this.renderMode(),this.renderToolbar()}),e.append(n)}),this.toolbarEl.append(e);const s=document.createElement("div");if(s.className=`${ds}__toolbar-separator`,this.toolbarEl.append(s),"code"!==this.currentMode&&(this.getDefaultToolbarActions().forEach(t=>{const e=document.createElement("button");if(e.type="button",e.className=`${ds}__toolbar-item`,e.disabled=this.getBool("disabled"),t.tooltip&&(e.title=t.tooltip),t.icon)e.append(createDbIcon(t.icon,16));else if("bold"===t.id){const s=document.createElement("strong");s.textContent=t.label,e.append(s)}else if("italic"===t.id){const s=document.createElement("em");s.textContent=t.label,e.append(s)}else if("strikethrough"===t.id){const s=document.createElement("span");s.style.textDecoration="line-through",s.textContent=t.label,e.append(s)}else e.textContent=t.label;if(t.shortcut){const s=document.createElement("span");s.className=`${ds}__toolbar-shortcut`,s.textContent=t.shortcut,e.append(s)}e.addEventListener("click",t.action),this.toolbarEl?.append(e)}),this.getBool("file-upload"))){const t=document.createElement("label");t.className=`${ds}__file-upload`;const e=document.createElement("input");e.type="file",e.accept="image/*",e.hidden=!0,e.addEventListener("change",async()=>{const t=e.files?.[0];if(!t)return;const s=new CustomEvent("db-file-upload",{detail:{file:t},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(s),!s.defaultPrevented){const e=URL.createObjectURL(t);this.insertText(``)}e.value=""}),t.append(e,createDbIcon("upload",16)),this.toolbarEl.append(t)}}renderMode(){if(!this.editPanelEl||!this.previewPanelEl||!this.codePanelEl)return;const t="edit"===this.currentMode||"split"===this.currentMode,e="preview"===this.currentMode||"split"===this.currentMode,s="code"===this.currentMode;this.editPanelEl.hidden=!t,this.previewPanelEl.hidden=!e,this.codePanelEl.hidden=!s,this.updateRootClasses(),this.renderToolbar()}setupAutoSave(){if(this.autoSaveTimer&&window.clearInterval(this.autoSaveTimer),!this.getBool("auto-save"))return;const t=Number(this.getAttribute("auto-save-interval")||3e4);this.autoSaveTimer=window.setInterval(()=>{const t=this.getAttribute("value")||"";this.internalValue&&this.internalValue!==t&&(this.isSaving=!0,this.updateStatus(),this.dispatchEvent(new CustomEvent("db-save",{detail:{value:this.internalValue},bubbles:!0,composed:!0})),this.isSaving=!1,this.lastSaved=new Date,this.updateStatus())},t)}build(){this.toolbarEl=document.createElement("div"),this.toolbarEl.className=`${ds}__toolbar`,this.contentEl=document.createElement("div"),this.contentEl.className=`${ds}__content`,this.editPanelEl=document.createElement("div"),this.editPanelEl.className=`${ds}__edit-panel`,this.textareaEl=document.createElement("textarea"),this.textareaEl.className=`${ds}__textarea`,this.textareaEl.addEventListener("input",()=>{this.internalValue=this.textareaEl?.value||"",this.emitChange(),this.updatePreview(),this.updateCodeView(),this.updateCounts()}),this.textareaEl.addEventListener("focus",()=>{this.isFocused=!0,this.updateRootClasses(),this.dispatchEvent(new CustomEvent("db-focus",{bubbles:!0,composed:!0}))}),this.textareaEl.addEventListener("blur",()=>{this.isFocused=!1,this.updateRootClasses(),this.dispatchEvent(new CustomEvent("db-blur",{bubbles:!0,composed:!0}))}),this.textareaEl.addEventListener("keydown",this.handleKeyDown),this.editPanelEl.append(this.textareaEl),this.previewPanelEl=document.createElement("div"),this.previewPanelEl.className=`${ds}__preview-panel`,this.previewEl=document.createElement("div"),this.previewEl.className=`${ds}__preview`,this.previewPanelEl.append(this.previewEl),this.codePanelEl=document.createElement("div"),this.codePanelEl.className=`${ds}__code-panel`,this.codeViewEl=document.createElement("pre"),this.codeViewEl.className=`${ds}__code-view`;const t=document.createElement("code");this.codeViewEl.append(t),this.codePanelEl.append(this.codeViewEl),this.contentEl.append(this.editPanelEl,this.previewPanelEl,this.codePanelEl),this.statusEl=document.createElement("div"),this.statusEl.className=`${ds}__status`,this.wordCountEl=document.createElement("span"),this.wordCountEl.className=`${ds}__word-count`,this.lineCountEl=document.createElement("span"),this.lineCountEl.className=`${ds}__line-count`,this.lastSavedEl=document.createElement("span"),this.lastSavedEl.className=`${ds}__last-saved`,this.savingEl=document.createElement("span"),this.savingEl.className=`${ds}__saving`,this.savingEl.textContent="저장 중...",this.statusEl.append(this.wordCountEl,this.lineCountEl,this.lastSavedEl,this.savingEl),this.append(this.toolbarEl,this.contentEl,this.statusEl)}}customElements.get("db-markdown-editor")||customElements.define("db-markdown-editor",DbMarkdownEditor);const cs="designbase-wc-testimonial",hs=["list","card"];class DbTestimonial extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["quote","author","role","company","avatar","avatar-initials","rating","max-rating","variant","align"]}connectedCallback(){this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}build(){this.innerEl=document.createElement("div"),this.quoteEl=document.createElement("p"),this.quoteEl.className=`${cs}__quote`,this.footerEl=document.createElement("div"),this.footerEl.className=`${cs}__footer`,this.avatarWrapEl=document.createElement("div"),this.avatarWrapEl.className=`${cs}__avatar`,this.avatarEl=document.createElement("db-avatar"),this.avatarEl.className=`${cs}__avatar-image`,this.avatarWrapEl.append(this.avatarEl);const t=document.createElement("div");t.className=`${cs}__meta`,this.authorEl=document.createElement("span"),this.authorEl.className=`${cs}__author`,this.roleEl=document.createElement("span"),this.roleEl.className=`${cs}__role`,this.ratingEl=document.createElement("db-rating"),this.ratingEl.className=`${cs}__rating`,this.ratingEl.setAttribute("display","stars"),this.ratingEl.setAttribute("variant","inline"),this.ratingEl.setAttribute("allow-half",""),this.ratingEl.setAttribute("readonly",""),this.ratingEl.setAttribute("hover-effect","false"),this.ratingEl.setAttribute("color","primary"),this.ratingEl.hidden=!0,t.append(this.authorEl,this.roleEl,this.ratingEl),this.footerEl.append(this.avatarWrapEl,t),this.extraEl=document.createElement("div"),this.extraEl.className=`${cs}__extra`,this.extraEl.hidden=!0,this.innerEl.append(this.quoteEl,this.footerEl,this.extraEl),this.append(this.innerEl)}getVariant(){const t=this.getAttribute("variant")||"card";return hs.includes(t)?t:"card"}getAvatarSize(){return"list"===this.getVariant()?"s":"m"}syncExtraContent(){if(!this.extraEl)return;const t=Array.from(this.childNodes).filter(t=>t!==this.innerEl&&(t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.textContent?.trim()));if(0===t.length)return this.extraEl.hidden=!0,void this.extraEl.replaceChildren();this.extraEl.hidden=!1,this.extraEl.replaceChildren(...t.map(t=>t.cloneNode(!0)))}updateUI(){const t=this.getAttribute("quote")||"",e=this.getAttribute("author")||"",s=this.getAttribute("role")||"",i=this.getAttribute("company")||"",n=this.getAttribute("avatar")||"",a=this.getAttribute("avatar-initials")||"",r=this.getAttribute("rating"),l=Number(this.getAttribute("max-rating")||5),o=null!==r&&""!==r?function clampRating(t,e){if("number"==typeof t&&!Number.isNaN(t))return t<0?0:t>e?e:Math.round(10*t)/10}(Number(r),l):void 0,d=this.getVariant(),u=this.getAttribute("align")||"left",b=[cs,`${cs}--variant-${d}`,"left"!==u?`${cs}--align-${u}`:""].filter(Boolean).join(" ");this.className=b,this.innerEl&&(this.innerEl.className=`${cs}__inner`),this.quoteEl&&(this.quoteEl.textContent=t?`“${t}”`:""),this.authorEl&&(this.authorEl.textContent=e);const p=[s,i].filter(Boolean).join(" · ");this.roleEl&&(this.roleEl.textContent=p,this.roleEl.hidden=!p);const m=Boolean(n||a);this.avatarWrapEl&&(this.avatarWrapEl.hidden=!m),this.avatarEl&&m&&(this.avatarEl.setAttribute("size",this.getAvatarSize()),n?this.avatarEl.setAttribute("src",n):this.avatarEl.removeAttribute("src"),a?this.avatarEl.setAttribute("initials",a):this.avatarEl.removeAttribute("initials"),this.avatarEl.setAttribute("alt",`${e} 프로필 이미지`)),this.ratingEl&&("number"==typeof o?(this.ratingEl.hidden=!1,this.ratingEl.setAttribute("value",String(o)),this.ratingEl.setAttribute("max-value",String(l)),this.ratingEl.setAttribute("size","s")):this.ratingEl.hidden=!0),this.syncExtraContent()}}customElements.get("db-testimonial")||customElements.define("db-testimonial",DbTestimonial);const us="designbase-wc-section-hero";class DbSectionHero extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","subtitle","description","background-image","background-video","overlay-color","overlay-opacity","buttons","variant","theme","alignment","animated","full-height","min-height","max-height","content-max-width"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}get buttons(){return this.parseButtons()}set buttons(t){this.setAttribute("buttons","string"==typeof t?t:JSON.stringify(t))}parseButtons(){try{const t=JSON.parse(this.getAttribute("buttons")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}build(){this.backgroundVideoEl=document.createElement("video"),this.backgroundVideoEl.className=`${us}__background-video`,this.backgroundVideoEl.autoplay=!0,this.backgroundVideoEl.muted=!0,this.backgroundVideoEl.loop=!0,this.backgroundVideoEl.playsInline=!0,this.backgroundVideoEl.hidden=!0,this.backgroundImageEl=document.createElement("div"),this.backgroundImageEl.className=`${us}__background-image`,this.backgroundImageEl.hidden=!0,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${us}__overlay`,this.overlayEl.hidden=!0;const t=document.createElement("div");t.className=`${us}__container`;const e=document.createElement("div");e.className=`${us}__content`,this.titleEl=document.createElement("h1"),this.titleEl.className=`${us}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${us}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${us}__description`,this.buttonsEl=document.createElement("div"),this.buttonsEl.className=`${us}__buttons`,e.append(this.titleEl,this.subtitleEl,this.descriptionEl,this.buttonsEl),t.append(e),this.append(this.backgroundVideoEl,this.backgroundImageEl,this.overlayEl,t)}updateUI(){const t=this.getAttribute("title")||"",e=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("background-image")||"",n=this.getAttribute("background-video")||"",a=this.getAttribute("overlay-color")||"",r=Number(this.getAttribute("overlay-opacity")||.5),l=this.getAttribute("variant")||"default",o=this.getAttribute("theme")||"light",d=this.getAttribute("alignment")||"left",u=this.hasAttribute("animated"),b=this.hasAttribute("full-height"),p=this.getAttribute("min-height"),m=this.getAttribute("max-height"),g=this.getAttribute("content-max-width"),v=this.parseButtons(),E=Boolean(i||n),f="dark"===o||"gradient"===o||E&&("overlay"===l||"image"===o);this.className=[us,`${us}--variant-${l}`,`${us}--theme-${o}`,`${us}--alignment-${d}`,u&&`${us}--animated`,b&&`${us}--full-height`,f&&`${us}--on-media`].filter(Boolean).join(" "),this.style.minHeight=p||"",this.style.maxHeight=m||"",this.titleEl&&(this.titleEl.textContent=t),this.subtitleEl&&(this.subtitleEl.textContent=e,this.subtitleEl.hidden=!e),this.descriptionEl&&(this.descriptionEl.textContent=s,this.descriptionEl.hidden=!s);const w=this.querySelector(`.${us}__content`);if(w&&(g?w.style.maxWidth=/^\d+$/.test(g)?`${g}px`:g:w.style.removeProperty("max-width")),this.backgroundVideoEl)if(n){this.backgroundVideoEl.hidden=!1,this.backgroundVideoEl.replaceChildren();const t=document.createElement("source");t.src=n,t.type="video/mp4",this.backgroundVideoEl.append(t)}else this.backgroundVideoEl.hidden=!0;this.backgroundImageEl&&(i?(this.backgroundImageEl.hidden=!1,this.backgroundImageEl.style.backgroundImage=`url(${i})`,this.backgroundImageEl.style.backgroundSize="cover",this.backgroundImageEl.style.backgroundPosition="center",this.backgroundImageEl.style.backgroundRepeat="no-repeat"):this.backgroundImageEl.hidden=!0),this.overlayEl&&(E?(this.overlayEl.hidden=!1,a?(this.overlayEl.style.background=a,this.overlayEl.style.opacity=String(r)):(this.overlayEl.style.background=`linear-gradient(180deg, rgba(0, 0, 0, ${.35*r}) 0%, rgba(0, 0, 0, ${r}) 100%)`,this.overlayEl.style.opacity="1")):this.overlayEl.hidden=!0),this.buttonsEl&&(this.buttonsEl.replaceChildren(),v.length>0?(v.forEach(t=>{const e=document.createElement("db-button");if(e.setAttribute("variant",function mapButtonVariant(t){return"outline"===t?"tertiary":"ghost"===t?"ghost":"secondary"===t?"secondary":"tertiary"===t?"tertiary":"primary"}(t.variant)),e.setAttribute("size",t.size||"m"),t.href&&e.setAttribute("href",t.href),t.external&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer")),t.startIcon)e.setAttribute("start-icon",t.startIcon),e.textContent=t.text;else if(t.icon){const s=document.createElement("span");s.className=`${us}__button-content`;const i=document.createElement("span");i.className=`${us}__button-icon`,i.setAttribute("aria-hidden","true"),i.textContent=t.icon;const n=document.createElement("span");n.textContent=t.text,s.append(i,n),e.append(s)}else e.textContent=t.text;e.addEventListener("click",e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("db-button-click",{detail:{button:t},bubbles:!0,composed:!0}))}),this.buttonsEl.append(e)}),this.buttonsEl.hidden=!1):this.buttonsEl.hidden=!0)}}customElements.get("db-section-hero")||customElements.define("db-section-hero",DbSectionHero);const bs="designbase-wc-section-feature";class DbSectionFeature extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","image","image-alt","media-position","actions","tinted","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseBadge(){try{const t=this.getAttribute("badge");return t?JSON.parse(t):null}catch{return null}}get actions(){return this.parseActions()}set actions(t){this.setAttribute("actions","string"==typeof t?t:JSON.stringify(t))}parseActions(){try{const t=JSON.parse(this.getAttribute("actions")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}build(){this.sectionEl=document.createElement("db-section"),this.sectionEl.setAttribute("no-padding",""),this.sectionEl.setAttribute("data-wc-internal",""),this.featureWrapEl=document.createElement("div"),this.featureWrapEl.className=bs;const t=document.createElement("div");t.className=`${bs}__inner`;const e=document.createElement("div");e.className=`${bs}__content`,this.badgeEl=document.createElement("db-badge"),this.badgeEl.className=`${bs}__badge`,this.badgeEl.hidden=!0,this.headlineEl=document.createElement("h2"),this.headlineEl.className=`${bs}__headline`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${bs}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${bs}__description`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${bs}__actions`,e.append(this.badgeEl,this.headlineEl,this.subtitleEl,this.descriptionEl,this.actionsEl),this.mediaEl=document.createElement("div"),this.mediaEl.className=`${bs}__media`,this.imageEl=document.createElement("img"),this.imageEl.className=`${bs}__image`,this.mediaEl.append(this.imageEl),t.append(e,this.mediaEl),this.featureWrapEl.append(t),this.sectionEl.append(this.featureWrapEl),this.append(this.sectionEl)}updateUI(){const t=this.getAttribute("headline")||"",e=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("image")||"",n=this.getAttribute("image-alt")||t||"feature",a=this.getAttribute("media-position")||"right",r=this.getAttribute("content-padding")||"l",l=this.getAttribute("size")||"l",o=this.hasAttribute("tinted"),d=this.parseBadge(),u=this.parseActions(),b=[bs,`${bs}--media-${a}`,`${bs}--padding-${r}`,o&&`${bs}--tinted`].filter(Boolean).join(" ");this.className=bs,this.featureWrapEl&&(this.featureWrapEl.className=b),this.sectionEl&&(this.sectionEl.setAttribute("size",l),this.hasAttribute("full-width")?this.sectionEl.setAttribute("full-width",""):this.sectionEl.removeAttribute("full-width"),this.hasAttribute("full-height")?this.sectionEl.setAttribute("full-height",""):this.sectionEl.removeAttribute("full-height"),this.hasAttribute("overflow-visible")?this.sectionEl.setAttribute("overflow-visible",""):this.sectionEl.removeAttribute("overflow-visible")),this.badgeEl&&(d?.text?(this.badgeEl.hidden=!1,this.badgeEl.setAttribute("variant",d.variant||"primary"),this.badgeEl.setAttribute("badge-style",d.style||"text"),this.badgeEl.setAttribute("size",d.size||"m"),this.badgeEl.textContent=d.text):this.badgeEl.hidden=!0),this.headlineEl&&(this.headlineEl.textContent=t),this.subtitleEl&&(this.subtitleEl.textContent=e,this.subtitleEl.hidden=!e),this.descriptionEl&&(this.descriptionEl.textContent=s,this.descriptionEl.hidden=!s),this.mediaEl&&this.imageEl&&(i?(this.mediaEl.hidden=!1,this.imageEl.src=i,this.imageEl.alt=n):this.mediaEl.hidden=!0),this.actionsEl&&(this.actionsEl.replaceChildren(),u.length>0?(u.forEach(t=>{const e=document.createElement("db-button");e.setAttribute("variant",t.variant||"primary"),e.setAttribute("size",t.size||"m"),t.href&&e.setAttribute("href",t.href),e.textContent=t.label,e.addEventListener("click",e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("db-action",{detail:{action:t},bubbles:!0,composed:!0}))}),this.actionsEl.append(e)}),this.actionsEl.hidden=!1):this.actionsEl.hidden=!0)}}customElements.get("db-section-feature")||customElements.define("db-section-feature",DbSectionFeature);const ps="designbase-wc-app-badge",ms={"app-store":{label:"다운로드",storeName:"App Store"},"google-play":{label:"다운로드",storeName:"Google Play"}};class DbAppBadge extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["store","href","label","store-name","size","theme"]}connectedCallback(){this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}getStore(){return"google-play"===(this.getAttribute("store")||"app-store")?"google-play":"app-store"}getIconSize(){const t=this.getAttribute("size")||"m";return"s"===t?18:"l"===t?24:20}build(){this.iconWrapEl=document.createElement("span"),this.iconWrapEl.className=`${ps}__icon`,this.iconWrapEl.setAttribute("aria-hidden","true");const t=document.createElement("span");t.className=`${ps}__text`,this.labelEl=document.createElement("span"),this.labelEl.className=`${ps}__label`,this.storeEl=document.createElement("span"),this.storeEl.className=`${ps}__store`,t.append(this.labelEl,this.storeEl),this.append(this.iconWrapEl,t),this.addEventListener("click",t=>{this.getAttribute("href")||this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0,detail:{event:t}}))})}updateUI(){const t=this.getStore(),e=ms[t],s=this.getAttribute("size")||"m",i=this.getAttribute("theme")||"dark",n=this.getAttribute("label")||e.label,a=this.getAttribute("store-name")||e.storeName,r=this.getAttribute("href");this.className=[ps,`${ps}--${s}`,`${ps}--${i}`,`${ps}--${t}`].join(" "),r?(this.setAttribute("role","link"),this.tabIndex=0,this.onclick=()=>window.open(r,"_blank","noopener,noreferrer")):(this.setAttribute("role","button"),this.tabIndex=0),this.iconWrapEl&&this.iconWrapEl.replaceChildren(createDbIcon("app-store"===t?"apple":"play-store",this.getIconSize())),this.labelEl&&(this.labelEl.textContent=n),this.storeEl&&(this.storeEl.textContent=a)}}customElements.get("db-app-badge")||customElements.define("db-app-badge",DbAppBadge);const gs="designbase-wc-section-contact",vs="contact@designbase.co.kr";class DbSectionContact extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","description","action","align","accent","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseAction(){try{const t=this.getAttribute("action");if(t)return JSON.parse(t)}catch{}return{label:vs,href:`mailto:${vs}`}}build(){this.sectionEl=document.createElement("db-section"),this.sectionEl.setAttribute("no-padding",""),this.sectionEl.setAttribute("data-wc-internal",""),this.wrapEl=document.createElement("div"),this.wrapEl.className=gs,this.contactWrapEl=document.createElement("div"),this.contactWrapEl.className=`${gs}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${gs}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${gs}__description`,this.actionEl=document.createElement("db-button"),this.actionEl.className=`${gs}__action`,this.actionEl.setAttribute("variant","primary"),this.actionEl.setAttribute("size","m"),this.actionEl.setAttribute("radius","pill"),this.actionEl.setAttribute("start-icon","mail"),this.actionEl.addEventListener("click",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("db-action",{detail:{action:this.parseAction()},bubbles:!0,composed:!0}))}),this.contactWrapEl.append(this.titleEl,this.descriptionEl,this.actionEl),this.wrapEl.append(this.contactWrapEl),this.sectionEl.append(this.wrapEl),this.append(this.sectionEl)}updateUI(){const t=this.getAttribute("title")||"문의하기",e=this.getAttribute("description")||"궁금한 점이 있으시면 언제든지 연락주세요.",s=this.getAttribute("align")||"center",i=this.getAttribute("content-padding")||"l",n=this.getAttribute("size")||"l",a=!this.hasAttribute("accent")||"false"!==this.getAttribute("accent"),r=this.parseAction(),l=[gs,`${gs}--${s}`,`${gs}--padding-${i}`,a&&`${gs}--accent`].filter(Boolean).join(" ");this.className=gs,this.wrapEl&&(this.wrapEl.className=l),this.contactWrapEl&&(this.contactWrapEl.className=`${gs}__inner`),this.sectionEl&&(this.sectionEl.setAttribute("size",n),this.hasAttribute("full-width")?this.sectionEl.setAttribute("full-width",""):this.sectionEl.removeAttribute("full-width"),this.hasAttribute("full-height")?this.sectionEl.setAttribute("full-height",""):this.sectionEl.removeAttribute("full-height"),this.hasAttribute("overflow-visible")?this.sectionEl.setAttribute("overflow-visible",""):this.sectionEl.removeAttribute("overflow-visible")),this.titleEl&&(this.titleEl.textContent=t),this.descriptionEl&&(this.descriptionEl.textContent=e,this.descriptionEl.hidden=!e),this.actionEl&&(this.actionEl.textContent=r.label,r.href?this.actionEl.setAttribute("href",r.href):this.actionEl.removeAttribute("href"))}}customElements.get("db-section-contact")||customElements.define("db-section-contact",DbSectionContact);const Es="designbase-wc-section-app-download";class DbSectionAppDownload extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","description","stores","align","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}get stores(){return this.parseStores()}set stores(t){this.setAttribute("stores","string"==typeof t?t:JSON.stringify(t))}parseStores(){try{const t=JSON.parse(this.getAttribute("stores")||"[]");if(Array.isArray(t)&&t.length>0)return t}catch{}return[{store:"app-store",href:"#"},{store:"google-play",href:"#"}]}build(){this.sectionEl=document.createElement("db-section"),this.sectionEl.setAttribute("no-padding",""),this.sectionEl.setAttribute("data-wc-internal",""),this.wrapEl=document.createElement("div"),this.wrapEl.className=Es,this.innerEl=document.createElement("div"),this.innerEl.className=`${Es}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${Es}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${Es}__description`,this.badgesEl=document.createElement("div"),this.badgesEl.className=`${Es}__badges`,this.innerEl.append(this.titleEl,this.descriptionEl,this.badgesEl),this.wrapEl.append(this.innerEl),this.sectionEl.append(this.wrapEl),this.append(this.sectionEl)}updateUI(){const t=this.getAttribute("title")||"지금 바로 시작하세요",e=this.getAttribute("description")||"앱을 다운로드하고 바로 이용해 보세요.",s=this.getAttribute("align")||"center",i=this.getAttribute("size")||"l",n=this.parseStores(),a=[Es,`${Es}--${s}`].join(" ");this.className=Es,this.wrapEl&&(this.wrapEl.className=a),this.sectionEl&&(this.sectionEl.setAttribute("size",i),this.hasAttribute("full-width")?this.sectionEl.setAttribute("full-width",""):this.sectionEl.removeAttribute("full-width"),this.hasAttribute("full-height")?this.sectionEl.setAttribute("full-height",""):this.sectionEl.removeAttribute("full-height"),this.hasAttribute("overflow-visible")?this.sectionEl.setAttribute("overflow-visible",""):this.sectionEl.removeAttribute("overflow-visible")),this.titleEl&&(this.titleEl.textContent=t),this.descriptionEl&&(this.descriptionEl.textContent=e,this.descriptionEl.hidden=!e),this.badgesEl&&(this.badgesEl.replaceChildren(),n.forEach(t=>{const e=document.createElement("db-app-badge");e.setAttribute("store",t.store),e.setAttribute("size",t.size||"m"),e.setAttribute("theme",t.theme||"dark"),t.href&&e.setAttribute("href",t.href),t.label&&e.setAttribute("label",t.label),t.storeName&&e.setAttribute("store-name",t.storeName),this.badgesEl.append(e)}))}}customElements.get("db-section-app-download")||customElements.define("db-section-app-download",DbSectionAppDownload);const fs="designbase-wc-marquee";class DbMarquee extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.containerWidth=0,this.baseGroupWidth=0,this.boundMeasure=()=>this.measure()}static get observedAttributes(){return["items","direction","duration","speed","size","variant","bordered","pause-on-hover","fade-edges","fade-width","edge-padding","gap","align-y","aria-label"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build(),this.bindResize()),this.updateUI()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.unbindImageListeners()}attributeChangedCallback(){this.built&&this.updateUI()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}parseItems(){try{const t=this.getAttribute("items"),e=t?JSON.parse(t):[];if(Array.isArray(e)&&e.length>0)return e}catch{}const t=Array.from(this.children).filter(t=>!t.hasAttribute("data-wc-internal"));return t.length>0?t.map(t=>t.textContent?.trim()||""):[]}build(){this.containerEl=document.createElement("div"),this.srOnlyEl=document.createElement("span"),this.srOnlyEl.className=`${fs}__sr-only`,this.trackEl=document.createElement("div"),this.trackEl.className=`${fs}__track`,this.baseGroupEl=document.createElement("div"),this.baseGroupEl.className=`${fs}__group`,this.baseGroupEl.setAttribute("aria-hidden","true"),this.trackEl.append(this.baseGroupEl),this.containerEl.append(this.srOnlyEl,this.trackEl),this.append(this.containerEl)}bindResize(){this.resizeObserver=new ResizeObserver(()=>this.measure()),this.containerEl&&this.resizeObserver.observe(this.containerEl),this.baseGroupEl&&this.resizeObserver.observe(this.baseGroupEl)}measure(){this.containerWidth=Math.ceil(this.containerEl?.clientWidth??0),this.baseGroupWidth=Math.ceil(this.baseGroupEl?.scrollWidth??0),this.renderDuplicates(),this.bindImageListeners(),this.syncReadyState()}unbindImageListeners(){this.baseGroupEl&&this.baseGroupEl.querySelectorAll("img").forEach(t=>{t.removeEventListener("load",this.boundMeasure),t.removeEventListener("error",this.boundMeasure)})}bindImageListeners(){this.baseGroupEl&&(this.unbindImageListeners(),this.baseGroupEl.querySelectorAll("img").forEach(t=>{t.complete||(t.addEventListener("load",this.boundMeasure),t.addEventListener("error",this.boundMeasure))}))}renderItem(t){const e=document.createElement("div");return e.className=`${fs}__item`,e.textContent=t,e}renderGroup(t,e){const s=e??document.createElement("div");return s.className=`${fs}__group`,s.setAttribute("aria-hidden","true"),s.replaceChildren(...t.map(t=>this.renderItem(t))),s}renderDuplicates(){if(!this.trackEl||!this.baseGroupEl)return;const t=this.parseItems();this.renderGroup(t,this.baseGroupEl);const e=this.baseGroupWidth>0?Math.max(1,Math.ceil(this.containerWidth/this.baseGroupWidth)):1,s=[];for(let i=0;i<e;i+=1)s.push(this.renderGroup(t));this.trackEl.replaceChildren(this.baseGroupEl,...s)}syncReadyState(){this.containerEl&&this.containerEl.classList.toggle(`${fs}--ready`,this.baseGroupWidth>0)}updateUI(){const t=this.parseItems();if(0===t.length)return void(this.hidden=!0);this.hidden=!1;const e=this.getAttribute("direction")||"left",s=Math.max(Number(this.getAttribute("duration")||20),1),i=Number(this.getAttribute("speed")||1),n=s/(Number.isFinite(i)&&i>0?i:1),a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"default",l=this.getAttribute("align-y")||"center",o=this.getBool("fade-edges"),d=Math.max(Number(this.getAttribute("fade-width")||48),0),u=this.getAttribute("edge-padding"),b=null!==u&&""!==u?Math.max(Number(u),0):o?d:0,p=Math.max(Number(this.getAttribute("gap")||24),0),m=this.getBool("pause-on-hover",!0),g=this.hasAttribute("bordered")?this.getBool("bordered"):"outlined"===r,v=this.getAttribute("aria-label")||"Scrolling content";this.containerEl&&(this.containerEl.className=[fs,`${fs}--size-${a}`,`${fs}--variant-${r}`,`${fs}--align-${l}`,m&&`${fs}--pause-on-hover`,o&&`${fs}--fade-edges`,"right"===e&&`${fs}--right`,g&&`${fs}--bordered`].filter(Boolean).join(" "),this.containerEl.style.setProperty("--db-marquee-duration",`${n}s`),this.containerEl.style.setProperty("--db-marquee-shift",`${this.baseGroupWidth+p}px`),this.containerEl.style.setProperty("--db-marquee-gap",`${p}px`),this.containerEl.style.setProperty("--db-marquee-fade-width",`${d}px`),this.containerEl.style.setProperty("--db-marquee-edge-padding",`${b}px`),this.containerEl.setAttribute("role","region"),this.containerEl.setAttribute("aria-label",v)),this.srOnlyEl&&(this.srOnlyEl.textContent=t.join(" • ")||v),this.renderDuplicates(),this.measure()}}customElements.get("db-marquee")||customElements.define("db-marquee",DbMarquee);const ws="designbase-wc-gradient";class DbGradient extends HTMLElement{static get observedAttributes(){return["colors","direction","size","variant","animation-duration","animation-delay","full-width","full-height"]}connectedCallback(){this.style.display="flex",this.updateUI()}attributeChangedCallback(){this.updateUI()}getBool(t){return this.hasAttribute(t)&&"false"!==this.getAttribute(t)}get colors(){return this.parseColors()}set colors(t){this.setAttribute("colors","string"==typeof t?t:JSON.stringify(t))}parseColors(){try{const t=JSON.parse(this.getAttribute("colors")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}directionMap(t){return{"to-right":"to right","to-left":"to left","to-bottom":"to bottom","to-top":"to top","to-bottom-right":"to bottom right","to-bottom-left":"to bottom left","to-top-right":"to top right","to-top-left":"to top left",radial:"circle"}[t]}colorStops(t){return t.map(t=>{const e=void 0!==t.position?`${t.position}%`:"";return e?`${t.color} ${e}`:t.color}).join(", ")}generateGradientStyle(t,e){if(0===t.length)return{};const s=this.colorStops(t);return"radial"===e?{background:`radial-gradient(circle, ${s})`}:{background:`linear-gradient(${this.directionMap(e)}, ${s})`}}generateAnimatedStyle(t,e,s,i){const n=t.map((t,e)=>{const s=((void 0!==t.position?t.position:0)+20*e)%100;return`${t.color} ${s}%`}).join(", ");return{background:"radial"===e?`radial-gradient(circle, ${n})`:`linear-gradient(${this.directionMap(e)}, ${n})`,animation:`gradient-shift ${s}s ease-in-out ${i}s infinite`,backgroundSize:"200% 200%"}}generateMeshStyle(t){return{background:`conic-gradient(from 0deg, ${t.slice(0,4).map((t,e)=>{const s=void 0!==t.position?t.position:33.33*e;return`${t.color} ${s}%`}).join(", ")})`}}updateUI(){const t=this.parseColors(),e=this.getAttribute("direction")||"to-right",s=this.getAttribute("size")||"m",i=this.getAttribute("variant")||"default",n=Number(this.getAttribute("animation-duration")||3),a=Number(this.getAttribute("animation-delay")||0),r=this.getBool("full-width"),l=this.getBool("full-height");this.className=[ws,`${ws}--size-${s}`,`${ws}--variant-${i}`,`${ws}--direction-${e}`,r&&`${ws}--full-width`,l&&`${ws}--full-height`].filter(Boolean).join(" ");let o={};o="animated"===i?this.generateAnimatedStyle(t,e,n,a):"mesh"===i?this.generateMeshStyle(t):this.generateGradientStyle(t,e),Object.assign(this.style,o)}}customElements.get("db-gradient")||customElements.define("db-gradient",DbGradient);const ys={primary:{light:["#eff6ff","#dbeafe","#bfdbfe","#93c5fd"],vivid:["#3b82f6","#2563eb","#1d4ed8","#1e40af","#1e3a8a"],dark:["#0f172a","#1e293b","#334155","#475569","#64748b"]},secondary:{light:["#f8fafc","#f1f5f9","#e2e8f0","#cbd5e1"],vivid:["#6b7280","#4b5563","#374151","#1f2937","#111827"],dark:["#0f0f0f","#1a1a1a","#262626","#404040","#525252"]},success:{light:["#f0fdf4","#dcfce7","#bbf7d0","#86efac"],vivid:["#22c55e","#16a34a","#15803d","#166534","#14532d"],dark:["#052e16","#14532d","#166534","#15803d","#16a34a"]},warning:{light:["#fffbeb","#fef3c7","#fde68a"],vivid:["#f59e0b","#d97706","#b45309","#92400e","#78350f"],dark:["#451a03","#78350f","#92400e","#b45309","#d97706"]},error:{light:["#fef2f2","#fecaca","#fca5a5"],vivid:["#ef4444","#dc2626","#b91c1c","#991b1b","#7f1d1d"],dark:["#450a0a","#7f1d1d","#991b1b","#b91c1c","#dc2626"]},info:{light:["#eff6ff","#dbeafe","#bfdbfe","#93c5fd"],vivid:["#3b82f6","#2563eb","#1d4ed8","#1e40af","#1e3a8a"],dark:["#0f172a","#1e293b","#334155","#475569","#64748b"]},purple:{light:["#faf5ff","#f3e8ff","#e9d5ff","#d8b4fe"],vivid:["#a855f7","#9333ea","#7c3aed","#6d28d9","#5b21b6"],dark:["#3b0764","#581c87","#6b21a8","#7c3aed","#9333ea"]},ocean:{light:["#f0fdfa","#ccfbf1","#99f6e4"],vivid:["#14b8a6","#0d9488","#0f766e","#115e59","#134e4a"],dark:["#042f2e","#134e4a","#115e59","#0f766e","#0d9488"]},sunset:{light:["#fff7ed","#fed7aa","#fdba74"],vivid:["#f97316","#ea580c","#c2410c","#9a3412","#7c2d12"],dark:["#431407","#7c2d12","#9a3412","#c2410c","#ea580c"]}};const As="designbase-wc-random-gradient";class DbRandomGradient extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["scheme","tone","width","height","blur","color-count","animated","animation-duration","overlay","overlay-opacity"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}disconnectedCallback(){this.stopAnimation()}attributeChangedCallback(){this.built&&this.updateUI()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}build(){this.backgroundEl=document.createElement("div"),this.backgroundEl.className=`${As}__background`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${As}__overlay`,this.contentEl=document.createElement("div"),this.contentEl.className=`${As}__content`,this.append(this.backgroundEl,this.overlayEl,this.contentEl)}stopAnimation(){this.animationTimer&&(window.clearInterval(this.animationTimer),this.animationTimer=void 0)}applyGradient(){const t=function createRandomGradientStyle(t,e,s,i,n,a){const r=ys[t][e],l=Math.min(6,Math.max(3,s)),o=[];for(let t=0;t<l;t+=1)o.push(r[Math.floor(Math.random()*r.length)]);const d=Array.from({length:l},()=>100*Math.random()).sort((t,e)=>t-e),u=o.map((t,e)=>`${t} ${d[e]}%`).join(", ");return{background:`radial-gradient(circle at ${100*Math.random()}% ${100*Math.random()}%, ${u})`,filter:`blur(${Math.max(80,i)}px)`,transition:n?`background ${a}s ease-in-out`:"none"}}(this.getAttribute("scheme")||"primary",this.getAttribute("tone")||"vivid",Number(this.getAttribute("color-count")||4),Number(this.getAttribute("blur")||80),this.getBool("animated"),Number(this.getAttribute("animation-duration")||10));this.backgroundEl&&Object.assign(this.backgroundEl.style,t)}syncContent(){if(!this.contentEl)return;Array.from(this.childNodes).filter(t=>t!==this.backgroundEl&&t!==this.overlayEl&&t!==this.contentEl&&!(t instanceof HTMLElement&&t.hasAttribute("data-wc-internal"))).forEach(t=>this.contentEl.append(t)),this.contentEl.hidden=0===this.contentEl.childNodes.length}updateUI(){const t=this.getAttribute("scheme")||"primary",e=this.getAttribute("tone")||"vivid",s=this.getAttribute("width")||"100%",i=this.getAttribute("height")||"600px",n=!this.hasAttribute("overlay")||"false"!==this.getAttribute("overlay"),a=Number(this.getAttribute("overlay-opacity")||.2),r=this.getBool("animated");if(this.className=[As,r&&`${As}--animated`,n&&`${As}--with-overlay`].filter(Boolean).join(" "),this.style.width=/^\d+$/.test(s)?`${s}px`:s,this.style.height=/^\d+$/.test(i)?`${i}px`:i,this.overlayEl&&(this.overlayEl.hidden=!n,n)){const s=ys[t][e];Object.assign(this.overlayEl.style,{background:`linear-gradient(45deg, ${s[0]}, ${s[1]})`,opacity:String(a)})}if(this.stopAnimation(),this.applyGradient(),r){const t=Number(this.getAttribute("animation-duration")||10);this.animationTimer=window.setInterval(()=>this.applyGradient(),1e3*t)}this.syncContent()}}customElements.get("db-random-gradient")||customElements.define("db-random-gradient",DbRandomGradient);const _s="designbase-wc-ad-banner",Cs={hero:"지금 바로 시작하세요",topbar:"🎉 신규 가입 시 10,000원 적립금 증정!",card:"프리미엄 멤버십",floating:"오늘만 특가!"},xs={hero:"최대 50% 할인된 가격으로 프리미엄 서비스를 경험해보세요. 기간 한정 특별 혜택!",topbar:"오늘 하루만 특별 혜택",card:"무제한 서비스 이용권을 특별가에 만나보세요",floating:"장바구니에 담긴 상품 추가 20% 할인"},ks={hero:"자세히 보기",topbar:"지금 가입하기",card:"알아보기",floating:"할인받기"},Ss={hero:"star",topbar:"trending-up",card:"star-filled",floating:"cart"},Ns={primary:"primary",secondary:"secondary",success:"success",warning:"warning",error:"error"};class DbAdBanner extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.visible=!0,this.progress=100}static get observedAttributes(){return["type","variant","title","subtitle","cta-text","auto-close","close-delay","use-random-gradient","gradient-scheme","gradient-tone","gradient-animated","countdown-end-date","show-countdown","open"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}disconnectedCallback(){this.stopAutoClose()}attributeChangedCallback(t){this.built&&("open"===t&&(this.visible="false"!==this.getAttribute("open")),this.updateUI())}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getType(){const t=this.getAttribute("type")||"hero";return["hero","topbar","card","floating"].includes(t)?t:"hero"}getVariant(){const t=this.getAttribute("variant")||"primary";return["primary","secondary","success","warning","error"].includes(t)?t:"primary"}build(){this.rootEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.contentEl.className=`${_s}__content`,this.closeBtn=document.createElement("button"),this.closeBtn.type="button",this.closeBtn.className=`${_s}__close`,this.closeBtn.setAttribute("aria-label","닫기"),this.closeBtn.append(createDbIcon("close",20)),this.closeBtn.addEventListener("click",()=>this.handleClose());const t=document.createElement("div");t.className=`${_s}__main`,this.iconEl=document.createElement("div"),this.iconEl.className=`${_s}__icon`,this.labelEl=document.createElement("span"),this.labelEl.className=`${_s}__label`,this.labelEl.textContent="특별 이벤트",this.badgeEl=document.createElement("span"),this.badgeEl.className=`${_s}__badge`,this.badgeEl.textContent="HOT DEAL",this.titleEl=document.createElement("h2"),this.titleEl.className=`${_s}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${_s}__subtitle`;const e=document.createElement("div");e.className=`${_s}__text`,this.countdownWrapEl=document.createElement("div"),this.countdownWrapEl.className=`${_s}__countdown`,this.countdownEl=document.createElement("db-countdown"),this.countdownEl.setAttribute("size","s"),this.countdownEl.setAttribute("variant","compact"),this.countdownEl.setAttribute("show-labels","false"),this.countdownWrapEl.append(this.countdownEl),e.append(this.titleEl,this.subtitleEl,this.countdownWrapEl),this.actionsEl=document.createElement("div"),this.actionsEl.className=`${_s}__actions`,this.ctaEl=document.createElement("db-button"),this.ctaEl.className=`${_s}__cta`,this.ctaEl.setAttribute("variant","primary"),this.ctaEl.setAttribute("end-icon","arrow-right"),this.ctaEl.addEventListener("click",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("db-cta-click",{bubbles:!0,composed:!0}))}),this.actionsEl.append(this.ctaEl),t.append(this.iconEl,e,this.actionsEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${_s}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${_s}__progress-bar`,this.progressEl.append(this.progressBarEl),this.contentEl.append(this.closeBtn,t,this.progressEl),this.rootEl.append(this.contentEl),this.append(this.rootEl)}handleClose(){this.visible=!1,this.hidden=!0,this.stopAutoClose(),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}stopAutoClose(){this.autoCloseTimer&&(window.clearInterval(this.autoCloseTimer),this.autoCloseTimer=void 0)}startAutoClose(t){this.stopAutoClose(),this.progress=100,this.autoCloseTimer=window.setInterval(()=>{this.progress-=100/(t/100),this.progressBarEl&&(this.progressBarEl.style.width=`${Math.max(this.progress,0)}%`),this.progress<=0&&this.handleClose()},100)}renderGradientWrapper(t){this.rootEl&&this.contentEl&&(t?(this.gradientEl||(this.gradientEl=document.createElement("db-random-gradient"),this.gradientEl.className=`${_s}__gradient-bg`,this.gradientEl.setAttribute("height","100%"),this.gradientEl.setAttribute("width","100%")),this.gradientEl.parentElement!==this.rootEl&&this.rootEl.replaceChildren(this.gradientEl),this.contentEl.parentElement!==this.gradientEl&&this.gradientEl.append(this.contentEl)):(this.gradientEl&&(this.gradientEl.remove(),this.gradientEl=void 0),this.contentEl.parentElement!==this.rootEl&&this.rootEl.replaceChildren(this.contentEl)))}updateUI(){if(!this.visible||"false"===this.getAttribute("open"))return void(this.hidden=!0);this.hidden=!1;const t=this.getType(),e=this.getVariant(),s=this.getAttribute("title")||Cs[t],i=this.getAttribute("subtitle")||xs[t],n=this.getAttribute("cta-text")||ks[t],a=this.getBool("auto-close"),r=Math.max(Number(this.getAttribute("close-delay")||5e3),1e3),l=this.getBool("use-random-gradient"),o=this.getAttribute("gradient-tone")||"vivid",d=!this.hasAttribute("gradient-animated")||"false"!==this.getAttribute("gradient-animated"),u=this.getBool("show-countdown"),b=this.getAttribute("countdown-end-date");this.rootEl&&(this.rootEl.className=[_s,`${_s}--type-${t}`,`${_s}--variant-${e}`,a&&`${_s}--auto-close`,l&&`${_s}--with-gradient`,l&&"light"===o&&`${_s}--gradient-light`].filter(Boolean).join(" ")),l&&this.gradientEl&&(this.gradientEl.setAttribute("scheme",this.getAttribute("gradient-scheme")||Ns[e]),this.gradientEl.setAttribute("tone",o),this.gradientEl.setAttribute("animated",d?"true":"false")),this.renderGradientWrapper(l),this.iconEl&&(this.iconEl.replaceChildren(createDbIcon(Ss[t],"card"===t?32:"floating"===t?28:24)),this.labelEl&&this.iconEl.append(this.labelEl),this.badgeEl&&this.iconEl.append(this.badgeEl),this.labelEl&&(this.labelEl.hidden="topbar"!==t),this.badgeEl&&(this.badgeEl.hidden="floating"!==t)),this.titleEl&&(this.titleEl.textContent=s),this.subtitleEl&&(this.subtitleEl.textContent=i),this.countdownWrapEl&&this.countdownEl&&(this.countdownWrapEl.hidden=!(u&&b),u&&b&&this.countdownEl.setAttribute("end-date",b)),this.ctaEl&&(this.ctaEl.textContent=n,this.ctaEl.setAttribute("size","hero"===t?"l":"card"===t?"s":"m"),"floating"===t?this.ctaEl.setAttribute("full-width",""):this.ctaEl.removeAttribute("full-width")),this.progressEl&&(this.progressEl.hidden=!a),this.progressBarEl&&a&&(this.progressBarEl.style.width=`${this.progress}%`),this.stopAutoClose(),a&&this.startAutoClose(r)}}customElements.get("db-ad-banner")||customElements.define("db-ad-banner",DbAdBanner);const $s="designbase-wc-timeline";class DbTimeline extends HTMLElement{static get observedAttributes(){return["items","type","variant","size","color","clickable","full-width","disabled"]}connectedCallback(){this.style.display="block",this.render()}attributeChangedCallback(){this.isConnected&&this.render()}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(t){this.setAttribute("items","string"==typeof t?t:JSON.stringify(t))}getItemPosition(t){return"left"===(this.getAttribute("type")||"alternate")||t%2==0?"left":"right"}handleItemClick(t,e){this.hasAttribute("disabled")||t.disabled||!this.hasAttribute("clickable")||this.dispatchEvent(new CustomEvent("db-item-click",{bubbles:!0,composed:!0,detail:{item:t,index:e}}))}render(){const t=this.getAttribute("type")||"alternate",e=this.getAttribute("variant")||"default",s=this.getAttribute("size")||"m",i=this.getAttribute("color")||"primary",n=this.hasAttribute("clickable"),a=this.hasAttribute("disabled"),r=this.items;this.className=[$s,`${$s}--${t}`,`${$s}--${e}`,`${$s}--${s}`,n&&`${$s}--clickable`,this.hasAttribute("full-width")&&`${$s}--full-width`,a&&`${$s}--disabled`].filter(Boolean).join(" "),this.replaceChildren();const l=document.createElement("div");l.className=`${$s}__container`,r.forEach((t,o)=>{const d=this.getItemPosition(o),u=o===r.length-1,b=n&&!a&&!t.disabled,p=t.color||i,m=t.status||"pending",g=document.createElement("div");g.className=[`${$s}__item`,`${$s}__item--${d}`,`${$s}__item--${p}`,b&&`${$s}__item--clickable`,t.disabled&&`${$s}__item--disabled`].filter(Boolean).join(" ");const v=document.createElement("div");if(v.className=`${$s}__indicator-container`,"active"===m&&!t.icon&&void 0===t.number){const t=document.createElement("div");t.className=`${$s}__pulse`,v.append(t)}const E=document.createElement("div");if(E.className=[`${$s}__dot`,`${$s}__dot--${p}`,`${$s}__dot--${e}`,`${$s}__dot--${m}`,b&&`${$s}__dot--clickable`,t.icon&&`${$s}__dot--with-icon`,void 0!==t.number&&!t.icon&&`${$s}__dot--with-number`].filter(Boolean).join(" "),b&&(E.tabIndex=0,E.setAttribute("role","button"),E.setAttribute("aria-label",t.title?`${t.title} 타임라인 점`:`타임라인 점 ${o+1}`),E.addEventListener("click",()=>this.handleItemClick(t,o)),E.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleItemClick(t,o))})),t.icon&&isDbIconName(t.icon)){const e=document.createElement("div");e.className=`${$s}__icon`,e.append(createDbIcon(t.icon,"s"===s?14:"l"===s?20:16)),E.append(e)}else if(void 0!==t.number){const e=document.createElement("span");e.className=`${$s}__number`,e.textContent=String(t.number),E.append(e)}if(v.append(E),!u){const t=document.createElement("div");t.className=`${$s}__connector`,v.append(t)}const f=document.createElement("div");if(f.className=[`${$s}__content`,`${$s}__content--${d}`].join(" "),t.timestamp){const e=document.createElement("div");e.className=`${$s}__timestamp`,e.textContent=t.timestamp,f.append(e)}const w=document.createElement("div");if(w.className=`${$s}__content-inner`,b&&(w.tabIndex=0,w.setAttribute("role","button"),w.setAttribute("aria-label",t.title?`${t.title} 타임라인 아이템`:`타임라인 아이템 ${o+1}`),w.addEventListener("click",()=>this.handleItemClick(t,o)),w.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleItemClick(t,o))})),t.title){const e=document.createElement("h3");e.className=`${$s}__title`,e.textContent=t.title,w.append(e)}if(t.description){const e=document.createElement("p");e.className=`${$s}__description`,e.textContent=t.description,w.append(e)}f.append(w),g.append(v,f),l.append(g)}),this.append(l)}}customElements.get("db-timeline")||customElements.define("db-timeline",DbTimeline);const Is="designbase-wc-animation-text";class DbAnimationText extends HTMLElement{constructor(){super(...arguments),this.timers=[],this.displayText="",this.isVisible=!1,this.isAnimating=!1}static get observedAttributes(){return["text","trigger","type","speed","repeat","delay","direction","size","color","custom-color","weight","align","gradient-colors","wave-colors","glow-color","clickable","disabled"]}connectedCallback(){this.style.display="inline-block",this.ensureStructure(),this.syncFromAttributes(),this.setupTrigger()}disconnectedCallback(){this.clearTimers(),this.observer?.disconnect()}attributeChangedCallback(){this.isConnected&&(this.syncFromAttributes(),this.setupTrigger())}getText(){return this.getAttribute("text")||this.textContent?.trim()||""}getType(){const t=this.getAttribute("type")||"fade";return["typing","fade","slide","bounce","shake","glow","gradient","wave","flip","scale","decode"].includes(t)?t:"fade"}getTrigger(){const t=this.getAttribute("trigger")||"mount";return["mount","hover","click","in-view"].includes(t)?t:"mount"}ensureStructure(){this.ghostEl||(this.ghostEl=document.createElement("span"),this.ghostEl.setAttribute("aria-hidden","true"),this.ghostEl.style.visibility="hidden",this.ghostEl.style.pointerEvents="none",this.ghostEl.style.userSelect="none",this.layerEl=document.createElement("span"),this.layerEl.style.position="absolute",this.layerEl.style.top="0",this.layerEl.style.left="0",this.append(this.ghostEl,this.layerEl),this.addEventListener("mouseenter",()=>{"hover"!==this.getTrigger()||this.hasAttribute("disabled")||(this.isVisible=!0,this.startAnimation(),this.syncClasses())}),this.addEventListener("mouseleave",()=>{if("hover"!==this.getTrigger())return;this.isVisible=!1,this.isAnimating=!1,this.clearTimers();const t=this.getType();"typing"!==t&&"decode"!==t||(this.displayText=this.getText()),this.renderLayer(),this.syncClasses()}),this.addEventListener("click",()=>{if(!this.hasAttribute("disabled")){if("click"===this.getTrigger()){if(this.isVisible=!this.isVisible,this.isVisible)this.startAnimation();else{this.isAnimating=!1,this.clearTimers();const t=this.getType();"typing"!==t&&"decode"!==t||(this.displayText=this.getText()),this.renderLayer()}this.syncClasses()}this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))}}))}clearTimers(){this.timers.forEach(t=>window.clearInterval(t)),this.timers.forEach(t=>window.clearTimeout(t)),this.timers=[]}syncFromAttributes(){const t=this.getText(),e=this.getType(),s=this.getTrigger(),i=Number(this.getAttribute("speed")||1e3),n=Number(this.getAttribute("repeat")||1),a=this.getAttribute("custom-color"),r=(this.getAttribute("gradient-colors")||"#667eea,#764ba2").split(","),l=(this.getAttribute("wave-colors")||"#ff6b6b,#4ecdc4,#45b7d1,#96ceb4,#feca57").split(","),o=this.getAttribute("glow-color")||"#667eea";this.className=[Is,"typing"!==e&&`${Is}--${e}`,`${Is}--${this.getAttribute("size")||"m"}`,`${Is}--${this.getAttribute("color")||"primary"}`,`${Is}--${this.getAttribute("weight")||"normal"}`,`${Is}--${this.getAttribute("align")||"left"}`,`${Is}--${this.getAttribute("direction")||"left"}`,this.isVisible&&`${Is}--visible`,this.isAnimating&&`${Is}--animating`,(this.hasAttribute("clickable")||"click"===s)&&`${Is}--clickable`,this.hasAttribute("disabled")&&`${Is}--disabled`].filter(Boolean).join(" "),this.style.setProperty("--db-animation-speed",`${Number.isFinite(i)?i:1e3}ms`),this.style.setProperty("--db-animation-iteration-count",0===n?"infinite":String(n)),a&&this.style.setProperty("--db-text-custom",a),this.style.setProperty("--db-wave-colors",l.join(", ")),this.style.setProperty("--db-glow-color",o),"gradient"===e&&r.length>=2?(this.style.background=`linear-gradient(45deg, ${r.join(", ")})`,this.style.backgroundSize="200% 200%",this.style.webkitBackgroundClip="text",this.style.webkitTextFillColor="transparent",this.style.backgroundClip="text"):(this.style.removeProperty("background"),this.style.removeProperty("background-size"),this.style.removeProperty("-webkit-background-clip"),this.style.removeProperty("-webkit-text-fill-color"),this.style.removeProperty("background-clip")),"typing"!==e&&"decode"!==e||"mount"!==s||this.isAnimating?this.isAnimating||(this.displayText=t):this.displayText="",this.ghostEl&&(this.ghostEl.textContent=t,this.ghostEl.style.whiteSpace="typing"===e?"pre-wrap":""),this.layerEl&&(this.layerEl.className=["typing"===e&&`${Is}--typing`,this.isAnimating&&"typing"===e&&`${Is}--animating`].filter(Boolean).join(" "),this.layerEl.style.width="typing"===e?"auto":"100%",this.layerEl.style.height="100%",this.layerEl.style.whiteSpace="typing"===e?"pre-wrap":""),this.renderLayer()}syncClasses(){this.classList.toggle(`${Is}--visible`,this.isVisible),this.classList.toggle(`${Is}--animating`,this.isAnimating)}setupTrigger(){this.clearTimers(),this.observer?.disconnect();const t=this.getTrigger(),e=Number(this.getAttribute("delay")||0);if("mount"===t){const t=window.setTimeout(()=>{this.isVisible=!0,this.syncClasses(),this.startAnimation()},e);return void this.timers.push(t)}"in-view"===t&&(this.observer=new IntersectionObserver(t=>{t[0]?.isIntersecting&&(window.setTimeout(()=>{this.isVisible=!0,this.syncClasses(),this.startAnimation()},e),this.observer?.disconnect())}),this.observer.observe(this))}startAnimation(){const t=this.getType(),e=this.getText();if(this.isAnimating=!0,this.syncClasses(),this.syncFromAttributes(),"typing"===t)return void this.startTyping(0);if("decode"===t)return void this.startDecoding(0);this.displayText=e,this.renderLayer();const s=Number(this.getAttribute("speed")||1e3),i=window.setTimeout(()=>{this.isAnimating=!1,this.syncClasses(),this.syncFromAttributes()},s);this.timers.push(i)}startTyping(t){const e=this.getText(),s=Number(this.getAttribute("speed")||1e3),i=Number(this.getAttribute("repeat")||1);this.displayText="",this.renderLayer();let n=0;const a=window.setInterval(()=>{if(n>=e.length)if(window.clearInterval(a),0===i||t<i-1){const e=window.setTimeout(()=>this.startTyping(t+1),500);this.timers.push(e)}else this.isAnimating=!1,this.syncClasses();else this.displayText=e.slice(0,n+1),this.renderLayer(),n+=1},Math.max(16,s/Math.max(e.length,1)));this.timers.push(a)}startDecoding(t){const e=this.getText(),s=Number(this.getAttribute("repeat")||1),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";let n=0;const a=window.setInterval(()=>{if(this.displayText=e.split("").map((t,s)=>s<n?e[s]:i[Math.floor(74*Math.random())]||t).join(""),this.renderLayer(),n>=e.length)if(window.clearInterval(a),this.displayText=e,this.renderLayer(),0===s||t<s-1){const e=window.setTimeout(()=>this.startDecoding(t+1),500);this.timers.push(e)}else this.isAnimating=!1,this.syncClasses();n+=1/3},30);this.timers.push(a)}renderLayer(){if(!this.layerEl)return;const t=this.getType(),e=this.getText(),s=this.isVisible||this.isAnimating;"wave"!==t&&"shake"!==t||!s?this.layerEl.textContent=this.displayText||(s?e:""):this.layerEl.replaceChildren(...e.split("").map((t,e)=>{const s=document.createElement("span");return s.style.animationDelay=.05*e+"s",s.style.display="inline-block",s.textContent=" "===t?" ":t,s}))}}customElements.get("db-animation-text")||customElements.define("db-animation-text",DbAnimationText);const Ds="designbase-wc-tutorial";class DbTutorial extends HTMLElement{constructor(){super(...arguments),this.internalStep=0,this.targetElement=null,this.keyHandler=null,this.resizeHandler=null,this.isMounted=!1}static get observedAttributes(){return["open","steps","current-step","indicator-type","indicator-size"]}connectedCallback(){this.style.display="contents",this.syncStepFromAttribute(),this.syncOpenState()}disconnectedCallback(){this.detachListeners(),this.clearTargetHighlight(),this.unmount()}attributeChangedCallback(t){this.isConnected&&("open"!==t?("current-step"===t&&this.syncStepFromAttribute(),this.isMounted&&this.render()):this.syncOpenState())}get steps(){return this.parseSteps()}set steps(t){this.setAttribute("steps","string"==typeof t?t:JSON.stringify(t))}parseSteps(){try{const t=JSON.parse(this.getAttribute("steps")||"[]");return Array.isArray(t)?t:[]}catch{return[]}}syncStepFromAttribute(){if(!this.hasAttribute("current-step"))return;const t=Number(this.getAttribute("current-step")||0);Number.isFinite(t)&&(this.internalStep=Math.max(0,t))}isOpenRequested(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}getCurrentStepData(){const t=this.parseSteps();if(!t.length)return;const e=Math.min(Math.max(this.internalStep,0),t.length-1);return{step:t[e],index:e,steps:t}}syncOpenState(){if(this.isOpenRequested())return this.mount(),void this.attachListeners();this.detachListeners(),this.clearTargetHighlight(),this.unmount()}mount(){this.root||(this.root=document.createElement("div"),this.root.className=Ds,this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.tabIndex=-1,this.ensureStructure()),this.root.isConnected||document.body.append(this.root),this.isMounted=!0,this.render()}unmount(){this.isMounted=!1,this.root?.remove()}ensureStructure(){if(!this.root||this.popoverEl)return;this.overlayEl=document.createElement("div"),this.overlayEl.className=`${Ds}__overlay`,this.overlayEl.addEventListener("click",()=>this.handleEnd()),this.popoverEl=document.createElement("div"),this.popoverEl.className=`${Ds}__popover`,this.closeButtonEl=document.createElement("button"),this.closeButtonEl.type="button",this.closeButtonEl.className=`${Ds}__close-button`,this.closeButtonEl.setAttribute("aria-label","튜토리얼 종료"),this.closeButtonEl.append(createDbIcon("close",16)),this.closeButtonEl.addEventListener("click",()=>this.handleEnd());const t=document.createElement("div");t.className=`${Ds}__content`;const e=document.createElement("div");e.className=`${Ds}__text`,this.titleEl=document.createElement("h3"),this.titleEl.id="tutorial-title",this.titleEl.className=`${Ds}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.id="tutorial-content",this.descriptionEl.className=`${Ds}__description`,e.append(this.titleEl,this.descriptionEl);const s=document.createElement("div");s.className=`${Ds}__navigation`,this.prevButtonEl=document.createElement("db-button"),this.prevButtonEl.setAttribute("variant","secondary"),this.prevButtonEl.setAttribute("size","s"),this.prevButtonEl.setAttribute("start-icon","chevron-left"),this.prevButtonEl.textContent="이전",this.prevButtonEl.addEventListener("db-click",()=>this.handlePrev()),this.indicatorEl=document.createElement("db-indicator"),this.indicatorEl.addEventListener("db-step-click",t=>{const e=t.detail;"number"==typeof e.index&&this.goToStep(e.index)}),this.nextButtonEl=document.createElement("db-button"),this.nextButtonEl.setAttribute("variant","primary"),this.nextButtonEl.setAttribute("size","s"),this.nextButtonEl.addEventListener("db-click",()=>this.handleNext()),s.append(this.prevButtonEl,this.indicatorEl,this.nextButtonEl),t.append(e,s),this.popoverEl.append(this.closeButtonEl,t),this.root.append(this.overlayEl,this.popoverEl)}attachListeners(){this.keyHandler||(this.keyHandler=t=>{"Escape"===t.key?this.handleEnd():"ArrowLeft"===t.key?this.handlePrev():"ArrowRight"===t.key&&this.handleNext()},document.addEventListener("keydown",this.keyHandler)),this.resizeHandler||(this.resizeHandler=()=>this.updateTargetElement(),window.addEventListener("resize",this.resizeHandler))}detachListeners(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null)}clearTargetHighlight(){this.targetElement&&(this.targetElement.classList.remove(`${Ds}__target`),this.targetElement.style.position="",this.targetElement.style.zIndex="",this.targetElement=null)}updateTargetElement(){const t=this.getCurrentStepData();if(!t?.step.target||!this.popoverEl)return;this.clearTargetHighlight();const e=document.querySelector(t.step.target);if(!e)return;this.targetElement=e,e.style.position="relative",e.style.zIndex="1000",e.classList.add(`${Ds}__target`);const s=e.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,a=300,r=200,l=16;let o="auto"!==t.step.placement&&t.step.placement?t.step.placement:"bottom",d=s.bottom+l,u=s.left+s.width/2-150;if("auto"===t.step.placement)s.top-r-l>0?(o="top",d=s.top-r-l):s.bottom+r+l<n?(o="bottom",d=s.bottom+l):s.left-a-l>0?(o="left",d=s.top+s.height/2-100,u=s.left-a-l):(o="right",d=s.top+s.height/2-100,u=s.right+l);else switch(o){case"top":d=s.top-r-l;break;case"bottom":d=s.bottom+l;break;case"left":d=s.top+s.height/2-100,u=s.left-a-l;break;case"right":d=s.top+s.height/2-100,u=s.right+l}u=Math.max(l,Math.min(u,i-a-l)),d=Math.max(l,Math.min(d,n-r-l)),this.popoverEl.className=[`${Ds}__popover`,`${Ds}__popover--${o}`].join(" "),this.popoverEl.style.top=`${d}px`,this.popoverEl.style.left=`${u}px`}emitStepChange(t){this.dispatchEvent(new CustomEvent("db-step-change",{bubbles:!0,composed:!0,detail:{step:t}}))}goToStep(t){const e=this.parseSteps();e.length&&(this.clearTargetHighlight(),this.internalStep=Math.min(Math.max(t,0),e.length-1),this.setAttribute("current-step",String(this.internalStep)),this.emitStepChange(this.internalStep),this.render())}handlePrev(){const t=this.getCurrentStepData();!t||t.index<=0||(this.dispatchEvent(new CustomEvent("db-prev",{bubbles:!0,composed:!0})),this.goToStep(t.index-1))}handleNext(){const t=this.getCurrentStepData();t&&(t.index>=t.steps.length-1?this.handleEnd():(this.dispatchEvent(new CustomEvent("db-next",{bubbles:!0,composed:!0})),this.goToStep(t.index+1)))}handleEnd(){this.dispatchEvent(new CustomEvent("db-end",{bubbles:!0,composed:!0})),this.setAttribute("open","false")}render(){const t=this.getCurrentStepData();if(!t||!this.root)return;const{step:e,index:s,steps:i}=t,n=0===s,a=s===i.length-1;this.titleEl&&(this.titleEl.textContent=e.title||"",this.titleEl.hidden=!e.title),this.descriptionEl&&(this.descriptionEl.textContent=e.content||"",this.descriptionEl.hidden=!e.content),this.prevButtonEl&&(this.prevButtonEl.hidden=n),this.nextButtonEl&&(this.nextButtonEl.textContent=a?"완료":"다음",a?this.nextButtonEl.removeAttribute("end-icon"):this.nextButtonEl.setAttribute("end-icon","chevron-right")),this.indicatorEl&&(this.indicatorEl.setAttribute("current",String(s)),this.indicatorEl.setAttribute("total",String(i.length)),this.indicatorEl.setAttribute("type",this.getAttribute("indicator-type")||"numbers"),this.indicatorEl.setAttribute("size",this.getAttribute("indicator-size")||"m")),this.updateTargetElement()}}customElements.get("db-tutorial")||customElements.define("db-tutorial",DbTutorial);const Ls=["plasma","mesh-flow","fluid","radiant","ethereal"];function toLuminaSpeed(t){return Math.max(.1,t/3e3)}function hexToRgb(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?[parseInt(e[1],16)/255,parseInt(e[2],16)/255,parseInt(e[3],16)/255]:[0,0,0]}function padColors(t,e=5){return 0===t.length?["#7000FF","#FF00AA","#3300FF","#FFCC00","#00FFFF"]:Array.from({length:e},(e,s)=>t[s%t.length])}const Ms=["#0d0221","#5b21b6","#db2777","#38bdf8","#e9d5ff"],zs=[{id:"neon_dream",name:"Neon Dream",colors:["#7000FF","#FF00AA","#3300FF","#FFCC00","#00FFFF"]},{id:"sunset_bliss",name:"Sunset Bliss",colors:["#FF9900","#FF00CC","#6600FF","#FF5500","#220055"]},{id:"deep_ocean",name:"Deep Ocean",colors:["#001133","#0044FF","#00DDFF","#00FFAA","#000066"]},{id:"forest_mist",name:"Forest Mist",colors:["#002200","#00FF44","#AAFF00","#006622","#CCFFCC"]},{id:"northern_lights",name:"Northern Lights",colors:["#000000","#00FF99","#AA00FF","#0044FF","#FFFFFF"]},{id:"monochrome_fog",name:"Monochrome Fog",colors:["#000000","#333333","#888888","#CCCCCC","#FFFFFF"]},{id:"cotton_candy",name:"Cotton Candy",colors:["#FFC0CB","#87CEFA","#E0FFFF","#DDA0DD","#FF69B4"]},{id:"cyber_glitch",name:"Cyber Glitch",colors:["#1A1A1D","#C3073F","#6F2232","#950740","#4E4E50"]},{id:"golden_hour",name:"Golden Hour",colors:["#FF4E50","#FC913A","#F9D423","#EDE574","#E1F5C4"]}];const Ts=["#ffffff","#f0f9ff","#e0f2fe"],Bs=["#ffb7c5","#ff91a4","#f8c8dc","#ffc0cb","#fda4af"],Ps=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#4caf50","#ffeb3b","#ffc107","#ff9800"];function createFallingParticle(t,e,s,i=!1){return{x:Math.random()*t,y:i?Math.random()*e:-20,size:Math.random()*(s.maxSize-s.minSize)+s.minSize,speedX:(Math.random()-.5)*s.wind,speedY:Math.random()*(s.maxSpeedY-s.minSpeedY)+s.minSpeedY,opacity:.5*Math.random()+.3,rotation:Math.random()*Math.PI*2,rotationSpeed:.05*(Math.random()-.5),color:s.colors[Math.floor(Math.random()*s.colors.length)]}}const drawFallingParticles=(t,e,s,i,n,a)=>{const r=3e3/(a.speed||3e3),l=Math.max(1,.5*a.size),o={minSize:l,maxSize:Math.max(l+.5,1.5*a.size),minSpeedY:.4*r,maxSpeedY:1.2*r,wind:a.wind*r,colors:a.colors};i.current.length!==a.count&&(i.current=Array.from({length:a.count},()=>createFallingParticle(e,s,o,!0))),i.current.forEach(i=>{i.y+=i.speedY,i.x+=i.speedX+.5*Math.sin(i.y/50)*r,i.rotation+=i.rotationSpeed,i.y>s+20&&Object.assign(i,createFallingParticle(e,s,o)),i.x>e+20&&(i.x=-20),i.x<-20&&(i.x=e+20),t.save(),t.translate(i.x,i.y),t.rotate(i.rotation),t.fillStyle=i.color,t.globalAlpha=i.opacity*a.layerOpacity,function drawFallingParticleShape(t,e,s){return"snow"===e?(t.beginPath(),t.arc(0,0,s,0,2*Math.PI),void t.fill()):"flowers"===e?(t.beginPath(),t.moveTo(0,0),t.bezierCurveTo(s,-s,2*s,s,0,2*s),t.bezierCurveTo(2*-s,s,-s,-s,0,0),void t.fill()):void t.fillRect(-s/2,-s/2,s,s)}(t,n,i.size),t.restore()}),t.globalAlpha=1},Fs=["snow","flowers","confetti"];class CanvasAnimationController{constructor(t,e){this.options=e,this.raf=0,this.frameCount=0,this.mouse={x:-9999,y:-9999},this.particlesRef={current:[]},this.starsRef={current:[]},this.fallingRef={current:[]},this.tick=()=>{const t=this.canvas.getContext("2d");if(!t)return void(this.raf=requestAnimationFrame(this.tick));const e=window.devicePixelRatio||1,s=this.canvas.width/e,i=this.canvas.height/e,{type:n,colors:a,speed:r,particleCount:l,particleSize:o,starCount:d,starSize:u,clickable:b,wind:p,layerOpacity:m}=this.options;t.clearRect(0,0,s,i);const g=this.frameCount*(3e3/(r||3e3));switch(this.frameCount+=1,n){case"particles":((t,e,s,i,n)=>{i.current.length!==n.count&&(i.current=Array.from({length:n.count}).map(()=>({x:Math.random()*e,y:Math.random()*s,vx:1.5*(Math.random()-.5),vy:1.5*(Math.random()-.5),size:Math.random()*n.size+1,color:n.colors[Math.floor(Math.random()*n.colors.length)]})));const a=i.current;a.forEach((i,r)=>{if(i.x+=i.vx,i.y+=i.vy,(i.x<0||i.x>e)&&(i.vx*=-1),(i.y<0||i.y>s)&&(i.vy*=-1),n.clickable){const t=n.mouse.x-i.x,e=n.mouse.y-i.y,s=Math.sqrt(t*t+e*e);if(s<150){const n=(150-s)/150;i.vx+=t/s*n*.5,i.vy+=e/s*n*.5}const a=3,r=Math.sqrt(i.vx*i.vx+i.vy*i.vy);r>a&&(i.vx=i.vx/r*a,i.vy=i.vy/r*a)}t.beginPath(),t.arc(i.x,i.y,i.size,0,2*Math.PI),t.fillStyle=i.color,t.fill();for(let e=r+1;e<a.length;e++){const s=a[e],n=i.x-s.x,r=i.y-s.y,l=Math.sqrt(n*n+r*r);l<100&&(t.beginPath(),t.strokeStyle=i.color,t.globalAlpha=1-l/100,t.lineWidth=.5,t.moveTo(i.x,i.y),t.lineTo(s.x,s.y),t.stroke(),t.globalAlpha=1)}})})(t,s,i,this.particlesRef,{count:l,colors:a,size:o,mouse:this.mouse,clickable:b});break;case"stars":((t,e,s,i,n)=>{i.current.length!==n.count&&(i.current=Array.from({length:n.count}).map(()=>({x:Math.random()*e,y:Math.random()*s,size:Math.random()*n.size,blinkSpeed:.05*Math.random()+.01,color:n.colors[Math.floor(Math.random()*n.colors.length)]}))),i.current.forEach(e=>{e.y-=.05,e.y<0&&(e.y=s);const i=.5+.5*Math.sin(n.time*e.blinkSpeed);t.beginPath(),t.arc(e.x,e.y,e.size,0,2*Math.PI),t.fillStyle=e.color,t.globalAlpha=i,t.fill(),t.globalAlpha=1})})(t,s,i,this.starsRef,{count:d,colors:a,size:u,time:g});break;case"snow":case"flowers":case"confetti":(function isFallingType(t){return Fs.includes(t)})(n)&&drawFallingParticles(t,s,i,this.fallingRef,n,{count:l,colors:a,size:o,speed:r,wind:p,layerOpacity:m})}this.raf=requestAnimationFrame(this.tick)},this.container=t,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__canvas",t.appendChild(this.canvas),this.onResize=()=>this.resize(),this.onMouseMove=s=>{if("particles"!==e.type)return;const i=t.getBoundingClientRect();this.mouse={x:s.clientX-i.left,y:s.clientY-i.top}},this.onMouseLeave=()=>{this.mouse={x:-9999,y:-9999}},t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("mouseleave",this.onMouseLeave),window.addEventListener("resize",this.onResize),this.particlesRef.current=[],this.starsRef.current=[],this.fallingRef.current=[],this.frameCount=0,this.resize(),this.tick()}destroy(){cancelAnimationFrame(this.raf),this.container.removeEventListener("mousemove",this.onMouseMove),this.container.removeEventListener("mouseleave",this.onMouseLeave),window.removeEventListener("resize",this.onResize),this.canvas.remove()}resize(){const t=window.devicePixelRatio||1,e=this.container.getBoundingClientRect();this.canvas.width=e.width*t,this.canvas.height=e.height*t,this.canvas.style.width=`${e.width}px`,this.canvas.style.height=`${e.height}px`;const s=this.canvas.getContext("2d");s&&s.setTransform(t,0,0,t,0,0)}}function loadShader(t,e,s){const i=t.createShader(e);return i?(t.shaderSource(i,s),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)?i:(t.deleteShader(i),null)):null}class ShaderAnimationController{constructor(t,e){this.options=e,this.raf=0,this.startTime=performance.now(),this.render=()=>{const t=this.gl,e=this.program,s=this.positionBuffer;if(!t||!e||!s)return;const{colors:i,speed:n,blur:a,noise:r,zoom:l,variant:o}=this.options,{width:d,height:u}=this.resizeCanvas();if(0===d||0===u)return void(this.raf=requestAnimationFrame(this.render));t.viewport(0,0,d,u),t.useProgram(e);const b=t.getAttribLocation(e,"aVertexPosition"),p=t.getUniformLocation(e,"uResolution"),m=t.getUniformLocation(e,"uTime"),g=t.getUniformLocation(e,"uColors"),v=t.getUniformLocation(e,"uSpeed"),E=t.getUniformLocation(e,"uSoftness"),f=t.getUniformLocation(e,"uNoiseStrength"),w=t.getUniformLocation(e,"uZoom");t.enableVertexAttribArray(b),t.bindBuffer(t.ARRAY_BUFFER,s),t.vertexAttribPointer(b,2,t.FLOAT,!1,0,0),t.uniform2f(p,d,u);const y=padColors(i),A=toLuminaSpeed(n),_=function toLuminaSoftness(t){return Math.min(1,t/200)}(a),C=.6*A,x=function clampZoom(t){return Math.min(4,Math.max(.25,t))}(l),k=(performance.now()-this.startTime)/1e3;"mesh-flow"===o?(m&&t.uniform1f(m,k),v&&t.uniform1f(v,C),E&&t.uniform1f(E,_)):(m&&t.uniform1f(m,k*A),E&&t.uniform1f(E,_),f&&t.uniform1f(f,r),"fluid"===o&&w&&t.uniform1f(w,x));const S=new Float32Array(15);for(let t=0;t<5;t++){const e=hexToRgb(y[t]);S[3*t]=e[0],S[3*t+1]=e[1],S[3*t+2]=e[2]}g&&t.uniform3fv(g,S),t.drawArrays(t.TRIANGLE_STRIP,0,4),this.raf=requestAnimationFrame(this.render)},this.container=t,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__shader-canvas",t.appendChild(this.canvas),this.init()}resizeCanvas(){const t=this.container.getBoundingClientRect(),e=window.devicePixelRatio||1;return this.canvas.width=Math.max(1,t.width*e),this.canvas.height=Math.max(1,t.height*e),this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`,{width:this.canvas.width,height:this.canvas.height}}init(){const t=this.canvas.getContext("webgl");if(!t)return;this.gl=t;const{variant:e}=this.options,s=function getLuminaFragmentShader(t){switch(t){case"mesh-flow":return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uSpeed;\n uniform float uSoftness;\n void main() {\n vec2 uv = gl_FragCoord.xy / uResolution.xy;\n float aspect = uResolution.x / uResolution.y;\n vec2 p = uv;\n p.x *= aspect;\n float t = uTime * uSpeed * 0.1;\n vec3 col = mix(uColors[0], uColors[4], uv.y * 0.6 + 0.2);\n for(int i = 1; i < 4; i++) {\n float fi = float(i);\n float offset = fi * 4.0;\n vec2 q = p;\n q.x += sin(q.y * 1.5 + t + offset) * 0.2;\n q.y += cos(q.x * 0.8 - t + offset) * 0.1;\n float waveCenterY = 0.5 + 0.3 * sin(q.x * 1.0 + t * 0.8 + offset);\n float thickness = 0.15 + 0.15 * sin(q.x * 2.5 + t * 1.2 + offset);\n float w = thickness * (1.0 + uSoftness * 3.0);\n float dist = abs(q.y - waveCenterY);\n float blurAmount = 0.1 + uSoftness * 0.4;\n float intensity = smoothstep(w + blurAmount, w - blurAmount, dist);\n intensity *= 0.7;\n vec3 bandColor = uColors[i];\n bandColor = mix(bandColor, uColors[i+1], sin(p.x + t)*0.2 + 0.2);\n col = mix(col, bandColor, intensity);\n }\n float noise = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n col += (noise - 0.5) * 0.03;\n gl_FragColor = vec4(col, 1.0);\n }\n";case"radiant":return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uNoiseStrength;\n uniform float uSoftness;\n float random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n }\n void main() {\n vec2 uv = gl_FragCoord.xy / uResolution.xy;\n float aspect = uResolution.x / uResolution.y;\n uv.x *= aspect;\n float t = uTime * 0.15;\n vec3 col = uColors[0];\n for(int i = 1; i < 5; i++) {\n float fi = float(i);\n vec2 pos = vec2(\n 0.5 * aspect + 0.4 * sin(t * (0.5 + fi * 0.2) + fi * 1.5),\n 0.5 + 0.4 * cos(t * (0.4 + fi * 0.15) + fi)\n );\n float d = length(uv - pos);\n float radius = 0.6 + uSoftness * 1.0;\n float intensity = smoothstep(radius, 0.0, d);\n col = mix(col, uColors[i], intensity * 0.7);\n }\n float grain = random(gl_FragCoord.xy + uTime);\n col += (grain - 0.5) * uNoiseStrength;\n gl_FragColor = vec4(col, 1.0);\n }\n";case"ethereal":return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uNoiseStrength;\n uniform float uSoftness;\n float random (in vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))*43758.5453123);\n }\n float noise (in vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n vec2 u = f*f*(3.0-2.0*f);\n return mix( mix( random( i + vec2(0.0,0.0) ),\n random( i + vec2(1.0,0.0) ), u.x),\n mix( random( i + vec2(0.0,1.0) ),\n random( i + vec2(1.0,1.0) ), u.x), u.y);\n }\n #define OCTAVES 5\n float fbm (in vec2 st) {\n float value = 0.0;\n float amplitude = 0.5;\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * noise(st);\n st *= 2.0;\n amplitude *= 0.5;\n }\n return value;\n }\n void main() {\n vec2 uv = gl_FragCoord.xy/uResolution.xy;\n float aspect = uResolution.x/uResolution.y;\n uv.x *= aspect;\n float t = uTime * 0.05;\n float scale = 5.0 - uSoftness * 3.0;\n vec2 st = uv * scale;\n vec2 q = vec2(0.);\n q.x = fbm( st + 0.00*t );\n q.y = fbm( st + vec2(1.0) );\n vec2 r = vec2(0.);\n r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*t );\n r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*t );\n float f = fbm(st + r);\n vec3 color = mix(uColors[0], uColors[1], clamp((f*f)*4.0,0.0,1.0));\n color = mix(color, uColors[2], clamp(length(q),0.0,1.0));\n color = mix(color, uColors[3], clamp(length(r.x),0.0,1.0));\n color = mix(color, uColors[4], clamp(r.y*r.y, 0.0, 1.0));\n float grain = random(gl_FragCoord.xy + uTime);\n color += (grain - 0.5) * uNoiseStrength;\n gl_FragColor = vec4(color,1.0);\n }\n";default:return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uNoiseStrength;\n uniform float uSoftness;\n uniform float uZoom;\n float random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n }\n void main() {\n vec2 uv = (gl_FragCoord.xy - 0.5 * uResolution.xy) / min(uResolution.y, uResolution.x);\n float t = uTime * 0.2;\n float scale = mix(1.8, 0.45, uSoftness) / max(0.25, uZoom);\n vec2 p = uv * scale;\n for(float i = 1.0; i <= 4.0; i++){\n p.x += 0.6 / i * sin(i * 3.0 * p.y + t);\n p.y += 0.6 / i * cos(i * 3.0 * p.x + t);\n }\n float w1 = 0.5 + 0.5 * sin(p.x + t);\n float w2 = 0.5 + 0.5 * sin(p.y + t * 0.8);\n float w3 = 0.5 + 0.5 * sin(p.x + p.y);\n vec3 col = uColors[0];\n col = mix(col, uColors[1], smoothstep(0.1, 0.9, w1));\n col = mix(col, uColors[2], smoothstep(0.1, 0.9, w2));\n col = mix(col, uColors[3], smoothstep(0.1, 0.9, w3));\n float w4 = w1 * w2 * w3;\n col = mix(col, uColors[4], w4);\n float grain = random(gl_FragCoord.xy + uTime);\n col += (grain - 0.5) * uNoiseStrength;\n gl_FragColor = vec4(col, 1.0);\n }\n"}}(e),i=t.createProgram();if(!i)return;const n=loadShader(t,t.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main() {\n gl_Position = aVertexPosition;\n }\n"),a=loadShader(t,t.FRAGMENT_SHADER,s);if(!n||!a)return;if(t.attachShader(i,n),t.attachShader(i,a),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))return;this.program=i,this.vertexShader=n,this.fragmentShader=a;const r=t.createBuffer();r&&(this.positionBuffer=r,t.bindBuffer(t.ARRAY_BUFFER,r),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW),this.observer=new ResizeObserver(()=>this.resizeCanvas()),this.observer.observe(this.container),this.startTime=performance.now(),this.render())}destroy(){cancelAnimationFrame(this.raf),this.observer?.disconnect();const t=this.gl;t&&this.program&&(this.vertexShader&&t.deleteShader(this.vertexShader),this.fragmentShader&&t.deleteShader(this.fragmentShader),this.positionBuffer&&t.deleteBuffer(this.positionBuffer),t.deleteProgram(this.program)),this.canvas.remove()}}const Os="designbase-wc-animation-background";function parseColors(t,e){if(!t)return e;try{const s=JSON.parse(t);return Array.isArray(s)&&s.length?s:e}catch{return t.split(",").map(t=>t.trim()).filter(Boolean)}}function resolveColors(t){const{type:e,preset:s,colors:i}=t;if(s)return function getLuminaPresetColors(t){const e=zs.find(e=>e.id===t);return e?.colors??zs[0].colors}(s);if("fluid"===e&&i.length<5)return Ms;if("snow"===e||"flowers"===e||"confetti"===e){const t=function getFallingParticleDefaults(t){switch(t){case"snow":default:return Ts;case"flowers":return Bs;case"confetti":return Ps}}(e);return 3===i.length&&"#667eea"===i[0]&&"#764ba2"===i[1]?t:i}return i}function createLuminaOverlays(t,e){const s=document.createDocumentFragment();if(t>0){const e=document.createElement("div");e.className=`${Os}__lumina-noise`,e.style.backgroundImage="url(\"data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E\")",e.style.opacity=String(t),s.appendChild(e)}if(e){const t=document.createElement("div");t.className=`${Os}__lumina-vignette`,s.appendChild(t)}return s}function mountAnimationLayers(t,e){const s=resolveColors(e);let i={};if(e.disabled)return i;switch(e.type){case"particles":case"stars":case"snow":case"flowers":case"confetti":{const n=document.createElement("div");n.className=`${Os}__canvas-layer`,t.appendChild(n);const a=new CanvasAnimationController(n,{type:e.type,colors:s,speed:e.speed,particleCount:e.particleCount,particleSize:e.particleSize,starCount:e.starCount,starSize:e.starSize,clickable:e.clickable,wind:e.wind,layerOpacity:e.opacity});i={destroy:()=>a.destroy()};break}case"aurora":t.appendChild(function createMeshAuroraLayer(t,e,s,i,n){const a=document.createElement("div");a.className=`${Os}__aurora-mesh`;const r="subtle"===i?.3:"medium"===i?.6:.8,l=Math.max(5,e/1e3),o=t.length>=3?t:["#4f46e5","#ec4899","#06b6d4","#8b5cf6"],d="dark"===n?"screen":"multiply",u=`blur(${s}px)`,b=`${Os}__aurora-blob`,p=[{backgroundColor:o[0],top:"-10%",left:"-10%",animationDuration:`${l}s`,animationDelay:"0s"},{backgroundColor:o[1],top:"-10%",right:"-10%",animationDuration:1.2*l+"s",animationDelay:"2s"},{backgroundColor:o[2],bottom:"-20%",left:"20%",animationDuration:1.5*l+"s",animationDelay:"4s"}];o[3]&&p.push({backgroundColor:o[3],bottom:"-10%",right:"-10%",animationDuration:1.1*l+"s",animationDelay:"1s"}),p.forEach(t=>{const e=document.createElement("div");e.className=b,Object.assign(e.style,{filter:u,opacity:String(r),mixBlendMode:d,...t}),a.appendChild(e)});const m=document.createElement("div");return m.className=`${Os}__aurora-noise`,m.style.opacity="dark"===n?"0.03":"0.05",m.style.backgroundImage="url(\"data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E\")",a.appendChild(m),a}(s,e.speed,e.blur,e.intensity,e.theme));break;case"plasma":t.appendChild(function createPlasmaLayer(t,e,s){const i=document.createElement("div");i.className=`${Os}__plasma`;const n=Math.random().toString(36).slice(2,11),a=padColors(t),c=t=>a[t%a.length],r=60/toLuminaSpeed(e),l=document.createElement("style");l.textContent=`\n @keyframes designbase-wc-plasma-move-1-${n} {\n 0% { transform: translate(0, 0) rotate(0deg) scale(1); }\n 25% { transform: translate(10%, 10%) rotate(90deg) scale(1.2); }\n 50% { transform: translate(0, 20%) rotate(180deg) scale(1); }\n 75% { transform: translate(-10%, 10%) rotate(270deg) scale(0.9); }\n 100% { transform: translate(0, 0) rotate(360deg) scale(1); }\n }\n @keyframes designbase-wc-plasma-move-2-${n} {\n 0% { transform: translate(0, 0) rotate(0deg) scale(1.2); }\n 33% { transform: translate(-20%, 0) rotate(120deg) scale(1); }\n 66% { transform: translate(20%, -10%) rotate(240deg) scale(0.8); }\n 100% { transform: translate(0, 0) rotate(360deg) scale(1.2); }\n }\n @keyframes designbase-wc-plasma-move-3-${n} {\n 0% { transform: translate(0, 0) scale(0.8); }\n 50% { transform: translate(15%, -15%) scale(1.4); }\n 100% { transform: translate(0, 0) scale(0.8); }\n }\n @keyframes designbase-wc-plasma-rotate-${n} {\n 0% { transform: rotate(0deg) scale(1.5); }\n 50% { transform: rotate(180deg) scale(2.0); }\n 100% { transform: rotate(360deg) scale(1.5); }\n }`,i.appendChild(l);const o=document.createElement("div");return o.className=`${Os}__plasma-base`,o.style.backgroundColor=c(0),i.appendChild(o),[{top:"-10%",left:"-10%",width:"70%",height:"70%",background:`radial-gradient(circle, ${c(1)} 0%, transparent 70%)`,animation:`designbase-wc-plasma-move-1-${n} ${r}s infinite linear`},{bottom:"-20%",right:"-10%",width:"80%",height:"80%",background:`radial-gradient(circle, ${c(2)} 0%, transparent 70%)`,animation:`designbase-wc-plasma-move-2-${n} ${r}s infinite linear`},{top:"20%",left:"20%",width:"60%",height:"60%",background:`radial-gradient(circle, ${c(3)} 0%, transparent 70%)`,animation:`designbase-wc-plasma-rotate-${n} ${r}s infinite linear`,extraClass:`${Os}__plasma-blob--exclusion`},{top:"40%",right:"20%",width:"40%",height:"40%",background:c(4),animation:`designbase-wc-plasma-move-3-${n} ${r}s infinite ease-in-out`,extraClass:`${Os}__plasma-blob--accent`,filter:`blur(${s}px)`,opacity:"0.6"}].forEach(t=>{const e=document.createElement("div");e.className=`${Os}__plasma-blob${t.extraClass?` ${t.extraClass}`:""}`,Object.assign(e.style,{filter:t.filter||`blur(${s}px)`,opacity:t.opacity||"0.9",...t}),i.appendChild(e)}),i}(s,e.speed,e.blur)),t.appendChild(createLuminaOverlays(e.noise,e.showVignette));break;case"mesh-flow":case"fluid":case"radiant":case"ethereal":{const n=document.createElement("div");n.className=`${Os}__shader-layer`,t.appendChild(n);const a=new ShaderAnimationController(n,{variant:e.type,colors:s,speed:e.speed,blur:e.blur,noise:e.noise,zoom:e.zoom});t.appendChild(createLuminaOverlays(e.noise,e.showVignette)),i={destroy:()=>a.destroy()};break}case"gradient":t.appendChild(function createGradientLayer(t,e,s){const i=document.createDocumentFragment(),n=document.createElement("style");n.textContent="@keyframes designbase-wc-gradient-move {\n 0% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n 100% { background-position: 0% 50%; }\n }",i.appendChild(n);const a=document.createElement("div");a.className=`${Os}__css-layer`;const r=(e.length>0?e:["#ccc"]).join(", ");let l="90deg",o="";switch(t){case"up":l="0deg";break;case"down":l="180deg";break;case"left":l="270deg";break;case"right":l="90deg";break;case"diagonal":l="45deg";break;case"radial":o=`radial-gradient(circle, ${r})`}o||(o=`linear-gradient(${l}, ${r})`);const d=`${Math.max(2,s/1e3)}s`;return a.style.backgroundImage=o,a.style.backgroundSize="200% 200%",a.style.animation=`designbase-wc-gradient-move ${d} ease infinite`,i.appendChild(a),i}(e.direction,s,e.speed))}return i}function applyContainerStyles(t,e){const s=function isLuminaType(t){return Ls.includes(t)}(e.type)?"#000000":"dark"===e.theme?"var(--db-surface-base, #0f172a)":"var(--db-surface-base, #ffffff)";t.style.position="relative",t.style.overflow="hidden","gradient"!==e.type?t.style.backgroundColor=s:t.style.backgroundColor=""}function getEffectiveGridColor(t){return t.gridColor??("dark"===t.theme?"#ffffff":"#000000")}const Hs=Os;class DbAnimationBackground extends HTMLElement{static get observedAttributes(){return["type","theme","intensity","blur","speed","direction","colors","width","height","border-radius","opacity","blend-mode","particle-count","particle-size","star-count","star-size","wind","clickable","disabled","show-grid","grid-size","grid-color","grid-opacity","noise","show-vignette","preset","zoom"]}connectedCallback(){this.style.display="block",this.render()}disconnectedCallback(){this.teardownLayers(),this.clickHandler&&(this.removeEventListener("click",this.clickHandler),this.clickHandler=void 0)}attributeChangedCallback(){this.isConnected&&this.render()}teardownLayers(){this.layerHandle?.destroy?.(),this.layerHandle=void 0,this.layersEl&&this.layersEl.replaceChildren()}getSizeStyle(t){if(!t)return;const e=Number(t);return Number.isFinite(e)?`${e}px`:t}render(){const t=function parseAnimationBackgroundConfig(t){return{type:t.getAttribute("type")||"gradient",theme:"light"===t.getAttribute("theme")?"light":"dark",intensity:t.getAttribute("intensity")||"subtle",blur:Number(t.getAttribute("blur")||80),speed:Number(t.getAttribute("speed")||3e3),direction:t.getAttribute("direction")||"left",colors:parseColors(t.getAttribute("colors"),["#667eea","#764ba2","#f093fb"]),opacity:Number(t.getAttribute("opacity")||1),particleCount:Number(t.getAttribute("particle-count")||50),particleSize:Number(t.getAttribute("particle-size")||2),starCount:Number(t.getAttribute("star-count")||100),starSize:Number(t.getAttribute("star-size")||1.5),clickable:t.hasAttribute("clickable")&&"false"!==t.getAttribute("clickable"),wind:Number(t.getAttribute("wind")||.5),showGrid:t.hasAttribute("show-grid")&&"false"!==t.getAttribute("show-grid"),gridSize:Number(t.getAttribute("grid-size")||40),gridColor:t.getAttribute("grid-color")||void 0,gridOpacity:Number(t.getAttribute("grid-opacity")||.1),noise:Number(t.getAttribute("noise")||.05),showVignette:!t.hasAttribute("show-vignette")||"false"!==t.getAttribute("show-vignette"),preset:t.getAttribute("preset")||void 0,zoom:Number(t.getAttribute("zoom")||1),disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")}}(this);this.className=[Hs,`${Hs}--${t.type}`,t.clickable&&!t.disabled&&`${Hs}--clickable`,t.disabled&&`${Hs}--disabled`].filter(Boolean).join(" "),applyContainerStyles(this,t);const e=this.getSizeStyle(this.getAttribute("width")),s=this.getSizeStyle(this.getAttribute("height")),i=this.getSizeStyle(this.getAttribute("border-radius"));e&&(this.style.width=e),s&&(this.style.height=s),i&&(this.style.borderRadius=i),this.style.opacity=String(t.opacity);const n=this.getAttribute("blend-mode");if(n&&(this.style.mixBlendMode=n),!this.layersEl){this.layersEl=document.createElement("div"),this.layersEl.className=`${Hs}__layers`,Object.assign(this.layersEl.style,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"0"}),this.contentEl=document.createElement("div"),this.contentEl.className=`${Hs}__content`,Object.assign(this.contentEl.style,{position:"relative",zIndex:"10",width:"100%",height:"100%"});const t=document.createElement("slot");this.contentEl.appendChild(t),this.append(this.layersEl,this.contentEl)}this.teardownLayers();const a=this.querySelector(`.${Hs}__grid-overlay`);if(a?.remove(),this.layerHandle=mountAnimationLayers(this.layersEl,t),t.showGrid&&!t.disabled){const e=document.createElement("div");e.className=`${Hs}__grid-overlay`,Object.assign(e.style,{position:"absolute",inset:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1",backgroundImage:`linear-gradient(to right, ${getEffectiveGridColor(t)} 1px, transparent 1px), linear-gradient(to bottom, ${getEffectiveGridColor(t)} 1px, transparent 1px)`,backgroundSize:`${t.gridSize}px ${t.gridSize}px`,opacity:String(t.gridOpacity),maskImage:"linear-gradient(to bottom, black 0%, black 92%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, black 92%, transparent 100%)"}),this.insertBefore(e,this.contentEl??null)}this.clickHandler&&(this.removeEventListener("click",this.clickHandler),this.clickHandler=void 0),t.clickable&&!t.disabled&&(this.clickHandler=()=>{this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.addEventListener("click",this.clickHandler))}}customElements.get("db-animation-background")||customElements.define("db-animation-background",DbAnimationBackground);const Vs="designbase-wc-cursor-follower",Rs="designbase-wc-cursor-follower--hide-native";class DbCursorFollower extends HTMLElement{constructor(){super(...arguments),this.target={x:-9999,y:-9999},this.current={x:-9999,y:-9999},this.raf=0,this.enabled=!1,this.isScoped=!1}static get observedAttributes(){return["default-label","selector","smoothness","offset","hide-native-cursor","show-icon"]}connectedCallback(){this.style.display="contents",this.setupDesktopGate()}disconnectedCallback(){this.teardown()}attributeChangedCallback(){this.isConnected&&this.enabled&&this.mountLayer()}setupDesktopGate(){"undefined"!=typeof window&&(this.desktopMq=window.matchMedia("(pointer: fine) and (hover: hover) and (min-width: 769px)"),this.onDesktopChange=()=>{const t=this.desktopMq?.matches??!1;t!==this.enabled&&(this.enabled=t,t?(this.ensureScope(),this.mountLayer()):this.teardownLayer())},this.onDesktopChange(),this.desktopMq.addEventListener("change",this.onDesktopChange))}ensureScope(){if(this.scopeEl)return;if(this.childElementCount>0||this.textContent?.trim()){this.isScoped=!0,this.scopeEl=document.createElement("div"),this.scopeEl.className="designbase-wc-cursor-follower-scope";const t=document.createElement("slot");this.scopeEl.appendChild(t),this.appendChild(this.scopeEl)}}isInScope(t){return!!t&&(!this.isScoped||!this.scopeEl||this.scopeEl.contains(t))}mountLayer(){this.teardownLayer(),this.ensureScope();const t=this.getAttribute("default-label")||"See the project",e=this.getAttribute("selector")||'a[href], button:not(:disabled), [role="button"]:not([aria-disabled="true"]), [data-cursor], [data-cursor-label], input[type="submit"], input[type="button"]',s=Math.min(1,Math.max(.05,Number(this.getAttribute("smoothness")||.14))),i=function parseOffset(t){if(!t)return{x:18,y:18};try{const e=JSON.parse(t);return{x:Number(e.x??18),y:Number(e.y??18)}}catch{const[e,s]=t.split(",").map(t=>Number(t.trim()));return{x:Number.isFinite(e)?e:18,y:Number.isFinite(s)?s:18}}}(this.getAttribute("offset")),n=this.hasAttribute("hide-native-cursor")&&"false"!==this.getAttribute("hide-native-cursor"),a=!this.hasAttribute("show-icon")||"false"!==this.getAttribute("show-icon");n&&document.documentElement.classList.add(Rs),this.portalRoot=document.createElement("div"),this.portalRoot.className=Vs,this.portalRoot.setAttribute("aria-hidden","true"),this.pillEl=document.createElement("div"),this.pillEl.className=`${Vs}__pill`,this.labelEl=document.createElement("span"),this.labelEl.textContent=t,this.pillEl.appendChild(this.labelEl),a&&(this.iconEl=document.createElement("span"),this.iconEl.className=`${Vs}__icon`,this.iconEl.appendChild(createDbIcon("arrow-right",14)),this.pillEl.appendChild(this.iconEl)),this.portalRoot.appendChild(this.pillEl),document.body.appendChild(this.portalRoot),this.onMouseMove=s=>{this.target={x:s.clientX+i.x,y:s.clientY+i.y};const n=document.elementFromPoint(s.clientX,s.clientY),a=n?.closest(e)??null;this.isInScope(a)&&a?(this.labelEl&&(this.labelEl.textContent=function getLabelFromElement(t,e){return t.getAttribute("data-cursor-label")||t.getAttribute("data-cursor")||t.getAttribute("aria-label")||e}(a,t)),this.pillEl?.classList.add(`${Vs}__pill--visible`)):this.pillEl?.classList.remove(`${Vs}__pill--visible`)},window.addEventListener("mousemove",this.onMouseMove,{passive:!0});const tick=()=>{this.current.x+=(this.target.x-this.current.x)*s,this.current.y+=(this.target.y-this.current.y)*s,this.portalRoot&&(this.portalRoot.style.transform=`translate3d(${this.current.x}px, ${this.current.y}px, 0)`),this.raf=requestAnimationFrame(tick)};this.raf=requestAnimationFrame(tick)}teardownLayer(){cancelAnimationFrame(this.raf),this.onMouseMove&&(window.removeEventListener("mousemove",this.onMouseMove),this.onMouseMove=void 0),document.documentElement.classList.remove(Rs),this.portalRoot?.remove(),this.portalRoot=void 0,this.pillEl=void 0,this.labelEl=void 0,this.iconEl=void 0}teardown(){this.teardownLayer(),this.desktopMq&&this.onDesktopChange&&this.desktopMq.removeEventListener("change",this.onDesktopChange),this.scopeEl?.remove(),this.scopeEl=void 0,this.isScoped=!1,this.enabled=!1}}customElements.get("db-cursor-follower")||customElements.define("db-cursor-follower",DbCursorFollower);const qs="designbase-wc-lottie";class DbLottie extends HTMLElement{constructor(){super(...arguments),this.loadToken=0}static get observedAttributes(){return["src","animation-data","loop","autoplay","speed","width","height","renderer"]}connectedCallback(){this.style.display="inline-block",this.renderAnimation()}disconnectedCallback(){this.destroyAnimation(),this.container?.remove(),this.container=void 0}attributeChangedCallback(){this.isConnected&&this.renderAnimation()}getBool(t,e=!1){if(!this.hasAttribute(t))return e;const s=this.getAttribute(t);return""===s||"true"===s}getSizeStyle(t){if(!t)return;const e=Number(t);return Number.isFinite(e)?`${e}px`:t}destroyAnimation(){this.animation?.destroy(),this.animation=void 0}async renderAnimation(){const t=++this.loadToken;this.destroyAnimation(),this.container?this.container.replaceChildren():(this.container=document.createElement("div"),this.container.className=`${qs}__container`,this.appendChild(this.container));const e=this.getSizeStyle(this.getAttribute("width")),s=this.getSizeStyle(this.getAttribute("height"));if(e&&(this.style.width=e),s&&(this.style.height=s),t!==this.loadToken||!this.container)return;const i=this.getBool("loop",!0),n=!this.hasAttribute("autoplay")||this.getBool("autoplay",!0),a=Number(this.getAttribute("speed")||1),r=this.getAttribute("renderer")||"svg";let l;const o=this.getAttribute("animation-data");if(o)try{l=JSON.parse(o)}catch{l=void 0}const d=this.getAttribute("src");if(!l&&!d){const t=document.createElement("div");return t.className=`${qs}__fallback`,t.textContent="src 또는 animation-data 속성이 필요합니다.",void this.container.appendChild(t)}const u=await import("./chunks/lottie-e741cdda.js").then(function(t){return t.l}),b=u.default??u;t===this.loadToken&&this.container&&(this.animation=b.loadAnimation({container:this.container,renderer:r,loop:i,autoplay:n,...l?{animationData:l}:{path:d}}),Number.isFinite(a)&&a>0&&this.animation.setSpeed(a))}}customElements.get("db-lottie")||customElements.define("db-lottie",DbLottie);const js="designbase-wc-toast-container",Ws="top-right";let Us=0;function isBrowser$1(){return"undefined"!=typeof document}function showToast(t){const e=`db-toast-${Us+=1}`;if(!isBrowser$1())return{id:e,element:null,close:()=>{}};const{title:s,description:i,status:n="info",duration:a=5e3,position:r=Ws,showClose:l=!0,showProgress:o=!1}=t,d=function getContainer(t){const e=document.querySelector(`.${js}[data-position="${t}"]`);if(e)return e;const s=document.createElement("div");return s.className=`${js} ${js}--${t}`,s.dataset.position=t,s.setAttribute("role","region"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-label","알림"),document.body.appendChild(s),s}(r),u=document.createElement("db-toast");return u.setAttribute("toast-id",e),u.setAttribute("status",n),u.setAttribute("title",s),i&&u.setAttribute("description",i),u.setAttribute("duration",String(a)),u.setAttribute("show-close",String(l)),o&&u.setAttribute("show-progress",""),u.setAttribute("auto-remove","true"),r.startsWith("bottom")?d.insertBefore(u,d.firstChild):d.appendChild(u),u.addEventListener("db-close",()=>window.requestAnimationFrame(()=>function cleanupContainer(t){0===t.childElementCount&&t.remove()}(d)),{once:!0}),{id:e,element:u,close:()=>u.close()}}function shortcut(t){return(e,s)=>showToast({...s,title:e,status:t})}const toast=t=>showToast(t);function confirm(t){if(!function isBrowser(){return"undefined"!=typeof document}())return Promise.resolve(!1);const{message:e,title:s,confirmText:i,cancelText:n,confirmVariant:a,variant:r,size:l,showIcon:o,initialFocus:d,closeOnEscape:u,closeOnBackdrop:b}=t,p=document.createElement("db-confirm");return p.setAttribute("message",e),s&&p.setAttribute("title",s),i&&p.setAttribute("confirm-text",i),n&&p.setAttribute("cancel-text",n),a&&p.setAttribute("confirm-variant",a),r&&p.setAttribute("variant",r),l&&p.setAttribute("size",l),!1===o&&p.setAttribute("show-icon","false"),d&&p.setAttribute("initial-focus",d),!1===u&&p.setAttribute("close-on-escape","false"),!1===b&&p.setAttribute("close-on-backdrop","false"),document.body.appendChild(p),new Promise(t=>{let e=!1;const finish=s=>{e||(e=!0,p.removeEventListener("db-confirm",onConfirm),p.removeEventListener("db-cancel",onCancel),p.remove(),t(s))},onConfirm=()=>finish(!0),onCancel=()=>finish(!1);p.addEventListener("db-confirm",onConfirm),p.addEventListener("db-cancel",onCancel),p.setAttribute("open","true")})}toast.show=showToast,toast.success=shortcut("success"),toast.error=shortcut("error"),toast.warning=shortcut("warning"),toast.info=shortcut("info"),toast.dismissAll=t=>{if(!isBrowser$1())return;const e=t?`.${js}[data-position="${t}"] db-toast`:`.${js} db-toast`;document.querySelectorAll(e).forEach(t=>t.close())};export{DbAccordion,DbAdBanner,DbAlert,DbAnimationBackground,DbAnimationText,DbAppBadge,DbAudioPlayer,DbAvatar,DbBackdrop,DbBadge,DbBanner,DbBottomNavigation,DbBottomSheet,DbBreadcrumbs,DbButton,DbCalendar,DbCard,DbCarousel,DbCheckbox,DbChip,DbCodeBlock,DbColorPicker,DbConfirm,DbContainer,DbContextMenu,DbCountdown,DbCursorFollower,DbDatePicker,DbDivider,DbDrawer,DbDropdown,DbDropzone,DbEmptyState,DbFileUploader,DbFloatingActionButton,DbForm,DbGradient,DbGrid,DbGridItem,DbImage,DbImageList,DbImagePlaceholder,DbIndicator,DbInput,DbLabel,DbLightbox,DbList,DbLogo,DbLottie,DbMarkdownEditor,DbMarquee,DbMasonry,DbMenuItem,DbModal,DbNavbar,DbOnboardingModal,DbPageHeader,DbPagination,DbPopover,DbProgress,DbProgressStep,DbProgressbar,DbRadio,DbRandomGradient,DbRangeSlider,DbRating,DbReorder,DbResizablePanels,DbScrollArea,DbSearchBar,DbSection,DbSectionAppDownload,DbSectionContact,DbSectionFeature,DbSectionHero,DbSegmentControl,DbSelect,DbShare,DbSidebar,DbSkeleton,DbSpinner,DbSplitView,DbStack,DbStat,DbStepper,DbTable,DbTabs,DbTestimonial,DbTextarea,DbTimePicker,DbTimeline,DbToast,DbToggle,DbToolbar,DbTooltip,DbTopBanner,DbTutorial,DbVideoPlayer,DbYouTubePlayer,confirm,confirm as dbConfirm,toast as dbToast,showToast,toast};
|
|
1
|
+
import{c as e,g as t}from"./chunks/lottie-3b3dac01.js";function _mergeNamespaces(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(s){if("default"!==s&&!(s in e)){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}})}),Object.freeze(e)}const s={"arrow-bar-left":'<path fill="currentColor" d="M20.75 20h-1.5V4h1.5zM11.03 6.53l-4.72 4.72H16v1.5H6.31l4.72 4.72-1.06 1.06L3.44 12l6.53-6.53z"/>',"arrow-bar-right":'<path fill="currentColor" d="M4.75 20h-1.5V4h1.5zm15.81-8-6.53 6.53-1.06-1.06 4.72-4.72H8v-1.5h9.69l-4.72-4.72 1.06-1.06z"/>',award:'<path fill="currentColor" d="M11.753 15.5c-1.8 0-3.5-.7-4.77-1.98a6.74 6.74 0 0 1-1.98-4.77c0-1.8.7-3.5 1.98-4.77A6.74 6.74 0 0 1 11.753 2c1.8 0 3.5.7 4.77 1.98a6.74 6.74 0 0 1 1.98 4.77c0 1.8-.7 3.5-1.98 4.77a6.74 6.74 0 0 1-4.77 1.98m0-12c-1.4 0-2.72.55-3.71 1.54a5.22 5.22 0 0 0-1.54 3.71c0 1.4.55 2.72 1.54 3.71a5.22 5.22 0 0 0 3.71 1.54c1.4 0 2.72-.55 3.71-1.54a5.22 5.22 0 0 0 1.54-3.71c0-1.4-.55-2.72-1.54-3.71a5.22 5.22 0 0 0-3.71-1.54"/><path fill="currentColor" d="M15.313 21.5a.74.74 0 0 1-.64-.37l-3.56-5.96a.751.751 0 1 1 1.29-.77l2.86 4.8 1.06-2.07a.76.76 0 0 1 .72-.41l2.33.17-2.95-4.99a.76.76 0 0 1 .26-1.03c.36-.21.82-.09 1.03.26l3.68 6.22c.14.24.14.54 0 .78s-.4.37-.69.35l-3.27-.23-1.45 2.83c-.12.24-.37.4-.64.41h-.02z"/><path fill="currentColor" d="M8.193 21.5h-.02c-.27 0-.52-.17-.64-.41l-1.45-2.83-3.28.23a.75.75 0 0 1-.69-.35.73.73 0 0 1 0-.78l3.69-6.18c.21-.36.67-.47 1.03-.26s.47.67.26 1.03l-2.95 4.95 2.34-.17c.31-.01.58.14.72.41l1.06 2.07 2.86-4.8c.21-.36.67-.47 1.03-.26s.47.67.26 1.03l-3.56 5.96c-.14.23-.38.37-.64.37z"/>',apple:'<path fill="currentColor" fill-rule="evenodd" d="M18.644 18.648q-.807 1.15-1.316 1.592-.787.723-1.692.744-.649.001-1.562-.373-.914-.372-1.683-.371-.805-.001-1.73.371-.924.375-1.495.393-.866.038-1.729-.764-.55-.48-1.377-1.648-.885-1.245-1.455-2.891-.61-1.78-.611-3.447 0-1.91.826-3.292a4.86 4.86 0 0 1 1.73-1.751 4.65 4.65 0 0 1 2.34-.662q.69.001 1.81.422t1.436.422q.237 0 1.593-.498 1.279-.46 2.163-.384 2.4.192 3.6 1.895-2.145 1.301-2.123 3.637.02 1.82 1.317 3.023a4.3 4.3 0 0 0 1.315.863q-.159.46-.336.882a10.3 10.3 0 0 1-1.021 1.837M14.959 5.039c-.836.976-1.846 1.541-2.941 1.452a3 3 0 0 1-.021-.36c0-.913.396-1.889 1.103-2.688q.528-.607 1.343-1.009.813-.397 1.536-.435.02.192.019.381-.001 1.426-1.039 2.659" clip-rule="evenodd"/>',"play-store":'<path fill="currentColor" fill-rule="evenodd" d="M15.911 8.659 6.36 3.29c-.633-.342-1.226-.39-1.746-.016l8.34 8.34zm3.578 4.69c.6-.336.929-.812.929-1.34 0-.527-.329-1.004-.928-1.34l-2.783-1.563-3.133 3.132 2.841 2.84zM4 4.659v14.706c0 .38.084.709.236.97l8.097-8.098L4.1 4.002c-.064.197-.1.417-.1.658m.902 16.25q.232.09.495.09.47 0 .968-.275l9.255-5.197-2.666-2.67z" clip-rule="evenodd"/>',"arrow-right":'<path fill="currentColor" d="m20.06 12-7.53 7.53-1.06-1.06 5.72-5.72H4v-1.5h13.19l-5.72-5.72 1.06-1.06z"/>',star:'<path fill="currentColor" fill-rule="evenodd" d="M12 1.25a.75.75 0 0 1 .673.419l2.926 5.945 6.509.944a.75.75 0 0 1 .417 1.278l-4.718 4.624 1.132 6.511a.75.75 0 0 1-1.083.796L12 18.744l-5.856 3.023a.75.75 0 0 1-1.083-.796l1.133-6.511-4.719-4.624a.75.75 0 0 1 .417-1.278l6.51-.944 2.925-5.945A.75.75 0 0 1 12 1.25m0 2.449L9.573 8.63a.75.75 0 0 1-.565.411l-5.4.783 3.917 3.84a.75.75 0 0 1 .214.664l-.941 5.412 4.858-2.508a.75.75 0 0 1 .688 0l4.858 2.508-.94-5.412a.75.75 0 0 1 .213-.665l3.918-3.84-5.4-.782a.75.75 0 0 1-.566-.41z" clip-rule="evenodd"/>',"star-filled":'<path fill="currentColor" d="M23 9c-.1-.4-.4-.6-.8-.7l-6.4-.9-2.9-5.8c-.3-.7-1.5-.7-1.8 0L8.2 7.4l-6.4.9c-.4 0-.7.3-.8.7s0 .8.3 1l4.6 4.5-1.1 6.4c0 .4 0 .8.4 1 .3.2.7.3 1.1 0l5.7-3 5.7 3c.1 0 .3.1.5.1s.4 0 .6-.2c.3-.2.5-.6.4-1l-1.1-6.4 4.6-4.5c.3-.3.4-.7.3-1z"/>',"star-half":'<path fill="currentColor" d="M8.9 8.3 2 9.3l5 4.8L5.8 21l6.2-3.2V2z"/><path fill="currentColor" fill-rule="evenodd" d="M12 1.25a.75.75 0 0 1 .673.419l2.926 5.945 6.509.944a.75.75 0 0 1 .417 1.278l-4.718 4.624 1.132 6.511a.75.75 0 0 1-1.083.796L12 18.744l-5.856 3.023a.75.75 0 0 1-1.083-.796l1.133-6.511-4.719-4.624a.75.75 0 0 1 .417-1.278l6.51-.944 2.925-5.945A.75.75 0 0 1 12 1.25m0 2.449L9.573 8.63a.75.75 0 0 1-.565.411l-5.4.783 3.917 3.84a.75.75 0 0 1 .214.664l-.941 5.412 4.858-2.508a.75.75 0 0 1 .688 0l4.858 2.508-.94-5.412a.75.75 0 0 1 .213-.665l3.918-3.84-5.4-.782a.75.75 0 0 1-.566-.41z" clip-rule="evenodd"/>',"trending-up":'<path fill="currentColor" d="M22 11V5h-6"/><path fill="currentColor" fill-rule="evenodd" d="M21.53 6.53 13 15.06l-3-3-6.47 6.47-1.06-1.06L10 9.94l3 3 7.47-7.47z" clip-rule="evenodd"/>',cart:'<path fill="currentColor" d="M3 2.25c.945 0 1.714.75 1.747 1.688L4.94 6.25h16.899l-1.167 10.5h-2.093a2.75 2.75 0 1 1-3.156 0H9.578a2.75 2.75 0 1 1-3.156 0H4.31L3.253 4.063 3.25 4.03V4A.25.25 0 0 0 3 3.75H1v-1.5zm5 15.5a1.25 1.25 0 1 0-.001 2.499A1.25 1.25 0 0 0 8 17.75m9 0a1.25 1.25 0 1 0-.001 2.499A1.25 1.25 0 0 0 17 17.75m-11.31-2.5h13.64l.832-7.5H5.064z"/>',"bell-active":'<path fill="currentColor" fill-rule="evenodd" d="M6.75 10.015V13c0 1.445-.466 2.453-1.06 3.25h12.62c-.594-.797-1.06-1.805-1.06-3.25v-2.985c-.047-1.117-.55-2.449-1.465-3.497C14.879 5.479 13.6 4.75 12 4.75s-2.879.73-3.785 1.768c-.914 1.048-1.418 2.38-1.465 3.497m.335-4.483C8.229 4.221 9.9 3.25 12 3.25s3.771.97 4.915 2.282c1.132 1.298 1.777 2.96 1.834 4.44l.001.028v3c0 1.67.788 2.477 1.78 3.47a.75.75 0 0 1-.53 1.28H4a.75.75 0 0 1-.53-1.28c.992-.992 1.78-1.8 1.78-3.47V9.971c.057-1.48.703-3.141 1.835-4.439" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M9 16.25a.75.75 0 0 1 .75.75v1c0 1.286.964 2.25 2.25 2.25s2.25-.964 2.25-2.25v-1a.75.75 0 0 1 1.5 0v1c0 2.114-1.636 3.75-3.75 3.75S8.25 20.114 8.25 18v-1a.75.75 0 0 1 .75-.75M17.424 2.52a.75.75 0 0 1 1.056-.096c1.307 1.089 2.463 2.786 3.19 4.24a.75.75 0 1 1-1.34.671c-.673-1.345-1.717-2.848-2.81-3.759a.75.75 0 0 1-.096-1.056M6.576 2.52a.75.75 0 0 1-.096 1.056c-1.093.911-2.137 2.414-2.81 3.76a.75.75 0 0 1-1.34-.671c.727-1.455 1.883-3.152 3.19-4.241a.75.75 0 0 1 1.056.096M12 1.25a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0V2a.75.75 0 0 1 .75-.75" clip-rule="evenodd"/>',"caret-down-filled":'<path fill="currentColor" d="m12 14.5 5-5H7z"/>',"caret-updown-filled":'<path fill="currentColor" fill-rule="evenodd" d="m7 10 5-5 5 5zM17 14l-5 5-5-5z" clip-rule="evenodd"/>',"chevron-down":'<path fill="currentColor" fill-rule="evenodd" d="m5.47 9.53 1.06-1.06L12 13.94l5.47-5.47 1.06 1.06L12 16.06z" clip-rule="evenodd"/>',"chevron-up":'<path fill="currentColor" fill-rule="evenodd" d="m12 7.94 6.53 6.53-1.06 1.06L12 10.06l-5.47 5.47-1.06-1.06z" clip-rule="evenodd"/>',"chevron-left":'<path fill="currentColor" fill-rule="evenodd" d="m10.06 12 5.47-5.47-1.06-1.06L7.94 12l6.53 6.53 1.06-1.06z" clip-rule="evenodd"/>',"chevron-right":'<path fill="currentColor" fill-rule="evenodd" d="M9.53 5.47 16.06 12l-6.53 6.53-1.06-1.06L13.94 12 8.47 6.53z" clip-rule="evenodd"/>',calendar:'<path fill="currentColor" fill-rule="evenodd" d="M16.25 8V2h1.5v6zM6.25 8V2h1.5v6zM21 11.75H3v-1.5h18z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 5.75a.25.25 0 0 0-.25.25v14c0 .138.112.25.25.25h16a.25.25 0 0 0 .25-.25V6a.25.25 0 0 0-.25-.25zM2.25 6c0-.966.784-1.75 1.75-1.75h16c.966 0 1.75.784 1.75 1.75v14A1.75 1.75 0 0 1 20 21.75H4A1.75 1.75 0 0 1 2.25 20z" clip-rule="evenodd"/>',clock:'<path fill="currentColor" fill-rule="evenodd" d="M12.75 11.25V6h-1.5v6.75H16v-1.5z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12" clip-rule="evenodd"/>',bulb:'<path fill="currentColor" d="M15.5 17.5H8v-.75s-.02-1.79-1.06-3.21l-.29-.39C5.88 12.12 5 10.95 5 8.93 5 5.11 8.03 2 11.75 2s6.75 3.11 6.75 6.93c0 2-.87 3.17-1.65 4.2l-.29.39c-1.05 1.45-1.06 3.21-1.06 3.23zM9.44 16h4.62c.11-.81.42-2.16 1.29-3.36l.31-.41c.69-.93 1.35-1.8 1.35-3.31 0-2.99-2.36-5.43-5.25-5.43S6.5 5.93 6.5 8.93c0 1.52.66 2.4 1.35 3.32l.31.41c.86 1.19 1.17 2.53 1.28 3.34M15.75 20h-8v1.5h8z"/>',"circle-checked":'<path fill="currentColor" fill-rule="evenodd" d="m10.32 14.27 6.15-6.134 1.06 1.062-7.22 7.2L6.467 12.5l1.068-1.054z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M1.25 12C1.25 6.086 6.086 1.25 12 1.25S22.75 6.086 22.75 12 17.914 22.75 12 22.75 1.25 17.914 1.25 12M12 2.75c-5.086 0-9.25 4.164-9.25 9.25s4.164 9.25 9.25 9.25 9.25-4.164 9.25-9.25S17.086 2.75 12 2.75" clip-rule="evenodd"/>',"cloud-close":'<path fill="currentColor" fill-rule="evenodd" d="M5.23 9.323A7.75 7.75 0 0 1 12.5 4.25c3.782 0 6.923 2.71 7.606 6.291A4.74 4.74 0 0 1 23.25 15a4.75 4.75 0 0 1-4.75 4.75H6A5.25 5.25 0 0 1 .75 14.5c0-2.64 1.95-4.805 4.48-5.177M12.5 5.75a6.25 6.25 0 0 0-5.993 4.483l-.15.512-.534.025A3.74 3.74 0 0 0 2.25 14.5 3.75 3.75 0 0 0 6 18.25h12.5a3.243 3.243 0 0 0 .763-6.398l-.504-.122-.064-.514A6.25 6.25 0 0 0 12.5 5.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m14.47 15.53-5-5 1.06-1.06 5 5z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m9.47 14.47 5-5 1.06 1.06-5 5z" clip-rule="evenodd"/>',close:'<path fill="currentColor" fill-rule="evenodd" d="m5.47 17.47 12-12 1.06 1.06-12 12z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m6.53 5.47 12 12-1.06 1.06-12-12z" clip-rule="evenodd"/>',done:'<path fill="currentColor" fill-rule="evenodd" d="M9.476 15.936 18.97 6.47l1.06 1.062L9.468 18.064l-5.502-5.58 1.068-1.053z" clip-rule="evenodd"/>',"error-filled":'<path fill="currentColor" fill-rule="evenodd" d="M12 2.25a9.75 9.75 0 1 0 0 19.5 9.75 9.75 0 0 0 0-19.5M8.47 9.53l1.06-1.06L12 10.94l2.47-2.47 1.06 1.06L13.06 12l2.47 2.47-1.06 1.06L12 13.06l-2.47 2.47-1.06-1.06L10.94 12z" clip-rule="evenodd"/>',edit:'<path fill="currentColor" fill-rule="evenodd" d="M15.506 3.322a3.655 3.655 0 0 1 5.172 0 3.655 3.655 0 0 1 0 5.172L7.466 21.75H2.25v-5.215zm2.586.428c-.572 0-1.121.227-1.525.632l-.002.001L3.75 17.157v3.093h3.093L19.618 7.434a2.16 2.16 0 0 0-1.526-3.684" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M17.7 10.453 13.548 6.3l1.06-1.06 4.154 4.154z" clip-rule="evenodd"/>',eyedropper:'<path fill="currentColor" d="M17.889 11.615a.25.25 0 0 0 0-.353l-5.657-5.657a.25.25 0 0 0-.354 0l-1.414 1.414a.25.25 0 0 0 0 .354l5.657 5.656a.25.25 0 0 0 .354 0zm-.354 2.475a1.75 1.75 0 0 1-2.475 0L9.404 8.433a1.75 1.75 0 0 1 0-2.475l1.414-1.414a1.75 1.75 0 0 1 2.475 0l5.657 5.657a1.75 1.75 0 0 1 0 2.475z"/><path fill="currentColor" d="m15.951 12.86-7.077 7.076-.262.03-1.009.11-.453.454a2.85 2.85 0 0 1-4.03-4.03l.42-.42v-1.41l7.11-7.11zM5.04 15.291v1.41l-.86.86a1.35 1.35 0 0 0 1.91 1.909l.826-.826.262-.03 1.007-.111 5.644-5.644-3.18-3.178zM15.36 2.84a2.754 2.754 0 0 1 3.89 0l1.41 1.41a2.754 2.754 0 0 1 0 3.89l-2.94 2.941-5.3-5.3zm2.83 1.06a1.254 1.254 0 0 0-1.77 0l-1.88 1.88 3.18 3.18 1.88-1.88a1.255 1.255 0 0 0 0-1.77z"/><path fill="currentColor" d="m12.743 14.25-.006 1.5-8.46-.03.006-1.5z"/>',gallery:'<path fill="currentColor" d="M7.5 11c.8 0 1.5-.7 1.5-1.5S8.3 8 7.5 8 6 8.7 6 9.5 6.7 11 7.5 11"/><path fill="currentColor" fill-rule="evenodd" d="m16.698 9.015 5.787 4.913-.97 1.144-4.813-4.087L5.487 20.57l-.974-1.14z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 4.75c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h16c.69 0 1.25-.56 1.25-1.25V6c0-.69-.56-1.25-1.25-1.25zM1.25 6A2.75 2.75 0 0 1 4 3.25h16A2.75 2.75 0 0 1 22.75 6v12A2.75 2.75 0 0 1 20 20.75H4A2.75 2.75 0 0 1 1.25 18z" clip-rule="evenodd"/>',hide:'<path fill="currentColor" fill-rule="evenodd" d="M8.343 11.2c.056-.27.147-.581.284-.842l1.328.696c-.047.09-.102.252-.145.454-.041.199-.06.381-.06.492A2.27 2.27 0 0 0 12 14.25c.284 0 .685-.056.983-.2l.65 1.352c-.57.274-1.217.348-1.633.348-2.056 0-3.75-1.694-3.75-3.75 0-.238.035-.527.093-.8" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M2.833 12c.477-.936 1.58-2.68 3.626-3.843l-.742-1.304c-2.695 1.534-3.975 3.906-4.4 4.835L1.176 12l.143.312c.685 1.5 3.5 6.438 10.682 6.438 1.62 0 3.026-.253 4.242-.667l-.484-1.42c-1.054.36-2.297.587-3.758.587-5.874 0-8.377-3.707-9.167-5.25M12 6.75c-.673 0-1.6.084-2.202.227l-.346-1.46c.746-.177 1.797-.267 2.548-.267 7.182 0 9.997 4.939 10.682 6.438l.143.312-.143.312a11.1 11.1 0 0 1-3.22 4.037l-.923-1.184A9.7 9.7 0 0 0 21.166 12c-.79-1.544-3.292-5.25-9.166-5.25" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m19.763 22.237-18-18 1.06-1.06 18 18z" clip-rule="evenodd"/>',"info-filled":'<path fill="currentColor" fill-rule="evenodd" d="M12 2.25a9.75 9.75 0 1 0 0 19.5 9.75 9.75 0 0 0 0-19.5m-.75 5h1.5v1.5h-1.5zm0 3h1.5v6.5h-1.5z" clip-rule="evenodd"/>',lock:'<path fill="currentColor" fill-rule="evenodd" d="M5 11.75a.25.25 0 0 0-.25.25v8c0 .138.112.25.25.25h14a.25.25 0 0 0 .25-.25v-8a.25.25 0 0 0-.25-.25zM3.25 12c0-.966.784-1.75 1.75-1.75h14c.966 0 1.75.784 1.75 1.75v8A1.75 1.75 0 0 1 19 21.75H5A1.75 1.75 0 0 1 3.25 20z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M12 3.75A3.26 3.26 0 0 0 8.75 7v4h-1.5V7A4.76 4.76 0 0 1 12 2.25 4.76 4.76 0 0 1 16.75 7v4h-1.5V7A3.26 3.26 0 0 0 12 3.75" clip-rule="evenodd"/>',mail:'<path fill="currentColor" fill-rule="evenodd" d="m1.665 8.67.67-1.34L12 12.161l9.665-4.833.67 1.342L12 13.839z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h16c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25zM1.25 7A2.75 2.75 0 0 1 4 4.25h16A2.75 2.75 0 0 1 22.75 7v10A2.75 2.75 0 0 1 20 19.75H4A2.75 2.75 0 0 1 1.25 17z" clip-rule="evenodd"/>',minus:'<path fill="currentColor" fill-rule="evenodd" d="M6 10.75h12v1.5H6z" clip-rule="evenodd"/>',moon:'<path fill="currentColor" fill-rule="evenodd" d="M11.67 2.763a.75.75 0 0 1-.11.835c-.191.216-.414.406-.59.555l-.126.108a2.6 2.6 0 0 0-.512.568C10.043 5.28 9.75 6.113 9.75 8A6.207 6.207 0 0 0 16 14.25c1.706 0 3.214-.624 4.37-1.78a.75.75 0 0 1 1.277.596c-.433 4.878-4.25 8.684-9.647 8.684-5.435 0-9.75-4.757-9.75-9.75 0-4.976 3.784-9.211 8.684-9.647a.75.75 0 0 1 .736.41m-2.8 1.61C5.872 5.57 3.75 8.568 3.75 12c0 4.208 3.685 8.25 8.25 8.25 3.885 0 6.76-2.276 7.782-5.466-1.128.634-2.412.966-3.782.966A7.707 7.707 0 0 1 8.25 8c0-1.736.228-2.843.62-3.627" clip-rule="evenodd"/>',"more-vertical":'<path fill="currentColor" d="M11.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M11.5 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M11.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"/>',pause:'<path fill="currentColor" fill-rule="evenodd" d="M8 6.75h2.5v10.5H8zm5.5 0H16v10.5h-2.5z" clip-rule="evenodd"/>',play:'<path fill="currentColor" fill-rule="evenodd" d="M9.5 7.21v9.58l7.5-4.79z" clip-rule="evenodd"/>',plus:'<path fill="currentColor" fill-rule="evenodd" d="M11.25 11.25v-7h1.5v7h7v1.5h-7v7h-1.5v-7h-7v-1.5z" clip-rule="evenodd"/>',copy:'<path fill="currentColor" fill-rule="evenodd" d="M8 3.75a.25.25 0 0 0-.25.25v12c0 .138.112.25.25.25h12a.25.25 0 0 0 .25-.25V4a.25.25 0 0 0-.25-.25zM6.25 4c0-.966.784-1.75 1.75-1.75h12c.966 0 1.75.784 1.75 1.75v12A1.75 1.75 0 0 1 20 17.75H8A1.75 1.75 0 0 1 6.25 16z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M3.75 9v9A2.25 2.25 0 0 0 6 20.25h9v1.5H6A3.75 3.75 0 0 1 2.25 18V9z" clip-rule="evenodd"/>',code:'<path fill="currentColor" fill-rule="evenodd" d="m6.47 7.47 1.06 1.06L4.06 12l3.47 3.47-1.06 1.06L1.94 12zM19.94 12l-3.47-3.47 1.06-1.06L22.06 12l-4.53 4.53-1.06-1.06zM8.31 18.705l6-14 1.38.59-6 14z" clip-rule="evenodd"/>',write:'<path fill="currentColor" fill-rule="evenodd" d="M3.056 6.056A2.75 2.75 0 0 1 5 5.25h3v1.5H5A1.25 1.25 0 0 0 3.75 8v11A1.25 1.25 0 0 0 5 20.25h11A1.25 1.25 0 0 0 17.25 19v-3h1.5v3A2.75 2.75 0 0 1 16 21.75H5A2.75 2.75 0 0 1 2.25 19V8c0-.73.29-1.429.806-1.944" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M16.885 3.084a2.85 2.85 0 0 1 4.03 4.03l-9.604 9.636H7.25v-4.061zm2.015.666a1.35 1.35 0 0 0-.955.395L8.75 13.311v1.939h1.939l9.166-9.195A1.35 1.35 0 0 0 18.9 3.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m18.47 8.53-3-3 1.06-1.06 3 3z" clip-rule="evenodd"/>',upload:'<path fill="currentColor" d="m12 2.94 5.53 5.53-1.06 1.06-3.72-3.72V17h-1.5V5.81L7.53 9.53 6.47 8.47z"/><path fill="currentColor" d="M2.25 15h1.5v4.25h16.5V15h1.5v5.75H2.25z"/>',video:'<path fill="currentColor" fill-rule="evenodd" d="M21.37 6.347a.75.75 0 0 1 .38.653v10a.75.75 0 0 1-1.136.643l-5-3a.75.75 0 1 1 .772-1.286l3.864 2.318v-7.35l-3.864 2.318a.75.75 0 1 1-.772-1.286l5-3a.75.75 0 0 1 .755-.01" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M2.25 6A.75.75 0 0 1 3 5.25h13a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75H3a.75.75 0 0 1-.75-.75zm1.5.75v10.5h11.5V6.75z" clip-rule="evenodd"/>',"volume-up":'<path fill="currentColor" fill-rule="evenodd" d="M12.325 4.324A.75.75 0 0 1 12.75 5v14a.75.75 0 0 1-1.219.586L6.738 15.75H3a.75.75 0 0 1-.75-.75V9A.75.75 0 0 1 3 8.25h3.737l4.794-3.836a.75.75 0 0 1 .794-.09M11.25 6.56 7.469 9.586A.75.75 0 0 1 7 9.75H3.75v4.5H7a.75.75 0 0 1 .469.164l3.781 3.025zM17.57 4.37a.75.75 0 0 1 1.06 0c2.046 2.046 3.12 4.739 3.12 7.63 0 2.908-1.185 5.589-3.105 7.616a.75.75 0 1 1-1.09-1.032c1.68-1.773 2.695-4.092 2.695-6.584 0-2.508-.926-4.815-2.68-6.57a.75.75 0 0 1 0-1.06" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M14.97 7.97a.75.75 0 0 1 1.06 0c1.025 1.025 1.72 2.51 1.72 4.03 0 1.485-.571 2.998-1.748 4.058a.75.75 0 1 1-1.004-1.115c.823-.741 1.252-1.828 1.252-2.943 0-1.08-.505-2.195-1.28-2.97a.75.75 0 0 1 0-1.06" clip-rule="evenodd"/>',"mute-filled":'<path fill="currentColor" d="M12.3 4.1h.1c-.3-.2-.8 0-1.1.1L6.6 8H3c-.6 0-1 .4-1 1v6c0 .6.4 1 1 1h3.6l4.7 3.8c.2.1.4.2.6.2h.4c.3-.2.6-.5.6-.9V5q0-.6-.6-.9M21.9 9.7l-1.4-1.4-2.3 2.3-2.3-2.3-1.4 1.4 2.3 2.3-2.3 2.3 1.4 1.4 2.3-2.3 2.3 2.3 1.4-1.4-2.3-2.3z"/>',package:'<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M12 1.14 21.65 6.56v9.78L12 21.76 2.35 16.44V6.56zm-8.15 6.3v8.12L12 20.04l7.8-4.48V7.44L12 2.86z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M21.27 7.75 12.37 12.75l-.74-1.31 8.9-5z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M11.25 21v-8.9h1.5V21z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M3.47 6.35 12.37 11.45l-.75 1.3-8.9-5.1z"/><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M7.23 8.85 16.13 3.85l.74 1.3-8.9 5z"/>',"delivery-filled":'<path fill="currentColor" d="M22.68 11.13 21.45 8.66A2.25 2.25 0 0 0 18.76 7H18a3 3 0 0 0-3-3H4a3 3 0 0 0-3 3v9c0 .87.39 1.67 1.02 2.23.14 1.54 1.43 2.77 3 2.77 1.3 0 2.4-.84 2.82-2h6.37c.42 1.16 1.52 2 2.82 2 1.65 0 3-1.35 3-3h1c1.1 0 2-.9 2-2v-3.53c0-.46-.11-.92-.32-1.34M5 19c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m12 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-3h-1.78c-.33-.37-.75-.65-1.22-.82V9h.76c.38 0 .73.21.9.55l1.24 2.47c.07.14.1.3.1.47z"/>',repeat:'<path fill="currentColor" fill-rule="evenodd" d="m18.94 6-3.47-3.47 1.06-1.06L21.06 6l-4.53 4.53-1.06-1.06z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M5.532 7.433c.587-.488 1.3-.783 1.968-.783h12.4v-1.5H7.5c-1.116 0-2.183.49-2.988 1.18l-.044.038-.037.044C3.757 7.197 3.25 8.164 3.25 9.3V11h1.5V9.3c0-.648.279-1.267.782-1.867M5.06 18l3.47-3.47-1.06-1.06L2.94 18l4.53 4.53 1.06-1.06z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M19.25 14.7V13h1.5v1.7c0 1.136-.508 2.103-1.18 2.888l-.038.044-.044.037c-.805.69-1.872 1.181-2.988 1.181H4v-1.5h12.5c.668 0 1.381-.295 1.968-.783.503-.6.782-1.22.782-1.867" clip-rule="evenodd"/>',settings:'<path fill="currentColor" fill-rule="evenodd" d="M8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0M12 9.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M9.757 1.888a.75.75 0 0 1 .742-.639h3a.75.75 0 0 1 .742.639l.425 2.836q.303.11.594.244l2.304-1.703a.75.75 0 0 1 .976.073l2.121 2.12a.75.75 0 0 1 .073.977l-1.702 2.304q.134.291.244.594l2.835.425a.75.75 0 0 1 .639.742v3a.75.75 0 0 1-.639.742l-2.836.425q-.11.303-.243.594l1.702 2.304a.75.75 0 0 1-.073.976l-2.12 2.121a.75.75 0 0 1-.977.073l-2.304-1.702q-.291.134-.594.244l-.425 2.835a.75.75 0 0 1-.742.639h-3a.75.75 0 0 1-.742-.639l-.425-2.836a8 8 0 0 1-.594-.244l-2.304 1.703a.75.75 0 0 1-.976-.073l-2.121-2.12a.75.75 0 0 1-.073-.977l1.702-2.304a8 8 0 0 1-.244-.594l-2.835-.425a.75.75 0 0 1-.639-.742v-3a.75.75 0 0 1 .639-.742l2.836-.425q.11-.303.244-.594L3.264 6.435a.75.75 0 0 1 .073-.976l2.12-2.121a.75.75 0 0 1 .977-.073l2.304 1.702q.291-.134.594-.244zm1.388.861-.398 2.653a.75.75 0 0 1-.53.608 6 6 0 0 0-1.197.493.75.75 0 0 1-.804-.056L6.062 4.855 4.854 6.063l1.592 2.154a.75.75 0 0 1 .056.804 6.2 6.2 0 0 0-.493 1.2.75.75 0 0 1-.608.527l-2.653.398v1.708l2.653.398a.75.75 0 0 1 .608.53q.188.634.493 1.197a.75.75 0 0 1-.056.804l-1.592 2.154 1.208 1.208 2.154-1.592a.75.75 0 0 1 .804-.056q.562.304 1.2.493a.75.75 0 0 1 .527.608l.398 2.653h1.708l.398-2.653a.75.75 0 0 1 .53-.608q.634-.188 1.197-.493a.75.75 0 0 1 .804.056l2.154 1.592 1.208-1.208-1.592-2.154a.75.75 0 0 1-.056-.804q.304-.562.493-1.2a.75.75 0 0 1 .608-.527l2.653-.398v-1.708l-2.653-.398a.75.75 0 0 1-.608-.53 6 6 0 0 0-.493-1.197.75.75 0 0 1 .056-.804l1.592-2.154-1.208-1.208-2.154 1.592a.75.75 0 0 1-.804.056 6.2 6.2 0 0 0-1.2-.493.75.75 0 0 1-.527-.608l-.398-2.653z" clip-rule="evenodd"/>',refresh:'<path fill="currentColor" fill-rule="evenodd" d="M20.25 8.25V3h1.5v6.75H16v-1.5z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M12 3.75A8.25 8.25 0 0 0 3.75 12 8.25 8.25 0 0 0 12 20.25 8.25 8.25 0 0 0 20.25 12h1.5A9.75 9.75 0 0 1 12 21.75 9.75 9.75 0 0 1 2.25 12 9.75 9.75 0 0 1 12 2.25a9.75 9.75 0 0 1 8.628 5.205l.094.106.324.361.011.012.462.517a3 3 0 0 1 .098.123c.007.01.03.044.054.09l-1.342.671a.586.586 0 0 0 .068.11l.009.012-.021-.025q-.037-.043-.107-.12l-.335-.373-.013-.015-.494-.554-.05-.065a1 1 0 0 1-.05-.084l-.002-.004A8.25 8.25 0 0 0 12 3.75" clip-rule="evenodd"/>',expand:'<path fill="currentColor" fill-rule="evenodd" d="M17.25 6.75H12v-1.5h6.75V12h-1.5zM6.75 17.25V12h-1.5v6.75H12v-1.5z" clip-rule="evenodd"/>',shrink:'<path fill="currentColor" fill-rule="evenodd" d="M9.25 14.75H4v-1.5h6.75V20h-1.5zM13.75 10.25V5h-1.5v6.75H19v-1.5z" clip-rule="evenodd"/>',"grip-vertical":'<path fill="currentColor" d="M9.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M14.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M14.5 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M14.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"/>',"grip-horizontal":'<path fill="currentColor" d="M8 9.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M13.5 9.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M19 9.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M8 14.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M13.5 14.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0M19 14.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0"/>',search:'<path fill="currentColor" fill-rule="evenodd" d="M2.25 11c0-4.814 3.936-8.75 8.75-8.75s8.75 3.936 8.75 8.75-3.936 8.75-8.75 8.75S2.25 15.814 2.25 11M11 3.75c-3.986 0-7.25 3.264-7.25 7.25s3.264 7.25 7.25 7.25 7.25-3.264 7.25-7.25S14.986 3.75 11 3.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="m17.13 16.07 4.4 4.4-1.06 1.06-4.4-4.4z" clip-rule="evenodd"/>',"share-alt":'<path fill="currentColor" fill-rule="evenodd" d="M13.69 3.317a.75.75 0 0 1 .804.119l8 7a.75.75 0 0 1 0 1.128l-8 7A.75.75 0 0 1 13.25 18v-3.24c-1.925.051-3.579.315-5.062.932-1.659.692-3.157 1.85-4.588 3.758A.75.75 0 0 1 2.25 19c0-4.145 1.147-6.888 3.291-8.698 1.96-1.655 4.655-2.437 7.709-2.943V4a.75.75 0 0 1 .44-.683m1.06 2.336V8a.75.75 0 0 1-.638.742c-3.283.497-5.85 1.225-7.603 2.706-1.359 1.147-2.303 2.812-2.631 5.39 1.153-1.15 2.386-1.969 3.734-2.53 1.928-.804 4.04-1.058 6.388-1.058a.75.75 0 0 1 .75.75v2.347L20.861 11z" clip-rule="evenodd"/>',show:'<path fill="currentColor" fill-rule="evenodd" d="M8.25 12c0-2.055 1.695-3.75 3.75-3.75s3.75 1.694 3.75 3.75-1.694 3.75-3.75 3.75S8.25 14.056 8.25 12M12 9.75A2.27 2.27 0 0 0 9.75 12 2.27 2.27 0 0 0 12 14.25 2.27 2.27 0 0 0 14.25 12 2.27 2.27 0 0 0 12 9.75" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M2.833 12c.791 1.543 3.297 5.25 9.167 5.25 5.872 0 8.374-3.704 9.167-5.25-.791-1.543-3.297-5.25-9.167-5.25-5.871 0-8.374 3.704-9.167 5.25m-1.515-.312C2.006 10.183 4.823 5.25 12 5.25s9.997 4.938 10.682 6.438l.143.312-.143.312C21.994 13.817 19.177 18.75 12 18.75s-9.997-4.938-10.682-6.438L1.175 12z" clip-rule="evenodd"/>',sparkle:'<path fill="currentColor" fill-rule="evenodd" d="M12 2.25 14.08 8 19.75 10l-5.67 2L12 17.75 9.92 12 4.25 10l5.67-2zm0 4.4-.9 2.49-2.45.86 2.45.86.9 2.49.9-2.49 2.45-.86-2.45-.86zM18.5 15.25l.88 2.37 2.37.88-2.37.88-.88 2.37-.88-2.37-2.37-.88 2.37-.88z" clip-rule="evenodd"/>',sun:'<path fill="currentColor" fill-rule="evenodd" d="M12 7.75a4.25 4.25 0 1 0 0 8.5 4.25 4.25 0 0 0 0-8.5M6.25 12a5.75 5.75 0 1 1 11.5 0 5.75 5.75 0 0 1-11.5 0" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M11.25 5V2h1.5v3zm0 17v-3h1.5v3zm5.12-15.43 2.2-2.2 1.06 1.06-2.2 2.2zm-12.48 12.48 2.2-2.2 1.06 1.06-2.2 2.2zM19 11.25h3v1.5h-3zM2 11.25h3v1.5H2zm14.43 5.12 2.2 2.2-1.06 1.06-2.2-2.2zM4.37 6.57 6.57 4.37l1.06 1.06-2.2 2.2z" clip-rule="evenodd"/>',trash:'<path fill="currentColor" fill-rule="evenodd" d="M6.75 6v13c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25V6h1.5v13A2.75 2.75 0 0 1 16 21.75H8A2.75 2.75 0 0 1 5.25 19V6z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M21 6.75H3v-1.5h18z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M7.25 4c0-.966.784-1.75 1.75-1.75h6c.966 0 1.75.784 1.75 1.75v2h-1.5V4a.25.25 0 0 0-.25-.25H9a.25.25 0 0 0-.25.25v2h-1.5zM9.25 16V9h1.5v7zM13.25 16V9h1.5v7z" clip-rule="evenodd"/>',user:'<path fill="currentColor" fill-rule="evenodd" d="M8.652 3.687C9.52 2.708 10.833 2.25 12 2.25c1.198 0 2.38.478 3.313 1.402.979.868 1.437 2.181 1.437 3.348 0 1.198-.477 2.38-1.402 3.313-.868.979-2.181 1.437-3.348 1.437-1.198 0-2.38-.477-3.313-1.402C7.715 9.488 7.25 8.277 7.25 7c0-1.198.478-2.38 1.402-3.313M12 3.75c-.826 0-1.703.336-2.236.944l-.016.019-.018.017c-.664.664-.98 1.475-.98 2.27 0 .915.329 1.697.944 2.236l.019.016.017.018c.664.664 1.475.98 2.27.98.826 0 1.703-.336 2.236-.944l.016-.019.018-.017c.664-.664.98-1.475.98-2.27 0-.826-.336-1.703-.944-2.236l-.019-.016-.017-.018c-.664-.664-1.475-.98-2.27-.98M8 15.75c-.795 0-1.606.317-2.27.98l-.017.018-.02.016c-.614.539-.943 1.321-.943 2.236v3h-1.5v-3c0-1.277.465-2.487 1.437-3.348.934-.925 2.115-1.402 3.313-1.402h8c1.277 0 2.487.465 3.348 1.437.925.934 1.402 2.115 1.402 3.313v3h-1.5v-3c0-.795-.317-1.606-.98-2.27l-.018-.017-.016-.02c-.539-.614-1.321-.943-2.236-.943z" clip-rule="evenodd"/>',"warning-filled":'<path fill="currentColor" fill-rule="evenodd" d="M10.34 3.78a1.9 1.9 0 0 1 3.32 0l8.06 14.5A1.9 1.9 0 0 1 20.06 21H3.94a1.9 1.9 0 0 1-1.66-2.72zm.91 5.47h1.5v5.5h-1.5zm0 7h1.5v1.5h-1.5z" clip-rule="evenodd"/>'};function isDbIconName(e){return Object.prototype.hasOwnProperty.call(s,e)}function getDbComponentIconSize(e){return"s"===e?12:"l"===e?20:16}function createDbIcon(e,t=16){const i=document.createElement("template");return i.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" width="${t}" height="${t}" aria-hidden="true" focusable="false" data-designbase-icon="${e}">${s[e]}</svg>`,i.content.firstElementChild}const i=["disabled","loading","icon-only","full-width"],n=["primary","secondary","tertiary","danger","ghost","accent"],a=["s","m","l"],r=["none","s","m","l","pill"],o=["gradient","backlight"];class DbButton extends HTMLElement{constructor(){super(...arguments),this.handleClick=e=>{if(this.disabled||this.loading)return e.preventDefault(),void e.stopPropagation();this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.disabled||this.loading||this.classList.add("designbase-wc-button--pressed"),this.click())},this.handleKeyUp=e=>{"Enter"!==e.key&&" "!==e.key||this.classList.remove("designbase-wc-button--pressed")},this.handlePointerDown=()=>{this.disabled||this.loading||this.classList.add("designbase-wc-button--pressed")},this.handlePointerUp=()=>{this.classList.remove("designbase-wc-button--pressed")}}static get observedAttributes(){return["variant","size","radius","accent-style","type","loading-text","start-icon","end-icon",...i]}get variant(){return this.getAttribute("variant")||"primary"}set variant(e){this.setAttribute("variant",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get radius(){return this.getAttribute("radius")||""}set radius(e){e?this.setAttribute("radius",e):this.removeAttribute("radius")}get accentStyle(){return this.getAttribute("accent-style")||"gradient"}set accentStyle(e){e?this.setAttribute("accent-style",e):this.removeAttribute("accent-style")}get type(){return this.getAttribute("type")||"button"}set type(e){this.setAttribute("type",e)}get loadingText(){return this.getAttribute("loading-text")||""}set loadingText(e){e?this.setAttribute("loading-text",e):this.removeAttribute("loading-text")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get loading(){return this.hasAttribute("loading")}set loading(e){this.toggleAttribute("loading",e)}get iconOnly(){return this.hasAttribute("icon-only")}set iconOnly(e){this.toggleAttribute("icon-only",e)}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(e){this.toggleAttribute("full-width",e)}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("keyup",this.handleKeyUp),this.addEventListener("pointerdown",this.handlePointerDown),this.addEventListener("pointerup",this.handlePointerUp),this.addEventListener("pointerleave",this.handlePointerUp),this.addEventListener("pointercancel",this.handlePointerUp),this.syncAttributes()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("keyup",this.handleKeyUp),this.removeEventListener("pointerdown",this.handlePointerDown),this.removeEventListener("pointerup",this.handlePointerUp),this.removeEventListener("pointerleave",this.handlePointerUp),this.removeEventListener("pointercancel",this.handlePointerUp)}attributeChangedCallback(){this.syncAttributes()}syncAttributes(){this.classList.add("designbase-wc-button"),this.setAttribute("role","button"),this.setAttribute("aria-disabled",String(this.disabled||this.loading)),this.disabled||this.loading?this.removeAttribute("tabindex"):this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.syncModifier("variant",this.variant),this.syncModifier("size",this.size),this.syncRadius(),this.syncAccentStyle(),this.syncAccentField(),this.syncBooleanModifier("disabled"),this.syncBooleanModifier("icon-only"),this.syncBooleanModifier("full-width"),this.syncLoadingVisual(),this.loading?(this.querySelector(":scope > .designbase-wc-button__start-icon")?.remove(),this.querySelector(":scope > .designbase-wc-button__end-icon")?.remove()):this.syncIcons()}getIconSize(){return"s"===this.size?16:"l"===this.size?24:20}resolveIconName(e){if(e&&isDbIconName(e))return e}isManagedIconNode(e){return e instanceof HTMLElement&&(e.classList.contains("designbase-wc-button__start-icon")||e.classList.contains("designbase-wc-button__end-icon")||e.classList.contains("designbase-wc-button__spinner")||e.classList.contains("designbase-wc-button__accent-field")||e.classList.contains("designbase-wc-button__accent-glass")||e.classList.contains("designbase-wc-button__accent-orb"))}syncIcons(){const e=this.resolveIconName(this.getAttribute("start-icon")),t=this.resolveIconName(this.getAttribute("end-icon")),s=this.getIconSize();let i=this.querySelector(":scope > .designbase-wc-button__start-icon");if(e){if(!i){i=document.createElement("span"),i.className="designbase-wc-button__start-icon",i.setAttribute("aria-hidden","true");const e=Array.from(this.childNodes).find(e=>!this.isManagedIconNode(e));e?this.insertBefore(i,e):this.append(i)}i.replaceChildren(createDbIcon(e,s))}else i?.remove();let n=this.querySelector(":scope > .designbase-wc-button__end-icon");t?(n||(n=document.createElement("span"),n.className="designbase-wc-button__end-icon",n.setAttribute("aria-hidden","true")),n.replaceChildren(createDbIcon(t,s)),this.append(n)):n?.remove()}getDefaultRadiusClass(){return r.includes(this.radius)?`designbase-wc-button--radius-${this.radius}`:"designbase-wc-button--radius-pill"}syncRadius(){r.forEach(e=>this.classList.remove(`designbase-wc-button--radius-${e}`)),this.classList.add(this.getDefaultRadiusClass())}syncAccentStyle(){if(o.forEach(e=>this.classList.remove(`designbase-wc-button--accent-${e}`)),"accent"!==this.variant)return;const e=this.accentStyle,t=o.includes(e)?e:"gradient";this.classList.add(`designbase-wc-button--accent-${t}`)}syncAccentField(){const e="accent"===this.variant&&"gradient"===this.accentStyle,t=this.querySelector(":scope > .designbase-wc-button__accent-field"),s=this.querySelector(":scope > .designbase-wc-button__accent-glass");if(!e)return t?.remove(),void s?.remove();let i=t;if(!i){i=document.createElement("span"),i.className="designbase-wc-button__accent-field",i.setAttribute("aria-hidden","true");for(let e=1;e<=5;e+=1){const t=document.createElement("span");t.className=`designbase-wc-button__accent-orb designbase-wc-button__accent-orb--${e}`,i.appendChild(t)}this.insertBefore(i,this.firstChild)}if(!s){const e=document.createElement("span");e.className="designbase-wc-button__accent-glass",e.setAttribute("aria-hidden","true"),i.insertAdjacentElement("afterend",e)}}syncModifier(e,t){if(Array.from(this.classList).filter(t=>t.startsWith(`designbase-wc-button--${e}-`)).forEach(e=>this.classList.remove(e)),"variant"===e||"size"===e){("variant"===e?n:a).forEach(e=>this.classList.remove(`designbase-wc-button--${e}`)),this.classList.add(`designbase-wc-button--${t}`)}}syncBooleanModifier(e){const t=`designbase-wc-button--${e}`;this.classList.toggle(t,this.hasAttribute(e))}getSpinnerSize(){return a.includes(this.size)?this.size:"m"}syncLoadingVisual(){this.classList.toggle("designbase-wc-button--loading",this.loading);const e=this.querySelector(":scope > .designbase-wc-button__spinner");if(!this.loading)return void e?.remove();const t=`designbase-wc-button__spinner designbase-wc-spinner designbase-wc-spinner--circular designbase-wc-spinner--${this.getSpinnerSize()}`;if(e)return e.className=t,void e.setAttribute("aria-hidden","true");const s=document.createElement("span");s.className=t,s.setAttribute("aria-hidden","true"),s.innerHTML='<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>',this.insertBefore(s,this.firstChild)}}customElements.get("db-button")||customElements.define("db-button",DbButton);const l={weak:"약함",fair:"보통",good:"강함","very-strong":"아주 강함"};function getPasswordScore(e){switch(e){case"weak":return 1;case"fair":return 2;case"good":return 3;case"very-strong":return 4;default:return 0}}function getStepDecimalPlaces(e){const t=String(e),s=t.indexOf(".");return-1===s?0:t.length-s-1}function readNumericAttribute(e,t){const s=e.getAttribute(t);if(null===s||""===s)return;const i=Number(s);return Number.isFinite(i)?i:void 0}function attachNumberScrub(e,t){let s=null;const endScrub=()=>{s=null,t.onScrubStateChange?.(!1),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")},applyScrub=(e,i)=>{if(!s)return;const n=e-s.startX,a=t.getStep(),r=function computeScrubValue(e,t,s,i,n,a,r){const o=i*(n.shiftKey?10:n.altKey?.1:1);let l=e+Math.round(t/s)*o;void 0!==a&&(l=Math.max(a,l)),void 0!==r&&(l=Math.min(r,l));const d=getStepDecimalPlaces(o);return l=d>0?Number(l.toFixed(d)):Math.round(l),l}(s.startValue,n,t.getSensitivity(),a,i,t.getMin(),t.getMax());t.onValueChange(function formatScrubValue(e,t){const s=getStepDecimalPlaces(t);return s>0?e.toFixed(s):String(Math.round(e))}(r,a))},handlePointerDown=i=>{if(!t.isEnabled()||!t.isInteractive()||0!==i.button)return;const n=function parseScrubNumericValue(e){const t=e.trim();if(""===t)return 0;const s=Number(t);return Number.isFinite(s)?s:null}(t.getValue());null!==n&&(s={pointerId:i.pointerId,startX:i.clientX,startValue:n,moved:!1},e.setPointerCapture(i.pointerId))},handlePointerMove=e=>{if(!s||s.pointerId!==e.pointerId)return;const i=e.clientX-s.startX;!s.moved&&Math.abs(i)<3||(s.moved||(s.moved=!0,t.onScrubStateChange?.(!0),document.body.style.cursor="ew-resize",document.body.style.userSelect="none"),e.preventDefault(),applyScrub(e.clientX,e))},handlePointerEnd=t=>{s&&s.pointerId===t.pointerId&&(s.moved&&t.preventDefault(),e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId),endScrub())};return e.addEventListener("pointerdown",handlePointerDown),e.addEventListener("pointermove",handlePointerMove),e.addEventListener("pointerup",handlePointerEnd),e.addEventListener("pointercancel",handlePointerEnd),()=>{endScrub(),e.removeEventListener("pointerdown",handlePointerDown),e.removeEventListener("pointermove",handlePointerMove),e.removeEventListener("pointerup",handlePointerEnd),e.removeEventListener("pointercancel",handlePointerEnd)}}const d=["text","email","password","url","search","tel","number"],u=["s","m","l"],b=new Set(["arrow-bar-left","arrow-bar-right","caret-down-filled","chevron-down","chevron-left","chevron-right","circle-checked","close","error-filled","edit","hide","info-filled","lock","mail","plus","search","share-alt","show","sparkle","trash","user","warning-filled"]);class DbInput extends HTMLElement{constructor(){super(...arguments),this.passwordVisible=!1,this.isFocused=!1,this.touched=!1,this.isScrubbing=!1,this.handleInput=e=>{e.stopPropagation();const t=e.target;this.updateDynamicUI(),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:t.value,nativeEvent:e},bubbles:!0,composed:!0}))},this.handleChange=e=>{e.stopPropagation();const t=e.target;this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t.value,nativeEvent:e},bubbles:!0,composed:!0}))},this.handleFocus=e=>{this.isFocused=!0,this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-focus",{detail:{nativeEvent:e},bubbles:!0,composed:!0}))},this.handleBlur=e=>{this.isFocused=!1,this.touched=!0,this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-blur",{detail:{nativeEvent:e},bubbles:!0,composed:!0}))},this.handlePasswordToggle=()=>{this.passwordVisible=!this.passwordVisible,this.render()},this.handleSearchClear=()=>{this.input&&(this.input.value="",this.setAttribute("value",""),this.input.focus(),this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:"",nativeEvent:null},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-clear",{bubbles:!0,composed:!0})))}}static get observedAttributes(){return["type","label","placeholder","value","default-value","size","disabled","readonly","required","error","error-message","helper-text","full-width","name","start-icon","end-icon","validate","validation-visibility","validate-on-blur","password-min-length","scrubbable","scrub-step","scrub-sensitivity","min","max","step"]}get value(){return this.input?.value??this.getAttribute("value")??""}set value(e){this.setAttribute("value",e),this.input&&(this.input.value=e),this.updateDynamicUI()}get type(){return this.getAttribute("type")||"text"}set type(e){this.setAttribute("type",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get readOnly(){return this.hasAttribute("readonly")}set readOnly(e){this.toggleAttribute("readonly",e)}connectedCallback(){this.render()}disconnectedCallback(){this.detachScrub?.(),this.detachScrub=void 0}attributeChangedCallback(e){if("value"!==e||!this.isScrubbing){if("value"===e&&this.input){const e=this.getAttribute("value")??"";return this.input.value!==e&&(this.input.value=e),void this.updateDynamicUI()}this.render()}}focus(){this.input?.focus()}get passwordMinLength(){return Number(this.getAttribute("password-min-length")||8)}get validationVisibility(){return this.getAttribute("validation-visibility")||"focus"}get validateOnBlur(){return!this.hasAttribute("validate-on-blur")||"false"!==this.getAttribute("validate-on-blur")}get isValidationEnabled(){return this.hasAttribute("validate")}getIconSize(){return getDbComponentIconSize(this.size)}resolveIconName(e){const t=this.getAttribute(e);if(t&&b.has(t))return t}resolveStartIcon(){const e=this.resolveIconName("start-icon");return e||("search"===this.type?"search":void 0)}getCurrentValue(){return this.input?.value??this.getAttribute("value")??this.getAttribute("default-value")??""}render(){const e=this.getCurrentValue(),t=d.includes(this.type)?this.type:"text",s="search"===t,i="password"===t,n=i&&this.passwordVisible||s?"text":t,a=this.getAttribute("label")||"",r=this.getAttribute("helper-text")||"",o=this.getAttribute("error-message")||"",l=this.hasAttribute("error"),b=this.resolveStartIcon(),m=this.resolveIconName("end-icon");this.classList.add("designbase-wc-input"),u.forEach(e=>this.classList.remove(`designbase-wc-input--${e}`)),this.classList.add(`designbase-wc-input--${u.includes(this.size)?this.size:"m"}`),this.classList.toggle("designbase-wc-input--error",l),this.classList.toggle("designbase-wc-input--disabled",this.disabled),this.classList.toggle("designbase-wc-input--readonly",this.readOnly),this.classList.toggle("designbase-wc-input--full-width",this.hasAttribute("full-width")),this.classList.toggle("designbase-wc-input--with-start-icon",Boolean(b));const p=s&&e.length>0&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--with-end-icon",Boolean(m&&!i&&!s)||i||p),this.classList.toggle("designbase-wc-input--with-password-toggle",i),this.classList.toggle("designbase-wc-input--with-search-clear",p);const g=this.hasAttribute("scrubbable")&&"number"===t&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--scrubbable",g),this.classList.toggle("designbase-wc-input--scrubbing",this.isScrubbing);const v=this.getAttribute("id")||`db-input-${Math.random().toString(36).slice(2)}`;this.hasAttribute("id")||this.setAttribute("id",v);const E=`${v}-field`,f=`${v}-helper`,w=`${v}-error`,y=`${v}-validation`,A=this.getAttribute("min"),_=this.getAttribute("max"),C=this.getAttribute("step");this.innerHTML=`\n ${a?`<label class="designbase-wc-input__label" for="${E}">${this.escape(a)}${this.hasAttribute("required")?'<span aria-hidden="true"> *</span>':""}</label>`:""}\n <span class="designbase-wc-input__wrapper">\n ${b?'<span class="designbase-wc-input__start-icon" aria-hidden="true"></span>':""}\n <input\n id="${E}"\n class="designbase-wc-input__field"\n type="${n}"\n value="${this.escape(e)}"\n placeholder="${this.escape(this.getAttribute("placeholder")||"")}"\n ${s?'role="searchbox"':""}\n ${this.getAttribute("name")?`name="${this.escape(this.getAttribute("name")||"")}"`:""}\n ${this.disabled?"disabled":""}\n ${this.readOnly?"readonly":""}\n ${this.hasAttribute("required")?"required":""}\n ${null!==A?`min="${this.escape(A)}"`:""}\n ${null!==_?`max="${this.escape(_)}"`:""}\n ${null!==C?`step="${this.escape(C)}"`:""}\n aria-invalid="${String(l)}"\n />\n ${i?`<button type="button" class="designbase-wc-input__password-toggle" ${this.disabled?"disabled":""} aria-label="${this.passwordVisible?"비밀번호 숨기기":"비밀번호 보기"}"></button>`:""}\n ${s?'<button type="button" class="designbase-wc-input__clear-button" hidden aria-label="검색어 지우기"></button>':""}\n ${!m||i||s?"":'<span class="designbase-wc-input__end-icon" aria-hidden="true"></span>'}\n </span>\n ${this.isValidationEnabled&&i?`<div class="designbase-wc-input__validation-slot" id="${y}"></div>`:""}\n ${r&&!l?`<p id="${f}" class="designbase-wc-input__helper-text">${this.escape(r)}</p>`:""}\n ${l&&o?`<p id="${w}" class="designbase-wc-input__error-message">${this.escape(o)}</p>`:""}\n `,this.mountIcons(b,!m||i||s?void 0:m,i),this.input=this.querySelector("input")||void 0,this.input&&(this.input.value=e,this.input.addEventListener("input",this.handleInput),this.input.addEventListener("change",this.handleChange),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("blur",this.handleBlur)),this.querySelector(".designbase-wc-input__password-toggle")?.addEventListener("click",this.handlePasswordToggle),this.querySelector(".designbase-wc-input__clear-button")?.addEventListener("click",this.handleSearchClear),this.detachScrub?.(),this.detachScrub=void 0,g&&this.input&&(this.detachScrub=attachNumberScrub(this.input,{isEnabled:()=>this.hasAttribute("scrubbable")&&"number"===this.type,isInteractive:()=>!this.disabled&&!this.readOnly,getValue:()=>this.getCurrentValue(),getStep:()=>readNumericAttribute(this,"scrub-step")??readNumericAttribute(this,"step")??1,getMin:()=>readNumericAttribute(this,"min"),getMax:()=>readNumericAttribute(this,"max"),getSensitivity:()=>readNumericAttribute(this,"scrub-sensitivity")??4,onValueChange:e=>this.applyScrubValue(e),onScrubStateChange:e=>{this.isScrubbing=e,this.classList.toggle("designbase-wc-input--scrubbing",e),!e&&this.input&&this.dispatchEvent(new CustomEvent("db-change",{detail:{value:this.input.value,nativeEvent:null},bubbles:!0,composed:!0}))}})),this.updateDynamicUI()}mountIcons(e,t,s=!1){const i=this.getIconSize();if(e){const t=this.querySelector(".designbase-wc-input__start-icon");t?.replaceChildren(createDbIcon(e,i))}if(t){const e=this.querySelector(".designbase-wc-input__end-icon");e?.replaceChildren(createDbIcon(t,i))}if(s){const e=this.querySelector(".designbase-wc-input__password-toggle");e?.replaceChildren(createDbIcon(this.passwordVisible?"hide":"show",i))}const n=this.querySelector(".designbase-wc-input__clear-button");n?.replaceChildren(createDbIcon("close",i))}shouldShowPasswordValidation(e){return!(!this.isValidationEnabled||"password"!==this.type)&&("never"!==this.validationVisibility&&("always"===this.validationVisibility||(this.isFocused||e.length>0)))}renderValidationMarkup(e){const t=function getPasswordValidation(e,t=8){const s=[{id:"length",label:`최소 ${t}자 이상`,met:e.length>=t},{id:"lowercase",label:"소문자 포함",met:/[a-z]/.test(e)},{id:"uppercase",label:"대문자 포함",met:/[A-Z]/.test(e)},{id:"number",label:"숫자 포함",met:/\d/.test(e)},{id:"special",label:"특수문자 포함",met:/[!@#$%^&*(),.?":{}|<>]/.test(e)}],i=function getPasswordStrengthLevel(e,t){return!t||e<=1?"weak":2===e?"fair":3===e?"good":"very-strong"}(s.filter(e=>e.met).length,e.length>0);return{requirements:s,score:getPasswordScore(i),level:i,levelLabel:l[i],isValid:s.every(e=>e.met),isStrongEnough:"good"===i||"very-strong"===i}}(e,this.passwordMinLength),s=Array.from({length:4},(e,s)=>`<span class="designbase-wc-input__password-strength-segment${s<t.score?` designbase-wc-input__password-strength-segment--${t.level}`:""}"></span>`).join(""),i=t.requirements.map(e=>`<li class="designbase-wc-input__password-requirement${e.met?" designbase-wc-input__password-requirement--met":""}">${e.met?'<span class="designbase-wc-input__password-requirement-icon" aria-hidden="true"></span>':'<span class="designbase-wc-input__password-requirement-icon" aria-hidden="true"><span class="designbase-wc-input__password-requirement-dot"></span></span>'}<span class="designbase-wc-input__password-requirement-label">${this.escape(e.label)}</span></li>`).join("");return`\n <div class="designbase-wc-input__validation" aria-live="polite">\n <div class="designbase-wc-input__password-strength">\n <div class="designbase-wc-input__password-strength-bar" role="progressbar" aria-valuemin="0" aria-valuemax="4" aria-valuenow="${t.score}" aria-label="비밀번호 강도">${s}</div>\n <span class="designbase-wc-input__password-strength-label designbase-wc-input__password-strength-label--${t.level}">${t.levelLabel}</span>\n </div>\n <ul class="designbase-wc-input__password-requirements">${i}</ul>\n </div>\n `}updateDynamicUI(){const e=this.getCurrentValue(),t="search"===this.type&&e.length>0&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--with-search-clear",t);const s=this.querySelector(".designbase-wc-input__clear-button");s&&(s.hidden=!t,s.replaceChildren(createDbIcon("close",this.getIconSize())));const i=this.querySelector(".designbase-wc-input__validation-slot");if(i&&(this.shouldShowPasswordValidation(e)?(i.innerHTML=this.renderValidationMarkup(e),i.querySelectorAll(".designbase-wc-input__password-requirement--met .designbase-wc-input__password-requirement-icon").forEach(e=>{e.replaceChildren(createDbIcon("circle-checked",12))})):i.innerHTML=""),this.input){const t=`${this.getAttribute("id")}-helper`,s=`${this.getAttribute("id")}-error`,i=`${this.getAttribute("id")}-validation`,n=this.getAttribute("helper-text")||"",a=this.getAttribute("error-message")||"",r=this.hasAttribute("error"),o=[n&&!r?t:"",this.shouldShowPasswordValidation(e)?i:"",r&&a?s:""].filter(Boolean).join(" ")||void 0;o?this.input.setAttribute("aria-describedby",o):this.input.removeAttribute("aria-describedby")}}applyScrubValue(e){this.input&&(this.input.value=e,this.setAttribute("value",e),this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:e,nativeEvent:null},bubbles:!0,composed:!0})))}escape(e){return e.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[e]||e))}}customElements.get("db-input")||customElements.define("db-input",DbInput);const m=["s","m","l"];class DbCheckbox extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleChange=()=>{if(!this.input)return;const e=this.input.checked;this.toggleAttribute("checked",e),this.indeterminate&&(this.removeAttribute("indeterminate"),this.input.indeterminate=!1),this.syncVisual(),this.syncClasses(),this.dispatchEvent(new CustomEvent("db-change",{detail:{checked:e,selected:e},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["checked","selected","default-checked","default-selected","indeterminate","size","disabled","readonly","required","name","value","has-label"]}get checked(){return this.input?.checked??(this.hasAttribute("checked")||this.hasAttribute("selected"))}set checked(e){this.toggleAttribute("checked",e),this.input&&(this.input.checked=e,this.syncVisual(),this.syncClasses())}get indeterminate(){return this.hasAttribute("indeterminate")}set indeterminate(e){this.toggleAttribute("indeterminate",e),this.input&&(this.input.indeterminate=e,this.syncVisual(),this.syncClasses())}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.input&&(this.input.disabled=e),this.syncClasses()}get readOnly(){return this.hasAttribute("readonly")}set readOnly(e){this.toggleAttribute("readonly",e),this.input&&(this.input.readOnly=e),this.syncClasses()}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",e),this.input&&(this.input.required=e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}connectedCallback(){this.style.display="contents",this.built||this.build(),this.syncState()}attributeChangedCallback(e){if(this.built)return"checked"===e||"selected"===e?(this.input&&(this.input.checked=this.hasAttribute("checked")||this.hasAttribute("selected")),this.syncVisual(),void this.syncClasses()):void this.syncState()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}build(){for(this.root=document.createElement("label"),this.root.className="designbase-wc-checkbox",this.input=document.createElement("input"),this.input.type="checkbox",this.input.className="designbase-wc-checkbox__input",this.visual=document.createElement("span"),this.visual.className="designbase-wc-checkbox__visual",this.visual.setAttribute("aria-hidden","true"),this.labelEl=document.createElement("span"),this.labelEl.className="designbase-wc-checkbox__label";this.firstChild;)this.labelEl.appendChild(this.firstChild);this.root.append(this.input,this.visual,this.labelEl),this.appendChild(this.root),this.input.addEventListener("change",this.handleChange),this.built=!0}syncState(){if(!this.root||!this.input||!this.visual)return;const e=this.hasAttribute("checked")||this.hasAttribute("selected")||!this.hasAttribute("checked")&&!this.hasAttribute("selected")&&(this.hasAttribute("default-checked")||this.hasAttribute("default-selected")),t=this.hasAttribute("indeterminate");this.input.checked=e,this.input.indeterminate=t,this.input.disabled=this.disabled,this.input.readOnly=this.readOnly,this.input.required=this.required,this.input.name=this.getAttribute("name")||"",this.input.value=this.getAttribute("value")||"",this.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncVisual(),this.syncClasses()}syncVisual(){if(this.visual&&this.input){if(this.visual.replaceChildren(),this.input.indeterminate){const e=document.createElement("span");return e.className="designbase-wc-checkbox__indeterminate-icon",e.appendChild(createDbIcon("minus",16)),void this.visual.appendChild(e)}if(this.input.checked){const e=document.createElement("span");e.className="designbase-wc-checkbox__check-icon",e.appendChild(createDbIcon("done",16)),this.visual.appendChild(e)}}}syncClasses(){if(!this.root||!this.input)return;const e=m.includes(this.size)?this.size:"m",t=this.hasLabel&&Boolean(this.labelEl?.textContent?.trim());this.root.className=["designbase-wc-checkbox",`designbase-wc-checkbox--${e}`,this.input.checked&&"designbase-wc-checkbox--selected",this.input.indeterminate&&"designbase-wc-checkbox--indeterminate",this.disabled&&"designbase-wc-checkbox--disabled",this.readOnly&&"designbase-wc-checkbox--readonly",!t&&"designbase-wc-checkbox--no-label"].filter(Boolean).join(" ")}}customElements.get("db-checkbox")||customElements.define("db-checkbox",DbCheckbox);const p=["s","m","l"];class DbToggle extends HTMLElement{constructor(){super(...arguments),this.internals=this.attachInternals(),this.built=!1,this.handleClick=()=>{if(this.disabled||this.readOnly)return;const e=!this.checked;this.toggleAttribute("checked",e),this.syncFormValue(),this.syncState(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{checked:e,selected:e},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["checked","selected","default-checked","default-selected","size","disabled","readonly","has-label","name","value"]}get checked(){return this.hasAttribute("checked")||this.hasAttribute("selected")}set checked(e){this.toggleAttribute("checked",e),this.syncFormValue(),this.syncClasses()}get name(){return this.getAttribute("name")??""}set name(e){this.setAttribute("name",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.root&&(this.root.disabled=e),this.syncClasses()}get readOnly(){return this.hasAttribute("readonly")}set readOnly(e){this.toggleAttribute("readonly",e),this.syncClasses()}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}connectedCallback(){this.style.display="contents",this.built||this.build(),this.syncState()}attributeChangedCallback(){this.built&&this.syncState()}formResetCallback(){const e=this.hasAttribute("default-checked")||this.hasAttribute("default-selected");this.toggleAttribute("checked",e),this.syncFormValue(),this.syncState()}formDisabledCallback(e){this.toggleAttribute("disabled",e),this.root&&(this.root.disabled=e),this.syncClasses()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}syncFormValue(){const e=this.hasAttribute("checked")||this.hasAttribute("selected");this.internals.setFormValue(e?this.getAttribute("value")||"on":null)}build(){this.root=document.createElement("button"),this.root.type="button",this.root.className="designbase-wc-toggle";const e=document.createElement("span");e.className="designbase-wc-toggle__track",e.setAttribute("aria-hidden","true");const t=document.createElement("span");for(t.className="designbase-wc-toggle__thumb",e.appendChild(t),this.labelEl=document.createElement("span"),this.labelEl.className="designbase-wc-toggle__label";this.firstChild;)this.labelEl.appendChild(this.firstChild);this.root.append(e,this.labelEl),this.appendChild(this.root),this.root.addEventListener("click",this.handleClick),this.built=!0}syncState(){this.root&&(this.root.disabled=this.disabled,this.syncFormValue(),this.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncClasses())}syncClasses(){if(!this.root)return;const e=p.includes(this.size)?this.size:"m",t=this.hasLabel&&Boolean(this.labelEl?.textContent?.trim()),s=this.hasAttribute("checked")||this.hasAttribute("selected")||!this.hasAttribute("checked")&&!this.hasAttribute("selected")&&(this.hasAttribute("default-checked")||this.hasAttribute("default-selected"));this.root.className=["designbase-wc-toggle",`designbase-wc-toggle--${e}`,s&&"designbase-wc-toggle--selected",this.disabled&&"designbase-wc-toggle--disabled",this.readOnly&&"designbase-wc-toggle--readonly",!t&&"designbase-wc-toggle--no-label"].filter(Boolean).join(" "),this.root.setAttribute("aria-pressed",String(s))}}DbToggle.formAssociated=!0,customElements.get("db-toggle")||customElements.define("db-toggle",DbToggle);const g="designbase-wc-badge",v=["primary","secondary","info","success","warning","danger"],E=["s","m","l"],f=["dot","number","text","outlined"];class DbBadge extends HTMLElement{static get observedAttributes(){return["variant","size","badge-style","count","max-count","disabled"]}get variant(){return this.getAttribute("variant")||"primary"}set variant(e){this.setAttribute("variant",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get badgeStyle(){return this.getAttribute("badge-style")||"text"}set badgeStyle(e){this.setAttribute("badge-style",e)}get count(){const e=this.getAttribute("count");return null===e?void 0:Number(e)}set count(e){void 0===e?this.removeAttribute("count"):this.setAttribute("count",String(e))}get maxCount(){return Number(this.getAttribute("max-count")||99)}set maxCount(e){this.setAttribute("max-count",String(e))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}connectedCallback(){this.syncAttributes()}attributeChangedCallback(e,t,s){"count"!==e&&"max-count"!==e&&"badge-style"!==e||this.syncContent(),this.syncAttributes()}syncAttributes(){this.classList.add(g),this.setAttribute("aria-disabled",String(this.disabled)),this.syncEnum("variant",this.variant,v),this.syncEnum("size",this.size,E),this.syncEnum("style",this.badgeStyle,f),this.classList.toggle(`${g}--disabled`,this.disabled),this.syncContent()}syncContent(){"number"!==this.badgeStyle||void 0===this.count?"dot"===this.badgeStyle&&(this.textContent=""):this.textContent=this.count>this.maxCount?`${this.maxCount}+`:String(this.count)}syncEnum(e,t,s){s.forEach(e=>this.classList.remove(`${g}--${e}`)),s.includes(t)?this.classList.add(`${g}--${t}`):"style"===e&&this.classList.add(`${g}--text`)}}customElements.get("db-badge")||customElements.define("db-badge",DbBadge);const w={primary:"primary",secondary:"secondary",outline:"tertiary",ghost:"ghost"},y={s:"s",sm:"s",m:"m",md:"m",l:"l",lg:"l"};class DbBanner extends HTMLElement{static get observedAttributes(){return["title","description","icon","image","image-alt","actions","size","variant","background-image"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}parseActions(){const e=this.getAttribute("actions");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}getIconSize(e){return"s"===e?16:"l"===e?24:20}getActionIconSize(e){return"s"===e?16:"l"===e?20:18}resolveIconName(e){if(e)return e in{close:1,"info-filled":1}?e:void 0}createActionControl(e,t,s,i){const n=this.resolveIconName(e.icon),a=Boolean(e.iconOnly&&n);if(e.href){const t=document.createElement("a");return t.className=`designbase-wc-button designbase-wc-button--${s} designbase-wc-button--${i}`,a&&t.classList.add("designbase-wc-button--icon-only"),t.href=e.href,t.setAttribute("aria-label",e.text),a&&n?t.append(createDbIcon(n,this.getActionIconSize(i))):t.textContent=e.text,e.external&&(t.target="_blank",t.rel="noopener noreferrer"),t}const r=document.createElement("db-button");return r.setAttribute("variant",s),r.setAttribute("size",i),a?(r.setAttribute("icon-only",""),r.setAttribute("aria-label",e.text),n&&r.append(createDbIcon(n,this.getActionIconSize(i)))):r.textContent=e.text,(s=>{s.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-action",{bubbles:!0,composed:!0,detail:{index:t,action:e}}))})})(r),r}render(){const e=this.getAttribute("title")||"",t=this.getAttribute("description")||"",s=this.getAttribute("icon"),i=this.getAttribute("image"),n=this.getAttribute("image-alt")||e||"Banner image",a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"primary",o=this.getAttribute("background-image"),l=this.parseActions();if(this.className=`designbase-wc-banner designbase-wc-banner--${a} designbase-wc-banner--${r}`,this.replaceChildren(),"image"===r&&o){const e=document.createElement("div");e.className="designbase-wc-banner__background",e.style.backgroundImage=`url(${o})`,e.style.backgroundSize="cover",e.style.backgroundPosition="center",e.style.backgroundRepeat="no-repeat",this.append(e);const t=document.createElement("div");t.className="designbase-wc-banner__overlay",this.append(t)}const d=document.createElement("div");if(d.className="designbase-wc-banner__container",s){const e=document.createElement("div");e.className="designbase-wc-banner__icon",e.append(createDbIcon(s,this.getIconSize(a))),d.append(e)}if(i){const e=document.createElement("div");e.className="designbase-wc-banner__image";const t=document.createElement("img");t.src=i,t.alt=n,e.append(t),d.append(e)}const u=document.createElement("div");if(u.className="designbase-wc-banner__content",e){const t=document.createElement("h3");t.className="designbase-wc-banner__title",t.textContent=e,u.append(t)}if(t){const e=document.createElement("p");e.className="designbase-wc-banner__description",e.textContent=t,u.append(e)}if(d.append(u),l.length>0){const e=document.createElement("div");e.className="designbase-wc-banner__actions",l.forEach((t,s)=>{const i=w[t.variant||"primary"]||"primary",n=y[t.size||"sm"]||"s";e.append(this.createActionControl(t,s,i,n))}),d.append(e)}this.append(d)}}customElements.get("db-banner")||customElements.define("db-banner",DbBanner);const A=["circular","dots","bars","pulse","ripple"],_=["xs","s","m","l","xl"];class DbSpinner extends HTMLElement{static get observedAttributes(){return["type","size","color","speed","label","show-label"]}get type(){return this.getAttribute("type")||"circular"}set type(e){this.setAttribute("type",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get color(){return this.getAttribute("color")||""}set color(e){e?this.setAttribute("color",e):this.removeAttribute("color")}get speed(){return Number(this.getAttribute("speed")||1)}set speed(e){this.setAttribute("speed",String(e))}get label(){return this.getAttribute("label")||"로딩 중..."}set label(e){this.setAttribute("label",e)}get showLabel(){return this.hasAttribute("show-label")}set showLabel(e){this.toggleAttribute("show-label",e)}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){this.className=Array.from(this.classList).filter(e=>!e.startsWith("designbase-wc-spinner")).join(" "),this.classList.add("designbase-wc-spinner"),this.classList.add(`designbase-wc-spinner--${A.includes(this.type)?this.type:"circular"}`),this.classList.add(`designbase-wc-spinner--${_.includes(this.size)?this.size:"m"}`),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-busy","true"),this.showLabel&&this.setAttribute("aria-label",this.label),this.style.setProperty("--spinner-speed",`${this.speed}s`),this.color?this.style.setProperty("--spinner-color",this.color):this.style.removeProperty("--spinner-color"),this.innerHTML=`${this.renderSpinner()}${this.showLabel&&this.label?`<span class="designbase-wc-spinner__label" aria-hidden="true">${this.escape(this.label)}</span>`:""}`}renderSpinner(){switch(this.type){case"dots":return'<span class="designbase-wc-spinner__dots" aria-hidden="true"><span class="designbase-wc-spinner__dot"></span><span class="designbase-wc-spinner__dot"></span><span class="designbase-wc-spinner__dot"></span></span>';case"bars":return'<span class="designbase-wc-spinner__bars" aria-hidden="true"><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span><span class="designbase-wc-spinner__bar"></span></span>';case"pulse":return'<span class="designbase-wc-spinner__pulse" aria-hidden="true"></span>';case"ripple":return'<span class="designbase-wc-spinner__ripple" aria-hidden="true"><span class="designbase-wc-spinner__ripple-circle"></span><span class="designbase-wc-spinner__ripple-circle"></span></span>';default:return'<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>'}}escape(e){return e.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[e]||e))}}customElements.get("db-spinner")||customElements.define("db-spinner",DbSpinner);const C=["default","flat"],x=["s","m","l"];class DbCard extends HTMLElement{constructor(){super(...arguments),this.selectCheckbox=null,this.imageNode=null,this.handleClick=e=>{if(this.disabled||this.loading)return e.preventDefault(),void e.stopPropagation();this.clickable&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=e=>{!this.clickable||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click())},this.handleSelect=e=>{if(e?.stopPropagation(),this.disabled||this.loading||!this.selectable)return;const t=!this.selected;this.toggleAttribute("selected",t),this.selectCheckbox&&(t?this.selectCheckbox.setAttribute("checked",""):this.selectCheckbox.removeAttribute("checked")),this.dispatchEvent(new CustomEvent("db-select",{bubbles:!0,composed:!0,detail:{selected:t}}))}}static get observedAttributes(){return["variant","size","full-width","clickable","hoverable","selectable","selected","disabled","loading","image","image-alt"]}get variant(){return this.getAttribute("variant")||"default"}set variant(e){this.setAttribute("variant",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get clickable(){return this.hasAttribute("clickable")}set clickable(e){this.toggleAttribute("clickable",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get loading(){return this.hasAttribute("loading")}set loading(e){this.toggleAttribute("loading",e)}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(e){this.toggleAttribute("full-width",e)}get hoverable(){return this.hasAttribute("hoverable")}set hoverable(e){this.toggleAttribute("hoverable",e)}get selectable(){return this.hasAttribute("selectable")}set selectable(e){this.toggleAttribute("selectable",e)}get selected(){return this.hasAttribute("selected")}set selected(e){this.toggleAttribute("selected",e)}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.sync()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(e){this.isConnected&&(this.sync(),"selected"===e&&this.selectCheckbox&&(this.selected?this.selectCheckbox.setAttribute("checked",""):this.selectCheckbox.removeAttribute("checked")))}hasMediaSection(){return!!this.getAttribute("image")||null!==this.querySelector(':scope > .designbase-wc-card__thumbnail, :scope > .designbase-wc-card__media, :scope > [slot="media"], :scope > [slot="thumbnail"]')}hasFooterSection(){return null!==this.querySelector(':scope > .designbase-wc-card__footer, :scope > [slot="footer"]')}syncImageMedia(){const e=this.getAttribute("image"),t=this.querySelector(':scope > .designbase-wc-card__thumbnail, :scope > .designbase-wc-card__media, :scope > [slot="media"], :scope > [slot="thumbnail"]');if(!e)return void(this.imageNode&&(this.imageNode.remove(),this.imageNode=null));if(t&&t!==this.imageNode)return void(this.imageNode&&(this.imageNode.remove(),this.imageNode=null));if(!this.imageNode){this.imageNode=document.createElement("div"),this.imageNode.className="designbase-wc-card__media designbase-wc-card__thumbnail",this.imageNode.setAttribute("slot","media");const e=document.createElement("img");e.className="designbase-wc-card__thumbnail-image",this.imageNode.append(e);const t=this.querySelector(':scope > .designbase-wc-card__body, :scope > [slot="body"], :scope > .designbase-wc-card__footer, :scope > [slot="footer"]');t?this.insertBefore(this.imageNode,t):this.insertBefore(this.imageNode,this.firstChild)}const s=this.imageNode.querySelector("img");s&&(s.src=e,s.alt=this.getAttribute("image-alt")||"")}sync(){this.syncImageMedia(),this.syncAttributes(),this.syncOverlays()}syncOverlays(){const e=this.querySelector(":scope > .designbase-wc-card__loading-overlay"),t=this.querySelector(":scope > .designbase-wc-card__select-overlay");if(this.loading){if(!e){const e=document.createElement("div");e.className="designbase-wc-card__loading-overlay",e.setAttribute("aria-live","polite"),e.setAttribute("aria-busy","true");const t=document.createElement("div");t.className="designbase-wc-card__loading-spinner",e.append(t),this.append(e)}}else e?.remove();if(this.selectable)if(t)this.selectCheckbox&&(this.selected?this.selectCheckbox.setAttribute("checked",""):this.selectCheckbox.removeAttribute("checked"));else{const e=document.createElement("div");e.className="designbase-wc-card__select-overlay",e.addEventListener("click",e=>this.handleSelect(e));const t=document.createElement("db-checkbox");t.className="designbase-wc-card__select-checkbox",t.setAttribute("size","s"),t.setAttribute("has-label","false"),t.setAttribute("aria-label","카드 선택"),this.selected&&t.setAttribute("checked",""),t.addEventListener("click",e=>e.stopPropagation()),t.addEventListener("db-change",e=>{e.stopPropagation(),this.handleSelect()}),e.append(t),this.append(e),this.selectCheckbox=t}else t?.remove(),this.selectCheckbox=null}syncAttributes(){this.classList.add("designbase-wc-card"),this.setAttribute("aria-disabled",String(this.disabled||this.loading)),!this.clickable||this.disabled||this.loading?(this.removeAttribute("role"),this.removeAttribute("tabindex")):(this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")),C.forEach(e=>this.classList.remove(`designbase-wc-card--${e}`)),x.forEach(e=>this.classList.remove(`designbase-wc-card--${e}`)),this.classList.add(`designbase-wc-card--${C.includes(this.variant)?this.variant:"default"}`),this.classList.add(`designbase-wc-card--${x.includes(this.size)?this.size:"m"}`),this.classList.toggle("designbase-wc-card--full-width",this.hasAttribute("full-width")),this.classList.toggle("designbase-wc-card--clickable",this.clickable),this.classList.toggle("designbase-wc-card--hoverable",this.hasAttribute("hoverable")),this.classList.toggle("designbase-wc-card--selectable",this.hasAttribute("selectable")),this.classList.toggle("designbase-wc-card--selected",this.hasAttribute("selected")),this.classList.toggle("designbase-wc-card--disabled",this.disabled),this.classList.toggle("designbase-wc-card--loading",this.loading),this.classList.toggle("designbase-wc-card--with-media",this.hasMediaSection()),this.classList.toggle("designbase-wc-card--with-thumbnail",this.hasMediaSection()),this.classList.toggle("designbase-wc-card--with-footer",this.hasFooterSection())}}customElements.get("db-card")||customElements.define("db-card",DbCard);const k=["s","m","l"],S=["horizontal","vertical"],N=["default","pills"];class DbTabs extends HTMLElement{constructor(){super(...arguments),this.tabButtons=[],this.inactivePanels=document.createDocumentFragment(),this.isRendering=!1,this.handleListScroll=()=>{if(!this.list)return;const e=this.list.scrollWidth>this.list.clientWidth,t=this.list.scrollLeft+this.list.clientWidth>=this.list.scrollWidth-5;this.list.classList.toggle("designbase-wc-tabs__list--show-gradient",e&&!t&&"horizontal"===this.orientation)}}static get observedAttributes(){return["labels","items","active-index","selected-id","orientation","size","variant","full-width"]}get labels(){const e=this.tabItems.map(e=>e.label);return e.length?e:(this.getAttribute("labels")||"").split(",").map(e=>e.trim()).filter(Boolean)}set labels(e){this.setAttribute("labels",Array.isArray(e)?e.join(","):e)}get tabItems(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}get items(){return this.tabItems}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}set tabItems(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}get activeIndex(){const e=this.getAttribute("selected-id");if(e){const t=this.tabItems.findIndex((t,s)=>(t.id||String(s))===e);if(t>=0)return t}return Number(this.getAttribute("active-index")||0)}set activeIndex(e){this.setAttribute("active-index",String(e))}get orientation(){return this.getAttribute("orientation")||"horizontal"}set orientation(e){this.setAttribute("orientation",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get variant(){return this.getAttribute("variant")||"default"}set variant(e){this.setAttribute("variant",e)}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(e){this.toggleAttribute("full-width",Boolean(e))}connectedCallback(){this.render(),this.list?.addEventListener("scroll",this.handleListScroll,{passive:!0}),window.addEventListener("resize",this.handleListScroll),this.childObserver=new MutationObserver(e=>{if(this.isRendering)return;e.some(e=>Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.hasAttribute("slot")||void 0!==e.dataset.panelIndex)))&&this.render()}),this.childObserver.observe(this,{childList:!0})}disconnectedCallback(){this.list?.removeEventListener("scroll",this.handleListScroll),window.removeEventListener("resize",this.handleListScroll),this.childObserver?.disconnect()}attributeChangedCallback(){this.isConnected&&this.render()}collectPanelContent(){const e=new Map,register=(t,s)=>{if(!(t instanceof HTMLElement)||"SLOT"===t.tagName)return;e.has(s)||e.set(s,[]);const i=e.get(s);i.includes(t)||i.push(t)};return Array.from(this.children).forEach(e=>{const t=e.getAttribute("slot")?.match(/^panel-(\d+)$/);if(t)return void register(e,Number(t[1]));const s=e.dataset.panelIndex;void 0!==s&®ister(e,Number(s))}),this.panel?.querySelectorAll(":scope > .designbase-wc-tabs__panel-inner > [data-panel-index]").forEach(e=>{e instanceof HTMLElement&®ister(e,Number(e.dataset.panelIndex))}),Array.from(this.inactivePanels.children).forEach(e=>{e instanceof HTMLElement&&void 0!==e.dataset.panelIndex&®ister(e,Number(e.dataset.panelIndex))}),e}render(){this.isRendering=!0;const e=this.collectPanelContent(),t=this.labels,s=this.tabItems,i=Math.min(Math.max(this.activeIndex,0),Math.max(t.length-1,0)),n=k.includes(this.size)?this.size:"m",a=S.includes(this.orientation)?this.orientation:"horizontal",r=N.includes(this.variant)?this.variant:"default",o="default"===r;this.className=["designbase-wc-tabs",`designbase-wc-tabs--${a}`,`designbase-wc-tabs--${n}`,`designbase-wc-tabs--${r}`,this.fullWidth&&"designbase-wc-tabs--full-width"].filter(Boolean).join(" "),this.querySelectorAll(":scope > .designbase-wc-tabs__list, :scope > .designbase-wc-tabs__panel").forEach(e=>e.remove()),this.list=document.createElement("div"),this.list.className=["designbase-wc-tabs__list",`designbase-wc-tabs__list--${a}`,this.fullWidth&&"designbase-wc-tabs__list--full-width"].filter(Boolean).join(" "),this.list.setAttribute("role","tablist"),this.list.setAttribute("aria-orientation",a),this.list.setAttribute("aria-label","탭 목록"),this.tabButtons=[],t.forEach((e,t)=>{const a=s[t],r=Boolean(a?.disabled),o=t===i,l=document.createElement("button");if(l.type="button",l.className=["designbase-wc-tabs__tab",o&&"designbase-wc-tabs__tab--selected",r&&"designbase-wc-tabs__tab--disabled"].filter(Boolean).join(" "),l.setAttribute("role","tab"),l.setAttribute("aria-selected",String(o)),l.setAttribute("aria-controls",`panel-${t}`),l.id=`tab-${t}`,l.tabIndex=o?0:-1,l.disabled=r,a?.icon){const e=document.createElement("span");e.className="designbase-wc-tabs__tab-icon";const t="s"===n?16:"l"===n?20:18;e.append(createDbIcon(a.icon,t)),l.append(e)}const d=document.createElement("span");d.className="designbase-wc-tabs__tab-label",d.textContent=e,l.append(d),l.addEventListener("click",()=>this.select(t)),l.addEventListener("keydown",e=>this.handleKeyDown(e,t)),this.list?.append(l),this.tabButtons.push(l)}),o?(this.indicator=document.createElement("span"),this.indicator.className="designbase-wc-tabs__indicator designbase-wc-tabs__indicator--no-transition",this.list.append(this.indicator),requestAnimationFrame(()=>this.updateIndicator(!1))):this.indicator=void 0,this.panel=document.createElement("div"),this.panel.className="designbase-wc-tabs__panel",this.panel.setAttribute("role","tabpanel"),this.panel.id=`panel-${i}`,this.panel.setAttribute("aria-labelledby",`tab-${i}`),this.panel.tabIndex=0;const l=document.createElement("div");l.className="designbase-wc-tabs__panel-inner",e.forEach((e,t)=>{e.forEach(e=>{e.removeAttribute("slot"),e.dataset.panelIndex=String(t),t===i?l.append(e):this.inactivePanels.append(e)})}),this.panel.append(l),this.append(this.list,this.panel),requestAnimationFrame(()=>{this.handleListScroll(),o&&this.updateIndicator(!1)}),this.isRendering=!1}select(e){const t=this.labels,s=this.tabItems;if(!t[e]||s[e]?.disabled)return;this.activeIndex=e;const i=s[e]?.id||String(e);this.setAttribute("selected-id",i),this.dispatchEvent(new CustomEvent("db-change",{detail:{index:e,label:t[e],id:i},bubbles:!0,composed:!0})),this.render()}handleKeyDown(e,t){const s=this.labels,i=this.tabItems;let n=t;if("ArrowRight"===e.key||"ArrowDown"===e.key)n=(t+1)%s.length;else if("ArrowLeft"===e.key||"ArrowUp"===e.key)n=(t-1+s.length)%s.length;else if("Home"===e.key)n=0;else{if("End"!==e.key)return"Enter"===e.key||" "===e.key?(e.preventDefault(),void this.select(t)):void 0;n=s.length-1}e.preventDefault();let a=0;for(;i[n]?.disabled&&a<s.length;)n="ArrowLeft"===e.key||"ArrowUp"===e.key?(n-1+s.length)%s.length:(n+1)%s.length,a+=1;this.tabButtons[n]?.focus()}updateIndicator(e=!1){const t=this.list?.querySelector(".designbase-wc-tabs__tab--selected");if(!t||!this.indicator)return;const s="vertical"===this.orientation;this.indicator.classList.toggle("designbase-wc-tabs__indicator--no-transition",!e),this.indicator.classList.add(s?"designbase-wc-tabs__indicator--vertical":"designbase-wc-tabs__indicator--horizontal"),this.indicator.classList.add("designbase-wc-tabs__indicator--ready"),s?(this.indicator.style.width="2px",this.indicator.style.height=`${t.offsetHeight}px`,this.indicator.style.transform=`translate3d(0, ${t.offsetTop}px, 0)`):(this.indicator.style.width=`${t.offsetWidth}px`,this.indicator.style.height="2px",this.indicator.style.transform=`translate3d(${t.offsetLeft}px, 0, 0)`)}}customElements.get("db-tabs")||customElements.define("db-tabs",DbTabs);const $=["s","m","l","xl","full"],I=["default","tabs","segment"],D=["s","m","l"];class DbModal extends HTMLElement{constructor(){super(...arguments),this.titleId=`db-modal-title-${Math.random().toString(36).slice(2,9)}`,this.isMounted=!1,this.internalTabId="",this.internalSegment="",this.exitTimerId=null,this.handleDocumentKeyDown=e=>{"Escape"===e.key&&this.open&&"false"!==this.getAttribute("close-on-escape")&&(e.preventDefault(),this.close())}}static get observedAttributes(){return["open","title","size","header-variant","tabs","segments","selected-tab-id","default-selected-tab-id","segment-value","default-segment-value","nav-size","segment-full-width","close-on-outside-click","close-on-escape","show-close-button"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open","true"):this.removeAttribute("open")}connectedCallback(){this.classList.add("designbase-wc-modal-host"),document.addEventListener("keydown",this.handleDocumentKeyDown),this.childObserver=new MutationObserver(()=>{this.open&&this.render()}),this.childObserver.observe(this,{childList:!0}),this.syncOpenState()}disconnectedCallback(){this.childObserver?.disconnect(),document.removeEventListener("keydown",this.handleDocumentKeyDown),this.exitTimerId&&clearTimeout(this.exitTimerId),this.teardown()}attributeChangedCallback(e){if(this.isConnected)if("open"!==e){if("selected-tab-id"===e||"segment-value"===e){const e=this.getClassifiedChildren();return this.renderBodyContent(e.body),void this.renderHeader(e.header)}this.render(),this.isMounted&&this.syncVisibility()}else this.syncOpenState()}resolvedSize(){return $.includes(this.size)?this.size:"m"}get size(){return this.getAttribute("size")||"m"}set size(e){e?this.setAttribute("size",e):this.removeAttribute("size")}resolvedHeaderVariant(){const e=this.getAttribute("header-variant")||"default";return I.includes(e)?e:"default"}parsedTabs(){const e=this.getAttribute("tabs");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}parsedSegments(){const e=this.getAttribute("segments");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}usesIntegratedNav(){const e=this.resolvedHeaderVariant();return"tabs"===e&&this.parsedTabs().length>0||"segment"===e&&this.parsedSegments().length>0}closeIconSize(){const e=this.resolvedSize();return"s"===e?16:"l"===e?20:"xl"===e?24:18}activeTabId(){return this.getAttribute("selected-tab-id")||this.internalTabId||this.getAttribute("default-selected-tab-id")||this.parsedTabs()[0]?.id||""}activeSegmentValue(){return this.getAttribute("segment-value")||this.internalSegment||this.getAttribute("default-segment-value")||this.parsedSegments()[0]?.value||""}collectUserChildren(){return Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal"))}classifyChildren(e){const isPart=(e,t,s)=>e.classList.contains(s)||e.getAttribute("data-modal-part")===t,t=e.filter(e=>isPart(e,"header","designbase-wc-modal__header")),s=e.filter(e=>isPart(e,"footer","designbase-wc-modal__footer")||"footer"===e.getAttribute("slot")),i=e.filter(e=>isPart(e,"body","designbase-wc-modal__body")),n=e.filter(e=>!t.includes(e)&&!s.includes(e)&&!i.includes(e));return{header:t,body:[...i,...n],footer:s}}getClassifiedChildren(){const e=this.classifyChildren(this.collectUserChildren());if(e.header.length||e.body.length||e.footer.length)return e;return{header:Array.from(this.headerEl?.children||[]).filter(e=>e!==this.closeButton&&!e.classList.contains("designbase-wc-modal__header-row")&&("header"===e.getAttribute("data-modal-part")||e.classList.contains("designbase-wc-modal__header"))),body:this.collectContentParts("body"),footer:this.collectContentParts("footer")}}isBodyPart(e){return e.classList.contains("designbase-wc-modal__body")||"body"===e.getAttribute("data-modal-part")}isFooterPart(e){return e.classList.contains("designbase-wc-modal__footer")||"footer"===e.getAttribute("data-modal-part")||"footer"===e.getAttribute("slot")}collectContentParts(e){if(!this.contentEl)return[];const t=Array.from(this.contentEl.children).filter(t=>"body"===e?this.isBodyPart(t):this.isFooterPart(t));return t.length>0?t:Array.from(this.children).filter(t=>"body"===e?this.isBodyPart(t):this.isFooterPart(t))}placeContentParts(e,t){this.contentEl&&t.forEach(t=>{if(t.parentElement!==this.contentEl){if("body"===e){const e=this.contentEl.querySelector(':scope > .designbase-wc-modal__footer, :scope > [data-modal-part="footer"]')||null;return void this.contentEl.insertBefore(t,e)}this.contentEl.append(t)}})}restorePartsToHost(){this.contentEl&&Array.from(this.contentEl.children).filter(e=>!e.classList.contains("designbase-wc-modal__integrated-content")&&!e.hasAttribute("data-wc-internal")).forEach(e=>{e.parentElement!==this&&this.append(e)})}bindFooterActions(){if(!this.contentEl||"true"===this.contentEl.dataset.modalActionsBound)return;this.contentEl.dataset.modalActionsBound="true";const handleClose=e=>{const t=e.target?.closest("[data-modal-close]");t&&this.contentEl?.contains(t)&&this.close()};this.contentEl.addEventListener("click",handleClose),this.contentEl.addEventListener("db-click",handleClose)}ensureStructure(){this.root||(this.root=document.createElement("div"),this.root.className="designbase-wc-modal__overlay",this.root.setAttribute("data-wc-internal",""),this.root.addEventListener("click",e=>{e.target===this.root&&"false"!==this.getAttribute("close-on-outside-click")&&this.close()}),this.panel=document.createElement("div"),this.panel.className="designbase-wc-modal",this.panel.setAttribute("role","dialog"),this.panel.setAttribute("aria-modal","true"),this.panel.addEventListener("click",e=>e.stopPropagation()),this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-modal__header",this.headerContentEl=document.createElement("div"),this.headerContentEl.className="designbase-wc-modal__header-content",this.titleEl=document.createElement("h2"),this.titleEl.className="designbase-wc-modal__title",this.titleEl.id=this.titleId,this.closeButton=document.createElement("button"),this.closeButton.type="button",this.closeButton.className="designbase-wc-modal__close-button",this.closeButton.setAttribute("aria-label","모달 닫기"),this.closeButton.addEventListener("click",()=>this.close()),this.navEl=document.createElement("div"),this.navEl.className="designbase-wc-modal__header-nav",this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-modal__content",this.panel.append(this.headerEl,this.contentEl),this.root.append(this.panel))}renderCloseButton(){if(!this.closeButton)return;const e=this.closeIconSize();this.closeButton.replaceChildren(createDbIcon("close",e)),this.closeButton.hidden="false"===this.getAttribute("show-close-button")}renderDefaultHeader(e){if(!(this.headerEl&&this.headerContentEl&&this.titleEl&&this.closeButton))return;if(this.headerEl.className="designbase-wc-modal__header",this.headerEl.replaceChildren(),e.length>0)return e.forEach(e=>this.headerEl.append(e)),void("false"!==this.getAttribute("show-close-button")&&this.headerEl.append(this.closeButton));const t=this.getAttribute("title")||"";this.titleEl.textContent=t,this.titleEl.hidden=!t,this.headerContentEl.replaceChildren(),t&&this.headerContentEl.append(this.titleEl),this.renderCloseButton(),this.headerEl.append(this.headerContentEl),"false"!==this.getAttribute("show-close-button")&&this.headerEl.append(this.closeButton),this.panel&&(t?this.panel.setAttribute("aria-labelledby",this.titleId):this.panel.removeAttribute("aria-labelledby"))}renderNavHeader(){if(!(this.headerEl&&this.headerContentEl&&this.titleEl&&this.closeButton&&this.navEl))return;const e=this.resolvedHeaderVariant(),t=this.parsedTabs(),s=this.parsedSegments(),i=D.includes(this.getAttribute("nav-size")||"m")?this.getAttribute("nav-size")||"m":"s";this.headerEl.className=["designbase-wc-modal__header","tabs"===e&&"designbase-wc-modal__header--tabs","segment"===e&&"designbase-wc-modal__header--segment"].filter(Boolean).join(" ");const n=this.getAttribute("title")||"";this.titleEl.textContent=n,this.titleEl.hidden=!n,this.headerContentEl.replaceChildren(),n&&this.headerContentEl.append(this.titleEl),this.renderCloseButton();const a=document.createElement("div");if(a.className="designbase-wc-modal__header-row",a.append(this.headerContentEl),"false"!==this.getAttribute("show-close-button")&&a.append(this.closeButton),this.headerEl.replaceChildren(a),this.navEl.replaceChildren(),"tabs"===e&&t.length>0){const e=document.createElement("db-tabs");e.setAttribute("size",i),e.setAttribute("items",JSON.stringify(t.map(e=>({id:e.id,label:e.label,disabled:e.disabled})))),e.setAttribute("selected-id",this.activeTabId()),e.addEventListener("db-change",e=>{const t=e.detail?.id;t&&(this.hasAttribute("selected-tab-id")||(this.internalTabId=t),this.dispatchEvent(new CustomEvent("db-tab-change",{detail:{tabId:t},bubbles:!0,composed:!0})),this.renderBodyContent(this.getClassifiedChildren().body))}),this.tabsEl=e,this.navEl.append(e),this.headerEl.append(this.navEl)}if("segment"===e&&s.length>0){const e=document.createElement("db-segment-control");e.setAttribute("size",i),e.setAttribute("options",JSON.stringify(s.map(e=>({value:e.value,label:e.label,disabled:e.disabled})))),e.setAttribute("value",this.activeSegmentValue()),"false"!==this.getAttribute("segment-full-width")&&e.setAttribute("full-width",""),e.addEventListener("db-change",e=>{const t=e.detail?.value;t&&(this.hasAttribute("segment-value")||(this.internalSegment=t),this.dispatchEvent(new CustomEvent("db-segment-change",{detail:{value:t},bubbles:!0,composed:!0})),this.renderBodyContent(this.getClassifiedChildren().body))}),this.segmentEl=e,this.navEl.append(e),this.headerEl.append(this.navEl)}this.panel&&(n?this.panel.setAttribute("aria-labelledby",this.titleId):this.panel.removeAttribute("aria-labelledby"))}renderHeader(e){if(!this.headerEl)return;if(e.length>0)return this.headerEl.hidden=!1,void this.renderDefaultHeader(e);if(this.usesIntegratedNav())return this.headerEl.hidden=!1,void this.renderNavHeader();this.getAttribute("title")||""?(this.headerEl.hidden=!1,this.renderDefaultHeader([])):this.headerEl.hidden=!0}renderBodyContent(e=[]){if(!this.contentEl)return;let t=this.contentEl.querySelector(":scope > .designbase-wc-modal__integrated-content"),s="";if(this.usesIntegratedNav()){const e=this.resolvedHeaderVariant();if("tabs"===e){const e=this.parsedTabs().find(e=>e.id===this.activeTabId());s=e?.content||""}if("segment"===e){const e=this.parsedSegments().find(e=>e.value===this.activeSegmentValue());s=e?.content||""}}s?(t||(t=document.createElement("div"),t.className="designbase-wc-modal__integrated-content designbase-wc-modal__body",this.contentEl.insertBefore(t,this.contentEl.firstChild)),t.textContent=s):t?.remove();const i=e.filter(e=>this.isBodyPart(e)),n=e.filter(e=>!this.isBodyPart(e)&&!this.isFooterPart(e));this.placeContentParts("body",i.length>0?i:n)}renderFooter(e){if(!this.contentEl)return;const t=e.filter(e=>this.isFooterPart(e)),s=e.filter(e=>!this.isFooterPart(e)&&!this.isBodyPart(e)),i=t.length>0?t:s;this.placeContentParts("footer",i),i.forEach(e=>{e.hidden=!1}),this.bindFooterActions()}render(){this.ensureStructure();const{header:e,body:t,footer:s}=this.getClassifiedChildren();$.forEach(e=>this.panel?.classList.remove(`designbase-wc-modal--${e}`)),this.panel?.classList.add(`designbase-wc-modal--${this.resolvedSize()}`),this.renderHeader(e),this.renderBodyContent(t),this.renderFooter(s)}syncVisibility(){if(this.root&&this.panel){if(this.open)return this.root.setAttribute("data-state","entering"),this.panel.setAttribute("data-state","entering"),void requestAnimationFrame(()=>{this.panel,requestAnimationFrame(()=>{this.open&&this.root&&this.panel&&(this.root.setAttribute("data-state","entered"),this.panel.setAttribute("data-state","entered"))})});this.root.setAttribute("data-state","exiting"),this.panel.setAttribute("data-state","exiting")}}syncOpenState(){if(this.open)return this.render(),this.root&&!this.root.isConnected&&document.body.append(this.root),document.body.style.overflow="hidden",this.isMounted=!0,void this.syncVisibility();this.isMounted&&(this.syncVisibility(),document.body.style.overflow="",this.exitTimerId&&clearTimeout(this.exitTimerId),this.exitTimerId=window.setTimeout(()=>{this.open||this.teardown()},200))}teardown(){this.restorePartsToHost(),this.root?.remove(),this.isMounted=!1,document.body.style.overflow=""}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}}customElements.get("db-modal")||customElements.define("db-modal",DbModal);const L=["s","m","l"],M=["bottom-left","bottom-right","top-left","top-right"],T=["primary","secondary","tertiary","danger","ghost"];class DbDropdown extends HTMLElement{constructor(){super(...arguments),this.focusedIndex=-1,this.onTriggerActivate=null,this.lastTriggerSignature="",this.handleTriggerKeyDown=e=>{if(("Enter"===e.key||" "===e.key||"ArrowDown"===e.key)&&!this.open)return e.preventDefault(),this.open=!0,requestAnimationFrame(()=>this.focusItem(0)),void this.render();"Escape"===e.key&&this.open&&(e.preventDefault(),this.open=!1,this.render())},this.handleDocumentKeyDown=e=>{if(!this.open)return;if("Escape"===e.key)return e.preventDefault(),this.open=!1,this.render(),void this.triggerWrap?.querySelector("[aria-haspopup]")?.focus();const t=this.enabledItems();if(!t.length)return;const s=t.findIndex(e=>this.parsedItems.indexOf(e)===this.focusedIndex);switch(e.key){case"ArrowDown":e.preventDefault(),this.focusItem(s<0?0:this.parsedItems.indexOf(t[(s+1)%t.length]));break;case"ArrowUp":e.preventDefault(),this.focusItem(s<0?0:this.parsedItems.indexOf(t[(s-1+t.length)%t.length]));break;case"Home":e.preventDefault(),this.focusItem(this.parsedItems.indexOf(t[0]));break;case"End":e.preventDefault(),this.focusItem(this.parsedItems.indexOf(t[t.length-1]));break;case"Enter":case" ":{e.preventDefault();const t=this.parsedItems[this.focusedIndex];!t||t.divider||t.disabled||this.selectItem(t);break}}},this.handleDocumentMouseDown=e=>{this.open&&(this.contains(e.target)||(this.open=!1,this.render()))}}static get observedAttributes(){return["options","items","placeholder","label","value","size","placement","full-width","disabled","open","trigger-variant","trigger-icon","icon-only"]}get parsedItems(){const e=this.getAttribute("items");if(e)try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return(this.getAttribute("options")||"").split(",").map(e=>e.trim()).filter(Boolean).map((e,t)=>({id:`option-${t}`,label:e}))}get options(){return this.parsedItems.map(e=>e.label||e.id)}set options(e){this.setAttribute("options",Array.isArray(e)?e.join(","):e)}get items(){return this.parsedItems}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}get value(){return this.getAttribute("value")||""}set value(e){e?this.setAttribute("value",e):this.removeAttribute("value")}get open(){return this.hasAttribute("open")}set open(e){const t=this.open;this.toggleAttribute("open",e),t!==e&&this.dispatchEvent(new CustomEvent("db-open",{detail:{open:e},bubbles:!0,composed:!0}))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get placement(){return this.getAttribute("placement")||"bottom-left"}set placement(e){this.setAttribute("placement",e)}get placeholder(){return this.getAttribute("placeholder")||""}set placeholder(e){e?this.setAttribute("placeholder",e):this.removeAttribute("placeholder")}get label(){return this.getAttribute("label")||""}set label(e){e?this.setAttribute("label",e):this.removeAttribute("label")}get fullWidth(){return this.hasAttribute("full-width")}set fullWidth(e){this.toggleAttribute("full-width",e)}connectedCallback(){requestAnimationFrame(()=>this.render()),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown),this.unbindTrigger()}attributeChangedCallback(e){this.isConnected&&("open"!==e||this.open||(this.focusedIndex=-1),this.render())}resolvedSize(){return L.includes(this.size)?this.size:"m"}resolvedPlacement(){return M.includes(this.placement)?this.placement:"bottom-left"}menuItemIconSize(){const e=this.resolvedSize();return"s"===e?14:"l"===e?18:16}triggerLabel(){return this.label?this.label:this.placeholder?this.placeholder:this.value?this.value:"메뉴"}enabledItems(){return this.parsedItems.filter(e=>!e.disabled&&!e.divider)}collectTriggerChildren(){const isInternalNode=e=>e.hasAttribute("data-wc-internal")||e===this.triggerWrap||e===this.menu||e===this.defaultTrigger,e=Array.from(this.children).filter(e=>!isInternalNode(e));return e.length>0?e:Array.from(this.triggerWrap?.children||[]).filter(e=>!isInternalNode(e))}hasCustomTrigger(){return this.collectTriggerChildren().length>0}bindTrigger(){this.triggerWrap&&(this.unbindTrigger(),this.onTriggerActivate=e=>{this.disabled||(e.preventDefault(),e.stopPropagation(),this.toggleOpen())},this.triggerWrap.addEventListener("click",this.onTriggerActivate),this.triggerWrap.addEventListener("keydown",this.handleTriggerKeyDown))}unbindTrigger(){this.triggerWrap&&this.onTriggerActivate&&this.triggerWrap.removeEventListener("click",this.onTriggerActivate),this.triggerWrap&&this.triggerWrap.removeEventListener("keydown",this.handleTriggerKeyDown),this.onTriggerActivate=null}toggleOpen(){this.disabled||(this.open=!this.open,this.open&&requestAnimationFrame(()=>this.focusItem(0)),this.render())}triggerSignature(){return[this.resolvedSize(),this.getAttribute("trigger-variant")||"tertiary",this.hasAttribute("icon-only")?"1":"0",this.getAttribute("trigger-icon")||"",this.fullWidth?"1":"0"].join("|")}renderDefaultTrigger(){const e=this.resolvedSize(),t=this.getAttribute("trigger-variant")||"tertiary",s=T.includes(t)?t:"tertiary",i=this.hasAttribute("icon-only"),n=this.getAttribute("trigger-icon"),a=document.createElement("db-button");if(a.setAttribute("type","button"),a.setAttribute("variant",s),a.setAttribute("size",e),a.className="designbase-wc-dropdown__trigger",a.setAttribute("aria-haspopup","menu"),a.setAttribute("aria-label",this.triggerLabel()),this.fullWidth&&a.setAttribute("full-width",""),i)a.setAttribute("icon-only",""),a.setAttribute("start-icon",n&&isDbIconName(n)?n:"edit"),a.removeAttribute("end-icon");else{a.removeAttribute("icon-only"),n&&isDbIconName(n)?a.setAttribute("start-icon",n):a.removeAttribute("start-icon");const e=document.createElement("span");e.className="designbase-wc-dropdown__trigger-label",e.textContent=this.triggerLabel(),a.append(e),a.setAttribute("end-icon","chevron-down")}return a}syncDefaultTriggerState(e){e.setAttribute("aria-expanded",String(this.open)),e.setAttribute("aria-label",this.triggerLabel()),e.classList.toggle("designbase-wc-dropdown__trigger--open",this.open),this.disabled?e.setAttribute("disabled",""):e.removeAttribute("disabled");const t=e.querySelector(".designbase-wc-dropdown__trigger-label");t&&(t.textContent=this.triggerLabel())}ensureStructure(){this.triggerWrap||(this.triggerWrap=document.createElement("div"),this.triggerWrap.className="designbase-wc-dropdown__trigger-wrap",this.triggerWrap.setAttribute("data-wc-internal","")),this.menu||(this.menu=document.createElement("div"),this.menu.className="designbase-wc-dropdown__menu",this.menu.setAttribute("data-wc-internal",""),this.menu.setAttribute("role","menu")),this.contains(this.triggerWrap)||this.append(this.triggerWrap),this.triggerWrap.contains(this.menu)||this.triggerWrap.append(this.menu),Array.from(this.children).forEach(e=>{e===this.triggerWrap||e.hasAttribute("data-wc-internal")||this.triggerWrap.insertBefore(e,this.menu)})}renderTrigger(){const e=this.collectTriggerChildren();if(e.length>0){this.defaultTrigger?.remove(),this.defaultTrigger=void 0;Array.from(this.triggerWrap.children).filter(e=>e!==this.menu&&e!==this.defaultTrigger).forEach(e=>e.remove()),e.forEach(e=>{e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded",String(this.open)),e.classList.toggle("designbase-wc-dropdown__trigger--open",this.open),this.triggerWrap.insertBefore(e,this.menu||null)})}else{Array.from(this.triggerWrap.children).filter(e=>e!==this.menu&&e!==this.defaultTrigger).forEach(e=>e.remove()),this.defaultTrigger&&this.triggerSignature()===this.lastTriggerSignature||(this.defaultTrigger?.remove(),this.defaultTrigger=this.renderDefaultTrigger(),this.lastTriggerSignature=this.triggerSignature(),this.triggerWrap.insertBefore(this.defaultTrigger,this.menu||null)),this.syncDefaultTriggerState(this.defaultTrigger)}this.bindTrigger()}renderMenu(){const e=this.resolvedPlacement();this.menu.className=`designbase-wc-dropdown__menu designbase-wc-dropdown__menu--${e}${this.open?" designbase-wc-dropdown__menu--open":""}`,this.menu.setAttribute("aria-hidden",String(!this.open)),this.menu.setAttribute("aria-label",this.triggerLabel()),this.menu.replaceChildren();const t=this.menuItemIconSize();this.parsedItems.forEach((e,s)=>{if(e.divider){const e=document.createElement("div");return e.className="designbase-wc-dropdown__divider",e.setAttribute("role","separator"),void this.menu?.append(e)}e.id||e.label||String(s);const i=e.label||e.id,n=Boolean(e.disabled||this.disabled),a=this.focusedIndex===s,r=document.createElement("button");if(r.type="button",r.className=["designbase-wc-dropdown__item",n&&"designbase-wc-dropdown__item--disabled",a&&"designbase-wc-dropdown__item--focused"].filter(Boolean).join(" "),r.setAttribute("role","menuitem"),r.disabled=n,r.tabIndex=a?0:-1,r.dataset.index=String(s),e.icon){const s=createDbIcon(e.icon,t);s.classList.add("designbase-wc-dropdown__item-icon"),r.append(s)}const o=document.createElement("span");o.className="designbase-wc-dropdown__item-label",o.textContent=i,r.append(o),r.addEventListener("click",t=>{t.stopPropagation(),this.selectItem(e)}),this.menu?.append(r)})}render(){const e=this.resolvedSize();this.className=["designbase-wc-dropdown",`designbase-wc-dropdown--${e}`,this.open&&"designbase-wc-dropdown--open",this.fullWidth&&"designbase-wc-dropdown--full-width",this.disabled&&"designbase-wc-dropdown--disabled"].filter(Boolean).join(" "),this.ensureStructure(),this.renderTrigger(),this.renderMenu()}selectItem(e){e.disabled||e.divider||(this.open=!1,this.focusedIndex=-1,this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e.label||e.id,id:e.id,item:e},bubbles:!0,composed:!0})),this.render(),this.triggerWrap?.querySelector("[aria-haspopup]")?.focus())}focusItem(e){const t=this.enabledItems();if(!t.length)return;const s=t[Math.max(0,Math.min(e,t.length-1))],i=this.parsedItems.indexOf(s);this.focusedIndex=i;Array.from(this.menu?.querySelectorAll(".designbase-wc-dropdown__item")||[]).forEach(e=>{const t=Number(e.dataset.index)===i;e.classList.toggle("designbase-wc-dropdown__item--focused",t),e.tabIndex=t?0:-1,t&&e.focus()})}}customElements.get("db-dropdown")||customElements.define("db-dropdown",DbDropdown);const z=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],B=["s","m","l"],P=["default","primary","success","warning","danger","info"],F=-10;class DbTooltip extends HTMLElement{constructor(){super(...arguments),this.tooltipId=`db-tooltip-${Math.random().toString(36).slice(2,9)}`,this.visible=!1,this.handleShow=()=>{this.disabled||this.alwaysShow||(this.clearTimers(),this.showTimer=setTimeout(()=>this.setVisible(!0),Math.max(0,this.delay)))},this.handleHide=()=>{this.alwaysShow||(this.clearTimers(),this.hideTimer=setTimeout(()=>this.setVisible(!1),Math.max(0,this.hideDelay)))},this.handleKeyDown=e=>{"Escape"===e.key&&(this.clearTimers(),this.setVisible(!1))},this.handleReposition=()=>{(this.visible||this.alwaysShow)&&(this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.repositionRaf=requestAnimationFrame(()=>this.calculatePosition()))}}static get observedAttributes(){return["content","position","size","variant","disabled","always-show","delay","hide-delay","max-width","show-arrow"]}get content(){return this.getAttribute("content")||""}set content(e){this.setAttribute("content",e)}get position(){return this.getAttribute("position")||"top"}set position(e){this.setAttribute("position",e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}get variant(){return this.getAttribute("variant")||"default"}set variant(e){this.setAttribute("variant",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get alwaysShow(){return this.hasAttribute("always-show")}set alwaysShow(e){this.toggleAttribute("always-show",e)}get delay(){return Number(this.getAttribute("delay")??"200")}get hideDelay(){return Number(this.getAttribute("hide-delay")??"80")}get maxWidth(){return Number(this.getAttribute("max-width")??"240")}get showArrow(){return"false"!==this.getAttribute("show-arrow")}connectedCallback(){this.render(),this.childObserver=new MutationObserver(()=>this.render()),this.childObserver.observe(this,{childList:!0}),window.addEventListener("scroll",this.handleReposition,!0),window.addEventListener("resize",this.handleReposition)}disconnectedCallback(){this.childObserver?.disconnect(),this.clearTimers(),this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.enterRaf&&cancelAnimationFrame(this.enterRaf),this.removalTimer&&clearTimeout(this.removalTimer),window.removeEventListener("scroll",this.handleReposition,!0),window.removeEventListener("resize",this.handleReposition),this.tooltip?.remove(),this.tooltip=void 0}attributeChangedCallback(){this.isConnected&&(this.render(),this.alwaysShow?this.setVisible(!0):this.visible||this.removeTooltip())}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=void 0,this.hideTimer=void 0}groupOf(e){return e.startsWith("top")?"top":e.startsWith("bottom")?"bottom":e.startsWith("left")?"left":"right"}resolvedPosition(){return z.includes(this.position)?this.position:"top"}collectTriggerChildren(){const isInternalNode=e=>e.hasAttribute("data-wc-internal")||e===this.trigger,e=Array.from(this.children).filter(e=>!isInternalNode(e));return e.length>0?e:Array.from(this.trigger?.children||[])}ensureTrigger(){this.trigger||(this.trigger=document.createElement("span"),this.trigger.className="designbase-wc-tooltip__trigger",this.trigger.setAttribute("data-wc-internal",""),this.trigger.tabIndex=0,this.trigger.addEventListener("mouseenter",this.handleShow),this.trigger.addEventListener("mouseleave",this.handleHide),this.trigger.addEventListener("focus",this.handleShow),this.trigger.addEventListener("blur",this.handleHide),this.trigger.addEventListener("keydown",this.handleKeyDown)),this.trigger.parentElement!==this&&this.append(this.trigger)}mountTriggerChildren(e){this.trigger&&e.forEach(e=>{e.parentElement!==this.trigger&&this.trigger.append(e)})}render(){this.ensureTrigger(),this.mountTriggerChildren(this.collectTriggerChildren()),this.alwaysShow&&this.setVisible(!0)}ensureTooltip(){this.tooltip||(this.tooltip=document.createElement("div"),this.tooltip.className="designbase-wc-tooltip",this.tooltip.setAttribute("data-wc-internal",""),this.tooltip.setAttribute("role","tooltip"),this.tooltip.id=this.tooltipId,this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-tooltip__content",this.arrow=document.createElement("div"),this.arrow.className="designbase-wc-tooltip__arrow",this.tooltip.append(this.contentEl,this.arrow),document.body.append(this.tooltip))}syncTooltipClasses(e=this.visible||this.alwaysShow){if(!this.tooltip||!this.arrow)return;const t=this.resolvedPosition(),s=B.includes(this.size)?this.size:"m",i=P.includes(this.variant)?this.variant:"default";this.tooltip.className=["designbase-wc-tooltip",`designbase-wc-tooltip--${s}`,`designbase-wc-tooltip--${i}`,`designbase-wc-tooltip--${t}`,e&&"designbase-wc-tooltip--visible",this.disabled&&"designbase-wc-tooltip--disabled"].filter(Boolean).join(" "),this.arrow.className=`designbase-wc-tooltip__arrow designbase-wc-tooltip__arrow--${t}`,this.arrow.hidden=!this.showArrow,this.tooltip.setAttribute("data-placement-group",this.groupOf(t)),this.tooltip.setAttribute("aria-hidden",String(!e)),this.tooltip.style.maxWidth=`${this.maxWidth}px`,this.tooltip.style.zIndex="9999",this.tooltip.style.pointerEvents="none",this.contentEl&&(this.contentEl.textContent=this.content)}calculatePosition(){if(!this.trigger||!this.tooltip||!this.arrow)return;const e=this.resolvedPosition(),t=this.trigger.getBoundingClientRect(),s=this.tooltip.offsetWidth,i=this.tooltip.offsetHeight;let n=0,a=0,r=0,o=0;switch(e){case"top":n=t.top-i-8,a=t.left+t.width/2-s/2,r=i-2,o=s/2-6;break;case"top-start":n=t.top-i-8,a=t.left,r=i-2,o=8;break;case"top-end":n=t.top-i-8,a=t.right-s,r=i-2,o=s-8-6;break;case"bottom":n=t.bottom+8,a=t.left+t.width/2-s/2,r=F,o=s/2-6;break;case"bottom-start":n=t.bottom+8,a=t.left,r=F,o=8;break;case"bottom-end":n=t.bottom+8,a=t.right-s,r=F,o=s-8-6;break;case"left":n=t.top+t.height/2-i/2,a=t.left-s-8,r=i/2-6,o=s-2;break;case"left-start":n=t.top,a=t.left-s-8,r=8,o=s-2;break;case"left-end":n=t.bottom-i,a=t.left-s-8,r=i-8-6,o=s-2;break;case"right":n=t.top+t.height/2-i/2,a=t.right+8,r=i/2-6,o=F;break;case"right-start":n=t.top,a=t.right+8,r=8,o=F;break;case"right-end":n=t.bottom-i,a=t.right+8,r=i-8-6,o=F}const l=window.innerWidth,d=window.innerHeight;a<8&&(a=8),a+s>l-8&&(a=l-s-8),n<8&&(n=8),n+i>d-8&&(n=d-i-8);const u=this.groupOf(e);if("top"===u||"bottom"===u){const e=t.left+t.width/2-a-6;o=Math.min(s-8-6,Math.max(8,e))}else{const e=t.top+t.height/2-n-6;r=Math.min(i-8-6,Math.max(8,e))}this.tooltip.style.position="fixed",this.tooltip.style.top=`${n}px`,this.tooltip.style.left=`${a}px`,this.arrow.style.position="absolute",this.arrow.style.top=`${r}px`,this.arrow.style.left=`${o}px`}setVisible(e){if(!this.disabled||!e){if(this.visible=e,!e&&!this.alwaysShow)return this.hideTooltip(),void this.trigger?.removeAttribute("aria-describedby");this.removalTimer&&(clearTimeout(this.removalTimer),this.removalTimer=void 0),this.enterRaf&&(cancelAnimationFrame(this.enterRaf),this.enterRaf=void 0),this.ensureTooltip(),this.syncTooltipClasses(!1),this.calculatePosition(),this.trigger?.setAttribute("aria-describedby",this.tooltipId),this.enterRaf=requestAnimationFrame(()=>{this.enterRaf=requestAnimationFrame(()=>{this.enterRaf=void 0,this.syncTooltipClasses(!0),this.calculatePosition()})})}}hideTooltip(){if(this.enterRaf&&(cancelAnimationFrame(this.enterRaf),this.enterRaf=void 0),!this.tooltip)return;const e=this.tooltip;e.classList.remove("designbase-wc-tooltip--visible"),e.setAttribute("aria-hidden","true");const finish=()=>{e.removeEventListener("transitionend",onEnd),this.removalTimer&&(clearTimeout(this.removalTimer),this.removalTimer=void 0),this.visible||this.tooltip!==e||this.removeTooltip()},onEnd=t=>{t.target===e&&"opacity"===t.propertyName&&finish()};e.addEventListener("transitionend",onEnd),this.removalTimer=setTimeout(finish,400)}removeTooltip(){this.removalTimer&&(clearTimeout(this.removalTimer),this.removalTimer=void 0),this.tooltip?.remove(),this.tooltip=void 0,this.contentEl=void 0,this.arrow=void 0}}customElements.get("db-tooltip")||customElements.define("db-tooltip",DbTooltip);class DbAccordion extends HTMLElement{constructor(){super(...arguments),this.expanded=new Set,this.isRendering=!1,this.suppressExpandedAttrCallback=!1}static get observedAttributes(){return["items","variant","size","allow-multiple","expand-mode","expanded-items","default-item-type"]}get items(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}get allowMultiple(){return this.hasAttribute("allow-multiple")}set allowMultiple(e){this.toggleAttribute("allow-multiple",e)}get expandedItems(){const e=(this.getAttribute("expanded-items")||"").trim();if(!e)return[];if("all"===e)return this.items.map((e,t)=>this.resolveItemKey(e,t));try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>String(e).trim()).filter(Boolean)}catch{}return e.split(",").map(e=>e.trim()).filter(Boolean)}set expandedItems(e){Array.isArray(e)?this.setAttribute("expanded-items",e.join(",")):this.setAttribute("expanded-items",e)}connectedCallback(){this.syncExpandedFromAttributes(),this.render(),this.childObserver=new MutationObserver(e=>{if(this.isRendering)return;e.some(e=>Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&e.hasAttribute("slot")))&&this.render()}),this.childObserver.observe(this,{childList:!0})}disconnectedCallback(){this.childObserver?.disconnect()}attributeChangedCallback(e){if(this.isConnected){if("expanded-items"===e){if(this.suppressExpandedAttrCallback)return;return this.syncExpandedFromAttributes(),void this.syncExpandedState()}return"expand-mode"===e||"allow-multiple"===e?(this.syncExpandedFromAttributes(),void this.syncExpandedState()):"items"===e?(this.syncExpandedFromAttributes(),void this.render()):void this.render()}}resolveItemKey(e,t){return e.id??String(t)}getExpandMode(){const e=this.getAttribute("expand-mode");return"single"===e||"multiple"===e||"all"===e?e:(this.hasAttribute("allow-multiple"),"multiple")}syncExpandedFromAttributes(){const e=this.items.map((e,t)=>this.resolveItemKey(e,t)),t=this.expandedItems,s=this.getExpandMode();t.length>0?this.expanded=new Set(t.filter(t=>e.includes(t))):this.expanded="all"!==s?new Set:new Set(e)}iconSize(e){return"s"===e?16:"l"===e?24:20}collectPanelContent(){const e=new Map,register=(t,s)=>{if(!(t instanceof HTMLElement)||"SLOT"===t.tagName)return;e.has(s)||e.set(s,[]);const i=e.get(s);i.includes(t)||i.push(t)};return Array.from(this.children).forEach(e=>{const t=e.getAttribute("slot")?.match(/^content-(\d+)$/);t&®ister(e,Number(t[1]))}),this.querySelectorAll(":scope > .designbase-wc-accordion__item").forEach((e,t)=>{const s=e.querySelector(":scope > .designbase-wc-accordion__content > .designbase-wc-accordion__content-inner");s&&Array.from(s.children).forEach(e=>register(e,t))}),e}isItemExpanded(e,t){return this.expanded.has(this.resolveItemKey(e,t))}syncExpandedState(){const e=this.items;this.querySelectorAll(":scope > .designbase-wc-accordion__item").forEach((t,s)=>{const i=e[s];if(!i)return;const n=this.isItemExpanded(i,s);t.classList.toggle("designbase-wc-accordion__item--expanded",n),t.classList.toggle("designbase-wc-accordion__item--disabled",Boolean(i.disabled));const a=t.querySelector(".designbase-wc-accordion__trigger"),r=t.querySelector(".designbase-wc-accordion__content");a?.setAttribute("aria-expanded",String(n)),r?.setAttribute("aria-hidden",String(!n))})}render(){this.isRendering=!0;const e=this.collectPanelContent(),t=this.getAttribute("variant")||"default",s=this.getAttribute("size")||"m",i=this.getExpandMode(),n=this.getAttribute("default-item-type")||"none",a=this.items,r=this.iconSize(s);this.className=["designbase-wc-accordion",`designbase-wc-accordion--${t}`,`designbase-wc-accordion--${s}`,"multiple"===i&&"designbase-wc-accordion--multiple","single"===i&&"designbase-wc-accordion--single","all"===i&&"designbase-wc-accordion--all"].filter(Boolean).join(" "),this.setAttribute("role","region"),this.setAttribute("aria-label","아코디언"),this.querySelectorAll(":scope > .designbase-wc-accordion__item").forEach(e=>e.remove()),a.forEach((s,i)=>{const a=this.resolveItemKey(s,i),o=this.isItemExpanded(s,i),l=document.createElement("div");l.className=["designbase-wc-accordion__item",`designbase-wc-accordion__item--${t}`,o&&"designbase-wc-accordion__item--expanded",s.disabled&&"designbase-wc-accordion__item--disabled"].filter(Boolean).join(" "),l.dataset.itemKey=a;const d=document.createElement("button");d.type="button",d.className="designbase-wc-accordion__trigger",d.disabled=Boolean(s.disabled),d.setAttribute("aria-expanded",String(o)),d.setAttribute("aria-controls",`accordion-content-${a}`),d.addEventListener("click",()=>{s.disabled||this.toggle(a)});const u=s.itemType||n;if("number"===u){const e=document.createElement("div");e.className="designbase-wc-accordion__number",e.textContent=`${i+1}.`,d.append(e)}else if("question"===u){const e=document.createElement("div");e.className="designbase-wc-accordion__question",e.textContent="Q.",d.append(e)}else if("icon"===u&&s.icon){const e=document.createElement("div");e.className="designbase-wc-accordion__icon",e.append(createDbIcon(s.icon,r)),d.append(e)}const b=document.createElement("span");b.className="designbase-wc-accordion__title",b.textContent=s.title;const m=document.createElement("div");m.className="designbase-wc-accordion__chevron",m.append(createDbIcon("chevron-down",r)),d.append(b,m);const p=document.createElement("div");p.id=`accordion-content-${a}`,p.className="designbase-wc-accordion__content",p.setAttribute("aria-hidden",String(!o));const g=document.createElement("div");g.className="designbase-wc-accordion__content-inner";const v=e.get(i)||[];if(v.length>0)v.forEach(e=>{e.removeAttribute("slot"),g.append(e)});else if(s.content){const e=document.createElement("p");e.className="designbase-wc-accordion__content-text",e.textContent=s.content,g.append(e)}p.append(g),l.append(d,p),this.append(l)}),this.isRendering=!1}toggle(e){const t=this.getExpandMode();this.expanded.has(e)?this.expanded.delete(e):"single"===t?this.expanded=new Set([e]):this.expanded.add(e);const s=Array.from(this.expanded);this.syncExpandedState(),this.suppressExpandedAttrCallback=!0,this.expandedItems=s,this.suppressExpandedAttrCallback=!1,this.dispatchEvent(new CustomEvent("db-change",{detail:{expandedItems:s},bubbles:!0,composed:!0}))}}customElements.get("db-accordion")||customElements.define("db-accordion",DbAccordion);const O=["xs","s","m","l","xl","2xl"],R=["default","primary","success","warning","danger","info"],H=["online","offline","away","busy"],V=["#E3F2FD","#F3E5F5","#E8F5E8","#FFF3E0","#FCE4EC","#E0F2F1","#FFF8E1","#F1F8E9","#E8EAF6","#FFEBEE"],q=["#1976D2","#7B1FA2","#388E3C","#F57C00","#C2185B","#00796B","#F9A825","#689F38","#3F51B5","#D32F2F"];class DbAvatar extends HTMLElement{constructor(){super(...arguments),this.imageFailed=!1,this.imageLoaded=!1,this.handleClick=()=>{!this.hasAttribute("disabled")&&this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=e=>{this.hasAttribute("clickable")&&!this.hasAttribute("disabled")&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["src","alt","initials","size","variant","status","disabled","clickable","badge","badge-max-count","badge-variant","badge-style","badge-text"]}connectedCallback(){this.render(),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(e){"src"===e&&(this.imageFailed=!1,this.imageLoaded=!1),this.render()}render(){const e=O.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=R.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default",s=this.hasAttribute("disabled"),i=this.hasAttribute("clickable"),n=this.getAttribute("src"),a=this.getAttribute("initials")||"",r=Boolean(n&&!this.imageFailed),o=r&&!this.imageLoaded;if(this.className=["designbase-wc-avatar",`designbase-wc-avatar--${e}`,`designbase-wc-avatar--${t}`,i&&"designbase-wc-avatar--clickable",s&&"designbase-wc-avatar--disabled",o&&"designbase-wc-avatar--loading"].filter(Boolean).join(" "),i&&!s?(this.setAttribute("role","button"),this.tabIndex=0):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.toggleAttribute("aria-disabled",s),this.replaceChildren(),o){const e=document.createElement("div");e.className="designbase-wc-avatar__loading";const t=document.createElement("div");t.className="designbase-wc-avatar__skeleton",e.append(t),this.append(e)}if(r){const e=document.createElement("img");e.className="designbase-wc-avatar__image",e.src=n,e.alt=this.getAttribute("alt")||"아바타 이미지",e.loading="lazy",e.addEventListener("load",()=>{this.imageLoaded=!0,this.classList.remove("designbase-wc-avatar--loading"),this.querySelector(".designbase-wc-avatar__loading")?.remove()}),e.addEventListener("error",()=>{this.imageFailed=!0,this.imageLoaded=!1,this.render()}),this.append(e)}else if(a){const e=document.createElement("div");if(e.className="designbase-wc-avatar__initials","default"===t){const t=function initialsColor(e){let t=0;for(let s=0;s<e.length;s++)t=e.charCodeAt(s)+((t<<5)-t);const s=Math.abs(t)%V.length;return{backgroundColor:V[s],color:q[s]}}(a);e.style.backgroundColor=t.backgroundColor,e.style.color=t.color}e.textContent=a.charAt(0).toUpperCase(),this.append(e)}else{const t=document.createElement("div");t.className="designbase-wc-avatar__icon",t.append(createDbIcon("user",function iconSize(e){return"xs"===e?12:"s"===e?16:"m"===e?20:"l"===e?24:"xl"===e?32:40}(e))),this.append(t)}const l=this.getAttribute("status")||"";if(H.includes(l)){const e=document.createElement("span");e.className=`designbase-wc-avatar__status designbase-wc-avatar__status--${l}`,this.append(e)}if(this.hasAttribute("badge")){const t=document.createElement("div");t.className="designbase-wc-avatar__badge";const s=document.createElement("db-badge");s.setAttribute("count",this.getAttribute("badge")||"0");const i=this.getAttribute("badge-style")||"number";s.setAttribute("badge-style",i),this.hasAttribute("badge-max-count")&&s.setAttribute("max-count",this.getAttribute("badge-max-count")),s.setAttribute("variant",this.getAttribute("badge-variant")||"danger"),this.hasAttribute("badge-text")&&(s.textContent=this.getAttribute("badge-text"));const n="xl"===e||"2xl"===e?"m":"s";s.setAttribute("size",n),t.append(s),this.append(t)}}}customElements.get("db-avatar")||customElements.define("db-avatar",DbAvatar);const j=["primary","secondary","success","warning","danger","muted"];class DbDivider extends HTMLElement{static get observedAttributes(){return["orientation","thickness","color","length","variant","margin"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=this.getAttribute("orientation")||"horizontal",t=this.getAttribute("variant")||"solid",s=Number(this.getAttribute("thickness")||1),i=this.getAttribute("color"),n=this.getAttribute("length"),a=this.getAttribute("margin");this.className=["designbase-wc-divider",`designbase-wc-divider--${e}`,`designbase-wc-divider--${t}`,i&&j.includes(i)?`designbase-wc-divider--${i}`:""].filter(Boolean).join(" "),this.setAttribute("role","separator"),this.setAttribute("aria-orientation",e),this.style.border="none",this.style.background="none",this.style.margin="",this.style.width="",this.style.height="","vertical"===e?(this.style.display="inline-block",this.style.borderLeft=`${s}px ${t} var(--db-border-base)`,this.style.verticalAlign="middle",n&&(this.style.height=n.endsWith("px")||n.endsWith("%")?n:`${n}px`)):(this.style.display="block",this.style.width="100%",this.style.borderTop=`${s}px ${t} var(--db-border-base)`),i&&!j.includes(i)&&("vertical"===e?this.style.borderLeftColor=i:this.style.borderTopColor=i),a&&(this.style.margin=/^\d+$/.test(a)?`${a}px`:a)}}customElements.get("db-divider")||customElements.define("db-divider",DbDivider);const U=["s","m","l"],W=["default","success","warning","danger"],G=["default","minimal"];function createSvgCircle(e,t,s,i,n,a){const r=document.createElementNS("http://www.w3.org/2000/svg","circle");return r.setAttribute("class",e),r.setAttribute("cx",String(t)),r.setAttribute("cy",String(s)),r.setAttribute("r",String(i)),r.setAttribute("stroke-width",String(n)),a&&Object.entries(a).forEach(([e,t])=>r.setAttribute(e,t)),r}class DbProgress extends HTMLElement{constructor(){super(...arguments),this.structureSignature="",this.circumference=0}static get observedAttributes(){return["value","max","size","variant","type","circular-style","show-value","animated","striped","glow","gradient"]}get value(){return Number(this.getAttribute("value")||0)}set value(e){this.setAttribute("value",String(e))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=Number(this.getAttribute("max")||100),t=Math.min(Math.max(this.value/e*100,0),100),s=this.getAttribute("size")||"m",i=this.getAttribute("variant")||"default",n=this.getAttribute("type")||"linear",a=this.getAttribute("circular-style")||"default",r=U.includes(s)?s:"m",o=W.includes(i)?i:"default",l=G.includes(a)?a:"default",d=this.hasAttribute("show-value");this.className=["designbase-wc-progress",`designbase-wc-progress--size-${r}`,`designbase-wc-progress--variant-${o}`,`designbase-wc-progress--type-${n}`,"circular"===n&&"minimal"===l?"designbase-wc-progress--circular-minimal":"",this.hasAttribute("animated")?"designbase-wc-progress--animated":"",this.hasAttribute("striped")?"designbase-wc-progress--striped":"",this.hasAttribute("gradient")?"designbase-wc-progress--gradient":"",this.hasAttribute("glow")?"designbase-wc-progress--glow":""].filter(Boolean).join(" "),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax",String(e)),this.setAttribute("aria-valuenow",String(this.value));const u=[n,l,r,d?"1":"0"].join("|");u!==this.structureSignature&&(this.structureSignature=u,"circular"===n?this.buildCircular(l,r,d):this.buildLinear(d)),"circular"===n?this.updateCircular(t):this.updateLinear(t)}buildLinear(e){this.circularBarEl=void 0,this.circularValueEl=void 0;const t=document.createElement("div");t.className="designbase-wc-progress__linear";const s=document.createElement("div");s.className="designbase-wc-progress__track";const i=document.createElement("div");if(i.className="designbase-wc-progress__bar",s.append(i),t.append(s),this.barEl=i,e){const e=document.createElement("span");e.className="designbase-wc-progress__value",t.append(e),this.linearValueEl=e}else this.linearValueEl=void 0;this.replaceChildren(t)}updateLinear(e){this.barEl&&(this.barEl.style.width=`${e}%`),this.linearValueEl&&(this.linearValueEl.textContent=`${Math.round(e)}%`)}buildCircular(e,t,s){this.barEl=void 0,this.linearValueEl=void 0;const{svgSize:i,radius:n,strokeWidth:a,center:r}=function getCircularMetrics(e,t){if("minimal"===e)return{svgSize:20,radius:8,strokeWidth:2,center:10};switch(t){case"s":return{svgSize:64,radius:26,strokeWidth:4,center:32};case"l":return{svgSize:160,radius:62,strokeWidth:10,center:80};default:return{svgSize:120,radius:45,strokeWidth:8,center:60}}}(e,t);this.circumference=2*Math.PI*n;const o=document.createElement("div");o.className="designbase-wc-progress__circular";const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("class","designbase-wc-progress__circular-svg"),l.setAttribute("width",String(i)),l.setAttribute("height",String(i)),l.setAttribute("viewBox",`0 0 ${i} ${i}`),l.setAttribute("aria-hidden","true");const d=createSvgCircle("designbase-wc-progress__circular-bar",r,r,n,a,{"stroke-dasharray":String(this.circumference),"stroke-dashoffset":String(this.circumference),transform:`rotate(-90 ${r} ${r})`});if(this.circularBarEl=d,l.append(createSvgCircle("designbase-wc-progress__circular-track",r,r,n,a),d),o.append(l),s&&"minimal"!==e){const e=document.createElement("span");e.className="designbase-wc-progress__circular-value",o.append(e),this.circularValueEl=e}else this.circularValueEl=void 0;this.replaceChildren(o)}updateCircular(e){if(this.circularBarEl){const t=this.circumference-e/100*this.circumference;this.circularBarEl.setAttribute("stroke-dashoffset",String(t))}this.circularValueEl&&(this.circularValueEl.textContent=`${Math.round(e)}%`)}}customElements.get("db-progress")||customElements.define("db-progress",DbProgress);const J=["s","m","l"];class DbSelect extends HTMLElement{constructor(){super(...arguments),this.internals=this.attachInternals(),this.built=!1,this.searchTerm="",this.focusedIndex=-1,this.handleTriggerClick=()=>{this.hasAttribute("disabled")||this.hasAttribute("readonly")||(this.open=!this.open,this.open&&this.searchable&&setTimeout(()=>this.searchInput?.focus(),0))},this.handleTriggerFocus=()=>{this.trigger?.classList.add("designbase-wc-select__trigger--focused")},this.handleTriggerBlur=()=>{this.trigger?.classList.remove("designbase-wc-select__trigger--focused")},this.handleClear=e=>{e.stopPropagation();const t=[];this.setSelectedValues(t),this.syncTrigger(),this.syncOptions(),this.dispatchChange(t)},this.handleSearchInput=()=>{this.searchTerm=this.searchInput?.value||"",this.focusedIndex=-1,this.syncOptions()},this.handleDocumentMouseDown=e=>{this.contains(e.target)||(this.open=!1,this.searchTerm="",this.searchInput&&(this.searchInput.value=""),this.focusedIndex=-1,this.syncOptions())},this.handleDocumentKeyDown=e=>{if(!this.contains(document.activeElement))return;if(!this.open)return void("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.open=!0));const t=this.getFilteredOptions();switch(e.key){case"Escape":e.preventDefault(),this.open=!1,this.searchTerm="",this.searchInput&&(this.searchInput.value=""),this.focusedIndex=-1,this.syncOptions();break;case"ArrowDown":e.preventDefault(),this.focusedIndex=Math.min(this.focusedIndex+1,t.length-1),this.syncOptions();break;case"ArrowUp":e.preventDefault(),this.focusedIndex=Math.max(this.focusedIndex-1,0),this.syncOptions();break;case"Enter":e.preventDefault(),this.focusedIndex>=0&&t[this.focusedIndex]&&this.selectOption(t[this.focusedIndex])}}}static get observedAttributes(){return["options","value","placeholder","label","size","full-width","disabled","readonly","required","error","error-message","helper-text","multiple","searchable","show-clear-button","open","max-height","position","dropdown-width","name"]}get name(){return this.getAttribute("name")??""}set name(e){this.setAttribute("name",e)}get open(){return this.hasAttribute("open")}set open(e){this.toggleAttribute("open",e),this.syncOpenState()}get value(){return this.getAttribute("value")||""}set value(e){e?this.setAttribute("value",e):this.removeAttribute("value"),this.syncTrigger(),this.syncOptions()}connectedCallback(){this.built||this.build(),this.syncState(),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown)}formResetCallback(){this.removeAttribute("value"),this.internals.setFormValue(null),this.built&&(this.syncTrigger(),this.syncOptions())}formDisabledCallback(e){this.toggleAttribute("disabled",e)}attributeChangedCallback(e){if(this.built){if("open"!==e)return"value"===e?(this.syncTrigger(),void this.syncOptions()):void this.syncState();this.syncOpenState()}}get multiple(){return this.hasAttribute("multiple")}set multiple(e){this.toggleAttribute("multiple",Boolean(e))}get searchable(){return this.hasAttribute("searchable")}set searchable(e){this.toggleAttribute("searchable",Boolean(e))}get showClearButton(){return!this.hasAttribute("show-clear-button")||"false"!==this.getAttribute("show-clear-button")}parseOptions(){const e=this.getAttribute("options")||"[]";try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return e.split(",").map(e=>e.trim()).filter(Boolean).map(e=>({value:e,label:e}))}}parseSelectedValues(){const e=this.getAttribute("value")||"";if(!e)return[];if(this.multiple)try{const t=JSON.parse(e);return Array.isArray(t)?t.map(String):[]}catch{return e.split(",").map(e=>e.trim()).filter(Boolean)}return e?[e]:[]}setSelectedValues(e){this.multiple?e.length?this.setAttribute("value",JSON.stringify(e)):this.removeAttribute("value"):e[0]?this.setAttribute("value",e[0]):this.removeAttribute("value")}getIconSize(){const e=this.getAttribute("size")||"m";return getDbComponentIconSize(J.includes(e)?e:"m")}syncIndicatorIcons(){const e=this.getIconSize();this.clearButton?.replaceChildren(createDbIcon("close",e)),this.chevronEl&&this.chevronEl.replaceChildren(createDbIcon(this.open?"chevron-up":"chevron-down",e))}build(){const e=this.getAttribute("id")||`db-select-${Math.random().toString(36).slice(2)}`,t=`${e}-listbox`;this.hasAttribute("id")||this.setAttribute("id",e),this.labelEl=document.createElement("label"),this.labelEl.className="designbase-wc-select__label",this.trigger=document.createElement("div"),this.trigger.className="designbase-wc-select__trigger",this.trigger.tabIndex=0,this.trigger.setAttribute("role","combobox"),this.trigger.setAttribute("aria-haspopup","listbox"),this.trigger.setAttribute("aria-controls",t),this.trigger.addEventListener("click",this.handleTriggerClick),this.trigger.addEventListener("focus",this.handleTriggerFocus),this.trigger.addEventListener("blur",this.handleTriggerBlur),this.valueEl=document.createElement("div"),this.valueEl.className="designbase-wc-select__value",this.indicatorsEl=document.createElement("div"),this.indicatorsEl.className="designbase-wc-select__indicators",this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="designbase-wc-select__clear-button",this.clearButton.setAttribute("aria-label","모든 값 지우기"),this.clearButton.hidden=!0,this.clearButton.appendChild(createDbIcon("close",this.getIconSize())),this.clearButton.addEventListener("click",this.handleClear),this.chevronEl=document.createElement("div"),this.chevronEl.className="designbase-wc-select__chevron",this.indicatorsEl.append(this.clearButton,this.chevronEl),this.trigger.append(this.valueEl,this.indicatorsEl),this.dropdown=document.createElement("div"),this.dropdown.className="designbase-wc-select__dropdown",this.searchWrap=document.createElement("div"),this.searchWrap.className="designbase-wc-select__search",this.searchWrap.hidden=!0,this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="designbase-wc-select__search-input",this.searchInput.placeholder="옵션 검색",this.searchInput.addEventListener("input",this.handleSearchInput),this.searchInput.addEventListener("mousedown",e=>e.stopPropagation()),this.searchInput.addEventListener("click",e=>e.stopPropagation()),this.searchWrap.appendChild(this.searchInput),this.optionsEl=document.createElement("div"),this.optionsEl.className="designbase-wc-select__options",this.optionsEl.id=t,this.optionsEl.setAttribute("role","listbox"),this.dropdown.append(this.searchWrap,this.optionsEl),this.helperEl=document.createElement("p"),this.helperEl.className="designbase-wc-select__helper-text",this.errorEl=document.createElement("p"),this.errorEl.className="designbase-wc-select__error-message",this.append(this.labelEl,this.trigger,this.dropdown,this.helperEl,this.errorEl),this.built=!0}getFilteredOptions(){const e=this.parseOptions();if(!this.searchable||!this.searchTerm)return e;const t=this.searchTerm.toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(t))}selectOption(e){if(e.disabled)return;const t=this.parseSelectedValues();let s;this.multiple?s=t.includes(e.value)?t.filter(t=>t!==e.value):[...t,e.value]:(s=[e.value],this.open=!1,this.searchTerm="",this.searchInput&&(this.searchInput.value=""),this.focusedIndex=-1),this.setSelectedValues(s),this.syncTrigger(),this.syncOptions(),this.dispatchChange(s)}dispatchChange(e){const t=this.parseOptions();if(this.multiple){const s=new FormData;return e.forEach(e=>s.append(this.name||"select",e)),this.internals.setFormValue(e.length?s:null),this.dispatchEvent(new Event("change",{bubbles:!0})),void this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e,labels:e.map(e=>t.find(t=>t.value===e)?.label||e)},bubbles:!0,composed:!0}))}const s=e[0]||"",i=t.find(e=>e.value===s)?.label||"";this.internals.setFormValue(s||null),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:s,label:i},bubbles:!0,composed:!0}))}syncState(){if(!this.trigger||!this.dropdown||!this.optionsEl)return;const e=J.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t="top"===this.getAttribute("position")?"top":"bottom",s="full"===this.getAttribute("dropdown-width")?"full":"auto",i=Number(this.getAttribute("max-height")||200),n=this.getAttribute("label")||"",a=this.getAttribute("helper-text")||"",r=this.getAttribute("error-message")||"",o=this.hasAttribute("error"),l=this.getAttribute("id")||"";this.className=["designbase-wc-select",`designbase-wc-select--${e}`,this.open&&"designbase-wc-select--open",o&&"designbase-wc-select--error",this.hasAttribute("disabled")&&"designbase-wc-select--disabled",this.hasAttribute("readonly")&&"designbase-wc-select--readonly",this.hasAttribute("full-width")&&"designbase-wc-select--full-width",this.multiple&&"designbase-wc-select--multiple",this.searchable&&"designbase-wc-select--searchable"].filter(Boolean).join(" ");const d=this.parseSelectedValues();if(this.classList.toggle("designbase-wc-select--has-value",d.length>0),this.labelEl){const e=this.hasAttribute("required")?'<span class="designbase-wc-select__required" aria-hidden="true">*</span>':"";this.labelEl.innerHTML=n?`${this.escape(n)}${e}`:"",this.labelEl.hidden=!n}this.dropdown.className=["designbase-wc-select__dropdown",`designbase-wc-select__dropdown--${s}`,`designbase-wc-select__dropdown--${t}`,this.open&&"designbase-wc-select__dropdown--open"].filter(Boolean).join(" "),this.optionsEl.style.maxHeight=`${i}px`,this.searchWrap&&(this.searchWrap.hidden=!this.searchable);const u=`${l}-helper`,b=`${l}-error`;o&&r?(this.errorEl.id=b,this.errorEl.textContent=r,this.errorEl.hidden=!1,this.helperEl.hidden=!0,this.trigger.setAttribute("aria-describedby",b),this.trigger.setAttribute("aria-invalid","true")):a?(this.helperEl.id=u,this.helperEl.textContent=a,this.helperEl.hidden=!1,this.errorEl.hidden=!0,this.trigger.setAttribute("aria-describedby",u),this.trigger.removeAttribute("aria-invalid")):(this.helperEl.hidden=!0,this.errorEl.hidden=!0,this.trigger.removeAttribute("aria-describedby"),this.trigger.removeAttribute("aria-invalid")),this.hasAttribute("disabled")||this.hasAttribute("readonly")?this.trigger.tabIndex=-1:this.trigger.tabIndex=0,this.syncOpenState(),this.syncTrigger(),this.syncOptions(),this.syncIndicatorIcons()}syncOpenState(){this.trigger&&this.dropdown&&this.chevronEl&&(this.trigger.setAttribute("aria-expanded",String(this.open)),this.classList.toggle("designbase-wc-select--open",this.open),this.dropdown.classList.toggle("designbase-wc-select__dropdown--open",this.open),this.syncIndicatorIcons())}syncTrigger(){if(!this.valueEl||!this.clearButton)return;const e=this.parseOptions(),t=this.parseSelectedValues(),s=this.getAttribute("placeholder")||"선택하세요",i=t.length>0,n=i&&this.showClearButton&&!this.hasAttribute("disabled")&&!this.hasAttribute("readonly");if(this.valueEl.replaceChildren(),this.multiple)if(0===t.length){const e=document.createElement("span");e.className="designbase-wc-select__placeholder",e.textContent=s,this.valueEl.appendChild(e)}else{const s=document.createElement("div");s.className="designbase-wc-select__tags",t.forEach(i=>{const n=e.find(e=>e.value===i),a=document.createElement("span");a.className="designbase-wc-select__tag";const r=document.createElement("span");r.className="designbase-wc-select__tag-label",r.textContent=n?.label||i;const o=document.createElement("button");o.type="button",o.className="designbase-wc-select__tag-remove",o.setAttribute("aria-label",`${n?.label||i} 제거`),o.appendChild(createDbIcon("close",12)),o.addEventListener("click",e=>{e.stopPropagation();const s=t.filter(e=>e!==i);this.setSelectedValues(s),this.syncTrigger(),this.syncOptions(),this.dispatchChange(s)}),a.append(r,o),s.appendChild(a)}),this.valueEl.appendChild(s)}else{const n=document.createElement("span");n.className="designbase-wc-select__single-value";const a=e.find(e=>e.value===t[0]);n.textContent=i?a?.label||t[0]:s,i||n.classList.add("designbase-wc-select__placeholder"),this.valueEl.appendChild(n)}this.clearButton.hidden=!n,this.clearButton.setAttribute("aria-hidden",n?"false":"true"),this.classList.toggle("designbase-wc-select--has-value",i)}syncOptions(){if(!this.optionsEl)return;const e=this.getFilteredOptions(),t=this.parseSelectedValues(),s=this.getAttribute("id")||"db-select";if(this.optionsEl.replaceChildren(),0===e.length){const e=document.createElement("div");return e.className="designbase-wc-select__no-options",e.textContent=this.searchTerm?"검색 결과가 없습니다.":"옵션이 없습니다.",void this.optionsEl.appendChild(e)}e.forEach((e,i)=>{const n=t.includes(e.value),a=i===this.focusedIndex,r=document.createElement("div");if(r.className=["designbase-wc-select__option",n&&"designbase-wc-select__option--selected",a&&"designbase-wc-select__option--focused",e.disabled&&"designbase-wc-select__option--disabled"].filter(Boolean).join(" "),r.id=`${s}-option-${i}`,r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n)),r.addEventListener("click",()=>this.selectOption(e)),this.multiple){const t=document.createElement("div");t.className="designbase-wc-select__checkbox";const s=document.createElement("db-checkbox");s.setAttribute("size","s"),s.setAttribute("has-label","false"),n&&s.setAttribute("checked",""),e.disabled&&s.setAttribute("disabled",""),t.appendChild(s),r.appendChild(t)}const o=document.createElement("span");o.className="designbase-wc-select__option-label",o.textContent=e.label,r.appendChild(o),this.optionsEl.appendChild(r)}),this.focusedIndex>=0?this.trigger?.setAttribute("aria-activedescendant",`${s}-option-${this.focusedIndex}`):this.trigger?.removeAttribute("aria-activedescendant")}escape(e){return e.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[e]||e))}}DbSelect.formAssociated=!0,customElements.get("db-select")||customElements.define("db-select",DbSelect);const K=["s","m","l"];class DbTextarea extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleInput=e=>{e.stopPropagation(),this.field&&(this.updateCharacterCount(),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:this.field.value,nativeEvent:e},bubbles:!0,composed:!0})))},this.handleChange=e=>{if(e.stopPropagation(),!this.field)return;const t=this.field.value;this.getAttribute("value")!==t&&this.setAttribute("value",t),this.updateCharacterCount(),this.dispatchEvent(new Event("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t,nativeEvent:e},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["label","placeholder","value","default-value","name","size","rows","max-length","show-character-count","character-count-position","disabled","readonly","required","error","error-message","helper-text","full-width","resizable"]}get value(){return this.field?.value??this.getAttribute("value")??""}set value(e){this.setAttribute("value",e),this.field&&(this.field.value=e,this.updateCharacterCount())}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}connectedCallback(){this.built||this.build(),this.syncState()}attributeChangedCallback(e){if(this.built){if("value"===e&&this.field){const e=this.getAttribute("value")||"";return this.field.value!==e&&(this.field.value=e),void this.updateCharacterCount()}this.syncState()}}focus(){this.field?.focus()}get showCharacterCount(){return this.hasAttribute("show-character-count")}get characterCountPosition(){return this.getAttribute("character-count-position")||"bottom"}build(){const e=this.getAttribute("id")||`db-textarea-${Math.random().toString(36).slice(2)}`;this.hasAttribute("id")||this.setAttribute("id",e),this.labelEl=document.createElement("label"),this.labelEl.className="designbase-wc-textarea__label",this.labelEl.htmlFor=e,this.countTop=document.createElement("div"),this.countTop.className="designbase-wc-textarea__character-count designbase-wc-textarea__character-count--top",this.countTop.hidden=!0;const t=document.createElement("div");t.className="designbase-wc-textarea__wrapper",this.field=document.createElement("textarea"),this.field.id=e,this.field.className="designbase-wc-textarea__field",this.field.addEventListener("input",this.handleInput),this.field.addEventListener("change",this.handleChange),t.appendChild(this.field),this.footerEl=document.createElement("div"),this.footerEl.className="designbase-wc-textarea__footer",this.errorEl=document.createElement("div"),this.errorEl.className="designbase-wc-textarea__error-message",this.errorEl.setAttribute("role","alert"),this.helperEl=document.createElement("div"),this.helperEl.className="designbase-wc-textarea__helper-text",this.countBottom=document.createElement("div"),this.countBottom.className="designbase-wc-textarea__character-count designbase-wc-textarea__character-count--bottom",this.countBottom.hidden=!0,this.footerEl.append(this.errorEl,this.helperEl,this.countBottom),this.append(this.labelEl,this.countTop,t,this.footerEl),this.built=!0}syncState(){if(!this.field)return;const e=K.includes(this.size)?this.size:"m",t=this.getAttribute("label")||"",s=this.getAttribute("helper-text")||"",i=this.getAttribute("error-message")||"",n=this.hasAttribute("error"),a=this.getAttribute("value")??this.getAttribute("default-value")??"";if(this.className=["designbase-wc-textarea",`designbase-wc-textarea--${e}`,n&&"designbase-wc-textarea--error",this.hasAttribute("disabled")&&"designbase-wc-textarea--disabled",this.hasAttribute("readonly")&&"designbase-wc-textarea--readonly",this.hasAttribute("full-width")&&"designbase-wc-textarea--full-width",this.hasAttribute("resizable")?"":"designbase-wc-textarea--not-resizable"].filter(Boolean).join(" "),this.labelEl){const e=this.hasAttribute("required")?'<span aria-hidden="true"> *</span>':"";this.labelEl.innerHTML=t?`${this.escape(t)}${e}`:"",this.labelEl.hidden=!t}this.field.placeholder=this.getAttribute("placeholder")||"",this.field.name=this.getAttribute("name")||"",this.field.value!==a&&(this.field.value=a),this.field.rows=Number(this.getAttribute("rows")||4),this.field.disabled=this.hasAttribute("disabled"),this.field.readOnly=this.hasAttribute("readonly"),this.field.required=this.hasAttribute("required"),this.field.setAttribute("aria-invalid",String(n));const r=this.getAttribute("max-length");r?this.field.maxLength=Number(r):this.field.removeAttribute("maxLength");const o=`${this.getAttribute("id")}-helper`,l=`${this.getAttribute("id")}-error`;n&&i?(this.errorEl.id=l,this.errorEl.textContent=i,this.errorEl.hidden=!1,this.helperEl.hidden=!0,this.field.setAttribute("aria-describedby",l)):s?(this.helperEl.id=o,this.helperEl.textContent=s,this.helperEl.hidden=!1,this.errorEl.hidden=!0,this.field.setAttribute("aria-describedby",o)):(this.helperEl.hidden=!0,this.errorEl.hidden=!0,this.field.removeAttribute("aria-describedby")),this.updateCharacterCount()}updateCharacterCount(){if(!this.field||!this.countTop||!this.countBottom)return;const e=this.field.value.length,t=this.getAttribute("max-length"),s=Boolean(t&&e>Number(t)),i=`${e}${t?` / ${t}`:""}`,renderCount=e=>{e.innerHTML=`<span class="designbase-wc-textarea__character-count-text${s?" designbase-wc-textarea__character-count-text--error":""}">${i}</span>`};this.showCharacterCount&&"top"===this.characterCountPosition?(renderCount(this.countTop),this.countTop.hidden=!1,this.countBottom.hidden=!0):this.showCharacterCount?(renderCount(this.countBottom),this.countBottom.hidden=!1,this.countTop.hidden=!0):(this.countTop.hidden=!0,this.countBottom.hidden=!0)}escape(e){return e.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[e]||e))}}customElements.get("db-textarea")||customElements.define("db-textarea",DbTextarea);const Y=["s","m","l"];class DbRadio extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleChange=()=>{if(!this.input||this.disabled||this.readOnly)return;const e=this.input.checked;this.toggleAttribute("checked",e),this.syncVisual(),this.syncClasses(),this.dispatchEvent(new CustomEvent("db-change",{detail:{checked:e,selected:e,value:this.getAttribute("value")||""},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["checked","selected","default-checked","default-selected","size","disabled","readonly","required","name","value","has-label"]}get checked(){return this.input?.checked??(this.hasAttribute("checked")||this.hasAttribute("selected"))}set checked(e){this.toggleAttribute("checked",e),this.input&&(this.input.checked=e,this.syncVisual(),this.syncClasses())}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.input&&(this.input.disabled=e),this.syncClasses()}get readOnly(){return this.hasAttribute("readonly")}set readOnly(e){this.toggleAttribute("readonly",e),this.input&&(this.input.readOnly=e),this.syncClasses()}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",e),this.input&&(this.input.required=e)}get size(){return this.getAttribute("size")||"m"}set size(e){this.setAttribute("size",e)}connectedCallback(){this.style.display="contents",this.built||this.build(),this.syncState()}attributeChangedCallback(e){if(this.built)return"checked"===e||"selected"===e?(this.input&&(this.input.checked=this.hasAttribute("checked")||this.hasAttribute("selected")),this.syncVisual(),void this.syncClasses()):void this.syncState()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}build(){for(this.root=document.createElement("label"),this.root.className="designbase-wc-radio",this.input=document.createElement("input"),this.input.type="radio",this.input.className="designbase-wc-radio__input",this.visual=document.createElement("span"),this.visual.className="designbase-wc-radio__visual",this.visual.setAttribute("aria-hidden","true"),this.dot=document.createElement("span"),this.dot.className="designbase-wc-radio__dot",this.visual.appendChild(this.dot),this.labelEl=document.createElement("span"),this.labelEl.className="designbase-wc-radio__label";this.firstChild;)this.labelEl.appendChild(this.firstChild);this.root.append(this.input,this.visual,this.labelEl),this.appendChild(this.root),this.input.addEventListener("change",this.handleChange),this.built=!0}syncState(){if(!this.root||!this.input||!this.visual)return;const e=this.hasAttribute("checked")||this.hasAttribute("selected")||!this.hasAttribute("checked")&&!this.hasAttribute("selected")&&(this.hasAttribute("default-checked")||this.hasAttribute("default-selected"));this.input.checked=e,this.input.disabled=this.disabled,this.input.readOnly=this.readOnly,this.input.required=this.required,this.input.name=this.getAttribute("name")||"",this.input.value=this.getAttribute("value")||"",this.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncVisual(),this.syncClasses()}syncVisual(){}syncClasses(){if(!this.root||!this.input)return;const e=Y.includes(this.size)?this.size:"m",t=this.hasLabel&&Boolean(this.labelEl?.textContent?.trim());this.root.className=["designbase-wc-radio",`designbase-wc-radio--${e}`,this.input.checked&&"designbase-wc-radio--selected",this.disabled&&"designbase-wc-radio--disabled",this.readOnly&&"designbase-wc-radio--readonly",!t&&"designbase-wc-radio--no-label"].filter(Boolean).join(" ")}}customElements.get("db-radio")||customElements.define("db-radio",DbRadio);class DbPagination extends HTMLElement{static get observedAttributes(){return["current-page","total-pages","total-items","page-size","page-size-options","size","variant","alignment","show-first-last","show-previous-next","show-page-size-selector","show-total","sibling-count","boundary-count","disabled","full-width"]}get currentPage(){return Number(this.getAttribute("current-page")||1)}set currentPage(e){this.setAttribute("current-page",String(e))}get totalPages(){return Number(this.getAttribute("total-pages")||1)}set totalPages(e){this.setAttribute("total-pages",String(e))}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}iconSize(){const e=this.getAttribute("size")||"m";return"s"===e?12:"l"===e?16:14}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("alignment")||"center",i=this.hasAttribute("disabled"),n=this.hasAttribute("show-first-last"),a="false"!==this.getAttribute("show-previous-next"),r=this.hasAttribute("show-page-size-selector"),o=this.hasAttribute("show-total"),l=this.hasAttribute("full-width")||r||o,d=Number(this.getAttribute("total-items")||0),u=Number(this.getAttribute("page-size")||10),b=this.currentPage,m=this.totalPages,p=b<=1,g=b>=m;this.className=["designbase-wc-pagination",`designbase-wc-pagination--${e}`,`designbase-wc-pagination--${t}`,`designbase-wc-pagination--${s}`,i&&"designbase-wc-pagination--disabled",l&&"designbase-wc-pagination--full-width"].filter(Boolean).join(" "),this.setAttribute("role","navigation"),this.setAttribute("aria-label","페이지 네비게이션"),this.replaceChildren();const v=document.createElement("div");if(v.className=["designbase-wc-pagination__container",l&&"designbase-wc-pagination__container--full-width"].filter(Boolean).join(" "),o&&d>0){const e=document.createElement("div");e.className="designbase-wc-pagination__total",e.textContent=this.getTotalLabel(d,u,b),v.append(e)}const E=document.createElement("nav");E.className="designbase-wc-pagination__nav",E.setAttribute("aria-label","페이지 네비게이션");const f=document.createElement("ul");f.className="designbase-wc-pagination__list",n&&!p&&f.append(this.createIconButton("arrow-bar-left",1,"첫 페이지로 이동","first")),a&&!p&&f.append(this.createIconButton("chevron-left",b-1,"이전 페이지로 이동","previous")),this.getPageNumbers().forEach((e,t)=>{if("..."===e){const e=document.createElement("li");e.className="designbase-wc-pagination__ellipsis";const t=document.createElement("span");return t.className="designbase-wc-pagination__ellipsis-text",t.textContent="...",e.append(t),void f.append(e)}"number"==typeof e&&f.append(this.createPageButton(e,i))}),a&&!g&&f.append(this.createIconButton("chevron-right",b+1,"다음 페이지로 이동","next")),n&&!g&&f.append(this.createIconButton("arrow-bar-right",m,"마지막 페이지로 이동","last")),E.append(f),v.append(E),r&&v.append(this.createPageSizeSelector(e,u,i)),this.append(v)}getPageSizeOptions(){const e=this.getAttribute("page-size-options");if(!e)return[10,20,50,100];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>Number(e)).filter(e=>!Number.isNaN(e))}catch{}return[10,20,50,100]}getTotalLabel(e,t,s){return`${(s-1)*t+1}-${Math.min(s*t,e)} / ${e}개`}createPageSizeSelector(e,t,s){const i=document.createElement("div");i.className="designbase-wc-pagination__page-size";const n=document.createElement("label");n.className="designbase-wc-pagination__page-size-label";const a=document.createElement("span");a.className="designbase-wc-pagination__page-size-text",a.textContent="페이지당";const r=document.createElement("db-select");return r.className="designbase-wc-pagination__page-size-select",r.setAttribute("size",e),r.setAttribute("show-clear-button","false"),r.setAttribute("searchable","false"),r.setAttribute("options",JSON.stringify(this.getPageSizeOptions().map(e=>({value:String(e),label:String(e)})))),r.setAttribute("value",String(t)),s&&r.setAttribute("disabled",""),r.addEventListener("db-change",e=>{const s=e.detail,i=Number(s?.value);Number.isNaN(i)||i===t||(this.setAttribute("page-size",String(i)),this.dispatchEvent(new CustomEvent("db-page-size-change",{detail:{pageSize:i},bubbles:!0,composed:!0})))}),n.append(a,r),i.append(n),i}getPageNumbers(){const e=Number(this.getAttribute("sibling-count")||1),t=Number(this.getAttribute("boundary-count")||1),s=this.totalPages,i=this.currentPage;if(s<=2*e+3+2)return Array.from({length:s},(e,t)=>t+1);const n=Math.max(i-e,t),a=Math.min(i+e,s-t+1),r=n>t+2,o=a<s-t-1;if(!r&&o){const t=3+2*e;return[...Array.from({length:t},(e,t)=>t+1),"...",s]}if(r&&!o){const t=3+2*e;return[1,"...",...Array.from({length:t},(e,i)=>s-t+i+1)]}if(r&&o){return[1,"...",...Array.from({length:a-n+1},(e,t)=>n+t),"...",s]}return Array.from({length:s},(e,t)=>t+1)}createPageButton(e,t){const s=e===this.currentPage,i=document.createElement("li");i.className="designbase-wc-pagination__item";const n=document.createElement("button");return n.type="button",n.className=["designbase-wc-pagination__button",s&&"designbase-wc-pagination__button--active"].filter(Boolean).join(" "),n.textContent=String(e),n.disabled=t,s&&n.setAttribute("aria-current","page"),n.setAttribute("aria-label",`페이지 ${e}로 이동`),n.addEventListener("click",()=>this.select(e)),i.append(n),i}createIconButton(e,t,s,i){const n=document.createElement("li");n.className="designbase-wc-pagination__item";const a=document.createElement("button");return a.type="button",a.className=`designbase-wc-pagination__button designbase-wc-pagination__button--${i}`,a.disabled=this.hasAttribute("disabled"),a.setAttribute("aria-label",s),a.append(createDbIcon(e,this.iconSize())),a.addEventListener("click",()=>this.select(t)),n.append(a),n}select(e){this.hasAttribute("disabled")||e===this.currentPage||e<1||e>this.totalPages||(this.currentPage=e,this.dispatchEvent(new CustomEvent("db-change",{detail:{page:e},bubbles:!0,composed:!0})))}}customElements.get("db-pagination")||customElements.define("db-pagination",DbPagination);const X={s:12,m:14,l:16};class DbBreadcrumbs extends HTMLElement{constructor(){super(...arguments),this.openMenuId=null,this.onDocumentMouseDown=null,this.onDocumentKeyDown=null}static get observedAttributes(){return["items","size","variant","breadcrumb-style","max-items","menu-dropdown","max-label-length"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}disconnectedCallback(){this.removeGlobalListeners()}attributeChangedCallback(){this.isConnected&&(this.openMenuId=null,this.render())}get menuDropdown(){return this.hasAttribute("menu-dropdown")}get maxLabelLength(){const e=Number(this.getAttribute("max-label-length"));return Number.isFinite(e)&&e>0?e:12}get resolvedVariant(){return this.getAttribute("variant")||this.getAttribute("breadcrumb-style")||"default"}itemId(e,t){return e.id||`item-${t}`}menuItemId(e,t){return e.id||`menu-${t}`}visibleItems(){const e=this.items,t=Number(this.getAttribute("max-items")||0);if(!t||e.length<=t)return e;const s=e[0],i=e[e.length-1],n=e.slice(1,-1),a=t-2;if(a<=0)return[s,i];const r=Math.floor(n.length/2)-Math.floor(a/2);return[s,...n.slice(r,r+a),i]}shouldUseDropdown(e){return this.menuDropdown&&Boolean(e.menu?.length)}closeMenu(){this.openMenuId&&(this.openMenuId=null,this.removeGlobalListeners(),this.updateDropdownStates())}openMenu(e){this.openMenuId=e,this.addGlobalListeners(),this.updateDropdownStates()}toggleMenu(e){this.openMenuId===e?this.closeMenu():this.openMenu(e)}addGlobalListeners(){this.onDocumentMouseDown||(this.onDocumentMouseDown=e=>{this.contains(e.target)||this.closeMenu()},this.onDocumentKeyDown=e=>{"Escape"===e.key&&this.closeMenu()},document.addEventListener("mousedown",this.onDocumentMouseDown),document.addEventListener("keydown",this.onDocumentKeyDown))}removeGlobalListeners(){this.onDocumentMouseDown&&(document.removeEventListener("mousedown",this.onDocumentMouseDown),this.onDocumentMouseDown=null),this.onDocumentKeyDown&&(document.removeEventListener("keydown",this.onDocumentKeyDown),this.onDocumentKeyDown=null)}updateDropdownStates(){this.querySelectorAll("[data-breadcrumb-dropdown]").forEach(e=>{const t=e.dataset.breadcrumbDropdown||"",s=this.openMenuId===t;e.classList.toggle("designbase-wc-breadcrumbs__dropdown--open",s);const i=e.querySelector(".designbase-wc-breadcrumbs__trigger");i&&i.setAttribute("aria-expanded",String(s))})}createLabel(e){const t=function formatBreadcrumbLabel(e,t){return!t||e.length<=t?{text:e,full:e,truncated:!1}:{text:`${e.slice(0,t)}...`,full:e,truncated:!0}}(e,this.maxLabelLength),s=document.createElement("span");return s.className="designbase-wc-breadcrumbs__label",s.textContent=t.text,t.truncated&&s.setAttribute("title",t.full),s}createMenuItem(e,t,s){const i=e.href&&!e.disabled?document.createElement("a"):document.createElement("button");if(i.className=["designbase-wc-breadcrumbs__menu-item",e.active&&"designbase-wc-breadcrumbs__menu-item--active",e.disabled&&"designbase-wc-breadcrumbs__menu-item--disabled"].filter(Boolean).join(" "),i.setAttribute("role","menuitem"),i instanceof HTMLButtonElement?(i.type="button",i.disabled=Boolean(e.disabled)):i.href=e.href||"#",e.icon){const t=document.createElement("span");t.className="designbase-wc-breadcrumbs__icon",t.append(createDbIcon(e.icon,16)),i.append(t)}return i.append(this.createLabel(e.label)),i.addEventListener("click",i=>{e.disabled?i.preventDefault():(this.closeMenu(),this.dispatchEvent(new CustomEvent("db-menu-click",{detail:{menuItem:{...e,id:this.menuItemId(e,t)},parentItem:s},bubbles:!0,composed:!0})))}),i}createDropdownItem(e,t,s,i){const n=this.itemId(e,t),a=this.openMenuId===n,r=document.createElement("div");r.className=["designbase-wc-breadcrumbs__dropdown",a&&"designbase-wc-breadcrumbs__dropdown--open"].filter(Boolean).join(" "),r.dataset.breadcrumbDropdown=n;const o=document.createElement("button");if(o.type="button",o.className=["designbase-wc-breadcrumbs__trigger",(s||e.active)&&"designbase-wc-breadcrumbs__trigger--active",e.disabled&&"designbase-wc-breadcrumbs__trigger--disabled"].filter(Boolean).join(" "),o.setAttribute("aria-haspopup","menu"),o.setAttribute("aria-expanded",String(a)),o.disabled=Boolean(e.disabled),e.icon){const t=document.createElement("span");t.className="designbase-wc-breadcrumbs__icon",t.append(createDbIcon(e.icon,16)),o.append(t)}o.append(this.createLabel(e.label));const l=document.createElement("span");l.className="designbase-wc-breadcrumbs__chevron",l.setAttribute("aria-hidden","true"),l.append(createDbIcon("chevron-down",i)),o.append(l),o.addEventListener("click",t=>{t.stopPropagation(),e.disabled||this.toggleMenu(n)}),r.append(o);const d=document.createElement("div");return d.className="designbase-wc-breadcrumbs__menu",d.setAttribute("role","menu"),e.menu?.forEach((t,s)=>{d.append(this.createMenuItem(t,s,e))}),r.append(d),r}createStandardItem(e,t,s){const i=!e.href||s||e.disabled?document.createElement("span"):document.createElement("a");if(i.className=i instanceof HTMLAnchorElement?["designbase-wc-breadcrumbs__link",e.active&&"designbase-wc-breadcrumbs__link--active",e.disabled&&"designbase-wc-breadcrumbs__link--disabled"].filter(Boolean).join(" "):["designbase-wc-breadcrumbs__text",s&&"designbase-wc-breadcrumbs__text--active",e.disabled&&"designbase-wc-breadcrumbs__text--disabled"].filter(Boolean).join(" "),e.icon){const t=document.createElement("span");t.className="designbase-wc-breadcrumbs__icon",t.append(createDbIcon(e.icon,16)),i.append(t)}return i.append(this.createLabel(e.label)),i instanceof HTMLAnchorElement&&(i.href=e.href||"#"),i.addEventListener("click",t=>{(e.disabled||e.active||s)&&t.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{detail:{item:e},bubbles:!0,composed:!0}))}),i}render(){const e=this.getAttribute("size")||"m",t=this.resolvedVariant,s=this.visibleItems(),i=s.length<this.items.length,n=X[e]||14;this.className=["designbase-wc-breadcrumbs",`designbase-wc-breadcrumbs--${e}`,`designbase-wc-breadcrumbs--${t}`,i&&"designbase-wc-breadcrumbs--collapsed"].filter(Boolean).join(" "),this.setAttribute("role","navigation"),this.setAttribute("aria-label","브레드크럼 네비게이션"),this.replaceChildren();const a=document.createElement("ol");a.className="designbase-wc-breadcrumbs__list",s.forEach((e,t)=>{const i=t===s.length-1,r=document.createElement("li");if(r.className="designbase-wc-breadcrumbs__item",this.shouldUseDropdown(e)?r.append(this.createDropdownItem(e,t,i,n)):r.append(this.createStandardItem(e,t,i)),!i){const e=document.createElement("span");e.className="designbase-wc-breadcrumbs__separator",e.setAttribute("aria-hidden","true"),e.append(createDbIcon("chevron-right",16)),r.append(e)}a.append(r)}),this.append(a)}}customElements.get("db-breadcrumbs")||customElements.define("db-breadcrumbs",DbBreadcrumbs);const Z=["s","m","l"],Q=["default","striped","hoverable"];class DbTable extends HTMLElement{constructor(){super(...arguments),this.internalSelectedRows=[],this.internalSortDirection=null,this.internalPage=1}static get observedAttributes(){return["columns","data","title","size","variant","empty-message","sortable","sort-column","sort-direction","selectable","multi-select","selected-rows","row-key","loading","pagination","page","page-size","total-items","show-count-badge","clickable"]}get columns(){try{return JSON.parse(this.getAttribute("columns")||"[]")}catch{return[]}}set columns(e){this.setAttribute("columns","string"==typeof e?e:JSON.stringify(e))}get data(){try{return JSON.parse(this.getAttribute("data")||"[]")}catch{return[]}}set data(e){this.setAttribute("data","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}attributeChangedCallback(e){"selected-rows"===e&&this.syncSelectedRowsFromAttribute(),"sort-column"!==e&&"sort-direction"!==e||this.syncSortFromAttributes(),"page"===e&&(this.internalPage=Number(this.getAttribute("page")||1)),this.render()}syncSelectedRowsFromAttribute(){try{this.internalSelectedRows=JSON.parse(this.getAttribute("selected-rows")||"[]")}catch{this.internalSelectedRows=[]}}syncSortFromAttributes(){const e=this.getAttribute("sort-column"),t=this.getAttribute("sort-direction");this.internalSortColumn=e||void 0,this.internalSortDirection="asc"===t||"desc"===t?t:null}getRowKey(e,t){const s=e[this.getAttribute("row-key")||"id"];return String(null!=s?s:t)}getSortedData(){const e=this.data,t=this.getAttribute("sort-column")||this.internalSortColumn,s=this.getAttribute("sort-direction")||this.internalSortDirection;if(!t||!s)return e;const i=this.columns.find(e=>e.key===t);return i?.sortable?[...e].sort((e,i)=>{const n=e[t],a=i[t];return n===a?0:null==n?1:null==a?-1:n<a?"asc"===s?-1:1:"asc"===s?1:-1}):e}handleSort(e){if(!this.hasAttribute("sortable")||!e.sortable)return;let t="asc";this.internalSortColumn===e.key&&("asc"===this.internalSortDirection?t="desc":"desc"===this.internalSortDirection&&(t=null)),this.internalSortColumn=t?e.key:void 0,this.internalSortDirection=t,this.dispatchEvent(new CustomEvent("db-sort-change",{bubbles:!0,composed:!0,detail:{column:e.key,direction:t}})),this.render()}handleRowSelect(e,t,s){s?.stopPropagation();let i;i=this.hasAttribute("multi-select")?t?[...this.internalSelectedRows,e]:this.internalSelectedRows.filter(t=>t!==e):t?[e]:[],this.internalSelectedRows=i,this.dispatchEvent(new CustomEvent("db-selection-change",{bubbles:!0,composed:!0,detail:{selectedRows:i}})),this.render()}handleSelectAll(e){const t=e?this.data.map((e,t)=>this.getRowKey(e,t)):[];this.internalSelectedRows=t,this.dispatchEvent(new CustomEvent("db-selection-change",{bubbles:!0,composed:!0,detail:{selectedRows:t}})),this.render()}getPaginatedData(){const e=this.getSortedData();if(!this.hasAttribute("pagination"))return e;const t=Number(this.getAttribute("page-size")||10),s=Number(this.getAttribute("total-items")||e.length),i=Math.max(1,Math.ceil(s/t)),n=(Math.min(this.internalPage,i)-1)*t;return e.slice(n,n+t)}createSortIcon(e){const t=document.createElement("span");t.className="designbase-wc-table__sort-icon";if(!(this.internalSortColumn===e.key&&Boolean(this.internalSortDirection))){t.classList.add("designbase-wc-table__sort-icon--idle");const e=document.createElement("span");return e.className="designbase-wc-table__sort-icon-stack",e.append(createDbIcon("chevron-up",10),createDbIcon("chevron-down",10)),t.append(e),t}return t.classList.add("asc"===this.internalSortDirection?"designbase-wc-table__sort-icon--asc":"designbase-wc-table__sort-icon--desc"),t.append(createDbIcon("asc"===this.internalSortDirection?"chevron-up":"chevron-down",14)),t}createCheckbox(e){const t=document.createElement("db-checkbox");return t.setAttribute("size","s"),t.setAttribute("has-label","false"),e.checked&&t.setAttribute("checked",""),e.indeterminate&&t.setAttribute("indeterminate",""),e.stopPropagation&&t.addEventListener("click",e=>e.stopPropagation()),t.addEventListener("db-change",t=>{const s=t.detail;e.onChange?.(s.checked)}),t}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=Z.includes(e)?e:"m",i=Q.includes(t)?t:"default",n=this.columns,a=this.getPaginatedData(),r=this.getSortedData(),o=this.hasAttribute("loading"),l=this.hasAttribute("selectable"),d=this.hasAttribute("sortable"),u=this.getAttribute("empty-message")||"데이터가 없습니다.";if(this.className=["designbase-wc-table",`designbase-wc-table--${s}`,`designbase-wc-table--${i}`,l&&"designbase-wc-table--selectable",d&&"designbase-wc-table--sortable",o&&"designbase-wc-table--loading"].filter(Boolean).join(" "),this.replaceChildren(),o){const e=document.createElement("div");e.className="designbase-wc-table__loading";const t=document.createElement("div");t.className="designbase-wc-table__loading-spinner";const s=document.createElement("span");return s.textContent="로딩 중...",e.append(t,s),void this.append(e)}const b=this.getAttribute("title"),m=this.hasAttribute("show-count-badge");if(b||m){const e=document.createElement("div");e.className="designbase-wc-table__header";const t=document.createElement("div");if(t.className="designbase-wc-table__header-left",b){const e=document.createElement("h3");e.className="designbase-wc-table__title",e.textContent=b,t.append(e)}if(m){const e=document.createElement("db-badge");e.setAttribute("count",String(this.data.length)),e.setAttribute("badge-style","number"),e.setAttribute("variant","primary"),e.setAttribute("size","s"),t.append(e)}e.append(t),this.append(e)}const p=document.createElement("div");p.className="designbase-wc-table__container";const g=document.createElement("table");g.className="designbase-wc-table__table";const v=document.createElement("thead");v.className="designbase-wc-table__thead";const E=document.createElement("tr");E.className="designbase-wc-table__tr";const f=a.map((e,t)=>this.getRowKey(e,t)),w=f.filter(e=>this.internalSelectedRows.includes(e)),y=this.hasAttribute("clickable");if(l){const e=document.createElement("th");e.className="designbase-wc-table__th designbase-wc-table__th--checkbox";const t=this.createCheckbox({checked:f.length>0&&w.length===f.length,indeterminate:w.length>0&&w.length<f.length,onChange:e=>this.handleSelectAll(e)});e.append(t),E.append(e)}n.forEach(e=>{const t=document.createElement("th");t.className=["designbase-wc-table__th",`designbase-wc-table__th--${e.align||"left"}`,d&&e.sortable&&"designbase-wc-table__th--sortable",this.internalSortColumn===e.key&&this.internalSortDirection&&"designbase-wc-table__th--sorted"].filter(Boolean).join(" "),e.width&&(t.style.width="number"==typeof e.width?`${e.width}px`:e.width);const s=document.createElement("div");s.className="designbase-wc-table__th-content";const i=document.createElement("span");i.className="designbase-wc-table__th-text",i.textContent=e.header,s.append(i),d&&e.sortable&&s.append(this.createSortIcon(e)),t.append(s),d&&e.sortable&&t.addEventListener("click",()=>this.handleSort(e)),E.append(t)}),v.append(E);const A=document.createElement("tbody");if(A.className="designbase-wc-table__tbody",0===r.length){const e=document.createElement("tr");e.className="designbase-wc-table__tr";const t=document.createElement("td");t.className="designbase-wc-table__td designbase-wc-table__td--empty",t.colSpan=Math.max(n.length+(l?1:0),1);const s=document.createElement("db-empty-state");s.setAttribute("title","데이터가 없습니다"),s.setAttribute("description",u),s.setAttribute("variant","no-data"),s.setAttribute("size","m"),t.append(s),e.append(t),A.append(e)}else a.forEach((e,t)=>{const s=this.getRowKey(e,t),i=this.internalSelectedRows.includes(s),a=document.createElement("tr");if(a.className=["designbase-wc-table__tr",y&&"designbase-wc-table__tr--clickable",i&&"designbase-wc-table__tr--selected"].filter(Boolean).join(" "),y&&a.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-row-click",{detail:{item:e,index:t},bubbles:!0,composed:!0}))}),l){const e=document.createElement("td");e.className="designbase-wc-table__td designbase-wc-table__td--checkbox";const t=this.createCheckbox({checked:i,stopPropagation:!0,onChange:e=>this.handleRowSelect(s,e)});e.append(t),a.append(e)}n.forEach(t=>{const s=document.createElement("td");s.className=["designbase-wc-table__td",`designbase-wc-table__td--${t.align||"left"}`].join(" "),s.textContent=String(e[t.key]??""),a.append(s)}),A.append(a)});if(g.append(v,A),p.append(g),this.append(p),this.hasAttribute("pagination")){const e=Number(this.getAttribute("page-size")||10),t=Number(this.getAttribute("total-items")||r.length),i=Math.max(1,Math.ceil(t/e)),n=document.createElement("div");n.className="designbase-wc-table__footer";const a=document.createElement("db-pagination");a.setAttribute("current-page",String(this.internalPage)),a.setAttribute("total-pages",String(i)),a.setAttribute("size",s),a.setAttribute("show-first-last",""),a.addEventListener("db-change",e=>{const t=Number(e.detail?.page||1);this.internalPage=t,this.dispatchEvent(new CustomEvent("db-page-change",{bubbles:!0,composed:!0,detail:{page:t}})),this.render()}),n.append(a),this.append(n)}}}customElements.get("db-table")||customElements.define("db-table",DbTable);const ee="designbase-wc-alert";class DbAlert extends HTMLElement{static get observedAttributes(){return["title","message","variant","size","show-icon","closable","action-label","action-variant","action-buttons"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getIconName(e){return"success"===e?"circle-checked":"warning"===e?"warning-filled":"danger"===e?"error-filled":"info-filled"}parseActionButtons(){const e=this.getAttribute("action-buttons");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}render(){const e=this.getAttribute("variant")||"default",t=this.getAttribute("size")||"m",s="false"!==this.getAttribute("show-icon"),i="false"!==this.getAttribute("closable"),n=this.getAttribute("title")?.trim()||"",a=this.getAttribute("message")?.trim()||"",r=this.getAttribute("action-label"),o=this.getAttribute("action-variant")||"tertiary",l=this.parseActionButtons(),d=Boolean(a),u=Boolean(n),b=u&&!d||!u&&d,m=l.length>0?l:r?[{label:r,variant:o}]:[];this.className=[ee,`${ee}--${e}`,`${ee}--${t}`,s&&`${ee}--with-icon`,i&&`${ee}--closable`,b&&`${ee}--text-single`,m.length>0&&`${ee}--has-actions`].filter(Boolean).join(" "),this.setAttribute("role","alert"),this.setAttribute("aria-live","polite"),this.querySelector(`.${ee}__content`)?.remove(),this.querySelector(`.${ee}__actions`)?.remove(),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.remove()});const p=document.createElement("div");if(p.className=`${ee}__content`,s){const s=document.createElement("div");s.className=`${ee}__icon`,s.append(createDbIcon(this.getIconName(e),"s"===t?16:"l"===t?24:20)),p.append(s)}const g=document.createElement("div");if(g.className=`${ee}__body`,u){const e=document.createElement("div");e.className=`${ee}__title`,e.textContent=n,g.append(e)}if(d){const e=document.createElement("div");e.className=`${ee}__message`,e.textContent=a,g.append(e)}if(p.append(g),m.length>0){const e=document.createElement("div");e.className=`${ee}__actions`;const s=document.createElement("div");s.className=`${ee}__action-buttons`,m.forEach((e,i)=>{const n=document.createElement("db-button");n.setAttribute("variant",e.variant||"tertiary"),n.setAttribute("size",e.size||t),n.textContent=e.label,e.disabled&&n.setAttribute("disabled",""),n.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-action",{bubbles:!0,composed:!0,detail:{index:i,label:e.label}}))}),s.append(n)}),e.append(s),p.append(e)}if(i){const e=document.createElement("button");e.type="button",e.className=`${ee}__close`,e.setAttribute("aria-label","알림 닫기"),e.append(createDbIcon("close",20)),e.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}),p.append(e)}this.replaceChildren(p)}}customElements.get("db-alert")||customElements.define("db-alert",DbAlert);const te=["s","m","l"],se=["default","primary","success","warning","danger","info","neutral"];class DbChip extends HTMLElement{static get observedAttributes(){return["label","size","variant","deletable","disabled","selected","full-width","clickable","start-icon","end-icon"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}iconSize(e){return"s"===e?12:"l"===e?20:16}render(){const e=this.getAttribute("label")||this.textContent?.trim()||"",t=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"default",i=this.hasAttribute("disabled"),n=this.hasAttribute("deletable"),a=this.hasAttribute("selected"),r=this.hasAttribute("full-width"),o=this.hasAttribute("clickable"),l=this.getAttribute("start-icon"),d=this.getAttribute("end-icon"),u=te.includes(t)?t:"m",b=se.includes(s)?s:"default",m=this.iconSize(u);if(this.className=["designbase-wc-chip",`designbase-wc-chip--${u}`,`designbase-wc-chip--${b}`,n&&"designbase-wc-chip--deletable",i&&"designbase-wc-chip--disabled",a&&"designbase-wc-chip--selected",o&&"designbase-wc-chip--clickable",r&&"designbase-wc-chip--full-width"].filter(Boolean).join(" "),this.replaceChildren(),o&&!i?(this.setAttribute("role","button"),this.tabIndex=0):(this.removeAttribute("role"),this.removeAttribute("tabindex")),l){const e=document.createElement("span");e.className="designbase-wc-chip__start-icon",e.append(createDbIcon(l,m)),this.append(e)}const p=document.createElement("span");if(p.className="designbase-wc-chip__label",p.textContent=e,this.append(p),d&&!n){const e=document.createElement("span");e.className="designbase-wc-chip__end-icon",e.append(createDbIcon(d,m)),this.append(e)}if(n){const t=document.createElement("button");t.type="button",t.className="designbase-wc-chip__delete-button",t.disabled=i,t.setAttribute("aria-label",`${e} 삭제`),t.append(createDbIcon("close",m)),t.addEventListener("click",e=>{e.stopPropagation(),i||this.dispatchEvent(new CustomEvent("db-delete",{bubbles:!0,composed:!0}))}),this.append(t)}this.onclick=()=>{!i&&o&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.onkeydown=e=>{"Enter"!==e.key&&" "!==e.key||i||!o||(e.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})))}}}customElements.get("db-chip")||customElements.define("db-chip",DbChip);const ie=["text","circular","rectangular","rounded"],ne=["xs","s","m","l","xl"];function getDefaultSize(e,t){if("circular"===e)switch(t){case"xs":return"16px";case"s":return"24px";case"l":return"48px";case"xl":return"64px";default:return"32px"}switch(t){case"xs":return"12px";case"s":return"16px";case"l":return"24px";case"xl":return"32px";default:return"20px"}}function toCssSize(e){return/^\d+$/.test(e)?`${e}px`:e}class DbSkeleton extends HTMLElement{static get observedAttributes(){return["variant","size","width","height","animation","lines","line-spacing","last-line-width","aria-label"]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}render(){const e=this.getAttribute("variant")||"text",t=this.getAttribute("size")||"m",s=this.getAttribute("animation")||"pulse",i=Number(this.getAttribute("lines")||1),n=this.getAttribute("width"),a=this.getAttribute("height"),r=this.getAttribute("line-spacing")||"8px",o=this.getAttribute("last-line-width")||"60%",l=ie.includes(e)?e:"text",d=ne.includes(t)?t:"m",u=["designbase-wc-skeleton",`designbase-wc-skeleton--${l}`,`designbase-wc-skeleton--${d}`,`designbase-wc-skeleton--${s}`,(n||a)&&"designbase-wc-skeleton--custom-size"].filter(Boolean).join(" ");this.className!==u&&(this.className=u);const b=this.getAttribute("aria-label")??`${l} 스켈레톤 로딩 중`;if(this.getAttribute("aria-label")!==b&&this.setAttribute("aria-label",b),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.replaceChildren(),this.style.width=n?toCssSize(n):"circular"===l?getDefaultSize(l,d):"100%",this.style.height=a?toCssSize(a):"circular"===l?getDefaultSize(l,d):function getTextLineHeight(e){switch(e){case"xs":return"12px";case"s":return"16px";case"l":return"24px";case"xl":return"32px";default:return"20px"}}(d),"text"===l&&i>1)for(let e=1;e<i;e+=1){const t=document.createElement("div");t.className="designbase-wc-skeleton__line",t.style.marginTop=toCssSize(r),e===i-1&&(t.style.width=toCssSize(o)),this.append(t)}}}customElements.get("db-skeleton")||customElements.define("db-skeleton",DbSkeleton);class DbLabel extends HTMLElement{static get observedAttributes(){return["label","html-for","id","size","required","disabled","error"]}connectedCallback(){this.sync()}attributeChangedCallback(){this.sync()}sync(){const e=this.getAttribute("size")||"s",t=this.hasAttribute("required"),s=this.hasAttribute("disabled"),i=this.hasAttribute("error"),n=this.getAttribute("html-for"),a=this.getAttribute("id"),r=this.getAttribute("label");this.className=["designbase-wc-label",`designbase-wc-label--${e}`,s&&"designbase-wc-label--disabled",i&&"designbase-wc-label--error"].filter(Boolean).join(" ");let o=this.querySelector(":scope > label.designbase-wc-label__text");if(null!==r&&""!==r)o||(this.replaceChildren(),o=document.createElement("label"),o.className="designbase-wc-label__text",this.append(o)),o.textContent=r;else if(!o&&this.childNodes.length>0){o=document.createElement("label"),o.className="designbase-wc-label__text";Array.from(this.childNodes).forEach(e=>o.append(e)),this.append(o)}if(o&&(n?o.htmlFor=n:o.removeAttribute("for"),a?o.id=a:o.removeAttribute("id"),o.querySelector(".designbase-wc-label__required")?.remove(),t)){const e=document.createElement("span");e.className="designbase-wc-label__required",e.textContent="*",o.append(e)}}}customElements.get("db-label")||customElements.define("db-label",DbLabel);const ae={xs:{width:96,height:20,markSize:19},s:{width:125,height:26,markSize:25},m:{width:193,height:40,markSize:38},l:{width:256,height:53,markSize:50},xl:{width:320,height:66,markSize:63}};class DbLogo extends HTMLElement{static get observedAttributes(){return["type","text","src","alt","size","variant","clickable","href","target","full-width"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}handleClick(e){(this.hasAttribute("clickable")||this.getAttribute("href"))&&(e.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})))}renderLogoContent(e){const t=this.getAttribute("type")||"designbase",s=this.getAttribute("text")||"Logo",i=this.getAttribute("src"),n=this.getAttribute("alt")||s,a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"original",{width:o,height:l,markSize:d}=function getLogoDimensions(e){return ae[e]||ae.m}(a),u=function getLogoColor(e){if("original"===e)return;const t={light:"#ffffff",dark:"#000000",default:"var(--db-text-primary)",primary:"var(--db-brand-primary)",secondary:"var(--db-text-secondary)",white:"#ffffff"};return t[e]??t.default}(r);if("designbase"===t){const t=document.createElement("div");return t.className="designbase-wc-logo__svg",t.append(function createDesignBaseLogoSvg(e,t,s,i){const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("width",String(e)),n.setAttribute("height",String(t)),n.setAttribute("viewBox","0 0 386 40"),n.setAttribute("fill","none"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("aria-label","DesignBase Logo"),i&&n.setAttribute("class",i);const a=document.createElementNS("http://www.w3.org/2000/svg","g");return a.setAttribute("fill",s||"#000000"),a.innerHTML='\n<polygon points="58.4,23.6 77.3,23.6 77.3,16.2 58.4,16.2 58.4,7.7 79.4,7.7 79.4,0.4 49.5,0.4 49.5,39.6 80,39.6 80,32.3 58.4,32.3"/>\n<path d="M95.6,10.8c0-2.1,2-3.2,5-3.2s8.1,1.6,12.2,4l3.4-7.3c-4.5-2.8-9.6-4.2-14.9-4.2c-9.1,0-15.2,4.5-15.2,11.6 c0,13.9,20.9,9.6,20.9,17c0,2.4-2.2,3.8-5.8,3.8c-4.2,0-9.9-2.3-13.9-5.9l-3.5,7.2c4.9,4,11,6.2,17.3,6.2c8.7,0,15.4-4.1,15.4-11.8 C116.5,13.9,95.6,18,95.6,10.8z"/>\n<rect x="122.7" y="0.4" width="8.8" height="39.2"/>\n<path d="M158.8,7.8c4,0.1,7.8,1.7,10.8,4.4l5-6.3c-4.4-3.7-10-5.7-15.7-5.7c-12.2,0-21.4,8.5-21.4,19.9s9,20,20.9,20 c5.7-0.1,11.2-1.9,15.9-5.1V19.8h-7.6v10.3c-2.4,1.3-5,2-7.7,2.1h-0.4c-6.7-0.1-12.1-5.6-12-12.3v-0.4 C146.7,13,152.2,7.7,158.8,7.8z"/>\n<polygon points="209.1,25.6 190.1,0.4 182,0.4 182,39.6 190.5,39.6 190.5,14.5 209.5,39.6 217.5,39.6 217.5,0.4 209.1,0.4"/>\n<path d="M263.3,18.8c4-0.9,6.9-4.5,6.8-8.6c0-6-5.4-9.8-14-9.8h-24.5v6.5l6.4,1v31.8h18.7c9.1,0,14.8-4.2,14.8-10.9 C271.7,23.8,268.2,19.5,263.3,18.8z M246.9,7.6h8.7c3.4-0.1,5.4,1.5,5.4,4.2s-2,4.4-5.4,4.4h-8.7V7.6z M255.7,32.4h-8.7v-9.3h8.7 c4.1,0,6.7,1.7,6.7,4.5C262.4,30.6,259.8,32.4,255.7,32.4z"/>\n<path d="M290.5,0.4l-17,39.2h9.1l3.1-7.6h18.2l3,7.6h9.5L299.6,0.4H290.5z M288.6,24.9l6.2-15.2l6.2,15.2L288.6,24.9z"/>\n<path d="M328.9,10.8c0-2.1,2-3.2,5-3.2s8.1,1.6,12.2,4l3.4-7.3C345,1.4,339.9,0,334.6,0c-9.1,0-15.2,4.5-15.2,11.6 c0,13.9,20.9,9.6,20.9,17c0,2.4-2.2,3.8-5.8,3.8c-4.1,0-9.9-2.3-13.9-5.9l-3.5,7.2c4.9,4,11,6.2,17.3,6.2c8.7,0,15.4-4.1,15.4-11.8 C349.8,13.9,328.9,18,328.9,10.8z"/>\n<polygon points="364.4,32.3 364.4,23.6 383.3,23.6 383.3,16.2 364.4,16.2 364.4,7.7 385.4,7.7 385.4,0.4 355.5,0.4 355.5,39.6 386,39.6 386,32.3"/>\n<path d="M23.1,0.4H0v6.5l6.5,1v31.8h16.3c12.4,0,21-8.1,21-19.6S35.2,0.4,23.1,0.4z M34.7,20.1c0,7.2-4.8,12.1-11.4,12.1h-8V7.8H23 C29.8,7.8,34.8,12.8,34.7,20.1L34.7,20.1z"/>\n',n.append(a),n}(o,l,u)),void e.append(t)}if("designbase-mark"===t){const t=document.createElement("div");return t.className="designbase-wc-logo__svg",t.append(function createDesignBaseLogoMarkSvg(e,t,s){const i=.95*e,n=e,a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width",String(i)),a.setAttribute("height",String(n)),a.setAttribute("viewBox","0 0 95 100"),a.setAttribute("fill","none"),a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("aria-label","DesignBase Mark"),s&&a.setAttribute("class",s);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("fill",t||"#000000"),r.setAttribute("d","M45,0H0V8l10,2V90L0,92v8H45A50,50,0,0,0,45,0ZM43.12,90H20V10H38.33a15,15,0,0,1,0,30H30.11V50h13a20,20,0,0,1,0,40ZM71.4,80A30,30,0,0,0,55.83,42.83,24.93,24.93,0,0,0,60.27,13,40,40,0,0,1,71.4,80Z"),a.append(r),a}(d,u)),void e.append(t)}if(i){const t=document.createElement("img");return t.className="designbase-wc-logo__image",t.src=i,t.alt=n,void e.append(t)}const b=document.createElement("span");b.className="designbase-wc-logo__text",b.textContent=s,e.append(b)}render(){const e=this.getAttribute("type")||"designbase",t=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"original",i=this.hasAttribute("clickable")||Boolean(this.getAttribute("href")),n=this.hasAttribute("full-width"),a=this.getAttribute("href"),r=this.getAttribute("target")||"_self";this.className="",this.replaceChildren();const o=document.createElement("div");if(o.className=["designbase-wc-logo",`designbase-wc-logo--${t}`,s?`designbase-wc-logo--${s}`:"",i?"designbase-wc-logo--clickable":"",n?"designbase-wc-logo--full-width":"","custom"!==e?"designbase-wc-logo--svg":""].filter(Boolean).join(" "),i&&(o.addEventListener("click",e=>this.handleClick(e)),a||o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))})),this.renderLogoContent(o),a){const e=document.createElement("a");return e.className="designbase-wc-logo__link",e.href=a,e.target=r,"_blank"===r&&(e.rel="noopener noreferrer"),e.append(o),void this.append(e)}this.append(o)}}customElements.get("db-logo")||customElements.define("db-logo",DbLogo);class DbEmptyState extends HTMLElement{static get observedAttributes(){return["variant","size","title","description","action-text","secondary-action-text","image","image-alt"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}getIconName(e){return"no-results"===e?"search":"no-access"===e?"user":"error"===e?"cloud-close":"onboarding"===e?"bulb":"plus"}render(){const e=this.getAttribute("variant")||"no-data",t=this.getAttribute("size")||"m",s=this.getAttribute("title")||"",i=this.getAttribute("description")||"",n=this.getAttribute("action-text"),a=this.getAttribute("secondary-action-text"),r=this.getAttribute("image"),o=this.getAttribute("image-alt")||s,l="s"===t?24:"l"===t?48:32;this.className=`designbase-wc-empty-state designbase-wc-empty-state--${e} designbase-wc-empty-state--${t}`,this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.replaceChildren();const d=document.createElement("div");if(d.className="designbase-wc-empty-state__content",r){const e=document.createElement("div");e.className="designbase-wc-empty-state__image";const t=document.createElement("img");t.className="designbase-wc-empty-state__image-element",t.src=r,t.alt=o,e.append(t),d.append(e)}else{const t=document.createElement("div");t.className="designbase-wc-empty-state__icon",t.append(createDbIcon(this.getIconName(e),l)),d.append(t)}const u=document.createElement("h3");if(u.className="designbase-wc-empty-state__title",u.textContent=s,d.append(u),i){const e=document.createElement("p");e.className="designbase-wc-empty-state__description",e.textContent=i,d.append(e)}if(n||a){const s=document.createElement("div");if(s.className="designbase-wc-empty-state__actions",n){const i=document.createElement("db-button");i.setAttribute("variant","onboarding"===e?"primary":"secondary"),i.setAttribute("size",t),i.textContent=n,i.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-action",{bubbles:!0,composed:!0}))}),s.append(i)}if(a){const e=document.createElement("db-button");e.setAttribute("variant","tertiary"),e.setAttribute("size",t),e.textContent=a,e.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-secondary-action",{bubbles:!0,composed:!0}))}),s.append(e)}d.append(s)}this.append(d)}}customElements.get("db-empty-state")||customElements.define("db-empty-state",DbEmptyState);const oe=["fade","slide","zoom","none"];class DbBackdrop extends HTMLElement{constructor(){super(...arguments),this.keyHandler=null,this.handlePortalClick=e=>{e.target===this.portal&&"true"!==this.getAttribute("disable-backdrop-click")&&(this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})))}}static get observedAttributes(){return["open","blur","opacity","blur-amount","animation","animation-duration","z-index","background-color","disable-backdrop-click","disable-escape-key-down"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}connectedCallback(){this.style.display="contents",this.syncOpenState()}disconnectedCallback(){this.detachListeners(),this.portal?.remove(),this.portal=void 0,document.body.style.overflow=""}attributeChangedCallback(){this.isConnected&&this.syncOpenState()}isOpen(){return this.open}syncOpenState(){this.isOpen()?this.render():(document.body.style.overflow="",this.detachListeners(),this.portal?.remove())}collectChildren(){return Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal"))}attachListeners(){this.keyHandler||(this.keyHandler=e=>{"Escape"===e.key&&"true"!==this.getAttribute("disable-escape-key-down")&&(this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})))},document.addEventListener("keydown",this.keyHandler))}detachListeners(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}render(){if(!this.isOpen())return void this.syncOpenState();const e=this.hasAttribute("blur"),t=this.getAttribute("opacity")||"0.5",s=this.getAttribute("blur-amount")||"4",i=oe.includes(this.getAttribute("animation")||"fade")&&this.getAttribute("animation")||"fade",n=this.getAttribute("animation-duration")||"300",a=this.getAttribute("z-index")||"1000",r=this.getAttribute("background-color"),o=this.collectChildren();document.body.style.overflow="hidden",this.attachListeners(),this.portal||(this.portal=document.createElement("div"),this.portal.setAttribute("data-wc-internal",""),this.portal.addEventListener("click",this.handlePortalClick)),this.portal.className=["designbase-wc-backdrop",`designbase-wc-backdrop--${i}`,"designbase-wc-backdrop--open",e?"designbase-wc-backdrop--blur":""].filter(Boolean).join(" "),this.portal.setAttribute("role","presentation"),this.portal.setAttribute("aria-hidden","false"),this.portal.style.setProperty("--backdrop-opacity",t),this.portal.style.setProperty("--backdrop-blur-amount",`${s}px`),this.portal.style.setProperty("--backdrop-animation-duration",`${n}ms`),this.portal.style.setProperty("--backdrop-z-index",a),r?this.portal.style.backgroundColor=r:this.portal.style.removeProperty("background-color"),this.portal.replaceChildren(...o),this.portal.isConnected||document.body.append(this.portal)}}customElements.get("db-backdrop")||customElements.define("db-backdrop",DbBackdrop);const le=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],de=["click","hover","focus","manual"];class DbPopover extends HTMLElement{constructor(){super(...arguments),this.onDocMouseDown=null,this.onDocKeyDown=null,this.onExternalTriggerClick=null,this.handleTriggerClick=e=>{"click"===this.resolvedTrigger()&&(e.preventDefault(),e.stopPropagation(),this.setOpen(!this.isOpen()))},this.handleTriggerMouseEnter=()=>{"hover"===this.resolvedTrigger()&&this.scheduleOpen()},this.handleTriggerMouseLeave=()=>{"hover"===this.resolvedTrigger()&&this.scheduleClose()},this.handleTriggerFocus=()=>{"focus"===this.resolvedTrigger()&&this.scheduleOpen()},this.handleTriggerBlur=()=>{"focus"===this.resolvedTrigger()&&this.scheduleClose()},this.handleReposition=()=>{this.isOpen()&&(this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.repositionRaf=requestAnimationFrame(()=>{this.positionPanel(),this.repositionRaf=void 0}))}}static get observedAttributes(){return["open","placement","position","title","content","size","variant","trigger","delay","hide-delay","always-show","disabled","max-width","show-arrow","close-on-outside-click","close-on-escape","trigger-id"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}connectedCallback(){this.classList.add("designbase-wc-popover-host"),this.hasAttribute("placement")||this.hasAttribute("position")||this.setAttribute("placement","top"),this.render(),this.childObserver=new MutationObserver(()=>this.render()),this.childObserver.observe(this,{childList:!0}),this.bindExternalTrigger(),this.attachGlobalListeners(),this.syncOpenFromAttributes()}disconnectedCallback(){this.childObserver?.disconnect(),this.clearTimers(),this.repositionRaf&&cancelAnimationFrame(this.repositionRaf),this.unbindExternalTrigger(),this.detachGlobalListeners(),this.removePanel()}attributeChangedCallback(e){this.isConnected&&("trigger-id"===e&&(this.unbindExternalTrigger(),this.bindExternalTrigger()),"open"!==e&&"always-show"!==e&&"disabled"!==e?("content"===e&&this.bodyEl&&(this.bodyEl.textContent=this.getAttribute("content")||""),this.isOpen()&&(this.updatePanelMetadata(),requestAnimationFrame(()=>this.positionPanel()))):this.syncOpenFromAttributes())}resolvedPlacement(){const e=this.getAttribute("position")||this.getAttribute("placement")||"top";return le.includes(e)?e:"top"}resolvedTrigger(){const e=this.getAttribute("trigger")||"click";return de.includes(e)?e:"click"}isControlled(){return this.hasAttribute("open")}isOpen(){return!this.hasAttribute("disabled")&&(!!this.hasAttribute("always-show")||(this.isControlled()?"false"!==this.getAttribute("open"):this.panel?.classList.contains("designbase-wc-popover--visible")??!1))}setOpen(e){this.hasAttribute("disabled")||this.hasAttribute("always-show")||(this.isControlled()?e?this.setAttribute("open",""):this.removeAttribute("open"):e?this.showPanel():this.hidePanel(),this.dispatchEvent(new CustomEvent("db-open-change",{bubbles:!0,composed:!0,detail:{open:e}})),e||this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})))}syncOpenFromAttributes(){this.hasAttribute("always-show")?this.showPanel():this.isControlled()&&("false"!==this.getAttribute("open")?this.showPanel():this.hidePanel())}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=void 0,this.hideTimer=void 0}groupOf(e){return e.startsWith("top")?"top":e.startsWith("bottom")?"bottom":e.startsWith("left")?"left":"right"}collectTriggerChildren(){const isInternalNode=e=>e.hasAttribute("data-wc-internal")||e===this.triggerWrap,e=Array.from(this.children).filter(e=>!isInternalNode(e));return e.length>0?e:Array.from(this.triggerWrap?.children||[])}ensureTriggerWrap(){this.triggerWrap||(this.triggerWrap=document.createElement("span"),this.triggerWrap.className="designbase-wc-popover__trigger",this.triggerWrap.setAttribute("data-wc-internal",""),this.triggerWrap.tabIndex=0,this.triggerWrap.addEventListener("click",this.handleTriggerClick),this.triggerWrap.addEventListener("mouseenter",this.handleTriggerMouseEnter),this.triggerWrap.addEventListener("mouseleave",this.handleTriggerMouseLeave),this.triggerWrap.addEventListener("focus",this.handleTriggerFocus),this.triggerWrap.addEventListener("blur",this.handleTriggerBlur))}mountTriggerChildren(e){this.triggerWrap&&e.forEach(e=>{e.parentElement!==this.triggerWrap&&this.triggerWrap.append(e)})}collectBodyChildren(){return Array.from(this.querySelectorAll('[slot="content"]'))}bindExternalTrigger(){const e=this.getAttribute("trigger-id");e&&(this.triggerEl=document.getElementById(e),this.triggerEl&&(this.onExternalTriggerClick=()=>{"click"===this.resolvedTrigger()&&this.setOpen(!this.isOpen())},this.triggerEl.addEventListener("click",this.onExternalTriggerClick)))}unbindExternalTrigger(){this.triggerEl&&this.onExternalTriggerClick&&this.triggerEl.removeEventListener("click",this.onExternalTriggerClick),this.triggerEl=null,this.onExternalTriggerClick=null}attachGlobalListeners(){this.onDocMouseDown=e=>{if(!this.isOpen()||"false"===this.getAttribute("close-on-outside-click"))return;const t=e.target;this.panel?.contains(t)||this.triggerWrap?.contains(t)||this.triggerEl?.contains(t)||this.setOpen(!1)},this.onDocKeyDown=e=>{"Escape"===e.key&&this.isOpen()&&"false"!==this.getAttribute("close-on-escape")&&this.setOpen(!1)},document.addEventListener("mousedown",this.onDocMouseDown),document.addEventListener("keydown",this.onDocKeyDown)}detachGlobalListeners(){this.onDocMouseDown&&document.removeEventListener("mousedown",this.onDocMouseDown),this.onDocKeyDown&&document.removeEventListener("keydown",this.onDocKeyDown),this.onDocMouseDown=null,this.onDocKeyDown=null}scheduleOpen(){this.clearTimers();const e="hover"===this.resolvedTrigger()?Math.max(0,Number(this.getAttribute("delay")||0)):0;this.showTimer=setTimeout(()=>this.showPanel(),e)}scheduleClose(){this.clearTimers();const e="hover"===this.resolvedTrigger()?Math.max(0,Number(this.getAttribute("hide-delay")||80)):0;this.hideTimer=setTimeout(()=>this.setOpen(!1),e)}getTriggerRect(){const e=this.triggerEl||this.triggerWrap;return e?.getBoundingClientRect()}flipPlacementIfNeeded(e,t,s){const i=window.innerHeight,n=window.innerWidth,a=this.groupOf(e),r=t.top-s.height-8>=8,o=t.bottom+8+s.height<=i-8,l=t.left-s.width-8>=8,d=t.right+8+s.width<=n-8;return"top"===a&&!r&&o?e.replace(/^top/,"bottom"):"bottom"===a&&!o&&r?e.replace(/^bottom/,"top"):"left"===a&&!l&&d?e.replace(/^left/,"right"):"right"===a&&!d&&l?e.replace(/^right/,"left"):e}applyCoords(e,t,s){let i=0,n=0,a=0,r=0;const o=s.height,l=s.width,d=16;switch(e){case"top":i=t.top-s.height-8,n=t.left+t.width/2-s.width/2,a=o-5,r=l/2-5;break;case"top-start":i=t.top-s.height-8,n=t.left,a=o-5,r=11;break;case"top-end":i=t.top-s.height-8,n=t.right-s.width,a=o-5,r=l-d-5;break;case"bottom":i=t.bottom+8,n=t.left+t.width/2-s.width/2,a=-5,r=l/2-5;break;case"bottom-start":i=t.bottom+8,n=t.left,a=-5,r=11;break;case"bottom-end":i=t.bottom+8,n=t.right-s.width,a=-5,r=l-d-5;break;case"left":i=t.top+t.height/2-s.height/2,n=t.left-s.width-8,a=o/2-5,r=l-5;break;case"left-start":i=t.top,n=t.left-s.width-8,a=11,r=l-5;break;case"left-end":i=t.bottom-s.height,n=t.left-s.width-8,a=o-d-5,r=l-5;break;case"right":i=t.top+t.height/2-s.height/2,n=t.right+8,a=o/2-5,r=-5;break;case"right-start":i=t.top,n=t.right+8,a=11,r=-5;break;case"right-end":i=t.bottom-s.height,n=t.right+8,a=o-d-5,r=-5}const u=window.innerWidth,b=window.innerHeight;return n<8&&(n=8),n+s.width>u-8&&(n=u-s.width-8),i<8&&(i=8),i+s.height>b-8&&(i=b-s.height-8),{top:i,left:n,aTop:a,aLeft:r,placement:e}}positionPanel(){if(!this.panel)return;const e=this.getTriggerRect();if(!e)return;const t=Number(this.getAttribute("max-width")||300);this.panel.style.maxWidth=`${t}px`,this.panel.offsetHeight;const s=this.panel.getBoundingClientRect(),i=this.resolvedPlacement(),n=this.flipPlacementIfNeeded(i,e,s),{top:a,left:r,aTop:o,aLeft:l}=this.applyCoords(n,e,s);this.panel.style.top=`${a}px`,this.panel.style.left=`${r}px`,this.panel.dataset.placementGroup=this.groupOf(n),le.forEach(e=>{this.panel.classList.toggle(`designbase-wc-popover--${e}`,e===n)}),this.arrowEl&&(this.arrowEl.className=`designbase-wc-popover__arrow designbase-wc-popover__arrow--${n}`,this.arrowEl.style.top=`${o}px`,this.arrowEl.style.left=`${l}px`)}revealPanel(){this.panel&&(this.panel.classList.remove("designbase-wc-popover--visible"),this.positionPanel(),this.panel.offsetHeight,this.positionPanel(),this.panel.classList.add("designbase-wc-popover--visible"))}updatePanelMetadata(){if(!this.panel)return;const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.resolvedPlacement();this.panel.className=["designbase-wc-popover",`designbase-wc-popover--${e}`,`designbase-wc-popover--${t}`,`designbase-wc-popover--${s}`,this.isOpen()?"designbase-wc-popover--visible":"",this.hasAttribute("disabled")?"designbase-wc-popover--disabled":""].filter(Boolean).join(" ")}ensurePanel(){if(this.panel)return;const e=document.createElement("div");e.className="designbase-wc-popover",e.setAttribute("data-wc-internal",""),e.setAttribute("role","dialog"),e.setAttribute("aria-modal","false"),e.style.position="fixed",e.style.zIndex="9999";const t=document.createElement("div");t.className="designbase-wc-popover__content";const s=document.createElement("div");s.className="designbase-wc-popover__header";const i=document.createElement("h3");i.className="designbase-wc-popover__title";const n=document.createElement("db-button");n.className="designbase-wc-popover__close-button",n.setAttribute("variant","ghost"),n.setAttribute("size","s"),n.setAttribute("icon-only",""),n.setAttribute("start-icon","close"),n.setAttribute("aria-label","팝오버 닫기"),n.addEventListener("db-click",e=>{e.stopPropagation(),this.setOpen(!1)}),s.append(i,n),this.bodyEl=document.createElement("div"),this.bodyEl.className="designbase-wc-popover__body",t.append(s,this.bodyEl),e.append(t),"false"!==this.getAttribute("show-arrow")&&(this.arrowEl=document.createElement("div"),this.arrowEl.className=`designbase-wc-popover__arrow designbase-wc-popover__arrow--${this.resolvedPlacement()}`,e.append(this.arrowEl)),this.panel=e,this.panel.querySelector(".designbase-wc-popover__title").textContent=this.getAttribute("title")||"",this.panel.querySelector(".designbase-wc-popover__title").hidden=!this.getAttribute("title"),document.body.append(e),e.addEventListener("mouseenter",()=>{"hover"===this.resolvedTrigger()&&this.clearTimers()}),e.addEventListener("mouseleave",()=>{"hover"===this.resolvedTrigger()&&this.scheduleClose()})}showPanel(){if(this.hasAttribute("disabled"))return;this.ensurePanel(),this.updatePanelMetadata();const e=this.collectBodyChildren();e.length>0?this.bodyEl.replaceChildren(...e.map(e=>e.cloneNode(!0))):this.bodyEl.textContent=this.getAttribute("content")||"";const t=this.panel.querySelector(".designbase-wc-popover__title");t.textContent=this.getAttribute("title")||"",t.hidden=!this.getAttribute("title"),requestAnimationFrame(()=>{this.revealPanel(),window.addEventListener("scroll",this.handleReposition,!0),window.addEventListener("resize",this.handleReposition)})}hidePanel(){this.panel?.classList.remove("designbase-wc-popover--visible"),window.removeEventListener("scroll",this.handleReposition,!0),window.removeEventListener("resize",this.handleReposition),this.hasAttribute("always-show")||this.removePanel()}removePanel(){this.panel?.remove(),this.panel=void 0,this.bodyEl=void 0,this.arrowEl=void 0}render(){this.ensureTriggerWrap();const e=this.collectTriggerChildren();this.mountTriggerChildren(e);const t=Boolean(this.getAttribute("trigger-id"));this.triggerWrap&&(e.length>0||!t?this.triggerWrap.parentElement!==this&&this.append(this.triggerWrap):this.triggerWrap.parentElement===this&&this.triggerWrap.remove()),this.hasAttribute("always-show")&&this.showPanel()}}customElements.get("db-popover")||customElements.define("db-popover",DbPopover);const ce=["left","right","top","bottom"],he=["s","m","l","xl","full"];class DbDrawer extends HTMLElement{constructor(){super(...arguments),this.isMounted=!1,this.isActive=!1,this.previousActiveElement=null,this.keyHandler=null}static get observedAttributes(){return["open","title","position","size","show-close-button","close-on-backdrop-click","close-on-escape","animation-duration","show-overlay","overlay-closable","z-index","trap-focus","drawer-id"]}connectedCallback(){this.style.display="contents",this.render(),this.syncOpenState()}disconnectedCallback(){this.clearTimers(),this.detachEscape(),this.root?.remove(),this.root=void 0,document.body.style.overflow="",this.previousActiveElement&&this.previousActiveElement.focus()}attributeChangedCallback(e){this.isConnected&&("open"!==e?(this.render(),this.isMounted&&this.syncActiveClasses()):this.syncOpenState())}isOpenRequested(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}clearTimers(){null!=this.enterFrame&&(cancelAnimationFrame(this.enterFrame),this.enterFrame=void 0),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=void 0)}attachEscape(){this.keyHandler||(this.keyHandler=e=>{"Escape"===e.key&&"false"!==this.getAttribute("close-on-escape")&&this.close()},document.addEventListener("keydown",this.keyHandler))}detachEscape(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}close(){this.setAttribute("open","false"),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}collectChildren(){return Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal"))}syncOpenState(){const e=this.isOpenRequested(),t=Number(this.getAttribute("animation-duration")||300);if(this.clearTimers(),e)return this.render(),this.isMounted=!0,this.isActive=!1,this.syncActiveClasses(),this.root&&!this.root.isConnected&&document.body.append(this.root),"false"!==this.getAttribute("trap-focus")&&(this.previousActiveElement=document.activeElement),this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=void 0,this.isActive=!0,this.syncActiveClasses(),"false"!==this.getAttribute("trap-focus")&&this.container?.focus()})}),document.body.style.overflow="hidden",void this.attachEscape();this.isActive=!1,this.syncActiveClasses(),this.exitTimer=setTimeout(()=>{this.exitTimer=void 0,this.isMounted=!1,this.syncActiveClasses(),this.root?.remove(),document.body.style.overflow="",this.detachEscape(),"false"!==this.getAttribute("trap-focus")&&this.previousActiveElement&&(this.previousActiveElement.focus(),this.previousActiveElement=null)},t),this.detachEscape()}syncActiveClasses(){this.root&&(this.root.classList.toggle("designbase-wc-drawer--open",this.isActive),this.root.classList.toggle("designbase-wc-drawer--closing",this.isMounted&&!this.isActive),this.overlay?.classList.toggle("designbase-wc-drawer__overlay--open",this.isActive),this.container?.classList.toggle("designbase-wc-drawer__container--open",this.isActive))}render(){const e=ce.includes(this.getAttribute("position")||"right")&&this.getAttribute("position")||"right",t=he.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",s=this.getAttribute("title"),i="false"!==this.getAttribute("show-close-button"),n="false"!==this.getAttribute("show-overlay"),a=this.getAttribute("animation-duration")||"300",r=this.getAttribute("z-index")||"1000",o=this.getAttribute("drawer-id")||"drawer",l=this.collectChildren();this.root||(this.root=document.createElement("div"),this.root.setAttribute("data-wc-internal",""),this.overlay=document.createElement("div"),this.overlay.className="designbase-wc-drawer__overlay",this.overlay.setAttribute("aria-hidden","true"),this.overlay.addEventListener("click",e=>{if(e.target!==this.overlay)return;const t="false"!==this.getAttribute("overlay-closable"),s="false"!==this.getAttribute("close-on-backdrop-click");t&&s&&this.close()}),this.container=document.createElement("div"),this.container.className=`designbase-wc-drawer__container designbase-wc-drawer__container--${e}`,this.container.setAttribute("role","dialog"),this.container.setAttribute("aria-modal","true"),this.container.tabIndex=-1,this.container.addEventListener("click",e=>e.stopPropagation()),this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-drawer__content",this.container.append(this.contentEl)),this.root.className=["designbase-wc-drawer",`designbase-wc-drawer--${e}`,`designbase-wc-drawer--${t}`].join(" "),this.root.style.setProperty("--drawer-animation-duration",`${a}ms`),this.root.style.setProperty("--drawer-z-index",r),this.container.className=`designbase-wc-drawer__container designbase-wc-drawer__container--${e}`,this.container.id=o,s?this.container.setAttribute("aria-labelledby",`${o}-title`):this.container.removeAttribute("aria-labelledby"),this.contentEl.id=`${o}-content`,this.root.replaceChildren(),n&&this.overlay&&this.root.append(this.overlay);if(Boolean(s)||i){const e=document.createElement("div");if(e.className="designbase-wc-drawer__header",s){const t=document.createElement("h2");t.className="designbase-wc-drawer__title",t.id=`${o}-title`,t.textContent=s,e.append(t)}if(i){const t=document.createElement("db-button");t.className="designbase-wc-drawer__close-button",t.setAttribute("variant","ghost"),t.setAttribute("size","s"),t.setAttribute("icon-only",""),t.setAttribute("start-icon","close"),t.setAttribute("aria-label","닫기"),t.addEventListener("db-click",e=>{e.stopPropagation(),this.close()}),e.append(t)}this.container.replaceChildren(e,this.contentEl)}else this.container.replaceChildren(this.contentEl);this.contentEl.replaceChildren(...l),this.root.append(this.container),this.isMounted&&!this.root.isConnected&&document.body.append(this.root)}}customElements.get("db-drawer")||customElements.define("db-drawer",DbDrawer);class DbToast extends HTMLElement{constructor(){super(...arguments),this.timeoutId=null,this.progressInterval=null,this.closeTimerId=null,this.closed=!1}static get observedAttributes(){return["toast-id","status","title","description","duration","show-close","show-progress","auto-remove"]}connectedCallback(){this.closed=!1,this.render(),this.startTimers(),requestAnimationFrame(()=>this.classList.add("designbase-wc-toast--visible"))}disconnectedCallback(){this.clearTimers(),this.closeTimerId&&clearTimeout(this.closeTimerId),this.closeTimerId=null}attributeChangedCallback(e){if(!this.isConnected||this.closed)return;const t=this.classList.contains("designbase-wc-toast--visible");this.render(),t&&requestAnimationFrame(()=>this.classList.add("designbase-wc-toast--visible")),"duration"!==e&&"show-progress"!==e||(this.clearTimers(),this.startTimers())}clearTimers(){this.timeoutId&&clearTimeout(this.timeoutId),this.progressInterval&&clearInterval(this.progressInterval),this.timeoutId=null,this.progressInterval=null}startTimers(){const e=Number(this.getAttribute("duration")??"5000");if(!Number.isFinite(e)||e<=0)return;if("false"!==this.getAttribute("show-progress")&&this.hasAttribute("show-progress")){const t=this.querySelector(".designbase-wc-toast__progress-bar");t&&(t.style.width="0%");const s=Date.now();return void(this.progressInterval=setInterval(()=>{const i=Date.now()-s,n=Math.min(100,i/e*100);t&&(t.style.width=`${n}%`),n>=100&&this.close()},16))}this.timeoutId=setTimeout(()=>this.close(),e)}close(){this.closed||(this.closed=!0,this.clearTimers(),this.classList.remove("designbase-wc-toast--visible"),this.classList.add("designbase-wc-toast--closing"),this.closeTimerId&&clearTimeout(this.closeTimerId),this.closeTimerId=setTimeout(()=>{this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0,detail:{id:this.getAttribute("toast-id")||""}}));("true"===this.getAttribute("auto-remove")||this.hasAttribute("auto-remove")&&"false"!==this.getAttribute("auto-remove"))&&this.remove()},300))}iconForStatus(e){return"success"===e?"circle-checked":"warning"===e?"warning-filled":"error"===e?"error-filled":"info-filled"}render(){const e=this.getAttribute("status")||"info",t=this.getAttribute("title")||"",s=this.getAttribute("description")||"",i="false"!==this.getAttribute("show-close"),n="false"!==this.getAttribute("show-progress")&&this.hasAttribute("show-progress");if(this.className=["designbase-wc-toast",`designbase-wc-toast--${e}`,this.closed&&"designbase-wc-toast--closing"].filter(Boolean).join(" "),this.setAttribute("role","alert"),this.setAttribute("aria-live","assertive"),this.replaceChildren(),n){const e=document.createElement("div");e.className="designbase-wc-toast__progress";const t=document.createElement("div");t.className="designbase-wc-toast__progress-bar",t.style.width="0%",e.append(t),this.append(e)}const a=document.createElement("div");a.className=`designbase-wc-toast__icon designbase-wc-toast__icon--${e}`,a.append(createDbIcon(this.iconForStatus(e),20));const r=document.createElement("div");r.className="designbase-wc-toast__content";const o=document.createElement("div");if(o.className="designbase-wc-toast__title",o.textContent=t,r.append(o),s){const e=document.createElement("div");e.className="designbase-wc-toast__description",e.textContent=s,r.append(e)}if(this.append(a,r),i){const e=document.createElement("button");e.type="button",e.className="designbase-wc-toast__close-button",e.setAttribute("aria-label","토스트 닫기"),e.append(createDbIcon("close",20)),e.addEventListener("click",()=>this.close()),this.append(e)}}}customElements.get("db-toast")||customElements.define("db-toast",DbToast);class DbConfirm extends HTMLElement{constructor(){super(...arguments),this.root=null,this.keyHandler=null}static get observedAttributes(){return["open","title","message","confirm-text","cancel-text","confirm-variant","variant","size","show-icon","initial-focus","confirm-disabled","cancel-disabled","close-on-escape","close-on-backdrop"]}connectedCallback(){this.render()}disconnectedCallback(){this.detachEscape(),document.body.style.overflow="",this.root?.remove(),this.root=null}attributeChangedCallback(){this.render()}isOpen(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}attachEscape(){this.keyHandler||(this.keyHandler=e=>{"Escape"===e.key&&"false"!==this.getAttribute("close-on-escape")&&this.dispatchCancel()},document.addEventListener("keydown",this.keyHandler))}detachEscape(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}dispatchCancel(){this.setAttribute("open","false"),this.dispatchEvent(new CustomEvent("db-cancel",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}dispatchConfirm(){this.setAttribute("open","false"),this.dispatchEvent(new CustomEvent("db-confirm",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}iconForVariant(e){return"success"===e?"award":"warning"===e?"bell-active":"danger"===e?"cloud-close":"bulb"}iconSize(e){return"s"===e?20:"l"===e?32:24}render(){if(this.root?.remove(),this.root=null,this.detachEscape(),!this.isOpen())return document.body.style.overflow="",void this.replaceChildren();document.body.style.overflow="hidden",this.attachEscape();const e=this.getAttribute("title")||"",t=this.getAttribute("message")||this.textContent?.trim()||"",s=this.getAttribute("confirm-text")||"확인",i=this.getAttribute("cancel-text")||"취소",n=this.getAttribute("confirm-variant")||"primary",a=this.getAttribute("variant")||"info",r=this.getAttribute("size")||"s",o="false"!==this.getAttribute("show-icon"),l=this.getAttribute("initial-focus")||"confirm",d="true"===this.getAttribute("confirm-disabled"),u="true"===this.getAttribute("cancel-disabled"),b=document.createElement("div");b.className="designbase-wc-confirm__overlay",b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),e&&b.setAttribute("aria-labelledby","confirm-title"),b.setAttribute("aria-describedby","confirm-content"),b.addEventListener("click",e=>{e.target===b&&"false"!==this.getAttribute("close-on-backdrop")&&this.dispatchCancel()});const m=document.createElement("div");m.className=["designbase-wc-confirm__modal",`designbase-wc-confirm__modal--${a}`,`designbase-wc-confirm__modal--${r}`,!o&&"designbase-wc-confirm__modal--no-icon"].filter(Boolean).join(" ");const p=document.createElement("div");if(p.className=["designbase-wc-confirm__header",!o&&"designbase-wc-confirm__header--no-icon"].filter(Boolean).join(" "),o){const e=document.createElement("div");e.className="designbase-wc-confirm__icon",e.append(createDbIcon(this.iconForVariant(a),this.iconSize(r))),p.append(e)}const g=document.createElement("div");if(g.className="designbase-wc-confirm__title-area",e){const t=document.createElement("h2");t.id="confirm-title",t.className="designbase-wc-confirm__title",t.textContent=e,g.append(t)}p.append(g),m.append(p);const v=document.createElement("div");v.id="confirm-content",v.className="designbase-wc-confirm__content",v.textContent=t,m.append(v);const E=document.createElement("div");E.className="designbase-wc-confirm__footer";const f=document.createElement("db-button");f.setAttribute("variant","tertiary"),f.setAttribute("full-width",""),f.textContent=i,u&&f.setAttribute("disabled",""),f.addEventListener("db-click",()=>this.dispatchCancel());const w=document.createElement("db-button");w.setAttribute("variant",n),w.setAttribute("full-width",""),w.textContent=s,d&&w.setAttribute("disabled",""),w.addEventListener("db-click",()=>this.dispatchConfirm()),E.append(f,w),m.append(E),b.append(m),document.body.append(b),this.root=b,requestAnimationFrame(()=>{("cancel"===l?f:w).focus()})}}customElements.get("db-confirm")||customElements.define("db-confirm",DbConfirm);const ue=["dots","numbers","line","dot-line","slide","fill","combined"],be=["s","m","l"],me=["horizontal","vertical"];class DbIndicator extends HTMLElement{constructor(){super(...arguments),this.timerFrame=0,this.progress=0,this.pausedProgress=0,this.activeStep=0,this.isPlayingInternal=!1}static get observedAttributes(){return["total","current","default-current","indicator-type","type","size","direction","number-background","playback","clickable","timer","timer-duration","auto-roll","playing","default-playing","playback-disabled"]}get total(){return Math.max(1,Number(this.getAttribute("total")||1))}set total(e){this.setAttribute("total",String(e))}normalizeStep(e){const t=this.total;return(e%t+t)%t}get isCurrentControlled(){return this.hasAttribute("current")}get isPlayingControlled(){return this.hasAttribute("playing")}get resolvedCurrent(){return this.isCurrentControlled?this.normalizeStep(Number(this.getAttribute("current")||0)):this.activeStep}get resolvedPlaying(){return!!this.isPlayingControlled||this.isPlayingInternal}get indicatorType(){const e=this.getAttribute("indicator-type")||this.getAttribute("type")||"dots";return ue.includes(e)?e:"dots"}get size(){const e=this.getAttribute("size")||"m";return be.includes(e)?e:"m"}set size(e){this.setAttribute("size",e)}get direction(){const e=this.getAttribute("direction")||"horizontal";return me.includes(e)?e:"horizontal"}set direction(e){this.setAttribute("direction",e)}get numberBackground(){return this.hasAttribute("number-background")}set numberBackground(e){this.toggleAttribute("number-background",Boolean(e))}get playback(){return this.hasAttribute("playback")}set playback(e){this.toggleAttribute("playback",Boolean(e))}get clickable(){return this.hasAttribute("clickable")}set clickable(e){this.toggleAttribute("clickable",Boolean(e))}get timer(){return this.hasAttribute("timer")}set timer(e){this.toggleAttribute("timer",Boolean(e))}connectedCallback(){this.activeStep=this.normalizeStep(Number(this.getAttribute("default-current")||0)),this.isPlayingInternal=this.hasAttribute("default-playing"),this.render(),this.startTimer()}disconnectedCallback(){cancelAnimationFrame(this.timerFrame)}attributeChangedCallback(e){if(this.isConnected){if("current"===e&&this.isCurrentControlled)return this.resetProgress(),this.render(),void this.startTimer();if("playing"===e)return this.resolvedPlaying||(this.pausedProgress=this.progress),this.syncRootClasses(),this.syncPlaybackButton(),void this.startTimer();if("default-current"===e&&!this.isCurrentControlled)return this.activeStep=this.normalizeStep(Number(this.getAttribute("default-current")||0)),this.resetProgress(),this.render(),void this.startTimer();if("default-playing"===e&&!this.isPlayingControlled)return this.isPlayingInternal=this.hasAttribute("default-playing"),this.syncRootClasses(),this.syncPlaybackButton(),void this.startTimer();if("timer"===e||"timer-duration"===e||"auto-roll"===e)return this.resetProgress(),this.render(),void this.startTimer();this.render(),this.startTimer()}}resetProgress(){this.pausedProgress=0,this.progress=0}emitChange(e){const t={current:e,index:e};this.dispatchEvent(new CustomEvent("db-change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-current-change",{detail:t,bubbles:!0,composed:!0}))}goToStep(e){const t=this.normalizeStep(e);this.isCurrentControlled||(this.activeStep=t,this.resetProgress(),this.render(),this.startTimer()),this.emitChange(t)}startTimer(){if(cancelAnimationFrame(this.timerFrame),!this.timer||!this.resolvedPlaying||!this.isConnected)return;const e=Number(this.getAttribute("timer-duration")||3e3),t=Date.now()-this.pausedProgress*e,tick=()=>{const s=Date.now()-t,i=Math.min(s/e,1);this.progress=i,this.pausedProgress=i,this.updateTimerVisuals(),i<1?this.timerFrame=requestAnimationFrame(tick):(this.dispatchEvent(new CustomEvent("db-timer-complete",{detail:{step:this.resolvedCurrent},bubbles:!0,composed:!0})),this.resetProgress(),"false"===this.getAttribute("auto-roll")?this.render():this.goToStep(this.resolvedCurrent+1))};this.timerFrame=requestAnimationFrame(tick)}updateTimerVisuals(){this.querySelectorAll(".designbase-wc-indicator__line-fill, .designbase-wc-indicator__track-fill, .designbase-wc-indicator__dot-line-fill").forEach(e=>{e.style.transform="vertical"===this.direction?`scaleY(${this.progress})`:`scaleX(${this.progress})`});const e=this.querySelector(".designbase-wc-indicator__track-progress");if(e){const t=100*this.fillRatio()+"%";"vertical"===this.direction?e.style.height=t:e.style.width=t}const t=this.querySelector(".designbase-wc-indicator__dot-ring-progress");if(t){const e=15.9155,s=2*Math.PI*e;t.setAttribute("stroke-dashoffset",String(s*(1-this.progress)))}}syncRootClasses(){const e=this.indicatorType;this.className=["designbase-wc-indicator",`designbase-wc-indicator--${e}`,"combined"===e&&"designbase-wc-indicator--dots",`designbase-wc-indicator--${this.size}`,`designbase-wc-indicator--${this.direction}`,this.clickable&&"designbase-wc-indicator--clickable",this.timer&&!this.resolvedPlaying&&"designbase-wc-indicator--paused"].filter(Boolean).join(" ")}syncPlaybackButton(){const e=this.querySelector(".designbase-wc-indicator__playback-button");e&&(e.disabled=this.hasAttribute("playback-disabled"),e.setAttribute("aria-label",this.resolvedPlaying?"일시정지":"재생"),e.replaceChildren(createDbIcon(this.resolvedPlaying?"pause":"play")))}renderDotRing(){const e=15.9155,t=2*Math.PI*e,s=document.createElement("span");s.className="designbase-wc-indicator__dot-ring",s.setAttribute("aria-hidden","true");const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("class","designbase-wc-indicator__dot-ring-svg"),i.setAttribute("viewBox","0 0 36 36");const n=document.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("class","designbase-wc-indicator__dot-ring-bg"),n.setAttribute("cx","18"),n.setAttribute("cy","18"),n.setAttribute("r",String(e)),n.setAttribute("fill","none");const a=document.createElementNS("http://www.w3.org/2000/svg","circle");return a.setAttribute("class","designbase-wc-indicator__dot-ring-progress"),a.setAttribute("cx","18"),a.setAttribute("cy","18"),a.setAttribute("r",String(e)),a.setAttribute("fill","none"),a.setAttribute("stroke-dasharray",String(t)),a.setAttribute("stroke-dashoffset",String(t*(1-this.progress))),a.setAttribute("stroke-linecap","round"),i.append(n,a),s.append(i),s}renderStep(e,t,s){const i=e===this.resolvedCurrent,n=this.clickable?document.createElement("button"):document.createElement("span");return n.className=t,this.clickable&&n instanceof HTMLButtonElement?(n.type="button",n.setAttribute("aria-label",`${e+1}단계`),i&&n.setAttribute("aria-current","step"),n.addEventListener("click",()=>{this.goToStep(e),this.dispatchEvent(new CustomEvent("db-step-click",{detail:{current:e,index:e},bubbles:!0,composed:!0}))})):i||n.setAttribute("aria-hidden","true"),s&&n.append(s),n}renderDots(){const e=document.createDocumentFragment(),t=this.indicatorType,s="combined"===t?"dots":t,i=this.timer,n=this.resolvedPlaying,a=this.resolvedCurrent;this.direction;const r=this.total;if("dots"!==s)return e;for(let t=0;t<r;t+=1){const s=t===a,r=i&&s&&n,o=document.createElement("span");o.className="designbase-wc-indicator__dot-core";const l=document.createDocumentFragment();l.append(o),i&&s&&(r||this.progress>0)&&l.append(this.renderDotRing()),e.append(this.renderStep(t,["designbase-wc-indicator__dot",s&&"designbase-wc-indicator__dot--active"].filter(Boolean).join(" "),l))}return e}renderPlaybackButton(){const e=document.createElement("button");return e.type="button",e.className="designbase-wc-indicator__playback-button",e.disabled=this.hasAttribute("playback-disabled"),e.setAttribute("aria-label",this.resolvedPlaying?"일시정지":"재생"),e.append(createDbIcon(this.resolvedPlaying?"pause":"play")),e.addEventListener("click",()=>{if(this.hasAttribute("playback-disabled"))return;const e=!this.resolvedPlaying;this.isPlayingControlled?e?this.setAttribute("playing",""):(this.removeAttribute("playing"),this.pausedProgress=this.progress):(this.isPlayingInternal=e,e||(this.pausedProgress=this.progress)),this.syncRootClasses(),this.syncPlaybackButton(),this.startTimer(),this.dispatchEvent(new CustomEvent("db-playing-change",{detail:{playing:e},bubbles:!0,composed:!0}))}),e}renderNumbers(){const e=document.createElement("div");e.className=["designbase-wc-indicator__numbers",this.numberBackground&&"designbase-wc-indicator__numbers--bg"].filter(Boolean).join(" ");const t=document.createElement("span");t.className="designbase-wc-indicator__current",t.textContent=String(this.resolvedCurrent+1);const s=document.createElement("span");s.className="designbase-wc-indicator__separator",s.textContent="/";const i=document.createElement("span");return i.className="designbase-wc-indicator__total",i.textContent=String(this.total),e.append(t,s,i),e}renderSlide(){const e=this.direction,t=this.resolvedCurrent,s=document.createElement("div");s.className="designbase-wc-indicator__track";const i=document.createElement("div");i.className="designbase-wc-indicator__track-thumb";const n=100/this.total;if("vertical"===e?(i.style.height=`${n}%`,i.style.transform=`translateY(${100*t}%)`):(i.style.width=`${n}%`,i.style.transform=`translateX(${100*t}%)`),this.timer&&this.resolvedPlaying){const t=document.createElement("div");t.className="designbase-wc-indicator__track-fill",t.style.transform="vertical"===e?`scaleY(${this.progress})`:`scaleX(${this.progress})`,i.append(t)}return s.append(i),s}renderScaleFill(e){const t=document.createElement("span");return t.className=e,t.style.transform="vertical"===this.direction?`scaleY(${this.progress})`:`scaleX(${this.progress})`,t}renderLine(){const e=document.createDocumentFragment(),t=this.timer,s=this.resolvedPlaying,i=this.resolvedCurrent;for(let n=0;n<this.total;n+=1){const a=n===i,r=t&&a&&s?this.renderScaleFill("designbase-wc-indicator__line-fill"):void 0;e.append(this.renderStep(n,["designbase-wc-indicator__line-segment",a&&!t&&"designbase-wc-indicator__line-segment--active",a&&t&&"designbase-wc-indicator__line-segment--current"].filter(Boolean).join(" "),r))}return e}renderDotLine(){const e=document.createDocumentFragment(),t=this.timer,s=this.resolvedPlaying,i=this.resolvedCurrent;for(let n=0;n<this.total;n+=1){const a=n===i,r=t&&a&&s?this.renderScaleFill("designbase-wc-indicator__dot-line-fill"):void 0;e.append(this.renderStep(n,["designbase-wc-indicator__dot-line-item",a&&!t&&"designbase-wc-indicator__dot-line-item--active",a&&t&&"designbase-wc-indicator__dot-line-item--current"].filter(Boolean).join(" "),r))}return e}fillRatio(){const e=this.resolvedCurrent,t=e/this.total,s=1/this.total;return this.timer&&this.resolvedPlaying?Math.min(t+s*this.progress,1):(e+1)/this.total}renderFill(){const e=document.createElement("div");e.className="designbase-wc-indicator__track";const t=document.createElement("div");t.className="designbase-wc-indicator__track-progress";const s=100*this.fillRatio()+"%";return"vertical"===this.direction?t.style.height=s:t.style.width=s,e.append(t),e}renderContent(){const e="combined"===this.indicatorType?"dots":this.indicatorType;return"numbers"===e?this.renderNumbers():"slide"===e?this.renderSlide():"fill"===e?this.renderFill():"line"===e?this.renderLine():"dot-line"===e?this.renderDotLine():this.renderDots()}render(){const e=this.indicatorType,t=this.resolvedCurrent,s=this.total;this.syncRootClasses(),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","1"),this.setAttribute("aria-valuemax",String(s)),this.setAttribute("aria-valuenow",String(t+1)),this.replaceChildren();if("combined"===e||this.playback){const e=document.createElement("div");return e.className="designbase-wc-indicator__steps",e.append(this.renderContent()),void this.append(e,this.renderPlaybackButton())}this.append(this.renderContent())}}customElements.get("db-indicator")||customElements.define("db-indicator",DbIndicator);class DbList extends HTMLElement{constructor(){super(...arguments),this.groupName=`db-list-${Math.random().toString(36).slice(2,9)}`}static get observedAttributes(){return["items","size","variant","layout","spacing","selectable","multiple","selected-items","empty-message","show-description","show-arrow","show-badge","loading","loading-count"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}get selectedItems(){const e=this.getAttribute("selected-items")||"[]";try{const t=JSON.parse(e);return Array.isArray(t)?t.map(String):[]}catch{return[]}}set selectedItems(e){this.setAttribute("selected-items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}attributeChangedCallback(e){this.isConnected&&("selected-items"!==e?this.render():this.syncSelectionState())}flag(e,t=!0){return this.hasAttribute(e)?"false"!==this.getAttribute(e):t}controlSize(){return"l"===(this.getAttribute("size")||"m")?"m":"s"}parseBadge(e){return e?"string"==typeof e?{text:e,variant:"primary",style:"text"}:{text:e.text,variant:e.variant||"primary",style:e.style||"text"}:null}isSelected(e){return e.selected||this.selectedItems.includes(e.id)}setSelection(e){const t=JSON.stringify(e);this.getAttribute("selected-items")!==t?(this.setAttribute("selected-items",t),this.syncSelectionState(),this.dispatchEvent(new CustomEvent("db-select",{detail:{selectedItems:e},bubbles:!0,composed:!0}))):this.syncSelectionState()}toggleSelection(e){const t=this.hasAttribute("multiple"),s=this.selectedItems;let i;i=t?s.includes(e)?s.filter(t=>t!==e):[...s,e]:s.includes(e)?[]:[e],this.setSelection(i)}syncSelectionState(){const e=new Set(this.selectedItems);this.querySelectorAll(":scope > .designbase-wc-list__item").forEach(t=>{const s=t.dataset.itemId;if(!s)return;const i=e.has(s);t.classList.toggle("designbase-wc-list__item--selected",i),t.setAttribute("aria-selected",String(i));const n=t.querySelector("db-checkbox, db-radio");n&&(i?n.setAttribute("checked",""):n.removeAttribute("checked"))})}createSelectControl(e,t){const s=document.createElement("div");s.className="designbase-wc-list__item-select";const i=document.createElement(t?"db-checkbox":"db-radio");return i.setAttribute("has-label","false"),i.setAttribute("size",this.controlSize()),i.setAttribute("value",e.id),t||i.setAttribute("name",this.groupName),this.isSelected(e)&&i.setAttribute("checked",""),e.disabled&&i.setAttribute("disabled",""),i.addEventListener("click",e=>e.stopPropagation()),i.addEventListener("db-change",t=>{t.stopPropagation(),e.disabled||this.toggleSelection(e.id)}),s.append(i),s}createBadge(e){const t=document.createElement("db-badge");return t.setAttribute("size","s"),t.setAttribute("variant",e.variant),t.setAttribute("badge-style",e.style),"number"===e.style?t.setAttribute("count",e.text):t.textContent=e.text,t}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"navigation",s=this.getAttribute("layout")||"vertical",i=this.getAttribute("spacing")||"s",n=this.hasAttribute("selectable"),a=this.hasAttribute("multiple"),r=this.hasAttribute("loading"),o=Number(this.getAttribute("loading-count")||3),l=this.flag("show-description",!1),d=this.flag("show-arrow",!0),u=this.flag("show-badge",!0),b=this.items,m="s"===e?16:"l"===e?24:20;if(this.className=["designbase-wc-list",`designbase-wc-list--size-${e}`,`designbase-wc-list--variant-${t}`,`designbase-wc-list--layout-${s}`,`designbase-wc-list--spacing-${i}`,n&&"designbase-wc-list--selectable",a&&"designbase-wc-list--multiple",r&&"designbase-wc-list--loading"].filter(Boolean).join(" "),this.replaceChildren(),r)for(let e=0;e<o;e+=1){const e=document.createElement("div");e.className="designbase-wc-list__item designbase-wc-list__item--loading",e.innerHTML='\n <div class="designbase-wc-list__item-skeleton">\n <div class="designbase-wc-list__item-skeleton-icon"></div>\n <div class="designbase-wc-list__item-skeleton-content">\n <div class="designbase-wc-list__item-skeleton-title"></div>\n <div class="designbase-wc-list__item-skeleton-description"></div>\n </div>\n </div>\n ',this.append(e)}else{if(0===b.length){const e=document.createElement("div");return e.className="designbase-wc-list__empty",e.textContent=this.getAttribute("empty-message")||"항목이 없습니다.",void this.append(e)}b.forEach((r,o)=>{const b=this.isSelected(r),p=l&&Boolean(r.description),g=Boolean(r.meta?.length),v=this.parseBadge(r.badge),E=Boolean(u&&v||d),f=document.createElement("div");if(f.className=["designbase-wc-list__item",`designbase-wc-list__item--size-${e}`,`designbase-wc-list__item--variant-${t}`,`designbase-wc-list__item--layout-${s}`,`designbase-wc-list__item--spacing-${i}`,b&&"designbase-wc-list__item--selected",r.disabled&&"designbase-wc-list__item--disabled",(n||!r.disabled)&&"designbase-wc-list__item--clickable",r.icon&&"designbase-wc-list__item--with-leading",(p||g)&&"designbase-wc-list__item--with-secondary",E&&"designbase-wc-list__item--with-trailing"].filter(Boolean).join(" "),f.dataset.itemId=r.id,f.tabIndex=r.disabled?-1:0,n&&f.setAttribute("aria-selected",String(b)),n&&f.append(this.createSelectControl(r,a)),r.icon){const e=document.createElement("div");e.className="designbase-wc-list__item-icon",e.append(createDbIcon(r.icon,m)),f.append(e)}else if(r.image){const e=document.createElement("div");e.className="designbase-wc-list__item-image";const t=document.createElement("img");t.src=r.image,t.alt=r.title,e.append(t),f.append(e)}const w=document.createElement("div");w.className="designbase-wc-list__item-content";const y=document.createElement("div");y.className="designbase-wc-list__item-header";const A=document.createElement("h4");if(A.className="designbase-wc-list__item-title",A.textContent=r.title,y.append(A),w.append(y),p){const e=document.createElement("p");e.className="designbase-wc-list__item-description",e.textContent=r.description||"",w.append(e)}if(g&&r.meta){const e=document.createElement("div");e.className="designbase-wc-list__item-meta",r.meta.forEach(t=>{const s=document.createElement("div");s.className="designbase-wc-list__item-meta-item";const i=document.createElement("span");i.className="designbase-wc-list__item-meta-label",i.textContent=`${t.label}:`;const n=document.createElement("span");n.className="designbase-wc-list__item-meta-value",n.textContent=t.value,s.append(i,n),e.append(s)}),w.append(e)}if(f.append(w),E){const e=document.createElement("div");if(e.className="designbase-wc-list__item-trailing",u&&v&&e.append(this.createBadge(v)),d){const t=document.createElement("div");t.className="designbase-wc-list__item-arrow",t.setAttribute("aria-hidden","true"),t.append(createDbIcon("chevron-right",16)),e.append(t)}f.append(e)}const handleActivate=()=>{r.disabled||(this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:r,index:o},bubbles:!0,composed:!0})),n&&this.toggleSelection(r.id))};f.addEventListener("click",handleActivate),f.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),handleActivate())}),this.append(f)})}}}customElements.get("db-list")||customElements.define("db-list",DbList);class DbMenuItem extends HTMLElement{static get observedAttributes(){return["label","href","icon","active","disabled","badge","badge-color","size","variant","type","menu-style","expanded","expandable","sub-items","depth"]}get subItems(){try{return JSON.parse(this.getAttribute("sub-items")||"[]")}catch{return[]}}set subItems(e){this.setAttribute("sub-items","string"==typeof e?e:JSON.stringify(e))}get expanded(){return this.hasAttribute("expanded")}set expanded(e){this.toggleAttribute("expanded",e)}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}iconSize(e){return"s"===e?16:"l"===e?24:20}render(){const e=this.getAttribute("label")||"",t=this.getAttribute("href")||"",s=this.getAttribute("icon"),i=this.getAttribute("size")||"m",n=this.getAttribute("variant")||"default",a=this.getAttribute("type")||"block",r=this.getAttribute("menu-style")||"accordion",o=Number(this.getAttribute("depth")||0),l=this.hasAttribute("active"),d=this.hasAttribute("disabled"),u=this.getAttribute("badge")||"",b=this.getAttribute("badge-color")||"primary",m=this.subItems,p=m.length>0,g=this.hasAttribute("expandable")||p,v=this.expanded,E=this.iconSize(i);this.className=["designbase-wc-menu-item",`designbase-wc-menu-item--${a}`,`designbase-wc-menu-item--${i}`,`designbase-wc-menu-item--${n}`,`designbase-wc-menu-item--${r}`,`designbase-wc-menu-item--depth-${o}`,l&&"designbase-wc-menu-item--active",d&&"designbase-wc-menu-item--disabled",g&&"designbase-wc-menu-item--expandable",v&&"designbase-wc-menu-item--expanded",p&&"designbase-wc-menu-item--with-children",u&&"designbase-wc-menu-item--with-badge",s&&"designbase-wc-menu-item--with-icon"].filter(Boolean).join(" "),this.replaceChildren();const f=document.createElement("div");if(f.className=["designbase-wc-menu-item__content","designbase-wc-menu-item__content--clickable"].join(" "),s){const e=document.createElement("div");e.className=["designbase-wc-menu-item__icon",`designbase-wc-menu-item__icon--${n}`,l&&"designbase-wc-menu-item__icon--active",d&&"designbase-wc-menu-item__icon--disabled"].filter(Boolean).join(" "),e.append(createDbIcon(s,E)),f.append(e)}const w=document.createElement("span");if(w.className="designbase-wc-menu-item__label",w.textContent=e,f.append(w),u){const e=document.createElement("db-badge");e.setAttribute("size","s"),e.setAttribute("variant",b),e.setAttribute("badge-style","number"),e.setAttribute("count",u),f.append(e)}if(p){const e=document.createElement("div");e.className="designbase-wc-menu-item__expand-icon",e.append(createDbIcon(v?"chevron-up":"chevron-down",16)),f.append(e)}if(f.addEventListener("click",s=>{d||(p&&g?(s.preventDefault(),this.expanded=!this.expanded):t&&(window.location.href=t),this.dispatchEvent(new CustomEvent("db-click",{detail:{label:e,href:t,expanded:this.expanded},bubbles:!0,composed:!0})))}),this.append(f),p&&v){const e=document.createElement("div");e.className=`designbase-wc-menu-item__children designbase-wc-menu-item__children--${r}`,m.forEach(t=>{const s=document.createElement("db-menu-item");s.setAttribute("label",t.label),s.setAttribute("type","block"),s.setAttribute("menu-style",r),s.setAttribute("size",i),s.setAttribute("depth",String(o+1)),t.href&&s.setAttribute("href",t.href),t.icon&&s.setAttribute("icon",t.icon),t.active&&s.setAttribute("active",""),t.disabled&&s.setAttribute("disabled",""),void 0!==t.badge&&s.setAttribute("badge",String(t.badge)),t.badgeColor&&s.setAttribute("badge-color",t.badgeColor),t.variant&&s.setAttribute("variant",t.variant),s.addEventListener("db-click",e=>{e.stopPropagation(),t.disabled||this.dispatchEvent(new CustomEvent("db-child-click",{detail:{child:t},bubbles:!0,composed:!0}))}),e.append(s)}),this.append(e)}}}customElements.get("db-menu-item")||customElements.define("db-menu-item",DbMenuItem);const pe=["s","m","l"],ge=["vertical","horizontal"];class DbSearchBar extends HTMLElement{constructor(){super(...arguments),this.recentSearches=[],this.isFocused=!1,this.currentSuggestion=0,this.scrollParents=[]}static get observedAttributes(){return["value","default-value","placeholder","size","disabled","readonly","full-width","show-shortcut","shortcut-label","enable-recent-searches","recent-searches-key","recent-searches-layout","suggested-searches","suggestion-rolling-interval","categories","selected-category","search-results","empty-state-message"]}getResolvedSize(){const e=this.getAttribute("size")||"m";return pe.includes(e)?e:"m"}getIconPx(){return getDbComponentIconSize(this.getResolvedSize())}syncIcons(){const e=this.getIconPx();this.querySelector(".designbase-wc-search-bar__search-icon")?.replaceChildren(createDbIcon("search",e)),this.clearButton?.replaceChildren(createDbIcon("close",e))}hasInputValue(){return Boolean((this.input?.value??this.getAttribute("value")??"").trim())}get value(){return this.input?.value??this.getAttribute("value")??""}set value(e){this.setAttribute("value",e),this.input&&(this.input.value=e)}connectedCallback(){this.loadRecentSearches(),this.render(),this.bindGlobalShortcut()}disconnectedCallback(){this.clearSuggestionInterval(),this.unbindGlobalShortcut(),this.detachDropdownPortal(),this.blurTimer&&clearTimeout(this.blurTimer)}attributeChangedCallback(e){if(this.isConnected)return"value"===e&&this.input?(this.input.value=this.getAttribute("value")||"",this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),void this.syncSuggestionRolling()):"disabled"===e||"readonly"===e||"placeholder"===e||"show-shortcut"===e||"shortcut-label"===e||"selected-category"===e||"search-results"===e||"empty-state-message"===e||"suggested-searches"===e?(this.syncAttributes(),this.syncPlaceholder(),this.updateDropdown(),void this.syncSuggestionRolling()):"enable-recent-searches"===e||"recent-searches-key"===e?(this.loadRecentSearches(),void this.updateDropdown()):void("categories"!==e&&"recent-searches-layout"!==e?this.render():this.updateDropdown())}focus(){this.input?.focus()}parseJsonArray(e){try{const t=JSON.parse(this.getAttribute(e)||"[]");return Array.isArray(t)?t:[]}catch{return[]}}getRecentSearchesKey(){return this.getAttribute("recent-searches-key")||"searchbar-recent-searches"}loadRecentSearches(){if(this.hasAttribute("enable-recent-searches"))try{const e=localStorage.getItem(this.getRecentSearchesKey());this.recentSearches=e?JSON.parse(e):[],Array.isArray(this.recentSearches)||(this.recentSearches=[])}catch{this.recentSearches=[]}else this.recentSearches=[]}saveRecentSearches(){try{localStorage.setItem(this.getRecentSearchesKey(),JSON.stringify(this.recentSearches))}catch{}}clearSuggestionInterval(){this.suggestionInterval&&(clearInterval(this.suggestionInterval),this.suggestionInterval=void 0)}syncSuggestionRolling(){this.clearSuggestionInterval();const e=this.parseJsonArray("suggested-searches"),t=this.hasInputValue(),s=Number(this.getAttribute("suggestion-rolling-interval")||5e3);e.length>0&&!t&&(this.suggestionInterval=setInterval(()=>{this.currentSuggestion=(this.currentSuggestion+1)%e.length,this.syncPlaceholder(),this.updateDropdown()},s))}syncPlaceholder(){if(!this.input)return;const e=this.parseJsonArray("suggested-searches"),t=this.hasInputValue(),s=this.getAttribute("placeholder")||"검색...";e.length>0&&!t?this.input.placeholder=e[this.currentSuggestion]||s:this.input.placeholder=s}syncValueState(){const e=this.hasInputValue();this.classList.toggle("designbase-wc-search-bar--has-value",e),this.clearButton&&(this.clearButton.hidden=!e||this.hasAttribute("disabled")||this.hasAttribute("readonly")),this.shortcutBadge&&(this.shortcutBadge.hidden=!this.hasAttribute("show-shortcut")||e||this.hasAttribute("disabled")||this.hasAttribute("readonly")),this.syncIcons()}syncAttributes(){const e=this.getAttribute("size")||"m",t=this.hasAttribute("disabled"),s=this.hasAttribute("readonly"),i=this.hasAttribute("show-shortcut");this.className=["designbase-wc-search-bar",`designbase-wc-search-bar--${pe.includes(e)?e:"m"}`,t&&"designbase-wc-search-bar--disabled",s&&"designbase-wc-search-bar--readonly",this.hasAttribute("full-width")&&"designbase-wc-search-bar--full-width",Boolean(this.hasInputValue())&&"designbase-wc-search-bar--has-value"].filter(Boolean).join(" "),this.input&&(this.input.disabled=t,this.input.readOnly=s),this.shortcutBadge&&(this.shortcutBadge.hidden=!i||this.hasInputValue()||t||s,this.shortcutBadge.textContent=this.getAttribute("shortcut-label")||"⌘K"),this.syncValueState()}bindGlobalShortcut(){this.unbindGlobalShortcut(),!this.hasAttribute("show-shortcut")||this.hasAttribute("disabled")||this.hasAttribute("readonly")||(this.globalKeyHandler=e=>{const t=e.metaKey||e.ctrlKey;let s="k";const i=(this.getAttribute("shortcut-label")||"⌘K").slice(-1).toLowerCase();i&&(s=i),t&&e.key.toLowerCase()===s&&(e.preventDefault(),this.focus())},window.addEventListener("keydown",this.globalKeyHandler))}unbindGlobalShortcut(){this.globalKeyHandler&&(window.removeEventListener("keydown",this.globalKeyHandler),this.globalKeyHandler=void 0)}positionDropdown(){if(!this.dropdown||this.dropdown.hidden)return;const e=this.getBoundingClientRect(),t=this.input?.getBoundingClientRect(),s=t??e;this.dropdown.style.top=`${s.bottom+4}px`,this.dropdown.style.left=`${e.left}px`,this.dropdown.style.width=`${e.width}px`,this.dropdown.style.right="auto"}bindRepositionListeners(){if(this.repositionHandler)return;this.repositionHandler=()=>{requestAnimationFrame(()=>this.positionDropdown())},window.addEventListener("scroll",this.repositionHandler,!0),window.addEventListener("resize",this.repositionHandler),this.scrollParents=[];let e=this.parentElement;for(;e&&e!==document.body;){const t=getComputedStyle(e),s=/(auto|scroll|overlay)/.test(t.overflowY),i=/(auto|scroll|overlay)/.test(t.overflow);(s||i)&&e.scrollHeight>e.clientHeight&&(e.addEventListener("scroll",this.repositionHandler,{passive:!0}),this.scrollParents.push(e)),e=e.parentElement}}unbindRepositionListeners(){this.repositionHandler&&(window.removeEventListener("scroll",this.repositionHandler,!0),window.removeEventListener("resize",this.repositionHandler),this.scrollParents.forEach(e=>e.removeEventListener("scroll",this.repositionHandler)),this.scrollParents=[],this.repositionHandler=void 0)}attachDropdownPortal(){this.dropdown&&!this.dropdown.hidden&&(this.dropdown.classList.add("designbase-wc-search-bar__dropdown--portal"),this.dropdown.parentElement!==document.body&&document.body.append(this.dropdown),requestAnimationFrame(()=>this.positionDropdown()),this.repositionHandler||this.bindRepositionListeners())}detachDropdownPortal(){this.unbindRepositionListeners(),this.dropdown&&(this.dropdown.classList.remove("designbase-wc-search-bar__dropdown--portal"),this.dropdown.style.top="",this.dropdown.style.left="",this.dropdown.style.width="",this.dropdown.style.right="",this.dropdown.parentElement===document.body&&this.isConnected&&this.append(this.dropdown))}shouldShowDropdown(){const e=this.hasInputValue(),t=this.parseJsonArray("categories"),s=this.parseJsonArray("suggested-searches"),i=this.getAttribute("search-results"),n=this.getAttribute("empty-state-message");return this.isFocused&&(t.length>0||this.hasAttribute("enable-recent-searches")&&this.recentSearches.length>0&&!e||s.length>0&&!e||null!==i&&e||Boolean(n)&&!e&&(!this.hasAttribute("enable-recent-searches")||0===this.recentSearches.length)&&0===s.length)}formatSearchResult(e){if("string"==typeof e||"number"==typeof e)return String(e);if(e&&"object"==typeof e){const t=e;if("string"==typeof t.title)return t.title;if("string"==typeof t.label)return t.label}return String(e)}handleSearch(e){const t=(e??this.value).trim();t&&(this.dispatchEvent(new CustomEvent("db-search",{detail:{value:t},bubbles:!0,composed:!0})),this.hasAttribute("enable-recent-searches")&&(this.recentSearches=[t,...this.recentSearches.filter(e=>e!==t)].slice(0,10),this.saveRecentSearches(),this.updateDropdown()))}updateDropdown(){if(!this.dropdown)return;const e=this.shouldShowDropdown();if(this.dropdown.hidden=!e,this.classList.toggle("designbase-wc-search-bar--dropdown-open",e),!e)return this.dropdown.replaceChildren(),void this.detachDropdownPortal();this.dropdown.replaceChildren();const t=this.hasInputValue(),s=this.parseJsonArray("categories"),i=this.parseJsonArray("suggested-searches"),n=this.getAttribute("selected-category")||"",a=this.parseJsonArray("search-results"),r=this.getAttribute("empty-state-message"),o=ge.includes(this.getAttribute("recent-searches-layout")||"vertical")&&this.getAttribute("recent-searches-layout")||"vertical";if(s.length>0){const e=document.createElement("div");e.className="designbase-wc-search-bar__categories",s.forEach(t=>{const s=document.createElement("db-chip");s.setAttribute("label",t),s.setAttribute("size","s"),s.setAttribute("variant",t===n?"primary":"default"),s.setAttribute("clickable",""),s.addEventListener("mousedown",e=>{e.preventDefault(),this.setAttribute("selected-category",t),this.dispatchEvent(new CustomEvent("db-category-change",{detail:{category:t},bubbles:!0,composed:!0})),this.updateDropdown()}),e.append(s)}),this.dropdown.append(e)}if(t&&this.hasAttribute("search-results")){const e=document.createElement("div");if(e.className="designbase-wc-search-bar__results",a.length>0){const t=document.createElement("ul");t.className="designbase-wc-search-bar__results-list",a.forEach((e,s)=>{const i=document.createElement("li");i.className="designbase-wc-search-bar__result-item",i.textContent=this.formatSearchResult(e),i.addEventListener("mousedown",t=>{t.preventDefault(),this.isFocused=!1,this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-search-result-click",{detail:{result:e,index:s},bubbles:!0,composed:!0}))}),t.append(i)}),e.append(t)}else{const t=document.createElement("div");t.className="designbase-wc-search-bar__results-empty",t.textContent="검색 결과가 없습니다.",e.append(t)}return this.dropdown.append(e),void this.attachDropdownPortal()}if(this.hasAttribute("enable-recent-searches")&&!t&&this.recentSearches.length>0){const e=document.createElement("div");e.className=`designbase-wc-search-bar__recent-searches designbase-wc-search-bar__recent-searches--${o}`;const t=document.createElement("div");t.className="designbase-wc-search-bar__recent-header";const s=document.createElement("span");s.className="designbase-wc-search-bar__recent-title",s.textContent="최근 검색어";const i=document.createElement("button");i.type="button",i.className="designbase-wc-search-bar__clear-all-button",i.setAttribute("aria-label","모든 최근 검색어 삭제"),i.textContent="전체 삭제",i.addEventListener("mousedown",e=>{e.preventDefault(),this.recentSearches=[];try{localStorage.removeItem(this.getRecentSearchesKey())}catch{}this.updateDropdown()}),t.append(s,i);const n=document.createElement("div");n.className="designbase-wc-search-bar__recent-list",this.recentSearches.forEach(e=>{const t=document.createElement("div");t.className="designbase-wc-search-bar__recent-item";const s=document.createElement("button");s.type="button",s.className="designbase-wc-search-bar__recent-search-button",s.textContent=e,s.addEventListener("mousedown",t=>{if(t.preventDefault(),!this.input)return;this.input.value=e,this.setAttribute("value",e),this.syncValueState(),this.syncPlaceholder(),this.handleSearch(e);const s={value:e};this.dispatchEvent(new CustomEvent("db-input",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:s,bubbles:!0,composed:!0})),this.isFocused=!1,this.updateDropdown()});const i=document.createElement("button");i.type="button",i.className="designbase-wc-search-bar__recent-remove-button",i.setAttribute("aria-label",`${e} 삭제`),i.append(createDbIcon("close",getDbComponentIconSize("s"))),i.addEventListener("mousedown",t=>{t.preventDefault(),this.recentSearches=this.recentSearches.filter(t=>t!==e),this.saveRecentSearches(),this.updateDropdown()}),t.append(s,i),n.append(t)}),e.append(t,n),this.dropdown.append(e)}if(i.length>0&&!t){const e=document.createElement("div");e.className="designbase-wc-search-bar__suggestions";const t=document.createElement("div");t.className="designbase-wc-search-bar__suggestions-header";const s=document.createElement("span");s.className="designbase-wc-search-bar__suggestions-title",s.textContent="추천 검색어",t.append(s);const n=document.createElement("div");n.className="designbase-wc-search-bar__suggestions-list",i.forEach((e,t)=>{const s=document.createElement("button");s.type="button",s.className=["designbase-wc-search-bar__suggestion-item",t===this.currentSuggestion&&"designbase-wc-search-bar__suggestion-item--active"].filter(Boolean).join(" "),s.textContent=e,s.addEventListener("mousedown",t=>{if(t.preventDefault(),!this.input)return;this.clearSuggestionInterval(),this.input.value=e,this.setAttribute("value",e),this.syncValueState(),this.syncPlaceholder(),this.handleSearch(e);const s={value:e};this.dispatchEvent(new CustomEvent("db-input",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:s,bubbles:!0,composed:!0})),this.isFocused=!1,this.updateDropdown()}),n.append(s)}),e.append(t,n),this.dropdown.append(e)}if(r&&!t&&(!this.hasAttribute("enable-recent-searches")||0===this.recentSearches.length)&&0===i.length){const e=document.createElement("div");e.className="designbase-wc-search-bar__empty-state",e.textContent=r,this.dropdown.append(e)}this.attachDropdownPortal()}render(){const e=this.getAttribute("size")||"m",t=this.hasAttribute("disabled"),s=this.hasAttribute("readonly"),i=this.hasAttribute("full-width"),n=this.hasAttribute("show-shortcut"),a=this.getAttribute("value")??this.getAttribute("default-value")??"",r=Boolean(a.trim()),o=this.getIconPx();this.className=["designbase-wc-search-bar",`designbase-wc-search-bar--${pe.includes(e)?e:"m"}`,t&&"designbase-wc-search-bar--disabled",s&&"designbase-wc-search-bar--readonly",i&&"designbase-wc-search-bar--full-width",r&&"designbase-wc-search-bar--has-value",this.shouldShowDropdown()&&"designbase-wc-search-bar--dropdown-open"].filter(Boolean).join(" "),this.setAttribute("role","search"),this.clearSuggestionInterval(),this.detachDropdownPortal(),this.replaceChildren();const l=document.createElement("div");l.className="designbase-wc-search-bar__container";const d=document.createElement("div");d.className="designbase-wc-search-bar__search-icon",d.setAttribute("aria-hidden","true"),d.append(createDbIcon("search",o));const u=document.createElement("input");if(u.type="text",u.className="designbase-wc-search-bar__input",u.value=a,u.disabled=t,u.readOnly=s,u.setAttribute("aria-label","검색어 입력"),this.input=u,n){const i=document.createElement("db-badge");i.className="designbase-wc-search-bar__shortcut-badge",i.setAttribute("size","l"===e?"m":"s"),i.setAttribute("variant","secondary"),i.setAttribute("badge-style","text"),i.setAttribute("aria-hidden","true"),i.textContent=this.getAttribute("shortcut-label")||"⌘K",i.hidden=r||t||s,this.shortcutBadge=i,l.append(d,u,i)}else l.append(d,u);const b=document.createElement("button");b.type="button",b.className="designbase-wc-search-bar__clear-button",b.setAttribute("aria-label","검색어 지우기"),b.hidden=!r||t||s,b.append(createDbIcon("close",o)),this.clearButton=b,l.append(b);const m=document.createElement("div");m.className="designbase-wc-search-bar__dropdown",m.hidden=!0,m.addEventListener("mousedown",e=>{e.preventDefault()}),this.dropdown=m,u.addEventListener("input",()=>{this.setAttribute("value",u.value),this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),this.syncSuggestionRolling();const e={value:u.value};this.dispatchEvent(new CustomEvent("db-input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:e,bubbles:!0,composed:!0}))}),u.addEventListener("keydown",e=>{"Enter"===e.key&&this.handleSearch()}),u.addEventListener("focus",()=>{this.isFocused=!0,this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-focus",{bubbles:!0,composed:!0}))}),u.addEventListener("blur",()=>{this.isFocused=!1,this.blurTimer&&clearTimeout(this.blurTimer),this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-blur",{bubbles:!0,composed:!0}))}),b.addEventListener("click",()=>{u.value="",this.setAttribute("value",""),this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),this.syncSuggestionRolling(),u.focus(),this.dispatchEvent(new CustomEvent("db-clear",{bubbles:!0,composed:!0}));const e={value:""};this.dispatchEvent(new CustomEvent("db-input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:e,bubbles:!0,composed:!0}))}),this.append(l,m),this.syncIcons(),this.syncPlaceholder(),this.syncSuggestionRolling(),this.bindGlobalShortcut(),this.updateDropdown()}}customElements.get("db-search-bar")||customElements.define("db-search-bar",DbSearchBar);const ve={facebook:'<path fill="currentColor" d="M2.002 12.001c0 4.99 3.656 9.126 8.437 9.879v-6.988h-2.54v-2.891h2.54V9.798c0-2.508 1.493-3.891 3.776-3.891q1.095 0 2.24.195V8.56h-1.264c-1.24 0-1.628.772-1.628 1.563v1.875h2.771l-.443 2.891h-2.328v6.988C18.344 21.129 22 16.992 22 12.001c0-5.522-4.477-10-9.999-10-5.522.001-10 4.478-10 10"/>',x:'<path fill="currentColor" d="M17.801 3h3.066l-6.731 7.638L22 21h-6.171l-4.832-6.297L5.466 21H2.4l7.13-8.17L2 3h6.325l4.365 5.752zm-1.073 16.207h1.7L7.432 4.727H5.605z"/>',instagram:'<path fill="currentColor" fill-rule="evenodd" d="M7.376 12a4.623 4.623 0 1 0 9.246.002A4.623 4.623 0 0 0 7.376 12m1.619 0a3.003 3.003 0 1 1 6.007.001 3.003 3.003 0 0 1-6.007 0m8.889-4.793a1.078 1.078 0 1 0-2.156 0 1.078 1.078 0 0 0 2.156 0m.016-3.728a6.6 6.6 0 0 0-2.186-.42c-.963-.042-1.268-.054-3.71-.054s-2.755 0-3.71.054a6.6 6.6 0 0 0-2.184.42A4.6 4.6 0 0 0 3.477 6.11a6.6 6.6 0 0 0-.419 2.186c-.043.962-.056 1.267-.056 3.71s0 2.753.056 3.71c.015.748.156 1.486.419 2.187a4.6 4.6 0 0 0 2.634 2.632 6.6 6.6 0 0 0 2.185.45c.963.042 1.268.055 3.71.055s2.755 0 3.71-.055a6.6 6.6 0 0 0 2.186-.42 4.61 4.61 0 0 0 2.633-2.632c.263-.7.404-1.438.419-2.186.043-.962.056-1.267.056-3.71s0-2.753-.056-3.71a6.6 6.6 0 0 0-.421-2.217A4.6 4.6 0 0 0 17.9 3.479m1.104 13.852a2.99 2.99 0 0 1-1.712 1.71 5 5 0 0 1-1.67.312c-.95.044-1.218.055-3.654.055-2.438 0-2.687 0-3.655-.055a5 5 0 0 1-1.67-.311 2.99 2.99 0 0 1-1.718-1.711 5.1 5.1 0 0 1-.311-1.67c-.043-.95-.053-1.217-.053-3.653s0-2.686.053-3.655a5 5 0 0 1 .311-1.687c.305-.79.93-1.41 1.719-1.712a5 5 0 0 1 1.669-.311c.95-.043 1.218-.055 3.655-.055s2.687 0 3.654.055a5 5 0 0 1 1.67.31 3 3 0 0 1 1.712 1.713 5.1 5.1 0 0 1 .311 1.669c.043.95.054 1.218.054 3.655s0 2.698-.043 3.654h-.011v-.001a5 5 0 0 1-.311 1.688" clip-rule="evenodd"/>',linkedin:'<path fill="currentColor" fill-rule="evenodd" d="M17 21v-6.75c0-1.059-1.188-1.944-2.246-1.944-1.06 0-1.754.885-1.754 1.944V21H9V9h4v2c.662-1.071 2.356-1.763 3.525-1.763C18.997 9.237 21 11.28 21 13.75V21zM3 21V9h4v12zM7 5a2 2 0 1 1-4 0 2 2 0 0 1 4 0" clip-rule="evenodd"/>',youtube:'<path fill="currentColor" d="M23.498 6.186a3.02 3.02 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.02 3.02 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.02 3.02 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.02 3.02 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814M9.545 15.568V8.432L15.818 12z"/>',pinterest:'<path fill="currentColor" d="M12 2C6.474 2 2 6.478 2 12.008a10 10 0 0 0 6.351 9.316c-.09-.797-.165-1.999.03-2.87.18-.782 1.172-4.974 1.172-4.974s-.3-.601-.3-1.488c0-1.397.81-2.434 1.801-2.434.856 0 1.261.646 1.261 1.413 0 .856-.54 2.149-.825 3.335-.24.992.495 1.804 1.486 1.804 1.772 0 3.138-1.879 3.138-4.583 0-2.39-1.727-4.072-4.174-4.072-2.838 0-4.52 2.133-4.52 4.342 0 .857.33 1.788.751 2.284.075.105.09.18.075.286-.075.315-.24.991-.27 1.127-.045.18-.15.225-.33.135-1.247-.586-2.027-2.404-2.027-3.877 0-3.155 2.297-6.056 6.606-6.056 3.469 0 6.156 2.48 6.156 5.77 0 3.442-2.177 6.222-5.18 6.222-1.006 0-1.967-.526-2.297-1.142l-.616 2.374c-.225.871-.84 1.953-1.246 2.63.931.285 1.922.45 2.958.45 5.526 0 10-4.478 10-10.007C22 6.478 17.526 2 12 2"/>',whatsapp:'<path fill="currentColor" d="M12.042 2a9.92 9.92 0 0 1 7.044 2.906A9.83 9.83 0 0 1 22 11.918c-.003 5.464-4.47 9.91-9.958 9.91h-.005a10 10 0 0 1-4.758-1.206L2 22l1.413-5.136a9.86 9.86 0 0 1-1.329-4.954C2.086 6.446 6.553 2 12.042 2M8.516 7.333a.92.92 0 0 0-.663.31c-.228.249-.872.848-.872 2.066s.89 2.394 1.016 2.562c.124.165 1.722 2.746 4.251 3.739 2.101.825 2.53.661 2.985.62.457-.041 1.473-.6 1.68-1.178s.208-1.074.146-1.178-.229-.165-.478-.289-1.472-.723-1.7-.805-.394-.124-.56.124-.643.805-.788.97c-.145.166-.29.187-.539.063s-1.05-.386-2-1.23c-.74-.656-1.239-1.466-1.385-1.714s-.015-.383.11-.506c.111-.111.248-.29.373-.434.124-.144.166-.248.249-.413s.04-.31-.022-.434c-.062-.123-.545-1.348-.766-1.838-.187-.413-.383-.422-.56-.43z"/>',telegram:'<path fill="currentColor" d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m4.08 6.012c-.375.008-.958.209-3.73 1.366-.975.408-2.915 1.248-5.829 2.514-.466.191-.716.375-.74.558-.042.35.457.458 1.081.657.517.167 1.2.358 1.558.367.325.008.682-.125 1.082-.4 2.72-1.838 4.118-2.77 4.213-2.789.066-.017.15-.033.208.017s.059.15.05.175c-.05.208-2.604 2.537-2.755 2.689-.566.583-1.208.94-.217 1.59.858.566 1.349.924 2.231 1.499.558.366 1 .799 1.583.749.266-.025.54-.275.682-1.024.333-1.765.982-5.603 1.132-7.185.017-.133 0-.308-.017-.392a.44.44 0 0 0-.141-.274c-.125-.1-.308-.117-.39-.117"/>',mail:'<path fill="currentColor" fill-rule="evenodd" d="m1.665 8.67.67-1.34L12 12.161l9.665-4.833.67 1.342L12 13.839z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M4 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h16c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25zM1.25 7A2.75 2.75 0 0 1 4 4.25h16A2.75 2.75 0 0 1 22.75 7v10A2.75 2.75 0 0 1 20 19.75H4A2.75 2.75 0 0 1 1.25 17z" clip-rule="evenodd"/>',link:'<path fill="currentColor" fill-rule="evenodd" d="m15.344 9.698-5.657 5.657-1.06-1.06 5.657-5.657z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M17.819 6.163a4.25 4.25 0 0 0-6.01 0l-1.415 1.414-1.06-1.06 1.414-1.414a5.75 5.75 0 0 1 8.132 8.132l-1.416 1.414-1.06-1.062 1.415-1.413a4.25 4.25 0 0 0 0-6.01M6.154 11.818l1.412-1.412-.53-.531-.53-.53-1.414 1.414-.003.003c-2.22 2.244-2.211 5.86.029 8.075 2.245 2.22 5.824 2.31 8.102.056l.003-.003 1.414-1.414-1.06-1.06-1.412 1.41v.002c-1.67 1.65-4.308 1.608-5.993-.057-1.645-1.627-1.659-4.293-.018-5.953" clip-rule="evenodd"/>',copy:'<path fill="currentColor" fill-rule="evenodd" d="M8 3.75a.25.25 0 0 0-.25.25v12c0 .138.112.25.25.25h12a.25.25 0 0 0 .25-.25V4a.25.25 0 0 0-.25-.25zM6.25 4c0-.966.784-1.75 1.75-1.75h12c.966 0 1.75.784 1.75 1.75v12A1.75 1.75 0 0 1 20 17.75H8A1.75 1.75 0 0 1 6.25 16z" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M3.75 9v9A2.25 2.25 0 0 0 6 20.25h9v1.5H6A3.75 3.75 0 0 1 2.25 18V9z" clip-rule="evenodd"/>',"scan-qrcode":'<path fill="currentColor" d="M2.25 4c0-.964.786-1.75 1.75-1.75h3v1.5H4a.253.253 0 0 0-.25.25v3h-1.5zM20.25 4a.253.253 0 0 0-.25-.25h-3v-1.5h3c.964 0 1.75.786 1.75 1.75v3h-1.5zM20.25 20v-3h1.5v3c0 .964-.786 1.75-1.75 1.75h-3v-1.5h3c.136 0 .25-.114.25-.25M2.25 20v-3h1.5v3c0 .136.114.25.25.25h3v1.5H4c-.964 0-1.75-.786-1.75-1.75M9.5 7.5v2h-2v-2zM11 6H6v5h5zM16.5 7.5v2h-2v-2zM18 6h-5v5h5zM9.5 14.5v2h-2v-2zM11 13H6v5h5zM14.5 16.5H13V18h1.5zM18 15h-1.5v3H18z"/><path fill="currentColor" d="M18 15h-3v1.5h3zM14.5 13H13v1.5h1.5z"/>',"share-alt":'<path fill="currentColor" fill-rule="evenodd" d="M13.69 3.317a.75.75 0 0 1 .804.119l8 7a.75.75 0 0 1 0 1.128l-8 7A.75.75 0 0 1 13.25 18v-3.24c-1.925.051-3.579.315-5.062.932-1.659.692-3.157 1.85-4.588 3.758A.75.75 0 0 1 2.25 19c0-4.145 1.147-6.888 3.291-8.698 1.96-1.655 4.655-2.437 7.709-2.943V4a.75.75 0 0 1 .44-.683m1.06 2.336V8a.75.75 0 0 1-.638.742c-3.283.497-5.85 1.225-7.603 2.706-1.359 1.147-2.303 2.812-2.631 5.39 1.153-1.15 2.386-1.969 3.734-2.53 1.928-.804 4.04-1.058 6.388-1.058a.75.75 0 0 1 .75.75v2.347L20.861 11z" clip-rule="evenodd"/>'},Ee={facebook:"facebook",x:"x",instagram:"instagram",linkedin:"linkedin",pinterest:"pinterest",whatsapp:"whatsapp",telegram:"telegram",email:"mail",link:"link",qr:"scan-qrcode"};function createShareIcon(e,t=24){const s=document.createElement("template");return s.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" width="${t}" height="${t}" aria-hidden="true" focusable="false" data-designbase-icon="${e}">${ve[e]}</svg>`,s.content.firstElementChild}const fe=["facebook","x","linkedin","whatsapp","email","link"],we={facebook:{name:"Facebook",color:"#1877f2",shareUrl:"https://www.facebook.com/sharer/sharer.php?u={url}"},x:{name:"X",color:"#000000",shareUrl:"https://twitter.com/intent/tweet?url={url}&text={title}&hashtags={hashtags}"},instagram:{name:"Instagram",color:"#e4405f",shareUrl:"https://www.instagram.com/",customShare:()=>{window.alert("Instagram에 직접 공유하려면 링크를 복사하여 사용하세요.")}},linkedin:{name:"LinkedIn",color:"#0077b5",shareUrl:"https://www.linkedin.com/sharing/share-offsite/?url={url}"},pinterest:{name:"Pinterest",color:"#bd081c",shareUrl:"https://pinterest.com/pin/create/button/?url={url}&description={title}&media={imageUrl}"},whatsapp:{name:"WhatsApp",color:"#25d366",shareUrl:"https://wa.me/?text={title}%20{url}"},telegram:{name:"Telegram",color:"#0088cc",shareUrl:"https://t.me/share/url?url={url}&text={title}"},email:{name:"이메일",color:"#ea4335",shareUrl:"mailto:?subject={title}&body={description}%20{url}"},link:{name:"링크 복사",color:"#6c757d",shareUrl:""},qr:{name:"QR 코드",color:"#6c757d",shareUrl:""}};class DbShare extends HTMLElement{constructor(){super(...arguments),this.isCopied=!1,this.qrCodeData="",this.copyResetTimer=null,this.modalEl=null,this.contentSlot=null,this.dropdownEl=null}static get observedAttributes(){return["url","title","description","image-url","hashtags","variant","size","position","platforms","button-text","modal-title","show-qr-code","qr-code-size","copy-success-message","open"]}connectedCallback(){this.render()}disconnectedCallback(){this.copyResetTimer&&clearTimeout(this.copyResetTimer)}attributeChangedCallback(e){"open"===e&&"modal"===this.getAttribute("variant")&&this.modalEl?this.syncModalOpen():"url"===e&&this.contentSlot?this.refreshLinkInputValue():this.render()}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open","true"):this.removeAttribute("open")}parseListAttribute(e){const t=this.getAttribute(e);if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>String(e).trim()).filter(Boolean)}catch{}return t.split(",").map(e=>e.trim()).filter(Boolean)}getResolvedUrl(){const e=this.getAttribute("url");return e||("undefined"!=typeof window&&window.location?.href?window.location.href:"")}getContext(){return{url:this.getResolvedUrl(),title:this.getAttribute("share-title")||this.getAttribute("title")||"",description:this.getAttribute("description")||"",imageUrl:this.getAttribute("image-url")||"",hashtags:this.parseListAttribute("hashtags"),host:this}}getActivePlatforms(){const e=this.parseListAttribute("platforms");return(e.length>0?e:fe).filter(e=>e in we)}replaceUrlVariables(e,t){return e.replace("{url}",encodeURIComponent(t.url)).replace("{title}",encodeURIComponent(t.title)).replace("{description}",encodeURIComponent(t.description)).replace("{imageUrl}",encodeURIComponent(t.imageUrl)).replace("{hashtags}",t.hashtags.join(","))}async handleCopyLink(e){try{await navigator.clipboard.writeText(e.url),this.isCopied=!0,this.dispatchEvent(new CustomEvent("db-copy-success",{bubbles:!0,composed:!0,detail:{url:e.url}})),this.refreshContent(),this.copyResetTimer&&clearTimeout(this.copyResetTimer),this.copyResetTimer=setTimeout(()=>{this.isCopied=!1,this.refreshContent()},3e3)}catch(e){this.dispatchEvent(new CustomEvent("db-copy-error",{bubbles:!0,composed:!0,detail:{error:e}}))}}handleShowQrCode(e){if(this.qrCodeData=e.url,"modal"===this.getAttribute("variant"))return this.open=!0,void this.refreshContent();this.refreshContent()}handlePlatformShare(e){const t=this.getContext(),s=we[e];if(s)try{if("link"===e)this.handleCopyLink(t);else if("qr"===e)this.handleShowQrCode(t);else if(s.customShare)s.customShare(t);else if(s.shareUrl){const e=this.replaceUrlVariables(s.shareUrl,t);window.open(e,"_blank","width=600,height=400")}this.dispatchEvent(new CustomEvent("db-share",{bubbles:!0,composed:!0,detail:{platform:e,url:t.url}}))}catch(t){this.dispatchEvent(new CustomEvent("db-share-error",{bubbles:!0,composed:!0,detail:{platform:e,error:t}}))}}getPlacement(){const e=this.getAttribute("position")||"bottom";return"top"===e||"left"===e?"top-left":"right"===e?"bottom-right":"bottom-left"}mapButtonSize(){const e=this.getAttribute("size")||"m";return"s"===e?"s":"l"===e?"l":"m"}createTriggerButton(e){const t=document.createElement("db-button");return t.className=e||"designbase-wc-share__trigger",t.setAttribute("variant","secondary"),t.setAttribute("size",this.mapButtonSize()),t.textContent=this.getAttribute("button-text")||"공유",t.prepend(createShareIcon("share-alt",16)),t.addEventListener("db-click",()=>{"modal"!==this.getAttribute("variant")?this.open=!this.open:this.open=!0}),t}createPlatformIcon(e){const t=document.createElement("span");return t.className="designbase-wc-share__platform-icon",t.append(function createSharePlatformIcon(e,t=24){return createShareIcon(Ee[e],t)}(e,24)),t}createPlatformButton(e){const t=we[e],s=document.createElement("button");s.type="button",s.className=["designbase-wc-share__platform-button",`designbase-wc-share__platform-button--${e}`,"link"===e&&this.isCopied?"designbase-wc-share__platform-button--copied":""].filter(Boolean).join(" "),s.style.setProperty("--platform-color",t.color),s.title=t.name,s.setAttribute("aria-label",`${t.name}에 공유하기`),s.append(this.createPlatformIcon(e));const i=document.createElement("span");if(i.className="designbase-wc-share__platform-name",i.textContent=t.name,s.append(i),"link"===e&&this.isCopied){const e=document.createElement("span");e.className="designbase-wc-share__copy-success",e.append(createShareIcon("copy",12));const t=document.createElement("span");t.textContent="복사됨!",e.append(t),s.append(e)}return s.addEventListener("click",()=>this.handlePlatformShare(e)),s}createLinkInput(e){const t=document.createElement("db-input");return t.className="designbase-wc-share__link-input",t.setAttribute("type","text"),t.setAttribute("readonly",""),t.setAttribute("size","s"),t.setAttribute("full-width",""),t.setAttribute("value",e),customElements.whenDefined("db-input").then(()=>{t.setAttribute("value",e),t.value=e}),t}refreshLinkInputValue(){const e=this.getResolvedUrl(),t=this.contentSlot?.querySelector("db-input.designbase-wc-share__link-input");t&&(t.setAttribute("value",e),t.value=e)}createCopyButton(e){const t=document.createElement("db-button");t.className="designbase-wc-share__copy-button",t.setAttribute("size","s"),t.setAttribute("variant","primary");const s=document.createElement("span");return s.className="designbase-wc-button__start-icon",s.setAttribute("aria-hidden","true"),s.append(createShareIcon(this.isCopied?"copy":"link",16)),t.append(s),t.append(document.createTextNode(this.isCopied?"복사됨!":"복사")),t.addEventListener("db-click",()=>{this.handleCopyLink(e)}),t}generateQrCodeUrl(){const e=Number(this.getAttribute("qr-code-size")||200);return`https://api.qrserver.com/v1/create-qr-code/?size=${e}x${e}&data=${encodeURIComponent(this.qrCodeData)}`}createShareContent(){const e=document.createElement("div");return e.className="designbase-wc-share__content",this.populateShareContent(e),e}populateShareContent(e){const t=document.createElement("div");t.className="designbase-wc-share__platforms",this.getActivePlatforms().forEach(e=>{t.append(this.createPlatformButton(e))}),e.append(t);if("false"!==this.getAttribute("show-qr-code")&&this.qrCodeData){const t=document.createElement("div");t.className="designbase-wc-share__qr-section";const s=document.createElement("h4");s.className="designbase-wc-share__qr-title",s.textContent="QR 코드",t.append(s);const i=document.createElement("div");i.className="designbase-wc-share__qr-code";const n=document.createElement("img"),a=Number(this.getAttribute("qr-code-size")||200);n.src=this.generateQrCodeUrl(),n.alt="QR Code",n.width=a,n.height=a,i.append(n),t.append(i);const r=document.createElement("p");r.className="designbase-wc-share__qr-description",r.textContent="QR 코드를 스캔하여 링크에 접속하세요",t.append(r),e.append(t)}const s=this.getContext(),i=document.createElement("div");i.className="designbase-wc-share__link-preview";const n=document.createElement("h4");n.className="designbase-wc-share__link-title",n.textContent="공유 링크",i.append(n);const a=document.createElement("div");a.className="designbase-wc-share__link-container",a.append(this.createLinkInput(s.url)),a.append(this.createCopyButton(s)),i.append(a),e.append(i)}refreshContent(){const e=this.getAttribute("variant");if("inline"===e){const e=this.querySelector(":scope > .designbase-wc-share__content");return void e?.replaceWith(this.createShareContent())}"modal"===e&&this.contentSlot&&(this.contentSlot.replaceChildren(),this.populateShareContent(this.contentSlot))}syncModalOpen(){this.modalEl&&(this.open?(this.refreshLinkInputValue(),this.modalEl.setAttribute("open","true")):this.modalEl.removeAttribute("open"))}renderDropdown(){const e=document.createElement("db-dropdown");e.className="designbase-wc-share__dropdown",e.setAttribute("placement",this.getPlacement()),e.setAttribute("label",this.getAttribute("button-text")||"공유"),e.setAttribute("trigger-variant","secondary"),e.setAttribute("trigger-icon","share-alt"),e.setAttribute("size",this.mapButtonSize()),e.setAttribute("items",JSON.stringify(this.getActivePlatforms().map(e=>({id:e,label:we[e].name})))),e.addEventListener("db-change",e=>{const t=e.detail,s=t?.id;s&&this.handlePlatformShare(s)}),this.dropdownEl=e,this.append(e)}renderModal(){const e=this.createTriggerButton();this.append(e);const t=document.createElement("db-modal");t.className="designbase-wc-share__modal",t.setAttribute("title",this.getAttribute("modal-title")||"공유하기"),t.setAttribute("size","m"),this.contentSlot=document.createElement("div"),this.contentSlot.className="designbase-wc-share designbase-wc-share__content",this.contentSlot.setAttribute("data-modal-part","body"),this.populateShareContent(this.contentSlot),t.append(this.contentSlot),t.addEventListener("db-close",()=>{this.open=!1,this.qrCodeData="",this.contentSlot&&(this.contentSlot.replaceChildren(),this.populateShareContent(this.contentSlot))}),this.modalEl=t,this.append(t),this.syncModalOpen()}render(){const e=this.getAttribute("variant")||"button";this.className=`designbase-wc-share designbase-wc-share--${e}`,this.replaceChildren(),this.modalEl=null,this.contentSlot=null,this.dropdownEl=null,"inline"!==e?"dropdown"!==e?"modal"!==e?this.append(this.createTriggerButton()):this.renderModal():this.renderDropdown():this.append(this.createShareContent())}}customElements.get("db-share")||customElements.define("db-share",DbShare);const ye=["primary","white","dark"];class DbTopBanner extends HTMLElement{static get observedAttributes(){return["badge-text","content","image","link-text","variant","fixed","dismissed"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}isDarkBg(e){return"primary"===e||"dark"===e}createLinkButton(e,t){const s=this.isDarkBg(e),i=document.createElement("db-button");i.setAttribute("variant",s?"secondary":"ghost"),i.setAttribute("size","s"),i.classList.add("designbase-wc-top-banner__link");const n=document.createElement("span");n.textContent=t;const a=document.createElement("span");return a.className="designbase-wc-button__end-icon",a.append(createDbIcon("chevron-right",16)),i.append(n,a),i.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-link",{bubbles:!0,composed:!0}))}),i}createCloseButton(){const e=document.createElement("db-button");return e.setAttribute("variant","ghost"),e.setAttribute("size","m"),e.setAttribute("icon-only",""),e.setAttribute("aria-label","닫기"),e.classList.add("designbase-wc-top-banner__close"),e.append(createDbIcon("close",20)),e.addEventListener("db-click",()=>{this.setAttribute("dismissed",""),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0})),this.render()}),e}createBadge(e,t){const s=document.createElement("db-badge");return s.setAttribute("size","s"),s.setAttribute("variant",t?"secondary":"primary"),s.setAttribute("badge-style","text"),s.textContent=e,s.classList.add("designbase-wc-top-banner__badge"),s}render(){if(this.hasAttribute("dismissed"))return this.replaceChildren(),this.className="designbase-wc-top-banner designbase-wc-top-banner--dismissed",void(this.style.display="none");this.style.display="";const e=this.getAttribute("badge-text")||"",t=this.getAttribute("content")||"",s=this.getAttribute("image")||"",i=this.getAttribute("link-text")||"",n=this.getAttribute("variant")||"primary",a=ye.includes(n)?n:"primary",r=this.hasAttribute("fixed"),o=this.isDarkBg(a);if(this.className=["designbase-wc-top-banner",`designbase-wc-top-banner--${a}`,r&&"designbase-wc-top-banner--fixed",s&&"designbase-wc-top-banner--has-image"].filter(Boolean).join(" "),this.setAttribute("role","alert"),s?this.style.setProperty("--db-top-banner-bg-image",`url("${s}")`):this.style.removeProperty("--db-top-banner-bg-image"),this.replaceChildren(),s){const e=document.createElement("div");e.className="designbase-wc-top-banner__background",e.setAttribute("aria-hidden","true");const t=document.createElement("div");t.className="designbase-wc-top-banner__overlay",t.setAttribute("aria-hidden","true"),this.append(e,t)}const l=document.createElement("div");l.className="designbase-wc-top-banner__container";const d=document.createElement("div");d.className="designbase-wc-top-banner__content",e&&d.append(this.createBadge(e,o));const u=document.createElement("span");u.className="designbase-wc-top-banner__text",u.textContent=t,d.append(u),i&&d.append(this.createLinkButton(a,i)),l.append(d),l.append(this.createCloseButton()),this.append(l)}}customElements.get("db-top-banner")||customElements.define("db-top-banner",DbTopBanner);const Ae=["s","m","l"],_e=["default","minimal","card","colored","iconBox"],Ce=["horizontal","vertical","reverse"],xe=["primary","secondary","success","warning","error","info","custom"],ke={s:16,m:20,l:24};class DbStat extends HTMLElement{constructor(){super(...arguments),this.handleClick=()=>{!this.hasAttribute("disabled")&&this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=e=>{this.hasAttribute("clickable")&&!this.hasAttribute("disabled")&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["value","label","icon","icon-position","size","variant","layout","color","custom-color","progress","show-progress","change","show-change","description","show-description","clickable","disabled","animated"]}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.render()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(){this.render()}parseChange(){const e=this.getAttribute("change");if(!e)return null;try{const t=JSON.parse(e);if(t&&"number"==typeof t.value&&t.type)return t}catch{}return null}getChangeText(e){const t="increase"===e.type?"+":"-",s=e.period?` ${e.period}`:"";return`${t}${Math.abs(e.value)}%${s}`}resolveIconName(e){if(!e)return;return e in{user:1,sparkle:1,award:1,bulb:1,edit:1,search:1}?e:void 0}getProgressVariant(e){return"primary"===e?"primary":"success"===e?"success":"warning"===e?"warning":"error"===e?"danger":"default"}render(){const e=this.getAttribute("value")??"",t=this.getAttribute("label")||"",s=this.getAttribute("icon")||"",i=this.getAttribute("icon-position")||"left",n=this.getAttribute("size")||"m",a=Ae.includes(n)?n:"m",r=this.getAttribute("variant")||"default",o=_e.includes(r)?r:"default",l=this.getAttribute("layout")||"horizontal",d=Ce.includes(l)?l:"horizontal",u=this.getAttribute("color")||"primary",b=xe.includes(u)?u:"primary",m=this.getAttribute("custom-color")||"",p=this.getAttribute("progress"),g=null!==p?Number(p):NaN,v=this.hasAttribute("show-progress"),E=this.parseChange(),f=this.hasAttribute("show-change"),w=this.getAttribute("description")||"",y=this.hasAttribute("show-description"),A=this.hasAttribute("clickable"),_=this.hasAttribute("disabled"),C=this.hasAttribute("animated");this.className=["designbase-wc-stat",`designbase-wc-stat--size-${a}`,`designbase-wc-stat--variant-${o}`,`designbase-wc-stat--layout-${d}`,`designbase-wc-stat--color-${b}`,A&&"designbase-wc-stat--clickable",_&&"designbase-wc-stat--disabled",C&&"designbase-wc-stat--animated",v&&"designbase-wc-stat--with-progress",f&&E&&"designbase-wc-stat--with-change",y&&w&&"designbase-wc-stat--with-description"].filter(Boolean).join(" "),m?this.style.setProperty("--stat-color",m):this.style.removeProperty("--stat-color"),A&&!_?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.replaceChildren();const x=document.createElement("div");x.className="designbase-wc-stat__body";const k=this.resolveIconName(s);if(k){const e=document.createElement("div");e.className=`designbase-wc-stat__icon designbase-wc-stat__icon--${i}`;const t="iconBox"===o?ke[a]:20;e.append(createDbIcon(k,t)),x.append(e)}const S=document.createElement("div");S.className="designbase-wc-stat__content";const N=document.createElement("div");N.className="designbase-wc-stat__main";const $=document.createElement("div");$.className="designbase-wc-stat__label",$.textContent=t;const I=document.createElement("div");if(I.className="designbase-wc-stat__value",I.textContent=String(e),N.append($,I),S.append(N),f&&E){const e=document.createElement("div");e.className=["designbase-wc-stat__change","increase"===E.type?"designbase-wc-stat__change--increase":"designbase-wc-stat__change--decrease"].join(" "),e.textContent=this.getChangeText(E),S.append(e)}if(y&&w){const e=document.createElement("div");e.className="designbase-wc-stat__description",e.textContent=w,S.append(e)}if(x.append(S),this.append(x),v&&!Number.isNaN(g)){const e=Math.min(Math.max(g,0),100),t=document.createElement("div");t.className="designbase-wc-stat__progress";const s=document.createElement("db-progressbar");s.setAttribute("value",String(e)),s.setAttribute("size","s"),s.setAttribute("variant",this.getProgressVariant(b)),s.setAttribute("full-width",""),t.append(s),this.append(t)}}}customElements.get("db-stat")||customElements.define("db-stat",DbStat);const Se=["1:1","16:9","4:3","3:2","3:4","2:1","auto"],Ne=["cover","contain","fill","none","scale-down"],$e=["lazy","eager"],Ie=["skeleton","blur","none"],De=["s","m","l","full"],Le=["s","m","l"];class DbImage extends HTMLElement{constructor(){super(...arguments),this.imageState="loading",this.currentSrc="",this.showPlaceholder=!1,this.imgEl=null,this.placeholderEl=null,this.errorEl=null,this.initialized=!1,this.handleLoad=()=>{"loaded"!==this.imageState&&(this.imageState="loaded",this.showPlaceholder=!1,this.syncVisualState(),this.dispatchEvent(new CustomEvent("db-load",{bubbles:!0,composed:!0})))},this.handleError=()=>{const e=this.getAttribute("fallback-src")||"";if(e&&this.currentSrc!==e)return this.currentSrc=e,this.imageState="loading",this.updateImageSource(),void this.syncVisualState();this.imageState="error",this.showPlaceholder=!1,this.syncVisualState(),this.dispatchEvent(new CustomEvent("db-error",{bubbles:!0,composed:!0}))},this.handleClick=()=>{this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=e=>{this.hasAttribute("clickable")&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["src","alt","ratio","fit","loading","fallback-src","placeholder","rounded","width","height","max-width","max-height","full-width","full-height","shadow","hover","clickable"]}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.resetFromAttributes(),this.ensureStructure(),this.syncVisualState()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(e,t,s){if(t!==s||"src"===e){if("src"===e){const e=s||"";if(e!==this.currentSrc){this.currentSrc=e,this.imageState="loading";const t=this.getAttribute("placeholder")||"none";this.showPlaceholder="none"!==t,this.updateImageSource()}}"placeholder"===e&&(this.showPlaceholder="none"!==(s||"none")&&"loading"===this.imageState),this.ensureStructure(),this.syncVisualState()}else this.syncVisualState()}resetFromAttributes(){this.currentSrc=this.getAttribute("src")||"";const e=this.getAttribute("placeholder")||"none";this.showPlaceholder="none"!==e,this.imageState="loading"}getRoundedClass(){const e=this.getAttribute("rounded");return e?"true"===e||""===e?"designbase-wc-image--rounded":"s"===e?"designbase-wc-image--rounded-sm":"m"===e?"designbase-wc-image--rounded-md":"l"===e?"designbase-wc-image--rounded-lg":De.includes(e)?"full"===e?"designbase-wc-image--rounded-full":`designbase-wc-image--rounded-${e}`:"":""}getShadowClass(){const e=this.getAttribute("shadow");return e?"true"===e||""===e?"designbase-wc-image--shadow":Le.includes(e)?`designbase-wc-image--shadow-${e}`:"":""}getRatioClass(){const e=this.getAttribute("ratio")||"auto";return"auto"===e?"designbase-wc-image--ratio-auto":Se.includes(e)?`designbase-wc-image--ratio-${e.replace(":","-")}`:"designbase-wc-image--ratio-auto"}applyContainerStyle(){const e=this.style,t=this.hasAttribute("full-width"),s=this.hasAttribute("full-height"),i=this.getAttribute("width"),n=this.getAttribute("height"),a=this.getAttribute("max-width"),r=this.getAttribute("max-height");e.width=t?"100%":i||"",e.height=s?"100%":n||"",e.maxWidth=a||"",e.maxHeight=r||""}ensureStructure(){if(!this.initialized){this.placeholderEl=document.createElement("div"),this.placeholderEl.className="designbase-wc-image__placeholder",this.errorEl=document.createElement("div"),this.errorEl.className="designbase-wc-image__error",this.errorEl.append(createDbIcon("gallery",20));const e=document.createElement("span");e.className="designbase-wc-image__error-text",this.errorEl.append(e),this.imgEl=document.createElement("img"),this.imgEl.className="designbase-wc-image__img",this.imgEl.draggable=!1,this.imgEl.addEventListener("load",this.handleLoad),this.imgEl.addEventListener("error",this.handleError),this.append(this.placeholderEl,this.errorEl,this.imgEl),this.initialized=!0}this.updateImageSource(),this.updatePlaceholderContent(),this.updateErrorContent()}updateImageSource(){if(!this.imgEl)return;const e=this.getAttribute("alt")||"",t=this.getAttribute("loading")||"lazy",s=$e.includes(t)?t:"lazy";this.imgEl.alt=e,this.imgEl.loading=s;const i=this.currentSrc;if(!i)return void this.imgEl.removeAttribute("src");const n=new URL(i,window.location.href).href;this.imgEl.src!==n?this.imgEl.src=i:this.imgEl.complete&&this.imgEl.naturalWidth>0&&"loading"===this.imageState&&this.handleLoad()}updatePlaceholderContent(){if(!this.placeholderEl)return;const e=this.getAttribute("placeholder")||"none",t=Ie.includes(e)?e:"none";if(this.placeholderEl.className=["designbase-wc-image__placeholder",`designbase-wc-image__placeholder--${t}`].join(" "),this.placeholderEl.replaceChildren(),"skeleton"===t){const e=document.createElement("div");e.className="designbase-wc-image__skeleton",this.placeholderEl.append(e)}if("blur"===t){const e=document.createElement("div");e.className="designbase-wc-image__blur",this.placeholderEl.append(e)}}updateErrorContent(){if(!this.errorEl)return;const e=this.errorEl.querySelector(".designbase-wc-image__error-text");e&&(e.textContent=this.getAttribute("alt")||"이미지를 불러올 수 없습니다")}syncVisualState(){const e=this.getAttribute("fit")||"cover",t=Ne.includes(e)?e:"cover",s=this.hasAttribute("clickable"),i=this.hasAttribute("hover");if(this.className=["designbase-wc-image",this.getRatioClass(),`designbase-wc-image--fit-${t}`,this.getRoundedClass(),this.getShadowClass(),i&&"designbase-wc-image--hover",this.hasAttribute("full-width")&&"designbase-wc-image--full-width",this.hasAttribute("full-height")&&"designbase-wc-image--full-height",s&&"designbase-wc-image--clickable","loading"===this.imageState&&"designbase-wc-image--loading","error"===this.imageState&&"designbase-wc-image--error"].filter(Boolean).join(" "),this.applyContainerStyle(),s?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.placeholderEl){const e=this.showPlaceholder&&"loading"===this.imageState;this.placeholderEl.classList.toggle("designbase-wc-image__placeholder--visible",e),this.placeholderEl.hidden=!e}if(this.errorEl){const e="error"===this.imageState;this.errorEl.hidden=!e}if(this.imgEl){const e=Boolean(this.currentSrc)&&"error"!==this.imageState;this.imgEl.hidden=!e,this.imgEl.classList.toggle("designbase-wc-image__img--loaded","loaded"===this.imageState),this.imgEl.classList.toggle("designbase-wc-image__img--error","error"===this.imageState)}}}customElements.get("db-image")||customElements.define("db-image",DbImage);class DbImagePlaceholder extends HTMLElement{constructor(){super(...arguments),this.handleClick=()=>{this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.handleKeyDown=e=>{this.hasAttribute("clickable")&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick()))}}static get observedAttributes(){return["label","show-label","pattern-size","pattern-color","background-color","width","height","aspect-ratio","hover-effect","clickable"]}connectedCallback(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown),this.render()}disconnectedCallback(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}attributeChangedCallback(){this.render()}render(){const e=this.getAttribute("label")||"",t=this.hasAttribute("show-label"),s=Number(this.getAttribute("pattern-size")||20),i=this.getAttribute("pattern-color")||"#f3f3f3",n=this.getAttribute("background-color")||"#e7e7e7",a=this.getAttribute("width")||"100%",r=this.getAttribute("height")||"",o=this.getAttribute("aspect-ratio")||"",l=this.hasAttribute("hover-effect"),d=this.hasAttribute("clickable");this.className=["designbase-wc-image-placeholder",l&&"designbase-wc-image-placeholder--hover",d&&"designbase-wc-image-placeholder--clickable"].filter(Boolean).join(" "),this.style.width=a,this.style.height=r,this.style.aspectRatio=o,d?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.replaceChildren();const u=document.createElement("div");if(u.className="designbase-wc-image-placeholder__pattern",u.style.setProperty("--db-placeholder-bg",n),u.style.setProperty("--db-placeholder-pattern",i),u.style.setProperty("--db-placeholder-size",`${s}px`),u.style.setProperty("--db-placeholder-half-size",s/2+"px"),this.append(u),t&&e){const t=document.createElement("div");t.className="designbase-wc-image-placeholder__label-wrap";const s=document.createElement("span");s.className="designbase-wc-image-placeholder__label",s.textContent=e,t.append(s),this.append(t)}}}customElements.get("db-image-placeholder")||customElements.define("db-image-placeholder",DbImagePlaceholder);const Me=["grid","list","gallery","carousel"],Te=["1","2","3","4","5","6"],ze=["xs","s","m","l","xl"];class DbImageList extends HTMLElement{constructor(){super(...arguments),this.lightboxEl=null,this.selectedIndex=null}static get observedAttributes(){return["images","layout","columns","spacing","ratio","fit","rounded","shadow","hover","clickable","lightbox","loading","responsive"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}parseImages(){const e=this.getAttribute("images");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}mapRoundedAttr(){const e=this.getAttribute("rounded");if(e&&"false"!==e)return"true"===e||""===e?"m":e}createImageItem(e,t){const s=document.createElement("div");s.className="designbase-wc-image-list__item";const i=document.createElement("db-image");i.className="designbase-wc-image-list__image",i.setAttribute("src",e.thumbnail||e.src),i.setAttribute("alt",e.alt||e.title||`이미지 ${t+1}`),i.setAttribute("ratio",this.getAttribute("ratio")||"16:9"),i.setAttribute("fit",this.getAttribute("fit")||"cover"),i.setAttribute("loading",this.getAttribute("loading")||"lazy"),i.setAttribute("full-width","");const n=this.mapRoundedAttr();n&&i.setAttribute("rounded",n);const a=this.getAttribute("shadow");if(a&&"false"!==a&&i.setAttribute("shadow","true"===a?"":a),"false"!==this.getAttribute("hover")&&i.setAttribute("hover",""),e.thumbnail&&e.thumbnail!==e.src&&i.setAttribute("fallback-src",e.src),i.addEventListener("db-load",()=>{this.dispatchEvent(new CustomEvent("db-image-load",{bubbles:!0,composed:!0,detail:{image:e,index:t}}))}),i.addEventListener("db-error",()=>{this.dispatchEvent(new CustomEvent("db-image-error",{bubbles:!0,composed:!0,detail:{image:e,index:t}}))}),s.append(i),e.title||e.description){const t=document.createElement("div");if(t.className="designbase-wc-image-list__overlay",e.title){const s=document.createElement("h3");s.className="designbase-wc-image-list__title",s.textContent=e.title,t.append(s)}if(e.description){const s=document.createElement("p");s.className="designbase-wc-image-list__description",s.textContent=e.description,t.append(s)}s.append(t)}if(e.metadata?.date||e.metadata?.size){const t=document.createElement("div");if(t.className="designbase-wc-image-list__metadata",e.metadata.date){const s=document.createElement("span");s.className="designbase-wc-image-list__date",s.textContent=e.metadata.date,t.append(s)}if(e.metadata.size){const s=document.createElement("span");s.className="designbase-wc-image-list__size",s.textContent=e.metadata.size,t.append(s)}s.append(t)}return"false"!==this.getAttribute("clickable")&&s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-image-click",{bubbles:!0,composed:!0,detail:{image:e,index:t}})),"false"!==this.getAttribute("lightbox")&&this.openLightbox(t)}),s}openLightbox(e){this.selectedIndex=e,this.lightboxEl||(this.lightboxEl=document.createElement("db-lightbox"),this.lightboxEl.addEventListener("db-close",()=>{this.selectedIndex=null,this.lightboxEl?.removeAttribute("open")}),this.lightboxEl.addEventListener("db-image-change",e=>{const t=e.detail;"number"==typeof t?.index&&(this.selectedIndex=t.index)}),this.append(this.lightboxEl));const t=this.parseImages();this.lightboxEl.setAttribute("images",JSON.stringify(t.map((e,t)=>({id:e.id||`image-${t}`,src:e.src,alt:e.alt||e.title||"",title:e.title,description:e.description,thumbnail:e.thumbnail})))),this.lightboxEl.setAttribute("current-index",String(e)),this.lightboxEl.setAttribute("open","")}render(){const e=this.parseImages(),t=this.getAttribute("layout")||"grid",s=this.getAttribute("columns")||"3",i=this.getAttribute("spacing")||"m",n="false"!==this.getAttribute("responsive");this.className=["designbase-wc-image-list",`designbase-wc-image-list--${Me.includes(t)?t:"grid"}`,`designbase-wc-image-list--columns-${Te.includes(s)?s:"3"}`,`designbase-wc-image-list--spacing-${ze.includes(i)?i:"m"}`,n&&"designbase-wc-image-list--responsive","false"!==this.getAttribute("clickable")&&"designbase-wc-image-list--clickable","false"!==this.getAttribute("hover")&&"designbase-wc-image-list--hover"].filter(Boolean).join(" ");const a=this.lightboxEl;if(this.replaceChildren(),"carousel"===t){const t=document.createElement("div");t.className="designbase-wc-image-list__carousel",e.forEach((e,s)=>{const i=document.createElement("div");i.className="designbase-wc-image-list__carousel-item",i.append(this.createImageItem(e,s)),t.append(i)}),this.append(t)}else e.forEach((e,t)=>{this.append(this.createImageItem(e,t))});a&&(this.lightboxEl=a,this.append(a),null!==this.selectedIndex&&(a.setAttribute("current-index",String(this.selectedIndex)),a.setAttribute("open","")))}}customElements.get("db-image-list")||customElements.define("db-image-list",DbImageList);const Be=["s","m","l","xl"];class DbLightbox extends HTMLElement{constructor(){super(...arguments),this.portalEl=null,this.imageEl=null,this.loadingEl=null,this.errorEl=null,this.counterBadge=null,this.prevNav=null,this.nextNav=null,this.currentIndex=0,this.imageLoaded=!1,this.imageError=!1,this.keydownHandler=null,this.boundSrc="",this.thumbnailSignature="",this.handleImageLoad=()=>{this.imageLoaded=!0,this.imageError=!1,this.syncImageLayers()},this.handleImageError=()=>{this.imageLoaded=!1,this.imageError=!0,this.syncImageLayers()}}static get observedAttributes(){return["images","current-index","size","open","enable-keyboard","show-thumbnails","show-counter","show-close-button","show-navigation-buttons","show-toolbar","close-on-backdrop-click","close-on-escape"]}connectedCallback(){this.classList.add("designbase-wc-lightbox-host"),this.syncOpenState()}disconnectedCallback(){this.unmount()}attributeChangedCallback(e,t,s){if("current-index"===e)return this.currentIndex=Number(s||0),this.resetImageState(),void(this.open&&this.refreshView());"open"!==e?"images"===e&&this.open&&this.refreshView():this.syncOpenState()}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}parseImages(){const e=this.getAttribute("images");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}getCurrentImage(){return this.parseImages()[this.currentIndex]||null}resetImageState(){this.imageLoaded=!1,this.imageError=!1,this.boundSrc=""}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}goTo(e){const t=this.parseImages();if(!t.length)return;const s=(e%t.length+t.length)%t.length;s!==this.currentIndex&&(this.currentIndex=s,this.setAttribute("current-index",String(s)),this.resetImageState(),this.refreshView(),this.dispatchEvent(new CustomEvent("db-image-change",{bubbles:!0,composed:!0,detail:{index:s}})))}createIconButton(e,t,s,i,n={}){const a=document.createElement("db-button");return a.className=e,a.setAttribute("variant",n.variant||"ghost"),a.setAttribute("size",n.size||"m"),a.setAttribute("icon-only",""),a.setAttribute("start-icon",t),a.setAttribute("aria-label",s),n.radius&&a.setAttribute("radius",n.radius),a.addEventListener("db-click",i),a}buildPortal(){const e=this.getAttribute("size")||"l",t=Be.includes(e)?e:"l",s=document.createElement("div");s.className=`designbase-wc-lightbox designbase-wc-lightbox--size-${t}`,s.setAttribute("data-wc-internal","");const i=document.createElement("div");i.className="designbase-wc-lightbox__overlay";const n=document.createElement("div");n.className="designbase-wc-lightbox__modal";const a=document.createElement("div");a.className="designbase-wc-lightbox__header";const r=document.createElement("div");r.className="designbase-wc-lightbox__title";const o=document.createElement("h3");o.className="designbase-wc-lightbox__title-text";const l=document.createElement("db-badge");l.className="designbase-wc-lightbox__counter",l.setAttribute("size","s"),l.setAttribute("variant","secondary"),l.setAttribute("badge-style","text"),r.append(o,l);const d=document.createElement("div");d.className="designbase-wc-lightbox__header-actions","false"!==this.getAttribute("show-close-button")&&d.append(this.createIconButton("designbase-wc-lightbox__close-button","close","닫기",()=>this.close())),a.append(r,d);const u=document.createElement("div");u.className="designbase-wc-lightbox__content",this.prevNav=this.createIconButton("designbase-wc-lightbox__nav-button designbase-wc-lightbox__nav-button--prev","chevron-left","이전 이미지",()=>this.goTo(this.currentIndex-1),{radius:"pill",size:"l"}),this.nextNav=this.createIconButton("designbase-wc-lightbox__nav-button designbase-wc-lightbox__nav-button--next","chevron-right","다음 이미지",()=>this.goTo(this.currentIndex+1),{radius:"pill",size:"l"});const b=document.createElement("div");b.className="designbase-wc-lightbox__image-container",this.errorEl=document.createElement("div"),this.errorEl.className="designbase-wc-lightbox__error",this.errorEl.hidden=!0;const m=createDbIcon("gallery",24);m.classList.add("designbase-wc-lightbox__error-icon"),this.errorEl.append(m);const p=document.createElement("p");p.className="designbase-wc-lightbox__error-text",p.textContent="이미지를 불러올 수 없습니다",this.errorEl.append(p),this.loadingEl=document.createElement("div"),this.loadingEl.className="designbase-wc-lightbox__loading";const g=document.createElement("db-spinner");g.setAttribute("type","circular"),g.setAttribute("size","m"),g.setAttribute("show-label",""),g.setAttribute("label","이미지 로딩 중..."),this.loadingEl.append(g),this.imageEl=document.createElement("img"),this.imageEl.className="designbase-wc-lightbox__image",this.imageEl.draggable=!1,this.imageEl.addEventListener("load",this.handleImageLoad),this.imageEl.addEventListener("error",this.handleImageError),b.append(this.errorEl,this.loadingEl,this.imageEl);const v=document.createElement("div");v.className="designbase-wc-lightbox__description";const E=document.createElement("p");E.className="designbase-wc-lightbox__description-text",v.append(E),"false"!==this.getAttribute("show-navigation-buttons")&&u.append(this.prevNav,this.nextNav),u.append(b,v);const f=document.createElement("div");f.className="designbase-wc-lightbox__thumbnails";const w=document.createElement("div");return w.className="designbase-wc-lightbox__thumbnails-container",f.append(w),n.append(a,u,f),i.append(n),s.append(i),i.addEventListener("click",e=>{e.target===i&&"false"!==this.getAttribute("close-on-backdrop-click")&&this.close()}),this.portalEl=s,this.counterBadge=l,s}syncImageLayers(){this.imageEl&&this.loadingEl&&this.errorEl&&(this.imageEl.classList.toggle("designbase-wc-lightbox__image--loaded",this.imageLoaded),this.loadingEl.hidden=this.imageLoaded||this.imageError,this.errorEl.hidden=!this.imageError,this.imageEl.hidden=this.imageError)}updateThumbnails(){if(!this.portalEl)return;const e=this.portalEl.querySelector(".designbase-wc-lightbox__thumbnails-container"),t=this.portalEl.querySelector(".designbase-wc-lightbox__thumbnails");if(!e||!t)return;const s=this.parseImages(),i="false"!==this.getAttribute("show-thumbnails")&&s.length>1;if(t.hidden=!i,!i)return e.replaceChildren(),void(this.thumbnailSignature="");const n=s.map(e=>e.thumbnail||e.src).join("|");n!==this.thumbnailSignature||e.childElementCount!==s.length?(this.thumbnailSignature=n,e.replaceChildren(),s.forEach((t,s)=>{const i=document.createElement("button");i.type="button",i.className=["designbase-wc-lightbox__thumbnail",s===this.currentIndex&&"designbase-wc-lightbox__thumbnail--active"].filter(Boolean).join(" "),i.title=t.title||`이미지 ${s+1}`,i.setAttribute("aria-label",t.alt||t.title||`이미지 ${s+1}`),i.setAttribute("aria-current",s===this.currentIndex?"true":"false");const n=document.createElement("img");n.className="designbase-wc-lightbox__thumbnail-image",n.src=t.thumbnail||t.src,n.alt="",n.draggable=!1,n.loading="lazy",n.decoding="async",i.append(n),i.addEventListener("click",()=>this.goTo(s)),e.append(i)})):Array.from(e.children).forEach((e,t)=>{const s=e,i=t===this.currentIndex;s.classList.toggle("designbase-wc-lightbox__thumbnail--active",i),s.setAttribute("aria-current",i?"true":"false")})}loadCurrentImage(){if(!this.imageEl)return;const e=this.getCurrentImage();if(!e?.src)return this.imageEl.removeAttribute("src"),this.resetImageState(),void this.syncImageLayers();this.boundSrc!==e.src&&(this.boundSrc=e.src,this.resetImageState(),this.imageEl.src=e.src,this.imageEl.alt=e.alt||e.title||`이미지 ${this.currentIndex+1}`,this.syncImageLayers(),this.imageEl.complete&&this.imageEl.naturalWidth>0&&this.handleImageLoad())}refreshView(){if(!this.portalEl)return;const e=this.getCurrentImage(),t=this.parseImages(),s=this.portalEl.querySelector(".designbase-wc-lightbox__title-text"),i=this.portalEl.querySelector(".designbase-wc-lightbox__description-text"),n=this.portalEl.querySelector(".designbase-wc-lightbox__description");if(s&&(s.textContent=e?.title||"",s.hidden=!e?.title),this.counterBadge){const e="false"!==this.getAttribute("show-counter")&&t.length>1?`${this.currentIndex+1} / ${t.length}`:"";this.counterBadge.textContent=e,this.counterBadge.hidden=!e}n&&i&&(i.textContent=e?.description||"",n.hidden=!e?.description);const a="false"!==this.getAttribute("show-navigation-buttons")&&t.length>1;this.prevNav&&(this.prevNav.hidden=!a),this.nextNav&&(this.nextNav.hidden=!a),this.loadCurrentImage(),this.updateThumbnails()}mount(){this.portalEl||(this.portalEl=this.buildPortal()),this.portalEl.isConnected||document.body.append(this.portalEl),document.body.style.overflow="hidden",this.keydownHandler||(this.keydownHandler=e=>{this.open&&"false"!==this.getAttribute("enable-keyboard")&&("Escape"===e.key&&"false"!==this.getAttribute("close-on-escape")&&(e.preventDefault(),this.close()),"ArrowLeft"===e.key&&this.goTo(this.currentIndex-1),"ArrowRight"===e.key&&this.goTo(this.currentIndex+1))},document.addEventListener("keydown",this.keydownHandler)),this.currentIndex=Number(this.getAttribute("current-index")||0),this.refreshView()}unmount(){this.portalEl?.remove(),document.body.style.overflow="",this.keydownHandler&&(document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}syncOpenState(){this.open?this.mount():this.unmount()}}customElements.get("db-lightbox")||customElements.define("db-lightbox",DbLightbox);const Pe=["s","m","l"],Fe=["default","glass","transparent"];class DbBottomNavigation extends HTMLElement{static get observedAttributes(){return["items","active-item-id","size","background-color","fixed"]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}get items(){return this.parseItems()}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}parseItems(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}iconSize(e){return"s"===e?20:"l"===e?28:24}syncHostClasses(){const e=this.getAttribute("size")||"m",t=Pe.includes(e)?e:"m",s=this.getAttribute("background-color")||"default",i=Fe.includes(s)?s:"default";this.className=["designbase-wc-bottom-navigation",`designbase-wc-bottom-navigation--${t}`,`designbase-wc-bottom-navigation--${i}`,"false"!==this.getAttribute("fixed")&&"designbase-wc-bottom-navigation--fixed"].filter(Boolean).join(" ")}render(){this.syncHostClasses(),this.setAttribute("role","navigation"),this.setAttribute("aria-label","하단 네비게이션");const e=this.parseItems(),t=this.getAttribute("active-item-id")||"",s=this.getAttribute("size")||"m",i=this.iconSize(s);let n=this.querySelector(".designbase-wc-bottom-navigation__container");n?n.replaceChildren():(n=document.createElement("div"),n.className="designbase-wc-bottom-navigation__container",this.replaceChildren(n)),e.forEach(e=>{const s=t===e.id||Boolean(e.isActive),a=function resolveIcon$1(e){if(e)return e}(s&&e.activeIcon?e.activeIcon:e.icon),r=document.createElement("button");r.type="button",r.className=["designbase-wc-bottom-navigation__item",s&&"designbase-wc-bottom-navigation__item--active",e.disabled&&"designbase-wc-bottom-navigation__item--disabled"].filter(Boolean).join(" "),r.disabled=Boolean(e.disabled),r.setAttribute("aria-label",e.label),s&&r.setAttribute("aria-current","page");const o=document.createElement("div");o.className="designbase-wc-bottom-navigation__item-content";const l=document.createElement("div");if(l.className="designbase-wc-bottom-navigation__icon-wrapper",a){const e=createDbIcon(a,i);e.classList.add("designbase-wc-bottom-navigation__icon"),l.append(e)}if(void 0!==e.badge&&""!==e.badge){const t=document.createElement("db-badge");t.className="designbase-wc-bottom-navigation__badge",t.setAttribute("size","s"),t.setAttribute("variant",function mapBadgeVariant(e){return"error"===e?"danger":"warning"===e?"warning":"success"===e?"success":"info"===e?"info":"primary"===e?"primary":"secondary"}(e.badgeColor)),t.setAttribute("badge-style","number"),t.setAttribute("count",String(e.badge)),l.append(t)}const d=document.createElement("span");d.className="designbase-wc-bottom-navigation__label",d.textContent=e.label,o.append(l,d),r.append(o),r.addEventListener("click",()=>{e.disabled||this.dispatchEvent(new CustomEvent("db-item-click",{bubbles:!0,composed:!0,detail:{item:e}}))}),n.append(r)})}}customElements.get("db-bottom-navigation")||customElements.define("db-bottom-navigation",DbBottomNavigation);const Oe=["s","m","l"],Re=["default","transparent"],He=["fixed","sticky","static"];function resolveIcon(e){if(e)return e}class DbNavbar extends HTMLElement{constructor(){super(...arguments),this.mobileOpen=!1,this.userMenuOpen=!1,this.expandedMobile={},this.outsideHandler=null}static get observedAttributes(){return["items","user-menu-items","user-profile","size","variant","position","is-authenticated","show-search","search-placeholder","full-width","shadow"]}connectedCallback(){this.render(),this.bindOutsideClick()}disconnectedCallback(){this.unbindOutsideClick()}attributeChangedCallback(){this.isConnected&&this.render()}get items(){return this.parseItems("items")}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}get userMenuItems(){return this.parseItems("user-menu-items")}set userMenuItems(e){this.setAttribute("user-menu-items","string"==typeof e?e:JSON.stringify(e))}get userProfile(){return this.parseUserProfile()}set userProfile(e){null==e?this.removeAttribute("user-profile"):this.setAttribute("user-profile","string"==typeof e?e:JSON.stringify(e))}parseItems(e="items"){try{const t=JSON.parse(this.getAttribute(e)||"[]");return Array.isArray(t)?t:[]}catch{return[]}}parseUserProfile(){const e=this.getAttribute("user-profile");if(!e)return null;try{return JSON.parse(e)}catch{return null}}iconSize(e){return"s"===e?16:"l"===e?24:20}bindOutsideClick(){this.outsideHandler||(this.outsideHandler=e=>{this.contains(e.target)||(this.userMenuOpen=!1,this.updateUserMenuVisibility())},document.addEventListener("mousedown",this.outsideHandler))}unbindOutsideClick(){this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler),this.outsideHandler=null)}dispatchItemClick(e,t){this.dispatchEvent(new CustomEvent("user"===t?"db-user-menu-item-click":"db-item-click",{bubbles:!0,composed:!0,detail:{item:e,source:t}}))}syncHostClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("position")||"static";this.className=["designbase-wc-navbar",`designbase-wc-navbar--${Oe.includes(e)?e:"m"}`,`designbase-wc-navbar--${Re.includes(t)?t:"default"}`,`designbase-wc-navbar--${He.includes(s)?s:"static"}`,this.hasAttribute("full-width")&&"designbase-wc-navbar--full-width",this.hasAttribute("shadow")&&"designbase-wc-navbar--shadow",this.mobileOpen&&"designbase-wc-navbar--mobile-open"].filter(Boolean).join(" ")}isMegaMenu(e){return Boolean(e.megaMenu&&e.columns?.length)}createNavToggleButton(e,t){const s=document.createElement("button");s.type="button",s.className=["designbase-wc-navbar__nav-link","designbase-wc-navbar__nav-link--has-children",e.active&&"designbase-wc-navbar__nav-link--active",e.disabled&&"designbase-wc-navbar__nav-link--disabled"].filter(Boolean).join(" "),s.disabled=Boolean(e.disabled);const i=resolveIcon(e.icon);i&&s.append(createDbIcon(i,t)),s.append(document.createTextNode(e.label));const n=createDbIcon("chevron-down",12);return n.classList.add("designbase-wc-navbar__chevron"),s.append(n),s}createMegaLink(e,t){const s=document.createElement("a");s.href=e.href||"#",s.className=["designbase-wc-navbar__mega-link",e.active&&"designbase-wc-navbar__mega-link--active",e.disabled&&"designbase-wc-navbar__mega-link--disabled"].filter(Boolean).join(" ");const i=resolveIcon(e.icon);if(i){const e=document.createElement("span");e.className="designbase-wc-navbar__mega-link-icon",e.append(createDbIcon(i,t)),s.append(e)}const n=document.createElement("span");n.className="designbase-wc-navbar__mega-link-body";const a=document.createElement("span");if(a.className="designbase-wc-navbar__mega-link-label",a.textContent=e.label,n.append(a),e.description){const t=document.createElement("span");t.className="designbase-wc-navbar__mega-link-desc",t.textContent=e.description,n.append(t)}return s.append(n),s.addEventListener("click",t=>{t.preventDefault(),e.disabled||this.dispatchItemClick(e,"nav")}),s}createMegaMenu(e,t){const s=document.createElement("li");s.className="designbase-wc-navbar__nav-item designbase-wc-navbar__nav-item--mega";const i=this.createNavToggleButton(e,t),n=document.createElement("div");n.className="designbase-wc-navbar__mega";const a=document.createElement("div");a.className="designbase-wc-navbar__mega-inner";const r=document.createElement("div");return r.className="designbase-wc-navbar__mega-columns",r.style.setProperty("--db-navbar-mega-columns",String(e.columns.length)),e.columns.forEach(e=>{const s=document.createElement("div");if(s.className="designbase-wc-navbar__mega-column",e.title){const t=document.createElement("span");t.className="designbase-wc-navbar__mega-column-title",t.textContent=e.title,s.append(t)}const i=document.createElement("ul");i.className="designbase-wc-navbar__mega-list",e.items.forEach(e=>{const s=document.createElement("li");s.append(this.createMegaLink(e,t)),i.append(s)}),s.append(i),r.append(s)}),a.append(r),e.featured&&a.append(this.createMegaFeatured(e.featured,t)),n.append(a),s.append(i,n),s}createMegaFeatured(e,t){const s=document.createElement("a");s.href=e.href||"#",s.className="designbase-wc-navbar__mega-featured",e.image&&(s.style.setProperty("--db-navbar-mega-featured-image",`url("${e.image}")`),s.classList.add("designbase-wc-navbar__mega-featured--image"));const i=resolveIcon(e.icon);if(i){const e=document.createElement("span");e.className="designbase-wc-navbar__mega-featured-icon",e.append(createDbIcon(i,t+4)),s.append(e)}if(e.title){const t=document.createElement("span");t.className="designbase-wc-navbar__mega-featured-title",t.textContent=e.title,s.append(t)}if(e.description){const t=document.createElement("span");t.className="designbase-wc-navbar__mega-featured-desc",t.textContent=e.description,s.append(t)}if(e.ctaLabel){const t=document.createElement("span");t.className="designbase-wc-navbar__mega-featured-cta",t.append(document.createTextNode(e.ctaLabel)),t.append(createDbIcon("chevron-right",14)),s.append(t)}return s.addEventListener("click",t=>{t.preventDefault(),this.dispatchItemClick({id:`${e.href||"featured"}`,label:e.title||"featured",href:e.href},"nav")}),s}createDesktopNavItem(e,t){if(this.isMegaMenu(e))return this.createMegaMenu(e,t);const s=document.createElement("li");s.className="designbase-wc-navbar__nav-item";if(Boolean(e.children?.length)){const i=document.createElement("div");i.className="designbase-wc-navbar__dropdown";const n=document.createElement("button");n.type="button",n.className=["designbase-wc-navbar__nav-link","designbase-wc-navbar__nav-link--has-children",e.active&&"designbase-wc-navbar__nav-link--active",e.disabled&&"designbase-wc-navbar__nav-link--disabled"].filter(Boolean).join(" "),n.disabled=Boolean(e.disabled);const a=resolveIcon(e.icon);a&&n.append(createDbIcon(a,t)),n.append(document.createTextNode(e.label));const r=createDbIcon("chevron-down",12);r.classList.add("designbase-wc-navbar__chevron"),n.append(r);const o=document.createElement("ul");return o.className="designbase-wc-navbar__dropdown-menu",e.children.forEach(e=>{const s=document.createElement("li"),i=document.createElement("a");i.href=e.href||"#",i.className=["designbase-wc-navbar__dropdown-item",e.active&&"designbase-wc-navbar__dropdown-item--active",e.disabled&&"designbase-wc-navbar__dropdown-item--disabled"].filter(Boolean).join(" ");const n=resolveIcon(e.icon);n&&i.append(createDbIcon(n,t)),i.append(document.createTextNode(e.label)),i.addEventListener("click",t=>{e.disabled?t.preventDefault():(t.preventDefault(),this.dispatchItemClick(e,"nav"))}),s.append(i),o.append(s)}),i.append(n,o),s.append(i),s}const i=document.createElement("a");i.href=e.href||"#",i.className=["designbase-wc-navbar__nav-link",e.active&&"designbase-wc-navbar__nav-link--active",e.disabled&&"designbase-wc-navbar__nav-link--disabled"].filter(Boolean).join(" ");const n=resolveIcon(e.icon);return n&&i.append(createDbIcon(n,t)),i.append(document.createTextNode(e.label)),i.addEventListener("click",t=>{e.disabled?t.preventDefault():(t.preventDefault(),this.dispatchItemClick(e,"nav"))}),s.append(i),s}createUserMenuItemElement(e,t,s){const i=document.createElement("db-menu-item");return i.setAttribute("label",e.label),i.setAttribute("type","block"),i.setAttribute("menu-style","dropdown"),i.setAttribute("size",t),e.href&&i.setAttribute("href",e.href),e.icon&&i.setAttribute("icon",e.icon),e.disabled&&i.setAttribute("disabled",""),i.addEventListener("db-click",()=>{e.disabled||(s(),this.dispatchItemClick(e,"user"))}),i}bindSearchEvents(e){e.addEventListener("db-search",e=>{const t=e.detail,s=t.query??t.value??"";this.dispatchEvent(new CustomEvent("db-search",{bubbles:!0,composed:!0,detail:{query:s,value:s}}))})}applyAvatarProfile(e,t,s){e.setAttribute("size","s"===s?"s":"l"===s?"l":"m"),e.setAttribute("initials",t.name),e.setAttribute("alt",t.name),t.avatar&&e.setAttribute("src",t.avatar),void 0!==t.badge&&e.setAttribute("badge",String(t.badge)),t.badgeVariant&&e.setAttribute("badge-variant",t.badgeVariant),t.badgeStyle&&e.setAttribute("badge-style",t.badgeStyle),t.badgeText&&e.setAttribute("badge-text",t.badgeText)}getMobileChildren(e){if(this.isMegaMenu(e)){const t=(e.columns||[]).flatMap(e=>e.items);return e.featured?.href&&t.push({id:`${e.id}-featured`,label:e.featured.title||e.featured.ctaLabel||e.label,href:e.featured.href,icon:e.featured.icon}),t}return e.children||[]}createMobileMenuItem(e,t){const s=this.getMobileChildren(e),i=s.length>0,n=Boolean(this.expandedMobile[e.id]),a=document.createElement("db-menu-item");return a.setAttribute("label",e.label),a.setAttribute("type","block"),a.setAttribute("menu-style","accordion"),a.setAttribute("size",t),e.href&&a.setAttribute("href",e.href),e.icon&&a.setAttribute("icon",e.icon),e.active&&a.setAttribute("active",""),e.disabled&&a.setAttribute("disabled",""),i&&(a.setAttribute("expandable",""),a.subItems=s.map(e=>({id:e.id,label:e.label,href:e.href,icon:e.icon,active:e.active,disabled:e.disabled})),n&&a.setAttribute("expanded","")),a.addEventListener("db-click",()=>{if(!e.disabled){if(i)return this.expandedMobile[e.id]=!n,void this.renderMobileMenu();this.mobileOpen=!1,this.dispatchItemClick(e,"mobile"),this.render()}}),a.addEventListener("db-child-click",e=>{const t=e.detail;this.mobileOpen=!1,this.dispatchItemClick(t.child,"mobile"),this.render()}),a}updateUserMenuVisibility(){const e=this.querySelector(".designbase-wc-navbar__user-dropdown-menu");e&&(e.hidden=!this.userMenuOpen)}renderMobileMenu(){const e=this.querySelector(".designbase-wc-navbar__mobile-nav-list");if(!e)return;const t=this.getAttribute("size")||"m",s=this.parseItems();e.replaceChildren(...s.map(e=>this.createMobileMenuItem(e,t)))}render(){this.syncHostClasses(),this.setAttribute("role","navigation"),this.setAttribute("aria-label","메인 네비게이션");const e=this.getAttribute("size")||"m",t=this.iconSize(e),s=this.parseItems(),i=this.parseItems("user-menu-items"),n=this.parseUserProfile(),a=this.hasAttribute("is-authenticated"),r=this.hasAttribute("show-search");this.replaceChildren();const o=document.createElement("div");o.className=["designbase-wc-navbar__container",this.hasAttribute("full-width")&&"designbase-wc-navbar__container--full-width"].filter(Boolean).join(" ");const l=document.createElement("div");l.className="designbase-wc-navbar__left";const d=document.createElement("div");d.className="designbase-wc-navbar__brand";const u=document.createElement("div");u.className="designbase-wc-navbar__logo";const b=document.createElement("db-logo");b.setAttribute("type","designbase"),b.setAttribute("size","s"),b.setAttribute("clickable",""),b.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-logo-click",{bubbles:!0,composed:!0}))}),u.append(b),d.append(u),l.append(d);const m=document.createElement("div");m.className="designbase-wc-navbar__right";const p=document.createElement("div");p.className="designbase-wc-navbar__nav designbase-wc-navbar__nav--desktop";const g=document.createElement("ul");if(g.className="designbase-wc-navbar__nav-list",s.forEach(e=>g.append(this.createDesktopNavItem(e,t))),p.append(g),m.append(p),r){const t=document.createElement("div");t.className="designbase-wc-navbar__search";const s=document.createElement("db-search-bar");s.setAttribute("variant","outlined"),s.setAttribute("size","s"===e?"s":"l"===e?"l":"m"),s.setAttribute("placeholder",this.getAttribute("search-placeholder")||"검색..."),this.bindSearchEvents(s),t.append(s),m.append(t)}const v=document.createElement("div");if(v.className="designbase-wc-navbar__user-menu",a&&n){const t=document.createElement("div");t.className="designbase-wc-navbar__user-dropdown";const s=document.createElement("button");s.type="button",s.className="designbase-wc-navbar__user-toggle",s.setAttribute("aria-expanded",String(this.userMenuOpen));const a=document.createElement("db-avatar");this.applyAvatarProfile(a,n,e);const r=document.createElement("span");r.className="designbase-wc-navbar__user-name",r.textContent=n.name,s.append(a,r,createDbIcon("chevron-down",12)),s.addEventListener("click",()=>{this.userMenuOpen=!this.userMenuOpen,s.setAttribute("aria-expanded",String(this.userMenuOpen)),this.updateUserMenuVisibility()});const o=document.createElement("ul");if(o.className="designbase-wc-navbar__user-dropdown-menu",o.hidden=!this.userMenuOpen,n.email){const e=document.createElement("li");e.className="designbase-wc-navbar__user-info";const t=document.createElement("span");t.className="designbase-wc-navbar__user-email",t.textContent=n.email,e.append(t),o.append(e)}i.forEach(t=>{const s=document.createElement("li");s.append(this.createUserMenuItemElement(t,e,()=>{this.userMenuOpen=!1,this.updateUserMenuVisibility()})),o.append(s)}),t.append(s,o),v.append(t)}else{const t=document.createElement("db-button");t.setAttribute("variant","primary"),t.setAttribute("size","s"===e?"s":"l"===e?"l":"m"),t.textContent="로그인",t.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-login-click",{bubbles:!0,composed:!0}))}),v.append(t)}m.append(v);const E=document.createElement("button");E.type="button",E.className="designbase-wc-navbar__mobile-toggle",E.setAttribute("aria-expanded",String(this.mobileOpen)),E.setAttribute("aria-label","메뉴 열기");for(let e=0;e<3;e+=1){const e=document.createElement("span");e.className="designbase-wc-navbar__mobile-toggle-line",E.append(e)}if(E.addEventListener("click",()=>{this.mobileOpen=!this.mobileOpen,this.render()}),o.append(l,m,E),this.append(o),this.mobileOpen){const e=document.createElement("div");if(e.className="designbase-wc-navbar__mobile-menu",r){const t=document.createElement("div");t.className="designbase-wc-navbar__mobile-search";const s=document.createElement("db-search-bar");s.setAttribute("variant","outlined"),s.setAttribute("size","s"),s.setAttribute("full-width",""),s.setAttribute("placeholder",this.getAttribute("search-placeholder")||"검색..."),this.bindSearchEvents(s),t.append(s),e.append(t)}const t=document.createElement("ul");t.className="designbase-wc-navbar__mobile-nav-list",e.append(t);const s=document.createElement("div");if(s.className="designbase-wc-navbar__mobile-user",a&&n){const e=document.createElement("div");e.className="designbase-wc-navbar__mobile-user-info";const t=document.createElement("db-avatar");this.applyAvatarProfile(t,n,"m");const a=document.createElement("div"),r=document.createElement("div");if(r.className="designbase-wc-navbar__mobile-user-name",r.textContent=n.name,a.append(r),n.email){const e=document.createElement("div");e.className="designbase-wc-navbar__mobile-user-email",e.textContent=n.email,a.append(e)}if(e.append(t,a),s.append(e),i.length){const e=document.createElement("ul");e.className="designbase-wc-navbar__mobile-user-menu",i.forEach(t=>{const s=document.createElement("li");s.append(this.createUserMenuItemElement(t,"m",()=>{this.mobileOpen=!1,this.render()})),e.append(s)}),s.append(e)}}else{const e=document.createElement("db-button");e.setAttribute("variant","primary"),e.setAttribute("size","m"),e.setAttribute("full-width",""),e.textContent="로그인",e.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-login-click",{bubbles:!0,composed:!0}))}),s.append(e)}e.append(s),this.append(e),this.renderMobileMenu()}}}customElements.get("db-navbar")||customElements.define("db-navbar",DbNavbar);const Ve=["default","compact","minimal"],qe=["s","m","l"],je={youtube:"youtube",instagram:"instagram",x:"x",linkedin:"linkedin",facebook:"facebook",email:"mail"};function parseJson(e,t){if(!e)return t;try{return JSON.parse(e)??t}catch{return t}}class DbFooter extends HTMLElement{static get observedAttributes(){return["columns","legal-links","social-links","company-info","family-sites","tagline","copyright","logo-type","variant","size","full-width","show-logo","show-social","family-site-label"]}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}get columns(){return parseJson(this.getAttribute("columns"),[])}set columns(e){this.setAttribute("columns","string"==typeof e?e:JSON.stringify(e))}get legalLinks(){return parseJson(this.getAttribute("legal-links"),[])}set legalLinks(e){this.setAttribute("legal-links","string"==typeof e?e:JSON.stringify(e))}get socialLinks(){return parseJson(this.getAttribute("social-links"),[])}set socialLinks(e){this.setAttribute("social-links","string"==typeof e?e:JSON.stringify(e))}get companyInfo(){return parseJson(this.getAttribute("company-info"),{})}set companyInfo(e){this.setAttribute("company-info","string"==typeof e?e:JSON.stringify(e))}get familySites(){return parseJson(this.getAttribute("family-sites"),[])}set familySites(e){this.setAttribute("family-sites","string"==typeof e?e:JSON.stringify(e))}syncHostClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=qe.includes(e)?e:"m",i=Ve.includes(t)?t:"default";this.className=["designbase-wc-footer",`designbase-wc-footer--${s}`,`designbase-wc-footer--${i}`,this.hasAttribute("full-width")&&"designbase-wc-footer--full-width"].filter(Boolean).join(" ")}dispatchLinkClick(e,t){this.dispatchEvent(new CustomEvent("db-link-click",{bubbles:!0,composed:!0,detail:{link:e,source:t}}))}createLink(e,t,s){const i=document.createElement("a");return i.href=e.href||"#",i.className=[t,e.emphasize&&`${t}--emphasize`].filter(Boolean).join(" "),i.textContent=e.label,e.external&&(i.target="_blank",i.rel="noopener noreferrer"),i.addEventListener("click",t=>{t.preventDefault(),this.dispatchLinkClick(e,s)}),i}createSocialLink(e,t){const s=document.createElement("a");s.href=e.href,s.className="designbase-wc-footer__social-link",s.target="_blank",s.rel="noopener noreferrer",s.setAttribute("aria-label",e.label||e.platform);const i=je[e.platform]||"share-alt";return s.append(createShareIcon(i,t)),s.addEventListener("click",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("db-social-click",{bubbles:!0,composed:!0,detail:{link:e}}))}),s}createCompanyInfoRows(e){const t=[],s=[];e.companyName&&s.push(e.companyName),e.representative&&s.push(`대표: ${e.representative}`),e.businessNumber&&s.push(`사업자등록번호: ${e.businessNumber}`),s.length&&t.push(s.join(" | "));const i=[];e.address&&i.push(e.address),e.phone&&i.push(`대표전화: ${e.phone}`),e.customerCenter&&i.push(`고객센터: ${e.customerCenter}`),i.length&&t.push(i.join(" | "));const n=[];return e.email&&n.push(`이메일: ${e.email}`),e.mailOrderNumber&&n.push(`통신판매업신고: ${e.mailOrderNumber}`),e.hostingProvider&&n.push(`호스팅: ${e.hostingProvider}`),n.length&&t.push(n.join(" | ")),t}showLogo(){return!this.hasAttribute("show-logo")||"false"!==this.getAttribute("show-logo")}createLogo(){const e=document.createElement("div");e.className="designbase-wc-footer__logo";const t=document.createElement("db-logo");return t.setAttribute("type",this.getAttribute("logo-type")||"designbase"),t.setAttribute("size","s"),t.setAttribute("clickable",""),t.addEventListener("db-click",()=>{this.dispatchEvent(new CustomEvent("db-logo-click",{bubbles:!0,composed:!0}))}),e.append(t),e}renderBrand(e,t={}){const{showTagline:s=!0}=t,i=document.createElement("div");i.className="designbase-wc-footer__brand",this.showLogo()&&i.append(this.createLogo());const n=this.getAttribute("tagline");if(s&&n){const e=document.createElement("p");e.className="designbase-wc-footer__tagline",e.textContent=n,i.append(e)}const a=this.socialLinks;if(a.length&&(!this.hasAttribute("show-social")||"false"!==this.getAttribute("show-social"))){const t=document.createElement("div");t.className="designbase-wc-footer__social",a.forEach(s=>t.append(this.createSocialLink(s,e))),i.append(t)}return i}renderColumns(e){if(!e.length)return null;const t=document.createElement("div");return t.className="designbase-wc-footer__columns",t.style.setProperty("--db-footer-columns",String(Math.min(e.length,4))),e.forEach(e=>{const s=document.createElement("div");s.className="designbase-wc-footer__column";const i=document.createElement("h3");i.className="designbase-wc-footer__column-title",i.textContent=e.title,s.append(i);const n=document.createElement("ul");n.className="designbase-wc-footer__column-list",e.items.forEach(e=>{const t=document.createElement("li");t.append(this.createLink(e,"designbase-wc-footer__column-link","column")),n.append(t)}),s.append(n),t.append(s)}),t}createLegalNav(e){const t=document.createElement("nav");t.className="designbase-wc-footer__legal-nav",t.setAttribute("aria-label","법적 고지");const s=document.createElement("ul");return s.className="designbase-wc-footer__legal-list",e.forEach((t,i)=>{const n=document.createElement("li");if(n.append(this.createLink(t,"designbase-wc-footer__legal-link","legal")),s.append(n),i<e.length-1){const e=document.createElement("span");e.className="designbase-wc-footer__legal-divider",e.setAttribute("aria-hidden","true"),e.textContent="|",n.append(e)}}),t.append(s),t}renderLegalBar(e,t){if(!e.length&&!t.length)return null;const s=document.createElement("div");if(s.className="designbase-wc-footer__legal-bar",e.length&&s.append(this.createLegalNav(e)),t.length){const e=document.createElement("div");e.className="designbase-wc-footer__family-site";const i=document.createElement("select");i.className="designbase-wc-footer__family-select",i.setAttribute("aria-label",this.getAttribute("family-site-label")||"패밀리 사이트");const n=document.createElement("option");n.value="",n.textContent=this.getAttribute("family-site-label")||"패밀리 사이트",n.disabled=!0,n.selected=!0,i.append(n),t.forEach(e=>{const t=document.createElement("option");t.value=e.href,t.textContent=e.label,t.dataset.id=e.id,i.append(t)}),i.addEventListener("change",()=>{const e=t.find(e=>e.href===i.value);e&&(i.selectedIndex=0,this.dispatchEvent(new CustomEvent("db-family-site-change",{bubbles:!0,composed:!0,detail:{site:e}})))}),e.append(i),s.append(e)}return s}renderCompanyInfo(e){const t=this.createCompanyInfoRows(e);if(!t.length)return null;const s=document.createElement("div");return s.className="designbase-wc-footer__company",t.forEach(e=>{const t=document.createElement("p");t.className="designbase-wc-footer__company-line",t.textContent=e,s.append(t)}),s}createCopyright(e){const t=document.createElement("div");t.className="designbase-wc-footer__bottom";const s=document.createElement("p");return s.className="designbase-wc-footer__copyright",s.textContent=e,t.append(s),t}renderMinimal(e,t,s){const i=document.createElement("div");i.className="designbase-wc-footer__minimal-bar";const n=document.createElement("div");if(n.className="designbase-wc-footer__minimal-start",this.showLogo()&&n.append(this.createLogo()),i.append(n),t.length){const e=document.createElement("div");e.className="designbase-wc-footer__minimal-legal",e.append(this.createLegalNav(t)),i.append(e)}e.append(i),e.append(this.createCopyright(s))}render(){this.syncHostClasses(),this.setAttribute("role","contentinfo");const e=this.getAttribute("variant")||"default",t=this.getAttribute("size")||"m",s="s"===t?18:"l"===t?22:20,i="default"===e?this.columns:[],n=this.legalLinks,a=this.companyInfo,r=this.familySites,o=this.getAttribute("copyright")||`© ${(new Date).getFullYear()} Designbase. All rights reserved.`;this.replaceChildren();const l=document.createElement("div");if(l.className=["designbase-wc-footer__container",this.hasAttribute("full-width")&&"designbase-wc-footer__container--full-width"].filter(Boolean).join(" "),"minimal"===e)return this.renderMinimal(l,n,o),void this.append(l);const d=document.createElement("div");d.className="designbase-wc-footer__top",d.append(this.renderBrand(s,{showTagline:"compact"!==e}));const u=this.renderColumns(i);u&&d.append(u),l.append(d);const b=this.renderLegalBar(n,r);b&&l.append(b);const m=this.renderCompanyInfo(a);m&&l.append(m),l.append(this.createCopyright(o)),this.append(l)}}customElements.get("db-footer")||customElements.define("db-footer",DbFooter);const Ue=["s","m","l"],We=["default","dark","light"],Ge=["left","right"];class DbSidebar extends HTMLElement{constructor(){super(...arguments),this.expandedItems=new Set,this.userMenuOpen=!1,this.outsideHandler=null}static get observedAttributes(){return["items","sections","user-menu-items","user-profile","default-expanded-ids","size","variant","position","collapsed","collapsible","show-logo","full-height","shadow"]}connectedCallback(){this.seedExpanded(),this.render(),this.bindOutsideClick()}disconnectedCallback(){this.unbindOutsideClick()}attributeChangedCallback(e){this.isConnected&&("default-expanded-ids"===e&&this.seedExpanded(),"collapsed"===e&&this.hasAttribute("collapsed")&&(this.userMenuOpen=!1),this.render())}seedExpanded(){try{const e=JSON.parse(this.getAttribute("default-expanded-ids")||"[]");Array.isArray(e)&&(this.expandedItems=new Set(e))}catch{this.expandedItems=new Set}}get items(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}get sections(){return this.parseSections()}set sections(e){this.setAttribute("sections","string"==typeof e?e:JSON.stringify(e))}get userMenuItems(){return this.parseUserMenuItems()}set userMenuItems(e){this.setAttribute("user-menu-items","string"==typeof e?e:JSON.stringify(e))}get userProfile(){return this.parseUserProfile()}set userProfile(e){null==e?this.removeAttribute("user-profile"):this.setAttribute("user-profile","string"==typeof e?e:JSON.stringify(e))}parseSections(){const e=this.getAttribute("sections");if(e)try{const t=JSON.parse(e);if(Array.isArray(t)&&t.length)return t}catch{}try{const e=JSON.parse(this.getAttribute("items")||"[]");return[{id:"main",items:Array.isArray(e)?e:[]}]}catch{return[{id:"main",items:[]}]}}parseUserMenuItems(){try{const e=JSON.parse(this.getAttribute("user-menu-items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseUserProfile(){const e=this.getAttribute("user-profile");if(!e)return null;try{return JSON.parse(e)}catch{return null}}bindOutsideClick(){this.outsideHandler||(this.outsideHandler=e=>{const t=this.querySelector(".designbase-wc-sidebar__user");t&&!t.contains(e.target)&&(this.userMenuOpen=!1,this.updateUserMenuVisibility())},document.addEventListener("mousedown",this.outsideHandler))}unbindOutsideClick(){this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler),this.outsideHandler=null)}syncHostClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("position")||"left";this.className=["designbase-wc-sidebar",`designbase-wc-sidebar--${Ue.includes(e)?e:"m"}`,`designbase-wc-sidebar--${We.includes(t)?t:"default"}`,`designbase-wc-sidebar--${Ge.includes(s)?s:"left"}`,this.hasAttribute("collapsed")&&"designbase-wc-sidebar--collapsed",this.hasAttribute("full-height")&&"designbase-wc-sidebar--full-height",this.hasAttribute("shadow")&&"designbase-wc-sidebar--shadow"].filter(Boolean).join(" ")}dispatchItemClick(e){this.dispatchEvent(new CustomEvent("db-item-click",{bubbles:!0,composed:!0,detail:{item:e}}))}dispatchUserMenuItemClick(e){this.dispatchEvent(new CustomEvent("db-user-menu-item-click",{bubbles:!0,composed:!0,detail:{item:e}}))}updateUserMenuVisibility(){const e=this.querySelector(".designbase-wc-sidebar__user-dropdown");e&&(e.hidden=!this.userMenuOpen)}createSidebarMenuItem(e,t,s=0){const i=Boolean(e.children?.length),n=this.expandedItems.has(e.id),a=this.hasAttribute("collapsed"),r=document.createElement("li");r.className="designbase-wc-sidebar__item";const o=document.createElement("db-menu-item");return o.setAttribute("label",e.label),o.setAttribute("type","block"),o.setAttribute("menu-style","accordion"),o.setAttribute("size",t),o.setAttribute("depth",String(s)),e.href&&o.setAttribute("href",e.href),e.icon&&o.setAttribute("icon",e.icon),e.active&&o.setAttribute("active",""),e.disabled&&o.setAttribute("disabled",""),void 0!==e.badge&&o.setAttribute("badge",String(e.badge)),e.badgeColor&&o.setAttribute("badge-color",e.badgeColor),i&&(o.setAttribute("expandable",""),o.subItems=(e.children||[]).map(e=>({id:e.id,label:e.label,href:e.href,icon:e.icon,active:e.active,disabled:e.disabled,badge:e.badge,badgeColor:e.badgeColor})),n&&!a&&o.setAttribute("expanded","")),o.addEventListener("db-click",()=>{if(!e.disabled)return i&&!a?(this.expandedItems.has(e.id)?this.expandedItems.delete(e.id):this.expandedItems.add(e.id),void this.renderNav()):void this.dispatchItemClick(e)}),o.addEventListener("db-child-click",e=>{const t=e.detail;this.dispatchItemClick(t.child)}),r.append(o),r}renderNav(){const e=this.querySelector(".designbase-wc-sidebar__nav");if(!e)return;const t=this.getAttribute("size")||"m",s=this.parseSections();e.replaceChildren(),s.forEach(s=>{const i=document.createElement("div");if(i.className="designbase-wc-sidebar__section",!this.hasAttribute("collapsed")&&s.title){const e=document.createElement("div");e.className="designbase-wc-sidebar__section-title",e.textContent=s.title,i.append(e)}const n=document.createElement("ul");n.className="designbase-wc-sidebar__nav-list",s.items.forEach(e=>n.append(this.createSidebarMenuItem(e,t))),i.append(n),e.append(i)})}render(){this.syncHostClasses(),this.setAttribute("role","complementary"),this.setAttribute("aria-label","사이드바 네비게이션");const e=this.getAttribute("size")||"m",t="false"!==this.getAttribute("collapsible"),s="false"!==this.getAttribute("show-logo"),i=this.hasAttribute("collapsed"),n=this.parseUserProfile(),a=this.parseUserMenuItems(),r="l"===e?"m":"s"===e?"xs":"s";this.replaceChildren();const o=document.createElement("div");if(o.className="designbase-wc-sidebar__container",t||s&&!i){const e=document.createElement("div");if(e.className=["designbase-wc-sidebar__header",(i||!s)&&"designbase-wc-sidebar__header--collapsed-only"].filter(Boolean).join(" "),!i&&s){const t=document.createElement("div");t.className="designbase-wc-sidebar__logo";const s=document.createElement("db-logo");s.setAttribute("type","designbase"),s.setAttribute("size",r),t.append(s),t.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-logo-click",{bubbles:!0,composed:!0}))}),e.append(t)}if(t){const t=document.createElement("db-button");t.className="designbase-wc-sidebar__toggle",t.setAttribute("variant","tertiary"),t.setAttribute("size","s"),t.setAttribute("icon-only",""),t.setAttribute("start-icon",i?"arrow-bar-right":"arrow-bar-left"),t.setAttribute("aria-label",i?"사이드바 펼치기":"사이드바 접기"),t.addEventListener("db-click",()=>{const e=!this.hasAttribute("collapsed");e?this.setAttribute("collapsed",""):this.removeAttribute("collapsed"),this.dispatchEvent(new CustomEvent("db-toggle",{bubbles:!0,composed:!0,detail:{collapsed:e}}))}),e.append(t)}o.append(e)}const l=document.createElement("div");l.className="designbase-wc-sidebar__nav-wrapper";const d=document.createElement("nav");d.className="designbase-wc-sidebar__nav",d.setAttribute("aria-label","주 메뉴"),l.append(d),o.append(l);const u=document.createElement("div");if(u.className="designbase-wc-sidebar__footer",n&&!i){const e=document.createElement("div");e.className="designbase-wc-sidebar__user";const t=document.createElement("div");if(t.className="designbase-wc-sidebar__user-dropdown",t.setAttribute("role","menu"),t.setAttribute("aria-label","사용자 메뉴"),t.hidden=!this.userMenuOpen,a.length){const e=document.createElement("ul");e.className="designbase-wc-sidebar__user-menu",a.forEach(t=>{const s=document.createElement("li");s.className="designbase-wc-sidebar__user-menu-item";const i=document.createElement("db-menu-item");i.setAttribute("label",t.label),i.setAttribute("type","block"),i.setAttribute("menu-style","accordion"),i.setAttribute("size","s"),t.icon&&i.setAttribute("icon",t.icon),t.href&&i.setAttribute("href",t.href),i.addEventListener("db-click",()=>{this.userMenuOpen=!1,this.updateUserMenuVisibility(),this.dispatchUserMenuItemClick(t)}),s.append(i),e.append(s)}),t.append(e)}const s=document.createElement("div");s.className="designbase-wc-sidebar__user-info",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",String(this.userMenuOpen));const i=document.createElement("db-avatar");i.className="designbase-wc-sidebar__user-avatar",i.setAttribute("size","s"),i.setAttribute("initials",n.name),i.setAttribute("alt",n.name),n.avatar&&i.setAttribute("src",n.avatar);const r=document.createElement("div");r.className="designbase-wc-sidebar__user-details";const o=document.createElement("div");if(o.className="designbase-wc-sidebar__user-name",o.textContent=n.name,r.append(o),n.email){const e=document.createElement("div");e.className="designbase-wc-sidebar__user-email",e.textContent=n.email,r.append(e)}if(s.append(i,r),a.length){const e=document.createElement("span");e.className="designbase-wc-sidebar__user-more",e.setAttribute("aria-hidden","true"),e.append(createDbIcon("more-vertical",16)),s.append(e),s.setAttribute("aria-haspopup","menu")}s.addEventListener("click",()=>{a.length&&(this.userMenuOpen=!this.userMenuOpen,s.setAttribute("aria-expanded",String(this.userMenuOpen)),this.updateUserMenuVisibility())}),e.append(t,s),u.append(e)}else if(n&&i){const e=document.createElement("div");e.className="designbase-wc-sidebar__user-collapsed",e.setAttribute("role","button"),e.setAttribute("tabindex","0");const t=document.createElement("db-avatar");t.className="designbase-wc-sidebar__user-avatar-collapsed",t.setAttribute("size","m"),t.setAttribute("initials",n.name),t.setAttribute("alt",n.name),n.avatar&&t.setAttribute("src",n.avatar),e.append(t),u.append(e)}o.append(u),this.append(o),this.renderNav()}}customElements.get("db-sidebar")||customElements.define("db-sidebar",DbSidebar);class DbContextMenu extends HTMLElement{constructor(){super(...arguments),this.externalTarget=null,this.activeSubMenu=null,this.onExternalContextMenu=null,this.handleDocumentMouseDown=e=>{if(!this.open)return;const t=e.target;this.menuEl?.contains(t)||2===e.button&&(this.targetWrap?.contains(t)||this.externalTarget?.contains(t))||this.close()},this.handleKeyDown=e=>{this.open&&"Escape"===e.key&&this.close()},this.handleContextMenu=e=>{this.hasAttribute("disabled")||(e.preventDefault(),e.stopPropagation(),this.openAt(e.clientX,e.clientY))}}static get observedAttributes(){return["open","x","y","items","target-id","disabled"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open","true"):this.removeAttribute("open")}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.style.display="contents",requestAnimationFrame(()=>{this.renderTarget(),this.syncMenu()}),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleKeyDown),this.unbindExternalTarget(),this.menuEl?.remove(),this.menuEl=void 0}attributeChangedCallback(e){if(this.isConnected)return"target-id"===e?(this.unbindExternalTarget(),void this.bindExternalTarget()):void("open"!==e&&"x"!==e&&"y"!==e&&"items"!==e||this.syncMenu())}openAt(e,t){this.setAttribute("x",String(e)),this.setAttribute("y",String(t)),this.setAttribute("open","true"),this.dispatchEvent(new CustomEvent("db-open",{bubbles:!0,composed:!0,detail:{x:e,y:t}})),this.syncMenu()}close(){this.activeSubMenu=null,this.removeAttribute("open"),this.menuEl?.remove(),this.menuEl=void 0,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}collectTargetChildren(){const e=Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal")&&e!==this.targetWrap);return e.length>0?e:Array.from(this.targetWrap?.children||[])}bindExternalTarget(){const e=this.getAttribute("target-id");e&&(this.externalTarget=document.getElementById(e),this.externalTarget&&(this.onExternalContextMenu=e=>this.handleContextMenu(e),this.externalTarget.addEventListener("contextmenu",this.onExternalContextMenu)))}unbindExternalTarget(){this.externalTarget&&this.onExternalContextMenu&&this.externalTarget.removeEventListener("contextmenu",this.onExternalContextMenu),this.externalTarget=null,this.onExternalContextMenu=null}renderTarget(){const e=this.collectTargetChildren();this.getAttribute("target-id")?(this.replaceChildren(),this.bindExternalTarget()):(this.targetWrap||(this.targetWrap=document.createElement("div"),this.targetWrap.className="designbase-wc-context-menu__target",this.targetWrap.addEventListener("contextmenu",this.handleContextMenu)),this.replaceChildren(),e.forEach(e=>this.targetWrap.append(e)),e.length>0&&this.append(this.targetWrap))}adjustPosition(){if(!this.menuEl)return;const e=Number(this.getAttribute("x")||0),t=Number(this.getAttribute("y")||0),s=this.menuEl.getBoundingClientRect();let i=e,n=t;e+s.width>window.innerWidth&&(i=e-s.width),t+s.height>window.innerHeight&&(n=t-s.height),this.menuEl.style.left=`${Math.max(0,i)}px`,this.menuEl.style.top=`${Math.max(0,n)}px`}createMenuItem(e){const t=document.createElement("db-menu-item");return t.setAttribute("label",e.label||e.id),t.setAttribute("type","block"),t.setAttribute("menu-style","dropdown"),e.icon&&t.setAttribute("icon",e.icon),e.disabled&&t.setAttribute("disabled",""),e.variant&&t.setAttribute("variant",e.variant),e.subItems?.length&&(t.setAttribute("sub-items",JSON.stringify(e.subItems)),t.setAttribute("expandable","")),t.addEventListener("db-click",()=>{e.disabled||e.subItems?.length||(this.dispatchEvent(new CustomEvent("db-select",{detail:{item:e},bubbles:!0,composed:!0})),this.close())}),t.addEventListener("db-child-click",e=>{const t=e.detail?.child;this.dispatchEvent(new CustomEvent("db-select",{detail:{item:t},bubbles:!0,composed:!0})),this.close()}),t}renderItem(e,t){if(e.divider||e.isDivider){const e=document.createElement("db-divider");return e.className="designbase-wc-divider",e}const s=document.createElement("div");s.className="designbase-wc-context-menu__item-wrapper",s.append(this.createMenuItem(e));if(Boolean(e.subItems?.length)){const t=document.createElement("div");t.className=["designbase-wc-context-menu__submenu",this.activeSubMenu===e.id&&"designbase-wc-context-menu__submenu--open"].filter(Boolean).join(" "),e.subItems?.forEach((e,s)=>{const i=this.renderItem(e,s);i&&t.append(i)}),s.addEventListener("mouseenter",()=>{this.activeSubMenu=e.id,t.classList.add("designbase-wc-context-menu__submenu--open")}),s.addEventListener("mouseleave",()=>{this.activeSubMenu=null,t.classList.remove("designbase-wc-context-menu__submenu--open")}),s.append(t)}return s}syncMenu(){if(this.menuEl?.remove(),this.menuEl=void 0,!this.open)return;const e=Number(this.getAttribute("x")||0),t=Number(this.getAttribute("y")||0),s=this.items,i=document.createElement("div");i.className="designbase-wc-context-menu",i.setAttribute("data-wc-internal",""),i.style.position="fixed",i.style.left=`${e}px`,i.style.top=`${t}px`,i.style.zIndex="1000",i.setAttribute("role","menu"),i.setAttribute("aria-orientation","vertical"),s.forEach((e,t)=>{const s=this.renderItem(e,t);s&&i.append(s)}),document.body.append(i),this.menuEl=i,requestAnimationFrame(()=>this.adjustPosition())}}customElements.get("db-context-menu")||customElements.define("db-context-menu",DbContextMenu);const Je=["s","m","l"],Ke=["default","primary","success","warning","danger"],Ye=["solid","striped","animated"];class DbProgressbar extends HTMLElement{static get observedAttributes(){return["value","min","max","size","variant","bar-style","show-label","label","label-position","full-width","disabled"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=Number(this.getAttribute("min")||0),t=Number(this.getAttribute("max")||100),s=Number(this.getAttribute("value")||0),i=Math.max(e,Math.min(t,s)),n=t===e?0:(i-e)/(t-e)*100,a=this.getAttribute("size")||"m",r=this.getAttribute("variant")||"default",o=this.getAttribute("bar-style")||"solid",l=this.getAttribute("label-position")||"top",d=this.hasAttribute("show-label"),u=this.getAttribute("label")||(d?`${Math.round(n)}%`:""),b=this.hasAttribute("disabled");this.className=["designbase-wc-progressbar",`designbase-wc-progressbar--${Je.includes(a)?a:"m"}`,`designbase-wc-progressbar--${Ke.includes(r)?r:"default"}`,`designbase-wc-progressbar--${Ye.includes(o)?o:"solid"}`,this.hasAttribute("full-width")&&"designbase-wc-progressbar--full-width",b&&"designbase-wc-progressbar--disabled",100===n&&"designbase-wc-progressbar--completed"].filter(Boolean).join(" "),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin",String(e)),this.setAttribute("aria-valuemax",String(t)),this.setAttribute("aria-valuenow",String(i)),u&&this.setAttribute("aria-label",u),this.replaceChildren();const m=document.createElement("div");if(m.className=`designbase-wc-progressbar__container designbase-wc-progressbar__container--${l}`,u&&"inside"!==l){const e=document.createElement("span");e.className=`designbase-wc-progressbar__label designbase-wc-progressbar__label--${l}`,e.textContent=u,m.append(e)}const p=document.createElement("div");p.className="designbase-wc-progressbar__track";const g=document.createElement("div");if(g.className="designbase-wc-progressbar__fill",g.style.width=`${n}%`,u&&"inside"===l){const e=document.createElement("span");e.className="designbase-wc-progressbar__fill-label",e.textContent=u,g.append(e)}p.append(g),m.append(p),this.append(m)}}customElements.get("db-progressbar")||customElements.define("db-progressbar",DbProgressbar);class DbProgressStep extends HTMLElement{static get observedAttributes(){return["items","size","layout","current-step","clickable","full-width","disabled"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}resolveStatus(e,t){const s=t.status??"pending";if("pending"!==s)return s;const i=Number(this.getAttribute("current-step")||0);return e<i?"completed":e===i?"active":"pending"}iconSize(e){return"s"===e?12:"l"===e?20:16}renderIndicatorContent(e,t,s){const i=document.createElement("div");if(i.className="designbase-wc-progress-step__icon","completed"===e)i.append(createDbIcon("done",this.iconSize(s)));else if("error"===e)i.append(createDbIcon("warning-filled",this.iconSize(s)));else{const e=document.createElement("span");e.className="designbase-wc-progress-step__number",e.textContent=String(t+1),i.append(e)}return i}handleStepClick(e,t){const s=this.hasAttribute("disabled"),i=this.hasAttribute("clickable");s||e.disabled||!i||this.dispatchEvent(new CustomEvent("db-step-click",{detail:{item:e,index:t},bubbles:!0,composed:!0}))}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("layout")||"horizontal",s=this.hasAttribute("clickable"),i=this.hasAttribute("disabled"),n=this.items;this.className=["designbase-wc-progress-step",`designbase-wc-progress-step--${e}`,`designbase-wc-progress-step--${t}`,s&&"designbase-wc-progress-step--clickable",this.hasAttribute("full-width")&&"designbase-wc-progress-step--full-width",i&&"designbase-wc-progress-step--disabled"].filter(Boolean).join(" "),this.replaceChildren(),n.forEach((t,a)=>{const r=this.resolveStatus(a,t),o=a===n.length-1,l=s&&!i&&!t.disabled,d="completed"===(a>0?this.resolveStatus(a-1,n[a-1]):"pending")?"completed":r,u=document.createElement("div");u.className=["designbase-wc-progress-step__item",`designbase-wc-progress-step__item--${r}`,l&&"designbase-wc-progress-step__item--clickable",t.disabled&&"designbase-wc-progress-step__item--disabled"].filter(Boolean).join(" ");const b=document.createElement("div");b.className="designbase-wc-progress-step__indicator-container";const m=document.createElement("div");if(m.className="designbase-wc-progress-step__indicator",l?(m.tabIndex=0,m.setAttribute("role","button"),m.setAttribute("aria-label",`${t.title} 단계로 이동`),m.addEventListener("click",()=>this.handleStepClick(t,a)),m.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleStepClick(t,a))})):m.tabIndex=-1,"active"===r){const e=document.createElement("div");e.className="designbase-wc-progress-step__pulse",m.append(e)}if(m.append(this.renderIndicatorContent(r,a,e)),b.append(m),!o){const e=document.createElement("div");e.className=["designbase-wc-progress-step__connector",`designbase-wc-progress-step__connector--${d}`].join(" "),b.append(e)}u.append(b);const p=document.createElement("div");p.className="designbase-wc-progress-step__content";const g=document.createElement("div");g.className="designbase-wc-progress-step__header";const v=document.createElement("h3");if(v.className="designbase-wc-progress-step__title",v.textContent=t.title,g.append(v),p.append(g),t.description){const e=document.createElement("p");e.className="designbase-wc-progress-step__description",e.textContent=t.description,p.append(e)}if(t.timestamp){const e=document.createElement("span");e.className="designbase-wc-progress-step__timestamp",e.textContent=t.timestamp,p.append(e)}u.append(p),this.append(u)})}}customElements.get("db-progress-step")||customElements.define("db-progress-step",DbProgressStep);const Xe="designbase-wc-range-slider";class DbRangeSlider extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.headerEl=null,this.labelEl=null,this.valuesEl=null,this.containerEl=null,this.trackEl=null,this.fillEl=null,this.thumbEls=[],this.currentValue=50,this.currentRange=[25,75],this.isDragging=!1,this.activeThumb=null,this.boundTrackClick=e=>this.handleTrackClick(e),this.boundPointerMove=e=>this.handlePointerMove(e),this.boundPointerUp=()=>this.handlePointerUp(),this.boundContainerKeyDown=e=>this.handleKeyDown(e),this.eventsBound=!1}static get observedAttributes(){return["value","range","min","max","step","size","variant","show-value","show-label","label","value-position","value-fixed","show-thumb-tooltip","show-marks","marks","mark-labels","disabled","readonly","full-width","vertical"]}connectedCallback(){this.built||(this.build(),this.built=!0),this.readAttributeValues(),this.syncClasses(),this.syncDomOrder(),this.syncStructure(),this.syncVisuals(),this.syncA11y(),this.bindEvents()}disconnectedCallback(){this.unbindEvents()}attributeChangedCallback(e){this.built&&(this.readAttributeValues(),this.syncClasses(),this.isStructuralAttribute(e)&&(this.syncDomOrder(),this.syncStructure()),this.syncVisuals(),this.syncA11y())}isStructuralAttribute(e){return["range","show-value","show-label","label","value-position","show-marks","marks","mark-labels","vertical"].includes(e)}get value(){return this.currentValue}set value(e){this.currentValue=this.clamp(e),this.setAttribute("value",String(this.currentValue)),this.syncVisuals()}get range(){if(this.hasAttribute("range"))return[...this.currentRange]}set range(e){if(null==e)return this.removeAttribute("range"),void(this.built&&(this.syncStructure(),this.syncVisuals()));const t=this.normalizeRangeInput(e);if(!t)return;const s=[Math.min(t[0],t[1]),Math.max(t[0],t[1])];this.currentRange=[this.clamp(s[0]),this.clamp(s[1])];const i=`${this.currentRange[0]},${this.currentRange[1]}`;this.getAttribute("range")!==i&&this.setAttribute("range",i),this.built&&this.syncVisuals()}build(){this.classList.add(Xe),this.headerEl=document.createElement("div"),this.headerEl.className=`${Xe}__header`,this.labelEl=document.createElement("span"),this.labelEl.className=`${Xe}__label`,this.valuesEl=document.createElement("div"),this.valuesEl.className=`${Xe}__values`,this.containerEl=document.createElement("div"),this.containerEl.className=`${Xe}__container`,this.containerEl.setAttribute("role","slider"),this.containerEl.setAttribute("tabindex","0"),this.trackEl=document.createElement("div"),this.trackEl.className=`${Xe}__track`,this.fillEl=document.createElement("div"),this.fillEl.className=`${Xe}__fill`,this.trackEl.appendChild(this.fillEl),this.containerEl.appendChild(this.trackEl)}getValuePosition(){const e=this.getAttribute("value-position");return e||(this.shouldShowLabel()?"top":"right")}shouldShowLabel(){return this.hasAttribute("show-label")&&Boolean(this.getAttribute("label")?.trim())}formatValue(e){const t=this.getAttribute("value-fixed");if(null!==t&&""!==t){const s=Number(t);if(Number.isFinite(s))return e.toFixed(s)}return String(e)}syncDomOrder(){if(!this.headerEl||!this.valuesEl||!this.containerEl)return;const e=this.getValuePosition(),t=this.shouldShowLabel(),s=this.hasAttribute("show-value"),i=this.hasAttribute("range");return this.replaceChildren(),this.labelEl&&(this.labelEl.textContent=this.getAttribute("label")?.trim()||""),i||"top"===e?(this.headerEl.replaceChildren(),t&&this.labelEl&&this.headerEl.appendChild(this.labelEl),s&&this.headerEl.appendChild(this.valuesEl),this.headerEl.childElementCount>0&&this.append(this.headerEl),void this.append(this.containerEl)):"bottom"===e?(t&&this.labelEl&&(this.headerEl.replaceChildren(this.labelEl),this.append(this.headerEl)),this.append(this.containerEl),void(s&&this.append(this.valuesEl))):void(s?this.append(this.valuesEl,this.containerEl):this.append(this.containerEl))}bindEvents(){this.eventsBound||(this.trackEl?.addEventListener("click",this.boundTrackClick),this.containerEl?.addEventListener("keydown",this.boundContainerKeyDown),this.eventsBound=!0)}unbindEvents(){this.eventsBound&&(this.trackEl?.removeEventListener("click",this.boundTrackClick),this.containerEl?.removeEventListener("keydown",this.boundContainerKeyDown),document.removeEventListener("pointermove",this.boundPointerMove),document.removeEventListener("pointerup",this.boundPointerUp),this.eventsBound=!1)}readAttributeValues(){const e=this.getNumberAttr("min",0),t=this.getNumberAttr("max",100),s=this.getNumberAttr("step",1);if(this.hasAttribute("range")){const i=this.parseRangeAttr(this.getAttribute("range"));i?this.currentRange=[this.clamp(i[0],e,t,s),this.clamp(i[1],e,t,s)]:this.currentRange.every(Number.isFinite)||(this.currentRange=[25,75])}else this.currentValue=this.clamp(this.getNumberAttr("value",50),e,t,s)}syncClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.hasAttribute("range"),i=this.getValuePosition(),n=[Xe,`${Xe}--${e}`,`${Xe}--${t}`,`${Xe}--value-${s?"top":i}`,this.shouldShowLabel()?`${Xe}--has-label`:"",this.hasAttribute("disabled")?`${Xe}--disabled`:"",this.hasAttribute("readonly")?`${Xe}--readonly`:"",this.hasAttribute("full-width")?`${Xe}--full-width`:"",this.hasAttribute("vertical")?`${Xe}--vertical`:"",this.hasAttribute("show-thumb-tooltip")?`${Xe}--show-tooltip`:"",s?`${Xe}--range`:""].filter(Boolean);if(this.className=n.join(" "),this.trackEl){const e=[`${Xe}__track`];this.hasAttribute("disabled")&&e.push(`${Xe}__track--disabled`),this.hasAttribute("readonly")&&e.push(`${Xe}__track--readonly`),this.trackEl.className=e.join(" ")}}syncStructure(){if(!this.valuesEl||!this.trackEl||!this.fillEl)return;const e=this.hasAttribute("show-value"),t=this.hasAttribute("range"),s=this.hasAttribute("show-marks");if(this.valuesEl.innerHTML="",this.valuesEl.hidden=!e,e)if(t){const e=document.createElement("span");e.className=`${Xe}__value ${Xe}__value--min`;const t=document.createElement("span");t.className=`${Xe}__value-separator`,t.textContent="~",t.setAttribute("aria-hidden","true");const s=document.createElement("span");s.className=`${Xe}__value ${Xe}__value--max`,this.valuesEl.append(e,t,s)}else{const e=document.createElement("span");e.className=`${Xe}__value ${Xe}__value--single`,this.valuesEl.appendChild(e)}if(this.thumbEls.forEach(e=>e.remove()),this.thumbEls=[],this.trackEl.querySelectorAll(`.${Xe}__mark`).forEach(e=>e.remove()),s){const e=this.parseMarks();if(e.length>0){const t=this.parseMarkLabels();e.forEach(e=>{const s=document.createElement("div");if(s.className=`${Xe}__mark`,s.setAttribute("aria-hidden","true"),this.isMarkActive(e)&&s.classList.add(`${Xe}__mark--active`),this.hasAttribute("vertical")?s.style.bottom=`${this.valueToPercent(e)}%`:s.style.left=`${this.valueToPercent(e)}%`,void 0!==t[e]){const i=document.createElement("span");i.className=`${Xe}__mark-label`,i.textContent=t[e],s.appendChild(i)}this.trackEl.insertBefore(s,this.fillEl)})}}const i=t?2:1,n=this.hasAttribute("disabled")||this.hasAttribute("readonly");for(let e=0;e<i;e++){const s=document.createElement("div");s.className=`${Xe}__thumb`,s.setAttribute("role","slider"),s.setAttribute("draggable","false"),s.setAttribute("tabindex",n?"-1":"0");const i=t?0===e?"min":"max":"single";t&&(s.dataset.thumb=i),s.addEventListener("pointerdown",e=>this.handleThumbPointerDown(e,i)),s.addEventListener("keydown",e=>this.handleKeyDown(e,i));const a=document.createElement("span");a.className=`${Xe}__thumb-tooltip`,a.setAttribute("aria-hidden","true"),a.hidden=!0,s.appendChild(a),this.trackEl.appendChild(s),this.thumbEls.push(s)}}isMarkActive(e){if(this.hasAttribute("range")){const[t,s]=this.currentRange;return e>=t&&e<=s}return e<=this.currentValue}syncVisuals(){if(!this.fillEl)return;const e=this.hasAttribute("range"),t=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100);if(e){const[e,i]=this.currentRange,n=this.valueToPercent(e),a=this.valueToPercent(i);this.hasAttribute("vertical")?(this.fillEl.style.left="",this.fillEl.style.width="",this.fillEl.style.bottom=`${n}%`,this.fillEl.style.height=a-n+"%"):(this.fillEl.style.bottom="",this.fillEl.style.height="",this.fillEl.style.left=`${n}%`,this.fillEl.style.width=a-n+"%"),this.thumbEls[0]&&(this.setThumbPosition(this.thumbEls[0],n),this.thumbEls[0].setAttribute("aria-valuemin",String(t)),this.thumbEls[0].setAttribute("aria-valuemax",String(i)),this.thumbEls[0].setAttribute("aria-valuenow",String(e))),this.thumbEls[1]&&(this.setThumbPosition(this.thumbEls[1],a),this.thumbEls[1].setAttribute("aria-valuemin",String(e)),this.thumbEls[1].setAttribute("aria-valuemax",String(s)),this.thumbEls[1].setAttribute("aria-valuenow",String(i)));const r=this.valuesEl?.querySelector(`.${Xe}__value--min`),o=this.valuesEl?.querySelector(`.${Xe}__value--max`);r&&(r.textContent=this.formatValue(e)),o&&(o.textContent=this.formatValue(i))}else{const e=this.valueToPercent(this.currentValue);this.hasAttribute("vertical")?(this.fillEl.style.left="",this.fillEl.style.width="",this.fillEl.style.bottom="0",this.fillEl.style.height=`${e}%`):(this.fillEl.style.bottom="",this.fillEl.style.height="",this.fillEl.style.left="0",this.fillEl.style.width=`${e}%`),this.thumbEls[0]&&(this.setThumbPosition(this.thumbEls[0],e),this.thumbEls[0].setAttribute("aria-valuemin",String(t)),this.thumbEls[0].setAttribute("aria-valuemax",String(s)),this.thumbEls[0].setAttribute("aria-valuenow",String(this.currentValue)));const i=this.valuesEl?.querySelector(`.${Xe}__value--single`);i&&(i.textContent=this.formatValue(this.currentValue))}this.syncThumbTooltips(),this.trackEl?.querySelectorAll(`.${Xe}__mark`).forEach(e=>{const t=e instanceof HTMLElement?parseFloat(e.style.left):NaN,s=e instanceof HTMLElement?parseFloat(e.style.bottom):NaN,i=Number.isFinite(t)?t:s;if(!Number.isFinite(i))return;const n=this.percentToValue(i);e.classList.toggle(`${Xe}__mark--active`,this.isMarkActive(n))})}syncThumbTooltips(){const e=this.hasAttribute("range"),t=this.hasAttribute("show-thumb-tooltip");this.thumbEls.forEach((s,i)=>{const n=s.querySelector(`.${Xe}__thumb-tooltip`);if(!n)return;if(!t)return void(n.hidden=!0);n.hidden=!1;const a=e?0===i?this.currentRange[0]:this.currentRange[1]:this.currentValue;n.textContent=this.formatValue(a)})}syncA11y(){if(!this.containerEl)return;const e=this.getNumberAttr("min",0),t=this.getNumberAttr("max",100),s=this.hasAttribute("range"),i=this.hasAttribute("disabled"),n=this.hasAttribute("readonly");this.containerEl.setAttribute("aria-valuemin",String(e)),this.containerEl.setAttribute("aria-valuemax",String(t)),this.containerEl.setAttribute("aria-valuenow",String(s?this.currentRange[0]:this.currentValue)),this.containerEl.setAttribute("aria-valuetext",s?`${this.currentRange[0]} to ${this.currentRange[1]}`:String(this.currentValue)),this.containerEl.setAttribute("aria-disabled",String(i)),this.containerEl.setAttribute("aria-readonly",String(n)),this.containerEl.setAttribute("tabindex",i||n?"-1":"0")}setThumbPosition(e,t){this.hasAttribute("vertical")?(e.style.left="",e.style.bottom=`${t}%`):(e.style.bottom="",e.style.left=`${t}%`)}valueToPercent(e){const t=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100);return s===t?0:(e-t)/(s-t)*100}percentToValue(e){const t=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100),i=this.getNumberAttr("step",1),n=t+e/100*(s-t);return this.snapToStep(n,t,s,i)}snapToStep(e,t,s,i){const n=Math.round(e/i)*i;return Math.min(s,Math.max(t,n))}clamp(e,t=this.getNumberAttr("min",0),s=this.getNumberAttr("max",100),i=this.getNumberAttr("step",1)){return this.snapToStep(Math.min(s,Math.max(t,e)),t,s,i)}getNumberAttr(e,t){const s=this.getAttribute(e);if(null===s||""===s)return t;const i=Number(s);return Number.isFinite(i)?i:t}normalizeRangeInput(e){if("string"==typeof e)return this.parseRangeAttr(e);if(!Array.isArray(e)||e.length<2)return null;const t=Number(e[0]),s=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(s)?[t,s]:null}parseRangeAttr(e){if(!e)return null;if(e.startsWith("[")){try{const t=JSON.parse(e);if(Array.isArray(t)&&2===t.length){const e=Number(t[0]),s=Number(t[1]);if(Number.isFinite(e)&&Number.isFinite(s))return[e,s]}}catch{return null}return null}const t=e.split(",").map(e=>Number(e.trim()));return 2!==t.length||t.some(e=>!Number.isFinite(e))?null:[t[0],t[1]]}parseMarks(){const e=this.getAttribute("marks");if(!e)return[];if(e.startsWith("[")){try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>Number(e)).filter(e=>Number.isFinite(e))}catch{return[]}return[]}return e.split(",").map(e=>Number(e.trim())).filter(e=>Number.isFinite(e))}parseMarkLabels(){const e=this.getAttribute("mark-labels");if(!e)return{};try{const t=JSON.parse(e),s={};return Object.entries(t).forEach(([e,t])=>{s[Number(e)]=t}),s}catch{return{}}}isInteractive(){return!this.hasAttribute("disabled")&&!this.hasAttribute("readonly")}getTrackPercent(e,t){if(!this.trackEl)return 0;const s=this.trackEl.getBoundingClientRect();if(this.hasAttribute("vertical")){const e=Math.max(s.top,Math.min(s.bottom,t));return(s.bottom-e)/s.height*100}return(Math.max(s.left,Math.min(s.right,e))-s.left)/s.width*100}handleThumbPointerDown(e,t){this.isInteractive()&&(e.preventDefault(),this.isDragging=!0,this.activeThumb=t,this.setThumbActive(t,!0),document.addEventListener("pointermove",this.boundPointerMove),document.addEventListener("pointerup",this.boundPointerUp))}handleTrackClick(e){if(!this.isInteractive()||!this.trackEl)return;if(e.target.closest(`.${Xe}__thumb`))return;const t=this.getTrackPercent(e.clientX,e.clientY),s=this.percentToValue(t);this.commitValueAtPosition(s)}handlePointerMove(e){if(!this.isDragging||!this.isInteractive())return;const t=this.getTrackPercent(e.clientX,e.clientY),s=this.percentToValue(t);this.applyDragValue(s)}handlePointerUp(){this.isDragging&&(this.activeThumb&&this.setThumbActive(this.activeThumb,!1),this.isDragging=!1,this.activeThumb=null,document.removeEventListener("pointermove",this.boundPointerMove),document.removeEventListener("pointerup",this.boundPointerUp),this.syncThumbTooltips(),this.hasAttribute("range")?this.setAttribute("range",`${this.currentRange[0]},${this.currentRange[1]}`):this.setAttribute("value",String(this.currentValue)),this.syncA11y())}setThumbActive(e,t){if(this.hasAttribute("range")){const s=this.thumbEls["min"===e?0:1];return void s?.classList.toggle(`${Xe}__thumb--active`,t)}this.thumbEls[0]?.classList.toggle(`${Xe}__thumb--active`,t)}applyDragValue(e){const t=this.clamp(e);if(this.hasAttribute("range")){const[e,s]=this.currentRange;if("min"===this.activeThumb)this.currentRange=[Math.min(t,s),s];else if("max"===this.activeThumb)this.currentRange=[e,Math.max(t,e)];else{Math.abs(t-e)<=Math.abs(t-s)?(this.currentRange=[Math.min(t,s),s],this.activeThumb="min"):(this.currentRange=[e,Math.max(t,e)],this.activeThumb="max")}this.syncVisuals(),this.dispatchRangeChange()}else this.currentValue=t,this.syncVisuals(),this.syncA11y(),this.dispatchValueChange()}commitValueAtPosition(e){const t=this.clamp(e);if(this.hasAttribute("range")){const[e,s]=this.currentRange,i=Math.abs(t-e),n=Math.abs(t-s);this.currentRange=i<=n?[Math.min(t,s),s]:[e,Math.max(t,e)],this.setAttribute("range",`${this.currentRange[0]},${this.currentRange[1]}`),this.syncVisuals(),this.dispatchRangeChange()}else this.currentValue=t,this.setAttribute("value",String(this.currentValue)),this.syncVisuals(),this.syncA11y(),this.dispatchValueChange()}handleKeyDown(e,t="single"){if(!this.isInteractive())return;const s=this.getNumberAttr("step",1),i=this.getNumberAttr("min",0),n=this.getNumberAttr("max",100);let a;if(this.hasAttribute("range")&&"single"!==t){const r="min"===t?this.currentRange[0]:this.currentRange[1];switch(e.key){case"ArrowLeft":case"ArrowDown":a=this.clamp(r-s,i,n);break;case"ArrowRight":case"ArrowUp":a=this.clamp(r+s,i,n);break;case"Home":a=i;break;case"End":a=n;break;default:return}const o=[...this.currentRange];if("min"===t?o[0]=a:o[1]=a,o[0]>o[1])return;return e.preventDefault(),this.currentRange=o,void this.afterKeyboard()}if(!this.hasAttribute("range")){switch(e.key){case"ArrowLeft":case"ArrowDown":a=this.clamp(this.currentValue-s,i,n);break;case"ArrowRight":case"ArrowUp":a=this.clamp(this.currentValue+s,i,n);break;case"Home":a=i;break;case"End":a=n;break;default:return}e.preventDefault(),this.currentValue=a,this.afterKeyboard()}}afterKeyboard(){this.hasAttribute("range")?(this.setAttribute("range",`${this.currentRange[0]},${this.currentRange[1]}`),this.syncVisuals(),this.dispatchRangeChange()):(this.setAttribute("value",String(this.currentValue)),this.syncVisuals(),this.syncA11y(),this.dispatchValueChange())}dispatchValueChange(){this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{value:this.currentValue}}))}dispatchRangeChange(){this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{range:[...this.currentRange]}}))}}customElements.get("db-range-slider")||customElements.define("db-range-slider",DbRangeSlider);const Ze="designbase-wc-segment-control",Qe={bar:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="12" width="4" height="8"/><rect x="10" y="8" width="4" height="12"/><rect x="17" y="4" width="4" height="16"/></svg>',line:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 16 9 10 14 13 20 6"/></svg>',pie:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v10l8.66 5"/><circle cx="12" cy="12" r="10"/></svg>',donut:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="3"/></svg>',radar:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 20 8 17 20 7 20 4 8"/></svg>'};class DbSegmentControl extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.indicatorEl=null,this.segmentButtons=[],this.focusedIndex=-1,this.boundKeyDown=e=>this.handleKeyDown(e),this.boundResize=()=>this.updateIndicator(),this.resizeObserver=null}static get observedAttributes(){return["options","value","default-value","size","variant","appearance","full-width","disabled"]}connectedCallback(){this.built||(this.built=!0),this.render(),this.addEventListener("keydown",this.boundKeyDown),window.addEventListener("resize",this.boundResize),this.resizeObserver=new ResizeObserver(()=>this.updateIndicator()),this.resizeObserver.observe(this)}disconnectedCallback(){this.removeEventListener("keydown",this.boundKeyDown),window.removeEventListener("resize",this.boundResize),this.resizeObserver?.disconnect(),this.resizeObserver=null}attributeChangedCallback(e){this.built&&("value"!==e?this.render():this.updateSelection())}get options(){return this.parseOptions(this.getAttribute("options"))}set options(e){this.setAttribute("options","string"==typeof e?e:JSON.stringify(e))}get value(){return this.getAttribute("value")||this.getAttribute("default-value")||this.options[0]?.value||""}set value(e){this.setAttribute("value",e)}parseOptions(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("appearance")||"pill",i=this.hasAttribute("disabled"),n=this.options,a=this.value;this.className=[Ze,`${Ze}--${e}`,`${Ze}--${t}`,"rounded"===s&&`${Ze}--appearance-rounded`,this.hasAttribute("full-width")&&`${Ze}--full-width`,i&&`${Ze}--disabled`].filter(Boolean).join(" "),this.setAttribute("role","tablist"),this.setAttribute("aria-label","세그먼트 컨트롤"),this.replaceChildren(),this.segmentButtons=[],n.forEach((e,s)=>{const n=e.value===a,r=Boolean(i||e.disabled),o=document.createElement("button");if(o.type="button",o.className=[`${Ze}__segment`,n&&`${Ze}__segment--selected`,r&&`${Ze}__segment--disabled`].filter(Boolean).join(" "),o.setAttribute("role","tab"),o.setAttribute("aria-selected",String(n)),o.setAttribute("aria-disabled",String(r)),o.setAttribute("tabindex",n?"0":"-1"),o.disabled=r,e.icon&&Qe[e.icon]){const t=document.createElement("span");t.className=`${Ze}__segment-icon`,t.innerHTML=Qe[e.icon],o.appendChild(t)}const l=document.createElement("span");l.className=`${Ze}__segment-label`,l.textContent=e.label,"icon-only"===t&&l.setAttribute("aria-label",e.label),o.appendChild(l),o.addEventListener("click",()=>this.select(e.value)),o.addEventListener("focus",()=>{this.focusedIndex=s,o.classList.add(`${Ze}__segment--focused`)}),o.addEventListener("blur",()=>{this.focusedIndex=-1,o.classList.remove(`${Ze}__segment--focused`)}),this.appendChild(o),this.segmentButtons.push(o)}),this.indicatorEl=document.createElement("div"),this.indicatorEl.className=`${Ze}__indicator`,this.appendChild(this.indicatorEl),this.updateSelection()}updateSelection(){const e=this.options,t=this.value,s=e.findIndex(e=>e.value===t);this.segmentButtons.forEach((s,i)=>{const n=e[i],a=n?.value===t;s.classList.toggle(`${Ze}__segment--selected`,a),s.setAttribute("aria-selected",String(a)),s.setAttribute("tabindex",a?"0":"-1")}),this.indicatorEl&&e.length>0&&s>=0&&requestAnimationFrame(()=>this.updateIndicator())}updateIndicator(){const e=this.options.findIndex(e=>e.value===this.value),t=this.segmentButtons[e];this.indicatorEl&&t&&(this.indicatorEl.style.width=`${t.offsetWidth}px`,this.indicatorEl.style.transform=`translateX(${t.offsetLeft}px)`)}select(e){if(this.hasAttribute("disabled"))return;const t=this.options.find(t=>t.value===e);t&&!t.disabled&&(this.setAttribute("value",e),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e},bubbles:!0,composed:!0})))}handleKeyDown(e){if(this.hasAttribute("disabled"))return;const t=this.options,s=t.findIndex(e=>e.value===this.value);if(-1===s)return;let i=s;switch(e.key){case"ArrowLeft":e.preventDefault(),i=s>0?s-1:t.length-1;break;case"ArrowRight":e.preventDefault(),i=s<t.length-1?s+1:0;break;case"Home":e.preventDefault(),i=0;break;case"End":e.preventDefault(),i=t.length-1;break;case"Enter":case" ":return e.preventDefault(),void this.select(t[i]?.value??this.value);default:return}for(;i!==s;){const s=t[i];if(s&&!s.disabled){this.segmentButtons[i]?.focus();break}i="ArrowLeft"===e.key||"Home"===e.key?i>0?i-1:t.length-1:i<t.length-1?i+1:0}}}customElements.get("db-segment-control")||customElements.define("db-segment-control",DbSegmentControl);const et="designbase-wc-stepper",tt=["s","m","l"],st={display:"block",width:"100%",minWidth:"0",height:"auto",padding:"0",margin:"0",border:"0",background:"transparent",color:"inherit",fontFamily:"inherit",fontWeight:"600",lineHeight:"1",textAlign:"center",outline:"none",boxShadow:"none",boxSizing:"border-box",appearance:"none"};class DbStepper extends HTMLElement{constructor(){super(...arguments),this.decrementBtn=null,this.incrementBtn=null,this.valueWrapEl=null,this.valueTextEl=null,this.valueInputEl=null,this.descriptionEl=null,this.boundInputKeyDown=e=>this.handleInputKeyDown(e),this.boundInputInput=()=>this.handleInputInput(),this.boundInputPaste=e=>this.handleInputPaste(e),this.boundInputBlur=()=>this.commitInputValue()}static get observedAttributes(){return["value","min","max","step","size","editable","full-width","disabled","readonly"]}connectedCallback(){this.querySelector(`.${et}__button`)||this.build(),this.syncFromAttributes()}attributeChangedCallback(e){this.decrementBtn&&this.syncFromAttributes()}get value(){return Number(this.getAttribute("value")||0)}set value(e){this.setAttribute("value",String(e))}build(){this.decrementBtn=document.createElement("button"),this.decrementBtn.type="button",this.decrementBtn.className=`${et}__button ${et}__button--decrement`,this.decrementBtn.setAttribute("aria-label","감소"),this.decrementBtn.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>',this.valueWrapEl=document.createElement("div"),this.valueWrapEl.className=`${et}__value`,this.valueTextEl=document.createElement("span"),this.valueTextEl.className=`${et}__value-text`,this.valueWrapEl.appendChild(this.valueTextEl),this.incrementBtn=document.createElement("button"),this.incrementBtn.type="button",this.incrementBtn.className=`${et}__button ${et}__button--increment`,this.incrementBtn.setAttribute("aria-label","증가"),this.incrementBtn.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>',this.descriptionEl=document.createElement("div"),this.descriptionEl.id="stepper-description",this.descriptionEl.className="sr-only",this.decrementBtn.addEventListener("click",()=>this.change(this.value-this.getStep())),this.incrementBtn.addEventListener("click",()=>this.change(this.value+this.getStep())),this.append(this.decrementBtn,this.valueWrapEl,this.incrementBtn,this.descriptionEl)}isEditable(){return!this.hasAttribute("disabled")&&!this.hasAttribute("readonly")&&"false"!==this.getAttribute("editable")}syncFromAttributes(){const e=this.getAttribute("size")||"m",t=this.hasAttribute("disabled"),s=this.hasAttribute("readonly"),i=this.getMin(),n=this.getMax(),a=this.getStep(),r=this.clamp(this.snapToStep(this.value));if(this.getAttribute("value")!==String(r)&&this.setAttribute("value",String(r)),this.className=[et,`${et}--${tt.includes(e)?e:"m"}`,this.hasAttribute("full-width")&&`${et}--full-width`,this.isEditable()&&`${et}--editable`,t&&`${et}--disabled`,s&&`${et}--readonly`].filter(Boolean).join(" "),this.syncValueField(r),this.descriptionEl){const e=this.isEditable()?"값을 직접 입력할 수 있습니다. ":"";this.descriptionEl.textContent=`${e}숫자 조정기. +/- 버튼으로 값을 조정할 수 있습니다. 현재 값: ${r}, 최소값: ${i}, 최대값: ${n}, 단계: ${a}`}this.decrementBtn?.setAttribute("aria-describedby","stepper-description"),this.incrementBtn?.setAttribute("aria-describedby","stepper-description"),this.updateButtons()}applyValueInputAppearance(){this.valueInputEl&&(Object.assign(this.valueInputEl.style,st),this.valueInputEl.style.setProperty("-webkit-appearance","none"),this.valueInputEl.style.setProperty("-moz-appearance","textfield"))}syncValueField(e){if(this.valueWrapEl){if(this.isEditable())return this.valueInputEl||(this.valueInputEl=document.createElement("input"),this.valueInputEl.className=`${et}__value-input`,this.valueInputEl.type="text",this.valueInputEl.setAttribute("inputmode",this.allowsDecimal()?"decimal":"numeric"),this.valueInputEl.setAttribute("pattern",this.buildInputPattern()),this.valueInputEl.setAttribute("aria-label","값 입력"),this.valueInputEl.autocomplete="off",this.valueInputEl.spellcheck=!1,this.valueInputEl.addEventListener("keydown",this.boundInputKeyDown),this.valueInputEl.addEventListener("input",this.boundInputInput),this.valueInputEl.addEventListener("paste",this.boundInputPaste),this.valueInputEl.addEventListener("blur",this.boundInputBlur),this.applyValueInputAppearance()),this.applyValueInputAppearance(),this.valueInputEl.setAttribute("inputmode",this.allowsDecimal()?"decimal":"numeric"),this.valueInputEl.setAttribute("pattern",this.buildInputPattern()),this.valueInputEl.setAttribute("aria-valuemin",String(this.getMin())),this.valueInputEl.setAttribute("aria-valuemax",String(this.getMax())),this.valueInputEl.disabled=!1,document.activeElement!==this.valueInputEl&&(this.valueInputEl.value=String(e)),this.valueTextEl?.remove(),void(this.valueWrapEl.contains(this.valueInputEl)||this.valueWrapEl.appendChild(this.valueInputEl));this.valueInputEl&&(this.valueInputEl.removeEventListener("keydown",this.boundInputKeyDown),this.valueInputEl.removeEventListener("input",this.boundInputInput),this.valueInputEl.removeEventListener("paste",this.boundInputPaste),this.valueInputEl.removeEventListener("blur",this.boundInputBlur),this.valueInputEl.remove(),this.valueInputEl=null),this.valueTextEl||(this.valueTextEl=document.createElement("span"),this.valueTextEl.className=`${et}__value-text`),this.valueTextEl.textContent=String(e),this.valueWrapEl.contains(this.valueTextEl)||this.valueWrapEl.appendChild(this.valueTextEl)}}allowsNegative(){return this.getMin()<0}allowsDecimal(){const e=this.getStep();return!Number.isInteger(e)}buildInputPattern(){return`^${this.allowsNegative()?"-?":""}\\d*${this.allowsDecimal()?"(\\.\\d*)?":""}$`}sanitizeInputString(e){let t="",s=!1,i=!1;for(let n=0;n<e.length;n++){const a=e[n];"-"!==a||!this.allowsNegative()||0!==t.length||s?"."!==a||!this.allowsDecimal()||i?/\d/.test(a)&&(t+=a):(t+=a,i=!0):(t+=a,s=!0)}return t}parseInputValue(e){const t=e.trim();if(""===t||"-"===t||"."===t)return null;const s=Number(t);return Number.isFinite(s)?s:null}enforceInputBounds(e,t={}){const s=this.sanitizeInputString(e),i=this.parseInputValue(s);if(null===i)return s;const n=this.getMin(),a=this.getMax();return i>a?String(a):t.clampMin&&i<n?String(n):s}handleInputKeyDown(e){if(!["Backspace","Delete","Tab","Escape","ArrowLeft","ArrowRight","Home","End"].includes(e.key)){if("Enter"===e.key)return e.preventDefault(),this.commitInputValue(),void this.valueInputEl?.blur();if("-"===e.key&&this.allowsNegative()){const e=this.valueInputEl;if(e&&0===e.selectionStart&&0===e.selectionEnd&&!e.value.includes("-"))return}"."===e.key&&this.allowsDecimal()&&!this.valueInputEl?.value.includes(".")||/^\d$/.test(e.key)||e.preventDefault()}}handleInputInput(){if(!this.valueInputEl)return;const e=this.enforceInputBounds(this.valueInputEl.value);this.valueInputEl.value!==e&&(this.valueInputEl.value=e)}handleInputPaste(e){if(e.preventDefault(),!this.valueInputEl)return;const t=e.clipboardData?.getData("text")??"",s=this.enforceInputBounds(this.sanitizeInputString(this.valueInputEl.value+t));this.valueInputEl.value=s,this.handleInputInput()}commitInputValue(){if(!this.valueInputEl||!this.isEditable())return;const e=this.valueInputEl.value.trim();if(""===e||"-"===e||"."===e)return void(this.valueInputEl.value=String(this.value));const t=this.parseInputValue(e);if(null===t)return void(this.valueInputEl.value=String(this.value));const s=this.snapToStep(t);this.valueInputEl.value=String(s),this.change(s)}getMin(){return Number(this.getAttribute("min")??0)}getMax(){return Number(this.getAttribute("max")??100)}getStep(){return Number(this.getAttribute("step")??1)}snapToStep(e){const t=this.getStep(),s=Math.round(e/t)*t;return this.clamp(s)}clamp(e){return Math.max(this.getMin(),Math.min(this.getMax(),e))}updateButtons(){const e=this.getMin(),t=this.getMax(),s=this.hasAttribute("disabled"),i=this.hasAttribute("readonly"),n=this.value,a=n<=e,r=n>=t;if(this.decrementBtn){const e=s||i||a;this.decrementBtn.disabled=e,this.decrementBtn.classList.toggle(`${et}__button--disabled`,e)}if(this.incrementBtn){const e=s||i||r;this.incrementBtn.disabled=e,this.incrementBtn.classList.toggle(`${et}__button--disabled`,e)}}change(e){if(this.hasAttribute("disabled")||this.hasAttribute("readonly"))return;const t=this.getMin(),s=this.getMax(),i=this.clamp(this.snapToStep(e)),n=this.value;if(i!==n){if(this.setAttribute("value",String(i)),this.valueTextEl&&(this.valueTextEl.textContent=String(i)),this.valueInputEl&&(this.valueInputEl.value=String(i)),this.updateButtons(),this.descriptionEl){const e=this.getStep(),n=this.isEditable()?"값을 직접 입력할 수 있습니다. ":"";this.descriptionEl.textContent=`${n}숫자 조정기. +/- 버튼으로 값을 조정할 수 있습니다. 현재 값: ${i}, 최소값: ${t}, 최대값: ${s}, 단계: ${e}`}this.dispatchEvent(new CustomEvent("db-change",{detail:{value:i,minReached:i<=t,maxReached:i>=s},bubbles:!0,composed:!0})),i<=t&&n>t&&this.dispatchEvent(new CustomEvent("db-min-reached",{bubbles:!0,composed:!0,detail:{value:i}})),i>=s&&n<s&&this.dispatchEvent(new CustomEvent("db-max-reached",{bubbles:!0,composed:!0,detail:{value:i}}))}else this.valueInputEl&&(this.valueInputEl.value=String(i))}}customElements.get("db-stepper")||customElements.define("db-stepper",DbStepper);const it=["s","m","l","xl","full"],nt=["none","s","m","l","xl"];class DbContainer extends HTMLElement{static get observedAttributes(){return["size","padding","max-width","full-width"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const e=this.getAttribute("size")||"l",t=this.getAttribute("padding")||"m",s=this.getAttribute("max-width");this.className=["designbase-wc-container",`designbase-wc-container--size-${it.includes(e)?e:"l"}`,nt.includes(t)&&`designbase-wc-container--padding-${t}`,this.hasAttribute("full-width")&&"designbase-wc-container--full-width"].filter(Boolean).join(" "),this.hasAttribute("full-width")?this.style.maxWidth="100%":s?this.style.maxWidth=s.includes("px")||s.includes("%")?s:`${s}px`:this.style.removeProperty("max-width")}}customElements.get("db-container")||customElements.define("db-container",DbContainer);const at=["vertical","horizontal"],rt=["start","center","end","stretch"],ot=["start","center","end","space-between","space-around","space-evenly"],lt=["none","xs","s","m","l","xl"];class DbStack extends HTMLElement{static get observedAttributes(){return["direction","alignment","justify","spacing","full-width","full-height","wrap"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const e=this.getAttribute("direction")||"vertical",t=this.getAttribute("alignment")||"start",s=this.getAttribute("justify")||"start",i=this.getAttribute("spacing")||"m",n=lt.includes(i)?i:"m";this.className=["designbase-wc-stack",`designbase-wc-stack--direction-${at.includes(e)?e:"vertical"}`,`designbase-wc-stack--alignment-${rt.includes(t)?t:"start"}`,`designbase-wc-stack--justify-${ot.includes(s)?s:"start"}`,`designbase-wc-stack--spacing-${{none:"none",xs:"xs",s:"sm",m:"md",l:"lg",xl:"xl"}[n]||"md"}`,this.hasAttribute("full-width")&&"designbase-wc-stack--full-width",this.hasAttribute("full-height")&&"designbase-wc-stack--full-height",this.hasAttribute("wrap")&&"designbase-wc-stack--wrap"].filter(Boolean).join(" ")}}customElements.get("db-stack")||customElements.define("db-stack",DbStack);class DbGrid extends HTMLElement{static get observedAttributes(){return["columns","gap","fixed","no-padding","full-width"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const e=Math.max(1,Number(this.getAttribute("columns")||12)),t=this.getAttribute("gap")||"m",s=["none","xs","s","m","l","xl"].includes(t)?t:"m",i={none:"0",xs:"var(--db-gap-xs)",s:"var(--db-gap-s)",m:"var(--db-gap-m)",l:"var(--db-gap-l)",xl:"var(--db-gap-xl)"};this.className=["designbase-wc-grid",`designbase-wc-grid--gap-${s}`,this.hasAttribute("fixed")&&"designbase-wc-grid--fixed",this.hasAttribute("no-padding")&&"designbase-wc-grid--no-padding",this.hasAttribute("full-width")&&"designbase-wc-grid--full-width"].filter(Boolean).join(" "),this.style.setProperty("--db-wc-grid-columns",String(e)),this.style.display="grid",this.style.gridTemplateColumns=`repeat(${e}, minmax(0, 1fr))`,this.style.gap=i[s]||i.m,this.style.alignItems="start"}}class DbGridItem extends HTMLElement{static get observedAttributes(){return["span","span-sm","span-md","span-lg","span-xl"]}connectedCallback(){this.syncClasses()}attributeChangedCallback(){this.syncClasses()}syncClasses(){const parseSpan=(e,t=12)=>{const s=Number(e??t);return Math.min(12,Math.max(1,Number.isFinite(s)?s:t))},e=parseSpan(this.getAttribute("span")),t=parseSpan(this.getAttribute("span-sm"),e),s=parseSpan(this.getAttribute("span-md"),t),i=parseSpan(this.getAttribute("span-lg"),s),n=parseSpan(this.getAttribute("span-xl"),i);this.className="designbase-wc-grid__item",this.style.gridColumn=`span ${e}`,this.style.setProperty("--db-wc-grid-item-span",String(e)),this.style.setProperty("--db-wc-grid-item-span-sm",String(t)),this.style.setProperty("--db-wc-grid-item-span-md",String(s)),this.style.setProperty("--db-wc-grid-item-span-lg",String(i)),this.style.setProperty("--db-wc-grid-item-span-xl",String(n))}}customElements.get("db-grid")||customElements.define("db-grid",DbGrid),customElements.get("db-grid-item")||customElements.define("db-grid-item",DbGridItem);class DbToolbar extends HTMLElement{static get observedAttributes(){return["items","size","variant","position","full-width","shadow","rounded","fixed"]}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}attributeChangedCallback(e){"items"!==e?this.syncHostClasses():this.render()}syncHostClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("position")||"top";this.className=["designbase-wc-toolbar",`designbase-wc-toolbar--size-${e}`,`designbase-wc-toolbar--variant-${t}`,`designbase-wc-toolbar--position-${s}`,this.hasAttribute("full-width")&&"designbase-wc-toolbar--full-width",this.hasAttribute("fixed")&&"designbase-wc-toolbar--fixed",this.hasAttribute("shadow")&&"designbase-wc-toolbar--shadow",this.hasAttribute("rounded")&&"designbase-wc-toolbar--rounded"].filter(Boolean).join(" ")}render(){this.syncHostClasses(),this.setAttribute("role","toolbar");let e=this.querySelector(".designbase-wc-toolbar__content");e?e.replaceChildren():(e=document.createElement("div"),e.className="designbase-wc-toolbar__content",this.replaceChildren(e));const t=document.createElement("div");t.className="designbase-wc-toolbar__group",e.append(t),this.items.forEach(e=>{if("separator"===e.type){const e=document.createElement("div");return e.className="designbase-wc-toolbar__item designbase-wc-toolbar__item--separator",e.setAttribute("role","separator"),void t.append(e)}const s=document.createElement("button");s.type="button",s.className=["designbase-wc-toolbar__item","designbase-wc-toolbar__item--button",e.active&&"designbase-wc-toolbar__item--active",e.disabled&&"designbase-wc-toolbar__item--disabled"].filter(Boolean).join(" "),s.textContent=e.label||e.id,s.disabled=Boolean(e.disabled),e.tooltip&&(s.title=e.tooltip),s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:e},bubbles:!0,composed:!0}))}),t.append(s)})}}customElements.get("db-toolbar")||customElements.define("db-toolbar",DbToolbar);const dt="designbase-wc-form";class DbForm extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.formEl=null,this.headerEl=null,this.fieldsEl=null,this.actionsEl=null,this.submitBtn=null,this.resetBtn=null,this.values={},this.errors={},this.touched={},this.initialValues={},this.fieldWrappers=new Map,this.boundSubmit=e=>this.handleSubmit(e),this.boundReset=e=>this.handleReset(e)}static get observedAttributes(){return["fields","columns","size","variant","title","description","submit-text","reset-text","show-reset","submit-loading","submit-disabled","initial-values"]}connectedCallback(){this.built||(this.buildShell(),this.built=!0),this.bootstrapValues(),this.syncAll()}attributeChangedCallback(e){this.built&&("initial-values"===e&&this.bootstrapValues(),"fields"===e&&this.bootstrapValues(),this.syncAll())}get fields(){return this.parseFields(this.getAttribute("fields"))}set fields(e){this.setAttribute("fields","string"==typeof e?e:JSON.stringify(e))}parseFields(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}parseInitialValues(){const e=this.getAttribute("initial-values");if(!e)return{};try{const t=JSON.parse(e);return t&&"object"==typeof t?t:{}}catch{return{}}}bootstrapValues(){this.initialValues=this.parseInitialValues();const e={...this.initialValues};this.fields.forEach(t=>{void 0===e[t.name]&&(void 0===t.value?void 0===t.defaultValue?"checkbox"===t.type&&t.checkboxGroup?e[t.name]=[]:"checkbox"!==t.type?e[t.name]="":e[t.name]=!1:e[t.name]=t.defaultValue:e[t.name]=t.value)}),this.values=e}buildShell(){this.formEl=document.createElement("form"),this.formEl.className=`${dt}__native`,this.formEl.noValidate=!0,this.formEl.addEventListener("submit",this.boundSubmit),this.headerEl=document.createElement("div"),this.headerEl.className=`${dt}__header`,this.fieldsEl=document.createElement("div"),this.fieldsEl.className=`${dt}__fields`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${dt}__actions`,this.submitBtn=document.createElement("db-button"),this.submitBtn.setAttribute("type","submit"),this.submitBtn.setAttribute("variant","primary"),this.resetBtn=document.createElement("db-button"),this.resetBtn.setAttribute("type","button"),this.resetBtn.setAttribute("variant","secondary"),this.resetBtn.addEventListener("click",this.boundReset),this.actionsEl.append(this.submitBtn,this.resetBtn),this.formEl.append(this.fieldsEl,this.actionsEl),this.append(this.headerEl,this.formEl)}syncAll(){this.syncClasses(),this.syncHeader(),this.renderFields(),this.syncActions()}syncClasses(){const e=this.getAttribute("columns")||"1",t=this.getAttribute("size")||"m",s=this.getAttribute("variant")||"default";this.className=[dt,`${dt}--columns-${e}`,`${dt}--${t}`,`${dt}--${s}`,this.hasAttribute("submit-loading")&&`${dt}--loading`].filter(Boolean).join(" ")}syncHeader(){if(!this.headerEl)return;const e=this.getAttribute("title")||"",t=this.getAttribute("description")||"";if(this.headerEl.innerHTML="",e||t){if(this.headerEl.hidden=!1,e){const t=document.createElement("h3");t.className=`${dt}__title`,t.textContent=e,this.headerEl.appendChild(t)}if(t){const e=document.createElement("p");e.className=`${dt}__description`,e.textContent=t,this.headerEl.appendChild(e)}}else this.headerEl.hidden=!0}syncActions(){const e=this.getAttribute("submit-text")||"제출",t=this.getAttribute("reset-text")||"리셋",s=this.hasAttribute("show-reset");this.submitBtn&&(this.submitBtn.textContent=e,this.hasAttribute("submit-loading")?this.submitBtn.setAttribute("loading",""):this.submitBtn.removeAttribute("loading"),this.hasAttribute("submit-disabled")?this.submitBtn.setAttribute("disabled",""):this.submitBtn.removeAttribute("disabled")),this.resetBtn&&(this.resetBtn.textContent=t,this.resetBtn.hidden=!s)}renderFields(){if(!this.fieldsEl)return;const e=this.getAttribute("size")||"m";this.fieldsEl.innerHTML="",this.fieldWrappers.clear(),this.fields.forEach(t=>{const s=document.createElement("div");if(s.className=`${dt}__field-wrapper ${dt}__field-wrapper--${t.type||"text"}`,s.dataset.field=t.name,t.label&&("checkbox"!==t.type||t.checkboxGroup)){const e=document.createElement("label");if(e.className=`${dt}__label`,e.htmlFor=`db-form-${t.name}`,e.textContent=t.label,t.required||t.validation?.required){const t=document.createElement("span");t.className=`${dt}__required`,t.textContent="*",t.setAttribute("aria-hidden","true"),e.appendChild(t)}s.appendChild(e)}s.appendChild(this.createFieldControl(t,e)),this.fieldsEl.appendChild(s),this.fieldWrappers.set(t.name,s),this.refreshFieldState(t.name)})}refreshFieldState(e){const t=this.fields.find(t=>t.name===e),s=this.fieldWrappers.get(e);if(!t||!s)return;const i=Boolean(this.touched[e]&&this.errors[e]);s.classList.toggle(`${dt}__field-wrapper--error`,i),s.querySelector(`.${dt}__error`)?.remove(),s.querySelector(`.${dt}__help`)?.remove();const n=s.querySelector(`.${dt}__field, db-input, db-textarea, db-select, db-checkbox`);if(n&&(i?(n.setAttribute("error",""),n.setAttribute("error-message",this.errors[e])):(n.removeAttribute("error"),n.removeAttribute("error-message"))),i){const t=document.createElement("div");return t.className=`${dt}__error`,t.textContent=this.errors[e],void s.appendChild(t)}if(t.helpText){const e=document.createElement("div");e.className=`${dt}__help`,e.textContent=t.helpText,s.appendChild(e)}}refreshAllFieldStates(){this.fields.forEach(e=>this.refreshFieldState(e.name))}createFieldControl(e,t){const s=e.type||"text",i=this.values[e.name],n=Boolean(this.touched[e.name]&&this.errors[e.name]),a=n?this.errors[e.name]:"";if("textarea"===s){const s=document.createElement("db-textarea");return s.className=`${dt}__field`,s.setAttribute("name",e.name),s.id=`db-form-${e.name}`,s.setAttribute("size",t),s.setAttribute("full-width",""),e.placeholder&&s.setAttribute("placeholder",e.placeholder),void 0!==i&&s.setAttribute("value",String(i)),e.disabled&&s.setAttribute("disabled",""),e.readOnly&&s.setAttribute("readonly",""),e.required&&s.setAttribute("required",""),e.maxLength&&s.setAttribute("max-length",String(e.maxLength)),n&&(s.setAttribute("error",""),s.setAttribute("error-message",a)),s.addEventListener("db-change",t=>{const s=t.detail;this.handleFieldChange(e,s.value)}),s.addEventListener("db-input",t=>{const s=t.detail;this.handleFieldChange(e,s.value,!1)}),s}if("select"===s){const s=document.createElement("db-select");return s.className=`${dt}__field`,s.setAttribute("name",e.name),s.id=`db-form-${e.name}`,s.setAttribute("size",t),s.setAttribute("full-width",""),e.placeholder&&s.setAttribute("placeholder",e.placeholder),e.options&&s.setAttribute("options",JSON.stringify(e.options)),e.multiple&&s.setAttribute("multiple",""),e.disabled&&s.setAttribute("disabled",""),e.readOnly&&s.setAttribute("readonly",""),e.required&&s.setAttribute("required",""),void 0!==i&&s.setAttribute("value",Array.isArray(i)?JSON.stringify(i):String(i)),n&&(s.setAttribute("error",""),s.setAttribute("error-message",a)),s.addEventListener("db-change",t=>{const s=t.detail;this.handleFieldChange(e,s.value)}),s}if("radio"===s&&e.radioGroup){const s=document.createElement("div");return s.className=`${dt}__radio-group`,s.setAttribute("role","radiogroup"),(e.options||[]).forEach(n=>{const a=document.createElement("db-radio");a.setAttribute("name",e.name),a.setAttribute("value",n.value),a.setAttribute("size",t),i===n.value&&a.setAttribute("checked",""),(e.disabled||n.disabled)&&a.setAttribute("disabled",""),a.textContent=n.label,a.addEventListener("db-change",t=>{t.detail.checked&&this.handleFieldChange(e,n.value)}),s.appendChild(a)}),s}if("checkbox"===s&&e.checkboxGroup){const s=document.createElement("div");s.className=`${dt}__checkbox-group`;const n=Array.isArray(i)?i:[];return(e.options||[]).forEach(i=>{const a=document.createElement("db-checkbox");a.setAttribute("name",e.name),a.setAttribute("value",i.value),a.setAttribute("size",t),n.includes(i.value)&&a.setAttribute("checked",""),(e.disabled||i.disabled)&&a.setAttribute("disabled",""),a.textContent=i.label,a.addEventListener("db-change",t=>{const s=t.detail,n=Array.isArray(this.values[e.name])?[...this.values[e.name]]:[],a=s.checked?[...new Set([...n,i.value])]:n.filter(e=>e!==i.value);this.handleFieldChange(e,a)}),s.appendChild(a)}),s}if("checkbox"===s){const s=document.createElement("db-checkbox");return s.className=`${dt}__field`,s.setAttribute("name",e.name),s.id=`db-form-${e.name}`,s.setAttribute("size",t),i&&s.setAttribute("checked",""),e.disabled&&s.setAttribute("disabled",""),e.readOnly&&s.setAttribute("readonly",""),e.required&&s.setAttribute("required",""),s.textContent=e.label||"",s.addEventListener("db-change",t=>{const s=t.detail;this.handleFieldChange(e,s.checked)}),s}const r=document.createElement("db-input");return r.className=`${dt}__field`,r.setAttribute("name",e.name),r.id=`db-form-${e.name}`,r.setAttribute("type",s),r.setAttribute("size",t),r.setAttribute("full-width",""),e.placeholder&&r.setAttribute("placeholder",e.placeholder),void 0!==i&&!1!==i&&r.setAttribute("value",String(i)),e.disabled&&r.setAttribute("disabled",""),e.readOnly&&r.setAttribute("readonly",""),e.required&&r.setAttribute("required",""),void 0!==e.min&&r.setAttribute("min",String(e.min)),void 0!==e.max&&r.setAttribute("max",String(e.max)),void 0!==e.minLength&&r.setAttribute("minlength",String(e.minLength)),void 0!==e.maxLength&&r.setAttribute("maxlength",String(e.maxLength)),e.pattern&&r.setAttribute("pattern",e.pattern),n&&(r.setAttribute("error",""),r.setAttribute("error-message",a)),r.addEventListener("db-change",t=>{const s=t.detail;this.handleFieldChange(e,s.value)}),r.addEventListener("db-input",t=>{const s=t.detail;this.handleFieldChange(e,s.value,!1)}),r}handleFieldChange(e,t,s=!0){this.values[e.name]=t,s&&(this.touched[e.name]=!0);const i=this.validateField(e,t);this.errors[e.name]=i||"",this.refreshFieldState(e.name),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}validateField(e,t){const s=e.validation||{};if((s.required??e.required)&&(null==t||""===t||!1===t||Array.isArray(t)&&0===t.length))return e.errorMessage||`${e.label||e.name}은(는) 필수입니다.`;if(void 0!==s.min&&Number(t)<s.min)return e.errorMessage||`최소값은 ${s.min}입니다.`;if(void 0!==s.max&&Number(t)>s.max)return e.errorMessage||`최대값은 ${s.max}입니다.`;if(void 0!==s.minLength&&String(t).length<s.minLength)return e.errorMessage||`최소 ${s.minLength}자 이상 입력해주세요.`;if(void 0!==s.maxLength&&String(t).length>s.maxLength)return e.errorMessage||`최대 ${s.maxLength}자까지 입력 가능합니다.`;const i=s.pattern||e.pattern;if(i&&String(t))try{if(!new RegExp(i).test(String(t)))return e.errorMessage||"올바른 형식으로 입력해주세요."}catch{}}validateForm(){let e=!0;return this.fields.forEach(t=>{const s=this.validateField(t,this.values[t.name]);s?(this.errors[t.name]=s,e=!1):this.errors[t.name]=""}),e}handleSubmit(e){e.preventDefault(),this.fields.forEach(e=>{this.touched[e.name]=!0}),this.validateForm()?this.dispatchEvent(new CustomEvent("db-submit",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})):this.refreshAllFieldStates()}handleReset(e){e.preventDefault(),this.values={...this.initialValues},this.bootstrapValues(),this.errors={},this.touched={},this.renderFields(),this.dispatchEvent(new CustomEvent("db-reset",{bubbles:!0,composed:!0,detail:{values:{...this.values}}})),this.dispatchEvent(new CustomEvent("db-change",{bubbles:!0,composed:!0,detail:{values:{...this.values}}}))}}customElements.get("db-form")||customElements.define("db-form",DbForm);const ct=["default","minimal"],ht=["center","left"];class DbPageHeader extends HTMLElement{constructor(){super(...arguments),this.internalTabId="",this.handleBack=()=>{const e=new CustomEvent("db-back",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||function navigatePageHeaderBack(e="/"){if("undefined"==typeof window)return;const t=window.history.state?.idx;if("number"==typeof t&&t>0)return void window.history.back();(()=>{try{return!!document.referrer&&new URL(document.referrer).origin===window.location.origin}catch{return!1}})()||window.history.length>1?window.history.back():window.location.assign(e)}(this.getAttribute("back-fallback-href")||"/")},this.handleTabChange=e=>{const t=e.detail,s=t?.selectedId??this.parseTabs()[t?.index??0]?.id??String(t?.index??0);this.hasAttribute("selected-tab-id")||(this.internalTabId=s),this.dispatchEvent(new CustomEvent("db-tab-change",{bubbles:!0,composed:!0,detail:{tabId:s}}))}}static get observedAttributes(){return["title","subtitle","description","breadcrumbs","variant","show-back-button","back-fallback-href","back-label","tabs","selected-tab-id","default-selected-tab-id","align"]}connectedCallback(){this.syncDefaultTab(),this.render()}attributeChangedCallback(e){this.isConnected&&("default-selected-tab-id"!==e&&"tabs"!==e||this.syncDefaultTab(),this.render())}syncDefaultTab(){if(this.internalTabId)return;const e=this.parseTabs(),t=this.getAttribute("default-selected-tab-id");this.internalTabId=t||e[0]?.id||""}parseTabs(){try{const e=JSON.parse(this.getAttribute("tabs")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBreadcrumbs(){try{const e=JSON.parse(this.getAttribute("breadcrumbs")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}getActiveTabId(){return this.getAttribute("selected-tab-id")||this.internalTabId}getVariant(){const e=this.getAttribute("variant")||"default";return ct.includes(e)?e:"default"}getAlign(){const e=this.getAttribute("align")||"center";return ht.includes(e)?e:"center"}collectActions(){const e=Array.from(this.querySelectorAll(':scope > [slot="actions"]'));if(e.length)return e;const t=this.querySelector(":scope > .designbase-wc-page-header__cta")||this.querySelector(":scope > .designbase-wc-page-header__actions");return t?Array.from(t.children):[]}collectDescriptionSlot(){const e=this.querySelector(':scope > [slot="description"]');if(e)return e;const t=this.querySelector(":scope .designbase-wc-page-header__description"),s=t?.firstElementChild;return s||null}renderTitleBlock(e){const t=document.createDocumentFragment(),s=this.getAttribute("title")||"",i=this.getAttribute("subtitle"),n=document.createElement("h1");if(n.className="designbase-wc-page-header__title",n.textContent=s,t.append(n),i){const e=document.createElement("h2");e.className="designbase-wc-page-header__subtitle",e.textContent=i,t.append(e)}const a=this.getAttribute("description");if(e||a){const s=document.createElement("div");s.className="designbase-wc-page-header__description",e?s.append(e):s.textContent=a,t.append(s)}return t}render(){const e=this.collectActions(),t=this.collectDescriptionSlot(),s="minimal"===this.getVariant(),i=this.getAlign(),n=this.parseBreadcrumbs(),a=this.parseTabs(),r=a.length>0,o=this.hasAttribute("show-back-button");if(this.className=["designbase-wc-page-header",s?"designbase-wc-page-header--minimal":`designbase-wc-page-header--${i}`].filter(Boolean).join(" "),this.replaceChildren(),n.length){const e=document.createElement("div");e.className="designbase-wc-page-header__breadcrumbs";const t=document.createElement("db-breadcrumbs");t.setAttribute("size","s"),t.setAttribute("items",JSON.stringify(n)),e.append(t),this.append(e)}const l=document.createElement("div");l.className="designbase-wc-page-header__main";const d=document.createElement("div");if(d.className="designbase-wc-page-header__content",s&&o){const e=document.createElement("div");e.className="designbase-wc-page-header__title-row";const s=document.createElement("db-button");s.className="designbase-wc-page-header__back-button",s.setAttribute("variant","tertiary"),s.setAttribute("size","m"),s.setAttribute("icon-only",""),s.setAttribute("start-icon","chevron-left"),s.setAttribute("aria-label",this.getAttribute("back-label")||"뒤로가기"),s.setAttribute("tooltip",this.getAttribute("back-label")||"뒤로가기"),s.addEventListener("db-click",this.handleBack),e.append(s);const i=document.createElement("div");i.className="designbase-wc-page-header__title-group",i.append(this.renderTitleBlock(t)),e.append(i),d.append(e)}else d.append(this.renderTitleBlock(t));if(l.append(d),s&&e.length){const t=document.createElement("div");t.className="designbase-wc-page-header__cta",e.forEach(e=>t.append(e)),l.append(t)}if(this.append(l),!s&&e.length){const t=document.createElement("div");t.className="designbase-wc-page-header__actions",e.forEach(e=>t.append(e)),this.append(t)}this.renderMinimalTabs(s,r,a)}renderMinimalTabs(e,t,s){if(!e||!t)return;const i=document.createElement("div");i.className="designbase-wc-page-header__toolbar";const n=document.createElement("div");n.className="designbase-wc-page-header__tabs";const a=document.createElement("db-tabs");a.setAttribute("size","m"),a.setAttribute("items",JSON.stringify(s)),a.setAttribute("selected-id",this.getActiveTabId()),a.addEventListener("db-change",this.handleTabChange),n.append(a),i.append(n),this.append(i)}}customElements.get("db-page-header")||customElements.define("db-page-header",DbPageHeader);const ut=["s","m","l","xl"];class DbSection extends HTMLElement{constructor(){super(...arguments),this.contentId=`db-section-${Math.random().toString(36).slice(2,9)}`,this.internalExpanded=!0,this.internalTabId="",this.handleToggle=()=>{if(!this.isCollapsible())return;const e=!this.isExpanded();this.hasAttribute("expanded")||(this.internalExpanded=e),this.dispatchEvent(new CustomEvent("db-expanded-change",{bubbles:!0,composed:!0,detail:{expanded:e}})),this.hasAttribute("expanded")||(this.syncHostClasses(),this.syncCollapsibleState())},this.handleTabChange=e=>{const t=e.detail,s=t?.id??this.parseTabs()[t?.index??0]?.id??String(t?.index??0);this.internalTabId=s,this.tabsEl?.setAttribute("selected-id",s),this.dispatchEvent(new CustomEvent("db-tab-change",{bubbles:!0,composed:!0,detail:{tabId:s}}))}}static get observedAttributes(){return["title","subtitle","description","size","collapsible","default-expanded","expanded","no-padding","full-width","full-height","overflow-visible","tabs","selected-tab-id","default-selected-tab-id"]}connectedCallback(){this.internalExpanded="false"!==this.getAttribute("default-expanded"),this.syncDefaultTab(),this.ensureStructure(),this.sync(),this.observer=new MutationObserver(()=>this.sync()),this.observer.observe(this,{childList:!0})}disconnectedCallback(){this.observer?.disconnect()}attributeChangedCallback(e){if(this.isConnected){if("default-expanded"!==e||this.hasAttribute("expanded")||(this.internalExpanded="false"!==this.getAttribute("default-expanded")),"default-selected-tab-id"!==e&&"tabs"!==e||this.syncDefaultTab(),"selected-tab-id"===e){const e=this.getAttribute("selected-tab-id");e&&(this.internalTabId=e)}this.sync()}}syncDefaultTab(){if(this.internalTabId)return;const e=this.parseTabs(),t=this.getAttribute("default-selected-tab-id")||"";this.internalTabId=t||e[0]?.id||""}parseTabs(){try{const e=JSON.parse(this.getAttribute("tabs")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}getActiveTabId(){const e=this.getAttribute("selected-tab-id");return e&&this.internalTabId&&e!==this.internalTabId?this.internalTabId:e||this.internalTabId||this.tabsEl?.getAttribute("selected-id")||""}hasHeaderTabs(){return this.parseTabs().length>0&&!this.isCollapsible()}isCollapsible(){return this.hasAttribute("collapsible")}isExpanded(){return!this.isCollapsible()||(this.hasAttribute("expanded")?"false"!==this.getAttribute("expanded"):this.internalExpanded)}isUserNode(e){return!e.hasAttribute("data-wc-internal")}collectSlotted(e){const t=Array.from(this.querySelectorAll(`:scope > [slot="${e}"]`)).filter(this.isUserNode);if(t.length)return t;if("actions"===e&&this.actionsHostEl)return Array.from(this.actionsHostEl.children);if("footer"===e&&this.footerEl)return Array.from(this.footerEl.children);if("header"===e){const e=this.headerEl?.querySelector(".designbase-wc-section__header-main");return e?Array.from(e.children):[]}if("description"===e){const e=this.headerEl?.querySelector(".designbase-wc-section__description"),t=e?.firstElementChild;return t?[t]:[]}return[]}collectContentNodes(){const e=Array.from(this.children).filter(e=>{if(!this.isUserNode(e))return!1;const t=e.getAttribute("slot");return!t||"default"===t});return e.length?e:this.contentEl?Array.from(this.contentEl.children):[]}ensureStructure(){this.headerEl||(this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section__header",this.headerEl.setAttribute("data-wc-internal","")),this.bodyEl||(this.bodyEl=document.createElement("div"),this.bodyEl.className="designbase-wc-section__body",this.bodyEl.id=this.contentId,this.bodyEl.setAttribute("data-wc-internal",""),this.bodyInnerEl=document.createElement("div"),this.bodyInnerEl.className="designbase-wc-section__body-inner",this.bodyInnerEl.setAttribute("data-wc-internal",""),this.bodyEl.append(this.bodyInnerEl)),this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-section__content",this.contentEl.setAttribute("data-wc-internal","")),this.footerEl||(this.footerEl=document.createElement("div"),this.footerEl.className="designbase-wc-section__footer",this.footerEl.setAttribute("data-wc-internal","")),this.headerEl.isConnected||this.append(this.headerEl)}mountBody(){const e=this.collectContentNodes(),t=this.collectSlotted("footer");if(this.contentEl.replaceChildren(...e),this.footerEl.replaceChildren(...t),this.footerEl.hidden=0===t.length,this.isCollapsible())return this.bodyInnerEl.replaceChildren(this.contentEl,this.footerEl),void(this.bodyEl.isConnected||this.append(this.bodyEl));this.bodyEl?.remove(),this.contentEl.isConnected||this.append(this.contentEl),t.length?this.footerEl.isConnected||this.append(this.footerEl):this.footerEl.remove()}getChevronSize(){const e=this.getAttribute("size")||"m";return"s"===e?16:"l"===e||"xl"===e?24:20}createTitleArea(){const e=this.getAttribute("title"),t=this.getAttribute("subtitle"),s=this.getAttribute("description"),i=this.collectSlotted("description")[0];if(!(e||t||s||i))return null;const n=document.createElement("div");if(n.className="designbase-wc-section__title-area",e){const t=document.createElement("h2");t.className="designbase-wc-section__title",t.textContent=e,n.append(t)}if(t){const e=document.createElement("h3");e.className="designbase-wc-section__subtitle",e.textContent=t,n.append(e)}if(i){const e=document.createElement("p");e.className="designbase-wc-section__description",e.append(i),n.append(e)}else if(s){const e=document.createElement("p");e.className="designbase-wc-section__description",e.textContent=s,n.append(e)}return n}createChevron(){const e=document.createElement("span");return e.className="designbase-wc-section__chevron",e.setAttribute("aria-hidden","true"),e.append(createDbIcon("chevron-down",this.getChevronSize())),e}renderHeader(){if(!this.headerEl)return;const e=this.collectSlotted("header")[0],t=this.collectSlotted("actions"),s=this.createTitleArea(),i=this.hasHeaderTabs(),n=Boolean(e||s||t.length);if(this.headerEl.replaceChildren(),this.headerEl.hidden=!n&&!i,this.headerEl.classList.toggle("designbase-wc-section__header--with-tabs",i),!n&&!i)return;if(this.isCollapsible()){if(e){const t=document.createElement("button");t.type="button",t.className="designbase-wc-section__header-trigger",t.setAttribute("aria-expanded",String(this.isExpanded())),t.setAttribute("aria-controls",this.contentId),t.addEventListener("click",this.handleToggle);const s=document.createElement("div");s.className="designbase-wc-section__header-main",s.append(e),t.append(s,this.createChevron()),this.headerEl.append(t)}else{const e=document.createElement("button");e.type="button",e.className="designbase-wc-section__header-trigger",e.setAttribute("aria-expanded",String(this.isExpanded())),e.setAttribute("aria-controls",this.contentId),e.addEventListener("click",this.handleToggle),s&&e.append(s),e.append(this.createChevron()),this.headerEl.append(e),t.length&&(this.actionsHostEl=document.createElement("div"),this.actionsHostEl.className="designbase-wc-section__actions",this.actionsHostEl.addEventListener("click",e=>e.stopPropagation()),t.forEach(e=>this.actionsHostEl.append(e)),this.headerEl.append(this.actionsHostEl))}return}const appendHeaderMain=i=>{e?i.append(e):(s&&i.append(s),t.length&&(this.actionsHostEl=document.createElement("div"),this.actionsHostEl.className="designbase-wc-section__actions",t.forEach(e=>this.actionsHostEl.append(e)),i.append(this.actionsHostEl)))};if(i){const e=document.createElement("div");e.className="designbase-wc-section__header-row",appendHeaderMain(e),this.headerEl.append(e);const t=document.createElement("div");return t.className="designbase-wc-section__header-tabs",this.tabsEl||(this.tabsEl=document.createElement("db-tabs"),this.tabsEl.setAttribute("size","m"),this.tabsEl.addEventListener("db-change",this.handleTabChange)),this.tabsEl.setAttribute("items",JSON.stringify(this.parseTabs())),this.tabsEl.setAttribute("selected-id",this.getActiveTabId()),t.append(this.tabsEl),void this.headerEl.append(t)}appendHeaderMain(this.headerEl)}syncHostClasses(){const e=this.getAttribute("size")||"m",t=ut.includes(e)?e:"m",s=this.isExpanded();this.className=["designbase-wc-section",`designbase-wc-section--size-${t}`,this.hasAttribute("no-padding")&&"designbase-wc-section--no-padding",this.hasHeaderTabs()&&"designbase-wc-section--has-header-tabs",this.hasAttribute("full-width")&&"designbase-wc-section--full-width",this.hasAttribute("full-height")&&"designbase-wc-section--full-height",this.hasAttribute("overflow-visible")&&"designbase-wc-section--overflow-visible",this.isCollapsible()&&"designbase-wc-section--collapsible",this.isCollapsible()&&s&&"designbase-wc-section--expanded",this.isCollapsible()&&!s&&"designbase-wc-section--collapsed"].filter(Boolean).join(" ")}syncCollapsibleState(){if(!this.isCollapsible()||!this.bodyEl)return;const e=this.isExpanded();this.bodyEl.setAttribute("aria-hidden",String(!e));const t=this.headerEl?.querySelector(".designbase-wc-section__header-trigger");t?.setAttribute("aria-expanded",String(e))}sync(){this.ensureStructure(),this.syncHostClasses(),this.renderHeader(),this.mountBody(),this.syncCollapsibleState()}}customElements.get("db-section")||customElements.define("db-section",DbSection);const bt=["s","m","l"],mt=["primary","secondary","tertiary"],pt={s:12,m:16,l:20},gt={s:"xs",m:"s",l:"m"};class DbFloatingActionButton extends HTMLElement{constructor(){super(...arguments),this.handleClick=e=>{if(this.disabled||this.loading)return e.preventDefault(),void e.stopPropagation();this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))}}static get observedAttributes(){return["size","variant","icon","loading","disabled","aria-label"]}get size(){const e=this.getAttribute("size")||"m";return bt.includes(e)?e:"m"}set size(e){this.setAttribute("size",e)}get variant(){const e=this.getAttribute("variant")||"primary";return mt.includes(e)?e:"primary"}set variant(e){this.setAttribute("variant",e)}get loading(){return this.hasAttribute("loading")}set loading(e){this.toggleAttribute("loading",Boolean(e))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",Boolean(e))}connectedCallback(){"button"!==this.getAttribute("role")&&this.setAttribute("role","button"),this.hasAttribute("type")||this.setAttribute("type","button"),this.addEventListener("click",this.handleClick),this.sync()}disconnectedCallback(){this.removeEventListener("click",this.handleClick)}attributeChangedCallback(){this.isConnected&&this.sync()}resolveIconName(e){if(!e)return;return e in{plus:1,search:1,settings:1,edit:1,close:1}?e:void 0}sync(){this.className=["designbase-wc-fab",`designbase-wc-fab--${this.size}`,`designbase-wc-fab--${this.variant}`,this.disabled&&"designbase-wc-fab--disabled",this.loading&&"designbase-wc-fab--loading"].filter(Boolean).join(" ");const e=this.getAttribute("aria-label")||"Floating action button";this.getAttribute("aria-label")!==e&&this.setAttribute("aria-label",e);const t=String(this.loading);this.getAttribute("aria-busy")!==t&&this.setAttribute("aria-busy",t);const s=String(this.disabled||this.loading);this.getAttribute("aria-disabled")!==s&&this.setAttribute("aria-disabled",s);let i=this.querySelector(":scope > .designbase-wc-fab__icon");if(i||(i=document.createElement("div"),i.className="designbase-wc-fab__icon",this.append(i)),i.replaceChildren(),this.loading){const e=document.createElement("span");return e.className=`designbase-wc-spinner designbase-wc-spinner--circular designbase-wc-spinner--${gt[this.size]}`,e.setAttribute("aria-hidden","true"),e.innerHTML='<svg class="designbase-wc-spinner__circular" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle class="designbase-wc-spinner__circular-track" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"></circle><circle class="designbase-wc-spinner__circular-indicator" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"></circle></svg>',void i.append(e)}const n=this.getAttribute("icon"),a=this.resolveIconName(n);if(a)return void i.append(createDbIcon(a,pt[this.size]));const r=Array.from(this.children).find(e=>e!==i&&!e.hasAttribute("data-wc-internal"));r&&!r.isConnected&&i.append(r)}}customElements.get("db-floating-action-button")||customElements.define("db-floating-action-button",DbFloatingActionButton);const vt={s:40,m:60,l:80,full:100},Et=["default","persistent","temporary","fullscreen"],ft=["slide","fade","scale","none"];function resolveHeightPercent(e){if(!e)return vt.m;const t=vt[e];if(t)return Math.min(100,Math.max(20,t));const s=Number(e);return Number.isFinite(s)?Math.min(100,Math.max(20,s)):vt.m}class DbBottomSheet extends HTMLElement{constructor(){super(...arguments),this.sheetHeightPercent=vt.m,this.isDragging=!1,this.isVisible=!1,this.isMounted=!1,this.keyHandler=null,this.dragState={active:!1,pointerId:-1,startY:0,startHeight:vt.m,lastY:0,lastTime:0},this.handlePointerDown=e=>{"true"!==this.getAttribute("disable-drag")&&0===e.button&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),this.dragState={active:!0,pointerId:e.pointerId,startY:e.clientY,startHeight:this.sheetHeightPercent,lastY:e.clientY,lastTime:Date.now()},this.isDragging=!0,this.syncActiveClasses())},this.handlePointerMove=e=>{const t=this.dragState;if(!t.active||e.pointerId!==t.pointerId)return;e.preventDefault(),t.lastY=e.clientY,t.lastTime=Date.now();const s=window.innerHeight||1,i=(t.startY-e.clientY)/s*100,n=this.getMaxHeightLimit(resolveHeightPercent(this.getAttribute("height")));this.sheetHeightPercent=Math.min(n,Math.max(20,t.startHeight+i)),this.applySheetDimensions()},this.handlePointerUp=e=>{const t=this.dragState;if(!t.active||e.pointerId!==t.pointerId)return;const s=e.currentTarget;s.hasPointerCapture(e.pointerId)&&s.releasePointerCapture(e.pointerId),this.finishDrag()}}static get observedAttributes(){return["open","title","subtitle","height","max-height","variant","disable-backdrop-click","disable-escape-key-down","disable-drag","show-close-button","animation","animation-duration","z-index","show-backdrop","backdrop-blur","backdrop-opacity","sticky-header","sticky-footer"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}shouldMountPortal(){return this.isOpenRequested()||this.isMounted}connectedCallback(){this.style.display="contents",this.childObserver=new MutationObserver(()=>{this.isOpenRequested()&&this.render()}),this.childObserver.observe(this,{childList:!0}),this.syncOpenState()}disconnectedCallback(){this.childObserver?.disconnect(),this.childObserver=void 0,this.clearTimers(),this.detachEscape(),this.root?.remove(),this.root=void 0,document.body.style.overflow=""}attributeChangedCallback(e){this.isConnected&&("open"!==e?("height"===e&&this.isOpenRequested()&&(this.sheetHeightPercent=resolveHeightPercent(this.getAttribute("height"))),this.shouldMountPortal()&&(this.render(),this.isMounted&&this.syncActiveClasses())):this.syncOpenState())}isOpenRequested(){return this.open}clearTimers(){this.enterFrame&&(cancelAnimationFrame(this.enterFrame),this.enterFrame=void 0),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=void 0)}scheduleEnterAnimation(){this.enterFrame&&cancelAnimationFrame(this.enterFrame),this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=requestAnimationFrame(()=>{this.enterFrame=void 0,this.isOpenRequested()&&this.sheet&&(this.sheet.offsetHeight,this.isVisible=!0,this.syncActiveClasses())})})}getMaxHeightLimit(e){const t=Number(this.getAttribute("max-height")||0),s=e>=100;return Math.min(100,Math.max(e,t||(s?100:90)))}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}attachEscape(){this.keyHandler||(this.keyHandler=e=>{"Escape"===e.key&&"true"!==this.getAttribute("disable-escape-key-down")&&this.close()},document.addEventListener("keydown",this.keyHandler))}detachEscape(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}collectSlotted(e){const t=Array.from(this.querySelectorAll(`:scope > [slot="${e}"]`));if(t.length)return t;if("header"===e){const e=this.sheet?.querySelector(".designbase-wc-bottom-sheet__header-main");return e?Array.from(e.children):[]}if("footer"===e){const e=this.sheet?.querySelector(".designbase-wc-bottom-sheet__footer");return e?Array.from(e.children):[]}return[]}collectContentNodes(){const e=Array.from(this.children).filter(e=>{const t=e.getAttribute("slot");return!t||"default"===t});return e.length?e:this.contentEl?Array.from(this.contentEl.children):[]}finishDrag(){const e=this.dragState;if(!e.active)return;e.active=!1,this.isDragging=!1;const t=e.lastY-e.startY,s=t/Math.max(1,Date.now()-e.lastTime),i=window.innerHeight||1,n=(e.startY-e.lastY)/i*100,a=this.getMaxHeightLimit(resolveHeightPercent(this.getAttribute("height"))),r=Math.min(a,Math.max(20,e.startHeight+n));r<=22||t>72||s>.6?this.close():(this.sheetHeightPercent=r,this.applySheetDimensions(),this.syncActiveClasses())}syncOpenState(){const e=this.isOpenRequested(),t=Number(this.getAttribute("animation-duration")||400);if(this.clearTimers(),e)return this.sheetHeightPercent=resolveHeightPercent(this.getAttribute("height")),this.render(),this.isMounted=!0,this.isVisible=!1,this.syncActiveClasses(),this.root&&!this.root.isConnected&&document.body.append(this.root),this.scheduleEnterAnimation(),document.body.style.overflow="hidden",void this.attachEscape();this.isVisible=!1,this.syncActiveClasses(),this.exitTimer=setTimeout(()=>{this.exitTimer=void 0,this.detachContentToHost(),this.isMounted=!1,this.syncActiveClasses(),this.root?.remove(),document.body.style.overflow="",this.detachEscape()},t),this.detachEscape()}syncActiveClasses(){if(!this.sheet)return;const e=resolveHeightPercent(this.getAttribute("height")),t=this.getAttribute("variant")||"default",s=this.getAttribute("animation")||"slide",i=Et.includes(t)?t:"default",n=ft.includes(s)?s:"slide",a="false"!==this.getAttribute("show-backdrop"),r=this.hasAttribute("sticky-header"),o=this.hasAttribute("sticky-footer");this.sheet.className=["designbase-wc-bottom-sheet",`designbase-wc-bottom-sheet--${i}`,`designbase-wc-bottom-sheet--${n}`,this.isMounted&&this.isVisible&&"designbase-wc-bottom-sheet--open",this.isDragging&&"designbase-wc-bottom-sheet--dragging",r&&"designbase-wc-bottom-sheet--sticky-header",o&&"designbase-wc-bottom-sheet--sticky-footer",!a&&"designbase-wc-bottom-sheet--no-backdrop",(e>=100||this.sheetHeightPercent>=100)&&"designbase-wc-bottom-sheet--full"].filter(Boolean).join(" "),this.backdrop?.classList.toggle("designbase-wc-backdrop--open",this.isMounted&&this.isVisible)}applySheetDimensions(){if(!this.sheet)return;const e=this.getMaxHeightLimit(resolveHeightPercent(this.getAttribute("height")));this.sheet.style.height=`${this.sheetHeightPercent}vh`,this.sheet.style.maxHeight=`${e}vh`}detachContentToHost(){this.contentEl&&Array.from(this.contentEl.children).forEach(e=>this.append(e));const e=this.sheet?.querySelector(".designbase-wc-bottom-sheet__header-main");e&&Array.from(e.children).forEach(e=>{"bottom-sheet-title"!==e.id&&"bottom-sheet-subtitle"!==e.id&&this.append(e)});const t=this.sheet?.querySelector(".designbase-wc-bottom-sheet__footer");t&&Array.from(t.children).forEach(e=>this.append(e))}render(){if(!this.shouldMountPortal())return;const e=this.getAttribute("title"),t=this.getAttribute("subtitle"),s="false"!==this.getAttribute("show-close-button"),i="false"!==this.getAttribute("show-backdrop"),n=this.hasAttribute("backdrop-blur"),a=this.getAttribute("backdrop-opacity")||"0.5",r=this.getAttribute("animation-duration")||"400",o=this.getAttribute("z-index")||"1000",l=this.hasAttribute("sticky-header"),d=this.hasAttribute("sticky-footer"),u=this.collectSlotted("header"),b=this.collectSlotted("footer"),m=this.collectContentNodes();if(this.root||(this.root=document.createElement("div"),this.root.setAttribute("data-wc-internal",""),this.backdrop=document.createElement("div"),this.backdrop.className="designbase-wc-backdrop designbase-wc-backdrop--bottom-sheet",this.backdrop.setAttribute("role","presentation"),this.backdrop.addEventListener("click",e=>{e.target===this.backdrop&&"true"!==this.getAttribute("disable-backdrop-click")&&this.close()}),this.sheet=document.createElement("div"),this.sheet.setAttribute("role","dialog"),this.sheet.setAttribute("aria-modal","true"),this.grabBar=document.createElement("div"),this.grabBar.className="designbase-wc-bottom-sheet__grab-bar",this.grabBar.addEventListener("pointerdown",this.handlePointerDown),this.grabBar.addEventListener("pointermove",this.handlePointerMove),this.grabBar.addEventListener("pointerup",this.handlePointerUp),this.grabBar.addEventListener("pointercancel",this.handlePointerUp),this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-bottom-sheet__content"),this.root.replaceChildren(),i&&this.backdrop&&(this.backdrop.className=["designbase-wc-backdrop","designbase-wc-backdrop--bottom-sheet",n&&"designbase-wc-backdrop--blur"].filter(Boolean).join(" "),this.backdrop.style.setProperty("--backdrop-opacity",a),this.backdrop.style.setProperty("--bottom-sheet-animation-duration",`${r}ms`),this.backdrop.style.zIndex=o,this.backdrop.setAttribute("aria-hidden",String(!this.isOpenRequested())),this.root.append(this.backdrop)),!this.sheet||!this.grabBar||!this.contentEl)return;this.sheet.style.zIndex=String(Number(o)+1),this.sheet.style.setProperty("--bottom-sheet-animation-duration",`${r}ms`),this.applySheetDimensions(),e?this.sheet.setAttribute("aria-labelledby","bottom-sheet-title"):this.sheet.removeAttribute("aria-labelledby"),t?this.sheet.setAttribute("aria-describedby","bottom-sheet-subtitle"):this.sheet.removeAttribute("aria-describedby"),this.sheet.replaceChildren();const p="true"===this.getAttribute("disable-drag");if(this.grabBar.className=["designbase-wc-bottom-sheet__grab-bar",!p&&"designbase-wc-bottom-sheet__grab-bar--draggable"].filter(Boolean).join(" "),this.grabBar.replaceChildren(),!p){const e=document.createElement("div");e.className="designbase-wc-bottom-sheet__handle",e.setAttribute("aria-hidden","true"),this.grabBar.append(e)}this.sheet.append(this.grabBar);if(Boolean(e||t||u.length||s)){const i=document.createElement("div");i.className=["designbase-wc-bottom-sheet__header",l&&"designbase-wc-bottom-sheet__header--sticky"].filter(Boolean).join(" ");const n=document.createElement("div");if(n.className="designbase-wc-bottom-sheet__header-main",u.length)u.forEach(e=>n.append(e));else{if(e){const t=document.createElement("h2");t.id="bottom-sheet-title",t.className="designbase-wc-bottom-sheet__title",t.textContent=e,n.append(t)}if(t){const e=document.createElement("p");e.id="bottom-sheet-subtitle",e.className="designbase-wc-bottom-sheet__subtitle",e.textContent=t,n.append(e)}}if(i.append(n),s){const e=document.createElement("button");e.type="button",e.className="designbase-wc-bottom-sheet__close-button",e.setAttribute("aria-label","닫기"),e.append(createDbIcon("close",20)),e.addEventListener("click",()=>this.close()),i.append(e)}this.sheet.append(i)}if(this.contentEl.replaceChildren(...m),this.sheet.append(this.contentEl),b.length){const e=document.createElement("div");e.className=["designbase-wc-bottom-sheet__footer",d&&"designbase-wc-bottom-sheet__footer--sticky"].filter(Boolean).join(" "),b.forEach(t=>e.append(t)),this.sheet.append(e)}this.root.append(this.sheet),this.isMounted&&!this.root.isConnected&&document.body.append(this.root),this.syncActiveClasses()}}customElements.get("db-bottom-sheet")||customElements.define("db-bottom-sheet",DbBottomSheet);const wt=["vertical","horizontal","both"],yt=["auto","thin","none"];class DbScrollArea extends HTMLElement{static get observedAttributes(){return["direction","scrollbar-style","max-height","max-width","min-height","min-width","full-width","full-height","always-show-scrollbar","scrollbar-color","scrollbar-track-color"]}connectedCallback(){this.ensureStructure(),this.sync(),this.resizeObserver=new ResizeObserver(()=>{this.syncViewportSize(),this.syncScrollState()}),this.resizeObserver.observe(this),this.contentEl&&this.resizeObserver.observe(this.contentEl),this.observer=new MutationObserver(()=>this.syncChildren()),this.observer.observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){this.resizeObserver?.disconnect(),this.observer?.disconnect()}attributeChangedCallback(){this.isConnected&&this.sync()}ensureStructure(){this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-scroll-area__content",this.contentEl.setAttribute("data-wc-internal","")),this.contentEl.isConnected||this.append(this.contentEl)}collectContentNodes(){return Array.from(this.children).filter(e=>e!==this.contentEl&&!e.hasAttribute("data-wc-internal"))}syncChildren(){const e=this.collectContentNodes();e.length&&this.contentEl?.append(...e),this.syncScrollState()}toCssSize(e){if(!e)return;if(e.includes("px")||e.includes("%")||e.includes("vh")||e.includes("rem"))return e;const t=Number(e);return Number.isFinite(t)?`${t}px`:e}syncScrollState(){const e=this.contentEl;if(!e)return;const t=e.scrollHeight>e.clientHeight,s=e.scrollWidth>e.clientWidth;this.classList.toggle("designbase-wc-scroll-area--has-vertical",t),this.classList.toggle("designbase-wc-scroll-area--has-horizontal",s)}syncViewportSize(){if(!this.contentEl)return;const e=this.toCssSize(this.getAttribute("max-height"))||this.style.maxHeight||void 0,t=this.toCssSize(this.getAttribute("max-width"))||this.style.maxWidth||void 0,s=this.toCssSize(this.getAttribute("min-height"))||this.style.minHeight||void 0,i=this.toCssSize(this.getAttribute("min-width"))||this.style.minWidth||void 0;this.contentEl.style.maxHeight=e||"",this.contentEl.style.maxWidth=t||"",this.contentEl.style.minHeight=s||"",this.contentEl.style.minWidth=i||""}sync(){this.ensureStructure();const e=this.getAttribute("direction")||"vertical",t=this.getAttribute("scrollbar-style")||"auto",s=wt.includes(e)?e:"vertical",i=yt.includes(t)?t:"auto";this.className=["designbase-wc-scroll-area",`designbase-wc-scroll-area--direction-${s}`,`designbase-wc-scroll-area--scrollbar-${i}`,this.hasAttribute("full-width")&&"designbase-wc-scroll-area--full-width",this.hasAttribute("full-height")&&"designbase-wc-scroll-area--full-height",this.hasAttribute("always-show-scrollbar")&&"designbase-wc-scroll-area--always-show"].filter(Boolean).join(" ");const n=this.getAttribute("scrollbar-color"),a=this.getAttribute("scrollbar-track-color");n?this.style.setProperty("--scrollbar-color",n):this.style.removeProperty("--scrollbar-color"),a?this.style.setProperty("--scrollbar-track-color",a):this.style.removeProperty("--scrollbar-track-color"),this.syncViewportSize(),this.syncChildren()}}customElements.get("db-scroll-area")||customElements.define("db-scroll-area",DbScrollArea);const At=["s","m","l"],_t=["default","outlined","filled"];class DbDropzone extends HTMLElement{constructor(){super(...arguments),this.internalDragOver=!1,this.handleFileInputChange=()=>{this.emitFiles(this.fileInput?.files??null),this.fileInput&&(this.fileInput.value="")},this.handleDragOver=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||(this.internalDragOver=!0,this.syncClasses(),this.dispatchEvent(new CustomEvent("db-drag-over",{bubbles:!0,composed:!0,detail:{event:e}})))},this.handleDragLeave=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||(this.internalDragOver=!1,this.syncClasses(),this.dispatchEvent(new CustomEvent("db-drag-leave",{bubbles:!0,composed:!0,detail:{event:e}})))},this.handleDrop=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||(this.internalDragOver=!1,this.syncClasses(),this.emitFiles(e.dataTransfer?.files??null),this.dispatchEvent(new CustomEvent("db-drop",{bubbles:!0,composed:!0,detail:{event:e}})))},this.handleClick=e=>{this.isDisabled()||e.target.closest(".designbase-wc-dropzone__button")||(this.fileInput?.click(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0,detail:{event:e}})))}}static get observedAttributes(){return["size","variant","show-icon","icon","image","title","description","button-text","show-button","accept","max-size","multiple","drag-over","disabled","readonly"]}connectedCallback(){this.ensureInput(),this.sync(),this.addEventListener("dragover",this.handleDragOver),this.addEventListener("dragleave",this.handleDragLeave),this.addEventListener("drop",this.handleDrop),this.addEventListener("click",this.handleClick)}disconnectedCallback(){this.removeEventListener("dragover",this.handleDragOver),this.removeEventListener("dragleave",this.handleDragLeave),this.removeEventListener("drop",this.handleDrop),this.removeEventListener("click",this.handleClick)}attributeChangedCallback(){this.isConnected&&this.sync()}ensureInput(){this.fileInput||(this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.style.display="none",this.fileInput.setAttribute("data-wc-internal",""),this.fileInput.addEventListener("change",this.handleFileInputChange),this.append(this.fileInput))}isDisabled(){return this.hasAttribute("disabled")||this.hasAttribute("readonly")}isDragOver(){return this.hasAttribute("drag-over")?"false"!==this.getAttribute("drag-over"):this.internalDragOver}validateFile(e){const t=this.getAttribute("accept");if(t){const s=t.split(",").map(e=>e.trim()),i=e.type,n=`.${e.name.split(".").pop()?.toLowerCase()}`;if(!s.some(e=>e.startsWith(".")?n===e.toLowerCase():i===e||i.startsWith(e.replace("*",""))))return!1}const s=Number(this.getAttribute("max-size")||0);return!(s>0&&e.size>s)}emitFiles(e){if(!e||0===e.length)return;const t=Array.from(e).filter(e=>this.validateFile(e));t.length&&this.dispatchEvent(new CustomEvent("db-file-select",{bubbles:!0,composed:!0,detail:{files:t}}))}getDescriptionText(){const e=this.getAttribute("description");if(e)return e;const t=this.getAttribute("accept");if(!t)return"모든 파일 형식 지원";let s=t.split(",").map(e=>{const t=e.trim();return t.startsWith(".")?t.toUpperCase():t.includes("*")?t.replace("*","").toUpperCase():t}).join(", ");const i=Number(this.getAttribute("max-size")||0);if(i>0){const e=1024,t=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(i)/Math.log(e));s+=` (최대 ${`${parseFloat((i/e**n).toFixed(2))} ${t[n]}`})`}return s}collectChildren(){return Array.from(this.children).filter(e=>e!==this.fileInput&&!e.hasAttribute("data-wc-internal"))}syncClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=At.includes(e)?e:"m",i=_t.includes(t)?t:"default";this.className=["designbase-wc-dropzone",`designbase-wc-dropzone--size-${s}`,`designbase-wc-dropzone--variant-${i}`,this.isDragOver()&&"designbase-wc-dropzone--drag-over",this.hasAttribute("disabled")&&"designbase-wc-dropzone--disabled",this.hasAttribute("readonly")&&"designbase-wc-dropzone--readonly"].filter(Boolean).join(" ")}sync(){this.ensureInput(),this.syncClasses();const e=this.getAttribute("accept"),t=this.hasAttribute("multiple");this.fileInput&&(e?this.fileInput.setAttribute("accept",e):this.fileInput.removeAttribute("accept"),this.fileInput.toggleAttribute("multiple",t),this.fileInput.disabled=this.isDisabled());const s=this.collectChildren(),i=this.querySelector(":scope > .designbase-wc-dropzone__content[data-wc-internal]");if(s.length)return void i?.remove();let n=i;n||(n=document.createElement("div"),n.className="designbase-wc-dropzone__content",n.setAttribute("data-wc-internal",""),this.append(n)),n.replaceChildren();const a=this.getAttribute("size")||"m",r=At.includes(a)?a:"m",o=this.getAttribute("image"),l="false"!==this.getAttribute("show-icon"),d=this.getAttribute("icon")||"gallery",u=this.getAttribute("title")||"파일을 드래그하여 업로드하거나 클릭하여 선택하세요",b=this.getDescriptionText(),m=this.hasAttribute("show-button"),p=this.getAttribute("button-text")||"파일 선택";if(o){const e=document.createElement("div");e.className="designbase-wc-dropzone__image";const t=document.createElement("img");t.src=o,t.alt="Upload illustration",e.append(t),n.append(e)}else if(l){const e=document.createElement("div");e.className="designbase-wc-dropzone__icon";const t="s"===r?32:"l"===r?56:48;e.append(createDbIcon(d,t)),n.append(e)}if(u){const e=document.createElement("div");e.className="designbase-wc-dropzone__title",e.textContent=u,n.append(e)}if(b){const e=document.createElement("div");e.className="designbase-wc-dropzone__description",e.textContent=b,n.append(e)}if(m){const e=document.createElement("button");e.type="button",e.className="designbase-wc-dropzone__button",e.textContent=p,e.disabled=this.isDisabled(),e.addEventListener("click",e=>{e.stopPropagation(),this.isDisabled()||this.fileInput?.click()}),n.append(e)}}}customElements.get("db-dropzone")||customElements.define("db-dropzone",DbDropzone);class DbOnboardingModal extends HTMLElement{constructor(){super(...arguments),this.internalStep=0,this.keyHandler=null,this.isMounted=!1,this.handlePrev=()=>{this.getCurrentStep()>0&&this.goToStep(this.getCurrentStep()-1)},this.handleNext=()=>{const e=this.getSteps(),t=this.getCurrentStep();t>=e.length-1?this.dispatchEvent(new CustomEvent("db-complete",{bubbles:!0,composed:!0})):this.goToStep(t+1)}}static get observedAttributes(){return["open","steps","current-step","show-close-button","show-indicator","indicator-type","indicator-size"]}get open(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get steps(){return this.parseSteps()}set steps(e){const t="string"==typeof e?e:JSON.stringify(e);this.getAttribute("steps")!==t&&this.setAttribute("steps",t)}connectedCallback(){this.style.display="contents",this.syncStepFromAttribute(),this.syncOpenState()}disconnectedCallback(){this.detachKeyHandler(),this.unmount()}attributeChangedCallback(e){this.isConnected&&("open"!==e?("current-step"===e&&this.syncStepFromAttribute(),"steps"!==e?this.isMounted&&this.render():this.isOpenRequested()&&(this.isMounted?this.render():this.syncOpenState())):this.syncOpenState())}isOpenRequested(){return this.open}parseSteps(){const e=this.getAttribute("steps");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}syncStepFromAttribute(){if(!this.hasAttribute("current-step"))return;const e=Number(this.getAttribute("current-step")||0);Number.isFinite(e)&&(this.internalStep=Math.max(0,e))}getSteps(){return this.parseSteps()}getCurrentStep(){const e=this.getSteps();return e.length?Math.min(Math.max(this.internalStep,0),e.length-1):0}close(){this.open=!1,this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}emitStepChange(e){this.dispatchEvent(new CustomEvent("db-step-change",{bubbles:!0,composed:!0,detail:{step:e}}))}goToStep(e){const t=this.getSteps();if(!t.length)return;const s=Math.min(Math.max(e,0),t.length-1);this.internalStep=s,this.emitStepChange(s),this.render()}attachKeyHandler(){this.keyHandler||(this.keyHandler=e=>{"Escape"!==e.key?"ArrowLeft"===e.key&&this.getCurrentStep()>0?this.handlePrev():"ArrowRight"===e.key&&this.getCurrentStep()<this.getSteps().length-1&&this.handleNext():this.close()},document.addEventListener("keydown",this.keyHandler))}detachKeyHandler(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null)}syncOpenState(){if(this.isOpenRequested())return this.mount(),void this.attachKeyHandler();this.detachKeyHandler(),this.unmount()}mount(){this.root||(this.root=document.createElement("div"),this.root.className="designbase-wc-onboarding-modal",this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.tabIndex=-1,this.ensureStructure()),this.root.isConnected||document.body.append(this.root),this.isMounted=!0,this.render()}unmount(){this.isMounted=!1,this.root?.remove()}ensureStructure(){this.root&&(this.contentEl&&this.root.contains(this.contentEl)||(this.overlayEl=void 0,this.contentEl=void 0,this.closeButtonEl=void 0,this.mainEl=void 0,this.imageWrapEl=void 0,this.imageEl=void 0,this.textEl=void 0,this.titleEl=void 0,this.descriptionEl=void 0,this.navigationEl=void 0,this.prevButtonEl=void 0,this.nextButtonEl=void 0,this.indicatorEl=void 0,this.root.replaceChildren(),this.overlayEl=document.createElement("div"),this.overlayEl.className="designbase-wc-onboarding-modal__overlay",this.overlayEl.addEventListener("click",()=>this.close()),this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-onboarding-modal__content",this.closeButtonEl=document.createElement("button"),this.closeButtonEl.type="button",this.closeButtonEl.className="designbase-wc-onboarding-modal__close-button",this.closeButtonEl.setAttribute("aria-label","닫기"),this.closeButtonEl.append(createDbIcon("close",20)),this.closeButtonEl.addEventListener("click",()=>this.close()),this.mainEl=document.createElement("div"),this.mainEl.className="designbase-wc-onboarding-modal__main",this.imageWrapEl=document.createElement("div"),this.imageWrapEl.className="designbase-wc-onboarding-modal__image",this.imageEl=document.createElement("img"),this.imageWrapEl.append(this.imageEl),this.textEl=document.createElement("div"),this.textEl.className="designbase-wc-onboarding-modal__text",this.titleEl=document.createElement("h2"),this.titleEl.id="onboarding-title",this.titleEl.className="designbase-wc-onboarding-modal__title",this.descriptionEl=document.createElement("p"),this.descriptionEl.id="onboarding-description",this.descriptionEl.className="designbase-wc-onboarding-modal__description",this.textEl.append(this.titleEl,this.descriptionEl),this.mainEl.append(this.imageWrapEl,this.textEl),this.navigationEl=document.createElement("div"),this.navigationEl.className="designbase-wc-onboarding-modal__navigation",this.prevButtonEl=document.createElement("db-button"),this.prevButtonEl.setAttribute("variant","secondary"),this.prevButtonEl.setAttribute("size","m"),this.prevButtonEl.setAttribute("start-icon","chevron-left"),this.prevButtonEl.setAttribute("aria-label","이전"),this.prevButtonEl.addEventListener("db-click",this.handlePrev),this.indicatorEl=document.createElement("db-indicator"),this.indicatorEl.addEventListener("db-step-click",e=>{const t=e.detail;this.goToStep(t.index??t.current)}),this.nextButtonEl=document.createElement("db-button"),this.nextButtonEl.setAttribute("variant","primary"),this.nextButtonEl.setAttribute("size","m"),this.nextButtonEl.addEventListener("db-click",this.handleNext),this.navigationEl.append(this.prevButtonEl,this.indicatorEl,this.nextButtonEl),this.contentEl.append(this.closeButtonEl,this.mainEl,this.navigationEl),this.root.append(this.overlayEl,this.contentEl)))}render(){if(!this.root||!this.isMounted)return;this.ensureStructure();const e=this.getSteps(),t=this.getCurrentStep(),s=e[t];if(!s)return;const i=!this.hasAttribute("show-close-button")||"false"!==this.getAttribute("show-close-button"),n=!this.hasAttribute("show-indicator")||"false"!==this.getAttribute("show-indicator"),a=this.getAttribute("indicator-type")||"dots",r=this.getAttribute("indicator-size")||"m",o=0===t,l=t===e.length-1;if(this.root.setAttribute("aria-labelledby","onboarding-title"),this.root.setAttribute("aria-describedby","onboarding-description"),this.closeButtonEl&&(this.closeButtonEl.style.display=i?"":"none"),this.imageWrapEl&&this.imageEl&&(s.image?(this.imageEl.src=s.image,this.imageEl.alt=s.title||"온보딩 이미지",this.imageWrapEl.style.display=""):this.imageWrapEl.style.display="none"),this.titleEl&&(this.titleEl.textContent=s.title||"",this.titleEl.style.display=s.title?"":"none"),this.descriptionEl&&(this.descriptionEl.textContent=s.description||"",this.descriptionEl.style.display=s.description?"":"none"),this.prevButtonEl&&(this.prevButtonEl.textContent="이전",o?this.prevButtonEl.setAttribute("disabled",""):this.prevButtonEl.removeAttribute("disabled")),this.nextButtonEl&&(this.nextButtonEl.textContent=l?"완료":"다음",this.nextButtonEl.setAttribute("aria-label",l?"완료":"다음"),l?this.nextButtonEl.removeAttribute("end-icon"):this.nextButtonEl.setAttribute("end-icon","chevron-right")),this.indicatorEl){const s=n&&e.length>1;this.indicatorEl.style.display=s?"":"none",s&&(this.indicatorEl.setAttribute("total",String(e.length)),this.indicatorEl.setAttribute("current",String(t)),this.indicatorEl.setAttribute("indicator-type",a),this.indicatorEl.setAttribute("size",r),this.indicatorEl.setAttribute("clickable",""))}}}customElements.get("db-onboarding-modal")||customElements.define("db-onboarding-modal",DbOnboardingModal);class DbSplitView extends HTMLElement{constructor(){super(...arguments),this.panelSizes=[],this.draggingIndex=null,this.panelSources=[],this.isSyncing=!1,this.isObserving=!1,this.handleMouseDown=e=>t=>{t.preventDefault(),this.draggingIndex=e,document.body.style.cursor="horizontal"===this.getDirection()?"col-resize":"row-resize",document.body.style.userSelect="none"},this.handleMouseMove=e=>{if(null===this.draggingIndex)return;if(!this.panelSources.length)return;const t=this.getDirection(),s=this.getMode(),i=this.getSplitterSize(),n=this.getBoundingClientRect(),a=this.panelSources[this.draggingIndex];if(!a)return;const r=this.readPanelConfig(a,this.draggingIndex,this.panelSources.length);let o=this.panelSizes[this.draggingIndex];if("horizontal"===t){const t=n.width,a=e.clientX-n.left;let l=0;for(let e=0;e<this.draggingIndex;e++){const n=this.panelSizes[e];l+="fixed"===s?n:n*t,l+=i}const d=a-l;if("fixed"===s)o=Math.max(r.minSize||0,Math.min(r.maxSize||t,d));else{o=d/t;const e=r.minSize?r.minSize/t:0,s=r.maxSize?r.maxSize/t:1;o=Math.max(e,Math.min(s,o))}}else{const t=n.height,a=e.clientY-n.top;let l=0;for(let e=0;e<this.draggingIndex;e++){const n=this.panelSizes[e];l+="fixed"===s?n:n*t,l+=i}const d=a-l;if("fixed"===s)o=Math.max(r.minSize||0,Math.min(r.maxSize||t,d));else{o=d/t;const e=r.minSize?r.minSize/t:0,s=r.maxSize?r.maxSize/t:1;o=Math.max(e,Math.min(s,o))}}this.panelSizes[this.draggingIndex]=o,this.applyPanelSizes(),this.classList.toggle("designbase-wc-split-view--dragging",!0)},this.handleMouseUp=()=>{null!==this.draggingIndex&&(this.draggingIndex=null,document.body.style.cursor="",document.body.style.userSelect="",this.classList.toggle("designbase-wc-split-view--dragging",!1))}}static get observedAttributes(){return["direction","mode","splitter-size","splitter-color","splitter-hover-color","gap","full-width","full-height"]}connectedCallback(){this.style.display="flex",this.style.boxSizing="border-box",this.collectPanelSources(),this.initPanelSizes(),this.sync(),this.observer=new MutationObserver(()=>{this.isSyncing||(this.collectPanelSources(),this.initPanelSizes(),this.sync())}),this.startObserving(),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){this.stopObserving(),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.draggingIndex=null,document.body.style.cursor="",document.body.style.userSelect=""}startObserving(){this.observer&&!this.isObserving&&(this.observer.observe(this,{childList:!0}),this.isObserving=!0)}stopObserving(){this.observer&&this.isObserving&&(this.observer.disconnect(),this.isObserving=!1)}attributeChangedCallback(){this.isConnected&&this.sync()}collectPanelSources(){this.panelSources=[];const e=Array.from(this.querySelectorAll('[slot="panel"]'));if(e.length)return void(this.panelSources=e);const t=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__panel > .designbase-wc-split-view__panel-body"));t.length&&(this.panelSources=t.map(e=>e.firstElementChild).filter(e=>e instanceof HTMLElement))}readPanelConfig(e,t,s){const i=e.getAttribute("data-size"),n=e.getAttribute("data-min-size"),a=e.getAttribute("data-max-size"),r=this.getMode();let o;return null!=i&&""!==i&&(o=Number(i)),{size:void 0!==o&&Number.isFinite(o)?o:"ratio"===r?1/s:200,minSize:n?Number(n):void 0,maxSize:a?Number(a):void 0,resizable:"false"!==e.getAttribute("data-resizable"),flexible:e.hasAttribute("data-flexible")||"false"!==e.getAttribute("data-flexible")&&t===s-1}}initPanelSizes(){const e=this.panelSources.length;if(!e)return;if(this.panelSizes.length===e)return;const t=this.getMode();this.panelSizes=this.panelSources.map((s,i)=>this.readPanelConfig(s,i,e).size??("ratio"===t?1/e:200))}getDirection(){return"vertical"===(this.getAttribute("direction")||"horizontal")?"vertical":"horizontal"}getMode(){return"fixed"===(this.getAttribute("mode")||"ratio")?"fixed":"ratio"}getSplitterSize(){return Number(this.getAttribute("splitter-size")||4)}getGap(){return Number(this.getAttribute("gap")||0)}applyPanelSizes(){if(!this.panelSources.length)return;const e=this.getDirection(),t=this.getMode();Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__panel")).forEach((s,i)=>{const n=this.panelSources[i];if(!n)return;const a=this.readPanelConfig(n,i,this.panelSources.length),r=this.panelSizes[i],o=a.flexible;if(s.style.width="",s.style.height="",s.style.flexBasis="",s.style.flexGrow="",s.style.flexShrink="",s.style.minHeight="",s.style.minWidth="",o)s.style.flex="1 1 0","vertical"===e?s.style.minHeight="0":s.style.minWidth="0";else{const e="fixed"===t?`${r}px`:100*r+"%";s.style.flex=`0 0 ${e}`}s.classList.toggle("designbase-wc-split-view__panel--flexible",Boolean(o)),s.classList.toggle("designbase-wc-split-view__panel--fixed",!o)})}sync(){if(this.isSyncing=!0,this.stopObserving(),this.collectPanelSources(),this.initPanelSizes(),!this.panelSources.length)return this.isSyncing=!1,void this.startObserving();const e=this.getDirection(),t=this.getMode(),s=this.getGap(),i=this.getSplitterSize(),n=this.getAttribute("splitter-color"),a=this.getAttribute("splitter-hover-color");this.className=["designbase-wc-split-view",`designbase-wc-split-view--direction-${e}`,`designbase-wc-split-view--mode-${t}`,this.hasAttribute("full-width")&&"designbase-wc-split-view--full-width",this.hasAttribute("full-height")&&"designbase-wc-split-view--full-height",null!==this.draggingIndex&&"designbase-wc-split-view--dragging"].filter(Boolean).join(" "),this.style.setProperty("--splitter-size",`${i}px`),n?this.style.setProperty("--splitter-color",n):this.style.removeProperty("--splitter-color"),a?this.style.setProperty("--splitter-hover-color",a):this.style.removeProperty("--splitter-hover-color"),this.style.gap=s>0?`${s}px`:"";const r=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__panel")),o=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__splitter"));r.forEach(e=>e.remove()),o.forEach(e=>e.remove()),this.panelSources.forEach((t,i)=>{const n=this.readPanelConfig(t,i,this.panelSources.length),a=i===this.panelSources.length-1,r=!1!==n.resizable&&!a,o=document.createElement("div");o.className="designbase-wc-split-view__panel";const l=document.createElement("div");if(l.className="designbase-wc-split-view__panel-body",t.parentElement!==l&&l.append(t),o.append(l),this.append(o),!a&&r&&0===s){const t=document.createElement("div");t.className=`designbase-wc-split-view__splitter designbase-wc-split-view__splitter--direction-${e}`,t.style.cursor="horizontal"===e?"col-resize":"row-resize",t.addEventListener("mousedown",this.handleMouseDown(i)),this.append(t)}}),this.applyPanelSizes(),this.isSyncing=!1,this.startObserving()}}customElements.get("db-split-view")||customElements.define("db-split-view",DbSplitView);const Ct=["s","m","l"],xt=["default","outlined","filled"];class DbFileUploader extends HTMLElement{constructor(){super(...arguments),this.uploadedFiles=[],this.uploadIntervals=new Map,this.handleFileSelect=e=>{if(this.isDisabled())return;const t=e.detail,s=t?.files??[];if(!s.length)return;const i=s.map(e=>({file:e,id:`${Date.now()}-${Math.random()}`,status:"pending",progress:0}));this.hasAttribute("multiple")?this.uploadedFiles=[...this.uploadedFiles,...i]:this.uploadedFiles=i,this.dispatchEvent(new CustomEvent("db-upload",{bubbles:!0,composed:!0,detail:{files:i}})),this.simulateUpload(i),this.renderFileList()},this.handleRemove=e=>{if(this.isDisabled())return;const t=this.uploadIntervals.get(e);t&&(clearInterval(t),this.uploadIntervals.delete(e)),this.uploadedFiles=this.uploadedFiles.filter(t=>t.id!==e),this.dispatchEvent(new CustomEvent("db-remove",{bubbles:!0,composed:!0,detail:{fileId:e}})),this.renderFileList()},this.handleRetry=e=>{if(this.isDisabled())return;const t=this.uploadedFiles.find(t=>t.id===e);t&&(this.updateFile(e,{status:"pending",progress:0,error:void 0}),this.dispatchEvent(new CustomEvent("db-retry",{bubbles:!0,composed:!0,detail:{fileId:e}})),this.simulateUpload([t]),this.renderFileList())}}static get observedAttributes(){return["size","variant","accept","max-size","multiple","show-file-list","show-progress","disabled","readonly"]}connectedCallback(){this.ensureDropzone(),this.sync(),this.dropzone?.addEventListener("db-file-select",this.handleFileSelect)}disconnectedCallback(){this.dropzone?.removeEventListener("db-file-select",this.handleFileSelect),this.uploadIntervals.forEach(e=>clearInterval(e)),this.uploadIntervals.clear()}attributeChangedCallback(){this.isConnected&&this.sync()}isDisabled(){return this.hasAttribute("disabled")||this.hasAttribute("readonly")}ensureDropzone(){this.dropzone||(this.dropzone=document.createElement("db-dropzone"),this.dropzone.setAttribute("data-wc-internal",""),this.prepend(this.dropzone))}formatFileSize(e){if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/1024**t).toFixed(2))} ${["Bytes","KB","MB","GB"][t]}`}simulateUpload(e){e.forEach((e,t)=>{this.updateFile(e.id,{status:"uploading",progress:0});let s=0;const i=setInterval(()=>{if(s+=20*Math.random(),s>=100)return s=100,clearInterval(i),this.uploadIntervals.delete(e.id),this.updateFile(e.id,{status:"success",progress:100}),void this.renderFileList();this.updateFile(e.id,{progress:s}),this.renderFileList()},100+50*t);this.uploadIntervals.set(e.id,i)})}updateFile(e,t){this.uploadedFiles=this.uploadedFiles.map(s=>s.id===e?{...s,...t}:s)}sync(){if(this.ensureDropzone(),!this.dropzone)return;const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=Ct.includes(e)?e:"m",i=xt.includes(t)?t:"default";this.className=["designbase-wc-file-uploader",`designbase-wc-file-uploader--size-${s}`,`designbase-wc-file-uploader--variant-${i}`,this.hasAttribute("disabled")&&"designbase-wc-file-uploader--disabled",this.hasAttribute("readonly")&&"designbase-wc-file-uploader--readonly"].filter(Boolean).join(" "),this.dropzone.setAttribute("size",s),this.dropzone.setAttribute("variant",i),this.getAttribute("accept")?this.dropzone.setAttribute("accept",this.getAttribute("accept")):this.dropzone.removeAttribute("accept"),this.getAttribute("max-size")?this.dropzone.setAttribute("max-size",this.getAttribute("max-size")):this.dropzone.removeAttribute("max-size"),this.dropzone.toggleAttribute("multiple",this.hasAttribute("multiple")),this.dropzone.toggleAttribute("disabled",this.hasAttribute("disabled")),this.dropzone.toggleAttribute("readonly",this.hasAttribute("readonly")),this.renderFileList()}renderStatusIcon(e){if("uploading"===e){const e=document.createElement("db-spinner");return e.setAttribute("type","circular"),e.setAttribute("size","s"),e}return createDbIcon("success"===e?"done":"error"===e?"error-filled":"gallery",20)}renderFileList(){const e=!this.hasAttribute("show-file-list")||"false"!==this.getAttribute("show-file-list"),t=!this.hasAttribute("show-progress")||"false"!==this.getAttribute("show-progress");if(this.querySelector(":scope > .designbase-wc-file-uploader__file-list")?.remove(),!e||!this.uploadedFiles.length)return;const s=document.createElement("div");s.className="designbase-wc-file-uploader__file-list";const i=document.createElement("div");i.className="designbase-wc-file-uploader__file-list-title",i.textContent=`업로드된 파일들 (${this.uploadedFiles.length}개)`,s.append(i);const n=document.createElement("div");n.className="designbase-wc-file-uploader__file-items",this.uploadedFiles.forEach(e=>{const s=document.createElement("div");s.className=`designbase-wc-file-uploader__file-item designbase-wc-file-uploader__file-item--${e.status}`;const i=document.createElement("div");i.className="designbase-wc-file-uploader__file-info";const a=document.createElement("div");a.className="designbase-wc-file-uploader__file-icon",a.append(this.renderStatusIcon(e.status));const r=document.createElement("div");r.className="designbase-wc-file-uploader__file-details";const o=document.createElement("div");o.className="designbase-wc-file-uploader__file-name",o.textContent=e.file.name;const l=document.createElement("div");if(l.className="designbase-wc-file-uploader__file-size",l.textContent=this.formatFileSize(e.file.size),r.append(o,l),e.error){const t=document.createElement("div");t.className="designbase-wc-file-uploader__file-error",t.textContent=e.error,r.append(t)}if(i.append(a,r),s.append(i),t&&"uploading"===e.status){const t=document.createElement("div");t.className="designbase-wc-file-uploader__progress";const i=document.createElement("db-progressbar");i.setAttribute("value",String(Math.round(e.progress||0))),i.setAttribute("size","s"),i.setAttribute("variant","primary"),i.setAttribute("bar-style","solid"),i.setAttribute("show-label",""),i.setAttribute("label-position","inside"),i.setAttribute("full-width",""),t.append(i),s.append(t)}const d=document.createElement("div");if(d.className="designbase-wc-file-uploader__file-actions","error"===e.status){const t=document.createElement("button");t.type="button",t.className="designbase-wc-file-uploader__retry-button",t.textContent="재시도",t.disabled=this.isDisabled(),t.addEventListener("click",()=>this.handleRetry(e.id)),d.append(t)}const u=document.createElement("button");u.type="button",u.className="designbase-wc-file-uploader__remove-button",u.textContent="삭제",u.disabled=this.isDisabled(),u.addEventListener("click",()=>this.handleRemove(e.id)),d.append(u),s.append(d),n.append(s)}),s.append(n),this.append(s)}}customElements.get("db-file-uploader")||customElements.define("db-file-uploader",DbFileUploader);const startOfDay=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},endOfDay=e=>{const t=new Date(e);return t.setHours(23,59,59,999),t},addDays$1=(e,t)=>{const s=new Date(e);return s.setDate(s.getDate()+t),startOfDay(s)},getMonthEnd=e=>endOfDay(new Date(e.getFullYear(),e.getMonth()+1,0)),getYearEnd=e=>endOfDay(new Date(e.getFullYear(),11,31)),clampRange=(e,t,s)=>{let{start:i,end:n}=e;return t&&i<t&&(i=startOfDay(t)),s&&n>s&&(n=endOfDay(s)),i>n?{start:n,end:i}:{start:i,end:n}},kt=[{id:"today",label:"오늘",getRange:({today:e})=>clampRange({start:startOfDay(e),end:endOfDay(e)})},{id:"yesterday",label:"어제",getRange:({today:e})=>{const t=addDays$1(e,-1);return clampRange({start:t,end:endOfDay(t)})}},{id:"this-week",label:"이번 주",getRange:({today:e,startOfWeek:t,minDate:s,maxDate:i})=>{const n=((e,t)=>{const s=e.getDay();return addDays$1(e,-("monday"===t?(s+6)%7:s))})(e,t);return clampRange({start:n,end:(a=n,endOfDay(addDays$1(a,6)))},s,i);var a}},{id:"this-month",label:"이번 달",getRange:({today:e,minDate:t,maxDate:s})=>{return clampRange({start:(i=e,startOfDay(new Date(i.getFullYear(),i.getMonth(),1))),end:getMonthEnd(e)},t,s);var i}},{id:"this-year",label:"올해",getRange:({today:e,minDate:t,maxDate:s})=>{return clampRange({start:(i=e,startOfDay(new Date(i.getFullYear(),0,1))),end:getYearEnd(e)},t,s);var i}},{id:"custom",label:"사용자 지정",getRange:()=>null}],addMonths=(e,t)=>{const s=new Date(e);return s.setDate(1),s.setMonth(s.getMonth()+t),s},toISODate=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,parseISODate=e=>{if(!e)return null;const t=e.trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!t)return null;const s=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(s.getTime())?null:startOfDay(s)},formatDisplayDate=(e,t="ko-KR")=>e.toLocaleDateString(t),detectActivePresetId=(e,t,s)=>{if(!e)return"custom";const i=e.start.toDateString(),n=e.end.toDateString();for(const e of t){if("custom"===e.id)continue;const t=e.getRange(s);if(t&&(t.start.toDateString()===i&&t.end.toDateString()===n))return e.id}return"custom"},formatPanelInputDate=(e,t)=>e?e.toLocaleDateString(t,{year:"numeric",month:"short",day:"numeric"}):"",St="designbase-wc-date-picker",Nt=["s","m","l"],$t=["default","outlined","filled"],isRangeValue=e=>Boolean(e)&&"object"==typeof e&&!Array.isArray(e)&&"start"in e&&"end"in e;class DbDatePicker extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.isOpen=!1,this.currentMonth=new Date,this.viewStartMonth=new Date,this.rangeStart=null,this.hoveredDate=null,this.activePresetId="custom",this.inputText="",this.boundDocumentMouseDown=e=>this.handleDocumentMouseDown(e)}static get observedAttributes(){return["mode","layout","type","inline","value","default-value","min-date","max-date","size","variant","disabled","readonly","label","full-width","error","locale","start-of-week","show-outside-days","dropdown-position","open","events"]}connectedCallback(){this.built||this.build(),this.readInitialValue(),this.render(),document.addEventListener("mousedown",this.boundDocumentMouseDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundDocumentMouseDown)}attributeChangedCallback(e){if(this.built){if("value"===e&&(this.readAttributeValue(),this.syncInputText()),"open"===e)return this.isOpen=this.hasAttribute("open"),void this.render();this.render()}}get value(){return this.getAttribute("value")||""}set value(e){e?this.setAttribute("value",e):this.removeAttribute("value")}get mode(){const e=this.getAttribute("mode")||"single";return"range"===e?"range":"multiple"===e?"multiple":"single"}set mode(e){this.setAttribute("mode",e)}get isPanelLayout(){return"panel"===this.getAttribute("layout")}get effectiveMode(){return this.isPanelLayout?"range":this.mode}get inline(){return this.hasAttribute("inline")}set inline(e){this.toggleAttribute("inline",Boolean(e))}get type(){return"modal"===this.getAttribute("type")?"modal":"dropdown"}get locale(){return this.getAttribute("locale")||"ko-KR"}get startOfWeek(){return"monday"===this.getAttribute("start-of-week")?"monday":"sunday"}get showOutsideDays(){return"false"!==this.getAttribute("show-outside-days")}get usesPendingValue(){return this.isPanelLayout||"modal"===this.type}get today(){return startOfDay(new Date)}get minDate(){return parseISODate(this.getAttribute("min-date"))}get maxDate(){return parseISODate(this.getAttribute("max-date"))}get presets(){return this.isPanelLayout?kt:[]}get events(){const e=this.getAttribute("events");if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}build(){this.built=!0,this.labelEl=document.createElement("label"),this.labelEl.className=`${St}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${St}__trigger`;const e=document.createElement("button");e.type="button",e.className=`${St}__icon-display`,e.setAttribute("aria-label","날짜 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${St}__input`,this.inputEl.setAttribute("aria-label","날짜 입력"),this.inputEl.addEventListener("click",()=>this.openPicker()),this.inputEl.addEventListener("blur",()=>this.handleInputBlur()),this.inputEl.addEventListener("input",()=>{this.inputText=this.inputEl?.value||""});const t=document.createElement("button");t.type="button",t.className=`${St}__toggle`,t.setAttribute("aria-label","날짜 선택 열기"),t.addEventListener("click",()=>this.toggleOpen()),this.triggerEl.append(e,this.inputEl,t),this.dropdownEl=document.createElement("div"),this.dropdownEl.className=`${St}__dropdown`,this.dropdownEl.setAttribute("role","dialog"),this.dropdownEl.setAttribute("aria-modal","false"),this.calendarHost=document.createElement("div"),this.dropdownEl.appendChild(this.calendarHost)}readInitialValue(){const e=this.getAttribute("value")??this.getAttribute("default-value");if(e&&(this.selectedValue=this.parseValue(e)),this.tempValue=this.selectedValue,this.syncInputText(),isRangeValue(this.selectedValue)){const e=parseISODate(this.selectedValue.start);e&&(this.viewStartMonth=new Date(e))}else if("string"==typeof this.selectedValue){const e=parseISODate(this.selectedValue);e&&(this.currentMonth=new Date(e))}}readAttributeValue(){const e=this.getAttribute("value");if(!e)return this.selectedValue=void 0,void(this.tempValue=void 0);this.selectedValue=this.parseValue(e),this.isOpen&&this.usesPendingValue||(this.tempValue=this.selectedValue)}parseValue(e){if(e){if("multiple"===this.effectiveMode||e.trim().startsWith("["))try{const t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>Boolean(parseISODate(e)))}catch{return}if("range"===this.effectiveMode||e.trim().startsWith("{"))try{const t=JSON.parse(e);if(t?.start&&t?.end)return{start:t.start,end:t.end}}catch{return}return parseISODate(e)?e:void 0}}serializeValue(e){return e?"string"==typeof e?e:JSON.stringify(e):""}formatDisplay(e){if(!e)return"";if("string"==typeof e){const t=parseISODate(e);return t?formatDisplayDate(t,this.locale):""}if(Array.isArray(e))return e.map(e=>parseISODate(e)).filter(Boolean).map(e=>formatDisplayDate(e,this.locale)).join(", ");const t=parseISODate(e.start),s=parseISODate(e.end);return t&&s?e.start===e.end?formatDisplayDate(t,this.locale):`${formatDisplayDate(t,this.locale)} ~ ${formatDisplayDate(s,this.locale)}`:""}syncInputText(){this.inputText=this.formatDisplay(this.selectedValue),this.inputEl&&(this.inputEl.value=this.inputText)}getWorkingValue(){return"range"===this.effectiveMode&&this.rangeStart?this.tempValue??this.selectedValue:this.usesPendingValue&&(this.isOpen||this.inline)?this.tempValue:this.selectedValue}presetContext(){return{today:this.today,startOfWeek:this.startOfWeek,minDate:this.minDate??void 0,maxDate:this.maxDate??void 0}}isDateValid(e){return!(this.minDate&&e<this.minDate)&&!(this.maxDate&&e>this.maxDate)}emitChange(e){const t=this.serializeValue(e);t?this.setAttribute("value",t):this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e??null},bubbles:!0,composed:!0}))}applyValue(e,t=!this.usesPendingValue){if(t)return this.selectedValue=e,this.tempValue=e,this.syncInputText(),void this.emitChange(e);this.tempValue=e,this.renderCalendar()}handleDateClick(e){if(this.disabled||this.readonly||!this.isDateValid(e))return;this.isPanelLayout&&(this.activePresetId="custom");const t=this.getWorkingValue();if("single"===this.effectiveMode){const t=toISODate(e);return this.applyValue(t,!this.usesPendingValue),this.inline||this.isPanelLayout||this.closePicker(),void this.render()}if("multiple"===this.effectiveMode){const s=toISODate(e),i=Array.isArray(t)?t:[],n=i.includes(s)?i.filter(e=>e!==s):[...i,s];return this.applyValue(n,!this.usesPendingValue),void this.render()}if(!this.rangeStart)return this.rangeStart=e,this.applyValue({start:toISODate(e),end:toISODate(e)},!1),void this.renderCalendar();const s=this.rangeStart,i=e,n=s>i?{start:toISODate(i),end:toISODate(s)}:{start:toISODate(s),end:toISODate(i)};this.rangeStart=null,this.applyValue(n,!0),this.inline||this.isPanelLayout||this.closePicker(),this.render()}handlePresetSelect(e){if(this.activePresetId=e.id,this.rangeStart=null,"custom"===e.id)return void this.renderCalendar();const t=e.getRange(this.presetContext());if(!t)return;const s={start:toISODate(t.start),end:toISODate(t.end)};this.viewStartMonth=new Date(t.start),this.applyValue(s,!this.usesPendingValue),this.render()}handlePendingApply(){this.selectedValue=this.tempValue,this.syncInputText(),this.emitChange(this.tempValue),this.rangeStart=null,this.closePicker(),this.render()}handlePendingCancel(){this.tempValue=this.selectedValue,this.rangeStart=null,this.activePresetId=detectActivePresetId(isRangeValue(this.selectedValue)?{start:parseISODate(this.selectedValue.start),end:parseISODate(this.selectedValue.end)}:void 0,this.presets,this.presetContext()),this.closePicker(),this.render()}handleInputBlur(){if(!this.inputEl)return;const e=this.inputEl.value.trim();if(e.match(/^(\d{4})-(\d{2})-(\d{2})$/)){const t=parseISODate(e);if(t&&this.isDateValid(t)){const e=toISODate(t);return this.applyValue(e,!0),void this.render()}}this.syncInputText()}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",Boolean(e))}get readonly(){return this.hasAttribute("readonly")}set readonly(e){this.toggleAttribute("readonly",Boolean(e))}openPicker(){this.disabled||this.readonly||(this.isOpen=!0,this.usesPendingValue&&(this.tempValue=this.selectedValue,this.activePresetId=detectActivePresetId(isRangeValue(this.selectedValue)?{start:parseISODate(this.selectedValue.start),end:parseISODate(this.selectedValue.end)}:void 0,this.presets,this.presetContext())),this.render())}closePicker(){this.isOpen=!1,this.rangeStart=null,this.hoveredDate=null,this.render()}toggleOpen(){this.isOpen?this.closePicker():this.openPicker()}handleDocumentMouseDown(e){this.isOpen&&!this.inline&&(this.contains(e.target)||(this.usesPendingValue&&(this.tempValue=this.selectedValue),this.closePicker()))}isDateSelected(e){const t=toISODate(e),s=this.getWorkingValue();return"single"===this.effectiveMode?"string"==typeof s&&s===t:"multiple"===this.effectiveMode?Array.isArray(s)&&s.includes(t):!(!this.rangeStart||toISODate(this.rangeStart)!==t)||!!isRangeValue(s)&&(s.start===t||s.end===t)}isInRange(e){if("range"!==this.effectiveMode)return!1;let t=null,s=null;if(this.rangeStart)t=this.rangeStart,s=this.hoveredDate;else{const e=this.getWorkingValue();isRangeValue(e)&&(t=parseISODate(e.start),s=parseISODate(e.end))}if(!t)return!1;const i=toISODate(e),n=toISODate(t),a=s?toISODate(s):n;return i>=n&&i<=a}renderDateCell(e,t){const s=e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear(),i=e.toDateString()===this.today.toDateString(),n=this.isDateSelected(e),a=this.isInRange(e),r=0===e.getDay()||6===e.getDay(),o=this.events.filter(t=>{const s=parseISODate(t.date);return!!s&&s.toDateString()===e.toDateString()}),l=this.getWorkingValue(),d=isRangeValue(l)?parseISODate(l.end)?.toDateString():void 0,u=isRangeValue(l)?parseISODate(l.start)?.toDateString():void 0,b=document.createElement("button");b.type="button",b.className=[`${St}__date`,!s&&this.showOutsideDays&&`${St}__date--outside`,i&&`${St}__date--today`,n&&`${St}__date--selected`,a&&!n&&`${St}__date--in-range`,"range"===this.effectiveMode&&(this.rangeStart?.toDateString()===e.toDateString()||u===e.toDateString())&&`${St}__date--range-start`,"range"===this.effectiveMode&&d===e.toDateString()&&`${St}__date--range-end`,r&&`${St}__date--weekend`,!this.isDateValid(e)&&`${St}__date--disabled`,o.length>0&&`${St}__date--has-events`].filter(Boolean).join(" "),b.disabled=!this.isDateValid(e)||this.disabled||this.readonly,b.addEventListener("click",()=>this.handleDateClick(e));const m=document.createElement("span");if(m.className=`${St}__date-number`,m.textContent=String(e.getDate()),b.appendChild(m),o.length>0){const e=document.createElement("div");e.className=`${St}__events`,o.slice(0,3).forEach(t=>{const s=document.createElement("div");s.className=`${St}__event ${St}__event--${t.type||"dot"}`,t.color&&(s.style.backgroundColor=t.color),t.label&&(s.title=t.label),e.appendChild(s)}),b.appendChild(e)}return b}renderSingleMonth(e,t={}){const{showPrev:s=!1,showNext:i=!1}=t,n=getDbComponentIconSize(this.getAttribute("size")||"m"),a=document.createElement("div");a.className=`${St}__month`;const r=document.createElement("div");if(r.className=`${St}__header`,s){const e=document.createElement("button");e.type="button",e.className=`${St}__nav-button`,e.setAttribute("aria-label","이전 달"),e.disabled=this.disabled||this.readonly,e.appendChild(createDbIcon("chevron-left",n)),e.addEventListener("click",()=>{this.isPanelLayout?this.viewStartMonth=addMonths(this.viewStartMonth,-1):this.currentMonth=addMonths(this.currentMonth,-1),this.renderCalendar()}),r.appendChild(e)}else{const e=document.createElement("span");e.className=`${St}__nav-spacer`,e.setAttribute("aria-hidden","true"),r.appendChild(e)}const o=document.createElement("div");if(o.className=`${St}__current-month`,o.textContent=e.toLocaleDateString(this.locale,{year:"numeric",month:"long"}),r.appendChild(o),i){const e=document.createElement("button");e.type="button",e.className=`${St}__nav-button`,e.setAttribute("aria-label","다음 달"),e.disabled=this.disabled||this.readonly,e.appendChild(createDbIcon("chevron-right",n)),e.addEventListener("click",()=>{this.isPanelLayout?this.viewStartMonth=addMonths(this.viewStartMonth,1):this.currentMonth=addMonths(this.currentMonth,1),this.renderCalendar()}),r.appendChild(e)}else{const e=document.createElement("span");e.className=`${St}__nav-spacer`,e.setAttribute("aria-hidden","true"),r.appendChild(e)}a.appendChild(r);const l=document.createElement("div");l.className=`${St}__weekdays`,(e=>{const t=["일","월","화","수","목","금","토"];return"monday"===e&&t.push(t.shift()),t})(this.startOfWeek).forEach(e=>{const t=document.createElement("div");t.className=`${St}__weekday`,t.textContent=e,l.appendChild(t)}),a.appendChild(l);const d=document.createElement("div");d.className=`${St}__grid`;const u=this.isPanelLayout;return((e,t,s=!1)=>{const i=e.getFullYear(),n=e.getMonth(),a=new Date(i,n,1),r="monday"===t?(a.getDay()+6)%7:a.getDay();if(s){const e=[];for(let t=0;t<r;t+=1)e.push(null);const t=new Date(i,n+1,0).getDate();for(let s=1;s<=t;s+=1)e.push(new Date(i,n,s));return e}const o=new Date(a);return o.setDate(o.getDate()-r),Array.from({length:42},(e,t)=>{const s=new Date(o);return s.setDate(o.getDate()+t),s})})(e,this.startOfWeek,u).forEach((t,s)=>{if(!t){const e=document.createElement("span");return e.className=`${St}__date ${St}__date--empty`,e.setAttribute("aria-hidden","true"),e.dataset.index=String(s),void d.appendChild(e)}const i=t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear();if(!this.showOutsideDays&&!i){const e=document.createElement("span");return e.className=`${St}__date ${St}__date--empty`,e.setAttribute("aria-hidden","true"),e.dataset.index=String(s),void d.appendChild(e)}d.appendChild(this.renderDateCell(t,e))}),a.appendChild(d),a}renderDefaultCalendar(){const e=document.createElement("div");e.className=`${St}__selector`;const t=this.isPanelLayout?this.viewStartMonth:this.currentMonth;if(e.appendChild(this.renderSingleMonth(t,{showPrev:!0,showNext:!0})),!this.isPanelLayout){const t=document.createElement("div");t.className=`${St}__footer`;const s=document.createElement("button");s.type="button",s.className=`${St}__today-button`,s.textContent="오늘",s.disabled=this.disabled||this.readonly,s.addEventListener("click",()=>{const e=new Date;this.isPanelLayout?this.viewStartMonth=e:this.currentMonth=e,this.renderCalendar()}),t.appendChild(s),e.appendChild(t)}return e}renderPanelCalendar(){const e=document.createElement("div");e.className=`${St}__panel`;const t=document.createElement("div");t.className=`${St}__presets`,t.setAttribute("role","listbox"),t.setAttribute("aria-label","기간 프리셋"),this.presets.forEach(e=>{const s=document.createElement("button");s.type="button",s.className=[`${St}__preset`,this.activePresetId===e.id&&`${St}__preset--active`].filter(Boolean).join(" "),s.setAttribute("role","option"),s.setAttribute("aria-selected",String(this.activePresetId===e.id)),s.textContent=e.label,s.addEventListener("click",()=>this.handlePresetSelect(e)),t.appendChild(s)}),e.appendChild(t);const s=document.createElement("div");s.className=`${St}__panel-main`;const i=document.createElement("div");i.className=`${St}__months ${St}__months--count-2`,[0,1].forEach(e=>{const t=addMonths(this.viewStartMonth,e);i.appendChild(this.renderSingleMonth(t,{showPrev:0===e,showNext:1===e}))}),s.appendChild(i);const n=document.createElement("div");n.className=`${St}__panel-footer`;const a=isRangeValue(this.tempValue)?this.tempValue:void 0,r=document.createElement("div");r.className=`${St}__range-display`;const o=document.createElement("span");o.className=`${St}__range-text`,o.textContent=a?.start&&parseISODate(a.start)?formatPanelInputDate(parseISODate(a.start),this.locale):"시작일";const l=document.createElement("span");l.className=`${St}__range-separator`,l.textContent="–";const d=document.createElement("span");d.className=`${St}__range-text`,d.textContent=a?.end&&parseISODate(a.end)?formatPanelInputDate(parseISODate(a.end),this.locale):"종료일",r.append(o,l,d),n.appendChild(r);const u=document.createElement("div");u.className=`${St}__panel-actions`;const b=document.createElement("db-button");b.setAttribute("variant","secondary"),b.setAttribute("size","m"),b.textContent="취소",b.addEventListener("click",()=>this.handlePendingCancel());const m=document.createElement("db-button");return m.setAttribute("variant","primary"),m.setAttribute("size","m"),m.textContent="적용",m.addEventListener("click",()=>this.handlePendingApply()),u.append(b,m),n.appendChild(u),s.appendChild(n),e.appendChild(s),e}renderCalendar(){this.calendarHost&&(this.calendarHost.replaceChildren(),this.calendarHost.appendChild(this.isPanelLayout?this.renderPanelCalendar():this.renderDefaultCalendar()))}render(){const e=Nt.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=$t.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default",s=this.getAttribute("dropdown-position")||"bottom-start",i=getDbComponentIconSize(e);if(this.className=[St,this.inline?`${St}--size-${e}`:`${St}--${e}`,`${St}--variant-${t}`,this.hasAttribute("full-width")&&`${St}--full-width`,this.disabled&&`${St}--disabled`,this.readonly&&`${St}--readonly`,this.isOpen&&`${St}--open`,this.hasAttribute("error")&&`${St}--error`,this.isPanelLayout&&`${St}--panel`].filter(Boolean).join(" "),this.replaceChildren(),this.inline)return this.calendarHost=document.createElement("div"),this.appendChild(this.calendarHost),void this.renderCalendar();if(!(this.labelEl&&this.triggerEl&&this.inputEl&&this.dropdownEl))return;const n=this.getAttribute("label")||"";this.labelEl.textContent=n,this.labelEl.hidden=!n,this.inputEl.value=this.inputText,this.inputEl.placeholder=this.isPanelLayout?"기간을 선택하세요":"날짜를 선택하세요",this.inputEl.disabled=this.disabled,this.inputEl.readOnly=this.readonly;const a=this.triggerEl.querySelector(`.${St}__icon-display`);a&&(a.innerHTML="",a.appendChild(createDbIcon("calendar",i)),a.disabled=this.disabled);const r=this.triggerEl.querySelector(`.${St}__toggle`);if(r&&(r.innerHTML="",r.appendChild(createDbIcon("chevron-down",i)),r.disabled=this.disabled),this.dropdownEl.className=[`${St}__dropdown`,`${St}__dropdown--${s}`,this.isPanelLayout&&`${St}__dropdown--panel`].filter(Boolean).join(" "),this.dropdownEl.hidden=!this.isOpen||"modal"===this.type,this.calendarHost=document.createElement("div"),this.dropdownEl.replaceChildren(this.calendarHost),this.renderCalendar(),this.append(this.labelEl,this.triggerEl),this.isOpen&&"dropdown"===this.type&&this.appendChild(this.dropdownEl),this.isOpen&&"modal"===this.type){const e=document.createElement("db-modal");e.setAttribute("open","true"),e.setAttribute("title",this.isPanelLayout?"기간 선택":"날짜 선택"),e.setAttribute("size",this.isPanelLayout?"l":"s"),e.addEventListener("db-close",()=>this.handlePendingCancel());const t=document.createElement("div");if(this.calendarHost=t,this.renderCalendar(),e.append(t),this.usesPendingValue){const t=document.createElement("div");t.className=`${St}__modal-footer`;const s=document.createElement("db-button");s.setAttribute("variant","secondary"),s.setAttribute("size","m"),s.textContent="취소",s.addEventListener("click",()=>this.handlePendingCancel());const i=document.createElement("db-button");i.setAttribute("variant","primary"),i.setAttribute("size","m"),i.textContent="적용",i.addEventListener("click",()=>this.handlePendingApply()),t.append(s,i),e.append(t)}this.appendChild(e)}}}customElements.get("db-date-picker")||customElements.define("db-date-picker",DbDatePicker);const It="designbase-wc-time-picker",Dt=["s","m","l"],Lt=["12h","24h","12h-with-seconds","24h-with-seconds"];class DbTimePicker extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.isOpen=!1,this.hours=12,this.minutes=0,this.seconds=0,this.period="PM",this.inputText="",this.tempHours=12,this.tempMinutes=0,this.tempSeconds=0,this.tempPeriod="PM",this.boundDocumentMouseDown=e=>this.handleDocumentMouseDown(e)}static get observedAttributes(){return["value","default-value","type","format","minute-step","size","disabled","readonly","label","full-width","error","dropdown-position","open"]}connectedCallback(){this.built||this.build(),this.parseTimeString(this.getAttribute("value")??this.getAttribute("default-value")??"12:00"),this.syncInputText(),this.render(),document.addEventListener("mousedown",this.boundDocumentMouseDown)}disconnectedCallback(){document.removeEventListener("mousedown",this.boundDocumentMouseDown)}attributeChangedCallback(e){if(this.built){if("value"===e){const e=this.getAttribute("value");e&&(this.parseTimeString(e),this.syncInputText())}if("open"===e)return this.isOpen=this.hasAttribute("open"),void this.render();this.render()}}get value(){return this.getAttribute("value")||""}set value(e){e?this.setAttribute("value",e):this.removeAttribute("value")}get format(){const e=this.getAttribute("format")||"24h";return Lt.includes(e)?e:"24h"}set format(e){this.setAttribute("format",e)}get type(){return"modal"===this.getAttribute("type")?"modal":"dropdown"}get is12h(){return"12h"===this.format||"12h-with-seconds"===this.format}get showSeconds(){return"12h-with-seconds"===this.format||"24h-with-seconds"===this.format}get minuteStep(){const e=Number(this.getAttribute("minute-step")||"1");return Number.isFinite(e)&&e>0?e:1}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",Boolean(e))}get readonly(){return this.hasAttribute("readonly")}set readonly(e){this.toggleAttribute("readonly",Boolean(e))}build(){this.built=!0,this.labelEl=document.createElement("label"),this.labelEl.className=`${It}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${It}__trigger`;const e=document.createElement("button");e.type="button",e.className=`${It}__icon-display`,e.setAttribute("aria-label","시간 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${It}__input`,this.inputEl.setAttribute("aria-label","시간 입력"),this.inputEl.addEventListener("click",()=>this.openPicker()),this.inputEl.addEventListener("blur",()=>this.handleInputBlur()),this.inputEl.addEventListener("input",()=>{this.inputText=this.inputEl?.value||""});const t=document.createElement("button");t.type="button",t.className=`${It}__toggle`,t.setAttribute("aria-label","시간 선택 열기"),t.addEventListener("click",()=>this.toggleOpen()),this.triggerEl.append(e,this.inputEl,t),this.dropdownEl=document.createElement("div"),this.dropdownEl.className=`${It}__dropdown`,this.dropdownEl.setAttribute("role","dialog"),this.dropdownEl.setAttribute("aria-modal","false")}pad2(e){return String(e).padStart(2,"0")}to24Hour(e,t){return"AM"===t?12===e?0:e:12===e?12:e+12}formatTimeString(e,t,s,i){const n="AM"===(i||this.period)?"오전":"오후";return this.is12h?`${n} ${this.pad2(e)}:${this.pad2(t)}${this.showSeconds?`:${this.pad2(s)}`:""}`:`${this.pad2(e)}:${this.pad2(t)}${this.showSeconds?`:${this.pad2(s)}`:""}`}toValue24(e,t,s,i){const n=this.is12h?this.to24Hour(e,i||this.period):e;return`${this.pad2(n)}:${this.pad2(t)}${this.showSeconds?`:${this.pad2(s)}`:""}`}parseTimeString(e){const t=e.trim();if(this.is12h){const e=this.showSeconds?/^(오전|오후|AM|PM)?\s*(0?[1-9]|1[0-2]):([0-5]\d):([0-5]\d)\s*(AM|PM|오전|오후)?$/i:/^(오전|오후|AM|PM)?\s*(0?[1-9]|1[0-2]):([0-5]\d)\s*(AM|PM|오전|오후)?$/i,s=t.match(e);if(s){const e=s[1],t=this.showSeconds?s[5]:s[4],i=(e||t||"AM").toUpperCase();return this.hours=parseInt(s[2],10),this.minutes=parseInt(s[3],10),this.seconds=this.showSeconds?parseInt(s[4],10):0,void(this.period="오후"===i||"PM"===i?"PM":"AM")}}else{const e=this.showSeconds?/^([01]?\d|2[0-3]):([0-5]\d):([0-5]\d)$/:/^([01]?\d|2[0-3]):([0-5]\d)$/,s=t.match(e);s&&(this.hours=parseInt(s[1],10),this.minutes=parseInt(s[2],10),this.seconds=this.showSeconds?parseInt(s[3],10):0)}}syncInputText(){this.inputText=this.formatTimeString(this.hours,this.minutes,this.seconds),this.inputEl&&(this.inputEl.value=this.inputText)}emitChange(e){this.setAttribute("value",e),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:e},bubbles:!0,composed:!0}))}handleTimeChange(e,t,s=this.seconds,i){this.hours=e,this.minutes=t,this.seconds=s,i&&(this.period=i);const n=this.formatTimeString(e,t,s,i);this.inputText=n,this.inputEl&&(this.inputEl.value=n),this.emitChange(this.toValue24(e,t,s,i))}handleInputBlur(){if(!this.inputEl)return;const e=this.inputText;this.parseTimeString(this.inputEl.value);this.formatTimeString(this.hours,this.minutes,this.seconds)!==e||this.inputEl.value.trim()?this.handleTimeChange(this.hours,this.minutes,this.seconds,this.period):this.syncInputText()}openPicker(){this.disabled||this.readonly||(this.isOpen=!0,"modal"===this.type&&(this.tempHours=this.hours,this.tempMinutes=this.minutes,this.tempSeconds=this.seconds,this.tempPeriod=this.period),this.render())}closePicker(){this.isOpen=!1,this.render()}toggleOpen(){this.isOpen?this.closePicker():this.openPicker()}handleDocumentMouseDown(e){this.isOpen&&(this.contains(e.target)||this.closePicker())}createWheel(e){const{label:t,items:s,value:i,onChange:n,formatter:a}=e,r=document.createElement("div");r.className=`${It}__wheel-container`;const o=document.createElement("div");o.className=`${It}__wheel-label`,o.textContent=t,r.appendChild(o);const l=document.createElement("div");l.className=`${It}__wheel-viewport`;const d=document.createElement("div");d.className=`${It}__wheel`,d.setAttribute("role","listbox"),d.setAttribute("aria-label",t);let u=null,b=!1,m=!1,p=0,g=0;const indexOfValue=e=>s.findIndex(t=>t===e),scrollToIndex=(e,t=!0)=>{const s=40*e;b=!0,d.scrollTo({top:s,behavior:t?"smooth":"auto"}),window.setTimeout(()=>{b=!1},150)},fmt=e=>a?a(e):"number"==typeof e?this.pad2(e):String(e);s.forEach(e=>{const t=document.createElement("div");t.className=[`${It}__wheel-item`,e===i&&`${It}__wheel-item--selected`].filter(Boolean).join(" "),t.setAttribute("role","option"),t.setAttribute("aria-selected",String(e===i)),t.textContent=fmt(e),t.addEventListener("click",()=>{const t=indexOfValue(e);scrollToIndex(t,!0),e!==i&&n(e)}),d.appendChild(t)});const handleScroll=()=>{b||(u&&window.clearTimeout(u),u=window.setTimeout(()=>{const e=d.scrollTop,t=Math.round(e/40),a=Math.max(0,Math.min(s.length-1,t)),r=s[a];scrollToIndex(a,!0),r!==i&&n(r)},120))};d.addEventListener("scroll",handleScroll),d.addEventListener("pointerdown",e=>{m=!0,p=e.clientY,g=d.scrollTop,d.setPointerCapture(e.pointerId),d.style.cursor="grabbing"}),d.addEventListener("pointermove",e=>{m&&(d.scrollTop=g-(e.clientY-p))});const endDrag=e=>{m&&(m=!1,d.releasePointerCapture(e.pointerId),d.style.cursor="grab",handleScroll())};d.addEventListener("pointerup",endDrag),d.addEventListener("pointercancel",endDrag);const v=indexOfValue(i);v>=0&&requestAnimationFrame(()=>scrollToIndex(v,!1));const E=document.createElement("div");E.className=`${It}__wheel-center-indicator`,E.setAttribute("aria-hidden","true");const f=document.createElement("div");f.className=`${It}__wheel-fade wheel-fade--top`,f.setAttribute("aria-hidden","true");const w=document.createElement("div");return w.className=`${It}__wheel-fade wheel-fade--bottom`,w.setAttribute("aria-hidden","true"),l.append(d,E,f,w),r.appendChild(l),r}renderSelector(e=!1){const t=document.createElement("div");t.className=`${It}__selector`;const s=document.createElement("div");s.className=`${It}__picker-wheels`;const i=this.is12h?Array.from({length:12},(e,t)=>t+1):Array.from({length:24},(e,t)=>t),n=Array.from({length:Math.floor(60/this.minuteStep)},(e,t)=>t*this.minuteStep),a=Array.from({length:60},(e,t)=>t),r=e?this.tempHours:this.hours,o=e?this.tempMinutes:this.minutes,l=e?this.tempSeconds:this.seconds,d=e?this.tempPeriod:this.period,onChange=(t,s,i,n)=>{if(e)return this.tempHours=t,this.tempMinutes=s,this.tempSeconds=i,void(this.tempPeriod=n);this.handleTimeChange(t,s,i,n)};if(s.appendChild(this.createWheel({label:"시간",items:i,value:r,onChange:e=>onChange(e,o,l,d)})),s.appendChild(this.createWheel({label:"분",items:n,value:n.includes(o)?o:n[0],onChange:e=>onChange(r,e,l,d)})),this.showSeconds&&s.appendChild(this.createWheel({label:"초",items:a,value:l,onChange:e=>onChange(r,o,e,d)})),this.is12h&&s.appendChild(this.createWheel({label:"오전/오후",items:["AM","PM"],value:d,onChange:e=>onChange(r,o,l,e),formatter:e=>"AM"===e?"오전":"오후"})),t.appendChild(s),e)return t;const u=document.createElement("div");u.className=`${It}__dropdown-actions`;const b=document.createElement("div");b.className=`${It}__preview`,b.setAttribute("aria-live","polite"),b.appendChild(createDbIcon("clock",16));const m=document.createElement("div");m.className=`${It}__preview-time`,m.textContent=this.formatTimeString(r,o,l,d),b.appendChild(m);const p=document.createElement("db-button");return p.setAttribute("variant","primary"),p.setAttribute("size","m"),p.textContent="선택",p.addEventListener("click",()=>{this.handleTimeChange(r,o,l,d),this.closePicker()}),u.append(b,p),t.appendChild(u),t}render(){const e=Dt.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=this.getAttribute("dropdown-position")||"bottom-start",s=getDbComponentIconSize(e);if(this.className=[It,`${It}--${e}`,this.hasAttribute("full-width")&&`${It}--full-width`,this.disabled&&`${It}--disabled`,this.readonly&&`${It}--readonly`,this.isOpen&&`${It}--open`,this.hasAttribute("error")&&`${It}--error`].filter(Boolean).join(" "),this.replaceChildren(),!(this.labelEl&&this.triggerEl&&this.inputEl&&this.dropdownEl))return;const i=this.getAttribute("label")||"";this.labelEl.textContent=i,this.labelEl.hidden=!i,this.inputEl.value=this.inputText,this.inputEl.placeholder=this.is12h?this.showSeconds?"12:00:00 PM":"12:00 PM":this.showSeconds?"12:00:00":"12:00",this.inputEl.disabled=this.disabled,this.inputEl.readOnly=this.readonly;const n=this.triggerEl.querySelector(`.${It}__icon-display`);n&&(n.innerHTML="",n.appendChild(createDbIcon("clock",s)),n.disabled=this.disabled);const a=this.triggerEl.querySelector(`.${It}__toggle`);if(a&&(a.innerHTML="",a.appendChild(createDbIcon("chevron-down",s)),a.disabled=this.disabled),this.dropdownEl.className=[`${It}__dropdown`,`${It}__dropdown--${t}`].filter(Boolean).join(" "),this.dropdownEl.hidden=!this.isOpen,this.isOpen&&"dropdown"===this.type&&this.dropdownEl.replaceChildren(this.renderSelector(!1)),this.append(this.labelEl,this.triggerEl),this.isOpen&&"dropdown"===this.type&&this.appendChild(this.dropdownEl),this.isOpen&&"modal"===this.type){const e=document.createElement("db-modal");e.setAttribute("open","true"),e.setAttribute("title","시간 선택"),e.setAttribute("size","s"),e.addEventListener("db-close",()=>this.closePicker());const t=this.renderSelector(!0),s=document.createElement("div");s.className=`${It}__modal-footer`;const i=document.createElement("db-button");i.setAttribute("variant","secondary"),i.setAttribute("size","m"),i.textContent="취소",i.addEventListener("click",()=>this.closePicker());const n=document.createElement("db-button");n.setAttribute("variant","primary"),n.setAttribute("size","m"),n.textContent="적용",n.addEventListener("click",()=>{this.handleTimeChange(this.tempHours,this.tempMinutes,this.tempSeconds,this.tempPeriod),this.closePicker()}),s.append(i,n),e.append(t,s),this.appendChild(e)}}}customElements.get("db-time-picker")||customElements.define("db-time-picker",DbTimePicker);const Mt="designbase-wc-calendar",Tt=[{value:"meeting",label:"회의"},{value:"task",label:"업무"},{value:"reminder",label:"알림"},{value:"birthday",label:"생일"},{value:"holiday",label:"휴일"},{value:"custom",label:"기타"}],zt=[{value:"#17a2b8",label:"청록"},{value:"#0d6efd",label:"파랑"},{value:"#198754",label:"초록"},{value:"#ffc107",label:"노랑"},{value:"#dc3545",label:"빨강"},{value:"#6f42c1",label:"보라"}];class DbCalendar extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.currentView="month",this.selectedDate=new Date,this._events=[],this.showEventModal=!1,this.selectedEvent=null,this.isEditing=!1,this.draggedEvent=null,this.dragOverDate=null,this.selectedDateRange={start:null,end:null},this.eventForm={title:"",description:"",startTime:"09:00",endTime:"10:00",type:"meeting",color:"#17a2b8",isAllDay:!1,location:""}}static get observedAttributes(){return["view","current-date","events","locale","show-weekends","highlight-today","show-outside-days"]}connectedCallback(){this.built||this.build(),this.readAttributes(),this.render()}attributeChangedCallback(){this.built&&(this.readAttributes(),this.render())}get locale(){return this.getAttribute("locale")||"ko-KR"}get showWeekends(){return"false"!==this.getAttribute("show-weekends")}get highlightToday(){return"false"!==this.getAttribute("highlight-today")}get showOutsideDays(){return"false"!==this.getAttribute("show-outside-days")}get events(){return this._events}set events(e){"string"!=typeof e?(this._events=Array.isArray(e)?e:[],this.setAttribute("events",JSON.stringify(this._events))):this.setAttribute("events",e)}build(){this.built=!0,this.headerEl=document.createElement("div"),this.headerEl.className=`${Mt}__header`,this.bodyEl=document.createElement("div"),this.bodyEl.className=`${Mt}__body`,this.modalEl=document.createElement("db-modal"),this.modalEl.setAttribute("size","m"),this.modalEl.addEventListener("db-close",()=>this.closeModal())}readAttributes(){this.currentView="month";const e=parseISODate(this.getAttribute("current-date"));e&&(this.selectedDate=e);const t=this.getAttribute("events");if(t)try{const e=JSON.parse(t);this._events=Array.isArray(e)?e:[]}catch{this._events=[]}else this._events=[]}isSameDate(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}eventsForDate(e){return this._events.filter(t=>{const s=parseISODate(t.date);return!!s&&this.isSameDate(s,e)})}emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}handleViewChange(e){this.currentView="month",this.emit("db-view-change",{view:e}),this.render()}shiftMonth(e){const t=new Date(this.selectedDate);t.setMonth(t.getMonth()+e),this.selectedDate=t,this.emit("db-month-change",{date:toISODate(t)}),this.render()}shiftYear(e){const t=new Date(this.selectedDate);t.setFullYear(t.getFullYear()+e),this.selectedDate=t,this.emit("db-month-change",{date:toISODate(t)}),this.render()}handleDateClick(e){this.selectedDate=e,this.emit("db-date-click",{date:toISODate(e)}),!this.selectedDateRange.start||this.selectedDateRange.start&&this.selectedDateRange.end?this.selectedDateRange={start:e,end:null}:this.selectedDateRange.start&&!this.selectedDateRange.end&&(e<this.selectedDateRange.start?this.selectedDateRange={start:e,end:this.selectedDateRange.start}:this.selectedDateRange={start:this.selectedDateRange.start,end:e}),this.openAddModal(e)}handleDragStart(e,t){this.draggedEvent=e,t.dataTransfer?.setData("text/plain",e.id),t.dataTransfer?.setData("application/json",JSON.stringify(e)),t.dataTransfer&&(t.dataTransfer.effectAllowed="move")}handleDragOver(e,t){t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"),this.dragOverDate=e,this.render()}handleDragLeave(e){const t=e.relatedTarget,s=e.currentTarget;s&&t&&s.contains(t)||(this.dragOverDate=null,this.render())}handleDrop(e,t){if(t.preventDefault(),!this.draggedEvent)return;const s={...this.draggedEvent,date:toISODate(e)};this.emit("db-event-edit",{event:s}),this.draggedEvent=null,this.dragOverDate=null,this.render()}handleDragEnd(){this.draggedEvent=null,this.dragOverDate=null,this.render()}handleEventClick(e,t){t.stopPropagation(),this.selectedEvent=e,this.isEditing=!0;const s=parseISODate(e.date);s&&(this.selectedDate=s),this.eventForm={title:e.title,description:e.description||"",startTime:e.startTime||"09:00",endTime:e.endTime||"10:00",type:e.type,color:e.color||"#17a2b8",isAllDay:e.isAllDay||!1,location:e.location||""},this.emit("db-event-click",{event:e}),this.showEventModal=!0,this.render()}openAddModal(e){this.selectedDate=e,this.selectedEvent=null,this.isEditing=!1,this.eventForm={title:"",description:"",startTime:"09:00",endTime:"10:00",type:"meeting",color:"#17a2b8",isAllDay:!1,location:""},this.showEventModal=!0,this.render()}closeModal(){this.showEventModal=!1,this.selectedEvent=null,this.isEditing=!1,this.render()}saveEvent(){if(!this.eventForm.title.trim())return void window.alert("제목을 입력해주세요.");const e={title:this.eventForm.title.trim(),description:this.eventForm.description,date:toISODate(this.selectedDate),startTime:this.eventForm.startTime,endTime:this.eventForm.endTime,type:this.eventForm.type,color:this.eventForm.color,isAllDay:this.eventForm.isAllDay,location:this.eventForm.location};if(this.isEditing&&this.selectedEvent){const t={...this.selectedEvent,...e};this.emit("db-event-edit",{event:t})}else this.emit("db-event-add",{event:e});this.closeModal()}deleteEvent(){this.selectedEvent&&window.confirm("정말로 이 일정을 삭제하시겠습니까?")&&(this.emit("db-event-delete",{eventId:this.selectedEvent.id}),this.closeModal())}renderHeader(){if(!this.headerEl)return;this.headerEl.replaceChildren();const e=document.createElement("div");e.className=`${Mt}__navigation`;const t=getDbComponentIconSize("m"),s=document.createElement("button");s.type="button",s.className=`${Mt}__nav-button`,s.setAttribute("aria-label","이전"),s.appendChild(createDbIcon("chevron-left",t)),s.addEventListener("click",()=>{this.shiftMonth(-1)});const i=document.createElement("div");i.className=`${Mt}__title`,i.textContent=this.selectedDate.toLocaleDateString(this.locale,{year:"numeric",month:"long"});const n=document.createElement("button");n.type="button",n.className=`${Mt}__nav-button`,n.setAttribute("aria-label","다음"),n.appendChild(createDbIcon("chevron-right",t)),n.addEventListener("click",()=>{this.shiftMonth(1)}),e.append(s,i,n),this.headerEl.appendChild(e)}renderMonthView(){const e=document.createElement("div");e.className=`${Mt}__month-view`;const t=document.createElement("div");t.className=`${Mt}__weekdays`,["일","월","화","수","목","금","토"].forEach(e=>{const s=document.createElement("div");s.className=`${Mt}__weekday`,s.textContent=e,t.appendChild(s)}),e.appendChild(t);const s=document.createElement("div");s.className=`${Mt}__days`;const i=this.selectedDate.getFullYear(),n=this.selectedDate.getMonth(),a=new Date(i,n,1),r=new Date(a);r.setDate(r.getDate()-a.getDay());const o=new Date;for(let e=0;e<42;e+=1){const t=new Date(r);t.setDate(r.getDate()+e);const i=t.getMonth()===n;if(!this.showOutsideDays&&!i)continue;const a=0===t.getDay()||6===t.getDay();if(!this.showWeekends&&a)continue;const l=document.createElement("div"),d=this.selectedDateRange.start&&this.selectedDateRange.end&&t>=this.selectedDateRange.start&&t<=this.selectedDateRange.end,u=this.selectedDateRange.start&&t.toDateString()===this.selectedDateRange.start.toDateString(),b=this.selectedDateRange.end&&t.toDateString()===this.selectedDateRange.end.toDateString(),m=Boolean(d&&!u&&!b);l.className=[`${Mt}__day`,i&&`${Mt}__day--current-month`,this.highlightToday&&t.toDateString()===o.toDateString()&&`${Mt}__day--today`,this.isSameDate(t,this.selectedDate)&&`${Mt}__day--selected`,u&&`${Mt}__day--selected--start`,b&&`${Mt}__day--selected--end`,m&&`${Mt}__day--selected--middle`,!this.showWeekends&&a&&`${Mt}__day--weekend`].filter(Boolean).join(" "),l.addEventListener("click",()=>this.handleDateClick(t));const p=document.createElement("span");p.className=`${Mt}__day-number`,p.textContent=String(t.getDate()),l.appendChild(p);const g=this.eventsForDate(t);if(g.length){const e=document.createElement("div");if(e.className=`${Mt}__day-events`,g.slice(0,2).forEach(t=>{const s=document.createElement("div");s.className=[`${Mt}__event-bar`,`${Mt}__event-bar--${t.type}`].filter(Boolean).join(" "),t.color&&(s.style.backgroundColor=t.color),this.draggedEvent?.id===t.id&&s.classList.add(`${Mt}__event-bar--dragging`),s.title=t.title,s.draggable=!0;const i=document.createElement("span");i.className=`${Mt}__event-title`,i.textContent=t.title,s.appendChild(i),s.addEventListener("click",e=>this.handleEventClick(t,e)),s.addEventListener("dragstart",e=>this.handleDragStart(t,e)),s.addEventListener("dragend",()=>this.handleDragEnd()),e.appendChild(s)}),g.length>2){const t=document.createElement("div");t.className=`${Mt}__more-events`,t.textContent=`+${g.length-2} more`,e.appendChild(t)}l.appendChild(e)}const v=document.createElement("div");v.className=[`${Mt}__drop-zone`,this.dragOverDate&&this.isSameDate(this.dragOverDate,t)&&`${Mt}__drop-zone--active`].filter(Boolean).join(" "),v.addEventListener("dragover",e=>this.handleDragOver(t,e)),v.addEventListener("dragleave",e=>this.handleDragLeave(e)),v.addEventListener("drop",e=>this.handleDrop(t,e)),l.appendChild(v),s.appendChild(l)}return e.appendChild(s),e}renderYearView(){const e=document.createElement("div");e.className=`${Mt}__year-view`;const t=this.selectedDate.getFullYear();for(let s=0;s<12;s+=1){const i=new Date(t,s,1),n=this._events.filter(e=>{const i=parseISODate(e.date);return i&&i.getFullYear()===t&&i.getMonth()===s}),a=document.createElement("div");a.className=`${Mt}__year-month`,a.addEventListener("click",()=>{this.selectedDate=i,this.handleViewChange("month")});const r=document.createElement("h3");if(r.className=`${Mt}__year-month-title`,r.textContent=i.toLocaleDateString(this.locale,{month:"long"}),a.appendChild(r),n.length){const e=document.createElement("div");if(e.className=`${Mt}__year-month-events`,n.slice(0,4).forEach(t=>{const s=document.createElement("span");s.className=[`${Mt}__year-event`,`${Mt}__year-event--${t.type}`].join(" "),t.color&&(s.style.backgroundColor=t.color),e.appendChild(s)}),n.length>4){const t=document.createElement("span");t.className=`${Mt}__year-more-events`,t.textContent=`+${n.length-4} more`,e.appendChild(t)}a.appendChild(e)}e.appendChild(a)}return e}renderWeekView(){const e=document.createElement("div");e.className=`${Mt}__week-view`;const t=new Date,s=new Date(this.selectedDate);s.setDate(this.selectedDate.getDate()-this.selectedDate.getDay());const i=document.createElement("div");i.className=`${Mt}__week-header`;const n=document.createElement("div");n.className=`${Mt}__time-column-header`,i.appendChild(n);for(let e=0;e<7;e+=1){const n=new Date(s);n.setDate(s.getDate()+e);const a=document.createElement("div");a.className=[`${Mt}__week-day-header`,n.toDateString()===t.toDateString()&&`${Mt}__week-day-header--today`].filter(Boolean).join(" ");const r=document.createElement("span");r.className=`${Mt}__week-day-name`,r.textContent=n.toLocaleDateString(this.locale,{weekday:"short"});const o=document.createElement("span");o.className=`${Mt}__week-day-number`,o.textContent=String(n.getDate()),a.append(r,o),i.appendChild(a)}e.appendChild(i);const a=document.createElement("div");a.className=`${Mt}__week-grid`;const r=document.createElement("div");r.className=`${Mt}__week-time-column`;for(let e=6;e<=22;e+=1){const t=document.createElement("div");t.className=`${Mt}__time-slot`;const s=document.createElement("span");s.className=`${Mt}__time-label`,s.textContent=`${String(e).padStart(2,"0")}:00`,t.appendChild(s),r.appendChild(t)}a.appendChild(r);const o=document.createElement("div");o.className=`${Mt}__week-columns`;for(let e=0;e<7;e+=1){const t=new Date(s);t.setDate(s.getDate()+e);const i=document.createElement("div");i.className=`${Mt}__week-column`;for(let e=6;e<=22;e+=1){const s=document.createElement("div");s.className=`${Mt}__week-cell`,s.title=`${t.toLocaleDateString()} ${String(e).padStart(2,"0")}:00`,s.addEventListener("click",()=>{this.selectedDate=new Date(t),this.eventForm.startTime=`${String(e).padStart(2,"0")}:00`,this.eventForm.endTime=`${String(e+1).padStart(2,"0")}:00`,this.openAddModal(this.selectedDate)}),i.appendChild(s)}this.eventsForDate(t).forEach(e=>{if(!e.startTime)return;const[t,s]=e.startTime.split(":").map(Number),n=.8*(60*(t-6)+(s||0)),a=(e.endTime||e.startTime).split(":").map(Number),r=60*(a[0]||t)+(a[1]||0),o=60*t+(s||0),l=Math.max(20,48*(r-o)/60),d=document.createElement("div");d.className=[`${Mt}__week-event`,`${Mt}__week-event--${e.type}`].filter(Boolean).join(" "),d.textContent=e.title,d.title=e.title,d.style.backgroundColor=e.color||"#17a2b8",d.style.top=`${n}px`,d.style.height=`${l}px`,d.addEventListener("click",t=>this.handleEventClick(e,t)),i.appendChild(d)}),o.appendChild(i)}return a.appendChild(o),e.appendChild(a),e}renderModal(){if(!this.modalEl)return;if(this.modalEl.replaceChildren(),!this.showEventModal)return void this.modalEl.removeAttribute("open");this.modalEl.setAttribute("open","true"),this.modalEl.setAttribute("title",this.isEditing?"일정 편집":"새 일정 추가");const e=document.createElement("div");e.className=`${Mt}__event-form`;const t=document.createElement("db-input");t.setAttribute("label","제목 *"),t.setAttribute("placeholder","일정 제목을 입력하세요"),t.setAttribute("full-width",""),t.setAttribute("value",this.eventForm.title),t.addEventListener("db-input",e=>{this.eventForm.title=e.detail.value});const s=document.createElement("db-input");s.setAttribute("label","설명"),s.setAttribute("placeholder","일정 설명을 입력하세요"),s.setAttribute("full-width",""),s.setAttribute("value",this.eventForm.description),s.addEventListener("db-input",e=>{this.eventForm.description=e.detail.value});const i=document.createElement("db-date-picker");i.setAttribute("label","날짜"),i.setAttribute("full-width",""),i.setAttribute("value",toISODate(this.selectedDate)),i.addEventListener("db-change",e=>{const t=parseISODate(e.detail.value);t&&(this.selectedDate=t)});const n=document.createElement("db-select");n.setAttribute("label","일정 타입"),n.setAttribute("full-width",""),n.setAttribute("options",JSON.stringify(Tt)),n.setAttribute("value",this.eventForm.type),n.addEventListener("db-change",e=>{this.eventForm.type=e.detail.value});const a=document.createElement("db-select");a.setAttribute("label","색상"),a.setAttribute("full-width",""),a.setAttribute("options",JSON.stringify(zt)),a.setAttribute("value",this.eventForm.color),a.addEventListener("db-change",e=>{this.eventForm.color=e.detail.value});const r=document.createElement("db-time-picker");r.setAttribute("label","시작 시간"),r.setAttribute("full-width",""),r.setAttribute("value",this.eventForm.startTime),r.addEventListener("db-change",e=>{this.eventForm.startTime=e.detail.value});const o=document.createElement("db-time-picker");o.setAttribute("label","종료 시간"),o.setAttribute("full-width",""),o.setAttribute("value",this.eventForm.endTime),o.addEventListener("db-change",e=>{this.eventForm.endTime=e.detail.value}),e.append(t,s,i,n,a,r,o);const l=document.createElement("div");l.className="designbase-wc-modal__body",l.setAttribute("data-modal-part","body"),l.appendChild(e);const d=document.createElement("div");d.className="designbase-wc-modal__footer",d.setAttribute("data-modal-part","footer");const u=document.createElement("div");if(u.className=`${Mt}__modal-actions`,this.isEditing){const e=document.createElement("db-button");e.setAttribute("variant","danger"),e.textContent="삭제",e.addEventListener("click",()=>this.deleteEvent()),u.appendChild(e)}const b=document.createElement("div");b.className=`${Mt}__modal-buttons`;const m=document.createElement("db-button");m.setAttribute("variant","secondary"),m.textContent="취소",m.addEventListener("click",()=>this.closeModal());const p=document.createElement("db-button");p.setAttribute("variant","primary"),p.textContent=this.isEditing?"수정":"저장",p.addEventListener("click",()=>this.saveEvent()),b.append(m,p),u.appendChild(b),d.appendChild(u),this.modalEl.append(l,d)}render(){this.className=Mt,this.replaceChildren(),this.headerEl&&this.bodyEl&&(this.renderHeader(),this.bodyEl.replaceChildren(),this.bodyEl.appendChild(this.renderMonthView()),this.append(this.headerEl,this.bodyEl),this.renderModal(),this.showEventModal&&this.modalEl&&this.appendChild(this.modalEl))}}customElements.get("db-calendar")||customElements.define("db-calendar",DbCalendar);const Bt=["s","m","l"],Pt=["default","minimal","card","inline","large"],Ft=["stars","number","both","reviews","detailed"],Ot=["star","number","percentage","text"],Rt=["primary","secondary","success","warning","error","custom"];class DbRating extends HTMLElement{constructor(){super(...arguments),this.hoverValue=null,this.starsEl=null,this.handlePointerMove=e=>{if(!this.isInteractive()||!this.getBooleanAttr("hover-effect",!0))return;const t=e.target?.closest(".designbase-wc-rating__star");if(!t||!this.contains(t))return;const s=Number(t.dataset.index);if(!Number.isFinite(s))return;const i=this.getNumberAttr("max-value",5),n=this.getPointerValue(s,e.clientX,t,i);this.hoverValue!==n&&(this.hoverValue=n,this.classList.toggle("designbase-wc-rating--hovering",!0),this.refreshStars(),this.dispatchEvent(new CustomEvent("db-hover",{detail:{value:n},bubbles:!0,composed:!0})))},this.handlePointerLeave=()=>{null!==this.hoverValue&&(this.hoverValue=null,this.classList.remove("designbase-wc-rating--hovering"),this.refreshStars())},this.handleClick=e=>{if(!this.isInteractive())return;const t=e.target?.closest(".designbase-wc-rating__star");if(!t||!this.contains(t))return;e.preventDefault();const s=Number(t.dataset.index);if(!Number.isFinite(s))return;const i=this.getNumberAttr("max-value",5),n=this.getPointerValue(s,e.clientX,t,i);this.hoverValue=null,this.classList.remove("designbase-wc-rating--hovering"),this.setAttribute("value",String(n)),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:n},bubbles:!0,composed:!0})),this.render()}}static get observedAttributes(){return["value","max-value","size","variant","type","display","review-count","rating-text","review-text","allow-half","readonly","disabled","clickable","color","custom-color","animated","hover-effect"]}connectedCallback(){this.addEventListener("mousemove",this.handlePointerMove),this.addEventListener("mouseleave",this.handlePointerLeave),this.addEventListener("click",this.handleClick),this.render()}disconnectedCallback(){this.removeEventListener("mousemove",this.handlePointerMove),this.removeEventListener("mouseleave",this.handlePointerLeave),this.removeEventListener("click",this.handleClick)}attributeChangedCallback(){this.isConnected&&this.render()}getNumberAttr(e,t){const s=this.getAttribute(e);if(null===s||""===s)return t;const i=Number(s);return Number.isFinite(i)?i:t}getBooleanAttr(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getOption(e,t,s){const i=this.getAttribute(e);return i&&t.includes(i)?i:s}normalizeSize(e){return"xs"===e||"s"===e?"s":"xl"===e||"l"===e?"l":"m"===e?"m":this.getOption("size",Bt,"m")}getStarIconSize(){const e=this.normalizeSize(this.getAttribute("size"));return"s"===e?16:"l"===e?24:20}supportsHalfSteps(){return this.getBooleanAttr("allow-half")||this.getBooleanAttr("clickable")}isInteractive(){return this.getBooleanAttr("clickable")&&!this.getBooleanAttr("readonly")&&!this.getBooleanAttr("disabled")}getStarFill(e,t,s){const i=e+1;return t>=i?1:s&&t>=i-.5?.5:0}getPointerValue(e,t,s,i){const n=s.getBoundingClientRect();let a;return a=this.supportsHalfSteps()&&t-n.left<n.width/2?e+.5:e+1,a/5*i}formatRating(e,t,s,i){const n=e/t*5;return"percentage"===s?`${Math.round(e/t*100)}%`:"number"===s?i?n.toFixed(1):String(Math.round(n)):"text"===s?n>=4.5?"매우 좋음":n>=3?"보통":"낮음":`${n.toFixed(1)}/5`}updateStarElement(e,t,s,i,n){e.className=["designbase-wc-rating__star",0===t&&"designbase-wc-rating__star--empty",t>0&&n&&"designbase-wc-rating__star--hover-preview",i&&"designbase-wc-rating__star--clickable",this.getBooleanAttr("animated")&&"designbase-wc-rating__star--animated"].filter(Boolean).join(" "),e.dataset.index=String(s);const a=1===t?"star-filled":.5===t?"star-half":"star",r=this.getStarIconSize(),o=e.querySelector("svg");o?.getAttribute("data-designbase-icon")===a&&o.getAttribute("width")===String(r)||e.replaceChildren(createDbIcon(a,r))}refreshStars(){if(!this.starsEl)return;const e=this.getNumberAttr("value",0),t=this.getNumberAttr("max-value",5),s=this.getBooleanAttr("allow-half",!1),i=this.getBooleanAttr("hover-effect",!0),n=null!==this.hoverValue&&i,a=(n?this.hoverValue:e)/t*5,r=this.isInteractive(),o=s||n,l=Array.from(this.starsEl.querySelectorAll(":scope > .designbase-wc-rating__star"));for(let e=0;e<5;e+=1){const t=this.getStarFill(e,a,o),s=n&&t>0,i=l[e]??document.createElement("span");i.setAttribute("aria-hidden","true"),this.updateStarElement(i,t,e,r,s),l[e]||this.starsEl.append(i)}for(let e=l.length-1;e>=5;e-=1)l[e]?.remove()}render(){const e=this.getNumberAttr("value",0),t=this.getNumberAttr("max-value",5),s=this.normalizeSize(this.getAttribute("size")),i=this.getOption("variant",Pt,"default"),n=this.getOption("type",Ot,"star"),a=this.getOption("display",Ft,"stars"),r=this.getOption("color",Rt,"primary"),o=this.getNumberAttr("review-count",0),l=this.getBooleanAttr("allow-half",!1),d=this.getBooleanAttr("readonly",!1),u=this.getBooleanAttr("disabled",!1),b=this.getBooleanAttr("clickable",!1),m=this.getBooleanAttr("hover-effect",!0),p=null!==this.hoverValue&&m;this.className=["designbase-wc-rating",`designbase-wc-rating--size-${s}`,`designbase-wc-rating--variant-${i}`,`designbase-wc-rating--type-${n}`,`designbase-wc-rating--display-${a}`,`designbase-wc-rating--color-${r}`,d&&"designbase-wc-rating--readonly",u&&"designbase-wc-rating--disabled",b&&"designbase-wc-rating--clickable",this.getBooleanAttr("animated")&&"designbase-wc-rating--animated",p&&"designbase-wc-rating--hovering"].filter(Boolean).join(" ");const g=this.getAttribute("custom-color");"custom"===r&&g?this.style.setProperty("--rating-color",g):this.style.removeProperty("--rating-color");let v=this.querySelector(':scope > [role="img"]');v||(v=document.createElement("div"),this.replaceChildren(v)),v.setAttribute("role","img"),v.setAttribute("aria-label",`rating ${this.formatRating(e,t,n,l)}`);if("stars"===a||"both"===a||"detailed"===a){const e=v.querySelectorAll(":scope > .designbase-wc-rating__stars");e.forEach((e,t)=>{t>0&&e.remove()});const t=e[0];t?this.starsEl=t:(this.starsEl=document.createElement("div"),this.starsEl.className="designbase-wc-rating__stars",v.prepend(this.starsEl)),this.refreshStars()}else this.starsEl&&(this.starsEl.remove(),this.starsEl=null);const E=this.getAttribute("rating-text")||this.formatRating(e,t,n,l);let f=v.querySelector(".designbase-wc-rating__number-container");if("number"===a||"both"===a){if(!f){f=document.createElement("div"),f.className="designbase-wc-rating__number-container";const e=document.createElement("span");e.className="designbase-wc-rating__number",f.append(e),v.append(f)}const e=f.querySelector(".designbase-wc-rating__number");e&&(e.textContent=E)}else f?.remove();let w=v.querySelector(".designbase-wc-rating__review-count");if("reviews"===a||"detailed"===a){const e=this.getAttribute("review-text")||(o>0?`${o.toLocaleString()} 리뷰`:"");e?(w||(w=document.createElement("span"),w.className="designbase-wc-rating__review-count",v.append(w)),w.textContent=e):w?.remove()}else w?.remove()}}customElements.get("db-rating")||customElements.define("db-rating",DbRating);const Ht=["s","m","l"],Vt=["default","compact","minimal"];class DbCountdown extends HTMLElement{constructor(){super(...arguments),this.timer=null,this.targetTime=Date.now()}static get observedAttributes(){return["end-date","duration","size","variant","show-days","show-hours","show-minutes","show-seconds","show-labels"]}connectedCallback(){this.setupTargetTime(),this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(){this.setupTargetTime(),this.render()}boolAttr(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}optionAttr(e,t,s){const i=this.getAttribute(e);return i&&t.includes(i)?i:s}setupTargetTime(){const e=this.getAttribute("end-date"),t=Number(this.getAttribute("duration"));if(e){const t=new Date(e).getTime();return void(this.targetTime=Number.isFinite(t)?t:Date.now())}Number.isFinite(t)&&t>0?this.targetTime=Date.now()+1e3*t:this.targetTime=Date.now()}getRemaining(){const e=this.targetTime-Date.now();return e<=0?{days:0,hours:0,minutes:0,seconds:0,total:0}:{days:Math.floor(e/864e5),hours:Math.floor(e/36e5%24),minutes:Math.floor(e/6e4%60),seconds:Math.floor(e/1e3%60),total:e}}stop(){null!==this.timer&&(window.clearInterval(this.timer),this.timer=null)}start(){this.stop(),this.render(),this.timer=window.setInterval(()=>{const e=this.getRemaining();this.render(),this.dispatchEvent(new CustomEvent("db-tick",{detail:e,bubbles:!0,composed:!0})),e.total<=0&&(this.stop(),this.dispatchEvent(new CustomEvent("db-complete",{bubbles:!0,composed:!0})))},1e3)}two(e){return String(e).padStart(2,"0")}render(){const e=this.optionAttr("size",Ht,"m"),t=this.optionAttr("variant",Vt,"default"),s=this.boolAttr("show-labels",!0),i=this.getRemaining();this.className=["designbase-wc-countdown",`designbase-wc-countdown--${e}`,`designbase-wc-countdown--${t}`,s&&"designbase-wc-countdown--with-labels",i.total<=0&&"designbase-wc-countdown--expired"].filter(Boolean).join(" ");const n={days:this.getAttribute("label-days")||"일",hours:this.getAttribute("label-hours")||"시간",minutes:this.getAttribute("label-minutes")||"분",seconds:this.getAttribute("label-seconds")||"초"},a=[{key:"days",value:i.days,show:this.boolAttr("show-days",!0)},{key:"hours",value:i.hours,show:this.boolAttr("show-hours",!0)},{key:"minutes",value:i.minutes,show:this.boolAttr("show-minutes",!0)},{key:"seconds",value:i.seconds,show:this.boolAttr("show-seconds",!0)}].filter(e=>e.show),r=[];for(let e=0;e<a.length;e+=1){const i=a[e],o=document.createElement("div");o.className="designbase-wc-countdown__unit";const l=document.createElement("div");if(l.className="designbase-wc-countdown__value",l.textContent=this.two(i.value),o.append(l),s){const e=document.createElement("div");e.className="designbase-wc-countdown__label",e.textContent=n[i.key],o.append(e)}if(r.push(o),e<a.length-1&&"minimal"!==t){const e=document.createElement("div");e.className="designbase-wc-countdown__separator",e.textContent=":",r.push(e)}}this.replaceChildren(...r)}}customElements.get("db-countdown")||customElements.define("db-countdown",DbCountdown);const qt=[1,2,3,4,5,6],jt=["xs","s","m","l","xl"];class DbMasonry extends HTMLElement{static get observedAttributes(){return["images","columns","spacing","hover","clickable"]}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}get images(){try{const e=JSON.parse(this.getAttribute("images")||"[]");return Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.src):[]}catch{return[]}}set images(e){this.setAttribute("images","string"==typeof e?e:JSON.stringify(e))}boolAttr(e,t=!0){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}render(){const e=Number(this.getAttribute("columns")||3),t=qt.includes(e)?e:3,s=this.getAttribute("spacing")||"m",i=jt.includes(s)?s:"m",n=this.boolAttr("hover",!0),a=this.boolAttr("clickable",!0);this.className=["designbase-wc-masonry",`designbase-wc-masonry--columns-${t}`,`designbase-wc-masonry--spacing-${i}`,n&&"designbase-wc-masonry--hover",a&&"designbase-wc-masonry--clickable"].filter(Boolean).join(" ");const r=document.createDocumentFragment();this.images.forEach((e,t)=>{const s=document.createElement("figure");s.className="designbase-wc-masonry__item";const i=document.createElement("img");if(i.className="designbase-wc-masonry__image",i.src=e.thumbnail||e.src,i.alt=e.alt||e.title||`image-${t+1}`,i.loading="lazy",i.addEventListener("load",()=>{this.dispatchEvent(new CustomEvent("db-image-load",{detail:{image:e,index:t},bubbles:!0,composed:!0}))}),i.addEventListener("error",()=>{this.dispatchEvent(new CustomEvent("db-image-error",{detail:{image:e,index:t},bubbles:!0,composed:!0}))}),s.append(i),e.title||e.description){const t=document.createElement("figcaption");if(t.className="designbase-wc-masonry__overlay",e.title){const s=document.createElement("h3");s.className="designbase-wc-masonry__title",s.textContent=e.title,t.append(s)}if(e.description){const s=document.createElement("p");s.className="designbase-wc-masonry__description",s.textContent=e.description,t.append(s)}s.append(t)}a&&(s.tabIndex=0,s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-image-click",{detail:{image:e,index:t},bubbles:!0,composed:!0}))})),r.append(s)}),this.replaceChildren(r)}}customElements.get("db-masonry")||customElements.define("db-masonry",DbMasonry);class DbCarousel extends HTMLElement{constructor(){super(...arguments),this.currentIndex=0,this.timer=null,this.isAutoPlaying=!1}static get observedAttributes(){return["items","size","variant","theme","transition","auto-play","auto-play-interval","infinite","show-navigation","show-indicators","indicator-style","show-auto-play-control","show-title","show-description","disabled","readonly"]}get items(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.style.display="block",this.clampCurrentIndex(),this.isAutoPlaying=this.getBool("auto-play"),this.startAutoPlay(),this.render()}disconnectedCallback(){this.stopAutoPlay()}attributeChangedCallback(e){"items"===e&&this.clampCurrentIndex(),"auto-play"!==e&&"auto-play-interval"!==e||(this.isAutoPlaying=this.getBool("auto-play"),this.startAutoPlay()),this.render()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}clampCurrentIndex(){this.currentIndex>=this.items.length&&(this.currentIndex=0)}stopAutoPlay(){this.timer&&(window.clearInterval(this.timer),this.timer=null)}startAutoPlay(){if(this.stopAutoPlay(),!this.isAutoPlaying||this.items.length<=1)return;const e=Math.max(1e3,Number(this.getAttribute("auto-play-interval")||5e3));this.timer=window.setInterval(()=>this.goToNext(),e)}getIndicatorType(){if(this.getBool("show-auto-play-control",!0)&&this.getBool("show-indicators",!0)&&this.items.length>1)return"combined";const e=this.getAttribute("indicator-style")||"dots";return"lines"===e?"line":"numbers"===e?"numbers":"dots"}getIndicatorSize(){const e=this.getAttribute("size")||"m";return"l"===e||"xl"===e?"m":"s"}goTo(e){e<0||e>=this.items.length||(this.currentIndex=e,this.dispatchEvent(new CustomEvent("db-slide-change",{detail:{index:e},bubbles:!0,composed:!0})),this.render())}goToPrev(){if(0===this.items.length)return;const e=this.getBool("infinite",!0),t=this.currentIndex-1;t<0?this.goTo(e?this.items.length-1:0):this.goTo(t)}goToNext(){if(0===this.items.length)return;const e=this.getBool("infinite",!0),t=this.currentIndex+1;t>=this.items.length?this.goTo(e?0:this.items.length-1):this.goTo(t)}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"light",i=this.getAttribute("transition")||"slide",n=this.getBool("show-navigation",!0),a=this.getBool("show-indicators",!0),r=this.getBool("show-auto-play-control",!0),o=this.getBool("show-title",!0),l=this.getBool("show-description",!0),d=this.getBool("disabled"),u=this.getBool("readonly"),b=this.getAttribute("indicator-style")||"dots",m=r&&a&&this.items.length>1;this.className=["designbase-wc-carousel",`designbase-wc-carousel--size-${e}`,`designbase-wc-carousel--variant-${t}`,`designbase-wc-carousel--theme-${s}`,`designbase-wc-carousel--transition-${i}`,`designbase-wc-carousel--indicator-${b}`,d&&"designbase-wc-carousel--disabled",u&&"designbase-wc-carousel--readonly"].filter(Boolean).join(" ");const p=document.createElement("div");p.className="designbase-wc-carousel__container";const g=document.createElement("div");if(g.className="designbase-wc-carousel__track",g.style.transform=`translateX(-${100*this.currentIndex}%)`,this.items.forEach((e,t)=>{const s=document.createElement("div");s.className="designbase-wc-carousel__slide"+(t===this.currentIndex?" designbase-wc-carousel__slide--active":""),s.style.flex="0 0 100%",s.style.width="100%",s.style.height="100%",s.style.minWidth="0";const i=e.image?"#ffffff":"";if(i&&(s.style.color=i),e.image){const i=document.createElement("div");i.className="designbase-wc-carousel__slide-image";const n=document.createElement("img");n.className="designbase-wc-carousel__slide-img",n.src=e.image,n.alt=e.alt||e.title||`Slide ${t+1}`,i.append(n),s.append(i)}if(o&&e.title||l&&e.description){const t=document.createElement("div");if(t.className="designbase-wc-carousel__slide-info",i&&(t.style.color=i),o&&e.title){const s=document.createElement("h3");s.className="designbase-wc-carousel__slide-title",s.textContent=e.title,i&&(s.style.color=i),t.append(s)}if(l&&e.description){const s=document.createElement("p");s.className="designbase-wc-carousel__slide-description",s.textContent=e.description,i&&(s.style.color=i),t.append(s)}s.append(t)}s.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:e,index:t},bubbles:!0,composed:!0}))}),g.append(s)}),p.append(g),n&&this.items.length>1){const e=document.createElement("button");e.className="designbase-wc-carousel__nav-button designbase-wc-carousel__nav-button--prev",e.type="button",e.append(createDbIcon("chevron-left",20)),e.disabled=d||u,e.addEventListener("click",()=>this.goToPrev());const t=document.createElement("button");t.className="designbase-wc-carousel__nav-button designbase-wc-carousel__nav-button--next",t.type="button",t.append(createDbIcon("chevron-right",20)),t.disabled=d||u,t.addEventListener("click",()=>this.goToNext()),p.append(e,t)}const v=[p];if(a&&this.items.length>1){const e=document.createElement("div");e.className="designbase-wc-carousel__controls";const t=document.createElement("div");t.className="designbase-wc-carousel__indicators";const s=document.createElement("db-indicator");s.setAttribute("current",String(this.currentIndex)),s.setAttribute("total",String(this.items.length)),s.setAttribute("type",this.getIndicatorType()),s.setAttribute("size",this.getIndicatorSize()),s.setAttribute("clickable",""),m&&(s.setAttribute("timer",""),s.setAttribute("timer-duration",String(Math.max(1e3,Number(this.getAttribute("auto-play-interval")||5e3)))),s.setAttribute("auto-roll","false"),this.isAutoPlaying?s.setAttribute("playing",""):s.removeAttribute("playing"),(d||u)&&s.setAttribute("playback-disabled","")),s.addEventListener("db-step-click",e=>{const t=e;this.goTo(t.detail.index)}),s.addEventListener("db-playing-change",e=>{const t=e;this.isAutoPlaying=t.detail.playing,this.startAutoPlay(),this.render()}),t.append(s),e.append(t),v.push(e)}this.replaceChildren(...v)}}customElements.get("db-carousel")||customElements.define("db-carousel",DbCarousel);const clamp=(e,t,s)=>Math.max(t,Math.min(s,e)),normalizeHex=e=>{const t=(e||"").trim().toUpperCase();return t?t.startsWith("#")?t:`#${t}`:""},isHex=e=>/^#?[0-9A-Fa-f]{6}$/.test(e||""),hexToRgb$1=e=>{const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e.trim());return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},rgbToHsv=(e,t,s)=>{e/=255,t/=255,s/=255;const i=Math.max(e,t,s),n=i-Math.min(e,t,s);let a=0;if(0!==n){switch(i){case e:a=(t-s)/n+(t<s?6:0);break;case t:a=(s-e)/n+2;break;case s:a=(e-t)/n+4}a*=60}return{h:a,s:100*(0===i?0:n/i),v:100*i}},Ut=["s","m","l"],Wt=["dropdown","modal"],Gt=["bottom-start","bottom-end","top-start","top-end"],Jt="#006FFF",Kt=hexToRgb$1(Jt)??{r:0,g:111,b:255},Yt=rgbToHsv(Kt.r,Kt.g,Kt.b),Xt=JSON.stringify([{label:"HEX",value:"hex"},{label:"RGB",value:"rgb"},{label:"RGBA",value:"rgba"},{label:"HSL",value:"hsl"},{label:"HSLA",value:"hsla"}]);class DbColorPicker extends HTMLElement{constructor(){super(...arguments),this.h=Yt.h,this.s=Yt.s,this.v=Yt.v,this.a=100,this.open=!1,this.format="hex",this.colorInput=Jt,this.alphaInput="100",this.isCopied=!1,this.tempColor="",this.dragging=null,this.mounted=!1,this.copiedTimer=null,this.debounceTimer=null,this.lastEmittedHex="",this.suppressNextValueSync=!1,this.didMount=!1,this.triggerInputFocused=!1,this.panelInputFocused=!1,this.panelAlphaInputFocused=!1,this.handleOutsideClick=e=>{if(!this.open||"dropdown"!==this.getOption("type",Wt,"dropdown"))return;const t=e.target;this.contains(t)||this.formatSelectEl?.contains(t)||(this.open=!1,this.update())},this.handleDocumentMouseMove=e=>{"area"===this.dragging&&(this.getBool("disabled")||this.getBool("readonly")||this.updateFromArea(e.clientX,e.clientY))},this.handleDocumentMouseUp=()=>{"area"===this.dragging&&(this.dragging=null,this.onColorStateChanged(!0))},this.handleModalCancel=()=>{const e=hexToRgb$1(this.tempColor);if(e){const t=rgbToHsv(e.r,e.g,e.b);this.h=t.h,this.s=t.s,this.v=t.v}this.open=!1,this.update(),this.dispatchEvent(new CustomEvent("db-cancel",{bubbles:!0,composed:!0}))},this.handleModalApply=()=>{this.open=!1,this.actuallyEmit(),this.dispatchEvent(new CustomEvent("db-apply",{detail:{value:this.getOutward()},bubbles:!0,composed:!0})),this.update()}}static get observedAttributes(){return["size","type","position","value","default-value","show-input","show-alpha","show-format-selector","show-copy-button","show-eyedropper","disabled","readonly","full-width","error","on-change-format","change-debounce-ms","emit-during-drag"]}connectedCallback(){this.mounted||this.mount(),this.syncFromValueAttr(!0),this.update(),document.addEventListener("mousedown",this.handleOutsideClick),document.addEventListener("mousemove",this.handleDocumentMouseMove),document.addEventListener("mouseup",this.handleDocumentMouseUp)}disconnectedCallback(){document.removeEventListener("mousedown",this.handleOutsideClick),document.removeEventListener("mousemove",this.handleDocumentMouseMove),document.removeEventListener("mouseup",this.handleDocumentMouseUp),this.copiedTimer&&clearTimeout(this.copiedTimer),this.debounceTimer&&clearTimeout(this.debounceTimer)}attributeChangedCallback(e){this.mounted&&("value"!==e&&"default-value"!==e||this.syncFromValueAttr(!1),this.update())}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getOption(e,t,s){const i=this.getAttribute(e);return i&&t.includes(i)?i:s}getIconSize(){return getDbComponentIconSize(this.getOption("size",Ut,"m"))}getRgb(){return((e,t,s)=>{const i=(s/=100)*(t/=100),n=i*(1-Math.abs(e/60%2-1)),a=s-i;let r=0,o=0,l=0;return e>=0&&e<60?(r=i,o=n,l=0):e<120?(r=n,o=i,l=0):e<180?(r=0,o=i,l=n):e<240?(r=0,o=n,l=i):e<300?(r=n,o=0,l=i):(r=i,o=0,l=n),{r:Math.round(255*(r+a)),g:Math.round(255*(o+a)),b:Math.round(255*(l+a))}})(this.h,this.s,this.v)}getHex(){const e=this.getRgb();return((e,t,s)=>{const h=e=>clamp(Math.round(e),0,255).toString(16).padStart(2,"0");return`#${h(e)}${h(t)}${h(s)}`.toUpperCase()})(e.r,e.g,e.b)}getHsl(){const e=this.getRgb();return((e,t,s)=>{e/=255,t/=255,s/=255;const i=Math.max(e,t,s),n=Math.min(e,t,s);let a=0,r=0;const o=(i+n)/2;if(i!==n){const l=i-n;switch(r=o>.5?l/(2-i-n):l/(i+n),i){case e:a=(t-s)/l+(t<s?6:0);break;case t:a=(s-e)/l+2;break;case s:a=(e-t)/l+4}a*=60}return{h:a,s:100*r,l:100*o}})(e.r,e.g,e.b)}getUiFormatted(){const e=this.getRgb(),t=this.getHex(),s=this.getHsl();return((e,t,s,i,n)=>{const a=n/100;switch(e){case"hex":default:return s;case"rgb":return`rgb(${t.r}, ${t.g}, ${t.b})`;case"rgba":return`rgba(${t.r}, ${t.g}, ${t.b}, ${a.toFixed(2)})`;case"hsl":return`hsl(${Math.round(i.h)}, ${Math.round(i.s)}%, ${Math.round(i.l)}%)`;case"hsla":return`hsla(${Math.round(i.h)}, ${Math.round(i.s)}%, ${Math.round(i.l)}%, ${a.toFixed(2)})`}})(this.format,e,t,s,this.a)}getOutward(){return"hex"===("ui"===this.getAttribute("on-change-format")?"ui":"hex")?this.getHex():this.getUiFormatted()}syncFromValueAttr(e){const t=this.getAttribute("value")??(e?this.getAttribute("default-value"):null)??(e?Jt:null);if(null==t)return;const s=normalizeHex(t);if(!isHex(s))return;if(!e&&this.suppressNextValueSync&&s===this.lastEmittedHex)return void(this.suppressNextValueSync=!1);const i=hexToRgb$1(s);if(!i)return;const n=rgbToHsv(i.r,i.g,i.b);this.h=n.h,this.s=n.s,this.v=n.v,this.colorInput=s,this.lastEmittedHex=s}actuallyEmit(){const e=normalizeHex(this.getHex()),t=this.hasAttribute("value")&&isHex(this.getAttribute("value")||"")?normalizeHex(this.getAttribute("value")||""):null;t&&t===e||this.lastEmittedHex!==e&&(this.lastEmittedHex=e,this.suppressNextValueSync=!0,this.setAttribute("value",e),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:this.getOutward()},bubbles:!0,composed:!0})))}scheduleEmit(){const e=this.getBool("emit-during-drag",!0);if(this.dragging&&!e)return;const t=Number(this.getAttribute("change-debounce-ms")||"0");if(t>0)return this.debounceTimer&&clearTimeout(this.debounceTimer),void(this.debounceTimer=setTimeout(()=>this.actuallyEmit(),t));this.actuallyEmit()}onColorStateChanged(e=!1){this.didMount?(!e||this.getBool("emit-during-drag",!0),this.scheduleEmit()):this.didMount=!0}updateFromArea(e,t){const s=this.colorFieldEl;if(!s)return;const i=s.getBoundingClientRect(),n=clamp(e-i.left,0,i.width),a=clamp(t-i.top,0,i.height);this.s=n/i.width*100,this.v=100-a/i.height*100,this.updateVisuals(),this.onColorStateChanged()}getInputValue(e){return e?e.getAttribute("value")??"":""}setInputValue(e,t){e&&void 0!==t&&e.setAttribute("value",t)}getPanelControlSize(){return"s"===this.getOption("size",Ut,"m")?"s":"m"}commitColorInput(e){const t=("trigger"===e?this.triggerInputEl?.value:this.getInputValue(this.panelValueInputEl)??"").trim();if(/^#([0-9A-Fa-f]{6})$/.test(t)){const e=hexToRgb$1(t),s=rgbToHsv(e.r,e.g,e.b);return this.h=s.h,this.s=s.s,this.v=s.v,this.colorInput=normalizeHex(t),this.updateVisuals(),void this.onColorStateChanged()}let s=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(t);if(s){const e=clamp(parseInt(s[1],10),0,255),t=clamp(parseInt(s[2],10),0,255),i=clamp(parseInt(s[3],10),0,255),n=rgbToHsv(e,t,i);return this.h=n.h,this.s=n.s,this.v=n.v,this.colorInput=`rgb(${e}, ${t}, ${i})`,this.updateVisuals(),void this.onColorStateChanged()}if(s=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i.exec(t),s){const e=clamp(parseInt(s[1],10),0,255),t=clamp(parseInt(s[2],10),0,255),i=clamp(parseInt(s[3],10),0,255),n=parseFloat(s[4]),a=rgbToHsv(e,t,i);this.h=a.h,this.s=a.s,this.v=a.v,this.a=Math.round(100*n),this.alphaInput=String(this.a),this.colorInput=`rgba(${e}, ${t}, ${i}, ${n})`,this.updateVisuals(),this.onColorStateChanged()}}commitAlphaInput(){const e=Number(this.getInputValue(this.panelAlphaInputEl).trim()||this.alphaInput);if(!Number.isNaN(e)&&e>=0&&e<=100){const t=Math.round(e);this.a=t,this.alphaInput=String(t),this.updateVisuals(),this.onColorStateChanged()}else this.alphaInput=String(this.a),this.panelAlphaInputEl&&this.setInputValue(this.panelAlphaInputEl,this.alphaInput)}async onCopy(){try{await navigator.clipboard.writeText(this.getUiFormatted()),this.isCopied=!0,this.updateCopyButtons(),this.copiedTimer&&clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout(()=>{this.isCopied=!1,this.updateCopyButtons()},1600)}catch{}}async onEyedrop(){try{if("EyeDropper"in window){const e=new window.EyeDropper,{sRGBHex:t}=await e.open(),s=hexToRgb$1(t);if(!s)return;const i=rgbToHsv(s.r,s.g,s.b);this.h=i.h,this.s=i.s,this.v=i.v,this.updateVisuals(),this.onColorStateChanged()}}catch{}}toggleOpen(){if(this.getBool("disabled")||this.getBool("readonly"))return;if("modal"===this.getOption("type",Wt,"dropdown"))return this.tempColor=this.getHex(),this.open=!0,void this.update();this.open=!this.open,this.update()}mount(){this.mounted=!0;const e=this.getIconSize();this.triggerEl=document.createElement("div"),this.triggerEl.className="designbase-wc-color-picker__trigger",this.triggerEl.addEventListener("click",()=>this.toggleOpen());const t=document.createElement("div");t.className="designbase-wc-color-picker__color-display",this.colorBoxEl=document.createElement("div"),this.colorBoxEl.className="designbase-wc-color-picker__color-box",t.append(this.colorBoxEl),this.triggerInputEl=document.createElement("input"),this.triggerInputEl.type="text",this.triggerInputEl.className="designbase-wc-color-picker__input",this.triggerInputEl.placeholder="#000000",this.triggerInputEl.addEventListener("click",e=>e.stopPropagation()),this.triggerInputEl.addEventListener("focus",()=>{this.triggerInputFocused=!0}),this.triggerInputEl.addEventListener("blur",()=>{this.triggerInputFocused=!1;const e="hex"===this.format?normalizeHex(this.getUiFormatted()):this.getUiFormatted();this.triggerInputEl&&this.triggerInputEl.value!==e&&(this.triggerInputEl.value=e,this.colorInput=e)}),this.triggerInputEl.addEventListener("input",()=>{this.triggerInputEl&&(this.colorInput=this.triggerInputEl.value)}),this.triggerInputEl.addEventListener("keydown",e=>{"Enter"===e.key&&this.commitColorInput("trigger")});const s=document.createElement("div");s.className="designbase-wc-color-picker__trigger-actions",this.triggerCopyBtn=document.createElement("button"),this.triggerCopyBtn.type="button",this.triggerCopyBtn.className="designbase-wc-color-picker__copy-button-inline",this.triggerCopyBtn.setAttribute("aria-label","Copy color value"),this.triggerCopyBtn.addEventListener("click",e=>{e.stopPropagation(),this.onCopy()}),this.toggleBtn=document.createElement("button"),this.toggleBtn.type="button",this.toggleBtn.className="designbase-wc-color-picker__toggle",this.toggleBtn.setAttribute("aria-label","Toggle color picker"),this.toggleBtn.append(createDbIcon("chevron-down",e)),s.append(this.triggerCopyBtn,this.toggleBtn),this.triggerEl.append(t,this.triggerInputEl,s),this.dropdownEl=document.createElement("div"),this.dropdownEl.className="designbase-wc-color-picker__dropdown",this.dropdownEl.addEventListener("click",e=>e.stopPropagation()),this.dropdownEl.hidden=!0;const i=document.createElement("div");i.className="designbase-wc-color-picker__selector";const n=document.createElement("div");n.className="designbase-wc-color-picker__color-area",this.colorFieldEl=document.createElement("div"),this.colorFieldEl.className="designbase-wc-color-picker__color-field",this.colorPointerEl=document.createElement("div"),this.colorPointerEl.className="designbase-wc-color-picker__color-pointer",this.colorFieldEl.append(this.colorPointerEl),this.colorFieldEl.addEventListener("mousedown",e=>{this.getBool("disabled")||this.getBool("readonly")||(e.preventDefault(),this.dragging="area",this.updateFromArea(e.clientX,e.clientY))}),this.colorFieldEl.addEventListener("touchstart",e=>{if(this.getBool("disabled")||this.getBool("readonly"))return;this.dragging="area";const t=e.touches[0];this.updateFromArea(t.clientX,t.clientY)},{passive:!0}),this.colorFieldEl.addEventListener("touchmove",e=>{if("area"!==this.dragging)return;const t=e.touches[0];this.updateFromArea(t.clientX,t.clientY)},{passive:!0}),this.colorFieldEl.addEventListener("touchend",()=>{"area"===this.dragging&&(this.dragging=null,this.onColorStateChanged(!0))}),n.append(this.colorFieldEl);const a=document.createElement("div");a.className="designbase-wc-color-picker__controls",this.eyedropperBtnEl=document.createElement("db-button"),this.eyedropperBtnEl.setAttribute("variant","tertiary"),this.eyedropperBtnEl.setAttribute("size",this.getPanelControlSize()),this.eyedropperBtnEl.setAttribute("icon-only",""),this.eyedropperBtnEl.setAttribute("start-icon","eyedropper"),this.eyedropperBtnEl.setAttribute("aria-label","Eyedropper tool"),this.eyedropperBtnEl.addEventListener("click",()=>{this.onEyedrop()});const r=document.createElement("div");r.className="designbase-wc-color-picker__slider-container";const o=document.createElement("div");o.className="designbase-wc-color-picker__hue-slider",this.hueSliderEl=document.createElement("input"),this.hueSliderEl.type="range",this.hueSliderEl.min="0",this.hueSliderEl.max="360",this.hueSliderEl.className="designbase-wc-color-picker__slider designbase-wc-color-picker__slider--hue",this.hueSliderEl.addEventListener("input",()=>{this.h=parseFloat(this.hueSliderEl.value),this.updateVisuals(),this.onColorStateChanged()}),o.append(this.hueSliderEl),this.alphaSliderWrapEl=document.createElement("div"),this.alphaSliderWrapEl.className="designbase-wc-color-picker__alpha-slider",this.alphaSliderEl=document.createElement("input"),this.alphaSliderEl.type="range",this.alphaSliderEl.min="0",this.alphaSliderEl.max="100",this.alphaSliderEl.className="designbase-wc-color-picker__slider designbase-wc-color-picker__slider--alpha",this.alphaSliderEl.addEventListener("input",()=>{this.a=clamp(parseInt(this.alphaSliderEl.value,10),0,100),this.alphaInput=String(this.a),this.panelAlphaInputEl&&this.setInputValue(this.panelAlphaInputEl,this.alphaInput),this.updateVisuals(),this.onColorStateChanged()}),this.alphaSliderWrapEl.append(this.alphaSliderEl),r.append(o,this.alphaSliderWrapEl),a.append(this.eyedropperBtnEl,r);const l=document.createElement("div");l.className="designbase-wc-color-picker__value-display",this.formatSelectEl=document.createElement("db-select"),this.formatSelectEl.setAttribute("size","s"),this.formatSelectEl.setAttribute("position","top"),this.formatSelectEl.setAttribute("show-clear-button","false"),this.formatSelectEl.setAttribute("options",Xt),this.formatSelectEl.addEventListener("db-change",e=>{const t=e.detail,s=t?.value;s&&(this.format=s,this.updateVisuals())}),this.panelValueInputEl=document.createElement("db-input"),this.panelValueInputEl.classList.add("designbase-wc-color-picker__value-input"),this.panelValueInputEl.setAttribute("size","s"),this.panelValueInputEl.setAttribute("placeholder","#000000"),this.panelValueInputEl.addEventListener("db-focus",()=>{this.panelInputFocused=!0}),this.panelValueInputEl.addEventListener("db-blur",()=>{this.panelInputFocused=!1;const e="hex"===this.format?normalizeHex(this.getUiFormatted()):this.getUiFormatted();this.getInputValue(this.panelValueInputEl)!==e&&(this.setInputValue(this.panelValueInputEl,e),this.colorInput=e)}),this.panelValueInputEl.addEventListener("db-input",e=>{const t=e.detail;void 0!==t?.value&&(this.colorInput=t.value)}),this.panelValueInputEl.addEventListener("keydown",e=>{"Enter"===e.key&&this.commitColorInput("panel")}),this.panelAlphaWrapEl=document.createElement("div"),this.panelAlphaWrapEl.className="designbase-wc-color-picker__alpha-input-wrap",this.panelAlphaInputEl=document.createElement("db-input"),this.panelAlphaInputEl.classList.add("designbase-wc-color-picker__alpha-input"),this.panelAlphaInputEl.setAttribute("size","s"),this.panelAlphaInputEl.setAttribute("placeholder","100"),this.panelAlphaInputEl.setAttribute("aria-label","Alpha percent"),this.panelAlphaInputEl.addEventListener("db-focus",()=>{this.panelAlphaInputFocused=!0}),this.panelAlphaInputEl.addEventListener("db-blur",()=>{this.panelAlphaInputFocused=!1,this.commitAlphaInput()}),this.panelAlphaInputEl.addEventListener("db-input",e=>{const t=e.detail,s=(t?.value??"").replace(/[^\d]/g,"").slice(0,3);s!==t?.value&&this.setInputValue(this.panelAlphaInputEl,s),this.alphaInput=s}),this.panelAlphaInputEl.addEventListener("keydown",e=>{"Enter"===e.key&&this.commitAlphaInput()});const d=document.createElement("span");d.className="designbase-wc-color-picker__alpha-suffix",d.textContent="%",this.panelAlphaWrapEl.append(this.panelAlphaInputEl,d),this.panelCopyBtnEl=document.createElement("db-button"),this.panelCopyBtnEl.setAttribute("variant","tertiary"),this.panelCopyBtnEl.setAttribute("size","s"),this.panelCopyBtnEl.setAttribute("icon-only",""),this.panelCopyBtnEl.setAttribute("start-icon","copy"),this.panelCopyBtnEl.setAttribute("aria-label","Copy color value"),this.panelCopyBtnEl.addEventListener("click",()=>{this.onCopy()}),l.append(this.formatSelectEl,this.panelValueInputEl,this.panelAlphaWrapEl,this.panelCopyBtnEl),i.append(n,a,l),this.selectorEl=i,this.dropdownEl.append(i),this.modalEl=document.createElement("db-modal"),this.modalEl.setAttribute("size","s"),this.modalEl.setAttribute("title","색상 선택"),this.modalEl.setAttribute("close-on-escape","true"),this.modalEl.addEventListener("db-close",this.handleModalCancel),this.modalBodyEl=document.createElement("div"),this.modalBodyEl.setAttribute("data-modal-part","body");const u=document.createElement("div");u.setAttribute("data-modal-part","footer"),u.style.display="flex",u.style.gap="8px",u.style.justifyContent="flex-end";const b=document.createElement("db-button");b.setAttribute("variant","tertiary"),b.setAttribute("size","m"),b.textContent="취소",b.addEventListener("click",this.handleModalCancel);const m=document.createElement("db-button");m.setAttribute("variant","primary"),m.setAttribute("size","m"),m.textContent="적용",m.addEventListener("click",this.handleModalApply),u.append(b,m),this.modalEl.append(this.modalBodyEl,u),this.replaceChildren(this.triggerEl,this.dropdownEl,this.modalEl)}updateCopyButtons(){const e=this.getIconSize(),t=this.isCopied?"done":"copy";this.triggerCopyBtn&&this.triggerCopyBtn.replaceChildren(createDbIcon(t,e)),this.panelCopyBtnEl&&this.panelCopyBtnEl.setAttribute("start-icon",t)}updateVisuals(){const e=this.getRgb(),t=this.getHex(),s=this.getBool("show-alpha",!0),i=this.getUiFormatted(),n="hex"===this.format?normalizeHex(i):i;!this.triggerInputFocused&&this.triggerInputEl&&(this.triggerInputEl.value=n),!this.panelInputFocused&&this.panelValueInputEl&&this.setInputValue(this.panelValueInputEl,n),this.colorBoxEl&&(this.colorBoxEl.style.backgroundColor=s?`rgba(${e.r}, ${e.g}, ${e.b}, ${this.a/100})`:t),this.colorFieldEl&&(this.colorFieldEl.style.backgroundImage=`\n linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0)),\n linear-gradient(to right, #ffffff, hsl(${this.h}, 100%, 50%))\n `),this.colorPointerEl&&(this.colorPointerEl.style.left=`${this.s}%`,this.colorPointerEl.style.top=100-this.v+"%",this.colorPointerEl.style.backgroundColor=`rgb(${e.r}, ${e.g}, ${e.b})`),this.hueSliderEl&&(this.hueSliderEl.value=String(this.h),this.hueSliderEl.style.background="linear-gradient(to right,\n hsl(0,100%,50%),\n hsl(60,100%,50%),\n hsl(120,100%,50%),\n hsl(180,100%,50%),\n hsl(240,100%,50%),\n hsl(300,100%,50%),\n hsl(360,100%,50%))"),this.alphaSliderEl&&(this.alphaSliderEl.value=String(this.a),this.alphaSliderEl.style.backgroundImage=`\n linear-gradient(45deg, var(--db-border-base) 25%, transparent 25%),\n linear-gradient(-45deg, var(--db-border-base) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--db-border-base) 75%),\n linear-gradient(-45deg, transparent 75%, var(--db-border-base) 75%),\n linear-gradient(to right, rgba(${e.r}, ${e.g}, ${e.b}, 0), rgba(${e.r}, ${e.g}, ${e.b}, 1))\n `,this.alphaSliderEl.style.backgroundSize="8px 8px,8px 8px,8px 8px,8px 8px,100% 100%",this.alphaSliderEl.style.backgroundPosition="0 0,0 4px,4px -4px,-4px 0,0 0",this.alphaSliderEl.style.backgroundColor="var(--db-surface-base)"),this.panelAlphaInputEl&&!this.panelAlphaInputFocused&&this.setInputValue(this.panelAlphaInputEl,this.alphaInput),this.formatSelectEl&&this.formatSelectEl.getAttribute("value")!==this.format&&this.formatSelectEl.setAttribute("value",this.format),this.colorInput=n}update(){if(!this.mounted)return;const e=this.getOption("size",Ut,"m"),t=this.getOption("type",Wt,"dropdown"),s=this.getOption("position",Gt,"bottom-start"),i=this.getBool("disabled"),n=this.getBool("readonly"),a=this.getBool("show-input",!0),r=this.getBool("show-alpha",!0),o=this.getBool("show-format-selector",!0),l=this.getBool("show-copy-button",!0),d=this.getBool("show-eyedropper",!0),u="undefined"!=typeof window&&"EyeDropper"in window;if(this.className=["designbase-wc-color-picker",`designbase-wc-color-picker--${e}`,`designbase-wc-color-picker--${s}`,this.open&&"dropdown"===t&&"designbase-wc-color-picker--open",this.getBool("full-width")&&"designbase-wc-color-picker--full-width",this.getBool("error")&&"designbase-wc-color-picker--error",i&&"designbase-wc-color-picker--disabled",n&&"designbase-wc-color-picker--readonly",!a&&"designbase-wc-color-picker--no-input"].filter(Boolean).join(" "),this.triggerInputEl&&(this.triggerInputEl.hidden=!a,this.triggerInputEl.disabled=i,this.triggerInputEl.readOnly=n),this.triggerCopyBtn&&(this.triggerCopyBtn.hidden=!(a&&l),this.triggerCopyBtn.disabled=i),this.toggleBtn&&(this.toggleBtn.disabled=i),this.dropdownEl&&(this.dropdownEl.className=`designbase-wc-color-picker__dropdown designbase-wc-color-picker__dropdown--${s}`,this.dropdownEl.hidden=!("dropdown"===t&&this.open)),this.alphaSliderWrapEl&&(this.alphaSliderWrapEl.hidden=!r),this.panelAlphaWrapEl&&(this.panelAlphaWrapEl.hidden=!r),this.formatSelectEl&&(this.formatSelectEl.hidden=!o),this.panelCopyBtnEl&&(this.panelCopyBtnEl.hidden=!l),this.eyedropperBtnEl&&(this.eyedropperBtnEl.hidden=!(d&&u)),this.selectorEl){const e="modal"===t?this.modalBodyEl:this.dropdownEl;e&&this.selectorEl.parentElement!==e&&e.append(this.selectorEl)}this.modalEl&&("modal"===t&&this.open?this.modalEl.setAttribute("open","true"):this.modalEl.removeAttribute("open")),this.updateCopyButtons(),this.updateVisuals()}}customElements.get("db-color-picker")||customElements.define("db-color-picker",DbColorPicker);const Zt=["default","bordered","filled","minimal"],Qt=["s","m","l"],es=["vertical","horizontal"];class DbReorder extends HTMLElement{constructor(){super(...arguments),this.draggedIndex=-1,this.dropIndex=-1,this.handleContainerDragOver=e=>{if(this.draggedIndex<0)return;const t=e.target;if(t instanceof Element&&t.closest(".designbase-wc-reorder__item"))return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");const s=this.getDropIndexFromContainerPointer(e);this.setDropIndex(this.isValidDropIndex(s)?s:-1)},this.handleContainerDrop=e=>{if(this.draggedIndex<0)return;const t=e.target;if(t instanceof Element&&t.closest(".designbase-wc-reorder__item"))return;e.preventDefault();const s=this.dropIndex>=0?this.dropIndex:this.getDropIndexFromContainerPointer(e);this.commitDrop(s)}}static get observedAttributes(){return["items","variant","size","orientation","selectable","multi-select","show-drag-handle","show-drag-icon","full-width","disabled"]}get items(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.addEventListener("dragover",this.handleContainerDragOver),this.addEventListener("drop",this.handleContainerDrop),this.render()}disconnectedCallback(){this.removeEventListener("dragover",this.handleContainerDragOver),this.removeEventListener("drop",this.handleContainerDrop)}attributeChangedCallback(){this.render()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getOption(e,t,s){const i=this.getAttribute(e);return i&&t.includes(i)?i:s}emitReorder(e){this.items=e,this.dispatchEvent(new CustomEvent("db-reorder",{detail:{items:e},bubbles:!0,composed:!0}))}getItemElements(){return Array.from(this.children).filter(e=>e instanceof HTMLElement&&e.classList.contains("designbase-wc-reorder__item"))}updateDragClasses(){const e=this.getOption("orientation",es,"vertical"),t=this.draggedIndex>=0,s=this.items.length,i=t&&this.isValidDropIndex(this.dropIndex);this.classList.toggle("designbase-wc-reorder--dragging",t),this.getItemElements().forEach((n,a)=>{const r=t&&this.draggedIndex===a,o=i&&this.dropIndex===a,l=i&&this.dropIndex===s&&a===s-1,d=o||l;n.classList.toggle("designbase-wc-reorder__item--dragged",r),n.classList.toggle("designbase-wc-reorder__item--drag-over",d),n.classList.toggle("designbase-wc-reorder__item--drag-down",o&&"vertical"===e),n.classList.toggle("designbase-wc-reorder__item--drag-up",l&&"vertical"===e),n.classList.toggle("designbase-wc-reorder__item--drag-right",o&&"horizontal"===e),n.classList.toggle("designbase-wc-reorder__item--drag-left",l&&"horizontal"===e)})}getAdjustedDropIndex(e=this.dropIndex){return this.draggedIndex<0||e<0?-1:e>this.draggedIndex?e-1:e}isValidDropIndex(e=this.dropIndex){const t=this.getAdjustedDropIndex(e);return t>=0&&t!==this.draggedIndex}getDropIndexFromPointer(e,t,s,i){const n=t.getBoundingClientRect();return("horizontal"===i?e.clientX-n.left:e.clientY-n.top)<("horizontal"===i?n.width/2:n.height/2)?s:s+1}getDropIndexFromContainerPointer(e){const t=this.getOption("orientation",es,"vertical"),s=this.getItemElements();if(0===s.length)return-1;const i="horizontal"===t?e.clientX:e.clientY;for(let e=0;e<s.length;e+=1){const n=s[e].getBoundingClientRect();if(i<("horizontal"===t?n.left:n.top)+("horizontal"===t?n.width:n.height)/2)return e}return s.length}commitDrop(e){const t=this.getAdjustedDropIndex(e);if(this.draggedIndex<0||t<0||t===this.draggedIndex)return void this.resetDragState();const s=[...this.items],[i]=s.splice(this.draggedIndex,1);s.splice(t,0,i),this.draggedIndex=-1,this.dropIndex=-1,this.emitReorder(s)}setDropIndex(e){this.dropIndex!==e&&(this.dropIndex=e,this.updateDragClasses())}resetDragState(){this.draggedIndex=-1,this.dropIndex=-1,this.updateDragClasses()}render(){const e=this.getOption("variant",Zt,"default"),t=this.getOption("size",Qt,"m"),s=this.getOption("orientation",es,"vertical"),i=this.getBool("disabled"),n=this.getBool("selectable"),a=this.getBool("multi-select"),r=this.getBool("show-drag-handle",!0),o=this.getBool("show-drag-icon",!0);this.className=["designbase-wc-reorder",`designbase-wc-reorder--${e}`,`designbase-wc-reorder--${t}`,`designbase-wc-reorder--${s}`,this.getBool("full-width")&&"designbase-wc-reorder--full-width",i&&"designbase-wc-reorder--disabled",n&&"designbase-wc-reorder--selectable"].filter(Boolean).join(" ");const l=document.createDocumentFragment();this.items.forEach((e,d)=>{const u=document.createElement("div"),b=i||!!e.disabled,m=this.draggedIndex===d,p=this.draggedIndex>=0&&this.isValidDropIndex(this.dropIndex),g=p&&this.dropIndex===d,v=p&&this.dropIndex===this.items.length&&d===this.items.length-1,E=g||v;if(u.className=["designbase-wc-reorder__item",e.selected&&"designbase-wc-reorder__item--selected",m&&"designbase-wc-reorder__item--dragged",b&&"designbase-wc-reorder__item--disabled",E&&"designbase-wc-reorder__item--drag-over",g&&"vertical"===s&&"designbase-wc-reorder__item--drag-down",v&&"vertical"===s&&"designbase-wc-reorder__item--drag-up",g&&"horizontal"===s&&"designbase-wc-reorder__item--drag-right",v&&"horizontal"===s&&"designbase-wc-reorder__item--drag-left"].filter(Boolean).join(" "),u.draggable=!b,u.addEventListener("dragstart",t=>{b||(this.draggedIndex=d,this.dropIndex=-1,t.dataTransfer&&(t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.id)),this.updateDragClasses())}),u.addEventListener("dragover",e=>{if(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this.draggedIndex<0)return void this.setDropIndex(-1);const t=this.getDropIndexFromPointer(e,u,d,s);this.setDropIndex(this.isValidDropIndex(t)?t:-1)}),u.addEventListener("dragleave",e=>{const t=u.getBoundingClientRect(),s=e.clientX-t.left,i=e.clientY-t.top;(s<0||s>t.width||i<0||i>t.height)&&this.setDropIndex(-1)}),u.addEventListener("drop",e=>{e.preventDefault();const t=this.dropIndex>=0?this.dropIndex:this.getDropIndexFromPointer(e,u,d,s);this.commitDrop(t)}),u.addEventListener("dragend",()=>{this.resetDragState()}),r&&!b){const e=document.createElement("div");if(e.className="designbase-wc-reorder__drag-handle",e.setAttribute("aria-hidden","true"),o){const i="horizontal"===s?"grip-horizontal":"grip-vertical",n="s"===t?14:"l"===t?18:16;e.append(createDbIcon(i,n))}else e.textContent="≡";u.append(e)}if(n){const t=document.createElement("div");t.className="designbase-wc-reorder__checkbox";const s=document.createElement("input");s.type=a?"checkbox":"radio",s.checked=!!e.selected,s.disabled=b,s.className="designbase-wc-reorder__checkbox-input",s.addEventListener("change",()=>{const t=this.items.map(t=>t.id!==e.id?a?t:{...t,selected:!1}:{...t,selected:!a||!t.selected});this.items=t,this.dispatchEvent(new CustomEvent("db-select",{detail:{items:t.filter(e=>e.selected)},bubbles:!0,composed:!0})),this.render()}),t.append(s),u.append(t)}const f=document.createElement("div");f.className="designbase-wc-reorder__content",f.textContent=e.content,u.append(f),l.append(u)}),this.replaceChildren(l)}}customElements.get("db-reorder")||customElements.define("db-reorder",DbReorder);const ts=["s","m","l"],ss=["low","medium","high","urgent"],is={low:"낮음",medium:"보통",high:"높음",urgent:"긴급"};class DbKanban extends HTMLElement{constructor(){super(...arguments),this.dragState=null,this.dropTarget=null,this.handleBoardDragOver=e=>{if(!this.dragState)return;const t=e.target;t instanceof Element&&(t.closest(".designbase-wc-kanban__card")||t.closest(".designbase-wc-kanban__column-body"))||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"))},this.handleBoardDrop=e=>{if(!this.dragState)return;const t=e.target;t instanceof Element&&(t.closest(".designbase-wc-kanban__card")||t.closest(".designbase-wc-kanban__column-body"))||(e.preventDefault(),this.commitDrop())}}static get observedAttributes(){return["columns","size","disabled","draggable","show-column-count","show-add-card","allow-cross-column","full-width","empty-column-text"]}get columns(){try{const e=JSON.parse(this.getAttribute("columns")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}set columns(e){this.setAttribute("columns","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.setAttribute("role","region"),this.setAttribute("aria-label","칸반 보드"),this.addEventListener("dragover",this.handleBoardDragOver),this.addEventListener("drop",this.handleBoardDrop),this.render()}disconnectedCallback(){this.removeEventListener("dragover",this.handleBoardDragOver),this.removeEventListener("drop",this.handleBoardDrop)}attributeChangedCallback(){this.isConnected&&this.render()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getOption(e,t,s){const i=this.getAttribute(e);return i&&t.includes(i)?i:s}emitChange(e){this.columns=e,this.dispatchEvent(new CustomEvent("db-change",{detail:{columns:e},bubbles:!0,composed:!0}))}emitCardMove(e,t){this.columns=e,this.dispatchEvent(new CustomEvent("db-card-move",{detail:{...t,columns:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{columns:e},bubbles:!0,composed:!0}))}findCardLocation(e){for(const t of this.columns){const s=t.cards.findIndex(t=>t.id===e);if(s>=0)return{columnId:t.id,index:s}}return null}getAdjustedDropIndex(e,t){if(!this.dragState)return-1;const{columnId:s,cardIndex:i}=this.dragState;return s===e&&t>i?t-1:t}isValidDropTarget(e=this.dropTarget){if(!this.dragState||!e)return!1;const t=this.getAdjustedDropIndex(e.columnId,e.index);return!(t<0)&&(this.dragState.columnId!==e.columnId||t!==this.dragState.cardIndex)}moveCard(e,t,s){const i=this.findCardLocation(e);if(!i)return;const n=this.columns.map(e=>({...e,cards:[...e.cards]})),a=n.find(e=>e.id===i.columnId),r=n.find(e=>e.id===t);if(!a||!r)return;const[o]=a.cards.splice(i.index,1);if(!o)return;const l=this.getAdjustedDropIndex(t,s);r.cards.splice(Math.max(0,l),0,o),this.emitCardMove(n,{cardId:e,fromColumnId:i.columnId,toColumnId:t,fromIndex:i.index,toIndex:Math.max(0,l)})}setDropTarget(e){const t=e&&this.isValidDropTarget(e)?e:null;(this.dropTarget?`${this.dropTarget.columnId}:${this.dropTarget.index}`:"")!==(t?`${t.columnId}:${t.index}`:"")&&(this.dropTarget=t,this.updateDragClasses())}resetDragState(){this.dragState=null,this.dropTarget=null,this.classList.remove("designbase-wc-kanban--dragging"),this.updateDragClasses()}updateDragClasses(){const e=!!this.dragState;this.classList.toggle("designbase-wc-kanban--dragging",e),this.querySelectorAll(".designbase-wc-kanban__card").forEach(t=>{const s=t.dataset.cardId||"",i=e&&this.dragState?.cardId===s;t.classList.toggle("designbase-wc-kanban__card--dragged",i)}),this.querySelectorAll(".designbase-wc-kanban__column-body").forEach(e=>{const t=e.dataset.columnId||"",s=!!this.dropTarget&&this.dropTarget.columnId===t;e.classList.toggle("designbase-wc-kanban__column-body--drag-over",s)}),this.querySelectorAll(".designbase-wc-kanban__card").forEach(e=>{const t=e.dataset.columnId||"",s=Number(e.dataset.cardIndex||-1),i=!!this.dropTarget&&this.dropTarget.columnId===t&&this.dropTarget.index===s,n=this.columns.find(e=>e.id===t),a=!!this.dropTarget&&this.dropTarget.columnId===t&&n&&this.dropTarget.index===n.cards.length&&s===n.cards.length-1;e.classList.toggle("designbase-wc-kanban__card--drop-before",i),e.classList.toggle("designbase-wc-kanban__card--drop-after",a)})}getDropIndexFromPointer(e,t,s){const i=t.getBoundingClientRect();return e.clientY-i.top<i.height/2?s:s+1}getDropIndexFromColumnPointer(e,t){const s=Array.from(this.querySelectorAll(`.designbase-wc-kanban__column-body[data-column-id="${t}"] > .designbase-wc-kanban__card`));if(0===s.length)return 0;for(let t=0;t<s.length;t+=1){const i=s[t].getBoundingClientRect();if(e.clientY<i.top+i.height/2)return t}return s.length}commitDrop(){if(!this.dragState||!this.dropTarget||!this.isValidDropTarget())return void this.resetDragState();const{cardId:e}=this.dragState,{columnId:t,index:s}=this.dropTarget;this.resetDragState(),this.moveCard(e,t,s),this.render()}formatDueDate(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("ko-KR",{month:"short",day:"numeric"})}getInitials(e){return e.initials?e.initials:e.name.split(/\s+/).map(e=>e.charAt(0)).join("").slice(0,2).toUpperCase()}createTag(e){const t=document.createElement("span");return t.className=["designbase-wc-kanban__tag",e.variant&&`designbase-wc-kanban__tag--${e.variant}`].filter(Boolean).join(" "),t.textContent=e.label,t}createPriorityBadge(e){const t=document.createElement("span");return t.className=`designbase-wc-kanban__priority designbase-wc-kanban__priority--${e}`,t.textContent=is[e],t.setAttribute("aria-label",`우선순위 ${is[e]}`),t}createAssignee(e){const t=document.createElement("div");if(t.className="designbase-wc-kanban__assignee",t.title=e.name,e.avatar){const s=document.createElement("img");s.className="designbase-wc-kanban__assignee-avatar",s.src=e.avatar,s.alt=e.name,t.append(s)}else{const s=document.createElement("span");s.className="designbase-wc-kanban__assignee-initials",s.textContent=this.getInitials(e),t.append(s)}const s=document.createElement("span");return s.className="designbase-wc-kanban__assignee-name",s.textContent=e.name,t.append(s),t}bindCardDrag(e,t,s,i,n,a){e.draggable=n&&!a&&!t.disabled,e.addEventListener("dragstart",e=>{!n||a||t.disabled||(this.dragState={cardId:t.id,columnId:s,cardIndex:i},this.dropTarget=null,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.id)),this.classList.add("designbase-wc-kanban--dragging"),this.updateDragClasses())}),e.addEventListener("dragover",t=>{if(!this.dragState)return;t.preventDefault(),t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.dropEffect="move");if(!this.getBool("allow-cross-column",!0)&&this.dragState.columnId!==s)return;const n=this.getDropIndexFromPointer(t,e,i);this.setDropTarget({columnId:s,index:n})}),e.addEventListener("dragleave",t=>{const s=e.getBoundingClientRect(),i=t.clientX-s.left,n=t.clientY-s.top;(i<0||i>s.width||n<0||n>s.height)&&this.setDropTarget(null)}),e.addEventListener("drop",e=>{e.preventDefault(),e.stopPropagation(),this.commitDrop()}),e.addEventListener("dragend",()=>{this.resetDragState(),this.render()})}createCard(e,t,s,i){const n=document.createElement("article");n.className=["designbase-wc-kanban__card",e.disabled&&"designbase-wc-kanban__card--disabled",e.priority&&`designbase-wc-kanban__card--priority-${e.priority}`].filter(Boolean).join(" "),n.dataset.cardId=e.id,n.dataset.columnId=t,n.dataset.cardIndex=String(s),n.setAttribute("role","listitem"),n.tabIndex=e.disabled?-1:0;const a=document.createElement("div");a.className="designbase-wc-kanban__card-title-row";const r=document.createElement("h4");if(r.className="designbase-wc-kanban__card-title",r.textContent=e.title,a.append(r),e.priority&&ss.includes(e.priority)&&a.append(this.createPriorityBadge(e.priority)),n.append(a),e.description){const t=document.createElement("p");t.className="designbase-wc-kanban__card-description",t.textContent=e.description,n.append(t)}if(e.tags?.length){const t=document.createElement("div");t.className="designbase-wc-kanban__card-tags",e.tags.forEach(e=>t.append(this.createTag(e))),n.append(t)}const o=document.createElement("div");if(o.className="designbase-wc-kanban__card-footer",e.assignee&&o.append(this.createAssignee(e.assignee)),e.dueDate){const t=document.createElement("span");t.className="designbase-wc-kanban__due-date",t.append(createDbIcon("calendar","l"===i.size?12:"m"===i.size?11:10));const s=document.createElement("span");s.textContent=this.formatDueDate(e.dueDate),t.append(s),o.append(t)}return o.childNodes.length>0&&n.append(o),n.addEventListener("click",s=>{i.disabled||this.dispatchEvent(new CustomEvent("db-card-click",{detail:{card:e,columnId:t},bubbles:!0,composed:!0}))}),n.addEventListener("keydown",s=>{"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),this.dispatchEvent(new CustomEvent("db-card-click",{detail:{card:e,columnId:t},bubbles:!0,composed:!0})))}),this.bindCardDrag(n,e,t,s,i.draggable,i.disabled),n}createColumn(e,t){const s=document.createElement("section"),i=void 0!==e.limit&&e.cards.length>e.limit;s.className=["designbase-wc-kanban__column",i&&"designbase-wc-kanban__column--over-limit"].filter(Boolean).join(" "),s.dataset.columnId=e.id,s.setAttribute("role","group"),s.setAttribute("aria-label",e.title);const n=document.createElement("header");n.className="designbase-wc-kanban__column-header";const a=document.createElement("div");if(a.className="designbase-wc-kanban__column-title-wrap",e.color){const t=document.createElement("span");t.className="designbase-wc-kanban__column-color",t.style.backgroundColor=e.color,t.setAttribute("aria-hidden","true"),a.append(t)}const r=document.createElement("h3");if(r.className="designbase-wc-kanban__column-title",r.textContent=e.title,a.append(r),n.append(a),t.showColumnCount){const t=document.createElement("span");t.className="designbase-wc-kanban__column-count",t.textContent=void 0!==e.limit?`${e.cards.length}/${e.limit}`:String(e.cards.length),n.append(t)}s.append(n);const o=document.createElement("div");if(o.className="designbase-wc-kanban__column-body",o.dataset.columnId=e.id,o.setAttribute("role","list"),o.addEventListener("dragover",t=>{if(!this.dragState)return;t.preventDefault(),t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.dropEffect="move");if(!this.getBool("allow-cross-column",!0)&&this.dragState.columnId!==e.id)return;const s=this.getDropIndexFromColumnPointer(t,e.id);this.setDropTarget({columnId:e.id,index:s})}),o.addEventListener("drop",e=>{e.preventDefault(),e.stopPropagation(),this.commitDrop()}),0===e.cards.length){const e=document.createElement("div");e.className="designbase-wc-kanban__column-empty",e.textContent=t.emptyColumnText,o.append(e)}else e.cards.forEach((s,i)=>{o.append(this.createCard(s,e.id,i,{size:t.size,draggable:t.draggable,disabled:t.disabled}))});if(s.append(o),t.showAddCard&&!t.disabled){const i=document.createElement("button");i.type="button",i.className="designbase-wc-kanban__add-card",i.append(createDbIcon("plus","l"===t.size?14:"m"===t.size?12:10));const n=document.createElement("span");n.textContent="카드 추가",i.append(n),i.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-add-card",{detail:{columnId:e.id},bubbles:!0,composed:!0}))}),s.append(i)}return s}render(){const e=this.getOption("size",ts,"s"),t=this.getBool("disabled"),s=this.getBool("draggable",!0),i=this.getBool("show-column-count",!0),n=this.getBool("show-add-card"),a=this.getAttribute("empty-column-text")||"카드가 없습니다";this.className=["designbase-wc-kanban",`designbase-wc-kanban--${e}`,this.getBool("full-width")&&"designbase-wc-kanban--full-width",t&&"designbase-wc-kanban--disabled",this.classList.contains("designbase-wc-kanban--dragging")&&"designbase-wc-kanban--dragging"].filter(Boolean).join(" ");const r=document.createElement("div");r.className="designbase-wc-kanban__board";const o=document.createDocumentFragment();this.columns.forEach(r=>{o.append(this.createColumn(r,{size:e,draggable:s,showColumnCount:i,showAddCard:n,emptyColumnText:a,disabled:t}))}),r.append(o),this.replaceChildren(r),this.updateDragClasses()}}customElements.get("db-kanban")||customElements.define("db-kanban",DbKanban);const ns=["day","week"],as=["#86efac","#fde047","#93c5fd","#c4b5fd","#f9a8d4","#5eead4","#fdba74","#a5b4fc"],rs=["일","월","화","수","목","금","토"],os=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function parseDate(e){const[t,s,i]=e.split("-").map(Number);return new Date(t,s-1,i)}function toDateKey(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function addDays(e,t){const s=new Date(e);return s.setDate(s.getDate()+t),s}function daysBetween(e,t){const s=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),i=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((i-s)/864e5)}function clampDate(e,t,s){return e<t?new Date(t):e>s?new Date(s):e}class DbGantt extends HTMLElement{constructor(){super(...arguments),this.collapsedGroups=new Set,this.dragState=null,this.reorderState=null,this.reorderDropIndex=null,this.suppressRender=!1,this.didDrag=!1,this.handlePointerMove=e=>{if(this.reorderState&&e.pointerId===this.reorderState.pointerId)return void this.updateReorderDropTarget(e.clientY);if(!this.dragState||e.pointerId!==this.dragState.pointerId)return;const t=this.getOption("scale",ns,"day"),s=this.getNumber("cell-width","week"===t?72:44),{start:i,end:n}=this.getViewRange(),a=Math.round((e.clientX-this.dragState.startX)/s);0!==a&&(this.didDrag=!0);let r=new Date(this.dragState.originalStart),o=new Date(this.dragState.originalEnd);if("move"===this.dragState.mode?(r=addDays(this.dragState.originalStart,a),o=addDays(this.dragState.originalEnd,a)):"resize-start"===this.dragState.mode?(r=addDays(this.dragState.originalStart,a),r>o&&(r=new Date(o))):(o=addDays(this.dragState.originalEnd,a),o<r&&(o=new Date(r))),r=clampDate(r,i,n),o=clampDate(o,i,n),r>o)return;const l=this.items.find(e=>e.id===this.dragState.itemId);l&&this.applyBarGeometry(this.dragState.barEl,{...l,startDate:toDateKey(r),endDate:toDateKey(o)},i,s)},this.handlePointerUp=e=>{if(this.reorderState&&e.pointerId===this.reorderState.pointerId)return void this.finishReorderDrag(e);if(!this.dragState||e.pointerId!==this.dragState.pointerId)return;const t=this.getOption("scale",ns,"day"),s=this.getNumber("cell-width","week"===t?72:44),{start:i,end:n}=this.getViewRange(),a=Math.round((e.clientX-this.dragState.startX)/s);let r=new Date(this.dragState.originalStart),o=new Date(this.dragState.originalEnd);const l=this.dragState.mode,d=this.dragState.itemId;"move"===l?(r=addDays(this.dragState.originalStart,a),o=addDays(this.dragState.originalEnd,a)):"resize-start"===l?(r=addDays(this.dragState.originalStart,a),r>o&&(r=new Date(o))):(o=addDays(this.dragState.originalEnd,a),o<r&&(o=new Date(r))),r=clampDate(r,i,n),o=clampDate(o,i,n),this.dragState.barEl.releasePointerCapture(e.pointerId),this.dragState.barEl.classList.remove("designbase-wc-gantt__bar--dragging"),this.dragState=null;const u=this.items.find(e=>e.id===d);if(!u)return;const b=toDateKey(r),m=toDateKey(o);b===u.startDate&&m===u.endDate||(this.updateItem(d,{startDate:b,endDate:m},"move"===l?"move":"resize"),this.render())}}static get observedAttributes(){return["groups","rows","items","start-date","end-date","today","scale","cell-width","show-weekends","show-today","sidebar-label","full-width","disabled","draggable","reorderable","locale"]}get groups(){return this.parseJson("groups",[])}set groups(e){this.setAttribute("groups","string"==typeof e?e:JSON.stringify(e))}get rows(){return this.parseJson("rows",[])}set rows(e){this.setAttribute("rows","string"==typeof e?e:JSON.stringify(e))}get items(){return this.parseJson("items",[])}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.setAttribute("role","region"),this.setAttribute("aria-label","프로젝트 타임라인"),this.addEventListener("pointermove",this.handlePointerMove),this.addEventListener("pointerup",this.handlePointerUp),this.addEventListener("pointercancel",this.handlePointerUp),this.render()}disconnectedCallback(){this.removeEventListener("pointermove",this.handlePointerMove),this.removeEventListener("pointerup",this.handlePointerUp),this.removeEventListener("pointercancel",this.handlePointerUp)}attributeChangedCallback(){!this.isConnected||this.suppressRender||this.dragState||this.reorderState||this.render()}parseJson(e,t){try{return JSON.parse(this.getAttribute(e)||"null")??t}catch{return t}}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getNumber(e,t){const s=Number(this.getAttribute(e));return Number.isFinite(s)&&s>0?s:t}getOption(e,t,s){const i=this.getAttribute(e);return i&&t.includes(i)?i:s}getLocale(){return this.getAttribute("locale")||"ko-KR"}getWeekdays(){return this.getLocale().startsWith("ko")?rs:os}getViewRange(){const e=this.getAttribute("start-date"),t=this.getAttribute("end-date");if(e&&t)return{start:parseDate(e),end:parseDate(t)};const s=this.items.flatMap(e=>[parseDate(e.startDate),parseDate(e.endDate)]);if(0===s.length){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1);return{start:t,end:addDays(t,29)}}const i=new Date(Math.min(...s.map(e=>e.getTime()))),n=new Date(Math.max(...s.map(e=>e.getTime())));return{start:addDays(i,-2),end:addDays(n,2)}}getTodayDate(){const e=this.getAttribute("today");return e?parseDate(e):new Date}getDateColumns(e,t){const s=daysBetween(e,t)+1;return Array.from({length:s},(t,s)=>addDays(e,s))}getVisibleRows(){const e=this.groups,t=this.rows;if(0===e.length)return t.map(e=>({type:"row",row:e}));const s=[];for(const i of e)s.push({type:"group",group:i}),this.collapsedGroups.has(i.id)||t.filter(e=>e.groupId===i.id).forEach(e=>s.push({type:"row",row:e}));return t.filter(t=>!t.groupId||!e.some(e=>e.id===t.groupId)).forEach(e=>s.push({type:"row",row:e})),s}getMonthSegments(e){const t=[];let s="",i=0;for(const n of e){const e=`${n.getFullYear()}-${n.getMonth()}`;e!==s?(i>0&&t.push({label:s,span:i}),s=e,i=1):i+=1}return i>0&&t.push({label:s,span:i}),t.map(e=>{const[t,s]=e.label.split("-").map(Number);return{label:new Date(t,s,1).toLocaleDateString(this.getLocale(),{year:"numeric",month:"long"}),span:e.span}})}getInitials(e){return e.initials?e.initials:e.name.split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase()}updateItem(e,t,s){const i=this.items.map(s=>s.id===e?{...s,...t}:s);this.emitItemsChange(i,s,e)}emitItemsChange(e,t,s){this.suppressRender=!0,this.items=e,this.suppressRender=!1;const i=e.find(e=>e.id===s);this.dispatchEvent(new CustomEvent("db-item-change",{detail:{item:i,items:e,action:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{groups:this.groups,rows:this.rows,items:e},bubbles:!0,composed:!0}))}applyBarGeometry(e,t,s,i){const n=parseDate(t.startDate),a=parseDate(t.endDate),r=daysBetween(s,n),o=daysBetween(n,a)+1;e.style.left=r*i+2+"px",e.style.width=`${Math.max(o*i-4,i-4)}px`}startBarDrag(e,t,s,i){!this.getBool("draggable",!0)||this.getBool("disabled")||t.disabled||(e.preventDefault(),e.stopPropagation(),this.didDrag=!1,i.setPointerCapture(e.pointerId),i.classList.add("designbase-wc-gantt__bar--dragging"),this.dragState={itemId:t.id,mode:s,pointerId:e.pointerId,startX:e.clientX,originalStart:parseDate(t.startDate),originalEnd:parseDate(t.endDate),barEl:i})}canReorder(){return this.getBool("reorderable",!0)&&!this.getBool("disabled")}createDragHandle(e,t,s){const i=document.createElement("span");return i.className="designbase-wc-gantt__drag-handle",i.setAttribute("role","button"),i.setAttribute("aria-label","group"===e?"그룹 순서 변경":"행 순서 변경"),i.append(createDbIcon("grip-vertical",12)),this.canReorder()?(i.addEventListener("pointerdown",n=>{n.preventDefault(),n.stopPropagation(),this.startReorderDrag(n,e,t,s,i)}),i):i}getGroupIndex(e){return this.groups.findIndex(t=>t.id===e)}getRowScope(e){return this.rows.filter(t=>(t.groupId||"")===(e||""))}getRowIndexInScope(e,t){return this.getRowScope(t).findIndex(t=>t.id===e)}getReorderTargets(e,t){return Array.from(this.querySelectorAll("group"===e?".designbase-wc-gantt__label-cell--group":`.designbase-wc-gantt__label-cell--row[data-group-id="${t||""}"]`))}startReorderDrag(e,t,s,i,n){const a="group"===t?this.getGroupIndex(s):this.getRowIndexInScope(s,i);a<0||(n.setPointerCapture(e.pointerId),this.reorderState={kind:t,id:s,groupId:i,pointerId:e.pointerId,startY:e.clientY,fromIndex:a,captureEl:n},this.classList.add("designbase-wc-gantt--reordering"),this.updateReorderDropTarget(e.clientY))}updateReorderDropTarget(e){if(!this.reorderState)return;const t=this.getReorderTargets(this.reorderState.kind,this.reorderState.groupId);let s=null;t.forEach((t,i)=>{const n=t.getBoundingClientRect(),a=n.top+n.height/2,r=e>=n.top&&e<=n.bottom,o=e>a;t.classList.toggle("designbase-wc-gantt__label-cell--drag-over",r),t.classList.toggle("designbase-wc-gantt__label-cell--drag-over-before",r&&!o),t.classList.toggle("designbase-wc-gantt__label-cell--drag-over-after",r&&o),r&&(s=o?i+1:i)}),this.reorderDropIndex=s}clearReorderIndicators(){this.querySelectorAll(".designbase-wc-gantt__label-cell--drag-over").forEach(e=>{e.classList.remove("designbase-wc-gantt__label-cell--drag-over","designbase-wc-gantt__label-cell--drag-over-before","designbase-wc-gantt__label-cell--drag-over-after")})}finishReorderDrag(e){if(!this.reorderState)return;const{kind:t,id:s,groupId:i,fromIndex:n,captureEl:a}=this.reorderState;try{a.releasePointerCapture(this.reorderState.pointerId)}catch{}const r=this.reorderDropIndex;if(this.reorderState=null,this.reorderDropIndex=null,this.classList.remove("designbase-wc-gantt--reordering"),this.clearReorderIndicators(),null===r)return;const o=r>n?r-1:r;o<0||o===n||("group"===t?this.reorderGroups(n,o,s):this.reorderRows(n,o,s,i))}emitStructureChange(e,t,s,i){this.suppressRender=!0,this.groups=e,this.rows=t,this.suppressRender=!1,this.dispatchEvent(new CustomEvent(i,{detail:{...s,groups:e,rows:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-change",{detail:{groups:e,rows:t,items:this.items},bubbles:!0,composed:!0})),this.render()}reorderGroups(e,t,s){const i=[...this.groups],[n]=i.splice(e,1);n&&(i.splice(t,0,n),this.emitStructureChange(i,this.rows,{groupId:s,fromIndex:e,toIndex:t},"db-group-reorder"))}reorderRows(e,t,s,i){const n=this.getRowScope(i),a=[...n],[r]=a.splice(e,1);if(!r)return;a.splice(t,0,r);const o=new Set(n.map(e=>e.id)),l=[];let d=!1;for(const e of this.rows)o.has(e.id)?d||(l.push(...a),d=!0):l.push(e);d||l.push(...a),this.emitStructureChange(this.groups,l,{rowId:s,groupId:i,fromIndex:e,toIndex:t},"db-row-reorder")}createGroupBadge(e){const t=document.createElement("db-badge");return t.className="designbase-wc-gantt__group-badge",t.setAttribute("badge-style","dot"),t.setAttribute("size","s"),t.setAttribute("variant","primary"),t.setAttribute("aria-hidden","true"),e&&t.style.setProperty("--db-gantt-badge-color",e),t}createGroupChevron(e){const t=document.createElement("span");return t.className=["designbase-wc-gantt__group-chevron",e?"designbase-wc-gantt__group-chevron--collapsed":""].filter(Boolean).join(" "),t.append(createDbIcon("chevron-down",12)),t}createAssignee(e){const t=document.createElement("span");if(t.className="designbase-wc-gantt__assignee",t.title=e.name,e.avatar){const s=document.createElement("img");s.src=e.avatar,s.alt=e.name,t.appendChild(s)}else t.textContent=this.getInitials(e);return t}createStatusIcon(e){const t=document.createElement("span");return t.className=`designbase-wc-gantt__status designbase-wc-gantt__status--${e}`,t.setAttribute("aria-hidden","true"),t.textContent="completed"===e?"✓":"!",t}deriveSummaryColor(e,t){if(0===e.length)return t||as[0];const s=e.filter(e=>e.color);if(0===s.length)return t||as[0];return s.reduce((e,t)=>{const s=daysBetween(parseDate(e.startDate),parseDate(e.endDate));return daysBetween(parseDate(t.startDate),parseDate(t.endDate))>s?t:e}).color||t||as[0]}getGroupSummary(e,t){const s=this.rows.filter(t=>t.groupId===e),i=this.items.filter(e=>s.some(t=>t.id===e.rowId));if(0===i.length)return null;const n=i.map(e=>parseDate(e.startDate).getTime()),a=i.map(e=>parseDate(e.endDate).getTime()),r=i.map(e=>e.progress).filter(e=>"number"==typeof e);return{startDate:toDateKey(new Date(Math.min(...n))),endDate:toDateKey(new Date(Math.max(...a))),color:this.deriveSummaryColor(i,t),progress:r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0,count:i.length}}applyBarTone(e,t){const s=function deriveBarTone(e){return{base:`color-mix(in srgb, ${e} 42%, white)`,progress:`color-mix(in srgb, ${e} 58%, white)`}}(t);e.style.setProperty("--db-gantt-bar-color",t),e.style.setProperty("--db-gantt-bar-bg",s.base),e.style.setProperty("--db-gantt-bar-progress-bg",s.progress)}createGroupSummaryBar(e,t,s,i){const n=clampDate(parseDate(e.startDate),t,s),a=clampDate(parseDate(e.endDate),t,s);if(a<t||n>s)return null;const r=daysBetween(t,n),o=daysBetween(n,a)+1,l=Math.min(100,Math.max(0,e.progress)),d=document.createElement("div");if(d.className="designbase-wc-gantt__group-summary",d.setAttribute("aria-hidden","true"),d.title=`${e.count}개 태스크`,this.applyBarTone(d,e.color),d.style.left=r*i+2+"px",d.style.width=`${Math.max(o*i-4,i-4)}px`,l>0){const e=document.createElement("span");e.className="designbase-wc-gantt__group-summary-progress",e.style.width=`${l}%`,d.appendChild(e)}return d}createBar(e,t,s,i){const n=e.color||as[i%as.length],a=document.createElement("div");a.className="designbase-wc-gantt__bar",a.setAttribute("role","button"),a.setAttribute("tabindex",e.disabled?"-1":"0"),a.setAttribute("aria-label",`${e.title}, ${e.startDate} – ${e.endDate}`),this.applyBarTone(a,n),e.disabled&&a.classList.add("designbase-wc-gantt__bar--disabled"),this.applyBarGeometry(a,e,t,s);const r="number"==typeof e.progress?Math.min(100,Math.max(0,e.progress)):0;if(r>0){const e=document.createElement("span");e.className="designbase-wc-gantt__bar-progress",e.style.width=`${r}%`,a.appendChild(e)}const o=document.createElement("div");o.className="designbase-wc-gantt__bar-body","delayed"!==e.status&&"at-risk"!==e.status||o.appendChild(this.createStatusIcon(e.status));const l=document.createElement("span");l.className="designbase-wc-gantt__bar-label",l.textContent=e.title,o.appendChild(l),e.assignee&&o.appendChild(this.createAssignee(e.assignee));const d=document.createElement("span");d.className="designbase-wc-gantt__bar-handle designbase-wc-gantt__bar-handle--start",d.setAttribute("aria-hidden","true");const u=document.createElement("span");return u.className="designbase-wc-gantt__bar-handle designbase-wc-gantt__bar-handle--end",u.setAttribute("aria-hidden","true"),a.append(d,o,u),e.disabled||!this.getBool("draggable",!0)||this.getBool("disabled")||(d.addEventListener("pointerdown",t=>this.startBarDrag(t,e,"resize-start",a)),u.addEventListener("pointerdown",t=>this.startBarDrag(t,e,"resize-end",a)),o.addEventListener("pointerdown",t=>{t.target.closest(".designbase-wc-gantt__bar-handle")||this.startBarDrag(t,e,"move",a)})),a.addEventListener("click",t=>{this.dragState||this.didDrag?this.didDrag=!1:(t.stopPropagation(),this.dispatchEvent(new CustomEvent("db-item-click",{detail:{item:e},bubbles:!0,composed:!0})))}),a}toggleGroup(e){this.collapsedGroups.has(e)?this.collapsedGroups.delete(e):this.collapsedGroups.add(e),this.dispatchEvent(new CustomEvent("db-group-toggle",{detail:{groupId:e,collapsed:this.collapsedGroups.has(e)},bubbles:!0,composed:!0})),this.render()}render(){const e=this.items,t=this.getOption("scale",ns,"day"),s=this.getNumber("cell-width","week"===t?72:44),i=this.getBool("show-weekends",!0),n=this.getBool("show-today",!0),a=this.getAttribute("sidebar-label")||"할 일",r=this.getBool("disabled"),o=this.getBool("full-width",!0),l=this.getWeekdays(),{start:d,end:u}=this.getViewRange(),b=this.getDateColumns(d,u),m=toDateKey(this.getTodayDate()),p=b.findIndex(e=>toDateKey(e)===m),g=this.getVisibleRows(),v=b.length*s,E=document.createElement("div");E.className=["designbase-wc-gantt",o?"designbase-wc-gantt--full-width":"",r?"designbase-wc-gantt--disabled":"",this.getBool("draggable",!0)?"designbase-wc-gantt--draggable":""].filter(Boolean).join(" ");const f=document.createElement("div");f.className="designbase-wc-gantt__viewport";const w=document.createElement("div");w.className="designbase-wc-gantt__grid",w.style.setProperty("--db-gantt-chart-width",`${v}px`),w.style.setProperty("--db-gantt-cell-width",`${s}px`);const y=document.createElement("div");y.className="designbase-wc-gantt__corner",y.textContent=a,w.appendChild(y);const A=document.createElement("div");A.className="designbase-wc-gantt__date-header";const _=document.createElement("div");_.className="designbase-wc-gantt__month-row";for(const e of this.getMonthSegments(b)){const t=document.createElement("div");t.className="designbase-wc-gantt__month-cell",t.style.width=e.span*s+"px",t.textContent=e.label,_.appendChild(t)}A.appendChild(_);const C=document.createElement("div");C.className="designbase-wc-gantt__day-row";for(const e of b){const t=toDateKey(e)===m,a=0===e.getDay()||6===e.getDay(),r=document.createElement("div");r.className=["designbase-wc-gantt__day-cell",t&&n?"designbase-wc-gantt__day-cell--today":"",a&&i?"designbase-wc-gantt__day-cell--weekend":""].filter(Boolean).join(" "),r.style.width=`${s}px`;const o=document.createElement("span");o.className="designbase-wc-gantt__day-num",o.textContent=String(e.getDate());const d=document.createElement("span");d.className="designbase-wc-gantt__day-name",d.textContent=l[e.getDay()],r.append(o,d),C.appendChild(r)}A.appendChild(C),w.appendChild(A);const x=new Map;e.forEach((e,t)=>{const s=x.get(e.rowId)||[];s.push({...e,color:e.color||as[t%as.length]}),x.set(e.rowId,s)});let k=0;for(const e of g){if("group"===e.type){const{group:t}=e,n=this.collapsedGroups.has(t.id),a=document.createElement("button");a.type="button",a.className="designbase-wc-gantt__label-cell designbase-wc-gantt__label-cell--group",a.setAttribute("aria-expanded",String(!n)),a.dataset.groupId=t.id;const r=document.createElement("span");r.className="designbase-wc-gantt__group-title",r.textContent=t.title,a.append(this.createDragHandle("group",t.id),this.createGroupChevron(n),this.createGroupBadge(t.color),r),a.addEventListener("click",e=>{e.target.closest(".designbase-wc-gantt__drag-handle")||this.toggleGroup(t.id)}),w.appendChild(a);const o=document.createElement("div");if(o.className="designbase-wc-gantt__track-cell designbase-wc-gantt__track-cell--group",n){const e=this.getGroupSummary(t.id,t.color);if(e){const t=document.createElement("div");t.className="designbase-wc-gantt__grid-bg",b.forEach(e=>{const n=document.createElement("div"),a=0===e.getDay()||6===e.getDay();n.className=["designbase-wc-gantt__grid-cell",a&&i?"designbase-wc-gantt__grid-cell--weekend":""].filter(Boolean).join(" "),n.style.width=`${s}px`,t.appendChild(n)}),o.appendChild(t);const n=document.createElement("div");n.className="designbase-wc-gantt__group-summary-wrap";const a=this.createGroupSummaryBar(e,d,u,s);a&&n.appendChild(a),o.appendChild(n)}}w.appendChild(o);continue}const{row:t}=e,n=document.createElement("button");n.type="button",n.className="designbase-wc-gantt__label-cell designbase-wc-gantt__label-cell--row",n.dataset.groupId=t.groupId||"",n.dataset.rowId=t.id;const a=document.createElement("span");a.className="designbase-wc-gantt__row-title",a.textContent=t.label,n.append(this.createDragHandle("row",t.id,t.groupId),a),n.addEventListener("click",e=>{e.target.closest(".designbase-wc-gantt__drag-handle")||this.dispatchEvent(new CustomEvent("db-row-click",{detail:{row:t},bubbles:!0,composed:!0}))}),w.appendChild(n);const r=document.createElement("div");r.className="designbase-wc-gantt__track-cell";const o=document.createElement("div");o.className="designbase-wc-gantt__grid-bg",b.forEach(e=>{const t=document.createElement("div"),n=0===e.getDay()||6===e.getDay();t.className=["designbase-wc-gantt__grid-cell",n&&i?"designbase-wc-gantt__grid-cell--weekend":""].filter(Boolean).join(" "),t.style.width=`${s}px`,o.appendChild(t)}),r.appendChild(o);const l=document.createElement("div");l.className="designbase-wc-gantt__bars",(x.get(t.id)||[]).forEach(e=>{const t=clampDate(parseDate(e.startDate),d,u),i=clampDate(parseDate(e.endDate),d,u);i<d||t>u||l.appendChild(this.createBar({...e,startDate:toDateKey(t),endDate:toDateKey(i)},d,s,k++))}),r.appendChild(l),w.appendChild(r)}if(f.appendChild(w),n&&p>=0){const e=document.createElement("div");e.className="designbase-wc-gantt__today-line",e.style.left=`calc(var(--db-gantt-label-width) + ${p*s+s/2}px)`,w.appendChild(e)}E.appendChild(f),this.replaceChildren(E)}}customElements.get("db-gantt")||customElements.define("db-gantt",DbGantt);const ls=["both","horizontal","vertical"],ds=["bottom-right","bottom-left","top-right","top-left","right","bottom"];class DbResizablePanels extends HTMLElement{constructor(){super(...arguments),this.isResizing=!1,this.startSize={width:0,height:0},this.startPos={x:0,y:0},this.currentSize={width:0,height:0},this.onMouseDown=e=>{e.preventDefault(),this.startResize(e.clientX,e.clientY),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},this.onTouchStart=e=>{e.preventDefault();const t=e.touches[0];this.startResize(t.clientX,t.clientY),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.onTouchEnd)},this.onMouseMove=e=>{this.applyResize(e.clientX,e.clientY)},this.onTouchMove=e=>{e.preventDefault();const t=e.touches[0];this.applyResize(t.clientX,t.clientY)},this.onMouseUp=()=>{this.endResize(),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)},this.onTouchEnd=()=>{this.endResize(),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd)}}static get observedAttributes(){return["initial-width","initial-height","min-width","min-height","max-width","max-height","direction","handle-position","handle-size","handle-color","handle-hover-color","snap-to-grid","show-guides","show-size-indicator","show-constraints","show-border","shadow","background-color","border-radius"]}connectedCallback(){this.ensureStructure(),this.initializeSize(),this.render()}attributeChangedCallback(){this.render()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getNumber(e,t){const s=Number(this.getAttribute(e)??t);return Number.isFinite(s)?s:t}getDirection(){const e=this.getAttribute("direction");return e&&ls.includes(e)?e:"both"}getHandlePosition(){const e=this.getAttribute("handle-position");return e&&ds.includes(e)?e:"bottom-right"}initializeSize(){const e=this.parentElement?.getBoundingClientRect();if(!e)return;const t=this.getAttribute("initial-width")||"100%",s=this.getAttribute("initial-height")||"100%";this.currentSize={width:"string"==typeof t&&t.endsWith("%")?e.width*Number(t.replace("%",""))/100:Number(t)||e.width,height:"string"==typeof s&&s.endsWith("%")?e.height*Number(s.replace("%",""))/100:Number(s)||e.height}}getMinSize(){return{width:this.getNumber("min-width",200),height:this.getNumber("min-height",150)}}getMaxSize(){const e=this.parentElement?.getBoundingClientRect();if(!e)return{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY};const t=this.getAttribute("max-width")||"100vw",s=this.getAttribute("max-height")||"100vh",toSize=(e,t,s)=>{if("100vw"===e||"100vh"===e)return t;if("100%"===e)return s;const i=Number(e);return Number.isFinite(i)?i:Number.POSITIVE_INFINITY};return{width:toSize(t,window.innerWidth,e.width),height:toSize(s,window.innerHeight,e.height)}}ensureStructure(){if(this.container)return;this.container=document.createElement("div"),this.container.className="designbase-wc-resizable-panels",this.guidesEl=document.createElement("div"),this.guidesEl.className="designbase-wc-resizable-panels__guides";const e=document.createElement("div");e.className="designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--horizontal";const t=document.createElement("div");t.className="designbase-wc-resizable-panels__guide designbase-wc-resizable-panels__guide--vertical",this.guidesEl.append(e,t),this.sizeIndicatorEl=document.createElement("div"),this.sizeIndicatorEl.className="designbase-wc-resizable-panels__size-indicator",this.constraintsEl=document.createElement("div"),this.constraintsEl.className="designbase-wc-resizable-panels__constraints",this.contentEl=document.createElement("div"),this.contentEl.className="designbase-wc-resizable-panels__content",this.handleEl=document.createElement("div"),this.handleEl.className="designbase-wc-resizable-panels__handle",this.handleEl.addEventListener("mousedown",this.onMouseDown),this.handleEl.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.container.append(this.guidesEl,this.sizeIndicatorEl,this.constraintsEl,this.contentEl,this.handleEl),this.replaceChildren(this.container)}startResize(e,t){this.isResizing=!0,this.startSize={...this.currentSize},this.startPos={x:e,y:t},this.dispatchEvent(new CustomEvent("db-resize-start",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render()}applyResize(e,t){if(!this.isResizing)return;const s=e-this.startPos.x,i=t-this.startPos.y,n=this.getDirection();let a=this.startSize.width,r=this.startSize.height;"both"!==n&&"horizontal"!==n||(a+=s),"both"!==n&&"vertical"!==n||(r+=i);const o=this.getNumber("snap-to-grid",0);o>0&&(a=Math.round(a/o)*o,r=Math.round(r/o)*o);const l=this.getMinSize(),d=this.getMaxSize();a=Math.max(l.width,Math.min(d.width,a)),r=Math.max(l.height,Math.min(d.height,r)),this.currentSize={width:a,height:r},this.dispatchEvent(new CustomEvent("db-resize",{detail:this.currentSize,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("db-size-change",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render()}endResize(){this.isResizing&&(this.isResizing=!1,this.dispatchEvent(new CustomEvent("db-resize-end",{detail:this.currentSize,bubbles:!0,composed:!0})),this.render())}renderHandleStyle(){if(!this.handleEl)return;const e=this.getDirection(),t=this.getHandlePosition(),s=this.getAttribute("handle-color"),i=this.getAttribute("handle-hover-color");s?this.handleEl.style.setProperty("--db-resize-handle-color",s):this.handleEl.style.removeProperty("--db-resize-handle-color"),i?this.handleEl.style.setProperty("--db-resize-handle-hover-color",i):this.handleEl.style.removeProperty("--db-resize-handle-hover-color"),this.handleEl.style.top="",this.handleEl.style.right="",this.handleEl.style.bottom="",this.handleEl.style.left="",this.handleEl.style.transform="",this.handleEl.style.width="",this.handleEl.style.height="",this.handleEl.style.backgroundColor="",this.handleEl.onmouseenter=null,this.handleEl.onmouseleave=null;let n=`corner-${t}`;"vertical"===e?n="edge-bottom":"horizontal"===e&&(n="edge-right"),this.handleEl.className=`designbase-wc-resizable-panels__handle designbase-wc-resizable-panels__handle--${n}`,this.handleEl.setAttribute("role","separator"),this.handleEl.setAttribute("aria-label","크기 조절"),this.handleEl.replaceChildren()}render(){if(this.ensureStructure(),!(this.container&&this.contentEl&&this.guidesEl&&this.sizeIndicatorEl&&this.constraintsEl))return;const e=["designbase-wc-resizable-panels",this.isResizing&&"designbase-wc-resizable-panels--resizing",this.getBool("show-border",!0)&&"designbase-wc-resizable-panels--border",this.getBool("shadow",!0)&&"designbase-wc-resizable-panels--shadow"].filter(Boolean).join(" ");this.container.className=e,this.container.style.width=`${this.currentSize.width}px`,this.container.style.height=`${this.currentSize.height}px`;const t=this.getAttribute("background-color");this.container.style.backgroundColor=t||"";const s=this.getAttribute("border-radius")||"8px";if(this.container.style.borderRadius=/^\d+$/.test(s)?`${s}px`:s,0===this.contentEl.children.length){const e=Array.from(this.childNodes).filter(e=>e!==this.container);this.contentEl.append(...e)}if(this.guidesEl.style.display=this.getBool("show-guides",!0)&&this.isResizing?"":"none",this.sizeIndicatorEl.style.display=this.getBool("show-size-indicator",!0)&&this.isResizing?"":"none",this.sizeIndicatorEl.textContent=`${Math.round(this.currentSize.width)} × ${Math.round(this.currentSize.height)}`,this.constraintsEl.style.display=this.getBool("show-constraints",!0)&&this.isResizing?"":"none",this.constraintsEl.replaceChildren(),"none"!==this.constraintsEl.style.display){const e=this.getMinSize(),t=this.getMaxSize();this.currentSize.width<=e.width&&this.constraintsEl.append(this.makeConstraint("최소 너비 도달","min")),this.currentSize.height<=e.height&&this.constraintsEl.append(this.makeConstraint("최소 높이 도달","min")),this.currentSize.width>=t.width&&this.constraintsEl.append(this.makeConstraint("최대 너비 도달","max")),this.currentSize.height>=t.height&&this.constraintsEl.append(this.makeConstraint("최대 높이 도달","max"))}this.renderHandleStyle()}makeConstraint(e,t){const s=document.createElement("div");return s.className=`designbase-wc-resizable-panels__constraint designbase-wc-resizable-panels__constraint--${t}`,s.textContent=e,s}}customElements.get("db-resizable-panels")||customElements.define("db-resizable-panels",DbResizablePanels);const cs="designbase-wc-video-player",hs=20;class DbVideoPlayer extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.rafId=null,this.playlistIndex=0,this.isFullscreen=!1,this.showControlsOverlay=!1,this.isPlaying=!1,this.isMuted=!1,this.volume=1,this.lastVolumeBeforeMute=1,this.currentTime=0,this.duration=0,this.isLoading=!1,this.error=null,this.onFullscreenChange=()=>{this.isFullscreen=document.fullscreenElement===this,this.dispatchEvent(new CustomEvent("db-fullscreen-change",{detail:{isFullscreen:this.isFullscreen},bubbles:!0,composed:!0})),this.updateUI()},this.onMouseEnter=()=>{this.showControlsOverlay=!0,this.updateUI()},this.onMouseLeave=()=>{this.showControlsOverlay=!1,this.updateUI()}}static get observedAttributes(){return["src","poster","title","description","size","variant","theme","auto-play","loop","muted","show-controls","enable-fullscreen","show-progress","show-time","show-volume","playlist","current-index"]}connectedCallback(){this.built||(this.built=!0,this.build(),this.bindVideoEvents()),this.syncFromAttributes(),this.updateUI(),document.addEventListener("fullscreenchange",this.onFullscreenChange),this.addEventListener("mouseenter",this.onMouseEnter),this.addEventListener("mouseleave",this.onMouseLeave)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.removeEventListener("mouseenter",this.onMouseEnter),this.removeEventListener("mouseleave",this.onMouseLeave),this.stopProgressAnimation()}attributeChangedCallback(e){this.built&&("src"!==e&&"playlist"!==e&&"current-index"!==e?("muted"===e&&this.videoEl&&(this.videoEl.muted=this.getBool("muted")),this.updateUI()):this.loadVideoSource())}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getPlaylist(){try{const e=this.getAttribute("playlist"),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}}getCurrentSrc(){const e=this.getPlaylist();if(e.length>0){const t=Number(this.getAttribute("current-index")||this.playlistIndex||0);return e[Math.max(0,Math.min(e.length-1,t))]}return this.getAttribute("src")||""}formatTime(e){if(!Number.isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}iconButton(e,t,s){const i=document.createElement("button");return i.type="button",i.className=`${cs}__control-button`,i.append(createDbIcon(e,t)),i.addEventListener("click",e=>{e.stopPropagation(),s()}),i}skipButton(e,t){const s=document.createElement("button");return s.type="button",s.className=`${cs}__skip-button`,s.textContent=e,s.setAttribute("aria-label",t<0?"10초 되감기":"10초 빨리감기"),s.addEventListener("click",e=>{e.stopPropagation(),this.seekBy(t)}),s}syncFromAttributes(){this.playlistIndex=Number(this.getAttribute("current-index")||0),this.isMuted=this.getBool("muted"),this.volume=this.isMuted?0:1,this.lastVolumeBeforeMute=this.volume>0?this.volume:1,this.loadVideoSource()}loadVideoSource(){if(!this.videoEl)return;const e=this.getCurrentSrc();if(!e)return;const t=new URL(e,window.location.href).href;this.videoEl.src!==t&&(this.videoEl.src=e,this.videoEl.load()),this.videoEl.poster=this.getAttribute("poster")||"",this.videoEl.autoplay=this.getBool("auto-play"),this.videoEl.loop=this.getBool("loop"),this.videoEl.muted=this.getBool("muted"),this.videoEl.playsInline=!0}bindVideoEvents(){const e=this.videoEl;e&&(e.addEventListener("play",()=>{this.isPlaying=!0,this.startProgressAnimation(),this.dispatchEvent(new CustomEvent("db-play",{bubbles:!0,composed:!0})),this.updateUI()}),e.addEventListener("pause",()=>{this.isPlaying=!1,this.stopProgressAnimation(),this.dispatchEvent(new CustomEvent("db-pause",{bubbles:!0,composed:!0})),this.updateUI()}),e.addEventListener("timeupdate",()=>{this.currentTime=e.currentTime,this.duration=Number.isFinite(e.duration)?e.duration:0,this.dispatchEvent(new CustomEvent("db-time-update",{detail:{currentTime:this.currentTime,duration:this.duration},bubbles:!0,composed:!0})),this.updateProgress(),this.updateTime()}),e.addEventListener("volumechange",()=>{this.volume=e.volume,this.isMuted=e.muted||0===e.volume,!this.isMuted&&this.volume>0&&(this.lastVolumeBeforeMute=this.volume),this.dispatchEvent(new CustomEvent("db-volume-change",{detail:{volume:this.volume},bubbles:!0,composed:!0})),this.updateVolumeUI()}),e.addEventListener("ended",()=>{this.isPlaying=!1,this.stopProgressAnimation(),this.dispatchEvent(new CustomEvent("db-ended",{bubbles:!0,composed:!0}));const t=this.getPlaylist(),s=this.playlistIndex+1;t.length>0&&s<t.length&&(this.playlistIndex=s,this.loadVideoSource(),e.play()),this.updateUI()}),e.addEventListener("error",()=>{this.error="비디오를 재생할 수 없습니다.",this.dispatchEvent(new CustomEvent("db-error",{detail:{error:this.error},bubbles:!0,composed:!0})),this.updateUI()}),e.addEventListener("loadstart",()=>{this.isLoading=!0,this.error=null,this.updateUI()}),e.addEventListener("loadedmetadata",()=>{this.duration=Number.isFinite(e.duration)?e.duration:0,this.updateTime()}),e.addEventListener("canplay",()=>{this.isLoading=!1,this.updateUI()}),e.addEventListener("click",()=>this.togglePlay()))}togglePlay(){this.videoEl&&(this.videoEl.paused?this.videoEl.play():this.videoEl.pause())}toggleMute(){if(this.videoEl){if(this.isMuted)return this.videoEl.muted=!1,void(this.videoEl.volume=this.lastVolumeBeforeMute>0?this.lastVolumeBeforeMute:1);this.videoEl.volume>0&&(this.lastVolumeBeforeMute=this.videoEl.volume),this.videoEl.muted=!0,this.videoEl.volume=0}}seekBy(e){if(!this.videoEl)return;const t=Number.isFinite(this.videoEl.duration)?this.videoEl.duration:0,s=t>0?t:Number.MAX_SAFE_INTEGER,i=Math.max(0,Math.min(s,this.videoEl.currentTime+e));this.videoEl.currentTime=i}toggleFullscreen(){this.getBool("enable-fullscreen",!0)&&(this.isFullscreen?document.exitFullscreen?.():this.requestFullscreen?.())}build(){this.videoEl=document.createElement("video"),this.videoEl.className=`${cs}__video`;const e=document.createElement("div");e.className=`${cs}__loading`;const t=document.createElement("div");t.className=`${cs}__spinner`,e.append(t);const s=document.createElement("div");s.className=`${cs}__error`;const i=document.createElement("p");i.textContent="비디오를 재생할 수 없습니다.";const n=document.createElement("button");n.type="button",n.textContent="다시 시도",n.addEventListener("click",()=>{this.error=null,this.loadVideoSource(),this.updateUI()}),s.append(i,n),this.dimOverlayEl=document.createElement("div"),this.dimOverlayEl.className=`${cs}__dim-overlay`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${cs}__overlay`;const a=document.createElement("div");a.className=`${cs}__top-controls`;const r=document.createElement("div");r.className=`${cs}__title`;const o=document.createElement("h3"),l=document.createElement("p");r.append(o,l),a.append(r),this._titleEl=o,this._descEl=l;const d=document.createElement("div");d.className=`${cs}__center-controls`;const u=this.skipButton("-10",-10);this.centerPlayEl=document.createElement("button"),this.centerPlayEl.type="button",this.centerPlayEl.className=`${cs}__play-button`,this.centerPlayEl.addEventListener("click",e=>{e.stopPropagation(),this.togglePlay()});const b=this.skipButton("+10",10);d.append(u,this.centerPlayEl,b);const m=document.createElement("div");m.className=`${cs}__bottom-controls`,this.progressEl=document.createElement("div"),this.progressEl.className=`${cs}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${cs}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${cs}__progress-handle`,this.progressEl.append(this.progressBarEl,this.progressHandleEl),this.progressEl.addEventListener("click",e=>{if(!this.videoEl||!Number.isFinite(this.duration)||this.duration<=0)return;const t=this.progressEl.getBoundingClientRect(),s=(e.clientX-t.left)/t.width;this.videoEl.currentTime=s*this.duration});const p=document.createElement("div");p.className=`${cs}__controls`;const g=document.createElement("div");g.className=`${cs}__left-controls`,this.togglePlayEl=this.iconButton("play",hs,()=>this.togglePlay()),this.volumeWrapEl=document.createElement("div"),this.volumeWrapEl.className=`${cs}__volume`,this.muteButtonEl=this.iconButton("volume-up",hs,()=>this.toggleMute());const v=document.createElement("div");v.className=`${cs}__volume-slider`,this.volumeInputEl=document.createElement("input"),this.volumeInputEl.type="range",this.volumeInputEl.min="0",this.volumeInputEl.max="1",this.volumeInputEl.step="0.1",this.volumeInputEl.addEventListener("input",()=>{if(!this.videoEl||!this.volumeInputEl)return;const e=parseFloat(this.volumeInputEl.value);e>0&&(this.lastVolumeBeforeMute=e),this.videoEl.volume=e,this.videoEl.muted=0===e}),v.append(this.volumeInputEl),this.volumeWrapEl.append(this.muteButtonEl,v),this.timeEl=document.createElement("div"),this.timeEl.className=`${cs}__time`,this.timeCurrentEl=document.createElement("span");const E=document.createElement("span");E.textContent="/",this.timeDurationEl=document.createElement("span"),this.timeEl.append(this.timeCurrentEl,E,this.timeDurationEl),g.append(this.togglePlayEl,this.volumeWrapEl,this.timeEl);const f=document.createElement("div");f.className=`${cs}__right-controls`,this.fullscreenButtonEl=this.iconButton("expand",hs,()=>this.toggleFullscreen()),f.append(this.fullscreenButtonEl),p.append(g,f),m.append(this.progressEl,p),this.overlayEl.append(a,d,m),this.append(this.videoEl,e,s,this.dimOverlayEl,this.overlayEl)}get titleEl(){return this._titleEl}get descEl(){return this._descEl}updateProgress(){const e=this.duration>0?this.currentTime/this.duration*100:0;this.progressBarEl&&(this.progressBarEl.style.width=`${e}%`),this.progressHandleEl&&(this.progressHandleEl.style.left=`${e}%`)}updateTime(){this.timeCurrentEl&&(this.timeCurrentEl.textContent=this.formatTime(this.currentTime)),this.timeDurationEl&&(this.timeDurationEl.textContent=this.formatTime(this.duration))}updateVolumeUI(){const e=this.isMuted?0:this.volume;this.volumeInputEl&&(this.volumeInputEl.value=String(e)),this.muteButtonEl&&this.muteButtonEl.replaceChildren(createDbIcon(this.isMuted||0===e?"mute-filled":"volume-up",hs))}startProgressAnimation(){this.stopProgressAnimation();const tick=()=>{!this.videoEl||this.videoEl.paused||this.videoEl.ended||(this.currentTime=this.videoEl.currentTime,this.duration=Number.isFinite(this.videoEl.duration)?this.videoEl.duration:0,this.updateProgress(),this.updateTime(),this.rafId=requestAnimationFrame(tick))};this.rafId=requestAnimationFrame(tick)}stopProgressAnimation(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null)}updatePlayIcons(){const e=this.isPlaying?"pause":"play";this.centerPlayEl&&this.centerPlayEl.replaceChildren(createDbIcon(e,48)),this.togglePlayEl&&this.togglePlayEl.replaceChildren(createDbIcon(e,hs))}updateUI(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto",i=this.getBool("show-controls",!0),n=this.getBool("show-progress",!0),a=this.getBool("show-time",!0),r=this.getBool("show-volume",!0),o=this.getBool("enable-fullscreen",!0);this.className=[cs,`${cs}--size-${e}`,`${cs}--variant-${t}`,`${cs}--theme-${s}`,this.isPlaying&&`${cs}--playing`,!this.isPlaying&&`${cs}--paused`,this.isMuted&&`${cs}--muted`,this.isLoading&&`${cs}--loading`,this.error&&`${cs}--error`,i&&this.showControlsOverlay&&`${cs}--show-controls`,this.isFullscreen&&`${cs}--fullscreen`].filter(Boolean).join(" ");const l=this.getAttribute("title"),d=this.getAttribute("description");this.titleEl&&(l?(this.titleEl.textContent=l,this.titleEl.hidden=!1):this.titleEl.hidden=!0),this.descEl&&(d?(this.descEl.textContent=d,this.descEl.hidden=!1):this.descEl.hidden=!0),this.overlayEl&&(this.overlayEl.hidden=!i),this.dimOverlayEl&&(this.dimOverlayEl.hidden=!i),this.progressEl&&(this.progressEl.hidden=!n),this.timeEl&&(this.timeEl.hidden=!a),this.volumeWrapEl&&(this.volumeWrapEl.hidden=!r),this.fullscreenButtonEl&&(this.fullscreenButtonEl.hidden=!o),this.fullscreenButtonEl&&this.fullscreenButtonEl.replaceChildren(createDbIcon(this.isFullscreen?"shrink":"expand",hs)),this.updatePlayIcons(),this.updateProgress(),this.updateTime(),this.updateVolumeUI()}}customElements.get("db-video-player")||customElements.define("db-video-player",DbVideoPlayer);class DbYouTubePlayer extends HTMLElement{constructor(){super(...arguments),this.isFullscreen=!1,this.playlistIndex=0,this.onFullscreenChange=()=>{this.isFullscreen=!!document.fullscreenElement,this.dispatchEvent(new CustomEvent("db-fullscreen-change",{detail:{isFullscreen:this.isFullscreen},bubbles:!0,composed:!0})),this.render()}}static get observedAttributes(){return["video-id","title","description","size","variant","theme","auto-play","loop","muted","show-controls","enable-fullscreen","enable-keyboard","enable-touch","show-subtitles","default-subtitle-lang","playback-rate","start-time","end-time","show-related-videos","show-info","show-channel-info","show-like-buttons","show-comments","playlist","current-index"]}connectedCallback(){this.style.display="block",this.playlistIndex=Number(this.getAttribute("current-index")||0),this.render(),document.addEventListener("fullscreenchange",this.onFullscreenChange)}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange)}attributeChangedCallback(){this.render()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}extractVideoId(e){if(!e)return"";if(11===e.length&&/^[a-zA-Z0-9_-]{11}$/.test(e))return e;const t=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/v\/|youtube\.com\/watch\?.*&v=)([^&\n?#]+)/,/youtube\.com\/watch\?.*v=([^&\n?#]+)/];for(const s of t){const t=e.match(s);if(t)return t[1]}return e}getPlaylist(){try{const e=this.getAttribute("playlist"),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}}getCurrentVideoId(){const e=this.getPlaylist();if(e.length>0){const t=Math.max(0,Math.min(e.length-1,this.playlistIndex));return this.extractVideoId(e[t])}return this.extractVideoId(this.getAttribute("video-id")||"")}generateEmbedUrl(e){const t=new URLSearchParams;if(this.getBool("auto-play")&&t.append("autoplay","1"),this.getBool("loop")&&t.append("loop","1"),this.getBool("muted")&&t.append("mute","1"),this.getBool("show-controls",!0)||t.append("controls","0"),this.getBool("enable-fullscreen",!0)||t.append("fs","0"),this.getBool("enable-keyboard",!0)||t.append("disablekb","1"),this.getBool("enable-touch",!0)||t.append("modestbranding","1"),this.getBool("show-subtitles")){t.append("cc_load_policy","1");const e=this.getAttribute("default-subtitle-lang")||"ko";e&&t.append("cc_lang_pref",e)}const s=this.getAttribute("playback-rate")||"1";"1"!==s&&t.append("vq",s);const i=Number(this.getAttribute("start-time")||0);i>0&&t.append("start",String(i));const n=Number(this.getAttribute("end-time")||0);n>0&&t.append("end",String(n)),this.getBool("show-related-videos",!0)||t.append("rel","0"),this.getBool("show-info",!0)||t.append("showinfo","0"),this.getBool("show-channel-info",!0)||t.append("modestbranding","1"),this.getBool("show-like-buttons",!0)||t.append("modestbranding","1"),this.getBool("show-comments",!1)||t.append("modestbranding","1");const a=this.getPlaylist().map(e=>this.extractVideoId(e)).filter(Boolean);a.length>0?t.append("playlist",a.join(",")):this.getBool("loop")&&t.append("playlist",e);const r=t.toString();return`https://www.youtube.com/embed/${e}${r?`?${r}`:""}`}render(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto";this.className=["designbase-wc-youtube-player",`designbase-wc-youtube-player--${e}`,`designbase-wc-youtube-player--${t}`,`designbase-wc-youtube-player--${s}`,this.isFullscreen&&"designbase-wc-youtube-player--fullscreen"].filter(Boolean).join(" ");const i=this.getCurrentVideoId();if(!i){const e=document.createElement("div");return e.className="designbase-wc-youtube-player__error",e.textContent="동영상을 불러올 수 없습니다.",void this.replaceChildren(e)}const n=document.createElement("div");n.className="designbase-wc-youtube-player__container";const a=document.createElement("iframe");a.className="designbase-wc-youtube-player__iframe",a.src=this.generateEmbedUrl(i),a.title=this.getAttribute("title")||`YouTube 동영상: ${i}`,a.setAttribute("frameborder","0"),a.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"),a.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),a.referrerPolicy="strict-origin-when-cross-origin",a.allowFullscreen=!0,n.append(a);const r=this.getAttribute("description"),o=document.createDocumentFragment();if(o.append(n),r&&"minimal"!==t){const e=document.createElement("div");e.className="designbase-wc-youtube-player__description";const t=document.createElement("p");t.textContent=r,e.append(t),o.append(e)}this.replaceChildren(o)}}customElements.get("db-youtube-player")||customElements.define("db-youtube-player",DbYouTubePlayer);const us="designbase-wc-audio-player";class DbAudioPlayer extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.isPlaying=!1,this.isMuted=!1,this.volume=1,this.currentTime=0,this.duration=0,this.showSettingsMenu=!1,this.playbackRate=1,this.currentRepeatMode="none",this.isShuffle=!1,this.isLoading=!1,this.error=null,this.playlistIndex=0,this.shuffledPlaylist=[],this.boundKeyDown=e=>this.handleKeyDown(e)}static get observedAttributes(){return["src","title","artist","album","album-art","size","variant","theme","auto-play","loop","muted","show-controls","enable-keyboard","show-progress","show-time","show-volume","show-settings","playlist","current-index","playback-rates","default-playback-rate","repeat-mode","shuffle"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build(),this.bindAudioEvents()),this.syncFromAttributes(),this.updateUI(),this.getBool("enable-keyboard",!0)&&document.addEventListener("keydown",this.boundKeyDown)}disconnectedCallback(){document.removeEventListener("keydown",this.boundKeyDown)}attributeChangedCallback(e){if(this.built){if("current-index"===e)return this.playlistIndex=Number(this.getAttribute("current-index")||0),void this.loadCurrentTrack();"repeat-mode"===e&&(this.currentRepeatMode=this.getAttribute("repeat-mode")||"none"),"shuffle"===e&&(this.isShuffle=this.getBool("shuffle"),this.refreshShuffledPlaylist()),"default-playback-rate"===e&&(this.playbackRate=Number(this.getAttribute("default-playback-rate")||1),this.audioEl&&(this.audioEl.playbackRate=this.playbackRate)),this.updateUI()}}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getPlaylist(){try{const e=this.getAttribute("playlist"),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}}getPlaybackRates(){try{const e=this.getAttribute("playback-rates"),t=e?JSON.parse(e):[.5,.75,1,1.25,1.5,2];return Array.isArray(t)&&t.length>0?t:[.5,.75,1,1.25,1.5,2]}catch{return[.5,.75,1,1.25,1.5,2]}}getIconSize(){const e=this.getAttribute("size")||"m";return"s"===e?16:"l"===e?24:"xl"===e?32:20}getCurrentTrack(){const e=this.getPlaylist();if(e.length>0){return e[this.isShuffle&&this.shuffledPlaylist.length>0?this.shuffledPlaylist[this.playlistIndex]??this.playlistIndex:this.playlistIndex]||e[0]}return{src:this.getAttribute("src")||"",title:this.getAttribute("title")||void 0,artist:this.getAttribute("artist")||void 0,album:this.getAttribute("album")||void 0,albumArt:this.getAttribute("album-art")||void 0}}refreshShuffledPlaylist(){const e=this.getPlaylist();if(e.length>0&&this.isShuffle){const t=Array.from({length:e.length},(e,t)=>t);this.shuffledPlaylist=[...t].sort(()=>Math.random()-.5)}else this.shuffledPlaylist=[]}formatTime(e){return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}syncFromAttributes(){this.playlistIndex=Number(this.getAttribute("current-index")||0),this.currentRepeatMode=this.getAttribute("repeat-mode")||"none",this.isShuffle=this.getBool("shuffle"),this.playbackRate=Number(this.getAttribute("default-playback-rate")||1),this.isMuted=this.getBool("muted"),this.volume=this.isMuted?0:1,this.refreshShuffledPlaylist(),this.loadCurrentTrack()}loadCurrentTrack(){if(!this.audioEl)return;const e=this.getCurrentTrack(),t=e?.src||this.getAttribute("src")||"";this.audioEl.src!==t&&t&&(this.audioEl.src=t,this.audioEl.load()),this.updateTrackInfo(),this.updatePlaylistActive()}bindAudioEvents(){const e=this.audioEl;e&&(e.addEventListener("play",()=>{this.isPlaying=!0,this.dispatchEvent(new CustomEvent("db-play",{bubbles:!0,composed:!0})),this.updateUI()}),e.addEventListener("pause",()=>{this.isPlaying=!1,this.dispatchEvent(new CustomEvent("db-pause",{bubbles:!0,composed:!0})),this.updateUI()}),e.addEventListener("timeupdate",()=>{this.currentTime=e.currentTime,this.duration=e.duration||0,this.dispatchEvent(new CustomEvent("db-time-update",{detail:{currentTime:this.currentTime,duration:this.duration},bubbles:!0,composed:!0})),this.updateProgress(),this.updateTime()}),e.addEventListener("volumechange",()=>{this.volume=e.volume,this.isMuted=e.muted,this.dispatchEvent(new CustomEvent("db-volume-change",{detail:{volume:this.volume},bubbles:!0,composed:!0})),this.updateVolumeUI()}),e.addEventListener("ended",()=>this.handleEnded()),e.addEventListener("error",()=>{this.error="오디오를 재생할 수 없습니다.",this.dispatchEvent(new CustomEvent("db-error",{detail:{error:this.error},bubbles:!0,composed:!0})),this.updateUI()}),e.addEventListener("loadstart",()=>{this.isLoading=!0,this.error=null,this.updateUI()}),e.addEventListener("canplay",()=>{this.isLoading=!1,this.updateUI()}))}handleEnded(){this.isPlaying=!1,this.dispatchEvent(new CustomEvent("db-ended",{bubbles:!0,composed:!0}));const e=this.getPlaylist();if(e.length>0){if("one"===this.currentRepeatMode)this.audioEl&&(this.audioEl.currentTime=0,this.audioEl.play());else if("all"===this.currentRepeatMode||this.playlistIndex<e.length-1){const t=this.playlistIndex+1;t<e.length?this.setPlaylistIndex(t):"all"===this.currentRepeatMode&&this.setPlaylistIndex(0)}}else this.getBool("loop")&&this.audioEl&&(this.audioEl.currentTime=0,this.audioEl.play());this.updateUI()}setPlaylistIndex(e){this.playlistIndex=e,this.dispatchEvent(new CustomEvent("db-playlist-change",{detail:{index:e},bubbles:!0,composed:!0})),this.loadCurrentTrack(),this.audioEl&&this.audioEl.play()}togglePlay(){this.audioEl&&(this.isPlaying?this.audioEl.pause():this.audioEl.play())}toggleMute(){this.audioEl&&(this.audioEl.muted=!this.isMuted)}toggleRepeatMode(){const e=["none","one","all"],t=e[(e.indexOf(this.currentRepeatMode)+1)%e.length];this.currentRepeatMode=t,this.dispatchEvent(new CustomEvent("db-repeat-mode-change",{detail:{mode:t},bubbles:!0,composed:!0})),this.updateUI()}toggleShuffle(){this.isShuffle=!this.isShuffle,this.refreshShuffledPlaylist(),this.dispatchEvent(new CustomEvent("db-shuffle-change",{detail:{shuffle:this.isShuffle},bubbles:!0,composed:!0})),this.updateUI()}handlePlaybackRateChange(e){this.audioEl&&(this.audioEl.playbackRate=e,this.playbackRate=e,this.dispatchEvent(new CustomEvent("db-playback-rate-change",{detail:{rate:e},bubbles:!0,composed:!0})))}handleKeyDown(e){if(this.audioEl&&this.getBool("enable-keyboard",!0))switch(e.code){case"Space":e.preventDefault(),this.togglePlay();break;case"ArrowLeft":e.preventDefault(),this.audioEl.currentTime=Math.max(0,this.currentTime-10);break;case"ArrowRight":e.preventDefault(),this.audioEl.currentTime=Math.min(this.duration,this.currentTime+10);break;case"ArrowUp":e.preventDefault(),this.audioEl.volume=Math.min(1,this.volume+.1),this.audioEl.muted=!1;break;case"ArrowDown":e.preventDefault(),this.audioEl.volume=Math.max(0,this.volume-.1),this.audioEl.muted=0===this.audioEl.volume;break;case"KeyM":e.preventDefault(),this.toggleMute();break;case"KeyR":e.preventDefault(),this.toggleRepeatMode();break;case"KeyS":e.preventDefault(),this.toggleShuffle()}}iconButton(e,t,s){const i=document.createElement("button");return i.type="button",i.className=`${us}__control-button`,i.append(createDbIcon(e,this.getIconSize())),s?.disabled&&(i.disabled=!0),s?.data&&Object.entries(s.data).forEach(([e,t])=>i.setAttribute(`data-${e}`,t)),i.addEventListener("click",t),i}build(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto";this.className=[us,`${us}--size-${e}`,`${us}--variant-${t}`,`${us}--theme-${s}`].join(" "),this.audioEl=document.createElement("audio"),this.audioEl.preload="metadata",this.audioEl.hidden=!0;const i=document.createElement("div");i.className=`${us}__loading`;const n=document.createElement("div");n.className=`${us}__spinner`,i.append(n);const a=document.createElement("div");a.className=`${us}__error`;const r=document.createElement("p");r.textContent="오디오를 재생할 수 없습니다.";const o=document.createElement("button");o.type="button",o.textContent="다시 시도",o.addEventListener("click",()=>window.location.reload()),a.append(r,o);const l=document.createElement("div");l.className=`${us}__album-art`,this.albumImgEl=document.createElement("img"),this.albumImgEl.addEventListener("error",()=>{this.albumImgEl&&(this.albumImgEl.style.display="none"),this.albumPlaceholderEl?.classList.remove("album-placeholder")}),this.albumPlaceholderEl=document.createElement("div"),this.albumPlaceholderEl.className="album-placeholder",this.albumPlaceholderEl.textContent="🎵",l.append(this.albumImgEl,this.albumPlaceholderEl);const d=document.createElement("div");d.className=`${us}__main`;const u=document.createElement("div");u.className=`${us}__info`,this.titleEl=document.createElement("div"),this.titleEl.className=`${us}__title`,this.artistEl=document.createElement("div"),this.artistEl.className=`${us}__artist`,this.albumEl=document.createElement("div"),this.albumEl.className=`${us}__album`,u.append(this.titleEl,this.artistEl,this.albumEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${us}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${us}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${us}__progress-handle`,this.progressEl.append(this.progressBarEl,this.progressHandleEl),this.progressEl.addEventListener("click",e=>{if(!this.audioEl||!this.progressEl)return;const t=this.progressEl.getBoundingClientRect(),s=(e.clientX-t.left)/t.width;this.audioEl.currentTime=s*(this.duration||0)});const b=document.createElement("div");b.className=`${us}__controls`;const m=document.createElement("div");m.className=`${us}__left-controls`;const p=document.createElement("div");p.className=`${us}__center-controls`;const g=document.createElement("div");g.className=`${us}__right-controls`,this.playButtonEl=document.createElement("button"),this.playButtonEl.type="button",this.playButtonEl.className=`${us}__play-button`,this.playButtonEl.addEventListener("click",()=>this.togglePlay()),p.append(this.playButtonEl),b.append(m,p,g);const v=document.createElement("div");v.className=`${us}__bottom-controls`;const E=document.createElement("div");E.className=`${us}__left-bottom`;const f=document.createElement("div");f.className=`${us}__right-bottom`;const w=document.createElement("div");w.className=`${us}__time`,this.timeCurrentEl=document.createElement("span");const y=document.createElement("span");y.textContent="/",this.timeDurationEl=document.createElement("span"),w.append(this.timeCurrentEl,y,this.timeDurationEl),E.append(w);const A=document.createElement("div");A.className=`${us}__volume`;const _=this.iconButton(this.isMuted||0===this.volume?"mute-filled":"volume-up",()=>this.toggleMute());_.title=this.isMuted||0===this.volume?"음소거 해제":"음소거";const C=document.createElement("div");C.className=`${us}__volume-slider`;const x=document.createElement("div");x.className="volume-label";const k=document.createElement("span");k.textContent="🔊";const S=document.createElement("span");x.append(k,S),this.volumeInputEl=document.createElement("input"),this.volumeInputEl.type="range",this.volumeInputEl.min="0",this.volumeInputEl.max="1",this.volumeInputEl.step="0.1",this.volumeInputEl.addEventListener("input",()=>{if(!this.audioEl||!this.volumeInputEl)return;const e=parseFloat(this.volumeInputEl.value);this.audioEl.volume=e,this.audioEl.muted=0===e}),C.append(x,this.volumeInputEl),A.append(_,C);const N=document.createElement("div");N.className=`${us}__settings`;const $=this.iconButton("settings",()=>{this.showSettingsMenu=!this.showSettingsMenu,this.updateSettingsMenu()});this.settingsMenuEl=document.createElement("div"),this.settingsMenuEl.className=`${us}__settings-menu`,this.settingsMenuEl.hidden=!0;const I=document.createElement("div");I.className=`${us}__setting-group`;const D=document.createElement("label");D.textContent="재생 속도";const L=document.createElement("select");L.addEventListener("change",()=>this.handlePlaybackRateChange(parseFloat(L.value))),I.append(D,L),this.settingsMenuEl.append(I),N.append($,this.settingsMenuEl),f.append(A,N),v.append(E,f),d.append(u,this.progressEl,b,v);const M=document.createElement("div");M.className=`${us}__playlist`,M.hidden=!0;const T=document.createElement("h4");T.textContent="플레이리스트",this.playlistTracksEl=document.createElement("div"),this.playlistTracksEl.className=`${us}__playlist-tracks`,M.append(T,this.playlistTracksEl),this.append(this.audioEl,i,a,l,d,M),this._leftControls=m,this._rightControls=g,this._controls=b,this._time=w,this._volumeWrap=A,this._settings=N,this._playlist=M,this._rateSelect=L,this._volumePercent=S,this._muteButton=_}get leftControls(){return this._leftControls}get rightControls(){return this._rightControls}get controlsEl(){return this._controls}get timeEl(){return this._time}get volumeWrap(){return this._volumeWrap}get settingsEl(){return this._settings}get playlistEl(){return this._playlist}get rateSelect(){return this._rateSelect}get volumePercent(){return this._volumePercent}get muteButton(){return this._muteButton}updateTrackInfo(){const e=this.getCurrentTrack();this.titleEl&&(this.titleEl.textContent=e?.title||"Unknown Track"),this.artistEl&&(this.artistEl.textContent=e?.artist||"Unknown Artist"),this.albumEl&&(e?.album?(this.albumEl.textContent=e.album,this.albumEl.hidden=!1):this.albumEl.hidden=!0),this.albumImgEl&&this.albumPlaceholderEl&&(e?.albumArt?(this.albumImgEl.src=e.albumArt,this.albumImgEl.alt=e.title||"Album Art",this.albumImgEl.style.display=""):(this.albumImgEl.removeAttribute("src"),this.albumImgEl.style.display="none"),this.albumPlaceholderEl.className="album-placeholder")}updateProgress(){const e=this.duration>0?this.currentTime/this.duration*100:0;this.progressBarEl&&(this.progressBarEl.style.width=`${e}%`),this.progressHandleEl&&(this.progressHandleEl.style.left=`${e}%`,this.progressHandleEl.style.transform=e<=0?"translate(0, -50%)":e>=100?"translate(-100%, -50%)":"translate(-50%, -50%)")}updateTime(){this.timeCurrentEl&&(this.timeCurrentEl.textContent=this.formatTime(this.currentTime)),this.timeDurationEl&&(this.timeDurationEl.textContent=this.formatTime(this.duration))}updateVolumeUI(){this.volumeInputEl&&(this.volumeInputEl.value=String(this.volume)),this.volumePercent&&(this.volumePercent.textContent=`${Math.round(100*this.volume)}%`),this.muteButton&&(this.muteButton.replaceChildren(createDbIcon(this.isMuted||0===this.volume?"mute-filled":"volume-up",this.getIconSize())),this.muteButton.title=this.isMuted||0===this.volume?"음소거 해제":"음소거")}updateSettingsMenu(){this.settingsMenuEl&&(this.settingsMenuEl.hidden=!this.showSettingsMenu)}rebuildControlButtons(){const e=this.getPlaylist(),t=1.2*this.getIconSize();this.leftControls.replaceChildren(),this.rightControls.replaceChildren(),e.length>0&&this.leftControls.append(this.iconButton("refresh",()=>this.toggleShuffle(),{data:{shuffle:"true"}})),this.leftControls.append(this.iconButton("chevron-left",()=>{if(e.length>0){const e=this.playlistIndex-1;e>=0&&this.setPlaylistIndex(e)}else this.audioEl&&(this.audioEl.currentTime=0)},{disabled:e.length>0&&0===this.playlistIndex})),this.playButtonEl&&this.playButtonEl.replaceChildren(createDbIcon(this.isPlaying?"pause":"play",t)),this.rightControls.append(this.iconButton("chevron-right",()=>{if(e.length>0){const t=this.playlistIndex+1;t<e.length&&this.setPlaylistIndex(t)}},{disabled:e.length>0&&this.playlistIndex===e.length-1})),e.length>0&&this.rightControls.append(this.iconButton("repeat",()=>this.toggleRepeatMode(),{data:{repeat:"true"}}))}rebuildPlaylist(){if(!this.playlistTracksEl)return;const e=this.getPlaylist(),t=this.getAttribute("variant")||"default";this.playlistEl.hidden=!("full"===t&&e.length>0),this.playlistTracksEl.replaceChildren(),e.forEach((e,t)=>{const s=document.createElement("div");if(s.className=`${us}__playlist-track${t===this.playlistIndex?` ${us}__playlist-track--active`:""}`,s.addEventListener("click",()=>this.setPlaylistIndex(t)),e.albumArt){const t=document.createElement("img");t.src=e.albumArt,t.alt=e.title||"Album Art",s.append(t)}const i=document.createElement("div");i.className=`${us}__playlist-track-info`;const n=document.createElement("div");n.className=`${us}__playlist-track-title`,n.textContent=e.title||"Unknown Track";const a=document.createElement("div");a.className=`${us}__playlist-track-artist`,a.textContent=e.artist||"Unknown Artist",i.append(n,a),s.append(i),this.playlistTracksEl?.append(s)})}updatePlaylistActive(){this.playlistTracksEl&&Array.from(this.playlistTracksEl.children).forEach((e,t)=>{e.classList.toggle(`${us}__playlist-track--active`,t===this.playlistIndex)})}updateUI(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"auto",i=this.getBool("show-controls",!0),n=this.getBool("show-progress",!0),a=this.getBool("show-time",!0),r=this.getBool("show-volume",!0),o=this.getBool("show-settings",!1);this.className=[us,`${us}--size-${e}`,`${us}--variant-${t}`,`${us}--theme-${s}`,this.isPlaying&&`${us}--playing`,!this.isPlaying&&`${us}--paused`,this.isMuted&&`${us}--muted`,this.isLoading&&`${us}--loading`,this.error&&`${us}--error`,this.isShuffle&&`${us}--shuffle`,`${us}--repeat-${this.currentRepeatMode}`].filter(Boolean).join(" "),this.audioEl&&(this.audioEl.autoplay=this.getBool("auto-play"),this.audioEl.loop=this.getBool("loop"),this.audioEl.muted=this.getBool("muted"),this.audioEl.playbackRate=this.playbackRate),this.progressEl&&(this.progressEl.hidden=!n),this.controlsEl&&(this.controlsEl.hidden=!i),this.timeEl&&(this.timeEl.hidden=!a),this.volumeWrap&&(this.volumeWrap.hidden=!r),this.settingsEl&&(this.settingsEl.hidden=!o),this.rateSelect.replaceChildren(...this.getPlaybackRates().map(e=>{const t=document.createElement("option");return t.value=String(e),t.textContent=`${e}x`,e===this.playbackRate&&(t.selected=!0),t})),this.rebuildControlButtons(),this.updateTrackInfo(),this.updateProgress(),this.updateTime(),this.updateVolumeUI(),this.updateSettingsMenu(),this.rebuildPlaylist()}}customElements.get("db-audio-player")||customElements.define("db-audio-player",DbAudioPlayer);var bs={exports:{}};!function(t){var s=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,i={},n={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function encode(e){return e instanceof Token?new Token(e.type,encode(e.content),e.alias):Array.isArray(e)?e.map(encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++s}),e.__id},clone:function deepClone(e,t){var s,i;switch(t=t||{},n.util.type(e)){case"Object":if(i=n.util.objId(e),t[i])return t[i];for(var a in s={},t[i]=s,e)e.hasOwnProperty(a)&&(s[a]=deepClone(e[a],t));return s;case"Array":return i=n.util.objId(e),t[i]?t[i]:(s=[],t[i]=s,e.forEach(function(e,i){s[i]=deepClone(e,t)}),s);default:return e}},getLanguage:function(e){for(;e;){var s=t.exec(e.className);if(s)return s[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,s){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+s)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(i){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(i.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var s in t)if(t[s].src==e)return t[s]}return null}},isActive:function(e,t,s){for(var i="no-"+t;e;){var n=e.classList;if(n.contains(t))return!0;if(n.contains(i))return!1;e=e.parentElement}return!!s}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(e,t){var s=n.util.clone(n.languages[e]);for(var i in t)s[i]=t[i];return s},insertBefore:function(e,t,s,i){var a=(i=i||n.languages)[e],r={};for(var o in a)if(a.hasOwnProperty(o)){if(o==t)for(var l in s)s.hasOwnProperty(l)&&(r[l]=s[l]);s.hasOwnProperty(o)||(r[o]=a[o])}var d=i[e];return i[e]=r,n.languages.DFS(n.languages,function(t,s){s===d&&t!=e&&(this[t]=r)}),r},DFS:function DFS(e,t,s,i){i=i||{};var a=n.util.objId;for(var r in e)if(e.hasOwnProperty(r)){t.call(e,r,e[r],s||r);var o=e[r],l=n.util.type(o);"Object"!==l||i[a(o)]?"Array"!==l||i[a(o)]||(i[a(o)]=!0,DFS(o,t,r,i)):(i[a(o)]=!0,DFS(o,t,null,i))}}},plugins:{},highlightAll:function(e,t){n.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,s){var i={callback:s,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",i),i.elements=Array.prototype.slice.apply(i.container.querySelectorAll(i.selector)),n.hooks.run("before-all-elements-highlight",i);for(var a,r=0;a=i.elements[r++];)n.highlightElement(a,!0===t,i.callback)},highlightElement:function(t,s,i){var a=n.util.getLanguage(t),r=n.languages[a];n.util.setLanguage(t,a);var o=t.parentElement;o&&"pre"===o.nodeName.toLowerCase()&&n.util.setLanguage(o,a);var l={element:t,language:a,grammar:r,code:t.textContent};function insertHighlightedCode(e){l.highlightedCode=e,n.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,n.hooks.run("after-highlight",l),n.hooks.run("complete",l),i&&i.call(l.element)}if(n.hooks.run("before-sanity-check",l),(o=l.element.parentElement)&&"pre"===o.nodeName.toLowerCase()&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","0"),!l.code)return n.hooks.run("complete",l),void(i&&i.call(l.element));if(n.hooks.run("before-highlight",l),l.grammar)if(s&&e.Worker){var d=new Worker(n.filename);d.onmessage=function(e){insertHighlightedCode(e.data)},d.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else insertHighlightedCode(n.highlight(l.code,l.grammar,l.language));else insertHighlightedCode(n.util.encode(l.code))},highlight:function(e,t,s){var i={code:e,grammar:t,language:s};if(n.hooks.run("before-tokenize",i),!i.grammar)throw new Error('The language "'+i.language+'" has no grammar.');return i.tokens=n.tokenize(i.code,i.grammar),n.hooks.run("after-tokenize",i),Token.stringify(n.util.encode(i.tokens),i.language)},tokenize:function(e,t){var s=t.rest;if(s){for(var i in s)t[i]=s[i];delete t.rest}var n=new LinkedList;return addAfter(n,n.head,e),matchGrammar(e,n,t,n.head,0),function toArray(e){var t=[],s=e.head.next;for(;s!==e.tail;)t.push(s.value),s=s.next;return t}(n)},hooks:{all:{},add:function(e,t){var s=n.hooks.all;s[e]=s[e]||[],s[e].push(t)},run:function(e,t){var s=n.hooks.all[e];if(s&&s.length)for(var i,a=0;i=s[a++];)i(t)}},Token:Token};function Token(e,t,s,i){this.type=e,this.content=t,this.alias=s,this.length=0|(i||"").length}function matchPattern(e,t,s,i){e.lastIndex=t;var n=e.exec(s);if(n&&i&&n[1]){var a=n[1].length;n.index+=a,n[0]=n[0].slice(a)}return n}function matchGrammar(e,t,s,i,a,r){for(var o in s)if(s.hasOwnProperty(o)&&s[o]){var l=s[o];l=Array.isArray(l)?l:[l];for(var d=0;d<l.length;++d){if(r&&r.cause==o+","+d)return;var u=l[d],b=u.inside,m=!!u.lookbehind,p=!!u.greedy,g=u.alias;if(p&&!u.pattern.global){var v=u.pattern.toString().match(/[imsuy]*$/)[0];u.pattern=RegExp(u.pattern.source,v+"g")}for(var E=u.pattern||u,f=i.next,w=a;f!==t.tail&&!(r&&w>=r.reach);w+=f.value.length,f=f.next){var y=f.value;if(t.length>e.length)return;if(!(y instanceof Token)){var A,_=1;if(p){if(!(A=matchPattern(E,w,e,m))||A.index>=e.length)break;var C=A.index,x=A.index+A[0].length,k=w;for(k+=f.value.length;C>=k;)k+=(f=f.next).value.length;if(w=k-=f.value.length,f.value instanceof Token)continue;for(var S=f;S!==t.tail&&(k<x||"string"==typeof S.value);S=S.next)_++,k+=S.value.length;_--,y=e.slice(w,k),A.index-=w}else if(!(A=matchPattern(E,0,y,m)))continue;C=A.index;var N=A[0],$=y.slice(0,C),I=y.slice(C+N.length),D=w+y.length;r&&D>r.reach&&(r.reach=D);var L=f.prev;if($&&(L=addAfter(t,L,$),w+=$.length),removeRange(t,L,_),f=addAfter(t,L,new Token(o,b?n.tokenize(N,b):N,g,N)),I&&addAfter(t,f,I),_>1){var M={cause:o+","+d,reach:D};matchGrammar(e,t,s,f.prev,w,M),r&&M.reach>r.reach&&(r.reach=M.reach)}}}}}}function LinkedList(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function addAfter(e,t,s){var i=t.next,n={value:s,prev:t,next:i};return t.next=n,i.prev=n,e.length++,n}function removeRange(e,t,s){for(var i=t.next,n=0;n<s&&i!==e.tail;n++)i=i.next;t.next=i,i.prev=t,e.length-=n}if(e.Prism=n,Token.stringify=function stringify(e,t){if("string"==typeof e)return e;if(Array.isArray(e)){var s="";return e.forEach(function(e){s+=stringify(e,t)}),s}var i={type:e.type,content:stringify(e.content,t),tag:"span",classes:["token",e.type],attributes:{},language:t},a=e.alias;a&&(Array.isArray(a)?Array.prototype.push.apply(i.classes,a):i.classes.push(a)),n.hooks.run("wrap",i);var r="";for(var o in i.attributes)r+=" "+o+'="'+(i.attributes[o]||"").replace(/"/g,""")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+r+">"+i.content+"</"+i.tag+">"},!e.document)return e.addEventListener?(n.disableWorkerMessageHandler||e.addEventListener("message",function(t){var s=JSON.parse(t.data),i=s.language,a=s.code,r=s.immediateClose;e.postMessage(n.highlight(a,n.languages[i],i)),r&&e.close()},!1),n):n;var a=n.util.currentScript();function highlightAutomaticallyCallback(){n.manual||n.highlightAll()}if(a&&(n.filename=a.src,a.hasAttribute("data-manual")&&(n.manual=!0)),!n.manual){var r=document.readyState;"loading"===r||"interactive"===r&&a&&a.defer?document.addEventListener("DOMContentLoaded",highlightAutomaticallyCallback):window.requestAnimationFrame?window.requestAnimationFrame(highlightAutomaticallyCallback):window.setTimeout(highlightAutomaticallyCallback,16)}return n}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});t.exports&&(t.exports=s),void 0!==e&&(e.Prism=s),s.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},s.languages.markup.tag.inside["attr-value"].inside.entity=s.languages.markup.entity,s.languages.markup.doctype.inside["internal-subset"].inside=s.languages.markup,s.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(s.languages.markup.tag,"addInlined",{value:function addInlined(e,t){var i={};i["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:s.languages[t]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};n["language-"+t]={pattern:/[\s\S]+/,inside:s.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},s.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(s.languages.markup.tag,"addAttribute",{value:function(e,t){s.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:s.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),s.languages.html=s.languages.markup,s.languages.mathml=s.languages.markup,s.languages.svg=s.languages.markup,s.languages.xml=s.languages.extend("markup",{}),s.languages.ssml=s.languages.xml,s.languages.atom=s.languages.xml,s.languages.rss=s.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var s=e.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))}(s),s.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},s.languages.javascript=s.languages.extend("clike",{"class-name":[s.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),s.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,s.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:s.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:s.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:s.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:s.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:s.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),s.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:s.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),s.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),s.languages.markup&&(s.languages.markup.tag.addInlined("script","javascript"),s.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),s.languages.js=s.languages.javascript,function(){if(void 0!==s&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",i="loading",n="loaded",a="pre[data-src]:not(["+t+'="'+n+'"]):not(['+t+'="'+i+'"])';s.hooks.add("before-highlightall",function(e){e.selector+=", "+a}),s.hooks.add("before-sanity-check",function(r){var o=r.element;if(o.matches(a)){r.code="",o.setAttribute(t,i);var l=o.appendChild(document.createElement("CODE"));l.textContent="Loading…";var d=o.getAttribute("data-src"),u=r.language;if("none"===u){var b=(/\.(\w+)$/.exec(d)||[,"none"])[1];u=e[b]||b}s.util.setLanguage(l,u),s.util.setLanguage(o,u);var m=s.plugins.autoloader;m&&m.loadLanguages(u),function loadFile(e,t,s){var i=new XMLHttpRequest;i.open("GET",e,!0),i.onreadystatechange=function(){4==i.readyState&&(i.status<400&&i.responseText?t(i.responseText):i.status>=400?s("✖ Error "+i.status+" while fetching file: "+i.statusText):s("✖ Error: File does not exist or is empty"))},i.send(null)}(d,function(e){o.setAttribute(t,n);var i=function parseRange(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var s=Number(t[1]),i=t[2],n=t[3];return i?n?[s,Number(n)]:[s,void 0]:[s,s]}}(o.getAttribute("data-range"));if(i){var a=e.split(/\r\n?|\n/g),r=i[0],d=null==i[1]?a.length:i[1];r<0&&(r+=a.length),r=Math.max(0,Math.min(r-1,a.length)),d<0&&(d+=a.length),d=Math.max(0,Math.min(d,a.length)),e=a.slice(r,d).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(r+1))}l.textContent=e,s.highlightElement(l)},function(e){o.setAttribute(t,"failed"),l.textContent=e})}}),s.plugins.fileHighlight={highlight:function highlight(e){for(var t,i=(e||document).querySelectorAll(a),n=0;t=i[n++];)s.highlightElement(t)}};var r=!1;s.fileHighlight=function(){r||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),r=!0),s.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}(bs);var ms=bs.exports,ps=t(ms),gs=_mergeNamespaces({__proto__:null,default:ps},[ms]);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function addInlined(e,t){var s={};s["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};i["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var n={};n[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:i},Prism.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var s=e.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))}(Prism),Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},i={bash:s,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=e.languages.bash;for(var n=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=i.variable[1].inside,r=0;r<n.length;r++)a[n[r]]=e.languages.bash[n[r]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(Prism),function(e){var t=e.util.clone(e.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,n=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function re(e,t){return e=e.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return i}).replace(/<SPREAD>/g,function(){return n}),RegExp(e,t)}n=re(n).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=re(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:re(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:re(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var stringifyToken=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(stringifyToken).join(""):""},walkTokens=function(t){for(var s=[],i=0;i<t.length;i++){var n=t[i],a=!1;if("string"!=typeof n&&("tag"===n.type&&n.content[0]&&"tag"===n.content[0].type?"</"===n.content[0].content[0].content?s.length>0&&s[s.length-1].tagName===stringifyToken(n.content[0].content[1])&&s.pop():"/>"===n.content[n.content.length-1].content||s.push({tagName:stringifyToken(n.content[0].content[1]),openedBraces:0}):s.length>0&&"punctuation"===n.type&&"{"===n.content?s[s.length-1].openedBraces++:s.length>0&&s[s.length-1].openedBraces>0&&"punctuation"===n.type&&"}"===n.content?s[s.length-1].openedBraces--:a=!0),(a||"string"==typeof n)&&s.length>0&&0===s[s.length-1].openedBraces){var r=stringifyToken(n);i<t.length-1&&("string"==typeof t[i+1]||"plain-text"===t[i+1].type)&&(r+=stringifyToken(t[i+1]),t.splice(i+1,1)),i>0&&("string"==typeof t[i-1]||"plain-text"===t[i-1].type)&&(r=stringifyToken(t[i-1])+r,t.splice(i-1,1),i--),t[i]=new e.Token("plain-text",r,null,r)}n.content&&"string"!=typeof n.content&&walkTokens(n.content)}};e.hooks.add("after-tokenize",function(e){"jsx"!==e.language&&"tsx"!==e.language||walkTokens(e.tokens)})}(Prism),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var s=e.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0}(Prism);const vs={js:"javascript",ts:"typescript",sh:"bash",shell:"bash",html:"markup",xml:"markup",svg:"markup"},Es={javascript:"JavaScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",css:"CSS",scss:"SCSS",json:"JSON",bash:"Bash",markup:"HTML"},resolvePrismLanguage=e=>{const t=e.toLowerCase().trim();return vs[t]??t},formatLanguageLabel=e=>{const t=resolvePrismLanguage(e);return Es[t]??e.toUpperCase()},highlightWithPrism=(e,t)=>{const s=(()=>{const e=globalThis.Prism;return e?.languages?e:ps??gs})(),i=resolvePrismLanguage(t),n=s.languages[i];if(!n)return null;try{return s.highlight(e,n,i)}catch{return null}},highlightCodeSync=(e,t)=>highlightWithPrism(e,t),fs="designbase-wc-code-block";class DbCodeBlock extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.renderToken=0,this.internalActiveId="",this.copied=!1,this.editedCodes={},this.handleSegmentChange=e=>{const t=e,s=t.detail?.value;s&&(this.hasAttribute("active-id")||(this.internalActiveId=s),this.dispatchEvent(new CustomEvent("db-active-id-change",{detail:{activeId:s},bubbles:!0,composed:!0})),this.render())}}static get observedAttributes(){return["items","code","language","default-active-id","active-id","show-language","highlight","theme","show-copy","copied-label","copy-label","min-height","max-height","overflow","editable"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.internalActiveId=this.getAttribute("default-active-id")||this.getResolvedItems()[0]?.id||""),this.render(),Promise.resolve().then(()=>{this.isConnected&&this.built&&this.render()}),this.addEventListener("db-change",this.handleSegmentChange)}disconnectedCallback(){this.removeEventListener("db-change",this.handleSegmentChange),this.copyTimeout&&window.clearTimeout(this.copyTimeout)}attributeChangedCallback(e){if(this.built)if("active-id"!==e){if("items"===e||"code"===e||"language"===e){const e=this.getResolvedItems();e.find(e=>e.id===this.getActiveId())||(this.internalActiveId=e[0]?.id||"")}this.render()}else this.render()}getBool(e,t=!0){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getResolvedItems(){const e=this.getAttribute("items");if(e)try{const t=JSON.parse(e);if(Array.isArray(t)&&t.length>0)return t}catch{}const t=this.getAttribute("code");if(t){const e=this.getAttribute("language")||"tsx";return[{id:"default",label:e,code:t,language:e}]}return[]}getActiveId(){return this.getAttribute("active-id")||this.internalActiveId}getActiveItem(){const e=this.getResolvedItems();return e.find(e=>e.id===this.getActiveId())||e[0]}toCssSize(e){if(e)return/^\d+$/.test(e)?`${e}px`:e}async handleCopy(){const e=this.getActiveItem(),t=this.getBool("editable",!1),s=(t?this.editedCodes[e?.id??""]??e?.code:e?.code)?.trim();if(s){try{await navigator.clipboard.writeText(s)}catch{const e=document.createElement("textarea");e.value=s,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),e.remove()}this.copied=!0,this.render(),this.copyTimeout&&window.clearTimeout(this.copyTimeout),this.copyTimeout=window.setTimeout(()=>{this.copied=!1,this.render()},1600)}}render(){const e=++this.renderToken;this.renderNow(e)}renderNow(e){const t=this.getActiveItem();if(!t)return void this.replaceChildren();const s=this.getResolvedItems(),i=s.length>1,n=this.getAttribute("language")||"tsx",a=t.language??n,r=this.getBool("show-language",!0),o=this.getBool("highlight",!0),l=this.getAttribute("theme")||"auto",d=this.getBool("show-copy",!0),u=this.getAttribute("copied-label")||"복사됨",b=this.getAttribute("copy-label")||"복사",m=this.getAttribute("overflow")||"scroll-x",p=this.getBool("editable",!1),g=p?this.editedCodes[t.id]??t.code:t.code,v=g.trim();let E=null;if(o&&g)try{E=highlightCodeSync(g,a)}catch{E=null}if(e!==this.renderToken)return;const f=this.toCssSize(this.getAttribute("min-height")),w=this.toCssSize(this.getAttribute("max-height"));f?this.style.setProperty("--db-code-block-min-height",f):this.style.removeProperty("--db-code-block-min-height"),w?this.style.setProperty("--db-code-block-max-height",w):this.style.removeProperty("--db-code-block-max-height"),this.className=[fs,`${fs}--overflow-${m}`,"auto"!==l&&`${fs}--theme-${l}`,p&&`${fs}--editable`].filter(Boolean).join(" ");const y=document.createElement("div");y.className=`${fs}__toolbar`;const A=document.createElement("div");if(A.className=`${fs}__toolbar-left`,i){const e=document.createElement("db-segment-control");e.setAttribute("size","s"),e.setAttribute("options",JSON.stringify(s.map(e=>({value:e.id,label:e.label})))),e.setAttribute("value",this.getActiveId()),A.append(e)}if(r){const e=document.createElement("span");e.className=`${fs}__language`,e.textContent=formatLanguageLabel(a),A.append(e)}if(y.append(A),d){const e=document.createElement("db-button");e.setAttribute("type","button"),e.setAttribute("variant","tertiary"),e.setAttribute("size","s"),e.setAttribute("start-icon",this.copied?"done":"copy"),e.textContent=this.copied?u:b,e.addEventListener("db-click",()=>this.handleCopy()),y.append(e)}const _=document.createElement("div");if(_.className=`${fs}__body`,i&&t.description){const e=document.createElement("p");e.className=`${fs}__caption`,e.textContent=t.description,_.append(e)}if(p){void 0===this.editedCodes[t.id]&&(this.editedCodes[t.id]=t.code);const e=document.createElement("div");e.className=`${fs}__editor`;const s=document.createElement("pre");s.className=`${fs}__pre ${fs}__pre--mirror`,s.setAttribute("aria-hidden","true");const i=document.createElement("code");i.className=`${fs}__code language-${a}`,E?i.innerHTML=E:i.textContent=g,s.append(i);const n=document.createElement("textarea");n.className=`${fs}__textarea`,n.value=g,n.spellcheck=!1,n.setAttribute("autocapitalize","off"),n.setAttribute("autocorrect","off"),n.setAttribute("aria-label",`${formatLanguageLabel(a)} 코드 편집`),n.addEventListener("input",()=>{this.editedCodes[t.id]=n.value;const e=o&&n.value?highlightCodeSync(n.value,a):null;e?i.innerHTML=e:i.textContent=n.value,this.dispatchEvent(new CustomEvent("db-code-change",{detail:{code:n.value,itemId:t.id},bubbles:!0,composed:!0}))}),e.append(s,n),_.append(e)}else{const e=document.createElement("pre");e.className=`${fs}__pre`;const t=document.createElement("code");t.className=`${fs}__code language-${a}`,E?t.innerHTML=E:t.textContent=v,e.append(t),_.append(e)}this.replaceChildren(y,_)}}customElements.get("db-code-block")||customElements.define("db-code-block",DbCodeBlock);const ws="designbase-wc-markdown-editor";class DbMarkdownEditor extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.internalValue="",this.currentMode="preview",this.isFocused=!1,this.wordCount=0,this.lineCount=0,this.lastSaved=null,this.isSaving=!1,this.handleKeyDown=e=>{if(this.getBool("disabled")||this.getBool("readonly"))return;const{ctrlKey:t,shiftKey:s,key:i}=e;t&&"b"===i?(e.preventDefault(),this.insertText("**","**","**")):t&&"i"===i?(e.preventDefault(),this.insertText("*","*","*")):t&&"k"===i?(e.preventDefault(),this.insertText("[","](",")")):t&&"`"===i?(e.preventDefault(),this.insertText("`","`","`")):t&&s&&"S"===i?(e.preventDefault(),this.insertText("~~","~~","~~")):"Tab"===i&&(e.preventDefault(),this.insertText(" ","",""))}}static get observedAttributes(){return["size","variant","mode","theme","value","placeholder","min-height","max-height","auto-height","readonly","disabled","show-toolbar","show-status","show-word-count","show-line-count","auto-save","auto-save-interval","file-upload"]}connectedCallback(){this.built||(this.built=!0,this.build()),this.syncFromAttributes(),this.renderMode(),this.updateCounts(),this.updateStatus(),this.setupAutoSave()}disconnectedCallback(){this.autoSaveTimer&&window.clearInterval(this.autoSaveTimer)}attributeChangedCallback(e){if(this.built){if("value"===e&&this.textareaEl)return this.internalValue=this.getAttribute("value")||"",this.textareaEl.value=this.internalValue,this.updatePreview(),this.updateCodeView(),void this.updateCounts();if("mode"===e)return this.currentMode=this.getAttribute("mode")||"preview",void this.renderMode();"auto-save"!==e&&"auto-save-interval"!==e||this.setupAutoSave(),this.updateRootClasses()}}get value(){return this.internalValue}set value(e){this.internalValue=e,this.setAttribute("value",e),this.textareaEl&&(this.textareaEl.value=e),this.updatePreview(),this.updateCodeView(),this.updateCounts()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}syncFromAttributes(){if(this.internalValue=this.getAttribute("value")||"",this.currentMode=this.getAttribute("mode")||"preview",this.textareaEl){this.textareaEl.value=this.internalValue,this.textareaEl.placeholder=this.getAttribute("placeholder")||"마크다운을 입력하세요...",this.textareaEl.readOnly=this.getBool("readonly"),this.textareaEl.disabled=this.getBool("disabled");const e=Number(this.getAttribute("min-height")||200),t=Number(this.getAttribute("max-height")||600),s=this.getBool("auto-height");this.textareaEl.style.minHeight=s?"auto":`${e}px`,this.textareaEl.style.maxHeight=s?"none":`${t}px`}this.updateRootClasses(),this.updatePreview(),this.updateCodeView()}updateRootClasses(){const e=this.getAttribute("size")||"m",t=this.getAttribute("variant")||"default",s=this.getAttribute("theme")||"light";this.className=[ws,`${ws}--size-${e}`,`${ws}--variant-${t}`,`${ws}--mode-${this.currentMode}`,`${ws}--theme-${s}`,this.isFocused&&`${ws}--focused`,this.getBool("disabled")&&`${ws}--disabled`,this.getBool("readonly")&&`${ws}--readonly`].filter(Boolean).join(" ")}markdownToHtml(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/~~(.*)~~/gim,"<del>$1</del>").replace(/`(.*)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/!\[([^\]]*)\]\(([^)]+)\)/gim,'<img alt="$1" src="$2" />').replace(/^> (.*$)/gim,"<blockquote>$1</blockquote>").replace(/^- (.*$)/gim,"<ul><li>$1</li></ul>").replace(/^(\d+)\. (.*$)/gim,"<ol><li>$2</li></ol>").replace(/\n/gim,"<br />")}updatePreview(){this.previewEl&&(this.previewEl.innerHTML=this.markdownToHtml(this.internalValue))}updateCodeView(){if(this.codeViewEl){const e=this.codeViewEl.querySelector("code");e&&(e.textContent=this.internalValue)}}updateCounts(){this.wordCount=this.internalValue.trim()?this.internalValue.trim().split(/\s+/).length:0,this.lineCount=this.internalValue?this.internalValue.split("\n").length:0,this.wordCountEl&&(this.wordCountEl.textContent=`단어: ${this.wordCount}`),this.lineCountEl&&(this.lineCountEl.textContent=`라인: ${this.lineCount}`)}updateStatus(){if(!this.statusEl)return;const e=this.getBool("show-status",!0);this.statusEl.hidden=!e,this.wordCountEl&&(this.wordCountEl.hidden=!this.getBool("show-word-count",!0)),this.lineCountEl&&(this.lineCountEl.hidden=!this.getBool("show-line-count",!0)),this.lastSavedEl&&(this.lastSavedEl.hidden=!this.lastSaved,this.lastSaved&&(this.lastSavedEl.textContent=`저장됨: ${this.lastSaved.toLocaleTimeString()}`)),this.savingEl&&(this.savingEl.hidden=!this.isSaving)}emitChange(){this.dispatchEvent(new CustomEvent("db-change",{detail:{value:this.internalValue},bubbles:!0,composed:!0}))}insertText(e,t="",s=""){if(!this.textareaEl||this.getBool("disabled")||this.getBool("readonly"))return;const{selectionStart:i,selectionEnd:n}=this.textareaEl,a=this.internalValue.substring(i,n),r=t+(a||e)+s,o=this.internalValue.substring(0,i)+r+this.internalValue.substring(n);this.internalValue=o,this.textareaEl.value=o,this.emitChange(),this.updatePreview(),this.updateCodeView(),this.updateCounts();const l=i+t.length+(a?a.length:e.length);window.setTimeout(()=>{this.textareaEl&&(this.textareaEl.setSelectionRange(l,l),this.textareaEl.focus())},0)}getDefaultToolbarActions(){return[{id:"bold",label:"B",tooltip:"굵게 (Ctrl+B)",shortcut:"Ctrl+B",action:()=>this.insertText("**","**","**")},{id:"italic",label:"I",tooltip:"기울임 (Ctrl+I)",shortcut:"Ctrl+I",action:()=>this.insertText("*","*","*")},{id:"strikethrough",label:"S",tooltip:"취소선 (Ctrl+Shift+S)",shortcut:"Ctrl+Shift+S",action:()=>this.insertText("~~","~~","~~")},{id:"separator1",label:"|",separator:!0,action:()=>{}},{id:"heading1",label:"H1",tooltip:"제목 1",action:()=>this.insertText("# ","","")},{id:"heading2",label:"H2",tooltip:"제목 2",action:()=>this.insertText("## ","","")},{id:"heading3",label:"H3",tooltip:"제목 3",action:()=>this.insertText("### ","","")},{id:"separator2",label:"|",separator:!0,action:()=>{}},{id:"link",label:"",icon:"share-alt",tooltip:"링크 (Ctrl+K)",shortcut:"Ctrl+K",action:()=>this.insertText("[","](",")")},{id:"image",label:"",icon:"video",tooltip:"이미지",action:()=>this.insertText("")},{id:"code",label:"",icon:"code",tooltip:"인라인 코드 (Ctrl+`)",shortcut:"Ctrl+`",action:()=>this.insertText("`","`","`")},{id:"codeBlock",label:"```",tooltip:"코드 블록",action:()=>this.insertText("\n```\n","","\n```\n")},{id:"separator3",label:"|",separator:!0,action:()=>{}},{id:"list",label:"•",tooltip:"순서 없는 목록",action:()=>this.insertText("- ","","")},{id:"orderedList",label:"1.",tooltip:"순서 있는 목록",action:()=>this.insertText("1. ","","")},{id:"quote",label:'"',tooltip:"인용구",action:()=>this.insertText("> ","","")},{id:"separator4",label:"|",separator:!0,action:()=>{}},{id:"table",label:"⊞",tooltip:"테이블",action:()=>this.insertText("\n| 헤더1 | 헤더2 | 헤더3 |\n|-------|-------|-------|\n| 셀1 | 셀2 | 셀3 |\n","","")},{id:"horizontalRule",label:"—",tooltip:"수평선",action:()=>this.insertText("\n---\n","","")}]}renderToolbar(){if(!this.toolbarEl)return;const e=this.getBool("show-toolbar",!0);this.toolbarEl.hidden=!e,this.toolbarEl.replaceChildren();const t=document.createElement("div");t.className=`${ws}__mode-buttons`;[{mode:"edit",icon:"write",title:"편집 모드"},{mode:"preview",icon:"show",title:"미리보기 모드"},{mode:"split",icon:"hide",title:"분할 모드"},{mode:"code",icon:"code",title:"코드 보기"}].forEach(({mode:e,icon:s,title:i})=>{const n=document.createElement("button");n.type="button",n.className=`${ws}__mode-button${this.currentMode===e?` ${ws}__mode-button--active`:""}`,n.title=i,n.append(createDbIcon(s,16)),n.addEventListener("click",()=>{this.currentMode=e,this.updateRootClasses(),this.renderMode(),this.renderToolbar()}),t.append(n)}),this.toolbarEl.append(t);const s=document.createElement("div");if(s.className=`${ws}__toolbar-separator`,this.toolbarEl.append(s),"code"!==this.currentMode&&(this.getDefaultToolbarActions().forEach(e=>{const t=document.createElement("button");if(t.type="button",t.className=`${ws}__toolbar-item`,t.disabled=this.getBool("disabled"),e.tooltip&&(t.title=e.tooltip),e.icon)t.append(createDbIcon(e.icon,16));else if("bold"===e.id){const s=document.createElement("strong");s.textContent=e.label,t.append(s)}else if("italic"===e.id){const s=document.createElement("em");s.textContent=e.label,t.append(s)}else if("strikethrough"===e.id){const s=document.createElement("span");s.style.textDecoration="line-through",s.textContent=e.label,t.append(s)}else t.textContent=e.label;if(e.shortcut){const s=document.createElement("span");s.className=`${ws}__toolbar-shortcut`,s.textContent=e.shortcut,t.append(s)}t.addEventListener("click",e.action),this.toolbarEl?.append(t)}),this.getBool("file-upload"))){const e=document.createElement("label");e.className=`${ws}__file-upload`;const t=document.createElement("input");t.type="file",t.accept="image/*",t.hidden=!0,t.addEventListener("change",async()=>{const e=t.files?.[0];if(!e)return;const s=new CustomEvent("db-file-upload",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(s),!s.defaultPrevented){const t=URL.createObjectURL(e);this.insertText(``)}t.value=""}),e.append(t,createDbIcon("upload",16)),this.toolbarEl.append(e)}}renderMode(){if(!this.editPanelEl||!this.previewPanelEl||!this.codePanelEl)return;const e="edit"===this.currentMode||"split"===this.currentMode,t="preview"===this.currentMode||"split"===this.currentMode,s="code"===this.currentMode;this.editPanelEl.hidden=!e,this.previewPanelEl.hidden=!t,this.codePanelEl.hidden=!s,this.updateRootClasses(),this.renderToolbar()}setupAutoSave(){if(this.autoSaveTimer&&window.clearInterval(this.autoSaveTimer),!this.getBool("auto-save"))return;const e=Number(this.getAttribute("auto-save-interval")||3e4);this.autoSaveTimer=window.setInterval(()=>{const e=this.getAttribute("value")||"";this.internalValue&&this.internalValue!==e&&(this.isSaving=!0,this.updateStatus(),this.dispatchEvent(new CustomEvent("db-save",{detail:{value:this.internalValue},bubbles:!0,composed:!0})),this.isSaving=!1,this.lastSaved=new Date,this.updateStatus())},e)}build(){this.toolbarEl=document.createElement("div"),this.toolbarEl.className=`${ws}__toolbar`,this.contentEl=document.createElement("div"),this.contentEl.className=`${ws}__content`,this.editPanelEl=document.createElement("div"),this.editPanelEl.className=`${ws}__edit-panel`,this.textareaEl=document.createElement("textarea"),this.textareaEl.className=`${ws}__textarea`,this.textareaEl.addEventListener("input",()=>{this.internalValue=this.textareaEl?.value||"",this.emitChange(),this.updatePreview(),this.updateCodeView(),this.updateCounts()}),this.textareaEl.addEventListener("focus",()=>{this.isFocused=!0,this.updateRootClasses(),this.dispatchEvent(new CustomEvent("db-focus",{bubbles:!0,composed:!0}))}),this.textareaEl.addEventListener("blur",()=>{this.isFocused=!1,this.updateRootClasses(),this.dispatchEvent(new CustomEvent("db-blur",{bubbles:!0,composed:!0}))}),this.textareaEl.addEventListener("keydown",this.handleKeyDown),this.editPanelEl.append(this.textareaEl),this.previewPanelEl=document.createElement("div"),this.previewPanelEl.className=`${ws}__preview-panel`,this.previewEl=document.createElement("div"),this.previewEl.className=`${ws}__preview`,this.previewPanelEl.append(this.previewEl),this.codePanelEl=document.createElement("div"),this.codePanelEl.className=`${ws}__code-panel`,this.codeViewEl=document.createElement("pre"),this.codeViewEl.className=`${ws}__code-view`;const e=document.createElement("code");this.codeViewEl.append(e),this.codePanelEl.append(this.codeViewEl),this.contentEl.append(this.editPanelEl,this.previewPanelEl,this.codePanelEl),this.statusEl=document.createElement("div"),this.statusEl.className=`${ws}__status`,this.wordCountEl=document.createElement("span"),this.wordCountEl.className=`${ws}__word-count`,this.lineCountEl=document.createElement("span"),this.lineCountEl.className=`${ws}__line-count`,this.lastSavedEl=document.createElement("span"),this.lastSavedEl.className=`${ws}__last-saved`,this.savingEl=document.createElement("span"),this.savingEl.className=`${ws}__saving`,this.savingEl.textContent="저장 중...",this.statusEl.append(this.wordCountEl,this.lineCountEl,this.lastSavedEl,this.savingEl),this.append(this.toolbarEl,this.contentEl,this.statusEl)}}customElements.get("db-markdown-editor")||customElements.define("db-markdown-editor",DbMarkdownEditor);const ys="designbase-wc-testimonial",As=["list","card"];class DbTestimonial extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["quote","author","role","company","avatar","avatar-initials","rating","max-rating","variant","align"]}connectedCallback(){this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}build(){this.innerEl=document.createElement("div"),this.quoteEl=document.createElement("p"),this.quoteEl.className=`${ys}__quote`,this.footerEl=document.createElement("div"),this.footerEl.className=`${ys}__footer`,this.avatarWrapEl=document.createElement("div"),this.avatarWrapEl.className=`${ys}__avatar`,this.avatarEl=document.createElement("db-avatar"),this.avatarEl.className=`${ys}__avatar-image`,this.avatarWrapEl.append(this.avatarEl);const e=document.createElement("div");e.className=`${ys}__meta`,this.authorEl=document.createElement("span"),this.authorEl.className=`${ys}__author`,this.roleEl=document.createElement("span"),this.roleEl.className=`${ys}__role`,this.ratingEl=document.createElement("db-rating"),this.ratingEl.className=`${ys}__rating`,this.ratingEl.setAttribute("display","stars"),this.ratingEl.setAttribute("variant","inline"),this.ratingEl.setAttribute("allow-half",""),this.ratingEl.setAttribute("readonly",""),this.ratingEl.setAttribute("hover-effect","false"),this.ratingEl.setAttribute("color","primary"),this.ratingEl.hidden=!0,e.append(this.authorEl,this.roleEl,this.ratingEl),this.footerEl.append(this.avatarWrapEl,e),this.extraEl=document.createElement("div"),this.extraEl.className=`${ys}__extra`,this.extraEl.hidden=!0,this.innerEl.append(this.quoteEl,this.footerEl,this.extraEl),this.append(this.innerEl)}getVariant(){const e=this.getAttribute("variant")||"card";return As.includes(e)?e:"card"}getAvatarSize(){return"list"===this.getVariant()?"s":"m"}syncExtraContent(){if(!this.extraEl)return;const e=Array.from(this.childNodes).filter(e=>e!==this.innerEl&&(e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&e.textContent?.trim()));if(0===e.length)return this.extraEl.hidden=!0,void this.extraEl.replaceChildren();this.extraEl.hidden=!1,this.extraEl.replaceChildren(...e.map(e=>e.cloneNode(!0)))}updateUI(){const e=this.getAttribute("quote")||"",t=this.getAttribute("author")||"",s=this.getAttribute("role")||"",i=this.getAttribute("company")||"",n=this.getAttribute("avatar")||"",a=this.getAttribute("avatar-initials")||"",r=this.getAttribute("rating"),o=Number(this.getAttribute("max-rating")||5),l=null!==r&&""!==r?function clampRating(e,t){if("number"==typeof e&&!Number.isNaN(e))return e<0?0:e>t?t:Math.round(10*e)/10}(Number(r),o):void 0,d=this.getVariant(),u=this.getAttribute("align")||"left",b=[ys,`${ys}--variant-${d}`,"left"!==u?`${ys}--align-${u}`:""].filter(Boolean).join(" ");this.className=b,this.innerEl&&(this.innerEl.className=`${ys}__inner`),this.quoteEl&&(this.quoteEl.textContent=e?`“${e}”`:""),this.authorEl&&(this.authorEl.textContent=t);const m=[s,i].filter(Boolean).join(" · ");this.roleEl&&(this.roleEl.textContent=m,this.roleEl.hidden=!m);const p=Boolean(n||a);this.avatarWrapEl&&(this.avatarWrapEl.hidden=!p),this.avatarEl&&p&&(this.avatarEl.setAttribute("size",this.getAvatarSize()),n?this.avatarEl.setAttribute("src",n):this.avatarEl.removeAttribute("src"),a?this.avatarEl.setAttribute("initials",a):this.avatarEl.removeAttribute("initials"),this.avatarEl.setAttribute("alt",`${t} 프로필 이미지`)),this.ratingEl&&("number"==typeof l?(this.ratingEl.hidden=!1,this.ratingEl.setAttribute("value",String(l)),this.ratingEl.setAttribute("max-value",String(o)),this.ratingEl.setAttribute("size","s")):this.ratingEl.hidden=!0),this.syncExtraContent()}}customElements.get("db-testimonial")||customElements.define("db-testimonial",DbTestimonial);const _s="designbase-wc-section-hero";class DbSectionHero extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","subtitle","description","background-image","background-video","overlay-color","overlay-opacity","buttons","variant","theme","alignment","animated","full-height","min-height","max-height","content-max-width"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}get buttons(){return this.parseButtons()}set buttons(e){this.setAttribute("buttons","string"==typeof e?e:JSON.stringify(e))}parseButtons(){try{const e=JSON.parse(this.getAttribute("buttons")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}build(){this.backgroundVideoEl=document.createElement("video"),this.backgroundVideoEl.className=`${_s}__background-video`,this.backgroundVideoEl.autoplay=!0,this.backgroundVideoEl.muted=!0,this.backgroundVideoEl.loop=!0,this.backgroundVideoEl.playsInline=!0,this.backgroundVideoEl.hidden=!0,this.backgroundImageEl=document.createElement("div"),this.backgroundImageEl.className=`${_s}__background-image`,this.backgroundImageEl.hidden=!0,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${_s}__overlay`,this.overlayEl.hidden=!0;const e=document.createElement("div");e.className=`${_s}__container`;const t=document.createElement("div");t.className=`${_s}__content`,this.titleEl=document.createElement("h1"),this.titleEl.className=`${_s}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${_s}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${_s}__description`,this.buttonsEl=document.createElement("div"),this.buttonsEl.className=`${_s}__buttons`,t.append(this.titleEl,this.subtitleEl,this.descriptionEl,this.buttonsEl),e.append(t),this.append(this.backgroundVideoEl,this.backgroundImageEl,this.overlayEl,e)}updateUI(){const e=this.getAttribute("title")||"",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("background-image")||"",n=this.getAttribute("background-video")||"",a=this.getAttribute("overlay-color")||"",r=Number(this.getAttribute("overlay-opacity")||.5),o=this.getAttribute("variant")||"default",l=this.getAttribute("theme")||"light",d=this.getAttribute("alignment")||"left",u=this.hasAttribute("animated"),b=this.hasAttribute("full-height"),m=this.getAttribute("min-height"),p=this.getAttribute("max-height"),g=this.getAttribute("content-max-width"),v=this.parseButtons(),E=Boolean(i||n),f="dark"===l||"gradient"===l||E&&("overlay"===o||"image"===l);this.className=[_s,`${_s}--variant-${o}`,`${_s}--theme-${l}`,`${_s}--alignment-${d}`,u&&`${_s}--animated`,b&&`${_s}--full-height`,f&&`${_s}--on-media`].filter(Boolean).join(" "),this.style.minHeight=m||"",this.style.maxHeight=p||"",this.titleEl&&(this.titleEl.textContent=e),this.subtitleEl&&(this.subtitleEl.textContent=t,this.subtitleEl.hidden=!t),this.descriptionEl&&(this.descriptionEl.textContent=s,this.descriptionEl.hidden=!s);const w=this.querySelector(`.${_s}__content`);if(w&&(g?w.style.maxWidth=/^\d+$/.test(g)?`${g}px`:g:w.style.removeProperty("max-width")),this.backgroundVideoEl)if(n){this.backgroundVideoEl.hidden=!1,this.backgroundVideoEl.replaceChildren();const e=document.createElement("source");e.src=n,e.type="video/mp4",this.backgroundVideoEl.append(e)}else this.backgroundVideoEl.hidden=!0;this.backgroundImageEl&&(i?(this.backgroundImageEl.hidden=!1,this.backgroundImageEl.style.backgroundImage=`url(${i})`,this.backgroundImageEl.style.backgroundSize="cover",this.backgroundImageEl.style.backgroundPosition="center",this.backgroundImageEl.style.backgroundRepeat="no-repeat"):this.backgroundImageEl.hidden=!0),this.overlayEl&&(E?(this.overlayEl.hidden=!1,a?(this.overlayEl.style.background=a,this.overlayEl.style.opacity=String(r)):(this.overlayEl.style.background=`linear-gradient(180deg, rgba(0, 0, 0, ${.35*r}) 0%, rgba(0, 0, 0, ${r}) 100%)`,this.overlayEl.style.opacity="1")):this.overlayEl.hidden=!0),this.buttonsEl&&(this.buttonsEl.replaceChildren(),v.length>0?(v.forEach(e=>{const t=document.createElement("db-button");if(t.setAttribute("variant",function mapButtonVariant(e){return"outline"===e?"tertiary":"ghost"===e?"ghost":"secondary"===e?"secondary":"tertiary"===e?"tertiary":"primary"}(e.variant)),t.setAttribute("size",e.size||"m"),e.href&&t.setAttribute("href",e.href),e.external&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer")),e.startIcon)t.setAttribute("start-icon",e.startIcon),t.textContent=e.text;else if(e.icon){const s=document.createElement("span");s.className=`${_s}__button-content`;const i=document.createElement("span");i.className=`${_s}__button-icon`,i.setAttribute("aria-hidden","true"),i.textContent=e.icon;const n=document.createElement("span");n.textContent=e.text,s.append(i,n),t.append(s)}else t.textContent=e.text;t.addEventListener("click",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("db-button-click",{detail:{button:e},bubbles:!0,composed:!0}))}),this.buttonsEl.append(t)}),this.buttonsEl.hidden=!1):this.buttonsEl.hidden=!0)}}customElements.get("db-section-hero")||customElements.define("db-section-hero",DbSectionHero);const Cs=["full-width","full-height","overflow-visible"];function syncMarketingBlockHost(e,t){for(const s of Cs)e.classList.toggle(`${t}--${s}`,e.hasAttribute(s))}const xs="designbase-wc-section-feature";class DbSectionFeature extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","image","image-alt","media-position","actions","tinted","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}get actions(){return this.parseActions()}set actions(e){this.setAttribute("actions","string"==typeof e?e:JSON.stringify(e))}parseActions(){try{const e=JSON.parse(this.getAttribute("actions")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${xs}__inner`;const e=document.createElement("div");e.className=`${xs}__content`,this.contentEl=e,this.headlineEl=document.createElement("h2"),this.headlineEl.className=`${xs}__headline`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${xs}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${xs}__description`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${xs}__actions`,e.append(this.headlineEl,this.subtitleEl,this.descriptionEl,this.actionsEl),this.mediaEl=document.createElement("div"),this.mediaEl.className=`${xs}__media`,this.imageEl=document.createElement("img"),this.imageEl.className=`${xs}__image`,this.mediaEl.append(this.imageEl),this.innerEl.append(e,this.mediaEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("headline")||"",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("image")||"",n=this.getAttribute("image-alt")||e||"feature",a=this.getAttribute("media-position")||"right",r=this.getAttribute("content-padding")||"l",o=this.hasAttribute("tinted"),l=this.parseBadge(),d=this.parseActions();if(this.className=[xs,`${xs}--media-${a}`,`${xs}--padding-${r}`,o&&`${xs}--tinted`].filter(Boolean).join(" "),syncMarketingBlockHost(this,xs),this.contentEl&&this.headlineEl){const e=l?.text?.trim();e?(this.badgeEl||(this.badgeEl=document.createElement("db-badge"),this.badgeEl.className=`${xs}__badge`),this.badgeEl.setAttribute("variant",l.variant||"primary"),this.badgeEl.setAttribute("badge-style",l.style||"text"),this.badgeEl.setAttribute("size",l.size||"m"),this.badgeEl.textContent=e,this.badgeEl.isConnected||this.contentEl.insertBefore(this.badgeEl,this.headlineEl)):this.badgeEl&&this.badgeEl.remove()}this.headlineEl&&(this.headlineEl.textContent=e),this.subtitleEl&&(this.subtitleEl.textContent=t,this.subtitleEl.hidden=!t),this.descriptionEl&&(this.descriptionEl.textContent=s,this.descriptionEl.hidden=!s),this.mediaEl&&this.imageEl&&(i?(this.mediaEl.hidden=!1,this.imageEl.src=i,this.imageEl.alt=n):this.mediaEl.hidden=!0),this.actionsEl&&(this.actionsEl.replaceChildren(),d.length>0?(d.forEach(e=>{const t=document.createElement("db-button");t.setAttribute("variant",e.variant||"primary"),t.setAttribute("size",e.size||"m"),e.href&&t.setAttribute("href",e.href),t.textContent=e.label,t.addEventListener("click",t=>{t.stopPropagation(),this.dispatchEvent(new CustomEvent("db-action",{detail:{action:e},bubbles:!0,composed:!0}))}),this.actionsEl.append(t)}),this.actionsEl.hidden=!1):this.actionsEl.hidden=!0)}}customElements.get("db-section-feature")||customElements.define("db-section-feature",DbSectionFeature);const ks="designbase-wc-app-badge",Ss={"app-store":{label:"다운로드",storeName:"App Store"},"google-play":{label:"다운로드",storeName:"Google Play"}};class DbAppBadge extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["store","href","label","store-name","size","theme"]}connectedCallback(){this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}getStore(){return"google-play"===(this.getAttribute("store")||"app-store")?"google-play":"app-store"}getIconSize(){const e=this.getAttribute("size")||"m";return"s"===e?18:"l"===e?24:20}build(){this.iconWrapEl=document.createElement("span"),this.iconWrapEl.className=`${ks}__icon`,this.iconWrapEl.setAttribute("aria-hidden","true");const e=document.createElement("span");e.className=`${ks}__text`,this.labelEl=document.createElement("span"),this.labelEl.className=`${ks}__label`,this.storeEl=document.createElement("span"),this.storeEl.className=`${ks}__store`,e.append(this.labelEl,this.storeEl),this.append(this.iconWrapEl,e),this.addEventListener("click",e=>{this.getAttribute("href")||this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0,detail:{event:e}}))})}updateUI(){const e=this.getStore(),t=Ss[e],s=this.getAttribute("size")||"m",i=this.getAttribute("theme")||"dark",n=this.getAttribute("label")||t.label,a=this.getAttribute("store-name")||t.storeName,r=this.getAttribute("href");this.className=[ks,`${ks}--${s}`,`${ks}--${i}`,`${ks}--${e}`].join(" "),r?(this.setAttribute("role","link"),this.tabIndex=0,this.onclick=()=>window.open(r,"_blank","noopener,noreferrer")):(this.setAttribute("role","button"),this.tabIndex=0),this.iconWrapEl&&this.iconWrapEl.replaceChildren(createDbIcon("app-store"===e?"apple":"play-store",this.getIconSize())),this.labelEl&&(this.labelEl.textContent=n),this.storeEl&&(this.storeEl.textContent=a)}}customElements.get("db-app-badge")||customElements.define("db-app-badge",DbAppBadge);const Ns="designbase-wc-section-contact",$s="contact@designbase.co.kr";class DbSectionContact extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","description","action","align","accent","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseAction(){try{const e=this.getAttribute("action");if(e)return JSON.parse(e)}catch{}return{label:$s,href:`mailto:${$s}`}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Ns}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${Ns}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${Ns}__description`,this.actionEl=document.createElement("db-button"),this.actionEl.className=`${Ns}__action`,this.actionEl.setAttribute("variant","primary"),this.actionEl.setAttribute("size","m"),this.actionEl.setAttribute("radius","pill"),this.actionEl.setAttribute("start-icon","mail"),this.actionEl.addEventListener("click",e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("db-action",{detail:{action:this.parseAction()},bubbles:!0,composed:!0}))}),this.innerEl.append(this.titleEl,this.descriptionEl,this.actionEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("title")||"문의하기",t=this.getAttribute("description")||"궁금한 점이 있으시면 언제든지 연락주세요.",s=this.getAttribute("align")||"center",i=this.getAttribute("content-padding")||"l",n=!this.hasAttribute("accent")||"false"!==this.getAttribute("accent"),a=this.parseAction();this.className=[Ns,`${Ns}--${s}`,`${Ns}--padding-${i}`,n&&`${Ns}--accent`].filter(Boolean).join(" "),syncMarketingBlockHost(this,Ns),this.titleEl&&(this.titleEl.textContent=e),this.descriptionEl&&(this.descriptionEl.textContent=t,this.descriptionEl.hidden=!t),this.actionEl&&(this.actionEl.textContent=a.label,a.href?this.actionEl.setAttribute("href",a.href):this.actionEl.removeAttribute("href"))}}customElements.get("db-section-contact")||customElements.define("db-section-contact",DbSectionContact);const Is="designbase-wc-section-app-download";class DbSectionAppDownload extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","description","stores","align","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}get stores(){return this.parseStores()}set stores(e){this.setAttribute("stores","string"==typeof e?e:JSON.stringify(e))}parseStores(){try{const e=JSON.parse(this.getAttribute("stores")||"[]");if(Array.isArray(e)&&e.length>0)return e}catch{}return[{store:"app-store",href:"#"},{store:"google-play",href:"#"}]}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Is}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${Is}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${Is}__description`,this.badgesEl=document.createElement("div"),this.badgesEl.className=`${Is}__badges`,this.innerEl.append(this.titleEl,this.descriptionEl,this.badgesEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("title")||"지금 바로 시작하세요",t=this.getAttribute("description")||"앱을 다운로드하고 바로 이용해 보세요.",s=this.getAttribute("align")||"center",i=this.parseStores();this.className=[Is,`${Is}--${s}`].join(" "),syncMarketingBlockHost(this,Is),this.titleEl&&(this.titleEl.textContent=e),this.descriptionEl&&(this.descriptionEl.textContent=t,this.descriptionEl.hidden=!t),this.badgesEl&&(this.badgesEl.replaceChildren(),i.forEach(e=>{const t=document.createElement("db-app-badge");t.setAttribute("store",e.store),t.setAttribute("size",e.size||"m"),t.setAttribute("theme",e.theme||"dark"),e.href&&t.setAttribute("href",e.href),e.label&&t.setAttribute("label",e.label),e.storeName&&t.setAttribute("store-name",e.storeName),this.badgesEl.append(t)}))}}customElements.get("db-section-app-download")||customElements.define("db-section-app-download",DbSectionAppDownload);const Ds="designbase-wc-section-cta";class DbSectionCta extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["title","headline","subtitle","description","badge","buttons","variant","theme","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}parseButtons(){try{const e=JSON.parse(this.getAttribute("buttons")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}build(){this.wrapEl=document.createElement("div"),this.wrapEl.className=`${Ds}__inner`,this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header",this.badgeEl=document.createElement("db-badge"),this.badgeEl.className="designbase-wc-section-block-header__badge",this.badgeEl.hidden=!0,this.headlineEl=document.createElement("h2"),this.headlineEl.className="designbase-wc-section-block-header__headline",this.subtitleEl=document.createElement("p"),this.subtitleEl.className="designbase-wc-section-block-header__subtitle",this.descriptionEl=document.createElement("p"),this.descriptionEl.className="designbase-wc-section-block-header__description",this.headerEl.append(this.badgeEl,this.headlineEl,this.subtitleEl,this.descriptionEl),this.actionsEl=document.createElement("div"),this.actionsEl.className=`${Ds}__actions`,this.wrapEl.append(this.headerEl,this.actionsEl),this.append(this.wrapEl)}updateUI(){const e=this.getAttribute("headline")||this.getAttribute("title")||"",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("variant")||"default",n=this.getAttribute("theme")||"gradient",a=this.getAttribute("align")||"center",r=this.getAttribute("content-padding")||"l",o=this.parseBadge(),l=this.parseButtons();this.className=[Ds,`${Ds}--${i}`,`${Ds}--${n}`,`${Ds}--${a}`,`${Ds}--padding-${r}`].join(" "),syncMarketingBlockHost(this,Ds),this.headerEl&&(this.headerEl.className=["designbase-wc-section-block-header",`designbase-wc-section-block-header--${a}`,`${Ds}__header`].join(" ")),this.badgeEl&&(o?.text?(this.badgeEl.hidden=!1,this.badgeEl.style.display="",this.badgeEl.setAttribute("variant",o.variant||"primary"),this.badgeEl.setAttribute("badge-style",o.style||"text"),this.badgeEl.setAttribute("size",o.size||"m"),this.badgeEl.textContent=o.text):(this.badgeEl.hidden=!0,this.badgeEl.style.display="none",this.badgeEl.textContent="")),this.headlineEl&&(this.headlineEl.textContent=e,this.headlineEl.hidden=!e),this.subtitleEl&&(this.subtitleEl.textContent=t,this.subtitleEl.hidden=!t),this.descriptionEl&&(this.descriptionEl.textContent=s,this.descriptionEl.hidden=!s),this.actionsEl&&(this.actionsEl.replaceChildren(),l.forEach((e,t)=>{const s=document.createElement("db-button");s.setAttribute("variant",e.variant||(0===t?"primary":"tertiary")),s.setAttribute("size",e.size||"m"),e.href&&s.setAttribute("href",e.href),s.textContent=e.text,this.actionsEl.append(s)}),this.actionsEl.hidden=0===l.length)}}function applySectionBlockHeader(e,t){if(!e)return;const{headline:s="",subtitle:i="",description:n="",badge:a,align:r="center",extraClassName:o}=t;e.className=["designbase-wc-section-block-header",`designbase-wc-section-block-header--${r}`,o].filter(Boolean).join(" ");let l=e.querySelector("db-badge");a?.text?(l||(l=document.createElement("db-badge"),l.className="designbase-wc-section-block-header__badge",e.prepend(l)),l.removeAttribute("hidden"),l.style.display="",l.setAttribute("variant",a.variant||"primary"),l.setAttribute("badge-style",a.style||"text"),l.setAttribute("size",a.size||"m"),l.textContent=a.text):l&&(l.textContent="",l.setAttribute("hidden",""),l.style.display="none");const d=e.querySelector("h2"),u=e.querySelector(".designbase-wc-section-block-header__subtitle"),b=e.querySelector(".designbase-wc-section-block-header__description");d&&(d.textContent=s,d.hidden=!s),u&&(u.textContent=i,u.hidden=!i),b&&(b.textContent=n,b.hidden=!n)}customElements.get("db-section-cta")||customElements.define("db-section-cta",DbSectionCta);const Ls="designbase-wc-section-testimonials";class DbSectionTestimonials extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.carouselIndex=0}static get observedAttributes(){return["headline","subtitle","description","badge","items","variant","columns","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0}attributeChangedCallback(){this.built&&(this.carouselIndex=0,this.updateUI())}parseItems(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}buildHeader(e){this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header";const t=document.createElement("db-badge");t.className="designbase-wc-section-block-header__badge",t.hidden=!0,t.dataset.role="badge";const s=document.createElement("h2");s.className="designbase-wc-section-block-header__headline",s.dataset.role="headline";const i=document.createElement("p");i.className="designbase-wc-section-block-header__subtitle",i.dataset.role="subtitle";const n=document.createElement("p");n.className="designbase-wc-section-block-header__description",n.dataset.role="description",this.headerEl.append(t,s,i,n),e.append(this.headerEl)}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Ls}__inner`,this.buildHeader(this.innerEl),this.contentEl=document.createElement("div"),this.contentEl.className=`${Ls}__grid`,this.innerEl.append(this.contentEl),this.append(this.innerEl)}createTestimonialEl(e){const t=document.createElement("db-testimonial");return t.setAttribute("variant","card"),t.setAttribute("quote",e.quote),t.setAttribute("author",e.author),e.role&&t.setAttribute("role",e.role),e.company&&t.setAttribute("company",e.company),e.avatar&&t.setAttribute("avatar",e.avatar),null!=e.rating&&t.setAttribute("rating",String(e.rating)),t.setAttribute("align","center"),t}updateHeader(){this.headerEl&&applySectionBlockHeader(this.headerEl,{headline:this.getAttribute("headline")||"고객 후기",subtitle:this.getAttribute("subtitle")||"",description:this.getAttribute("description")||"",badge:this.parseBadge(),align:this.getAttribute("align")||"center"})}clampCarouselIndex(e){e<=0?this.carouselIndex=0:(this.carouselIndex>=e&&(this.carouselIndex=0),this.carouselIndex<0&&(this.carouselIndex=0))}updateCarouselTransform(){if(!this.carouselViewport||!this.carouselTrack)return;const e=this.carouselViewport.clientWidth;this.carouselTrack.style.transform=`translate3d(-${this.carouselIndex*e}px, 0, 0)`,this.carouselIndicator&&this.carouselIndicator.setAttribute("current",String(this.carouselIndex))}goToCarouselSlide(e,t){t<=0||(this.carouselIndex=Math.max(0,Math.min(e,t-1)),this.updateCarouselTransform())}renderGrid(e){this.contentEl&&(this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.carouselViewport=void 0,this.carouselTrack=void 0,this.carouselIndicator=void 0,this.contentEl.className=`${Ls}__grid`,this.contentEl.replaceChildren(),e.forEach(e=>{this.contentEl.append(this.createTestimonialEl(e))}))}renderCarousel(e){if(!this.contentEl)return;if(this.contentEl.replaceChildren(),this.contentEl.className=`${Ls}__carousel`,this.clampCarouselIndex(e.length),0===e.length)return;const t=document.createElement("div");t.className=`${Ls}__carousel-viewport`;const s=document.createElement("div");if(s.className=`${Ls}__carousel-track`,e.forEach(e=>{const t=document.createElement("div");t.className=`${Ls}__carousel-slide`,t.append(this.createTestimonialEl(e)),s.append(t)}),t.append(s),this.carouselViewport=t,this.carouselTrack=s,e.length>1){const s=document.createElement("button");s.type="button",s.className=`${Ls}__carousel-nav ${Ls}__carousel-nav--prev`,s.setAttribute("aria-label","이전 후기"),s.append(createDbIcon("chevron-left",20)),s.addEventListener("click",()=>{const t=this.carouselIndex-1;this.goToCarouselSlide(t<0?e.length-1:t,e.length)});const i=document.createElement("button");i.type="button",i.className=`${Ls}__carousel-nav ${Ls}__carousel-nav--next`,i.setAttribute("aria-label","다음 후기"),i.append(createDbIcon("chevron-right",20)),i.addEventListener("click",()=>{const t=this.carouselIndex+1;this.goToCarouselSlide(t>=e.length?0:t,e.length)}),t.append(s,i);const n=document.createElement("div");n.className=`${Ls}__carousel-controls`;const a=document.createElement("db-indicator");a.className=`${Ls}__carousel-indicator`,a.setAttribute("current",String(this.carouselIndex)),a.setAttribute("total",String(e.length)),a.setAttribute("type","dots"),a.setAttribute("size","s"),a.setAttribute("clickable",""),a.addEventListener("db-step-click",t=>{const s=t;this.goToCarouselSlide(s.detail.index,e.length)}),this.carouselIndicator=a,n.append(a),this.contentEl.append(t,n)}else this.contentEl.append(t);this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>this.updateCarouselTransform()),this.resizeObserver.observe(t),requestAnimationFrame(()=>this.updateCarouselTransform())}updateUI(){const e=this.getAttribute("variant")||"grid",t=this.getAttribute("columns")||"3",s=this.getAttribute("content-padding")||"l",i=this.parseItems();this.className=[Ls,`${Ls}--${e}`,`${Ls}--cols-${t}`,`${Ls}--padding-${s}`].join(" "),syncMarketingBlockHost(this,Ls),this.updateHeader(),"carousel"===e?this.renderCarousel(i):this.renderGrid(i)}}customElements.get("db-section-testimonials")||customElements.define("db-section-testimonials",DbSectionTestimonials);const Ms="designbase-wc-section-feature-grid",Ts={sparkles:"sparkle",rocket:"package",shield:"award",chart:"trending-up",users:"user",bolt:"bulb"};class DbSectionFeatureGrid extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","items","columns","tinted","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseItems(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Ms}__inner`,this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header",this.headerEl.innerHTML='\n <db-badge class="designbase-wc-section-block-header__badge" hidden></db-badge>\n <h2 class="designbase-wc-section-block-header__headline"></h2>\n <p class="designbase-wc-section-block-header__subtitle"></p>\n <p class="designbase-wc-section-block-header__description"></p>\n ',this.gridEl=document.createElement("div"),this.gridEl.className=`${Ms}__grid`,this.innerEl.append(this.headerEl,this.gridEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("headline")||"주요 기능",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("columns")||"3",n=this.getAttribute("content-padding")||"l",a=this.getAttribute("align")||"center",r=this.hasAttribute("tinted"),o=this.parseBadge(),l=this.parseItems();this.className=[Ms,`${Ms}--cols-${i}`,`${Ms}--padding-${n}`,r&&`${Ms}--tinted`].filter(Boolean).join(" "),syncMarketingBlockHost(this,Ms),this.headerEl&&applySectionBlockHeader(this.headerEl,{headline:e,subtitle:t,description:s,badge:o,align:a}),this.gridEl&&(this.gridEl.replaceChildren(),l.forEach(e=>{const t=document.createElement("article");t.className=`${Ms}__card`;const s=document.createElement("div");s.className=`${Ms}__card-icon`,s.append(createDbIcon(Ts[e.iconName||"sparkles"]||"sparkle",24));const i=document.createElement("h3");i.className=`${Ms}__card-title`,i.textContent=e.title;const n=document.createElement("p");n.className=`${Ms}__card-description`,n.textContent=e.description,t.append(s,i,n),this.gridEl.append(t)}))}}customElements.get("db-section-feature-grid")||customElements.define("db-section-feature-grid",DbSectionFeatureGrid);const zs="designbase-wc-section-logo-cloud";class DbSectionLogoCloud extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","logos","variant","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseLogos(){try{const e=JSON.parse(this.getAttribute("logos")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${zs}__inner`,this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header",this.headerEl.innerHTML='\n <db-badge class="designbase-wc-section-block-header__badge" hidden></db-badge>\n <h2 class="designbase-wc-section-block-header__headline"></h2>\n <p class="designbase-wc-section-block-header__subtitle"></p>\n <p class="designbase-wc-section-block-header__description"></p>\n ',this.contentEl=document.createElement("div"),this.innerEl.append(this.headerEl,this.contentEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("headline")||"함께하는 파트너",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("variant")||"grid",n=this.getAttribute("content-padding")||"m",a=this.getAttribute("align")||"center",r=this.parseBadge(),o=this.parseLogos();if(this.className=[zs,`${zs}--${i}`,`${zs}--padding-${n}`].join(" "),syncMarketingBlockHost(this,zs),this.headerEl&&applySectionBlockHeader(this.headerEl,{headline:e,subtitle:t,description:s,badge:r,align:a}),this.contentEl){if(this.contentEl.replaceChildren(),"marquee"===i){this.contentEl.className=`${zs}__marquee`;const e=document.createElement("db-marquee");return e.setAttribute("items",JSON.stringify(o.map(e=>e.label??e.alt))),void this.contentEl.append(e)}this.contentEl.className=`${zs}__grid`,o.forEach(e=>{const t=document.createElement(e.href?"a":"div");if(t.className=`${zs}__item`,e.href&&t instanceof HTMLAnchorElement&&(t.href=e.href,t.target="_blank",t.rel="noopener noreferrer"),e.src){const s=document.createElement("img");s.src=e.src,s.alt=e.alt,s.className=`${zs}__image`,t.append(s)}else{const s=document.createElement("span");s.className=`${zs}__label`,s.textContent=e.label??e.alt,t.append(s)}this.contentEl.append(t)})}}}customElements.get("db-section-logo-cloud")||customElements.define("db-section-logo-cloud",DbSectionLogoCloud);const Bs="designbase-wc-section-stats";class DbSectionStats extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","items","columns","tinted","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseItems(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Bs}__inner`,this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header",this.headerEl.innerHTML='\n <db-badge class="designbase-wc-section-block-header__badge" hidden></db-badge>\n <h2 class="designbase-wc-section-block-header__headline"></h2>\n <p class="designbase-wc-section-block-header__subtitle"></p>\n <p class="designbase-wc-section-block-header__description"></p>\n ',this.gridEl=document.createElement("div"),this.gridEl.className=`${Bs}__grid`,this.innerEl.append(this.headerEl,this.gridEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("headline")||"",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("columns")||"4",n=this.getAttribute("content-padding")||"l",a=this.getAttribute("align")||"center",r=this.hasAttribute("tinted"),o=this.parseBadge(),l=this.parseItems();if(this.className=[Bs,`${Bs}--cols-${i}`,`${Bs}--padding-${n}`,r&&`${Bs}--tinted`].filter(Boolean).join(" "),syncMarketingBlockHost(this,Bs),this.headerEl){const i=e||t||s||o?.text;this.headerEl.hidden=!i,applySectionBlockHeader(this.headerEl,{headline:e,subtitle:t,description:s,badge:o,align:a})}this.gridEl&&(this.gridEl.replaceChildren(),l.forEach(e=>{const t=document.createElement("db-stat");t.setAttribute("value",String(e.value)),t.setAttribute("label",e.label),t.setAttribute("variant","minimal"),t.setAttribute("layout","vertical"),t.setAttribute("size","l"),e.description&&(t.setAttribute("description",e.description),t.setAttribute("show-description","")),t.className=`${Bs}__stat`,this.gridEl.append(t)}))}}customElements.get("db-section-stats")||customElements.define("db-section-stats",DbSectionStats);const Ps="designbase-wc-section-faq";class DbSectionFaq extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","items","allow-multiple","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parseItems(){try{const e=JSON.parse(this.getAttribute("items")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Ps}__inner`,this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header",this.headerEl.innerHTML='\n <db-badge class="designbase-wc-section-block-header__badge" hidden></db-badge>\n <h2 class="designbase-wc-section-block-header__headline"></h2>\n <p class="designbase-wc-section-block-header__subtitle"></p>\n <p class="designbase-wc-section-block-header__description"></p>\n ',this.accordionEl=document.createElement("db-accordion"),this.accordionEl.className=`${Ps}__accordion`,this.innerEl.append(this.headerEl,this.accordionEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("headline")||"자주 묻는 질문",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("content-padding")||"l",n=this.getAttribute("align")||"center",a=this.hasAttribute("allow-multiple"),r=this.parseBadge(),o=this.parseItems();if(this.className=[Ps,`${Ps}--padding-${i}`].join(" "),syncMarketingBlockHost(this,Ps),this.headerEl&&applySectionBlockHeader(this.headerEl,{headline:e,subtitle:t,description:s,badge:r,align:n}),!this.accordionEl)return;const l=o.map(e=>({id:e.id,title:e.question,content:e.answer,itemType:"question"}));this.accordionEl.setAttribute("items",JSON.stringify(l)),this.accordionEl.setAttribute("variant","separated"),this.accordionEl.setAttribute("size","m"),this.accordionEl.setAttribute("default-item-type","question"),a?(this.accordionEl.setAttribute("allow-multiple",""),this.accordionEl.setAttribute("expand-mode","multiple")):(this.accordionEl.removeAttribute("allow-multiple"),this.accordionEl.setAttribute("expand-mode","single"))}}customElements.get("db-section-faq")||customElements.define("db-section-faq",DbSectionFaq);const Fs="designbase-wc-section-pricing";class DbSectionPricing extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["headline","subtitle","description","badge","plans","columns","align","content-padding","size","full-width","full-height","overflow-visible"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}attributeChangedCallback(){this.built&&this.updateUI()}parsePlans(){try{const e=JSON.parse(this.getAttribute("plans")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}parseBadge(){try{const e=this.getAttribute("badge");return e?JSON.parse(e):null}catch{return null}}build(){this.innerEl=document.createElement("div"),this.innerEl.className=`${Fs}__inner`,this.headerEl=document.createElement("div"),this.headerEl.className="designbase-wc-section-block-header",this.headerEl.innerHTML='\n <db-badge class="designbase-wc-section-block-header__badge" hidden></db-badge>\n <h2 class="designbase-wc-section-block-header__headline"></h2>\n <p class="designbase-wc-section-block-header__subtitle"></p>\n <p class="designbase-wc-section-block-header__description"></p>\n ',this.gridEl=document.createElement("div"),this.gridEl.className=`${Fs}__grid`,this.innerEl.append(this.headerEl,this.gridEl),this.append(this.innerEl)}updateUI(){const e=this.getAttribute("headline")||"요금제",t=this.getAttribute("subtitle")||"",s=this.getAttribute("description")||"",i=this.getAttribute("columns")||"3",n=this.getAttribute("content-padding")||"l",a=this.getAttribute("align")||"center",r=this.parseBadge(),o=this.parsePlans();this.className=[Fs,`${Fs}--cols-${i}`,`${Fs}--padding-${n}`].join(" "),syncMarketingBlockHost(this,Fs),this.headerEl&&applySectionBlockHeader(this.headerEl,{headline:e,subtitle:t,description:s,badge:r,align:a}),this.gridEl&&(this.gridEl.replaceChildren(),o.forEach(e=>{const t=document.createElement("article");t.className=[`${Fs}__plan-card`,e.highlighted?`${Fs}__plan-card--highlighted`:""].filter(Boolean).join(" ");const s=document.createElement("div");if(s.className=`${Fs}__plan-body`,e.badge){const t=document.createElement("db-badge");t.setAttribute("variant","primary"),t.setAttribute("badge-style","filled"),t.setAttribute("size","s"),t.className=`${Fs}__plan-badge`,t.textContent=e.badge,s.append(t)}const i=document.createElement("h3");i.className=`${Fs}__plan-name`,i.textContent=e.name;const n=document.createElement("div");n.className=`${Fs}__price-row`;const a=document.createElement("span");if(a.className=`${Fs}__price`,a.textContent=e.price,n.append(a),e.period){const t=document.createElement("span");t.className=`${Fs}__period`,t.textContent=`/ ${e.period}`,n.append(t)}if(s.append(i,n),e.description){const t=document.createElement("p");t.className=`${Fs}__plan-description`,t.textContent=e.description,s.append(t)}const r=document.createElement("ul");r.className=`${Fs}__features`,e.features.forEach(e=>{const t=document.createElement("li");t.textContent=e,r.append(t)}),s.append(r);const o=document.createElement("div");o.className=`${Fs}__plan-footer`;const l=document.createElement("db-button");l.className=`${Fs}__cta`,l.setAttribute("variant",e.cta.variant||(e.highlighted?"primary":"tertiary")),l.setAttribute("size","m"),l.setAttribute("full-width",""),e.cta.href&&l.setAttribute("href",e.cta.href),l.textContent=e.cta.label,o.append(l),t.append(s,o),this.gridEl.append(t)}))}}customElements.get("db-section-pricing")||customElements.define("db-section-pricing",DbSectionPricing);const Os="designbase-wc-marquee";function isImageItem(e){return"object"==typeof e&&null!==e&&"string"==typeof e.src}class DbMarquee extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.rows=[],this.rowCount=0,this.containerWidth=0,this.gap=24,this.scrollVelocityEnabled=!1,this.rafId=0,this.lastFrameTime=0,this.lastScrollY=0,this.smoothedScrollV=0,this.baseDurationSec=12,this.reduceMotion=!1,this.boundMeasure=()=>this.measure(),this.boundFrame=e=>this.frame(e)}static get observedAttributes(){return["items","direction","duration","speed","size","variant","bordered","pause-on-hover","fade-edges","fade-width","edge-padding","gap","align-y","row-count","row-gap","scroll-velocity","scroll-boost","aria-label"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.reduceMotion="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.build(),this.bindResize()),this.updateUI()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.stopScrollEngine(),this.unbindImageListeners()}attributeChangedCallback(){this.built&&this.updateUI()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}parseItems(){try{const e=this.getAttribute("items"),t=e?JSON.parse(e):[];if(Array.isArray(t)&&t.length>0)return t.filter(e=>"string"==typeof e||isImageItem(e))}catch{}const e=Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal"));return e.length>0?e.map(e=>e.textContent?.trim()||""):[]}itemToText(e){return isImageItem(e)?e.alt||"":e}build(){this.containerEl=document.createElement("div"),this.srOnlyEl=document.createElement("span"),this.srOnlyEl.className=`${Os}__sr-only`,this.rowsEl=document.createElement("div"),this.rowsEl.className=`${Os}__rows`,this.containerEl.append(this.srOnlyEl,this.rowsEl),this.append(this.containerEl)}bindResize(){this.resizeObserver=new ResizeObserver(()=>this.measure()),this.containerEl&&this.resizeObserver.observe(this.containerEl)}reconcileRows(e,t){if(this.rowsEl){for(this.rowCount=e;this.rows.length<e;){const e=document.createElement("div");e.className=`${Os}__row`;const t=document.createElement("div");t.className=`${Os}__track`;const s=document.createElement("div");s.className=`${Os}__group`,s.setAttribute("aria-hidden","true"),t.append(s),e.append(t),this.rowsEl.append(e),this.rows.push({rowEl:e,trackEl:t,baseGroupEl:s,baseGroupWidth:0,duplicateCount:0,baseDir:1,x:0,dirState:1})}for(;this.rows.length>e;){const e=this.rows.pop();e?.rowEl.remove()}this.rows.forEach((e,s)=>{e.baseDir=s%2==0?t:-t;const i=e.baseDir<0;e.rowEl.classList.toggle(`${Os}__row--right`,i),e.rowEl.style.setProperty("--db-marquee-row-index",String(s))}),this.resizeObserver&&this.rows.forEach(e=>this.resizeObserver?.observe(e.baseGroupEl))}}measure(){this.containerWidth=Math.ceil(this.containerEl?.clientWidth??0),this.rows.forEach(e=>{e.baseGroupWidth=Math.ceil(e.baseGroupEl.scrollWidth??0),e.rowEl.style.setProperty("--db-marquee-shift",`${e.baseGroupWidth+this.gap}px`),this.reconcileDuplicates(e)}),this.syncReadyState()}unbindImageListeners(){this.rows.forEach(e=>{e.baseGroupEl.querySelectorAll("img").forEach(e=>{e.removeEventListener("load",this.boundMeasure),e.removeEventListener("error",this.boundMeasure)})})}bindImageListeners(){this.rows.forEach(e=>{e.baseGroupEl.querySelectorAll("img").forEach(e=>{e.complete||(e.addEventListener("load",this.boundMeasure),e.addEventListener("error",this.boundMeasure))})})}renderItem(e){const t=document.createElement("div");if(t.className=`${Os}__item`,isImageItem(e)){t.classList.add(`${Os}__item--image`);const s=document.createElement("img");if(s.className=`${Os}__image`,s.src=e.src,s.alt=e.alt||"",s.loading="lazy",s.decoding="async",e.height&&(s.style.height=`${e.height}px`),e.href){const i=document.createElement("a");i.className=`${Os}__link`,i.href=e.href,i.setAttribute("tabindex","-1"),i.append(s),t.append(i)}else t.append(s);return t}return t.textContent=e,t}renderGroup(e,t){const s=t??document.createElement("div");return s.className=`${Os}__group`,s.setAttribute("aria-hidden","true"),s.replaceChildren(...e.map(e=>this.renderItem(e))),s}buildBase(e){this.rows.forEach(t=>{for(this.renderGroup(e,t.baseGroupEl);t.trackEl.children.length>1;)t.trackEl.lastElementChild?.remove();t.duplicateCount=0})}baseImagesReady(e){return Array.from(e.baseGroupEl.querySelectorAll("img")).every(e=>e.complete)}reconcileDuplicates(e){const t=e.baseGroupWidth>0&&this.baseImagesReady(e)?Math.max(1,Math.ceil(2*this.containerWidth/e.baseGroupWidth)):1;let s=e.trackEl.children.length-1;if(s===t)return void(e.duplicateCount=t);const i=this.parseItems();for(;s<t;)e.trackEl.append(this.renderGroup(i)),s+=1;for(;s>t;)e.trackEl.lastElementChild?.remove(),s-=1;e.duplicateCount=t}syncReadyState(){if(!this.containerEl)return;const e=this.rows.length>0&&this.rows.every(e=>e.baseGroupWidth>0);this.containerEl.classList.toggle(`${Os}--ready`,e)}startScrollEngine(){this.rafId||this.reduceMotion||(this.lastScrollY="undefined"!=typeof window?window.scrollY:0,this.lastFrameTime=0,this.smoothedScrollV=0,this.rows.forEach(e=>{e.x=0,e.dirState=1}),this.rafId=requestAnimationFrame(this.boundFrame))}stopScrollEngine(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0),this.rows.forEach(e=>{e.trackEl.style.transform=""})}frame(e){if(!this.scrollVelocityEnabled)return void(this.rafId=0);this.lastFrameTime||(this.lastFrameTime=e);const t=Math.min((e-this.lastFrameTime)/1e3,.05);this.lastFrameTime=e;const s="undefined"!=typeof window?window.scrollY:0,i=t>0?(s-this.lastScrollY)/t:0;this.lastScrollY=s;const n=1-Math.exp(-t/.12);this.smoothedScrollV+=(i-this.smoothedScrollV)*n;const a=Math.max(Number(this.getAttribute("scroll-boost")||6),0),r=this.smoothedScrollV/800*(a/6);this.rows.forEach(e=>{const s=e.baseGroupWidth+this.gap;if(s<=0)return;const i=s/this.baseDurationSec;let n=-e.baseDir*i*t;r<0?e.dirState=-1:r>0&&(e.dirState=1),n*=e.dirState,n+=n*Math.abs(r);let a=(e.x+n)%s;a>0&&(a-=s),e.x=a,e.trackEl.style.transform=`translate3d(${a}px, 0, 0)`}),this.rafId=requestAnimationFrame(this.boundFrame)}updateUI(){const e=this.parseItems();if(0===e.length)return this.stopScrollEngine(),void(this.hidden=!0);this.hidden=!1;const t=this.getAttribute("direction")||"left",s="right"===t?-1:1,i=Math.max(Number(this.getAttribute("duration")||12),1),n=Number(this.getAttribute("speed")||1),a=i/(Number.isFinite(n)&&n>0?n:1);this.baseDurationSec=a;const r=this.getAttribute("size")||"m",o=this.getAttribute("variant")||"default",l=this.getAttribute("align-y")||"center",d=this.getBool("fade-edges"),u=Math.max(Number(this.getAttribute("fade-width")||48),0),b=this.getAttribute("edge-padding"),m=null!==b&&""!==b?Math.max(Number(b),0):d?u:0,p=Math.max(Number(this.getAttribute("gap")||24),0);this.gap=p;const g=Math.round(Number(this.getAttribute("row-count")||1)),v=Number.isFinite(g)?Math.min(Math.max(g,1),8):1,E=Math.max(Number(this.getAttribute("row-gap")||12),0),f=this.getBool("scroll-velocity");this.scrollVelocityEnabled=f;const w=this.getBool("pause-on-hover",!0),y=this.hasAttribute("bordered")?this.getBool("bordered"):"outlined"===o,A=this.getAttribute("aria-label")||"Scrolling content";if(this.containerEl&&(this.containerEl.className=[Os,`${Os}--size-${r}`,`${Os}--variant-${o}`,`${Os}--align-${l}`,w&&!f&&`${Os}--pause-on-hover`,d&&`${Os}--fade-edges`,"right"===t&&`${Os}--right`,v>1&&`${Os}--multi-row`,f&&`${Os}--scroll-velocity`,y&&`${Os}--bordered`].filter(Boolean).join(" "),this.containerEl.style.setProperty("--db-marquee-duration",`${a}s`),this.containerEl.style.setProperty("--db-marquee-gap",`${p}px`),this.containerEl.style.setProperty("--db-marquee-row-gap",`${E}px`),this.containerEl.style.setProperty("--db-marquee-fade-width",`${u}px`),this.containerEl.style.setProperty("--db-marquee-edge-padding",`${m}px`),this.containerEl.setAttribute("role","region"),this.containerEl.setAttribute("aria-label",A)),this.srOnlyEl){const t=e.map(e=>this.itemToText(e)).filter(Boolean).join(" • ");this.srOnlyEl.textContent=t||A}this.reconcileRows(v,s),this.buildBase(e),this.bindImageListeners(),this.measure(),f?this.startScrollEngine():this.stopScrollEngine()}}customElements.get("db-marquee")||customElements.define("db-marquee",DbMarquee);const Rs="designbase-wc-gradient";class DbGradient extends HTMLElement{static get observedAttributes(){return["colors","direction","size","variant","animation-duration","animation-delay","full-width","full-height"]}connectedCallback(){this.style.display="flex",this.updateUI()}attributeChangedCallback(){this.updateUI()}getBool(e){return this.hasAttribute(e)&&"false"!==this.getAttribute(e)}get colors(){return this.parseColors()}set colors(e){this.setAttribute("colors","string"==typeof e?e:JSON.stringify(e))}parseColors(){try{const e=JSON.parse(this.getAttribute("colors")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}directionMap(e){return{"to-right":"to right","to-left":"to left","to-bottom":"to bottom","to-top":"to top","to-bottom-right":"to bottom right","to-bottom-left":"to bottom left","to-top-right":"to top right","to-top-left":"to top left",radial:"circle"}[e]}colorStops(e){return e.map(e=>{const t=void 0!==e.position?`${e.position}%`:"";return t?`${e.color} ${t}`:e.color}).join(", ")}generateGradientStyle(e,t){if(0===e.length)return{};const s=this.colorStops(e);return"radial"===t?{background:`radial-gradient(circle, ${s})`}:{background:`linear-gradient(${this.directionMap(t)}, ${s})`}}generateAnimatedStyle(e,t,s,i){const n=e.map((e,t)=>{const s=((void 0!==e.position?e.position:0)+20*t)%100;return`${e.color} ${s}%`}).join(", ");return{background:"radial"===t?`radial-gradient(circle, ${n})`:`linear-gradient(${this.directionMap(t)}, ${n})`,animation:`gradient-shift ${s}s ease-in-out ${i}s infinite`,backgroundSize:"200% 200%"}}generateMeshStyle(e){return{background:`conic-gradient(from 0deg, ${e.slice(0,4).map((e,t)=>{const s=void 0!==e.position?e.position:33.33*t;return`${e.color} ${s}%`}).join(", ")})`}}updateUI(){const e=this.parseColors(),t=this.getAttribute("direction")||"to-right",s=this.getAttribute("size")||"m",i=this.getAttribute("variant")||"default",n=Number(this.getAttribute("animation-duration")||3),a=Number(this.getAttribute("animation-delay")||0),r=this.getBool("full-width"),o=this.getBool("full-height");this.className=[Rs,`${Rs}--size-${s}`,`${Rs}--variant-${i}`,`${Rs}--direction-${t}`,r&&`${Rs}--full-width`,o&&`${Rs}--full-height`].filter(Boolean).join(" ");let l={};l="animated"===i?this.generateAnimatedStyle(e,t,n,a):"mesh"===i?this.generateMeshStyle(e):this.generateGradientStyle(e,t),Object.assign(this.style,l)}}customElements.get("db-gradient")||customElements.define("db-gradient",DbGradient);const Hs={primary:{light:["#eff6ff","#dbeafe","#bfdbfe","#93c5fd"],vivid:["#3b82f6","#2563eb","#1d4ed8","#1e40af","#1e3a8a"],dark:["#0f172a","#1e293b","#334155","#475569","#64748b"]},secondary:{light:["#f8fafc","#f1f5f9","#e2e8f0","#cbd5e1"],vivid:["#6b7280","#4b5563","#374151","#1f2937","#111827"],dark:["#0f0f0f","#1a1a1a","#262626","#404040","#525252"]},success:{light:["#f0fdf4","#dcfce7","#bbf7d0","#86efac"],vivid:["#22c55e","#16a34a","#15803d","#166534","#14532d"],dark:["#052e16","#14532d","#166534","#15803d","#16a34a"]},warning:{light:["#fffbeb","#fef3c7","#fde68a"],vivid:["#f59e0b","#d97706","#b45309","#92400e","#78350f"],dark:["#451a03","#78350f","#92400e","#b45309","#d97706"]},error:{light:["#fef2f2","#fecaca","#fca5a5"],vivid:["#ef4444","#dc2626","#b91c1c","#991b1b","#7f1d1d"],dark:["#450a0a","#7f1d1d","#991b1b","#b91c1c","#dc2626"]},info:{light:["#eff6ff","#dbeafe","#bfdbfe","#93c5fd"],vivid:["#3b82f6","#2563eb","#1d4ed8","#1e40af","#1e3a8a"],dark:["#0f172a","#1e293b","#334155","#475569","#64748b"]},purple:{light:["#faf5ff","#f3e8ff","#e9d5ff","#d8b4fe"],vivid:["#a855f7","#9333ea","#7c3aed","#6d28d9","#5b21b6"],dark:["#3b0764","#581c87","#6b21a8","#7c3aed","#9333ea"]},ocean:{light:["#f0fdfa","#ccfbf1","#99f6e4"],vivid:["#14b8a6","#0d9488","#0f766e","#115e59","#134e4a"],dark:["#042f2e","#134e4a","#115e59","#0f766e","#0d9488"]},sunset:{light:["#fff7ed","#fed7aa","#fdba74"],vivid:["#f97316","#ea580c","#c2410c","#9a3412","#7c2d12"],dark:["#431407","#7c2d12","#9a3412","#c2410c","#ea580c"]}};const Vs="designbase-wc-random-gradient";class DbRandomGradient extends HTMLElement{constructor(){super(...arguments),this.built=!1}static get observedAttributes(){return["scheme","tone","width","height","blur","color-count","animated","animation-duration","overlay","overlay-opacity"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}disconnectedCallback(){this.stopAnimation()}attributeChangedCallback(){this.built&&this.updateUI()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}build(){this.backgroundEl=document.createElement("div"),this.backgroundEl.className=`${Vs}__background`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${Vs}__overlay`,this.contentEl=document.createElement("div"),this.contentEl.className=`${Vs}__content`,this.append(this.backgroundEl,this.overlayEl,this.contentEl)}stopAnimation(){this.animationTimer&&(window.clearInterval(this.animationTimer),this.animationTimer=void 0)}applyGradient(){const e=function createRandomGradientStyle(e,t,s,i,n,a){const r=Hs[e][t],o=Math.min(6,Math.max(3,s)),l=[];for(let e=0;e<o;e+=1)l.push(r[Math.floor(Math.random()*r.length)]);const d=Array.from({length:o},()=>100*Math.random()).sort((e,t)=>e-t),u=l.map((e,t)=>`${e} ${d[t]}%`).join(", ");return{background:`radial-gradient(circle at ${100*Math.random()}% ${100*Math.random()}%, ${u})`,filter:`blur(${Math.max(80,i)}px)`,transition:n?`background ${a}s ease-in-out`:"none"}}(this.getAttribute("scheme")||"primary",this.getAttribute("tone")||"vivid",Number(this.getAttribute("color-count")||4),Number(this.getAttribute("blur")||80),this.getBool("animated"),Number(this.getAttribute("animation-duration")||10));this.backgroundEl&&Object.assign(this.backgroundEl.style,e)}syncContent(){if(!this.contentEl)return;Array.from(this.childNodes).filter(e=>e!==this.backgroundEl&&e!==this.overlayEl&&e!==this.contentEl&&!(e instanceof HTMLElement&&e.hasAttribute("data-wc-internal"))).forEach(e=>this.contentEl.append(e)),this.contentEl.hidden=0===this.contentEl.childNodes.length}updateUI(){const e=this.getAttribute("scheme")||"primary",t=this.getAttribute("tone")||"vivid",s=this.getAttribute("width")||"100%",i=this.getAttribute("height")||"600px",n=!this.hasAttribute("overlay")||"false"!==this.getAttribute("overlay"),a=Number(this.getAttribute("overlay-opacity")||.2),r=this.getBool("animated");if(this.className=[Vs,r&&`${Vs}--animated`,n&&`${Vs}--with-overlay`].filter(Boolean).join(" "),this.style.width=/^\d+$/.test(s)?`${s}px`:s,this.style.height=/^\d+$/.test(i)?`${i}px`:i,this.overlayEl&&(this.overlayEl.hidden=!n,n)){const s=Hs[e][t];Object.assign(this.overlayEl.style,{background:`linear-gradient(45deg, ${s[0]}, ${s[1]})`,opacity:String(a)})}if(this.stopAnimation(),this.applyGradient(),r){const e=Number(this.getAttribute("animation-duration")||10);this.animationTimer=window.setInterval(()=>this.applyGradient(),1e3*e)}this.syncContent()}}customElements.get("db-random-gradient")||customElements.define("db-random-gradient",DbRandomGradient);const qs="designbase-wc-ad-banner",js={hero:"지금 바로 시작하세요",topbar:"🎉 신규 가입 시 10,000원 적립금 증정!",card:"프리미엄 멤버십",floating:"오늘만 특가!"},Us={hero:"최대 50% 할인된 가격으로 프리미엄 서비스를 경험해보세요. 기간 한정 특별 혜택!",topbar:"오늘 하루만 특별 혜택",card:"무제한 서비스 이용권을 특별가에 만나보세요",floating:"장바구니에 담긴 상품 추가 20% 할인"},Ws={hero:"자세히 보기",topbar:"지금 가입하기",card:"알아보기",floating:"할인받기"},Gs="star-filled",Js={primary:"primary",secondary:"secondary",success:"success",warning:"warning",error:"error"};class DbAdBanner extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.visible=!0,this.progress=100}static get observedAttributes(){return["type","variant","size","title","subtitle","cta-text","image","image-alt","href","target","auto-close","close-delay","background","animation-type","grid-type","use-random-gradient","gradient-scheme","gradient-tone","gradient-animated","countdown-end-date","show-countdown","open"]}connectedCallback(){this.style.display="block",this.built||(this.built=!0,this.build()),this.updateUI()}disconnectedCallback(){this.stopAutoClose()}attributeChangedCallback(e){this.built&&("open"===e&&(this.visible="false"!==this.getAttribute("open")),this.updateUI())}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getType(){const e=this.getAttribute("type")||"hero";return["hero","topbar","card","floating"].includes(e)?e:"hero"}getVariant(){const e=this.getAttribute("variant")||"primary";return["primary","secondary","success","warning","error"].includes(e)?e:"primary"}getSize(){const e=this.getAttribute("size")||"m";return["s","m","l"].includes(e)?e:"m"}ctaButtonSize(e,t){return"card"===e?"s":"floating"===e?"s"===t?"s":"m":t}build(){this.rootEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.contentEl.className=`${qs}__content`,this.closeBtn=document.createElement("button"),this.closeBtn.type="button",this.closeBtn.className=`${qs}__close`,this.closeBtn.setAttribute("aria-label","닫기"),this.closeBtn.append(createDbIcon("close",16)),this.closeBtn.addEventListener("click",e=>{e.stopPropagation(),this.handleClose()}),this.imageEl=document.createElement("img"),this.imageEl.className=`${qs}__image`,this.imageEl.loading="lazy";const e=document.createElement("div");e.className=`${qs}__main`,this.mainEl=e,this.iconEl=document.createElement("div"),this.iconEl.className=`${qs}__icon`,this.labelEl=document.createElement("span"),this.labelEl.className=`${qs}__label`,this.labelEl.textContent="특별 이벤트",this.badgeEl=document.createElement("span"),this.badgeEl.className=`${qs}__badge`,this.badgeEl.textContent="HOT DEAL",this.titleEl=document.createElement("h2"),this.titleEl.className=`${qs}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${qs}__subtitle`;const t=document.createElement("div");t.className=`${qs}__text`,this.textEl=t,this.countdownWrapEl=document.createElement("div"),this.countdownWrapEl.className=`${qs}__countdown`,t.append(this.titleEl,this.subtitleEl),this.actionsEl=document.createElement("div"),this.actionsEl.className=`${qs}__actions`,this.ctaEl=document.createElement("db-button"),this.ctaEl.className=`${qs}__cta`,this.ctaEl.setAttribute("variant","primary"),this.ctaEl.setAttribute("end-icon","arrow-right"),this.ctaEl.addEventListener("click",e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("db-cta-click",{bubbles:!0,composed:!0}))}),this.actionsEl.append(this.ctaEl),e.append(t,this.actionsEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${qs}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${qs}__progress-bar`,this.progressEl.append(this.progressBarEl),this.contentEl.append(this.closeBtn,e,this.progressEl),this.rootEl.append(this.contentEl),this.append(this.rootEl),this.contentEl.addEventListener("click",e=>{"topbar"===this.getType()&&(e.target?.closest(`.${qs}__close`)||this.dispatchEvent(new CustomEvent("db-cta-click",{bubbles:!0,composed:!0})))})}handleClose(){this.visible=!1,this.style.display="none",this.setAttribute("open","false"),this.stopAutoClose(),this.dispatchEvent(new CustomEvent("db-close",{bubbles:!0,composed:!0}))}stopAutoClose(){this.autoCloseTimer&&(window.clearInterval(this.autoCloseTimer),this.autoCloseTimer=void 0)}startAutoClose(e){this.stopAutoClose(),this.progress=100,this.autoCloseTimer=window.setInterval(()=>{this.progress-=100/(e/100),this.progressBarEl&&(this.progressBarEl.style.width=`${Math.max(this.progress,0)}%`),this.progress<=0&&this.handleClose()},100)}getBackground(){const e=this.getAttribute("background");return e&&["solid","gradient","animation","grid"].includes(e)?e:this.getBool("use-random-gradient")?"gradient":"solid"}ensureAnimBg(){if(!this.animBgEl){const e=document.createElement("div");e.className=`${qs}__backdrop`;const t=document.createElement("db-animation-background");t.className=`${qs}__anim-bg`,t.setAttribute("width","100%"),t.setAttribute("height","100%"),e.append(t),this.animBgEl=e,this.animBgInner=t}return this.animBgEl}ensureGridBg(){if(!this.gridBgEl){const e=document.createElement("div");e.className=`${qs}__backdrop`;const t=document.createElement("db-grid-background");t.className=`${qs}__grid-bg`,t.setAttribute("width","100%"),t.setAttribute("height","100%"),e.append(t),this.gridBgEl=e,this.gridBgInner=t}return this.gridBgEl}clearBackdrop(e){"gradient"!==e&&this.gradientEl&&(this.gradientEl.remove(),this.gradientEl=void 0),"animation"!==e&&this.animBgEl&&(this.animBgEl.remove(),this.animBgEl=void 0,this.animBgInner=void 0),"grid"!==e&&this.gridBgEl&&(this.gridBgEl.remove(),this.gridBgEl=void 0,this.gridBgInner=void 0)}renderBackground(e,t){if(!this.rootEl||!this.contentEl)return;if(this.clearBackdrop(e),"gradient"===e){this.gradientEl||(this.gradientEl=document.createElement("db-random-gradient"),this.gradientEl.className=`${qs}__gradient-bg`,this.gradientEl.setAttribute("height","100%"),this.gradientEl.setAttribute("width","100%"));const e=this.getAttribute("gradient-tone")||"vivid",s=!this.hasAttribute("gradient-animated")||"false"!==this.getAttribute("gradient-animated");return this.gradientEl.setAttribute("scheme",this.getAttribute("gradient-scheme")||Js[t]),this.gradientEl.setAttribute("tone",e),this.gradientEl.setAttribute("animated",s?"true":"false"),this.gradientEl.parentElement!==this.rootEl&&this.rootEl.replaceChildren(this.gradientEl),void(this.contentEl.parentElement!==this.gradientEl&&this.gradientEl.append(this.contentEl))}const s=[];if("animation"===e){const e=this.ensureAnimBg();this.animBgInner?.setAttribute("type",this.getAttribute("animation-type")||"graphite"),this.animBgInner?.setAttribute("theme","dark"),s.push(e)}else if("grid"===e){const e=this.ensureGridBg();this.gridBgInner?.setAttribute("type",this.getAttribute("grid-type")||"lines"),this.gridBgInner?.setAttribute("color","var(--db-text-inverse-primary)"),this.gridBgInner?.setAttribute("opacity","0.18"),this.gridBgInner?.setAttribute("fade","vignette"),this.gridBgInner?.setAttribute("animated",""),s.push(e)}const i=[...s,this.contentEl],n=Array.from(this.rootEl.children);n.length===i.length&&i.every((e,t)=>n[t]===e)||this.rootEl.replaceChildren(...i)}syncIcon(e){this.mainEl&&this.textEl&&this.iconEl&&("card"===e?(this.iconEl.replaceChildren(createDbIcon(Gs,32)),this.iconEl.parentElement!==this.mainEl&&this.mainEl.insertBefore(this.iconEl,this.textEl)):this.iconEl.remove())}syncBadge(e){this.textEl&&this.badgeEl&&("floating"===e?this.badgeEl.parentElement!==this.textEl&&this.textEl.insertBefore(this.badgeEl,this.textEl.firstChild):this.badgeEl.remove())}syncImage(e,t){this.contentEl&&this.imageEl&&this.mainEl&&("floating"===e&&t?(this.imageEl.src=t,this.imageEl.alt=this.getAttribute("image-alt")||"",this.imageEl.parentElement!==this.contentEl&&this.contentEl.insertBefore(this.imageEl,this.mainEl)):this.imageEl.remove())}syncLink(e,t){if(!this.contentEl)return;if("topbar"!==e||!t)return void this.linkEl?.remove();this.linkEl||(this.linkEl=document.createElement("a"),this.linkEl.className=`${qs}__link`),this.linkEl.setAttribute("href",t);const s=this.getAttribute("target");s?this.linkEl.setAttribute("target",s):this.linkEl.removeAttribute("target"),this.linkEl.setAttribute("aria-label",this.titleEl?.textContent||"배너 링크"),this.linkEl.parentElement!==this.contentEl&&this.contentEl.append(this.linkEl)}syncCountdown(e,t){this.textEl&&this.countdownWrapEl&&(e&&t?(this.countdownEl||(this.countdownEl=document.createElement("db-countdown"),this.countdownEl.setAttribute("size","s"),this.countdownEl.setAttribute("variant","compact"),this.countdownEl.setAttribute("show-labels","false"),this.countdownWrapEl.replaceChildren(this.countdownEl)),this.countdownEl.setAttribute("end-date",t),this.countdownWrapEl.parentElement!==this.textEl&&this.textEl.append(this.countdownWrapEl)):this.countdownWrapEl.remove())}updateUI(){if(!this.visible||"false"===this.getAttribute("open"))return void(this.style.display="none");this.style.display="block";const e=this.getType(),t=this.getVariant(),s=this.getSize(),i=this.getAttribute("title")||js[e],n=this.getAttribute("subtitle")||Us[e],a=this.getAttribute("cta-text")||Ws[e],r=this.getBool("auto-close"),o=Math.max(Number(this.getAttribute("close-delay")||5e3),1e3),l=this.getBackground(),d=this.getAttribute("gradient-tone")||"vivid",u=this.getBool("show-countdown"),b=this.getAttribute("countdown-end-date");this.rootEl&&(this.rootEl.className=[qs,`${qs}--type-${e}`,`${qs}--variant-${t}`,`${qs}--size-${s}`,`${qs}--bg-${l}`,r&&`${qs}--auto-close`,"gradient"===l&&`${qs}--with-gradient`,"gradient"===l&&"light"===d&&`${qs}--gradient-light`].filter(Boolean).join(" ")),this.renderBackground(l,t),this.syncIcon(e),this.syncBadge(e),this.syncImage(e,this.getAttribute("image")),this.syncLink(e,this.getAttribute("href")),this.titleEl&&(this.titleEl.textContent=i),this.subtitleEl&&(this.subtitleEl.textContent=n),this.syncCountdown(u,b),this.actionsEl&&(this.actionsEl.hidden="topbar"===e),this.ctaEl&&(this.ctaEl.textContent=a,this.ctaEl.setAttribute("size",this.ctaButtonSize(e,s)),"floating"===e?this.ctaEl.setAttribute("full-width",""):this.ctaEl.removeAttribute("full-width")),this.progressEl&&(this.progressEl.hidden=!r),this.progressBarEl&&r&&(this.progressBarEl.style.width=`${this.progress}%`),this.stopAutoClose(),r&&this.startAutoClose(o)}}customElements.get("db-ad-banner")||customElements.define("db-ad-banner",DbAdBanner);const Ks="designbase-wc-timeline";class DbTimeline extends HTMLElement{static get observedAttributes(){return["items","type","variant","size","color","clickable","full-width","disabled"]}connectedCallback(){this.style.display="block",this.render()}attributeChangedCallback(){this.isConnected&&this.render()}get items(){try{return JSON.parse(this.getAttribute("items")||"[]")}catch{return[]}}set items(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}getItemPosition(e){return"left"===(this.getAttribute("type")||"alternate")||e%2==0?"left":"right"}handleItemClick(e,t){this.hasAttribute("disabled")||e.disabled||!this.hasAttribute("clickable")||this.dispatchEvent(new CustomEvent("db-item-click",{bubbles:!0,composed:!0,detail:{item:e,index:t}}))}render(){const e=this.getAttribute("type")||"alternate",t=this.getAttribute("variant")||"default",s=this.getAttribute("size")||"m",i=this.getAttribute("color")||"primary",n=this.hasAttribute("clickable"),a=this.hasAttribute("disabled"),r=this.items;this.className=[Ks,`${Ks}--${e}`,`${Ks}--${t}`,`${Ks}--${s}`,n&&`${Ks}--clickable`,this.hasAttribute("full-width")&&`${Ks}--full-width`,a&&`${Ks}--disabled`].filter(Boolean).join(" "),this.replaceChildren();const o=document.createElement("div");o.className=`${Ks}__container`,r.forEach((e,l)=>{const d=this.getItemPosition(l),u=l===r.length-1,b=n&&!a&&!e.disabled,m=e.color||i,p=e.status||"pending",g=document.createElement("div");g.className=[`${Ks}__item`,`${Ks}__item--${d}`,`${Ks}__item--${m}`,b&&`${Ks}__item--clickable`,e.disabled&&`${Ks}__item--disabled`].filter(Boolean).join(" ");const v=document.createElement("div");if(v.className=`${Ks}__indicator-container`,"active"===p&&!e.icon&&void 0===e.number){const e=document.createElement("div");e.className=`${Ks}__pulse`,v.append(e)}const E=document.createElement("div");if(E.className=[`${Ks}__dot`,`${Ks}__dot--${m}`,`${Ks}__dot--${t}`,`${Ks}__dot--${p}`,b&&`${Ks}__dot--clickable`,e.icon&&`${Ks}__dot--with-icon`,void 0!==e.number&&!e.icon&&`${Ks}__dot--with-number`].filter(Boolean).join(" "),b&&(E.tabIndex=0,E.setAttribute("role","button"),E.setAttribute("aria-label",e.title?`${e.title} 타임라인 점`:`타임라인 점 ${l+1}`),E.addEventListener("click",()=>this.handleItemClick(e,l)),E.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleItemClick(e,l))})),e.icon&&isDbIconName(e.icon)){const t=document.createElement("div");t.className=`${Ks}__icon`,t.append(createDbIcon(e.icon,"s"===s?14:"l"===s?20:16)),E.append(t)}else if(void 0!==e.number){const t=document.createElement("span");t.className=`${Ks}__number`,t.textContent=String(e.number),E.append(t)}if(v.append(E),!u){const e=document.createElement("div");e.className=`${Ks}__connector`,v.append(e)}const f=document.createElement("div");if(f.className=[`${Ks}__content`,`${Ks}__content--${d}`].join(" "),e.timestamp){const t=document.createElement("div");t.className=`${Ks}__timestamp`,t.textContent=e.timestamp,f.append(t)}const w=document.createElement("div");if(w.className=`${Ks}__content-inner`,b&&(w.tabIndex=0,w.setAttribute("role","button"),w.setAttribute("aria-label",e.title?`${e.title} 타임라인 아이템`:`타임라인 아이템 ${l+1}`),w.addEventListener("click",()=>this.handleItemClick(e,l)),w.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleItemClick(e,l))})),e.title){const t=document.createElement("h3");t.className=`${Ks}__title`,t.textContent=e.title,w.append(t)}if(e.description){const t=document.createElement("p");t.className=`${Ks}__description`,t.textContent=e.description,w.append(t)}f.append(w),g.append(v,f),o.append(g)}),this.append(o)}}customElements.get("db-timeline")||customElements.define("db-timeline",DbTimeline);const Ys="designbase-wc-animation-text";class DbAnimationText extends HTMLElement{constructor(){super(...arguments),this.timers=[],this.displayText="",this.isVisible=!1,this.isAnimating=!1,this.wordEls=[],this.rotateToken=0}static get observedAttributes(){return["text","texts","interval","trigger","type","speed","repeat","delay","direction","size","color","custom-color","weight","align","gradient-colors","wave-colors","glow-color","clickable","disabled"]}connectedCallback(){this.style.display="inline-block",this.ensureStructure(),this.syncFromAttributes(),this.setupTrigger()}disconnectedCallback(){this.clearTimers(),this.observer?.disconnect(),this.teardownScrollFill(),this.rotateObserver?.disconnect()}attributeChangedCallback(){this.isConnected&&(this.syncFromAttributes(),this.setupTrigger())}getText(){return this.getAttribute("text")||this.textContent?.trim()||""}getRotateTexts(){const e=this.getAttribute("texts");if(e){const t=e.split(",").map(e=>e.trim()).filter(Boolean);if(t.length)return t}const t=this.getText();return t?[t]:[]}getLongestText(){return this.getRotateTexts().reduce((e,t)=>t.length>e.length?t:e,"")}getType(){const e=this.getAttribute("type")||"fade";return["typing","fade","slide","bounce","shake","glow","gradient","wave","flip","scale","decode","roll","reveal","scroll-fill","text-rotate"].includes(e)?e:"fade"}getTrigger(){const e=this.getAttribute("trigger")||"mount";return["mount","hover","click","in-view"].includes(e)?e:"mount"}ensureStructure(){this.ghostEl||(this.ghostEl=document.createElement("span"),this.ghostEl.setAttribute("aria-hidden","true"),this.ghostEl.style.visibility="hidden",this.ghostEl.style.pointerEvents="none",this.ghostEl.style.userSelect="none",this.layerEl=document.createElement("span"),this.layerEl.style.position="absolute",this.layerEl.style.top="0",this.layerEl.style.left="0",this.append(this.ghostEl,this.layerEl),this.addEventListener("mouseenter",()=>{"hover"!==this.getTrigger()||this.hasAttribute("disabled")||"roll"!==this.getType()&&(this.isVisible=!0,this.startAnimation(),this.syncClasses())}),this.addEventListener("mouseleave",()=>{if("hover"!==this.getTrigger())return;if("roll"===this.getType())return;this.isVisible=!1,this.isAnimating=!1,this.clearTimers();const e=this.getType();"typing"!==e&&"decode"!==e||(this.displayText=this.getText()),this.renderLayer(),this.syncClasses()}),this.addEventListener("click",()=>{if(!this.hasAttribute("disabled")){if("click"===this.getTrigger()){if(this.isVisible=!this.isVisible,this.isVisible)this.startAnimation();else{this.isAnimating=!1,this.clearTimers();const e=this.getType();"typing"!==e&&"decode"!==e||(this.displayText=this.getText()),this.renderLayer()}this.syncClasses()}this.hasAttribute("clickable")&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))}}))}clearTimers(){this.timers.forEach(e=>window.clearInterval(e)),this.timers.forEach(e=>window.clearTimeout(e)),this.timers=[]}syncFromAttributes(){const e=this.getText(),t=this.getType(),s=this.getTrigger(),i=Number(this.getAttribute("speed")||1e3),n=Number(this.getAttribute("repeat")||1),a=this.getAttribute("custom-color"),r=(this.getAttribute("gradient-colors")||"#667eea,#764ba2").split(","),o=(this.getAttribute("wave-colors")||"#ff6b6b,#4ecdc4,#45b7d1,#96ceb4,#feca57").split(","),l=this.getAttribute("glow-color")||"#667eea";this.className=[Ys,"typing"!==t&&`${Ys}--${t}`,`${Ys}--${this.getAttribute("size")||"m"}`,`${Ys}--${this.getAttribute("color")||"primary"}`,`${Ys}--${this.getAttribute("weight")||"normal"}`,`${Ys}--${this.getAttribute("align")||"left"}`,`${Ys}--${this.getAttribute("direction")||"left"}`,this.isVisible&&`${Ys}--visible`,this.isAnimating&&`${Ys}--animating`,(this.hasAttribute("clickable")||"click"===s)&&`${Ys}--clickable`,this.hasAttribute("disabled")&&`${Ys}--disabled`].filter(Boolean).join(" "),this.style.setProperty("--db-animation-speed",`${Number.isFinite(i)?i:1e3}ms`),this.style.setProperty("--db-animation-iteration-count",0===n?"infinite":String(n)),a&&this.style.setProperty("--db-text-custom",a),this.style.setProperty("--db-wave-colors",o.join(", ")),this.style.setProperty("--db-glow-color",l),this.style.removeProperty("background"),this.style.removeProperty("background-size"),this.style.removeProperty("-webkit-background-clip"),this.style.removeProperty("-webkit-text-fill-color"),this.style.removeProperty("background-clip"),this.layerEl&&("gradient"===t&&r.length>=2?this.layerEl.style.backgroundImage=`linear-gradient(45deg, ${r.join(", ")})`:this.layerEl.style.removeProperty("background-image")),"typing"!==t&&"decode"!==t||"mount"!==s||this.isAnimating?this.isAnimating||(this.displayText=e):this.displayText="";const d="typing"===t||"decode"===t||"roll"===t||"text-rotate"===t,u="roll"===t||"text-rotate"===t?"nowrap":d?"pre-wrap":"";this.ghostEl&&(d?(this.ghostEl.textContent="text-rotate"===t?this.getLongestText():e,this.ghostEl.style.display="inline-block",this.ghostEl.style.whiteSpace=u,this.ghostEl.style.paddingRight="typing"===t?"0.25em":""):(this.ghostEl.textContent="",this.ghostEl.style.display="none")),this.layerEl&&(this.layerEl.className=[`${Ys}__layer`,"typing"===t&&`${Ys}--typing`,this.isAnimating&&"typing"===t&&`${Ys}--animating`].filter(Boolean).join(" "),d?(this.layerEl.style.position="absolute",this.layerEl.style.top="0",this.layerEl.style.left="0",this.layerEl.style.width="100%",this.layerEl.style.height="100%",this.layerEl.style.whiteSpace=u):(this.layerEl.style.position="static",this.layerEl.style.removeProperty("top"),this.layerEl.style.removeProperty("left"),this.layerEl.style.width="auto",this.layerEl.style.height="auto",this.layerEl.style.whiteSpace="")),this.renderLayer()}syncClasses(){this.classList.toggle(`${Ys}--visible`,this.isVisible),this.classList.toggle(`${Ys}--animating`,this.isAnimating)}setupTrigger(){this.clearTimers(),this.observer?.disconnect(),this.teardownScrollFill(),this.rotateObserver?.disconnect(),this.rotateObserver=void 0,this.rotateToken++;const e=this.getTrigger(),t=Number(this.getAttribute("delay")||0);if("scroll-fill"!==this.getType())if("text-rotate"!==this.getType()){if("mount"===e){const e=window.setTimeout(()=>{this.isVisible=!0,this.syncClasses(),this.startAnimation()},t);return void this.timers.push(e)}"in-view"===e&&(this.observer=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(window.setTimeout(()=>{this.isVisible=!0,this.syncClasses(),this.startAnimation()},t),this.observer?.disconnect())}),this.observer.observe(this))}else this.setupTextRotate();else this.setupScrollFill()}setupTextRotate(){if(this.getRotateTexts().length<=1)return;const e=++this.rotateToken,start=()=>{if(e!==this.rotateToken||!this.isConnected||"text-rotate"!==this.getType())return;const t=this.layerEl?.querySelector(`.${Ys}__rotate-track`);if(!t||!t.firstElementChild)return;const s=Array.from(t.children),i=Number(this.getAttribute("speed")||500),n=Math.max(i+200,Number(this.getAttribute("interval")||2e3));let a=0;const apply=e=>{const n=s[0].getBoundingClientRect().height;if(!n)return;const r="cubic-bezier(0.22, 1, 0.36, 1)";var o;t.style.transition=e?`transform ${i}ms ${r}`:"none",t.style.transform=`translateY(-${a*n}px)`,this.style.transition=e?`width ${i}ms ${r}`:"none",this.style.width=`${o=a,s[o].getBoundingClientRect().width}px`};apply(!1);const r=window.setInterval(()=>{if(a+=1,apply(!0),a===s.length-1){const e=window.setTimeout(()=>{a=0,apply(!1)},i);this.timers.push(e)}},n);this.timers.push(r),this.rotateObserver?.disconnect();let o=!0;const l=new ResizeObserver(()=>{o?o=!1:apply(!1)});l.observe(s[0]),this.rotateObserver=l};"undefined"!=typeof document&&document.fonts?document.fonts.ready.then(()=>window.requestAnimationFrame(start)):window.requestAnimationFrame(start)}setupScrollFill(){this.scrollHandler=()=>{null==this.rafId&&(this.rafId=window.requestAnimationFrame(()=>{this.rafId=void 0,this.updateScrollFill()}))},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.scrollHandler,{passive:!0}),this.updateScrollFill()}teardownScrollFill(){this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),window.removeEventListener("resize",this.scrollHandler),this.scrollHandler=void 0),null!=this.rafId&&(window.cancelAnimationFrame(this.rafId),this.rafId=void 0)}updateScrollFill(){if("scroll-fill"!==this.getType()||0===this.wordEls.length)return;const clamp=e=>Math.max(0,Math.min(1,e)),e=this.getBoundingClientRect(),t=window.innerHeight||document.documentElement.clientHeight,s=.85*t,i=.35*t,n=clamp((s-e.top)/(s-i||1)),a=this.wordEls.length;this.wordEls.forEach((e,t)=>{const s=clamp((n*(a+4)-t)/4);e.style.opacity=String(.18+(1-.18)*s)})}startAnimation(){const e=this.getType(),t=this.getText();if(this.isAnimating=!0,this.syncClasses(),this.syncFromAttributes(),"typing"===e)return void this.startTyping(0);if("decode"===e)return void this.startDecoding(0);if("reveal"===e||"scroll-fill"===e||"roll"===e)return this.displayText=t,"roll"!==e&&this.renderLayer(),this.isAnimating=!1,void this.syncClasses();this.displayText=t,this.renderLayer();const s=Number(this.getAttribute("speed")||1e3),i=window.setTimeout(()=>{this.isAnimating=!1,this.syncClasses(),this.syncFromAttributes()},s);this.timers.push(i)}startTyping(e){const t=this.getText(),s=Number(this.getAttribute("speed")||1e3),i=Number(this.getAttribute("repeat")||1);this.displayText="",this.renderLayer();let n=0;const a=window.setInterval(()=>{if(n>=t.length)if(window.clearInterval(a),0===i||e<i-1){const t=window.setTimeout(()=>this.startTyping(e+1),500);this.timers.push(t)}else this.isAnimating=!1,this.syncClasses();else this.displayText=t.slice(0,n+1),this.renderLayer(),n+=1},Math.max(16,s/Math.max(t.length,1)));this.timers.push(a)}startDecoding(e){const t=this.getText(),s=Number(this.getAttribute("repeat")||1),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";let n=0;const a=window.setInterval(()=>{if(this.displayText=t.split("").map((e,s)=>s<n?t[s]:i[Math.floor(74*Math.random())]||e).join(""),this.renderLayer(),n>=t.length)if(window.clearInterval(a),this.displayText=t,this.renderLayer(),0===s||e<s-1){const t=window.setTimeout(()=>this.startDecoding(e+1),500);this.timers.push(t)}else this.isAnimating=!1,this.syncClasses();n+=1/3},30);this.timers.push(a)}renderLayer(){if(!this.layerEl)return;const e=this.getType(),t=this.getText(),s=this.isVisible||this.isAnimating;if("reveal"===e||"scroll-fill"===e){this.wordEls=[];const s=document.createDocumentFragment(),i=t.split(/(\s+)/);let n=0;for(const t of i){if(""===t)continue;if(/^\s+$/.test(t)){s.appendChild(document.createTextNode(t));continue}const i=document.createElement("span");i.className=`${Ys}__word`,i.textContent=t,"reveal"===e&&(i.style.animationDelay=.06*n+"s"),this.wordEls.push(i),s.appendChild(i),n+=1}return this.layerEl.replaceChildren(s),void("scroll-fill"===e&&this.updateScrollFill())}if("text-rotate"===e){const e=this.getRotateTexts(),s=e.length?e:[t],i=document.createElement("span");i.className=`${Ys}__rotate-track`;const build=e=>{const t=document.createElement("span");return t.className=`${Ys}__rotate-item`,t.textContent=e,t};return s.forEach(e=>i.appendChild(build(e))),s.length>1&&i.appendChild(build(s[0])),void this.layerEl.replaceChildren(i)}if("roll"===e){const e=document.createElement("span");e.className=`${Ys}__roll-track`;const s=document.createElement("span");s.className=`${Ys}__roll-item`,s.textContent=t;const i=s.cloneNode(!0);return e.append(s,i),void this.layerEl.replaceChildren(e)}if("typing"!==e)"wave"!==e&&"shake"!==e||!s?this.layerEl.textContent=this.displayText||(s?t:""):this.layerEl.replaceChildren(...t.split("").map((e,t)=>{const s=document.createElement("span");return s.style.animationDelay=.05*t+"s",s.style.display="inline-block",s.textContent=" "===e?" ":e,s}));else if(this.layerEl.textContent=this.displayText,this.isAnimating){const e=document.createElement("span");e.className=`${Ys}__caret`,e.setAttribute("aria-hidden","true"),this.layerEl.appendChild(e)}}}customElements.get("db-animation-text")||customElements.define("db-animation-text",DbAnimationText);const Xs="designbase-wc-tutorial";class DbTutorial extends HTMLElement{constructor(){super(...arguments),this.internalStep=0,this.targetElement=null,this.keyHandler=null,this.resizeHandler=null,this.isMounted=!1}static get observedAttributes(){return["open","steps","current-step","indicator-type","indicator-size"]}connectedCallback(){this.style.display="contents",this.syncStepFromAttribute(),this.syncOpenState()}disconnectedCallback(){this.detachListeners(),this.clearTargetHighlight(),this.unmount()}attributeChangedCallback(e){this.isConnected&&("open"!==e?("current-step"===e&&this.syncStepFromAttribute(),this.isMounted&&this.render()):this.syncOpenState())}get steps(){return this.parseSteps()}set steps(e){this.setAttribute("steps","string"==typeof e?e:JSON.stringify(e))}parseSteps(){try{const e=JSON.parse(this.getAttribute("steps")||"[]");return Array.isArray(e)?e:[]}catch{return[]}}syncStepFromAttribute(){if(!this.hasAttribute("current-step"))return;const e=Number(this.getAttribute("current-step")||0);Number.isFinite(e)&&(this.internalStep=Math.max(0,e))}isOpenRequested(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}getCurrentStepData(){const e=this.parseSteps();if(!e.length)return;const t=Math.min(Math.max(this.internalStep,0),e.length-1);return{step:e[t],index:t,steps:e}}syncOpenState(){if(this.isOpenRequested())return this.mount(),void this.attachListeners();this.detachListeners(),this.clearTargetHighlight(),this.unmount()}mount(){this.root||(this.root=document.createElement("div"),this.root.className=Xs,this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.tabIndex=-1,this.ensureStructure()),this.root.isConnected||document.body.append(this.root),this.isMounted=!0,this.render()}unmount(){this.isMounted=!1,this.root?.remove()}ensureStructure(){if(!this.root||this.popoverEl)return;this.overlayEl=document.createElement("div"),this.overlayEl.className=`${Xs}__overlay`,this.overlayEl.addEventListener("click",()=>this.handleEnd()),this.popoverEl=document.createElement("div"),this.popoverEl.className=`${Xs}__popover`,this.closeButtonEl=document.createElement("button"),this.closeButtonEl.type="button",this.closeButtonEl.className=`${Xs}__close-button`,this.closeButtonEl.setAttribute("aria-label","튜토리얼 종료"),this.closeButtonEl.append(createDbIcon("close",16)),this.closeButtonEl.addEventListener("click",()=>this.handleEnd());const e=document.createElement("div");e.className=`${Xs}__content`;const t=document.createElement("div");t.className=`${Xs}__text`,this.titleEl=document.createElement("h3"),this.titleEl.id="tutorial-title",this.titleEl.className=`${Xs}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.id="tutorial-content",this.descriptionEl.className=`${Xs}__description`,t.append(this.titleEl,this.descriptionEl);const s=document.createElement("div");s.className=`${Xs}__navigation`,this.prevButtonEl=document.createElement("db-button"),this.prevButtonEl.setAttribute("variant","secondary"),this.prevButtonEl.setAttribute("size","s"),this.prevButtonEl.setAttribute("start-icon","chevron-left"),this.prevButtonEl.textContent="이전",this.prevButtonEl.addEventListener("db-click",()=>this.handlePrev()),this.indicatorEl=document.createElement("db-indicator"),this.indicatorEl.addEventListener("db-step-click",e=>{const t=e.detail;"number"==typeof t.index&&this.goToStep(t.index)}),this.nextButtonEl=document.createElement("db-button"),this.nextButtonEl.setAttribute("variant","primary"),this.nextButtonEl.setAttribute("size","s"),this.nextButtonEl.addEventListener("db-click",()=>this.handleNext()),s.append(this.prevButtonEl,this.indicatorEl,this.nextButtonEl),e.append(t,s),this.popoverEl.append(this.closeButtonEl,e),this.root.append(this.overlayEl,this.popoverEl)}attachListeners(){this.keyHandler||(this.keyHandler=e=>{"Escape"===e.key?this.handleEnd():"ArrowLeft"===e.key?this.handlePrev():"ArrowRight"===e.key&&this.handleNext()},document.addEventListener("keydown",this.keyHandler)),this.resizeHandler||(this.resizeHandler=()=>this.updateTargetElement(),window.addEventListener("resize",this.resizeHandler))}detachListeners(){this.keyHandler&&(document.removeEventListener("keydown",this.keyHandler),this.keyHandler=null),this.resizeHandler&&(window.removeEventListener("resize",this.resizeHandler),this.resizeHandler=null)}clearTargetHighlight(){this.targetElement&&(this.targetElement.classList.remove(`${Xs}__target`),this.targetElement.style.position="",this.targetElement.style.zIndex="",this.targetElement=null)}updateTargetElement(){const e=this.getCurrentStepData();if(!e?.step.target||!this.popoverEl)return;this.clearTargetHighlight();const t=document.querySelector(e.step.target);if(!t)return;this.targetElement=t,t.style.position="relative",t.style.zIndex="1000",t.classList.add(`${Xs}__target`);const s=t.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,a=300,r=200,o=16;let l="auto"!==e.step.placement&&e.step.placement?e.step.placement:"bottom",d=s.bottom+o,u=s.left+s.width/2-150;if("auto"===e.step.placement)s.top-r-o>0?(l="top",d=s.top-r-o):s.bottom+r+o<n?(l="bottom",d=s.bottom+o):s.left-a-o>0?(l="left",d=s.top+s.height/2-100,u=s.left-a-o):(l="right",d=s.top+s.height/2-100,u=s.right+o);else switch(l){case"top":d=s.top-r-o;break;case"bottom":d=s.bottom+o;break;case"left":d=s.top+s.height/2-100,u=s.left-a-o;break;case"right":d=s.top+s.height/2-100,u=s.right+o}u=Math.max(o,Math.min(u,i-a-o)),d=Math.max(o,Math.min(d,n-r-o)),this.popoverEl.className=[`${Xs}__popover`,`${Xs}__popover--${l}`].join(" "),this.popoverEl.style.top=`${d}px`,this.popoverEl.style.left=`${u}px`}emitStepChange(e){this.dispatchEvent(new CustomEvent("db-step-change",{bubbles:!0,composed:!0,detail:{step:e}}))}goToStep(e){const t=this.parseSteps();t.length&&(this.clearTargetHighlight(),this.internalStep=Math.min(Math.max(e,0),t.length-1),this.setAttribute("current-step",String(this.internalStep)),this.emitStepChange(this.internalStep),this.render())}handlePrev(){const e=this.getCurrentStepData();!e||e.index<=0||(this.dispatchEvent(new CustomEvent("db-prev",{bubbles:!0,composed:!0})),this.goToStep(e.index-1))}handleNext(){const e=this.getCurrentStepData();e&&(e.index>=e.steps.length-1?this.handleEnd():(this.dispatchEvent(new CustomEvent("db-next",{bubbles:!0,composed:!0})),this.goToStep(e.index+1)))}handleEnd(){this.dispatchEvent(new CustomEvent("db-end",{bubbles:!0,composed:!0})),this.setAttribute("open","false")}render(){const e=this.getCurrentStepData();if(!e||!this.root)return;const{step:t,index:s,steps:i}=e,n=0===s,a=s===i.length-1;this.titleEl&&(this.titleEl.textContent=t.title||"",this.titleEl.hidden=!t.title),this.descriptionEl&&(this.descriptionEl.textContent=t.content||"",this.descriptionEl.hidden=!t.content),this.prevButtonEl&&(this.prevButtonEl.hidden=n),this.nextButtonEl&&(this.nextButtonEl.textContent=a?"완료":"다음",a?this.nextButtonEl.removeAttribute("end-icon"):this.nextButtonEl.setAttribute("end-icon","chevron-right")),this.indicatorEl&&(this.indicatorEl.setAttribute("current",String(s)),this.indicatorEl.setAttribute("total",String(i.length)),this.indicatorEl.setAttribute("type",this.getAttribute("indicator-type")||"numbers"),this.indicatorEl.setAttribute("size",this.getAttribute("indicator-size")||"m")),this.updateTargetElement()}}customElements.get("db-tutorial")||customElements.define("db-tutorial",DbTutorial);const Zs=["plasma","mesh-flow","fluid","radiant","ethereal"];function toLuminaSpeed(e){return Math.max(.1,e/3e3)}function toSpeedRate(e){return Math.max(.1,e/3e3)}function hexToRgb(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255]:[0,0,0]}function padColors(e,t=5){return 0===e.length?["#7000FF","#FF00AA","#3300FF","#FFCC00","#00FFFF"]:Array.from({length:t},(t,s)=>e[s%e.length])}const Qs=["#0d0221","#5b21b6","#db2777","#38bdf8","#e9d5ff"],ei="data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E",ti=[{id:"neon_dream",name:"Neon Dream",colors:["#7000FF","#FF00AA","#3300FF","#FFCC00","#00FFFF"]},{id:"sunset_bliss",name:"Sunset Bliss",colors:["#FF9900","#FF00CC","#6600FF","#FF5500","#220055"]},{id:"deep_ocean",name:"Deep Ocean",colors:["#001133","#0044FF","#00DDFF","#00FFAA","#000066"]},{id:"forest_mist",name:"Forest Mist",colors:["#002200","#00FF44","#AAFF00","#006622","#CCFFCC"]},{id:"northern_lights",name:"Northern Lights",colors:["#000000","#00FF99","#AA00FF","#0044FF","#FFFFFF"]},{id:"monochrome_fog",name:"Monochrome Fog",colors:["#000000","#333333","#888888","#CCCCCC","#FFFFFF"]},{id:"cotton_candy",name:"Cotton Candy",colors:["#FFC0CB","#87CEFA","#E0FFFF","#DDA0DD","#FF69B4"]},{id:"cyber_glitch",name:"Cyber Glitch",colors:["#1A1A1D","#C3073F","#6F2232","#950740","#4E4E50"]},{id:"golden_hour",name:"Golden Hour",colors:["#FF4E50","#FC913A","#F9D423","#EDE574","#E1F5C4"]}];const si={graphite:{id:"graphite",colors:["#000000","#333333","#b3b3b3"],scale:1},abyss:{id:"abyss",colors:["#020617","#0f172a","#3b82f6"],scale:2.2},cherry:{id:"cherry",colors:["#1a0505","#4a0b1c","#e11d48"],scale:2.8},forest:{id:"forest",colors:["#021207","#064e3b","#10b981"],scale:2},sunset:{id:"sunset",colors:["#170500","#7c2d12","#f97316"],scale:3},amethyst:{id:"amethyst",colors:["#0f051a","#3b0764","#a855f7"],scale:2.4}},ii=si.graphite.colors,ni=Object.keys(si);function isGraphitePresetId(e){return Boolean(e&&e in si)}function getGraphitePreset(e){return si[e]}const ai=["#ffffff","#f0f9ff","#e0f2fe"],ri=["#ffb7c5","#ff91a4","#f8c8dc","#ffc0cb","#fda4af"],oi=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#4caf50","#ffeb3b","#ffc107","#ff9800"];function createFallingParticle(e,t,s,i=!1){return{x:Math.random()*e,y:i?Math.random()*t:-20,size:Math.random()*(s.maxSize-s.minSize)+s.minSize,speedX:(Math.random()-.5)*s.wind,speedY:Math.random()*(s.maxSpeedY-s.minSpeedY)+s.minSpeedY,opacity:.5*Math.random()+.3,rotation:Math.random()*Math.PI*2,rotationSpeed:.05*(Math.random()-.5),color:s.colors[Math.floor(Math.random()*s.colors.length)]}}const drawFallingParticles=(e,t,s,i,n,a)=>{const r=toSpeedRate(a.speed),o=Math.max(1,.5*a.size),l={minSize:o,maxSize:Math.max(o+.5,1.5*a.size),minSpeedY:.4*r,maxSpeedY:1.2*r,wind:a.wind*r,colors:a.colors},d=`${a.count}:${a.size}:${a.speed}:${a.wind}`;i.current.length===a.count&&i.spawnKey===d||(i.current=Array.from({length:a.count},()=>createFallingParticle(t,s,l,!0)),i.spawnKey=d),i.current.forEach(i=>{i.y+=i.speedY,i.x+=i.speedX+.5*Math.sin(i.y/50)*r,i.rotation+=i.rotationSpeed,i.y>s+20&&Object.assign(i,createFallingParticle(t,s,l)),i.x>t+20&&(i.x=-20),i.x<-20&&(i.x=t+20),e.save(),e.translate(i.x,i.y),e.rotate(i.rotation),e.fillStyle=i.color,e.globalAlpha=i.opacity*a.layerOpacity,function drawFallingParticleShape(e,t,s){return"snow"===t?(e.beginPath(),e.arc(0,0,s,0,2*Math.PI),void e.fill()):"flowers"===t?(e.beginPath(),e.moveTo(0,0),e.bezierCurveTo(s,-s,2*s,s,0,2*s),e.bezierCurveTo(2*-s,s,-s,-s,0,0),void e.fill()):void e.fillRect(-s/2,-s/2,s,s)}(e,n,i.size),e.restore()}),e.globalAlpha=1},li=["snow","flowers","confetti"];class CanvasAnimationController{constructor(e,t){this.raf=0,this.frameCount=0,this.mouse={x:-9999,y:-9999},this.particlesRef={current:[]},this.starsRef={current:[]},this.fallingRef={current:[]},this.tick=()=>{const e=this.canvas.getContext("2d");if(!e)return void(this.raf=requestAnimationFrame(this.tick));const t=window.devicePixelRatio||1,s=this.canvas.width/t,i=this.canvas.height/t,{type:n,colors:a,speed:r,particleCount:o,particleSize:l,starCount:d,starSize:u,clickable:b,wind:m,layerOpacity:p}=this.options;e.clearRect(0,0,s,i);const g=toSpeedRate(r),v=this.frameCount*g;switch(this.frameCount+=1,n){case"particles":((e,t,s,i,n)=>{const a=`${n.count}:${n.size}`;i.current.length===n.count&&i.spawnKey===a||(i.current=Array.from({length:n.count}).map(()=>({x:Math.random()*t,y:Math.random()*s,vx:1.5*(Math.random()-.5),vy:1.5*(Math.random()-.5),size:Math.random()*n.size+1,color:n.colors[Math.floor(Math.random()*n.colors.length)]})),i.spawnKey=a);const r=i.current,o=toSpeedRate(n.speed);r.forEach((i,a)=>{if(i.x+=i.vx*o,i.y+=i.vy*o,(i.x<0||i.x>t)&&(i.vx*=-1),(i.y<0||i.y>s)&&(i.vy*=-1),n.clickable){const e=n.mouse.x-i.x,t=n.mouse.y-i.y,s=Math.sqrt(e*e+t*t);if(s<150){const n=(150-s)/150;i.vx+=e/s*n*.5,i.vy+=t/s*n*.5}const a=3,r=Math.sqrt(i.vx*i.vx+i.vy*i.vy);r>a&&(i.vx=i.vx/r*a,i.vy=i.vy/r*a)}e.save(),e.globalAlpha=n.layerOpacity,e.beginPath(),e.arc(i.x,i.y,i.size,0,2*Math.PI),e.fillStyle=i.color,e.fill(),e.restore();for(let t=a+1;t<r.length;t++){const s=r[t],a=i.x-s.x,o=i.y-s.y,l=Math.sqrt(a*a+o*o);l<100&&(e.beginPath(),e.strokeStyle=i.color,e.globalAlpha=(1-l/100)*n.layerOpacity,e.lineWidth=.5,e.moveTo(i.x,i.y),e.lineTo(s.x,s.y),e.stroke(),e.globalAlpha=1)}})})(e,s,i,this.particlesRef,{count:o,colors:a,size:l,speed:r,mouse:this.mouse,clickable:b,layerOpacity:p});break;case"stars":((e,t,s,i,n)=>{const a=`${n.count}:${n.size}`;i.current.length===n.count&&i.spawnKey===a||(i.current=Array.from({length:n.count}).map(()=>({x:Math.random()*t,y:Math.random()*s,size:Math.random()*n.size,blinkSpeed:.05*Math.random()+.01,color:n.colors[Math.floor(Math.random()*n.colors.length)]})),i.spawnKey=a),i.current.forEach(t=>{t.y-=.05*n.speedRate,t.y<0&&(t.y=s);const i=(.5+.5*Math.sin(n.time*t.blinkSpeed))*n.layerOpacity;e.beginPath(),e.arc(t.x,t.y,t.size,0,2*Math.PI),e.fillStyle=t.color,e.globalAlpha=i,e.fill(),e.globalAlpha=1})})(e,s,i,this.starsRef,{count:d,colors:a,size:u,time:v,layerOpacity:p,speedRate:g});break;case"snow":case"flowers":case"confetti":(function isFallingType(e){return li.includes(e)})(n)&&drawFallingParticles(e,s,i,this.fallingRef,n,{count:o,colors:a,size:l,speed:r,wind:m,layerOpacity:p})}this.raf=requestAnimationFrame(this.tick)},this.container=e,this.options=t,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__canvas",e.appendChild(this.canvas),this.onResize=()=>this.resize(),this.onMouseMove=e=>{if("particles"!==this.options.type)return;const t=this.container.getBoundingClientRect();this.mouse={x:e.clientX-t.left,y:e.clientY-t.top}},this.onMouseLeave=()=>{this.mouse={x:-9999,y:-9999}},e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("mouseleave",this.onMouseLeave),window.addEventListener("resize",this.onResize),this.particlesRef.current=[],this.starsRef.current=[],this.fallingRef.current=[],this.frameCount=0,this.resize(),this.tick()}updateOptions(e){this.options={...this.options,...e}}destroy(){cancelAnimationFrame(this.raf),this.container.removeEventListener("mousemove",this.onMouseMove),this.container.removeEventListener("mouseleave",this.onMouseLeave),window.removeEventListener("resize",this.onResize),this.canvas.remove()}resize(){const e=window.devicePixelRatio||1,t=this.container.getBoundingClientRect();this.canvas.width=t.width*e,this.canvas.height=t.height*e,this.canvas.style.width=`${t.width}px`,this.canvas.style.height=`${t.height}px`;const s=this.canvas.getContext("2d");s&&s.setTransform(e,0,0,e,0,0)}}function loadShader$1(e,t,s){const i=e.createShader(t);return i?(e.shaderSource(i,s),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(e.deleteShader(i),null)):null}class ShaderAnimationController{constructor(e,t){this.raf=0,this.startTime=performance.now(),this.render=()=>{const e=this.gl,t=this.program,s=this.positionBuffer;if(!e||!t||!s)return;const{colors:i,speed:n,blur:a,noise:r,zoom:o,variant:l}=this.options,{width:d,height:u}=this.resizeCanvas();if(0===d||0===u)return void(this.raf=requestAnimationFrame(this.render));e.viewport(0,0,d,u),e.useProgram(t);const b=e.getAttribLocation(t,"aVertexPosition"),m=e.getUniformLocation(t,"uResolution"),p=e.getUniformLocation(t,"uTime"),g=e.getUniformLocation(t,"uColors"),v=e.getUniformLocation(t,"uSpeed"),E=e.getUniformLocation(t,"uSoftness"),f=e.getUniformLocation(t,"uNoiseStrength"),w=e.getUniformLocation(t,"uZoom");e.enableVertexAttribArray(b),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(b,2,e.FLOAT,!1,0,0),e.uniform2f(m,d,u);const y=padColors(i),A=toLuminaSpeed(n),_=function toLuminaSoftness(e){return Math.min(1,e/200)}(a),C=.6*A,x=function clampZoom(e){return Math.min(4,Math.max(.25,e))}(o),k=(performance.now()-this.startTime)/1e3;"mesh-flow"===l?(p&&e.uniform1f(p,k),v&&e.uniform1f(v,C),E&&e.uniform1f(E,_),w&&e.uniform1f(w,x)):(p&&e.uniform1f(p,k*A),E&&e.uniform1f(E,_),f&&e.uniform1f(f,r),w&&e.uniform1f(w,x));const S=new Float32Array(15);for(let e=0;e<5;e++){const t=hexToRgb(y[e]);S[3*e]=t[0],S[3*e+1]=t[1],S[3*e+2]=t[2]}g&&e.uniform3fv(g,S),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.raf=requestAnimationFrame(this.render)},this.container=e,this.options=t,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__shader-canvas",e.appendChild(this.canvas),this.init()}updateOptions(e){this.options={...this.options,...e}}resizeCanvas(){const e=this.container.getBoundingClientRect(),t=window.devicePixelRatio||1;return this.canvas.width=Math.max(1,e.width*t),this.canvas.height=Math.max(1,e.height*t),this.canvas.style.width=`${e.width}px`,this.canvas.style.height=`${e.height}px`,{width:this.canvas.width,height:this.canvas.height}}init(){const e=this.canvas.getContext("webgl");if(!e)return;this.gl=e;const{variant:t}=this.options,s=function getLuminaFragmentShader(e){switch(e){case"mesh-flow":return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uSpeed;\n uniform float uSoftness;\n uniform float uZoom;\n void main() {\n vec2 uv = gl_FragCoord.xy / uResolution.xy;\n float aspect = uResolution.x / uResolution.y;\n vec2 p = (uv - 0.5) / max(0.25, uZoom) + 0.5;\n p.x *= aspect;\n float t = uTime * uSpeed * 0.1;\n vec3 col = mix(uColors[0], uColors[4], uv.y * 0.6 + 0.2);\n for(int i = 1; i < 4; i++) {\n float fi = float(i);\n float offset = fi * 4.0;\n vec2 q = p;\n q.x += sin(q.y * 1.5 + t + offset) * 0.2;\n q.y += cos(q.x * 0.8 - t + offset) * 0.1;\n float waveCenterY = 0.5 + 0.3 * sin(q.x * 1.0 + t * 0.8 + offset);\n float thickness = 0.15 + 0.15 * sin(q.x * 2.5 + t * 1.2 + offset);\n float w = thickness * (1.0 + uSoftness * 3.0);\n float dist = abs(q.y - waveCenterY);\n float blurAmount = 0.1 + uSoftness * 0.4;\n float intensity = smoothstep(w + blurAmount, w - blurAmount, dist);\n intensity *= 0.7;\n vec3 bandColor = uColors[i];\n bandColor = mix(bandColor, uColors[i+1], sin(p.x + t)*0.2 + 0.2);\n col = mix(col, bandColor, intensity);\n }\n float noise = fract(sin(dot(gl_FragCoord.xy, vec2(12.9898, 78.233))) * 43758.5453);\n col += (noise - 0.5) * 0.03;\n gl_FragColor = vec4(col, 1.0);\n }\n";case"radiant":return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uNoiseStrength;\n uniform float uSoftness;\n uniform float uZoom;\n float random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n }\n void main() {\n vec2 uv = gl_FragCoord.xy / uResolution.xy;\n float aspect = uResolution.x / uResolution.y;\n uv = (uv - 0.5) / max(0.25, uZoom) + 0.5;\n uv.x *= aspect;\n float t = uTime * 0.15;\n vec3 col = uColors[0];\n for(int i = 1; i < 5; i++) {\n float fi = float(i);\n vec2 pos = vec2(\n 0.5 * aspect + 0.4 * sin(t * (0.5 + fi * 0.2) + fi * 1.5),\n 0.5 + 0.4 * cos(t * (0.4 + fi * 0.15) + fi)\n );\n float d = length(uv - pos);\n float radius = 0.6 + uSoftness * 1.0;\n float intensity = smoothstep(radius, 0.0, d);\n col = mix(col, uColors[i], intensity * 0.7);\n }\n float grain = random(gl_FragCoord.xy + uTime);\n col += (grain - 0.5) * uNoiseStrength;\n gl_FragColor = vec4(col, 1.0);\n }\n";case"ethereal":return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uNoiseStrength;\n uniform float uSoftness;\n uniform float uZoom;\n float random (in vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))*43758.5453123);\n }\n float noise (in vec2 st) {\n vec2 i = floor(st);\n vec2 f = fract(st);\n vec2 u = f*f*(3.0-2.0*f);\n return mix( mix( random( i + vec2(0.0,0.0) ),\n random( i + vec2(1.0,0.0) ), u.x),\n mix( random( i + vec2(0.0,1.0) ),\n random( i + vec2(1.0,1.0) ), u.x), u.y);\n }\n #define OCTAVES 5\n float fbm (in vec2 st) {\n float value = 0.0;\n float amplitude = 0.5;\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * noise(st);\n st *= 2.0;\n amplitude *= 0.5;\n }\n return value;\n }\n void main() {\n vec2 uv = gl_FragCoord.xy/uResolution.xy;\n float aspect = uResolution.x/uResolution.y;\n uv = (uv - 0.5) / max(0.25, uZoom) + 0.5;\n uv.x *= aspect;\n float t = uTime * 0.8;\n float scale = 5.0 - uSoftness * 3.0;\n vec2 st = uv * scale;\n vec2 q = vec2(0.);\n q.x = fbm( st + 0.12*t );\n q.y = fbm( st + vec2(1.0) + 0.10*t );\n vec2 r = vec2(0.);\n r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.30*t );\n r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.26*t );\n float f = fbm(st + r);\n vec3 color = mix(uColors[0], uColors[1], clamp((f*f)*4.0,0.0,1.0));\n color = mix(color, uColors[2], clamp(length(q),0.0,1.0));\n color = mix(color, uColors[3], clamp(length(r.x),0.0,1.0));\n color = mix(color, uColors[4], clamp(r.y*r.y, 0.0, 1.0));\n float grain = random(gl_FragCoord.xy + uTime);\n color += (grain - 0.5) * uNoiseStrength;\n gl_FragColor = vec4(color,1.0);\n }\n";default:return"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform vec3 uColors[5];\n uniform float uNoiseStrength;\n uniform float uSoftness;\n uniform float uZoom;\n float random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n }\n void main() {\n vec2 uv = (gl_FragCoord.xy - 0.5 * uResolution.xy) / min(uResolution.y, uResolution.x);\n float t = uTime * 0.2;\n float scale = mix(1.8, 0.45, uSoftness) / max(0.25, uZoom);\n vec2 p = uv * scale;\n for(float i = 1.0; i <= 4.0; i++){\n p.x += 0.6 / i * sin(i * 3.0 * p.y + t);\n p.y += 0.6 / i * cos(i * 3.0 * p.x + t);\n }\n float w1 = 0.5 + 0.5 * sin(p.x + t);\n float w2 = 0.5 + 0.5 * sin(p.y + t * 0.8);\n float w3 = 0.5 + 0.5 * sin(p.x + p.y);\n vec3 col = uColors[0];\n col = mix(col, uColors[1], smoothstep(0.1, 0.9, w1));\n col = mix(col, uColors[2], smoothstep(0.1, 0.9, w2));\n col = mix(col, uColors[3], smoothstep(0.1, 0.9, w3));\n float w4 = w1 * w2 * w3;\n col = mix(col, uColors[4], w4);\n float grain = random(gl_FragCoord.xy + uTime);\n col += (grain - 0.5) * uNoiseStrength;\n gl_FragColor = vec4(col, 1.0);\n }\n"}}(t),i=e.createProgram();if(!i)return;const n=loadShader$1(e,e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main() {\n gl_Position = aVertexPosition;\n }\n"),a=loadShader$1(e,e.FRAGMENT_SHADER,s);if(!n||!a)return;if(e.attachShader(i,n),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return;this.program=i,this.vertexShader=n,this.fragmentShader=a;const r=e.createBuffer();r&&(this.positionBuffer=r,e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),this.observer=new ResizeObserver(()=>this.resizeCanvas()),this.observer.observe(this.container),this.startTime=performance.now(),this.render())}destroy(){cancelAnimationFrame(this.raf),this.observer?.disconnect();const e=this.gl;e&&this.program&&(this.vertexShader&&e.deleteShader(this.vertexShader),this.fragmentShader&&e.deleteShader(this.fragmentShader),this.positionBuffer&&e.deleteBuffer(this.positionBuffer),e.deleteProgram(this.program)),this.canvas.remove()}}const di=.05;function loadShader(e,t,s){const i=e.createShader(t);return i?(e.shaderSource(i,s),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(e.deleteShader(i),null)):null}function lerp(e,t,s){return e+(t-e)*s}function lerpRgb(e,t,s){return[lerp(e[0],t[0],s),lerp(e[1],t[1],s),lerp(e[2],t[2],s)]}class GraphiteShaderController{constructor(e,t){this.raf=0,this.startTime=performance.now(),this.current={shaderSpeed:0,shaderIntensity:0,grain:0,scale:0,warp:0,color1:[0,0,0],color2:[0,0,0],color3:[0,0,0]},this.render=()=>{const e=this.gl,t=this.program,s=this.positionBuffer;if(!e||!t||!s)return;this.tickLerp();const{width:i,height:n}=this.resizeCanvas();if(0===i||0===n)return void(this.raf=requestAnimationFrame(this.render));e.viewport(0,0,i,n),e.useProgram(t);const a=e.getAttribLocation(t,"aVertexPosition"),r=e.getUniformLocation(t,"uResolution"),o=e.getUniformLocation(t,"uTime"),l=e.getUniformLocation(t,"uSpeed"),d=e.getUniformLocation(t,"uIntensity"),u=e.getUniformLocation(t,"uGrain"),b=e.getUniformLocation(t,"uScale"),m=e.getUniformLocation(t,"uWarp"),p=e.getUniformLocation(t,"uColor1"),g=e.getUniformLocation(t,"uColor2"),v=e.getUniformLocation(t,"uColor3");e.enableVertexAttribArray(a),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0);const E=(performance.now()-this.startTime)/1e3;r&&e.uniform2f(r,i,n),o&&e.uniform1f(o,E),l&&e.uniform1f(l,this.current.shaderSpeed),d&&e.uniform1f(d,this.current.shaderIntensity),u&&e.uniform1f(u,this.current.grain),b&&e.uniform1f(b,this.current.scale),m&&e.uniform1f(m,this.current.warp),p&&e.uniform3fv(p,this.current.color1),g&&e.uniform3fv(g,this.current.color2),v&&e.uniform3fv(v,this.current.color3),e.drawArrays(e.TRIANGLE_STRIP,0,4),this.raf=requestAnimationFrame(this.render)},this.container=e,this.options=t,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__shader-canvas",e.appendChild(this.canvas),this.syncCurrentImmediate(t),this.init()}updateOptions(e){this.options={...this.options,...e}}syncCurrentImmediate(e){const[t,s,i]=this.resolveColors(e.colors);this.current={shaderSpeed:e.shaderSpeed,shaderIntensity:e.shaderIntensity,grain:e.grain,scale:e.scale,warp:e.warp,color1:hexToRgb(t),color2:hexToRgb(s),color3:hexToRgb(i)}}resolveColors(e){return[e[0]??"#000000",e[1]??"#333333",e[2]??"#b3b3b3"]}resizeCanvas(){const e=this.container.getBoundingClientRect(),t=window.devicePixelRatio||1;return this.canvas.width=Math.max(1,e.width*t),this.canvas.height=Math.max(1,e.height*t),this.canvas.style.width=`${e.width}px`,this.canvas.style.height=`${e.height}px`,{width:this.canvas.width,height:this.canvas.height}}init(){const e=this.canvas.getContext("webgl");if(!e)return;this.gl=e;const t=e.createProgram();if(!t)return;const s=loadShader(e,e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main() {\n gl_Position = aVertexPosition;\n }\n"),i=loadShader(e,e.FRAGMENT_SHADER,"\n precision highp float;\n uniform vec2 uResolution;\n uniform float uTime;\n uniform float uSpeed;\n uniform float uIntensity;\n uniform float uGrain;\n uniform float uScale;\n uniform float uWarp;\n uniform vec3 uColor1;\n uniform vec3 uColor2;\n uniform vec3 uColor3;\n\n vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}\n vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}\n vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}\n\n float cnoise(vec3 P){\n vec3 Pi0 = floor(P);\n vec3 Pi1 = Pi0 + vec3(1.0);\n Pi0 = mod(Pi0, 289.0);\n Pi1 = mod(Pi1, 289.0);\n vec3 Pf0 = fract(P);\n vec3 Pf1 = Pf0 - vec3(1.0);\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n\n vec4 gx0 = ixy0 / 7.0;\n vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\n vec4 gx1 = ixy1 / 7.0;\n vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\n vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n return 2.2 * n_xyz;\n }\n\n void main() {\n vec2 p = gl_FragCoord.xy / uResolution.xy;\n float base = p.x * 0.5 + p.y * 0.5;\n\n float n = cnoise(vec3(p * uScale, uTime * uSpeed)) * 0.5 + 0.5;\n float n2 = cnoise(vec3(p * (uScale * 1.5) - (n * uWarp), uTime * (uSpeed * 1.2))) * 0.5 + 0.5;\n\n float mask = (base * 0.2 + n * 0.5 + n2 * 0.3) * uIntensity;\n\n vec3 color = mix(uColor1, uColor2, smoothstep(0.1, 0.6, mask));\n color = mix(color, uColor3, smoothstep(0.5, 0.9, mask));\n\n float grain = fract(sin(dot(p + fract(uTime), vec2(12.9898, 78.233))) * 43758.5453);\n color += (grain - 0.5) * uGrain;\n\n gl_FragColor = vec4(color, 1.0);\n }\n");if(!s||!i)return;if(e.attachShader(t,s),e.attachShader(t,i),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS))return;this.program=t,this.vertexShader=s,this.fragmentShader=i;const n=e.createBuffer();n&&(this.positionBuffer=n,e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),this.observer=new ResizeObserver(()=>this.resizeCanvas()),this.observer.observe(this.container),this.startTime=performance.now(),this.render())}tickLerp(){const{colors:e,shaderSpeed:t,shaderIntensity:s,grain:i,scale:n,warp:a}=this.options,[r,o,l]=this.resolveColors(e),d=hexToRgb(r),u=hexToRgb(o),b=hexToRgb(l);this.current.shaderSpeed=lerp(this.current.shaderSpeed,t,di),this.current.shaderIntensity=lerp(this.current.shaderIntensity,s,di),this.current.grain=lerp(this.current.grain,i,di),this.current.scale=lerp(this.current.scale,n,di),this.current.warp=lerp(this.current.warp,a,di),this.current.color1=lerpRgb(this.current.color1,d,di),this.current.color2=lerpRgb(this.current.color2,u,di),this.current.color3=lerpRgb(this.current.color3,b,di)}destroy(){cancelAnimationFrame(this.raf),this.observer?.disconnect();const e=this.gl;e&&this.program&&(this.vertexShader&&e.deleteShader(this.vertexShader),this.fragmentShader&&e.deleteShader(this.fragmentShader),this.positionBuffer&&e.deleteBuffer(this.positionBuffer),e.deleteProgram(this.program)),this.canvas.remove()}}const ci="designbase-wc-animation-background",hi="graphite",ui=new Set(["particles","stars","snow","flowers","confetti","aurora","plasma","mesh-flow","fluid","radiant","ethereal","graphite"]);function parseColors(e,t){if(!e)return t;try{const s=JSON.parse(e);return Array.isArray(s)&&s.length?s:t}catch{return e.split(",").map(e=>e.trim()).filter(Boolean)}}function parseAnimationBackgroundConfig(e){const t=function normalizeAnimationType(e){return e&&"gradient"!==e&&ui.has(e)?e:hi}(e.getAttribute("type")),s="light"===e.getAttribute("theme")?"light":"dark",i=e.getAttribute("intensity")||"subtle",n=e.getAttribute("preset")||void 0,a=e.getAttribute("zoom"),r="graphite"===t;let o=Number(a||1);if(r&&null===a){o=getGraphitePreset(isGraphitePresetId(n)?n:"graphite").scale}return{type:t,theme:s,intensity:i,blur:Number(e.getAttribute("blur")||80),speed:Number(e.getAttribute("speed")||3e3),direction:e.getAttribute("direction")||"left",colors:parseColors(e.getAttribute("colors"),r?[...ii]:["#667eea","#764ba2","#f093fb"]),opacity:Number(e.getAttribute("opacity")||1),particleCount:Number(e.getAttribute("particle-count")||("particles"===t?15:50)),particleSize:Number(e.getAttribute("particle-size")||2),starCount:Number(e.getAttribute("star-count")||100),starSize:Number(e.getAttribute("star-size")||1.5),clickable:e.hasAttribute("clickable")&&"false"!==e.getAttribute("clickable"),wind:Number(e.getAttribute("wind")||.5),noise:Number(e.getAttribute("noise")??(r?.1:.05)),showVignette:!e.hasAttribute("show-vignette")||"false"!==e.getAttribute("show-vignette"),preset:n||(r?"graphite":void 0),zoom:o,shaderSpeed:Number(e.getAttribute("shader-speed")||.4),shaderIntensity:Number(e.getAttribute("shader-intensity")||1.2),warp:Number(e.getAttribute("warp")||1.4),disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")}}function resolveColors(e){const{type:t,preset:s,colors:i}=e;if("graphite"===t)return s&&isGraphitePresetId(s)?[...getGraphitePreset(s).colors]:i.length>=3?i.slice(0,3):[...ii];if(s&&!isGraphitePresetId(s))return function getLuminaPresetColors(e){const t=ti.find(t=>t.id===e);return t?.colors??ti[0].colors}(s);if("fluid"===t&&i.length<5)return Qs;if("snow"===t||"flowers"===t||"confetti"===t){const e=function getFallingParticleDefaults(e){switch(e){case"snow":default:return ai;case"flowers":return ri;case"confetti":return oi}}(t);return 3===i.length&&"#667eea"===i[0]&&"#764ba2"===i[1]?e:i}return i}function createMeshAuroraLayer(e,t,s,i,n){const a=document.createElement("div");a.className=`${ci}__aurora-mesh`;const r="subtle"===i?.3:"medium"===i?.6:.8,o=function toAnimationDurationSec(e,t=3,s=.75){const i=3e3*t/Math.max(500,e);return Math.max(s,i)}(t,5,1.25),l=e.length>=3?e:["#4f46e5","#ec4899","#06b6d4","#8b5cf6"],d="dark"===n?"screen":"multiply",u=`blur(${s}px)`,b=`${ci}__aurora-blob`,m=[{backgroundColor:l[0],top:"-10%",left:"-10%",animationDuration:`${o}s`,animationDelay:"0s"},{backgroundColor:l[1],top:"-10%",right:"-10%",animationDuration:1.2*o+"s",animationDelay:"2s"},{backgroundColor:l[2],bottom:"-20%",left:"20%",animationDuration:1.5*o+"s",animationDelay:"4s"}];l[3]&&m.push({backgroundColor:l[3],bottom:"-10%",right:"-10%",animationDuration:1.1*o+"s",animationDelay:"1s"}),m.forEach(e=>{const t=document.createElement("div");t.className=b,Object.assign(t.style,{filter:u,opacity:String(r),mixBlendMode:d,...e}),a.appendChild(t)});const p=document.createElement("div");return p.className=`${ci}__aurora-noise`,p.style.opacity="dark"===n?"0.03":"0.05",p.style.backgroundImage="url(\"data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E\")",a.appendChild(p),a}function createLuminaOverlays(e,t){const s=document.createDocumentFragment();if(e>0){const t=document.createElement("div");t.className=`${ci}__lumina-noise`,t.style.backgroundImage=`url("${ei}")`,t.style.opacity=String(e),s.appendChild(t)}if(t){const e=document.createElement("div");e.className=`${ci}__lumina-vignette`,s.appendChild(e)}return s}function mountAnimationLayers(e,t){const s=resolveColors(t);let i={};if(t.disabled)return i;switch(t.type){case"particles":case"stars":case"snow":case"flowers":case"confetti":{const n=document.createElement("div");n.className=`${ci}__canvas-layer`,e.appendChild(n);const a=new CanvasAnimationController(n,{type:t.type,colors:s,speed:t.speed,particleCount:t.particleCount,particleSize:t.particleSize,starCount:t.starCount,starSize:t.starSize,clickable:t.clickable,wind:t.wind,layerOpacity:t.opacity});i={destroy:()=>a.destroy(),update:e=>{const t=resolveColors(e);a.updateOptions({colors:t,speed:e.speed,particleCount:e.particleCount,particleSize:e.particleSize,starCount:e.starCount,starSize:e.starSize,clickable:e.clickable,wind:e.wind,layerOpacity:e.opacity})}};break}case"aurora":e.appendChild(createMeshAuroraLayer(s,t.speed,t.blur,t.intensity,t.theme));break;case"plasma":e.appendChild(function createPlasmaLayer(e,t,s){const i=document.createElement("div");i.className=`${ci}__plasma`;const n=Math.random().toString(36).slice(2,11),a=padColors(e),c=e=>a[e%a.length],r=60/toLuminaSpeed(t),o=document.createElement("style");o.textContent=`\n @keyframes designbase-wc-plasma-move-1-${n} {\n 0% { transform: translate(0, 0) rotate(0deg) scale(1); }\n 25% { transform: translate(10%, 10%) rotate(90deg) scale(1.2); }\n 50% { transform: translate(0, 20%) rotate(180deg) scale(1); }\n 75% { transform: translate(-10%, 10%) rotate(270deg) scale(0.9); }\n 100% { transform: translate(0, 0) rotate(360deg) scale(1); }\n }\n @keyframes designbase-wc-plasma-move-2-${n} {\n 0% { transform: translate(0, 0) rotate(0deg) scale(1.2); }\n 33% { transform: translate(-20%, 0) rotate(120deg) scale(1); }\n 66% { transform: translate(20%, -10%) rotate(240deg) scale(0.8); }\n 100% { transform: translate(0, 0) rotate(360deg) scale(1.2); }\n }\n @keyframes designbase-wc-plasma-move-3-${n} {\n 0% { transform: translate(0, 0) scale(0.8); }\n 50% { transform: translate(15%, -15%) scale(1.4); }\n 100% { transform: translate(0, 0) scale(0.8); }\n }\n @keyframes designbase-wc-plasma-rotate-${n} {\n 0% { transform: rotate(0deg) scale(1.5); }\n 50% { transform: rotate(180deg) scale(2.0); }\n 100% { transform: rotate(360deg) scale(1.5); }\n }`,i.appendChild(o);const l=document.createElement("div");return l.className=`${ci}__plasma-base`,l.style.backgroundColor=c(0),i.appendChild(l),[{top:"-10%",left:"-10%",width:"70%",height:"70%",background:`radial-gradient(circle, ${c(1)} 0%, transparent 70%)`,animation:`designbase-wc-plasma-move-1-${n} ${r}s infinite linear`},{bottom:"-20%",right:"-10%",width:"80%",height:"80%",background:`radial-gradient(circle, ${c(2)} 0%, transparent 70%)`,animation:`designbase-wc-plasma-move-2-${n} ${r}s infinite linear`},{top:"20%",left:"20%",width:"60%",height:"60%",background:`radial-gradient(circle, ${c(3)} 0%, transparent 70%)`,animation:`designbase-wc-plasma-rotate-${n} ${r}s infinite linear`,extraClass:`${ci}__plasma-blob--exclusion`},{top:"40%",right:"20%",width:"40%",height:"40%",background:c(4),animation:`designbase-wc-plasma-move-3-${n} ${r}s infinite ease-in-out`,extraClass:`${ci}__plasma-blob--accent`,filter:`blur(${s}px)`,opacity:"0.6"}].forEach(e=>{const t=document.createElement("div");t.className=`${ci}__plasma-blob${e.extraClass?` ${e.extraClass}`:""}`,Object.assign(t.style,{filter:e.filter||`blur(${s}px)`,opacity:e.opacity||"0.9",...e}),i.appendChild(t)}),i}(s,t.speed,t.blur)),e.appendChild(createLuminaOverlays(t.noise,t.showVignette));break;case"mesh-flow":case"fluid":case"radiant":case"ethereal":{const n=document.createElement("div");n.className=`${ci}__shader-layer`,e.appendChild(n);const a=new ShaderAnimationController(n,{variant:t.type,colors:s,speed:t.speed,blur:t.blur,noise:t.noise,zoom:t.zoom});e.appendChild(createLuminaOverlays(t.noise,t.showVignette)),i={destroy:()=>a.destroy(),update:e=>{const t=resolveColors(e);a.updateOptions({colors:t,speed:e.speed,blur:e.blur,noise:e.noise,zoom:e.zoom})}};break}case"graphite":{const n=document.createElement("div");n.className=`${ci}__shader-layer`,e.appendChild(n);const a=new GraphiteShaderController(n,{colors:s,shaderSpeed:t.shaderSpeed,shaderIntensity:t.shaderIntensity,grain:t.noise,scale:t.zoom,warp:t.warp});i={destroy:()=>a.destroy(),update:e=>{const t=resolveColors(e);a.updateOptions({colors:t,shaderSpeed:e.shaderSpeed,shaderIntensity:e.shaderIntensity,grain:e.noise,scale:e.zoom,warp:e.warp})}};break}}return i}function applyContainerStyles(e,t){const s=function isLuminaType(e){return Zs.includes(e)}(t.type),i="graphite"===t.type,n=s||i?"#000000":"dark"===t.theme?"var(--db-surface-base, #0f172a)":"var(--db-surface-base, #ffffff)";e.style.position="relative",e.style.overflow="hidden",e.style.backgroundColor=n}const bi=3e3,mi={speed:{attr:"speed",label:"Speed (×)",kind:"range",min:500,max:12e3,step:100,default:bi,display:{min:.2,max:4,step:.1,fixed:1,fromAttr:e=>{const t=Math.min(12e3,Math.max(500,e));return Math.round(t/bi*10)/10},toAttr:e=>{const t=Math.min(4,Math.max(.2,e));return Math.round(t*bi)}}},blur:{attr:"blur",label:"Blur",kind:"range",min:0,max:200,step:2,default:80},opacity:{attr:"opacity",label:"Opacity",kind:"range",min:0,max:1,step:.05,default:1,fixed:2},noise:{attr:"noise",label:"Noise",kind:"range",min:0,max:.4,step:.01,default:.05,fixed:2},zoom:{attr:"zoom",label:"Zoom",kind:"range",min:.5,max:3,step:.1,default:1,fixed:1},particleCount:{attr:"particle-count",label:"Particle Count",kind:"range",min:10,max:250,step:5,default:50},particleCountParticles:{attr:"particle-count",label:"Particle Count",kind:"range",min:10,max:250,step:5,default:15},particleSize:{attr:"particle-size",label:"Particle Size",kind:"range",min:1,max:10,step:.5,default:2,fixed:1},starCount:{attr:"star-count",label:"Star Count",kind:"range",min:20,max:500,step:10,default:100},starSize:{attr:"star-size",label:"Star Size",kind:"range",min:.5,max:6,step:.5,default:1.5,fixed:1},wind:{attr:"wind",label:"Wind",kind:"range",min:0,max:3,step:.1,default:.5,fixed:1},direction:{attr:"direction",label:"Direction",kind:"select",options:["left","right","up","down","diagonal","radial"],default:"left"},intensity:{attr:"intensity",label:"Intensity",kind:"select",options:["subtle","medium","vivid"],default:"subtle"},theme:{attr:"theme",label:"Theme",kind:"select",options:["dark","light"],default:"dark"},preset:{attr:"preset",label:"Preset",kind:"select",options:["(none)","neon_dream","sunset_bliss","deep_ocean","forest_mist","northern_lights","monochrome_fog","cotton_candy","cyber_glitch","golden_hour"],default:"(none)"},showVignette:{attr:"show-vignette",label:"Vignette",kind:"toggle",default:!0},shaderSpeed:{attr:"shader-speed",label:"Speed",kind:"range",min:0,max:3,step:.01,default:.4,fixed:2},shaderIntensity:{attr:"shader-intensity",label:"Intensity",kind:"range",min:.1,max:3,step:.01,default:1.2,fixed:2},grain:{attr:"noise",label:"Grain",kind:"range",min:0,max:.5,step:.01,default:.1,fixed:2},scale:{attr:"zoom",label:"Scale",kind:"range",min:.5,max:5,step:.1,default:1,fixed:1},warp:{attr:"warp",label:"Warp",kind:"range",min:0,max:2,step:.05,default:1.4,fixed:2},graphiteTheme:{attr:"preset",label:"Theme",kind:"select",options:[...ni],default:"graphite"}};function colors(e){return{attr:"colors",label:"Colors",kind:"colors",default:e}}const pi={particles:[mi.particleCountParticles,mi.particleSize,mi.speed,mi.opacity,colors(["#60a5fa","#a78bfa","#f472b6"])],stars:[mi.starCount,mi.starSize,mi.speed,mi.opacity,colors(["#ffffff","#e0e7ff","#c7d2fe"])],snow:[mi.particleCount,mi.particleSize,mi.speed,mi.wind,colors(["#ffffff","#f0f9ff","#e0f2fe"])],flowers:[mi.particleCount,mi.particleSize,mi.speed,mi.wind,colors(["#ffb7c5","#ff91a4","#f8c8dc","#ffc0cb"])],confetti:[mi.particleCount,mi.particleSize,mi.speed,mi.wind,colors(["#f44336","#e91e63","#9c27b0","#2196f3","#4caf50","#ffeb3b"])],aurora:[mi.intensity,mi.blur,mi.speed,mi.theme,colors(["#4f46e5","#ec4899","#06b6d4","#8b5cf6"])],plasma:[mi.speed,mi.blur,mi.noise,mi.showVignette,mi.preset,colors(["#7000FF","#FF00AA","#3300FF","#FFCC00","#00FFFF"])],"mesh-flow":[mi.speed,mi.blur,mi.noise,mi.zoom,colors(["#4f46e5","#ec4899","#06b6d4","#8b5cf6","#22d3ee"])],fluid:[mi.speed,mi.blur,mi.noise,mi.zoom,colors(["#001133","#0044FF","#00DDFF","#00FFAA","#000066"])],radiant:[mi.speed,mi.blur,mi.noise,mi.zoom,colors(["#FF4E50","#FC913A","#F9D423","#EDE574","#E1F5C4"])],ethereal:[mi.speed,mi.blur,mi.noise,mi.zoom,colors(["#7000FF","#FF00AA","#00FFFF","#FFFFFF","#3300FF"])],graphite:[mi.shaderSpeed,mi.shaderIntensity,mi.grain,mi.scale,mi.warp,mi.graphiteTheme,colors(["#000000","#333333","#b3b3b3"])]};function getControlsForType(e){return pi[e]??pi.graphite}function writeControlAttribute(e,t,s){"colors"!==t.kind?"toggle"!==t.kind?"select"!==t.kind?e.setAttribute(t.attr,String(s)):"(none)"===s?e.removeAttribute(t.attr):e.setAttribute(t.attr,String(s)):e.setAttribute(t.attr,s?"true":"false"):e.setAttribute(t.attr,JSON.stringify(s))}const gi=ci,vi=["particles","stars","snow","flowers","confetti","mesh-flow","fluid","radiant","ethereal","graphite"],Ei=["mesh-flow","fluid","radiant","ethereal"];class DbAnimationBackground extends HTMLElement{constructor(){super(...arguments),this.panelOpen=!1,this.controlInputs=new Map,this.syncingControls=!1}static get observedAttributes(){return["type","theme","intensity","blur","speed","direction","colors","width","height","border-radius","opacity","blend-mode","particle-count","particle-size","star-count","star-size","wind","clickable","disabled","noise","show-vignette","preset","zoom","show-controls","shader-speed","shader-intensity","warp"]}connectedCallback(){this.style.display="block",this.render()}disconnectedCallback(){this.teardownLayers(),this.clickHandler&&(this.removeEventListener("click",this.clickHandler),this.clickHandler=void 0)}attributeChangedCallback(e,t,s){this.isConnected&&t!==s&&("show-controls"!==e?this.syncingControls||("type"===e&&this.getBool("show-controls",!1)&&this.rebuildControlInputs(),this.applyConfig(),this.getBool("show-controls",!1)&&this.syncControlInputs()):this.syncControlsVisibility())}getBool(e,t=!1){return this.hasAttribute(e)?"false"!==this.getAttribute(e):t}getSizeStyle(e){if(!e)return;const t=Number(e);return Number.isFinite(t)?`${t}px`:e}getConfig(){return parseAnimationBackgroundConfig(this)}teardownLayers(){this.layerHandle?.destroy?.(),this.layerHandle=void 0,this.mountedType=void 0,this.layersEl&&this.layersEl.replaceChildren()}remountLayers(e){this.layersEl&&(this.teardownLayers(),this.layerHandle=mountAnimationLayers(this.layersEl,e),this.mountedType=e.type)}canLiveUpdate(e){return this.mountedType===e.type&&vi.includes(e.type)&&"function"==typeof this.layerHandle?.update}applyConfig(){const e=this.getConfig();this.className=[gi,`${gi}--${e.type}`,e.clickable&&!e.disabled&&`${gi}--clickable`,e.disabled&&`${gi}--disabled`,this.getBool("show-controls",!1)&&`${gi}--show-controls`].filter(Boolean).join(" "),applyContainerStyles(this,e);const t=this.getSizeStyle(this.getAttribute("width")),s=this.getSizeStyle(this.getAttribute("height")),i=this.getSizeStyle(this.getAttribute("border-radius"));t&&(this.style.width=t),s&&(this.style.height=s),i&&(this.style.borderRadius=i),this.style.opacity="",this.layersEl&&(this.layersEl.style.opacity=String(e.opacity));const n=this.getAttribute("blend-mode");if(n&&(this.style.mixBlendMode=n),e.disabled)return this.teardownLayers(),void this.syncClickable(e);this.canLiveUpdate(e)?(this.layerHandle?.update?.(e),this.layersEl&&Ei.includes(e.type)&&function syncLuminaOverlays(e,t,s){let i=e.querySelector(`.${ci}__lumina-noise`),n=e.querySelector(`.${ci}__lumina-vignette`);t>0?(i||(i=document.createElement("div"),i.className=`${ci}__lumina-noise`,i.style.backgroundImage=`url("${ei}")`,i.style.mixBlendMode="overlay",e.appendChild(i)),i.style.opacity=String(t)):i?.remove(),s?n||(n=document.createElement("div"),n.className=`${ci}__lumina-vignette`,e.appendChild(n)):n?.remove()}(this.layersEl,e.noise,e.showVignette)):this.remountLayers(e),this.syncClickable(e)}syncClickable(e){this.clickHandler&&(this.removeEventListener("click",this.clickHandler),this.clickHandler=void 0),e.clickable&&!e.disabled&&(this.clickHandler=()=>{this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.addEventListener("click",this.clickHandler))}render(){if(!this.layersEl){this.layersEl=document.createElement("div"),this.layersEl.className=`${gi}__layers`,Object.assign(this.layersEl.style,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"0"}),this.contentEl=document.createElement("div"),this.contentEl.className=`${gi}__content`,Object.assign(this.contentEl.style,{position:"relative",zIndex:"10",width:"100%",height:"100%"});const e=document.createElement("slot");this.contentEl.appendChild(e),this.append(this.layersEl,this.contentEl)}this.ensureControlsShell(),this.applyConfig(),this.syncControlsVisibility()}ensureControlsShell(){if(this.controlsRootEl)return;const e=document.createElement("div");e.className=`${gi}__controls-root`,e.hidden=!0;const t=this.createIconButton("settings","컨트롤 열기",()=>{this.panelOpen=!this.panelOpen,this.syncPanelState()});t.setAttribute("variant","secondary"),t.className=`${gi}__controls-gear`;const s=document.createElement("div");s.className=`${gi}__controls-panel`,s.setAttribute("role","dialog"),s.hidden=!0,s.addEventListener("click",e=>e.stopPropagation());const i=document.createElement("div");i.className=`${gi}__controls-head`;const n=document.createElement("span");n.className=`${gi}__controls-title`,n.append(createDbIcon("settings",14),document.createTextNode(" Controls"));const a=this.createIconButton("refresh","기본값으로 초기화",()=>{const e=this.getConfig(),t=getControlsForType(e.type);if(this.syncingControls=!0,function resetControlsToDefaults(e,t){t.forEach(t=>{const s=t.default;"select"!==t.kind||s!==t.default?writeControlAttribute(e,t,Array.isArray(s)?[...s]:s):"(none)"===s?e.removeAttribute(t.attr):writeControlAttribute(e,t,s)})}(this,t),"graphite"===e.type){const e=getGraphitePreset("graphite");this.setAttribute("zoom",String(e.scale)),this.setAttribute("colors",JSON.stringify(e.colors))}this.syncingControls=!1,this.applyConfig(),this.syncControlInputs()});a.className=`${gi}__controls-icon-btn`,i.append(n,a),s.append(i),e.append(t,s),this.appendChild(e),this.controlsRootEl=e,this.panelEl=s}syncControlsVisibility(){if(!this.controlsRootEl)return;const e=this.getBool("show-controls",!1);this.controlsRootEl.hidden=!e,e?this.rebuildControlInputs():(this.panelOpen=!1,this.syncPanelState())}syncPanelState(){if(!this.controlsRootEl||!this.panelEl)return;const e=this.controlsRootEl.querySelector(`.${gi}__controls-gear`);e&&(e.dataset.open=this.panelOpen?"true":"false",e.setAttribute("aria-expanded",this.panelOpen?"true":"false")),this.panelEl.hidden=!this.panelOpen}createIconButton(e,t,s){const i=document.createElement("db-button");return i.setAttribute("variant","tertiary"),i.setAttribute("size","s"),i.setAttribute("icon-only",""),i.setAttribute("start-icon",e),i.setAttribute("aria-label",t),i.addEventListener("click",e=>{e.stopPropagation(),s()}),i}rebuildControlInputs(){if(!this.panelEl)return;this.panelEl.querySelectorAll(`.${gi}__controls-field`).forEach(e=>e.remove()),this.controlInputs.clear();const e=this.getConfig(),t=getControlsForType(e.type),s=this.panelEl.querySelector(`.${gi}__controls-title`);s&&(s.lastChild?.remove(),s.append(document.createTextNode(` ${e.type}`))),t.forEach(e=>{const t=this.createControlField(e);this.panelEl?.appendChild(t)}),this.syncControlInputs()}createControlField(e){const t=document.createElement("div");if(t.className=`${gi}__controls-field`,t.dataset.attr=e.attr,"range"===e.kind){const s=function getControlSliderBounds(e){return e.display?{min:e.display.min,max:e.display.max,step:e.display.step,fixed:e.display.fixed}:{min:e.min??0,max:e.max??100,step:e.step??1,fixed:e.fixed}}(e),i=document.createElement("db-range-slider");return i.className=`${gi}__controls-range`,i.setAttribute("size","s"),i.setAttribute("full-width",""),i.setAttribute("show-label",""),i.setAttribute("label",e.label),i.setAttribute("show-value",""),i.setAttribute("value-position","top"),i.setAttribute("show-thumb-tooltip",""),i.setAttribute("min",String(s.min)),i.setAttribute("max",String(s.max)),i.setAttribute("step",String(s.step)),null!=s.fixed&&i.setAttribute("value-fixed",String(s.fixed)),i.addEventListener("db-change",t=>{const s=t.detail;null!=s.value&&this.commitControlValue(e,function controlSliderToAttr(e,t){return e.display?e.display.toAttr(t):t}(e,s.value))}),t.appendChild(i),this.controlInputs.set(e.attr,i),t}if("select"===e.kind){const s=document.createElement("div");s.className=`${gi}__controls-label`,s.textContent=e.label;const i=e.options??[];if(i.length>4){const n=document.createElement("db-select");n.className=`${gi}__controls-select`,n.setAttribute("size","s"),n.setAttribute("full-width",""),n.setAttribute("options",JSON.stringify(i.map(e=>({value:e,label:e})))),n.addEventListener("db-change",t=>{const s=t.detail;null!=s.value&&this.commitControlValue(e,s.value)}),t.append(s,n),this.controlInputs.set(e.attr,n)}else{const n=document.createElement("db-segment-control");n.className=`${gi}__controls-seg`,n.setAttribute("size","s"),n.setAttribute("full-width",""),n.setAttribute("options",JSON.stringify(i.map(e=>({value:e,label:e})))),n.addEventListener("db-change",t=>{const s=t.detail;null!=s.value&&this.commitControlValue(e,s.value)}),t.append(s,n),this.controlInputs.set(e.attr,n)}return t}if("toggle"===e.kind){const s=document.createElement("div");s.className=`${gi}__controls-toggle`;const i=document.createElement("span");i.textContent=e.label;const n=document.createElement("db-toggle");return n.setAttribute("size","s"),n.addEventListener("db-change",t=>{const s=t.detail;this.commitControlValue(e,Boolean(s.checked))}),s.append(i,n),t.appendChild(s),this.controlInputs.set(e.attr,n),t}const s=document.createElement("div");s.className=`${gi}__controls-label`,s.textContent=e.label;const i=document.createElement("div");return i.className=`${gi}__controls-colors`,t.append(s,i),this.controlInputs.set(e.attr,i),t}commitControlValue(e,t){if(this.syncingControls=!0,writeControlAttribute(this,e,t),"preset"===e.attr&&"graphite"===this.getConfig().type&&"string"==typeof t&&isGraphitePresetId(t)){const e=getGraphitePreset(t);this.setAttribute("zoom",String(e.scale)),this.setAttribute("colors",JSON.stringify(e.colors))}this.syncingControls=!1,this.applyConfig()}syncControlInputs(){getControlsForType(this.getConfig().type).forEach(e=>{const t=function readControlValue(e,t){const s=e.getAttribute(t.attr);if("colors"===t.kind){if(!s)return[...t.default];try{const e=JSON.parse(s);return Array.isArray(e)&&e.length?[...e]:[...t.default]}catch{const e=s.split(",").map(e=>e.trim()).filter(Boolean);return e.length?e:[...t.default]}}if("toggle"===t.kind)return null===s?t.default:"false"!==s;if("select"===t.kind)return s||t.default;if(null===s||""===s)return t.default;const i=Number(s);return Number.isFinite(i)?i:t.default}(this,e),s=this.controlInputs.get(e.attr);if(s)if("range"===e.kind&&function isRangeSlider(e){return"DB-RANGE-SLIDER"===e.tagName}(s)){const i=Number(t);s.setAttribute("value",String(function controlAttrToSlider(e,t){return e.display?e.display.fromAttr(t):t}(e,i)))}else if("select"===e.kind)s.setAttribute("value",String(t));else if("toggle"===e.kind){Boolean(t)?s.setAttribute("checked",""):s.removeAttribute("checked")}else"colors"===e.kind&&this.renderColorInputs(s,e,t)})}renderColorInputs(e,t,s){const i=[...s];e.replaceChildren();const commitStructuralChange=s=>{this.commitControlValue(t,s),this.renderColorInputs(e,t,s)};if(i.forEach((s,n)=>{const a=document.createElement("div");a.className=`${gi}__controls-color`;const r=document.createElement("db-color-picker");if(r.className=`${gi}__controls-color-picker`,r.setAttribute("size","s"),r.setAttribute("full-width",""),r.setAttribute("show-alpha","false"),r.setAttribute("show-eyedropper","false"),r.setAttribute("value",s),r.addEventListener("db-change",e=>{const s=e.detail,a=s?.value;"string"==typeof a&&a&&(i[n]=a,this.commitControlValue(t,[...i]))}),a.appendChild(r),i.length>1){const e=this.createIconButton("trash","색상 제거",()=>{commitStructuralChange(i.filter((e,t)=>t!==n))});e.className=`${gi}__controls-color-remove`,a.appendChild(e)}e.appendChild(a)}),i.length<8){const t=this.createIconButton("plus","색상 추가",()=>{commitStructuralChange([...i,i[i.length-1]??"#ffffff"])});t.className=`${gi}__controls-color-add`,e.appendChild(t)}}}customElements.get("db-animation-background")||customElements.define("db-animation-background",DbAnimationBackground);const fi="designbase-wc-grid-background";class DbGridBackground extends HTMLElement{constructor(){super(...arguments),this.lastTime=0,this.lastPointerMove=0,this.bandAngle=Math.random()*Math.PI*2,this.pointer={x:0,y:0,strength:0,inside:!1},this.cssW=0,this.cssH=0,this.tracePulses=[],this.traceSpawnAccumulator=0,this.onThemeMediaChange=()=>this.scheduleDraw(),this.onPointerMove=e=>this.handlePointerMove(e)}static get observedAttributes(){return["type","size","thickness","color","theme","opacity","fade","fade-size","background","overlay","interactive","interaction","interaction-color","interaction-radius","cross-size","cross-style","lines-layout","guide-inset","guide-edges","guide-x","guide-y","guide-span-x","guide-span-y","animated","animation-style","animation-speed","trace-length","trace-direction","width","height","border-radius"]}connectedCallback(){this.ensureCanvas(),this.applyHostStyles(),this.startObserving(),this.observeDocumentTheme(),this.bindPointer(),this.measure(),this.scheduleDraw()}disconnectedCallback(){this.ro?.disconnect(),this.ro=void 0,this.themeObserver?.disconnect(),this.themeObserver=void 0,window.removeEventListener("pointermove",this.onPointerMove),this.themeMedia?.removeEventListener("change",this.onThemeMediaChange),this.themeMedia=void 0,null!=this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=void 0}attributeChangedCallback(){this.isConnected&&(this.applyHostStyles(),this.bindPointer(),this.measure(),this.scheduleDraw())}getBool(e){return this.hasAttribute(e)&&"false"!==this.getAttribute(e)}getNumber(e,t){const s=this.getAttribute(e);if(null===s||""===s)return t;const i=Number(s);return Number.isFinite(i)?i:t}getSizeStyle(e){if(!e)return;const t=Number(e);return Number.isFinite(t)?`${t}px`:e}getColorProbe(){if(!this.colorProbe){const e=document.createElement("span");e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",width:"0",height:"0",overflow:"hidden",visibility:"hidden",pointerEvents:"none"}),this.appendChild(e),this.colorProbe=e}return this.colorProbe}resolveCssColor(e){if(!e.includes("var(")&&!e.startsWith("color-mix"))return e;const t=this.getColorProbe();t.style.color=e;const s=getComputedStyle(t).color;return s&&"rgba(0, 0, 0, 0)"!==s?s:e}isDarkContext(){const e=this.getAttribute("theme");if("dark"===e)return!0;if("light"===e)return!1;const t=document.documentElement,s=t.getAttribute("data-color-mode");if("dark"===s)return!0;if("light"===s)return!1;const i=t.getAttribute("data-theme");return"dark"===i||"light"!==i&&window.matchMedia("(prefers-color-scheme: dark)").matches}resolveThemeColor(e,t,s,i){if(e)return this.resolveCssColor(e);const n=this.getColorProbe(),a=this.isDarkContext();n.style.color=`var(${t}, ${a?i:s})`;const r=getComputedStyle(n).color;return r&&"rgba(0, 0, 0, 0)"!==r?r:a?i:s}effectiveOpacity(){const e=this.getAttribute("opacity");return null!==e&&""!==e?this.getNumber("opacity",.05):this.isDarkContext()?.1:.05}effectiveColor(){const e=this.getAttribute("color");return e?this.resolveCssColor(e):this.isDarkContext()?"#ffffff":"#000000"}effectiveInterColor(){const e=this.getAttribute("interaction-color");return e?this.resolveCssColor(e):this.effectiveColor()}traceDrawColor(e){return this.hasAttribute("interaction-color")?e.interColor:e.color}traceDrawOpacity(e){const t=e.opacity;return this.hasAttribute("interaction-color")?Math.min(1,t+.2):Math.min(1,3*t)}parseColorRgb(e){const t=this.resolveCssColor(e).match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:this.isDarkContext()?[255,255,255]:[0,0,0]}crossArm(e,t,s){return s>0?s<=1?e*s:s:Math.min(.32*e,8+1.5*t)}interactionMode(){const e=this.getAttribute("interaction");if("glow"===e||"magnet"===e||"rotate"===e||"none"===e)return e;if(!this.getBool("interactive"))return"none";const t=this.getAttribute("type")||"lines";return"dots"===t?"magnet":"cross"===t?"rotate":"glow"}animationStyle(){const e=this.getAttribute("animation-style")||"band";return"trace"===e||"both"===e?e:"band"}traceDirection(){const e=this.getAttribute("trace-direction")||"both";return"vertical"===e||"horizontal"===e?e:"both"}linesLayout(){const e=this.getAttribute("lines-layout")||"grid";return"frame"===e||"center"===e?e:"grid"}crossStyle(){return"line"===(this.getAttribute("cross-style")||"plus")?"line":"plus"}parseGuideEdges(e){const t=(e||"top,right,bottom,left").split(",").map(e=>e.trim().toLowerCase()).filter(Boolean);return new Set(t)}guideFraction(e,t){const s=this.getAttribute(e);if(null===s||""===s)return t;const i=Number(s);return Number.isFinite(i)?Math.min(1,Math.max(0,i)):t}isGridLines(e){return"lines"===e.type&&"grid"===e.linesLayout}isTraceableLines(e){return"lines"===e.type&&("grid"===e.linesLayout||"frame"===e.linesLayout)}get cfg(){return{type:this.getAttribute("type")||"lines",linesLayout:this.linesLayout(),crossStyle:this.crossStyle(),size:Math.max(4,this.getNumber("size",32)),thickness:Math.max(.5,this.getNumber("thickness",1)),color:this.effectiveColor(),opacity:this.effectiveOpacity(),fade:this.getAttribute("fade")||"none",fadeSize:this.getNumber("fade-size",.22),interaction:this.interactionMode(),interColor:this.effectiveInterColor(),interRadius:Math.max(20,this.getNumber("interaction-radius",130)),crossSize:this.getNumber("cross-size",0),guideInset:Math.max(0,this.getNumber("guide-inset",16)),guideEdges:this.parseGuideEdges(this.getAttribute("guide-edges")),guideX:this.guideFraction("guide-x",.5),guideY:this.guideFraction("guide-y",.5),guideSpanX:Math.max(0,this.getNumber("guide-span-x",0)),guideSpanY:Math.max(0,this.getNumber("guide-span-y",0)),animate:this.getBool("animated"),animSpeed:this.getNumber("animation-speed",1),animationStyle:this.animationStyle(),traceLength:this.getNumber("trace-length",0),traceDirection:this.traceDirection()}}ensureCanvas(){if(this.canvas)return;const e=document.createElement("canvas");Object.assign(e.style,{display:"block",width:"100%",height:"100%",pointerEvents:"none"}),this.appendChild(e),this.canvas=e,this.ctx=e.getContext("2d")??void 0,this.hlCanvas=document.createElement("canvas"),this.maskCanvas=document.createElement("canvas")}applyHostStyles(){const e=this.getBool("overlay");this.className=[fi,`${fi}--${this.getAttribute("type")||"lines"}`,e&&`${fi}--overlay`].filter(Boolean).join(" "),this.style.display="block",this.style.boxSizing="border-box",this.style.pointerEvents="none";const t=this.getAttribute("background");if(this.style.backgroundColor=t?this.resolveCssColor(t):"transparent",e)this.style.position="absolute",this.style.inset="0",this.style.width="100%",this.style.height="100%",this.style.zIndex||(this.style.zIndex="1");else{"absolute"!==this.style.position&&this.style.position||(this.style.position="relative");const e=this.getSizeStyle(this.getAttribute("width")),t=this.getSizeStyle(this.getAttribute("height"));e&&(this.style.width=e),t&&(this.style.height=t)}const s=this.getSizeStyle(this.getAttribute("border-radius"));this.style.borderRadius=s||"",this.canvas&&(this.canvas.style.borderRadius=s||"")}startObserving(){this.ro||(this.ro=new ResizeObserver(()=>{this.measure(),this.scheduleDraw()}),this.ro.observe(this))}observeDocumentTheme(){this.themeObserver||"undefined"!=typeof MutationObserver&&(this.themeObserver=new MutationObserver(()=>this.scheduleDraw()),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-color-mode","class"]}))}bindPointer(){window.removeEventListener("pointermove",this.onPointerMove),this.themeMedia?.removeEventListener("change",this.onThemeMediaChange),this.themeMedia||(this.themeMedia=window.matchMedia("(prefers-color-scheme: dark)")),this.themeMedia.addEventListener("change",this.onThemeMediaChange),"none"!==this.interactionMode()?window.addEventListener("pointermove",this.onPointerMove,{passive:!0}):(this.pointer.strength=0,this.pointer.inside=!1)}handlePointerMove(e){if(!this.canvas)return;const t=this.canvas.getBoundingClientRect(),s=e.clientX-t.left,i=e.clientY-t.top,n=this.cfg.interRadius,a=s>=-n&&s<=t.width+n&&i>=-n&&i<=t.height+n;this.pointer.x=s,this.pointer.y=i,this.pointer.inside=a,a&&(this.pointer.strength=1,this.lastPointerMove=performance.now(),this.ensureLoop())}measure(){if(!this.canvas||!this.ctx)return;const e=this.getBoundingClientRect(),t=Math.max(1,Math.round(e.width)),s=Math.max(1,Math.round(e.height));this.cssW=t,this.cssH=s,this.tracePulses=[],this.traceSpawnAccumulator=0;const i=Math.min(2,window.devicePixelRatio||1);[this.canvas,this.hlCanvas,this.maskCanvas].forEach(e=>{e&&(e.width=Math.round(t*i),e.height=Math.round(s*i))})}axis(e,t){const s=e/2,i=[],n=Math.ceil((0-s)/t),a=Math.floor((e-s)/t);for(let r=n;r<=a;r++){const n=s+r*t;n>.75&&n<e-.75&&i.push(n)}return i}scheduleDraw(){const e=this.cfg;this.drawFrame(performance.now(),0),e.animate||this.pointer.strength>.001?this.ensureLoop():null!=this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=void 0)}ensureLoop(){if(null!=this.rafId)return;this.lastTime=performance.now();const tick=e=>{const t=Math.min(.05,(e-this.lastTime)/1e3);this.lastTime=e,"none"!==this.interactionMode()?e-this.lastPointerMove>90&&(this.pointer.strength=Math.max(0,this.pointer.strength-2.2*t)):this.pointer.strength=0,this.drawFrame(e,t);this.cfg.animate||this.pointer.strength>.001?this.rafId=requestAnimationFrame(tick):(this.rafId=void 0,this.drawFrame(e,t))};this.rafId=requestAnimationFrame(tick)}drawFrame(e,t){const s=this.ctx;if(!s||!this.canvas)return;const{cssW:i,cssH:n}=this;if(i<=0||n<=0)return;const a=this.cfg,r=Math.min(2,window.devicePixelRatio||1),o=e/1e3;s.setTransform(r,0,0,r,0,0),s.clearRect(0,0,i,n),this.drawPattern(s,i,n,a,a.color,a.opacity,o),a.animate&&this.isTraceableLines(a)&&("trace"===a.animationStyle||"both"===a.animationStyle)&&this.drawTraceHighlight(s,i,n,a,t);if(("glow"===a.interaction&&this.pointer.strength>.001||a.animate&&"trace"!==a.animationStyle&&(this.isGridLines(a)||"diagonal"===a.type))&&this.hlCanvas&&this.maskCanvas){const e=this.hlCanvas.getContext("2d"),t=this.maskCanvas.getContext("2d");e&&t&&(e.setTransform(r,0,0,r,0,0),e.clearRect(0,0,i,n),this.drawPattern(e,i,n,a,a.interColor,Math.min(1,a.opacity+.4),o),this.buildEnergyMask(t,i,n,r,a,o),e.setTransform(1,0,0,1,0,0),e.globalCompositeOperation="destination-in",e.drawImage(this.maskCanvas,0,0),e.globalCompositeOperation="source-over",s.setTransform(1,0,0,1,0,0),s.globalCompositeOperation="lighter",s.drawImage(this.hlCanvas,0,0),s.globalCompositeOperation="source-over",s.setTransform(r,0,0,r,0,0))}this.applyFade(s,i,n,a)}easeInOutCubic(e){const t=Math.min(1,Math.max(0,e));return t<.5?4*t*t*t:1-(-2*t+2)**3/2}traceSegmentLength(e){return e.traceLength>0?e.traceLength:28}pulseHead(e,t){const s=this.easeInOutCubic(e.progress);return-e.length+s*(t+2*e.length)}updateTracePulses(e,t,s,i){const n=this.traceSegmentLength(s),a=Math.min(6,Math.max(2,Math.floor(e*t/(s.size*s.size*180)))),r=(.38+.52*Math.random())/Math.max(.25,s.animSpeed);for(this.traceSpawnAccumulator+=i;this.traceSpawnAccumulator>=r&&this.tracePulses.length<a&&(this.traceSpawnAccumulator-=r,this.spawnTracePulse(e,t,s,n),!(Math.random()>.45)););this.tracePulses=this.tracePulses.filter(e=>(e.progress+=i/e.duration,e.progress<.1?e.alpha=e.progress/.1:e.progress>.9?e.alpha=(1-e.progress)/.1:e.alpha=1,e.progress<1&&e.alpha>.02))}traceLinePositions(e,t,s){if("frame"===s.linesLayout){const i=Math.min(s.guideInset,e/2-1,t/2-1),n=s.guideEdges,a=[],r=[];return n.has("left")&&a.push(i),n.has("right")&&a.push(e-i),n.has("top")&&r.push(i),n.has("bottom")&&r.push(t-i),{xs:a,ys:r}}return{xs:this.axis(e,s.size),ys:this.axis(t,s.size)}}spawnTracePulse(e,t,s,i){const{xs:n,ys:a}=this.traceLinePositions(e,t,s),r="horizontal"!==s.traceDirection&&n.length>0,o="vertical"!==s.traceDirection&&a.length>0;if(!r&&!o)return;let l;l=r&&o?Math.random()<.5?"v":"h":r?"v":"h";const d=i,u=(("v"===l?t:e)+2*d)/(88*Math.max(.25,s.animSpeed)),b={axis:l,linePos:"v"===l?n[Math.floor(Math.random()*n.length)]:a[Math.floor(Math.random()*a.length)],progress:0,length:d,duration:u,alpha:0};this.tracePulses.push(b)}drawTracePulseSegment(e,t,s,i,n){const[a,r,o]=this.parseColorRgb(this.traceDrawColor(n)),l=Math.min(1,this.traceDrawOpacity(n)*t.alpha),d="v"===t.axis?i:s,u=this.pulseHead(t,d);let b,m,p,g;if("v"===t.axis?(b=p=t.linePos,g=Math.min(i,u),m=Math.max(0,u-t.length)):(m=g=t.linePos,p=Math.min(s,u),b=Math.max(0,u-t.length)),Math.abs(p-b)<.5&&Math.abs(g-m)<.5)return;const v=e.createLinearGradient(b,m,p,g);v.addColorStop(0,`rgba(${a},${r},${o},0)`),v.addColorStop(.18,`rgba(${a},${r},${o},${.2*l})`),v.addColorStop(.5,`rgba(${a},${r},${o},${l})`),v.addColorStop(.82,`rgba(${a},${r},${o},${.2*l})`),v.addColorStop(1,`rgba(${a},${r},${o},0)`),e.save(),e.strokeStyle=v,e.lineCap="round",e.globalAlpha=t.alpha,e.shadowColor=`rgba(${a},${r},${o},${.9*l})`,e.shadowBlur=12+5*n.thickness,e.lineWidth=Math.max(1.1,n.thickness+.6),e.beginPath(),e.moveTo(b,m),e.lineTo(p,g),e.stroke(),e.shadowBlur=0,e.lineWidth=Math.max(.6,.35*n.thickness),e.globalAlpha=Math.min(1,1.1*t.alpha),e.stroke(),e.restore()}drawTraceHighlight(e,t,s,i,n){this.updateTracePulses(t,s,i,n),e.save(),e.globalCompositeOperation="lighter",this.tracePulses.forEach(n=>this.drawTracePulseSegment(e,n,t,s,i)),e.restore()}drawPattern(e,t,s,i,n,a,r){const{type:o,size:l,thickness:d}=i;if(e.save(),e.globalAlpha=a,e.strokeStyle=n,e.fillStyle=n,e.lineWidth=d,e.lineCap="round","lines"===o)"frame"===i.linesLayout?this.drawFrameGuides(e,t,s,i):"center"===i.linesLayout?this.drawCenterGuides(e,t,s,i):this.drawGridLines(e,t,s,i.size);else if("dots"===o){const n=this.axis(t,l),a=this.axis(s,l),o=Math.max(.75,d),u="magnet"===i.interaction&&this.pointer.strength>.001,b=this.pointer,m=i.interRadius;n.forEach((t,s)=>{a.forEach((n,a)=>{let d=t,p=n,g=o;if(u&&b.inside){const e=b.x-t,s=b.y-n,i=Math.hypot(e,s);if(i<m){const t=(1-i/m)*b.strength;g=o*(1+1.6*t),d+=e/(i||1)*t*l*.28,p+=s/(i||1)*t*l*.28}}if(i.animate){g*=.75+.25*Math.sin(2*r*i.animSpeed+.9*(s+a))}e.beginPath(),e.arc(d,p,g,0,2*Math.PI),e.fill()})})}else if("cross"===o){const n=this.axis(t,l),a=this.axis(s,l),r=this.crossArm(l,d,i.crossSize),o="rotate"===i.interaction&&this.pointer.strength>.001,u=this.pointer;n.forEach(t=>{a.forEach(s=>{if(e.save(),e.translate(t,s),o&&u.inside&&u.strength>.01){const i=u.x-t,n=u.y-s;e.rotate(Math.atan2(n,i))}e.beginPath(),"line"===i.crossStyle?(e.moveTo(-r,0),e.lineTo(r,0)):(e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,-r),e.lineTo(0,r)),e.stroke(),e.restore()})})}else{e.save(),e.beginPath(),e.rect(0,0,t,s),e.clip(),e.translate(t/2,s/2),e.rotate(Math.PI/4);const i=Math.hypot(t,s);e.beginPath();for(let t=-i;t<=i;t+=l)e.moveTo(t,-i),e.lineTo(t,i),e.moveTo(-i,t),e.lineTo(i,t);e.stroke(),e.restore()}e.restore()}drawGridLines(e,t,s,i){const n=this.axis(t,i),a=this.axis(s,i);e.beginPath(),n.forEach(t=>{e.moveTo(t,0),e.lineTo(t,s)}),a.forEach(s=>{e.moveTo(0,s),e.lineTo(t,s)}),e.stroke()}drawFrameGuides(e,t,s,i){const n=Math.min(i.guideInset,t/2-1,s/2-1),a=i.guideEdges;e.beginPath(),a.has("top")&&(e.moveTo(0,n),e.lineTo(t,n)),a.has("bottom")&&(e.moveTo(0,s-n),e.lineTo(t,s-n)),a.has("left")&&(e.moveTo(n,0),e.lineTo(n,s)),a.has("right")&&(e.moveTo(t-n,0),e.lineTo(t-n,s)),e.stroke()}drawCenterGuides(e,t,s,i){const n=t*i.guideX,a=s*i.guideY,r=i.guideSpanX>0?i.guideSpanX:t,o=i.guideSpanY>0?i.guideSpanY:s;e.beginPath(),e.moveTo(n-r/2,a),e.lineTo(n+r/2,a),e.moveTo(n,a-o/2),e.lineTo(n,a+o/2),e.stroke()}buildEnergyMask(e,t,s,i,n,a){if(e.setTransform(i,0,0,i,0,0),e.clearRect(0,0,t,s),e.globalCompositeOperation="lighter","glow"===n.interaction&&this.pointer.strength>.001&&this.pointer.inside){const i=n.interRadius,a=e.createRadialGradient(this.pointer.x,this.pointer.y,0,this.pointer.x,this.pointer.y,i);a.addColorStop(0,`rgba(255,255,255,${.9*this.pointer.strength})`),a.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=a,e.fillRect(0,0,t,s)}if(n.animate&&"trace"!==n.animationStyle){e.save(),e.translate(t/2,s/2),e.rotate(this.bandAngle);const i=Math.hypot(t,s),r=Math.max(60,.18*i),o=i+r,l=90*a*n.animSpeed%(2*o)-o,d=e.createLinearGradient(l-r,0,l+r,0);d.addColorStop(0,"rgba(255,255,255,0)"),d.addColorStop(.5,"rgba(255,255,255,0.55)"),d.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=d,e.fillRect(-i,-i,2*i,2*i),e.restore()}e.globalCompositeOperation="source-over"}applyFade(e,t,s,i){const n=i.fade;if("none"===n)return;const a=i.fadeSize,r=a>1?a:Math.max(8,t*a),o=a>1?a:Math.max(8,s*a);e.save(),e.globalCompositeOperation="destination-in";const edge=i=>{let n;"top"===i?(n=e.createLinearGradient(0,0,0,o),n.addColorStop(0,"rgba(0,0,0,0)"),n.addColorStop(1,"rgba(0,0,0,1)")):"bottom"===i?(n=e.createLinearGradient(0,s-o,0,s),n.addColorStop(0,"rgba(0,0,0,1)"),n.addColorStop(1,"rgba(0,0,0,0)")):"left"===i?(n=e.createLinearGradient(0,0,r,0),n.addColorStop(0,"rgba(0,0,0,0)"),n.addColorStop(1,"rgba(0,0,0,1)")):(n=e.createLinearGradient(t-r,0,t,0),n.addColorStop(0,"rgba(0,0,0,1)"),n.addColorStop(1,"rgba(0,0,0,0)")),e.fillStyle=n,e.fillRect(0,0,t,s)};if("vignette"===n){const i=e.createRadialGradient(t/2,s/2,.2*Math.min(t,s),t/2,s/2,Math.hypot(t,s)/2);i.addColorStop(0,"rgba(0,0,0,1)"),i.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=i,e.fillRect(0,0,t,s)}else{("top"===n?["top"]:"bottom"===n?["bottom"]:"left"===n?["left"]:"right"===n?["right"]:"vertical"===n?["top","bottom"]:"horizontal"===n?["left","right"]:["top","bottom","left","right"]).forEach(edge)}e.restore()}}customElements.get("db-grid-background")||customElements.define("db-grid-background",DbGridBackground);const wi="designbase-wc-cursor-follower",yi="designbase-wc-cursor-follower--hide-native";class DbCursorFollower extends HTMLElement{constructor(){super(...arguments),this.target={x:-9999,y:-9999},this.current={x:-9999,y:-9999},this.raf=0,this.enabled=!1,this.isScoped=!1}static get observedAttributes(){return["default-label","selector","smoothness","offset","hide-native-cursor","show-icon"]}connectedCallback(){this.style.display="contents",this.setupDesktopGate()}disconnectedCallback(){this.teardown()}attributeChangedCallback(){this.isConnected&&this.enabled&&this.mountLayer()}setupDesktopGate(){"undefined"!=typeof window&&(this.desktopMq=window.matchMedia("(pointer: fine) and (hover: hover) and (min-width: 769px)"),this.onDesktopChange=()=>{const e=this.desktopMq?.matches??!1;e!==this.enabled&&(this.enabled=e,e?this.mountLayer():this.teardownLayer())},this.onDesktopChange(),this.desktopMq.addEventListener("change",this.onDesktopChange))}updateScope(){this.isScoped=this.childElementCount>0||!!this.textContent?.trim()}isInScope(e){return!!e&&(!this.isScoped||this.contains(e))}mountLayer(){this.teardownLayer(),this.updateScope();const e=this.getAttribute("default-label")||"See the project",t=this.getAttribute("selector")||'a[href], button:not(:disabled), [role="button"]:not([aria-disabled="true"]), [data-cursor], [data-cursor-label], input[type="submit"], input[type="button"]',s=Math.min(1,Math.max(.05,Number(this.getAttribute("smoothness")||.14))),i=function parseOffset(e){if(!e)return{x:18,y:18};try{const t=JSON.parse(e);return{x:Number(t.x??18),y:Number(t.y??18)}}catch{const[t,s]=e.split(",").map(e=>Number(e.trim()));return{x:Number.isFinite(t)?t:18,y:Number.isFinite(s)?s:18}}}(this.getAttribute("offset")),n=this.hasAttribute("hide-native-cursor")&&"false"!==this.getAttribute("hide-native-cursor"),a=!this.hasAttribute("show-icon")||"false"!==this.getAttribute("show-icon");n&&document.documentElement.classList.add(yi),this.portalRoot=document.createElement("div"),this.portalRoot.className=wi,this.portalRoot.setAttribute("aria-hidden","true"),this.pillEl=document.createElement("div"),this.pillEl.className=`${wi}__pill`,this.labelEl=document.createElement("span"),this.labelEl.textContent=e,this.pillEl.appendChild(this.labelEl),a&&(this.iconEl=document.createElement("span"),this.iconEl.className=`${wi}__icon`,this.iconEl.appendChild(createDbIcon("arrow-right",14)),this.pillEl.appendChild(this.iconEl)),this.portalRoot.appendChild(this.pillEl),document.body.appendChild(this.portalRoot),this.onMouseMove=s=>{this.target={x:s.clientX+i.x,y:s.clientY+i.y};const n=document.elementFromPoint(s.clientX,s.clientY),a=n?.closest(t)??null;this.isInScope(a)&&a?(this.labelEl&&(this.labelEl.textContent=function getLabelFromElement(e,t){return e.getAttribute("data-cursor-label")||e.getAttribute("data-cursor")||e.getAttribute("aria-label")||t}(a,e)),this.pillEl?.classList.add(`${wi}__pill--visible`)):this.pillEl?.classList.remove(`${wi}__pill--visible`)},window.addEventListener("mousemove",this.onMouseMove,{passive:!0});const tick=()=>{this.current.x+=(this.target.x-this.current.x)*s,this.current.y+=(this.target.y-this.current.y)*s,this.portalRoot&&(this.portalRoot.style.transform=`translate3d(${this.current.x}px, ${this.current.y}px, 0)`),this.raf=requestAnimationFrame(tick)};this.raf=requestAnimationFrame(tick)}teardownLayer(){cancelAnimationFrame(this.raf),this.onMouseMove&&(window.removeEventListener("mousemove",this.onMouseMove),this.onMouseMove=void 0),document.documentElement.classList.remove(yi),this.portalRoot?.remove(),this.portalRoot=void 0,this.pillEl=void 0,this.labelEl=void 0,this.iconEl=void 0}teardown(){this.teardownLayer(),this.desktopMq&&this.onDesktopChange&&this.desktopMq.removeEventListener("change",this.onDesktopChange),this.isScoped=!1,this.enabled=!1}}customElements.get("db-cursor-follower")||customElements.define("db-cursor-follower",DbCursorFollower);const Ai="designbase-wc-lottie";class DbLottie extends HTMLElement{constructor(){super(...arguments),this.loadToken=0}static get observedAttributes(){return["src","animation-data","loop","autoplay","speed","width","height","renderer"]}connectedCallback(){this.style.display="inline-block",this.renderAnimation()}disconnectedCallback(){this.destroyAnimation(),this.container?.remove(),this.container=void 0}attributeChangedCallback(){this.isConnected&&this.renderAnimation()}getBool(e,t=!1){if(!this.hasAttribute(e))return t;const s=this.getAttribute(e);return""===s||"true"===s}getSizeStyle(e){if(!e)return;const t=Number(e);return Number.isFinite(t)?`${t}px`:e}destroyAnimation(){this.animation?.destroy(),this.animation=void 0}async renderAnimation(){const e=++this.loadToken;this.destroyAnimation(),this.container?this.container.replaceChildren():(this.container=document.createElement("div"),this.container.className=`${Ai}__container`,this.appendChild(this.container));const t=this.getSizeStyle(this.getAttribute("width")),s=this.getSizeStyle(this.getAttribute("height"));if(t&&(this.style.width=t),s&&(this.style.height=s),e!==this.loadToken||!this.container)return;const i=this.getBool("loop",!0),n=!this.hasAttribute("autoplay")||this.getBool("autoplay",!0),a=Number(this.getAttribute("speed")||1),r=this.getAttribute("renderer")||"svg";let o;const l=this.getAttribute("animation-data");if(l)try{o=JSON.parse(l)}catch{o=void 0}const d=this.getAttribute("src");if(!o&&!d){const e=document.createElement("div");return e.className=`${Ai}__fallback`,e.textContent="src 또는 animation-data 속성이 필요합니다.",void this.container.appendChild(e)}const u=await import("./chunks/lottie-3b3dac01.js").then(function(e){return e.l}),b=u.default??u;e===this.loadToken&&this.container&&(this.animation=b.loadAnimation({container:this.container,renderer:r,loop:i,autoplay:n,...o?{animationData:o}:{path:d}}),Number.isFinite(a)&&a>0&&this.animation.setSpeed(a))}}customElements.get("db-lottie")||customElements.define("db-lottie",DbLottie);const _i="designbase-wc-toast-container",Ci="top-right";let xi=0;function isBrowser$1(){return"undefined"!=typeof document}function showToast(e){const t=`db-toast-${xi+=1}`;if(!isBrowser$1())return{id:t,element:null,close:()=>{}};const{title:s,description:i,status:n="info",duration:a=5e3,position:r=Ci,showClose:o=!0,showProgress:l=!1}=e,d=function getContainer(e){const t=document.querySelector(`.${_i}[data-position="${e}"]`);if(t)return t;const s=document.createElement("div");return s.className=`${_i} ${_i}--${e}`,s.dataset.position=e,s.setAttribute("role","region"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-label","알림"),document.body.appendChild(s),s}(r),u=document.createElement("db-toast");return u.setAttribute("toast-id",t),u.setAttribute("status",n),u.setAttribute("title",s),i&&u.setAttribute("description",i),u.setAttribute("duration",String(a)),u.setAttribute("show-close",String(o)),l&&u.setAttribute("show-progress",""),u.setAttribute("auto-remove","true"),r.startsWith("bottom")?d.insertBefore(u,d.firstChild):d.appendChild(u),u.addEventListener("db-close",()=>window.requestAnimationFrame(()=>function cleanupContainer(e){0===e.childElementCount&&e.remove()}(d)),{once:!0}),{id:t,element:u,close:()=>u.close()}}function shortcut(e){return(t,s)=>showToast({...s,title:t,status:e})}const toast=e=>showToast(e);function confirm(e){if(!function isBrowser(){return"undefined"!=typeof document}())return Promise.resolve(!1);const{message:t,title:s,confirmText:i,cancelText:n,confirmVariant:a,variant:r,size:o,showIcon:l,initialFocus:d,closeOnEscape:u,closeOnBackdrop:b}=e,m=document.createElement("db-confirm");return m.setAttribute("message",t),s&&m.setAttribute("title",s),i&&m.setAttribute("confirm-text",i),n&&m.setAttribute("cancel-text",n),a&&m.setAttribute("confirm-variant",a),r&&m.setAttribute("variant",r),o&&m.setAttribute("size",o),!1===l&&m.setAttribute("show-icon","false"),d&&m.setAttribute("initial-focus",d),!1===u&&m.setAttribute("close-on-escape","false"),!1===b&&m.setAttribute("close-on-backdrop","false"),document.body.appendChild(m),new Promise(e=>{let t=!1;const finish=s=>{t||(t=!0,m.removeEventListener("db-confirm",onConfirm),m.removeEventListener("db-cancel",onCancel),m.remove(),e(s))},onConfirm=()=>finish(!0),onCancel=()=>finish(!1);m.addEventListener("db-confirm",onConfirm),m.addEventListener("db-cancel",onCancel),m.setAttribute("open","true")})}toast.show=showToast,toast.success=shortcut("success"),toast.error=shortcut("error"),toast.warning=shortcut("warning"),toast.info=shortcut("info"),toast.dismissAll=e=>{if(!isBrowser$1())return;const t=e?`.${_i}[data-position="${e}"] db-toast`:`.${_i} db-toast`;document.querySelectorAll(t).forEach(e=>e.close())};export{DbAccordion,DbAdBanner,DbAlert,DbAnimationBackground,DbAnimationText,DbAppBadge,DbAudioPlayer,DbAvatar,DbBackdrop,DbBadge,DbBanner,DbBottomNavigation,DbBottomSheet,DbBreadcrumbs,DbButton,DbCalendar,DbCard,DbCarousel,DbCheckbox,DbChip,DbCodeBlock,DbColorPicker,DbConfirm,DbContainer,DbContextMenu,DbCountdown,DbCursorFollower,DbDatePicker,DbDivider,DbDrawer,DbDropdown,DbDropzone,DbEmptyState,DbFileUploader,DbFloatingActionButton,DbFooter,DbForm,DbGantt,DbGradient,DbGrid,DbGridBackground,DbGridItem,DbImage,DbImageList,DbImagePlaceholder,DbIndicator,DbInput,DbKanban,DbLabel,DbLightbox,DbList,DbLogo,DbLottie,DbMarkdownEditor,DbMarquee,DbMasonry,DbMenuItem,DbModal,DbNavbar,DbOnboardingModal,DbPageHeader,DbPagination,DbPopover,DbProgress,DbProgressStep,DbProgressbar,DbRadio,DbRandomGradient,DbRangeSlider,DbRating,DbReorder,DbResizablePanels,DbScrollArea,DbSearchBar,DbSection,DbSectionAppDownload,DbSectionContact,DbSectionCta,DbSectionFaq,DbSectionFeature,DbSectionFeatureGrid,DbSectionHero,DbSectionLogoCloud,DbSectionPricing,DbSectionStats,DbSectionTestimonials,DbSegmentControl,DbSelect,DbShare,DbSidebar,DbSkeleton,DbSpinner,DbSplitView,DbStack,DbStat,DbStepper,DbTable,DbTabs,DbTestimonial,DbTextarea,DbTimePicker,DbTimeline,DbToast,DbToggle,DbToolbar,DbTooltip,DbTopBanner,DbTutorial,DbVideoPlayer,DbYouTubePlayer,confirm,confirm as dbConfirm,toast as dbToast,showToast,toast};
|