// ==UserScript== // @name GKD网页审查工具增强 // @name:en-US Make GKDInspect Better // @namespace https://blog.adproqwq.xyz // @version 2.4.5 // @author Adpro // @description 让GKD网页审查工具再次强大! // @description:en-US Let GKD Inspect Better Again! // @license MIT // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDMyIDMyIj48cGF0aCBmaWxsPSJjdXJyZW50Q29sb3IiIGQ9Im0yMyA0bC01IDMuNzV2Ni41TDE1IDEybC01IDMuNzV2Ni41TDcgMjBsLTUgMy43NVYzMGgydi01LjI1bDMtMi4yNWwzIDIuMjVWMzBoMlYxNi43NWwzLTIuMjVsMyAyLjI1VjMwaDJWOC43NWwzLTIuMjVsMyAyLjI1VjMwaDJWNy43NXoiLz48L3N2Zz4= // @homepage https://github.com/adproqwq/MakeGKDInspectBetter // @supportURL https://github.com/adproqwq/MakeGKDInspectBetter/issues // @match https://i.gkd.li/* // @exclude https://i.gkd.li // @require https://cdn.jsdelivr.net/npm/vue@3.5.10/dist/vue.global.prod.js // @grant none // ==/UserScript== (r=>{if(typeof GM_addStyle=="function"){GM_addStyle(r);return}const o=document.createElement("style");o.textContent=r,document.head.append(o)})(' :root{--mdui-breakpoint-xs:0px;--mdui-breakpoint-sm:600px;--mdui-breakpoint-md:840px;--mdui-breakpoint-lg:1080px;--mdui-breakpoint-xl:1440px;--mdui-breakpoint-xxl:1920px}:root{--mdui-color-primary-light:103,80,164;--mdui-color-primary-container-light:234,221,255;--mdui-color-on-primary-light:255,255,255;--mdui-color-on-primary-container-light:33,0,94;--mdui-color-inverse-primary-light:208,188,255;--mdui-color-secondary-light:98,91,113;--mdui-color-secondary-container-light:232,222,248;--mdui-color-on-secondary-light:255,255,255;--mdui-color-on-secondary-container-light:30,25,43;--mdui-color-tertiary-light:125,82,96;--mdui-color-tertiary-container-light:255,216,228;--mdui-color-on-tertiary-light:255,255,255;--mdui-color-on-tertiary-container-light:55,11,30;--mdui-color-surface-light:254,247,255;--mdui-color-surface-dim-light:222,216,225;--mdui-color-surface-bright-light:254,247,255;--mdui-color-surface-container-lowest-light:255,255,255;--mdui-color-surface-container-low-light:247,242,250;--mdui-color-surface-container-light:243,237,247;--mdui-color-surface-container-high-light:236,230,240;--mdui-color-surface-container-highest-light:230,224,233;--mdui-color-surface-variant-light:231,224,236;--mdui-color-on-surface-light:28,27,31;--mdui-color-on-surface-variant-light:73,69,78;--mdui-color-inverse-surface-light:49,48,51;--mdui-color-inverse-on-surface-light:244,239,244;--mdui-color-background-light:254,247,255;--mdui-color-on-background-light:28,27,31;--mdui-color-error-light:179,38,30;--mdui-color-error-container-light:249,222,220;--mdui-color-on-error-light:255,255,255;--mdui-color-on-error-container-light:65,14,11;--mdui-color-outline-light:121,116,126;--mdui-color-outline-variant-light:196,199,197;--mdui-color-shadow-light:0,0,0;--mdui-color-surface-tint-color-light:103,80,164;--mdui-color-scrim-light:0,0,0;--mdui-color-primary-dark:208,188,255;--mdui-color-primary-container-dark:79,55,139;--mdui-color-on-primary-dark:55,30,115;--mdui-color-on-primary-container-dark:234,221,255;--mdui-color-inverse-primary-dark:103,80,164;--mdui-color-secondary-dark:204,194,220;--mdui-color-secondary-container-dark:74,68,88;--mdui-color-on-secondary-dark:51,45,65;--mdui-color-on-secondary-container-dark:232,222,248;--mdui-color-tertiary-dark:239,184,200;--mdui-color-tertiary-container-dark:99,59,72;--mdui-color-on-tertiary-dark:73,37,50;--mdui-color-on-tertiary-container-dark:255,216,228;--mdui-color-surface-dark:20,18,24;--mdui-color-surface-dim-dark:20,18,24;--mdui-color-surface-bright-dark:59,56,62;--mdui-color-surface-container-lowest-dark:15,13,19;--mdui-color-surface-container-low-dark:29,27,32;--mdui-color-surface-container-dark:33,31,38;--mdui-color-surface-container-high-dark:43,41,48;--mdui-color-surface-container-highest-dark:54,52,59;--mdui-color-surface-variant-dark:73,69,79;--mdui-color-on-surface-dark:230,225,229;--mdui-color-on-surface-variant-dark:202,196,208;--mdui-color-inverse-surface-dark:230,225,229;--mdui-color-inverse-on-surface-dark:49,48,51;--mdui-color-background-dark:20,18,24;--mdui-color-on-background-dark:230,225,229;--mdui-color-error-dark:242,184,181;--mdui-color-error-container-dark:140,29,24;--mdui-color-on-error-dark:96,20,16;--mdui-color-on-error-container-dark:249,222,220;--mdui-color-outline-dark:147,143,153;--mdui-color-outline-variant-dark:68,71,70;--mdui-color-shadow-dark:0,0,0;--mdui-color-surface-tint-color-dark:208,188,255;--mdui-color-scrim-dark:0,0,0;font-size:16px}.mdui-theme-light,:root{color-scheme:light;--mdui-color-primary:var(--mdui-color-primary-light);--mdui-color-primary-container:var(--mdui-color-primary-container-light);--mdui-color-on-primary:var(--mdui-color-on-primary-light);--mdui-color-on-primary-container:var(--mdui-color-on-primary-container-light);--mdui-color-inverse-primary:var(--mdui-color-inverse-primary-light);--mdui-color-secondary:var(--mdui-color-secondary-light);--mdui-color-secondary-container:var(--mdui-color-secondary-container-light);--mdui-color-on-secondary:var(--mdui-color-on-secondary-light);--mdui-color-on-secondary-container:var(--mdui-color-on-secondary-container-light);--mdui-color-tertiary:var(--mdui-color-tertiary-light);--mdui-color-tertiary-container:var(--mdui-color-tertiary-container-light);--mdui-color-on-tertiary:var(--mdui-color-on-tertiary-light);--mdui-color-on-tertiary-container:var(--mdui-color-on-tertiary-container-light);--mdui-color-surface:var(--mdui-color-surface-light);--mdui-color-surface-dim:var(--mdui-color-surface-dim-light);--mdui-color-surface-bright:var(--mdui-color-surface-bright-light);--mdui-color-surface-container-lowest:var(--mdui-color-surface-container-lowest-light);--mdui-color-surface-container-low:var(--mdui-color-surface-container-low-light);--mdui-color-surface-container:var(--mdui-color-surface-container-light);--mdui-color-surface-container-high:var(--mdui-color-surface-container-high-light);--mdui-color-surface-container-highest:var(--mdui-color-surface-container-highest-light);--mdui-color-surface-variant:var(--mdui-color-surface-variant-light);--mdui-color-on-surface:var(--mdui-color-on-surface-light);--mdui-color-on-surface-variant:var(--mdui-color-on-surface-variant-light);--mdui-color-inverse-surface:var(--mdui-color-inverse-surface-light);--mdui-color-inverse-on-surface:var(--mdui-color-inverse-on-surface-light);--mdui-color-background:var(--mdui-color-background-light);--mdui-color-on-background:var(--mdui-color-on-background-light);--mdui-color-error:var(--mdui-color-error-light);--mdui-color-error-container:var(--mdui-color-error-container-light);--mdui-color-on-error:var(--mdui-color-on-error-light);--mdui-color-on-error-container:var(--mdui-color-on-error-container-light);--mdui-color-outline:var(--mdui-color-outline-light);--mdui-color-outline-variant:var(--mdui-color-outline-variant-light);--mdui-color-shadow:var(--mdui-color-shadow-light);--mdui-color-surface-tint-color:var(--mdui-color-surface-tint-color-light);--mdui-color-scrim:var(--mdui-color-scrim-light);color:rgb(var(--mdui-color-on-background));background-color:rgb(var(--mdui-color-background))}.mdui-theme-dark{color-scheme:dark;--mdui-color-primary:var(--mdui-color-primary-dark);--mdui-color-primary-container:var(--mdui-color-primary-container-dark);--mdui-color-on-primary:var(--mdui-color-on-primary-dark);--mdui-color-on-primary-container:var(--mdui-color-on-primary-container-dark);--mdui-color-inverse-primary:var(--mdui-color-inverse-primary-dark);--mdui-color-secondary:var(--mdui-color-secondary-dark);--mdui-color-secondary-container:var(--mdui-color-secondary-container-dark);--mdui-color-on-secondary:var(--mdui-color-on-secondary-dark);--mdui-color-on-secondary-container:var(--mdui-color-on-secondary-container-dark);--mdui-color-tertiary:var(--mdui-color-tertiary-dark);--mdui-color-tertiary-container:var(--mdui-color-tertiary-container-dark);--mdui-color-on-tertiary:var(--mdui-color-on-tertiary-dark);--mdui-color-on-tertiary-container:var(--mdui-color-on-tertiary-container-dark);--mdui-color-surface:var(--mdui-color-surface-dark);--mdui-color-surface-dim:var(--mdui-color-surface-dim-dark);--mdui-color-surface-bright:var(--mdui-color-surface-bright-dark);--mdui-color-surface-container-lowest:var(--mdui-color-surface-container-lowest-dark);--mdui-color-surface-container-low:var(--mdui-color-surface-container-low-dark);--mdui-color-surface-container:var(--mdui-color-surface-container-dark);--mdui-color-surface-container-high:var(--mdui-color-surface-container-high-dark);--mdui-color-surface-container-highest:var(--mdui-color-surface-container-highest-dark);--mdui-color-surface-variant:var(--mdui-color-surface-variant-dark);--mdui-color-on-surface:var(--mdui-color-on-surface-dark);--mdui-color-on-surface-variant:var(--mdui-color-on-surface-variant-dark);--mdui-color-inverse-surface:var(--mdui-color-inverse-surface-dark);--mdui-color-inverse-on-surface:var(--mdui-color-inverse-on-surface-dark);--mdui-color-background:var(--mdui-color-background-dark);--mdui-color-on-background:var(--mdui-color-on-background-dark);--mdui-color-error:var(--mdui-color-error-dark);--mdui-color-error-container:var(--mdui-color-error-container-dark);--mdui-color-on-error:var(--mdui-color-on-error-dark);--mdui-color-on-error-container:var(--mdui-color-on-error-container-dark);--mdui-color-outline:var(--mdui-color-outline-dark);--mdui-color-outline-variant:var(--mdui-color-outline-variant-dark);--mdui-color-shadow:var(--mdui-color-shadow-dark);--mdui-color-surface-tint-color:var(--mdui-color-surface-tint-color-dark);--mdui-color-scrim:var(--mdui-color-scrim-dark);color:rgb(var(--mdui-color-on-background));background-color:rgb(var(--mdui-color-background))}@media (prefers-color-scheme:dark){.mdui-theme-auto{color-scheme:dark;--mdui-color-primary:var(--mdui-color-primary-dark);--mdui-color-primary-container:var(--mdui-color-primary-container-dark);--mdui-color-on-primary:var(--mdui-color-on-primary-dark);--mdui-color-on-primary-container:var(--mdui-color-on-primary-container-dark);--mdui-color-inverse-primary:var(--mdui-color-inverse-primary-dark);--mdui-color-secondary:var(--mdui-color-secondary-dark);--mdui-color-secondary-container:var(--mdui-color-secondary-container-dark);--mdui-color-on-secondary:var(--mdui-color-on-secondary-dark);--mdui-color-on-secondary-container:var(--mdui-color-on-secondary-container-dark);--mdui-color-tertiary:var(--mdui-color-tertiary-dark);--mdui-color-tertiary-container:var(--mdui-color-tertiary-container-dark);--mdui-color-on-tertiary:var(--mdui-color-on-tertiary-dark);--mdui-color-on-tertiary-container:var(--mdui-color-on-tertiary-container-dark);--mdui-color-surface:var(--mdui-color-surface-dark);--mdui-color-surface-dim:var(--mdui-color-surface-dim-dark);--mdui-color-surface-bright:var(--mdui-color-surface-bright-dark);--mdui-color-surface-container-lowest:var(--mdui-color-surface-container-lowest-dark);--mdui-color-surface-container-low:var(--mdui-color-surface-container-low-dark);--mdui-color-surface-container:var(--mdui-color-surface-container-dark);--mdui-color-surface-container-high:var(--mdui-color-surface-container-high-dark);--mdui-color-surface-container-highest:var(--mdui-color-surface-container-highest-dark);--mdui-color-surface-variant:var(--mdui-color-surface-variant-dark);--mdui-color-on-surface:var(--mdui-color-on-surface-dark);--mdui-color-on-surface-variant:var(--mdui-color-on-surface-variant-dark);--mdui-color-inverse-surface:var(--mdui-color-inverse-surface-dark);--mdui-color-inverse-on-surface:var(--mdui-color-inverse-on-surface-dark);--mdui-color-background:var(--mdui-color-background-dark);--mdui-color-on-background:var(--mdui-color-on-background-dark);--mdui-color-error:var(--mdui-color-error-dark);--mdui-color-error-container:var(--mdui-color-error-container-dark);--mdui-color-on-error:var(--mdui-color-on-error-dark);--mdui-color-on-error-container:var(--mdui-color-on-error-container-dark);--mdui-color-outline:var(--mdui-color-outline-dark);--mdui-color-outline-variant:var(--mdui-color-outline-variant-dark);--mdui-color-shadow:var(--mdui-color-shadow-dark);--mdui-color-surface-tint-color:var(--mdui-color-surface-tint-color-dark);--mdui-color-scrim:var(--mdui-color-scrim-dark);color:rgb(var(--mdui-color-on-background));background-color:rgb(var(--mdui-color-background))}}:root{--mdui-elevation-level0:none;--mdui-elevation-level1:0 .5px 1.5px 0 rgba(var(--mdui-color-shadow), 19%),0 0 1px 0 rgba(var(--mdui-color-shadow), 3.9%);--mdui-elevation-level2:0 .85px 3px 0 rgba(var(--mdui-color-shadow), 19%),0 .25px 1px 0 rgba(var(--mdui-color-shadow), 3.9%);--mdui-elevation-level3:0 1.25px 5px 0 rgba(var(--mdui-color-shadow), 19%),0 .3333px 1.5px 0 rgba(var(--mdui-color-shadow), 3.9%);--mdui-elevation-level4:0 1.85px 6.25px 0 rgba(var(--mdui-color-shadow), 19%),0 .5px 1.75px 0 rgba(var(--mdui-color-shadow), 3.9%);--mdui-elevation-level5:0 2.75px 9px 0 rgba(var(--mdui-color-shadow), 19%),0 .25px 3px 0 rgba(var(--mdui-color-shadow), 3.9%)}:root{--mdui-motion-easing-linear:cubic-bezier(0, 0, 1, 1);--mdui-motion-easing-standard:cubic-bezier(.2, 0, 0, 1);--mdui-motion-easing-standard-accelerate:cubic-bezier(.3, 0, 1, 1);--mdui-motion-easing-standard-decelerate:cubic-bezier(0, 0, 0, 1);--mdui-motion-easing-emphasized:var(--mdui-motion-easing-standard);--mdui-motion-easing-emphasized-accelerate:cubic-bezier(.3, 0, .8, .15);--mdui-motion-easing-emphasized-decelerate:cubic-bezier(.05, .7, .1, 1);--mdui-motion-duration-short1:50ms;--mdui-motion-duration-short2:.1s;--mdui-motion-duration-short3:.15s;--mdui-motion-duration-short4:.2s;--mdui-motion-duration-medium1:.25s;--mdui-motion-duration-medium2:.3s;--mdui-motion-duration-medium3:.35s;--mdui-motion-duration-medium4:.4s;--mdui-motion-duration-long1:.45s;--mdui-motion-duration-long2:.5s;--mdui-motion-duration-long3:.55s;--mdui-motion-duration-long4:.6s;--mdui-motion-duration-extra-long1:.7s;--mdui-motion-duration-extra-long2:.8s;--mdui-motion-duration-extra-long3:.9s;--mdui-motion-duration-extra-long4:1s}.mdui-prose{line-height:1.75;word-wrap:break-word}.mdui-prose :first-child{margin-top:0}.mdui-prose :last-child{margin-bottom:0}.mdui-prose code,.mdui-prose kbd,.mdui-prose pre,.mdui-prose pre tt,.mdui-prose samp{font-family:Consolas,Courier,Courier New,monospace}.mdui-prose caption{text-align:left}.mdui-prose [draggable=true],.mdui-prose [draggable]{cursor:move}.mdui-prose [draggable=false]{cursor:inherit}.mdui-prose dl,.mdui-prose form,.mdui-prose ol,.mdui-prose p,.mdui-prose ul{margin-top:1.25em;margin-bottom:1.25em}.mdui-prose a{text-decoration:none;outline:0;color:rgb(var(--mdui-color-primary))}.mdui-prose a:focus,.mdui-prose a:hover{border-bottom:.0625rem solid rgb(var(--mdui-color-primary))}.mdui-prose small{font-size:.875em}.mdui-prose strong{font-weight:600}.mdui-prose blockquote{margin:1.6em 2em;padding-left:1em;border-left:.25rem solid rgb(var(--mdui-color-surface-variant))}@media only screen and (max-width:599.98px){.mdui-prose blockquote{margin:1.6em 0}}.mdui-prose blockquote footer{font-size:86%;color:rgb(var(--mdui-color-on-surface-variant))}.mdui-prose mark{color:inherit;background-color:rgb(var(--mdui-color-secondary-container));border-bottom:.0625rem solid rgb(var(--mdui-color-secondary));margin:0 .375rem;padding:.125rem}.mdui-prose h1,.mdui-prose h2,.mdui-prose h3,.mdui-prose h4,.mdui-prose h5,.mdui-prose h6{font-weight:400}.mdui-prose h1 small,.mdui-prose h2 small,.mdui-prose h3 small,.mdui-prose h4 small,.mdui-prose h5 small,.mdui-prose h6 small{font-weight:inherit;font-size:65%;color:rgb(var(--mdui-color-on-surface-variant))}.mdui-prose h1 strong,.mdui-prose h2 strong,.mdui-prose h3 strong,.mdui-prose h4 strong,.mdui-prose h5 strong,.mdui-prose h6 strong{font-weight:600}.mdui-prose h1{font-size:2.5em;margin-top:0;margin-bottom:1.25em;line-height:1.1111}.mdui-prose h2{font-size:1.875em;margin-top:2.25em;margin-bottom:1.125em;line-height:1.3333}.mdui-prose h3{font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.6}.mdui-prose h4{font-size:1.25em;margin-top:1.875em;margin-bottom:.875em;line-height:1.5}.mdui-prose h2+*,.mdui-prose h3+*,.mdui-prose h4+*,.mdui-prose hr+*{margin-top:0}.mdui-prose code,.mdui-prose kbd{font-size:.875em;color:rgb(var(--mdui-color-on-surface-container));background-color:rgba(var(--mdui-color-surface-variant),.28);padding:.125rem .375rem;border-radius:var(--mdui-shape-corner-extra-small)}.mdui-prose kbd{font-size:.9em}.mdui-prose abbr[title]{text-decoration:none;cursor:help;border-bottom:.0625rem dotted rgb(var(--mdui-color-on-surface-variant))}.mdui-prose ins,.mdui-prose u{text-decoration:none;border-bottom:.0625rem solid rgb(var(--mdui-color-on-surface-variant))}.mdui-prose del{text-decoration:line-through}.mdui-prose hr{margin-top:3em;margin-bottom:3em;border:none;border-bottom:.0625rem solid rgb(var(--mdui-color-surface-variant))}.mdui-prose pre{margin-top:1.7143em;margin-bottom:1.7143em}.mdui-prose pre code{padding:.8571em 1.1429em;overflow-x:auto;-webkit-overflow-scrolling:touch;background-color:rgb(var(--mdui-color-surface-container));color:rgb(var(--mdui-color-on-surface-container));border-radius:var(--mdui-shape-corner-extra-small)}.mdui-prose ol,.mdui-prose ul{padding-left:1.625em}.mdui-prose ul{list-style-type:disc}.mdui-prose ol{list-style-type:decimal}.mdui-prose ol[type=A]{list-style-type:upper-alpha}.mdui-prose ol[type=a]{list-style-type:lower-alpha}.mdui-prose ol[type=I]{list-style-type:upper-roman}.mdui-prose ol[type=i]{list-style-type:lower-roman}.mdui-prose ol[type="1"]{list-style-type:decimal}.mdui-prose li{margin-top:.5em;margin-bottom:.5em}.mdui-prose ol>li,.mdui-prose ul>li{padding-left:.375em}.mdui-prose ol>li>p,.mdui-prose ul>li>p{margin-top:.75em;margin-bottom:.75em}.mdui-prose ol>li>:first-child,.mdui-prose ul>li>:first-child{margin-top:1.25em}.mdui-prose ol>li>:last-child,.mdui-prose ul>li>:last-child{margin-bottom:1.25em}.mdui-prose ol>li::marker{font-weight:400;color:rgb(var(--mdui-color-on-surface-variant))}.mdui-prose ul>li::marker{color:rgb(var(--mdui-color-on-surface-variant))}.mdui-prose ol ol,.mdui-prose ol ul,.mdui-prose ul ol,.mdui-prose ul ul{margin-top:.75em;margin-bottom:.75em}.mdui-prose fieldset,.mdui-prose img{border:none}.mdui-prose figure,.mdui-prose img,.mdui-prose video{margin-top:2em;margin-bottom:2em;max-width:100%}.mdui-prose figure>*{margin-top:0;margin-bottom:0}.mdui-prose figcaption{font-size:.875em;line-height:1.4286;margin-top:.8571em;color:rgb(var(--mdui-color-on-surface-variant))}.mdui-prose figcaption:empty:before{z-index:-1;cursor:text;content:attr(placeholder);color:rgb(var(--mdui-color-on-surface-variant))}.mdui-prose table{margin-top:2em;margin-bottom:2em;border:.0625rem solid rgb(var(--mdui-color-surface-variant));border-radius:var(--mdui-shape-corner-large)}.mdui-table{width:100%;overflow-x:auto;margin-top:2em;margin-bottom:2em;border:.0625rem solid rgb(var(--mdui-color-surface-variant));border-radius:var(--mdui-shape-corner-large)}.mdui-table table{margin-top:0;margin-bottom:0;border:none;border-radius:0}.mdui-prose table,.mdui-table table{width:100%;text-align:left;border-collapse:collapse;border-spacing:0}.mdui-prose td,.mdui-prose th,.mdui-table td,.mdui-table th{border-top:.0625rem solid rgb(var(--mdui-color-surface-variant))}.mdui-prose td:not(:first-child),.mdui-prose th:not(:first-child),.mdui-table td:not(:first-child),.mdui-table th:not(:first-child){border-left:.0625rem solid rgb(var(--mdui-color-surface-variant))}.mdui-prose td:not(:last-child),.mdui-prose th:not(:last-child),.mdui-table td:not(:last-child),.mdui-table th:not(:last-child){border-right:.0625rem solid rgb(var(--mdui-color-surface-variant))}.mdui-prose tbody:first-child tr:first-child td,.mdui-prose thead:first-child tr:first-child th,.mdui-table tbody:first-child tr:first-child td,.mdui-table thead:first-child tr:first-child th{border-top:0}.mdui-prose tfoot td,.mdui-prose tfoot th,.mdui-prose thead td,.mdui-prose thead th,.mdui-table tfoot td,.mdui-table tfoot th,.mdui-table thead td,.mdui-table thead th{position:relative;vertical-align:middle;padding:1.125rem 1rem;font-weight:var(--mdui-typescale-title-medium-weight);letter-spacing:var(--mdui-typescale-title-medium-tracking);line-height:var(--mdui-typescale-title-medium-line-height);color:rgb(var(--mdui-color-on-surface-variant));box-shadow:var(--mdui-elevation-level1)}.mdui-prose tbody td,.mdui-prose tbody th,.mdui-table tbody td,.mdui-table tbody th{padding:.875rem 1rem}.mdui-prose tbody th,.mdui-table tbody th{vertical-align:middle;font-weight:inherit}.mdui-prose tbody td,.mdui-table tbody td{vertical-align:baseline}:root{--mdui-shape-corner-none:0;--mdui-shape-corner-extra-small:.25rem;--mdui-shape-corner-small:.5rem;--mdui-shape-corner-medium:.75rem;--mdui-shape-corner-large:1rem;--mdui-shape-corner-extra-large:1.75rem;--mdui-shape-corner-full:1000rem}:root{--mdui-state-layer-hover:.08;--mdui-state-layer-focus:.12;--mdui-state-layer-pressed:.12;--mdui-state-layer-dragged:.16}:root{--mdui-typescale-display-large-weight:400;--mdui-typescale-display-medium-weight:400;--mdui-typescale-display-small-weight:400;--mdui-typescale-display-large-line-height:4rem;--mdui-typescale-display-medium-line-height:3.25rem;--mdui-typescale-display-small-line-height:2.75rem;--mdui-typescale-display-large-size:3.5625rem;--mdui-typescale-display-medium-size:2.8125rem;--mdui-typescale-display-small-size:2.25rem;--mdui-typescale-display-large-tracking:0rem;--mdui-typescale-display-medium-tracking:0rem;--mdui-typescale-display-small-tracking:0rem;--mdui-typescale-headline-large-weight:400;--mdui-typescale-headline-medium-weight:400;--mdui-typescale-headline-small-weight:400;--mdui-typescale-headline-large-line-height:2.5rem;--mdui-typescale-headline-medium-line-height:2.25rem;--mdui-typescale-headline-small-line-height:2rem;--mdui-typescale-headline-large-size:2rem;--mdui-typescale-headline-medium-size:1.75rem;--mdui-typescale-headline-small-size:1.5rem;--mdui-typescale-headline-large-tracking:0rem;--mdui-typescale-headline-medium-tracking:0rem;--mdui-typescale-headline-small-tracking:0rem;--mdui-typescale-title-large-weight:400;--mdui-typescale-title-medium-weight:500;--mdui-typescale-title-small-weight:500;--mdui-typescale-title-large-line-height:1.75rem;--mdui-typescale-title-medium-line-height:1.5rem;--mdui-typescale-title-small-line-height:1.25rem;--mdui-typescale-title-large-size:1.375rem;--mdui-typescale-title-medium-size:1rem;--mdui-typescale-title-small-size:.875rem;--mdui-typescale-title-large-tracking:0rem;--mdui-typescale-title-medium-tracking:.009375rem;--mdui-typescale-title-small-tracking:.00625rem;--mdui-typescale-label-large-weight:500;--mdui-typescale-label-medium-weight:500;--mdui-typescale-label-small-weight:500;--mdui-typescale-label-large-line-height:1.25rem;--mdui-typescale-label-medium-line-height:1rem;--mdui-typescale-label-small-line-height:.375rem;--mdui-typescale-label-large-size:.875rem;--mdui-typescale-label-medium-size:.75rem;--mdui-typescale-label-small-size:.6875rem;--mdui-typescale-label-large-tracking:.00625rem;--mdui-typescale-label-medium-tracking:.03125rem;--mdui-typescale-label-small-tracking:.03125rem;--mdui-typescale-body-large-weight:400;--mdui-typescale-body-medium-weight:400;--mdui-typescale-body-small-weight:400;--mdui-typescale-body-large-line-height:1.5rem;--mdui-typescale-body-medium-line-height:1.25rem;--mdui-typescale-body-small-line-height:1rem;--mdui-typescale-body-large-size:1rem;--mdui-typescale-body-medium-size:.875rem;--mdui-typescale-body-small-size:.75rem;--mdui-typescale-body-large-tracking:.009375rem;--mdui-typescale-body-medium-tracking:.015625rem;--mdui-typescale-body-small-tracking:.025rem}.mdui-lock-screen{overflow:hidden!important}#categories{width:500px}mdui-dialog>*>span{display:flex;font-size:var(--mdui-typescale-body-large-size)}.introduction{color:rgb(var(--mdui-color-on-surface-variant));display:block;opacity:1;transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)} '); (function (vue) { 'use strict'; var _a; function isObject(obj) { return obj !== null && typeof obj === "object" && "constructor" in obj && obj.constructor === Object; } function extend$1(target = {}, src = {}) { Object.keys(src).forEach((key2) => { if (typeof target[key2] === "undefined") target[key2] = src[key2]; else if (isObject(src[key2]) && isObject(target[key2]) && Object.keys(src[key2]).length > 0) { extend$1(target[key2], src[key2]); } }); } const ssrDocument = { body: {}, addEventListener() { }, removeEventListener() { }, activeElement: { blur() { }, nodeName: "" }, querySelector() { return null; }, querySelectorAll() { return []; }, getElementById() { return null; }, createEvent() { return { initEvent() { } }; }, createElement() { return { children: [], childNodes: [], style: {}, setAttribute() { }, getElementsByTagName() { return []; } }; }, createElementNS() { return {}; }, importNode() { return null; }, location: { hash: "", host: "", hostname: "", href: "", origin: "", pathname: "", protocol: "", search: "" } }; function getDocument() { const doc = typeof document !== "undefined" ? document : {}; extend$1(doc, ssrDocument); return doc; } const ssrWindow = { document: ssrDocument, navigator: { userAgent: "" }, location: { hash: "", host: "", hostname: "", href: "", origin: "", pathname: "", protocol: "", search: "" }, history: { replaceState() { }, pushState() { }, go() { }, back() { } }, CustomEvent: function CustomEvent2() { return this; }, addEventListener() { }, removeEventListener() { }, getComputedStyle() { return { getPropertyValue() { return ""; } }; }, Image() { }, Date() { }, screen: {}, setTimeout() { }, clearTimeout() { }, matchMedia() { return {}; }, requestAnimationFrame(callback) { if (typeof setTimeout === "undefined") { callback(); return null; } return setTimeout(callback, 0); }, cancelAnimationFrame(id2) { if (typeof setTimeout === "undefined") { return; } clearTimeout(id2); } }; function getWindow$1() { const win = typeof window !== "undefined" ? window : {}; extend$1(win, ssrWindow); return win; } const getNodeName$1 = (element) => { return (element == null ? void 0 : element.nodeName.toLowerCase()) ?? ""; }; const isNodeName = (element, name) => { return (element == null ? void 0 : element.nodeName.toLowerCase()) === name.toLowerCase(); }; const isFunction = (target) => { return typeof target === "function"; }; const isString = (target) => { return typeof target === "string"; }; const isNumber = (target) => { return typeof target === "number"; }; const isBoolean = (target) => { return typeof target === "boolean"; }; const isUndefined = (target) => { return typeof target === "undefined"; }; const isNull = (target) => { return target === null; }; const isWindow = (target) => { return typeof Window !== "undefined" && target instanceof Window; }; const isDocument = (target) => { return typeof Document !== "undefined" && target instanceof Document; }; const isElement = (target) => { return typeof Element !== "undefined" && target instanceof Element; }; const isNode$1 = (target) => { return typeof Node !== "undefined" && target instanceof Node; }; const isArrayLike = (target) => { return !isFunction(target) && !isWindow(target) && isNumber(target.length); }; const isObjectLike = (target) => { return typeof target === "object" && target !== null; }; const toElement = (target) => { return isDocument(target) ? target.documentElement : target; }; const toCamelCase = (string) => { return string.replace(/-([a-z])/g, (_2, letter) => { return letter.toUpperCase(); }); }; const toKebabCase = (string) => { if (!string) { return string; } return string.replace(/^./, string[0].toLowerCase()).replace(/[A-Z]/g, (replacer) => { return "-" + replacer.toLowerCase(); }); }; const returnFalse = () => { return false; }; const returnTrue = () => { return true; }; const eachArray = (target, callback) => { for (let i3 = 0; i3 < target.length; i3 += 1) { if (callback.call(target[i3], target[i3], i3) === false) { return target; } } return target; }; const eachObject = (target, callback) => { const keys = Object.keys(target); for (let i3 = 0; i3 < keys.length; i3 += 1) { const key2 = keys[i3]; if (callback.call(target[key2], key2, target[key2]) === false) { return target; } } return target; }; class JQ { constructor(arr) { this.length = 0; if (!arr) { return this; } eachArray(arr, (item, i3) => { this[i3] = item; }); this.length = arr.length; return this; } } const isDomReady = (document2 = getDocument()) => { return /complete|interactive/.test(document2.readyState); }; const createElement = (tagName) => { const document2 = getDocument(); return document2.createElement(tagName); }; const appendChild = (element, child) => { return element.appendChild(child); }; const removeChild = (element) => { return element.parentNode ? element.parentNode.removeChild(element) : element; }; const getChildNodesArray = (target, parent) => { const tempParent = createElement(parent); tempParent.innerHTML = target; return [].slice.call(tempParent.childNodes); }; const get$ = () => { const $2 = function(selector) { if (!selector) { return new JQ(); } if (selector instanceof JQ) { return selector; } if (isFunction(selector)) { const document2 = getDocument(); if (isDomReady(document2)) { selector.call(document2, $2); } else { document2.addEventListener("DOMContentLoaded", () => selector.call(document2, $2), { once: true }); } return new JQ([document2]); } if (isString(selector)) { const html = selector.trim(); if (html.startsWith("<") && html.endsWith(">")) { let toCreate = "div"; const tags = { li: "ul", tr: "tbody", td: "tr", th: "tr", tbody: "table", option: "select" }; eachObject(tags, (childTag, parentTag) => { if (html.startsWith(`<${childTag}`)) { toCreate = parentTag; return false; } return; }); return new JQ(getChildNodesArray(html, toCreate)); } const document2 = getDocument(); return new JQ(document2.querySelectorAll(selector)); } if (isArrayLike(selector) && !isNode$1(selector)) { return new JQ(selector); } return new JQ([selector]); }; $2.fn = JQ.prototype; return $2; }; const $$1 = get$(); const merge = (first, second) => { eachArray(second, (value) => { first.push(value); }); return first; }; const unique = (arr) => { return [...new Set(arr)]; }; $$1.fn.get = function(index) { return index === void 0 ? [].slice.call(this) : this[index >= 0 ? index : index + this.length]; }; $$1.fn.add = function(selector) { return new JQ(unique(merge(this.get(), $$1(selector).get()))); }; const getAttribute = (element, key2, defaultValue2) => { const value = element.getAttribute(key2); return isNull(value) ? defaultValue2 : value; }; const removeAttribute = (element, key2) => { element.removeAttribute(key2); }; const setAttribute = (element, key2, value) => { isNull(value) ? removeAttribute(element, key2) : element.setAttribute(key2, value); }; $$1.fn.each = function(callback) { return eachArray(this, (value, index) => { return callback.call(value, index, value); }); }; eachArray(["add", "remove", "toggle"], (name) => { $$1.fn[`${name}Class`] = function(className2) { if (name === "remove" && !arguments.length) { return this.each((_2, element) => { setAttribute(element, "class", ""); }); } return this.each((i3, element) => { if (!isElement(element)) { return; } const classes = (isFunction(className2) ? className2.call(element, i3, getAttribute(element, "class", "")) : className2).split(" ").filter((name2) => name2); eachArray(classes, (cls) => { element.classList[name](cls); }); }); }; }); eachArray(["insertBefore", "insertAfter"], (name, nameIndex) => { $$1.fn[name] = function(target) { const $element = nameIndex ? $$1(this.get().reverse()) : this; const $target = $$1(target); const result = []; $target.each((index, target2) => { if (!target2.parentNode) { return; } $element.each((_2, element) => { const newItem = index ? element.cloneNode(true) : element; const existingItem = nameIndex ? target2.nextSibling : target2; result.push(newItem); target2.parentNode.insertBefore(newItem, existingItem); }); }); return $$1(nameIndex ? result.reverse() : result); }; }); const isPlainText = (target) => { return isString(target) && !(target.startsWith("<") && target.endsWith(">")); }; eachArray(["before", "after"], (name, nameIndex) => { $$1.fn[name] = function(...args) { if (nameIndex === 1) { args = args.reverse(); } return this.each((index, element) => { const targets = isFunction(args[0]) ? [args[0].call(element, index, element.innerHTML)] : args; eachArray(targets, (target) => { let $target; if (isPlainText(target)) { $target = $$1(getChildNodesArray(target, "div")); } else if (index && isElement(target)) { $target = $$1(target.cloneNode(true)); } else { $target = $$1(target); } $target[nameIndex ? "insertAfter" : "insertBefore"](element); }); }); }; }); function each(target, callback) { return isArrayLike(target) ? eachArray(target, (value, index) => { return callback.call(value, index, value); }) : eachObject(target, callback); } function map(elements, callback) { const window2 = getWindow$1(); let value; const ret = []; each(elements, (i3, element) => { value = callback.call(window2, element, i3); if (value != null) { ret.push(value); } }); return [].concat(...ret); } $$1.fn.map = function(callback) { return new JQ(map(this, (element, i3) => { return callback.call(element, i3, element); })); }; $$1.fn.clone = function() { return this.map(function() { return this.cloneNode(true); }); }; $$1.fn.is = function(selector) { let isMatched = false; if (isFunction(selector)) { this.each((index, element) => { if (selector.call(element, index, element)) { isMatched = true; } }); return isMatched; } if (isString(selector)) { this.each((_2, element) => { if (isDocument(element) || isWindow(element)) { return; } if (element.matches.call(element, selector)) { isMatched = true; } }); return isMatched; } const $compareWith = $$1(selector); this.each((_2, element) => { $compareWith.each((_3, compare) => { if (element === compare) { isMatched = true; } }); }); return isMatched; }; $$1.fn.remove = function(selector) { return this.each((_2, element) => { if (!selector || $$1(element).is(selector)) { removeChild(element); } }); }; eachArray(["prepend", "append"], (name, nameIndex) => { $$1.fn[name] = function(...args) { return this.each((index, element) => { const childNodes = element.childNodes; const childLength = childNodes.length; const child = childLength ? childNodes[nameIndex ? childLength - 1 : 0] : createElement("div"); if (!childLength) { appendChild(element, child); } let contents = isFunction(args[0]) ? [args[0].call(element, index, element.innerHTML)] : args; if (index) { contents = contents.map((content) => { return isString(content) ? content : $$1(content).clone(); }); } $$1(child)[nameIndex ? "after" : "before"](...contents); if (!childLength) { removeChild(child); } }); }; }); eachArray(["appendTo", "prependTo"], (name, nameIndex) => { $$1.fn[name] = function(target) { const extraChilds = []; const $target = $$1(target).map((_2, element) => { const childNodes = element.childNodes; const childLength = childNodes.length; if (childLength) { return childNodes[nameIndex ? 0 : childLength - 1]; } const child = createElement("div"); appendChild(element, child); extraChilds.push(child); return child; }); const $result = this[nameIndex ? "insertBefore" : "insertAfter"]($target); $$1(extraChilds).remove(); return $result; }; }); const getComputedStyleValue = (element, name) => { const window2 = getWindow$1(); return window2.getComputedStyle(element).getPropertyValue(toKebabCase(name)); }; const isBorderBox = (element) => { return getComputedStyleValue(element, "box-sizing") === "border-box"; }; const getExtraWidth = (element, direction, extra) => { const position = direction === "width" ? ["Left", "Right"] : ["Top", "Bottom"]; return [0, 1].reduce((prev, _2, index) => { let prop = extra + position[index]; if (extra === "border") { prop += "Width"; } return prev + parseFloat(getComputedStyleValue(element, prop) || "0"); }, 0); }; const getStyle = (element, name) => { if (name === "width" || name === "height") { const valueNumber = element.getBoundingClientRect()[name]; if (isBorderBox(element)) { return `${valueNumber}px`; } return `${valueNumber - getExtraWidth(element, name, "border") - getExtraWidth(element, name, "padding")}px`; } return getComputedStyleValue(element, name); }; const cssNumber = [ "animation-iteration-count", "column-count", "fill-opacity", "flex-grow", "flex-shrink", "font-weight", "grid-area", "grid-column", "grid-column-end", "grid-column-start", "grid-row", "grid-row-end", "grid-row-start", "line-height", "opacity", "order", "orphans", "widows", "z-index", "zoom" ]; eachArray(["attr", "prop", "css"], (name, nameIndex) => { const set2 = (element, key2, value) => { if (isUndefined(value)) { return; } if (nameIndex === 0) { return setAttribute(element, key2, value); } if (nameIndex === 1) { element[key2] = value; return; } key2 = toKebabCase(key2); const getSuffix = () => key2.startsWith("--") || cssNumber.includes(key2) ? "" : "px"; element.style.setProperty(key2, isNumber(value) ? `${value}${getSuffix()}` : value); }; const get2 = (element, key2) => { if (nameIndex === 0) { return getAttribute(element, key2); } if (nameIndex === 1) { return element[key2]; } return getStyle(element, key2); }; $$1.fn[name] = function(key2, value) { if (isObjectLike(key2)) { eachObject(key2, (k2, v2) => { this[name](k2, v2); }); return this; } if (arguments.length === 1) { const element = this[0]; return isElement(element) ? get2(element, key2) : void 0; } return this.each((i3, element) => { set2(element, key2, isFunction(value) ? value.call(element, i3, get2(element, key2)) : value); }); }; }); $$1.fn.children = function(selector) { const children = []; this.each((_2, element) => { eachArray(element.childNodes, (childNode) => { if (!isElement(childNode)) { return; } if (!selector || $$1(childNode).is(selector)) { children.push(childNode); } }); }); return new JQ(unique(children)); }; $$1.fn.slice = function(...args) { return new JQ([].slice.apply(this, args)); }; $$1.fn.eq = function(index) { const ret = index === -1 ? this.slice(index) : this.slice(index, +index + 1); return new JQ(ret); }; const dir = ($elements, nameIndex, node, selector, filter) => { const ret = []; let target; $elements.each((_2, element) => { target = element[node]; while (target && isElement(target)) { if (nameIndex === 2) { if (selector && $$1(target).is(selector)) { break; } if (!filter || $$1(target).is(filter)) { ret.push(target); } } else if (nameIndex === 0) { if (!selector || $$1(target).is(selector)) { ret.push(target); } break; } else { if (!selector || $$1(target).is(selector)) { ret.push(target); } } target = target[node]; } }); return new JQ(unique(ret)); }; eachArray(["", "s", "sUntil"], (name, nameIndex) => { $$1.fn[`parent${name}`] = function(selector, filter) { const $nodes = !nameIndex ? this : $$1(this.get().reverse()); return dir($nodes, nameIndex, "parentNode", selector, filter); }; }); $$1.fn.closest = function(selector) { if (this.is(selector)) { return this; } const matched = []; this.parents().each((_2, element) => { if ($$1(element).is(selector)) { matched.push(element); return false; } }); return new JQ(matched); }; const weakMap$1 = /* @__PURE__ */ new WeakMap(); const getAll = (element) => { return weakMap$1.get(element) ?? {}; }; const get$2 = (element, keyOriginal) => { const data2 = getAll(element); const key2 = toCamelCase(keyOriginal); return key2 in data2 ? data2[key2] : void 0; }; const setAll = (element, object) => { const data2 = getAll(element); eachObject(object, (keyOriginal, value) => { data2[toCamelCase(keyOriginal)] = value; }); weakMap$1.set(element, data2); }; const set$2 = (element, keyOriginal, value) => { setAll(element, { [keyOriginal]: value }); }; const removeAll = (element) => { weakMap$1.delete(element); }; const removeMultiple = (element, keysOriginal) => { const data2 = getAll(element); eachArray(keysOriginal, (keyOriginal) => { const key2 = toCamelCase(keyOriginal); delete data2[key2]; }); weakMap$1.set(element, data2); }; const rbrace = /^(?:{[\w\W]*\}|\[[\w\W]*\])$/; const stringTransform = (value) => { if (value === "true") { return true; } if (value === "false") { return false; } if (value === "null") { return null; } if (value === +value + "") { return +value; } if (rbrace.test(value)) { return JSON.parse(value); } return value; }; const dataAttr = (element, key2, value) => { if (isUndefined(value) && element.nodeType === 1) { value = element.dataset[key2]; if (isString(value)) { try { value = stringTransform(value); } catch (e2) { } } } return value; }; $$1.fn.data = function(key2, value) { if (isUndefined(key2)) { if (!this.length) { return void 0; } const element = this[0]; const resultData = getAll(element); if (element.nodeType !== 1) { return resultData; } eachObject(element.dataset, (key3) => { resultData[key3] = dataAttr(element, key3, resultData[key3]); }); return resultData; } if (isObjectLike(key2)) { return this.each(function() { setAll(this, key2); }); } if (arguments.length === 2 && isUndefined(value)) { return this; } if (!isUndefined(value)) { return this.each(function() { set$2(this, key2, value); }); } if (!this.length) { return void 0; } return dataAttr(this[0], toCamelCase(key2), get$2(this[0], key2)); }; $$1.fn.empty = function() { return this.each((_2, element) => { element.innerHTML = ""; }); }; $$1.fn.extend = function(obj) { eachObject(obj, (prop, value) => { $$1.fn[prop] = value; }); return this; }; $$1.fn.filter = function(selector) { if (isFunction(selector)) { return this.map((index, element) => { return selector.call(element, index, element) ? element : void 0; }); } if (isString(selector)) { return this.map((_2, element) => { return $$1(element).is(selector) ? element : void 0; }); } const $selector = $$1(selector); return this.map((_2, element) => { return $selector.get().includes(element) ? element : void 0; }); }; $$1.fn.find = function(selector) { const foundElements = []; this.each((_2, element) => { merge(foundElements, $$1(element.querySelectorAll(selector)).get()); }); return new JQ(foundElements); }; $$1.fn.first = function() { return this.eq(0); }; const contains = (container2, contains2) => { return container2 !== contains2 && toElement(container2).contains(contains2); }; $$1.fn.has = function(selector) { const $targets = isString(selector) ? this.find(selector) : $$1(selector); const { length } = $targets; return this.map(function() { for (let i3 = 0; i3 < length; i3 += 1) { if (contains(this, $targets[i3])) { return this; } } return; }); }; $$1.fn.hasClass = function(className2) { return this[0].classList.contains(className2); }; const handleExtraWidth = (element, name, value, funcIndex, includeMargin, multiply) => { const getExtraWidthValue = (extra) => { return getExtraWidth(element, name.toLowerCase(), extra) * multiply; }; if (funcIndex === 2 && includeMargin) { value += getExtraWidthValue("margin"); } if (isBorderBox(element)) { if (funcIndex === 0) { value -= getExtraWidthValue("border"); } if (funcIndex === 1) { value -= getExtraWidthValue("border"); value -= getExtraWidthValue("padding"); } } else { if (funcIndex === 0) { value += getExtraWidthValue("padding"); } if (funcIndex === 2) { value += getExtraWidthValue("border"); value += getExtraWidthValue("padding"); } } return value; }; const get$1 = (element, name, funcIndex, includeMargin) => { const document2 = getDocument(); const clientProp = `client${name}`; const scrollProp = `scroll${name}`; const offsetProp = `offset${name}`; const innerProp = `inner${name}`; if (isWindow(element)) { return funcIndex === 2 ? element[innerProp] : toElement(document2)[clientProp]; } if (isDocument(element)) { const doc = toElement(element); return Math.max( // @ts-ignore element.body[scrollProp], doc[scrollProp], // @ts-ignore element.body[offsetProp], doc[offsetProp], doc[clientProp] ); } const value = parseFloat(getComputedStyleValue(element, name.toLowerCase()) || "0"); return handleExtraWidth(element, name, value, funcIndex, includeMargin, 1); }; const set$1 = (element, elementIndex, name, funcIndex, includeMargin, value) => { let computedValue = isFunction(value) ? value.call(element, elementIndex, get$1(element, name, funcIndex, includeMargin)) : value; if (computedValue == null) { return; } const $element = $$1(element); const dimension = name.toLowerCase(); if (isString(computedValue) && ["auto", "inherit", ""].includes(computedValue)) { $element.css(dimension, computedValue); return; } const suffix = computedValue.toString().replace(/\b[0-9.]*/, ""); const numerical = parseFloat(computedValue); computedValue = handleExtraWidth(element, name, numerical, funcIndex, includeMargin, -1) + (suffix || "px"); $element.css(dimension, computedValue); }; eachArray(["Width", "Height"], (name) => { eachArray([`inner${name}`, name.toLowerCase(), `outer${name}`], (funcName, funcIndex) => { $$1.fn[funcName] = function(margin, value) { const isSet = arguments.length && (funcIndex < 2 || !isBoolean(margin)); const includeMargin = margin === true || value === true; if (!isSet) { return this.length ? get$1(this[0], name, funcIndex, includeMargin) : void 0; } return this.each((index, element) => { return set$1(element, index, name, funcIndex, includeMargin, margin); }); }; }); }); $$1.fn.hide = function() { return this.each((_2, element) => { element.style.display = "none"; }); }; eachArray(["val", "html", "text"], (name, nameIndex) => { const props = ["value", "innerHTML", "textContent"]; const propName = props[nameIndex]; const get2 = ($elements) => { if (nameIndex === 2) { return map($elements, (element) => { return toElement(element)[propName]; }).join(""); } if (!$elements.length) { return void 0; } const firstElement = $elements[0]; const $firstElement = $$1(firstElement); if (nameIndex === 0 && $firstElement.is("select[multiple]")) { return map($firstElement.find("option:checked"), (element) => element.value); } return firstElement[propName]; }; const set2 = (element, value) => { if (isUndefined(value)) { if (nameIndex !== 0) { return; } value = ""; } if (nameIndex === 1 && isElement(value)) { value = value.outerHTML; } element[propName] = value; }; $$1.fn[name] = function(value) { if (!arguments.length) { return get2(this); } return this.each((i3, element) => { const $element = $$1(element); const computedValue = isFunction(value) ? value.call(element, i3, get2($element)) : value; if (nameIndex === 0 && Array.isArray(computedValue)) { if ($element.is("select[multiple]")) { map($element.find("option"), (option) => { return option.selected = computedValue.includes(option.value); }); } else { element.checked = computedValue.includes(element.value); } } else { set2(element, computedValue); } }); }; }); $$1.fn.index = function(selector) { if (!arguments.length) { return this.eq(0).parent().children().get().indexOf(this[0]); } if (isString(selector)) { return $$1(selector).get().indexOf(this[0]); } return this.get().indexOf($$1(selector)[0]); }; $$1.fn.last = function() { return this.eq(-1); }; eachArray(["", "All", "Until"], (name, nameIndex) => { $$1.fn[`next${name}`] = function(selector, filter) { return dir(this, nameIndex, "nextElementSibling", selector, filter); }; }); $$1.fn.not = function(selector) { const $excludes = this.filter(selector); return this.map((_2, element) => { return $excludes.index(element) > -1 ? void 0 : element; }); }; const CustomEvent$1 = getWindow$1().CustomEvent; class MduiCustomEvent extends CustomEvent$1 { constructor(type, options) { super(type, options); this.data = options.data; this.namespace = options.namespace; } } const elementIdMap = /* @__PURE__ */ new WeakMap(); let elementId = 1; const getElementId = (element) => { if (!elementIdMap.has(element)) { elementIdMap.set(element, ++elementId); } return elementIdMap.get(element); }; const handlersMap = /* @__PURE__ */ new Map(); const getHandlers = (element) => { const id2 = getElementId(element); return handlersMap.get(id2) || handlersMap.set(id2, []).get(id2); }; const parse$1 = (type) => { const parts = type.split("."); return { type: parts[0], namespace: parts.slice(1).sort().join(" ") }; }; const matcherFor = (namespace) => { return new RegExp("(?:^| )" + namespace.replace(" ", " .* ?") + "(?: |$)"); }; const getMatchedHandlers = (element, type, func, selector) => { const event = parse$1(type); return getHandlers(element).filter((handler) => { return handler && (!event.type || handler.type === event.type) && (!event.namespace || matcherFor(event.namespace).test(handler.namespace)) && (!func || getElementId(handler.func) === getElementId(func)) && (!selector || handler.selector === selector); }); }; const add = (element, types, func, data2, selector) => { let useCapture = false; if (isObjectLike(data2) && data2.useCapture) { useCapture = true; } types.split(" ").forEach((type) => { if (!type) { return; } const event = parse$1(type); const callFn = (e2, elem) => { const result = func.apply( elem, // @ts-ignore e2.detail === null ? [e2] : [e2].concat(e2.detail) ); if (result === false) { e2.preventDefault(); e2.stopPropagation(); } }; const proxyFn = (e2) => { if (e2.namespace && !matcherFor(e2.namespace).test(event.namespace)) { return; } e2.data = data2; if (selector) { $$1(element).find(selector).get().reverse().forEach((elem) => { if (elem === e2.target || contains(elem, e2.target)) { callFn(e2, elem); } }); } else { callFn(e2, element); } }; const handler = { type: event.type, namespace: event.namespace, func, selector, id: getHandlers(element).length, proxy: proxyFn }; getHandlers(element).push(handler); element.addEventListener(handler.type, proxyFn, useCapture); }); }; const remove = (element, types, func, selector) => { const handlersInElement = getHandlers(element); const removeEvent = (handler) => { delete handlersInElement[handler.id]; element.removeEventListener(handler.type, handler.proxy, false); }; if (!types) { handlersInElement.forEach((handler) => { removeEvent(handler); }); } else { types.split(" ").forEach((type) => { if (type) { getMatchedHandlers(element, type, func, selector).forEach((handler) => { removeEvent(handler); }); } }); } }; $$1.fn.off = function(types, selector, callback) { if (isObjectLike(types)) { eachObject(types, (type, fn) => { this.off(type, selector, fn); }); return this; } if (selector === false || isFunction(selector)) { callback = selector; selector = void 0; } if (callback === false) { callback = returnFalse; } return this.each(function() { remove(this, types, callback, selector); }); }; function extend(target, ...objectN) { eachArray(objectN, (object) => { eachObject(object, (prop, value) => { if (!isUndefined(value)) { target[prop] = value; } }); }); return target; } $$1.fn.offsetParent = function() { const document2 = getDocument(); return this.map(function() { let offsetParent = this.offsetParent; while (offsetParent && $$1(offsetParent).css("position") === "static") { offsetParent = offsetParent.offsetParent; } return offsetParent || document2.documentElement; }); }; const floatStyle = ($element, name) => { return parseFloat($element.css(name)); }; $$1.fn.position = function() { if (!this.length) { return void 0; } const $element = this.eq(0); let currentOffset; let parentOffset = { left: 0, top: 0 }; if ($element.css("position") === "fixed") { currentOffset = $element[0].getBoundingClientRect(); } else { currentOffset = $element.offset(); const $offsetParent = $element.offsetParent(); parentOffset = $offsetParent.offset(); parentOffset.top += floatStyle($offsetParent, "border-top-width"); parentOffset.left += floatStyle($offsetParent, "border-left-width"); } return { top: currentOffset.top - parentOffset.top - floatStyle($element, "margin-top"), left: currentOffset.left - parentOffset.left - floatStyle($element, "margin-left") }; }; const get = (element) => { if (!element.getClientRects().length) { return { top: 0, left: 0 }; } const { top, left } = element.getBoundingClientRect(); const { pageYOffset, pageXOffset } = element.ownerDocument.defaultView; return { top: top + pageYOffset, left: left + pageXOffset }; }; const set = (element, value, index) => { const $element = $$1(element); const position = $element.css("position"); if (position === "static") { $element.css("position", "relative"); } const currentOffset = get(element); const currentTopString = $element.css("top"); const currentLeftString = $element.css("left"); let currentTop; let currentLeft; const calculatePosition = (position === "absolute" || position === "fixed") && (currentTopString + currentLeftString).includes("auto"); if (calculatePosition) { const currentPosition = $element.position(); currentTop = currentPosition.top; currentLeft = currentPosition.left; } else { currentTop = parseFloat(currentTopString); currentLeft = parseFloat(currentLeftString); } const computedValue = isFunction(value) ? value.call(element, index, extend({}, currentOffset)) : value; $element.css({ top: computedValue.top != null ? computedValue.top - currentOffset.top + currentTop : void 0, left: computedValue.left != null ? computedValue.left - currentOffset.left + currentLeft : void 0 }); }; $$1.fn.offset = function(value) { if (!arguments.length) { if (!this.length) { return void 0; } return get(this[0]); } return this.each(function(index) { set(this, value, index); }); }; $$1.fn.on = function(types, selector, data2, callback, one) { if (isObjectLike(types)) { if (!isString(selector)) { data2 = data2 || selector; selector = void 0; } eachObject(types, (type, fn) => { this.on(type, selector, data2, fn, one); }); return this; } if (data2 == null && callback == null) { callback = selector; data2 = selector = void 0; } else if (callback == null) { if (isString(selector)) { callback = data2; data2 = void 0; } else { callback = data2; data2 = selector; selector = void 0; } } if (callback === false) { callback = returnFalse; } else if (!callback) { return this; } if (one) { const _this = this; const origCallback = callback; callback = function(event, ...dataN) { _this.off(event.type, selector, callback); return origCallback.call(this, event, ...dataN); }; } return this.each(function() { add(this, types, callback, data2, selector); }); }; $$1.fn.one = function(types, selector, data2, callback) { return this.on(types, selector, data2, callback, true); }; eachArray(["", "All", "Until"], (name, nameIndex) => { $$1.fn[`prev${name}`] = function(selector, filter) { const $nodes = !nameIndex ? this : $$1(this.get().reverse()); return dir($nodes, nameIndex, "previousElementSibling", selector, filter); }; }); $$1.fn.removeAttr = function(attributeName) { const names = attributeName.split(" ").filter((name) => name); return this.each(function() { eachArray(names, (name) => { removeAttribute(this, name); }); }); }; const removeData = (element, name) => { if (isUndefined(name)) { return removeAll(element); } const keys = isString(name) ? name.split(" ").filter((nameItem) => nameItem) : name; removeMultiple(element, keys); }; $$1.fn.removeData = function(name) { return this.each((_2, element) => { removeData(element, name); }); }; $$1.fn.removeProp = function(name) { return this.each((_2, element) => { try { delete element[name]; } catch (e2) { } }); }; $$1.fn.replaceWith = function(newContent) { this.each((index, element) => { let content = newContent; if (isFunction(content)) { content = content.call(element, index, element.innerHTML); } else if (index && !isString(content)) { content = $$1(content).clone(); } $$1(element).before(content); }); return this.remove(); }; $$1.fn.replaceAll = function(target) { return $$1(target).map((index, element) => { $$1(element).replaceWith(index ? this.clone() : this); return this.get(); }); }; const param = (obj) => { if (!isObjectLike(obj) && !Array.isArray(obj)) { return ""; } const args = []; const destructure = (key2, value) => { let keyTmp; if (isObjectLike(value)) { eachObject(value, (i3, v2) => { keyTmp = Array.isArray(value) && !isObjectLike(v2) ? "" : i3; destructure(`${key2}[${keyTmp}]`, v2); }); } else { keyTmp = value == null || value === "" ? "=" : `=${encodeURIComponent(value)}`; args.push(encodeURIComponent(key2) + keyTmp); } }; if (Array.isArray(obj)) { eachArray(obj, ({ name, value }) => { return destructure(name, value); }); } else { eachObject(obj, destructure); } return args.join("&"); }; const formCollections = /* @__PURE__ */ new WeakMap(); const getFormControls = (form) => { const nativeFormControls = [...form.elements]; const formControls = formCollections.get(form) || []; const comparePosition = (a2, b3) => { const position = a2.compareDocumentPosition(b3); return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1; }; return [...nativeFormControls, ...formControls].sort(comparePosition); }; const getFormControlsValue = ($elements) => { const result = []; $elements.each((_2, element) => { const elements = element instanceof HTMLFormElement ? getFormControls(element) : [element]; $$1(elements).each((_3, element2) => { const $element = $$1(element2); const type = element2.type; const nodeName = element2.nodeName.toLowerCase(); if (nodeName !== "fieldset" && element2.name && !element2.disabled && [ "input", "select", "textarea", "keygen", "mdui-checkbox", "mdui-radio-group", "mdui-switch", "mdui-text-field", "mdui-select", "mdui-slider", "mdui-range-slider", "mdui-segmented-button-group" ].includes(nodeName) && !["submit", "button", "image", "reset", "file"].includes(type) && (!["radio", "checkbox"].includes(type) || element2.checked) && (!["mdui-checkbox", "mdui-switch"].includes(nodeName) || element2.checked)) { result.push({ name: element2.name, value: $element.val() }); } }); }); return result; }; $$1.fn.serializeArray = function() { return getFormControlsValue(this).map((element) => { if (!Array.isArray(element.value)) { return element; } return element.value.map((value) => ({ name: element.name, value })); }).flat(); }; $$1.fn.serialize = function() { return param(this.serializeArray()); }; $$1.fn.serializeObject = function() { const result = {}; getFormControlsValue(this).forEach((element) => { const { name, value } = element; if (!result.hasOwnProperty(name)) { result[name] = value; } else { const originalValue = result[name]; if (!Array.isArray(originalValue)) { result[name] = [originalValue]; } if (Array.isArray(value)) { result[name].push(...value); } else { result[name].push(value); } } }); return result; }; const elementDisplay = {}; const defaultDisplay = (nodeName) => { const document2 = getDocument(); let element; let display; if (!elementDisplay[nodeName]) { element = createElement(nodeName); appendChild(document2.body, element); display = getStyle(element, "display"); removeChild(element); if (display === "none") { display = "block"; } elementDisplay[nodeName] = display; } return elementDisplay[nodeName]; }; $$1.fn.show = function() { return this.each((_2, element) => { if (element.style.display === "none") { element.style.display = ""; } if (getStyle(element, "display") === "none") { element.style.display = defaultDisplay(element.nodeName); } }); }; $$1.fn.siblings = function(selector) { return this.prevAll(selector).add(this.nextAll(selector)); }; $$1.fn.toggle = function() { return this.each((_2, element) => { getStyle(element, "display") === "none" ? $$1(element).show() : $$1(element).hide(); }); }; $$1.fn.trigger = function(name, detail = null, options) { const { type, namespace } = parse$1(name); const event = new MduiCustomEvent(type, { detail, data: null, namespace, bubbles: true, cancelable: false, composed: true, ...options }); return this.each((_2, element) => { element.dispatchEvent(event); }); }; const ajaxStart = "ajaxStart"; const ajaxSuccess = "ajaxSuccess"; const ajaxError = "ajaxError"; const ajaxComplete = "ajaxComplete"; const globalOptions = {}; const isQueryStringData = (method) => { return ["GET", "HEAD"].includes(method); }; const appendQuery = (url, query) => { return `${url}&${query}`.replace(/[&?]{1,2}/, "?"); }; const isCrossDomain = (url) => { const window2 = getWindow$1(); return /^([\w-]+:)?\/\/([^/]+)/.test(url) && RegExp.$2 !== window2.location.host; }; const isHttpStatusSuccess = (status) => { return status >= 200 && status < 300 || [0, 304].includes(status); }; const mergeOptions = (options) => { const defaults = { url: "", method: "GET", data: "", processData: true, async: true, cache: true, username: "", password: "", headers: {}, xhrFields: {}, statusCode: {}, dataType: "", contentType: "application/x-www-form-urlencoded", timeout: 0, global: true }; eachObject(globalOptions, (key2, value) => { const callbacks = [ "beforeSend", "success", "error", "complete", "statusCode" ]; if (!callbacks.includes(key2) && !isUndefined(value)) { defaults[key2] = value; } }); return extend({}, defaults, options); }; const ajax = (options) => { const document2 = getDocument(); const window2 = getWindow$1(); let isCanceled = false; const eventParams = {}; const successEventParams = {}; const mergedOptions = mergeOptions(options); const method = mergedOptions.method.toUpperCase(); let { data: data2, url } = mergedOptions; url = url || window2.location.toString(); const { processData, async, cache, username, password, headers, xhrFields, statusCode, dataType, contentType, timeout, global: global2 } = mergedOptions; const isMethodQueryString = isQueryStringData(method); if (data2 && (isMethodQueryString || processData) && !isString(data2) && !(data2 instanceof ArrayBuffer) && !(data2 instanceof Blob) && !(data2 instanceof Document) && !(data2 instanceof FormData)) { data2 = param(data2); } if (data2 && isMethodQueryString) { url = appendQuery(url, data2); data2 = null; } const trigger = (event, callback, ...args) => { if (global2) { $$1(document2).trigger(event, callback === "success" ? successEventParams : eventParams); } let resultGlobal; let resultCustom; if (callback in globalOptions) { resultGlobal = globalOptions[callback](...args); } if (mergedOptions[callback]) { resultCustom = mergedOptions[callback](...args); } if (callback === "beforeSend" && [resultGlobal, resultCustom].includes(false)) { isCanceled = true; } }; const XHR = () => { let textStatus; return new Promise((resolve, reject) => { const doReject = (reason) => { return reject(new Error(reason)); }; if (isMethodQueryString && !cache) { url = appendQuery(url, `_=${Date.now()}`); } const xhr = new XMLHttpRequest(); xhr.open(method, url, async, username, password); if (contentType || data2 && !isMethodQueryString && contentType !== false) { xhr.setRequestHeader("Content-Type", contentType); } if (dataType === "json") { xhr.setRequestHeader("Accept", "application/json, text/javascript"); } eachObject(headers, (key2, value) => { if (!isUndefined(value)) { xhr.setRequestHeader(key2, value + ""); } }); if (!isCrossDomain(url)) { xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); } eachObject(xhrFields, (key2, value) => { xhr[key2] = value; }); eventParams.xhr = successEventParams.xhr = xhr; eventParams.options = successEventParams.options = mergedOptions; let xhrTimeout; xhr.onload = () => { if (xhrTimeout) { clearTimeout(xhrTimeout); } const isSuccess = isHttpStatusSuccess(xhr.status); let responseData = void 0; if (isSuccess) { textStatus = xhr.status === 204 || method === "HEAD" ? "nocontent" : xhr.status === 304 ? "notmodified" : "success"; if (dataType === "json" || !dataType && (xhr.getResponseHeader("content-type") || "").includes("json")) { try { responseData = method === "HEAD" ? void 0 : JSON.parse(xhr.responseText); successEventParams.response = responseData; } catch (err) { textStatus = "parsererror"; trigger(ajaxError, "error", xhr, textStatus); doReject(textStatus); } if (textStatus !== "parsererror") { trigger(ajaxSuccess, "success", responseData, textStatus, xhr); resolve(responseData); } } else { responseData = method === "HEAD" ? void 0 : xhr.responseType === "text" || xhr.responseType === "" ? xhr.responseText : xhr.response; successEventParams.response = responseData; trigger(ajaxSuccess, "success", responseData, textStatus, xhr); resolve(responseData); } } else { textStatus = "error"; trigger(ajaxError, "error", xhr, textStatus); doReject(textStatus); } eachArray([globalOptions.statusCode ?? {}, statusCode], (func) => { if (func[xhr.status]) { if (isSuccess) { func[xhr.status](responseData, textStatus, xhr); } else { func[xhr.status](xhr, textStatus); } } }); trigger(ajaxComplete, "complete", xhr, textStatus); }; xhr.onerror = () => { if (xhrTimeout) { clearTimeout(xhrTimeout); } trigger(ajaxError, "error", xhr, xhr.statusText); trigger(ajaxComplete, "complete", xhr, "error"); doReject(xhr.statusText); }; xhr.onabort = () => { let statusText = "abort"; if (xhrTimeout) { statusText = "timeout"; clearTimeout(xhrTimeout); } trigger(ajaxError, "error", xhr, statusText); trigger(ajaxComplete, "complete", xhr, statusText); doReject(statusText); }; trigger(ajaxStart, "beforeSend", xhr, mergedOptions); if (isCanceled) { return doReject("cancel"); } if (timeout > 0) { xhrTimeout = window2.setTimeout(() => xhr.abort(), timeout); } xhr.send(data2); }); }; return XHR(); }; $$1.ajax = ajax; const ajaxSetup = (options) => { return extend(globalOptions, options); }; $$1.ajaxSetup = ajaxSetup; $$1.contains = contains; function data(element, key2, value) { if (isObjectLike(key2)) { setAll(element, key2); return key2; } if (!isUndefined(value)) { set$2(element, key2, value); return value; } if (isUndefined(key2)) { return getAll(element); } return get$2(element, key2); } $$1.data = data; $$1.each = each; $$1.extend = function(target, ...objectN) { if (!objectN.length) { eachObject(target, (prop, value) => { this[prop] = value; }); return this; } return extend(target, ...objectN); }; $$1.map = map; $$1.merge = merge; $$1.param = param; $$1.removeData = removeData; $$1.unique = unique; function __decorate(decorators, target, key2, desc) { var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d2; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key2, desc); else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d2 = decorators[i3]) r2 = (c2 < 3 ? d2(r2) : c2 > 3 ? d2(target, key2, r2) : d2(target, key2)) || r2; return c2 > 3 && r2 && Object.defineProperty(target, key2, r2), r2; } typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { var e2 = new Error(message); return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2; }; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$2 = globalThis, e$3 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s = Symbol(), o$4 = /* @__PURE__ */ new WeakMap(); let n$4 = class n { constructor(t2, e2, o2) { if (this._$cssResult$ = true, o2 !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = t2, this.t = e2; } get styleSheet() { let t2 = this.o; const s2 = this.t; if (e$3 && void 0 === t2) { const e2 = void 0 !== s2 && 1 === s2.length; e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2)); } return t2; } toString() { return this.cssText; } }; const r$4 = (t2) => new n$4("string" == typeof t2 ? t2 : t2 + "", void 0, s), i$3 = (t2, ...e2) => { const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => { if (true === t3._$cssResult$) return t3.cssText; if ("number" == typeof t3) return t3; throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); })(s2) + t2[o3 + 1], t2[0]); return new n$4(o2, t2, s); }, S$1 = (s2, o2) => { if (e$3) s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet); else for (const e2 of o2) { const o3 = document.createElement("style"), n3 = t$2.litNonce; void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3); } }, c$3 = e$3 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => { let e2 = ""; for (const s2 of t3.cssRules) e2 += s2.cssText; return r$4(e2); })(t2) : t2; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: i$2, defineProperty: e$2, getOwnPropertyDescriptor: r$3, getOwnPropertyNames: h$2, getOwnPropertySymbols: o$3, getPrototypeOf: n$3 } = Object, a$1 = globalThis, c$2 = a$1.trustedTypes, l = c$2 ? c$2.emptyScript : "", p = a$1.reactiveElementPolyfillSupport, d = (t2, s2) => t2, u = { toAttribute(t2, s2) { switch (s2) { case Boolean: t2 = t2 ? l : null; break; case Object: case Array: t2 = null == t2 ? t2 : JSON.stringify(t2); } return t2; }, fromAttribute(t2, s2) { let i3 = t2; switch (s2) { case Boolean: i3 = null !== t2; break; case Number: i3 = null === t2 ? null : Number(t2); break; case Object: case Array: try { i3 = JSON.parse(t2); } catch (t3) { i3 = null; } } return i3; } }, f$2 = (t2, s2) => !i$2(t2, s2), y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f$2 }; Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); let b$1 = class b extends HTMLElement { static addInitializer(t2) { this._$Ei(), (this.l ?? (this.l = [])).push(t2); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(t2, s2 = y) { if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t2, s2), !s2.noAccessor) { const i3 = Symbol(), r2 = this.getPropertyDescriptor(t2, i3, s2); void 0 !== r2 && e$2(this.prototype, t2, r2); } } static getPropertyDescriptor(t2, s2, i3) { const { get: e2, set: h2 } = r$3(this.prototype, t2) ?? { get() { return this[s2]; }, set(t3) { this[s2] = t3; } }; return { get() { return e2 == null ? void 0 : e2.call(this); }, set(s3) { const r2 = e2 == null ? void 0 : e2.call(this); h2.call(this, s3), this.requestUpdate(t2, r2, i3); }, configurable: true, enumerable: true }; } static getPropertyOptions(t2) { return this.elementProperties.get(t2) ?? y; } static _$Ei() { if (this.hasOwnProperty(d("elementProperties"))) return; const t2 = n$3(this); t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties); } static finalize() { if (this.hasOwnProperty(d("finalized"))) return; if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) { const t3 = this.properties, s2 = [...h$2(t3), ...o$3(t3)]; for (const i3 of s2) this.createProperty(i3, t3[i3]); } const t2 = this[Symbol.metadata]; if (null !== t2) { const s2 = litPropertyMetadata.get(t2); if (void 0 !== s2) for (const [t3, i3] of s2) this.elementProperties.set(t3, i3); } this._$Eh = /* @__PURE__ */ new Map(); for (const [t3, s2] of this.elementProperties) { const i3 = this._$Eu(t3, s2); void 0 !== i3 && this._$Eh.set(i3, t3); } this.elementStyles = this.finalizeStyles(this.styles); } static finalizeStyles(s2) { const i3 = []; if (Array.isArray(s2)) { const e2 = new Set(s2.flat(1 / 0).reverse()); for (const s3 of e2) i3.unshift(c$3(s3)); } else void 0 !== s2 && i3.push(c$3(s2)); return i3; } static _$Eu(t2, s2) { const i3 = s2.attribute; return false === i3 ? void 0 : "string" == typeof i3 ? i3 : "string" == typeof t2 ? t2.toLowerCase() : void 0; } constructor() { super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev(); } _$Ev() { var _a2; this._$ES = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (_a2 = this.constructor.l) == null ? void 0 : _a2.forEach((t2) => t2(this)); } addController(t2) { var _a2; (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2)); } removeController(t2) { var _a2; (_a2 = this._$EO) == null ? void 0 : _a2.delete(t2); } _$E_() { const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties; for (const i3 of s2.keys()) this.hasOwnProperty(i3) && (t2.set(i3, this[i3]), delete this[i3]); t2.size > 0 && (this._$Ep = t2); } createRenderRoot() { const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); return S$1(t2, this.constructor.elementStyles), t2; } connectedCallback() { var _a2; this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t2) => { var _a3; return (_a3 = t2.hostConnected) == null ? void 0 : _a3.call(t2); }); } enableUpdating(t2) { } disconnectedCallback() { var _a2; (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t2) => { var _a3; return (_a3 = t2.hostDisconnected) == null ? void 0 : _a3.call(t2); }); } attributeChangedCallback(t2, s2, i3) { this._$AK(t2, i3); } _$EC(t2, s2) { var _a2; const i3 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i3); if (void 0 !== e2 && true === i3.reflect) { const r2 = (void 0 !== ((_a2 = i3.converter) == null ? void 0 : _a2.toAttribute) ? i3.converter : u).toAttribute(s2, i3.type); this._$Em = t2, null == r2 ? this.removeAttribute(e2) : this.setAttribute(e2, r2), this._$Em = null; } } _$AK(t2, s2) { var _a2; const i3 = this.constructor, e2 = i3._$Eh.get(t2); if (void 0 !== e2 && this._$Em !== e2) { const t3 = i3.getPropertyOptions(e2), r2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a2 = t3.converter) == null ? void 0 : _a2.fromAttribute) ? t3.converter : u; this._$Em = e2, this[e2] = r2.fromAttribute(s2, t3.type), this._$Em = null; } } requestUpdate(t2, s2, i3) { if (void 0 !== t2) { if (i3 ?? (i3 = this.constructor.getPropertyOptions(t2)), !(i3.hasChanged ?? f$2)(this[t2], s2)) return; this.P(t2, s2, i3); } false === this.isUpdatePending && (this._$ES = this._$ET()); } P(t2, s2, i3) { this._$AL.has(t2) || this._$AL.set(t2, s2), true === i3.reflect && this._$Em !== t2 && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t2); } async _$ET() { this.isUpdatePending = true; try { await this._$ES; } catch (t3) { Promise.reject(t3); } const t2 = this.scheduleUpdate(); return null != t2 && await t2, !this.isUpdatePending; } scheduleUpdate() { return this.performUpdate(); } performUpdate() { var _a2; if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { for (const [t4, s3] of this._$Ep) this[t4] = s3; this._$Ep = void 0; } const t3 = this.constructor.elementProperties; if (t3.size > 0) for (const [s3, i3] of t3) true !== i3.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.P(s3, this[s3], i3); } let t2 = false; const s2 = this._$AL; try { t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t3) => { var _a3; return (_a3 = t3.hostUpdate) == null ? void 0 : _a3.call(t3); }), this.update(s2)) : this._$EU(); } catch (s3) { throw t2 = false, this._$EU(), s3; } t2 && this._$AE(s2); } willUpdate(t2) { } _$AE(t2) { var _a2; (_a2 = this._$EO) == null ? void 0 : _a2.forEach((t3) => { var _a3; return (_a3 = t3.hostUpdated) == null ? void 0 : _a3.call(t3); }), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2); } _$EU() { this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false; } get updateComplete() { return this.getUpdateComplete(); } getUpdateComplete() { return this._$ES; } shouldUpdate(t2) { return true; } update(t2) { this._$Ej && (this._$Ej = this._$Ej.forEach((t3) => this._$EC(t3, this[t3]))), this._$EU(); } updated(t2) { } firstUpdated(t2) { } }; b$1.elementStyles = [], b$1.shadowRootOptions = { mode: "open" }, b$1[d("elementProperties")] = /* @__PURE__ */ new Map(), b$1[d("finalized")] = /* @__PURE__ */ new Map(), p == null ? void 0 : p({ ReactiveElement: b$1 }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.0.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const n$2 = globalThis, c$1 = n$2.trustedTypes, h$1 = c$1 ? c$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, f$1 = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, m = "?" + v, _ = `<${m}>`, w$1 = document, lt = () => w$1.createComment(""), st$1 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, g$1 = Array.isArray, $ = (t2) => g$1(t2) || "function" == typeof (t2 == null ? void 0 : t2[Symbol.iterator]), x$1 = "[ \n\f\r]", T = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, E = /-->/g, k = />/g, O = RegExp(`>|${x$1}(?:([^\\s"'>=/]+)(${x$1}*=${x$1}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), S = /'/g, j$1 = /"/g, M = /^(?:script|style|textarea|title)$/i, P = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), ke = P(1), R = Symbol.for("lit-noChange"), D = Symbol.for("lit-nothing"), V = /* @__PURE__ */ new WeakMap(), I = w$1.createTreeWalker(w$1, 129); function N$1(t2, i3) { if (!g$1(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array"); return void 0 !== h$1 ? h$1.createHTML(i3) : i3; } const U = (t2, i3) => { const s2 = t2.length - 1, e2 = []; let h2, o2 = 2 === i3 ? "" : 3 === i3 ? "" : "", n3 = T; for (let i4 = 0; i4 < s2; i4++) { const s3 = t2[i4]; let r2, l2, c2 = -1, a2 = 0; for (; a2 < s3.length && (n3.lastIndex = a2, l2 = n3.exec(s3), null !== l2); ) a2 = n3.lastIndex, n3 === T ? "!--" === l2[1] ? n3 = E : void 0 !== l2[1] ? n3 = k : void 0 !== l2[2] ? (M.test(l2[2]) && (h2 = RegExp("" === l2[0] ? (n3 = h2 ?? T, c2 = -1) : void 0 === l2[1] ? c2 = -2 : (c2 = n3.lastIndex - l2[2].length, r2 = l2[1], n3 = void 0 === l2[3] ? O : '"' === l2[3] ? j$1 : S) : n3 === j$1 || n3 === S ? n3 = O : n3 === E || n3 === k ? n3 = T : (n3 = O, h2 = void 0); const u2 = n3 === O && t2[i4 + 1].startsWith("/>") ? " " : ""; o2 += n3 === T ? s3 + _ : c2 >= 0 ? (e2.push(r2), s3.slice(0, c2) + f$1 + s3.slice(c2) + v + u2) : s3 + v + (-2 === c2 ? i4 : u2); } return [N$1(t2, o2 + (t2[s2] || "") + (2 === i3 ? "" : 3 === i3 ? "" : "")), e2]; }; class B { constructor({ strings: t2, _$litType$: i3 }, s2) { let e2; this.parts = []; let h2 = 0, o2 = 0; const n3 = t2.length - 1, r2 = this.parts, [l2, a2] = U(t2, i3); if (this.el = B.createElement(l2, s2), I.currentNode = this.el.content, 2 === i3 || 3 === i3) { const t3 = this.el.content.firstChild; t3.replaceWith(...t3.childNodes); } for (; null !== (e2 = I.nextNode()) && r2.length < n3; ) { if (1 === e2.nodeType) { if (e2.hasAttributes()) for (const t3 of e2.getAttributeNames()) if (t3.endsWith(f$1)) { const i4 = a2[o2++], s3 = e2.getAttribute(t3).split(v), n4 = /([.?@])?(.*)/.exec(i4); r2.push({ type: 1, index: h2, name: n4[2], strings: s3, ctor: "." === n4[1] ? Y : "?" === n4[1] ? Z : "@" === n4[1] ? q : G }), e2.removeAttribute(t3); } else t3.startsWith(v) && (r2.push({ type: 6, index: h2 }), e2.removeAttribute(t3)); if (M.test(e2.tagName)) { const t3 = e2.textContent.split(v), i4 = t3.length - 1; if (i4 > 0) { e2.textContent = c$1 ? c$1.emptyScript : ""; for (let s3 = 0; s3 < i4; s3++) e2.append(t3[s3], lt()), I.nextNode(), r2.push({ type: 2, index: ++h2 }); e2.append(t3[i4], lt()); } } } else if (8 === e2.nodeType) if (e2.data === m) r2.push({ type: 2, index: h2 }); else { let t3 = -1; for (; -1 !== (t3 = e2.data.indexOf(v, t3 + 1)); ) r2.push({ type: 7, index: h2 }), t3 += v.length - 1; } h2++; } } static createElement(t2, i3) { const s2 = w$1.createElement("template"); return s2.innerHTML = t2, s2; } } function z(t2, i3, s2 = t2, e2) { var _a2, _b; if (i3 === R) return i3; let h2 = void 0 !== e2 ? (_a2 = s2.o) == null ? void 0 : _a2[e2] : s2.l; const o2 = st$1(i3) ? void 0 : i3._$litDirective$; return (h2 == null ? void 0 : h2.constructor) !== o2 && ((_b = h2 == null ? void 0 : h2._$AO) == null ? void 0 : _b.call(h2, false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2.o ?? (s2.o = []))[e2] = h2 : s2.l = h2), void 0 !== h2 && (i3 = z(t2, h2._$AS(t2, i3.values), h2, e2)), i3; } let F$1 = class F { constructor(t2, i3) { this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3; } get parentNode() { return this._$AM.parentNode; } get _$AU() { return this._$AM._$AU; } u(t2) { const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? w$1).importNode(i3, true); I.currentNode = e2; let h2 = I.nextNode(), o2 = 0, n3 = 0, r2 = s2[0]; for (; void 0 !== r2; ) { if (o2 === r2.index) { let i4; 2 === r2.type ? i4 = new et(h2, h2.nextSibling, this, t2) : 1 === r2.type ? i4 = new r2.ctor(h2, r2.name, r2.strings, this, t2) : 6 === r2.type && (i4 = new K(h2, this, t2)), this._$AV.push(i4), r2 = s2[++n3]; } o2 !== (r2 == null ? void 0 : r2.index) && (h2 = I.nextNode(), o2++); } return I.currentNode = w$1, e2; } p(t2) { let i3 = 0; for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++; } }; class et { get _$AU() { var _a2; return ((_a2 = this._$AM) == null ? void 0 : _a2._$AU) ?? this.v; } constructor(t2, i3, s2, e2) { this.type = 2, this._$AH = D, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this.v = (e2 == null ? void 0 : e2.isConnected) ?? true; } get parentNode() { let t2 = this._$AA.parentNode; const i3 = this._$AM; return void 0 !== i3 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i3.parentNode), t2; } get startNode() { return this._$AA; } get endNode() { return this._$AB; } _$AI(t2, i3 = this) { t2 = z(this, t2, i3), st$1(t2) ? t2 === D || null == t2 || "" === t2 ? (this._$AH !== D && this._$AR(), this._$AH = D) : t2 !== this._$AH && t2 !== R && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : $(t2) ? this.k(t2) : this._(t2); } O(t2) { return this._$AA.parentNode.insertBefore(t2, this._$AB); } T(t2) { this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2)); } _(t2) { this._$AH !== D && st$1(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(w$1.createTextNode(t2)), this._$AH = t2; } $(t2) { var _a2; const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = B.createElement(N$1(s2.h, s2.h[0]), this.options)), s2); if (((_a2 = this._$AH) == null ? void 0 : _a2._$AD) === e2) this._$AH.p(i3); else { const t3 = new F$1(e2, this), s3 = t3.u(this.options); t3.p(i3), this.T(s3), this._$AH = t3; } } _$AC(t2) { let i3 = V.get(t2.strings); return void 0 === i3 && V.set(t2.strings, i3 = new B(t2)), i3; } k(t2) { g$1(this._$AH) || (this._$AH = [], this._$AR()); const i3 = this._$AH; let s2, e2 = 0; for (const h2 of t2) e2 === i3.length ? i3.push(s2 = new et(this.O(lt()), this.O(lt()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++; e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2); } _$AR(t2 = this._$AA.nextSibling, i3) { var _a2; for ((_a2 = this._$AP) == null ? void 0 : _a2.call(this, false, true, i3); t2 && t2 !== this._$AB; ) { const i4 = t2.nextSibling; t2.remove(), t2 = i4; } } setConnected(t2) { var _a2; void 0 === this._$AM && (this.v = t2, (_a2 = this._$AP) == null ? void 0 : _a2.call(this, t2)); } } class G { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(t2, i3, s2, e2, h2) { this.type = 1, this._$AH = D, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = D; } _$AI(t2, i3 = this, s2, e2) { const h2 = this.strings; let o2 = false; if (void 0 === h2) t2 = z(this, t2, i3, 0), o2 = !st$1(t2) || t2 !== this._$AH && t2 !== R, o2 && (this._$AH = t2); else { const e3 = t2; let n3, r2; for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r2 = z(this, e3[s2 + n3], i3, n3), r2 === R && (r2 = this._$AH[n3]), o2 || (o2 = !st$1(r2) || r2 !== this._$AH[n3]), r2 === D ? t2 = D : t2 !== D && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2; } o2 && !e2 && this.j(t2); } j(t2) { t2 === D ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? ""); } } class Y extends G { constructor() { super(...arguments), this.type = 3; } j(t2) { this.element[this.name] = t2 === D ? void 0 : t2; } } class Z extends G { constructor() { super(...arguments), this.type = 4; } j(t2) { this.element.toggleAttribute(this.name, !!t2 && t2 !== D); } } class q extends G { constructor(t2, i3, s2, e2, h2) { super(t2, i3, s2, e2, h2), this.type = 5; } _$AI(t2, i3 = this) { if ((t2 = z(this, t2, i3, 0) ?? D) === R) return; const s2 = this._$AH, e2 = t2 === D && s2 !== D || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== D && (s2 === D || e2); e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2; } handleEvent(t2) { var _a2; "function" == typeof this._$AH ? this._$AH.call(((_a2 = this.options) == null ? void 0 : _a2.host) ?? this.element, t2) : this._$AH.handleEvent(t2); } } class K { constructor(t2, i3, s2) { this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2; } get _$AU() { return this._$AM._$AU; } _$AI(t2) { z(this, t2); } } const Re = n$2.litHtmlPolyfillSupport; Re == null ? void 0 : Re(B, et), (n$2.litHtmlVersions ?? (n$2.litHtmlVersions = [])).push("3.2.0"); const Q = (t2, i3, s2) => { const e2 = (s2 == null ? void 0 : s2.renderBefore) ?? i3; let h2 = e2._$litPart$; if (void 0 === h2) { const t3 = (s2 == null ? void 0 : s2.renderBefore) ?? null; e2._$litPart$ = h2 = new et(i3.insertBefore(lt(), t3), t3, void 0, s2 ?? {}); } return h2._$AI(t2), h2; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class h extends b$1 { constructor() { super(...arguments), this.renderOptions = { host: this }, this.o = void 0; } createRenderRoot() { var _a2; const t2 = super.createRenderRoot(); return (_a2 = this.renderOptions).renderBefore ?? (_a2.renderBefore = t2.firstChild), t2; } update(t2) { const e2 = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this.o = Q(e2, this.renderRoot, this.renderOptions); } connectedCallback() { var _a2; super.connectedCallback(), (_a2 = this.o) == null ? void 0 : _a2.setConnected(true); } disconnectedCallback() { var _a2; super.disconnectedCallback(), (_a2 = this.o) == null ? void 0 : _a2.setConnected(false); } render() { return R; } } h._$litElement$ = true, h["finalized"] = true, (_a = globalThis.litElementHydrateSupport) == null ? void 0 : _a.call(globalThis, { LitElement: h }); const f = globalThis.litElementPolyfillSupport; f == null ? void 0 : f({ LitElement: h }); (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$1 = (t2) => (e2, o2) => { void 0 !== o2 ? o2.addInitializer(() => { customElements.define(t2, e2); }) : customElements.define(t2, e2); }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const o$2 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f$2 }, r$2 = (t2 = o$2, e2, r2) => { const { kind: n3, metadata: i3 } = r2; let s2 = globalThis.litPropertyMetadata.get(i3); if (void 0 === s2 && globalThis.litPropertyMetadata.set(i3, s2 = /* @__PURE__ */ new Map()), s2.set(r2.name, t2), "accessor" === n3) { const { name: o2 } = r2; return { set(r3) { const n4 = e2.get.call(this); e2.set.call(this, r3), this.requestUpdate(o2, n4, t2); }, init(e3) { return void 0 !== e3 && this.P(o2, void 0, t2), e3; } }; } if ("setter" === n3) { const { name: o2 } = r2; return function(r3) { const n4 = this[o2]; e2.call(this, r3), this.requestUpdate(o2, n4, t2); }; } throw Error("Unsupported decorator location: " + n3); }; function n$1(t2) { return (e2, o2) => "object" == typeof o2 ? r$2(t2, e2, o2) : ((t3, e3, o3) => { const r2 = e3.hasOwnProperty(o3); return e3.constructor.createProperty(o3, r2 ? { ...t3, wrapped: true } : t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0; })(t2, e2, o2); } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function r$1(r2) { return n$1({ ...r2, state: true, attribute: false }); } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const e$1 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2); /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function o$1(o2) { return (e2, n3) => { const { slot: r2, selector: s2 } = o2 ?? {}, c2 = "slot" + (r2 ? `[name=${r2}]` : ":not([name])"); return e$1(e2, n3, { get() { var _a2; const t2 = (_a2 = this.renderRoot) == null ? void 0 : _a2.querySelector(c2), e3 = (t2 == null ? void 0 : t2.assignedElements(o2)) ?? []; return void 0 === s2 ? e3 : e3.filter((t3) => t3.matches(s2)); } }); }; } /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const to = (t2) => t2 ?? D; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 }); let i$1 = class i { constructor(t2) { } get _$AU() { return this._$AM._$AU; } _$AT(t2, e2, i3) { this.t = t2, this._$AM = e2, this.i = i3; } _$AS(t2, e2) { return this.update(t2, e2); } update(t2, e2) { return this.render(...e2); } }; /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const ee = "important", ie = " !" + ee, se = e(class extends i$1 { constructor(e2) { var _a2; if (super(e2), e2.type !== t.ATTRIBUTE || "style" !== e2.name || ((_a2 = e2.strings) == null ? void 0 : _a2.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute."); } render(t2) { return Object.keys(t2).reduce((e2, r2) => { const s2 = t2[r2]; return null == s2 ? e2 : e2 + `${r2 = r2.includes("-") ? r2 : r2.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s2};`; }, ""); } update(t2, [e2]) { const { style: r2 } = t2.element; if (void 0 === this.ft) return this.ft = new Set(Object.keys(e2)), this.render(e2); for (const t3 of this.ft) null == e2[t3] && (this.ft.delete(t3), t3.includes("-") ? r2.removeProperty(t3) : r2[t3] = null); for (const t3 in e2) { const s2 = e2[t3]; if (null != s2) { this.ft.add(t3); const e3 = "string" == typeof s2 && s2.endsWith(ie); t3.includes("-") || e3 ? r2.setProperty(t3, e3 ? s2.slice(0, -11) : s2, e3 ? ee : "") : r2[t3] = s2; } } return R; } }); class MduiElement extends h { /** * 触发自定义事件。若返回 false,表示事件被取消 * @param type * @param options 通常只用到 cancelable 和 detail;bubbles、composed 统一不用 */ emit(type, options) { const event = new CustomEvent(type, Object.assign({ bubbles: true, cancelable: false, composed: true, detail: {} }, options)); return this.dispatchEvent(event); } } class HasSlotController { constructor(host, ...slotNames) { this.slotNames = []; (this.host = host).addController(this); this.slotNames = slotNames; this.onSlotChange = this.onSlotChange.bind(this); } hostConnected() { this.host.shadowRoot.addEventListener("slotchange", this.onSlotChange); if (!isDomReady()) { $$1(() => { this.host.requestUpdate(); }); } } hostDisconnected() { this.host.shadowRoot.removeEventListener("slotchange", this.onSlotChange); } test(slotName) { return slotName === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(slotName); } hasDefaultSlot() { return [...this.host.childNodes].some((node) => { if (node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "") { return true; } if (node.nodeType === node.ELEMENT_NODE) { const el = node; if (!el.hasAttribute("slot")) { return true; } } return false; }); } hasNamedSlot(name) { return this.host.querySelector(`:scope > [slot="${name}"]`) !== null; } onSlotChange(event) { const slot = event.target; if (this.slotNames.includes("[default]") && !slot.name || slot.name && this.slotNames.includes(slot.name)) { this.host.requestUpdate(); } } } const nothingTemplate = ke`${D}`; const componentStyle = i$3`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}:host :focus,:host :focus-visible,:host(:focus),:host(:focus-visible){outline:0}[hidden]{display:none!important}`; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class le extends i$1 { constructor(i3) { if (super(i3), this.it = D, i3.type !== t.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings"); } render(t2) { if (t2 === D || null == t2) return this._t = void 0, this.it = t2; if (t2 === R) return t2; if ("string" != typeof t2) throw Error(this.constructor.directiveName + "() called with a non-string value"); if (t2 === this.it) return this._t; this.it = t2; const i3 = [t2]; return i3.raw = i3, this._t = { _$litType$: this.constructor.resultType, strings: i3, values: [] }; } } le.directiveName = "unsafeHTML", le.resultType = 1; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class pe extends le { } pe.directiveName = "unsafeSVG", pe.resultType = 2; const fe = e(pe); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const st = (o2) => null === o2 || "object" != typeof o2 && "function" != typeof o2, rt = (o2) => void 0 === o2.strings, ht = {}, dt = (o2, t2 = ht) => o2._$AH = t2; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const mt = (i3, t2) => { var _a2; const e2 = i3._$AN; if (void 0 === e2) return false; for (const i4 of e2) (_a2 = i4._$AO) == null ? void 0 : _a2.call(i4, t2, false), mt(i4, t2); return true; }, _t = (i3) => { let t2, e2; do { if (void 0 === (t2 = i3._$AM)) break; e2 = t2._$AN, e2.delete(i3), i3 = t2; } while (0 === (e2 == null ? void 0 : e2.size)); }, wt = (i3) => { for (let t2; t2 = i3._$AM; i3 = t2) { let e2 = t2._$AN; if (void 0 === e2) t2._$AN = e2 = /* @__PURE__ */ new Set(); else if (e2.has(i3)) break; e2.add(i3), gt(t2); } }; function bt(i3) { void 0 !== this._$AN ? (_t(this), this._$AM = i3, wt(this)) : this._$AM = i3; } function yt(i3, t2 = false, e2 = 0) { const s2 = this._$AH, o2 = this._$AN; if (void 0 !== o2 && 0 !== o2.size) if (t2) if (Array.isArray(s2)) for (let i4 = e2; i4 < s2.length; i4++) mt(s2[i4], false), _t(s2[i4]); else null != s2 && (mt(s2, false), _t(s2)); else mt(this, i3); } const gt = (i3) => { i3.type == t.CHILD && (i3._$AP ?? (i3._$AP = yt), i3._$AQ ?? (i3._$AQ = bt)); }; class $t extends i$1 { constructor() { super(...arguments), this._$AN = void 0; } _$AT(i3, t2, e2) { super._$AT(i3, t2, e2), wt(this), this.isConnected = i3._$AU; } _$AO(i3, t2 = true) { var _a2, _b; i3 !== this.isConnected && (this.isConnected = i3, i3 ? (_a2 = this.reconnected) == null ? void 0 : _a2.call(this) : (_b = this.disconnected) == null ? void 0 : _b.call(this)), t2 && (mt(this, i3), _t(this)); } setValue(i3) { if (rt(this.t)) this.t._$AI(i3, this); else { const t2 = [...this.t._$AH]; t2[this.i] = i3, this.t._$AI(t2, this, 0); } } disconnected() { } reconnected() { } } /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class Tt { constructor(t2) { this.Y = t2; } disconnect() { this.Y = void 0; } reconnect(t2) { this.Y = t2; } deref() { return this.Y; } } class Et { constructor() { this.Z = void 0, this.q = void 0; } get() { return this.Z; } pause() { this.Z ?? (this.Z = new Promise((t2) => this.q = t2)); } resume() { var _a2; (_a2 = this.q) == null ? void 0 : _a2.call(this), this.Z = this.q = void 0; } } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const me = (t2) => !st(t2) && "function" == typeof t2.then, _e = 1073741823; class we extends $t { constructor() { super(...arguments), this.wt = _e, this.bt = [], this.K = new Tt(this), this.X = new Et(); } render(...t2) { return t2.find((t3) => !me(t3)) ?? R; } update(t2, s2) { const i3 = this.bt; let e2 = i3.length; this.bt = s2; const r2 = this.K, o2 = this.X; this.isConnected || this.disconnected(); for (let t3 = 0; t3 < s2.length && !(t3 > this.wt); t3++) { const n3 = s2[t3]; if (!me(n3)) return this.wt = t3, n3; t3 < e2 && n3 === i3[t3] || (this.wt = _e, e2 = 0, Promise.resolve(n3).then(async (t4) => { for (; o2.get(); ) await o2.get(); const s3 = r2.deref(); if (void 0 !== s3) { const i4 = s3.bt.indexOf(n3); i4 > -1 && i4 < s3.wt && (s3.wt = i4, s3.setValue(t4)); } })); } return R; } disconnected() { this.K.disconnect(), this.X.pause(); } reconnected() { this.K.reconnect(this), this.X.resume(); } } const be = e(we); const style$n = i$3`:host{display:inline-block;width:1em;height:1em;font-weight:400;font-family:'Material Icons';font-display:block;font-style:normal;line-height:1;direction:ltr;letter-spacing:normal;white-space:nowrap;text-transform:none;word-wrap:normal;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;-moz-osx-font-smoothing:grayscale;font-size:1.5rem}::slotted(svg),svg{width:100%;height:100%;fill:currentcolor}`; let Icon = class Icon2 extends MduiElement { constructor() { super(...arguments); this.hasSlotController = new HasSlotController(this, "[default]"); } render() { const renderDefault = () => { if (this.name) { const [name, variant] = this.name.split("--"); const familyMap = /* @__PURE__ */ new Map([ ["outlined", "Material Icons Outlined"], ["filled", "Material Icons"], ["rounded", "Material Icons Round"], ["sharp", "Material Icons Sharp"], ["two-tone", "Material Icons Two Tone"] ]); return ke`${name}`; } if (this.src) { return ke`${be(ajax({ url: this.src }).then(fe))}`; } return ke``; }; return this.hasSlotController.test("[default]") ? ke`` : renderDefault(); } }; Icon.styles = [componentStyle, style$n]; __decorate([ n$1({ reflect: true }) ], Icon.prototype, "name", void 0); __decorate([ n$1({ reflect: true }) ], Icon.prototype, "src", void 0); Icon = __decorate([ t$1("mdui-icon") ], Icon); const style$m = i$3`:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;white-space:nowrap;vertical-align:middle;border-radius:var(--shape-corner);-webkit-user-select:none;user-select:none;width:2.5rem;height:2.5rem;background-color:rgb(var(--mdui-color-primary-container));color:rgb(var(--mdui-color-on-primary-container));font-size:var(--mdui-typescale-title-medium-size);font-weight:var(--mdui-typescale-title-medium-weight);letter-spacing:var(--mdui-typescale-title-medium-tracking);line-height:var(--mdui-typescale-title-medium-line-height)}img{width:100%;height:100%}::slotted(mdui-icon),mdui-icon{font-size:1.5em}`; let Avatar = class Avatar2 extends MduiElement { constructor() { super(...arguments); this.hasSlotController = new HasSlotController(this, "[default]"); } render() { return this.hasSlotController.test("[default]") ? ke`` : this.src ? ke`${to(this.label)}` : this.icon ? ke`` : nothingTemplate; } }; Avatar.styles = [componentStyle, style$m]; __decorate([ n$1({ reflect: true }) ], Avatar.prototype, "src", void 0); __decorate([ n$1({ reflect: true }) ], Avatar.prototype, "fit", void 0); __decorate([ n$1({ reflect: true }) ], Avatar.prototype, "icon", void 0); __decorate([ n$1({ reflect: true }) ], Avatar.prototype, "label", void 0); Avatar = __decorate([ t$1("mdui-avatar") ], Avatar); const style$l = i$3`:host{--shape-corner:var(--mdui-shape-corner-full);display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:var(--shape-corner);padding-left:.25rem;padding-right:.25rem;color:rgb(var(--mdui-color-on-error));background-color:rgb(var(--mdui-color-error));height:1rem;min-width:1rem;font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height)}:host([variant=small]){min-width:0;padding:0;width:.375rem;height:.375rem}`; let Badge = class Badge2 extends MduiElement { constructor() { super(...arguments); this.variant = "large"; } render() { if (this.variant === "small") { return nothingTemplate; } return ke``; } }; Badge.styles = [componentStyle, style$l]; __decorate([ n$1({ reflect: true }) ], Badge.prototype, "variant", void 0); Badge = __decorate([ t$1("mdui-badge") ], Badge); const booleanConverter = (value) => { return value !== null && value !== "false"; }; class DefinedController { constructor(host, options) { this.defined = false; (this.host = host).addController(this); this.relatedElements = options.relatedElements; this.needDomReady = options.needDomReady || !!options.relatedElements; this.onSlotChange = this.onSlotChange.bind(this); } hostConnected() { this.host.shadowRoot.addEventListener("slotchange", this.onSlotChange); } hostDisconnected() { this.host.shadowRoot.removeEventListener("slotchange", this.onSlotChange); } /** * 判断组件是否定义完成 */ isDefined() { if (this.defined) { return true; } this.defined = (!this.needDomReady || isDomReady()) && !this.getUndefinedLocalNames().length; return this.defined; } /** * 在组件定义完成后,promise 被 resolve */ async whenDefined() { if (this.defined) { return Promise.resolve(); } const document2 = getDocument(); if (this.needDomReady && !isDomReady(document2)) { await new Promise((resolve) => { document2.addEventListener("DOMContentLoaded", () => resolve(), { once: true }); }); } const undefinedLocalNames = this.getUndefinedLocalNames(); if (undefinedLocalNames.length) { const promises = []; undefinedLocalNames.forEach((localName) => { promises.push(customElements.whenDefined(localName)); }); await Promise.all(promises); } this.defined = true; return; } /** * slot 中的未完成定义的相关 Web components 组件的 CSS 选择器 */ getScopeLocalNameSelector() { const localNames = this.relatedElements; if (!localNames) { return null; } if (Array.isArray(localNames)) { return localNames.map((localName) => `${localName}:not(:defined)`).join(","); } return Object.keys(localNames).filter((localName) => !localNames[localName]).map((localName) => `${localName}:not(:defined)`).join(","); } /** * 整个页面中的未完成定义的相关 Web components 组件的 CSS 选择器 */ getGlobalLocalNameSelector() { const localNames = this.relatedElements; if (!localNames || Array.isArray(localNames)) { return null; } return Object.keys(localNames).filter((localName) => localNames[localName]).map((localName) => `${localName}:not(:defined)`).join(","); } /** * 获取未完成定义的相关 Web components 组件名 */ getUndefinedLocalNames() { const scopeSelector = this.getScopeLocalNameSelector(); const globalSelector = this.getGlobalLocalNameSelector(); const undefinedScopeElements = scopeSelector ? [...this.host.querySelectorAll(scopeSelector)] : []; const undefinedGlobalElements = globalSelector ? [...getDocument().querySelectorAll(globalSelector)] : []; const localNames = [ ...undefinedScopeElements, ...undefinedGlobalElements ].map((element) => element.localName); return unique(localNames); } /** * slot 变更时,若 slot 中包含未完成定义的相关 Web components 组件,则组件未定义完成 */ onSlotChange() { const selector = this.getScopeLocalNameSelector(); if (selector) { const undefinedElements = this.host.querySelectorAll(selector); if (undefinedElements.length) { this.defined = false; } } } } function watch(propName, waitUntilFirstUpdate = false) { return (proto, functionName) => { const { update } = proto; if (propName in proto) { proto.update = function(changedProperties) { if (changedProperties.has(propName)) { const oldValue = changedProperties.get(propName); const newValue = this[propName]; if (oldValue !== newValue) { if (!waitUntilFirstUpdate || this.hasUpdated) { this[functionName](oldValue, newValue); } } } update.call(this, changedProperties); }; } }; } const ScrollBehaviorMixin = (superclass) => { class ScrollBehaviorMixinClass extends superclass { // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(...args) { super(...args); this.scrollBehaviorDefinedController = new DefinedController(this, { needDomReady: true }); this.lastScrollTopThreshold = 0; this.lastScrollTopNoThreshold = 0; this.isParentLayout = false; this.onListeningScroll = this.onListeningScroll.bind(this); } /** * 滚动时,如果需要给 container 添加 padding,添加在顶部还是底部 */ get scrollPaddingPosition() { throw new Error("Must implement scrollPaddingPosition getter"); } async onScrollTargetChange(oldValue, newValue) { await this.scrollBehaviorDefinedController.whenDefined(); if (oldValue && !newValue || !oldValue && newValue) { this.updateContainerPadding(); } if (!this.scrollBehavior) { return; } const oldListening = this.getListening(oldValue); if (oldListening) { oldListening.removeEventListener("scroll", this.onListeningScroll); } const newListening = this.getListening(newValue); if (newListening) { this.updateScrollTop(newListening); newListening.addEventListener("scroll", this.onListeningScroll); } } async onScrollBehaviorChange(oldValue, newValue) { await this.scrollBehaviorDefinedController.whenDefined(); if (oldValue && !newValue || !oldValue && newValue) { this.updateContainerPadding(); } const listening = this.getListening(this.scrollTarget); if (!listening) { return; } if (this.scrollBehavior) { this.updateScrollTop(listening); listening.addEventListener("scroll", this.onListeningScroll); } else { listening.removeEventListener("scroll", this.onListeningScroll); } } connectedCallback() { super.connectedCallback(); this.scrollBehaviorDefinedController.whenDefined().then(() => { this.isParentLayout = isNodeName(this.parentElement, "mdui-layout"); this.updateContainerPadding(); }); } disconnectedCallback() { super.disconnectedCallback(); this.scrollBehaviorDefinedController.whenDefined().then(() => { this.updateContainerPadding(false); }); } /** * scrollBehavior 包含多个滚动行为,用空格分割 * 用该方法判断指定滚动行为是否在 scrollBehavior 中 * @param behavior 为数组时,只要其中一个行为在 scrollBehavior 中,即返回 `true` */ hasScrollBehavior(behavior) { var _a2; const behaviors = ((_a2 = this.scrollBehavior) == null ? void 0 : _a2.split(" ")) ?? []; if (Array.isArray(behavior)) { return !!behaviors.filter((v2) => behavior.includes(v2)).length; } else { return behaviors.includes(behavior); } } /** * 执行滚动事件,在滚动距离超过 scrollThreshold 时才会执行 * Note: 父类可以按需实现该方法 * @param isScrollingUp 是否向上滚动 * @param scrollTop 距离 scrollTarget 顶部的距离 */ // eslint-disable-next-line @typescript-eslint/no-unused-vars runScrollThreshold(isScrollingUp, scrollTop) { return; } /** * 执行滚动事件,会无视 scrollThreshold,始终会执行 * @param isScrollingUp 是否向上滚动 * @param scrollTop 距离 scrollTarget 顶部的距离 */ // eslint-disable-next-line @typescript-eslint/no-unused-vars runScrollNoThreshold(isScrollingUp, scrollTop) { return; } /** * 更新滚动容器的 padding,避免内容被 navigation-bar 覆盖 * 仅 scrollBehavior 包含 hide、shrink 时,添加 padding * @param withPadding 该值为 false 时,为移除 padding */ updateContainerPadding(withPadding = true) { const container2 = this.getContainer(this.scrollTarget); if (!container2 || this.isParentLayout) { return; } const propName = this.scrollPaddingPosition === "top" ? "paddingTop" : "paddingBottom"; if (withPadding) { const propValue = this.getListening(this.scrollTarget) && ["fixed", "absolute"].includes($$1(this).css("position")) ? this.offsetHeight : null; $$1(container2).css({ [propName]: propValue }); } else { $$1(container2).css({ [propName]: null }); } } onListeningScroll() { const listening = this.getListening(this.scrollTarget); window.requestAnimationFrame(() => this.onScroll(listening)); } /** * 滚动事件,这里过滤掉不符合条件的滚动 */ onScroll(listening) { const scrollTop = listening.scrollY ?? listening.scrollTop; if (this.lastScrollTopNoThreshold !== scrollTop) { this.runScrollNoThreshold(scrollTop < this.lastScrollTopNoThreshold, scrollTop); this.lastScrollTopNoThreshold = scrollTop; } if (Math.abs(scrollTop - this.lastScrollTopThreshold) > (this.scrollThreshold || 0)) { this.runScrollThreshold(scrollTop < this.lastScrollTopThreshold, scrollTop); this.lastScrollTopThreshold = scrollTop; } } /** * 重新更新 lastScrollTopThreshold、lastScrollTopNoThreshold 的值 * 用于在 scrollTarget、scrollBehavior 变更时,重新设置 lastScrollTopThreshold、lastScrollTopNoThreshold 的初始值 */ updateScrollTop(listening) { this.lastScrollTopThreshold = this.lastScrollTopNoThreshold = listening.scrollY ?? listening.scrollTop; } /** * 获取组件需要监听哪个元素的滚动状态 */ getListening(target) { return target ? $$1(target)[0] : window; } /** * 获取组件在哪个容器内滚动 */ getContainer(target) { return target ? $$1(target)[0] : document.body; } } __decorate([ n$1({ attribute: "scroll-target" }) ], ScrollBehaviorMixinClass.prototype, "scrollTarget", void 0); __decorate([ n$1({ reflect: true, attribute: "scroll-behavior" }) ], ScrollBehaviorMixinClass.prototype, "scrollBehavior", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "scroll-threshold" }) ], ScrollBehaviorMixinClass.prototype, "scrollThreshold", void 0); __decorate([ watch("scrollTarget") ], ScrollBehaviorMixinClass.prototype, "onScrollTargetChange", null); __decorate([ watch("scrollBehavior") ], ScrollBehaviorMixinClass.prototype, "onScrollBehaviorChange", null); return ScrollBehaviorMixinClass; }; let id = 0; const uniqueId = () => { return ++id; }; let weakMap; let observer; const observeResize = (target, callback) => { const $target = $$1(target); const key2 = uniqueId(); const result = { unobserve: () => { $target.each((_2, target2) => { const options = weakMap.get(target2); const index = options.coArr.findIndex((co) => co.key === key2); if (index !== -1) { options.coArr.splice(index, 1); } if (!options.coArr.length) { observer.unobserve(target2); weakMap.delete(target2); } else { weakMap.set(target2, options); } }); } }; if (!weakMap) { weakMap = /* @__PURE__ */ new WeakMap(); observer = new ResizeObserver((entries) => { entries.forEach((entry) => { const target2 = entry.target; const options = weakMap.get(target2); options.entry = entry; options.coArr.forEach((co) => { co.callback.call(result, entry, result); }); }); }); } $target.each((_2, target2) => { const options = weakMap.get(target2) ?? { coArr: [] }; if (options.coArr.length && options.entry) { callback.call(result, options.entry, result); } options.coArr.push({ callback, key: key2 }); weakMap.set(target2, options); observer.observe(target2); }); return result; }; class LayoutManager { constructor() { this.states = []; } /** * 注册 `` */ registerMain(element) { this.$main = $$1(element); } /** * 取消注册 `` */ unregisterMain() { this.$main = void 0; } /** * 注册新的 `` */ registerItem(element) { const state = { element }; this.states.push(state); state.observeResize = observeResize(state.element, () => { this.updateLayout(state.element, { width: this.isNoWidth(state) ? 0 : void 0 }); }); this.items = void 0; this.resort(); this.updateLayout(); } /** * 取消注册 `` */ unregisterItem(element) { var _a2; const index = this.states.findIndex((item2) => item2.element === element); if (index < 0) { return; } const item = this.states[index]; (_a2 = item.observeResize) == null ? void 0 : _a2.unobserve(); this.items = void 0; this.states.splice(index, 1); if (this.states[index]) { this.updateLayout(this.states[index].element); } } /** * 获取所有 `` 元素(按在 DOM 中的顺序) */ getItems() { if (!this.items) { const items = this.states.map((state) => state.element); this.items = items.sort((a2, b3) => { const position = a2.compareDocumentPosition(b3); if (position & Node.DOCUMENT_POSITION_FOLLOWING) { return -1; } else if (position & Node.DOCUMENT_POSITION_PRECEDING) { return 1; } else { return 0; } }); } return this.items; } /** * 获取 `` 元素 */ getMain() { return this.$main ? this.$main[0] : void 0; } /** * 获取 `` 及 `` 元素 */ getItemsAndMain() { return [...this.getItems(), this.getMain()].filter((i3) => i3); } /** * 更新 `order` 值,更新完后重新计算布局 */ updateOrder() { this.resort(); this.updateLayout(); } /** * 重新计算布局 * @param element 从哪一个元素开始更新;若未传入参数,则将更新所有元素 * @param size 此次更新中,元素的宽高(仅在此次更新中使用)。若不传则自动计算 */ updateLayout(element, size) { const state = element ? { element, width: size == null ? void 0 : size.width, height: size == null ? void 0 : size.height } : void 0; const index = state ? this.states.findIndex((v2) => v2.element === state.element) : 0; if (index < 0) { return; } Object.assign(this.states[index], state); this.states.forEach((currState, currIndex) => { if (currIndex < index) { return; } const placement = currState.element.layoutPlacement; const prevState = currIndex > 0 ? this.states[currIndex - 1] : void 0; const top = (prevState == null ? void 0 : prevState.top) ?? 0; const right = (prevState == null ? void 0 : prevState.right) ?? 0; const bottom = (prevState == null ? void 0 : prevState.bottom) ?? 0; const left = (prevState == null ? void 0 : prevState.left) ?? 0; Object.assign(currState, { top, right, bottom, left }); switch (placement) { case "top": case "bottom": currState[placement] += currState.height ?? currState.element.offsetHeight; break; case "right": case "left": currState[placement] += (this.isNoWidth(currState) ? 0 : currState.width) ?? currState.element.offsetWidth; break; } currState.height = currState.width = void 0; $$1(currState.element).css({ position: "absolute", top: placement === "bottom" ? null : top, right: placement === "left" ? null : right, bottom: placement === "top" ? null : bottom, left: placement === "right" ? null : left }); }); const lastState = this.states[this.states.length - 1]; if (this.$main) { this.$main.css({ paddingTop: lastState.top, paddingRight: lastState.right, paddingBottom: lastState.bottom, paddingLeft: lastState.left }); } } /** * 按 order 排序,order 相同时,按在 DOM 中的顺序排序 */ resort() { const items = this.getItems(); this.states.sort((a2, b3) => { const aOrder = a2.element.order ?? 0; const bOrder = b3.element.order ?? 0; if (aOrder > bOrder) { return 1; } if (aOrder < bOrder) { return -1; } if (items.indexOf(a2.element) > items.indexOf(b3.element)) { return 1; } if (items.indexOf(a2.element) < items.indexOf(b3.element)) { return -1; } return 0; }); } /** * 组件宽度是否为 0 * mdui-navigation-drawer 较为特殊,在为模态化时,占据的宽度为 0 */ isNoWidth(state) { return isNodeName(state.element, "mdui-navigation-drawer") && // @ts-ignore state.element.isModal; } } const layoutManagerMap = /* @__PURE__ */ new WeakMap(); const getLayout = (element) => { if (!layoutManagerMap.has(element)) { layoutManagerMap.set(element, new LayoutManager()); } return layoutManagerMap.get(element); }; class LayoutItemBase extends MduiElement { constructor() { super(...arguments); this.isParentLayout = false; } /** * 当前布局组件所处的位置,父类必须实现该 getter */ get layoutPlacement() { throw new Error("Must implement placement getter!"); } // order 变更时,需要重新调整布局 onOrderChange() { var _a2; (_a2 = this.layoutManager) == null ? void 0 : _a2.updateOrder(); } connectedCallback() { super.connectedCallback(); const parentElement = this.parentElement; this.isParentLayout = isNodeName(parentElement, "mdui-layout"); if (this.isParentLayout) { this.layoutManager = getLayout(parentElement); this.layoutManager.registerItem(this); } } disconnectedCallback() { super.disconnectedCallback(); if (this.layoutManager) { this.layoutManager.unregisterItem(this); } } } __decorate([ n$1({ type: Number, reflect: true }) ], LayoutItemBase.prototype, "order", void 0); __decorate([ watch("order", true) ], LayoutItemBase.prototype, "onOrderChange", null); const style$k = i$3`:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;right:0;bottom:0;left:0;display:flex;flex:0 0 auto;align-items:center;justify-content:flex-start;border-radius:var(--shape-corner) var(--shape-corner) 0 0;z-index:var(--z-index);transition:bottom var(--mdui-motion-duration-long2) var(--mdui-motion-easing-emphasized);padding:0 1rem;height:5rem;background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2)}:host([scroll-target]:not([scroll-target=''])){position:absolute}:host([hide]){transition-duration:var(--mdui-motion-duration-short4);bottom:-5.625rem}::slotted(:not(:first-child)){margin-left:.5rem}::slotted(mdui-fab){box-shadow:var(--mdui-elevation-level0)}:host([fab-detach]) ::slotted(mdui-fab){position:absolute;transition:bottom var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard);right:1rem;bottom:.75rem}:host([fab-detach][hide][scroll-behavior~=hide]) ::slotted(mdui-fab){transition-duration:var(--mdui-motion-duration-short4);bottom:1rem;box-shadow:var(--mdui-elevation-level2)}:host([fab-detach][hide][scroll-behavior~=hide][scroll-target]:not([scroll-target=''])) ::slotted(mdui-fab){bottom:6.625rem}:host([hide]) ::slotted(:not(mdui-fab)),:host([hide]:not([fab-detach])) ::slotted(mdui-fab){transform:translateY(8.75rem);transition:transform var(--mdui-motion-duration-0) var(--mdui-motion-easing-emphasized-accelerate) var(--mdui-motion-duration-short4)}::slotted(:first-child){transition:transform var(--mdui-motion-duration-short3) var(--mdui-motion-easing-emphasized-decelerate) var(--mdui-motion-duration-short1)}::slotted(:nth-child(2)){transition:transform var(--mdui-motion-duration-short3) var(--mdui-motion-easing-emphasized-decelerate) var(--mdui-motion-duration-short3)}::slotted(:nth-child(3)){transition:transform var(--mdui-motion-duration-short3) var(--mdui-motion-easing-emphasized-decelerate) var(--mdui-motion-duration-short4)}::slotted(:nth-child(4)){transition:transform var(--mdui-motion-duration-short3) var(--mdui-motion-easing-emphasized-decelerate) var(--mdui-motion-duration-medium1)}::slotted(:nth-child(5)){transition:transform var(--mdui-motion-duration-short3) var(--mdui-motion-easing-emphasized-decelerate) var(--mdui-motion-duration-medium2)}::slotted(:nth-child(6)){transition:transform var(--mdui-motion-duration-short3) var(--mdui-motion-easing-emphasized-decelerate) var(--mdui-motion-duration-medium3)}`; let BottomAppBar = class BottomAppBar2 extends ScrollBehaviorMixin(LayoutItemBase) { constructor() { super(...arguments); this.hide = false; this.fabDetach = false; } get scrollPaddingPosition() { return "bottom"; } get layoutPlacement() { return "bottom"; } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); this.addEventListener("transitionend", (event) => { if (event.target === this) { this.emit(this.hide ? "hidden" : "shown"); } }); } render() { return ke``; } /** * 滚动行为 * 当前仅支持 hide 这一个行为,所以不做行为类型判断 */ runScrollThreshold(isScrollingUp) { if (!isScrollingUp && !this.hide) { const eventProceeded = this.emit("hide", { cancelable: true }); if (eventProceeded) { this.hide = true; } } if (isScrollingUp && this.hide) { const eventProceeded = this.emit("show", { cancelable: true }); if (eventProceeded) { this.hide = false; } } } }; BottomAppBar.styles = [componentStyle, style$k]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], BottomAppBar.prototype, "hide", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "fab-detach" }) ], BottomAppBar.prototype, "fabDetach", void 0); __decorate([ n$1({ reflect: true, attribute: "scroll-behavior" }) ], BottomAppBar.prototype, "scrollBehavior", void 0); BottomAppBar = __decorate([ t$1("mdui-bottom-app-bar") ], BottomAppBar); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const ii = () => new Zt(); class Zt { } const qt = /* @__PURE__ */ new WeakMap(), Kt = e(class extends $t { render(t2) { return D; } update(t2, [i3]) { var _a2; const s2 = i3 !== this.Y; return s2 && void 0 !== this.Y && this.rt(void 0), (s2 || this.lt !== this.ct) && (this.Y = i3, this.ht = (_a2 = t2.options) == null ? void 0 : _a2.host, this.rt(this.ct = t2.element)), D; } rt(t2) { if (this.isConnected || (t2 = void 0), "function" == typeof this.Y) { const i3 = this.ht ?? globalThis; let s2 = qt.get(i3); void 0 === s2 && (s2 = /* @__PURE__ */ new WeakMap(), qt.set(i3, s2)), void 0 !== s2.get(this.Y) && this.Y.call(this.ht, void 0), s2.set(this.Y, t2), void 0 !== t2 && this.Y.call(this.ht, t2); } else this.Y.value = t2; } get lt() { var _a2, _b; return "function" == typeof this.Y ? (_a2 = qt.get(this.ht ?? globalThis)) == null ? void 0 : _a2.get(this.Y) : (_b = this.Y) == null ? void 0 : _b.value; } disconnected() { this.lt === this.ct && this.rt(void 0); } reconnected() { this.rt(this.ct); } }); function cc(names) { if (typeof names === "string" || typeof names === "number") return "" + names; let out = ""; if (Array.isArray(names)) { for (let i3 = 0, tmp; i3 < names.length; i3++) { if ((tmp = cc(names[i3])) !== "") { out += (out && " ") + tmp; } } } else { for (let k2 in names) { if (names[k2]) out += (out && " ") + k2; } } return out; } const reportValidityOverloads = /* @__PURE__ */ new WeakMap(); const formResets = /* @__PURE__ */ new WeakMap(); class FormController { constructor(host, options) { (this.host = host).addController(this); this.definedController = new DefinedController(host, { needDomReady: true }); this.options = { form: (control) => { const formId = $$1(control).attr("form"); if (formId) { const root2 = control.getRootNode(); return root2.getElementById(formId); } return control.closest("form"); }, name: (control) => control.name, value: (control) => control.value, defaultValue: (control) => control.defaultValue, setValue: (control, value) => control.value = value, disabled: (control) => control.disabled, reportValidity: (control) => isFunction(control.reportValidity) ? control.reportValidity() : true, ...options }; this.onFormData = this.onFormData.bind(this); this.onFormSubmit = this.onFormSubmit.bind(this); this.onFormReset = this.onFormReset.bind(this); this.reportFormValidity = this.reportFormValidity.bind(this); } hostConnected() { this.definedController.whenDefined().then(() => { this.form = this.options.form(this.host); if (this.form) { this.attachForm(this.form); } }); } hostDisconnected() { this.detachForm(); } hostUpdated() { this.definedController.whenDefined().then(() => { const form = this.options.form(this.host); if (!form) { this.detachForm(); } if (form && this.form !== form) { this.detachForm(); this.attachForm(form); } }); } /** * 获取当前表单控件关联的 `
` 元素 */ getForm() { return this.form ?? null; } /** * 重置整个表单,所有表单控件恢复成默认值 */ reset(invoker) { this.doAction("reset", invoker); } /** * 提交整个表单 */ submit(invoker) { this.doAction("submit", invoker); } attachForm(form) { if (!form) { this.form = void 0; return; } this.form = form; if (formCollections.has(this.form)) { formCollections.get(this.form).add(this.host); } else { formCollections.set(this.form, /* @__PURE__ */ new Set([this.host])); } this.form.addEventListener("formdata", this.onFormData); this.form.addEventListener("submit", this.onFormSubmit); this.form.addEventListener("reset", this.onFormReset); if (!reportValidityOverloads.has(this.form)) { reportValidityOverloads.set(this.form, this.form.reportValidity); this.form.reportValidity = () => this.reportFormValidity(); } } detachForm() { if (this.form) { formCollections.get(this.form).delete(this.host); this.form.removeEventListener("formdata", this.onFormData); this.form.removeEventListener("submit", this.onFormSubmit); this.form.removeEventListener("reset", this.onFormReset); if (reportValidityOverloads.has(this.form) && !formCollections.get(this.form).size) { this.form.reportValidity = reportValidityOverloads.get(this.form); reportValidityOverloads.delete(this.form); } } } doAction(type, invoker) { if (!this.form) { return; } const $button = $$1(``; } isButton() { return !this.href; } } ButtonBase.styles = [ componentStyle, buttonBaseStyle ]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ButtonBase.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ButtonBase.prototype, "loading", void 0); __decorate([ n$1({ reflect: true }) ], ButtonBase.prototype, "name", void 0); __decorate([ n$1({ reflect: true }) ], ButtonBase.prototype, "value", void 0); __decorate([ n$1({ reflect: true }) ], ButtonBase.prototype, "type", void 0); __decorate([ n$1({ reflect: true }) ], ButtonBase.prototype, "form", void 0); __decorate([ n$1({ reflect: true, attribute: "formaction" }) ], ButtonBase.prototype, "formAction", void 0); __decorate([ n$1({ reflect: true, attribute: "formenctype" }) ], ButtonBase.prototype, "formEnctype", void 0); __decorate([ n$1({ reflect: true, attribute: "formmethod" }) ], ButtonBase.prototype, "formMethod", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "formnovalidate" }) ], ButtonBase.prototype, "formNoValidate", void 0); __decorate([ n$1({ reflect: true, attribute: "formtarget" }) ], ButtonBase.prototype, "formTarget", void 0); const style$h = i$3`:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;text-align:center;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);min-width:3rem;height:2.5rem;color:rgb(var(--mdui-color-primary));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.button{width:100%;padding:0 1rem}:host([full-width]){display:block}:host([variant=elevated]){box-shadow:var(--mdui-elevation-level1);background-color:rgb(var(--mdui-color-surface-container-low));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=filled]){color:rgb(var(--mdui-color-on-primary));background-color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-primary)}:host([variant=tonal]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-secondary-container )}:host([variant=outlined]){border:.0625rem solid rgb(var(--mdui-color-outline));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=text]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=outlined][focus-visible]){border-color:rgb(var(--mdui-color-primary))}:host([variant=elevated][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=filled][hover]),:host([variant=tonal][hover]){box-shadow:var(--mdui-elevation-level1)}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){color:rgba(var(--mdui-color-on-surface),38%);box-shadow:var(--mdui-elevation-level0)}:host([variant=elevated][disabled]),:host([variant=filled][disabled]),:host([variant=tonal][disabled]){background-color:rgba(var(--mdui-color-on-surface),12%)}:host([variant=outlined][disabled]){border-color:rgba(var(--mdui-color-on-surface),12%)}.label{display:inline-flex;padding-right:.5rem;padding-left:.5rem}.end-icon,.icon{display:inline-flex;font-size:1.28571429em}.end-icon mdui-icon,.icon mdui-icon,::slotted([slot=end-icon]),::slotted([slot=icon]){font-size:inherit}mdui-circular-progress{display:inline-flex;width:1.125rem;height:1.125rem}:host([variant=filled]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-primary))}:host([variant=tonal]) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-secondary-container))}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`; let Button = class Button2 extends ButtonBase { constructor() { super(...arguments); this.variant = "filled"; this.fullWidth = false; this.rippleRef = ii(); } get rippleElement() { return this.rippleRef.value; } render() { return ke`${this.isButton() ? this.renderButton({ className: "button", part: "button", content: this.renderInner() }) : this.disabled || this.loading ? ke`${this.renderInner()}` : this.renderAnchor({ className: "button", part: "button", content: this.renderInner() })}`; } renderIcon() { if (this.loading) { return this.renderLoading(); } return ke`${this.icon ? ke`` : nothingTemplate}`; } renderLabel() { return ke``; } renderEndIcon() { return ke`${this.endIcon ? ke`` : nothingTemplate}`; } renderInner() { return [this.renderIcon(), this.renderLabel(), this.renderEndIcon()]; } }; Button.styles = [ButtonBase.styles, style$h]; __decorate([ n$1({ reflect: true }) ], Button.prototype, "variant", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "full-width" }) ], Button.prototype, "fullWidth", void 0); __decorate([ n$1({ reflect: true }) ], Button.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], Button.prototype, "endIcon", void 0); Button = __decorate([ t$1("mdui-button") ], Button); const style$g = i$3`:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;text-align:center;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;font-size:1.5rem;width:2.5rem;height:2.5rem}:host([variant=standard]){color:rgb(var(--mdui-color-on-surface-variant));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=filled]){color:rgb(var(--mdui-color-primary));background-color:rgb(var(--mdui-color-surface-container-highest));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=tonal]){color:rgb(var(--mdui-color-on-surface-variant));background-color:rgb(var(--mdui-color-surface-container-highest));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=outlined]){border:.0625rem solid rgb(var(--mdui-color-outline));color:rgb(var(--mdui-color-on-surface-variant));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}:host([variant=outlined][pressed]){color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([variant=standard][selected]){color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=filled]:not([selectable])),:host([variant=filled][selected]){color:rgb(var(--mdui-color-on-primary));background-color:rgb(var(--mdui-color-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-primary)}:host([variant=tonal]:not([selectable])),:host([variant=tonal][selected]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-secondary-container )}:host([variant=outlined][selected]){border:none;color:rgb(var(--mdui-color-inverse-on-surface));background-color:rgb(var(--mdui-color-inverse-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-on-surface)}:host([variant=filled][disabled]),:host([variant=outlined][disabled]),:host([variant=tonal][disabled]){background-color:rgba(var(--mdui-color-on-surface),.12);border-color:rgba(var(--mdui-color-on-surface),.12)}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){color:rgba(var(--mdui-color-on-surface),.38)!important}:host([loading]) .button,:host([loading]) mdui-ripple{opacity:0}.button{float:left;width:100%}.icon,.selected-icon mdui-icon,::slotted(*){font-size:inherit}mdui-circular-progress{display:flex;position:absolute;top:calc(50% - 1.5rem / 2);left:calc(50% - 1.5rem / 2);width:1.5rem;height:1.5rem}:host([variant=filled]:not([disabled])) mdui-circular-progress{stroke:rgb(var(--mdui-color-on-primary))}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`; let ButtonIcon = class ButtonIcon2 extends ButtonBase { constructor() { super(...arguments); this.variant = "standard"; this.selectable = false; this.selected = false; this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "[default]", "selected-icon"); } get rippleElement() { return this.rippleRef.value; } onSelectedChange() { this.emit("change"); } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.addEventListener("click", () => { if (!this.selectable || this.disabled) { return; } this.selected = !this.selected; }); } render() { return ke`${this.isButton() ? this.renderButton({ className: "button", part: "button", content: this.renderIcon() }) : this.disabled || this.loading ? ke`${this.renderIcon()}` : this.renderAnchor({ className: "button", part: "button", content: this.renderIcon() })} ${this.renderLoading()}`; } renderIcon() { const icon = () => this.hasSlotController.test("[default]") ? ke`` : this.icon ? ke`` : nothingTemplate; const selectedIcon = () => this.hasSlotController.test("selected-icon") || this.selectedIcon ? ke`` : icon(); return this.selected ? selectedIcon() : icon(); } }; ButtonIcon.styles = [ButtonBase.styles, style$g]; __decorate([ n$1({ reflect: true }) ], ButtonIcon.prototype, "variant", void 0); __decorate([ n$1({ reflect: true }) ], ButtonIcon.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "selected-icon" }) ], ButtonIcon.prototype, "selectedIcon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ButtonIcon.prototype, "selectable", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ButtonIcon.prototype, "selected", void 0); __decorate([ watch("selected", true) ], ButtonIcon.prototype, "onSelectedChange", null); ButtonIcon = __decorate([ t$1("mdui-button-icon") ], ButtonIcon); const style$f = i$3`:host{--shape-corner:var(--mdui-shape-corner-medium);position:relative;display:inline-block;overflow:hidden;border-radius:var(--shape-corner);-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([clickable]){cursor:pointer}:host([variant=elevated]){background-color:rgb(var(--mdui-color-surface-container-low));box-shadow:var(--mdui-elevation-level1)}:host([variant=filled]){background-color:rgb(var(--mdui-color-surface-container-highest))}:host([variant=outlined]){background-color:rgb(var(--mdui-color-surface));border:.0625rem solid rgb(var(--mdui-color-outline))}:host([variant=elevated][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=filled][hover]),:host([variant=outlined][hover]){box-shadow:var(--mdui-elevation-level1)}:host([variant=elevated][dragged]),:host([variant=filled][dragged]),:host([variant=outlined][dragged]){box-shadow:var(--mdui-elevation-level3)}:host([disabled]){opacity:.38;cursor:default;-webkit-user-select:none;user-select:none}:host([variant=elevated][disabled]){background-color:rgb(var(--mdui-color-surface-variant));box-shadow:var(--mdui-elevation-level0)}:host([variant=filled][disabled]){background-color:rgb(var(--mdui-color-surface));box-shadow:var(--mdui-elevation-level1)}:host([variant=outlined][disabled]){box-shadow:var(--mdui-elevation-level0);border-color:rgba(var(--mdui-color-outline),.32)}.link{position:relative;display:inline-block;width:100%;height:100%;color:inherit;font-size:inherit;letter-spacing:inherit;text-decoration:none;touch-action:manipulation;-webkit-user-drag:none}`; let Card = class Card2 extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) { constructor() { super(...arguments); this.variant = "elevated"; this.clickable = false; this.disabled = false; this.rippleRef = ii(); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.disabled || !this.href && !this.clickable; } get focusElement() { return this.href && !this.disabled ? this.renderRoot.querySelector("._a") : this; } get focusDisabled() { return this.rippleDisabled; } render() { return ke`${this.href && !this.disabled ? this.renderAnchor({ className: "link", content: ke`` }) : ke``}`; } }; Card.styles = [componentStyle, style$f]; __decorate([ n$1({ reflect: true }) ], Card.prototype, "variant", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Card.prototype, "clickable", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Card.prototype, "disabled", void 0); Card = __decorate([ t$1("mdui-card") ], Card); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const Ft = e(class extends i$1 { constructor(r2) { if (super(r2), r2.type !== t.PROPERTY && r2.type !== t.ATTRIBUTE && r2.type !== t.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings"); if (!rt(r2)) throw Error("`live` bindings can only contain a single expression"); } render(r2) { return r2; } update(r2, [e2]) { if (e2 === R || e2 === D) return e2; const i3 = r2.element, n3 = r2.name; if (r2.type === t.PROPERTY) { if (e2 === i3[n3]) return R; } else if (r2.type === t.BOOLEAN_ATTRIBUTE) { if (!!e2 === i3.hasAttribute(n3)) return R; } else if (r2.type === t.ATTRIBUTE && i3.getAttribute(n3) === e2 + "") return R; return dt(r2), e2; } }); function defaultValue(propertyName = "value") { return (proto, key2) => { const constructor = proto.constructor; const attributeChangedCallback = constructor.prototype.attributeChangedCallback; constructor.prototype.attributeChangedCallback = function(name, old, value) { const options = constructor.getPropertyOptions(propertyName); const attributeName = isString(options.attribute) ? options.attribute : propertyName; if (name === attributeName) { const converter = options.converter || u; const fromAttribute = isFunction(converter) ? converter : (converter == null ? void 0 : converter.fromAttribute) ?? u.fromAttribute; const newValue = fromAttribute(value, options.type); if (this[propertyName] !== newValue) { this[key2] = newValue; } } attributeChangedCallback.call(this, name, old, value); }; }; } const style$e = i$3`:host{display:inline-block;width:1em;height:1em;line-height:1;font-size:1.5rem}`; const svgTag = (svgPaths) => ke`${fe(svgPaths)}`; let IconCheckBoxOutlineBlank = class IconCheckBoxOutlineBlank2 extends h { render() { return svgTag(''); } }; IconCheckBoxOutlineBlank.styles = style$e; IconCheckBoxOutlineBlank = __decorate([ t$1("mdui-icon-check-box-outline-blank") ], IconCheckBoxOutlineBlank); let IconCheckBox = class IconCheckBox2 extends h { render() { return svgTag(''); } }; IconCheckBox.styles = style$e; IconCheckBox = __decorate([ t$1("mdui-icon-check-box") ], IconCheckBox); let IconIndeterminateCheckBox = class IconIndeterminateCheckBox2 extends h { render() { return svgTag(''); } }; IconIndeterminateCheckBox.styles = style$e; IconIndeterminateCheckBox = __decorate([ t$1("mdui-icon-indeterminate-check-box") ], IconIndeterminateCheckBox); const style$d = i$3`:host{position:relative;display:inline-flex;cursor:pointer;-webkit-tap-highlight-color:transparent;border-radius:.125rem;font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}label{display:inline-flex;align-items:center;width:100%;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}input{position:absolute;padding:0;opacity:0;pointer-events:none;width:1.125rem;height:1.125rem;margin:0 0 0 .6875rem}.icon{display:flex;position:absolute;opacity:1;transform:scale(1);color:rgb(var(--mdui-color-on-surface));font-size:1.5rem;transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.checked-icon,.indeterminate-icon{opacity:0;transform:scale(.5);transition-property:color,opacity,transform;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard)}.icon .i,::slotted([slot=checked-icon]),::slotted([slot=indeterminate-icon]),::slotted([slot=unchecked-icon]){color:inherit;font-size:inherit}i{position:relative;display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;border-radius:50%;width:2.5rem;height:2.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.label{display:flex;width:100%;padding-top:.625rem;padding-bottom:.625rem;color:rgb(var(--mdui-color-on-surface));transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}:host([checked]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([checked]) .icon{color:rgb(var(--mdui-color-primary))}:host([checked]) .indeterminate-icon{opacity:0;transform:scale(.5)}:host([checked]) .checked-icon{opacity:1;transform:scale(1)}:host([indeterminate]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([indeterminate]) .icon{color:rgb(var(--mdui-color-primary))}:host([indeterminate]) .checked-icon{opacity:0;transform:scale(.5)}:host([indeterminate]) .indeterminate-icon{opacity:1;transform:scale(1)}.invalid i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}.invalid .icon{color:rgb(var(--mdui-color-error))}.invalid .label{color:rgb(var(--mdui-color-error))}:host([disabled]){cursor:default;pointer-events:none}:host([disabled]) .icon{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled][checked]) .unchecked-icon,:host([disabled][indeterminate]) .unchecked-icon{opacity:0}`; let Checkbox = class Checkbox2 extends RippleMixin(FocusableMixin(MduiElement)) { constructor() { super(...arguments); this.disabled = false; this.checked = false; this.defaultChecked = false; this.indeterminate = false; this.required = false; this.name = ""; this.value = "on"; this.invalid = false; this.inputRef = ii(); this.rippleRef = ii(); this.formController = new FormController(this, { value: (control) => control.checked ? control.value : void 0, defaultValue: (control) => control.defaultChecked, setValue: (control, checked) => control.checked = checked }); } /** * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState) */ get validity() { return this.inputRef.value.validity; } /** * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串 */ get validationMessage() { return this.inputRef.value.validationMessage; } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.disabled; } get focusElement() { return this.inputRef.value; } get focusDisabled() { return this.disabled; } async onDisabledChange() { await this.updateComplete; this.invalid = !this.inputRef.value.checkValidity(); } async onCheckedChange() { var _a2; await this.updateComplete; const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { this.invalid = !this.inputRef.value.checkValidity(); } } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true` */ checkValidity() { const valid = this.inputRef.value.checkValidity(); if (!valid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); } return valid; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。 * * 如果验证未通过,还会在组件上显示验证失败的提示。 */ reportValidity() { this.invalid = !this.inputRef.value.reportValidity(); if (this.invalid) { const eventProceeded = this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); if (!eventProceeded) { this.blur(); this.focus(); } } return !this.invalid; } /** * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证 * * @param message 自定义的错误提示文本 */ setCustomValidity(message) { this.inputRef.value.setCustomValidity(message); this.invalid = !this.inputRef.value.checkValidity(); } render() { return ke``; } /** * input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom */ onChange() { this.checked = this.inputRef.value.checked; this.indeterminate = false; this.emit("change"); } }; Checkbox.styles = [componentStyle, style$d]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Checkbox.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Checkbox.prototype, "checked", void 0); __decorate([ defaultValue("checked") ], Checkbox.prototype, "defaultChecked", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Checkbox.prototype, "indeterminate", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Checkbox.prototype, "required", void 0); __decorate([ n$1({ reflect: true }) ], Checkbox.prototype, "form", void 0); __decorate([ n$1({ reflect: true }) ], Checkbox.prototype, "name", void 0); __decorate([ n$1({ reflect: true }) ], Checkbox.prototype, "value", void 0); __decorate([ n$1({ reflect: true, attribute: "unchecked-icon" }) ], Checkbox.prototype, "uncheckedIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "checked-icon" }) ], Checkbox.prototype, "checkedIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "indeterminate-icon" }) ], Checkbox.prototype, "indeterminateIcon", void 0); __decorate([ r$1() ], Checkbox.prototype, "invalid", void 0); __decorate([ watch("disabled", true), watch("indeterminate", true), watch("required", true) ], Checkbox.prototype, "onDisabledChange", null); __decorate([ watch("checked", true) ], Checkbox.prototype, "onCheckedChange", null); Checkbox = __decorate([ t$1("mdui-checkbox") ], Checkbox); let IconCheck = class IconCheck2 extends h { render() { return svgTag(''); } }; IconCheck.styles = style$e; IconCheck = __decorate([ t$1("mdui-icon-check") ], IconCheck); let IconClear = class IconClear2 extends h { render() { return svgTag(''); } }; IconClear.styles = style$e; IconClear = __decorate([ t$1("mdui-icon-clear") ], IconClear); const style$c = i$3`:host{--shape-corner:var(--mdui-shape-corner-small);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);height:2rem;background-color:rgb(var(--mdui-color-surface));border:.0625rem solid rgb(var(--mdui-color-outline));color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}.button{padding-right:.4375rem;padding-left:.4375rem}:host([variant=input]) .button{padding-right:.1875rem;padding-left:.1875rem}:host([selected]) .button{padding-right:.5rem;padding-left:.5rem}:host([selected][variant=input]) .button{padding-right:.25rem;padding-left:.25rem}:host([elevated]) .button{padding-right:.5rem;padding-left:.5rem}:host([variant=assist]){color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([elevated]){border-width:0;background-color:rgb(var(--mdui-color-surface-container-low));box-shadow:var(--mdui-elevation-level1)}:host([selected]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));border-width:0;--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-secondary-container )}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){border-color:rgba(var(--mdui-color-on-surface),12%);color:rgba(var(--mdui-color-on-surface),38%);box-shadow:var(--mdui-elevation-level0)}:host([disabled][elevated]),:host([disabled][selected]){background-color:rgba(var(--mdui-color-on-surface),12%)}:host([selected][hover]){box-shadow:var(--mdui-elevation-level1)}:host([elevated][hover]){color:rgb(var(--mdui-color-on-secondary-container));box-shadow:var(--mdui-elevation-level2)}:host([variant=filter][hover]),:host([variant=input][hover]),:host([variant=suggestion][hover]){color:rgb(var(--mdui-color-on-surface-variant))}:host([variant=filter][focus-visible]),:host([variant=input][focus-visible]),:host([variant=suggestion][focus-visible]){border-color:rgb(var(--mdui-color-on-surface-variant))}:host([dragged]),:host([dragged][hover]){box-shadow:var(--mdui-elevation-level4)}.button{overflow:visible}.label{display:inline-flex;padding-right:.5rem;padding-left:.5rem}.end-icon,.icon,.selected-icon{display:inline-flex;font-size:1.28571429em;color:rgb(var(--mdui-color-on-surface-variant))}:host([variant=assist]) .end-icon,:host([variant=assist]) .icon,:host([variant=assist]) .selected-icon{color:rgb(var(--mdui-color-primary))}:host([selected]) .end-icon,:host([selected]) .icon,:host([selected]) .selected-icon{color:rgb(var(--mdui-color-on-secondary-container))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([disabled]) .selected-icon{opacity:.38;color:rgb(var(--mdui-color-on-surface))}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}:host([variant=input]) .has-icon .icon,:host([variant=input]) .has-icon .selected-icon,:host([variant=input]) .has-icon mdui-circular-progress{margin-left:.25rem}:host([variant=input]) .has-end-icon .end-icon{margin-right:.25rem}mdui-circular-progress{display:inline-flex;width:1.125rem;height:1.125rem}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}::slotted(mdui-avatar[slot=end-icon]),::slotted(mdui-avatar[slot=icon]),::slotted(mdui-avatar[slot=selected-icon]){width:1.5rem;height:1.5rem}:host([disabled]) ::slotted(mdui-avatar[slot=end-icon]),:host([disabled]) ::slotted(mdui-avatar[slot=icon]),:host([disabled]) ::slotted(mdui-avatar[slot=selected-icon]){opacity:.38}::slotted(mdui-avatar[slot=icon]),::slotted(mdui-avatar[slot=selected-icon]){margin-left:-.25rem;margin-right:-.125rem}::slotted(mdui-avatar[slot=end-icon]){margin-right:-.25rem;margin-left:-.125rem}.delete-icon{display:inline-flex;font-size:1.28571429em;transition:background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);border-radius:var(--mdui-shape-corner-full);margin-right:-.25rem;margin-left:-.25rem;padding:.25rem;color:rgb(var(--mdui-color-on-surface-variant))}.delete-icon:hover{background-color:rgba(var(--mdui-color-on-surface-variant),12%)}.has-end-icon .delete-icon{margin-left:.25rem}:host([variant=assiat]) .delete-icon{color:rgb(var(--mdui-color-primary))}:host([variant=input]) .delete-icon{margin-right:.0625rem}:host([disabled]) .delete-icon{color:rgba(var(--mdui-color-on-surface),38%)}.delete-icon .i,::slotted([slot=delete-icon]){font-size:inherit}::slotted(mdui-avatar[slot=delete-icon]){width:1.125rem;height:1.125rem}`; let Chip = class Chip2 extends ButtonBase { constructor() { super(); this.variant = "assist"; this.elevated = false; this.selectable = false; this.selected = false; this.deletable = false; this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "icon", "selected-icon", "end-icon"); this.onClick = this.onClick.bind(this); this.onKeyDown = this.onKeyDown.bind(this); } get rippleElement() { return this.rippleRef.value; } onSelectedChange() { this.emit("change"); } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.addEventListener("click", this.onClick); this.addEventListener("keydown", this.onKeyDown); } render() { const hasIcon = this.icon || this.hasSlotController.test("icon"); const hasEndIcon = this.endIcon || this.hasSlotController.test("end-icon"); const hasSelectedIcon = this.selectedIcon || ["assist", "filter"].includes(this.variant) || hasIcon || this.hasSlotController.test("selected-icon"); const className2 = cc({ button: true, "has-icon": this.loading || !this.selected && hasIcon || this.selected && hasSelectedIcon, "has-end-icon": hasEndIcon }); return ke`${this.isButton() ? this.renderButton({ className: className2, part: "button", content: this.renderInner() }) : this.disabled || this.loading ? ke`${this.renderInner()}` : this.renderAnchor({ className: className2, part: "button", content: this.renderInner() })}`; } onClick() { if (this.disabled || this.loading) { return; } if (this.selectable) { this.selected = !this.selected; } } onKeyDown(event) { if (this.disabled || this.loading) { return; } if (this.selectable && event.key === " ") { event.preventDefault(); this.selected = !this.selected; } if (this.deletable && ["Delete", "Backspace"].includes(event.key)) { this.emit("delete"); } } /** * 点击删除按钮 */ onDelete(event) { event.stopPropagation(); this.emit("delete"); } renderIcon() { if (this.loading) { return this.renderLoading(); } const icon = () => { return this.icon ? ke`` : nothingTemplate; }; const selectedIcon = () => { if (this.selectedIcon) { return ke``; } if (this.variant === "assist" || this.variant === "filter") { return ke``; } return icon(); }; return !this.selected ? ke`${icon()}` : ke`${selectedIcon()}`; } renderLabel() { return ke``; } renderEndIcon() { return ke`${this.endIcon ? ke`` : nothingTemplate}`; } renderDeleteIcon() { if (!this.deletable) { return nothingTemplate; } return ke`${this.deleteIcon ? ke`` : ke``}`; } renderInner() { return [ this.renderIcon(), this.renderLabel(), this.renderEndIcon(), this.renderDeleteIcon() ]; } }; Chip.styles = [ButtonBase.styles, style$c]; __decorate([ n$1({ reflect: true }) ], Chip.prototype, "variant", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Chip.prototype, "elevated", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Chip.prototype, "selectable", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Chip.prototype, "selected", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Chip.prototype, "deletable", void 0); __decorate([ n$1({ reflect: true }) ], Chip.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "selected-icon" }) ], Chip.prototype, "selectedIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], Chip.prototype, "endIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "delete-icon" }) ], Chip.prototype, "deleteIcon", void 0); __decorate([ watch("selected", true) ], Chip.prototype, "onSelectedChange", null); Chip = __decorate([ t$1("mdui-chip") ], Chip); const arraysEqualIgnoreOrder = (a2, b3) => { if (a2.length !== b3.length) { return false; } const sortedA = [...a2].sort(); const sortedB = [...b3].sort(); return sortedA.every((value, index) => value === sortedB[index]); }; const collapseStyle = i$3`:host{display:block}`; let Collapse = class Collapse2 extends MduiElement { constructor() { super(...arguments); this.accordion = false; this.disabled = false; this.activeKeys = []; this.isInitial = true; this.definedController = new DefinedController(this, { relatedElements: ["mdui-collapse-item"] }); } async onActiveKeysChange() { var _a2; await this.definedController.whenDefined(); const value = this.accordion ? (_a2 = this.items.find((item) => this.activeKeys.includes(item.key))) == null ? void 0 : _a2.value : this.items.filter((item) => this.activeKeys.includes(item.key)).map((item) => item.value); this.setValue(value); if (!this.isInitial) { this.emit("change"); } } async onValueChange() { this.isInitial = !this.hasUpdated; await this.definedController.whenDefined(); if (this.accordion) { const value = this.value; if (!value) { this.setActiveKeys([]); } else { const item = this.items.find((item2) => item2.value === value); this.setActiveKeys(item ? [item.key] : []); } } else { const value = this.value; if (!value.length) { this.setActiveKeys([]); } else { const activeKeys = this.items.filter((item) => value.includes(item.value)).map((item) => item.key); this.setActiveKeys(activeKeys); } } this.updateItems(); } render() { return ke``; } setActiveKeys(activeKeys) { if (!arraysEqualIgnoreOrder(this.activeKeys, activeKeys)) { this.activeKeys = activeKeys; } } setValue(value) { if (this.accordion || isUndefined(this.value) || isUndefined(value)) { this.value = value; } else if (!arraysEqualIgnoreOrder(this.value, value)) { this.value = value; } } onClick(event) { if (this.disabled) { return; } if (event.button) { return; } const target = event.target; const item = target.closest("mdui-collapse-item"); if (!item || item.disabled) { return; } const path = event.composedPath(); if (item.trigger && !path.find((element) => isElement(element) && $$1(element).is(item.trigger))) { return; } if (!path.find((element) => isElement(element) && element.part.contains("header"))) { return; } if (this.accordion) { if (this.activeKeys.includes(item.key)) { this.setActiveKeys([]); } else { this.setActiveKeys([item.key]); } } else { const activeKeys = [...this.activeKeys]; if (activeKeys.includes(item.key)) { activeKeys.splice(activeKeys.indexOf(item.key), 1); } else { activeKeys.push(item.key); } this.setActiveKeys(activeKeys); } this.isInitial = false; this.updateItems(); } async onSlotChange() { await this.definedController.whenDefined(); this.updateItems(); } // 更新 的状态 updateItems() { this.items.forEach((item) => { item.active = this.activeKeys.includes(item.key); item.isInitial = this.isInitial; }); } }; Collapse.styles = [ componentStyle, collapseStyle ]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Collapse.prototype, "accordion", void 0); __decorate([ n$1() ], Collapse.prototype, "value", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Collapse.prototype, "disabled", void 0); __decorate([ r$1() ], Collapse.prototype, "activeKeys", void 0); __decorate([ o$1({ selector: "mdui-collapse-item", flatten: true }) ], Collapse.prototype, "items", void 0); __decorate([ watch("activeKeys", true) ], Collapse.prototype, "onActiveKeysChange", null); __decorate([ watch("value") ], Collapse.prototype, "onValueChange", null); Collapse = __decorate([ t$1("mdui-collapse") ], Collapse); const collapseItemStyle = i$3`:host{display:flex;flex-direction:column}.header{display:block}.body{display:block;overflow:hidden;transition:height var(--mdui-motion-duration-short4) var(--mdui-motion-easing-emphasized)}.body.opened{overflow:visible}.body.active{transition-duration:var(--mdui-motion-duration-medium4)}`; let CollapseItem = class CollapseItem2 extends MduiElement { constructor() { super(...arguments); this.disabled = false; this.active = false; this.state = "closed"; this.isInitial = true; this.key = uniqueId(); this.bodyRef = ii(); } onActiveChange() { if (this.isInitial) { this.state = this.active ? "opened" : "closed"; if (this.hasUpdated) { this.updateBodyHeight(); } } else { this.state = this.active ? "open" : "close"; this.emit(this.state); this.updateBodyHeight(); } } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.updateBodyHeight(); } render() { return ke`${this.header}`; } onTransitionEnd(event) { if (event.target === this.bodyRef.value) { this.state = this.active ? "opened" : "closed"; this.emit(this.state); this.updateBodyHeight(); } } updateBodyHeight() { const scrollHeight = this.bodyRef.value.scrollHeight; if (this.state === "close") { $$1(this.bodyRef.value).height(scrollHeight); this.bodyRef.value.clientLeft; } $$1(this.bodyRef.value).height(this.state === "opened" ? "auto" : this.state === "open" ? scrollHeight : 0); } }; CollapseItem.styles = [ componentStyle, collapseItemStyle ]; __decorate([ n$1({ reflect: true }) ], CollapseItem.prototype, "value", void 0); __decorate([ n$1({ reflect: true }) ], CollapseItem.prototype, "header", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], CollapseItem.prototype, "disabled", void 0); __decorate([ n$1() ], CollapseItem.prototype, "trigger", void 0); __decorate([ r$1() ], CollapseItem.prototype, "active", void 0); __decorate([ r$1() ], CollapseItem.prototype, "state", void 0); __decorate([ watch("active") ], CollapseItem.prototype, "onActiveChange", null); CollapseItem = __decorate([ t$1("mdui-collapse-item") ], CollapseItem); /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function nn(n3, r2, t2) { return n3 ? r2(n3) : t2 == null ? void 0 : t2(n3); } function animateTo(el, keyframes, options) { if (!el) { return Promise.resolve(); } return new Promise((resolve) => { if (options.duration === Infinity) { throw new Error("Promise-based animations must be finite."); } if (isNumber(options.duration) && isNaN(options.duration)) { options.duration = 0; } if (options.easing === "") { options.easing = "linear"; } const animation = el.animate(keyframes, options); animation.addEventListener("cancel", resolve, { once: true }); animation.addEventListener("finish", resolve, { once: true }); }); } function stopAnimations(el) { if (!el) { return Promise.resolve(); } return Promise.all(el.getAnimations().map((animation) => { return new Promise((resolve) => { const handleAnimationEvent = requestAnimationFrame(resolve); animation.addEventListener("cancel", () => handleAnimationEvent, { once: true }); animation.addEventListener("finish", () => handleAnimationEvent, { once: true }); animation.cancel(); }); })); } function isTabbable(el) { const window2 = getWindow$1(); const localName = el.localName; if (el.getAttribute("tabindex") === "-1") { return false; } if (el.hasAttribute("disabled")) { return false; } if (el.hasAttribute("aria-disabled") && el.getAttribute("aria-disabled") !== "false") { return false; } if (localName === "input" && el.getAttribute("type") === "radio" && !el.hasAttribute("checked")) { return false; } if (el.offsetParent === null) { return false; } if (window2.getComputedStyle(el).visibility === "hidden") { return false; } if ((localName === "audio" || localName === "video") && el.hasAttribute("controls")) { return true; } if (el.hasAttribute("tabindex")) { return true; } if (el.hasAttribute("contenteditable") && el.getAttribute("contenteditable") !== "false") { return true; } return [ "button", "input", "select", "textarea", "a", "audio", "video", "summary" ].includes(localName); } function getTabbableBoundary(root2) { const allElements = []; function walk(el) { if (el instanceof HTMLElement) { allElements.push(el); if (el.shadowRoot !== null && el.shadowRoot.mode === "open") { walk(el.shadowRoot); } } const children = el.children; [...children].forEach((e2) => walk(e2)); } walk(root2); const start = allElements.find((el) => isTabbable(el)) ?? null; const end = allElements.reverse().find((el) => isTabbable(el)) ?? null; return { start, end }; } let activeModals = []; class Modal { constructor(element) { this.tabDirection = "forward"; this.element = element; this.handleFocusIn = this.handleFocusIn.bind(this); this.handleKeyDown = this.handleKeyDown.bind(this); this.handleKeyUp = this.handleKeyUp.bind(this); } activate() { activeModals.push(this.element); document.addEventListener("focusin", this.handleFocusIn); document.addEventListener("keydown", this.handleKeyDown); document.addEventListener("keyup", this.handleKeyUp); } deactivate() { activeModals = activeModals.filter((modal) => modal !== this.element); document.removeEventListener("focusin", this.handleFocusIn); document.removeEventListener("keydown", this.handleKeyDown); document.removeEventListener("keyup", this.handleKeyUp); } isActive() { return activeModals[activeModals.length - 1] === this.element; } checkFocus() { if (this.isActive()) { if (!this.element.matches(":focus-within")) { const { start, end } = getTabbableBoundary(this.element); const target = this.tabDirection === "forward" ? start : end; if (typeof (target == null ? void 0 : target.focus) === "function") { target.focus({ preventScroll: true }); } } } } handleFocusIn() { this.checkFocus(); } handleKeyDown(event) { if (event.key === "Tab" && event.shiftKey) { this.tabDirection = "backward"; } requestAnimationFrame(() => this.checkFocus()); } handleKeyUp() { this.tabDirection = "forward"; } } const getEasing = (element, name) => { const cssVariableName = `--mdui-motion-easing-${name}`; return $$1(element).css(cssVariableName).trim(); }; const getDuration = (element, name) => { const cssVariableName = `--mdui-motion-duration-${name}`; const cssValue = $$1(element).css(cssVariableName).trim().toLowerCase(); if (cssValue.endsWith("ms")) { return parseFloat(cssValue); } else { return parseFloat(cssValue) * 1e3; } }; let scrollBarSizeCached; const getScrollBarSize = (fresh) => { if (isUndefined(document)) { return 0; } if (scrollBarSizeCached === void 0) { const $inner = $$1("
").css({ width: "100%", height: "200px" }); const $outer = $$1("
").css({ position: "absolute", top: "0", left: "0", pointerEvents: "none", visibility: "hidden", width: "200px", height: "150px", overflow: "hidden" }).append($inner).appendTo(document.body); const widthContained = $inner[0].offsetWidth; $outer.css("overflow", "scroll"); let widthScroll = $inner[0].offsetWidth; if (widthContained === widthScroll) { widthScroll = $outer[0].clientWidth; } $outer.remove(); scrollBarSizeCached = widthContained - widthScroll; } return scrollBarSizeCached; }; const hasScrollbar = (target) => { return target.scrollHeight > target.clientHeight; }; const lockMap = /* @__PURE__ */ new WeakMap(); const className = "mdui-lock-screen"; const lockScreen = (source2, target) => { const document2 = getDocument(); target ?? (target = document2.documentElement); if (!lockMap.has(target)) { lockMap.set(target, /* @__PURE__ */ new Set()); } const lock = lockMap.get(target); lock.add(source2); const $target = $$1(target); if (hasScrollbar(target)) { $target.css("width", `calc(100% - ${getScrollBarSize()}px)`); } $target.addClass(className); }; const unlockScreen = (source2, target) => { const document2 = getDocument(); target ?? (target = document2.documentElement); const lock = lockMap.get(target); if (!lock) { return; } lock.delete(source2); if (lock.size === 0) { lockMap.delete(target); $$1(target).removeClass(className).width(""); } }; /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const LOCALE_STATUS_EVENT = "lit-localize-status"; /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const isStrTagged = (val) => typeof val !== "string" && "strTag" in val; const joinStringsAndValues = (strings, values, valueOrder) => { let concat = strings[0]; for (let i3 = 1; i3 < strings.length; i3++) { concat += values[i3 - 1]; concat += strings[i3]; } return concat; }; /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const defaultMsg = (template) => isStrTagged(template) ? joinStringsAndValues(template.strings, template.values) : template; let msg = defaultMsg; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class Deferred { constructor() { this.settled = false; this.promise = new Promise((resolve, reject) => { this._resolve = resolve; this._reject = reject; }); } resolve(value) { this.settled = true; this._resolve(value); } reject(error) { this.settled = true; this._reject(error); } } /** * @license * Copyright 2014 Travis Webb * SPDX-License-Identifier: MIT */ for (let i3 = 0; i3 < 256; i3++) { (i3 >> 4 & 15).toString(16) + (i3 & 15).toString(16); } /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ let loading = new Deferred(); loading.resolve(); let listeningLitLocalizeStatus = false; const localeReadyCallbacksMap = /* @__PURE__ */ new Map(); const onLocaleReady = (target, callback) => { if (!listeningLitLocalizeStatus) { listeningLitLocalizeStatus = true; const window2 = getWindow$1(); window2.addEventListener(LOCALE_STATUS_EVENT, (event) => { if (event.detail.status === "ready") { localeReadyCallbacksMap.forEach((callbacks2) => { callbacks2.forEach((cb) => cb()); }); } }); } const callbacks = localeReadyCallbacksMap.get(target) || []; callbacks.push(callback); localeReadyCallbacksMap.set(target, callbacks); }; const offLocaleReady = (target) => { localeReadyCallbacksMap.delete(target); }; const style$b = i$3`:host{--shape-corner:var(--mdui-shape-corner-extra-large);--z-index:2300;position:fixed;z-index:var(--z-index);display:none;align-items:center;justify-content:center;inset:0;padding:3rem}::slotted(mdui-top-app-bar[slot=header]){position:absolute;border-top-left-radius:var(--mdui-shape-corner-extra-large);border-top-right-radius:var(--mdui-shape-corner-extra-large);background-color:rgb(var(--mdui-color-surface-container-high))}:host([fullscreen]){--shape-corner:var(--mdui-shape-corner-none);padding:0}:host([fullscreen]) ::slotted(mdui-top-app-bar[slot=header]){border-top-left-radius:var(--mdui-shape-corner-none);border-top-right-radius:var(--mdui-shape-corner-none)}.overlay{position:fixed;inset:0;background-color:rgba(var(--mdui-color-scrim),.4)}.panel{--mdui-color-background:var(--mdui-color-surface-container-high);position:relative;display:flex;flex-direction:column;max-height:100%;border-radius:var(--shape-corner);outline:0;transform-origin:top;min-width:17.5rem;max-width:35rem;padding:1.5rem;background-color:rgb(var(--mdui-color-surface-container-high));box-shadow:var(--mdui-elevation-level3)}:host([fullscreen]) .panel{width:100%;max-width:100%;height:100%;max-height:100%;box-shadow:var(--mdui-elevation-level0)}.header{display:flex;flex-direction:column}.has-icon .header{align-items:center}.icon{display:flex;color:rgb(var(--mdui-color-secondary));font-size:1.5rem}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit}.headline{display:flex;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-headline-small-size);font-weight:var(--mdui-typescale-headline-small-weight);letter-spacing:var(--mdui-typescale-headline-small-tracking);line-height:var(--mdui-typescale-headline-small-line-height)}.icon+.headline{padding-top:1rem}.body{overflow:auto}.header+.body{margin-top:1rem}.description{display:flex;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([fullscreen]) .description{color:rgb(var(--mdui-color-on-surface))}.has-description.has-default .description{margin-bottom:1rem}.action{display:flex;justify-content:flex-end;padding-top:1.5rem}.action::slotted(:not(:first-child)){margin-left:.5rem}:host([stacked-actions]) .action{flex-direction:column;align-items:end}:host([stacked-actions]) .action::slotted(:not(:first-child)){margin-left:0;margin-top:.5rem}`; let Dialog = class Dialog2 extends MduiElement { constructor() { super(...arguments); this.open = false; this.fullscreen = false; this.closeOnEsc = false; this.closeOnOverlayClick = false; this.stackedActions = false; this.overlayRef = ii(); this.panelRef = ii(); this.bodyRef = ii(); this.hasSlotController = new HasSlotController(this, "header", "icon", "headline", "description", "action", "[default]"); this.definedController = new DefinedController(this, { relatedElements: ["mdui-top-app-bar"] }); } async onOpenChange() { const hasUpdated = this.hasUpdated; if (!this.open && !hasUpdated) { return; } await this.definedController.whenDefined(); if (!hasUpdated) { await this.updateComplete; } const children = Array.from(this.panelRef.value.querySelectorAll(".header, .body, .actions")); const easingLinear = getEasing(this, "linear"); const easingEmphasizedDecelerate = getEasing(this, "emphasized-decelerate"); const easingEmphasizedAccelerate = getEasing(this, "emphasized-accelerate"); const stopAnimation = () => Promise.all([ stopAnimations(this.overlayRef.value), stopAnimations(this.panelRef.value), ...children.map((child) => stopAnimations(child)) ]); if (this.open) { if (hasUpdated) { const eventProceeded = this.emit("open", { cancelable: true }); if (!eventProceeded) { return; } } this.style.display = "flex"; const topAppBarElements = this.topAppBarElements ?? []; if (topAppBarElements.length) { const topAppBarElement = topAppBarElements[0]; if (!topAppBarElement.scrollTarget) { topAppBarElement.scrollTarget = this.bodyRef.value; } this.bodyRef.value.style.marginTop = "0"; } this.originalTrigger = document.activeElement; this.modalHelper.activate(); lockScreen(this); await stopAnimation(); requestAnimationFrame(() => { const autoFocusTarget = this.querySelector("[autofocus]"); if (autoFocusTarget) { autoFocusTarget.focus({ preventScroll: true }); } else { this.panelRef.value.focus({ preventScroll: true }); } }); const duration = getDuration(this, "medium4"); await Promise.all([ animateTo(this.overlayRef.value, [{ opacity: 0 }, { opacity: 1, offset: 0.3 }, { opacity: 1 }], { duration: hasUpdated ? duration : 0, easing: easingLinear }), animateTo(this.panelRef.value, [ { transform: "translateY(-1.875rem) scaleY(0)" }, { transform: "translateY(0) scaleY(1)" } ], { duration: hasUpdated ? duration : 0, easing: easingEmphasizedDecelerate }), animateTo(this.panelRef.value, [{ opacity: 0 }, { opacity: 1, offset: 0.1 }, { opacity: 1 }], { duration: hasUpdated ? duration : 0, easing: easingLinear }), ...children.map((child) => animateTo(child, [ { opacity: 0 }, { opacity: 0, offset: 0.2 }, { opacity: 1, offset: 0.8 }, { opacity: 1 } ], { duration: hasUpdated ? duration : 0, easing: easingLinear })) ]); if (hasUpdated) { this.emit("opened"); } } else { const eventProceeded = this.emit("close", { cancelable: true }); if (!eventProceeded) { return; } this.modalHelper.deactivate(); await stopAnimation(); const duration = getDuration(this, "short4"); await Promise.all([ animateTo(this.overlayRef.value, [{ opacity: 1 }, { opacity: 0 }], { duration, easing: easingLinear }), animateTo(this.panelRef.value, [ { transform: "translateY(0) scaleY(1)" }, { transform: "translateY(-1.875rem) scaleY(0.6)" } ], { duration, easing: easingEmphasizedAccelerate }), animateTo(this.panelRef.value, [{ opacity: 1 }, { opacity: 1, offset: 0.75 }, { opacity: 0 }], { duration, easing: easingLinear }), ...children.map((child) => animateTo(child, [{ opacity: 1 }, { opacity: 0, offset: 0.75 }, { opacity: 0 }], { duration, easing: easingLinear })) ]); this.style.display = "none"; unlockScreen(this); const trigger = this.originalTrigger; if (typeof (trigger == null ? void 0 : trigger.focus) === "function") { setTimeout(() => trigger.focus()); } this.emit("closed"); } } disconnectedCallback() { super.disconnectedCallback(); unlockScreen(this); offLocaleReady(this); } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); this.modalHelper = new Modal(this); this.addEventListener("keydown", (event) => { if (this.open && this.closeOnEsc && event.key === "Escape") { event.stopPropagation(); this.open = false; } }); } render() { const hasActionSlot = this.hasSlotController.test("action"); const hasDefaultSlot = this.hasSlotController.test("[default]"); const hasIcon = !!this.icon || this.hasSlotController.test("icon"); const hasHeadline = !!this.headline || this.hasSlotController.test("headline"); const hasDescription = !!this.description || this.hasSlotController.test("description"); const hasHeader = hasIcon || hasHeadline || this.hasSlotController.test("header"); const hasBody = hasDescription || hasDefaultSlot; return ke`
${nn(hasHeader, () => ke`${nn(hasIcon, () => this.renderIcon())} ${nn(hasHeadline, () => this.renderHeadline())}`)} ${nn(hasBody, () => ke`
${nn(hasDescription, () => this.renderDescription())}
`)} ${nn(hasActionSlot, () => ke``)}
`; } onOverlayClick() { this.emit("overlay-click"); if (!this.closeOnOverlayClick) { return; } this.open = false; } renderIcon() { return ke`${this.icon ? ke`` : nothingTemplate}`; } renderHeadline() { return ke`${this.headline}`; } renderDescription() { return ke`${this.description}`; } }; Dialog.styles = [componentStyle, style$b]; __decorate([ n$1({ reflect: true }) ], Dialog.prototype, "icon", void 0); __decorate([ n$1({ reflect: true }) ], Dialog.prototype, "headline", void 0); __decorate([ n$1({ reflect: true }) ], Dialog.prototype, "description", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Dialog.prototype, "open", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Dialog.prototype, "fullscreen", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "close-on-esc" }) ], Dialog.prototype, "closeOnEsc", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "close-on-overlay-click" }) ], Dialog.prototype, "closeOnOverlayClick", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "stacked-actions" }) ], Dialog.prototype, "stackedActions", void 0); __decorate([ o$1({ slot: "header", selector: "mdui-top-app-bar", flatten: true }) ], Dialog.prototype, "topAppBarElements", void 0); __decorate([ watch("open") ], Dialog.prototype, "onOpenChange", null); Dialog = __decorate([ t$1("mdui-dialog") ], Dialog); const style$a = i$3`:host{display:block;height:.0625rem;background-color:rgb(var(--mdui-color-surface-variant))}:host([inset]){margin-left:1rem}:host([middle]){margin-left:1rem;margin-right:1rem}:host([vertical]){height:100%;width:.0625rem}`; let Divider = class Divider2 extends MduiElement { constructor() { super(...arguments); this.vertical = false; this.inset = false; this.middle = false; } render() { return ke``; } }; Divider.styles = [componentStyle, style$a]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Divider.prototype, "vertical", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Divider.prototype, "inset", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Divider.prototype, "middle", void 0); Divider = __decorate([ t$1("mdui-divider") ], Divider); function hasWindow() { return typeof window !== "undefined"; } function getNodeName(node) { if (isNode(node)) { return (node.nodeName || "").toLowerCase(); } return "#document"; } function getWindow(node) { var _node$ownerDocument; return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; } function getDocumentElement(node) { var _ref; return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; } function isNode(value) { if (!hasWindow()) { return false; } return value instanceof Node || value instanceof getWindow(value).Node; } function isHTMLElement(value) { if (!hasWindow()) { return false; } return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; } function isShadowRoot(value) { if (!hasWindow() || typeof ShadowRoot === "undefined") { return false; } return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; } function isOverflowElement(element) { const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element); return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); } function isLastTraversableNode(node) { return ["html", "body", "#document"].includes(getNodeName(node)); } function getComputedStyle$1(element) { return getWindow(element).getComputedStyle(element); } function getParentNode(node) { if (getNodeName(node) === "html") { return node; } const result = ( // Step into the shadow DOM of the parent of a slotted node. node.assignedSlot || // DOM Element detected. node.parentNode || // ShadowRoot detected. isShadowRoot(node) && node.host || // Fallback. getDocumentElement(node) ); return isShadowRoot(result) ? result.host : result; } function getNearestOverflowAncestor(node) { const parentNode = getParentNode(node); if (isLastTraversableNode(parentNode)) { return node.ownerDocument ? node.ownerDocument.body : node.body; } if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { return parentNode; } return getNearestOverflowAncestor(parentNode); } function getOverflowAncestors(node, list, traverseIframes) { var _node$ownerDocument2; if (list === void 0) { list = []; } if (traverseIframes === void 0) { traverseIframes = true; } const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); const win = getWindow(scrollableAncestor); if (isBody) { const frameElement = getFrameElement(win); return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); } return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); } function getFrameElement(win) { return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; } const style$9 = i$3`:host{--z-index:2100;display:contents}.panel{display:block;position:fixed;z-index:var(--z-index)}`; let Dropdown = class Dropdown2 extends MduiElement { constructor() { super(); this.open = false; this.disabled = false; this.trigger = "click"; this.placement = "auto"; this.stayOpenOnClick = false; this.openDelay = 150; this.closeDelay = 150; this.openOnPointer = false; this.panelRef = ii(); this.definedController = new DefinedController(this, { relatedElements: [""] }); this.onDocumentClick = this.onDocumentClick.bind(this); this.onDocumentKeydown = this.onDocumentKeydown.bind(this); this.onWindowScroll = this.onWindowScroll.bind(this); this.onMouseLeave = this.onMouseLeave.bind(this); this.onFocus = this.onFocus.bind(this); this.onClick = this.onClick.bind(this); this.onContextMenu = this.onContextMenu.bind(this); this.onMouseEnter = this.onMouseEnter.bind(this); this.onPanelClick = this.onPanelClick.bind(this); } get triggerElement() { return this.triggerElements[0]; } // 这些属性变更时,需要更新样式 async onPositionChange() { if (this.open) { await this.definedController.whenDefined(); this.updatePositioner(); } } async onOpenChange() { var _a2, _b; const hasUpdated = this.hasUpdated; if (!this.open && !hasUpdated) { return; } await this.definedController.whenDefined(); if (!hasUpdated) { await this.updateComplete; } const easingLinear = getEasing(this, "linear"); const easingEmphasizedDecelerate = getEasing(this, "emphasized-decelerate"); const easingEmphasizedAccelerate = getEasing(this, "emphasized-accelerate"); if (this.open) { if (hasUpdated) { const eventProceeded = this.emit("open", { cancelable: true }); if (!eventProceeded) { return; } } const focusablePanel = this.panelElements.find((panel) => isFunction(panel.focus)); setTimeout(() => { focusablePanel == null ? void 0 : focusablePanel.focus(); }); const duration = getDuration(this, "medium4"); await stopAnimations(this.panelRef.value); this.panelRef.value.hidden = false; this.updatePositioner(); await Promise.all([ animateTo(this.panelRef.value, [ { transform: `${this.getCssScaleName()}(0.45)` }, { transform: `${this.getCssScaleName()}(1)` } ], { duration: hasUpdated ? duration : 0, easing: easingEmphasizedDecelerate }), animateTo(this.panelRef.value, [{ opacity: 0 }, { opacity: 1, offset: 0.125 }, { opacity: 1 }], { duration: hasUpdated ? duration : 0, easing: easingLinear }) ]); if (hasUpdated) { this.emit("opened"); } } else { const eventProceeded = this.emit("close", { cancelable: true }); if (!eventProceeded) { return; } if (!this.hasTrigger("focus") && isFunction((_a2 = this.triggerElement) == null ? void 0 : _a2.focus) && (this.contains(document.activeElement) || this.contains(((_b = document.activeElement) == null ? void 0 : _b.assignedSlot) ?? null))) { this.triggerElement.focus(); } const duration = getDuration(this, "short4"); await stopAnimations(this.panelRef.value); await Promise.all([ animateTo(this.panelRef.value, [ { transform: `${this.getCssScaleName()}(1)` }, { transform: `${this.getCssScaleName()}(0.45)` } ], { duration, easing: easingEmphasizedAccelerate }), animateTo(this.panelRef.value, [{ opacity: 1 }, { opacity: 1, offset: 0.875 }, { opacity: 0 }], { duration, easing: easingLinear }) ]); if (this.panelRef.value) { this.panelRef.value.hidden = true; } this.emit("closed"); } } connectedCallback() { super.connectedCallback(); this.definedController.whenDefined().then(() => { document.addEventListener("pointerdown", this.onDocumentClick); document.addEventListener("keydown", this.onDocumentKeydown); this.overflowAncestors = getOverflowAncestors(this.triggerElement); this.overflowAncestors.forEach((ancestor) => { ancestor.addEventListener("scroll", this.onWindowScroll); }); }); } disconnectedCallback() { var _a2, _b; super.disconnectedCallback(); document.removeEventListener("pointerdown", this.onDocumentClick); document.removeEventListener("keydown", this.onDocumentKeydown); (_a2 = this.overflowAncestors) == null ? void 0 : _a2.forEach((ancestor) => { ancestor.removeEventListener("scroll", this.onWindowScroll); }); (_b = this.observeResize) == null ? void 0 : _b.unobserve(); } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.addEventListener("mouseleave", this.onMouseLeave); this.definedController.whenDefined().then(() => { this.triggerElement.addEventListener("focus", this.onFocus); this.triggerElement.addEventListener("click", this.onClick); this.triggerElement.addEventListener("contextmenu", this.onContextMenu); this.triggerElement.addEventListener("mouseenter", this.onMouseEnter); this.observeResize = observeResize(this.triggerElement, () => { this.updatePositioner(); }); }); } render() { return ke``; } /** * 获取 dropdown 打开、关闭动画的 CSS scaleX 或 scaleY */ getCssScaleName() { return this.animateDirection === "horizontal" ? "scaleX" : "scaleY"; } /** * 在 document 上点击时,根据条件判断是否要关闭 dropdown */ onDocumentClick(e2) { if (this.disabled || !this.open) { return; } const path = e2.composedPath(); if (!path.includes(this)) { this.open = false; } if (this.hasTrigger("contextmenu") && !this.hasTrigger("click") && path.includes(this.triggerElement)) { this.open = false; } } /** * 在 document 上按下按键时,根据条件判断是否要关闭 dropdown */ onDocumentKeydown(event) { var _a2; if (this.disabled || !this.open) { return; } if (event.key === "Escape") { this.open = false; return; } if (event.key === "Tab") { if (!this.hasTrigger("focus") && isFunction((_a2 = this.triggerElement) == null ? void 0 : _a2.focus)) { event.preventDefault(); } this.open = false; } } onWindowScroll() { window.requestAnimationFrame(() => this.onPositionChange()); } hasTrigger(trigger) { const triggers = this.trigger.split(" "); return triggers.includes(trigger); } onFocus() { if (this.disabled || this.open || !this.hasTrigger("focus")) { return; } this.open = true; } onClick(e2) { if (this.disabled || e2.button || !this.hasTrigger("click")) { return; } if (this.open && (this.hasTrigger("hover") || this.hasTrigger("focus"))) { return; } this.pointerOffsetX = e2.offsetX; this.pointerOffsetY = e2.offsetY; this.open = !this.open; } onPanelClick(e2) { if (!this.disabled && !this.stayOpenOnClick && $$1(e2.target).is("mdui-menu-item")) { this.open = false; } } onContextMenu(e2) { if (this.disabled || !this.hasTrigger("contextmenu")) { return; } e2.preventDefault(); this.pointerOffsetX = e2.offsetX; this.pointerOffsetY = e2.offsetY; this.open = true; } onMouseEnter() { if (this.disabled || !this.hasTrigger("hover")) { return; } window.clearTimeout(this.closeTimeout); if (this.openDelay) { this.openTimeout = window.setTimeout(() => { this.open = true; }, this.openDelay); } else { this.open = true; } } onMouseLeave() { if (this.disabled || !this.hasTrigger("hover")) { return; } window.clearTimeout(this.openTimeout); this.closeTimeout = window.setTimeout(() => { this.open = false; }, this.closeDelay || 50); } // 更新 panel 的位置 updatePositioner() { const $panel = $$1(this.panelRef.value); const $window = $$1(window); const panelElements = this.panelElements; const panelRect = { width: Math.max(...(panelElements == null ? void 0 : panelElements.map((panel) => panel.offsetWidth)) ?? []), height: panelElements == null ? void 0 : panelElements.map((panel) => panel.offsetHeight).reduce((total, height) => total + height, 0) }; const triggerClientRect = this.triggerElement.getBoundingClientRect(); const triggerRect = this.openOnPointer ? { top: this.pointerOffsetY + triggerClientRect.top, left: this.pointerOffsetX + triggerClientRect.left, width: 0, height: 0 } : triggerClientRect; const screenMargin = 8; let transformOriginX; let transformOriginY; let top; let left; let placement = this.placement; if (placement === "auto") { const windowWidth = $window.width(); const windowHeight = $window.height(); let position2; let alignment2; if (windowHeight - triggerRect.top - triggerRect.height > panelRect.height + screenMargin) { position2 = "bottom"; } else if (triggerRect.top > panelRect.height + screenMargin) { position2 = "top"; } else if (windowWidth - triggerRect.left - triggerRect.width > panelRect.width + screenMargin) { position2 = "right"; } else if (triggerRect.left > panelRect.width + screenMargin) { position2 = "left"; } else { position2 = "bottom"; } if (["top", "bottom"].includes(position2)) { if (windowWidth - triggerRect.left > panelRect.width + screenMargin) { alignment2 = "start"; } else if (triggerRect.left + triggerRect.width / 2 > panelRect.width / 2 + screenMargin && windowWidth - triggerRect.left - triggerRect.width / 2 > panelRect.width / 2 + screenMargin) { alignment2 = void 0; } else if (triggerRect.left + triggerRect.width > panelRect.width + screenMargin) { alignment2 = "end"; } else { alignment2 = "start"; } } else { if (windowHeight - triggerRect.top > panelRect.height + screenMargin) { alignment2 = "start"; } else if (triggerRect.top + triggerRect.height / 2 > panelRect.height / 2 + screenMargin && windowHeight - triggerRect.top - triggerRect.height / 2 > panelRect.height / 2 + screenMargin) { alignment2 = void 0; } else if (triggerRect.top + triggerRect.height > panelRect.height + screenMargin) { alignment2 = "end"; } else { alignment2 = "start"; } } placement = alignment2 ? [position2, alignment2].join("-") : position2; } const [position, alignment] = placement.split("-"); this.animateDirection = ["top", "bottom"].includes(position) ? "vertical" : "horizontal"; switch (position) { case "top": transformOriginY = "bottom"; top = triggerRect.top - panelRect.height; break; case "bottom": transformOriginY = "top"; top = triggerRect.top + triggerRect.height; break; default: transformOriginY = "center"; switch (alignment) { case "start": top = triggerRect.top; break; case "end": top = triggerRect.top + triggerRect.height - panelRect.height; break; default: top = triggerRect.top + triggerRect.height / 2 - panelRect.height / 2; break; } break; } switch (position) { case "left": transformOriginX = "right"; left = triggerRect.left - panelRect.width; break; case "right": transformOriginX = "left"; left = triggerRect.left + triggerRect.width; break; default: transformOriginX = "center"; switch (alignment) { case "start": left = triggerRect.left; break; case "end": left = triggerRect.left + triggerRect.width - panelRect.width; break; default: left = triggerRect.left + triggerRect.width / 2 - panelRect.width / 2; break; } break; } $panel.css({ top, left, transformOrigin: [transformOriginX, transformOriginY].join(" ") }); } }; Dropdown.styles = [componentStyle, style$9]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Dropdown.prototype, "open", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Dropdown.prototype, "disabled", void 0); __decorate([ n$1({ reflect: true }) ], Dropdown.prototype, "trigger", void 0); __decorate([ n$1({ reflect: true }) ], Dropdown.prototype, "placement", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "stay-open-on-click" }) ], Dropdown.prototype, "stayOpenOnClick", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "open-delay" }) ], Dropdown.prototype, "openDelay", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "close-delay" }) ], Dropdown.prototype, "closeDelay", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "open-on-pointer" }) ], Dropdown.prototype, "openOnPointer", void 0); __decorate([ o$1({ slot: "trigger", flatten: true }) ], Dropdown.prototype, "triggerElements", void 0); __decorate([ o$1({ flatten: true }) ], Dropdown.prototype, "panelElements", void 0); __decorate([ watch("placement", true), watch("openOnPointer", true) ], Dropdown.prototype, "onPositionChange", null); __decorate([ watch("open") ], Dropdown.prototype, "onOpenChange", null); Dropdown = __decorate([ t$1("mdui-dropdown") ], Dropdown); const delay = (duration = 0) => { return new Promise((resolve) => setTimeout(resolve, duration)); }; const style$8 = i$3`:host{--shape-corner-small:var(--mdui-shape-corner-small);--shape-corner-normal:var(--mdui-shape-corner-large);--shape-corner-large:var(--mdui-shape-corner-extra-large);position:relative;display:inline-block;flex-shrink:0;overflow:hidden;text-align:center;border-radius:var(--shape-corner-normal);cursor:pointer;-webkit-tap-highlight-color:transparent;transition-property:box-shadow;transition-timing-function:var(--mdui-motion-easing-emphasized);transition-duration:var(--mdui-motion-duration-medium4);width:3.5rem;height:3.5rem;box-shadow:var(--mdui-elevation-level3);font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.button{padding:0 1rem}:host([size=small]) .button{padding:0 .5rem}:host([size=large]) .button{padding:0 1.875rem}:host([lowered]){box-shadow:var(--mdui-elevation-level1)}:host([focus-visible]){box-shadow:var(--mdui-elevation-level3)}:host([lowered][focus-visible]){box-shadow:var(--mdui-elevation-level1)}:host([pressed]){box-shadow:var(--mdui-elevation-level3)}:host([lowered][pressed]){box-shadow:var(--mdui-elevation-level1)}:host([hover]){box-shadow:var(--mdui-elevation-level4)}:host([lowered][hover]){box-shadow:var(--mdui-elevation-level2)}:host([variant=primary]){color:rgb(var(--mdui-color-on-primary-container));background-color:rgb(var(--mdui-color-primary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-primary-container )}:host([variant=surface]){color:rgb(var(--mdui-color-primary));background-color:rgb(var(--mdui-color-surface-container-high));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([variant=surface][lowered]){background-color:rgb(var(--mdui-color-surface-container-low))}:host([variant=secondary]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-secondary-container )}:host([variant=tertiary]){color:rgb(var(--mdui-color-on-tertiary-container));background-color:rgb(var(--mdui-color-tertiary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-tertiary-container )}:host([size=small]){border-radius:var(--shape-corner-small);width:2.5rem;height:2.5rem}:host([size=large]){border-radius:var(--shape-corner-large);width:6rem;height:6rem}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){color:rgba(var(--mdui-color-on-surface),38%);background-color:rgba(var(--mdui-color-on-surface),12%);box-shadow:var(--mdui-elevation-level0)}:host([extended]){width:auto}.label{display:inline-flex;transition:opacity var(--mdui-motion-duration-short2) var(--mdui-motion-easing-linear) var(--mdui-motion-duration-short2);padding-left:.25rem;padding-right:.25rem}.has-icon .label{margin-left:.5rem}:host([size=small]) .has-icon .label{margin-left:.25rem}:host([size=large]) .has-icon .label{margin-left:1rem}:host(:not([extended])) .label{opacity:0;transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1)}:host([size=large]) .label{font-size:1.5em}.icon{display:inline-flex;font-size:1.71428571em}:host([size=large]) .icon{font-size:2.57142857em}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit}mdui-circular-progress{display:inline-flex;width:1.5rem;height:1.5rem}:host([size=large]) mdui-circular-progress{width:2.25rem;height:2.25rem}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}`; let Fab = class Fab2 extends ButtonBase { constructor() { super(...arguments); this.variant = "primary"; this.size = "normal"; this.extended = false; this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "icon"); this.definedController = new DefinedController(this, { relatedElements: [""] }); } get rippleElement() { return this.rippleRef.value; } /** * extended 变更时,设置动画 */ async onExtendedChange() { const hasUpdated = this.hasUpdated; if (this.extended) { this.style.width = `${this.scrollWidth}px`; } else { this.style.width = ""; } await this.definedController.whenDefined(); await this.updateComplete; if (this.extended && !hasUpdated) { this.style.width = `${this.scrollWidth}px`; } if (!hasUpdated) { await delay(); this.style.transitionProperty = "box-shadow, width, bottom, transform"; } } render() { const className2 = cc({ button: true, "has-icon": this.icon || this.hasSlotController.test("icon") }); return ke`${this.isButton() ? this.renderButton({ className: className2, part: "button", content: this.renderInner() }) : this.disabled || this.loading ? ke`${this.renderInner()}` : this.renderAnchor({ className: className2, part: "button", content: this.renderInner() })}`; } renderLabel() { return ke``; } renderIcon() { if (this.loading) { return this.renderLoading(); } return ke`${this.icon ? ke`` : nothingTemplate}`; } renderInner() { return [this.renderIcon(), this.renderLabel()]; } }; Fab.styles = [ButtonBase.styles, style$8]; __decorate([ n$1({ reflect: true }) ], Fab.prototype, "variant", void 0); __decorate([ n$1({ reflect: true }) ], Fab.prototype, "size", void 0); __decorate([ n$1({ reflect: true }) ], Fab.prototype, "icon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Fab.prototype, "extended", void 0); __decorate([ watch("extended") ], Fab.prototype, "onExtendedChange", null); Fab = __decorate([ t$1("mdui-fab") ], Fab); const layoutStyle = i$3`:host{position:relative;display:flex;flex:1 1 auto;overflow:hidden}:host([full-height]){height:100%}`; let Layout = class Layout2 extends MduiElement { constructor() { super(...arguments); this.fullHeight = false; } render() { return ke``; } }; Layout.styles = [componentStyle, layoutStyle]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "full-height" }) ], Layout.prototype, "fullHeight", void 0); Layout = __decorate([ t$1("mdui-layout") ], Layout); const layoutItemStyle = i$3`:host{display:flex;z-index:1}`; let LayoutItem = class LayoutItem2 extends LayoutItemBase { constructor() { super(...arguments); this.placement = "top"; } get layoutPlacement() { return this.placement; } // placement 变更时,需要重新调整布局 onPlacementChange() { var _a2; (_a2 = this.layoutManager) == null ? void 0 : _a2.updateLayout(this); } render() { return ke``; } }; LayoutItem.styles = [ componentStyle, layoutItemStyle ]; __decorate([ n$1({ reflect: true }) ], LayoutItem.prototype, "placement", void 0); __decorate([ watch("placement", true) ], LayoutItem.prototype, "onPlacementChange", null); LayoutItem = __decorate([ t$1("mdui-layout-item") ], LayoutItem); const layoutMainStyle = i$3`:host{flex:1 0 auto;max-width:100%;overflow:auto}`; let LayoutMain = class LayoutMain2 extends MduiElement { connectedCallback() { super.connectedCallback(); const parentElement = this.parentElement; if (isNodeName(parentElement, "mdui-layout")) { this.layoutManager = getLayout(parentElement); this.layoutManager.registerMain(this); } } disconnectedCallback() { super.disconnectedCallback(); if (this.layoutManager) { this.layoutManager.unregisterMain(); } } render() { return ke``; } }; LayoutMain.styles = [ componentStyle, layoutMainStyle ]; LayoutMain = __decorate([ t$1("mdui-layout-main") ], LayoutMain); const style$7 = i$3`:host{--shape-corner:var(--mdui-shape-corner-none);position:relative;display:inline-block;width:100%;overflow:hidden;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container-highest));height:.25rem}.determinate,.indeterminate{background-color:rgb(var(--mdui-color-primary))}.determinate{height:100%;transition:width var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard)}.indeterminate::before{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate 2s var(--mdui-motion-easing-linear) infinite;content:' '}.indeterminate::after{position:absolute;top:0;bottom:0;left:0;background-color:inherit;animation:mdui-comp-progress-indeterminate-short 2s var(--mdui-motion-easing-linear) infinite;content:' '}@keyframes mdui-comp-progress-indeterminate{0%{left:0;width:0}50%{left:30%;width:70%}75%{left:100%;width:0}}@keyframes mdui-comp-progress-indeterminate-short{0%{left:0;width:0}50%{left:0;width:0}75%{left:0;width:25%}100%{left:100%;width:0}}`; let LinearProgress = class LinearProgress2 extends MduiElement { constructor() { super(...arguments); this.max = 1; } render() { const isDeterminate = !isUndefined(this.value); if (isDeterminate) { const value = this.value; return ke`
`; } return ke`
`; } }; LinearProgress.styles = [componentStyle, style$7]; __decorate([ n$1({ type: Number, reflect: true }) ], LinearProgress.prototype, "max", void 0); __decorate([ n$1({ type: Number }) ], LinearProgress.prototype, "value", void 0); LinearProgress = __decorate([ t$1("mdui-linear-progress") ], LinearProgress); const listItemStyle = i$3`:host{--shape-corner:var(--mdui-shape-corner-none);--shape-corner-rounded:var(--mdui-shape-corner-extra-large);position:relative;display:block;border-radius:var(--shape-corner);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([rounded]),:host([rounded]) mdui-ripple{border-radius:var(--shape-corner-rounded)}:host([active]){background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-secondary-container )}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;text-decoration:none;color:inherit;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}:host([nonclickable]:not([href])) .container{cursor:auto;-webkit-user-select:auto;user-select:auto}.preset{display:flex;align-items:center;padding:.5rem 1.5rem .5rem 1rem;min-height:3.5rem}:host([alignment=start]) .preset{align-items:flex-start}:host([alignment=end]) .preset{align-items:flex-end}.body{display:flex;flex:1 1 100%;flex-direction:column;justify-content:center;min-width:0}.headline{display:block;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([active]) .headline{color:rgb(var(--mdui-color-on-secondary-container))}.description{display:none;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([disabled]) .description,:host([focused]) .description,:host([hover]) .description,:host([pressed]) .description{color:rgb(var(--mdui-color-on-surface))}.has-description .description{display:block}:host([description-line='1']) .description,:host([headline-line='1']) .headline{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([description-line='2']) .description,:host([description-line='3']) .description,:host([headline-line='2']) .headline,:host([headline-line='3']) .headline{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}:host([description-line='2']) .description,:host([headline-line='2']) .headline{-webkit-line-clamp:2}:host([description-line='3']) .description,:host([headline-line='3']) .headline{-webkit-line-clamp:3}.end-icon,.icon{display:flex;flex:0 0 auto;font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([focused]) .end-icon,:host([focused]) .icon,:host([hover]) .end-icon,:host([hover]) .icon,:host([pressed]) .end-icon,:host([pressed]) .icon{color:rgb(var(--mdui-color-on-surface))}:host([active]) .end-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}.end-icon mdui-icon,.icon mdui-icon,.is-end-icon ::slotted([slot=end-icon]),.is-icon ::slotted([slot=icon]){font-size:1.5rem}.has-icon .icon{margin-right:1rem}.has-icon ::slotted(mdui-checkbox[slot=icon]),.has-icon ::slotted(mdui-radio[slot=icon]){margin-left:-.5rem}.has-end-icon .end-icon{margin-left:1rem}.has-end-icon ::slotted(mdui-checkbox[slot=end-icon]),.has-end-icon ::slotted(mdui-radio[slot=end-icon]){margin-right:-.5rem}`; let ListItem = class ListItem2 extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) { constructor() { super(...arguments); this.disabled = false; this.active = false; this.nonclickable = false; this.rounded = false; this.alignment = "center"; this.rippleRef = ii(); this.itemRef = ii(); this.hasSlotController = new HasSlotController(this, "[default]", "description", "icon", "end-icon", "custom"); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.focusDisabled; } get focusElement() { return this.href && !this.disabled ? this.itemRef.value : this; } get focusDisabled() { return this.href ? this.disabled : this.disabled || this.nonclickable; } render() { const preset = !this.hasSlotController.test("custom"); const hasIcon = this.icon || this.hasSlotController.test("icon"); const hasEndIcon = this.endIcon || this.hasSlotController.test("end-icon"); const hasDescription = this.description || this.hasSlotController.test("description"); const className2 = cc({ container: true, preset, "has-icon": hasIcon, "has-end-icon": hasEndIcon, "has-description": hasDescription, // icon slot 中的元素是否为 mdui-icon 或 mdui-icon-* 组件 "is-icon": isNodeName(this.iconElements[0], "mdui-icon"), // end-icon slot 中的元素是否为 mdui-icon 或 mdui-icon-* 组件 "is-end-icon": getNodeName$1(this.endIconElements[0]).startsWith("mdui-icon-") }); return ke`${this.href && !this.disabled ? this.renderAnchor({ className: className2, content: this.renderInner(), part: "container", refDirective: Kt(this.itemRef) }) : ke`
${this.renderInner()}
`}`; } renderInner() { const hasDefaultSlot = this.hasSlotController.test("[default]"); return ke`${this.icon ? ke`` : nothingTemplate}
${hasDefaultSlot ? ke`` : ke`
${this.headline}
`}${this.description}
${this.endIcon ? ke`` : nothingTemplate}
`; } }; ListItem.styles = [ componentStyle, listItemStyle ]; __decorate([ n$1({ reflect: true }) ], ListItem.prototype, "headline", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "headline-line" }) ], ListItem.prototype, "headlineLine", void 0); __decorate([ n$1({ reflect: true }) ], ListItem.prototype, "description", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "description-line" }) ], ListItem.prototype, "descriptionLine", void 0); __decorate([ n$1({ reflect: true }) ], ListItem.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], ListItem.prototype, "endIcon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ListItem.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ListItem.prototype, "active", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ListItem.prototype, "nonclickable", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], ListItem.prototype, "rounded", void 0); __decorate([ n$1({ reflect: true }) ], ListItem.prototype, "alignment", void 0); __decorate([ o$1({ slot: "icon", flatten: true }) ], ListItem.prototype, "iconElements", void 0); __decorate([ o$1({ slot: "end-icon", flatten: true }) ], ListItem.prototype, "endIconElements", void 0); ListItem = __decorate([ t$1("mdui-list-item") ], ListItem); const listSubheaderStyle = i$3`:host{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:default;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);padding-left:1rem;padding-right:1.5rem;height:3.5rem;line-height:3.5rem}`; let ListSubheader = class ListSubheader2 extends MduiElement { render() { return ke``; } }; ListSubheader.styles = [ componentStyle, listSubheaderStyle ]; ListSubheader = __decorate([ t$1("mdui-list-subheader") ], ListSubheader); const listStyle = i$3`:host{display:block;padding:.5rem 0}::slotted(mdui-divider[middle]){margin-left:1rem;margin-right:1.5rem}`; let List = class List2 extends MduiElement { render() { return ke``; } }; List.styles = [componentStyle, listStyle]; List = __decorate([ t$1("mdui-list") ], List); let IconArrowRight = class IconArrowRight2 extends h { render() { return svgTag(''); } }; IconArrowRight.styles = style$e; IconArrowRight = __decorate([ t$1("mdui-icon-arrow-right") ], IconArrowRight); const menuItemStyle = i$3`:host{position:relative;display:block}:host([selected]){background-color:rgba(var(--mdui-color-primary),12%)}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}.preset{display:flex;align-items:center;text-decoration:none;height:3rem;padding:0 .75rem}.preset.dense{height:2rem}.label-container{flex:1 1 100%;min-width:0}.label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking)}.end-icon,.end-text,.icon,.selected-icon{display:none;flex:0 0 auto;color:rgb(var(--mdui-color-on-surface-variant))}.has-end-icon .end-icon,.has-end-text .end-text,.has-icon .icon,.has-icon .selected-icon{display:flex}.end-icon,.icon,.selected-icon{font-size:1.5rem}.end-icon::slotted(mdui-avatar),.icon::slotted(mdui-avatar),.selected-icon::slotted(mdui-avatar){width:1.5rem;height:1.5rem}.dense .end-icon,.dense .icon,.dense .selected-icon{font-size:1.125rem}.dense .end-icon::slotted(mdui-avatar),.dense .icon::slotted(mdui-avatar),.dense .selected-icon::slotted(mdui-avatar){width:1.125rem;height:1.125rem}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}.end-text{font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.icon,.selected-icon{margin-right:.75rem}.end-icon,.end-text{margin-left:.75rem}.arrow-right{color:rgb(var(--mdui-color-on-surface))}.submenu{--shape-corner:var(--mdui-shape-corner-extra-small);display:block;position:absolute;z-index:1;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);min-width:7rem;max-width:17.5rem;padding-top:.5rem;padding-bottom:.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.submenu::slotted(mdui-divider){margin-top:.5rem;margin-bottom:.5rem}`; let MenuItem = class MenuItem2 extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) { constructor() { super(); this.disabled = false; this.submenuOpen = false; this.selected = false; this.dense = false; this.focusable = false; this.key = uniqueId(); this.rippleRef = ii(); this.containerRef = ii(); this.submenuRef = ii(); this.hasSlotController = new HasSlotController(this, "[default]", "icon", "end-icon", "end-text", "submenu", "custom"); this.definedController = new DefinedController(this, { relatedElements: [""] }); this.onOuterClick = this.onOuterClick.bind(this); this.onFocus = this.onFocus.bind(this); this.onBlur = this.onBlur.bind(this); this.onClick = this.onClick.bind(this); this.onKeydown = this.onKeydown.bind(this); this.onMouseEnter = this.onMouseEnter.bind(this); this.onMouseLeave = this.onMouseLeave.bind(this); } get focusDisabled() { return this.disabled || !this.focusable; } get focusElement() { return this.href && !this.disabled ? this.containerRef.value : this; } get rippleDisabled() { return this.disabled; } get rippleElement() { return this.rippleRef.value; } get hasSubmenu() { return this.hasSlotController.test("submenu"); } async onOpenChange() { const hasUpdated = this.hasUpdated; if (!this.submenuOpen && !hasUpdated) { return; } await this.definedController.whenDefined(); if (!hasUpdated) { await this.updateComplete; } const easingLinear = getEasing(this, "linear"); const easingEmphasizedDecelerate = getEasing(this, "emphasized-decelerate"); const easingEmphasizedAccelerate = getEasing(this, "emphasized-accelerate"); if (this.submenuOpen) { if (hasUpdated) { const eventProceeded = this.emit("submenu-open", { cancelable: true }); if (!eventProceeded) { return; } } const duration = getDuration(this, "medium4"); await stopAnimations(this.submenuRef.value); this.submenuRef.value.hidden = false; this.updateSubmenuPositioner(); await Promise.all([ animateTo(this.submenuRef.value, [{ transform: "scaleY(0.45)" }, { transform: "scaleY(1)" }], { duration: hasUpdated ? duration : 0, easing: easingEmphasizedDecelerate }), animateTo(this.submenuRef.value, [{ opacity: 0 }, { opacity: 1, offset: 0.125 }, { opacity: 1 }], { duration: hasUpdated ? duration : 0, easing: easingLinear }) ]); if (hasUpdated) { this.emit("submenu-opened"); } } else { const eventProceeded = this.emit("submenu-close", { cancelable: true }); if (!eventProceeded) { return; } const duration = getDuration(this, "short4"); await stopAnimations(this.submenuRef.value); await Promise.all([ animateTo(this.submenuRef.value, [{ transform: "scaleY(1)" }, { transform: "scaleY(0.45)" }], { duration, easing: easingEmphasizedAccelerate }), animateTo(this.submenuRef.value, [{ opacity: 1 }, { opacity: 1, offset: 0.875 }, { opacity: 0 }], { duration, easing: easingLinear }) ]); if (this.submenuRef.value) { this.submenuRef.value.hidden = true; } this.emit("submenu-closed"); } } connectedCallback() { super.connectedCallback(); this.definedController.whenDefined().then(() => { document.addEventListener("pointerdown", this.onOuterClick); }); } disconnectedCallback() { super.disconnectedCallback(); document.removeEventListener("pointerdown", this.onOuterClick); } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.definedController.whenDefined().then(() => { this.addEventListener("focus", this.onFocus); this.addEventListener("blur", this.onBlur); this.addEventListener("click", this.onClick); this.addEventListener("keydown", this.onKeydown); this.addEventListener("mouseenter", this.onMouseEnter); this.addEventListener("mouseleave", this.onMouseLeave); }); } render() { const hasSubmenu = this.hasSubmenu; const hasCustomSlot = this.hasSlotController.test("custom"); const hasEndIconSlot = this.hasSlotController.test("end-icon"); const useDefaultEndIcon = !this.endIcon && hasSubmenu && !hasEndIconSlot; const hasEndIcon = this.endIcon || hasSubmenu || hasEndIconSlot; const hasIcon = !isUndefined(this.icon) || this.selects === "single" || this.selects === "multiple" || this.hasSlotController.test("icon"); const hasEndText = !!this.endText || this.hasSlotController.test("end-text"); const className2 = cc({ container: true, dense: this.dense, preset: !hasCustomSlot, "has-icon": hasIcon, "has-end-text": hasEndText, "has-end-icon": hasEndIcon }); return ke`${this.href && !this.disabled ? this.renderAnchor({ part: "container", className: className2, content: this.renderInner(useDefaultEndIcon, hasIcon), refDirective: Kt(this.containerRef), tabIndex: this.focusable ? 0 : -1 }) : ke`
${this.renderInner(useDefaultEndIcon, hasIcon)}
`} ${nn(hasSubmenu, () => ke``)}`; } /** * 点击子菜单外面的区域,关闭子菜单 */ onOuterClick(event) { if (!this.disabled && this.submenuOpen && this !== event.target && !$$1.contains(this, event.target)) { this.submenuOpen = false; } } hasTrigger(trigger) { return this.submenuTrigger ? this.submenuTrigger.split(" ").includes(trigger) : false; } onFocus() { if (this.disabled || this.submenuOpen || !this.hasTrigger("focus") || !this.hasSubmenu) { return; } this.submenuOpen = true; } onBlur() { if (this.disabled || !this.submenuOpen || !this.hasTrigger("focus") || !this.hasSubmenu) { return; } this.submenuOpen = false; } onClick(event) { if (this.disabled || event.button) { return; } if (!this.hasTrigger("click") || event.target !== this || !this.hasSubmenu) { return; } if (this.submenuOpen && (this.hasTrigger("hover") || this.hasTrigger("focus"))) { return; } this.submenuOpen = !this.submenuOpen; } onKeydown(event) { if (this.disabled || !this.hasSubmenu) { return; } if (!this.submenuOpen && event.key === "Enter") { event.stopPropagation(); this.submenuOpen = true; } if (this.submenuOpen && event.key === "Escape") { event.stopPropagation(); this.submenuOpen = false; } } onMouseEnter() { if (this.disabled || !this.hasTrigger("hover") || !this.hasSubmenu) { return; } window.clearTimeout(this.submenuCloseTimeout); if (this.submenuOpenDelay) { this.submenuOpenTimeout = window.setTimeout(() => { this.submenuOpen = true; }, this.submenuOpenDelay); } else { this.submenuOpen = true; } } onMouseLeave() { if (this.disabled || !this.hasTrigger("hover") || !this.hasSubmenu) { return; } window.clearTimeout(this.submenuOpenTimeout); this.submenuCloseTimeout = window.setTimeout(() => { this.submenuOpen = false; }, this.submenuCloseDelay || 50); } // 更新子菜单的位置 updateSubmenuPositioner() { const $window = $$1(window); const $submenu = $$1(this.submenuRef.value); const itemRect = this.getBoundingClientRect(); const submenuWidth = $submenu.innerWidth(); const submenuHeight = $submenu.innerHeight(); const screenMargin = 8; let placementX = "bottom"; let placementY = "right"; if ($window.height() - itemRect.top > submenuHeight + screenMargin) { placementX = "bottom"; } else if (itemRect.top + itemRect.height > submenuHeight + screenMargin) { placementX = "top"; } if ($window.width() - itemRect.left - itemRect.width > submenuWidth + screenMargin) { placementY = "right"; } else if (itemRect.left > submenuWidth + screenMargin) { placementY = "left"; } $$1(this.submenuRef.value).css({ top: placementX === "bottom" ? 0 : itemRect.height - submenuHeight, left: placementY === "right" ? itemRect.width : -submenuWidth, transformOrigin: [ placementY === "right" ? 0 : "100%", placementX === "bottom" ? 0 : "100%" ].join(" ") }); } renderInner(useDefaultEndIcon, hasIcon) { return ke`${this.selected ? ke`${this.selectedIcon ? ke`` : ke``}` : ke`${hasIcon ? ke`` : nothingTemplate}`}
${this.endText}${useDefaultEndIcon ? ke`` : ke`${this.endIcon ? ke`` : nothingTemplate}`}
`; } }; MenuItem.styles = [ componentStyle, menuItemStyle ]; __decorate([ n$1({ reflect: true }) ], MenuItem.prototype, "value", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], MenuItem.prototype, "disabled", void 0); __decorate([ n$1({ reflect: true }) ], MenuItem.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], MenuItem.prototype, "endIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-text" }) ], MenuItem.prototype, "endText", void 0); __decorate([ n$1({ reflect: true, attribute: "selected-icon" }) ], MenuItem.prototype, "selectedIcon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "submenu-open" }) ], MenuItem.prototype, "submenuOpen", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], MenuItem.prototype, "selected", void 0); __decorate([ r$1() ], MenuItem.prototype, "dense", void 0); __decorate([ r$1() ], MenuItem.prototype, "selects", void 0); __decorate([ r$1() ], MenuItem.prototype, "submenuTrigger", void 0); __decorate([ r$1() ], MenuItem.prototype, "submenuOpenDelay", void 0); __decorate([ r$1() ], MenuItem.prototype, "submenuCloseDelay", void 0); __decorate([ r$1() ], MenuItem.prototype, "focusable", void 0); __decorate([ watch("submenuOpen") ], MenuItem.prototype, "onOpenChange", null); MenuItem = __decorate([ t$1("mdui-menu-item") ], MenuItem); const menuStyle = i$3`:host{--shape-corner:var(--mdui-shape-corner-extra-small);position:relative;display:block;border-radius:var(--shape-corner);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);min-width:7rem;max-width:17.5rem;padding-top:.5rem;padding-bottom:.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}::slotted(mdui-divider){margin-top:.5rem;margin-bottom:.5rem}`; let Menu = class Menu2 extends MduiElement { constructor() { super(...arguments); this.dense = false; this.submenuTrigger = "click hover"; this.submenuOpenDelay = 200; this.submenuCloseDelay = 200; this.selectedKeys = []; this.isInitial = true; this.lastActiveItems = []; this.definedController = new DefinedController(this, { relatedElements: ["mdui-menu-item"] }); } // 菜单项元素(包含子菜单中的菜单项) get items() { return $$1(this.childrenItems).find("mdui-menu-item").add(this.childrenItems).get(); } // 菜单项元素(不包含已禁用的,包含子菜单中的菜单项) get itemsEnabled() { return this.items.filter((item) => !item.disabled); } // 当前菜单是否为单选 get isSingle() { return this.selects === "single"; } // 当前菜单是否为多选 get isMultiple() { return this.selects === "multiple"; } // 当前菜单是否可选择 get isSelectable() { return this.isSingle || this.isMultiple; } // 当前菜单是否为子菜单 get isSubmenu() { return !$$1(this).parent().length; } // 最深层级的子菜单中,最后交互过的 menu-item get lastActiveItem() { const index = this.lastActiveItems.length ? this.lastActiveItems.length - 1 : 0; return this.lastActiveItems[index]; } set lastActiveItem(item) { const index = this.lastActiveItems.length ? this.lastActiveItems.length - 1 : 0; this.lastActiveItems[index] = item; } async onSlotChange() { await this.definedController.whenDefined(); this.items.forEach((item) => { item.dense = this.dense; item.selects = this.selects; item.submenuTrigger = this.submenuTrigger; item.submenuOpenDelay = this.submenuOpenDelay; item.submenuCloseDelay = this.submenuCloseDelay; }); } async onSelectsChange() { if (!this.isSelectable) { this.setSelectedKeys([]); } else if (this.isSingle) { this.setSelectedKeys(this.selectedKeys.slice(0, 1)); } await this.onSelectedKeysChange(); } async onSelectedKeysChange() { await this.definedController.whenDefined(); const values = this.itemsEnabled.filter((item) => this.selectedKeys.includes(item.key)).map((item) => item.value); const value = this.isMultiple ? values : values[0] || void 0; this.setValue(value); if (!this.isInitial) { this.emit("change"); } } async onValueChange() { this.isInitial = !this.hasUpdated; await this.definedController.whenDefined(); if (!this.isSelectable) { this.updateSelected(); return; } const values = (this.isSingle ? [this.value] : ( // 多选时,传入的值可能是字符串(通过 attribute 属性设置);或字符串数组(通过 property 属性设置) isString(this.value) ? [this.value] : this.value )).filter((i3) => i3); if (!values.length) { this.setSelectedKeys([]); } else if (this.isSingle) { const firstItem = this.itemsEnabled.find((item) => item.value === values[0]); this.setSelectedKeys(firstItem ? [firstItem.key] : []); } else if (this.isMultiple) { this.setSelectedKeys(this.itemsEnabled.filter((item) => values.includes(item.value)).map((item) => item.key)); } this.updateSelected(); this.updateFocusable(); } /** * 将焦点设置在当前元素上 */ focus(options) { if (this.lastActiveItem) { this.focusOne(this.lastActiveItem, options); } } /** * 从当前元素中移除焦点 */ blur() { if (this.lastActiveItem) { this.lastActiveItem.blur(); } } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.definedController.whenDefined().then(() => { this.updateFocusable(); this.lastActiveItem = this.items.find((item) => item.focusable); }); this.addEventListener("submenu-open", (e2) => { const $parentItem = $$1(e2.target); const submenuItemsEnabled = $parentItem.children("mdui-menu-item:not([disabled])").get(); const submenuLevel = $parentItem.parents("mdui-menu-item").length + 1; if (submenuItemsEnabled.length) { this.lastActiveItems[submenuLevel] = submenuItemsEnabled[0]; this.updateFocusable(); this.focusOne(this.lastActiveItems[submenuLevel]); } }); this.addEventListener("submenu-close", (e2) => { const $parentItem = $$1(e2.target); const submenuLevel = $parentItem.parents("mdui-menu-item").length + 1; if (this.lastActiveItems.length - 1 === submenuLevel) { this.lastActiveItems.pop(); this.updateFocusable(); if (this.lastActiveItems[submenuLevel - 1]) { this.focusOne(this.lastActiveItems[submenuLevel - 1]); } } }); } render() { return ke``; } setSelectedKeys(selectedKeys) { if (!arraysEqualIgnoreOrder(this.selectedKeys, selectedKeys)) { this.selectedKeys = selectedKeys; } } setValue(value) { if (this.isSingle || isUndefined(this.value) || isUndefined(value)) { this.value = value; } else if (!arraysEqualIgnoreOrder(this.value, value)) { this.value = value; } } // 获取和指定菜单项同级的所有菜单项 getSiblingsItems(item, onlyEnabled = false) { return $$1(item).parent().children(`mdui-menu-item${onlyEnabled ? ":not([disabled])" : ""}`).get(); } // 更新 menu-item 的可聚焦状态 updateFocusable() { if (this.lastActiveItem) { this.items.forEach((item) => { item.focusable = item.key === this.lastActiveItem.key; }); return; } if (!this.selectedKeys.length) { this.itemsEnabled.forEach((item, index) => { item.focusable = !index; }); return; } if (this.isSingle) { this.items.forEach((item) => { item.focusable = this.selectedKeys.includes(item.key); }); return; } if (this.isMultiple) { const focusableItem = this.items.find((item) => item.focusable); if (!(focusableItem == null ? void 0 : focusableItem.key) || !this.selectedKeys.includes(focusableItem.key)) { this.itemsEnabled.filter((item) => this.selectedKeys.includes(item.key)).forEach((item, index) => item.focusable = !index); } } } updateSelected() { this.items.forEach((item) => { item.selected = this.selectedKeys.includes(item.key); }); } // 切换一个菜单项的选中状态 selectOne(item) { if (this.isMultiple) { const selectedKeys = [...this.selectedKeys]; if (selectedKeys.includes(item.key)) { selectedKeys.splice(selectedKeys.indexOf(item.key), 1); } else { selectedKeys.push(item.key); } this.setSelectedKeys(selectedKeys); } if (this.isSingle) { if (this.selectedKeys.includes(item.key)) { this.setSelectedKeys([]); } else { this.setSelectedKeys([item.key]); } } this.isInitial = false; this.updateSelected(); } // 使一个 menu-item 可聚焦 async focusableOne(item) { this.items.forEach((_item) => _item.focusable = _item.key === item.key); await delay(); } // 聚焦一个 menu-item focusOne(item, options) { item.focus(options); } async onClick(event) { if (!this.definedController.isDefined()) { return; } if (this.isSubmenu) { return; } if (event.button) { return; } const target = event.target; const item = target.closest("mdui-menu-item"); if (!item || item.disabled) { return; } this.lastActiveItem = item; if (this.isSelectable && item.value) { this.selectOne(item); } await this.focusableOne(item); this.focusOne(item); } async onKeyDown(event) { if (!this.definedController.isDefined()) { return; } if (this.isSubmenu) { return; } const item = event.target; if (event.key === "Enter") { event.preventDefault(); item.click(); } if (event.key === " ") { event.preventDefault(); if (this.isSelectable && item.value) { this.selectOne(item); await this.focusableOne(item); this.focusOne(item); } } if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) { const items = this.getSiblingsItems(item, true); const activeItem = items.find((item2) => item2.focusable); let index = activeItem ? items.indexOf(activeItem) : 0; if (items.length > 0) { event.preventDefault(); if (event.key === "ArrowDown") { index++; } else if (event.key === "ArrowUp") { index--; } else if (event.key === "Home") { index = 0; } else if (event.key === "End") { index = items.length - 1; } if (index < 0) { index = items.length - 1; } if (index > items.length - 1) { index = 0; } this.lastActiveItem = items[index]; await this.focusableOne(items[index]); this.focusOne(items[index]); return; } } } }; Menu.styles = [componentStyle, menuStyle]; __decorate([ n$1({ reflect: true }) // eslint-disable-next-line prettier/prettier ], Menu.prototype, "selects", void 0); __decorate([ n$1() ], Menu.prototype, "value", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Menu.prototype, "dense", void 0); __decorate([ n$1({ reflect: true, attribute: "submenu-trigger" }) ], Menu.prototype, "submenuTrigger", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "submenu-open-delay" }) ], Menu.prototype, "submenuOpenDelay", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "submenu-close-delay" }) ], Menu.prototype, "submenuCloseDelay", void 0); __decorate([ r$1() ], Menu.prototype, "selectedKeys", void 0); __decorate([ o$1({ flatten: true, selector: "mdui-menu-item" }) ], Menu.prototype, "childrenItems", void 0); __decorate([ watch("dense"), watch("selects"), watch("submenuTrigger"), watch("submenuOpenDelay"), watch("submenuCloseDelay") ], Menu.prototype, "onSlotChange", null); __decorate([ watch("selects", true) ], Menu.prototype, "onSelectsChange", null); __decorate([ watch("selectedKeys", true) ], Menu.prototype, "onSelectedKeysChange", null); __decorate([ watch("value") ], Menu.prototype, "onValueChange", null); Menu = __decorate([ t$1("mdui-menu") ], Menu); const navigationBarItemStyle = i$3`:host{--shape-corner-indicator:var(--mdui-shape-corner-full);position:relative;z-index:0;flex:1;overflow:hidden;min-width:3rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}.container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-decoration:none;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;padding-top:.75rem;padding-bottom:.75rem}.container:not(.initial){transition:padding var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}mdui-ripple{z-index:1;left:50%;transform:translateX(-50%);width:4rem;height:2rem;margin-top:.75rem;border-radius:var(--mdui-shape-corner-full)}mdui-ripple:not(.initial){transition:margin-top var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.indicator{position:relative;display:flex;align-items:center;justify-content:center;background-color:transparent;border-radius:var(--shape-corner-indicator);height:2rem;width:2rem}:not(.initial) .indicator{transition:background-color var(--mdui-motion-duration-short1) var(--mdui-motion-easing-standard),width var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}::slotted([slot=badge]){position:absolute;transform:translate(50%,-50%)}::slotted([slot=badge][variant=small]){transform:translate(.5625rem,-.5625rem)}.active-icon,.icon{color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}.active-icon mdui-icon,.icon mdui-icon,::slotted([slot=active]),::slotted([slot=icon]){font-size:inherit}.icon{display:flex}.active-icon{display:none}.label{display:flex;align-items:center;height:1rem;color:rgb(var(--mdui-color-on-surface-variant));margin-top:.25rem;margin-bottom:.25rem;font-size:var(--mdui-typescale-label-medium-size);font-weight:var(--mdui-typescale-label-medium-weight);letter-spacing:var(--mdui-typescale-label-medium-tracking);line-height:var(--mdui-typescale-label-medium-line-height)}:not(.initial) .label{transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear)}:host(:not([active])) mdui-ripple.label-visibility-selected,mdui-ripple.label-visibility-unlabeled{margin-top:1.5rem}.container.label-visibility-unlabeled,:host(:not([active])) .container.label-visibility-selected{padding-top:1.5rem;padding-bottom:0}.container.label-visibility-unlabeled .label,:host(:not([active])) .container.label-visibility-selected .label{opacity:0}:host([active]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([active]) .indicator{width:4rem;background-color:rgb(var(--mdui-color-secondary-container))}:host([active]) .active-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}:host([active]) .has-active-icon .active-icon{display:flex}:host([active]) .has-active-icon .icon{display:none}:host([active]) .label{color:rgb(var(--mdui-color-on-surface))}`; let NavigationBarItem = class NavigationBarItem2 extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) { constructor() { super(...arguments); this.isInitial = true; this.active = false; this.disabled = false; this.key = uniqueId(); this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "active-icon"); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.disabled; } get focusElement() { var _a2; return this.href ? (_a2 = this.renderRoot) == null ? void 0 : _a2.querySelector("._a") : this; } get focusDisabled() { return this.disabled; } render() { const labelVisibilityClassName = cc({ "label-visibility-selected": this.labelVisibility === "selected", "label-visibility-labeled": this.labelVisibility === "labeled", "label-visibility-unlabeled": this.labelVisibility === "unlabeled", initial: this.isInitial }); const className2 = cc([ { container: true, "has-active-icon": this.activeIcon || this.hasSlotController.test("active-icon") }, labelVisibilityClassName ]); return ke`${this.href ? this.renderAnchor({ part: "container", className: className2, content: this.renderInner() }) : ke`
${this.renderInner()}
`}`; } renderInner() { return ke`
${this.activeIcon ? ke`` : nothingTemplate}${this.icon ? ke`` : nothingTemplate}
`; } }; NavigationBarItem.styles = [ componentStyle, navigationBarItemStyle ]; __decorate([ n$1({ reflect: true }) ], NavigationBarItem.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "active-icon" }) ], NavigationBarItem.prototype, "activeIcon", void 0); __decorate([ n$1({ reflect: true }) ], NavigationBarItem.prototype, "value", void 0); __decorate([ r$1() ], NavigationBarItem.prototype, "labelVisibility", void 0); __decorate([ r$1() ], NavigationBarItem.prototype, "isInitial", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationBarItem.prototype, "active", void 0); __decorate([ r$1() ], NavigationBarItem.prototype, "disabled", void 0); NavigationBarItem = __decorate([ t$1("mdui-navigation-bar-item") ], NavigationBarItem); const navigationBarStyle = i$3`:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;right:0;bottom:0;left:0;display:flex;flex:0 0 auto;overflow:hidden;border-radius:var(--shape-corner) var(--shape-corner) 0 0;z-index:var(--z-index);transition-property:transform;transition-duration:var(--mdui-motion-duration-long2);transition-timing-function:var(--mdui-motion-easing-emphasized);height:5rem;background-color:rgb(var(--mdui-color-surface));box-shadow:var(--mdui-elevation-level2)}:host([scroll-target]:not([scroll-target=''])){position:absolute}:host([hide]){transform:translateY(5.625rem);transition-duration:var(--mdui-motion-duration-short4)}`; let NavigationBar = class NavigationBar2 extends ScrollBehaviorMixin(LayoutItemBase) { constructor() { super(...arguments); this.hide = false; this.labelVisibility = "auto"; this.activeKey = 0; this.isInitial = true; this.definedController = new DefinedController(this, { relatedElements: ["mdui-navigation-bar-item"] }); } get scrollPaddingPosition() { return "bottom"; } get layoutPlacement() { return "bottom"; } async onActiveKeyChange() { await this.definedController.whenDefined(); const item = this.items.find((item2) => item2.key === this.activeKey); this.value = item == null ? void 0 : item.value; if (!this.isInitial) { this.emit("change"); } } async onValueChange() { this.isInitial = !this.hasUpdated; await this.definedController.whenDefined(); const item = this.items.find((item2) => item2.value === this.value); this.activeKey = (item == null ? void 0 : item.key) ?? 0; this.updateItems(); } async onLabelVisibilityChange() { await this.definedController.whenDefined(); this.updateItems(); } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); this.addEventListener("transitionend", (event) => { if (event.target === this) { this.emit(this.hide ? "hidden" : "shown"); } }); } render() { return ke``; } /** * 滚动行为 * 当前仅支持 hide 这一个行为,所以不做行为类型判断 */ runScrollThreshold(isScrollingUp) { if (!isScrollingUp && !this.hide) { const eventProceeded = this.emit("hide", { cancelable: true }); if (eventProceeded) { this.hide = true; } } if (isScrollingUp && this.hide) { const eventProceeded = this.emit("show", { cancelable: true }); if (eventProceeded) { this.hide = false; } } } onClick(event) { if (event.button) { return; } const target = event.target; const item = target.closest("mdui-navigation-bar-item"); if (!item) { return; } this.activeKey = item.key; this.isInitial = false; this.updateItems(); } // 更新 的状态 updateItems() { const items = this.items; const labelVisibility = this.labelVisibility === "auto" ? items.length <= 3 ? "labeled" : "selected" : this.labelVisibility; items.forEach((item) => { item.active = this.activeKey === item.key; item.labelVisibility = labelVisibility; item.isInitial = this.isInitial; }); } async onSlotChange() { await this.definedController.whenDefined(); this.updateItems(); } }; NavigationBar.styles = [ componentStyle, navigationBarStyle ]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationBar.prototype, "hide", void 0); __decorate([ n$1({ reflect: true, attribute: "label-visibility" }) ], NavigationBar.prototype, "labelVisibility", void 0); __decorate([ n$1({ reflect: true }) ], NavigationBar.prototype, "value", void 0); __decorate([ n$1({ reflect: true, attribute: "scroll-behavior" }) ], NavigationBar.prototype, "scrollBehavior", void 0); __decorate([ r$1() ], NavigationBar.prototype, "activeKey", void 0); __decorate([ o$1({ selector: "mdui-navigation-bar-item", flatten: true }) ], NavigationBar.prototype, "items", void 0); __decorate([ watch("activeKey", true) ], NavigationBar.prototype, "onActiveKeyChange", null); __decorate([ watch("value") ], NavigationBar.prototype, "onValueChange", null); __decorate([ watch("labelVisibility", true) ], NavigationBar.prototype, "onLabelVisibilityChange", null); NavigationBar = __decorate([ t$1("mdui-navigation-bar") ], NavigationBar); const breakpoint = (width) => { const window2 = getWindow$1(); const document2 = getDocument(); const computedStyle = window2.getComputedStyle(document2.documentElement); const containerWidth = isElement(width) ? $$1(width).innerWidth() : isNumber(width) ? width : $$1(window2).innerWidth(); const getBreakpointValue = (breakpoint2) => { const width2 = computedStyle.getPropertyValue(`--mdui-breakpoint-${breakpoint2}`).toLowerCase(); return parseFloat(width2); }; const getNextBreakpoint = (breakpoint2) => { switch (breakpoint2) { case "xs": return "sm"; case "sm": return "md"; case "md": return "lg"; case "lg": return "xl"; case "xl": return "xxl"; } }; return { /** * 当前宽度是否大于指定断点值 * @param breakpoint */ up(breakpoint2) { return containerWidth >= getBreakpointValue(breakpoint2); }, /** * 当前宽度是否小于指定断点值 * @param breakpoint */ down(breakpoint2) { return containerWidth < getBreakpointValue(breakpoint2); }, /** * 当前宽度是否在指定断点值内 * @param breakpoint */ only(breakpoint2) { if (breakpoint2 === "xxl") { return this.up(breakpoint2); } else { return this.up(breakpoint2) && this.down(getNextBreakpoint(breakpoint2)); } }, /** * 当前宽度是否不在指定断点值内 * @param breakpoint */ not(breakpoint2) { return !this.only(breakpoint2); }, /** * 当前宽度是否在指定断点值之间 * @param startBreakpoint * @param endBreakpoint * @returns */ between(startBreakpoint, endBreakpoint) { return this.up(startBreakpoint) && this.down(endBreakpoint); } }; }; const style$6 = i$3`:host{--shape-corner:var(--mdui-shape-corner-large);--z-index:2200;display:none;position:fixed;top:0;bottom:0;left:0;z-index:1;width:22.5rem}:host([placement=right]){left:initial;right:0}:host([mobile]),:host([modal]){top:0!important;right:0;bottom:0!important;width:initial;z-index:var(--z-index)}:host([placement=right][mobile]),:host([placement=right][modal]){left:0}:host([contained]){position:absolute}.overlay{position:absolute;inset:0;z-index:inherit;background-color:rgba(var(--mdui-color-scrim),.4)}.panel{display:block;position:absolute;top:0;bottom:0;left:0;width:100%;overflow:auto;z-index:inherit;background-color:rgb(var(--mdui-color-surface));box-shadow:var(--mdui-elevation-level0)}:host([mobile]) .panel,:host([modal]) .panel{border-radius:0 var(--shape-corner) var(--shape-corner) 0;max-width:80%;width:22.5rem;background-color:rgb(var(--mdui-color-surface-container-low));box-shadow:var(--mdui-elevation-level1)}:host([placement=right]) .panel{left:initial;right:0}:host([placement=right][mobile]) .panel,:host([placement=right][modal]) .panel{border-radius:var(--shape-corner) 0 0 var(--shape-corner)}`; let NavigationDrawer = class NavigationDrawer2 extends LayoutItemBase { constructor() { super(...arguments); this.open = false; this.modal = false; this.closeOnEsc = false; this.closeOnOverlayClick = false; this.placement = "left"; this.contained = false; this.mobile = false; this.overlayRef = ii(); this.panelRef = ii(); this.definedController = new DefinedController(this, { needDomReady: true }); } get layoutPlacement() { return this.placement; } get lockTarget() { return this.contained || this.isParentLayout ? this.parentElement : document.documentElement; } get isModal() { return this.mobile || this.modal; } // contained 变更后,修改监听尺寸变化的元素。为 true 时,监听父元素;为 false 时,监听 body async onContainedChange() { var _a2; await this.definedController.whenDefined(); (_a2 = this.observeResize) == null ? void 0 : _a2.unobserve(); this.observeResize = observeResize(this.contained ? this.parentElement : document.documentElement, () => { const target = this.contained ? this.parentElement : void 0; this.mobile = breakpoint(target).down("md"); if (this.isParentLayout) { this.layoutManager.updateLayout(this, { width: this.isModal ? 0 : void 0 }); } }); } onPlacementChange() { if (this.isParentLayout) { this.layoutManager.updateLayout(this); } } async onMobileChange() { if (!this.open || this.isParentLayout || this.contained) { return; } await this.definedController.whenDefined(); if (this.isModal) { lockScreen(this, this.lockTarget); await this.getLockTargetAnimate(false, 0); } else { unlockScreen(this, this.lockTarget); await this.getLockTargetAnimate(true, 0); } } async onOpenChange() { let panel = this.panelRef.value; let overlay = this.overlayRef.value; const isRight = this.placement === "right"; const easingLinear = getEasing(this, "linear"); const easingEmphasized = getEasing(this, "emphasized"); const setLayoutTransition = (duration, easing) => { $$1(this.layoutManager.getItemsAndMain()).css("transition", isNull(duration) ? null : `all ${duration}ms ${easing}`); }; const stopOldAnimations = async () => { const elements = []; if (this.isModal) { elements.push(overlay, panel); } else if (!this.isParentLayout) { elements.push(this.lockTarget); } if (this.isParentLayout) { const layoutItems = this.layoutManager.getItemsAndMain(); const layoutIndex = layoutItems.indexOf(this); elements.push(...layoutItems.slice(layoutIndex)); } if (!this.isModal && !elements.includes(this)) { elements.push(this); } await Promise.all(elements.map((element) => stopAnimations(element))); }; if (this.open) { const hasUpdated = this.hasUpdated; if (!hasUpdated) { await this.updateComplete; panel = this.panelRef.value; overlay = this.overlayRef.value; } if (hasUpdated) { const eventProceeded = this.emit("open", { cancelable: true }); if (!eventProceeded) { return; } } await this.definedController.whenDefined(); this.style.display = "block"; this.originalTrigger = document.activeElement; if (this.isModal) { this.modalHelper.activate(); if (!this.contained) { lockScreen(this, this.lockTarget); } } await stopOldAnimations(); requestAnimationFrame(() => { const autoFocusTarget = this.querySelector("[autofocus]"); if (autoFocusTarget) { autoFocusTarget.focus({ preventScroll: true }); } else { panel.focus({ preventScroll: true }); } }); const duration = getDuration(this, "long2"); const animations = []; if (this.isModal) { animations.push(animateTo(overlay, [{ opacity: 0 }, { opacity: 1, offset: 0.3 }, { opacity: 1 }], { duration: hasUpdated ? duration : 0, easing: easingLinear })); } else if (!this.isParentLayout) { animations.push(this.getLockTargetAnimate(true, hasUpdated ? duration : 0)); } if (this.isParentLayout && hasUpdated) { setLayoutTransition(duration, easingEmphasized); this.layoutManager.updateLayout(this); } animations.push(animateTo(this.isModal ? panel : this, [ { transform: `translateX(${isRight ? "" : "-"}100%)` }, { transform: "translateX(0)" } ], { duration: hasUpdated ? duration : 0, easing: easingEmphasized })); await Promise.all(animations); if (!this.open) { return; } if (this.isParentLayout && hasUpdated) { setLayoutTransition(null); } if (hasUpdated) { this.emit("opened"); } } else if (this.hasUpdated) { const eventProceeded = this.emit("close", { cancelable: true }); if (!eventProceeded) { return; } await this.definedController.whenDefined(); if (this.isModal) { this.modalHelper.deactivate(); } await stopOldAnimations(); const duration = getDuration(this, "short4"); const animations = []; if (this.isModal) { animations.push(animateTo(overlay, [{ opacity: 1 }, { opacity: 0 }], { duration, easing: easingLinear })); } else if (!this.isParentLayout) { animations.push(this.getLockTargetAnimate(false, duration)); } if (this.isParentLayout) { setLayoutTransition(duration, easingEmphasized); this.layoutManager.updateLayout(this, { width: 0 }); } animations.push(animateTo(this.isModal ? panel : this, [ { transform: "translateX(0)" }, { transform: `translateX(${isRight ? "" : "-"}100%)` } ], { duration, easing: easingEmphasized })); await Promise.all(animations); if (this.open) { return; } if (this.isParentLayout) { setLayoutTransition(null); } this.style.display = "none"; if (this.isModal && !this.contained) { unlockScreen(this, this.lockTarget); } const trigger = this.originalTrigger; if (isFunction(trigger == null ? void 0 : trigger.focus)) { setTimeout(() => trigger.focus()); } this.emit("closed"); } } connectedCallback() { super.connectedCallback(); this.modalHelper = new Modal(this); } disconnectedCallback() { var _a2; super.disconnectedCallback(); unlockScreen(this, this.lockTarget); (_a2 = this.observeResize) == null ? void 0 : _a2.unobserve(); } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); this.addEventListener("keydown", (event) => { if (this.open && this.closeOnEsc && event.key === "Escape" && this.isModal) { event.stopPropagation(); this.open = false; } }); } render() { return ke`${nn(this.isModal, () => ke`
`)}`; } onOverlayClick() { this.emit("overlay-click"); if (this.closeOnOverlayClick) { this.open = false; } } getLockTargetAnimate(open2, duration) { const paddingName = this.placement === "right" ? "paddingRight" : "paddingLeft"; const panelWidth = $$1(this.panelRef.value).innerWidth() + "px"; return animateTo(this.lockTarget, [ { [paddingName]: open2 ? 0 : panelWidth }, { [paddingName]: open2 ? panelWidth : 0 } ], { duration, easing: getEasing(this, "emphasized"), fill: "forwards" }); } }; NavigationDrawer.styles = [componentStyle, style$6]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationDrawer.prototype, "open", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationDrawer.prototype, "modal", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "close-on-esc" }) ], NavigationDrawer.prototype, "closeOnEsc", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "close-on-overlay-click" }) ], NavigationDrawer.prototype, "closeOnOverlayClick", void 0); __decorate([ n$1({ reflect: true }) // eslint-disable-next-line prettier/prettier ], NavigationDrawer.prototype, "placement", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationDrawer.prototype, "contained", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationDrawer.prototype, "mobile", void 0); __decorate([ watch("contained") ], NavigationDrawer.prototype, "onContainedChange", null); __decorate([ watch("placement", true) ], NavigationDrawer.prototype, "onPlacementChange", null); __decorate([ watch("mobile", true), watch("modal", true) ], NavigationDrawer.prototype, "onMobileChange", null); __decorate([ watch("open") ], NavigationDrawer.prototype, "onOpenChange", null); NavigationDrawer = __decorate([ t$1("mdui-navigation-drawer") ], NavigationDrawer); const navigationRailStyle = i$3`:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;top:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;border-radius:0 var(--shape-corner) var(--shape-corner) 0;z-index:var(--z-index);width:5rem;background-color:rgb(var(--mdui-color-surface));padding:.375rem .75rem}:host([contained]){position:absolute}:host([divider]){border-right:.0625rem solid rgb(var(--mdui-color-surface-variant));width:5.0625rem}:host([placement=right]){left:initial;right:0;border-radius:var(--shape-corner) 0 0 var(--shape-corner)}:host([placement=right][divider]){border-right:none;border-left:.0625rem solid rgb(var(--mdui-color-surface-variant))}.bottom,.items,.top{display:flex;flex-direction:column;align-items:center;width:100%}.top{margin-bottom:1.75rem}.bottom{margin-top:1.75rem}::slotted([slot=bottom]),::slotted([slot=top]),::slotted(mdui-navigation-rail-item){margin-top:.375rem;margin-bottom:.375rem}:host([alignment=start]) .top-spacer{flex-grow:0}:host([alignment=start]) .bottom-spacer{flex-grow:1}:host([alignment=end]) .top-spacer{flex-grow:1}:host([alignment=end]) .bottom-spacer{flex-grow:0}:host([alignment=center]){justify-content:center}:host([alignment=center]) .bottom,:host([alignment=center]) .top{position:absolute}:host([alignment=center]) .top{top:.375rem}:host([alignment=center]) .bottom{bottom:.375rem}`; let NavigationRail = class NavigationRail2 extends LayoutItemBase { constructor() { super(...arguments); this.placement = "left"; this.alignment = "start"; this.contained = false; this.divider = false; this.activeKey = 0; this.hasSlotController = new HasSlotController(this, "top", "bottom"); this.definedController = new DefinedController(this, { relatedElements: ["mdui-navigation-rail-item"] }); this.isInitial = true; } get layoutPlacement() { return this.placement; } get parentTarget() { return this.contained || this.isParentLayout ? this.parentElement : document.body; } get isRight() { return this.placement === "right"; } get paddingValue() { return ["fixed", "absolute"].includes($$1(this).css("position")) ? this.offsetWidth : void 0; } async onActiveKeyChange() { await this.definedController.whenDefined(); const item = this.items.find((item2) => item2.key === this.activeKey); this.value = item == null ? void 0 : item.value; if (!this.isInitial) { this.emit("change"); } } async onValueChange() { this.isInitial = !this.hasUpdated; await this.definedController.whenDefined(); const item = this.items.find((item2) => item2.value === this.value); this.activeKey = (item == null ? void 0 : item.key) ?? 0; this.updateItems(); } async onContainedChange() { if (this.isParentLayout) { return; } await this.definedController.whenDefined(); $$1(document.body).css({ paddingLeft: this.contained || this.isRight ? null : this.paddingValue, paddingRight: this.contained || !this.isRight ? null : this.paddingValue }); $$1(this.parentElement).css({ paddingLeft: this.contained && !this.isRight ? this.paddingValue : null, paddingRight: this.contained && this.isRight ? this.paddingValue : null }); } async onPlacementChange() { var _a2; await this.definedController.whenDefined(); (_a2 = this.layoutManager) == null ? void 0 : _a2.updateLayout(this); this.items.forEach((item) => { item.placement = this.placement; }); if (!this.isParentLayout) { $$1(this.parentTarget).css({ paddingLeft: this.isRight ? null : this.paddingValue, paddingRight: this.isRight ? this.paddingValue : null }); } } connectedCallback() { super.connectedCallback(); if (!this.isParentLayout) { this.definedController.whenDefined().then(() => { $$1(this.parentTarget).css({ paddingLeft: this.isRight ? null : this.paddingValue, paddingRight: this.isRight ? this.paddingValue : null }); }); } } disconnectedCallback() { super.disconnectedCallback(); if (!this.isParentLayout && this.definedController.isDefined()) { $$1(this.parentTarget).css({ paddingLeft: this.isRight ? void 0 : null, paddingRight: this.isRight ? null : void 0 }); } } render() { const hasTopSlot = this.hasSlotController.test("top"); const hasBottomSlot = this.hasSlotController.test("bottom"); return ke`${nn(hasTopSlot, () => ke``)} ${nn(hasBottomSlot, () => ke``)}`; } onClick(event) { if (event.button) { return; } const target = event.target; const item = target.closest("mdui-navigation-rail-item"); if (!item) { return; } this.activeKey = item.key; this.isInitial = false; this.updateItems(); } updateItems() { this.items.forEach((item) => { item.active = this.activeKey === item.key; item.placement = this.placement; item.isInitial = this.isInitial; }); } async onSlotChange() { await this.definedController.whenDefined(); this.updateItems(); } }; NavigationRail.styles = [ componentStyle, navigationRailStyle ]; __decorate([ n$1({ reflect: true }) ], NavigationRail.prototype, "value", void 0); __decorate([ n$1({ reflect: true }) // eslint-disable-next-line prettier/prettier ], NavigationRail.prototype, "placement", void 0); __decorate([ n$1({ reflect: true }) ], NavigationRail.prototype, "alignment", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationRail.prototype, "contained", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationRail.prototype, "divider", void 0); __decorate([ r$1() ], NavigationRail.prototype, "activeKey", void 0); __decorate([ o$1({ selector: "mdui-navigation-rail-item", flatten: true }) ], NavigationRail.prototype, "items", void 0); __decorate([ watch("activeKey", true) ], NavigationRail.prototype, "onActiveKeyChange", null); __decorate([ watch("value") ], NavigationRail.prototype, "onValueChange", null); __decorate([ watch("contained", true) ], NavigationRail.prototype, "onContainedChange", null); __decorate([ watch("placement", true) ], NavigationRail.prototype, "onPlacementChange", null); NavigationRail = __decorate([ t$1("mdui-navigation-rail") ], NavigationRail); const navigationRailItemStyle = i$3`:host{--shape-corner-indicator:var(--mdui-shape-corner-full);position:relative;z-index:0;width:100%;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}.container{display:flex;flex-direction:column;align-items:center;justify-content:center;text-decoration:none;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;height:3.5rem}.container:not(.initial){transition:padding var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}mdui-ripple{z-index:1;width:3.5rem;height:2rem;border-radius:var(--mdui-shape-corner-full)}.container:not(.has-label)+mdui-ripple{height:3.5rem}.indicator{position:relative;display:flex;align-items:center;justify-content:center;background-color:transparent;border-radius:var(--shape-corner-indicator);height:2rem;width:2rem}:not(.initial) .indicator{transition:background-color var(--mdui-motion-duration-short1) var(--mdui-motion-easing-standard),width var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard),height var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}::slotted([slot=badge]){position:absolute;transform:translate(50%,-50%)}.placement-right::slotted([slot=badge]){transform:translate(-50%,-50%)}::slotted([slot=badge][variant=small]){transform:translate(.5625rem,-.5625rem)}.placement-right::slotted([slot=badge][variant=small]){transform:translate(-.5625rem,-.5625rem)}.active-icon,.icon{color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}.active-icon mdui-icon,.icon mdui-icon,::slotted([slot=active-icon]),::slotted([slot=icon]){font-size:inherit}.icon{display:flex}.active-icon{display:none}.label{display:flex;align-items:center;height:1rem;color:rgb(var(--mdui-color-on-surface-variant));margin-top:.25rem;margin-bottom:.25rem;font-size:var(--mdui-typescale-label-medium-size);font-weight:var(--mdui-typescale-label-medium-weight);letter-spacing:var(--mdui-typescale-label-medium-tracking);line-height:var(--mdui-typescale-label-medium-line-height)}:not(.initial) .label{transition:opacity var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear)}:host([active]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([active]) .indicator{width:3.5rem;background-color:rgb(var(--mdui-color-secondary-container))}:host([active]) :not(.has-label) .indicator{height:3.5rem}:host([active]) .active-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}:host([active]) .has-active-icon .active-icon{display:flex}:host([active]) .has-active-icon .icon{display:none}:host([active]) .label{color:rgb(var(--mdui-color-on-surface))}`; let NavigationRailItem = class NavigationRailItem2 extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) { constructor() { super(...arguments); this.active = false; this.isInitial = true; this.placement = "left"; this.disabled = false; this.key = uniqueId(); this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "[default]", "active-icon"); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.disabled; } get focusElement() { var _a2; return this.href ? (_a2 = this.renderRoot) == null ? void 0 : _a2.querySelector("._a") : this; } get focusDisabled() { return this.disabled; } render() { const hasDefaultSlot = this.hasSlotController.test("[default]"); const className2 = cc({ container: true, "has-label": hasDefaultSlot, "has-active-icon": this.activeIcon || this.hasSlotController.test("active-icon"), initial: this.isInitial }); return ke`${this.href ? this.renderAnchor({ part: "container", className: className2, content: this.renderInner(hasDefaultSlot) }) : ke`
${this.renderInner(hasDefaultSlot)}
`}`; } renderInner(hasDefaultSlot) { return ke`
${this.activeIcon ? ke`` : nothingTemplate}${this.icon ? ke`` : nothingTemplate}
${hasDefaultSlot ? ke`` : D}`; } }; NavigationRailItem.styles = [ componentStyle, navigationRailItemStyle ]; __decorate([ n$1({ reflect: true }) ], NavigationRailItem.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "active-icon" }) ], NavigationRailItem.prototype, "activeIcon", void 0); __decorate([ n$1({ reflect: true }) ], NavigationRailItem.prototype, "value", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], NavigationRailItem.prototype, "active", void 0); __decorate([ r$1() ], NavigationRailItem.prototype, "isInitial", void 0); __decorate([ r$1() ], NavigationRailItem.prototype, "placement", void 0); __decorate([ r$1() ], NavigationRailItem.prototype, "disabled", void 0); NavigationRailItem = __decorate([ t$1("mdui-navigation-rail-item") ], NavigationRailItem); let IconCircle = class IconCircle2 extends h { render() { return svgTag(''); } }; IconCircle.styles = style$e; IconCircle = __decorate([ t$1("mdui-icon-circle") ], IconCircle); let IconRadioButtonUnchecked = class IconRadioButtonUnchecked2 extends h { render() { return svgTag(''); } }; IconRadioButtonUnchecked.styles = style$e; IconRadioButtonUnchecked = __decorate([ t$1("mdui-icon-radio-button-unchecked") ], IconRadioButtonUnchecked); const radioStyle = i$3`:host{position:relative;display:inline-flex;align-items:center;cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none;border-radius:.125rem;font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}.icon{display:flex;position:absolute;font-size:1.5rem}:not(.initial) .icon{transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard)}.unchecked-icon{transition-property:color;color:rgb(var(--mdui-color-on-surface-variant))}:host([focused]) .unchecked-icon,:host([hover]) .unchecked-icon,:host([pressed]) .unchecked-icon{color:rgb(var(--mdui-color-on-surface))}.checked-icon{opacity:0;transform:scale(.2);transition-property:color,opacity,transform;color:rgb(var(--mdui-color-primary))}.icon .i,::slotted([slot=checked-icon]),::slotted([slot=unchecked-icon]){color:inherit;font-size:inherit}i{position:relative;display:flex;align-items:center;justify-content:center;flex-shrink:0;overflow:hidden;border-radius:50%;width:2.5rem;height:2.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.label{display:flex;width:100%;padding-top:.625rem;padding-bottom:.625rem;color:rgb(var(--mdui-color-on-surface))}.label:not(.initial){transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}:host([checked]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([checked]) .icon{color:rgb(var(--mdui-color-primary))}:host([checked]) .checked-icon{opacity:1;transform:scale(.5)}i.invalid{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}i.invalid .icon{color:rgb(var(--mdui-color-error))}.label.invalid{color:rgb(var(--mdui-color-error))}:host([disabled]),:host([group-disabled]){cursor:default;pointer-events:none}:host([disabled]) .icon,:host([group-disabled]) .icon{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled]) .label,:host([group-disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}`; let Radio = class Radio2 extends RippleMixin(FocusableMixin(MduiElement)) { constructor() { super(...arguments); this.value = ""; this.disabled = false; this.checked = false; this.invalid = false; this.groupDisabled = false; this.focusable = true; this.isInitial = true; this.rippleRef = ii(); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.isDisabled(); } get focusElement() { return this; } get focusDisabled() { return this.isDisabled() || !this.focusable; } onCheckedChange() { this.emit("change"); } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); this.addEventListener("click", () => { if (!this.isDisabled()) { this.checked = true; } }); } render() { const className2 = Rt({ invalid: this.invalid, initial: this.isInitial }); return ke`${this.uncheckedIcon ? ke`` : ke``}${this.checkedIcon ? ke`` : ke``}`; } isDisabled() { return this.disabled || this.groupDisabled; } }; Radio.styles = [componentStyle, radioStyle]; __decorate([ n$1({ reflect: true }) ], Radio.prototype, "value", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Radio.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Radio.prototype, "checked", void 0); __decorate([ n$1({ reflect: true, attribute: "unchecked-icon" }) ], Radio.prototype, "uncheckedIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "checked-icon" }) ], Radio.prototype, "checkedIcon", void 0); __decorate([ r$1() ], Radio.prototype, "invalid", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "group-disabled" }) ], Radio.prototype, "groupDisabled", void 0); __decorate([ r$1() ], Radio.prototype, "focusable", void 0); __decorate([ r$1() ], Radio.prototype, "isInitial", void 0); __decorate([ watch("checked", true) ], Radio.prototype, "onCheckedChange", null); Radio = __decorate([ t$1("mdui-radio") ], Radio); const radioGroupStyle = i$3`:host{display:inline-block}fieldset{border:none;padding:0;margin:0;min-width:0}input{position:absolute;padding:0;opacity:0;pointer-events:none;width:1.25rem;height:1.25rem;margin:0 0 0 .625rem}`; let RadioGroup = class RadioGroup2 extends MduiElement { constructor() { super(...arguments); this.disabled = false; this.name = ""; this.value = ""; this.defaultValue = ""; this.required = false; this.invalid = false; this.isInitial = true; this.inputRef = ii(); this.formController = new FormController(this); this.definedController = new DefinedController(this, { relatedElements: ["mdui-radio"] }); } /** * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState) */ get validity() { return this.inputRef.value.validity; } /** * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串 */ get validationMessage() { return this.inputRef.value.validationMessage; } // 为了使 可以不是该组件的直接子元素,这里不用 @queryAssignedElements() get items() { return $$1(this).find("mdui-radio").get(); } get itemsEnabled() { return $$1(this).find("mdui-radio:not([disabled])").get(); } async onValueChange() { var _a2; this.isInitial = false; await this.definedController.whenDefined(); this.emit("input"); this.emit("change"); this.updateItems(); this.updateRadioFocusable(); await this.updateComplete; const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { this.invalid = !this.inputRef.value.checkValidity(); } } async onInvalidChange() { await this.definedController.whenDefined(); this.updateItems(); } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true` */ checkValidity() { const valid = this.inputRef.value.checkValidity(); if (!valid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); } return valid; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。 * * 如果验证未通过,还会在组件上显示验证失败的提示。 */ reportValidity() { this.invalid = !this.inputRef.value.reportValidity(); if (this.invalid) { const eventProceeded = this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); if (!eventProceeded) { this.inputRef.value.blur(); this.inputRef.value.focus(); } } return !this.invalid; } /** * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证 * * @param message 自定义的错误提示文本 */ setCustomValidity(message) { this.inputRef.value.setCustomValidity(message); this.invalid = !this.inputRef.value.checkValidity(); } render() { return ke`
`; } // 更新 mdui-radio 的 checked 后,需要更新可聚焦状态 // 同一个 mdui-radio-group 中的多个 mdui-radio,仅有一个可聚焦 // 若有已选中的,则已选中的可聚焦;若没有已选中的,则第一个可聚焦 updateRadioFocusable() { const items = this.items; const itemChecked = items.find((item) => item.checked); if (itemChecked) { items.forEach((item) => { item.focusable = item === itemChecked; }); } else { this.itemsEnabled.forEach((item, index) => { item.focusable = !index; }); } } async onClick(event) { await this.definedController.whenDefined(); const target = event.target; const item = target.closest("mdui-radio"); if (!item || item.disabled) { return; } this.value = item.value; await this.updateComplete; item.focus(); } /** * 在内部的 `` 上按下按键时,在 `` 之间切换焦点 */ async onKeyDown(event) { if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", " "].includes(event.key)) { return; } event.preventDefault(); await this.definedController.whenDefined(); const items = this.itemsEnabled; const itemChecked = items.find((item) => item.checked) ?? items[0]; const incr = event.key === " " ? 0 : ["ArrowUp", "ArrowLeft"].includes(event.key) ? -1 : 1; let index = items.indexOf(itemChecked) + incr; if (index < 0) { index = items.length - 1; } if (index > items.length - 1) { index = 0; } this.value = items[index].value; await this.updateComplete; items[index].focus(); } async onSlotChange() { await this.definedController.whenDefined(); this.updateItems(); this.updateRadioFocusable(); } /** * slot 中的 mdui-radio 的 checked 变更时触发的事件 */ onCheckedChange(event) { event.stopPropagation(); } // 更新 的状态 updateItems() { this.items.forEach((item) => { item.checked = item.value === this.value; item.invalid = this.invalid; item.groupDisabled = this.disabled; item.isInitial = this.isInitial; }); } }; RadioGroup.styles = [ componentStyle, radioGroupStyle ]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], RadioGroup.prototype, "disabled", void 0); __decorate([ n$1({ reflect: true }) ], RadioGroup.prototype, "form", void 0); __decorate([ n$1({ reflect: true }) ], RadioGroup.prototype, "name", void 0); __decorate([ n$1({ reflect: true }) ], RadioGroup.prototype, "value", void 0); __decorate([ defaultValue() ], RadioGroup.prototype, "defaultValue", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], RadioGroup.prototype, "required", void 0); __decorate([ r$1() ], RadioGroup.prototype, "invalid", void 0); __decorate([ watch("value", true) ], RadioGroup.prototype, "onValueChange", null); __decorate([ watch("invalid", true), watch("disabled") ], RadioGroup.prototype, "onInvalidChange", null); RadioGroup = __decorate([ t$1("mdui-radio-group") ], RadioGroup); /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function* oo(o2, f2) { if (void 0 !== o2) { let i3 = 0; for (const t2 of o2) yield f2(t2, i3++); } } const sliderBaseStyle = i$3`:host{position:relative;display:block;width:100%;-webkit-tap-highlight-color:transparent;height:2.5rem;padding:0 1.25rem}label{position:relative;display:block;width:100%;height:100%}input[type=range]{position:absolute;inset:0;z-index:4;height:100%;cursor:pointer;opacity:0;appearance:none;width:calc(100% + 20rem * 2 / 16);margin:0 -1.25rem;padding:0 .75rem}:host([disabled]) input[type=range]{cursor:not-allowed}.track-active,.track-inactive{position:absolute;top:50%;height:.25rem;margin-top:-.125rem}.track-inactive{left:-.125rem;right:-.125rem;border-radius:var(--mdui-shape-corner-full);background-color:rgb(var(--mdui-color-surface-container-highest))}.invalid .track-inactive{background-color:rgba(var(--mdui-color-error),.12)}:host([disabled]) .track-inactive{background-color:rgba(var(--mdui-color-on-surface),.12)}.track-active{background-color:rgb(var(--mdui-color-primary))}.invalid .track-active{background-color:rgb(var(--mdui-color-error))}:host([disabled]) .track-active{background-color:rgba(var(--mdui-color-on-surface),.38)}.handle{position:absolute;top:50%;transform:translate(-50%);cursor:pointer;z-index:2;width:2.5rem;height:2.5rem;margin-top:-1.25rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}.invalid .handle{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}.handle .elevation,.handle::before{position:absolute;display:block;content:' ';left:.625rem;top:.625rem;width:1.25rem;height:1.25rem;border-radius:var(--mdui-shape-corner-full)}.handle .elevation{background-color:rgb(var(--mdui-color-primary));box-shadow:var(--mdui-elevation-level1)}.invalid .handle .elevation{background-color:rgb(var(--mdui-color-error))}:host([disabled]) .handle .elevation{background-color:rgba(var(--mdui-color-on-surface),.38);box-shadow:var(--mdui-elevation-level0)}.handle::before{background-color:rgb(var(--mdui-color-background))}.handle mdui-ripple{border-radius:var(--mdui-shape-corner-full)}.label{position:absolute;left:50%;transform:translateX(-50%) scale(0);transform-origin:center bottom;display:flex;align-items:center;justify-content:center;cursor:default;white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none;transition:transform var(--mdui-motion-duration-short2) var(--mdui-motion-easing-standard);bottom:2.5rem;min-width:1.75rem;height:1.75rem;padding:.375rem .5rem;border-radius:var(--mdui-shape-corner-full);color:rgb(var(--mdui-color-on-primary));font-size:var(--mdui-typescale-label-medium-size);font-weight:var(--mdui-typescale-label-medium-weight);letter-spacing:var(--mdui-typescale-label-medium-tracking);line-height:var(--mdui-typescale-label-medium-line-height);background-color:rgb(var(--mdui-color-primary))}.invalid .label{color:rgb(var(--mdui-color-on-error));background-color:rgb(var(--mdui-color-error))}.label::after{content:' ';position:absolute;z-index:-1;transform:rotate(45deg);width:.875rem;height:.875rem;bottom:-.125rem;background-color:rgb(var(--mdui-color-primary))}.invalid .label::after{background-color:rgb(var(--mdui-color-error))}.label-visible{transform:translateX(-50%) scale(1);transition:transform var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.tickmark{position:absolute;top:50%;transform:translate(-50%);width:.125rem;height:.125rem;margin-top:-.0625rem;border-radius:var(--mdui-shape-corner-full);background-color:rgba(var(--mdui-color-on-surface-variant),.38)}.invalid .tickmark{background-color:rgba(var(--mdui-color-error),.38)}.tickmark.active{background-color:rgba(var(--mdui-color-on-primary),.38)}.invalid .tickmark.active{background-color:rgba(var(--mdui-color-on-error),.38)}:host([disabled]) .tickmark{background-color:rgba(var(--mdui-color-on-surface),.38)}`; class SliderBase extends RippleMixin(FocusableMixin(MduiElement)) { constructor() { super(...arguments); this.min = 0; this.max = 100; this.step = 1; this.tickmarks = false; this.nolabel = false; this.disabled = false; this.name = ""; this.invalid = false; this.labelVisible = false; this.inputRef = ii(); this.trackActiveRef = ii(); this.labelFormatter = (value) => value.toString(); } /** * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState) */ get validity() { return this.inputRef.value.validity; } /** * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串 */ get validationMessage() { return this.inputRef.value.validationMessage; } get rippleDisabled() { return this.disabled; } get focusElement() { return this.inputRef.value; } get focusDisabled() { return this.disabled; } onDisabledChange() { this.invalid = !this.inputRef.value.checkValidity(); } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true` */ checkValidity() { const valid = this.inputRef.value.checkValidity(); if (!valid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); } return valid; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。 * * 如果验证未通过,还会在组件上显示验证失败的提示。 */ reportValidity() { this.invalid = !this.inputRef.value.reportValidity(); if (this.invalid) { const eventProceeded = this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); if (!eventProceeded) { this.blur(); this.focus(); } } return !this.invalid; } /** * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证 * * @param message 自定义的错误提示文本 */ setCustomValidity(message) { this.inputRef.value.setCustomValidity(message); this.invalid = !this.inputRef.value.checkValidity(); } /** * value 不在 min、max 或 step 的限制范围内时,修正 value 的值 */ fixValue(value) { const { min, max, step } = this; value = Math.min(Math.max(value, min), max); const steps = Math.round((value - min) / step); let fixedValue = min + steps * step; if (fixedValue > max) { fixedValue -= step; } return fixedValue; } /** * 获取候选值组成的数组 */ getCandidateValues() { return Array.from({ length: this.max - this.min + 1 }, (_2, index) => index + this.min).filter((value) => !((value - this.min) % this.step)); } /** * 渲染浮动标签 */ renderLabel(value) { return nn(!this.nolabel, () => ke`
${this.labelFormatter(value)}
`); } onChange() { this.emit("change"); } } SliderBase.styles = [ componentStyle, sliderBaseStyle ]; __decorate([ n$1({ type: Number, reflect: true }) ], SliderBase.prototype, "min", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], SliderBase.prototype, "max", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], SliderBase.prototype, "step", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], SliderBase.prototype, "tickmarks", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], SliderBase.prototype, "nolabel", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], SliderBase.prototype, "disabled", void 0); __decorate([ n$1({ reflect: true }) ], SliderBase.prototype, "form", void 0); __decorate([ n$1({ reflect: true }) ], SliderBase.prototype, "name", void 0); __decorate([ r$1() ], SliderBase.prototype, "invalid", void 0); __decorate([ r$1() ], SliderBase.prototype, "labelVisible", void 0); __decorate([ n$1({ attribute: false }) ], SliderBase.prototype, "labelFormatter", void 0); __decorate([ watch("disabled", true) ], SliderBase.prototype, "onDisabledChange", null); let RangeSlider = class RangeSlider2 extends SliderBase { constructor() { super(...arguments); this.defaultValue = []; this.currentHandle = "start"; this.rippleStartRef = ii(); this.rippleEndRef = ii(); this.handleStartRef = ii(); this.handleEndRef = ii(); this.formController = new FormController(this); this._value = []; this.getRippleIndex = () => { if (this.hoverHandle) { return this.hoverHandle === "start" ? 0 : 1; } return this.currentHandle === "start" ? 0 : 1; }; } /** * 滑块的值,为数组格式,将于表单数据一起提交。 * * **NOTE**:该属性无法通过 HTML 属性设置初始值,如果要修改该值,只能通过修改 JavaScript 属性值实现。 */ get value() { return this._value; } set value(_value) { const oldValue = [...this._value]; this._value = [this.fixValue(_value[0]), this.fixValue(_value[1])]; this.requestUpdate("value", oldValue); this.updateComplete.then(() => { var _a2; this.updateStyle(); const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { this.invalid = !this.inputRef.value.checkValidity(); } }); } get rippleElement() { return [this.rippleStartRef.value, this.rippleEndRef.value]; } connectedCallback() { super.connectedCallback(); if (!this.value.length) { this.value = [this.min, this.max]; } this.value[0] = this.fixValue(this.value[0]); this.value[1] = this.fixValue(this.value[1]); if (!this.defaultValue.length) { this.defaultValue = [...this.value]; } } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); const getCurrentHandle = (event) => { const $this = $$1(this); const paddingLeft = parseFloat($this.css("padding-left")); const paddingRight = parseFloat($this.css("padding-right")); const percent = (event.offsetX - paddingLeft) / (this.clientWidth - paddingLeft - paddingRight); const pointerValue = (this.max - this.min) * percent + this.min; const middleValue = (this.value[1] - this.value[0]) / 2 + this.value[0]; return pointerValue > middleValue ? "end" : "start"; }; const onTouchStart = () => { if (!this.disabled) { this.labelVisible = true; } }; const onTouchEnd = () => { if (!this.disabled) { this.labelVisible = false; } }; this.addEventListener("touchstart", onTouchStart); this.addEventListener("mousedown", onTouchStart); this.addEventListener("touchend", onTouchEnd); this.addEventListener("mouseup", onTouchEnd); this.addEventListener("pointerdown", (event) => { this.currentHandle = getCurrentHandle(event); }); this.addEventListener("pointermove", (event) => { const currentHandle = getCurrentHandle(event); if (this.hoverHandle !== currentHandle) { this.endHover(event); this.hoverHandle = currentHandle; this.startHover(event); } }); this.updateStyle(); } /** * 用于提供拖拽操作 * 用于提供 html5 自带的表单错误提示 */ render() { return ke``; } updateStyle() { const getPercent = (value) => (value - this.min) / (this.max - this.min) * 100; const startPercent = getPercent(this.value[0]); const endPercent = getPercent(this.value[1]); this.trackActiveRef.value.style.width = `${endPercent - startPercent}%`; this.trackActiveRef.value.style.left = `${startPercent}%`; this.handleStartRef.value.style.left = `${startPercent}%`; this.handleEndRef.value.style.left = `${endPercent}%`; } onInput() { const isStart = this.currentHandle === "start"; const value = parseFloat(this.inputRef.value.value); const startValue = this.value[0]; const endValue = this.value[1]; const doInput = () => { this.updateStyle(); }; if (isStart) { if (value <= endValue) { this.value = [value, endValue]; doInput(); } else if (startValue !== endValue) { this.value = [endValue, endValue]; doInput(); } } else { if (value >= startValue) { this.value = [startValue, value]; doInput(); } else if (startValue !== endValue) { this.value = [startValue, startValue]; doInput(); } } } }; RangeSlider.styles = [SliderBase.styles]; __decorate([ defaultValue() ], RangeSlider.prototype, "defaultValue", void 0); __decorate([ r$1() ], RangeSlider.prototype, "currentHandle", void 0); __decorate([ n$1({ type: Array, attribute: false }) ], RangeSlider.prototype, "value", null); RangeSlider = __decorate([ t$1("mdui-range-slider") ], RangeSlider); const segmentedButtonStyle = i$3`:host{position:relative;display:inline-flex;flex-grow:1;flex-shrink:0;float:left;height:100%;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:transparent;border:.0625rem solid rgb(var(--mdui-color-outline))}.button{width:100%;padding:0 .75rem}:host([invalid]){color:rgb(var(--mdui-color-error));border-color:rgb(var(--mdui-color-error))}:host([invalid]) .button{background-color:rgb(var(--mdui-color-error-container))}:host([selected]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var( --mdui-color-on-secondary-container )}:host([disabled]),:host([group-disabled]){cursor:default;pointer-events:none;color:rgba(var(--mdui-color-on-surface),38%);border-color:rgba(var(--mdui-color-on-surface),12%)}:host([loading]){cursor:default;pointer-events:none}:host(:not(.mdui-segmented-button-first)){margin-left:-.0625rem}:host(.mdui-segmented-button-first){border-radius:var(--shape-corner) 0 0 var(--shape-corner)}:host(.mdui-segmented-button-last){border-radius:0 var(--shape-corner) var(--shape-corner) 0}.end-icon,.icon,.selected-icon{display:inline-flex;font-size:1.28571429em}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}mdui-circular-progress{width:1.125rem;height:1.125rem}:host([disabled]) mdui-circular-progress{opacity:.38}.label{display:inline-flex}.has-icon .label{padding-left:.5rem}.has-end-icon .label{padding-right:.5rem}`; let SegmentedButton = class SegmentedButton2 extends ButtonBase { constructor() { super(...arguments); this.selected = false; this.invalid = false; this.groupDisabled = false; this.key = uniqueId(); this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "[default]", "icon", "end-icon"); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.isDisabled() || this.loading; } get focusDisabled() { return this.isDisabled() || this.loading; } render() { const className2 = cc({ button: true, "has-icon": this.icon || this.selected || this.loading || this.hasSlotController.test("icon"), "has-end-icon": this.endIcon || this.hasSlotController.test("end-icon") }); return ke`${this.isButton() ? this.renderButton({ className: className2, part: "button", content: this.renderInner() }) : this.isDisabled() || this.loading ? ke`${this.renderInner()}` : this.renderAnchor({ className: className2, part: "button", content: this.renderInner() })}`; } isDisabled() { return this.disabled || this.groupDisabled; } renderIcon() { if (this.loading) { return this.renderLoading(); } if (this.selected) { return ke`${this.selectedIcon ? ke`` : ke``}`; } return ke`${this.icon ? ke`` : nothingTemplate}`; } renderLabel() { const hasLabel = this.hasSlotController.test("[default]"); if (!hasLabel) { return nothingTemplate; } return ke``; } renderEndIcon() { return ke`${this.endIcon ? ke`` : nothingTemplate}`; } renderInner() { return [this.renderIcon(), this.renderLabel(), this.renderEndIcon()]; } }; SegmentedButton.styles = [ ButtonBase.styles, segmentedButtonStyle ]; __decorate([ n$1({ reflect: true }) ], SegmentedButton.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], SegmentedButton.prototype, "endIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "selected-icon" }) ], SegmentedButton.prototype, "selectedIcon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], SegmentedButton.prototype, "selected", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], SegmentedButton.prototype, "invalid", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "group-disabled" }) ], SegmentedButton.prototype, "groupDisabled", void 0); SegmentedButton = __decorate([ t$1("mdui-segmented-button") ], SegmentedButton); const segmentedButtonGroupStyle = i$3`:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-flex;vertical-align:middle;height:2.5rem;font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height);color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([full-width]){display:flex;flex-wrap:nowrap}input,select{position:absolute;width:100%;height:100%;padding:0;opacity:0;pointer-events:none}`; let SegmentedButtonGroup = class SegmentedButtonGroup2 extends MduiElement { constructor() { super(...arguments); this.fullWidth = false; this.disabled = false; this.required = false; this.name = ""; this.value = ""; this.defaultValue = ""; this.selectedKeys = []; this.invalid = false; this.isInitial = true; this.inputRef = ii(); this.formController = new FormController(this); this.definedController = new DefinedController(this, { relatedElements: ["mdui-segmented-button"] }); } /** * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState) */ get validity() { return this.inputRef.value.validity; } /** * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串 */ get validationMessage() { return this.inputRef.value.validationMessage; } // 为了使 可以不是该组件的直接子元素,这里不用 @queryAssignedElements() get items() { return $$1(this).find("mdui-segmented-button").get(); } // 所有的子项元素(不包含已禁用的) get itemsEnabled() { return $$1(this).find("mdui-segmented-button:not([disabled])").get(); } // 是否为单选 get isSingle() { return this.selects === "single"; } // 是否为多选 get isMultiple() { return this.selects === "multiple"; } // 是否可选择 get isSelectable() { return this.isSingle || this.isMultiple; } async onSelectsChange() { if (!this.isSelectable) { this.setSelectedKeys([]); } else if (this.isSingle) { this.setSelectedKeys(this.selectedKeys.slice(0, 1)); } await this.onSelectedKeysChange(); } async onSelectedKeysChange() { await this.definedController.whenDefined(); const values = this.itemsEnabled.filter((item) => this.selectedKeys.includes(item.key)).map((item) => item.value); const value = this.isMultiple ? values : values[0] || ""; this.setValue(value); if (!this.isInitial) { this.emit("change"); } } async onValueChange() { var _a2; this.isInitial = !this.hasUpdated; await this.definedController.whenDefined(); if (!this.isSelectable) { this.updateItems(); return; } const values = (this.isSingle ? [this.value] : ( // 多选时,传入的值可能是字符串(通过 attribute 属性设置);或字符串数组(通过 property 属性设置) isString(this.value) ? [this.value] : this.value )).filter((i3) => i3); if (!values.length) { this.setSelectedKeys([]); } else if (this.isSingle) { const firstItem = this.itemsEnabled.find((item) => item.value === values[0]); this.setSelectedKeys(firstItem ? [firstItem.key] : []); } else if (this.isMultiple) { this.setSelectedKeys(this.itemsEnabled.filter((item) => values.includes(item.value)).map((item) => item.key)); } this.updateItems(); if (!this.isInitial) { const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { this.invalid = !this.inputRef.value.checkValidity(); } } } async onInvalidChange() { await this.definedController.whenDefined(); this.updateItems(); } connectedCallback() { super.connectedCallback(); this.value = this.isMultiple && isString(this.value) ? this.value ? [this.value] : [] : this.value; this.defaultValue = this.selects === "multiple" ? [] : ""; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true` */ checkValidity() { const valid = this.inputRef.value.checkValidity(); if (!valid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); } return valid; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。 * * 如果验证未通过,还会在组件上显示验证失败的提示。 */ reportValidity() { this.invalid = !this.inputRef.value.reportValidity(); if (this.invalid) { const eventProceeded = this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); if (!eventProceeded) { this.inputRef.value.blur(); this.inputRef.value.focus(); } } return !this.invalid; } /** * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证 * * @param message 自定义的错误提示文本 */ setCustomValidity(message) { this.inputRef.value.setCustomValidity(message); this.invalid = !this.inputRef.value.checkValidity(); } render() { return ke`${nn(this.isSelectable && this.isSingle, () => ke``)}${nn(this.isSelectable && this.isMultiple, () => ke``)}`; } // 切换一个元素的选中状态 selectOne(item) { if (this.isMultiple) { const selectedKeys = [...this.selectedKeys]; if (selectedKeys.includes(item.key)) { selectedKeys.splice(selectedKeys.indexOf(item.key), 1); } else { selectedKeys.push(item.key); } this.setSelectedKeys(selectedKeys); } if (this.isSingle) { if (this.selectedKeys.includes(item.key)) { this.setSelectedKeys([]); } else { this.setSelectedKeys([item.key]); } } this.isInitial = false; this.updateItems(); } async onClick(event) { if (event.button) { return; } await this.definedController.whenDefined(); const target = event.target; const item = target.closest("mdui-segmented-button"); if (!item || item.disabled) { return; } if (this.isSelectable && item.value) { this.selectOne(item); } } /** * 在隐藏的 `` 或 `` 或 ``; } renderTextArea(hasInputSlot) { return ke``; } /** * @param hasError 是否包含错误提示 * @param hasHelper 是否含 helper 属性或 helper slot */ renderHelper(hasError, hasHelper) { return hasError ? ke`
${this.error || this.inputRef.value.validationMessage}
` : hasHelper ? ke`${this.helper}` : ( // 右边有 counter,需要占位 ke`` ); } renderCounter(hasCounter) { return hasCounter ? ke`
${this.value.length}/${this.maxlength}
` : nothingTemplate; } }; TextField.styles = [componentStyle, style$5]; __decorate([ n$1({ reflect: true }) ], TextField.prototype, "variant", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "type", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "name", void 0); __decorate([ n$1() ], TextField.prototype, "value", void 0); __decorate([ defaultValue() ], TextField.prototype, "defaultValue", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "label", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "placeholder", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "helper", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "helper-on-focus" }) ], TextField.prototype, "helperOnFocus", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "clearable", void 0); __decorate([ n$1({ reflect: true, attribute: "clear-icon" }) ], TextField.prototype, "clearIcon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "end-aligned" }) ], TextField.prototype, "endAligned", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "prefix", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "suffix", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], TextField.prototype, "endIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "error-icon" }) ], TextField.prototype, "errorIcon", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "form", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "readonly", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "required", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], TextField.prototype, "rows", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "autosize", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "min-rows" }) ], TextField.prototype, "minRows", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "max-rows" }) ], TextField.prototype, "maxRows", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], TextField.prototype, "minlength", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], TextField.prototype, "maxlength", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "counter", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], TextField.prototype, "min", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], TextField.prototype, "max", void 0); __decorate([ n$1({ type: Number, reflect: true }) ], TextField.prototype, "step", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "pattern", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "toggle-password" }) ], TextField.prototype, "togglePassword", void 0); __decorate([ n$1({ reflect: true, attribute: "show-password-icon" }) ], TextField.prototype, "showPasswordIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "hide-password-icon" }) ], TextField.prototype, "hidePasswordIcon", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "autocapitalize", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "autocorrect", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "autocomplete", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "enterkeyhint", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TextField.prototype, "spellcheck", void 0); __decorate([ n$1({ reflect: true }) ], TextField.prototype, "inputmode", void 0); __decorate([ r$1() ], TextField.prototype, "invalid", void 0); __decorate([ r$1() ], TextField.prototype, "invalidStyle", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "focused-style" }) ], TextField.prototype, "focusedStyle", void 0); __decorate([ r$1() ], TextField.prototype, "isPasswordVisible", void 0); __decorate([ r$1() ], TextField.prototype, "hasValue", void 0); __decorate([ r$1() ], TextField.prototype, "error", void 0); __decorate([ watch("disabled", true) ], TextField.prototype, "onDisabledChange", null); __decorate([ watch("value") ], TextField.prototype, "onValueChange", null); __decorate([ watch("rows", true) ], TextField.prototype, "onRowsChange", null); __decorate([ watch("maxRows") ], TextField.prototype, "onMaxRowsChange", null); __decorate([ watch("minRows") ], TextField.prototype, "onMinRowsChange", null); TextField = __decorate([ t$1("mdui-text-field") ], TextField); const style$4 = i$3`:host{display:inline-block;width:100%}.hidden-input{display:none}.text-field{cursor:pointer}.chips{display:flex;flex-wrap:wrap;margin:-.5rem -.25rem;min-height:2.5rem}:host([variant=filled][label]) .chips{margin:0 -.25rem -1rem -.25rem}.chip{margin:.25rem}mdui-menu{max-width:none}`; let Select = class Select2 extends FocusableMixin(MduiElement) { constructor() { super(...arguments); this.variant = "filled"; this.multiple = false; this.name = ""; this.value = ""; this.defaultValue = ""; this.clearable = false; this.placement = "auto"; this.endAligned = false; this.readonly = false; this.disabled = false; this.required = false; this.invalid = false; this.menuRef = ii(); this.textFieldRef = ii(); this.hiddenInputRef = ii(); this.formController = new FormController(this); this.hasSlotController = new HasSlotController(this, "icon", "end-icon", "error-icon", "prefix", "suffix", "clear-button", "clear-icon", "helper"); this.definedController = new DefinedController(this, { relatedElements: ["mdui-menu-item"] }); } /** * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState) */ get validity() { return this.hiddenInputRef.value.validity; } /** * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串 */ get validationMessage() { return this.hiddenInputRef.value.validationMessage; } get focusElement() { return this.textFieldRef.value; } get focusDisabled() { return this.disabled; } connectedCallback() { super.connectedCallback(); this.value = this.multiple && isString(this.value) ? this.value ? [this.value] : [] : this.value; this.defaultValue = this.multiple ? [] : ""; this.definedController.whenDefined().then(() => { this.requestUpdate(); }); } disconnectedCallback() { var _a2; super.disconnectedCallback(); (_a2 = this.observeResize) == null ? void 0 : _a2.unobserve(); } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true` */ checkValidity() { const valid = this.hiddenInputRef.value.checkValidity(); if (!valid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); } return valid; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。 * * 如果验证未通过,还会在组件上显示验证失败的提示。 */ reportValidity() { this.invalid = !this.hiddenInputRef.value.reportValidity(); if (this.invalid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); this.focus(); } return !this.invalid; } /** * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证 * * @param message 自定义的错误提示文本 */ setCustomValidity(message) { this.hiddenInputRef.value.setCustomValidity(message); this.invalid = !this.hiddenInputRef.value.checkValidity(); } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.observeResize = observeResize(this.textFieldRef.value, () => this.resizeMenu()); } render() { var _a2; const hasSelection = this.multiple ? !!this.value.length : !!this.value; return ke`${this.multiple ? ke`` : ke``} `${v2}:text-field__${v2}`).join(",")}" readonly="readonly" .readonlyButClearable="${true}" .variant="${this.variant}" .name="${this.name}" .value="${this.multiple ? this.value.length ? " " : "" : this.getMenuItemLabelByValue(this.value)}" .label="${this.label}" .placeholder="${this.placeholder}" .helper="${this.helper}" .error="${(_a2 = this.hiddenInputRef.value) == null ? void 0 : _a2.validationMessage}" .clearable="${this.clearable}" .clearIcon="${this.clearIcon}" .endAligned="${this.endAligned}" .prefix="${this.prefix}" .suffix="${this.suffix}" .icon="${this.icon}" .endIcon="${this.endIcon}" .errorIcon="${this.errorIcon}" .form="${this.form}" .disabled="${this.disabled}" .required="${this.required}" .invalidStyle="${this.invalid}" @clear="${this.onClear}" @change="${(e2) => e2.stopPropagation()}" @keydown="${this.onTextFieldKeyDown}">${oo([ "icon", "end-icon", "error-icon", "prefix", "suffix", "clear-button", "clear-icon", "helper" ], (slotName) => this.hasSlotController.test(slotName) ? ke`` : D)} ${nn(this.multiple && this.value.length, () => ke`
${oo(this.value, (valueItem) => ke` `${v2}:chip__${v2}`).join(",")}" variant="input" deletable tabindex="-1" @delete="${() => this.onDeleteOneValue(valueItem)}">${this.getMenuItemLabelByValue(valueItem)}`)}
`)}
`; } getMenuItemLabelByValue(valueItem) { var _a2, _b; if (!this.menuItems.length) { return valueItem; } return ((_b = (_a2 = this.menuItems.find((item) => item.value === valueItem)) == null ? void 0 : _a2.textContent) == null ? void 0 : _b.trim()) || valueItem; } resizeMenu() { this.menuRef.value.style.width = `${this.textFieldRef.value.clientWidth}px`; } async onDropdownOpen() { this.textFieldRef.value.focusedStyle = true; } onDropdownClose() { var _a2; this.textFieldRef.value.focusedStyle = false; if (this.contains(document.activeElement) || this.contains(((_a2 = document.activeElement) == null ? void 0 : _a2.assignedSlot) ?? null)) { setTimeout(() => { this.focus(); }); } } async onValueChange(e2) { var _a2; const menu = e2.target; this.value = this.multiple ? menu.value.map((v2) => v2 ?? "") : menu.value ?? ""; await this.updateComplete; const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { this.invalid = !this.hiddenInputRef.value.checkValidity(); } } /** * multiple 为 true 时,点 chip 的删除按钮,删除其中一个值 */ onDeleteOneValue(valueItem) { const value = [...this.value]; if (value.includes(valueItem)) { value.splice(value.indexOf(valueItem), 1); } this.value = value; } onClear() { this.value = this.multiple ? [] : ""; } /** * 焦点在 text-field 上时,按下回车键,打开下拉选项 */ onTextFieldKeyDown(event) { if (event.key === "Enter") { event.preventDefault(); this.textFieldRef.value.click(); } } }; Select.styles = [componentStyle, style$4]; __decorate([ n$1({ reflect: true }) ], Select.prototype, "variant", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Select.prototype, "multiple", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "name", void 0); __decorate([ n$1() ], Select.prototype, "value", void 0); __decorate([ defaultValue() ], Select.prototype, "defaultValue", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "label", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "placeholder", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "helper", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Select.prototype, "clearable", void 0); __decorate([ n$1({ reflect: true, attribute: "clear-icon" }) ], Select.prototype, "clearIcon", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "placement", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "end-aligned" }) ], Select.prototype, "endAligned", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "prefix", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "suffix", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "icon", void 0); __decorate([ n$1({ reflect: true, attribute: "end-icon" }) ], Select.prototype, "endIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "error-icon" }) ], Select.prototype, "errorIcon", void 0); __decorate([ n$1({ reflect: true }) ], Select.prototype, "form", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Select.prototype, "readonly", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Select.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Select.prototype, "required", void 0); __decorate([ r$1() ], Select.prototype, "invalid", void 0); __decorate([ o$1({ flatten: true, selector: "mdui-menu-item" }) ], Select.prototype, "menuItems", void 0); Select = __decorate([ t$1("mdui-select") ], Select); const style$3 = i$3`.track-active{left:-.125rem;border-radius:var(--mdui-shape-corner-full) 0 0 var(--mdui-shape-corner-full)}`; let Slider = class Slider2 extends SliderBase { constructor() { super(...arguments); this.value = 0; this.defaultValue = 0; this.rippleRef = ii(); this.handleRef = ii(); this.formController = new FormController(this); } get rippleElement() { return this.rippleRef.value; } async onValueChange() { var _a2; this.value = this.fixValue(this.value); const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { await this.updateComplete; this.invalid = !this.inputRef.value.checkValidity(); } this.updateStyle(); } connectedCallback() { super.connectedCallback(); this.value = this.fixValue(this.value); } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); const onTouchStart = () => { if (!this.disabled) { this.labelVisible = true; } }; const onTouchEnd = () => { if (!this.disabled) { this.labelVisible = false; } }; this.addEventListener("touchstart", onTouchStart); this.addEventListener("mousedown", onTouchStart); this.addEventListener("touchend", onTouchEnd); this.addEventListener("mouseup", onTouchEnd); this.updateStyle(); } /** * 用于提供拖拽操作 * 用于提供 html5 自带的表单错误提示 */ render() { return ke``; } updateStyle() { const percent = (this.value - this.min) / (this.max - this.min) * 100; this.trackActiveRef.value.style.width = `${percent}%`; this.handleRef.value.style.left = `${percent}%`; } onInput() { this.value = parseFloat(this.inputRef.value.value); this.updateStyle(); } }; Slider.styles = [SliderBase.styles, style$3]; __decorate([ n$1({ type: Number }) ], Slider.prototype, "value", void 0); __decorate([ defaultValue() ], Slider.prototype, "defaultValue", void 0); __decorate([ watch("value", true) ], Slider.prototype, "onValueChange", null); Slider = __decorate([ t$1("mdui-slider") ], Slider); const style$2 = i$3`:host{--shape-corner:var(--mdui-shape-corner-extra-small);--z-index:2400;position:fixed;z-index:var(--z-index);display:none;align-items:center;flex-wrap:wrap;border-radius:var(--shape-corner);min-width:20rem;max-width:36rem;padding:.25rem 0;box-shadow:var(--mdui-elevation-level3);background-color:rgb(var(--mdui-color-inverse-surface));color:rgb(var(--mdui-color-inverse-on-surface));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([placement^=top]){transform-origin:top;top:1rem}:host([placement^=bottom]){transform-origin:bottom;bottom:1rem}:host([placement=bottom-start]),:host([placement=top-start]){left:1rem}:host([placement=bottom-end]),:host([placement=top-end]){right:1rem}.message{display:block;margin:.625rem 1rem}:host([message-line='1']) .message{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([message-line='2']) .message{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2}.action-group{display:flex;align-items:center;margin-left:auto;padding-right:.5rem}.action,.close-button{display:inline-flex;align-items:center;justify-content:center}.action{color:rgb(var(--mdui-color-inverse-primary));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking)}.action mdui-button,::slotted(mdui-button[slot=action][variant=outlined]),::slotted(mdui-button[slot=action][variant=text]){color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-primary)}.action mdui-button::part(button){padding:0 .5rem}.close-button{margin:0 -.25rem 0 .25rem;font-size:1.5rem;color:rgb(var(--mdui-color-inverse-on-surface))}.close-button mdui-button-icon,::slotted(mdui-button-icon[slot=close-button][variant=outlined]),::slotted(mdui-button-icon[slot=close-button][variant=standard]){font-size:inherit;color:inherit;--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-on-surface)}.close-button .i,::slotted([slot=close-icon]){font-size:inherit}`; let Snackbar = class Snackbar2 extends MduiElement { constructor() { super(); this.open = false; this.placement = "bottom"; this.actionLoading = false; this.closeable = false; this.autoCloseDelay = 5e3; this.closeOnOutsideClick = false; this.onDocumentClick = this.onDocumentClick.bind(this); } async onOpenChange() { const isMobile = breakpoint().down("sm"); const isCenteredHorizontally = ["top", "bottom"].includes(this.placement); const easingLinear = getEasing(this, "linear"); const easingEmphasizedDecelerate = getEasing(this, "emphasized-decelerate"); const children = Array.from(this.renderRoot.querySelectorAll(".message, .action-group")); const commonStyle = isMobile ? { left: "1rem", right: "1rem", minWidth: 0 } : isCenteredHorizontally ? { left: "50%" } : {}; if (this.open) { const hasUpdated = this.hasUpdated; if (!hasUpdated) { await this.updateComplete; } if (hasUpdated) { const eventProceeded = this.emit("open", { cancelable: true }); if (!eventProceeded) { return; } } window.clearTimeout(this.closeTimeout); if (this.autoCloseDelay) { this.closeTimeout = window.setTimeout(() => { this.open = false; }, this.autoCloseDelay); } this.style.display = "flex"; await Promise.all([ stopAnimations(this), ...children.map((child) => stopAnimations(child)) ]); const duration = getDuration(this, "medium4"); const getOpenStyle = (ident) => { const scaleY = `scaleY(${ident === "start" ? 0 : 1})`; if (isMobile) { return { transform: scaleY }; } else { return { transform: [ scaleY, isCenteredHorizontally ? "translateX(-50%)" : "" ].filter((i3) => i3).join(" ") }; } }; await Promise.all([ animateTo(this, [ { ...getOpenStyle("start"), ...commonStyle }, { ...getOpenStyle("end"), ...commonStyle } ], { duration: hasUpdated ? duration : 0, easing: easingEmphasizedDecelerate, fill: "forwards" }), animateTo(this, [{ opacity: 0 }, { opacity: 1, offset: 0.5 }, { opacity: 1 }], { duration: hasUpdated ? duration : 0, easing: easingLinear, fill: "forwards" }), ...children.map((child) => animateTo(child, [ { opacity: 0 }, { opacity: 0, offset: 0.2 }, { opacity: 1, offset: 0.8 }, { opacity: 1 } ], { duration: hasUpdated ? duration : 0, easing: easingLinear })) ]); if (hasUpdated) { this.emit("opened"); } return; } if (!this.open && this.hasUpdated) { const eventProceeded = this.emit("close", { cancelable: true }); if (!eventProceeded) { return; } window.clearTimeout(this.closeTimeout); await Promise.all([ stopAnimations(this), ...children.map((child) => stopAnimations(child)) ]); const duration = getDuration(this, "short4"); const getCloseStyle = (ident) => { const opacity = ident === "start" ? 1 : 0; const styles = { opacity }; if (!isMobile && isCenteredHorizontally) { Object.assign(styles, { transform: "translateX(-50%)" }); } return styles; }; await Promise.all([ animateTo(this, [ { ...getCloseStyle("start"), ...commonStyle }, { ...getCloseStyle("end"), ...commonStyle } ], { duration, easing: easingLinear, fill: "forwards" }), ...children.map((child) => animateTo(child, [{ opacity: 1 }, { opacity: 0, offset: 0.75 }, { opacity: 0 }], { duration, easing: easingLinear })) ]); this.style.display = "none"; this.emit("closed"); return; } } connectedCallback() { super.connectedCallback(); document.addEventListener("pointerdown", this.onDocumentClick); } disconnectedCallback() { super.disconnectedCallback(); document.removeEventListener("pointerdown", this.onDocumentClick); } render() { return ke`
${this.action ? ke`${this.action}` : nothingTemplate}${nn(this.closeable, () => ke`${this.closeIcon ? ke`` : ke``}`)}
`; } /** * 在 document 上点击时,根据条件判断是否要关闭 snackbar */ onDocumentClick(e2) { if (!this.open || !this.closeOnOutsideClick) { return; } const target = e2.target; if (!this.contains(target) && this !== target) { this.open = false; } } onActionClick(event) { event.stopPropagation(); this.emit("action-click"); } onCloseClick() { this.open = false; } }; Snackbar.styles = [componentStyle, style$2]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Snackbar.prototype, "open", void 0); __decorate([ n$1({ reflect: true }) ], Snackbar.prototype, "placement", void 0); __decorate([ n$1({ reflect: true, attribute: "action" }) ], Snackbar.prototype, "action", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "action-loading" }) ], Snackbar.prototype, "actionLoading", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Snackbar.prototype, "closeable", void 0); __decorate([ n$1({ reflect: true, attribute: "close-icon" }) ], Snackbar.prototype, "closeIcon", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "message-line" }) // eslint-disable-next-line prettier/prettier ], Snackbar.prototype, "messageLine", void 0); __decorate([ n$1({ type: Number, reflect: true, attribute: "auto-close-delay" }) ], Snackbar.prototype, "autoCloseDelay", void 0); __decorate([ n$1({ type: Boolean, reflect: true, attribute: "close-on-outside-click", converter: booleanConverter }) ], Snackbar.prototype, "closeOnOutsideClick", void 0); __decorate([ watch("open") ], Snackbar.prototype, "onOpenChange", null); Snackbar = __decorate([ t$1("mdui-snackbar") ], Snackbar); const style$1 = i$3`:host{--shape-corner:var(--mdui-shape-corner-full);--shape-corner-thumb:var(--mdui-shape-corner-full);position:relative;display:inline-block;cursor:pointer;-webkit-tap-highlight-color:transparent;height:2.5rem}:host([disabled]){cursor:default;pointer-events:none}label{display:inline-flex;align-items:center;width:100%;height:100%;white-space:nowrap;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}.track{position:relative;display:flex;align-items:center;border-radius:var(--shape-corner);transition-property:background-color,border-width;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard);height:2rem;width:3.25rem;border:.125rem solid rgb(var(--mdui-color-outline));background-color:rgb(var(--mdui-color-surface-container-highest))}:host([checked]) .track{background-color:rgb(var(--mdui-color-primary));border-width:0}.invalid .track{background-color:rgb(var(--mdui-color-error-container));border-color:rgb(var(--mdui-color-error))}:host([disabled]) .track{background-color:rgba(var(--mdui-color-surface-container-highest),.12);border-color:rgba(var(--mdui-color-on-surface),.12)}:host([disabled][checked]) .track{background-color:rgba(var(--mdui-color-on-surface),.12)}input{position:absolute;padding:0;opacity:0;pointer-events:none;width:1.25rem;height:1.25rem;margin:0 0 0 .625rem}mdui-ripple{border-radius:50%;transition-property:left,top;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard);width:2.5rem;height:2.5rem}.thumb{position:absolute;display:flex;align-items:center;justify-content:center;border-radius:var(--shape-corner-thumb);transition-property:width,height,left,background-color;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard);height:1rem;width:1rem;left:.375rem;background-color:rgb(var(--mdui-color-outline));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.thumb mdui-ripple{left:-.75rem;top:-.75rem}.has-unchecked-icon .thumb{height:1.5rem;width:1.5rem;left:.125rem}.has-unchecked-icon .thumb mdui-ripple{left:-.5rem;top:-.5rem}:host([focus-visible]) .thumb,:host([hover]) .thumb,:host([pressed]) .thumb{background-color:rgb(var(--mdui-color-on-surface-variant))}:host([checked]) .thumb{height:1.5rem;width:1.5rem;left:1.5rem;background-color:rgb(var(--mdui-color-on-primary));--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([checked]) .thumb mdui-ripple{left:-.5rem;top:-.5rem}:host([pressed]) .thumb{height:1.75rem;width:1.75rem;left:0}:host([pressed]) .thumb mdui-ripple{left:-.375rem;top:-.375rem}:host([pressed][checked]) .thumb{left:1.375rem}:host([focus-visible][checked]) .thumb,:host([hover][checked]) .thumb,:host([pressed][checked]) .thumb{background-color:rgb(var(--mdui-color-primary-container))}.invalid .thumb{background-color:rgb(var(--mdui-color-error));--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}:host([focus-visible]) .invalid .thumb,:host([hover]) .invalid .thumb,:host([pressed]) .invalid .thumb{background-color:rgb(var(--mdui-color-error))}:host([disabled]) .thumb{background-color:rgba(var(--mdui-color-on-surface),.38)}:host([disabled][checked]) .thumb{background-color:rgb(var(--mdui-color-surface))}.checked-icon,.unchecked-icon{display:flex;position:absolute;transition-property:opacity,transform;font-size:1rem}.unchecked-icon{opacity:1;transform:scale(1);transition-delay:var(--mdui-motion-duration-short1);transition-duration:var(--mdui-motion-duration-short3);transition-timing-function:var(--mdui-motion-easing-linear);color:rgb(var(--mdui-color-surface-container-highest))}:host([checked]) .unchecked-icon{opacity:0;transform:scale(.92);transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1)}:host([disabled]) .unchecked-icon{color:rgba(var(--mdui-color-surface-container-highest),.38)}.checked-icon{opacity:0;transform:scale(.92);transition-delay:0s;transition-duration:var(--mdui-motion-duration-short1);transition-timing-function:var(--mdui-motion-easing-linear);color:rgb(var(--mdui-color-on-primary-container))}:host([checked]) .checked-icon{opacity:1;transform:scale(1);transition-delay:var(--mdui-motion-duration-short1);transition-duration:var(--mdui-motion-duration-short3)}.invalid .checked-icon{color:rgb(var(--mdui-color-error-container))}:host([disabled]) .checked-icon{color:rgba(var(--mdui-color-on-surface),.38)}.checked-icon .i,.unchecked-icon .i,::slotted([slot=checked-icon]),::slotted([slot=unchecked-icon]){font-size:inherit;color:inherit}`; let Switch = class Switch2 extends RippleMixin(FocusableMixin(MduiElement)) { constructor() { super(...arguments); this.disabled = false; this.checked = false; this.defaultChecked = false; this.required = false; this.name = ""; this.value = "on"; this.invalid = false; this.rippleRef = ii(); this.inputRef = ii(); this.formController = new FormController(this, { value: (control) => control.checked ? control.value : void 0, defaultValue: (control) => control.defaultChecked, setValue: (control, checked) => control.checked = checked }); this.hasSlotController = new HasSlotController(this, "unchecked-icon"); } /** * 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState) */ get validity() { return this.inputRef.value.validity; } /** * 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串 */ get validationMessage() { return this.inputRef.value.validationMessage; } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return this.disabled; } get focusElement() { return this.inputRef.value; } get focusDisabled() { return this.disabled; } async onDisabledChange() { await this.updateComplete; this.invalid = !this.inputRef.value.checkValidity(); } async onCheckedChange() { var _a2; await this.updateComplete; const form = this.formController.getForm(); if (form && ((_a2 = formResets.get(form)) == null ? void 0 : _a2.has(this))) { this.invalid = false; formResets.get(form).delete(this); } else { this.invalid = !this.inputRef.value.checkValidity(); } } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true` */ checkValidity() { const valid = this.inputRef.value.checkValidity(); if (!valid) { this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); } return valid; } /** * 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。 * * 如果验证未通过,还会在组件上显示验证失败的提示。 */ reportValidity() { this.invalid = !this.inputRef.value.reportValidity(); if (this.invalid) { const eventProceeded = this.emit("invalid", { bubbles: false, cancelable: true, composed: false }); if (!eventProceeded) { this.blur(); this.focus(); } } return !this.invalid; } /** * 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证 * * @param message 自定义的错误提示文本 */ setCustomValidity(message) { this.inputRef.value.setCustomValidity(message); this.invalid = !this.inputRef.value.checkValidity(); } render() { return ke``; } /** * input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom */ onChange() { this.checked = this.inputRef.value.checked; this.emit("change"); } }; Switch.styles = [componentStyle, style$1]; __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Switch.prototype, "disabled", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Switch.prototype, "checked", void 0); __decorate([ defaultValue("checked") ], Switch.prototype, "defaultChecked", void 0); __decorate([ n$1({ reflect: true, attribute: "unchecked-icon" }) ], Switch.prototype, "uncheckedIcon", void 0); __decorate([ n$1({ reflect: true, attribute: "checked-icon" }) ], Switch.prototype, "checkedIcon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Switch.prototype, "required", void 0); __decorate([ n$1({ reflect: true }) ], Switch.prototype, "form", void 0); __decorate([ n$1({ reflect: true }) ], Switch.prototype, "name", void 0); __decorate([ n$1({ reflect: true }) ], Switch.prototype, "value", void 0); __decorate([ r$1() ], Switch.prototype, "invalid", void 0); __decorate([ watch("disabled", true), watch("required", true) ], Switch.prototype, "onDisabledChange", null); __decorate([ watch("checked", true) ], Switch.prototype, "onCheckedChange", null); Switch = __decorate([ t$1("mdui-switch") ], Switch); const tabStyle = i$3`:host{position:relative;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([active]){--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}.container{display:flex;justify-content:center;align-items:center;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;height:100%}.preset{flex-direction:column;min-height:3rem;padding:.625rem 1rem}:host([inline]) .preset{flex-direction:row}.icon-container,.label-container{position:relative;display:flex;align-items:center;justify-content:center}.icon-container ::slotted([slot=badge]){position:absolute;transform:translate(50%,-50%)}.icon-container ::slotted([slot=badge][variant=small]){transform:translate(.5625rem,-.5625rem)}.label-container ::slotted([slot=badge]){position:absolute;left:100%;bottom:100%;transform:translate(-.75rem,.625rem)}.label-container ::slotted([slot=badge][variant=small]){transform:translate(-.375rem,.375rem)}.icon,.label{display:flex;color:rgb(var(--mdui-color-on-surface-variant))}:host([focused]) .icon,:host([focused]) .label,:host([hover]) .icon,:host([hover]) .label,:host([pressed]) .icon,:host([pressed]) .label{color:rgb(var(--mdui-color-on-surface))}:host([active]) .icon,:host([active]) .label{color:rgb(var(--mdui-color-primary))}:host([active]) .variant-secondary .icon,:host([active]) .variant-secondary .label{color:rgb(var(--mdui-color-on-surface))}.icon{font-size:1.5rem}.label{font-size:var(--mdui-typescale-title-small-size);font-weight:var(--mdui-typescale-title-small-weight);letter-spacing:var(--mdui-typescale-title-small-tracking);line-height:var(--mdui-typescale-title-small-line-height)}.icon mdui-icon,::slotted([slot=icon]){font-size:inherit;color:inherit}`; let Tab = class Tab2 extends RippleMixin(FocusableMixin(MduiElement)) { constructor() { super(...arguments); this.inline = false; this.active = false; this.variant = "primary"; this.key = uniqueId(); this.rippleRef = ii(); this.hasSlotController = new HasSlotController(this, "icon", "custom"); } get rippleElement() { return this.rippleRef.value; } get rippleDisabled() { return false; } get focusElement() { return this; } get focusDisabled() { return false; } render() { const hasIcon = this.icon || this.hasSlotController.test("icon"); const hasCustomSlot = this.hasSlotController.test("custom"); const renderBadge = () => ke``; return ke`
${nn(hasIcon || this.icon, renderBadge)}${this.icon ? ke`` : nothingTemplate}
${nn(!hasIcon, renderBadge)}
`; } }; Tab.styles = [componentStyle, tabStyle]; __decorate([ n$1({ reflect: true }) ], Tab.prototype, "value", void 0); __decorate([ n$1({ reflect: true }) ], Tab.prototype, "icon", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Tab.prototype, "inline", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], Tab.prototype, "active", void 0); __decorate([ r$1() ], Tab.prototype, "variant", void 0); Tab = __decorate([ t$1("mdui-tab") ], Tab); const tabPanelStyle = i$3`:host{display:block;overflow-y:auto;flex:1 1 auto}:host(:not([active])){display:none}`; let TabPanel = class TabPanel2 extends MduiElement { constructor() { super(...arguments); this.active = false; } render() { return ke``; } }; TabPanel.styles = [ componentStyle, tabPanelStyle ]; __decorate([ n$1({ reflect: true }) ], TabPanel.prototype, "value", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter }) ], TabPanel.prototype, "active", void 0); TabPanel = __decorate([ t$1("mdui-tab-panel") ], TabPanel); const tabsStyle = i$3`:host{position:relative;display:flex}:host([placement^=top]){flex-direction:column}:host([placement^=bottom]){flex-direction:column-reverse}:host([placement^=left]){flex-direction:row}:host([placement^=right]){flex-direction:row-reverse}.container{position:relative;display:flex;flex:0 0 auto;overflow-x:auto;background-color:rgb(var(--mdui-color-surface))}:host([placement^=bottom]) .container,:host([placement^=top]) .container{flex-direction:row}:host([placement^=left]) .container,:host([placement^=right]) .container{flex-direction:column}:host([placement$='-start']) .container{justify-content:flex-start}:host([placement=bottom]) .container,:host([placement=left]) .container,:host([placement=right]) .container,:host([placement=top]) .container{justify-content:center}:host([placement$='-end']) .container{justify-content:flex-end}.container::after{content:' ';position:absolute;background-color:rgb(var(--mdui-color-surface-variant))}:host([placement^=bottom]) .container::after,:host([placement^=top]) .container::after{left:0;width:100%;height:.0625rem}:host([placement^=top]) .container::after{bottom:0}:host([placement^=bottom]) .container::after{top:0}:host([placement^=left]) .container::after,:host([placement^=right]) .container::after{top:0;height:100%;width:.0625rem}:host([placement^=left]) .container::after{right:0}:host([placement^=right]) .container::after{left:0}.indicator{position:absolute;z-index:1;background-color:rgb(var(--mdui-color-primary))}.container:not(.initial) .indicator{transition-duration:var(--mdui-motion-duration-medium2);transition-timing-function:var(--mdui-motion-easing-standard-decelerate)}:host([placement^=bottom]) .indicator,:host([placement^=top]) .indicator{transition-property:transform,left,width}:host([placement^=left]) .indicator,:host([placement^=right]) .indicator{transition-property:transform,top,height}:host([placement^=top]) .indicator{bottom:0}:host([placement^=bottom]) .indicator{top:0}:host([placement^=left]) .indicator{right:0}:host([placement^=right]) .indicator{left:0}:host([placement^=bottom][variant=primary]) .indicator,:host([placement^=top][variant=primary]) .indicator{height:.1875rem}:host([placement^=bottom][variant=secondary]) .indicator,:host([placement^=top][variant=secondary]) .indicator{height:.125rem}:host([placement^=left][variant=primary]) .indicator,:host([placement^=right][variant=primary]) .indicator{width:.1875rem}:host([placement^=left][variant=secondary]) .indicator,:host([placement^=right][variant=secondary]) .indicator{width:.125rem}:host([placement^=top][variant=primary]) .indicator{border-top-left-radius:.1875rem;border-top-right-radius:.1875rem}:host([placement^=bottom][variant=primary]) .indicator{border-bottom-right-radius:.1875rem;border-bottom-left-radius:.1875rem}:host([placement^=left][variant=primary]) .indicator{border-top-left-radius:.1875rem;border-bottom-left-radius:.1875rem}:host([placement^=right][variant=primary]) .indicator{border-top-right-radius:.1875rem;border-bottom-right-radius:.1875rem}:host([full-width]) ::slotted(mdui-tab){flex:1}`; let Tabs = class Tabs2 extends MduiElement { constructor() { super(...arguments); this.variant = "primary"; this.placement = "top-start"; this.fullWidth = false; this.activeKey = 0; this.isInitial = true; this.containerRef = ii(); this.indicatorRef = ii(); this.definedController = new DefinedController(this, { relatedElements: ["mdui-tab", "mdui-tab-panel"] }); } async onActiveKeyChange() { var _a2; await this.definedController.whenDefined(); this.value = (_a2 = this.tabs.find((tab) => tab.key === this.activeKey)) == null ? void 0 : _a2.value; this.updateActive(); if (!this.isInitial) { this.emit("change"); } } async onValueChange() { this.isInitial = !this.hasUpdated; await this.definedController.whenDefined(); const tab = this.tabs.find((tab2) => tab2.value === this.value); this.activeKey = (tab == null ? void 0 : tab.key) ?? 0; } async onIndicatorChange() { await this.updateComplete; this.updateIndicator(); } disconnectedCallback() { var _a2; super.disconnectedCallback(); (_a2 = this.observeResize) == null ? void 0 : _a2.unobserve(); } firstUpdated(_changedProperties) { super.firstUpdated(_changedProperties); this.observeResize = observeResize(this.containerRef.value, () => this.updateIndicator()); } render() { return ke`
`; } async onSlotChange() { await this.definedController.whenDefined(); this.updateActive(); } async onClick(event) { if (event.button) { return; } await this.definedController.whenDefined(); const target = event.target; const tab = target.closest("mdui-tab"); if (!tab) { return; } this.activeKey = tab.key; this.isInitial = false; this.updateActive(); } updateActive() { this.activeTab = this.tabs.map((tab) => { tab.active = this.activeKey === tab.key; return tab; }).find((tab) => tab.active); this.panels.forEach((panel) => { var _a2; return panel.active = panel.value === ((_a2 = this.activeTab) == null ? void 0 : _a2.value); }); this.updateIndicator(); } updateIndicator() { const activeTab = this.activeTab; const $indicator = $$1(this.indicatorRef.value); const isVertical = this.placement.startsWith("left") || this.placement.startsWith("right"); if (!activeTab) { $indicator.css({ transform: isVertical ? "scaleY(0)" : "scaleX(0)" }); return; } const $activeTab = $$1(activeTab); const offsetTop = activeTab.offsetTop; const offsetLeft = activeTab.offsetLeft; const commonStyle = isVertical ? { transform: "scaleY(1)", width: "", left: "" } : { transform: "scaleX(1)", height: "", top: "" }; let shownStyle = {}; if (this.variant === "primary") { const $customSlots = $activeTab.find(':scope > [slot="custom"]'); const children = $customSlots.length ? $customSlots.get() : $$1(activeTab.renderRoot).find('slot[name="custom"]').children().get(); if (isVertical) { const top = Math.min(...children.map((child) => child.offsetTop)) + offsetTop; const bottom = Math.max(...children.map((child) => child.offsetTop + child.offsetHeight)) + offsetTop; shownStyle = { top, height: bottom - top }; } else { const left = Math.min(...children.map((child) => child.offsetLeft)) + offsetLeft; const right = Math.max(...children.map((child) => child.offsetLeft + child.offsetWidth)) + offsetLeft; shownStyle = { left, width: right - left }; } } if (this.variant === "secondary") { shownStyle = isVertical ? { top: offsetTop, height: activeTab.offsetHeight } : { left: offsetLeft, width: activeTab.offsetWidth }; } $indicator.css({ ...commonStyle, ...shownStyle }); } }; Tabs.styles = [componentStyle, tabsStyle]; __decorate([ n$1({ reflect: true }) ], Tabs.prototype, "variant", void 0); __decorate([ n$1({ reflect: true }) ], Tabs.prototype, "value", void 0); __decorate([ n$1({ reflect: true }) ], Tabs.prototype, "placement", void 0); __decorate([ n$1({ type: Boolean, reflect: true, converter: booleanConverter, attribute: "full-width" }) ], Tabs.prototype, "fullWidth", void 0); __decorate([ r$1() ], Tabs.prototype, "activeKey", void 0); __decorate([ r$1() ], Tabs.prototype, "isInitial", void 0); __decorate([ o$1({ selector: "mdui-tab", flatten: true }) ], Tabs.prototype, "tabs", void 0); __decorate([ o$1({ selector: "mdui-tab-panel", slot: "panel", flatten: true }) ], Tabs.prototype, "panels", void 0); __decorate([ watch("activeKey", true) ], Tabs.prototype, "onActiveKeyChange", null); __decorate([ watch("value") ], Tabs.prototype, "onValueChange", null); __decorate([ watch("variant", true), watch("placement", true), watch("fullWidth", true) ], Tabs.prototype, "onIndicatorChange", null); Tabs = __decorate([ t$1("mdui-tabs") ], Tabs); class HoverController { /** * @param host * @param elementRef 检查鼠标是否放在该元素上 */ constructor(host, elementRef) { this.isHover = false; this.uniqueID = uniqueId(); this.enterEventName = `mouseenter.${this.uniqueID}.hoverController`; this.leaveEventName = `mouseleave.${this.uniqueID}.hoverController`; this.mouseEnterItems = []; this.mouseLeaveItems = []; (this.host = host).addController(this); this.elementRef = elementRef; } hostConnected() { this.host.updateComplete.then(() => { $$1(this.elementRef.value).on(this.enterEventName, () => { this.isHover = true; for (let i3 = this.mouseEnterItems.length - 1; i3 >= 0; i3--) { const item = this.mouseEnterItems[i3]; item.callback(); if (item.one) { this.mouseEnterItems.splice(i3, 1); } } }).on(this.leaveEventName, () => { this.isHover = false; for (let i3 = this.mouseLeaveItems.length - 1; i3 >= 0; i3--) { const item = this.mouseLeaveItems[i3]; item.callback(); if (item.one) { this.mouseLeaveItems.splice(i3, 1); } } }); }); } hostDisconnected() { $$1(this.elementRef.value).off(this.enterEventName).off(this.leaveEventName); } /** * 指定鼠标移入时的回调函数 * @param callback 要执行的回调函数 * @param one 是否仅执行一次 */ onMouseEnter(callback, one = false) { this.mouseEnterItems.push({ callback, one }); } /** * 指定鼠标移出时的回调函数 * @param callback 要执行的回调函数 * @param one 是否仅执行一次 */ onMouseLeave(callback, one = false) { this.mouseLeaveItems.push({ callback, one }); } } const style = i$3`:host{--shape-corner-plain:var(--mdui-shape-corner-extra-small);--shape-corner-rich:var(--mdui-shape-corner-medium);--z-index:2500;display:contents}.popup{position:fixed;display:flex;flex-direction:column;z-index:var(--z-index);border-radius:var(--shape-corner-plain);background-color:rgb(var(--mdui-color-inverse-surface));padding:0 .5rem;min-width:1.75rem;max-width:20rem}:host([variant=rich]) .popup{border-radius:var(--shape-corner-rich);background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2);padding:.75rem 1rem .5rem 1rem}.headline{display:flex;color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-title-small-size);font-weight:var(--mdui-typescale-title-small-weight);letter-spacing:var(--mdui-typescale-title-small-tracking);line-height:var(--mdui-typescale-title-small-line-height)}.content{display:flex;padding:.25rem 0;color:rgb(var(--mdui-color-inverse-on-surface));font-size:var(--mdui-typescale-body-small-size);font-weight:var(--mdui-typescale-body-small-weight);letter-spacing:var(--mdui-typescale-body-small-tracking);line-height:var(--mdui-typescale-body-small-line-height)}:host([variant=rich]) .content{color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}.action{display:flex;justify-content:flex-start;padding-top:.5rem}.action ::slotted(:not(:last-child)){margin-right:.5rem}`; let Tooltip = class Tooltip2 extends MduiElement { constructor() { super(); this.variant = "plain"; this.placement = "auto"; this.openDelay = 150; this.closeDelay = 150; this.trigger = "hover focus"; this.disabled = false; this.open = false; this.popupRef = ii(); this.hasSlotController = new HasSlotController(this, "headline", "action"); this.hoverController = new HoverController(this, this.popupRef); this.definedController = new DefinedController(this, { needDomReady: true }); this.onDocumentClick = this.onDocumentClick.bind(this); this.onWindowScroll = this.onWindowScroll.bind(this); this.onFocus = this.onFocus.bind(this); this.onBlur = this.onBlur.bind(this); this.onClick = this.onClick.bind(this); this.onKeydown = this.onKeydown.bind(this); this.onMouseEnter = this.onMouseEnter.bind(this); this.onMouseLeave = this.onMouseLeave.bind(this); } /** * 获取第一个非