@designbasekorea/ui-wc 0.1.5 → 0.2.1

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.
@@ -1 +1 @@
1
- import e,{forwardRef as t,useRef as s,useMemo as i,useImperativeHandle as n,useEffect as a,createElement as r,useState as l,useCallback as o}from"react";const d={"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"/>',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(e){return Object.prototype.hasOwnProperty.call(d,e)}function getDbComponentIconSize(e){return"s"===e?12:"l"===e?20:16}function createDbIcon(e,t=16){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}">${d[e]}</svg>`,s.content.firstElementChild}const u=["disabled","loading","icon-only","full-width"],b=["primary","secondary","tertiary","danger","ghost"],p=["s","m","l"],m=["s","m","l","pill"];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","type","loading-text","start-icon","end-icon",...u]}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 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.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"))}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"),this.append(n)),n.replaceChildren(createDbIcon(t,s))):n?.remove()}getDefaultRadiusClass(){return m.includes(this.radius)?`designbase-wc-button--radius-${this.radius}`:"s"===this.size?"designbase-wc-button--radius-s":"l"===this.size?"designbase-wc-button--radius-l":"designbase-wc-button--radius-m"}syncRadius(){m.forEach(e=>this.classList.remove(`designbase-wc-button--radius-${e}`)),this.classList.add(this.getDefaultRadiusClass())}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?b:p).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 p.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 g={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 l=i*(n.shiftKey?10:n.altKey?.1:1);let o=e+Math.round(t/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,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 v=["text","email","password","url","search","tel","number"],E=["s","m","l"],f=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=>{const t=e.target;this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:t.value,nativeEvent:e},bubbles:!0,composed:!0}))},this.handleChange=e=>{const t=e.target;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){"value"===e&&this.isScrubbing||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&&f.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=v.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")||"",l=this.getAttribute("error-message")||"",o=this.hasAttribute("error"),d=this.resolveStartIcon(),u=this.resolveIconName("end-icon");this.classList.add("designbase-wc-input"),E.forEach(e=>this.classList.remove(`designbase-wc-input--${e}`)),this.classList.add(`designbase-wc-input--${E.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(d));const b=s&&e.length>0&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--with-end-icon",Boolean(u&&!i&&!s)||i||b),this.classList.toggle("designbase-wc-input--with-password-toggle",i),this.classList.toggle("designbase-wc-input--with-search-clear",b);const p=this.hasAttribute("scrubbable")&&"number"===t&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--scrubbable",p),this.classList.toggle("designbase-wc-input--scrubbing",this.isScrubbing);const m=this.getAttribute("id")||`db-input-${Math.random().toString(36).slice(2)}`;this.hasAttribute("id")||this.setAttribute("id",m);const g=`${m}-field`,f=`${m}-helper`,w=`${m}-error`,y=`${m}-validation`,A=this.getAttribute("min"),C=this.getAttribute("max"),_=this.getAttribute("step");this.innerHTML=`\n ${a?`<label class="designbase-wc-input__label" for="${g}">${this.escape(a)}${this.hasAttribute("required")?'<span aria-hidden="true"> *</span>':""}</label>`:""}\n <span class="designbase-wc-input__wrapper">\n ${d?'<span class="designbase-wc-input__start-icon" aria-hidden="true"></span>':""}\n <input\n id="${g}"\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!==C?`max="${this.escape(C)}"`:""}\n ${null!==_?`step="${this.escape(_)}"`:""}\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 ${!u||i||s?"":'<span class="designbase-wc-input__end-icon" aria-hidden="true"></span>'}\n </span>\n <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(d,!u||i||s?void 0:u,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,p&&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:g[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"),l=[n&&!r?t:"",this.shouldShowPasswordValidation(e)?i:"",r&&a?s:""].filter(Boolean).join(" ")||void 0;l?this.input.setAttribute("aria-describedby",l):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=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-input")||customElements.define("db-input",DbInput);const w=["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=w.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 y=["s","m","l"];class DbToggle extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleClick=()=>{if(this.disabled||this.readOnly)return;const e=!this.checked;this.toggleAttribute("checked",e),this.syncState(),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"]}get checked(){return this.hasAttribute("checked")||this.hasAttribute("selected")}set checked(e){this.toggleAttribute("checked",e),this.syncClasses()}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()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}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.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncClasses())}syncClasses(){if(!this.root)return;const e=y.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))}}customElements.get("db-toggle")||customElements.define("db-toggle",DbToggle);const A="designbase-wc-badge",C=["primary","secondary","info","success","warning","danger"],_=["s","m","l"],k=["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(A),this.setAttribute("aria-disabled",String(this.disabled)),this.syncEnum("variant",this.variant,C),this.syncEnum("size",this.size,_),this.syncEnum("style",this.badgeStyle,k),this.classList.toggle(`${A}--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(`${A}--${e}`)),s.includes(t)?this.classList.add(`${A}--${t}`):"style"===e&&this.classList.add(`${A}--text`)}}customElements.get("db-badge")||customElements.define("db-badge",DbBadge);const x={primary:"primary",secondary:"secondary",outline:"tertiary",ghost:"ghost"},S={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",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 e=document.createElement("div");e.className="designbase-wc-banner__background",e.style.backgroundImage=`url(${l})`,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),o.length>0){const e=document.createElement("div");e.className="designbase-wc-banner__actions",o.forEach((t,s)=>{const i=x[t.variant||"primary"]||"primary",n=S[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 N=["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--${N.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=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-spinner")||customElements.define("db-spinner",DbSpinner);const I=["default","flat"],D=["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")),I.forEach(e=>this.classList.remove(`designbase-wc-card--${e}`)),D.forEach(e=>this.classList.remove(`designbase-wc-card--${e}`)),this.classList.add(`designbase-wc-card--${I.includes(this.variant)?this.variant:"default"}`),this.classList.add(`designbase-wc-card--${D.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 L=["s","m","l"],M=["horizontal","vertical"],z=["default","pills"];class DbTabs extends HTMLElement{constructor(){super(...arguments),this.tabButtons=[],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 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)}disconnectedCallback(){this.list?.removeEventListener("scroll",this.handleListScroll),window.removeEventListener("resize",this.handleListScroll)}attributeChangedCallback(){this.isConnected&&this.render()}render(){const e=Array.from(this.children).filter(e=>e.hasAttribute("slot")),t=this.labels,s=this.tabItems,i=Math.min(Math.max(this.activeIndex,0),Math.max(t.length-1,0)),n=L.includes(this.size)?this.size:"m",a=M.includes(this.orientation)?this.orientation:"horizontal",r=z.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(" "),Array.from(this.children).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),l=t===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-${t}`),o.id=`tab-${t}`,o.tabIndex=l?0:-1,o.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)),o.append(e)}const d=document.createElement("span");d.className="designbase-wc-tabs__tab-label",d.textContent=e,o.append(d),o.addEventListener("click",()=>this.select(t)),o.addEventListener("keydown",e=>this.handleKeyDown(e,t)),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("slot");o.name=`panel-${i}`,this.panel.append(o),this.append(this.list,this.panel),e.forEach(e=>this.append(e)),requestAnimationFrame(()=>{this.handleListScroll(),l&&this.updateIndicator(!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 T=["s","m","l","xl","full"],B=["default","tabs","segment"],P=["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.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.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 T.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 B.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=P.includes(this.getAttribute("nav-size")||"s")&&this.getAttribute("nav-size")||"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();T.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)return;const e=this.open?"entered":"exiting";this.root.setAttribute("data-state",e),this.panel.setAttribute("data-state",e)}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 requestAnimationFrame(()=>this.syncVisibility());this.syncVisibility(),document.body.style.overflow="",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 F=["s","m","l"],O=["bottom-left","bottom-right","top-left","top-right"],H=["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 F.includes(this.size)?this.size:"m"}resolvedPlacement(){return O.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=H.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"),a.setAttribute("end-icon","chevron-down"),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)}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.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 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 l=document.createElement("span");l.className="designbase-wc-dropdown__item-label",l.textContent=i,r.append(l),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 V=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],R=["s","m","l"],W=["default","primary","success","warning","danger","info"],q=-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),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 V.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(){if(!this.tooltip||!this.arrow)return;const e=this.resolvedPosition(),t=R.includes(this.size)?this.size:"m",s=W.includes(this.variant)?this.variant:"default";this.tooltip.className=["designbase-wc-tooltip",`designbase-wc-tooltip--${t}`,`designbase-wc-tooltip--${s}`,`designbase-wc-tooltip--${e}`,(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--${e}`,this.arrow.hidden=!this.showArrow,this.tooltip.setAttribute("data-placement-group",this.groupOf(e)),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 e=this.resolvedPosition(),t=this.trigger.getBoundingClientRect(),s=this.tooltip.getBoundingClientRect();let i=0,n=0,a=0,r=0;switch(e){case"top":i=t.top-s.height-8,n=t.left+t.width/2-s.width/2,a=s.height-2,r=s.width/2-6;break;case"top-start":i=t.top-s.height-8,n=t.left,a=s.height-2,r=8;break;case"top-end":i=t.top-s.height-8,n=t.right-s.width,a=s.height-2,r=s.width-8-6;break;case"bottom":i=t.bottom+8,n=t.left+t.width/2-s.width/2,a=q,r=s.width/2-6;break;case"bottom-start":i=t.bottom+8,n=t.left,a=q,r=8;break;case"bottom-end":i=t.bottom+8,n=t.right-s.width,a=q,r=s.width-8-6;break;case"left":i=t.top+t.height/2-s.height/2,n=t.left-s.width-8,a=s.height/2-6,r=s.width-2;break;case"left-start":i=t.top,n=t.left-s.width-8,a=8,r=s.width-2;break;case"left-end":i=t.bottom-s.height,n=t.left-s.width-8,a=s.height-8-6,r=s.width-2;break;case"right":i=t.top+t.height/2-s.height/2,n=t.right+8,a=s.height/2-6,r=q;break;case"right-start":i=t.top,n=t.right+8,a=8,r=q;break;case"right-end":i=t.bottom-s.height,n=t.right+8,a=s.height-8-6,r=q}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(e);if("top"===d||"bottom"===d){const e=t.left+t.width/2-n-6;r=Math.min(s.width-8-6,Math.max(8,e))}else{const e=t.top+t.height/2-i-6;a=Math.min(s.height-8-6,Math.max(8,e))}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(e){if(!this.disabled||!e){if(this.visible=e,!e&&!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","style","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&&register(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("style")||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),l=this.isItemExpanded(s,i),o=document.createElement("div");o.className=["designbase-wc-accordion__item",`designbase-wc-accordion__item--${t}`,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 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 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",(e.get(i)||[]).forEach(e=>{e.removeAttribute("slot"),g.append(e)}),m.append(g),o.append(d,m),this.append(o)}),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 j=["xs","s","m","l","xl","2xl"],U=["default","primary","success","warning","danger","info"],K=["online","offline","away","busy"],J=["#E3F2FD","#F3E5F5","#E8F5E8","#FFF3E0","#FCE4EC","#E0F2F1","#FFF8E1","#F1F8E9","#E8EAF6","#FFEBEE"],G=["#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=j.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=U.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--${e}`,`designbase-wc-avatar--${t}`,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 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)%J.length;return{backgroundColor:J[s],color:G[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 o=this.getAttribute("status")||"";if(K.includes(o)){const e=document.createElement("span");e.className=`designbase-wc-avatar__status designbase-wc-avatar__status--${o}`,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 Y=["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&&Y.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&&!Y.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 X=["s","m","l"],Z=["default","success","warning","danger"],Q=["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{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(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=X.includes(s)?s:"m",l=Z.includes(i)?i:"default",o=Q.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(e)),this.setAttribute("aria-valuenow",String(this.value)),this.replaceChildren(),"circular"===n){const{svgSize:e,radius:s,strokeWidth:i,center:n}=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}}}(o,r),a=2*Math.PI*s,l=a-t/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(e)),u.setAttribute("height",String(e)),u.setAttribute("viewBox",`0 0 ${e} ${e}`),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 e=document.createElement("span");e.className="designbase-wc-progress__circular-value",e.textContent=`${Math.round(t)}%`,d.append(e)}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=`${t}%`,u.append(b),d.append(u),this.hasAttribute("show-value")){const e=document.createElement("span");e.className="designbase-wc-progress__value",e.textContent=`${Math.round(t)}%`,d.append(e)}this.append(d)}}customElements.get("db-progress")||customElements.define("db-progress",DbProgress);const ee=["s","m","l"];class DbSelect extends HTMLElement{constructor(){super(...arguments),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"]}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)}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(ee.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)return 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.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=ee.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")||"",l=this.hasAttribute("error"),o=this.getAttribute("id")||"";this.className=["designbase-wc-select",`designbase-wc-select--${e}`,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 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=`${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 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 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",e=>{e.stopPropagation();const s=t.filter(e=>e!==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=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 l=document.createElement("span");l.className="designbase-wc-select__option-label",l.textContent=e.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(e){return e.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-select")||customElements.define("db-select",DbSelect);const te=["s","m","l"];class DbTextarea extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleInput=e=>{this.field&&(this.updateCharacterCount(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:this.field.value,nativeEvent:e},bubbles:!0,composed:!0})))},this.handleChange=e=>{if(!this.field)return;const t=this.field.value;this.getAttribute("value")!==t&&this.setAttribute("value",t),this.updateCharacterCount(),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t,nativeEvent:e},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["label","placeholder","value","default-value","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=te.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.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 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=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-textarea")||customElements.define("db-textarea",DbTextarea);const se=["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.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(){if(this.visual&&this.input&&(this.visual.replaceChildren(),this.input.checked)){const e=document.createElement("span");e.className="designbase-wc-radio__dot",this.visual.appendChild(e)}}syncClasses(){if(!this.root||!this.input)return;const e=se.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"),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--${e}`,`designbase-wc-pagination--${t}`,`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 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&&!m&&f.append(this.createIconButton("arrow-bar-left",1,"첫 페이지로 이동","first")),a&&!m&&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",p,"마지막 페이지로 이동","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,l=a<s-t-1;if(!r&&l){const t=3+2*e;return[...Array.from({length:t},(e,t)=>t+1),"...",s]}if(r&&!l){const t=3+2*e;return[1,"...",...Array.from({length:t},(e,i)=>s-t+i+1)]}if(r&&l){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);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(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}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]}render(){const e=this.getAttribute("size")||"m",t=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--${e}`,`designbase-wc-breadcrumbs--${t}`,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((e,t)=>{const i=t===s.length-1,a=document.createElement("li");a.className="designbase-wc-breadcrumbs__item";const r=!e.href||i||e.disabled?document.createElement("span"):document.createElement("a");if(r.className=r 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",i&&"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)),r.append(t)}const l=document.createElement("span");if(l.className="designbase-wc-breadcrumbs__label",l.textContent=e.label,r.append(l),r instanceof HTMLAnchorElement&&(r.href=e.href||"#"),r.addEventListener("click",t=>{(e.disabled||e.active||i)&&t.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{detail:{item:e},bubbles:!0,composed:!0}))}),a.append(r),!i){const e=document.createElement("span");e.className="designbase-wc-breadcrumbs__separator",e.setAttribute("aria-hidden","true"),e.append(createDbIcon("chevron-right",16)),a.append(e)}n.append(a)}),this.append(n)}}customElements.get("db-breadcrumbs")||customElements.define("db-breadcrumbs",DbBreadcrumbs);const ie=["s","m","l"],ne=["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";return this.internalSortColumn===e.key&&Boolean(this.internalSortDirection)?t.classList.add("asc"===this.internalSortDirection?"designbase-wc-table__sort-icon--asc":"designbase-wc-table__sort-icon--desc"):t.classList.add("designbase-wc-table__sort-icon--idle"),t.append(createDbIcon("caret-updown-filled",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=ie.includes(e)?e:"m",i=ne.includes(t)?t:"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 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"),p=this.hasAttribute("show-count-badge");if(b||p){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(p){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 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((e,t)=>this.getRowKey(e,t)),w=f.filter(e=>this.internalSelectedRows.includes(e)),y=this.hasAttribute("clickable");if(o){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+(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"),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}))}),o){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),m.append(g),this.append(m),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 ae="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"),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=[ae,`${ae}--${e}`,`${ae}--${t}`,s&&`${ae}--with-icon`,i&&`${ae}--closable`,b&&`${ae}--text-single`,p.length>0&&`${ae}--has-actions`].filter(Boolean).join(" "),this.setAttribute("role","alert"),this.setAttribute("aria-live","polite"),this.querySelector(`.${ae}__content`)?.remove(),this.querySelector(`.${ae}__actions`)?.remove(),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.remove()});const m=document.createElement("div");if(m.className=`${ae}__content`,s){const s=document.createElement("div");s.className=`${ae}__icon`,s.append(createDbIcon(this.getIconName(e),"s"===t?16:"l"===t?24:20)),m.append(s)}const g=document.createElement("div");if(g.className=`${ae}__body`,u){const e=document.createElement("div");e.className=`${ae}__title`,e.textContent=n,g.append(e)}if(d){const e=document.createElement("div");e.className=`${ae}__message`,e.textContent=a,g.append(e)}if(m.append(g),p.length>0){const e=document.createElement("div");e.className=`${ae}__actions`;const s=document.createElement("div");s.className=`${ae}__action-buttons`,p.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),m.append(e)}if(i){const e=document.createElement("button");e.type="button",e.className=`${ae}__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}))}),m.append(e)}this.replaceChildren(m)}}customElements.get("db-alert")||customElements.define("db-alert",DbAlert);const le=["s","m","l"],oe=["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"),l=this.hasAttribute("clickable"),o=this.getAttribute("start-icon"),d=this.getAttribute("end-icon"),u=le.includes(t)?t:"m",b=oe.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 e=document.createElement("span");e.className="designbase-wc-chip__start-icon",e.append(createDbIcon(o,p)),this.append(e)}const m=document.createElement("span");if(m.className="designbase-wc-chip__label",m.textContent=e,this.append(m),d&&!n){const e=document.createElement("span");e.className="designbase-wc-chip__end-icon",e.append(createDbIcon(d,p)),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",p)),t.addEventListener("click",e=>{e.stopPropagation(),i||this.dispatchEvent(new CustomEvent("db-delete",{bubbles:!0,composed:!0}))}),this.append(t)}this.onclick=()=>{!i&&l&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.onkeydown=e=>{"Enter"!==e.key&&" "!==e.key||i||!l||(e.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})))}}}customElements.get("db-chip")||customElements.define("db-chip",DbChip);const de=["text","circular","rectangular","rounded"],ce=["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",l=this.getAttribute("last-line-width")||"60%",o=de.includes(e)?e:"text",d=ce.includes(t)?t:"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(e){switch(e){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 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(l)),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 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(e=>l.append(e)),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(),t)){const e=document.createElement("span");e.className="designbase-wc-label__required",e.textContent="*",l.append(e)}}}customElements.get("db-label")||customElements.define("db-label",DbLabel);const he={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:l,height:o,markSize:d}=function getLogoDimensions(e){return he[e]||he.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}(l,o,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 l=document.createElement("div");if(l.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&&(l.addEventListener("click",e=>this.handleClick(e)),a||l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))})),this.renderLogoContent(l),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(l),void this.append(e)}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(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"),l=this.getAttribute("image-alt")||s,o="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=l,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),o)),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 ue=["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"]}connectedCallback(){this.style.display="contents",this.render()}disconnectedCallback(){this.detachListeners(),this.portal?.remove(),this.portal=void 0,document.body.style.overflow=""}attributeChangedCallback(){this.isConnected&&this.render()}isOpen(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}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(){const e=this.isOpen(),t=this.hasAttribute("blur"),s=this.getAttribute("opacity")||"0.5",i=this.getAttribute("blur-amount")||"4",n=ue.includes(this.getAttribute("animation")||"fade")&&this.getAttribute("animation")||"fade",a=this.getAttribute("animation-duration")||"300",r=this.getAttribute("z-index")||"1000",l=this.getAttribute("background-color"),o=this.collectChildren();document.body.style.overflow=e?"hidden":"",e?this.attachListeners():this.detachListeners(),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--${n}`,e?"designbase-wc-backdrop--open":"",t?"designbase-wc-backdrop--blur":""].filter(Boolean).join(" "),this.portal.setAttribute("role","presentation"),this.portal.setAttribute("aria-hidden",e?"false":"true"),this.portal.style.setProperty("--backdrop-opacity",s),this.portal.style.setProperty("--backdrop-blur-amount",`${i}px`),this.portal.style.setProperty("--backdrop-animation-duration",`${a}ms`),this.portal.style.setProperty("--backdrop-z-index",r),l?this.portal.style.backgroundColor=l:this.portal.style.removeProperty("background-color"),this.portal.replaceChildren(...o),e?this.portal.isConnected||document.body.append(this.portal):this.portal.isConnected&&this.portal.remove()}}customElements.get("db-backdrop")||customElements.define("db-backdrop",DbBackdrop);const be=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],pe=["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.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 be.includes(e)?e:"top"}resolvedTrigger(){const e=this.getAttribute("trigger")||"click";return pe.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()}positionPanel(){if(!this.panel)return;const e=this.getTriggerRect();if(!e)return;const t=this.resolvedPlacement(),s=this.panel.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,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}n=Math.max(8,Math.min(n,window.innerWidth-s.width-8)),i=Math.max(8,Math.min(i,window.innerHeight-s.height-8));const l=Number(this.getAttribute("max-width")||300);this.panel.style.top=`${i}px`,this.panel.style.left=`${n}px`,this.panel.style.maxWidth=`${l}px`,this.panel.dataset.placementGroup=this.groupOf(t),this.arrowEl&&(this.arrowEl.style.top=`${a}px`,this.arrowEl.style.left=`${r}px`),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.positionPanel(),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 me=["left","right","top","bottom"],ge=["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=me.includes(this.getAttribute("position")||"right")&&this.getAttribute("position")||"right",t=ge.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",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=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 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=`${l}-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(...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.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()}attributeChangedCallback(e){if(!this.isConnected)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;this.timeoutId=setTimeout(()=>this.close(),e);if("false"!==this.getAttribute("show-progress")&&this.hasAttribute("show-progress")){const t=this.querySelector(".designbase-wc-toast__progress-bar"),s=Date.now();this.progressInterval=setInterval(()=>{const i=Date.now()-s,n=Math.min(100,i/e*100);t&&(t.style.width=`${n}%`),n>=100&&this.close()},50)}}close(){this.closed||(this.closed=!0,this.clearTimers(),this.classList.remove("designbase-wc-toast--visible"),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.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 l=document.createElement("div");if(l.className="designbase-wc-toast__title",l.textContent=t,r.append(l),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",18)),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",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"),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 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 e=document.createElement("div");e.className="designbase-wc-confirm__icon",e.append(createDbIcon(this.iconForVariant(a),this.iconSize(r))),m.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)}m.append(g),p.append(m);const v=document.createElement("div");v.id="confirm-content",v.className="designbase-wc-confirm__content",v.textContent=t,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 ve=["dots","numbers","line","dot-line","slide","combined"],Ee=["s","m","l"],fe=["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(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 ve.includes(e)?e:"dots"}get size(){const e=this.getAttribute("size")||"m";return Ee.includes(e)?e:"m"}set size(e){this.setAttribute("size",e)}get direction(){const e=this.getAttribute("direction")||"horizontal";return fe.includes(e)?e:"horizontal"}set direction(e){this.setAttribute("direction",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").forEach(e=>{e.style.transform="vertical"===this.direction?`scaleY(${this.progress})`:`scaleX(${this.progress})`});const e=this.querySelector(".designbase-wc-indicator__dot-ring-progress");if(e){const t=15.9155,s=2*Math.PI*t;e.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.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(e)),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(e)),n.setAttribute("fill","none"),n.setAttribute("stroke-dasharray",String(t)),n.setAttribute("stroke-dashoffset",String(t*(1-this.progress))),n.setAttribute("stroke-linecap","round"),s.append(i,n),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,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()),e.append(this.renderStep(t,["designbase-wc-indicator__dot",s&&"designbase-wc-indicator__dot--active",l&&"designbase-wc-indicator__dot--with-ring"].filter(Boolean).join(" "),d))}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}render(){const e=this.indicatorType,t="combined"===e?"dots":e,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"===t){const e=document.createElement("span");e.className="designbase-wc-indicator__current",e.textContent=String(i+1);const t=document.createElement("span");t.className="designbase-wc-indicator__separator",t.textContent="/";const s=document.createElement("span");return s.className="designbase-wc-indicator__total",s.textContent=String(n),void this.append(e,t,s)}if("slide"===t){const e=document.createElement("div");e.className="designbase-wc-indicator__track";const t=document.createElement("div");t.className="designbase-wc-indicator__track-thumb";const l=100/n;if("vertical"===s?(t.style.height=`${l}%`,t.style.transform=`translateY(${100*i}%)`):(t.style.width=`${l}%`,t.style.transform=`translateX(${100*i}%)`),a&&r){const e=document.createElement("div");e.className="designbase-wc-indicator__track-fill",e.style.transform="vertical"===s?`scaleY(${this.progress})`:`scaleX(${this.progress})`,t.append(e)}return e.append(t),void this.append(e)}if("line"===t){const e=document.createDocumentFragment();for(let t=0;t<n;t+=1){const n=t===i,l=a&&n&&r?(()=>{const e=document.createElement("span");return e.className="designbase-wc-indicator__line-fill",e.style.transform="vertical"===s?`scaleY(${this.progress})`:`scaleX(${this.progress})`,e})():void 0;e.append(this.renderStep(t,["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(e)}if("dot-line"===t){const e=document.createDocumentFragment();for(let t=0;t<n;t+=1){const s=t===i;e.append(this.renderStep(t,["designbase-wc-indicator__dot-line-item",s&&"designbase-wc-indicator__dot-line-item--active"].filter(Boolean).join(" ")))}return void this.append(e)}if("combined"===e){const e=document.createElement("div");return e.className="designbase-wc-indicator__steps",e.append(this.renderDots()),void this.append(e,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(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"),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"===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<l;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,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-${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",(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 e=document.createElement("div");e.className="designbase-wc-list__item-icon",e.append(createDbIcon(r.icon,p)),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),m){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:l},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",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 e=document.createElement("div");e.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(" "),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(m){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||(m&&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),m&&v){const e=document.createElement("div");e.className=`designbase-wc-menu-item__children designbase-wc-menu-item__children--${r}`,p.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(l+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 we=["s","m","l"],ye=["default","outlined","filled"],Ae=["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","variant","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 we.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--${we.includes(e)?e:"m"}`,`designbase-wc-search-bar--${ye.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default"}`,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,!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"),l=Ae.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--${l}`;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.getAttribute("variant")||"default",s=this.hasAttribute("disabled"),i=this.hasAttribute("readonly"),n=this.hasAttribute("full-width"),a=this.hasAttribute("show-shortcut"),r=this.getAttribute("value")??this.getAttribute("default-value")??"",l=Boolean(r.trim()),o=this.getIconPx();this.className=["designbase-wc-search-bar",`designbase-wc-search-bar--${we.includes(e)?e:"m"}`,`designbase-wc-search-bar--${ye.includes(t)?t:"default"}`,s&&"designbase-wc-search-bar--disabled",i&&"designbase-wc-search-bar--readonly",n&&"designbase-wc-search-bar--full-width",l&&"designbase-wc-search-bar--has-value"].filter(Boolean).join(" "),this.setAttribute("role","search"),this.clearSuggestionInterval(),this.detachDropdownPortal(),this.replaceChildren();const d=document.createElement("div");d.className="designbase-wc-search-bar__container";const u=document.createElement("div");u.className="designbase-wc-search-bar__search-icon",u.setAttribute("aria-hidden","true"),u.append(createDbIcon("search",o));const b=document.createElement("input");if(b.type="text",b.className="designbase-wc-search-bar__input",b.value=r,b.disabled=s,b.readOnly=i,b.setAttribute("aria-label","검색어 입력"),this.input=b,a){const t=document.createElement("db-badge");t.className="designbase-wc-search-bar__shortcut-badge",t.setAttribute("size","l"===e?"m":"s"),t.setAttribute("variant","secondary"),t.setAttribute("badge-style","text"),t.setAttribute("aria-hidden","true"),t.textContent=this.getAttribute("shortcut-label")||"⌘K",t.hidden=l||s||i,this.shortcutBadge=t,d.append(u,b,t)}else d.append(u,b);const p=document.createElement("button");p.type="button",p.className="designbase-wc-search-bar__clear-button",p.setAttribute("aria-label","검색어 지우기"),p.hidden=!l||s||i,p.append(createDbIcon("close",o)),this.clearButton=p,d.append(p);const m=document.createElement("div");m.className="designbase-wc-search-bar__dropdown",m.hidden=!0,m.addEventListener("mousedown",e=>{e.preventDefault()}),this.dropdown=m,b.addEventListener("input",()=>{this.setAttribute("value",b.value),this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),this.syncSuggestionRolling();const e={value:b.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}))}),b.addEventListener("keydown",e=>{"Enter"===e.key&&this.handleSearch()}),b.addEventListener("focus",()=>{this.isFocused=!0,this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-focus",{bubbles:!0,composed:!0}))}),b.addEventListener("blur",()=>{this.isFocused=!1,this.blurTimer&&clearTimeout(this.blurTimer),this.updateDropdown(),this.dispatchEvent(new CustomEvent("db-blur",{bubbles:!0,composed:!0}))}),p.addEventListener("click",()=>{b.value="",this.setAttribute("value",""),this.syncValueState(),this.syncPlaceholder(),this.updateDropdown(),this.syncSuggestionRolling(),b.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(d,m),this.syncIcons(),this.syncPlaceholder(),this.syncSuggestionRolling(),this.bindGlobalShortcut(),this.updateDropdown()}}customElements.get("db-search-bar")||customElements.define("db-search-bar",DbSearchBar);const Ce={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"/>'},_e={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}">${Ce[e]}</svg>`,s.content.firstElementChild}const ke=["facebook","x","linkedin","whatsapp","email","link"],xe={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:ke).filter(e=>e in xe)}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=xe[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(_e[e],t)}(e,24)),t}createPlatformButton(e){const t=xe[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:xe[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 Se=["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=Se.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 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 o=document.createElement("div");o.className="designbase-wc-top-banner__container";const d=document.createElement("div");d.className="designbase-wc-top-banner__content",e&&d.append(this.createBadge(e,l));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)),o.append(d),o.append(this.createCloseButton()),this.append(o)}}customElements.get("db-top-banner")||customElements.define("db-top-banner",DbTopBanner);const Ne=["s","m","l"],$e=["default","minimal","card","colored","iconBox"],Ie=["horizontal","vertical","reverse"],De=["primary","secondary","success","warning","error","info","custom"],Le={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=Ne.includes(n)?n:"m",r=this.getAttribute("variant")||"default",l=$e.includes(r)?r:"default",o=this.getAttribute("layout")||"horizontal",d=Ie.includes(o)?o:"horizontal",u=this.getAttribute("color")||"primary",b=De.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"),C=this.hasAttribute("disabled"),_=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",C&&"designbase-wc-stat--disabled",_&&"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&&!C?(this.setAttribute("role","button"),this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.replaceChildren();const k=document.createElement("div");k.className="designbase-wc-stat__body";const x=this.resolveIconName(s);if(x){const e=document.createElement("div");e.className=`designbase-wc-stat__icon designbase-wc-stat__icon--${i}`;const t="iconBox"===l?Le[a]:20;e.append(createDbIcon(x,t)),k.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(k.append(S),this.append(k),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 Me=["1:1","16:9","4:3","3:2","3:4","2:1","auto"],ze=["cover","contain","fill","none","scale-down"],Te=["lazy","eager"],Be=["skeleton","blur","none"],Pe=["s","m","l","full"],Fe=["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":Pe.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":Fe.includes(e)?`designbase-wc-image--shadow-${e}`:"":""}getRatioClass(){const e=this.getAttribute("ratio")||"auto";return"auto"===e?"designbase-wc-image--ratio-auto":Me.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=Te.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=Be.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=ze.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")||"",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),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 Oe=["grid","list","gallery","carousel"],He=["1","2","3","4","5","6"],Ve=["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--${Oe.includes(t)?t:"grid"}`,`designbase-wc-image-list--columns-${He.includes(s)?s:"3"}`,`designbase-wc-image-list--spacing-${Ve.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 Re=["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(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,a={}){const r=document.createElement("db-button");r.className=e,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(t,s)),r.append(l),r.addEventListener("db-click",n),r}buildPortal(){const e=this.getAttribute("size")||"l",t=Re.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 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",e=>{e.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 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;t.hidden=!i,e.replaceChildren(),i&&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)})}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 We=["s","m","l"],qe=["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()}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=We.includes(e)?e:"m",s=this.getAttribute("background-color")||"default",i=qe.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 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 e=createDbIcon(a,i);e.classList.add("designbase-wc-bottom-navigation__icon"),o.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)),o.append(t)}const d=document.createElement("span");d.className="designbase-wc-bottom-navigation__label",d.textContent=e.label,l.append(o,d),r.append(l),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 je=["s","m","l"],Ue=["default","transparent"],Ke=["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()}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--${je.includes(e)?e:"m"}`,`designbase-wc-navbar--${Ue.includes(t)?t:"default"}`,`designbase-wc-navbar--${Ke.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(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 l=document.createElement("ul");return l.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),l.append(s)}),i.append(n,l),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)}createMobileMenuItem(e,t){const s=Boolean(e.children?.length),i=Boolean(this.expandedMobile[e.id]),n=document.createElement("db-menu-item");return n.setAttribute("label",e.label),n.setAttribute("type","block"),n.setAttribute("menu-style","accordion"),n.setAttribute("size",t),e.href&&n.setAttribute("href",e.href),e.icon&&n.setAttribute("icon",e.icon),e.active&&n.setAttribute("active",""),e.disabled&&n.setAttribute("disabled",""),s&&(n.setAttribute("expandable",""),n.subItems=(e.children||[]).map(e=>({id:e.id,label:e.label,href:e.href,icon:e.icon,active:e.active,disabled:e.disabled})),i&&n.setAttribute("expanded","")),n.addEventListener("db-click",()=>{if(!e.disabled){if(s)return this.expandedMobile[e.id]=!i,void this.renderMobileMenu();this.mobileOpen=!1,this.dispatchItemClick(e,"mobile"),this.render()}}),n.addEventListener("db-child-click",e=>{const t=e.detail;this.mobileOpen=!1,this.dispatchItemClick(t.child,"mobile"),this.render()}),n}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 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(e=>g.append(this.createDesktopNavItem(e,t))),m.append(g),p.append(m),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),p.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 l=document.createElement("ul");if(l.className="designbase-wc-navbar__user-dropdown-menu",l.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),l.append(e)}i.forEach(t=>{const s=document.createElement("li");s.append(this.createUserMenuItemElement(t,e,()=>{this.userMenuOpen=!1,this.updateUserMenuVisibility()})),l.append(s)}),t.append(s,l),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)}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 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()}),l.append(o,p,E),this.append(l),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 Je=["s","m","l"],Ge=["default","dark","light"],Ye=["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}}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--${Je.includes(e)?e:"m"}`,`designbase-wc-sidebar--${Ge.includes(t)?t:"default"}`,`designbase-wc-sidebar--${Ye.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 l=document.createElement("db-menu-item");return l.setAttribute("label",e.label),l.setAttribute("type","block"),l.setAttribute("menu-style","accordion"),l.setAttribute("size",t),l.setAttribute("depth",String(s)),e.href&&l.setAttribute("href",e.href),e.icon&&l.setAttribute("icon",e.icon),e.active&&l.setAttribute("active",""),e.disabled&&l.setAttribute("disabled",""),void 0!==e.badge&&l.setAttribute("badge",String(e.badge)),e.badgeColor&&l.setAttribute("badge-color",e.badgeColor),i&&(l.setAttribute("expandable",""),l.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&&l.setAttribute("expanded","")),l.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)}),l.addEventListener("db-child-click",e=>{const t=e.detail;this.dispatchItemClick(t.child)}),r.append(l),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 l=document.createElement("div");if(l.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("aria-label",i?"사이드바 펼치기":"사이드바 접기");const s=document.createElement("span");s.className="designbase-wc-button__start-icon designbase-wc-sidebar__toggle-icon",s.append(createDbIcon(i?"arrow-bar-right":"arrow-bar-left",16)),t.append(s),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)}l.append(e)}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 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 l=document.createElement("div");if(l.className="designbase-wc-sidebar__user-name",l.textContent=n.name,r.append(l),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)}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=e=>{if(!this.open)return;const t=e.target;this.menuEl?.contains(t)||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 Xe=["s","m","l"],Ze=["default","primary","success","warning","danger"],Qe=["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",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--${Xe.includes(a)?a:"m"}`,`designbase-wc-progressbar--${Ze.includes(r)?r:"default"}`,`designbase-wc-progressbar--${Qe.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(e)),this.setAttribute("aria-valuemax",String(t)),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 e=document.createElement("span");e.className=`designbase-wc-progressbar__label designbase-wc-progressbar__label--${o}`,e.textContent=u,p.append(e)}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 e=document.createElement("span");e.className="designbase-wc-progressbar__fill-label",e.textContent=u,g.append(e)}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(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),l=a===n.length-1,o=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}`,o&&"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 p=document.createElement("div");if(p.className="designbase-wc-progress-step__indicator",o?(p.tabIndex=0,p.setAttribute("role","button"),p.setAttribute("aria-label",`${t.title} 단계로 이동`),p.addEventListener("click",()=>this.handleStepClick(t,a)),p.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleStepClick(t,a))})):p.tabIndex=-1,"active"===r){const e=document.createElement("div");e.className="designbase-wc-progress-step__pulse",p.append(e)}if(p.append(this.renderIndicatorContent(r,a,e)),b.append(p),!l){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 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=t.title,g.append(v),m.append(g),t.description){const e=document.createElement("p");e.className="designbase-wc-progress-step__description",e.textContent=t.description,m.append(e)}if(t.timestamp){const e=document.createElement("span");e.className="designbase-wc-progress-step__timestamp",e.textContent=t.timestamp,m.append(e)}u.append(m),this.append(u)})}}customElements.get("db-progress-step")||customElements.define("db-progress-step",DbProgressStep);const et="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=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","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(e){this.built&&(this.readAttributeValues(),this.syncClasses(),this.isStructuralAttribute(e)&&this.syncStructure(),this.syncVisuals(),this.syncA11y())}isStructuralAttribute(e){return["range","show-value","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(et),this.valuesEl=document.createElement("div"),this.valuesEl.className=`${et}__values`,this.containerEl=document.createElement("div"),this.containerEl.className=`${et}__container`,this.containerEl.setAttribute("role","slider"),this.containerEl.setAttribute("tabindex","0"),this.trackEl=document.createElement("div"),this.trackEl.className=`${et}__track`,this.fillEl=document.createElement("div"),this.fillEl.className=`${et}__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 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.getAttribute("value-position")||"top",n=[et,`${et}--${e}`,`${et}--${t}`,`${et}--value-${s?"top":"top"===i?"right":i}`,this.hasAttribute("disabled")?`${et}--disabled`:"",this.hasAttribute("readonly")?`${et}--readonly`:"",this.hasAttribute("full-width")?`${et}--full-width`:"",this.hasAttribute("vertical")?`${et}--vertical`:"",s?`${et}--range`:""].filter(Boolean);if(this.className=n.join(" "),this.trackEl){const e=[`${et}__track`];this.hasAttribute("disabled")&&e.push(`${et}__track--disabled`),this.hasAttribute("readonly")&&e.push(`${et}__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=`${et}__value ${et}__value--min`;const t=document.createElement("span");t.className=`${et}__value ${et}__value--max`,this.valuesEl.append(e,t)}else{const e=document.createElement("span");e.className=`${et}__value ${et}__value--single`,this.valuesEl.appendChild(e)}if(this.thumbEls.forEach(e=>e.remove()),this.thumbEls=[],this.trackEl.querySelectorAll(`.${et}__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=`${et}__mark`,s.setAttribute("aria-hidden","true"),this.isMarkActive(e)&&s.classList.add(`${et}__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=`${et}__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=`${et}__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)),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(`.${et}__value--min`),l=this.valuesEl?.querySelector(`.${et}__value--max`);r&&(r.textContent=String(e)),l&&(l.textContent=String(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(`.${et}__value--single`);i&&(i.textContent=String(this.currentValue))}this.trackEl?.querySelectorAll(`.${et}__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(`${et}__mark--active`,this.isMarkActive(n))})}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(`.${et}__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.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(`${et}__thumb--active`,t)}this.thumbEls[0]?.classList.toggle(`${et}__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 l=[...this.currentRange];if("min"===t?l[0]=a:l[1]=a,l[0]>l[1])return;return e.preventDefault(),this.currentRange=l,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 tt="designbase-wc-segment-control",st={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)}static get observedAttributes(){return["options","value","default-value","size","variant","full-width","disabled"]}connectedCallback(){this.built||(this.built=!0),this.render(),this.addEventListener("keydown",this.boundKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this.boundKeyDown)}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.hasAttribute("disabled"),i=this.options,n=this.value;this.className=[tt,`${tt}--${e}`,`${tt}--${t}`,this.hasAttribute("full-width")&&`${tt}--full-width`,s&&`${tt}--disabled`].filter(Boolean).join(" "),this.setAttribute("role","tablist"),this.setAttribute("aria-label","세그먼트 컨트롤"),this.replaceChildren(),this.segmentButtons=[],i.forEach((e,i)=>{const a=e.value===n,r=Boolean(s||e.disabled),l=document.createElement("button");if(l.type="button",l.className=[`${tt}__segment`,a&&`${tt}__segment--selected`,r&&`${tt}__segment--disabled`].filter(Boolean).join(" "),l.setAttribute("role","tab"),l.setAttribute("aria-selected",String(a)),l.setAttribute("aria-disabled",String(r)),l.setAttribute("tabindex",a?"0":"-1"),l.disabled=r,e.icon&&st[e.icon]){const t=document.createElement("span");t.className=`${tt}__segment-icon`,t.innerHTML=st[e.icon],l.appendChild(t)}const o=document.createElement("span");o.className=`${tt}__segment-label`,o.textContent=e.label,"icon-only"===t&&o.setAttribute("aria-label",e.label),l.appendChild(o),l.addEventListener("click",()=>this.select(e.value)),l.addEventListener("focus",()=>{this.focusedIndex=i,l.classList.add(`${tt}__segment--focused`)}),l.addEventListener("blur",()=>{this.focusedIndex=-1,l.classList.remove(`${tt}__segment--focused`)}),this.appendChild(l),this.segmentButtons.push(l)}),this.indicatorEl=document.createElement("div"),this.indicatorEl.className=`${tt}__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(`${tt}__segment--selected`,a),s.setAttribute("aria-selected",String(a)),s.setAttribute("tabindex",a?"0":"-1")}),this.indicatorEl&&e.length>0&&s>=0&&(this.indicatorEl.style.width=100/e.length+"%",this.indicatorEl.style.transform=`translateX(${100*s}%)`)}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 it="designbase-wc-stepper",nt=["s","m","l"],at={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","disabled","readonly"]}connectedCallback(){this.querySelector(`.${it}__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=`${it}__button ${it}__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=`${it}__value`,this.valueTextEl=document.createElement("span"),this.valueTextEl.className=`${it}__value-text`,this.valueWrapEl.appendChild(this.valueTextEl),this.incrementBtn=document.createElement("button"),this.incrementBtn.type="button",this.incrementBtn.className=`${it}__button ${it}__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("editable")&&!this.hasAttribute("disabled")&&!this.hasAttribute("readonly")}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=[it,`${it}--size-${nt.includes(e)?e:"m"}`,this.isEditable()&&`${it}--editable`,t&&`${it}--disabled`,s&&`${it}--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,at),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=`${it}__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=`${it}__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(`${it}__button--disabled`,e)}if(this.incrementBtn){const e=s||i||r;this.incrementBtn.disabled=e,this.incrementBtn.classList.toggle(`${it}__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 rt=["s","m","l","xl","full"],lt=["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-${rt.includes(e)?e:"l"}`,lt.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 ot=["vertical","horizontal"],dt=["start","center","end","stretch"],ct=["start","center","end","space-between","space-around","space-evenly"],ht=["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=ht.includes(i)?i:"m";this.className=["designbase-wc-stack",`designbase-wc-stack--direction-${ot.includes(e)?e:"vertical"}`,`designbase-wc-stack--alignment-${dt.includes(t)?t:"start"}`,`designbase-wc-stack--justify-${ct.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 ut="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=`${ut}__native`,this.formEl.noValidate=!0,this.formEl.addEventListener("submit",this.boundSubmit),this.headerEl=document.createElement("div"),this.headerEl.className=`${ut}__header`,this.fieldsEl=document.createElement("div"),this.fieldsEl.className=`${ut}__fields`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${ut}__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=[ut,`${ut}--columns-${e}`,`${ut}--${t}`,`${ut}--${s}`,this.hasAttribute("submit-loading")&&`${ut}--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=`${ut}__title`,t.textContent=e,this.headerEl.appendChild(t)}if(t){const e=document.createElement("p");e.className=`${ut}__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=`${ut}__field-wrapper ${ut}__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=`${ut}__label`,e.htmlFor=`db-form-${t.name}`,e.textContent=t.label,t.required||t.validation?.required){const t=document.createElement("span");t.className=`${ut}__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(`${ut}__field-wrapper--error`,i),s.querySelector(`.${ut}__error`)?.remove(),s.querySelector(`.${ut}__help`)?.remove();const n=s.querySelector(`.${ut}__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=`${ut}__error`,t.textContent=this.errors[e],void s.appendChild(t)}if(t.helpText){const e=document.createElement("div");e.className=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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 bt=["default","minimal"],pt=["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 bt.includes(e)?e:"default"}getAlign(){const e=this.getAttribute("align")||"center";return pt.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,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 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 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 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(o.append(d),s&&e.length){const t=document.createElement("div");t.className="designbase-wc-page-header__cta",e.forEach(e=>t.append(e)),o.append(t)}if(this.append(o),!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","s"),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 mt=["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=mt.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 gt=["s","m","l"],vt=["primary","secondary","tertiary"],Et={s:16,m:24,l:32};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 gt.includes(e)?e:"m"}set size(e){this.setAttribute("size",e)}get variant(){const e=this.getAttribute("variant")||"primary";return vt.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--s",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,Et[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 ft={s:40,m:60,l:80,full:100},wt=["default","persistent","temporary","fullscreen"],yt=["slide","fade","scale","none"];function resolveHeightPercent(e){if(!e)return ft.m;const t=ft[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)):ft.m}class DbBottomSheet extends HTMLElement{constructor(){super(...arguments),this.sheetHeightPercent=ft.m,this.isDragging=!1,this.isVisible=!1,this.isMounted=!1,this.keyHandler=null,this.dragState={active:!1,pointerId:-1,startY:0,startHeight:ft.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"]}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=""}attributeChangedCallback(e){this.isConnected&&("open"!==e?("height"===e&&this.isOpenRequested()&&(this.sheetHeightPercent=resolveHeightPercent(this.getAttribute("height"))),this.render(),this.isMounted&&this.syncActiveClasses()):this.syncOpenState())}isOpenRequested(){return this.hasAttribute("open")&&"false"!==this.getAttribute("open")}clearTimers(){this.enterTimer&&(clearTimeout(this.enterTimer),this.enterTimer=void 0),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=void 0)}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.setAttribute("open","false"),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")||300);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.enterTimer=setTimeout(()=>{this.enterTimer=void 0,this.isVisible=!0,this.syncActiveClasses()},10),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=wt.includes(t)?t:"default",n=yt.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",(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(){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")||"300",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",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.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(),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 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 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",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(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(...p),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 At=["vertical","horizontal","both"],Ct=["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=At.includes(e)?e:"vertical",i=Ct.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 _t=["s","m","l"],kt=["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=_t.includes(e)?e:"m",i=kt.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=_t.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 e=document.createElement("div");e.className="designbase-wc-dropzone__image";const t=document.createElement("img");t.src=l,t.alt="Upload illustration",e.append(t),n.append(e)}else if(o){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(p){const e=document.createElement("button");e.type="button",e.className="designbase-wc-dropzone__button",e.textContent=m,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"]}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(),this.isMounted&&this.render()):this.syncOpenState())}isOpenRequested(){return this.hasAttribute("open")&&"false"!==this.getAttribute("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.setAttribute("open","false"),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.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 void this.root.replaceChildren();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===t,o=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="이전",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&&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 l=this.panelSizes[this.draggingIndex];if("horizontal"===t){const t=n.width,a=e.clientX-n.left;let o=0;for(let e=0;e<this.draggingIndex;e++){const n=this.panelSizes[e];o+="fixed"===s?n:n*t,o+=i}const d=a-o;if("fixed"===s)l=Math.max(r.minSize||0,Math.min(r.maxSize||t,d));else{l=d/t;const e=r.minSize?r.minSize/t:0,s=r.maxSize?r.maxSize/t:1;l=Math.max(e,Math.min(s,l))}}else{const t=n.height,a=e.clientY-n.top;let o=0;for(let e=0;e<this.draggingIndex;e++){const n=this.panelSizes[e];o+="fixed"===s?n:n*t,o+=i}const d=a-o;if("fixed"===s)l=Math.max(r.minSize||0,Math.min(r.maxSize||t,d));else{l=d/t;const e=r.minSize?r.minSize/t:0,s=r.maxSize?r.maxSize/t:1;l=Math.max(e,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 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 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"!==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],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"===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(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 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")),l=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__splitter"));r.forEach(e=>e.remove()),l.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,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",t.parentElement!==o&&o.append(t),l.append(o),this.append(l),!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 xt=["s","m","l"],St=["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=xt.includes(e)?e:"m",i=St.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 l=document.createElement("div");l.className="designbase-wc-file-uploader__file-name",l.textContent=e.file.name;const o=document.createElement("div");if(o.className="designbase-wc-file-uploader__file-size",o.textContent=this.formatFileSize(e.file.size),r.append(l,o),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=(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}},Nt=[{id:"today",label:"오늘",getRange:({today:e})=>clampRange({start:startOfDay(e),end:endOfDay(e)})},{id:"yesterday",label:"어제",getRange:({today:e})=>{const t=addDays(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(e,-("monday"===t?(s+6)%7:s))})(e,t);return clampRange({start:n,end:(a=n,endOfDay(addDays(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"}):"",$t="designbase-wc-date-picker",It=["s","m","l"],Dt=["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?Nt:[]}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=`${$t}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${$t}__trigger`;const e=document.createElement("button");e.type="button",e.className=`${$t}__icon-display`,e.setAttribute("aria-label","날짜 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${$t}__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=`${$t}__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=`${$t}__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(),l=this.events.filter(t=>{const s=parseISODate(t.date);return!!s&&s.toDateString()===e.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=[`${$t}__date`,!s&&this.showOutsideDays&&`${$t}__date--outside`,i&&`${$t}__date--today`,n&&`${$t}__date--selected`,a&&!n&&`${$t}__date--in-range`,"range"===this.effectiveMode&&(this.rangeStart?.toDateString()===e.toDateString()||u===e.toDateString())&&`${$t}__date--range-start`,"range"===this.effectiveMode&&d===e.toDateString()&&`${$t}__date--range-end`,r&&`${$t}__date--weekend`,!this.isDateValid(e)&&`${$t}__date--disabled`,l.length>0&&`${$t}__date--has-events`].filter(Boolean).join(" "),b.disabled=!this.isDateValid(e)||this.disabled||this.readonly,b.addEventListener("click",()=>this.handleDateClick(e));const p=document.createElement("span");if(p.className=`${$t}__date-number`,p.textContent=String(e.getDate()),b.appendChild(p),l.length>0){const e=document.createElement("div");e.className=`${$t}__events`,l.slice(0,3).forEach(t=>{const s=document.createElement("div");s.className=`${$t}__event ${$t}__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=`${$t}__month`;const r=document.createElement("div");if(r.className=`${$t}__header`,s){const e=document.createElement("button");e.type="button",e.className=`${$t}__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=`${$t}__nav-spacer`,e.setAttribute("aria-hidden","true"),r.appendChild(e)}const l=document.createElement("div");if(l.className=`${$t}__current-month`,l.textContent=e.toLocaleDateString(this.locale,{year:"numeric",month:"long"}),r.appendChild(l),i){const e=document.createElement("button");e.type="button",e.className=`${$t}__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=`${$t}__nav-spacer`,e.setAttribute("aria-hidden","true"),r.appendChild(e)}a.appendChild(r);const o=document.createElement("div");o.className=`${$t}__weekdays`,(e=>{const t=["일","월","화","수","목","금","토"];return"monday"===e&&t.push(t.shift()),t})(this.startOfWeek).forEach(e=>{const t=document.createElement("div");t.className=`${$t}__weekday`,t.textContent=e,o.appendChild(t)}),a.appendChild(o);const d=document.createElement("div");d.className=`${$t}__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 l=new Date(a);return l.setDate(l.getDate()-r),Array.from({length:42},(e,t)=>{const s=new Date(l);return s.setDate(l.getDate()+t),s})})(e,this.startOfWeek,u).forEach((t,s)=>{if(!t){const e=document.createElement("span");return e.className=`${$t}__date ${$t}__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=`${$t}__date ${$t}__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=`${$t}__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=`${$t}__footer`;const s=document.createElement("button");s.type="button",s.className=`${$t}__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=`${$t}__panel`;const t=document.createElement("div");t.className=`${$t}__presets`,t.setAttribute("role","listbox"),t.setAttribute("aria-label","기간 프리셋"),this.presets.forEach(e=>{const s=document.createElement("button");s.type="button",s.className=[`${$t}__preset`,this.activePresetId===e.id&&`${$t}__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=`${$t}__panel-main`;const i=document.createElement("div");i.className=`${$t}__months ${$t}__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=`${$t}__panel-footer`;const a=isRangeValue(this.tempValue)?this.tempValue:void 0,r=document.createElement("div");r.className=`${$t}__range-display`;const l=document.createElement("span");l.className=`${$t}__range-text`,l.textContent=a?.start&&parseISODate(a.start)?formatPanelInputDate(parseISODate(a.start),this.locale):"시작일";const o=document.createElement("span");o.className=`${$t}__range-separator`,o.textContent="–";const d=document.createElement("span");d.className=`${$t}__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=`${$t}__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),e.appendChild(s),e}renderCalendar(){this.calendarHost&&(this.calendarHost.replaceChildren(),this.calendarHost.appendChild(this.isPanelLayout?this.renderPanelCalendar():this.renderDefaultCalendar()))}render(){const e=It.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=Dt.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default",s=this.getAttribute("dropdown-position")||"bottom-start",i=getDbComponentIconSize(e);if(this.className=[$t,this.inline?`${$t}--size-${e}`:`${$t}--${e}`,`${$t}--variant-${t}`,this.hasAttribute("full-width")&&`${$t}--full-width`,this.disabled&&`${$t}--disabled`,this.readonly&&`${$t}--readonly`,this.isOpen&&`${$t}--open`,this.hasAttribute("error")&&`${$t}--error`,this.isPanelLayout&&`${$t}--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(`.${$t}__icon-display`);a&&(a.innerHTML="",a.appendChild(createDbIcon("calendar",i)),a.disabled=this.disabled);const r=this.triggerEl.querySelector(`.${$t}__toggle`);if(r&&(r.innerHTML="",r.appendChild(createDbIcon("chevron-down",i)),r.disabled=this.disabled),this.dropdownEl.className=[`${$t}__dropdown`,`${$t}__dropdown--${s}`,this.isPanelLayout&&`${$t}__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=`${$t}__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 Lt="designbase-wc-time-picker",Mt=["s","m","l"],zt=["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 zt.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=`${Lt}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${Lt}__trigger`;const e=document.createElement("button");e.type="button",e.className=`${Lt}__icon-display`,e.setAttribute("aria-label","시간 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${Lt}__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=`${Lt}__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=`${Lt}__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=`${Lt}__wheel-container`;const l=document.createElement("div");l.className=`${Lt}__wheel-label`,l.textContent=t,r.appendChild(l);const o=document.createElement("div");o.className=`${Lt}__wheel-viewport`;const d=document.createElement("div");d.className=`${Lt}__wheel`,d.setAttribute("role","listbox"),d.setAttribute("aria-label",t);let u=null,b=!1,p=!1,m=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=[`${Lt}__wheel-item`,e===i&&`${Lt}__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=>{p=!0,m=e.clientY,g=d.scrollTop,d.setPointerCapture(e.pointerId),d.style.cursor="grabbing"}),d.addEventListener("pointermove",e=>{p&&(d.scrollTop=g-(e.clientY-m))});const endDrag=e=>{p&&(p=!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=`${Lt}__wheel-center-indicator`,E.setAttribute("aria-hidden","true");const f=document.createElement("div");f.className=`${Lt}__wheel-fade wheel-fade--top`,f.setAttribute("aria-hidden","true");const w=document.createElement("div");return w.className=`${Lt}__wheel-fade wheel-fade--bottom`,w.setAttribute("aria-hidden","true"),o.append(d,E,f,w),r.appendChild(o),r}renderSelector(e=!1){const t=document.createElement("div");t.className=`${Lt}__selector`;const s=document.createElement("div");s.className=`${Lt}__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,l=e?this.tempMinutes:this.minutes,o=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,l,o,d)})),s.appendChild(this.createWheel({label:"분",items:n,value:n.includes(l)?l:n[0],onChange:e=>onChange(r,e,o,d)})),this.showSeconds&&s.appendChild(this.createWheel({label:"초",items:a,value:o,onChange:e=>onChange(r,l,e,d)})),this.is12h&&s.appendChild(this.createWheel({label:"오전/오후",items:["AM","PM"],value:d,onChange:e=>onChange(r,l,o,e),formatter:e=>"AM"===e?"오전":"오후"})),t.appendChild(s),e)return t;const u=document.createElement("div");u.className=`${Lt}__dropdown-actions`;const b=document.createElement("div");b.className=`${Lt}__preview`,b.setAttribute("aria-live","polite"),b.appendChild(createDbIcon("clock",16));const p=document.createElement("div");p.className=`${Lt}__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),t.appendChild(u),t}render(){const e=Mt.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=this.getAttribute("dropdown-position")||"bottom-start",s=getDbComponentIconSize(e);if(this.className=[Lt,`${Lt}--${e}`,this.hasAttribute("full-width")&&`${Lt}--full-width`,this.disabled&&`${Lt}--disabled`,this.readonly&&`${Lt}--readonly`,this.isOpen&&`${Lt}--open`,this.hasAttribute("error")&&`${Lt}--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(`.${Lt}__icon-display`);n&&(n.innerHTML="",n.appendChild(createDbIcon("clock",s)),n.disabled=this.disabled);const a=this.triggerEl.querySelector(`.${Lt}__toggle`);if(a&&(a.innerHTML="",a.appendChild(createDbIcon("chevron-down",s)),a.disabled=this.disabled),this.dropdownEl.className=[`${Lt}__dropdown`,`${Lt}__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=`${Lt}__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 Tt="designbase-wc-calendar",Bt=[{value:"meeting",label:"회의"},{value:"task",label:"업무"},{value:"reminder",label:"알림"},{value:"birthday",label:"생일"},{value:"holiday",label:"휴일"},{value:"custom",label:"기타"}],Pt=[{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=`${Tt}__header`,this.bodyEl=document.createElement("div"),this.bodyEl.className=`${Tt}__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=`${Tt}__navigation`;const t=getDbComponentIconSize("m"),s=document.createElement("button");s.type="button",s.className=`${Tt}__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=`${Tt}__title`,i.textContent=this.selectedDate.toLocaleDateString(this.locale,{year:"numeric",month:"long"});const n=document.createElement("button");n.type="button",n.className=`${Tt}__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=`${Tt}__month-view`;const t=document.createElement("div");t.className=`${Tt}__weekdays`,["일","월","화","수","목","금","토"].forEach(e=>{const s=document.createElement("div");s.className=`${Tt}__weekday`,s.textContent=e,t.appendChild(s)}),e.appendChild(t);const s=document.createElement("div");s.className=`${Tt}__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 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 o=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(),p=Boolean(d&&!u&&!b);o.className=[`${Tt}__day`,i&&`${Tt}__day--current-month`,this.highlightToday&&t.toDateString()===l.toDateString()&&`${Tt}__day--today`,this.isSameDate(t,this.selectedDate)&&`${Tt}__day--selected`,u&&`${Tt}__day--selected--start`,b&&`${Tt}__day--selected--end`,p&&`${Tt}__day--selected--middle`,!this.showWeekends&&a&&`${Tt}__day--weekend`].filter(Boolean).join(" "),o.addEventListener("click",()=>this.handleDateClick(t));const m=document.createElement("span");m.className=`${Tt}__day-number`,m.textContent=String(t.getDate()),o.appendChild(m);const g=this.eventsForDate(t);if(g.length){const e=document.createElement("div");if(e.className=`${Tt}__day-events`,g.slice(0,2).forEach(t=>{const s=document.createElement("div");s.className=[`${Tt}__event-bar`,`${Tt}__event-bar--${t.type}`].filter(Boolean).join(" "),t.color&&(s.style.backgroundColor=t.color),this.draggedEvent?.id===t.id&&s.classList.add(`${Tt}__event-bar--dragging`),s.title=t.title,s.draggable=!0;const i=document.createElement("span");i.className=`${Tt}__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=`${Tt}__more-events`,t.textContent=`+${g.length-2} more`,e.appendChild(t)}o.appendChild(e)}const v=document.createElement("div");v.className=[`${Tt}__drop-zone`,this.dragOverDate&&this.isSameDate(this.dragOverDate,t)&&`${Tt}__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)),o.appendChild(v),s.appendChild(o)}return e.appendChild(s),e}renderYearView(){const e=document.createElement("div");e.className=`${Tt}__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=`${Tt}__year-month`,a.addEventListener("click",()=>{this.selectedDate=i,this.handleViewChange("month")});const r=document.createElement("h3");if(r.className=`${Tt}__year-month-title`,r.textContent=i.toLocaleDateString(this.locale,{month:"long"}),a.appendChild(r),n.length){const e=document.createElement("div");if(e.className=`${Tt}__year-month-events`,n.slice(0,4).forEach(t=>{const s=document.createElement("span");s.className=[`${Tt}__year-event`,`${Tt}__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=`${Tt}__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=`${Tt}__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=`${Tt}__week-header`;const n=document.createElement("div");n.className=`${Tt}__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=[`${Tt}__week-day-header`,n.toDateString()===t.toDateString()&&`${Tt}__week-day-header--today`].filter(Boolean).join(" ");const r=document.createElement("span");r.className=`${Tt}__week-day-name`,r.textContent=n.toLocaleDateString(this.locale,{weekday:"short"});const l=document.createElement("span");l.className=`${Tt}__week-day-number`,l.textContent=String(n.getDate()),a.append(r,l),i.appendChild(a)}e.appendChild(i);const a=document.createElement("div");a.className=`${Tt}__week-grid`;const r=document.createElement("div");r.className=`${Tt}__week-time-column`;for(let e=6;e<=22;e+=1){const t=document.createElement("div");t.className=`${Tt}__time-slot`;const s=document.createElement("span");s.className=`${Tt}__time-label`,s.textContent=`${String(e).padStart(2,"0")}:00`,t.appendChild(s),r.appendChild(t)}a.appendChild(r);const l=document.createElement("div");l.className=`${Tt}__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=`${Tt}__week-column`;for(let e=6;e<=22;e+=1){const s=document.createElement("div");s.className=`${Tt}__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),l=60*t+(s||0),o=Math.max(20,48*(r-l)/60),d=document.createElement("div");d.className=[`${Tt}__week-event`,`${Tt}__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=`${o}px`,d.addEventListener("click",t=>this.handleEventClick(e,t)),i.appendChild(d)}),l.appendChild(i)}return a.appendChild(l),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=`${Tt}__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(Bt)),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(Pt)),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 l=document.createElement("db-time-picker");l.setAttribute("label","종료 시간"),l.setAttribute("full-width",""),l.setAttribute("value",this.eventForm.endTime),l.addEventListener("db-change",e=>{this.eventForm.endTime=e.detail.value}),e.append(t,s,i,n,a,r,l);const o=document.createElement("div");if(o.className=`${Tt}__event-form-footer`,o.style.display="flex",o.style.gap="8px",o.style.justifyContent="flex-end",o.style.marginTop="16px",this.isEditing){const e=document.createElement("db-button");e.setAttribute("variant","danger"),e.textContent="삭제",e.addEventListener("click",()=>this.deleteEvent()),o.appendChild(e)}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),e.appendChild(o),this.modalEl.appendChild(e)}render(){this.className=Tt,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 Ft=["s","m","l"],Ot=["default","minimal","card","inline","large"],Ht=["stars","number","both","reviews","detailed"],Vt=["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",Ft,"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(),l=e.querySelector("svg");l?.getAttribute("data-designbase-icon")===a&&l.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(),l=s||n,o=Array.from(this.starsEl.querySelectorAll(":scope > .designbase-wc-rating__star"));for(let e=0;e<5;e+=1){const t=this.getStarFill(e,a,l),s=n&&t>0,i=o[e]??document.createElement("span");i.setAttribute("aria-hidden","true"),this.updateStarElement(i,t,e,r,s),o[e]||this.starsEl.append(i)}for(let e=o.length-1;e>=5;e-=1)o[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",Ot,"default"),n=this.getOption("type",Vt,"star"),a=this.getOption("display",Ht,"stars"),r=this.getOption("color",Rt,"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(e,t,n,o)}`);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,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 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")||(l>0?`${l.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 Wt=["s","m","l"],qt=["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",Wt,"m"),t=this.optionAttr("variant",qt,"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],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 e=document.createElement("div");e.className="designbase-wc-countdown__label",e.textContent=n[i.key],l.append(e)}if(r.push(l),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 jt=[1,2,3,4,5,6],Ut=["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=jt.includes(e)?e:3,s=this.getAttribute("spacing")||"m",i=Ut.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=Array.from({length:t},()=>[]),l=new Array(t).fill(0);this.images.forEach(e=>{const t=l.indexOf(Math.min(...l));r[t].push(e),l[t]+=1});const o=document.createDocumentFragment();r.forEach(e=>{const t=document.createElement("div");t.className="designbase-wc-masonry__column",e.forEach(e=>{const s=this.images.indexOf(e),i=document.createElement("figure");i.className="designbase-wc-masonry__item";const n=document.createElement("img");if(n.className="designbase-wc-masonry__image",n.src=e.thumbnail||e.src,n.alt=e.alt||e.title||`image-${s+1}`,n.loading="lazy",n.addEventListener("load",()=>{this.dispatchEvent(new CustomEvent("db-image-load",{detail:{image:e,index:s},bubbles:!0,composed:!0}))}),n.addEventListener("error",()=>{this.dispatchEvent(new CustomEvent("db-image-error",{detail:{image:e,index:s},bubbles:!0,composed:!0}))}),i.append(n),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)}i.append(t)}a&&(i.tabIndex=0,i.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-image-click",{detail:{image:e,index:s},bubbles:!0,composed:!0}))})),t.append(i)}),o.append(t)}),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 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),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-${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 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((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(l&&e.title||o&&e.description){const t=document.createElement("div");if(t.className="designbase-wc-carousel__slide-info",i&&(t.style.color=i),l&&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(o&&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)}),m.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()),m.append(e,t)}const v=[m];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",""),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",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}},Kt=["s","m","l"],Jt=["dropdown","modal"],Gt=["bottom-start","bottom-end","top-start","top-end"],Yt="#006FFF",Xt=hexToRgb$1(Yt)??{r:0,g:111,b:255},Zt=rgbToHsv(Xt.r,Xt.g,Xt.b),Qt=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=Zt.h,this.s=Zt.s,this.v=Zt.v,this.a=100,this.open=!1,this.format="hex",this.colorInput=Yt,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",Jt,"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",Kt,"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,l=0,o=0;return e>=0&&e<60?(r=i,l=n,o=0):e<120?(r=n,l=i,o=0):e<180?(r=0,l=i,o=n):e<240?(r=0,l=n,o=i):e<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 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 l=(i+n)/2;if(i!==n){const o=i-n;switch(r=l>.5?o/(2-i-n):o/(i+n),i){case e:a=(t-s)/o+(t<s?6:0);break;case t:a=(s-e)/o+2;break;case s:a=(e-t)/o+4}a*=60}return{h:a,s:100*r,l:100*l}})(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?Yt: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",Kt,"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",Jt,"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 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",Qt),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()}),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 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",Kt,"m"),t=this.getOption("type",Jt,"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),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--${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&&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"===t&&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 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 es=["default","bordered","filled","minimal"],ts=["s","m","l"],ss=["vertical","horizontal"];class DbReorder extends HTMLElement{constructor(){super(...arguments),this.draggedIndex=-1,this.dragOverIndex=-1}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.render()}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}))}render(){const e=this.getOption("variant",es,"default"),t=this.getOption("size",ts,"m"),s=this.getOption("orientation",ss,"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--${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 o=document.createDocumentFragment();this.items.forEach((e,t)=>{const s=document.createElement("div"),d=i||!!e.disabled,u=this.dragOverIndex===t;if(s.className=["designbase-wc-reorder__item",e.selected&&"designbase-wc-reorder__item--selected",d&&"designbase-wc-reorder__item--disabled",u&&"designbase-wc-reorder__item--drag-over"].filter(Boolean).join(" "),s.draggable=!d,s.addEventListener("dragstart",e=>{d||(this.draggedIndex=t,e.dataTransfer?.setData("text/plain",String(t)))}),s.addEventListener("dragover",e=>{e.preventDefault(),this.dragOverIndex=t,this.render()}),s.addEventListener("dragleave",()=>{this.dragOverIndex=-1,this.render()}),s.addEventListener("drop",e=>{if(e.preventDefault(),this.draggedIndex<0||this.draggedIndex===t)return;const s=[...this.items],[i]=s.splice(this.draggedIndex,1);s.splice(t,0,i),this.draggedIndex=-1,this.dragOverIndex=-1,this.emitReorder(s)}),r&&!d){const e=document.createElement("div");e.className="designbase-wc-reorder__drag-handle",e.textContent=l?"⋮⋮":"≡",s.append(e)}if(n){const t=document.createElement("div");t.className="designbase-wc-reorder__checkbox";const i=document.createElement("input");i.type=a?"checkbox":"radio",i.checked=!!e.selected,i.disabled=d,i.className="designbase-wc-reorder__checkbox-input",i.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(i),s.append(t)}const b=document.createElement("div");b.className="designbase-wc-reorder__content",b.textContent=e.content,s.append(b),o.append(s)}),this.replaceChildren(o)}}customElements.get("db-reorder")||customElements.define("db-reorder",DbReorder);const is=["both","horizontal","vertical"],ns=["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&&is.includes(e)?e:"both"}getHandlePosition(){const e=this.getAttribute("handle-position");return e&&ns.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 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 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 as="designbase-wc-video-player",rs=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=`${as}__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=`${as}__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=`${as}__video`;const e=document.createElement("div");e.className=`${as}__loading`;const t=document.createElement("div");t.className=`${as}__spinner`,e.append(t);const s=document.createElement("div");s.className=`${as}__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=`${as}__dim-overlay`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${as}__overlay`;const a=document.createElement("div");a.className=`${as}__top-controls`;const r=document.createElement("div");r.className=`${as}__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=`${as}__center-controls`;const u=this.skipButton("-10",-10);this.centerPlayEl=document.createElement("button"),this.centerPlayEl.type="button",this.centerPlayEl.className=`${as}__play-button`,this.centerPlayEl.addEventListener("click",e=>{e.stopPropagation(),this.togglePlay()});const b=this.skipButton("+10",10);d.append(u,this.centerPlayEl,b);const p=document.createElement("div");p.className=`${as}__bottom-controls`,this.progressEl=document.createElement("div"),this.progressEl.className=`${as}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${as}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${as}__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 m=document.createElement("div");m.className=`${as}__controls`;const g=document.createElement("div");g.className=`${as}__left-controls`,this.togglePlayEl=this.iconButton("play",rs,()=>this.togglePlay()),this.volumeWrapEl=document.createElement("div"),this.volumeWrapEl.className=`${as}__volume`,this.muteButtonEl=this.iconButton("volume-up",rs,()=>this.toggleMute());const v=document.createElement("div");v.className=`${as}__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=`${as}__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=`${as}__right-controls`,this.fullscreenButtonEl=this.iconButton("expand",rs,()=>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,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",rs))}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,rs))}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),l=this.getBool("enable-fullscreen",!0);this.className=[as,`${as}--size-${e}`,`${as}--variant-${t}`,`${as}--theme-${s}`,this.isPlaying&&`${as}--playing`,!this.isPlaying&&`${as}--paused`,this.isMuted&&`${as}--muted`,this.isLoading&&`${as}--loading`,this.error&&`${as}--error`,i&&this.showControlsOverlay&&`${as}--show-controls`,this.isFullscreen&&`${as}--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",rs)),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"),l=document.createDocumentFragment();if(l.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),l.append(e)}this.replaceChildren(l)}}customElements.get("db-youtube-player")||customElements.define("db-youtube-player",DbYouTubePlayer);const ls="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=`${ls}__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=[ls,`${ls}--size-${e}`,`${ls}--variant-${t}`,`${ls}--theme-${s}`].join(" "),this.audioEl=document.createElement("audio"),this.audioEl.preload="metadata",this.audioEl.hidden=!0;const i=document.createElement("div");i.className=`${ls}__loading`;const n=document.createElement("div");n.className=`${ls}__spinner`,i.append(n);const a=document.createElement("div");a.className=`${ls}__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=`${ls}__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=`${ls}__main`;const u=document.createElement("div");u.className=`${ls}__info`,this.titleEl=document.createElement("div"),this.titleEl.className=`${ls}__title`,this.artistEl=document.createElement("div"),this.artistEl.className=`${ls}__artist`,this.albumEl=document.createElement("div"),this.albumEl.className=`${ls}__album`,u.append(this.titleEl,this.artistEl,this.albumEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${ls}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${ls}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${ls}__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=`${ls}__controls`;const p=document.createElement("div");p.className=`${ls}__left-controls`;const m=document.createElement("div");m.className=`${ls}__center-controls`;const g=document.createElement("div");g.className=`${ls}__right-controls`,this.playButtonEl=document.createElement("button"),this.playButtonEl.type="button",this.playButtonEl.className=`${ls}__play-button`,this.playButtonEl.addEventListener("click",()=>this.togglePlay()),m.append(this.playButtonEl),b.append(p,m,g);const v=document.createElement("div");v.className=`${ls}__bottom-controls`;const E=document.createElement("div");E.className=`${ls}__left-bottom`;const f=document.createElement("div");f.className=`${ls}__right-bottom`;const w=document.createElement("div");w.className=`${ls}__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=`${ls}__volume`;const C=this.iconButton(this.isMuted||0===this.volume?"mute-filled":"volume-up",()=>this.toggleMute());C.title=this.isMuted||0===this.volume?"음소거 해제":"음소거";const _=document.createElement("div");_.className=`${ls}__volume-slider`;const k=document.createElement("div");k.className="volume-label";const x=document.createElement("span");x.textContent="🔊";const S=document.createElement("span");k.append(x,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}),_.append(k,this.volumeInputEl),A.append(C,_);const N=document.createElement("div");N.className=`${ls}__settings`;const $=this.iconButton("settings",()=>{this.showSettingsMenu=!this.showSettingsMenu,this.updateSettingsMenu()});this.settingsMenuEl=document.createElement("div"),this.settingsMenuEl.className=`${ls}__settings-menu`,this.settingsMenuEl.hidden=!0;const I=document.createElement("div");I.className=`${ls}__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=`${ls}__playlist`,M.hidden=!0;const z=document.createElement("h4");z.textContent="플레이리스트",this.playlistTracksEl=document.createElement("div"),this.playlistTracksEl.className=`${ls}__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=C}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=`${ls}__playlist-track${t===this.playlistIndex?` ${ls}__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=`${ls}__playlist-track-info`;const n=document.createElement("div");n.className=`${ls}__playlist-track-title`,n.textContent=e.title||"Unknown Track";const a=document.createElement("div");a.className=`${ls}__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(`${ls}__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),l=this.getBool("show-settings",!1);this.className=[ls,`${ls}--size-${e}`,`${ls}--variant-${t}`,`${ls}--theme-${s}`,this.isPlaying&&`${ls}--playing`,!this.isPlaying&&`${ls}--paused`,this.isMuted&&`${ls}--muted`,this.isLoading&&`${ls}--loading`,this.error&&`${ls}--error`,this.isShuffle&&`${ls}--shuffle`,`${ls}--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(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 os=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,"&amp;").replace(/</g,"&lt;").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 l in a)if(a.hasOwnProperty(l)){if(l==t)for(var o in s)s.hasOwnProperty(o)&&(r[o]=s[o]);s.hasOwnProperty(l)||(r[l]=a[l])}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 l=e[r],o=n.util.type(l);"Object"!==o||i[a(l)]?"Array"!==o||i[a(l)]||(i[a(l)]=!0,DFS(l,t,r,i)):(i[a(l)]=!0,DFS(l,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 l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&n.util.setLanguage(l,a);var o={element:t,language:a,grammar:r,code:t.textContent};function insertHighlightedCode(e){o.highlightedCode=e,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&&e.Worker){var d=new Worker(n.filename);d.onmessage=function(e){insertHighlightedCode(e.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(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 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!==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,C=1;if(m){if(!(A=matchPattern(E,w,e,p))||A.index>=e.length)break;var _=A.index,k=A.index+A[0].length,x=w;for(x+=f.value.length;_>=x;)x+=(f=f.next).value.length;if(w=x-=f.value.length,f.value instanceof Token)continue;for(var S=f;S!==t.tail&&(x<k||"string"==typeof S.value);S=S.next)C++,x+=S.value.length;C--,y=e.slice(w,x),A.index-=w}else if(!(A=matchPattern(E,0,y,p)))continue;_=A.index;var N=A[0],$=y.slice(0,_),I=y.slice(_+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,C),f=addAfter(t,L,new Token(l,b?n.tokenize(N,b):N,g,N)),I&&addAfter(t,f,I),C>1){var M={cause:l+","+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 l in i.attributes)r+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,"&quot;")+'"';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:{});"undefined"!=typeof module&&module.exports&&(module.exports=os),"undefined"!=typeof global&&(global.Prism=os),os.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]},os.languages.markup.tag.inside["attr-value"].inside.entity=os.languages.markup.entity,os.languages.markup.doctype.inside["internal-subset"].inside=os.languages.markup,os.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Object.defineProperty(os.languages.markup.tag,"addInlined",{value:function addInlined(e,t){var s={};s["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:os.languages[t]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};i["language-"+t]={pattern:/[\s\S]+/,inside:os.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},os.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(os.languages.markup.tag,"addAttribute",{value:function(e,t){os.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:os.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),os.languages.html=os.languages.markup,os.languages.mathml=os.languages.markup,os.languages.svg=os.languages.markup,os.languages.xml=os.languages.extend("markup",{}),os.languages.ssml=os.languages.xml,os.languages.atom=os.languages.xml,os.languages.rss=os.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"))}(os),os.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:/[{}[\];(),.:]/},os.languages.javascript=os.languages.extend("clike",{"class-name":[os.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}|\?\?=?|\?\.?|[~:]/}),os.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,os.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:os.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:os.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:os.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:os.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:os.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),os.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:os.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"}}),os.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),os.languages.markup&&(os.languages.markup.tag.addInlined("script","javascript"),os.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")),os.languages.js=os.languages.javascript,function(){if(void 0!==os&&"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",s="loading",i="loaded",n="pre[data-src]:not(["+t+'="'+i+'"]):not(['+t+'="'+s+'"])';os.hooks.add("before-highlightall",function(e){e.selector+=", "+n}),os.hooks.add("before-sanity-check",function(a){var r=a.element;if(r.matches(n)){a.code="",r.setAttribute(t,s);var l=r.appendChild(document.createElement("CODE"));l.textContent="Loading…";var o=r.getAttribute("data-src"),d=a.language;if("none"===d){var u=(/\.(\w+)$/.exec(o)||[,"none"])[1];d=e[u]||u}os.util.setLanguage(l,d),os.util.setLanguage(r,d);var b=os.plugins.autoloader;b&&b.loadLanguages(d),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)}(o,function(e){r.setAttribute(t,i);var s=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]}}(r.getAttribute("data-range"));if(s){var n=e.split(/\r\n?|\n/g),a=s[0],o=null==s[1]?n.length:s[1];a<0&&(a+=n.length),a=Math.max(0,Math.min(a-1,n.length)),o<0&&(o+=n.length),o=Math.max(0,Math.min(o,n.length)),e=n.slice(a,o).join("\n"),r.hasAttribute("data-start")||r.setAttribute("data-start",String(a+1))}l.textContent=e,os.highlightElement(l)},function(e){r.setAttribute(t,"failed"),l.textContent=e})}}),os.plugins.fileHighlight={highlight:function highlight(e){for(var t,s=(e||document).querySelectorAll(n),i=0;t=s[i++];)os.highlightElement(t)}};var a=!1;os.fileHighlight=function(){a||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),a=!0),os.plugins.fileHighlight.highlight.apply(this,arguments)}}}();var ds=Object.freeze({__proto__:null});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(/&amp;/,"&"))}),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 cs={js:"javascript",ts:"typescript",sh:"bash",shell:"bash",html:"markup",xml:"markup",svg:"markup"},hs={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 cs[t]??t},formatLanguageLabel=e=>{const t=resolvePrismLanguage(e);return hs[t]??e.toUpperCase()},highlightWithPrism=(e,t)=>{const s=(()=>{const e=globalThis.Prism;return e?.languages?e:ds})(),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),us="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),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[t.id]??t.code:t.code,v=g.trim();let E=null;if(l&&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=[us,`${us}--overflow-${p}`,"auto"!==o&&`${us}--theme-${o}`,m&&`${us}--editable`].filter(Boolean).join(" ");const y=document.createElement("div");y.className=`${us}__toolbar`;const A=document.createElement("div");if(A.className=`${us}__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=`${us}__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 C=document.createElement("div");if(C.className=`${us}__body`,i&&t.description){const e=document.createElement("p");e.className=`${us}__caption`,e.textContent=t.description,C.append(e)}if(m){void 0===this.editedCodes[t.id]&&(this.editedCodes[t.id]=t.code);const e=document.createElement("div");e.className=`${us}__editor`;const s=document.createElement("pre");s.className=`${us}__pre ${us}__pre--mirror`,s.setAttribute("aria-hidden","true");const i=document.createElement("code");i.className=`${us}__code language-${a}`,E?i.innerHTML=E:i.textContent=g,s.append(i);const n=document.createElement("textarea");n.className=`${us}__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=l&&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),C.append(e)}else{const e=document.createElement("pre");e.className=`${us}__pre`;const t=document.createElement("code");t.className=`${us}__code language-${a}`,E?t.innerHTML=E:t.textContent=v,e.append(t),C.append(e)}this.replaceChildren(y,C)}}customElements.get("db-code-block")||customElements.define("db-code-block",DbCodeBlock);const bs="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=[bs,`${bs}--size-${e}`,`${bs}--variant-${t}`,`${bs}--mode-${this.currentMode}`,`${bs}--theme-${s}`,this.isFocused&&`${bs}--focused`,this.getBool("disabled")&&`${bs}--disabled`,this.getBool("readonly")&&`${bs}--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,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+t.length+(a?a.length:e.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 e=this.getBool("show-toolbar",!0);this.toolbarEl.hidden=!e,this.toolbarEl.replaceChildren();const t=document.createElement("div");t.className=`${bs}__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=`${bs}__mode-button${this.currentMode===e?` ${bs}__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=`${bs}__toolbar-separator`,this.toolbarEl.append(s),"code"!==this.currentMode&&(this.getDefaultToolbarActions().forEach(e=>{const t=document.createElement("button");if(t.type="button",t.className=`${bs}__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=`${bs}__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=`${bs}__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(`![${e.name}](${t})`)}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=`${bs}__toolbar`,this.contentEl=document.createElement("div"),this.contentEl.className=`${bs}__content`,this.editPanelEl=document.createElement("div"),this.editPanelEl.className=`${bs}__edit-panel`,this.textareaEl=document.createElement("textarea"),this.textareaEl.className=`${bs}__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=`${bs}__preview-panel`,this.previewEl=document.createElement("div"),this.previewEl.className=`${bs}__preview`,this.previewPanelEl.append(this.previewEl),this.codePanelEl=document.createElement("div"),this.codePanelEl.className=`${bs}__code-panel`,this.codeViewEl=document.createElement("pre"),this.codeViewEl.className=`${bs}__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=`${bs}__status`,this.wordCountEl=document.createElement("span"),this.wordCountEl.className=`${bs}__word-count`,this.lineCountEl=document.createElement("span"),this.lineCountEl.className=`${bs}__line-count`,this.lastSavedEl=document.createElement("span"),this.lastSavedEl.className=`${bs}__last-saved`,this.savingEl=document.createElement("span"),this.savingEl.className=`${bs}__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 ps="designbase-wc-testimonial",ms=["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=`${ps}__quote`,this.footerEl=document.createElement("div"),this.footerEl.className=`${ps}__footer`,this.avatarWrapEl=document.createElement("div"),this.avatarWrapEl.className=`${ps}__avatar`,this.avatarEl=document.createElement("db-avatar"),this.avatarEl.className=`${ps}__avatar-image`,this.avatarWrapEl.append(this.avatarEl);const e=document.createElement("div");e.className=`${ps}__meta`,this.authorEl=document.createElement("span"),this.authorEl.className=`${ps}__author`,this.roleEl=document.createElement("span"),this.roleEl.className=`${ps}__role`,this.ratingEl=document.createElement("db-rating"),this.ratingEl.className=`${ps}__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=`${ps}__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 ms.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"),l=Number(this.getAttribute("max-rating")||5),o=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),l):void 0,d=this.getVariant(),u=this.getAttribute("align")||"left",b=[ps,`${ps}--variant-${d}`,"left"!==u?`${ps}--align-${u}`:""].filter(Boolean).join(" ");this.className=b,this.innerEl&&(this.innerEl.className=`${ps}__inner`),this.quoteEl&&(this.quoteEl.textContent=e?`“${e}”`:""),this.authorEl&&(this.authorEl.textContent=t);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",`${t} 프로필 이미지`)),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 gs="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()}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=`${gs}__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=`${gs}__background-image`,this.backgroundImageEl.hidden=!0,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${gs}__overlay`,this.overlayEl.hidden=!0;const e=document.createElement("div");e.className=`${gs}__container`;const t=document.createElement("div");t.className=`${gs}__content`,this.titleEl=document.createElement("h1"),this.titleEl.className=`${gs}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${gs}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${gs}__description`,this.buttonsEl=document.createElement("div"),this.buttonsEl.className=`${gs}__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),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=[gs,`${gs}--variant-${l}`,`${gs}--theme-${o}`,`${gs}--alignment-${d}`,u&&`${gs}--animated`,b&&`${gs}--full-height`,f&&`${gs}--on-media`].filter(Boolean).join(" "),this.style.minHeight=p||"",this.style.maxHeight=m||"",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(`.${gs}__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=`${gs}__button-content`;const i=document.createElement("span");i.className=`${gs}__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 vs="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}}parseActions(){try{const e=JSON.parse(this.getAttribute("actions")||"[]");return Array.isArray(e)?e:[]}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=vs;const e=document.createElement("div");e.className=`${vs}__inner`;const t=document.createElement("div");t.className=`${vs}__content`,this.badgeEl=document.createElement("db-badge"),this.badgeEl.className=`${vs}__badge`,this.badgeEl.hidden=!0,this.headlineEl=document.createElement("h2"),this.headlineEl.className=`${vs}__headline`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${vs}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${vs}__description`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${vs}__actions`,t.append(this.badgeEl,this.headlineEl,this.subtitleEl,this.descriptionEl,this.actionsEl),this.mediaEl=document.createElement("div"),this.mediaEl.className=`${vs}__media`,this.imageEl=document.createElement("img"),this.imageEl.className=`${vs}__image`,this.mediaEl.append(this.imageEl),e.append(t,this.mediaEl),this.featureWrapEl.append(e),this.sectionEl.append(this.featureWrapEl),this.append(this.sectionEl)}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",l=this.getAttribute("size")||"l",o=this.hasAttribute("tinted"),d=this.parseBadge(),u=this.parseActions(),b=[vs,`${vs}--media-${a}`,`${vs}--padding-${r}`,o&&`${vs}--tinted`].filter(Boolean).join(" ");this.className=vs,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=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(),u.length>0?(u.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 Es="designbase-wc-app-badge",fs={"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=`${Es}__icon`,this.iconWrapEl.setAttribute("aria-hidden","true");const e=document.createElement("span");e.className=`${Es}__text`,this.labelEl=document.createElement("span"),this.labelEl.className=`${Es}__label`,this.storeEl=document.createElement("span"),this.storeEl.className=`${Es}__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=fs[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=[Es,`${Es}--${s}`,`${Es}--${i}`,`${Es}--${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 ws="designbase-wc-section-contact",ys="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:ys,href:`mailto:${ys}`}}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=ws,this.contactWrapEl=document.createElement("div"),this.contactWrapEl.className=`${ws}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${ws}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${ws}__description`,this.actionEl=document.createElement("db-button"),this.actionEl.className=`${ws}__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.contactWrapEl.append(this.titleEl,this.descriptionEl,this.actionEl),this.wrapEl.append(this.contactWrapEl),this.sectionEl.append(this.wrapEl),this.append(this.sectionEl)}updateUI(){const e=this.getAttribute("title")||"문의하기",t=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=[ws,`${ws}--${s}`,`${ws}--padding-${i}`,a&&`${ws}--accent`].filter(Boolean).join(" ");this.className=ws,this.wrapEl&&(this.wrapEl.className=l),this.contactWrapEl&&(this.contactWrapEl.className=`${ws}__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=e),this.descriptionEl&&(this.descriptionEl.textContent=t,this.descriptionEl.hidden=!t),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 As="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()}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.sectionEl=document.createElement("db-section"),this.sectionEl.setAttribute("no-padding",""),this.sectionEl.setAttribute("data-wc-internal",""),this.wrapEl=document.createElement("div"),this.wrapEl.className=As,this.innerEl=document.createElement("div"),this.innerEl.className=`${As}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${As}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${As}__description`,this.badgesEl=document.createElement("div"),this.badgesEl.className=`${As}__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 e=this.getAttribute("title")||"지금 바로 시작하세요",t=this.getAttribute("description")||"앱을 다운로드하고 바로 이용해 보세요.",s=this.getAttribute("align")||"center",i=this.getAttribute("size")||"l",n=this.parseStores(),a=[As,`${As}--${s}`].join(" ");this.className=As,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=e),this.descriptionEl&&(this.descriptionEl.textContent=t,this.descriptionEl.hidden=!t),this.badgesEl&&(this.badgesEl.replaceChildren(),n.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 Cs="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(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}catch{}const e=Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal"));return e.length>0?e.map(e=>e.textContent?.trim()||""):[]}build(){this.containerEl=document.createElement("div"),this.srOnlyEl=document.createElement("span"),this.srOnlyEl.className=`${Cs}__sr-only`,this.trackEl=document.createElement("div"),this.trackEl.className=`${Cs}__track`,this.baseGroupEl=document.createElement("div"),this.baseGroupEl.className=`${Cs}__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(e=>{e.removeEventListener("load",this.boundMeasure),e.removeEventListener("error",this.boundMeasure)})}bindImageListeners(){this.baseGroupEl&&(this.unbindImageListeners(),this.baseGroupEl.querySelectorAll("img").forEach(e=>{e.complete||(e.addEventListener("load",this.boundMeasure),e.addEventListener("error",this.boundMeasure))}))}renderItem(e){const t=document.createElement("div");return t.className=`${Cs}__item`,t.textContent=e,t}renderGroup(e,t){const s=t??document.createElement("div");return s.className=`${Cs}__group`,s.setAttribute("aria-hidden","true"),s.replaceChildren(...e.map(e=>this.renderItem(e))),s}renderDuplicates(){if(!this.trackEl||!this.baseGroupEl)return;const e=this.parseItems();this.renderGroup(e,this.baseGroupEl);const t=this.baseGroupWidth>0?Math.max(1,Math.ceil(this.containerWidth/this.baseGroupWidth)):1,s=[];for(let i=0;i<t;i+=1)s.push(this.renderGroup(e));this.trackEl.replaceChildren(this.baseGroupEl,...s)}syncReadyState(){this.containerEl&&this.containerEl.classList.toggle(`${Cs}--ready`,this.baseGroupWidth>0)}updateUI(){const e=this.parseItems();if(0===e.length)return void(this.hidden=!0);this.hidden=!1;const t=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=[Cs,`${Cs}--size-${a}`,`${Cs}--variant-${r}`,`${Cs}--align-${l}`,m&&`${Cs}--pause-on-hover`,o&&`${Cs}--fade-edges`,"right"===t&&`${Cs}--right`,g&&`${Cs}--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=e.join(" • ")||v),this.renderDuplicates(),this.measure()}}customElements.get("db-marquee")||customElements.define("db-marquee",DbMarquee);const _s="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)}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"),l=this.getBool("full-height");this.className=[_s,`${_s}--size-${s}`,`${_s}--variant-${i}`,`${_s}--direction-${t}`,r&&`${_s}--full-width`,l&&`${_s}--full-height`].filter(Boolean).join(" ");let o={};o="animated"===i?this.generateAnimatedStyle(e,t,n,a):"mesh"===i?this.generateMeshStyle(e):this.generateGradientStyle(e,t),Object.assign(this.style,o)}}customElements.get("db-gradient")||customElements.define("db-gradient",DbGradient);const ks={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 xs="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=`${xs}__background`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${xs}__overlay`,this.contentEl=document.createElement("div"),this.contentEl.className=`${xs}__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=ks[e][t],l=Math.min(6,Math.max(3,s)),o=[];for(let e=0;e<l;e+=1)o.push(r[Math.floor(Math.random()*r.length)]);const d=Array.from({length:l},()=>100*Math.random()).sort((e,t)=>e-t),u=o.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=[xs,r&&`${xs}--animated`,n&&`${xs}--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=ks[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 Ss="designbase-wc-ad-banner",Ns={hero:"지금 바로 시작하세요",topbar:"🎉 신규 가입 시 10,000원 적립금 증정!",card:"프리미엄 멤버십",floating:"오늘만 특가!"},$s={hero:"최대 50% 할인된 가격으로 프리미엄 서비스를 경험해보세요. 기간 한정 특별 혜택!",topbar:"오늘 하루만 특별 혜택",card:"무제한 서비스 이용권을 특별가에 만나보세요",floating:"장바구니에 담긴 상품 추가 20% 할인"},Is={hero:"자세히 보기",topbar:"지금 가입하기",card:"알아보기",floating:"할인받기"},Ds={hero:"star",topbar:"trending-up",card:"star-filled",floating:"cart"},Ls={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(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"}build(){this.rootEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.contentEl.className=`${Ss}__content`,this.closeBtn=document.createElement("button"),this.closeBtn.type="button",this.closeBtn.className=`${Ss}__close`,this.closeBtn.setAttribute("aria-label","닫기"),this.closeBtn.append(createDbIcon("close",20)),this.closeBtn.addEventListener("click",()=>this.handleClose());const e=document.createElement("div");e.className=`${Ss}__main`,this.iconEl=document.createElement("div"),this.iconEl.className=`${Ss}__icon`,this.labelEl=document.createElement("span"),this.labelEl.className=`${Ss}__label`,this.labelEl.textContent="특별 이벤트",this.badgeEl=document.createElement("span"),this.badgeEl.className=`${Ss}__badge`,this.badgeEl.textContent="HOT DEAL",this.titleEl=document.createElement("h2"),this.titleEl.className=`${Ss}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${Ss}__subtitle`;const t=document.createElement("div");t.className=`${Ss}__text`,this.countdownWrapEl=document.createElement("div"),this.countdownWrapEl.className=`${Ss}__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),t.append(this.titleEl,this.subtitleEl,this.countdownWrapEl),this.actionsEl=document.createElement("div"),this.actionsEl.className=`${Ss}__actions`,this.ctaEl=document.createElement("db-button"),this.ctaEl.className=`${Ss}__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(this.iconEl,t,this.actionsEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${Ss}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${Ss}__progress-bar`,this.progressEl.append(this.progressBarEl),this.contentEl.append(this.closeBtn,e,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(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)}renderGradientWrapper(e){this.rootEl&&this.contentEl&&(e?(this.gradientEl||(this.gradientEl=document.createElement("db-random-gradient"),this.gradientEl.className=`${Ss}__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 e=this.getType(),t=this.getVariant(),s=this.getAttribute("title")||Ns[e],i=this.getAttribute("subtitle")||$s[e],n=this.getAttribute("cta-text")||Is[e],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=[Ss,`${Ss}--type-${e}`,`${Ss}--variant-${t}`,a&&`${Ss}--auto-close`,l&&`${Ss}--with-gradient`,l&&"light"===o&&`${Ss}--gradient-light`].filter(Boolean).join(" ")),l&&this.gradientEl&&(this.gradientEl.setAttribute("scheme",this.getAttribute("gradient-scheme")||Ls[t]),this.gradientEl.setAttribute("tone",o),this.gradientEl.setAttribute("animated",d?"true":"false")),this.renderGradientWrapper(l),this.iconEl&&(this.iconEl.replaceChildren(createDbIcon(Ds[e],"card"===e?32:"floating"===e?28:24)),this.labelEl&&this.iconEl.append(this.labelEl),this.badgeEl&&this.iconEl.append(this.badgeEl),this.labelEl&&(this.labelEl.hidden="topbar"!==e),this.badgeEl&&(this.badgeEl.hidden="floating"!==e)),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"===e?"l":"card"===e?"s":"m"),"floating"===e?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 Ms="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=[Ms,`${Ms}--${e}`,`${Ms}--${t}`,`${Ms}--${s}`,n&&`${Ms}--clickable`,this.hasAttribute("full-width")&&`${Ms}--full-width`,a&&`${Ms}--disabled`].filter(Boolean).join(" "),this.replaceChildren();const l=document.createElement("div");l.className=`${Ms}__container`,r.forEach((e,o)=>{const d=this.getItemPosition(o),u=o===r.length-1,b=n&&!a&&!e.disabled,p=e.color||i,m=e.status||"pending",g=document.createElement("div");g.className=[`${Ms}__item`,`${Ms}__item--${d}`,`${Ms}__item--${p}`,b&&`${Ms}__item--clickable`,e.disabled&&`${Ms}__item--disabled`].filter(Boolean).join(" ");const v=document.createElement("div");if(v.className=`${Ms}__indicator-container`,"active"===m&&!e.icon&&void 0===e.number){const e=document.createElement("div");e.className=`${Ms}__pulse`,v.append(e)}const E=document.createElement("div");if(E.className=[`${Ms}__dot`,`${Ms}__dot--${p}`,`${Ms}__dot--${t}`,`${Ms}__dot--${m}`,b&&`${Ms}__dot--clickable`,e.icon&&`${Ms}__dot--with-icon`,void 0!==e.number&&!e.icon&&`${Ms}__dot--with-number`].filter(Boolean).join(" "),b&&(E.tabIndex=0,E.setAttribute("role","button"),E.setAttribute("aria-label",e.title?`${e.title} 타임라인 점`:`타임라인 점 ${o+1}`),E.addEventListener("click",()=>this.handleItemClick(e,o)),E.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleItemClick(e,o))})),e.icon&&isDbIconName(e.icon)){const t=document.createElement("div");t.className=`${Ms}__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=`${Ms}__number`,t.textContent=String(e.number),E.append(t)}if(v.append(E),!u){const e=document.createElement("div");e.className=`${Ms}__connector`,v.append(e)}const f=document.createElement("div");if(f.className=[`${Ms}__content`,`${Ms}__content--${d}`].join(" "),e.timestamp){const t=document.createElement("div");t.className=`${Ms}__timestamp`,t.textContent=e.timestamp,f.append(t)}const w=document.createElement("div");if(w.className=`${Ms}__content-inner`,b&&(w.tabIndex=0,w.setAttribute("role","button"),w.setAttribute("aria-label",e.title?`${e.title} 타임라인 아이템`:`타임라인 아이템 ${o+1}`),w.addEventListener("click",()=>this.handleItemClick(e,o)),w.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleItemClick(e,o))})),e.title){const t=document.createElement("h3");t.className=`${Ms}__title`,t.textContent=e.title,w.append(t)}if(e.description){const t=document.createElement("p");t.className=`${Ms}__description`,t.textContent=e.description,w.append(t)}f.append(w),g.append(v,f),l.append(g)}),this.append(l)}}customElements.get("db-timeline")||customElements.define("db-timeline",DbTimeline);const zs="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 e=this.getAttribute("type")||"fade";return["typing","fade","slide","bounce","shake","glow","gradient","wave","flip","scale","decode"].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")||(this.isVisible=!0,this.startAnimation(),this.syncClasses())}),this.addEventListener("mouseleave",()=>{if("hover"!==this.getTrigger())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(","),l=(this.getAttribute("wave-colors")||"#ff6b6b,#4ecdc4,#45b7d1,#96ceb4,#feca57").split(","),o=this.getAttribute("glow-color")||"#667eea";this.className=[zs,"typing"!==t&&`${zs}--${t}`,`${zs}--${this.getAttribute("size")||"m"}`,`${zs}--${this.getAttribute("color")||"primary"}`,`${zs}--${this.getAttribute("weight")||"normal"}`,`${zs}--${this.getAttribute("align")||"left"}`,`${zs}--${this.getAttribute("direction")||"left"}`,this.isVisible&&`${zs}--visible`,this.isAnimating&&`${zs}--animating`,(this.hasAttribute("clickable")||"click"===s)&&`${zs}--clickable`,this.hasAttribute("disabled")&&`${zs}--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"===t&&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"!==t&&"decode"!==t||"mount"!==s||this.isAnimating?this.isAnimating||(this.displayText=e):this.displayText="",this.ghostEl&&(this.ghostEl.textContent=e,this.ghostEl.style.whiteSpace="typing"===t?"pre-wrap":""),this.layerEl&&(this.layerEl.className=["typing"===t&&`${zs}--typing`,this.isAnimating&&"typing"===t&&`${zs}--animating`].filter(Boolean).join(" "),this.layerEl.style.width="typing"===t?"auto":"100%",this.layerEl.style.height="100%",this.layerEl.style.whiteSpace="typing"===t?"pre-wrap":""),this.renderLayer()}syncClasses(){this.classList.toggle(`${zs}--visible`,this.isVisible),this.classList.toggle(`${zs}--animating`,this.isAnimating)}setupTrigger(){this.clearTimers(),this.observer?.disconnect();const e=this.getTrigger(),t=Number(this.getAttribute("delay")||0);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))}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);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;"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}))}}customElements.get("db-animation-text")||customElements.define("db-animation-text",DbAnimationText);const Ts="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())}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=Ts,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=`${Ts}__overlay`,this.overlayEl.addEventListener("click",()=>this.handleEnd()),this.popoverEl=document.createElement("div"),this.popoverEl.className=`${Ts}__popover`,this.closeButtonEl=document.createElement("button"),this.closeButtonEl.type="button",this.closeButtonEl.className=`${Ts}__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=`${Ts}__content`;const t=document.createElement("div");t.className=`${Ts}__text`,this.titleEl=document.createElement("h3"),this.titleEl.id="tutorial-title",this.titleEl.className=`${Ts}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.id="tutorial-content",this.descriptionEl.className=`${Ts}__description`,t.append(this.titleEl,this.descriptionEl);const s=document.createElement("div");s.className=`${Ts}__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(`${Ts}__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(`${Ts}__target`);const s=t.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,a=300,r=200,l=16;let o="auto"!==e.step.placement&&e.step.placement?e.step.placement:"bottom",d=s.bottom+l,u=s.left+s.width/2-150;if("auto"===e.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=[`${Ts}__popover`,`${Ts}__popover--${o}`].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 Bs=["plasma","mesh-flow","fluid","radiant","ethereal"];function toLuminaSpeed(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 Ps=["#0d0221","#5b21b6","#db2777","#38bdf8","#e9d5ff"],Fs=[{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 Os=["#ffffff","#f0f9ff","#e0f2fe"],Hs=["#ffb7c5","#ff91a4","#f8c8dc","#ffc0cb","#fda4af"],Vs=["#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=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(t,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(t,s,o)),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},Rs=["snow","flowers","confetti"];class CanvasAnimationController{constructor(e,t){this.options=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:l,particleSize:o,starCount:d,starSize:u,clickable:b,wind:p,layerOpacity:m}=this.options;e.clearRect(0,0,s,i);const g=this.frameCount*(3e3/(r||3e3));switch(this.frameCount+=1,n){case"particles":((e,t,s,i,n)=>{i.current.length!==n.count&&(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)]})));const a=i.current;a.forEach((i,r)=>{if(i.x+=i.vx,i.y+=i.vy,(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.beginPath(),e.arc(i.x,i.y,i.size,0,2*Math.PI),e.fillStyle=i.color,e.fill();for(let t=r+1;t<a.length;t++){const s=a[t],n=i.x-s.x,r=i.y-s.y,l=Math.sqrt(n*n+r*r);l<100&&(e.beginPath(),e.strokeStyle=i.color,e.globalAlpha=1-l/100,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:l,colors:a,size:o,mouse:this.mouse,clickable:b});break;case"stars":((e,t,s,i,n)=>{i.current.length!==n.count&&(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.current.forEach(t=>{t.y-=.05,t.y<0&&(t.y=s);const i=.5+.5*Math.sin(n.time*t.blinkSpeed);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:g});break;case"snow":case"flowers":case"confetti":(function isFallingType(e){return Rs.includes(e)})(n)&&drawFallingParticles(e,s,i,this.fallingRef,n,{count:l,colors:a,size:o,speed:r,wind:p,layerOpacity:m})}this.raf=requestAnimationFrame(this.tick)},this.container=e,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__canvas",e.appendChild(this.canvas),this.onResize=()=>this.resize(),this.onMouseMove=s=>{if("particles"!==t.type)return;const i=e.getBoundingClientRect();this.mouse={x:s.clientX-i.left,y:s.clientY-i.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()}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(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.options=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:l,variant:o}=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"),p=e.getUniformLocation(t,"uResolution"),m=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(p,d,u);const y=padColors(i),A=toLuminaSpeed(n),C=function toLuminaSoftness(e){return Math.min(1,e/200)}(a),_=.6*A,k=function clampZoom(e){return Math.min(4,Math.max(.25,e))}(l),x=(performance.now()-this.startTime)/1e3;"mesh-flow"===o?(m&&e.uniform1f(m,x),v&&e.uniform1f(v,_),E&&e.uniform1f(E,C)):(m&&e.uniform1f(m,x*A),E&&e.uniform1f(E,C),f&&e.uniform1f(f,r),"fluid"===o&&w&&e.uniform1f(w,k));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.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__shader-canvas",e.appendChild(this.canvas),this.init()}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 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"}}(t),i=e.createProgram();if(!i)return;const n=loadShader(e,e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main() {\n gl_Position = aVertexPosition;\n }\n"),a=loadShader(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 Ws="designbase-wc-animation-background";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 resolveColors(e){const{type:t,preset:s,colors:i}=e;if(s)return function getLuminaPresetColors(e){const t=Fs.find(t=>t.id===e);return t?.colors??Fs[0].colors}(s);if("fluid"===t&&i.length<5)return Ps;if("snow"===t||"flowers"===t||"confetti"===t){const e=function getFallingParticleDefaults(e){switch(e){case"snow":default:return Os;case"flowers":return Hs;case"confetti":return Vs}}(t);return 3===i.length&&"#667eea"===i[0]&&"#764ba2"===i[1]?e:i}return i}function createLuminaOverlays(e,t){const s=document.createDocumentFragment();if(e>0){const t=document.createElement("div");t.className=`${Ws}__lumina-noise`,t.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\")",t.style.opacity=String(e),s.appendChild(t)}if(t){const e=document.createElement("div");e.className=`${Ws}__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=`${Ws}__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()};break}case"aurora":e.appendChild(function createMeshAuroraLayer(e,t,s,i,n){const a=document.createElement("div");a.className=`${Ws}__aurora-mesh`;const r="subtle"===i?.3:"medium"===i?.6:.8,l=Math.max(5,t/1e3),o=e.length>=3?e:["#4f46e5","#ec4899","#06b6d4","#8b5cf6"],d="dark"===n?"screen":"multiply",u=`blur(${s}px)`,b=`${Ws}__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(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 m=document.createElement("div");return m.className=`${Ws}__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,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=`${Ws}__plasma`;const n=Math.random().toString(36).slice(2,11),a=padColors(e),c=e=>a[e%a.length],r=60/toLuminaSpeed(t),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=`${Ws}__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:`${Ws}__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:`${Ws}__plasma-blob--accent`,filter:`blur(${s}px)`,opacity:"0.6"}].forEach(e=>{const t=document.createElement("div");t.className=`${Ws}__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=`${Ws}__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()};break}case"gradient":e.appendChild(function createGradientLayer(e,t,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=`${Ws}__css-layer`;const r=(t.length>0?t:["#ccc"]).join(", ");let l="90deg",o="";switch(e){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}(t.direction,s,t.speed))}return i}function applyContainerStyles(e,t){const s=function isLuminaType(e){return Bs.includes(e)}(t.type)?"#000000":"dark"===t.theme?"var(--db-surface-base, #0f172a)":"var(--db-surface-base, #ffffff)";e.style.position="relative",e.style.overflow="hidden","gradient"!==t.type?e.style.backgroundColor=s:e.style.backgroundColor=""}function getEffectiveGridColor(e){return e.gridColor??("dark"===e.theme?"#ffffff":"#000000")}const qs=Ws;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(e){if(!e)return;const t=Number(e);return Number.isFinite(t)?`${t}px`:e}render(){const e=function parseAnimationBackgroundConfig(e){return{type:e.getAttribute("type")||"gradient",theme:"light"===e.getAttribute("theme")?"light":"dark",intensity:e.getAttribute("intensity")||"subtle",blur:Number(e.getAttribute("blur")||80),speed:Number(e.getAttribute("speed")||3e3),direction:e.getAttribute("direction")||"left",colors:parseColors(e.getAttribute("colors"),["#667eea","#764ba2","#f093fb"]),opacity:Number(e.getAttribute("opacity")||1),particleCount:Number(e.getAttribute("particle-count")||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),showGrid:e.hasAttribute("show-grid")&&"false"!==e.getAttribute("show-grid"),gridSize:Number(e.getAttribute("grid-size")||40),gridColor:e.getAttribute("grid-color")||void 0,gridOpacity:Number(e.getAttribute("grid-opacity")||.1),noise:Number(e.getAttribute("noise")||.05),showVignette:!e.hasAttribute("show-vignette")||"false"!==e.getAttribute("show-vignette"),preset:e.getAttribute("preset")||void 0,zoom:Number(e.getAttribute("zoom")||1),disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")}}(this);this.className=[qs,`${qs}--${e.type}`,e.clickable&&!e.disabled&&`${qs}--clickable`,e.disabled&&`${qs}--disabled`].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=String(e.opacity);const n=this.getAttribute("blend-mode");if(n&&(this.style.mixBlendMode=n),!this.layersEl){this.layersEl=document.createElement("div"),this.layersEl.className=`${qs}__layers`,Object.assign(this.layersEl.style,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"0"}),this.contentEl=document.createElement("div"),this.contentEl.className=`${qs}__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.teardownLayers();const a=this.querySelector(`.${qs}__grid-overlay`);if(a?.remove(),this.layerHandle=mountAnimationLayers(this.layersEl,e),e.showGrid&&!e.disabled){const t=document.createElement("div");t.className=`${qs}__grid-overlay`,Object.assign(t.style,{position:"absolute",inset:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1",backgroundImage:`linear-gradient(to right, ${getEffectiveGridColor(e)} 1px, transparent 1px), linear-gradient(to bottom, ${getEffectiveGridColor(e)} 1px, transparent 1px)`,backgroundSize:`${e.gridSize}px ${e.gridSize}px`,opacity:String(e.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(t,this.contentEl??null)}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))}}customElements.get("db-animation-background")||customElements.define("db-animation-background",DbAnimationBackground);const js="designbase-wc-cursor-follower",Us="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.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 e=document.createElement("slot");this.scopeEl.appendChild(e),this.appendChild(this.scopeEl)}}isInScope(e){return!!e&&(!this.isScoped||!this.scopeEl||this.scopeEl.contains(e))}mountLayer(){this.teardownLayer(),this.ensureScope();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(Us),this.portalRoot=document.createElement("div"),this.portalRoot.className=js,this.portalRoot.setAttribute("aria-hidden","true"),this.pillEl=document.createElement("div"),this.pillEl.className=`${js}__pill`,this.labelEl=document.createElement("span"),this.labelEl.textContent=e,this.pillEl.appendChild(this.labelEl),a&&(this.iconEl=document.createElement("span"),this.iconEl.className=`${js}__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(`${js}__pill--visible`)):this.pillEl?.classList.remove(`${js}__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(Us),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 Ks="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=`${Ks}__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 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 e=document.createElement("div");return e.className=`${Ks}__fallback`,e.textContent="src 또는 animation-data 속성이 필요합니다.",void this.container.appendChild(e)}const u=await import("./chunks/lottie-eed75107.js"),b=u.default??u;e===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=new Set(["children","className","style","ref","key"]),Gs={activeIndex:"active-index",allowMultiple:"allow-multiple",boundaryCount:"boundary-count",breadcrumbStyle:"breadcrumb-style",badgeColor:"badge-color",characterCountPosition:"character-count-position",closeOnEscape:"close-on-escape",closeOnBackdrop:"close-on-backdrop",closeOnOverlayClick:"close-on-backdrop",confirmDisabled:"confirm-disabled",cancelDisabled:"cancel-disabled",confirmVariant:"confirm-variant",confirmText:"confirm-text",cancelText:"cancel-text",currentPage:"current-page",initialFocus:"initial-focus",indicatorType:"indicator-type",showClose:"show-close",showProgress:"show-progress",autoRemove:"auto-remove",autoRoll:"auto-roll",alwaysShow:"always-show",animationDuration:"animation-duration",backgroundColor:"background-color",blurAmount:"blur-amount",closeOnBackdropClick:"close-on-backdrop-click",closeOnOutsideClick:"close-on-outside-click",disableBackdropClick:"disable-backdrop-click",disableEscapeKeyDown:"disable-escape-key-down",drawerId:"drawer-id",defaultSelectedTabId:"default-selected-tab-id",showBackButton:"show-back-button",backFallbackHref:"back-fallback-href",backLabel:"back-label",defaultExpanded:"default-expanded",noPadding:"no-padding",fullHeight:"full-height",overflowVisible:"overflow-visible",disableDrag:"disable-drag",showCloseButton:"show-close-button",showIndicator:"show-indicator",currentStep:"current-step",showFileList:"show-file-list",splitterSize:"splitter-size",splitterColor:"splitter-color",splitterHoverColor:"splitter-hover-color",showBackdrop:"show-backdrop",backdropBlur:"backdrop-blur",backdropOpacity:"backdrop-opacity",stickyHeader:"sticky-header",stickyFooter:"sticky-footer",scrollbarStyle:"scrollbar-style",alwaysShowScrollbar:"always-show-scrollbar",scrollbarColor:"scrollbar-color",scrollbarTrackColor:"scrollbar-track-color",showIcon:"show-icon",showButton:"show-button",maxSize:"max-size",dragOver:"drag-over",defaultSegmentValue:"default-segment-value",headerVariant:"header-variant",navSize:"nav-size",overlayClosable:"overlay-closable",showOverlay:"show-overlay",trapFocus:"trap-focus",triggerId:"trigger-id",triggerVariant:"trigger-variant",triggerIcon:"trigger-icon",targetId:"target-id",toastId:"toast-id",showCountBadge:"show-count-badge",multiSelect:"multi-select",selectedRows:"selected-rows",rowKey:"row-key",emptyMessage:"empty-message",emptyStateMessage:"empty-state-message",enableRecentSearches:"enable-recent-searches",recentSearchesKey:"recent-searches-key",recentSearchesLayout:"recent-searches-layout",searchResults:"search-results",selectedCategory:"selected-category",suggestedSearches:"suggested-searches",suggestionRollingInterval:"suggestion-rolling-interval",sortColumn:"sort-column",sortDirection:"sort-direction",pageSize:"page-size",pageSizeOptions:"page-size-options",showPageSizeSelector:"show-page-size-selector",showTotal:"show-total",totalItems:"total-items",badgeMaxCount:"badge-max-count",badgeVariant:"badge-variant",badgeStyle:"badge-style",badgeText:"badge-text",defaultCurrent:"default-current",defaultPlaying:"default-playing",defaultValue:"default-value",minuteStep:"minute-step",startOfWeek:"start-of-week",showOutsideDays:"show-outside-days",highlightWeekends:"highlight-weekends",highlightToday:"highlight-today",showWeekends:"show-weekends",currentDate:"current-date",dropdownPosition:"dropdown-position",defaultItemType:"default-item-type",endIcon:"end-icon",errorMessage:"error-message",expandedItems:"expanded-items",fullWidth:"full-width",helperText:"helper-text",iconOnly:"icon-only",isOpen:"open",loadingText:"loading-text",loadingCount:"loading-count",maxLength:"max-length",maxItems:"max-items",menuStyle:"menu-style",passwordMinLength:"password-min-length",scrubStep:"scrub-step",scrubSensitivity:"scrub-sensitivity",playbackDisabled:"playback-disabled",readOnly:"readonly",selectedTabId:"selected-tab-id",segmentFullWidth:"segment-full-width",segmentValue:"segment-value",shareTitle:"share-title",buttonText:"button-text",modalTitle:"modal-title",imageUrl:"image-url",showQrCode:"show-qr-code",qrCodeSize:"qr-code-size",copySuccessMessage:"copy-success-message",selectedItems:"selected-items",showArrow:"show-arrow",showBadge:"show-badge",showCharacterCount:"show-character-count",showClearButton:"show-clear-button",showDescription:"show-description",showFirstLast:"show-first-last",showPreviousNext:"show-previous-next",showShortcut:"show-shortcut",siblingCount:"sibling-count",shortcutLabel:"shortcut-label",startIcon:"start-icon",subItems:"sub-items",timerDuration:"timer-duration",totalPages:"total-pages",validateOnBlur:"validate-on-blur",validationVisibility:"validation-visibility",videoId:"video-id"},Ys=new Set(["show-clear-button","closable","show-icon","show-close","show-progress","fixed"]);function toKebabCase(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function isEventProp(e,t){return Boolean(function eventPropToName(e,t){if(t[e])return t[e];if(!/^on[A-Z]/.test(e))return;const s=e.slice(2);return s.startsWith("Db")?`db-${toKebabCase(s.slice(2)).replace(/^-/,"")}`:void 0}(e,t))}function shouldRenderThroughReact(e){return"className"===e||"style"===e||"id"===e||"slot"===e||"title"===e||"role"===e||"tabIndex"===e||e.startsWith("aria-")||e.startsWith("data-")}function hasWritableProperty(e,t){let s=e;for(;s;){const e=Object.getOwnPropertyDescriptor(s,t);if(e)return Boolean(e.set);s=Object.getPrototypeOf(s)}return!1}function setElementProperty(e,t,s){if(hasWritableProperty(e,t))try{e[t]=s}catch{}}function extractTextChildren(e){if(null!=e&&"boolean"!=typeof e){if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e)){const t=e.map(e=>extractTextChildren(e)).filter(e=>void 0!==e);return t.length>0?t.join(""):void 0}}}function applyProp(e,t,s){const i=function toAttributeName(e){return Gs[e]||toKebabCase(e)}(t);if(null==s){if(!e.hasAttribute(i)){if(!(t in e))return;try{const s=e[t];if(!1===s||null==s)return}catch{}}return e.removeAttribute(i),void setElementProperty(e,t,!1)}if(!1===s){if(Ys.has(i)){if("false"===e.getAttribute(i))return;return e.setAttribute(i,"false"),void setElementProperty(e,t,!1)}if(!e.hasAttribute(i)){if(!(t in e))return;try{const s=e[t];if(!1===s||null==s)return}catch{}}return e.removeAttribute(i),void setElementProperty(e,t,!1)}if(!0===s){if(e.hasAttribute(i))return;return e.setAttribute(i,""),void setElementProperty(e,t,!0)}if("object"==typeof s){if(hasWritableProperty(e,t)){if(e[t]===s)return;setElementProperty(e,t,s)}else{const t=JSON.stringify(s);if(e.getAttribute(i)===t)return;e.setAttribute(i,t)}return}const n=String(s);if(e.getAttribute(i)!==n){if(t in e){if(e[t]===s)return}e.setAttribute(i,n),setElementProperty(e,t,s)}}function createWebComponent(r,l){const o=t((t,o)=>{const d=s(null),{className:u,style:b}=t,p=t.children,m=l.childrenAs?extractTextChildren(p):void 0,g=l.events||{},v={className:u,style:b},E=s(t);E.current=t;const f=i(()=>JSON.stringify({props:Object.entries(t).filter(([e,t])=>!Js.has(e)&&!isEventProp(e,g)&&!shouldRenderThroughReact(e)&&"function"!=typeof t).sort(([e],[t])=>e.localeCompare(t)),childText:l.childrenAs?m??null:void 0}),[m,g,t]);return Object.entries(t).forEach(([e,t])=>{Js.has(e)||isEventProp(e,g)||!shouldRenderThroughReact(e)||(v[e]=t)}),n(o,()=>d.current,[]),a(()=>{const e=d.current;if(e&&(Object.entries(E.current).forEach(([t,s])=>{Js.has(t)||isEventProp(t,g)||shouldRenderThroughReact(t)||applyProp(e,t,s)}),l.childrenAs)){const t=E.current[l.childrenAs],s=null!=t?String(t):m;applyProp(e,l.childrenAs,void 0!==s?s:void 0)}},[f,m,g]),a(()=>{const e=d.current;if(!e)return;const t=[];return Object.entries(g).forEach(([s,i])=>{const listener=e=>{const t=E.current[s];"function"==typeof t&&function invokeEventHandler(e,t){if(!(t instanceof CustomEvent))return void e(t);const s=t.detail;if(null===s||"object"!=typeof s||!("value"in s))return void e(t);const i=s.value,n=t.target;e(n&&"object"==typeof n&&"value"in n?t:{...t,detail:s,target:{...n&&"object"==typeof n?n:{},value:i}})}(t,e)};e.addEventListener(i,listener),t.push(()=>e.removeEventListener(i,listener))}),()=>t.forEach(e=>e())},[g]),e.createElement(r,{...v,ref:d},l.childrenAs?void 0:p)});return o.displayName=l.displayName,o}function ModalHeader({className:e="",children:t,...s}){return r("div",{className:`designbase-wc-modal__header ${e}`.trim(),"data-modal-part":"header",...s},t)}function ModalBody({className:e="",children:t,...s}){return r("div",{className:`designbase-wc-modal__body ${e}`.trim(),"data-modal-part":"body",...s},t)}function ModalFooter({className:e="",children:t,...s}){return r("div",{className:`designbase-wc-modal__footer ${e}`.trim(),"data-modal-part":"footer",...s},t)}function useContextMenu(){const[e,t]=l(!1),[s,i]=l({x:0,y:0}),n=o(e=>{e.preventDefault(),e.stopPropagation(),i({x:e.clientX,y:e.clientY}),t(!0)},[]),a=o(()=>{t(!1)},[]),r=o((e,s)=>{i({x:e,y:s}),t(!0)},[]);return{isOpen:e,x:s.x,y:s.y,handleContextMenu:n,handleClose:a,handleOpen:r}}const Xs=createWebComponent("db-accordion",{displayName:"Accordion",events:{onChange:"db-change",onItemChange:"db-change",onDbChange:"db-change"}}),Zs=createWebComponent("db-alert",{displayName:"Alert",childrenAs:"message",events:{onClose:"db-close",onAction:"db-action",onDbClose:"db-close",onDbAction:"db-action"}}),Qs=createWebComponent("db-avatar",{displayName:"Avatar",events:{onClick:"db-click",onDbClick:"db-click"}}),ei=createWebComponent("db-backdrop",{displayName:"Backdrop",events:{onClick:"db-click",onClose:"db-close",onDbClick:"db-click",onDbClose:"db-close"}}),ti=createWebComponent("db-badge",{displayName:"Badge"}),si=createWebComponent("db-banner",{displayName:"Banner",events:{onAction:"db-action",onDbAction:"db-action"}}),ii=createWebComponent("db-breadcrumbs",{displayName:"Breadcrumbs",events:{onItemClick:"db-click",onClick:"db-click",onDbClick:"db-click"}}),ni=createWebComponent("db-button",{displayName:"Button",events:{onPress:"db-click"}}),ai=createWebComponent("db-card",{displayName:"Card",events:{onClick:"db-click",onSelect:"db-select",onDbClick:"db-click",onDbSelect:"db-select"}}),ri=createWebComponent("db-checkbox",{displayName:"Checkbox",events:{onChange:"db-change",onDbChange:"db-change"}}),li=createWebComponent("db-chip",{displayName:"Chip",events:{onDelete:"db-delete",onDismiss:"db-delete",onClick:"db-click",onDbDelete:"db-delete",onDbClick:"db-click"}}),oi=createWebComponent("db-confirm",{displayName:"Confirm",childrenAs:"message",events:{onConfirm:"db-confirm",onCancel:"db-cancel",onClose:"db-close",onDbConfirm:"db-confirm",onDbCancel:"db-cancel",onDbClose:"db-close"}}),di=createWebComponent("db-container",{displayName:"Container"}),ci=createWebComponent("db-context-menu",{displayName:"ContextMenu",events:{onOpen:"db-open",onClose:"db-close",onSelect:"db-select",onDbOpen:"db-open",onDbClose:"db-close",onDbSelect:"db-select"}}),hi=createWebComponent("db-divider",{displayName:"Divider"}),ui=createWebComponent("db-drawer",{displayName:"Drawer",events:{onClose:"db-close",onDbClose:"db-close"}}),bi=createWebComponent("db-dropdown",{displayName:"Dropdown",events:{onChange:"db-change",onOpen:"db-open",onToggle:"db-open",onDbChange:"db-change",onDbOpen:"db-open"}}),pi=createWebComponent("db-empty-state",{displayName:"EmptyState",events:{onAction:"db-action",onSecondaryAction:"db-secondary-action",onDbAction:"db-action",onDbSecondaryAction:"db-secondary-action"}}),mi=createWebComponent("db-form",{displayName:"Form",events:{onSubmit:"db-submit",onChange:"db-change",onReset:"db-reset",onDbSubmit:"db-submit",onDbChange:"db-change",onDbReset:"db-reset"}}),gi=createWebComponent("db-grid",{displayName:"Grid"}),vi=createWebComponent("db-grid-item",{displayName:"GridItem"}),Ei=createWebComponent("db-indicator",{displayName:"Indicator",events:{onChange:"db-change",onCurrentChange:"db-current-change",onStepClick:"db-step-click",onPlayingChange:"db-playing-change",onTimerComplete:"db-timer-complete",onDbChange:"db-change",onDbCurrentChange:"db-current-change",onDbStepClick:"db-step-click",onDbPlayingChange:"db-playing-change",onDbTimerComplete:"db-timer-complete"}}),fi=createWebComponent("db-input",{displayName:"Input",events:{onChange:"db-input",onInput:"db-input",onDbInput:"db-input",onDbChange:"db-change"}}),wi=createWebComponent("db-label",{displayName:"Label"}),yi=createWebComponent("db-logo",{displayName:"Logo",events:{onClick:"db-click",onDbClick:"db-click"}}),Ai=createWebComponent("db-list",{displayName:"List",events:{onItemClick:"db-item-click",onItemSelect:"db-select",onSelect:"db-select",onDbItemClick:"db-item-click",onDbSelect:"db-select"}}),Ci=createWebComponent("db-menu-item",{displayName:"MenuItem",events:{onClick:"db-click",onChildClick:"db-child-click",onDbClick:"db-click",onDbChildClick:"db-child-click"}}),_i=createWebComponent("db-modal",{displayName:"Modal",events:{onClose:"db-close",onTabChange:"db-tab-change",onSegmentChange:"db-segment-change",onDbClose:"db-close",onDbTabChange:"db-tab-change",onDbSegmentChange:"db-segment-change"}}),ki=createWebComponent("db-pagination",{displayName:"Pagination",events:{onChange:"db-change",onPageChange:"db-change",onDbChange:"db-change",onPageSizeChange:"db-page-size-change",onDbPageSizeChange:"db-page-size-change"}}),xi=createWebComponent("db-popover",{displayName:"Popover",events:{onOpenChange:"db-open-change",onClose:"db-close",onDbOpenChange:"db-open-change",onDbClose:"db-close"}}),Si=createWebComponent("db-progress",{displayName:"Progress"}),Ni=createWebComponent("db-progress-step",{displayName:"ProgressStep",events:{onStepClick:"db-step-click",onDbStepClick:"db-step-click"}}),$i=createWebComponent("db-progressbar",{displayName:"Progressbar"}),Ii=createWebComponent("db-radio",{displayName:"Radio",events:{onChange:"db-change",onDbChange:"db-change"}}),Di=createWebComponent("db-range-slider",{displayName:"RangeSlider",events:{onChange:"db-change",onRangeChange:"db-change",onDbChange:"db-change"}}),Li=createWebComponent("db-search-bar",{displayName:"SearchBar",events:{onChange:"db-input",onInput:"db-input",onSearch:"db-search",onClear:"db-clear",onCategoryChange:"db-category-change",onSearchResultClick:"db-search-result-click",onFocus:"db-focus",onBlur:"db-blur",onDbChange:"db-input",onDbInput:"db-input",onDbSearch:"db-search",onDbClear:"db-clear",onDbCategoryChange:"db-category-change",onDbSearchResultClick:"db-search-result-click",onDbFocus:"db-focus",onDbBlur:"db-blur"}}),Mi=createWebComponent("db-share",{displayName:"Share",events:{onShare:"db-share",onShareError:"db-share-error",onCopySuccess:"db-copy-success",onCopyError:"db-copy-error",onDbShare:"db-share",onDbShareError:"db-share-error",onDbCopySuccess:"db-copy-success",onDbCopyError:"db-copy-error"}}),zi=createWebComponent("db-top-banner",{displayName:"TopBanner",events:{onClose:"db-close",onLinkPress:"db-link",onDbClose:"db-close",onDbLink:"db-link"}}),Ti=createWebComponent("db-stat",{displayName:"Stat",events:{onClick:"db-click",onDbClick:"db-click"}}),Bi=createWebComponent("db-image",{displayName:"Image",events:{onClick:"db-click",onLoad:"db-load",onError:"db-error",onDbClick:"db-click",onDbLoad:"db-load",onDbError:"db-error"}}),Pi=createWebComponent("db-image-placeholder",{displayName:"ImagePlaceholder",events:{onClick:"db-click",onDbClick:"db-click"}}),Fi=createWebComponent("db-image-list",{displayName:"ImageList",events:{onImageClick:"db-image-click",onImageLoad:"db-image-load",onImageError:"db-image-error",onDbImageClick:"db-image-click",onDbImageLoad:"db-image-load",onDbImageError:"db-image-error"}}),Oi=createWebComponent("db-lightbox",{displayName:"Lightbox",events:{onClose:"db-close",onImageChange:"db-image-change",onDbClose:"db-close",onDbImageChange:"db-image-change"}}),Hi=createWebComponent("db-bottom-navigation",{displayName:"BottomNavigation",events:{onItemClick:"db-item-click",onDbItemClick:"db-item-click"}}),Vi=createWebComponent("db-navbar",{displayName:"Navbar",events:{onItemClick:"db-item-click",onUserMenuItemClick:"db-user-menu-item-click",onLoginClick:"db-login-click",onLogoClick:"db-logo-click",onSearch:"db-search",onDbItemClick:"db-item-click",onDbUserMenuItemClick:"db-user-menu-item-click",onDbLoginClick:"db-login-click",onDbLogoClick:"db-logo-click",onDbSearch:"db-search"}}),Ri=createWebComponent("db-sidebar",{displayName:"Sidebar",events:{onItemClick:"db-item-click",onUserMenuItemClick:"db-user-menu-item-click",onLogoClick:"db-logo-click",onToggle:"db-toggle",onDbItemClick:"db-item-click",onDbUserMenuItemClick:"db-user-menu-item-click",onDbLogoClick:"db-logo-click",onDbToggle:"db-toggle"}}),Wi=createWebComponent("db-segment-control",{displayName:"SegmentControl",events:{onChange:"db-change",onDbChange:"db-change"}}),qi=createWebComponent("db-select",{displayName:"Select",events:{onChange:"db-change",onDbChange:"db-change"}}),ji=createWebComponent("db-skeleton",{displayName:"Skeleton"}),Ui=createWebComponent("db-spinner",{displayName:"Spinner"}),Ki=createWebComponent("db-stack",{displayName:"Stack"}),Ji=createWebComponent("db-stepper",{displayName:"Stepper",events:{onChange:"db-change",onDbChange:"db-change",onMinReached:"db-min-reached",onMaxReached:"db-max-reached"}}),Gi=createWebComponent("db-table",{displayName:"Table",events:{onRowClick:"db-row-click",onSelectionChange:"db-selection-change",onSortChange:"db-sort-change",onPageChange:"db-page-change",onDbRowClick:"db-row-click",onDbSelectionChange:"db-selection-change",onDbSortChange:"db-sort-change",onDbPageChange:"db-page-change"}}),Yi=createWebComponent("db-tabs",{displayName:"Tabs",events:{onChange:"db-change",onTabChange:"db-change",onDbChange:"db-change"}}),Xi=createWebComponent("db-textarea",{displayName:"Textarea",events:{onChange:"db-input",onInput:"db-input",onDbInput:"db-input",onDbChange:"db-change"}}),Zi=createWebComponent("db-toast",{displayName:"Toast",events:{onClose:"db-close",onDbClose:"db-close"}}),Qi=createWebComponent("db-toggle",{displayName:"Toggle",events:{onChange:"db-change",onDbChange:"db-change"}}),en=createWebComponent("db-toolbar",{displayName:"Toolbar"}),tn=createWebComponent("db-tooltip",{displayName:"Tooltip"}),sn=createWebComponent("db-rating",{displayName:"Rating",events:{onChange:"db-change",onHover:"db-hover",onDbChange:"db-change",onDbHover:"db-hover"}}),nn=createWebComponent("db-countdown",{displayName:"Countdown",events:{onComplete:"db-complete",onTick:"db-tick",onDbComplete:"db-complete",onDbTick:"db-tick"}}),an=createWebComponent("db-masonry",{displayName:"Masonry",events:{onImageClick:"db-image-click",onImageLoad:"db-image-load",onImageError:"db-image-error",onDbImageClick:"db-image-click",onDbImageLoad:"db-image-load",onDbImageError:"db-image-error"}}),rn=createWebComponent("db-carousel",{displayName:"Carousel",events:{onSlideChange:"db-slide-change",onItemClick:"db-item-click",onDbSlideChange:"db-slide-change",onDbItemClick:"db-item-click"}}),ln=createWebComponent("db-color-picker",{displayName:"ColorPicker",events:{onChange:"db-change",onDbChange:"db-change"}}),on=createWebComponent("db-reorder",{displayName:"Reorder",events:{onReorder:"db-reorder",onSelect:"db-select",onDbReorder:"db-reorder",onDbSelect:"db-select"}}),dn=createWebComponent("db-resizable-panels",{displayName:"ResizablePanels",events:{onResizeStart:"db-resize-start",onResize:"db-resize",onResizeEnd:"db-resize-end",onSizeChange:"db-size-change",onDbResizeStart:"db-resize-start",onDbResize:"db-resize",onDbResizeEnd:"db-resize-end",onDbSizeChange:"db-size-change"}}),cn=createWebComponent("db-video-player",{displayName:"VideoPlayer",events:{onPlay:"db-play",onPause:"db-pause",onEnded:"db-ended",onTimeUpdate:"db-time-update",onVolumeChange:"db-volume-change",onFullscreenChange:"db-fullscreen-change",onError:"db-error",onDbPlay:"db-play",onDbPause:"db-pause",onDbEnded:"db-ended",onDbTimeUpdate:"db-time-update",onDbVolumeChange:"db-volume-change",onDbFullscreenChange:"db-fullscreen-change",onDbError:"db-error"}}),hn=createWebComponent("db-youtube-player",{displayName:"YouTubePlayer",events:{onFullscreenChange:"db-fullscreen-change",onDbFullscreenChange:"db-fullscreen-change"}}),un=createWebComponent("db-audio-player",{displayName:"AudioPlayer",events:{onPlay:"db-play",onPause:"db-pause",onEnded:"db-ended",onTimeUpdate:"db-time-update",onVolumeChange:"db-volume-change",onPlaylistChange:"db-playlist-change",onPlaybackRateChange:"db-playback-rate-change",onRepeatModeChange:"db-repeat-mode-change",onShuffleChange:"db-shuffle-change",onError:"db-error",onDbPlay:"db-play",onDbPause:"db-pause",onDbEnded:"db-ended",onDbTimeUpdate:"db-time-update",onDbVolumeChange:"db-volume-change",onDbPlaylistChange:"db-playlist-change",onDbPlaybackRateChange:"db-playback-rate-change",onDbRepeatModeChange:"db-repeat-mode-change",onDbShuffleChange:"db-shuffle-change",onDbError:"db-error"}}),bn=createWebComponent("db-code-block",{displayName:"CodeBlock",events:{onActiveIdChange:"db-active-id-change",onDbActiveIdChange:"db-active-id-change",onCodeChange:"db-code-change",onDbCodeChange:"db-code-change"}}),pn=createWebComponent("db-markdown-editor",{displayName:"MarkdownEditor",events:{onChange:"db-change",onSave:"db-save",onFocus:"db-focus",onBlur:"db-blur",onFileUpload:"db-file-upload",onDbChange:"db-change",onDbSave:"db-save",onDbFocus:"db-focus",onDbBlur:"db-blur",onDbFileUpload:"db-file-upload"}}),mn=createWebComponent("db-testimonial",{displayName:"Testimonial"}),gn=createWebComponent("db-section-hero",{displayName:"SectionHero",events:{onButtonClick:"db-button-click",onDbButtonClick:"db-button-click"}}),vn=createWebComponent("db-section-feature",{displayName:"SectionFeature",events:{onAction:"db-action",onDbAction:"db-action"}}),En=createWebComponent("db-app-badge",{displayName:"AppBadge",events:{onClick:"db-click",onDbClick:"db-click"}}),fn=createWebComponent("db-section-contact",{displayName:"SectionContact",events:{onAction:"db-action",onDbAction:"db-action"}}),wn=createWebComponent("db-section-app-download",{displayName:"SectionAppDownload"}),yn=createWebComponent("db-marquee",{displayName:"Marquee"}),An=createWebComponent("db-gradient",{displayName:"Gradient"}),Cn=createWebComponent("db-random-gradient",{displayName:"RandomGradient"}),_n=createWebComponent("db-ad-banner",{displayName:"AdBanner",events:{onCtaClick:"db-cta-click",onClose:"db-close",onDbCtaClick:"db-cta-click",onDbClose:"db-close"}}),kn=createWebComponent("db-timeline",{displayName:"Timeline",events:{onItemClick:"db-item-click",onDbItemClick:"db-item-click"}}),xn=createWebComponent("db-animation-text",{displayName:"AnimationText",events:{onClick:"db-click",onDbClick:"db-click"}}),Sn=createWebComponent("db-tutorial",{displayName:"Tutorial",events:{onEnd:"db-end",onStepChange:"db-step-change",onNext:"db-next",onPrev:"db-prev",onDbEnd:"db-end",onDbStepChange:"db-step-change",onDbNext:"db-next",onDbPrev:"db-prev"}}),Nn=createWebComponent("db-animation-background",{displayName:"AnimationBackground",events:{onClick:"db-click",onDbClick:"db-click"}}),$n=createWebComponent("db-cursor-follower",{displayName:"CursorFollower"}),In=createWebComponent("db-lottie",{displayName:"Lottie"}),Dn=createWebComponent("db-page-header",{displayName:"PageHeader",events:{onBack:"db-back",onTabChange:"db-tab-change",onDbBack:"db-back",onDbTabChange:"db-tab-change"}}),Ln=createWebComponent("db-section",{displayName:"Section",events:{onExpandedChange:"db-expanded-change",onDbExpandedChange:"db-expanded-change",onTabChange:"db-tab-change",onDbTabChange:"db-tab-change"}}),Mn=createWebComponent("db-floating-action-button",{displayName:"FloatingActionButton",events:{onClick:"db-click",onDbClick:"db-click"}}),zn=createWebComponent("db-bottom-sheet",{displayName:"BottomSheet",events:{onClose:"db-close",onDbClose:"db-close"}}),Tn=createWebComponent("db-scroll-area",{displayName:"ScrollArea"}),Bn=createWebComponent("db-dropzone",{displayName:"Dropzone",events:{onFileSelect:"db-file-select",onDragOver:"db-drag-over",onDragLeave:"db-drag-leave",onDrop:"db-drop",onClick:"db-click",onDbFileSelect:"db-file-select",onDbDragOver:"db-drag-over",onDbDragLeave:"db-drag-leave",onDbDrop:"db-drop",onDbClick:"db-click"}}),Pn=createWebComponent("db-onboarding-modal",{displayName:"OnboardingModal",events:{onClose:"db-close",onStepChange:"db-step-change",onComplete:"db-complete",onDbClose:"db-close",onDbStepChange:"db-step-change",onDbComplete:"db-complete"}}),Fn=createWebComponent("db-split-view",{displayName:"SplitView"}),On=createWebComponent("db-file-uploader",{displayName:"FileUploader",events:{onUpload:"db-upload",onRemove:"db-remove",onRetry:"db-retry",onDbUpload:"db-upload",onDbRemove:"db-remove",onDbRetry:"db-retry"}}),Hn=createWebComponent("db-date-picker",{displayName:"DatePicker",events:{onChange:"db-change",onDbChange:"db-change"}}),Vn=createWebComponent("db-time-picker",{displayName:"TimePicker",events:{onChange:"db-change",onDbChange:"db-change"}}),Rn=createWebComponent("db-calendar",{displayName:"Calendar",events:{onDateClick:"db-date-click",onEventClick:"db-event-click",onEventAdd:"db-event-add",onEventEdit:"db-event-edit",onEventDelete:"db-event-delete",onViewChange:"db-view-change",onMonthChange:"db-month-change",onDbDateClick:"db-date-click",onDbEventClick:"db-event-click",onDbEventAdd:"db-event-add",onDbEventEdit:"db-event-edit",onDbEventDelete:"db-event-delete",onDbViewChange:"db-view-change",onDbMonthChange:"db-month-change"}});export{Xs as Accordion,_n as AdBanner,Zs as Alert,Nn as AnimationBackground,xn as AnimationText,En as AppBadge,un as AudioPlayer,Qs as Avatar,ei as Backdrop,ti as Badge,si as Banner,Hi as BottomNavigation,zn as BottomSheet,ii as Breadcrumbs,ni as Button,Rn as Calendar,ai as Card,rn as Carousel,ri as Checkbox,li as Chip,bn as CodeBlock,ln as ColorPicker,oi as Confirm,di as Container,ci as ContextMenu,nn as Countdown,$n as CursorFollower,Hn as DatePicker,hi as Divider,ui as Drawer,bi as Dropdown,Bn as Dropzone,pi as EmptyState,On as FileUploader,Mn as FloatingActionButton,mi as Form,An as Gradient,gi as Grid,vi as GridItem,Bi as Image,Fi as ImageList,Pi as ImagePlaceholder,Ei as Indicator,fi as Input,wi as Label,Oi as Lightbox,Ai as List,yi as Logo,In as Lottie,pn as MarkdownEditor,yn as Marquee,an as Masonry,Ci as MenuItem,_i as Modal,ModalBody,ModalFooter,ModalHeader,Vi as Navbar,Pn as OnboardingModal,Dn as PageHeader,ki as Pagination,xi as Popover,Si as Progress,Ni as ProgressStep,$i as Progressbar,Ii as Radio,Cn as RandomGradient,Di as RangeSlider,sn as Rating,on as Reorder,dn as ResizablePanels,Tn as ScrollArea,Li as SearchBar,Ln as Section,wn as SectionAppDownload,fn as SectionContact,vn as SectionFeature,gn as SectionHero,Wi as SegmentControl,qi as Select,Mi as Share,Ri as Sidebar,ji as Skeleton,Ui as Spinner,Fn as SplitView,Ki as Stack,Ti as Stat,Ji as Stepper,Gi as Table,Yi as Tabs,mn as Testimonial,Xi as Textarea,Vn as TimePicker,kn as Timeline,Zi as Toast,Qi as Toggle,en as Toolbar,tn as Tooltip,zi as TopBanner,Sn as Tutorial,cn as VideoPlayer,hn as YouTubePlayer,useContextMenu};
1
+ import e,{forwardRef as t,useRef as s,useMemo as i,useImperativeHandle as n,useEffect as a,createElement as r,useState as l,useCallback as o}from"react";const d={"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(e){return Object.prototype.hasOwnProperty.call(d,e)}function getDbComponentIconSize(e){return"s"===e?12:"l"===e?20:16}function createDbIcon(e,t=16){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}">${d[e]}</svg>`,s.content.firstElementChild}const u=["disabled","loading","icon-only","full-width"],b=["primary","secondary","tertiary","danger","ghost","accent"],p=["s","m","l"],m=["none","s","m","l","pill"],g=["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",...u]}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 m.includes(this.radius)?`designbase-wc-button--radius-${this.radius}`:"designbase-wc-button--radius-pill"}syncRadius(){m.forEach(e=>this.classList.remove(`designbase-wc-button--radius-${e}`)),this.classList.add(this.getDefaultRadiusClass())}syncAccentStyle(){if(g.forEach(e=>this.classList.remove(`designbase-wc-button--accent-${e}`)),"accent"!==this.variant)return;const e=this.accentStyle,t=g.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?b:p).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 p.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 v={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 l=i*(n.shiftKey?10:n.altKey?.1:1);let o=e+Math.round(t/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,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 E=["text","email","password","url","search","tel","number"],f=["s","m","l"],w=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=>{const t=e.target;this.updateDynamicUI(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:t.value,nativeEvent:e},bubbles:!0,composed:!0}))},this.handleChange=e=>{const t=e.target;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){"value"===e&&this.isScrubbing||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&&w.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=E.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")||"",l=this.getAttribute("error-message")||"",o=this.hasAttribute("error"),d=this.resolveStartIcon(),u=this.resolveIconName("end-icon");this.classList.add("designbase-wc-input"),f.forEach(e=>this.classList.remove(`designbase-wc-input--${e}`)),this.classList.add(`designbase-wc-input--${f.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(d));const b=s&&e.length>0&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--with-end-icon",Boolean(u&&!i&&!s)||i||b),this.classList.toggle("designbase-wc-input--with-password-toggle",i),this.classList.toggle("designbase-wc-input--with-search-clear",b);const p=this.hasAttribute("scrubbable")&&"number"===t&&!this.disabled&&!this.readOnly;this.classList.toggle("designbase-wc-input--scrubbable",p),this.classList.toggle("designbase-wc-input--scrubbing",this.isScrubbing);const m=this.getAttribute("id")||`db-input-${Math.random().toString(36).slice(2)}`;this.hasAttribute("id")||this.setAttribute("id",m);const g=`${m}-field`,v=`${m}-helper`,w=`${m}-error`,y=`${m}-validation`,A=this.getAttribute("min"),_=this.getAttribute("max"),C=this.getAttribute("step");this.innerHTML=`\n ${a?`<label class="designbase-wc-input__label" for="${g}">${this.escape(a)}${this.hasAttribute("required")?'<span aria-hidden="true"> *</span>':""}</label>`:""}\n <span class="designbase-wc-input__wrapper">\n ${d?'<span class="designbase-wc-input__start-icon" aria-hidden="true"></span>':""}\n <input\n id="${g}"\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(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 ${!u||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="${v}" 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(d,!u||i||s?void 0:u,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,p&&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:v[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"),l=[n&&!r?t:"",this.shouldShowPasswordValidation(e)?i:"",r&&a?s:""].filter(Boolean).join(" ")||void 0;l?this.input.setAttribute("aria-describedby",l):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=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-input")||customElements.define("db-input",DbInput);const y=["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=y.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 A=["s","m","l"];class DbToggle extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleClick=()=>{if(this.disabled||this.readOnly)return;const e=!this.checked;this.toggleAttribute("checked",e),this.syncState(),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"]}get checked(){return this.hasAttribute("checked")||this.hasAttribute("selected")}set checked(e){this.toggleAttribute("checked",e),this.syncClasses()}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()}get hasLabel(){return!this.hasAttribute("has-label")||"false"!==this.getAttribute("has-label")}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.hasLabel?this.labelEl?.removeAttribute("hidden"):this.labelEl?.setAttribute("hidden",""),this.syncClasses())}syncClasses(){if(!this.root)return;const e=A.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))}}customElements.get("db-toggle")||customElements.define("db-toggle",DbToggle);const _="designbase-wc-badge",C=["primary","secondary","info","success","warning","danger"],k=["s","m","l"],x=["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(_),this.setAttribute("aria-disabled",String(this.disabled)),this.syncEnum("variant",this.variant,C),this.syncEnum("size",this.size,k),this.syncEnum("style",this.badgeStyle,x),this.classList.toggle(`${_}--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(`${_}--${e}`)),s.includes(t)?this.classList.add(`${_}--${t}`):"style"===e&&this.classList.add(`${_}--text`)}}customElements.get("db-badge")||customElements.define("db-badge",DbBadge);const S={primary:"primary",secondary:"secondary",outline:"tertiary",ghost:"ghost"},N={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",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 e=document.createElement("div");e.className="designbase-wc-banner__background",e.style.backgroundImage=`url(${l})`,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),o.length>0){const e=document.createElement("div");e.className="designbase-wc-banner__actions",o.forEach((t,s)=>{const i=S[t.variant||"primary"]||"primary",n=N[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 $=["circular","dots","bars","pulse","ripple"],I=["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--${$.includes(this.type)?this.type:"circular"}`),this.classList.add(`designbase-wc-spinner--${I.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=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-spinner")||customElements.define("db-spinner",DbSpinner);const D=["default","flat"],L=["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")),D.forEach(e=>this.classList.remove(`designbase-wc-card--${e}`)),L.forEach(e=>this.classList.remove(`designbase-wc-card--${e}`)),this.classList.add(`designbase-wc-card--${D.includes(this.variant)?this.variant:"default"}`),this.classList.add(`designbase-wc-card--${L.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 M=["s","m","l"],z=["horizontal","vertical"],T=["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 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&&register(e,Number(s))}),this.panel?.querySelectorAll(":scope > .designbase-wc-tabs__panel-inner > [data-panel-index]").forEach(e=>{e instanceof HTMLElement&&register(e,Number(e.dataset.panelIndex))}),Array.from(this.inactivePanels.children).forEach(e=>{e instanceof HTMLElement&&void 0!==e.dataset.panelIndex&&register(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=M.includes(this.size)?this.size:"m",a=z.includes(this.orientation)?this.orientation:"horizontal",r=T.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(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),l=t===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-${t}`),o.id=`tab-${t}`,o.tabIndex=l?0:-1,o.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)),o.append(e)}const d=document.createElement("span");d.className="designbase-wc-tabs__tab-label",d.textContent=e,o.append(d),o.addEventListener("click",()=>this.select(t)),o.addEventListener("keydown",e=>this.handleKeyDown(e,t)),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",e.forEach((e,t)=>{e.forEach(e=>{e.removeAttribute("slot"),e.dataset.panelIndex=String(t),t===i?o.append(e):this.inactivePanels.append(e)})}),this.panel.append(o),this.append(this.list,this.panel),requestAnimationFrame(()=>{this.handleListScroll(),l&&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 B=["s","m","l","xl","full"],P=["default","tabs","segment"],F=["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 B.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 P.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=F.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();B.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 O=["s","m","l"],H=["bottom-left","bottom-right","top-left","top-right"],R=["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 O.includes(this.size)?this.size:"m"}resolvedPlacement(){return H.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=R.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.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 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 l=document.createElement("span");l.className="designbase-wc-dropdown__item-label",l.textContent=i,r.append(l),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 V=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],W=["s","m","l"],q=["default","primary","success","warning","danger","info"],j=-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),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 V.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(){if(!this.tooltip||!this.arrow)return;const e=this.resolvedPosition(),t=W.includes(this.size)?this.size:"m",s=q.includes(this.variant)?this.variant:"default";this.tooltip.className=["designbase-wc-tooltip",`designbase-wc-tooltip--${t}`,`designbase-wc-tooltip--${s}`,`designbase-wc-tooltip--${e}`,(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--${e}`,this.arrow.hidden=!this.showArrow,this.tooltip.setAttribute("data-placement-group",this.groupOf(e)),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 e=this.resolvedPosition(),t=this.trigger.getBoundingClientRect(),s=this.tooltip.getBoundingClientRect();let i=0,n=0,a=0,r=0;switch(e){case"top":i=t.top-s.height-8,n=t.left+t.width/2-s.width/2,a=s.height-2,r=s.width/2-6;break;case"top-start":i=t.top-s.height-8,n=t.left,a=s.height-2,r=8;break;case"top-end":i=t.top-s.height-8,n=t.right-s.width,a=s.height-2,r=s.width-8-6;break;case"bottom":i=t.bottom+8,n=t.left+t.width/2-s.width/2,a=j,r=s.width/2-6;break;case"bottom-start":i=t.bottom+8,n=t.left,a=j,r=8;break;case"bottom-end":i=t.bottom+8,n=t.right-s.width,a=j,r=s.width-8-6;break;case"left":i=t.top+t.height/2-s.height/2,n=t.left-s.width-8,a=s.height/2-6,r=s.width-2;break;case"left-start":i=t.top,n=t.left-s.width-8,a=8,r=s.width-2;break;case"left-end":i=t.bottom-s.height,n=t.left-s.width-8,a=s.height-8-6,r=s.width-2;break;case"right":i=t.top+t.height/2-s.height/2,n=t.right+8,a=s.height/2-6,r=j;break;case"right-start":i=t.top,n=t.right+8,a=8,r=j;break;case"right-end":i=t.bottom-s.height,n=t.right+8,a=s.height-8-6,r=j}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(e);if("top"===d||"bottom"===d){const e=t.left+t.width/2-n-6;r=Math.min(s.width-8-6,Math.max(8,e))}else{const e=t.top+t.height/2-i-6;a=Math.min(s.height-8-6,Math.max(8,e))}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(e){if(!this.disabled||!e){if(this.visible=e,!e&&!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","style","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&&register(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("style")||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),l=this.isItemExpanded(s,i),o=document.createElement("div");o.className=["designbase-wc-accordion__item",`designbase-wc-accordion__item--${t}`,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 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 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",(e.get(i)||[]).forEach(e=>{e.removeAttribute("slot"),g.append(e)}),m.append(g),o.append(d,m),this.append(o)}),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 U=["xs","s","m","l","xl","2xl"],K=["default","primary","success","warning","danger","info"],J=["online","offline","away","busy"],G=["#E3F2FD","#F3E5F5","#E8F5E8","#FFF3E0","#FCE4EC","#E0F2F1","#FFF8E1","#F1F8E9","#E8EAF6","#FFEBEE"],Y=["#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=U.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=K.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--${e}`,`designbase-wc-avatar--${t}`,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 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)%G.length;return{backgroundColor:G[s],color:Y[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 o=this.getAttribute("status")||"";if(J.includes(o)){const e=document.createElement("span");e.className=`designbase-wc-avatar__status designbase-wc-avatar__status--${o}`,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 X=["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&&X.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&&!X.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 Z=["s","m","l"],Q=["default","success","warning","danger"],ee=["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{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(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=Z.includes(s)?s:"m",l=Q.includes(i)?i:"default",o=ee.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(e)),this.setAttribute("aria-valuenow",String(this.value)),this.replaceChildren(),"circular"===n){const{svgSize:e,radius:s,strokeWidth:i,center:n}=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}}}(o,r),a=2*Math.PI*s,l=a-t/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(e)),u.setAttribute("height",String(e)),u.setAttribute("viewBox",`0 0 ${e} ${e}`),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 e=document.createElement("span");e.className="designbase-wc-progress__circular-value",e.textContent=`${Math.round(t)}%`,d.append(e)}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=`${t}%`,u.append(b),d.append(u),this.hasAttribute("show-value")){const e=document.createElement("span");e.className="designbase-wc-progress__value",e.textContent=`${Math.round(t)}%`,d.append(e)}this.append(d)}}customElements.get("db-progress")||customElements.define("db-progress",DbProgress);const te=["s","m","l"];class DbSelect extends HTMLElement{constructor(){super(...arguments),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"]}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)}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(te.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)return 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.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=te.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")||"",l=this.hasAttribute("error"),o=this.getAttribute("id")||"";this.className=["designbase-wc-select",`designbase-wc-select--${e}`,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 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=`${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 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 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",e=>{e.stopPropagation();const s=t.filter(e=>e!==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=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 l=document.createElement("span");l.className="designbase-wc-select__option-label",l.textContent=e.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(e){return e.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-select")||customElements.define("db-select",DbSelect);const se=["s","m","l"];class DbTextarea extends HTMLElement{constructor(){super(...arguments),this.built=!1,this.handleInput=e=>{this.field&&(this.updateCharacterCount(),this.dispatchEvent(new CustomEvent("db-input",{detail:{value:this.field.value,nativeEvent:e},bubbles:!0,composed:!0})))},this.handleChange=e=>{if(!this.field)return;const t=this.field.value;this.getAttribute("value")!==t&&this.setAttribute("value",t),this.updateCharacterCount(),this.dispatchEvent(new CustomEvent("db-change",{detail:{value:t,nativeEvent:e},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["label","placeholder","value","default-value","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=se.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.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 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=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]||e))}}customElements.get("db-textarea")||customElements.define("db-textarea",DbTextarea);const ie=["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=ie.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"),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--${e}`,`designbase-wc-pagination--${t}`,`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 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&&!m&&f.append(this.createIconButton("arrow-bar-left",1,"첫 페이지로 이동","first")),a&&!m&&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",p,"마지막 페이지로 이동","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,l=a<s-t-1;if(!r&&l){const t=3+2*e;return[...Array.from({length:t},(e,t)=>t+1),"...",s]}if(r&&!l){const t=3+2*e;return[1,"...",...Array.from({length:t},(e,i)=>s-t+i+1)]}if(r&&l){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);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(e){this.setAttribute("items","string"==typeof e?e:JSON.stringify(e))}connectedCallback(){this.render()}attributeChangedCallback(){this.isConnected&&this.render()}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]}render(){const e=this.getAttribute("size")||"m",t=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--${e}`,`designbase-wc-breadcrumbs--${t}`,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((e,t)=>{const i=t===s.length-1,a=document.createElement("li");a.className="designbase-wc-breadcrumbs__item";const r=!e.href||i||e.disabled?document.createElement("span"):document.createElement("a");if(r.className=r 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",i&&"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)),r.append(t)}const l=document.createElement("span");if(l.className="designbase-wc-breadcrumbs__label",l.textContent=e.label,r.append(l),r instanceof HTMLAnchorElement&&(r.href=e.href||"#"),r.addEventListener("click",t=>{(e.disabled||e.active||i)&&t.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{detail:{item:e},bubbles:!0,composed:!0}))}),a.append(r),!i){const e=document.createElement("span");e.className="designbase-wc-breadcrumbs__separator",e.setAttribute("aria-hidden","true"),e.append(createDbIcon("chevron-right",16)),a.append(e)}n.append(a)}),this.append(n)}}customElements.get("db-breadcrumbs")||customElements.define("db-breadcrumbs",DbBreadcrumbs);const ne=["s","m","l"],ae=["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=ne.includes(e)?e:"m",i=ae.includes(t)?t:"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 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"),p=this.hasAttribute("show-count-badge");if(b||p){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(p){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 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((e,t)=>this.getRowKey(e,t)),w=f.filter(e=>this.internalSelectedRows.includes(e)),y=this.hasAttribute("clickable");if(o){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+(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"),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}))}),o){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),m.append(g),this.append(m),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 le="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"),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=[le,`${le}--${e}`,`${le}--${t}`,s&&`${le}--with-icon`,i&&`${le}--closable`,b&&`${le}--text-single`,p.length>0&&`${le}--has-actions`].filter(Boolean).join(" "),this.setAttribute("role","alert"),this.setAttribute("aria-live","polite"),this.querySelector(`.${le}__content`)?.remove(),this.querySelector(`.${le}__actions`)?.remove(),Array.from(this.childNodes).forEach(e=>{e.nodeType===Node.TEXT_NODE&&e.remove()});const m=document.createElement("div");if(m.className=`${le}__content`,s){const s=document.createElement("div");s.className=`${le}__icon`,s.append(createDbIcon(this.getIconName(e),"s"===t?16:"l"===t?24:20)),m.append(s)}const g=document.createElement("div");if(g.className=`${le}__body`,u){const e=document.createElement("div");e.className=`${le}__title`,e.textContent=n,g.append(e)}if(d){const e=document.createElement("div");e.className=`${le}__message`,e.textContent=a,g.append(e)}if(m.append(g),p.length>0){const e=document.createElement("div");e.className=`${le}__actions`;const s=document.createElement("div");s.className=`${le}__action-buttons`,p.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),m.append(e)}if(i){const e=document.createElement("button");e.type="button",e.className=`${le}__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}))}),m.append(e)}this.replaceChildren(m)}}customElements.get("db-alert")||customElements.define("db-alert",DbAlert);const oe=["s","m","l"],de=["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"),l=this.hasAttribute("clickable"),o=this.getAttribute("start-icon"),d=this.getAttribute("end-icon"),u=oe.includes(t)?t:"m",b=de.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 e=document.createElement("span");e.className="designbase-wc-chip__start-icon",e.append(createDbIcon(o,p)),this.append(e)}const m=document.createElement("span");if(m.className="designbase-wc-chip__label",m.textContent=e,this.append(m),d&&!n){const e=document.createElement("span");e.className="designbase-wc-chip__end-icon",e.append(createDbIcon(d,p)),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",p)),t.addEventListener("click",e=>{e.stopPropagation(),i||this.dispatchEvent(new CustomEvent("db-delete",{bubbles:!0,composed:!0}))}),this.append(t)}this.onclick=()=>{!i&&l&&this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0}))},this.onkeydown=e=>{"Enter"!==e.key&&" "!==e.key||i||!l||(e.preventDefault(),this.dispatchEvent(new CustomEvent("db-click",{bubbles:!0,composed:!0})))}}}customElements.get("db-chip")||customElements.define("db-chip",DbChip);const ce=["text","circular","rectangular","rounded"],he=["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",l=this.getAttribute("last-line-width")||"60%",o=ce.includes(e)?e:"text",d=he.includes(t)?t:"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(e){switch(e){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 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(l)),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 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(e=>l.append(e)),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(),t)){const e=document.createElement("span");e.className="designbase-wc-label__required",e.textContent="*",l.append(e)}}}customElements.get("db-label")||customElements.define("db-label",DbLabel);const ue={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:l,height:o,markSize:d}=function getLogoDimensions(e){return ue[e]||ue.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}(l,o,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 l=document.createElement("div");if(l.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&&(l.addEventListener("click",e=>this.handleClick(e)),a||l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleClick(e))})),this.renderLogoContent(l),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(l),void this.append(e)}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(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"),l=this.getAttribute("image-alt")||s,o="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=l,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),o)),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 be=["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=be.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",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(...l),this.portal.isConnected||document.body.append(this.portal)}}customElements.get("db-backdrop")||customElements.define("db-backdrop",DbBackdrop);const pe=["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"],me=["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 pe.includes(e)?e:"top"}resolvedTrigger(){const e=this.getAttribute("trigger")||"click";return me.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,l=t.bottom+8+s.height<=i-8,o=t.left-s.width-8>=8,d=t.right+8+s.width<=n-8;return"top"===a&&!r&&l?e.replace(/^top/,"bottom"):"bottom"===a&&!l&&r?e.replace(/^bottom/,"top"):"left"===a&&!o&&d?e.replace(/^left/,"right"):"right"===a&&!d&&o?e.replace(/^right/,"left"):e}applyCoords(e,t,s){let i=0,n=0,a=0,r=0;switch(e){case"top":i=t.top-s.height-8,n=t.left+t.width/2-s.width/2,a=s.height,r=s.width/2-4;break;case"top-start":i=t.top-s.height-8,n=t.left,a=s.height,r=12;break;case"top-end":i=t.top-s.height-8,n=t.right-s.width,a=s.height,r=s.width-12;break;case"bottom":i=t.bottom+8,n=t.left+t.width/2-s.width/2,a=-4,r=s.width/2-4;break;case"bottom-start":i=t.bottom+8,n=t.left,a=-4,r=12;break;case"bottom-end":i=t.bottom+8,n=t.right-s.width,a=-4,r=s.width-12;break;case"left":i=t.top+t.height/2-s.height/2,n=t.left-s.width-8,a=s.height/2-4,r=s.width;break;case"left-start":i=t.top,n=t.left-s.width-8,a=12,r=s.width;break;case"left-end":i=t.bottom-s.height,n=t.left-s.width-8,a=s.height-12,r=s.width;break;case"right":i=t.top+t.height/2-s.height/2,n=t.right+8,a=s.height/2-4,r=-4;break;case"right-start":i=t.top,n=t.right+8,a=12,r=-4;break;case"right-end":i=t.bottom-s.height,n=t.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:e}}positionPanel(){if(!this.panel)return;const e=this.getTriggerRect();if(!e)return;this.panel.offsetHeight;const t=this.panel.getBoundingClientRect(),s=this.resolvedPlacement(),i=this.flipPlacementIfNeeded(s,e,t),{top:n,left:a,aTop:r,aLeft:l}=this.applyCoords(i,e,t),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),pe.forEach(e=>{this.panel.classList.toggle(`designbase-wc-popover--${e}`,e===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 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 ge=["left","right","top","bottom"],ve=["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=ge.includes(this.getAttribute("position")||"right")&&this.getAttribute("position")||"right",t=ve.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",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=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 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=`${l}-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(...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(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 l=document.createElement("div");if(l.className="designbase-wc-toast__title",l.textContent=t,r.append(l),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",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"),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 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 e=document.createElement("div");e.className="designbase-wc-confirm__icon",e.append(createDbIcon(this.iconForVariant(a),this.iconSize(r))),m.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)}m.append(g),p.append(m);const v=document.createElement("div");v.id="confirm-content",v.className="designbase-wc-confirm__content",v.textContent=t,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 Ee=["dots","numbers","line","dot-line","slide","combined"],fe=["s","m","l"],we=["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(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 Ee.includes(e)?e:"dots"}get size(){const e=this.getAttribute("size")||"m";return fe.includes(e)?e:"m"}set size(e){this.setAttribute("size",e)}get direction(){const e=this.getAttribute("direction")||"horizontal";return we.includes(e)?e:"horizontal"}set direction(e){this.setAttribute("direction",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").forEach(e=>{e.style.transform="vertical"===this.direction?`scaleY(${this.progress})`:`scaleX(${this.progress})`});const e=this.querySelector(".designbase-wc-indicator__dot-ring-progress");if(e){const t=15.9155,s=2*Math.PI*t;e.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.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(e)),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(e)),n.setAttribute("fill","none"),n.setAttribute("stroke-dasharray",String(t)),n.setAttribute("stroke-dashoffset",String(t*(1-this.progress))),n.setAttribute("stroke-linecap","round"),s.append(i,n),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,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()),e.append(this.renderStep(t,["designbase-wc-indicator__dot",s&&"designbase-wc-indicator__dot--active",l&&"designbase-wc-indicator__dot--with-ring"].filter(Boolean).join(" "),d))}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}render(){const e=this.indicatorType,t="combined"===e?"dots":e,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"===t){const e=document.createElement("span");e.className="designbase-wc-indicator__current",e.textContent=String(i+1);const t=document.createElement("span");t.className="designbase-wc-indicator__separator",t.textContent="/";const s=document.createElement("span");return s.className="designbase-wc-indicator__total",s.textContent=String(n),void this.append(e,t,s)}if("slide"===t){const e=document.createElement("div");e.className="designbase-wc-indicator__track";const t=document.createElement("div");t.className="designbase-wc-indicator__track-thumb";const l=100/n;if("vertical"===s?(t.style.height=`${l}%`,t.style.transform=`translateY(${100*i}%)`):(t.style.width=`${l}%`,t.style.transform=`translateX(${100*i}%)`),a&&r){const e=document.createElement("div");e.className="designbase-wc-indicator__track-fill",e.style.transform="vertical"===s?`scaleY(${this.progress})`:`scaleX(${this.progress})`,t.append(e)}return e.append(t),void this.append(e)}if("line"===t){const e=document.createDocumentFragment();for(let t=0;t<n;t+=1){const n=t===i,l=a&&n&&r?(()=>{const e=document.createElement("span");return e.className="designbase-wc-indicator__line-fill",e.style.transform="vertical"===s?`scaleY(${this.progress})`:`scaleX(${this.progress})`,e})():void 0;e.append(this.renderStep(t,["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(e)}if("dot-line"===t){const e=document.createDocumentFragment();for(let t=0;t<n;t+=1){const s=t===i;e.append(this.renderStep(t,["designbase-wc-indicator__dot-line-item",s&&"designbase-wc-indicator__dot-line-item--active"].filter(Boolean).join(" ")))}return void this.append(e)}if("combined"===e){const e=document.createElement("div");return e.className="designbase-wc-indicator__steps",e.append(this.renderDots()),void this.append(e,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(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"),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"===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<l;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,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-${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",(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 e=document.createElement("div");e.className="designbase-wc-list__item-icon",e.append(createDbIcon(r.icon,p)),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),m){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:l},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",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 e=document.createElement("div");e.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(" "),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(m){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||(m&&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),m&&v){const e=document.createElement("div");e.className=`designbase-wc-menu-item__children designbase-wc-menu-item__children--${r}`,p.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(l+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 ye=["s","m","l"],Ae=["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 ye.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--${ye.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"),l=Ae.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--${l}`;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()),l=this.getIconPx();this.className=["designbase-wc-search-bar",`designbase-wc-search-bar--${ye.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 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=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,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||t||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",e=>{e.preventDefault()}),this.dropdown=p,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(o,p),this.syncIcons(),this.syncPlaceholder(),this.syncSuggestionRolling(),this.bindGlobalShortcut(),this.updateDropdown()}}customElements.get("db-search-bar")||customElements.define("db-search-bar",DbSearchBar);const _e={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"/>'},Ce={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}">${_e[e]}</svg>`,s.content.firstElementChild}const ke=["facebook","x","linkedin","whatsapp","email","link"],xe={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:ke).filter(e=>e in xe)}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=xe[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(Ce[e],t)}(e,24)),t}createPlatformButton(e){const t=xe[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:xe[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 Se=["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=Se.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 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 o=document.createElement("div");o.className="designbase-wc-top-banner__container";const d=document.createElement("div");d.className="designbase-wc-top-banner__content",e&&d.append(this.createBadge(e,l));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)),o.append(d),o.append(this.createCloseButton()),this.append(o)}}customElements.get("db-top-banner")||customElements.define("db-top-banner",DbTopBanner);const Ne=["s","m","l"],$e=["default","minimal","card","colored","iconBox"],Ie=["horizontal","vertical","reverse"],De=["primary","secondary","success","warning","error","info","custom"],Le={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=Ne.includes(n)?n:"m",r=this.getAttribute("variant")||"default",l=$e.includes(r)?r:"default",o=this.getAttribute("layout")||"horizontal",d=Ie.includes(o)?o:"horizontal",u=this.getAttribute("color")||"primary",b=De.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 k=document.createElement("div");k.className="designbase-wc-stat__body";const x=this.resolveIconName(s);if(x){const e=document.createElement("div");e.className=`designbase-wc-stat__icon designbase-wc-stat__icon--${i}`;const t="iconBox"===l?Le[a]:20;e.append(createDbIcon(x,t)),k.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(k.append(S),this.append(k),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 Me=["1:1","16:9","4:3","3:2","3:4","2:1","auto"],ze=["cover","contain","fill","none","scale-down"],Te=["lazy","eager"],Be=["skeleton","blur","none"],Pe=["s","m","l","full"],Fe=["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":Pe.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":Fe.includes(e)?`designbase-wc-image--shadow-${e}`:"":""}getRatioClass(){const e=this.getAttribute("ratio")||"auto";return"auto"===e?"designbase-wc-image--ratio-auto":Me.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=Te.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=Be.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=ze.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")||"",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),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 Oe=["grid","list","gallery","carousel"],He=["1","2","3","4","5","6"],Re=["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--${Oe.includes(t)?t:"grid"}`,`designbase-wc-image-list--columns-${He.includes(s)?s:"3"}`,`designbase-wc-image-list--spacing-${Re.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 Ve=["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(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,a={}){const r=document.createElement("db-button");r.className=e,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(t,s)),r.append(l),r.addEventListener("db-click",n),r}buildPortal(){const e=this.getAttribute("size")||"l",t=Ve.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 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",e=>{e.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 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;t.hidden=!i,e.replaceChildren(),i&&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)})}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 We=["s","m","l"],qe=["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()}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=We.includes(e)?e:"m",s=this.getAttribute("background-color")||"default",i=qe.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 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 e=createDbIcon(a,i);e.classList.add("designbase-wc-bottom-navigation__icon"),o.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)),o.append(t)}const d=document.createElement("span");d.className="designbase-wc-bottom-navigation__label",d.textContent=e.label,l.append(o,d),r.append(l),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 je=["s","m","l"],Ue=["default","transparent"],Ke=["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()}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--${je.includes(e)?e:"m"}`,`designbase-wc-navbar--${Ue.includes(t)?t:"default"}`,`designbase-wc-navbar--${Ke.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(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 l=document.createElement("ul");return l.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),l.append(s)}),i.append(n,l),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)}createMobileMenuItem(e,t){const s=Boolean(e.children?.length),i=Boolean(this.expandedMobile[e.id]),n=document.createElement("db-menu-item");return n.setAttribute("label",e.label),n.setAttribute("type","block"),n.setAttribute("menu-style","accordion"),n.setAttribute("size",t),e.href&&n.setAttribute("href",e.href),e.icon&&n.setAttribute("icon",e.icon),e.active&&n.setAttribute("active",""),e.disabled&&n.setAttribute("disabled",""),s&&(n.setAttribute("expandable",""),n.subItems=(e.children||[]).map(e=>({id:e.id,label:e.label,href:e.href,icon:e.icon,active:e.active,disabled:e.disabled})),i&&n.setAttribute("expanded","")),n.addEventListener("db-click",()=>{if(!e.disabled){if(s)return this.expandedMobile[e.id]=!i,void this.renderMobileMenu();this.mobileOpen=!1,this.dispatchItemClick(e,"mobile"),this.render()}}),n.addEventListener("db-child-click",e=>{const t=e.detail;this.mobileOpen=!1,this.dispatchItemClick(t.child,"mobile"),this.render()}),n}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 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(e=>g.append(this.createDesktopNavItem(e,t))),m.append(g),p.append(m),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),p.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 l=document.createElement("ul");if(l.className="designbase-wc-navbar__user-dropdown-menu",l.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),l.append(e)}i.forEach(t=>{const s=document.createElement("li");s.append(this.createUserMenuItemElement(t,e,()=>{this.userMenuOpen=!1,this.updateUserMenuVisibility()})),l.append(s)}),t.append(s,l),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)}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 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()}),l.append(o,p,E),this.append(l),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 Je=["s","m","l"],Ge=["default","dark","light"],Ye=["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}}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--${Je.includes(e)?e:"m"}`,`designbase-wc-sidebar--${Ge.includes(t)?t:"default"}`,`designbase-wc-sidebar--${Ye.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 l=document.createElement("db-menu-item");return l.setAttribute("label",e.label),l.setAttribute("type","block"),l.setAttribute("menu-style","accordion"),l.setAttribute("size",t),l.setAttribute("depth",String(s)),e.href&&l.setAttribute("href",e.href),e.icon&&l.setAttribute("icon",e.icon),e.active&&l.setAttribute("active",""),e.disabled&&l.setAttribute("disabled",""),void 0!==e.badge&&l.setAttribute("badge",String(e.badge)),e.badgeColor&&l.setAttribute("badge-color",e.badgeColor),i&&(l.setAttribute("expandable",""),l.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&&l.setAttribute("expanded","")),l.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)}),l.addEventListener("db-child-click",e=>{const t=e.detail;this.dispatchItemClick(t.child)}),r.append(l),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 l=document.createElement("div");if(l.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)}l.append(e)}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 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 l=document.createElement("div");if(l.className="designbase-wc-sidebar__user-name",l.textContent=n.name,r.append(l),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)}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=e=>{if(!this.open)return;const t=e.target;this.menuEl?.contains(t)||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 Xe=["s","m","l"],Ze=["default","primary","success","warning","danger"],Qe=["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",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--${Xe.includes(a)?a:"m"}`,`designbase-wc-progressbar--${Ze.includes(r)?r:"default"}`,`designbase-wc-progressbar--${Qe.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(e)),this.setAttribute("aria-valuemax",String(t)),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 e=document.createElement("span");e.className=`designbase-wc-progressbar__label designbase-wc-progressbar__label--${o}`,e.textContent=u,p.append(e)}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 e=document.createElement("span");e.className="designbase-wc-progressbar__fill-label",e.textContent=u,g.append(e)}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(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),l=a===n.length-1,o=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}`,o&&"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 p=document.createElement("div");if(p.className="designbase-wc-progress-step__indicator",o?(p.tabIndex=0,p.setAttribute("role","button"),p.setAttribute("aria-label",`${t.title} 단계로 이동`),p.addEventListener("click",()=>this.handleStepClick(t,a)),p.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleStepClick(t,a))})):p.tabIndex=-1,"active"===r){const e=document.createElement("div");e.className="designbase-wc-progress-step__pulse",p.append(e)}if(p.append(this.renderIndicatorContent(r,a,e)),b.append(p),!l){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 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=t.title,g.append(v),m.append(g),t.description){const e=document.createElement("p");e.className="designbase-wc-progress-step__description",e.textContent=t.description,m.append(e)}if(t.timestamp){const e=document.createElement("span");e.className="designbase-wc-progress-step__timestamp",e.textContent=t.timestamp,m.append(e)}u.append(m),this.append(u)})}}customElements.get("db-progress-step")||customElements.define("db-progress-step",DbProgressStep);const et="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=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","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(e){this.built&&(this.readAttributeValues(),this.syncClasses(),this.isStructuralAttribute(e)&&this.syncStructure(),this.syncVisuals(),this.syncA11y())}isStructuralAttribute(e){return["range","show-value","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(et),this.valuesEl=document.createElement("div"),this.valuesEl.className=`${et}__values`,this.containerEl=document.createElement("div"),this.containerEl.className=`${et}__container`,this.containerEl.setAttribute("role","slider"),this.containerEl.setAttribute("tabindex","0"),this.trackEl=document.createElement("div"),this.trackEl.className=`${et}__track`,this.fillEl=document.createElement("div"),this.fillEl.className=`${et}__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 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.getAttribute("value-position")||"top",n=[et,`${et}--${e}`,`${et}--${t}`,`${et}--value-${s?"top":"top"===i?"right":i}`,this.hasAttribute("disabled")?`${et}--disabled`:"",this.hasAttribute("readonly")?`${et}--readonly`:"",this.hasAttribute("full-width")?`${et}--full-width`:"",this.hasAttribute("vertical")?`${et}--vertical`:"",s?`${et}--range`:""].filter(Boolean);if(this.className=n.join(" "),this.trackEl){const e=[`${et}__track`];this.hasAttribute("disabled")&&e.push(`${et}__track--disabled`),this.hasAttribute("readonly")&&e.push(`${et}__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=`${et}__value ${et}__value--min`;const t=document.createElement("span");t.className=`${et}__value ${et}__value--max`,this.valuesEl.append(e,t)}else{const e=document.createElement("span");e.className=`${et}__value ${et}__value--single`,this.valuesEl.appendChild(e)}if(this.thumbEls.forEach(e=>e.remove()),this.thumbEls=[],this.trackEl.querySelectorAll(`.${et}__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=`${et}__mark`,s.setAttribute("aria-hidden","true"),this.isMarkActive(e)&&s.classList.add(`${et}__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=`${et}__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=`${et}__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)),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(`.${et}__value--min`),l=this.valuesEl?.querySelector(`.${et}__value--max`);r&&(r.textContent=String(e)),l&&(l.textContent=String(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(`.${et}__value--single`);i&&(i.textContent=String(this.currentValue))}this.trackEl?.querySelectorAll(`.${et}__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(`${et}__mark--active`,this.isMarkActive(n))})}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(`.${et}__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.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(`${et}__thumb--active`,t)}this.thumbEls[0]?.classList.toggle(`${et}__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 l=[...this.currentRange];if("min"===t?l[0]=a:l[1]=a,l[0]>l[1])return;return e.preventDefault(),this.currentRange=l,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 tt="designbase-wc-segment-control",st={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=[tt,`${tt}--${e}`,`${tt}--${t}`,"rounded"===s&&`${tt}--appearance-rounded`,this.hasAttribute("full-width")&&`${tt}--full-width`,i&&`${tt}--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),l=document.createElement("button");if(l.type="button",l.className=[`${tt}__segment`,n&&`${tt}__segment--selected`,r&&`${tt}__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,e.icon&&st[e.icon]){const t=document.createElement("span");t.className=`${tt}__segment-icon`,t.innerHTML=st[e.icon],l.appendChild(t)}const o=document.createElement("span");o.className=`${tt}__segment-label`,o.textContent=e.label,"icon-only"===t&&o.setAttribute("aria-label",e.label),l.appendChild(o),l.addEventListener("click",()=>this.select(e.value)),l.addEventListener("focus",()=>{this.focusedIndex=s,l.classList.add(`${tt}__segment--focused`)}),l.addEventListener("blur",()=>{this.focusedIndex=-1,l.classList.remove(`${tt}__segment--focused`)}),this.appendChild(l),this.segmentButtons.push(l)}),this.indicatorEl=document.createElement("div"),this.indicatorEl.className=`${tt}__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(`${tt}__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 it="designbase-wc-stepper",nt=["s","m","l"],at={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(`.${it}__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=`${it}__button ${it}__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=`${it}__value`,this.valueTextEl=document.createElement("span"),this.valueTextEl.className=`${it}__value-text`,this.valueWrapEl.appendChild(this.valueTextEl),this.incrementBtn=document.createElement("button"),this.incrementBtn.type="button",this.incrementBtn.className=`${it}__button ${it}__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=[it,`${it}--${nt.includes(e)?e:"m"}`,this.hasAttribute("full-width")&&`${it}--full-width`,this.isEditable()&&`${it}--editable`,t&&`${it}--disabled`,s&&`${it}--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,at),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=`${it}__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=`${it}__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(`${it}__button--disabled`,e)}if(this.incrementBtn){const e=s||i||r;this.incrementBtn.disabled=e,this.incrementBtn.classList.toggle(`${it}__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 rt=["s","m","l","xl","full"],lt=["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-${rt.includes(e)?e:"l"}`,lt.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 ot=["vertical","horizontal"],dt=["start","center","end","stretch"],ct=["start","center","end","space-between","space-around","space-evenly"],ht=["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=ht.includes(i)?i:"m";this.className=["designbase-wc-stack",`designbase-wc-stack--direction-${ot.includes(e)?e:"vertical"}`,`designbase-wc-stack--alignment-${dt.includes(t)?t:"start"}`,`designbase-wc-stack--justify-${ct.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 ut="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=`${ut}__native`,this.formEl.noValidate=!0,this.formEl.addEventListener("submit",this.boundSubmit),this.headerEl=document.createElement("div"),this.headerEl.className=`${ut}__header`,this.fieldsEl=document.createElement("div"),this.fieldsEl.className=`${ut}__fields`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${ut}__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=[ut,`${ut}--columns-${e}`,`${ut}--${t}`,`${ut}--${s}`,this.hasAttribute("submit-loading")&&`${ut}--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=`${ut}__title`,t.textContent=e,this.headerEl.appendChild(t)}if(t){const e=document.createElement("p");e.className=`${ut}__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=`${ut}__field-wrapper ${ut}__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=`${ut}__label`,e.htmlFor=`db-form-${t.name}`,e.textContent=t.label,t.required||t.validation?.required){const t=document.createElement("span");t.className=`${ut}__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(`${ut}__field-wrapper--error`,i),s.querySelector(`.${ut}__error`)?.remove(),s.querySelector(`.${ut}__help`)?.remove();const n=s.querySelector(`.${ut}__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=`${ut}__error`,t.textContent=this.errors[e],void s.appendChild(t)}if(t.helpText){const e=document.createElement("div");e.className=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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=`${ut}__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 bt=["default","minimal"],pt=["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 bt.includes(e)?e:"default"}getAlign(){const e=this.getAttribute("align")||"center";return pt.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,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 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 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 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(o.append(d),s&&e.length){const t=document.createElement("div");t.className="designbase-wc-page-header__cta",e.forEach(e=>t.append(e)),o.append(t)}if(this.append(o),!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 mt=["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=mt.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 gt=["s","m","l"],vt=["primary","secondary","tertiary"],Et={s:12,m:16,l:20},ft={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 gt.includes(e)?e:"m"}set size(e){this.setAttribute("size",e)}get variant(){const e=this.getAttribute("variant")||"primary";return vt.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--${ft[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,Et[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 wt={s:40,m:60,l:80,full:100},yt=["default","persistent","temporary","fullscreen"],At=["slide","fade","scale","none"];function resolveHeightPercent(e){if(!e)return wt.m;const t=wt[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)):wt.m}class DbBottomSheet extends HTMLElement{constructor(){super(...arguments),this.sheetHeightPercent=wt.m,this.isDragging=!1,this.isVisible=!1,this.isMounted=!1,this.keyHandler=null,this.dragState={active:!1,pointerId:-1,startY:0,startHeight:wt.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=yt.includes(t)?t:"default",n=At.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",(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",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",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=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(),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 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 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",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(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(...p),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 _t=["vertical","horizontal","both"],Ct=["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=_t.includes(e)?e:"vertical",i=Ct.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 kt=["s","m","l"],xt=["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=kt.includes(e)?e:"m",i=xt.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=kt.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 e=document.createElement("div");e.className="designbase-wc-dropzone__image";const t=document.createElement("img");t.src=l,t.alt="Upload illustration",e.append(t),n.append(e)}else if(o){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(p){const e=document.createElement("button");e.type="button",e.className="designbase-wc-dropzone__button",e.textContent=m,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",l=0===t,o=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="이전",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&&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 l=this.panelSizes[this.draggingIndex];if("horizontal"===t){const t=n.width,a=e.clientX-n.left;let o=0;for(let e=0;e<this.draggingIndex;e++){const n=this.panelSizes[e];o+="fixed"===s?n:n*t,o+=i}const d=a-o;if("fixed"===s)l=Math.max(r.minSize||0,Math.min(r.maxSize||t,d));else{l=d/t;const e=r.minSize?r.minSize/t:0,s=r.maxSize?r.maxSize/t:1;l=Math.max(e,Math.min(s,l))}}else{const t=n.height,a=e.clientY-n.top;let o=0;for(let e=0;e<this.draggingIndex;e++){const n=this.panelSizes[e];o+="fixed"===s?n:n*t,o+=i}const d=a-o;if("fixed"===s)l=Math.max(r.minSize||0,Math.min(r.maxSize||t,d));else{l=d/t;const e=r.minSize?r.minSize/t:0,s=r.maxSize?r.maxSize/t:1;l=Math.max(e,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 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 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"!==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],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"===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(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 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")),l=Array.from(this.querySelectorAll(":scope > .designbase-wc-split-view__splitter"));r.forEach(e=>e.remove()),l.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,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",t.parentElement!==o&&o.append(t),l.append(o),this.append(l),!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 St=["s","m","l"],Nt=["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=St.includes(e)?e:"m",i=Nt.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 l=document.createElement("div");l.className="designbase-wc-file-uploader__file-name",l.textContent=e.file.name;const o=document.createElement("div");if(o.className="designbase-wc-file-uploader__file-size",o.textContent=this.formatFileSize(e.file.size),r.append(l,o),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=(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}},$t=[{id:"today",label:"오늘",getRange:({today:e})=>clampRange({start:startOfDay(e),end:endOfDay(e)})},{id:"yesterday",label:"어제",getRange:({today:e})=>{const t=addDays(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(e,-("monday"===t?(s+6)%7:s))})(e,t);return clampRange({start:n,end:(a=n,endOfDay(addDays(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"}):"",It="designbase-wc-date-picker",Dt=["s","m","l"],Lt=["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?$t:[]}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=`${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"),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(),l=this.events.filter(t=>{const s=parseISODate(t.date);return!!s&&s.toDateString()===e.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=[`${It}__date`,!s&&this.showOutsideDays&&`${It}__date--outside`,i&&`${It}__date--today`,n&&`${It}__date--selected`,a&&!n&&`${It}__date--in-range`,"range"===this.effectiveMode&&(this.rangeStart?.toDateString()===e.toDateString()||u===e.toDateString())&&`${It}__date--range-start`,"range"===this.effectiveMode&&d===e.toDateString()&&`${It}__date--range-end`,r&&`${It}__date--weekend`,!this.isDateValid(e)&&`${It}__date--disabled`,l.length>0&&`${It}__date--has-events`].filter(Boolean).join(" "),b.disabled=!this.isDateValid(e)||this.disabled||this.readonly,b.addEventListener("click",()=>this.handleDateClick(e));const p=document.createElement("span");if(p.className=`${It}__date-number`,p.textContent=String(e.getDate()),b.appendChild(p),l.length>0){const e=document.createElement("div");e.className=`${It}__events`,l.slice(0,3).forEach(t=>{const s=document.createElement("div");s.className=`${It}__event ${It}__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=`${It}__month`;const r=document.createElement("div");if(r.className=`${It}__header`,s){const e=document.createElement("button");e.type="button",e.className=`${It}__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=`${It}__nav-spacer`,e.setAttribute("aria-hidden","true"),r.appendChild(e)}const l=document.createElement("div");if(l.className=`${It}__current-month`,l.textContent=e.toLocaleDateString(this.locale,{year:"numeric",month:"long"}),r.appendChild(l),i){const e=document.createElement("button");e.type="button",e.className=`${It}__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=`${It}__nav-spacer`,e.setAttribute("aria-hidden","true"),r.appendChild(e)}a.appendChild(r);const o=document.createElement("div");o.className=`${It}__weekdays`,(e=>{const t=["일","월","화","수","목","금","토"];return"monday"===e&&t.push(t.shift()),t})(this.startOfWeek).forEach(e=>{const t=document.createElement("div");t.className=`${It}__weekday`,t.textContent=e,o.appendChild(t)}),a.appendChild(o);const d=document.createElement("div");d.className=`${It}__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 l=new Date(a);return l.setDate(l.getDate()-r),Array.from({length:42},(e,t)=>{const s=new Date(l);return s.setDate(l.getDate()+t),s})})(e,this.startOfWeek,u).forEach((t,s)=>{if(!t){const e=document.createElement("span");return e.className=`${It}__date ${It}__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=`${It}__date ${It}__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=`${It}__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=`${It}__footer`;const s=document.createElement("button");s.type="button",s.className=`${It}__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=`${It}__panel`;const t=document.createElement("div");t.className=`${It}__presets`,t.setAttribute("role","listbox"),t.setAttribute("aria-label","기간 프리셋"),this.presets.forEach(e=>{const s=document.createElement("button");s.type="button",s.className=[`${It}__preset`,this.activePresetId===e.id&&`${It}__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=`${It}__panel-main`;const i=document.createElement("div");i.className=`${It}__months ${It}__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=`${It}__panel-footer`;const a=isRangeValue(this.tempValue)?this.tempValue:void 0,r=document.createElement("div");r.className=`${It}__range-display`;const l=document.createElement("span");l.className=`${It}__range-text`,l.textContent=a?.start&&parseISODate(a.start)?formatPanelInputDate(parseISODate(a.start),this.locale):"시작일";const o=document.createElement("span");o.className=`${It}__range-separator`,o.textContent="–";const d=document.createElement("span");d.className=`${It}__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=`${It}__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),e.appendChild(s),e}renderCalendar(){this.calendarHost&&(this.calendarHost.replaceChildren(),this.calendarHost.appendChild(this.isPanelLayout?this.renderPanelCalendar():this.renderDefaultCalendar()))}render(){const e=Dt.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=Lt.includes(this.getAttribute("variant")||"default")&&this.getAttribute("variant")||"default",s=this.getAttribute("dropdown-position")||"bottom-start",i=getDbComponentIconSize(e);if(this.className=[It,this.inline?`${It}--size-${e}`:`${It}--${e}`,`${It}--variant-${t}`,this.hasAttribute("full-width")&&`${It}--full-width`,this.disabled&&`${It}--disabled`,this.readonly&&`${It}--readonly`,this.isOpen&&`${It}--open`,this.hasAttribute("error")&&`${It}--error`,this.isPanelLayout&&`${It}--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(`.${It}__icon-display`);a&&(a.innerHTML="",a.appendChild(createDbIcon("calendar",i)),a.disabled=this.disabled);const r=this.triggerEl.querySelector(`.${It}__toggle`);if(r&&(r.innerHTML="",r.appendChild(createDbIcon("chevron-down",i)),r.disabled=this.disabled),this.dropdownEl.className=[`${It}__dropdown`,`${It}__dropdown--${s}`,this.isPanelLayout&&`${It}__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=`${It}__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 Mt="designbase-wc-time-picker",zt=["s","m","l"],Tt=["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 Tt.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=`${Mt}__label`,this.triggerEl=document.createElement("div"),this.triggerEl.className=`${Mt}__trigger`;const e=document.createElement("button");e.type="button",e.className=`${Mt}__icon-display`,e.setAttribute("aria-label","시간 선택 열기"),e.addEventListener("click",()=>this.toggleOpen()),this.inputEl=document.createElement("input"),this.inputEl.type="text",this.inputEl.className=`${Mt}__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=`${Mt}__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=`${Mt}__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=`${Mt}__wheel-container`;const l=document.createElement("div");l.className=`${Mt}__wheel-label`,l.textContent=t,r.appendChild(l);const o=document.createElement("div");o.className=`${Mt}__wheel-viewport`;const d=document.createElement("div");d.className=`${Mt}__wheel`,d.setAttribute("role","listbox"),d.setAttribute("aria-label",t);let u=null,b=!1,p=!1,m=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=[`${Mt}__wheel-item`,e===i&&`${Mt}__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=>{p=!0,m=e.clientY,g=d.scrollTop,d.setPointerCapture(e.pointerId),d.style.cursor="grabbing"}),d.addEventListener("pointermove",e=>{p&&(d.scrollTop=g-(e.clientY-m))});const endDrag=e=>{p&&(p=!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=`${Mt}__wheel-center-indicator`,E.setAttribute("aria-hidden","true");const f=document.createElement("div");f.className=`${Mt}__wheel-fade wheel-fade--top`,f.setAttribute("aria-hidden","true");const w=document.createElement("div");return w.className=`${Mt}__wheel-fade wheel-fade--bottom`,w.setAttribute("aria-hidden","true"),o.append(d,E,f,w),r.appendChild(o),r}renderSelector(e=!1){const t=document.createElement("div");t.className=`${Mt}__selector`;const s=document.createElement("div");s.className=`${Mt}__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,l=e?this.tempMinutes:this.minutes,o=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,l,o,d)})),s.appendChild(this.createWheel({label:"분",items:n,value:n.includes(l)?l:n[0],onChange:e=>onChange(r,e,o,d)})),this.showSeconds&&s.appendChild(this.createWheel({label:"초",items:a,value:o,onChange:e=>onChange(r,l,e,d)})),this.is12h&&s.appendChild(this.createWheel({label:"오전/오후",items:["AM","PM"],value:d,onChange:e=>onChange(r,l,o,e),formatter:e=>"AM"===e?"오전":"오후"})),t.appendChild(s),e)return t;const u=document.createElement("div");u.className=`${Mt}__dropdown-actions`;const b=document.createElement("div");b.className=`${Mt}__preview`,b.setAttribute("aria-live","polite"),b.appendChild(createDbIcon("clock",16));const p=document.createElement("div");p.className=`${Mt}__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),t.appendChild(u),t}render(){const e=zt.includes(this.getAttribute("size")||"m")&&this.getAttribute("size")||"m",t=this.getAttribute("dropdown-position")||"bottom-start",s=getDbComponentIconSize(e);if(this.className=[Mt,`${Mt}--${e}`,this.hasAttribute("full-width")&&`${Mt}--full-width`,this.disabled&&`${Mt}--disabled`,this.readonly&&`${Mt}--readonly`,this.isOpen&&`${Mt}--open`,this.hasAttribute("error")&&`${Mt}--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(`.${Mt}__icon-display`);n&&(n.innerHTML="",n.appendChild(createDbIcon("clock",s)),n.disabled=this.disabled);const a=this.triggerEl.querySelector(`.${Mt}__toggle`);if(a&&(a.innerHTML="",a.appendChild(createDbIcon("chevron-down",s)),a.disabled=this.disabled),this.dropdownEl.className=[`${Mt}__dropdown`,`${Mt}__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=`${Mt}__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 Bt="designbase-wc-calendar",Pt=[{value:"meeting",label:"회의"},{value:"task",label:"업무"},{value:"reminder",label:"알림"},{value:"birthday",label:"생일"},{value:"holiday",label:"휴일"},{value:"custom",label:"기타"}],Ft=[{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=`${Bt}__header`,this.bodyEl=document.createElement("div"),this.bodyEl.className=`${Bt}__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=`${Bt}__navigation`;const t=getDbComponentIconSize("m"),s=document.createElement("button");s.type="button",s.className=`${Bt}__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=`${Bt}__title`,i.textContent=this.selectedDate.toLocaleDateString(this.locale,{year:"numeric",month:"long"});const n=document.createElement("button");n.type="button",n.className=`${Bt}__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=`${Bt}__month-view`;const t=document.createElement("div");t.className=`${Bt}__weekdays`,["일","월","화","수","목","금","토"].forEach(e=>{const s=document.createElement("div");s.className=`${Bt}__weekday`,s.textContent=e,t.appendChild(s)}),e.appendChild(t);const s=document.createElement("div");s.className=`${Bt}__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 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 o=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(),p=Boolean(d&&!u&&!b);o.className=[`${Bt}__day`,i&&`${Bt}__day--current-month`,this.highlightToday&&t.toDateString()===l.toDateString()&&`${Bt}__day--today`,this.isSameDate(t,this.selectedDate)&&`${Bt}__day--selected`,u&&`${Bt}__day--selected--start`,b&&`${Bt}__day--selected--end`,p&&`${Bt}__day--selected--middle`,!this.showWeekends&&a&&`${Bt}__day--weekend`].filter(Boolean).join(" "),o.addEventListener("click",()=>this.handleDateClick(t));const m=document.createElement("span");m.className=`${Bt}__day-number`,m.textContent=String(t.getDate()),o.appendChild(m);const g=this.eventsForDate(t);if(g.length){const e=document.createElement("div");if(e.className=`${Bt}__day-events`,g.slice(0,2).forEach(t=>{const s=document.createElement("div");s.className=[`${Bt}__event-bar`,`${Bt}__event-bar--${t.type}`].filter(Boolean).join(" "),t.color&&(s.style.backgroundColor=t.color),this.draggedEvent?.id===t.id&&s.classList.add(`${Bt}__event-bar--dragging`),s.title=t.title,s.draggable=!0;const i=document.createElement("span");i.className=`${Bt}__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=`${Bt}__more-events`,t.textContent=`+${g.length-2} more`,e.appendChild(t)}o.appendChild(e)}const v=document.createElement("div");v.className=[`${Bt}__drop-zone`,this.dragOverDate&&this.isSameDate(this.dragOverDate,t)&&`${Bt}__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)),o.appendChild(v),s.appendChild(o)}return e.appendChild(s),e}renderYearView(){const e=document.createElement("div");e.className=`${Bt}__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=`${Bt}__year-month`,a.addEventListener("click",()=>{this.selectedDate=i,this.handleViewChange("month")});const r=document.createElement("h3");if(r.className=`${Bt}__year-month-title`,r.textContent=i.toLocaleDateString(this.locale,{month:"long"}),a.appendChild(r),n.length){const e=document.createElement("div");if(e.className=`${Bt}__year-month-events`,n.slice(0,4).forEach(t=>{const s=document.createElement("span");s.className=[`${Bt}__year-event`,`${Bt}__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=`${Bt}__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=`${Bt}__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=`${Bt}__week-header`;const n=document.createElement("div");n.className=`${Bt}__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=[`${Bt}__week-day-header`,n.toDateString()===t.toDateString()&&`${Bt}__week-day-header--today`].filter(Boolean).join(" ");const r=document.createElement("span");r.className=`${Bt}__week-day-name`,r.textContent=n.toLocaleDateString(this.locale,{weekday:"short"});const l=document.createElement("span");l.className=`${Bt}__week-day-number`,l.textContent=String(n.getDate()),a.append(r,l),i.appendChild(a)}e.appendChild(i);const a=document.createElement("div");a.className=`${Bt}__week-grid`;const r=document.createElement("div");r.className=`${Bt}__week-time-column`;for(let e=6;e<=22;e+=1){const t=document.createElement("div");t.className=`${Bt}__time-slot`;const s=document.createElement("span");s.className=`${Bt}__time-label`,s.textContent=`${String(e).padStart(2,"0")}:00`,t.appendChild(s),r.appendChild(t)}a.appendChild(r);const l=document.createElement("div");l.className=`${Bt}__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=`${Bt}__week-column`;for(let e=6;e<=22;e+=1){const s=document.createElement("div");s.className=`${Bt}__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),l=60*t+(s||0),o=Math.max(20,48*(r-l)/60),d=document.createElement("div");d.className=[`${Bt}__week-event`,`${Bt}__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=`${o}px`,d.addEventListener("click",t=>this.handleEventClick(e,t)),i.appendChild(d)}),l.appendChild(i)}return a.appendChild(l),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=`${Bt}__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(Pt)),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(Ft)),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 l=document.createElement("db-time-picker");l.setAttribute("label","종료 시간"),l.setAttribute("full-width",""),l.setAttribute("value",this.eventForm.endTime),l.addEventListener("db-change",e=>{this.eventForm.endTime=e.detail.value}),e.append(t,s,i,n,a,r,l);const o=document.createElement("div");if(o.className=`${Bt}__event-form-footer`,o.style.display="flex",o.style.gap="8px",o.style.justifyContent="flex-end",o.style.marginTop="16px",this.isEditing){const e=document.createElement("db-button");e.setAttribute("variant","danger"),e.textContent="삭제",e.addEventListener("click",()=>this.deleteEvent()),o.appendChild(e)}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),e.appendChild(o),this.modalEl.appendChild(e)}render(){this.className=Bt,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 Ot=["s","m","l"],Ht=["default","minimal","card","inline","large"],Rt=["stars","number","both","reviews","detailed"],Vt=["star","number","percentage","text"],Wt=["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",Ot,"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(),l=e.querySelector("svg");l?.getAttribute("data-designbase-icon")===a&&l.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(),l=s||n,o=Array.from(this.starsEl.querySelectorAll(":scope > .designbase-wc-rating__star"));for(let e=0;e<5;e+=1){const t=this.getStarFill(e,a,l),s=n&&t>0,i=o[e]??document.createElement("span");i.setAttribute("aria-hidden","true"),this.updateStarElement(i,t,e,r,s),o[e]||this.starsEl.append(i)}for(let e=o.length-1;e>=5;e-=1)o[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",Ht,"default"),n=this.getOption("type",Vt,"star"),a=this.getOption("display",Rt,"stars"),r=this.getOption("color",Wt,"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(e,t,n,o)}`);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,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 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")||(l>0?`${l.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 qt=["s","m","l"],jt=["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",qt,"m"),t=this.optionAttr("variant",jt,"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],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 e=document.createElement("div");e.className="designbase-wc-countdown__label",e.textContent=n[i.key],l.append(e)}if(r.push(l),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 Ut=[1,2,3,4,5,6],Kt=["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=Ut.includes(e)?e:3,s=this.getAttribute("spacing")||"m",i=Kt.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=Array.from({length:t},()=>[]),l=new Array(t).fill(0);this.images.forEach(e=>{const t=l.indexOf(Math.min(...l));r[t].push(e),l[t]+=1});const o=document.createDocumentFragment();r.forEach(e=>{const t=document.createElement("div");t.className="designbase-wc-masonry__column",e.forEach(e=>{const s=this.images.indexOf(e),i=document.createElement("figure");i.className="designbase-wc-masonry__item";const n=document.createElement("img");if(n.className="designbase-wc-masonry__image",n.src=e.thumbnail||e.src,n.alt=e.alt||e.title||`image-${s+1}`,n.loading="lazy",n.addEventListener("load",()=>{this.dispatchEvent(new CustomEvent("db-image-load",{detail:{image:e,index:s},bubbles:!0,composed:!0}))}),n.addEventListener("error",()=>{this.dispatchEvent(new CustomEvent("db-image-error",{detail:{image:e,index:s},bubbles:!0,composed:!0}))}),i.append(n),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)}i.append(t)}a&&(i.tabIndex=0,i.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("db-image-click",{detail:{image:e,index:s},bubbles:!0,composed:!0}))})),t.append(i)}),o.append(t)}),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 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),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-${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 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((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(l&&e.title||o&&e.description){const t=document.createElement("div");if(t.className="designbase-wc-carousel__slide-info",i&&(t.style.color=i),l&&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(o&&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)}),m.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()),m.append(e,t)}const v=[m];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",""),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",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}},Jt=["s","m","l"],Gt=["dropdown","modal"],Yt=["bottom-start","bottom-end","top-start","top-end"],Xt="#006FFF",Zt=hexToRgb$1(Xt)??{r:0,g:111,b:255},Qt=rgbToHsv(Zt.r,Zt.g,Zt.b),es=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=Qt.h,this.s=Qt.s,this.v=Qt.v,this.a=100,this.open=!1,this.format="hex",this.colorInput=Xt,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",Gt,"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",Jt,"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,l=0,o=0;return e>=0&&e<60?(r=i,l=n,o=0):e<120?(r=n,l=i,o=0):e<180?(r=0,l=i,o=n):e<240?(r=0,l=n,o=i):e<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 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 l=(i+n)/2;if(i!==n){const o=i-n;switch(r=l>.5?o/(2-i-n):o/(i+n),i){case e:a=(t-s)/o+(t<s?6:0);break;case t:a=(s-e)/o+2;break;case s:a=(e-t)/o+4}a*=60}return{h:a,s:100*r,l:100*l}})(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?Xt: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",Jt,"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",Gt,"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 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",es),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()}),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 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",Jt,"m"),t=this.getOption("type",Gt,"dropdown"),s=this.getOption("position",Yt,"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--${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&&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"===t&&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 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 ts=["default","bordered","filled","minimal"],ss=["s","m","l"],is=["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",is,"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,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"===e),n.classList.toggle("designbase-wc-reorder__item--drag-up",o&&"vertical"===e),n.classList.toggle("designbase-wc-reorder__item--drag-right",l&&"horizontal"===e),n.classList.toggle("designbase-wc-reorder__item--drag-left",o&&"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",is,"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",ts,"default"),t=this.getOption("size",ss,"m"),s=this.getOption("orientation",is,"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--${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 o=document.createDocumentFragment();this.items.forEach((e,d)=>{const u=document.createElement("div"),b=i||!!e.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",e.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",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"),l){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),o.append(u)}),this.replaceChildren(o)}}customElements.get("db-reorder")||customElements.define("db-reorder",DbReorder);const ns=["both","horizontal","vertical"],as=["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&&ns.includes(e)?e:"both"}getHandlePosition(){const e=this.getAttribute("handle-position");return e&&as.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 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 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 rs="designbase-wc-video-player",ls=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=`${rs}__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=`${rs}__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=`${rs}__video`;const e=document.createElement("div");e.className=`${rs}__loading`;const t=document.createElement("div");t.className=`${rs}__spinner`,e.append(t);const s=document.createElement("div");s.className=`${rs}__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=`${rs}__dim-overlay`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${rs}__overlay`;const a=document.createElement("div");a.className=`${rs}__top-controls`;const r=document.createElement("div");r.className=`${rs}__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=`${rs}__center-controls`;const u=this.skipButton("-10",-10);this.centerPlayEl=document.createElement("button"),this.centerPlayEl.type="button",this.centerPlayEl.className=`${rs}__play-button`,this.centerPlayEl.addEventListener("click",e=>{e.stopPropagation(),this.togglePlay()});const b=this.skipButton("+10",10);d.append(u,this.centerPlayEl,b);const p=document.createElement("div");p.className=`${rs}__bottom-controls`,this.progressEl=document.createElement("div"),this.progressEl.className=`${rs}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${rs}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${rs}__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 m=document.createElement("div");m.className=`${rs}__controls`;const g=document.createElement("div");g.className=`${rs}__left-controls`,this.togglePlayEl=this.iconButton("play",ls,()=>this.togglePlay()),this.volumeWrapEl=document.createElement("div"),this.volumeWrapEl.className=`${rs}__volume`,this.muteButtonEl=this.iconButton("volume-up",ls,()=>this.toggleMute());const v=document.createElement("div");v.className=`${rs}__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=`${rs}__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=`${rs}__right-controls`,this.fullscreenButtonEl=this.iconButton("expand",ls,()=>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,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",ls))}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,ls))}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),l=this.getBool("enable-fullscreen",!0);this.className=[rs,`${rs}--size-${e}`,`${rs}--variant-${t}`,`${rs}--theme-${s}`,this.isPlaying&&`${rs}--playing`,!this.isPlaying&&`${rs}--paused`,this.isMuted&&`${rs}--muted`,this.isLoading&&`${rs}--loading`,this.error&&`${rs}--error`,i&&this.showControlsOverlay&&`${rs}--show-controls`,this.isFullscreen&&`${rs}--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",ls)),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"),l=document.createDocumentFragment();if(l.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),l.append(e)}this.replaceChildren(l)}}customElements.get("db-youtube-player")||customElements.define("db-youtube-player",DbYouTubePlayer);const os="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=`${os}__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=[os,`${os}--size-${e}`,`${os}--variant-${t}`,`${os}--theme-${s}`].join(" "),this.audioEl=document.createElement("audio"),this.audioEl.preload="metadata",this.audioEl.hidden=!0;const i=document.createElement("div");i.className=`${os}__loading`;const n=document.createElement("div");n.className=`${os}__spinner`,i.append(n);const a=document.createElement("div");a.className=`${os}__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=`${os}__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=`${os}__main`;const u=document.createElement("div");u.className=`${os}__info`,this.titleEl=document.createElement("div"),this.titleEl.className=`${os}__title`,this.artistEl=document.createElement("div"),this.artistEl.className=`${os}__artist`,this.albumEl=document.createElement("div"),this.albumEl.className=`${os}__album`,u.append(this.titleEl,this.artistEl,this.albumEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${os}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${os}__progress-bar`,this.progressHandleEl=document.createElement("div"),this.progressHandleEl.className=`${os}__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=`${os}__controls`;const p=document.createElement("div");p.className=`${os}__left-controls`;const m=document.createElement("div");m.className=`${os}__center-controls`;const g=document.createElement("div");g.className=`${os}__right-controls`,this.playButtonEl=document.createElement("button"),this.playButtonEl.type="button",this.playButtonEl.className=`${os}__play-button`,this.playButtonEl.addEventListener("click",()=>this.togglePlay()),m.append(this.playButtonEl),b.append(p,m,g);const v=document.createElement("div");v.className=`${os}__bottom-controls`;const E=document.createElement("div");E.className=`${os}__left-bottom`;const f=document.createElement("div");f.className=`${os}__right-bottom`;const w=document.createElement("div");w.className=`${os}__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=`${os}__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=`${os}__volume-slider`;const k=document.createElement("div");k.className="volume-label";const x=document.createElement("span");x.textContent="🔊";const S=document.createElement("span");k.append(x,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(k,this.volumeInputEl),A.append(_,C);const N=document.createElement("div");N.className=`${os}__settings`;const $=this.iconButton("settings",()=>{this.showSettingsMenu=!this.showSettingsMenu,this.updateSettingsMenu()});this.settingsMenuEl=document.createElement("div"),this.settingsMenuEl.className=`${os}__settings-menu`,this.settingsMenuEl.hidden=!0;const I=document.createElement("div");I.className=`${os}__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=`${os}__playlist`,M.hidden=!0;const z=document.createElement("h4");z.textContent="플레이리스트",this.playlistTracksEl=document.createElement("div"),this.playlistTracksEl.className=`${os}__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 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=`${os}__playlist-track${t===this.playlistIndex?` ${os}__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=`${os}__playlist-track-info`;const n=document.createElement("div");n.className=`${os}__playlist-track-title`,n.textContent=e.title||"Unknown Track";const a=document.createElement("div");a.className=`${os}__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(`${os}__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),l=this.getBool("show-settings",!1);this.className=[os,`${os}--size-${e}`,`${os}--variant-${t}`,`${os}--theme-${s}`,this.isPlaying&&`${os}--playing`,!this.isPlaying&&`${os}--paused`,this.isMuted&&`${os}--muted`,this.isLoading&&`${os}--loading`,this.error&&`${os}--error`,this.isShuffle&&`${os}--shuffle`,`${os}--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(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 ds=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,"&amp;").replace(/</g,"&lt;").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 l in a)if(a.hasOwnProperty(l)){if(l==t)for(var o in s)s.hasOwnProperty(o)&&(r[o]=s[o]);s.hasOwnProperty(l)||(r[l]=a[l])}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 l=e[r],o=n.util.type(l);"Object"!==o||i[a(l)]?"Array"!==o||i[a(l)]||(i[a(l)]=!0,DFS(l,t,r,i)):(i[a(l)]=!0,DFS(l,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 l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&n.util.setLanguage(l,a);var o={element:t,language:a,grammar:r,code:t.textContent};function insertHighlightedCode(e){o.highlightedCode=e,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&&e.Worker){var d=new Worker(n.filename);d.onmessage=function(e){insertHighlightedCode(e.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(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 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!==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(m){if(!(A=matchPattern(E,w,e,p))||A.index>=e.length)break;var C=A.index,k=A.index+A[0].length,x=w;for(x+=f.value.length;C>=x;)x+=(f=f.next).value.length;if(w=x-=f.value.length,f.value instanceof Token)continue;for(var S=f;S!==t.tail&&(x<k||"string"==typeof S.value);S=S.next)_++,x+=S.value.length;_--,y=e.slice(w,x),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(t,L,$),w+=$.length),removeRange(t,L,_),f=addAfter(t,L,new Token(l,b?n.tokenize(N,b):N,g,N)),I&&addAfter(t,f,I),_>1){var M={cause:l+","+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 l in i.attributes)r+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,"&quot;")+'"';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:{});"undefined"!=typeof module&&module.exports&&(module.exports=ds),"undefined"!=typeof global&&(global.Prism=ds),ds.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]},ds.languages.markup.tag.inside["attr-value"].inside.entity=ds.languages.markup.entity,ds.languages.markup.doctype.inside["internal-subset"].inside=ds.languages.markup,ds.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Object.defineProperty(ds.languages.markup.tag,"addInlined",{value:function addInlined(e,t){var s={};s["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:ds.languages[t]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};i["language-"+t]={pattern:/[\s\S]+/,inside:ds.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},ds.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(ds.languages.markup.tag,"addAttribute",{value:function(e,t){ds.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:ds.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),ds.languages.html=ds.languages.markup,ds.languages.mathml=ds.languages.markup,ds.languages.svg=ds.languages.markup,ds.languages.xml=ds.languages.extend("markup",{}),ds.languages.ssml=ds.languages.xml,ds.languages.atom=ds.languages.xml,ds.languages.rss=ds.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"))}(ds),ds.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:/[{}[\];(),.:]/},ds.languages.javascript=ds.languages.extend("clike",{"class-name":[ds.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}|\?\?=?|\?\.?|[~:]/}),ds.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,ds.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:ds.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:ds.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:ds.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:ds.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:ds.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),ds.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:ds.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"}}),ds.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),ds.languages.markup&&(ds.languages.markup.tag.addInlined("script","javascript"),ds.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")),ds.languages.js=ds.languages.javascript,function(){if(void 0!==ds&&"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",s="loading",i="loaded",n="pre[data-src]:not(["+t+'="'+i+'"]):not(['+t+'="'+s+'"])';ds.hooks.add("before-highlightall",function(e){e.selector+=", "+n}),ds.hooks.add("before-sanity-check",function(a){var r=a.element;if(r.matches(n)){a.code="",r.setAttribute(t,s);var l=r.appendChild(document.createElement("CODE"));l.textContent="Loading…";var o=r.getAttribute("data-src"),d=a.language;if("none"===d){var u=(/\.(\w+)$/.exec(o)||[,"none"])[1];d=e[u]||u}ds.util.setLanguage(l,d),ds.util.setLanguage(r,d);var b=ds.plugins.autoloader;b&&b.loadLanguages(d),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)}(o,function(e){r.setAttribute(t,i);var s=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]}}(r.getAttribute("data-range"));if(s){var n=e.split(/\r\n?|\n/g),a=s[0],o=null==s[1]?n.length:s[1];a<0&&(a+=n.length),a=Math.max(0,Math.min(a-1,n.length)),o<0&&(o+=n.length),o=Math.max(0,Math.min(o,n.length)),e=n.slice(a,o).join("\n"),r.hasAttribute("data-start")||r.setAttribute("data-start",String(a+1))}l.textContent=e,ds.highlightElement(l)},function(e){r.setAttribute(t,"failed"),l.textContent=e})}}),ds.plugins.fileHighlight={highlight:function highlight(e){for(var t,s=(e||document).querySelectorAll(n),i=0;t=s[i++];)ds.highlightElement(t)}};var a=!1;ds.fileHighlight=function(){a||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),a=!0),ds.plugins.fileHighlight.highlight.apply(this,arguments)}}}();var cs=Object.freeze({__proto__:null});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(/&amp;/,"&"))}),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 hs={js:"javascript",ts:"typescript",sh:"bash",shell:"bash",html:"markup",xml:"markup",svg:"markup"},us={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 hs[t]??t},formatLanguageLabel=e=>{const t=resolvePrismLanguage(e);return us[t]??e.toUpperCase()},highlightWithPrism=(e,t)=>{const s=(()=>{const e=globalThis.Prism;return e?.languages?e:cs})(),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),bs="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),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[t.id]??t.code:t.code,v=g.trim();let E=null;if(l&&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=[bs,`${bs}--overflow-${p}`,"auto"!==o&&`${bs}--theme-${o}`,m&&`${bs}--editable`].filter(Boolean).join(" ");const y=document.createElement("div");y.className=`${bs}__toolbar`;const A=document.createElement("div");if(A.className=`${bs}__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=`${bs}__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=`${bs}__body`,i&&t.description){const e=document.createElement("p");e.className=`${bs}__caption`,e.textContent=t.description,_.append(e)}if(m){void 0===this.editedCodes[t.id]&&(this.editedCodes[t.id]=t.code);const e=document.createElement("div");e.className=`${bs}__editor`;const s=document.createElement("pre");s.className=`${bs}__pre ${bs}__pre--mirror`,s.setAttribute("aria-hidden","true");const i=document.createElement("code");i.className=`${bs}__code language-${a}`,E?i.innerHTML=E:i.textContent=g,s.append(i);const n=document.createElement("textarea");n.className=`${bs}__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=l&&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=`${bs}__pre`;const t=document.createElement("code");t.className=`${bs}__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 ps="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=[ps,`${ps}--size-${e}`,`${ps}--variant-${t}`,`${ps}--mode-${this.currentMode}`,`${ps}--theme-${s}`,this.isFocused&&`${ps}--focused`,this.getBool("disabled")&&`${ps}--disabled`,this.getBool("readonly")&&`${ps}--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,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+t.length+(a?a.length:e.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 e=this.getBool("show-toolbar",!0);this.toolbarEl.hidden=!e,this.toolbarEl.replaceChildren();const t=document.createElement("div");t.className=`${ps}__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=`${ps}__mode-button${this.currentMode===e?` ${ps}__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=`${ps}__toolbar-separator`,this.toolbarEl.append(s),"code"!==this.currentMode&&(this.getDefaultToolbarActions().forEach(e=>{const t=document.createElement("button");if(t.type="button",t.className=`${ps}__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=`${ps}__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=`${ps}__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(`![${e.name}](${t})`)}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=`${ps}__toolbar`,this.contentEl=document.createElement("div"),this.contentEl.className=`${ps}__content`,this.editPanelEl=document.createElement("div"),this.editPanelEl.className=`${ps}__edit-panel`,this.textareaEl=document.createElement("textarea"),this.textareaEl.className=`${ps}__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=`${ps}__preview-panel`,this.previewEl=document.createElement("div"),this.previewEl.className=`${ps}__preview`,this.previewPanelEl.append(this.previewEl),this.codePanelEl=document.createElement("div"),this.codePanelEl.className=`${ps}__code-panel`,this.codeViewEl=document.createElement("pre"),this.codeViewEl.className=`${ps}__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=`${ps}__status`,this.wordCountEl=document.createElement("span"),this.wordCountEl.className=`${ps}__word-count`,this.lineCountEl=document.createElement("span"),this.lineCountEl.className=`${ps}__line-count`,this.lastSavedEl=document.createElement("span"),this.lastSavedEl.className=`${ps}__last-saved`,this.savingEl=document.createElement("span"),this.savingEl.className=`${ps}__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 ms="designbase-wc-testimonial",gs=["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=`${ms}__quote`,this.footerEl=document.createElement("div"),this.footerEl.className=`${ms}__footer`,this.avatarWrapEl=document.createElement("div"),this.avatarWrapEl.className=`${ms}__avatar`,this.avatarEl=document.createElement("db-avatar"),this.avatarEl.className=`${ms}__avatar-image`,this.avatarWrapEl.append(this.avatarEl);const e=document.createElement("div");e.className=`${ms}__meta`,this.authorEl=document.createElement("span"),this.authorEl.className=`${ms}__author`,this.roleEl=document.createElement("span"),this.roleEl.className=`${ms}__role`,this.ratingEl=document.createElement("db-rating"),this.ratingEl.className=`${ms}__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=`${ms}__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 gs.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"),l=Number(this.getAttribute("max-rating")||5),o=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),l):void 0,d=this.getVariant(),u=this.getAttribute("align")||"left",b=[ms,`${ms}--variant-${d}`,"left"!==u?`${ms}--align-${u}`:""].filter(Boolean).join(" ");this.className=b,this.innerEl&&(this.innerEl.className=`${ms}__inner`),this.quoteEl&&(this.quoteEl.textContent=e?`“${e}”`:""),this.authorEl&&(this.authorEl.textContent=t);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",`${t} 프로필 이미지`)),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 vs="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()}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=`${vs}__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=`${vs}__background-image`,this.backgroundImageEl.hidden=!0,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${vs}__overlay`,this.overlayEl.hidden=!0;const e=document.createElement("div");e.className=`${vs}__container`;const t=document.createElement("div");t.className=`${vs}__content`,this.titleEl=document.createElement("h1"),this.titleEl.className=`${vs}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${vs}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${vs}__description`,this.buttonsEl=document.createElement("div"),this.buttonsEl.className=`${vs}__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),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=[vs,`${vs}--variant-${l}`,`${vs}--theme-${o}`,`${vs}--alignment-${d}`,u&&`${vs}--animated`,b&&`${vs}--full-height`,f&&`${vs}--on-media`].filter(Boolean).join(" "),this.style.minHeight=p||"",this.style.maxHeight=m||"",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(`.${vs}__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=`${vs}__button-content`;const i=document.createElement("span");i.className=`${vs}__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 Es="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}}parseActions(){try{const e=JSON.parse(this.getAttribute("actions")||"[]");return Array.isArray(e)?e:[]}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=Es;const e=document.createElement("div");e.className=`${Es}__inner`;const t=document.createElement("div");t.className=`${Es}__content`,this.badgeEl=document.createElement("db-badge"),this.badgeEl.className=`${Es}__badge`,this.badgeEl.hidden=!0,this.headlineEl=document.createElement("h2"),this.headlineEl.className=`${Es}__headline`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${Es}__subtitle`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${Es}__description`,this.actionsEl=document.createElement("div"),this.actionsEl.className=`${Es}__actions`,t.append(this.badgeEl,this.headlineEl,this.subtitleEl,this.descriptionEl,this.actionsEl),this.mediaEl=document.createElement("div"),this.mediaEl.className=`${Es}__media`,this.imageEl=document.createElement("img"),this.imageEl.className=`${Es}__image`,this.mediaEl.append(this.imageEl),e.append(t,this.mediaEl),this.featureWrapEl.append(e),this.sectionEl.append(this.featureWrapEl),this.append(this.sectionEl)}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",l=this.getAttribute("size")||"l",o=this.hasAttribute("tinted"),d=this.parseBadge(),u=this.parseActions(),b=[Es,`${Es}--media-${a}`,`${Es}--padding-${r}`,o&&`${Es}--tinted`].filter(Boolean).join(" ");this.className=Es,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=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(),u.length>0?(u.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 fs="designbase-wc-app-badge",ws={"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=`${fs}__icon`,this.iconWrapEl.setAttribute("aria-hidden","true");const e=document.createElement("span");e.className=`${fs}__text`,this.labelEl=document.createElement("span"),this.labelEl.className=`${fs}__label`,this.storeEl=document.createElement("span"),this.storeEl.className=`${fs}__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=ws[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=[fs,`${fs}--${s}`,`${fs}--${i}`,`${fs}--${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 ys="designbase-wc-section-contact",As="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:As,href:`mailto:${As}`}}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=ys,this.contactWrapEl=document.createElement("div"),this.contactWrapEl.className=`${ys}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${ys}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${ys}__description`,this.actionEl=document.createElement("db-button"),this.actionEl.className=`${ys}__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.contactWrapEl.append(this.titleEl,this.descriptionEl,this.actionEl),this.wrapEl.append(this.contactWrapEl),this.sectionEl.append(this.wrapEl),this.append(this.sectionEl)}updateUI(){const e=this.getAttribute("title")||"문의하기",t=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=[ys,`${ys}--${s}`,`${ys}--padding-${i}`,a&&`${ys}--accent`].filter(Boolean).join(" ");this.className=ys,this.wrapEl&&(this.wrapEl.className=l),this.contactWrapEl&&(this.contactWrapEl.className=`${ys}__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=e),this.descriptionEl&&(this.descriptionEl.textContent=t,this.descriptionEl.hidden=!t),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 _s="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()}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.sectionEl=document.createElement("db-section"),this.sectionEl.setAttribute("no-padding",""),this.sectionEl.setAttribute("data-wc-internal",""),this.wrapEl=document.createElement("div"),this.wrapEl.className=_s,this.innerEl=document.createElement("div"),this.innerEl.className=`${_s}__inner`,this.titleEl=document.createElement("h2"),this.titleEl.className=`${_s}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.className=`${_s}__description`,this.badgesEl=document.createElement("div"),this.badgesEl.className=`${_s}__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 e=this.getAttribute("title")||"지금 바로 시작하세요",t=this.getAttribute("description")||"앱을 다운로드하고 바로 이용해 보세요.",s=this.getAttribute("align")||"center",i=this.getAttribute("size")||"l",n=this.parseStores(),a=[_s,`${_s}--${s}`].join(" ");this.className=_s,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=e),this.descriptionEl&&(this.descriptionEl.textContent=t,this.descriptionEl.hidden=!t),this.badgesEl&&(this.badgesEl.replaceChildren(),n.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 Cs="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(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}catch{}const e=Array.from(this.children).filter(e=>!e.hasAttribute("data-wc-internal"));return e.length>0?e.map(e=>e.textContent?.trim()||""):[]}build(){this.containerEl=document.createElement("div"),this.srOnlyEl=document.createElement("span"),this.srOnlyEl.className=`${Cs}__sr-only`,this.trackEl=document.createElement("div"),this.trackEl.className=`${Cs}__track`,this.baseGroupEl=document.createElement("div"),this.baseGroupEl.className=`${Cs}__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(e=>{e.removeEventListener("load",this.boundMeasure),e.removeEventListener("error",this.boundMeasure)})}bindImageListeners(){this.baseGroupEl&&(this.unbindImageListeners(),this.baseGroupEl.querySelectorAll("img").forEach(e=>{e.complete||(e.addEventListener("load",this.boundMeasure),e.addEventListener("error",this.boundMeasure))}))}renderItem(e){const t=document.createElement("div");return t.className=`${Cs}__item`,t.textContent=e,t}renderGroup(e,t){const s=t??document.createElement("div");return s.className=`${Cs}__group`,s.setAttribute("aria-hidden","true"),s.replaceChildren(...e.map(e=>this.renderItem(e))),s}renderDuplicates(){if(!this.trackEl||!this.baseGroupEl)return;const e=this.parseItems();this.renderGroup(e,this.baseGroupEl);const t=this.baseGroupWidth>0?Math.max(1,Math.ceil(this.containerWidth/this.baseGroupWidth)):1,s=[];for(let i=0;i<t;i+=1)s.push(this.renderGroup(e));this.trackEl.replaceChildren(this.baseGroupEl,...s)}syncReadyState(){this.containerEl&&this.containerEl.classList.toggle(`${Cs}--ready`,this.baseGroupWidth>0)}updateUI(){const e=this.parseItems();if(0===e.length)return void(this.hidden=!0);this.hidden=!1;const t=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=[Cs,`${Cs}--size-${a}`,`${Cs}--variant-${r}`,`${Cs}--align-${l}`,m&&`${Cs}--pause-on-hover`,o&&`${Cs}--fade-edges`,"right"===t&&`${Cs}--right`,g&&`${Cs}--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=e.join(" • ")||v),this.renderDuplicates(),this.measure()}}customElements.get("db-marquee")||customElements.define("db-marquee",DbMarquee);const ks="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)}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"),l=this.getBool("full-height");this.className=[ks,`${ks}--size-${s}`,`${ks}--variant-${i}`,`${ks}--direction-${t}`,r&&`${ks}--full-width`,l&&`${ks}--full-height`].filter(Boolean).join(" ");let o={};o="animated"===i?this.generateAnimatedStyle(e,t,n,a):"mesh"===i?this.generateMeshStyle(e):this.generateGradientStyle(e,t),Object.assign(this.style,o)}}customElements.get("db-gradient")||customElements.define("db-gradient",DbGradient);const xs={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 Ss="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=`${Ss}__background`,this.overlayEl=document.createElement("div"),this.overlayEl.className=`${Ss}__overlay`,this.contentEl=document.createElement("div"),this.contentEl.className=`${Ss}__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=xs[e][t],l=Math.min(6,Math.max(3,s)),o=[];for(let e=0;e<l;e+=1)o.push(r[Math.floor(Math.random()*r.length)]);const d=Array.from({length:l},()=>100*Math.random()).sort((e,t)=>e-t),u=o.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=[Ss,r&&`${Ss}--animated`,n&&`${Ss}--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=xs[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 Ns="designbase-wc-ad-banner",$s={hero:"지금 바로 시작하세요",topbar:"🎉 신규 가입 시 10,000원 적립금 증정!",card:"프리미엄 멤버십",floating:"오늘만 특가!"},Is={hero:"최대 50% 할인된 가격으로 프리미엄 서비스를 경험해보세요. 기간 한정 특별 혜택!",topbar:"오늘 하루만 특별 혜택",card:"무제한 서비스 이용권을 특별가에 만나보세요",floating:"장바구니에 담긴 상품 추가 20% 할인"},Ds={hero:"자세히 보기",topbar:"지금 가입하기",card:"알아보기",floating:"할인받기"},Ls={hero:"star",topbar:"trending-up",card:"star-filled",floating:"cart"},Ms={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(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"}build(){this.rootEl=document.createElement("div"),this.contentEl=document.createElement("div"),this.contentEl.className=`${Ns}__content`,this.closeBtn=document.createElement("button"),this.closeBtn.type="button",this.closeBtn.className=`${Ns}__close`,this.closeBtn.setAttribute("aria-label","닫기"),this.closeBtn.append(createDbIcon("close",20)),this.closeBtn.addEventListener("click",()=>this.handleClose());const e=document.createElement("div");e.className=`${Ns}__main`,this.iconEl=document.createElement("div"),this.iconEl.className=`${Ns}__icon`,this.labelEl=document.createElement("span"),this.labelEl.className=`${Ns}__label`,this.labelEl.textContent="특별 이벤트",this.badgeEl=document.createElement("span"),this.badgeEl.className=`${Ns}__badge`,this.badgeEl.textContent="HOT DEAL",this.titleEl=document.createElement("h2"),this.titleEl.className=`${Ns}__title`,this.subtitleEl=document.createElement("p"),this.subtitleEl.className=`${Ns}__subtitle`;const t=document.createElement("div");t.className=`${Ns}__text`,this.countdownWrapEl=document.createElement("div"),this.countdownWrapEl.className=`${Ns}__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),t.append(this.titleEl,this.subtitleEl,this.countdownWrapEl),this.actionsEl=document.createElement("div"),this.actionsEl.className=`${Ns}__actions`,this.ctaEl=document.createElement("db-button"),this.ctaEl.className=`${Ns}__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(this.iconEl,t,this.actionsEl),this.progressEl=document.createElement("div"),this.progressEl.className=`${Ns}__progress`,this.progressBarEl=document.createElement("div"),this.progressBarEl.className=`${Ns}__progress-bar`,this.progressEl.append(this.progressBarEl),this.contentEl.append(this.closeBtn,e,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(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)}renderGradientWrapper(e){this.rootEl&&this.contentEl&&(e?(this.gradientEl||(this.gradientEl=document.createElement("db-random-gradient"),this.gradientEl.className=`${Ns}__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 e=this.getType(),t=this.getVariant(),s=this.getAttribute("title")||$s[e],i=this.getAttribute("subtitle")||Is[e],n=this.getAttribute("cta-text")||Ds[e],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=[Ns,`${Ns}--type-${e}`,`${Ns}--variant-${t}`,a&&`${Ns}--auto-close`,l&&`${Ns}--with-gradient`,l&&"light"===o&&`${Ns}--gradient-light`].filter(Boolean).join(" ")),l&&this.gradientEl&&(this.gradientEl.setAttribute("scheme",this.getAttribute("gradient-scheme")||Ms[t]),this.gradientEl.setAttribute("tone",o),this.gradientEl.setAttribute("animated",d?"true":"false")),this.renderGradientWrapper(l),this.iconEl&&(this.iconEl.replaceChildren(createDbIcon(Ls[e],"card"===e?32:"floating"===e?28:24)),this.labelEl&&this.iconEl.append(this.labelEl),this.badgeEl&&this.iconEl.append(this.badgeEl),this.labelEl&&(this.labelEl.hidden="topbar"!==e),this.badgeEl&&(this.badgeEl.hidden="floating"!==e)),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"===e?"l":"card"===e?"s":"m"),"floating"===e?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 zs="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=[zs,`${zs}--${e}`,`${zs}--${t}`,`${zs}--${s}`,n&&`${zs}--clickable`,this.hasAttribute("full-width")&&`${zs}--full-width`,a&&`${zs}--disabled`].filter(Boolean).join(" "),this.replaceChildren();const l=document.createElement("div");l.className=`${zs}__container`,r.forEach((e,o)=>{const d=this.getItemPosition(o),u=o===r.length-1,b=n&&!a&&!e.disabled,p=e.color||i,m=e.status||"pending",g=document.createElement("div");g.className=[`${zs}__item`,`${zs}__item--${d}`,`${zs}__item--${p}`,b&&`${zs}__item--clickable`,e.disabled&&`${zs}__item--disabled`].filter(Boolean).join(" ");const v=document.createElement("div");if(v.className=`${zs}__indicator-container`,"active"===m&&!e.icon&&void 0===e.number){const e=document.createElement("div");e.className=`${zs}__pulse`,v.append(e)}const E=document.createElement("div");if(E.className=[`${zs}__dot`,`${zs}__dot--${p}`,`${zs}__dot--${t}`,`${zs}__dot--${m}`,b&&`${zs}__dot--clickable`,e.icon&&`${zs}__dot--with-icon`,void 0!==e.number&&!e.icon&&`${zs}__dot--with-number`].filter(Boolean).join(" "),b&&(E.tabIndex=0,E.setAttribute("role","button"),E.setAttribute("aria-label",e.title?`${e.title} 타임라인 점`:`타임라인 점 ${o+1}`),E.addEventListener("click",()=>this.handleItemClick(e,o)),E.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleItemClick(e,o))})),e.icon&&isDbIconName(e.icon)){const t=document.createElement("div");t.className=`${zs}__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=`${zs}__number`,t.textContent=String(e.number),E.append(t)}if(v.append(E),!u){const e=document.createElement("div");e.className=`${zs}__connector`,v.append(e)}const f=document.createElement("div");if(f.className=[`${zs}__content`,`${zs}__content--${d}`].join(" "),e.timestamp){const t=document.createElement("div");t.className=`${zs}__timestamp`,t.textContent=e.timestamp,f.append(t)}const w=document.createElement("div");if(w.className=`${zs}__content-inner`,b&&(w.tabIndex=0,w.setAttribute("role","button"),w.setAttribute("aria-label",e.title?`${e.title} 타임라인 아이템`:`타임라인 아이템 ${o+1}`),w.addEventListener("click",()=>this.handleItemClick(e,o)),w.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleItemClick(e,o))})),e.title){const t=document.createElement("h3");t.className=`${zs}__title`,t.textContent=e.title,w.append(t)}if(e.description){const t=document.createElement("p");t.className=`${zs}__description`,t.textContent=e.description,w.append(t)}f.append(w),g.append(v,f),l.append(g)}),this.append(l)}}customElements.get("db-timeline")||customElements.define("db-timeline",DbTimeline);const Ts="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 e=this.getAttribute("type")||"fade";return["typing","fade","slide","bounce","shake","glow","gradient","wave","flip","scale","decode"].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")||(this.isVisible=!0,this.startAnimation(),this.syncClasses())}),this.addEventListener("mouseleave",()=>{if("hover"!==this.getTrigger())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(","),l=(this.getAttribute("wave-colors")||"#ff6b6b,#4ecdc4,#45b7d1,#96ceb4,#feca57").split(","),o=this.getAttribute("glow-color")||"#667eea";this.className=[Ts,"typing"!==t&&`${Ts}--${t}`,`${Ts}--${this.getAttribute("size")||"m"}`,`${Ts}--${this.getAttribute("color")||"primary"}`,`${Ts}--${this.getAttribute("weight")||"normal"}`,`${Ts}--${this.getAttribute("align")||"left"}`,`${Ts}--${this.getAttribute("direction")||"left"}`,this.isVisible&&`${Ts}--visible`,this.isAnimating&&`${Ts}--animating`,(this.hasAttribute("clickable")||"click"===s)&&`${Ts}--clickable`,this.hasAttribute("disabled")&&`${Ts}--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"===t&&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"!==t&&"decode"!==t||"mount"!==s||this.isAnimating?this.isAnimating||(this.displayText=e):this.displayText="",this.ghostEl&&(this.ghostEl.textContent=e,this.ghostEl.style.whiteSpace="typing"===t?"pre-wrap":""),this.layerEl&&(this.layerEl.className=["typing"===t&&`${Ts}--typing`,this.isAnimating&&"typing"===t&&`${Ts}--animating`].filter(Boolean).join(" "),this.layerEl.style.width="typing"===t?"auto":"100%",this.layerEl.style.height="100%",this.layerEl.style.whiteSpace="typing"===t?"pre-wrap":""),this.renderLayer()}syncClasses(){this.classList.toggle(`${Ts}--visible`,this.isVisible),this.classList.toggle(`${Ts}--animating`,this.isAnimating)}setupTrigger(){this.clearTimers(),this.observer?.disconnect();const e=this.getTrigger(),t=Number(this.getAttribute("delay")||0);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))}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);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;"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}))}}customElements.get("db-animation-text")||customElements.define("db-animation-text",DbAnimationText);const Bs="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())}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=Bs,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=`${Bs}__overlay`,this.overlayEl.addEventListener("click",()=>this.handleEnd()),this.popoverEl=document.createElement("div"),this.popoverEl.className=`${Bs}__popover`,this.closeButtonEl=document.createElement("button"),this.closeButtonEl.type="button",this.closeButtonEl.className=`${Bs}__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=`${Bs}__content`;const t=document.createElement("div");t.className=`${Bs}__text`,this.titleEl=document.createElement("h3"),this.titleEl.id="tutorial-title",this.titleEl.className=`${Bs}__title`,this.descriptionEl=document.createElement("p"),this.descriptionEl.id="tutorial-content",this.descriptionEl.className=`${Bs}__description`,t.append(this.titleEl,this.descriptionEl);const s=document.createElement("div");s.className=`${Bs}__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(`${Bs}__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(`${Bs}__target`);const s=t.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,a=300,r=200,l=16;let o="auto"!==e.step.placement&&e.step.placement?e.step.placement:"bottom",d=s.bottom+l,u=s.left+s.width/2-150;if("auto"===e.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=[`${Bs}__popover`,`${Bs}__popover--${o}`].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 Ps=["plasma","mesh-flow","fluid","radiant","ethereal"];function toLuminaSpeed(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 Fs=["#0d0221","#5b21b6","#db2777","#38bdf8","#e9d5ff"],Os=[{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 Hs=["#ffffff","#f0f9ff","#e0f2fe"],Rs=["#ffb7c5","#ff91a4","#f8c8dc","#ffc0cb","#fda4af"],Vs=["#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=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(t,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(t,s,o)),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},Ws=["snow","flowers","confetti"];class CanvasAnimationController{constructor(e,t){this.options=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:l,particleSize:o,starCount:d,starSize:u,clickable:b,wind:p,layerOpacity:m}=this.options;e.clearRect(0,0,s,i);const g=this.frameCount*(3e3/(r||3e3));switch(this.frameCount+=1,n){case"particles":((e,t,s,i,n)=>{i.current.length!==n.count&&(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)]})));const a=i.current;a.forEach((i,r)=>{if(i.x+=i.vx,i.y+=i.vy,(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.beginPath(),e.arc(i.x,i.y,i.size,0,2*Math.PI),e.fillStyle=i.color,e.fill();for(let t=r+1;t<a.length;t++){const s=a[t],n=i.x-s.x,r=i.y-s.y,l=Math.sqrt(n*n+r*r);l<100&&(e.beginPath(),e.strokeStyle=i.color,e.globalAlpha=1-l/100,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:l,colors:a,size:o,mouse:this.mouse,clickable:b});break;case"stars":((e,t,s,i,n)=>{i.current.length!==n.count&&(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.current.forEach(t=>{t.y-=.05,t.y<0&&(t.y=s);const i=.5+.5*Math.sin(n.time*t.blinkSpeed);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:g});break;case"snow":case"flowers":case"confetti":(function isFallingType(e){return Ws.includes(e)})(n)&&drawFallingParticles(e,s,i,this.fallingRef,n,{count:l,colors:a,size:o,speed:r,wind:p,layerOpacity:m})}this.raf=requestAnimationFrame(this.tick)},this.container=e,this.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__canvas",e.appendChild(this.canvas),this.onResize=()=>this.resize(),this.onMouseMove=s=>{if("particles"!==t.type)return;const i=e.getBoundingClientRect();this.mouse={x:s.clientX-i.left,y:s.clientY-i.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()}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(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.options=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:l,variant:o}=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"),p=e.getUniformLocation(t,"uResolution"),m=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(p,d,u);const y=padColors(i),A=toLuminaSpeed(n),_=function toLuminaSoftness(e){return Math.min(1,e/200)}(a),C=.6*A,k=function clampZoom(e){return Math.min(4,Math.max(.25,e))}(l),x=(performance.now()-this.startTime)/1e3;"mesh-flow"===o?(m&&e.uniform1f(m,x),v&&e.uniform1f(v,C),E&&e.uniform1f(E,_)):(m&&e.uniform1f(m,x*A),E&&e.uniform1f(E,_),f&&e.uniform1f(f,r),"fluid"===o&&w&&e.uniform1f(w,k));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.canvas=document.createElement("canvas"),this.canvas.className="designbase-wc-animation-background__shader-canvas",e.appendChild(this.canvas),this.init()}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 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"}}(t),i=e.createProgram();if(!i)return;const n=loadShader(e,e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main() {\n gl_Position = aVertexPosition;\n }\n"),a=loadShader(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 qs="designbase-wc-animation-background";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 resolveColors(e){const{type:t,preset:s,colors:i}=e;if(s)return function getLuminaPresetColors(e){const t=Os.find(t=>t.id===e);return t?.colors??Os[0].colors}(s);if("fluid"===t&&i.length<5)return Fs;if("snow"===t||"flowers"===t||"confetti"===t){const e=function getFallingParticleDefaults(e){switch(e){case"snow":default:return Hs;case"flowers":return Rs;case"confetti":return Vs}}(t);return 3===i.length&&"#667eea"===i[0]&&"#764ba2"===i[1]?e:i}return i}function createLuminaOverlays(e,t){const s=document.createDocumentFragment();if(e>0){const t=document.createElement("div");t.className=`${qs}__lumina-noise`,t.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\")",t.style.opacity=String(e),s.appendChild(t)}if(t){const e=document.createElement("div");e.className=`${qs}__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=`${qs}__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()};break}case"aurora":e.appendChild(function createMeshAuroraLayer(e,t,s,i,n){const a=document.createElement("div");a.className=`${qs}__aurora-mesh`;const r="subtle"===i?.3:"medium"===i?.6:.8,l=Math.max(5,t/1e3),o=e.length>=3?e:["#4f46e5","#ec4899","#06b6d4","#8b5cf6"],d="dark"===n?"screen":"multiply",u=`blur(${s}px)`,b=`${qs}__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(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 m=document.createElement("div");return m.className=`${qs}__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,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=`${qs}__plasma`;const n=Math.random().toString(36).slice(2,11),a=padColors(e),c=e=>a[e%a.length],r=60/toLuminaSpeed(t),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=`${qs}__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:`${qs}__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:`${qs}__plasma-blob--accent`,filter:`blur(${s}px)`,opacity:"0.6"}].forEach(e=>{const t=document.createElement("div");t.className=`${qs}__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=`${qs}__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()};break}case"gradient":e.appendChild(function createGradientLayer(e,t,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=`${qs}__css-layer`;const r=(t.length>0?t:["#ccc"]).join(", ");let l="90deg",o="";switch(e){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}(t.direction,s,t.speed))}return i}function applyContainerStyles(e,t){const s=function isLuminaType(e){return Ps.includes(e)}(t.type)?"#000000":"dark"===t.theme?"var(--db-surface-base, #0f172a)":"var(--db-surface-base, #ffffff)";e.style.position="relative",e.style.overflow="hidden","gradient"!==t.type?e.style.backgroundColor=s:e.style.backgroundColor=""}function getEffectiveGridColor(e){return e.gridColor??("dark"===e.theme?"#ffffff":"#000000")}const js=qs;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(e){if(!e)return;const t=Number(e);return Number.isFinite(t)?`${t}px`:e}render(){const e=function parseAnimationBackgroundConfig(e){return{type:e.getAttribute("type")||"gradient",theme:"light"===e.getAttribute("theme")?"light":"dark",intensity:e.getAttribute("intensity")||"subtle",blur:Number(e.getAttribute("blur")||80),speed:Number(e.getAttribute("speed")||3e3),direction:e.getAttribute("direction")||"left",colors:parseColors(e.getAttribute("colors"),["#667eea","#764ba2","#f093fb"]),opacity:Number(e.getAttribute("opacity")||1),particleCount:Number(e.getAttribute("particle-count")||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),showGrid:e.hasAttribute("show-grid")&&"false"!==e.getAttribute("show-grid"),gridSize:Number(e.getAttribute("grid-size")||40),gridColor:e.getAttribute("grid-color")||void 0,gridOpacity:Number(e.getAttribute("grid-opacity")||.1),noise:Number(e.getAttribute("noise")||.05),showVignette:!e.hasAttribute("show-vignette")||"false"!==e.getAttribute("show-vignette"),preset:e.getAttribute("preset")||void 0,zoom:Number(e.getAttribute("zoom")||1),disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")}}(this);this.className=[js,`${js}--${e.type}`,e.clickable&&!e.disabled&&`${js}--clickable`,e.disabled&&`${js}--disabled`].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=String(e.opacity);const n=this.getAttribute("blend-mode");if(n&&(this.style.mixBlendMode=n),!this.layersEl){this.layersEl=document.createElement("div"),this.layersEl.className=`${js}__layers`,Object.assign(this.layersEl.style,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"0"}),this.contentEl=document.createElement("div"),this.contentEl.className=`${js}__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.teardownLayers();const a=this.querySelector(`.${js}__grid-overlay`);if(a?.remove(),this.layerHandle=mountAnimationLayers(this.layersEl,e),e.showGrid&&!e.disabled){const t=document.createElement("div");t.className=`${js}__grid-overlay`,Object.assign(t.style,{position:"absolute",inset:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1",backgroundImage:`linear-gradient(to right, ${getEffectiveGridColor(e)} 1px, transparent 1px), linear-gradient(to bottom, ${getEffectiveGridColor(e)} 1px, transparent 1px)`,backgroundSize:`${e.gridSize}px ${e.gridSize}px`,opacity:String(e.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(t,this.contentEl??null)}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))}}customElements.get("db-animation-background")||customElements.define("db-animation-background",DbAnimationBackground);const Us="designbase-wc-cursor-follower",Ks="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.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 e=document.createElement("slot");this.scopeEl.appendChild(e),this.appendChild(this.scopeEl)}}isInScope(e){return!!e&&(!this.isScoped||!this.scopeEl||this.scopeEl.contains(e))}mountLayer(){this.teardownLayer(),this.ensureScope();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(Ks),this.portalRoot=document.createElement("div"),this.portalRoot.className=Us,this.portalRoot.setAttribute("aria-hidden","true"),this.pillEl=document.createElement("div"),this.pillEl.className=`${Us}__pill`,this.labelEl=document.createElement("span"),this.labelEl.textContent=e,this.pillEl.appendChild(this.labelEl),a&&(this.iconEl=document.createElement("span"),this.iconEl.className=`${Us}__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(`${Us}__pill--visible`)):this.pillEl?.classList.remove(`${Us}__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(Ks),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 Js="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=`${Js}__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 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 e=document.createElement("div");return e.className=`${Js}__fallback`,e.textContent="src 또는 animation-data 속성이 필요합니다.",void this.container.appendChild(e)}const u=await import("./chunks/lottie-eed75107.js"),b=u.default??u;e===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 Gs=new Set(["children","className","style","ref","key"]),Ys={activeIndex:"active-index",allowMultiple:"allow-multiple",boundaryCount:"boundary-count",breadcrumbStyle:"breadcrumb-style",badgeColor:"badge-color",characterCountPosition:"character-count-position",closeOnEscape:"close-on-escape",closeOnBackdrop:"close-on-backdrop",closeOnOverlayClick:"close-on-backdrop",confirmDisabled:"confirm-disabled",cancelDisabled:"cancel-disabled",confirmVariant:"confirm-variant",confirmText:"confirm-text",cancelText:"cancel-text",currentPage:"current-page",initialFocus:"initial-focus",indicatorType:"indicator-type",showClose:"show-close",showProgress:"show-progress",autoRemove:"auto-remove",autoRoll:"auto-roll",alwaysShow:"always-show",animationDuration:"animation-duration",backgroundColor:"background-color",blurAmount:"blur-amount",closeOnBackdropClick:"close-on-backdrop-click",closeOnOutsideClick:"close-on-outside-click",disableBackdropClick:"disable-backdrop-click",disableEscapeKeyDown:"disable-escape-key-down",drawerId:"drawer-id",defaultSelectedTabId:"default-selected-tab-id",showBackButton:"show-back-button",backFallbackHref:"back-fallback-href",backLabel:"back-label",defaultExpanded:"default-expanded",noPadding:"no-padding",fullHeight:"full-height",overflowVisible:"overflow-visible",disableDrag:"disable-drag",showCloseButton:"show-close-button",showIndicator:"show-indicator",currentStep:"current-step",showFileList:"show-file-list",splitterSize:"splitter-size",splitterColor:"splitter-color",splitterHoverColor:"splitter-hover-color",showBackdrop:"show-backdrop",backdropBlur:"backdrop-blur",backdropOpacity:"backdrop-opacity",stickyHeader:"sticky-header",stickyFooter:"sticky-footer",scrollbarStyle:"scrollbar-style",alwaysShowScrollbar:"always-show-scrollbar",scrollbarColor:"scrollbar-color",scrollbarTrackColor:"scrollbar-track-color",showIcon:"show-icon",showButton:"show-button",maxSize:"max-size",dragOver:"drag-over",defaultSegmentValue:"default-segment-value",headerVariant:"header-variant",navSize:"nav-size",overlayClosable:"overlay-closable",showOverlay:"show-overlay",trapFocus:"trap-focus",triggerId:"trigger-id",triggerVariant:"trigger-variant",triggerIcon:"trigger-icon",targetId:"target-id",toastId:"toast-id",showCountBadge:"show-count-badge",multiSelect:"multi-select",selectedRows:"selected-rows",rowKey:"row-key",emptyMessage:"empty-message",emptyStateMessage:"empty-state-message",enableRecentSearches:"enable-recent-searches",recentSearchesKey:"recent-searches-key",recentSearchesLayout:"recent-searches-layout",searchResults:"search-results",selectedCategory:"selected-category",suggestedSearches:"suggested-searches",suggestionRollingInterval:"suggestion-rolling-interval",sortColumn:"sort-column",sortDirection:"sort-direction",pageSize:"page-size",pageSizeOptions:"page-size-options",showPageSizeSelector:"show-page-size-selector",showTotal:"show-total",totalItems:"total-items",badgeMaxCount:"badge-max-count",badgeVariant:"badge-variant",badgeStyle:"badge-style",badgeText:"badge-text",defaultCurrent:"default-current",defaultPlaying:"default-playing",defaultValue:"default-value",minuteStep:"minute-step",startOfWeek:"start-of-week",showOutsideDays:"show-outside-days",highlightWeekends:"highlight-weekends",highlightToday:"highlight-today",showWeekends:"show-weekends",currentDate:"current-date",dropdownPosition:"dropdown-position",defaultItemType:"default-item-type",endIcon:"end-icon",errorMessage:"error-message",expandedItems:"expanded-items",fullWidth:"full-width",helperText:"helper-text",iconOnly:"icon-only",isOpen:"open",open:"open",loadingText:"loading-text",loadingCount:"loading-count",maxLength:"max-length",maxItems:"max-items",menuStyle:"menu-style",passwordMinLength:"password-min-length",scrubStep:"scrub-step",scrubSensitivity:"scrub-sensitivity",playbackDisabled:"playback-disabled",readOnly:"readonly",selectedTabId:"selected-tab-id",segmentFullWidth:"segment-full-width",segmentValue:"segment-value",shareTitle:"share-title",buttonText:"button-text",modalTitle:"modal-title",imageUrl:"image-url",showQrCode:"show-qr-code",qrCodeSize:"qr-code-size",copySuccessMessage:"copy-success-message",selectedItems:"selected-items",showArrow:"show-arrow",showBadge:"show-badge",showCharacterCount:"show-character-count",showClearButton:"show-clear-button",showDescription:"show-description",showFirstLast:"show-first-last",showPreviousNext:"show-previous-next",showShortcut:"show-shortcut",siblingCount:"sibling-count",shortcutLabel:"shortcut-label",startIcon:"start-icon",subItems:"sub-items",timerDuration:"timer-duration",totalPages:"total-pages",validateOnBlur:"validate-on-blur",validationVisibility:"validation-visibility",videoId:"video-id"},Xs=new Set(["show-clear-button","closable","show-icon","show-close","show-progress","fixed"]);function toKebabCase(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function isEventProp(e,t){return Boolean(function eventPropToName(e,t){if(t[e])return t[e];if(!/^on[A-Z]/.test(e))return;const s=e.slice(2);return s.startsWith("Db")?`db-${toKebabCase(s.slice(2)).replace(/^-/,"")}`:void 0}(e,t))}function shouldRenderThroughReact(e){return"className"===e||"style"===e||"id"===e||"slot"===e||"title"===e||"role"===e||"tabIndex"===e||e.startsWith("aria-")||e.startsWith("data-")}function hasWritableProperty(e,t){let s=e;for(;s;){const e=Object.getOwnPropertyDescriptor(s,t);if(e)return Boolean(e.set);s=Object.getPrototypeOf(s)}return!1}function setElementProperty(e,t,s){if(hasWritableProperty(e,t))try{e[t]=s}catch{}}function extractTextChildren(e){if(null!=e&&"boolean"!=typeof e){if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e)){const t=e.map(e=>extractTextChildren(e)).filter(e=>void 0!==e);return t.length>0?t.join(""):void 0}}}function applyProp(e,t,s){const i=function toAttributeName(e){return Ys[e]||toKebabCase(e)}(t);if(null==s){if(!e.hasAttribute(i)){if(!(t in e))return;try{const s=e[t];if(!1===s||null==s)return}catch{}}return e.removeAttribute(i),void setElementProperty(e,t,!1)}if(!1===s){if(Xs.has(i)){if("false"===e.getAttribute(i))return;return e.setAttribute(i,"false"),void setElementProperty(e,t,!1)}if(!e.hasAttribute(i)){if(!(t in e))return;try{const s=e[t];if(!1===s||null==s)return}catch{}}return e.removeAttribute(i),void setElementProperty(e,t,!1)}if(!0===s){if(e.hasAttribute(i))return;return e.setAttribute(i,""),void setElementProperty(e,t,!0)}if("object"==typeof s){if(hasWritableProperty(e,t)){if(e[t]===s)return;setElementProperty(e,t,s)}else{const t=JSON.stringify(s);if(e.getAttribute(i)===t)return;e.setAttribute(i,t)}return}const n=String(s);if(e.getAttribute(i)!==n){if(t in e){if(e[t]===s)return}e.setAttribute(i,n),setElementProperty(e,t,s)}}function createWebComponent(r,l){const o=t((t,o)=>{const d=s(null),{className:u,style:b}=t,p=t.children,m=l.childrenAs?extractTextChildren(p):void 0,g=l.events||{},v={className:u,style:b},E=s(t);E.current=t;const f=i(()=>JSON.stringify({props:Object.entries(t).filter(([e,t])=>!Gs.has(e)&&!isEventProp(e,g)&&!shouldRenderThroughReact(e)&&"function"!=typeof t).sort(([e],[t])=>e.localeCompare(t)),childText:l.childrenAs?m??null:void 0}),[m,g,t]);return Object.entries(t).forEach(([e,t])=>{Gs.has(e)||isEventProp(e,g)||!shouldRenderThroughReact(e)||(v[e]=t)}),n(o,()=>d.current,[]),a(()=>{const e=d.current;if(e&&(Object.entries(E.current).forEach(([t,s])=>{Gs.has(t)||isEventProp(t,g)||shouldRenderThroughReact(t)||applyProp(e,t,s)}),l.childrenAs)){const t=E.current[l.childrenAs],s=null!=t?String(t):m;applyProp(e,l.childrenAs,void 0!==s?s:void 0)}},[f,m,g]),a(()=>{const e=d.current;if(!e)return;const t=[];return Object.entries(g).forEach(([s,i])=>{const listener=e=>{const t=E.current[s];"function"==typeof t&&function invokeEventHandler(e,t){if(!(t instanceof CustomEvent))return void e(t);const s=t.detail;if(null===s||"object"!=typeof s||!("value"in s))return void e(t);const i=s.value,n=t.target;e(n&&"object"==typeof n&&"value"in n?t:{...t,detail:s,target:{...n&&"object"==typeof n?n:{},value:i}})}(t,e)};e.addEventListener(i,listener),t.push(()=>e.removeEventListener(i,listener))}),()=>t.forEach(e=>e())},[g]),e.createElement(r,{...v,ref:d},l.childrenAs?void 0:p)});return o.displayName=l.displayName,o}function ModalHeader({className:e="",children:t,...s}){return r("div",{className:`designbase-wc-modal__header ${e}`.trim(),"data-modal-part":"header",...s},t)}function ModalBody({className:e="",children:t,...s}){return r("div",{className:`designbase-wc-modal__body ${e}`.trim(),"data-modal-part":"body",...s},t)}function ModalFooter({className:e="",children:t,...s}){return r("div",{className:`designbase-wc-modal__footer ${e}`.trim(),"data-modal-part":"footer",...s},t)}function useContextMenu(){const[e,t]=l(!1),[s,i]=l({x:0,y:0}),n=o(e=>{e.preventDefault(),e.stopPropagation(),i({x:e.clientX,y:e.clientY}),t(!0)},[]),a=o(()=>{t(!1)},[]),r=o((e,s)=>{i({x:e,y:s}),t(!0)},[]);return{isOpen:e,x:s.x,y:s.y,handleContextMenu:n,handleClose:a,handleOpen:r}}const Zs=createWebComponent("db-accordion",{displayName:"Accordion",events:{onChange:"db-change",onItemChange:"db-change",onDbChange:"db-change"}}),Qs=createWebComponent("db-alert",{displayName:"Alert",childrenAs:"message",events:{onClose:"db-close",onAction:"db-action",onDbClose:"db-close",onDbAction:"db-action"}}),ei=createWebComponent("db-avatar",{displayName:"Avatar",events:{onClick:"db-click",onDbClick:"db-click"}}),ti=createWebComponent("db-backdrop",{displayName:"Backdrop",events:{onClick:"db-click",onClose:"db-close",onDbClick:"db-click",onDbClose:"db-close"}}),si=createWebComponent("db-badge",{displayName:"Badge"}),ii=createWebComponent("db-banner",{displayName:"Banner",events:{onAction:"db-action",onDbAction:"db-action"}}),ni=createWebComponent("db-breadcrumbs",{displayName:"Breadcrumbs",events:{onItemClick:"db-click",onClick:"db-click",onDbClick:"db-click"}}),ai=createWebComponent("db-button",{displayName:"Button",events:{onPress:"db-click"}}),ri=createWebComponent("db-card",{displayName:"Card",events:{onClick:"db-click",onSelect:"db-select",onDbClick:"db-click",onDbSelect:"db-select"}}),li=createWebComponent("db-checkbox",{displayName:"Checkbox",events:{onChange:"db-change",onDbChange:"db-change"}}),oi=createWebComponent("db-chip",{displayName:"Chip",events:{onDelete:"db-delete",onDismiss:"db-delete",onClick:"db-click",onDbDelete:"db-delete",onDbClick:"db-click"}}),di=createWebComponent("db-confirm",{displayName:"Confirm",childrenAs:"message",events:{onConfirm:"db-confirm",onCancel:"db-cancel",onClose:"db-close",onDbConfirm:"db-confirm",onDbCancel:"db-cancel",onDbClose:"db-close"}}),ci=createWebComponent("db-container",{displayName:"Container"}),hi=createWebComponent("db-context-menu",{displayName:"ContextMenu",events:{onOpen:"db-open",onClose:"db-close",onSelect:"db-select",onDbOpen:"db-open",onDbClose:"db-close",onDbSelect:"db-select"}}),ui=createWebComponent("db-divider",{displayName:"Divider"}),bi=createWebComponent("db-drawer",{displayName:"Drawer",events:{onClose:"db-close",onDbClose:"db-close"}}),pi=createWebComponent("db-dropdown",{displayName:"Dropdown",events:{onChange:"db-change",onOpen:"db-open",onToggle:"db-open",onDbChange:"db-change",onDbOpen:"db-open"}}),mi=createWebComponent("db-empty-state",{displayName:"EmptyState",events:{onAction:"db-action",onSecondaryAction:"db-secondary-action",onDbAction:"db-action",onDbSecondaryAction:"db-secondary-action"}}),gi=createWebComponent("db-form",{displayName:"Form",events:{onSubmit:"db-submit",onChange:"db-change",onReset:"db-reset",onDbSubmit:"db-submit",onDbChange:"db-change",onDbReset:"db-reset"}}),vi=createWebComponent("db-grid",{displayName:"Grid"}),Ei=createWebComponent("db-grid-item",{displayName:"GridItem"}),fi=createWebComponent("db-indicator",{displayName:"Indicator",events:{onChange:"db-change",onCurrentChange:"db-current-change",onStepClick:"db-step-click",onPlayingChange:"db-playing-change",onTimerComplete:"db-timer-complete",onDbChange:"db-change",onDbCurrentChange:"db-current-change",onDbStepClick:"db-step-click",onDbPlayingChange:"db-playing-change",onDbTimerComplete:"db-timer-complete"}}),wi=createWebComponent("db-input",{displayName:"Input",events:{onChange:"db-input",onInput:"db-input",onDbInput:"db-input",onDbChange:"db-change"}}),yi=createWebComponent("db-label",{displayName:"Label"}),Ai=createWebComponent("db-logo",{displayName:"Logo",events:{onClick:"db-click",onDbClick:"db-click"}}),_i=createWebComponent("db-list",{displayName:"List",events:{onItemClick:"db-item-click",onItemSelect:"db-select",onSelect:"db-select",onDbItemClick:"db-item-click",onDbSelect:"db-select"}}),Ci=createWebComponent("db-menu-item",{displayName:"MenuItem",events:{onClick:"db-click",onChildClick:"db-child-click",onDbClick:"db-click",onDbChildClick:"db-child-click"}}),ki=createWebComponent("db-modal",{displayName:"Modal",events:{onClose:"db-close",onTabChange:"db-tab-change",onSegmentChange:"db-segment-change",onDbClose:"db-close",onDbTabChange:"db-tab-change",onDbSegmentChange:"db-segment-change"}}),xi=createWebComponent("db-pagination",{displayName:"Pagination",events:{onChange:"db-change",onPageChange:"db-change",onDbChange:"db-change",onPageSizeChange:"db-page-size-change",onDbPageSizeChange:"db-page-size-change"}}),Si=createWebComponent("db-popover",{displayName:"Popover",events:{onOpenChange:"db-open-change",onClose:"db-close",onDbOpenChange:"db-open-change",onDbClose:"db-close"}}),Ni=createWebComponent("db-progress",{displayName:"Progress"}),$i=createWebComponent("db-progress-step",{displayName:"ProgressStep",events:{onStepClick:"db-step-click",onDbStepClick:"db-step-click"}}),Ii=createWebComponent("db-progressbar",{displayName:"Progressbar"}),Di=createWebComponent("db-radio",{displayName:"Radio",events:{onChange:"db-change",onDbChange:"db-change"}}),Li=createWebComponent("db-range-slider",{displayName:"RangeSlider",events:{onChange:"db-change",onRangeChange:"db-change",onDbChange:"db-change"}}),Mi=createWebComponent("db-search-bar",{displayName:"SearchBar",events:{onChange:"db-input",onInput:"db-input",onSearch:"db-search",onClear:"db-clear",onCategoryChange:"db-category-change",onSearchResultClick:"db-search-result-click",onFocus:"db-focus",onBlur:"db-blur",onDbChange:"db-input",onDbInput:"db-input",onDbSearch:"db-search",onDbClear:"db-clear",onDbCategoryChange:"db-category-change",onDbSearchResultClick:"db-search-result-click",onDbFocus:"db-focus",onDbBlur:"db-blur"}}),zi=createWebComponent("db-share",{displayName:"Share",events:{onShare:"db-share",onShareError:"db-share-error",onCopySuccess:"db-copy-success",onCopyError:"db-copy-error",onDbShare:"db-share",onDbShareError:"db-share-error",onDbCopySuccess:"db-copy-success",onDbCopyError:"db-copy-error"}}),Ti=createWebComponent("db-top-banner",{displayName:"TopBanner",events:{onClose:"db-close",onLinkPress:"db-link",onDbClose:"db-close",onDbLink:"db-link"}}),Bi=createWebComponent("db-stat",{displayName:"Stat",events:{onClick:"db-click",onDbClick:"db-click"}}),Pi=createWebComponent("db-image",{displayName:"Image",events:{onClick:"db-click",onLoad:"db-load",onError:"db-error",onDbClick:"db-click",onDbLoad:"db-load",onDbError:"db-error"}}),Fi=createWebComponent("db-image-placeholder",{displayName:"ImagePlaceholder",events:{onClick:"db-click",onDbClick:"db-click"}}),Oi=createWebComponent("db-image-list",{displayName:"ImageList",events:{onImageClick:"db-image-click",onImageLoad:"db-image-load",onImageError:"db-image-error",onDbImageClick:"db-image-click",onDbImageLoad:"db-image-load",onDbImageError:"db-image-error"}}),Hi=createWebComponent("db-lightbox",{displayName:"Lightbox",events:{onClose:"db-close",onImageChange:"db-image-change",onDbClose:"db-close",onDbImageChange:"db-image-change"}}),Ri=createWebComponent("db-bottom-navigation",{displayName:"BottomNavigation",events:{onItemClick:"db-item-click",onDbItemClick:"db-item-click"}}),Vi=createWebComponent("db-navbar",{displayName:"Navbar",events:{onItemClick:"db-item-click",onUserMenuItemClick:"db-user-menu-item-click",onLoginClick:"db-login-click",onLogoClick:"db-logo-click",onSearch:"db-search",onDbItemClick:"db-item-click",onDbUserMenuItemClick:"db-user-menu-item-click",onDbLoginClick:"db-login-click",onDbLogoClick:"db-logo-click",onDbSearch:"db-search"}}),Wi=createWebComponent("db-sidebar",{displayName:"Sidebar",events:{onItemClick:"db-item-click",onUserMenuItemClick:"db-user-menu-item-click",onLogoClick:"db-logo-click",onToggle:"db-toggle",onDbItemClick:"db-item-click",onDbUserMenuItemClick:"db-user-menu-item-click",onDbLogoClick:"db-logo-click",onDbToggle:"db-toggle"}}),qi=createWebComponent("db-segment-control",{displayName:"SegmentControl",events:{onChange:"db-change",onDbChange:"db-change"}}),ji=createWebComponent("db-select",{displayName:"Select",events:{onChange:"db-change",onDbChange:"db-change"}}),Ui=createWebComponent("db-skeleton",{displayName:"Skeleton"}),Ki=createWebComponent("db-spinner",{displayName:"Spinner"}),Ji=createWebComponent("db-stack",{displayName:"Stack"}),Gi=createWebComponent("db-stepper",{displayName:"Stepper",events:{onChange:"db-change",onDbChange:"db-change",onMinReached:"db-min-reached",onMaxReached:"db-max-reached"}}),Yi=createWebComponent("db-table",{displayName:"Table",events:{onRowClick:"db-row-click",onSelectionChange:"db-selection-change",onSortChange:"db-sort-change",onPageChange:"db-page-change",onDbRowClick:"db-row-click",onDbSelectionChange:"db-selection-change",onDbSortChange:"db-sort-change",onDbPageChange:"db-page-change"}}),Xi=createWebComponent("db-tabs",{displayName:"Tabs",events:{onChange:"db-change",onTabChange:"db-change",onDbChange:"db-change"}}),Zi=createWebComponent("db-textarea",{displayName:"Textarea",events:{onChange:"db-input",onInput:"db-input",onDbInput:"db-input",onDbChange:"db-change"}}),Qi=createWebComponent("db-toast",{displayName:"Toast",events:{onClose:"db-close",onDbClose:"db-close"}}),en=createWebComponent("db-toggle",{displayName:"Toggle",events:{onChange:"db-change",onDbChange:"db-change"}}),tn=createWebComponent("db-toolbar",{displayName:"Toolbar"}),sn=createWebComponent("db-tooltip",{displayName:"Tooltip"}),nn=createWebComponent("db-rating",{displayName:"Rating",events:{onChange:"db-change",onHover:"db-hover",onDbChange:"db-change",onDbHover:"db-hover"}}),an=createWebComponent("db-countdown",{displayName:"Countdown",events:{onComplete:"db-complete",onTick:"db-tick",onDbComplete:"db-complete",onDbTick:"db-tick"}}),rn=createWebComponent("db-masonry",{displayName:"Masonry",events:{onImageClick:"db-image-click",onImageLoad:"db-image-load",onImageError:"db-image-error",onDbImageClick:"db-image-click",onDbImageLoad:"db-image-load",onDbImageError:"db-image-error"}}),ln=createWebComponent("db-carousel",{displayName:"Carousel",events:{onSlideChange:"db-slide-change",onItemClick:"db-item-click",onDbSlideChange:"db-slide-change",onDbItemClick:"db-item-click"}}),on=createWebComponent("db-color-picker",{displayName:"ColorPicker",events:{onChange:"db-change",onDbChange:"db-change"}}),dn=createWebComponent("db-reorder",{displayName:"Reorder",events:{onReorder:"db-reorder",onSelect:"db-select",onDbReorder:"db-reorder",onDbSelect:"db-select"}}),cn=createWebComponent("db-resizable-panels",{displayName:"ResizablePanels",events:{onResizeStart:"db-resize-start",onResize:"db-resize",onResizeEnd:"db-resize-end",onSizeChange:"db-size-change",onDbResizeStart:"db-resize-start",onDbResize:"db-resize",onDbResizeEnd:"db-resize-end",onDbSizeChange:"db-size-change"}}),hn=createWebComponent("db-video-player",{displayName:"VideoPlayer",events:{onPlay:"db-play",onPause:"db-pause",onEnded:"db-ended",onTimeUpdate:"db-time-update",onVolumeChange:"db-volume-change",onFullscreenChange:"db-fullscreen-change",onError:"db-error",onDbPlay:"db-play",onDbPause:"db-pause",onDbEnded:"db-ended",onDbTimeUpdate:"db-time-update",onDbVolumeChange:"db-volume-change",onDbFullscreenChange:"db-fullscreen-change",onDbError:"db-error"}}),un=createWebComponent("db-youtube-player",{displayName:"YouTubePlayer",events:{onFullscreenChange:"db-fullscreen-change",onDbFullscreenChange:"db-fullscreen-change"}}),bn=createWebComponent("db-audio-player",{displayName:"AudioPlayer",events:{onPlay:"db-play",onPause:"db-pause",onEnded:"db-ended",onTimeUpdate:"db-time-update",onVolumeChange:"db-volume-change",onPlaylistChange:"db-playlist-change",onPlaybackRateChange:"db-playback-rate-change",onRepeatModeChange:"db-repeat-mode-change",onShuffleChange:"db-shuffle-change",onError:"db-error",onDbPlay:"db-play",onDbPause:"db-pause",onDbEnded:"db-ended",onDbTimeUpdate:"db-time-update",onDbVolumeChange:"db-volume-change",onDbPlaylistChange:"db-playlist-change",onDbPlaybackRateChange:"db-playback-rate-change",onDbRepeatModeChange:"db-repeat-mode-change",onDbShuffleChange:"db-shuffle-change",onDbError:"db-error"}}),pn=createWebComponent("db-code-block",{displayName:"CodeBlock",events:{onActiveIdChange:"db-active-id-change",onDbActiveIdChange:"db-active-id-change",onCodeChange:"db-code-change",onDbCodeChange:"db-code-change"}}),mn=createWebComponent("db-markdown-editor",{displayName:"MarkdownEditor",events:{onChange:"db-change",onSave:"db-save",onFocus:"db-focus",onBlur:"db-blur",onFileUpload:"db-file-upload",onDbChange:"db-change",onDbSave:"db-save",onDbFocus:"db-focus",onDbBlur:"db-blur",onDbFileUpload:"db-file-upload"}}),gn=createWebComponent("db-testimonial",{displayName:"Testimonial"}),vn=createWebComponent("db-section-hero",{displayName:"SectionHero",events:{onButtonClick:"db-button-click",onDbButtonClick:"db-button-click"}}),En=createWebComponent("db-section-feature",{displayName:"SectionFeature",events:{onAction:"db-action",onDbAction:"db-action"}}),fn=createWebComponent("db-app-badge",{displayName:"AppBadge",events:{onClick:"db-click",onDbClick:"db-click"}}),wn=createWebComponent("db-section-contact",{displayName:"SectionContact",events:{onAction:"db-action",onDbAction:"db-action"}}),yn=createWebComponent("db-section-app-download",{displayName:"SectionAppDownload"}),An=createWebComponent("db-marquee",{displayName:"Marquee"}),_n=createWebComponent("db-gradient",{displayName:"Gradient"}),Cn=createWebComponent("db-random-gradient",{displayName:"RandomGradient"}),kn=createWebComponent("db-ad-banner",{displayName:"AdBanner",events:{onCtaClick:"db-cta-click",onClose:"db-close",onDbCtaClick:"db-cta-click",onDbClose:"db-close"}}),xn=createWebComponent("db-timeline",{displayName:"Timeline",events:{onItemClick:"db-item-click",onDbItemClick:"db-item-click"}}),Sn=createWebComponent("db-animation-text",{displayName:"AnimationText",events:{onClick:"db-click",onDbClick:"db-click"}}),Nn=createWebComponent("db-tutorial",{displayName:"Tutorial",events:{onEnd:"db-end",onStepChange:"db-step-change",onNext:"db-next",onPrev:"db-prev",onDbEnd:"db-end",onDbStepChange:"db-step-change",onDbNext:"db-next",onDbPrev:"db-prev"}}),$n=createWebComponent("db-animation-background",{displayName:"AnimationBackground",events:{onClick:"db-click",onDbClick:"db-click"}}),In=createWebComponent("db-cursor-follower",{displayName:"CursorFollower"}),Dn=createWebComponent("db-lottie",{displayName:"Lottie"}),Ln=createWebComponent("db-page-header",{displayName:"PageHeader",events:{onBack:"db-back",onTabChange:"db-tab-change",onDbBack:"db-back",onDbTabChange:"db-tab-change"}}),Mn=createWebComponent("db-section",{displayName:"Section",events:{onExpandedChange:"db-expanded-change",onDbExpandedChange:"db-expanded-change",onTabChange:"db-tab-change",onDbTabChange:"db-tab-change"}}),zn=createWebComponent("db-floating-action-button",{displayName:"FloatingActionButton",events:{onClick:"db-click",onDbClick:"db-click"}}),Tn=createWebComponent("db-bottom-sheet",{displayName:"BottomSheet",events:{onClose:"db-close",onDbClose:"db-close"}}),Bn=createWebComponent("db-scroll-area",{displayName:"ScrollArea"}),Pn=createWebComponent("db-dropzone",{displayName:"Dropzone",events:{onFileSelect:"db-file-select",onDragOver:"db-drag-over",onDragLeave:"db-drag-leave",onDrop:"db-drop",onClick:"db-click",onDbFileSelect:"db-file-select",onDbDragOver:"db-drag-over",onDbDragLeave:"db-drag-leave",onDbDrop:"db-drop",onDbClick:"db-click"}}),Fn=createWebComponent("db-onboarding-modal",{displayName:"OnboardingModal",events:{onClose:"db-close",onStepChange:"db-step-change",onComplete:"db-complete",onDbClose:"db-close",onDbStepChange:"db-step-change",onDbComplete:"db-complete"}}),On=createWebComponent("db-split-view",{displayName:"SplitView"}),Hn=createWebComponent("db-file-uploader",{displayName:"FileUploader",events:{onUpload:"db-upload",onRemove:"db-remove",onRetry:"db-retry",onDbUpload:"db-upload",onDbRemove:"db-remove",onDbRetry:"db-retry"}}),Rn=createWebComponent("db-date-picker",{displayName:"DatePicker",events:{onChange:"db-change",onDbChange:"db-change"}}),Vn=createWebComponent("db-time-picker",{displayName:"TimePicker",events:{onChange:"db-change",onDbChange:"db-change"}}),Wn=createWebComponent("db-calendar",{displayName:"Calendar",events:{onDateClick:"db-date-click",onEventClick:"db-event-click",onEventAdd:"db-event-add",onEventEdit:"db-event-edit",onEventDelete:"db-event-delete",onViewChange:"db-view-change",onMonthChange:"db-month-change",onDbDateClick:"db-date-click",onDbEventClick:"db-event-click",onDbEventAdd:"db-event-add",onDbEventEdit:"db-event-edit",onDbEventDelete:"db-event-delete",onDbViewChange:"db-view-change",onDbMonthChange:"db-month-change"}});export{Zs as Accordion,kn as AdBanner,Qs as Alert,$n as AnimationBackground,Sn as AnimationText,fn as AppBadge,bn as AudioPlayer,ei as Avatar,ti as Backdrop,si as Badge,ii as Banner,Ri as BottomNavigation,Tn as BottomSheet,ni as Breadcrumbs,ai as Button,Wn as Calendar,ri as Card,ln as Carousel,li as Checkbox,oi as Chip,pn as CodeBlock,on as ColorPicker,di as Confirm,ci as Container,hi as ContextMenu,an as Countdown,In as CursorFollower,Rn as DatePicker,ui as Divider,bi as Drawer,pi as Dropdown,Pn as Dropzone,mi as EmptyState,Hn as FileUploader,zn as FloatingActionButton,gi as Form,_n as Gradient,vi as Grid,Ei as GridItem,Pi as Image,Oi as ImageList,Fi as ImagePlaceholder,fi as Indicator,wi as Input,yi as Label,Hi as Lightbox,_i as List,Ai as Logo,Dn as Lottie,mn as MarkdownEditor,An as Marquee,rn as Masonry,Ci as MenuItem,ki as Modal,ModalBody,ModalFooter,ModalHeader,Vi as Navbar,Fn as OnboardingModal,Ln as PageHeader,xi as Pagination,Si as Popover,Ni as Progress,$i as ProgressStep,Ii as Progressbar,Di as Radio,Cn as RandomGradient,Li as RangeSlider,nn as Rating,dn as Reorder,cn as ResizablePanels,Bn as ScrollArea,Mi as SearchBar,Mn as Section,yn as SectionAppDownload,wn as SectionContact,En as SectionFeature,vn as SectionHero,qi as SegmentControl,ji as Select,zi as Share,Wi as Sidebar,Ui as Skeleton,Ki as Spinner,On as SplitView,Ji as Stack,Bi as Stat,Gi as Stepper,Yi as Table,Xi as Tabs,gn as Testimonial,Zi as Textarea,Vn as TimePicker,xn as Timeline,Qi as Toast,en as Toggle,tn as Toolbar,sn as Tooltip,Ti as TopBanner,Nn as Tutorial,hn as VideoPlayer,un as YouTubePlayer,useContextMenu};