c.541a83df.js 133 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744
  1. import{_ as e,j as t,e as i,y as a,k as n,I as r,J as o,d as s,n as l,K as d,L as c,N as u,O as h,P as p,Q as m,S as v,T as f,U as b,x as y,z as g,M as _,f as k,i as x,B as w,E as $,G as C,V as E,W as S,X as A,Y as B,Z as R,$ as V,t as M,a0 as I,a1 as L,p as P,a2 as T,h as K,a3 as D,a4 as F,R as O,D as H,a5 as q,a6 as N,a7 as z}from"./main-ec7846c8.js";import{F as j,s as U}from"./c.0e3055bd.js";import{o as X}from"./c.8e28b461.js";import{o as W}from"./c.eea05cf6.js";import{c as G}from"./c.3db34379.js";const Y={info:d,warning:c,error:u,success:h};e([l("ha-alert")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i()],key:"title",value:()=>""},{kind:"field",decorators:[i({attribute:"alert-type"})],key:"alertType",value:()=>"info"},{kind:"field",decorators:[i({type:Boolean})],key:"dismissable",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"rtl",value:()=>!1},{kind:"method",key:"render",value:function(){return a`
  2. <div
  3. class="issue-type ${n({rtl:this.rtl,[this.alertType]:!0})}"
  4. role="alert"
  5. >
  6. <div class="icon ${this.title?"":"no-title"}">
  7. <slot name="icon">
  8. <ha-svg-icon .path=${Y[this.alertType]}></ha-svg-icon>
  9. </slot>
  10. </div>
  11. <div class="content">
  12. <div class="main-content">
  13. ${this.title?a`<div class="title">${this.title}</div>`:""}
  14. <slot></slot>
  15. </div>
  16. <div class="action">
  17. <slot name="action">
  18. ${this.dismissable?a`<ha-icon-button
  19. @click=${this._dismiss_clicked}
  20. label="Dismiss alert"
  21. .path=${r}
  22. ></ha-icon-button>`:""}
  23. </slot>
  24. </div>
  25. </div>
  26. </div>
  27. `}},{kind:"method",key:"_dismiss_clicked",value:function(){o(this,"alert-dismissed-clicked")}},{kind:"field",static:!0,key:"styles",value:()=>s`
  28. .issue-type {
  29. position: relative;
  30. padding: 8px;
  31. display: flex;
  32. }
  33. .issue-type.rtl {
  34. flex-direction: row-reverse;
  35. }
  36. .issue-type::after {
  37. position: absolute;
  38. top: 0;
  39. right: 0;
  40. bottom: 0;
  41. left: 0;
  42. opacity: 0.12;
  43. pointer-events: none;
  44. content: "";
  45. border-radius: 4px;
  46. }
  47. .icon {
  48. z-index: 1;
  49. }
  50. .icon.no-title {
  51. align-self: center;
  52. }
  53. .issue-type.rtl > .content {
  54. flex-direction: row-reverse;
  55. text-align: right;
  56. }
  57. .content {
  58. display: flex;
  59. justify-content: space-between;
  60. align-items: center;
  61. width: 100%;
  62. }
  63. .action {
  64. z-index: 1;
  65. width: min-content;
  66. --mdc-theme-primary: var(--primary-text-color);
  67. }
  68. .main-content {
  69. overflow-wrap: anywhere;
  70. word-break: break-word;
  71. margin-left: 8px;
  72. margin-right: 0;
  73. }
  74. .issue-type.rtl > .content > .main-content {
  75. margin-left: 0;
  76. margin-right: 8px;
  77. }
  78. .title {
  79. margin-top: 2px;
  80. font-weight: bold;
  81. }
  82. .action mwc-button,
  83. .action ha-icon-button {
  84. --mdc-theme-primary: var(--primary-text-color);
  85. --mdc-icon-button-size: 36px;
  86. }
  87. .issue-type.info > .icon {
  88. color: var(--info-color);
  89. }
  90. .issue-type.info::after {
  91. background-color: var(--info-color);
  92. }
  93. .issue-type.warning > .icon {
  94. color: var(--warning-color);
  95. }
  96. .issue-type.warning::after {
  97. background-color: var(--warning-color);
  98. }
  99. .issue-type.error > .icon {
  100. color: var(--error-color);
  101. }
  102. .issue-type.error::after {
  103. background-color: var(--error-color);
  104. }
  105. .issue-type.success > .icon {
  106. color: var(--success-color);
  107. }
  108. .issue-type.success::after {
  109. background-color: var(--success-color);
  110. }
  111. `}]}}),t);const J=p(class extends m{constructor(e){if(super(e),v(this,"_element",void 0),e.type!==f.CHILD)throw new Error("dynamicElementDirective can only be used in content bindings")}update(e,[t,i]){return this._element&&this._element.localName===t?(i&&Object.entries(i).forEach((([e,t])=>{this._element[e]=t})),b):this.render(t,i)}render(e,t){return this._element=document.createElement(e),t&&Object.entries(t).forEach((([e,t])=>{this._element[e]=t})),this._element}}),Q={action:()=>import("./c.62767b73.js"),addon:()=>import("./c.0f2c7a19.js"),area:()=>import("./c.35c1b222.js"),attribute:()=>import("./c.56b8e866.js"),boolean:()=>import("./c.388e95d4.js"),"color-rgb":()=>import("./c.82f7d184.js"),"config-entry":()=>import("./c.f3b919a6.js"),date:()=>import("./c.a66b9724.js"),datetime:()=>import("./c.7ff3a36b.js"),device:()=>import("./c.1067c64a.js"),duration:()=>import("./c.993c72af.js"),entity:()=>import("./c.90249400.js"),file:()=>import("./c.08b532a7.js"),navigation:()=>import("./c.0f34374f.js"),number:()=>import("./c.5bdef5ef.js"),object:()=>import("./c.6b4b6aa6.js"),select:()=>Promise.resolve().then((function(){return Qe})),state:()=>import("./c.2f5573d4.js"),target:()=>import("./c.cacb2283.js"),template:()=>import("./c.3e105a28.js"),text:()=>import("./c.d2723eef.js"),time:()=>import("./c.2afbc6de.js"),icon:()=>import("./c.28596b81.js"),media:()=>import("./c.fb45139f.js").then((function(e){return e.h})),theme:()=>import("./c.923b9541.js"),location:()=>import("./c.bf0fb3ba.js"),"color-temp":()=>import("./c.75843f76.js"),"ui-action":()=>import("./c.e3089bb2.js")};e([l("ha-selector")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i()],key:"hass",value:void 0},{kind:"field",decorators:[i()],key:"selector",value:void 0},{kind:"field",decorators:[i()],key:"value",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i()],key:"helper",value:void 0},{kind:"field",decorators:[i()],key:"placeholder",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"required",value:()=>!0},{kind:"field",decorators:[i()],key:"context",value:void 0},{kind:"method",key:"focus",value:function(){var e,t;null===(e=this.shadowRoot)||void 0===e||null===(t=e.getElementById("selector"))||void 0===t||t.focus()}},{kind:"get",key:"_type",value:function(){return Object.keys(this.selector)[0]}},{kind:"method",key:"willUpdate",value:function(e){var t;e.has("selector")&&this.selector&&(null===(t=Q[this._type])||void 0===t||t.call(Q))}},{kind:"method",key:"render",value:function(){return a`
  112. ${J(`ha-selector-${this._type}`,{hass:this.hass,selector:this.selector,value:this.value,label:this.label,placeholder:this.placeholder,disabled:this.disabled,required:this.required,helper:this.helper,context:this.context,id:"selector"})}
  113. `}}]}}),t);var Z={ROOT:"mdc-form-field"},ee={LABEL_SELECTOR:".mdc-form-field > label"},te=function(e){function t(i){var a=e.call(this,g(g({},t.defaultAdapter),i))||this;return a.click=function(){a.handleClick()},a}return y(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return Z},enumerable:!1,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return ee},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{activateInputRipple:function(){},deactivateInputRipple:function(){},deregisterInteractionHandler:function(){},registerInteractionHandler:function(){}}},enumerable:!1,configurable:!0}),t.prototype.init=function(){this.adapter.registerInteractionHandler("click",this.click)},t.prototype.destroy=function(){this.adapter.deregisterInteractionHandler("click",this.click)},t.prototype.handleClick=function(){var e=this;this.adapter.activateInputRipple(),requestAnimationFrame((function(){e.adapter.deactivateInputRipple()}))},t}(_);class ie extends w{constructor(){super(...arguments),this.alignEnd=!1,this.spaceBetween=!1,this.nowrap=!1,this.label="",this.mdcFoundationClass=te}createAdapter(){return{registerInteractionHandler:(e,t)=>{this.labelEl.addEventListener(e,t)},deregisterInteractionHandler:(e,t)=>{this.labelEl.removeEventListener(e,t)},activateInputRipple:async()=>{const e=this.input;if(e instanceof j){const t=await e.ripple;t&&t.startPress()}},deactivateInputRipple:async()=>{const e=this.input;if(e instanceof j){const t=await e.ripple;t&&t.endPress()}}}}get input(){var e,t;return null!==(t=null===(e=this.slottedInputs)||void 0===e?void 0:e[0])&&void 0!==t?t:null}render(){const e={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return a`
  114. <div class="mdc-form-field ${n(e)}">
  115. <slot></slot>
  116. <label class="mdc-label"
  117. @click="${this._labelClick}">${this.label}</label>
  118. </div>`}click(){this._labelClick()}_labelClick(){const e=this.input;e&&(e.focus(),e.click())}}k([i({type:Boolean})],ie.prototype,"alignEnd",void 0),k([i({type:Boolean})],ie.prototype,"spaceBetween",void 0),k([i({type:Boolean})],ie.prototype,"nowrap",void 0),k([i({type:String}),X((async function(e){var t;null===(t=this.input)||void 0===t||t.setAttribute("aria-label",e)}))],ie.prototype,"label",void 0),k([x(".mdc-form-field")],ie.prototype,"mdcRoot",void 0),k([W("",!0,"*")],ie.prototype,"slottedInputs",void 0),k([x("label")],ie.prototype,"labelEl",void 0);const ae=s`.mdc-form-field{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));display:inline-flex;align-items:center;vertical-align:middle}.mdc-form-field>label{margin-left:0;margin-right:auto;padding-left:4px;padding-right:0;order:0}[dir=rtl] .mdc-form-field>label,.mdc-form-field>label[dir=rtl]{margin-left:auto;margin-right:0}[dir=rtl] .mdc-form-field>label,.mdc-form-field>label[dir=rtl]{padding-left:0;padding-right:4px}.mdc-form-field--nowrap>label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.mdc-form-field--align-end>label{margin-left:auto;margin-right:0;padding-left:0;padding-right:4px;order:-1}[dir=rtl] .mdc-form-field--align-end>label,.mdc-form-field--align-end>label[dir=rtl]{margin-left:0;margin-right:auto}[dir=rtl] .mdc-form-field--align-end>label,.mdc-form-field--align-end>label[dir=rtl]{padding-left:4px;padding-right:0}.mdc-form-field--space-between{justify-content:space-between}.mdc-form-field--space-between>label{margin:0}[dir=rtl] .mdc-form-field--space-between>label,.mdc-form-field--space-between>label[dir=rtl]{margin:0}:host{display:inline-flex}.mdc-form-field{width:100%}::slotted(*){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}::slotted(mwc-switch){margin-right:10px}[dir=rtl] ::slotted(mwc-switch),::slotted(mwc-switch[dir=rtl]){margin-left:10px}`;let ne=class extends ie{};ne.styles=[ae],ne=k([l("mwc-formfield")],ne),e([l("ha-form-boolean")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i()],key:"schema",value:void 0},{kind:"field",decorators:[i()],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[x("ha-checkbox",!0)],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){return a`
  119. <mwc-formfield .label=${this.label}>
  120. <ha-checkbox
  121. .checked=${this.data}
  122. .disabled=${this.disabled}
  123. @change=${this._valueChanged}
  124. ></ha-checkbox>
  125. </mwc-formfield>
  126. `}},{kind:"method",key:"_valueChanged",value:function(e){o(this,"value-changed",{value:e.target.checked})}}]}}),t),e([l("ha-form-constant")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"method",key:"render",value:function(){return a`<span class="label">${this.label}</span>${this.schema.value?`: ${this.schema.value}`:""}`}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  127. :host {
  128. display: block;
  129. }
  130. .label {
  131. font-weight: 500;
  132. }
  133. `}}]}}),t),e([l("ha-form-float")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[x("ha-textfield")],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){var e;return a`
  134. <ha-textfield
  135. type="numeric"
  136. inputMode="decimal"
  137. .label=${this.label}
  138. .value=${void 0!==this.data?this.data:""}
  139. .disabled=${this.disabled}
  140. .required=${this.schema.required}
  141. .autoValidate=${this.schema.required}
  142. .suffix=${null===(e=this.schema.description)||void 0===e?void 0:e.suffix}
  143. .validationMessage=${this.schema.required?"Required":void 0}
  144. @input=${this._valueChanged}
  145. ></ha-textfield>
  146. `}},{kind:"method",key:"updated",value:function(e){e.has("schema")&&this.toggleAttribute("own-margin",!!this.schema.required)}},{kind:"method",key:"_valueChanged",value:function(e){const t=e.target,i=t.value.replace(",",".");let a;if(!i.endsWith(".")&&"-"!==i)if(""!==i&&(a=parseFloat(i),isNaN(a)&&(a=void 0)),this.data!==a)o(this,"value-changed",{value:a});else{const e=void 0===a?"":String(a);t.value!==e&&(t.value=e)}}},{kind:"field",static:!0,key:"styles",value:()=>s`
  147. :host([own-margin]) {
  148. margin-bottom: 5px;
  149. }
  150. ha-textfield {
  151. display: block;
  152. }
  153. `}]}}),t),e([l("ha-form-grid")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[i({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[i()],key:"computeLabel",value:void 0},{kind:"field",decorators:[i()],key:"computeHelper",value:void 0},{kind:"method",key:"firstUpdated",value:function(e){$(C(n.prototype),"firstUpdated",this).call(this,e),this.setAttribute("own-margin","")}},{kind:"method",key:"updated",value:function(e){$(C(n.prototype),"updated",this).call(this,e),e.has("schema")&&(this.schema.column_min_width?this.style.setProperty("--form-grid-min-width",this.schema.column_min_width):this.style.setProperty("--form-grid-min-width",""))}},{kind:"method",key:"render",value:function(){return a`
  154. ${this.schema.schema.map((e=>a`
  155. <ha-form
  156. .hass=${this.hass}
  157. .data=${this.data}
  158. .schema=${[e]}
  159. .disabled=${this.disabled}
  160. .computeLabel=${this.computeLabel}
  161. .computeHelper=${this.computeHelper}
  162. ></ha-form>
  163. `))}
  164. `}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  165. :host {
  166. display: grid !important;
  167. grid-template-columns: repeat(
  168. var(--form-grid-column-count, auto-fit),
  169. minmax(var(--form-grid-min-width, 200px), 1fr)
  170. );
  171. grid-gap: 8px;
  172. }
  173. :host > ha-form {
  174. display: block;
  175. margin-bottom: 24px;
  176. }
  177. `}}]}}),t);const re=E({_template:S`
  178. <style>
  179. :host {
  180. display: inline-block;
  181. position: fixed;
  182. clip: rect(0px,0px,0px,0px);
  183. }
  184. </style>
  185. <div aria-live$="[[mode]]">[[_text]]</div>
  186. `,is:"iron-a11y-announcer",properties:{mode:{type:String,value:"polite"},timeout:{type:Number,value:150},_text:{type:String,value:""}},created:function(){re.instance||(re.instance=this),document.addEventListener("iron-announce",this._onIronAnnounce.bind(this))},announce:function(e){this._text="",this.async((function(){this._text=e}),this.timeout)},_onIronAnnounce:function(e){e.detail&&e.detail.text&&this.announce(e.detail.text)}});re.instance=null,re.requestAvailability=function(){re.instance||(re.instance=document.createElement("iron-a11y-announcer")),document.body?document.body.appendChild(re.instance):document.addEventListener("load",(function(){document.body.appendChild(re.instance)}))};class oe{constructor(e){oe[" "](e),this.type=e&&e.type||"default",this.key=e&&e.key,e&&"value"in e&&(this.value=e.value)}get value(){var e=this.type,t=this.key;if(e&&t)return oe.types[e]&&oe.types[e][t]}set value(e){var t=this.type,i=this.key;t&&i&&(t=oe.types[t]=oe.types[t]||{},null==e?delete t[i]:t[i]=e)}get list(){if(this.type){var e=oe.types[this.type];return e?Object.keys(e).map((function(e){return se[this.type][e]}),this):[]}}byKey(e){return this.key=e,this.value}}oe[" "]=function(){},oe.types={};var se=oe.types;E({is:"iron-meta",properties:{type:{type:String,value:"default"},key:{type:String},value:{type:String,notify:!0},self:{type:Boolean,observer:"_selfChanged"},__meta:{type:Boolean,computed:"__computeMeta(type, key, value)"}},hostAttributes:{hidden:!0},__computeMeta:function(e,t,i){var a=new oe({type:e,key:t});return void 0!==i&&i!==a.value?a.value=i:this.value!==a.value&&(this.value=a.value),a},get list(){return this.__meta&&this.__meta.list},_selfChanged:function(e){e&&(this.value=this)},byKey:function(e){return new oe({type:this.type,key:e}).value}});let le=null;const de={properties:{validator:{type:String},invalid:{notify:!0,reflectToAttribute:!0,type:Boolean,value:!1,observer:"_invalidChanged"}},registered:function(){le=new oe({type:"validator"})},_invalidChanged:function(){this.invalid?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid")},get _validator(){return le&&le.byKey(this.validator)},hasValidator:function(){return null!=this._validator},validate:function(e){return void 0===e&&void 0!==this.value?this.invalid=!this._getValidity(this.value):this.invalid=!this._getValidity(e),!this.invalid},_getValidity:function(e){return!this.hasValidator()||this._validator.validate(e)}};E({_template:S`
  187. <style>
  188. :host {
  189. display: inline-block;
  190. }
  191. </style>
  192. <slot id="content"></slot>
  193. `,is:"iron-input",behaviors:[de],properties:{bindValue:{type:String,value:""},value:{type:String,computed:"_computeValue(bindValue)"},allowedPattern:{type:String},autoValidate:{type:Boolean,value:!1},_inputElement:Object},observers:["_bindValueChanged(bindValue, _inputElement)"],listeners:{input:"_onInput",keypress:"_onKeypress"},created:function(){re.requestAvailability(),this._previousValidInput="",this._patternAlreadyChecked=!1},attached:function(){this._observer=A(this).observeNodes(function(e){this._initSlottedInput()}.bind(this))},detached:function(){this._observer&&(A(this).unobserveNodes(this._observer),this._observer=null)},get inputElement(){return this._inputElement},_initSlottedInput:function(){this._inputElement=this.getEffectiveChildren()[0],this.inputElement&&this.inputElement.value&&(this.bindValue=this.inputElement.value),this.fire("iron-input-ready")},get _patternRegExp(){var e;if(this.allowedPattern)e=new RegExp(this.allowedPattern);else if("number"===this.inputElement.type)e=/[0-9.,e-]/;return e},_bindValueChanged:function(e,t){t&&(void 0===e?t.value=null:e!==t.value&&(this.inputElement.value=e),this.autoValidate&&this.validate(),this.fire("bind-value-changed",{value:e}))},_onInput:function(){this.allowedPattern&&!this._patternAlreadyChecked&&(this._checkPatternValidity()||(this._announceInvalidCharacter("Invalid string of characters not entered."),this.inputElement.value=this._previousValidInput));this.bindValue=this._previousValidInput=this.inputElement.value,this._patternAlreadyChecked=!1},_isPrintable:function(e){var t=8==e.keyCode||9==e.keyCode||13==e.keyCode||27==e.keyCode,i=19==e.keyCode||20==e.keyCode||45==e.keyCode||46==e.keyCode||144==e.keyCode||145==e.keyCode||e.keyCode>32&&e.keyCode<41||e.keyCode>111&&e.keyCode<124;return!(t||0==e.charCode&&i)},_onKeypress:function(e){if(this.allowedPattern||"number"===this.inputElement.type){var t=this._patternRegExp;if(t&&!(e.metaKey||e.ctrlKey||e.altKey)){this._patternAlreadyChecked=!0;var i=String.fromCharCode(e.charCode);this._isPrintable(e)&&!t.test(i)&&(e.preventDefault(),this._announceInvalidCharacter("Invalid character "+i+" not entered."))}}},_checkPatternValidity:function(){var e=this._patternRegExp;if(!e)return!0;for(var t=0;t<this.inputElement.value.length;t++)if(!e.test(this.inputElement.value[t]))return!1;return!0},validate:function(){if(!this.inputElement)return this.invalid=!1,!0;var e=this.inputElement.checkValidity();return e&&(this.required&&""===this.bindValue?e=!1:this.hasValidator()&&(e=de.validate.call(this,this.bindValue))),this.invalid=!e,this.fire("iron-input-validate"),e},_announceInvalidCharacter:function(e){this.fire("iron-announce",{text:e})},_computeValue:function(e){return e}});const ce={attached:function(){this.fire("addon-attached")},update:function(e){}};E({_template:S`
  194. <style>
  195. :host {
  196. display: inline-block;
  197. float: right;
  198. @apply --paper-font-caption;
  199. @apply --paper-input-char-counter;
  200. }
  201. :host([hidden]) {
  202. display: none !important;
  203. }
  204. :host(:dir(rtl)) {
  205. float: left;
  206. }
  207. </style>
  208. <span>[[_charCounterStr]]</span>
  209. `,is:"paper-input-char-counter",behaviors:[ce],properties:{_charCounterStr:{type:String,value:"0"}},update:function(e){if(e.inputElement){e.value=e.value||"";var t=e.value.toString().length.toString();e.inputElement.hasAttribute("maxlength")&&(t+="/"+e.inputElement.getAttribute("maxlength")),this._charCounterStr=t}}});const ue=S`
  210. <custom-style>
  211. <style is="custom-style">
  212. html {
  213. --paper-input-container-shared-input-style: {
  214. position: relative; /* to make a stacking context */
  215. outline: none;
  216. box-shadow: none;
  217. padding: 0;
  218. margin: 0;
  219. width: 100%;
  220. max-width: 100%;
  221. background: transparent;
  222. border: none;
  223. color: var(--paper-input-container-input-color, var(--primary-text-color));
  224. -webkit-appearance: none;
  225. text-align: inherit;
  226. vertical-align: var(--paper-input-container-input-align, bottom);
  227. @apply --paper-font-subhead;
  228. };
  229. }
  230. </style>
  231. </custom-style>
  232. `;ue.setAttribute("style","display: none;"),document.head.appendChild(ue.content),E({_template:S`
  233. <style>
  234. :host {
  235. display: block;
  236. padding: 8px 0;
  237. @apply --paper-input-container;
  238. }
  239. :host([inline]) {
  240. display: inline-block;
  241. }
  242. :host([disabled]) {
  243. pointer-events: none;
  244. opacity: 0.33;
  245. @apply --paper-input-container-disabled;
  246. }
  247. :host([hidden]) {
  248. display: none !important;
  249. }
  250. [hidden] {
  251. display: none !important;
  252. }
  253. .floated-label-placeholder {
  254. @apply --paper-font-caption;
  255. }
  256. .underline {
  257. height: 2px;
  258. position: relative;
  259. }
  260. .focused-line {
  261. @apply --layout-fit;
  262. border-bottom: 2px solid var(--paper-input-container-focus-color, var(--primary-color));
  263. -webkit-transform-origin: center center;
  264. transform-origin: center center;
  265. -webkit-transform: scale3d(0,1,1);
  266. transform: scale3d(0,1,1);
  267. @apply --paper-input-container-underline-focus;
  268. }
  269. .underline.is-highlighted .focused-line {
  270. -webkit-transform: none;
  271. transform: none;
  272. -webkit-transition: -webkit-transform 0.25s;
  273. transition: transform 0.25s;
  274. @apply --paper-transition-easing;
  275. }
  276. .underline.is-invalid .focused-line {
  277. border-color: var(--paper-input-container-invalid-color, var(--error-color));
  278. -webkit-transform: none;
  279. transform: none;
  280. -webkit-transition: -webkit-transform 0.25s;
  281. transition: transform 0.25s;
  282. @apply --paper-transition-easing;
  283. }
  284. .unfocused-line {
  285. @apply --layout-fit;
  286. border-bottom: 1px solid var(--paper-input-container-color, var(--secondary-text-color));
  287. @apply --paper-input-container-underline;
  288. }
  289. :host([disabled]) .unfocused-line {
  290. border-bottom: 1px dashed;
  291. border-color: var(--paper-input-container-color, var(--secondary-text-color));
  292. @apply --paper-input-container-underline-disabled;
  293. }
  294. .input-wrapper {
  295. @apply --layout-horizontal;
  296. @apply --layout-center;
  297. position: relative;
  298. }
  299. .input-content {
  300. @apply --layout-flex-auto;
  301. @apply --layout-relative;
  302. max-width: 100%;
  303. }
  304. .input-content ::slotted(label),
  305. .input-content ::slotted(.paper-input-label) {
  306. position: absolute;
  307. top: 0;
  308. left: 0;
  309. width: 100%;
  310. font: inherit;
  311. color: var(--paper-input-container-color, var(--secondary-text-color));
  312. -webkit-transition: -webkit-transform 0.25s, width 0.25s;
  313. transition: transform 0.25s, width 0.25s;
  314. -webkit-transform-origin: left top;
  315. transform-origin: left top;
  316. /* Fix for safari not focusing 0-height date/time inputs with -webkit-apperance: none; */
  317. min-height: 1px;
  318. @apply --paper-font-common-nowrap;
  319. @apply --paper-font-subhead;
  320. @apply --paper-input-container-label;
  321. @apply --paper-transition-easing;
  322. }
  323. .input-content ::slotted(label):before,
  324. .input-content ::slotted(.paper-input-label):before {
  325. @apply --paper-input-container-label-before;
  326. }
  327. .input-content ::slotted(label):after,
  328. .input-content ::slotted(.paper-input-label):after {
  329. @apply --paper-input-container-label-after;
  330. }
  331. .input-content.label-is-floating ::slotted(label),
  332. .input-content.label-is-floating ::slotted(.paper-input-label) {
  333. -webkit-transform: translateY(-75%) scale(0.75);
  334. transform: translateY(-75%) scale(0.75);
  335. /* Since we scale to 75/100 of the size, we actually have 100/75 of the
  336. original space now available */
  337. width: 133%;
  338. @apply --paper-input-container-label-floating;
  339. }
  340. :host(:dir(rtl)) .input-content.label-is-floating ::slotted(label),
  341. :host(:dir(rtl)) .input-content.label-is-floating ::slotted(.paper-input-label) {
  342. right: 0;
  343. left: auto;
  344. -webkit-transform-origin: right top;
  345. transform-origin: right top;
  346. }
  347. .input-content.label-is-highlighted ::slotted(label),
  348. .input-content.label-is-highlighted ::slotted(.paper-input-label) {
  349. color: var(--paper-input-container-focus-color, var(--primary-color));
  350. @apply --paper-input-container-label-focus;
  351. }
  352. .input-content.is-invalid ::slotted(label),
  353. .input-content.is-invalid ::slotted(.paper-input-label) {
  354. color: var(--paper-input-container-invalid-color, var(--error-color));
  355. }
  356. .input-content.label-is-hidden ::slotted(label),
  357. .input-content.label-is-hidden ::slotted(.paper-input-label) {
  358. visibility: hidden;
  359. }
  360. .input-content ::slotted(input),
  361. .input-content ::slotted(iron-input),
  362. .input-content ::slotted(textarea),
  363. .input-content ::slotted(iron-autogrow-textarea),
  364. .input-content ::slotted(.paper-input-input) {
  365. @apply --paper-input-container-shared-input-style;
  366. /* The apply shim doesn't apply the nested color custom property,
  367. so we have to re-apply it here. */
  368. color: var(--paper-input-container-input-color, var(--primary-text-color));
  369. @apply --paper-input-container-input;
  370. }
  371. .input-content ::slotted(input)::-webkit-outer-spin-button,
  372. .input-content ::slotted(input)::-webkit-inner-spin-button {
  373. @apply --paper-input-container-input-webkit-spinner;
  374. }
  375. .input-content.focused ::slotted(input),
  376. .input-content.focused ::slotted(iron-input),
  377. .input-content.focused ::slotted(textarea),
  378. .input-content.focused ::slotted(iron-autogrow-textarea),
  379. .input-content.focused ::slotted(.paper-input-input) {
  380. @apply --paper-input-container-input-focus;
  381. }
  382. .input-content.is-invalid ::slotted(input),
  383. .input-content.is-invalid ::slotted(iron-input),
  384. .input-content.is-invalid ::slotted(textarea),
  385. .input-content.is-invalid ::slotted(iron-autogrow-textarea),
  386. .input-content.is-invalid ::slotted(.paper-input-input) {
  387. @apply --paper-input-container-input-invalid;
  388. }
  389. .prefix ::slotted(*) {
  390. display: inline-block;
  391. @apply --paper-font-subhead;
  392. @apply --layout-flex-none;
  393. @apply --paper-input-prefix;
  394. }
  395. .suffix ::slotted(*) {
  396. display: inline-block;
  397. @apply --paper-font-subhead;
  398. @apply --layout-flex-none;
  399. @apply --paper-input-suffix;
  400. }
  401. /* Firefox sets a min-width on the input, which can cause layout issues */
  402. .input-content ::slotted(input) {
  403. min-width: 0;
  404. }
  405. .input-content ::slotted(textarea) {
  406. resize: none;
  407. }
  408. .add-on-content {
  409. position: relative;
  410. }
  411. .add-on-content.is-invalid ::slotted(*) {
  412. color: var(--paper-input-container-invalid-color, var(--error-color));
  413. }
  414. .add-on-content.is-highlighted ::slotted(*) {
  415. color: var(--paper-input-container-focus-color, var(--primary-color));
  416. }
  417. </style>
  418. <div class="floated-label-placeholder" aria-hidden="true" hidden="[[noLabelFloat]]">&nbsp;</div>
  419. <div class="input-wrapper">
  420. <span class="prefix"><slot name="prefix"></slot></span>
  421. <div class$="[[_computeInputContentClass(noLabelFloat,alwaysFloatLabel,focused,invalid,_inputHasContent)]]" id="labelAndInputContainer">
  422. <slot name="label"></slot>
  423. <slot name="input"></slot>
  424. </div>
  425. <span class="suffix"><slot name="suffix"></slot></span>
  426. </div>
  427. <div class$="[[_computeUnderlineClass(focused,invalid)]]">
  428. <div class="unfocused-line"></div>
  429. <div class="focused-line"></div>
  430. </div>
  431. <div class$="[[_computeAddOnContentClass(focused,invalid)]]">
  432. <slot name="add-on"></slot>
  433. </div>
  434. `,is:"paper-input-container",properties:{noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},attrForValue:{type:String,value:"bind-value"},autoValidate:{type:Boolean,value:!1},invalid:{observer:"_invalidChanged",type:Boolean,value:!1},focused:{readOnly:!0,type:Boolean,value:!1,notify:!0},_addons:{type:Array},_inputHasContent:{type:Boolean,value:!1},_inputSelector:{type:String,value:"input,iron-input,textarea,.paper-input-input"},_boundOnFocus:{type:Function,value:function(){return this._onFocus.bind(this)}},_boundOnBlur:{type:Function,value:function(){return this._onBlur.bind(this)}},_boundOnInput:{type:Function,value:function(){return this._onInput.bind(this)}},_boundValueChanged:{type:Function,value:function(){return this._onValueChanged.bind(this)}}},listeners:{"addon-attached":"_onAddonAttached","iron-input-validate":"_onIronInputValidate"},get _valueChangedEvent(){return this.attrForValue+"-changed"},get _propertyForValue(){return B(this.attrForValue)},get _inputElement(){return A(this).querySelector(this._inputSelector)},get _inputElementValue(){return this._inputElement[this._propertyForValue]||this._inputElement.value},ready:function(){this.__isFirstValueUpdate=!0,this._addons||(this._addons=[]),this.addEventListener("focus",this._boundOnFocus,!0),this.addEventListener("blur",this._boundOnBlur,!0)},attached:function(){this.attrForValue?this._inputElement.addEventListener(this._valueChangedEvent,this._boundValueChanged):this.addEventListener("input",this._onInput),this._inputElementValue&&""!=this._inputElementValue?this._handleValueAndAutoValidate(this._inputElement):this._handleValue(this._inputElement)},_onAddonAttached:function(e){this._addons||(this._addons=[]);var t=e.target;-1===this._addons.indexOf(t)&&(this._addons.push(t),this.isAttached&&this._handleValue(this._inputElement))},_onFocus:function(){this._setFocused(!0)},_onBlur:function(){this._setFocused(!1),this._handleValueAndAutoValidate(this._inputElement)},_onInput:function(e){this._handleValueAndAutoValidate(e.target)},_onValueChanged:function(e){var t=e.target;this.__isFirstValueUpdate&&(this.__isFirstValueUpdate=!1,void 0===t.value||""===t.value)||this._handleValueAndAutoValidate(e.target)},_handleValue:function(e){var t=this._inputElementValue;t||0===t||"number"===e.type&&!e.checkValidity()?this._inputHasContent=!0:this._inputHasContent=!1,this.updateAddons({inputElement:e,value:t,invalid:this.invalid})},_handleValueAndAutoValidate:function(e){var t;this.autoValidate&&e&&(t=e.validate?e.validate(this._inputElementValue):e.checkValidity(),this.invalid=!t);this._handleValue(e)},_onIronInputValidate:function(e){this.invalid=this._inputElement.invalid},_invalidChanged:function(){this._addons&&this.updateAddons({invalid:this.invalid})},updateAddons:function(e){for(var t,i=0;t=this._addons[i];i++)t.update(e)},_computeInputContentClass:function(e,t,i,a,n){var r="input-content";if(e)n&&(r+=" label-is-hidden"),a&&(r+=" is-invalid");else{var o=this.querySelector("label");t||n?(r+=" label-is-floating",this.$.labelAndInputContainer.style.position="static",a?r+=" is-invalid":i&&(r+=" label-is-highlighted")):(o&&(this.$.labelAndInputContainer.style.position="relative"),a&&(r+=" is-invalid"))}return i&&(r+=" focused"),r},_computeUnderlineClass:function(e,t){var i="underline";return t?i+=" is-invalid":e&&(i+=" is-highlighted"),i},_computeAddOnContentClass:function(e,t){var i="add-on-content";return t?i+=" is-invalid":e&&(i+=" is-highlighted"),i}}),E({_template:S`
  435. <style>
  436. :host {
  437. display: inline-block;
  438. visibility: hidden;
  439. color: var(--paper-input-container-invalid-color, var(--error-color));
  440. @apply --paper-font-caption;
  441. @apply --paper-input-error;
  442. position: absolute;
  443. left:0;
  444. right:0;
  445. }
  446. :host([invalid]) {
  447. visibility: visible;
  448. }
  449. #a11yWrapper {
  450. visibility: hidden;
  451. }
  452. :host([invalid]) #a11yWrapper {
  453. visibility: visible;
  454. }
  455. </style>
  456. <!--
  457. If the paper-input-error element is directly referenced by an
  458. \`aria-describedby\` attribute, such as when used as a paper-input add-on,
  459. then applying \`visibility: hidden;\` to the paper-input-error element itself
  460. does not hide the error.
  461. For more information, see:
  462. https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description
  463. -->
  464. <div id="a11yWrapper">
  465. <slot></slot>
  466. </div>
  467. `,is:"paper-input-error",behaviors:[ce],properties:{invalid:{readOnly:!0,reflectToAttribute:!0,type:Boolean}},update:function(e){this._setInvalid(e.invalid)}});const he={properties:{name:{type:String},value:{notify:!0,type:String},required:{type:Boolean,value:!1}},attached:function(){},detached:function(){}};var pe={"U+0008":"backspace","U+0009":"tab","U+001B":"esc","U+0020":"space","U+007F":"del"},me={8:"backspace",9:"tab",13:"enter",27:"esc",33:"pageup",34:"pagedown",35:"end",36:"home",32:"space",37:"left",38:"up",39:"right",40:"down",46:"del",106:"*"},ve={shift:"shiftKey",ctrl:"ctrlKey",alt:"altKey",meta:"metaKey"},fe=/[a-z0-9*]/,be=/U\+/,ye=/^arrow/,ge=/^space(bar)?/,_e=/^escape$/;function ke(e,t){var i="";if(e){var a=e.toLowerCase();" "===a||ge.test(a)?i="space":_e.test(a)?i="esc":1==a.length?t&&!fe.test(a)||(i=a):i=ye.test(a)?a.replace("arrow",""):"multiply"==a?"*":a}return i}function xe(e,t){return e.key?ke(e.key,t):e.detail&&e.detail.key?ke(e.detail.key,t):(i=e.keyIdentifier,a="",i&&(i in pe?a=pe[i]:be.test(i)?(i=parseInt(i.replace("U+","0x"),16),a=String.fromCharCode(i).toLowerCase()):a=i.toLowerCase()),a||function(e){var t="";return Number(e)&&(t=e>=65&&e<=90?String.fromCharCode(32+e):e>=112&&e<=123?"f"+(e-112+1):e>=48&&e<=57?String(e-48):e>=96&&e<=105?String(e-96):me[e]),t}(e.keyCode)||"");var i,a}function we(e,t){return xe(t,e.hasModifiers)===e.key&&(!e.hasModifiers||!!t.shiftKey==!!e.shiftKey&&!!t.ctrlKey==!!e.ctrlKey&&!!t.altKey==!!e.altKey&&!!t.metaKey==!!e.metaKey)}function $e(e){return e.trim().split(" ").map((function(e){return function(e){return 1===e.length?{combo:e,key:e,event:"keydown"}:e.split("+").reduce((function(e,t){var i=t.split(":"),a=i[0],n=i[1];return a in ve?(e[ve[a]]=!0,e.hasModifiers=!0):(e.key=a,e.event=n||"keydown"),e}),{combo:e.split(":").shift()})}(e)}))}const Ce={properties:{keyEventTarget:{type:Object,value:function(){return this}},stopKeyboardEventPropagation:{type:Boolean,value:!1},_boundKeyHandlers:{type:Array,value:function(){return[]}},_imperativeKeyBindings:{type:Object,value:function(){return{}}}},observers:["_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)"],keyBindings:{},registered:function(){this._prepKeyBindings()},attached:function(){this._listenKeyEventListeners()},detached:function(){this._unlistenKeyEventListeners()},addOwnKeyBinding:function(e,t){this._imperativeKeyBindings[e]=t,this._prepKeyBindings(),this._resetKeyEventListeners()},removeOwnKeyBindings:function(){this._imperativeKeyBindings={},this._prepKeyBindings(),this._resetKeyEventListeners()},keyboardEventMatchesKeys:function(e,t){for(var i=$e(t),a=0;a<i.length;++a)if(we(i[a],e))return!0;return!1},_collectKeyBindings:function(){var e=this.behaviors.map((function(e){return e.keyBindings}));return-1===e.indexOf(this.keyBindings)&&e.push(this.keyBindings),e},_prepKeyBindings:function(){for(var e in this._keyBindings={},this._collectKeyBindings().forEach((function(e){for(var t in e)this._addKeyBinding(t,e[t])}),this),this._imperativeKeyBindings)this._addKeyBinding(e,this._imperativeKeyBindings[e]);for(var t in this._keyBindings)this._keyBindings[t].sort((function(e,t){var i=e[0].hasModifiers;return i===t[0].hasModifiers?0:i?-1:1}))},_addKeyBinding:function(e,t){$e(e).forEach((function(e){this._keyBindings[e.event]=this._keyBindings[e.event]||[],this._keyBindings[e.event].push([e,t])}),this)},_resetKeyEventListeners:function(){this._unlistenKeyEventListeners(),this.isAttached&&this._listenKeyEventListeners()},_listenKeyEventListeners:function(){this.keyEventTarget&&Object.keys(this._keyBindings).forEach((function(e){var t=this._keyBindings[e],i=this._onKeyBindingEvent.bind(this,t);this._boundKeyHandlers.push([this.keyEventTarget,e,i]),this.keyEventTarget.addEventListener(e,i)}),this)},_unlistenKeyEventListeners:function(){for(var e,t,i,a;this._boundKeyHandlers.length;)t=(e=this._boundKeyHandlers.pop())[0],i=e[1],a=e[2],t.removeEventListener(i,a)},_onKeyBindingEvent:function(e,t){if(this.stopKeyboardEventPropagation&&t.stopPropagation(),!t.defaultPrevented)for(var i=0;i<e.length;i++){var a=e[i][0],n=e[i][1];if(we(a,t)&&(this._triggerKeyHandler(a,n,t),t.defaultPrevented))return}},_triggerKeyHandler:function(e,t,i){var a=Object.create(e);a.keyboardEvent=i;var n=new CustomEvent(e.event,{detail:a,cancelable:!0});this[t].call(this,n),n.defaultPrevented&&i.preventDefault()}},Ee={properties:{focused:{type:Boolean,value:!1,notify:!0,readOnly:!0,reflectToAttribute:!0},disabled:{type:Boolean,value:!1,notify:!0,observer:"_disabledChanged",reflectToAttribute:!0},_oldTabIndex:{type:String},_boundFocusBlurHandler:{type:Function,value:function(){return this._focusBlurHandler.bind(this)}}},observers:["_changedControlState(focused, disabled)"],ready:function(){this.addEventListener("focus",this._boundFocusBlurHandler,!0),this.addEventListener("blur",this._boundFocusBlurHandler,!0)},_focusBlurHandler:function(e){this._setFocused("focus"===e.type)},_disabledChanged:function(e,t){this.setAttribute("aria-disabled",e?"true":"false"),this.style.pointerEvents=e?"none":"",e?(this._oldTabIndex=this.getAttribute("tabindex"),this._setFocused(!1),this.tabIndex=-1,this.blur()):void 0!==this._oldTabIndex&&(null===this._oldTabIndex?this.removeAttribute("tabindex"):this.setAttribute("tabindex",this._oldTabIndex))},_changedControlState:function(){this._controlStateChanged&&this._controlStateChanged()}},Se={NextLabelID:1,NextAddonID:1,NextInputID:1},Ae={properties:{label:{type:String},value:{notify:!0,type:String},disabled:{type:Boolean,value:!1},invalid:{type:Boolean,value:!1,notify:!0},allowedPattern:{type:String},type:{type:String},list:{type:String},pattern:{type:String},required:{type:Boolean,value:!1},errorMessage:{type:String},charCounter:{type:Boolean,value:!1},noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},autoValidate:{type:Boolean,value:!1},validator:{type:String},autocomplete:{type:String,value:"off"},autofocus:{type:Boolean,observer:"_autofocusChanged"},inputmode:{type:String},minlength:{type:Number},maxlength:{type:Number},min:{type:String},max:{type:String},step:{type:String},name:{type:String},placeholder:{type:String,value:""},readonly:{type:Boolean,value:!1},size:{type:Number},autocapitalize:{type:String,value:"none"},autocorrect:{type:String,value:"off"},autosave:{type:String},results:{type:Number},accept:{type:String},multiple:{type:Boolean},_ariaDescribedBy:{type:String,value:""},_ariaLabelledBy:{type:String,value:""},_inputId:{type:String,value:""}},listeners:{"addon-attached":"_onAddonAttached"},keyBindings:{"shift+tab:keydown":"_onShiftTabDown"},hostAttributes:{tabindex:0},get inputElement(){return this.$||(this.$={}),this.$.input||(this._generateInputId(),this.$.input=this.$$("#"+this._inputId)),this.$.input},get _focusableElement(){return this.inputElement},created:function(){this._typesThatHaveText=["date","datetime","datetime-local","month","time","week","file"]},attached:function(){this._updateAriaLabelledBy(),!R&&this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.inputElement.type)&&(this.alwaysFloatLabel=!0)},_appendStringWithSpace:function(e,t){return e=e?e+" "+t:t},_onAddonAttached:function(e){var t=A(e).rootTarget;if(t.id)this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,t.id);else{var i="paper-input-add-on-"+Se.NextAddonID++;t.id=i,this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,i)}},validate:function(){return this.inputElement.validate()},_focusBlurHandler:function(e){Ee._focusBlurHandler.call(this,e),this.focused&&!this._shiftTabPressed&&this._focusableElement&&this._focusableElement.focus()},_onShiftTabDown:function(e){var t=this.getAttribute("tabindex");this._shiftTabPressed=!0,this.setAttribute("tabindex","-1"),this.async((function(){this.setAttribute("tabindex",t),this._shiftTabPressed=!1}),1)},_handleAutoValidate:function(){this.autoValidate&&this.validate()},updateValueAndPreserveCaret:function(e){try{var t=this.inputElement.selectionStart;this.value=e,this.inputElement.selectionStart=t,this.inputElement.selectionEnd=t}catch(t){this.value=e}},_computeAlwaysFloatLabel:function(e,t){return t||e},_updateAriaLabelledBy:function(){var e,t=A(this.root).querySelector("label");t?(t.id?e=t.id:(e="paper-input-label-"+Se.NextLabelID++,t.id=e),this._ariaLabelledBy=e):this._ariaLabelledBy=""},_generateInputId:function(){this._inputId&&""!==this._inputId||(this._inputId="input-"+Se.NextInputID++)},_onChange:function(e){this.shadowRoot&&this.fire(e.type,{sourceEvent:e},{node:this,bubbles:e.bubbles,cancelable:e.cancelable})},_autofocusChanged:function(){if(this.autofocus&&this._focusableElement){var e=document.activeElement;e instanceof HTMLElement&&e!==document.body&&e!==document.documentElement||this._focusableElement.focus()}}};E({is:"paper-input",_template:S`
  468. <style>
  469. :host {
  470. display: block;
  471. }
  472. :host([focused]) {
  473. outline: none;
  474. }
  475. :host([hidden]) {
  476. display: none !important;
  477. }
  478. input {
  479. /* Firefox sets a min-width on the input, which can cause layout issues */
  480. min-width: 0;
  481. }
  482. /* In 1.x, the <input> is distributed to paper-input-container, which styles it.
  483. In 2.x the <iron-input> is distributed to paper-input-container, which styles
  484. it, but in order for this to work correctly, we need to reset some
  485. of the native input's properties to inherit (from the iron-input) */
  486. iron-input > input {
  487. @apply --paper-input-container-shared-input-style;
  488. font-family: inherit;
  489. font-weight: inherit;
  490. font-size: inherit;
  491. letter-spacing: inherit;
  492. word-spacing: inherit;
  493. line-height: inherit;
  494. text-shadow: inherit;
  495. color: inherit;
  496. cursor: inherit;
  497. }
  498. input:disabled {
  499. @apply --paper-input-container-input-disabled;
  500. }
  501. input::-webkit-outer-spin-button,
  502. input::-webkit-inner-spin-button {
  503. @apply --paper-input-container-input-webkit-spinner;
  504. }
  505. input::-webkit-clear-button {
  506. @apply --paper-input-container-input-webkit-clear;
  507. }
  508. input::-webkit-calendar-picker-indicator {
  509. @apply --paper-input-container-input-webkit-calendar-picker-indicator;
  510. }
  511. input::-webkit-input-placeholder {
  512. color: var(--paper-input-container-color, var(--secondary-text-color));
  513. }
  514. input:-moz-placeholder {
  515. color: var(--paper-input-container-color, var(--secondary-text-color));
  516. }
  517. input::-moz-placeholder {
  518. color: var(--paper-input-container-color, var(--secondary-text-color));
  519. }
  520. input::-ms-clear {
  521. @apply --paper-input-container-ms-clear;
  522. }
  523. input::-ms-reveal {
  524. @apply --paper-input-container-ms-reveal;
  525. }
  526. input:-ms-input-placeholder {
  527. color: var(--paper-input-container-color, var(--secondary-text-color));
  528. }
  529. label {
  530. pointer-events: none;
  531. }
  532. </style>
  533. <paper-input-container id="container" no-label-float="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
  534. <slot name="prefix" slot="prefix"></slot>
  535. <label hidden$="[[!label]]" aria-hidden="true" for$="[[_inputId]]" slot="label">[[label]]</label>
  536. <!-- Need to bind maxlength so that the paper-input-char-counter works correctly -->
  537. <iron-input bind-value="{{value}}" slot="input" class="input-element" id$="[[_inputId]]" maxlength$="[[maxlength]]" allowed-pattern="[[allowedPattern]]" invalid="{{invalid}}" validator="[[validator]]">
  538. <input aria-labelledby$="[[_ariaLabelledBy]]" aria-describedby$="[[_ariaDescribedBy]]" disabled$="[[disabled]]" title$="[[title]]" type$="[[type]]" pattern$="[[pattern]]" required$="[[required]]" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" minlength$="[[minlength]]" maxlength$="[[maxlength]]" min$="[[min]]" max$="[[max]]" step$="[[step]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" list$="[[list]]" size$="[[size]]" autocapitalize$="[[autocapitalize]]" autocorrect$="[[autocorrect]]" on-change="_onChange" tabindex$="[[tabIndex]]" autosave$="[[autosave]]" results$="[[results]]" accept$="[[accept]]" multiple$="[[multiple]]" role$="[[inputRole]]" aria-haspopup$="[[inputAriaHaspopup]]">
  539. </iron-input>
  540. <slot name="suffix" slot="suffix"></slot>
  541. <template is="dom-if" if="[[errorMessage]]">
  542. <paper-input-error aria-live="assertive" slot="add-on">[[errorMessage]]</paper-input-error>
  543. </template>
  544. <template is="dom-if" if="[[charCounter]]">
  545. <paper-input-char-counter slot="add-on"></paper-input-char-counter>
  546. </template>
  547. </paper-input-container>
  548. `,behaviors:[[Ee,Ce,Ae],he],properties:{value:{type:String},inputRole:{type:String,value:void 0},inputAriaHaspopup:{type:String,value:void 0}},get _focusableElement(){return this.inputElement._inputElement},listeners:{"iron-input-ready":"_onIronInputReady"},_onIronInputReady:function(){this.$.nativeInput||(this.$.nativeInput=this.$$("input")),this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.$.nativeInput.type)&&(this.alwaysFloatLabel=!0),this.inputElement.bindValue&&this.$.container._handleValueAndAutoValidate(this.inputElement)}});const Be={properties:{value:{type:Number,value:0,notify:!0,reflectToAttribute:!0},min:{type:Number,value:0,notify:!0},max:{type:Number,value:100,notify:!0},step:{type:Number,value:1,notify:!0},ratio:{type:Number,value:0,readOnly:!0,notify:!0}},observers:["_update(value, min, max, step)"],_calcRatio:function(e){return(this._clampValue(e)-this.min)/(this.max-this.min)},_clampValue:function(e){return Math.min(this.max,Math.max(this.min,this._calcStep(e)))},_calcStep:function(e){if(e=parseFloat(e),!this.step)return e;var t=Math.round((e-this.min)/this.step);return this.step<1?t/(1/this.step)+this.min:t*this.step+this.min},_validateValue:function(){var e=this._clampValue(this.value);return this.value=this.oldValue=isNaN(e)?this.oldValue:e,this.value!==e},_update:function(){this._validateValue(),this._setRatio(100*this._calcRatio(this.value))}};E({_template:S`
  549. <style>
  550. :host {
  551. display: block;
  552. width: 200px;
  553. position: relative;
  554. overflow: hidden;
  555. }
  556. :host([hidden]), [hidden] {
  557. display: none !important;
  558. }
  559. #progressContainer {
  560. @apply --paper-progress-container;
  561. position: relative;
  562. }
  563. #progressContainer,
  564. /* the stripe for the indeterminate animation*/
  565. .indeterminate::after {
  566. height: var(--paper-progress-height, 4px);
  567. }
  568. #primaryProgress,
  569. #secondaryProgress,
  570. .indeterminate::after {
  571. @apply --layout-fit;
  572. }
  573. #progressContainer,
  574. .indeterminate::after {
  575. background: var(--paper-progress-container-color, var(--google-grey-300));
  576. }
  577. :host(.transiting) #primaryProgress,
  578. :host(.transiting) #secondaryProgress {
  579. -webkit-transition-property: -webkit-transform;
  580. transition-property: transform;
  581. /* Duration */
  582. -webkit-transition-duration: var(--paper-progress-transition-duration, 0.08s);
  583. transition-duration: var(--paper-progress-transition-duration, 0.08s);
  584. /* Timing function */
  585. -webkit-transition-timing-function: var(--paper-progress-transition-timing-function, ease);
  586. transition-timing-function: var(--paper-progress-transition-timing-function, ease);
  587. /* Delay */
  588. -webkit-transition-delay: var(--paper-progress-transition-delay, 0s);
  589. transition-delay: var(--paper-progress-transition-delay, 0s);
  590. }
  591. #primaryProgress,
  592. #secondaryProgress {
  593. @apply --layout-fit;
  594. -webkit-transform-origin: left center;
  595. transform-origin: left center;
  596. -webkit-transform: scaleX(0);
  597. transform: scaleX(0);
  598. will-change: transform;
  599. }
  600. #primaryProgress {
  601. background: var(--paper-progress-active-color, var(--google-green-500));
  602. }
  603. #secondaryProgress {
  604. background: var(--paper-progress-secondary-color, var(--google-green-100));
  605. }
  606. :host([disabled]) #primaryProgress {
  607. background: var(--paper-progress-disabled-active-color, var(--google-grey-500));
  608. }
  609. :host([disabled]) #secondaryProgress {
  610. background: var(--paper-progress-disabled-secondary-color, var(--google-grey-300));
  611. }
  612. :host(:not([disabled])) #primaryProgress.indeterminate {
  613. -webkit-transform-origin: right center;
  614. transform-origin: right center;
  615. -webkit-animation: indeterminate-bar var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite;
  616. animation: indeterminate-bar var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite;
  617. }
  618. :host(:not([disabled])) #primaryProgress.indeterminate::after {
  619. content: "";
  620. -webkit-transform-origin: center center;
  621. transform-origin: center center;
  622. -webkit-animation: indeterminate-splitter var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite;
  623. animation: indeterminate-splitter var(--paper-progress-indeterminate-cycle-duration, 2s) linear infinite;
  624. }
  625. @-webkit-keyframes indeterminate-bar {
  626. 0% {
  627. -webkit-transform: scaleX(1) translateX(-100%);
  628. }
  629. 50% {
  630. -webkit-transform: scaleX(1) translateX(0%);
  631. }
  632. 75% {
  633. -webkit-transform: scaleX(1) translateX(0%);
  634. -webkit-animation-timing-function: cubic-bezier(.28,.62,.37,.91);
  635. }
  636. 100% {
  637. -webkit-transform: scaleX(0) translateX(0%);
  638. }
  639. }
  640. @-webkit-keyframes indeterminate-splitter {
  641. 0% {
  642. -webkit-transform: scaleX(.75) translateX(-125%);
  643. }
  644. 30% {
  645. -webkit-transform: scaleX(.75) translateX(-125%);
  646. -webkit-animation-timing-function: cubic-bezier(.42,0,.6,.8);
  647. }
  648. 90% {
  649. -webkit-transform: scaleX(.75) translateX(125%);
  650. }
  651. 100% {
  652. -webkit-transform: scaleX(.75) translateX(125%);
  653. }
  654. }
  655. @keyframes indeterminate-bar {
  656. 0% {
  657. transform: scaleX(1) translateX(-100%);
  658. }
  659. 50% {
  660. transform: scaleX(1) translateX(0%);
  661. }
  662. 75% {
  663. transform: scaleX(1) translateX(0%);
  664. animation-timing-function: cubic-bezier(.28,.62,.37,.91);
  665. }
  666. 100% {
  667. transform: scaleX(0) translateX(0%);
  668. }
  669. }
  670. @keyframes indeterminate-splitter {
  671. 0% {
  672. transform: scaleX(.75) translateX(-125%);
  673. }
  674. 30% {
  675. transform: scaleX(.75) translateX(-125%);
  676. animation-timing-function: cubic-bezier(.42,0,.6,.8);
  677. }
  678. 90% {
  679. transform: scaleX(.75) translateX(125%);
  680. }
  681. 100% {
  682. transform: scaleX(.75) translateX(125%);
  683. }
  684. }
  685. </style>
  686. <div id="progressContainer">
  687. <div id="secondaryProgress" hidden\$="[[_hideSecondaryProgress(secondaryRatio)]]"></div>
  688. <div id="primaryProgress"></div>
  689. </div>
  690. `,is:"paper-progress",behaviors:[Be],properties:{secondaryProgress:{type:Number,value:0},secondaryRatio:{type:Number,value:0,readOnly:!0},indeterminate:{type:Boolean,value:!1,observer:"_toggleIndeterminate"},disabled:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_disabledChanged"}},observers:["_progressChanged(secondaryProgress, value, min, max, indeterminate)"],hostAttributes:{role:"progressbar"},_toggleIndeterminate:function(e){this.toggleClass("indeterminate",e,this.$.primaryProgress)},_transformProgress:function(e,t){var i="scaleX("+t/100+")";e.style.transform=e.style.webkitTransform=i},_mainRatioChanged:function(e){this._transformProgress(this.$.primaryProgress,e)},_progressChanged:function(e,t,i,a,n){e=this._clampValue(e),t=this._clampValue(t);var r=100*this._calcRatio(e),o=100*this._calcRatio(t);this._setSecondaryRatio(r),this._transformProgress(this.$.secondaryProgress,r),this._transformProgress(this.$.primaryProgress,o),this.secondaryProgress=e,n?this.removeAttribute("aria-valuenow"):this.setAttribute("aria-valuenow",t),this.setAttribute("aria-valuemin",i),this.setAttribute("aria-valuemax",a)},_disabledChanged:function(e){this.setAttribute("aria-disabled",e?"true":"false")},_hideSecondaryProgress:function(e){return 0===e}});const Re={properties:{pressed:{type:Boolean,readOnly:!0,value:!1,reflectToAttribute:!0,observer:"_pressedChanged"},toggles:{type:Boolean,value:!1,reflectToAttribute:!0},active:{type:Boolean,value:!1,notify:!0,reflectToAttribute:!0},pointerDown:{type:Boolean,readOnly:!0,value:!1},receivedFocusFromKeyboard:{type:Boolean,readOnly:!0},ariaActiveAttribute:{type:String,value:"aria-pressed",observer:"_ariaActiveAttributeChanged"}},listeners:{down:"_downHandler",up:"_upHandler",tap:"_tapHandler"},observers:["_focusChanged(focused)","_activeChanged(active, ariaActiveAttribute)"],keyBindings:{"enter:keydown":"_asyncClick","space:keydown":"_spaceKeyDownHandler","space:keyup":"_spaceKeyUpHandler"},_mouseEventRe:/^mouse/,_tapHandler:function(){this.toggles?this._userActivate(!this.active):this.active=!1},_focusChanged:function(e){this._detectKeyboardFocus(e),e||this._setPressed(!1)},_detectKeyboardFocus:function(e){this._setReceivedFocusFromKeyboard(!this.pointerDown&&e)},_userActivate:function(e){this.active!==e&&(this.active=e,this.fire("change"))},_downHandler:function(e){this._setPointerDown(!0),this._setPressed(!0),this._setReceivedFocusFromKeyboard(!1)},_upHandler:function(){this._setPointerDown(!1),this._setPressed(!1)},_spaceKeyDownHandler:function(e){var t=e.detail.keyboardEvent,i=A(t).localTarget;this.isLightDescendant(i)||(t.preventDefault(),t.stopImmediatePropagation(),this._setPressed(!0))},_spaceKeyUpHandler:function(e){var t=e.detail.keyboardEvent,i=A(t).localTarget;this.isLightDescendant(i)||(this.pressed&&this._asyncClick(),this._setPressed(!1))},_asyncClick:function(){this.async((function(){this.click()}),1)},_pressedChanged:function(e){this._changedButtonState()},_ariaActiveAttributeChanged:function(e,t){t&&t!=e&&this.hasAttribute(t)&&this.removeAttribute(t)},_activeChanged:function(e,t){this.toggles?this.setAttribute(this.ariaActiveAttribute,e?"true":"false"):this.removeAttribute(this.ariaActiveAttribute),this._changedButtonState()},_controlStateChanged:function(){this.disabled?this._setPressed(!1):this._changedButtonState()},_changedButtonState:function(){this._buttonStateChanged&&this._buttonStateChanged()}},Ve=[Ce,Re];var Me={distance:function(e,t,i,a){var n=e-i,r=t-a;return Math.sqrt(n*n+r*r)},now:window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now};function Ie(e){this.element=e,this.width=this.boundingRect.width,this.height=this.boundingRect.height,this.size=Math.max(this.width,this.height)}function Le(e){this.element=e,this.color=window.getComputedStyle(e).color,this.wave=document.createElement("div"),this.waveContainer=document.createElement("div"),this.wave.style.backgroundColor=this.color,this.wave.classList.add("wave"),this.waveContainer.classList.add("wave-container"),A(this.waveContainer).appendChild(this.wave),this.resetInteractionState()}Ie.prototype={get boundingRect(){return this.element.getBoundingClientRect()},furthestCornerDistanceFrom:function(e,t){var i=Me.distance(e,t,0,0),a=Me.distance(e,t,this.width,0),n=Me.distance(e,t,0,this.height),r=Me.distance(e,t,this.width,this.height);return Math.max(i,a,n,r)}},Le.MAX_RADIUS=300,Le.prototype={get recenters(){return this.element.recenters},get center(){return this.element.center},get mouseDownElapsed(){var e;return this.mouseDownStart?(e=Me.now()-this.mouseDownStart,this.mouseUpStart&&(e-=this.mouseUpElapsed),e):0},get mouseUpElapsed(){return this.mouseUpStart?Me.now()-this.mouseUpStart:0},get mouseDownElapsedSeconds(){return this.mouseDownElapsed/1e3},get mouseUpElapsedSeconds(){return this.mouseUpElapsed/1e3},get mouseInteractionSeconds(){return this.mouseDownElapsedSeconds+this.mouseUpElapsedSeconds},get initialOpacity(){return this.element.initialOpacity},get opacityDecayVelocity(){return this.element.opacityDecayVelocity},get radius(){var e=this.containerMetrics.width*this.containerMetrics.width,t=this.containerMetrics.height*this.containerMetrics.height,i=1.1*Math.min(Math.sqrt(e+t),Le.MAX_RADIUS)+5,a=1.1-i/Le.MAX_RADIUS*.2,n=this.mouseInteractionSeconds/a,r=i*(1-Math.pow(80,-n));return Math.abs(r)},get opacity(){return this.mouseUpStart?Math.max(0,this.initialOpacity-this.mouseUpElapsedSeconds*this.opacityDecayVelocity):this.initialOpacity},get outerOpacity(){var e=.3*this.mouseUpElapsedSeconds,t=this.opacity;return Math.max(0,Math.min(e,t))},get isOpacityFullyDecayed(){return this.opacity<.01&&this.radius>=Math.min(this.maxRadius,Le.MAX_RADIUS)},get isRestingAtMaxRadius(){return this.opacity>=this.initialOpacity&&this.radius>=Math.min(this.maxRadius,Le.MAX_RADIUS)},get isAnimationComplete(){return this.mouseUpStart?this.isOpacityFullyDecayed:this.isRestingAtMaxRadius},get translationFraction(){return Math.min(1,this.radius/this.containerMetrics.size*2/Math.sqrt(2))},get xNow(){return this.xEnd?this.xStart+this.translationFraction*(this.xEnd-this.xStart):this.xStart},get yNow(){return this.yEnd?this.yStart+this.translationFraction*(this.yEnd-this.yStart):this.yStart},get isMouseDown(){return this.mouseDownStart&&!this.mouseUpStart},resetInteractionState:function(){this.maxRadius=0,this.mouseDownStart=0,this.mouseUpStart=0,this.xStart=0,this.yStart=0,this.xEnd=0,this.yEnd=0,this.slideDistance=0,this.containerMetrics=new Ie(this.element)},draw:function(){var e,t,i;this.wave.style.opacity=this.opacity,e=this.radius/(this.containerMetrics.size/2),t=this.xNow-this.containerMetrics.width/2,i=this.yNow-this.containerMetrics.height/2,this.waveContainer.style.webkitTransform="translate("+t+"px, "+i+"px)",this.waveContainer.style.transform="translate3d("+t+"px, "+i+"px, 0)",this.wave.style.webkitTransform="scale("+e+","+e+")",this.wave.style.transform="scale3d("+e+","+e+",1)"},downAction:function(e){var t=this.containerMetrics.width/2,i=this.containerMetrics.height/2;this.resetInteractionState(),this.mouseDownStart=Me.now(),this.center?(this.xStart=t,this.yStart=i,this.slideDistance=Me.distance(this.xStart,this.yStart,this.xEnd,this.yEnd)):(this.xStart=e?e.detail.x-this.containerMetrics.boundingRect.left:this.containerMetrics.width/2,this.yStart=e?e.detail.y-this.containerMetrics.boundingRect.top:this.containerMetrics.height/2),this.recenters&&(this.xEnd=t,this.yEnd=i,this.slideDistance=Me.distance(this.xStart,this.yStart,this.xEnd,this.yEnd)),this.maxRadius=this.containerMetrics.furthestCornerDistanceFrom(this.xStart,this.yStart),this.waveContainer.style.top=(this.containerMetrics.height-this.containerMetrics.size)/2+"px",this.waveContainer.style.left=(this.containerMetrics.width-this.containerMetrics.size)/2+"px",this.waveContainer.style.width=this.containerMetrics.size+"px",this.waveContainer.style.height=this.containerMetrics.size+"px"},upAction:function(e){this.isMouseDown&&(this.mouseUpStart=Me.now())},remove:function(){A(A(this.waveContainer).parentNode).removeChild(this.waveContainer)}},E({_template:S`
  691. <style>
  692. :host {
  693. display: block;
  694. position: absolute;
  695. border-radius: inherit;
  696. overflow: hidden;
  697. top: 0;
  698. left: 0;
  699. right: 0;
  700. bottom: 0;
  701. /* See PolymerElements/paper-behaviors/issues/34. On non-Chrome browsers,
  702. * creating a node (with a position:absolute) in the middle of an event
  703. * handler "interrupts" that event handler (which happens when the
  704. * ripple is created on demand) */
  705. pointer-events: none;
  706. }
  707. :host([animating]) {
  708. /* This resolves a rendering issue in Chrome (as of 40) where the
  709. ripple is not properly clipped by its parent (which may have
  710. rounded corners). See: http://jsbin.com/temexa/4
  711. Note: We only apply this style conditionally. Otherwise, the browser
  712. will create a new compositing layer for every ripple element on the
  713. page, and that would be bad. */
  714. -webkit-transform: translate(0, 0);
  715. transform: translate3d(0, 0, 0);
  716. }
  717. #background,
  718. #waves,
  719. .wave-container,
  720. .wave {
  721. pointer-events: none;
  722. position: absolute;
  723. top: 0;
  724. left: 0;
  725. width: 100%;
  726. height: 100%;
  727. }
  728. #background,
  729. .wave {
  730. opacity: 0;
  731. }
  732. #waves,
  733. .wave {
  734. overflow: hidden;
  735. }
  736. .wave-container,
  737. .wave {
  738. border-radius: 50%;
  739. }
  740. :host(.circle) #background,
  741. :host(.circle) #waves {
  742. border-radius: 50%;
  743. }
  744. :host(.circle) .wave-container {
  745. overflow: hidden;
  746. }
  747. </style>
  748. <div id="background"></div>
  749. <div id="waves"></div>
  750. `,is:"paper-ripple",behaviors:[Ce],properties:{initialOpacity:{type:Number,value:.25},opacityDecayVelocity:{type:Number,value:.8},recenters:{type:Boolean,value:!1},center:{type:Boolean,value:!1},ripples:{type:Array,value:function(){return[]}},animating:{type:Boolean,readOnly:!0,reflectToAttribute:!0,value:!1},holdDown:{type:Boolean,value:!1,observer:"_holdDownChanged"},noink:{type:Boolean,value:!1},_animating:{type:Boolean},_boundAnimate:{type:Function,value:function(){return this.animate.bind(this)}}},get target(){return this.keyEventTarget},keyBindings:{"enter:keydown":"_onEnterKeydown","space:keydown":"_onSpaceKeydown","space:keyup":"_onSpaceKeyup"},attached:function(){11==A(this).parentNode.nodeType?this.keyEventTarget=A(this).getOwnerRoot().host:this.keyEventTarget=A(this).parentNode;var e=this.keyEventTarget;this.listen(e,"up","uiUpAction"),this.listen(e,"down","uiDownAction")},detached:function(){this.unlisten(this.keyEventTarget,"up","uiUpAction"),this.unlisten(this.keyEventTarget,"down","uiDownAction"),this.keyEventTarget=null},get shouldKeepAnimating(){for(var e=0;e<this.ripples.length;++e)if(!this.ripples[e].isAnimationComplete)return!0;return!1},simulatedRipple:function(){this.downAction(null),this.async((function(){this.upAction()}),1)},uiDownAction:function(e){this.noink||this.downAction(e)},downAction:function(e){this.holdDown&&this.ripples.length>0||(this.addRipple().downAction(e),this._animating||(this._animating=!0,this.animate()))},uiUpAction:function(e){this.noink||this.upAction(e)},upAction:function(e){this.holdDown||(this.ripples.forEach((function(t){t.upAction(e)})),this._animating=!0,this.animate())},onAnimationComplete:function(){this._animating=!1,this.$.background.style.backgroundColor="",this.fire("transitionend")},addRipple:function(){var e=new Le(this);return A(this.$.waves).appendChild(e.waveContainer),this.$.background.style.backgroundColor=e.color,this.ripples.push(e),this._setAnimating(!0),e},removeRipple:function(e){var t=this.ripples.indexOf(e);t<0||(this.ripples.splice(t,1),e.remove(),this.ripples.length||this._setAnimating(!1))},animate:function(){if(this._animating){var e,t;for(e=0;e<this.ripples.length;++e)(t=this.ripples[e]).draw(),this.$.background.style.opacity=t.outerOpacity,t.isOpacityFullyDecayed&&!t.isRestingAtMaxRadius&&this.removeRipple(t);this.shouldKeepAnimating||0!==this.ripples.length?window.requestAnimationFrame(this._boundAnimate):this.onAnimationComplete()}},animateRipple:function(){return this.animate()},_onEnterKeydown:function(){this.uiDownAction(),this.async(this.uiUpAction,1)},_onSpaceKeydown:function(){this.uiDownAction()},_onSpaceKeyup:function(){this.uiUpAction()},_holdDownChanged:function(e,t){void 0!==t&&(e?this.downAction():this.upAction())}});const Pe={properties:{noink:{type:Boolean,observer:"_noinkChanged"},_rippleContainer:{type:Object}},_buttonStateChanged:function(){this.focused&&this.ensureRipple()},_downHandler:function(e){Re._downHandler.call(this,e),this.pressed&&this.ensureRipple(e)},ensureRipple:function(e){if(!this.hasRipple()){this._ripple=this._createRipple(),this._ripple.noink=this.noink;var t=this._rippleContainer||this.root;if(t&&A(t).appendChild(this._ripple),e){var i=A(this._rippleContainer||this),a=A(e).rootTarget;i.deepContains(a)&&this._ripple.uiDownAction(e)}}},getRipple:function(){return this.ensureRipple(),this._ripple},hasRipple:function(){return Boolean(this._ripple)},_createRipple:function(){return document.createElement("paper-ripple")},_noinkChanged:function(e){this.hasRipple()&&(this._ripple.noink=e)}},Te={observers:["_focusedChanged(receivedFocusFromKeyboard)"],_focusedChanged:function(e){e&&this.ensureRipple(),this.hasRipple()&&(this._ripple.holdDown=e)},_createRipple:function(){var e=Pe._createRipple();return e.id="ink",e.setAttribute("center",""),e.classList.add("circle"),e}},Ke=[Ve,Ee,Pe,Te],De=S`
  751. <style>
  752. :host {
  753. @apply --layout;
  754. @apply --layout-justified;
  755. @apply --layout-center;
  756. width: 200px;
  757. cursor: default;
  758. -webkit-user-select: none;
  759. -moz-user-select: none;
  760. -ms-user-select: none;
  761. user-select: none;
  762. -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  763. --paper-progress-active-color: var(--paper-slider-active-color, var(--google-blue-700));
  764. --paper-progress-secondary-color: var(--paper-slider-secondary-color, var(--google-blue-300));
  765. --paper-progress-disabled-active-color: var(--paper-slider-disabled-active-color, var(--paper-grey-400));
  766. --paper-progress-disabled-secondary-color: var(--paper-slider-disabled-secondary-color, var(--paper-grey-400));
  767. --calculated-paper-slider-height: var(--paper-slider-height, 2px);
  768. }
  769. /* focus shows the ripple */
  770. :host(:focus) {
  771. outline: none;
  772. }
  773. /**
  774. * NOTE(keanulee): Though :host-context is not universally supported, some pages
  775. * still rely on paper-slider being flipped when dir="rtl" is set on body. For full
  776. * compatibility, dir="rtl" must be explicitly set on paper-slider.
  777. */
  778. :dir(rtl) #sliderContainer {
  779. -webkit-transform: scaleX(-1);
  780. transform: scaleX(-1);
  781. }
  782. /**
  783. * NOTE(keanulee): This is separate from the rule above because :host-context may
  784. * not be recognized.
  785. */
  786. :host([dir="rtl"]) #sliderContainer {
  787. -webkit-transform: scaleX(-1);
  788. transform: scaleX(-1);
  789. }
  790. /**
  791. * NOTE(keanulee): Needed to override the :host-context rule (where supported)
  792. * to support LTR sliders in RTL pages.
  793. */
  794. :host([dir="ltr"]) #sliderContainer {
  795. -webkit-transform: scaleX(1);
  796. transform: scaleX(1);
  797. }
  798. #sliderContainer {
  799. position: relative;
  800. width: 100%;
  801. height: calc(30px + var(--calculated-paper-slider-height));
  802. margin-left: calc(15px + var(--calculated-paper-slider-height)/2);
  803. margin-right: calc(15px + var(--calculated-paper-slider-height)/2);
  804. }
  805. #sliderContainer:focus {
  806. outline: 0;
  807. }
  808. #sliderContainer.editable {
  809. margin-top: 12px;
  810. margin-bottom: 12px;
  811. }
  812. .bar-container {
  813. position: absolute;
  814. top: 0;
  815. bottom: 0;
  816. left: 0;
  817. right: 0;
  818. overflow: hidden;
  819. }
  820. .ring > .bar-container {
  821. left: calc(5px + var(--calculated-paper-slider-height)/2);
  822. transition: left 0.18s ease;
  823. }
  824. .ring.expand.dragging > .bar-container {
  825. transition: none;
  826. }
  827. .ring.expand:not(.pin) > .bar-container {
  828. left: calc(8px + var(--calculated-paper-slider-height)/2);
  829. }
  830. #sliderBar {
  831. padding: 15px 0;
  832. width: 100%;
  833. background-color: var(--paper-slider-bar-color, transparent);
  834. --paper-progress-container-color: var(--paper-slider-container-color, var(--paper-grey-400));
  835. --paper-progress-height: var(--calculated-paper-slider-height);
  836. }
  837. .slider-markers {
  838. position: absolute;
  839. /* slider-knob is 30px + the slider-height so that the markers should start at a offset of 15px*/
  840. top: 15px;
  841. height: var(--calculated-paper-slider-height);
  842. left: 0;
  843. right: -1px;
  844. box-sizing: border-box;
  845. pointer-events: none;
  846. @apply --layout-horizontal;
  847. }
  848. .slider-marker {
  849. @apply --layout-flex;
  850. }
  851. .slider-markers::after,
  852. .slider-marker::after {
  853. content: "";
  854. display: block;
  855. margin-left: -1px;
  856. width: 2px;
  857. height: var(--calculated-paper-slider-height);
  858. border-radius: 50%;
  859. background-color: var(--paper-slider-markers-color, #000);
  860. }
  861. .slider-knob {
  862. position: absolute;
  863. left: 0;
  864. top: 0;
  865. margin-left: calc(-15px - var(--calculated-paper-slider-height)/2);
  866. width: calc(30px + var(--calculated-paper-slider-height));
  867. height: calc(30px + var(--calculated-paper-slider-height));
  868. }
  869. .transiting > .slider-knob {
  870. transition: left 0.08s ease;
  871. }
  872. .slider-knob:focus {
  873. outline: none;
  874. }
  875. .slider-knob.dragging {
  876. transition: none;
  877. }
  878. .snaps > .slider-knob.dragging {
  879. transition: -webkit-transform 0.08s ease;
  880. transition: transform 0.08s ease;
  881. }
  882. .slider-knob-inner {
  883. margin: 10px;
  884. width: calc(100% - 20px);
  885. height: calc(100% - 20px);
  886. background-color: var(--paper-slider-knob-color, var(--google-blue-700));
  887. border: 2px solid var(--paper-slider-knob-color, var(--google-blue-700));
  888. border-radius: 50%;
  889. -moz-box-sizing: border-box;
  890. box-sizing: border-box;
  891. transition-property: -webkit-transform, background-color, border;
  892. transition-property: transform, background-color, border;
  893. transition-duration: 0.18s;
  894. transition-timing-function: ease;
  895. }
  896. .expand:not(.pin) > .slider-knob > .slider-knob-inner {
  897. -webkit-transform: scale(1.5);
  898. transform: scale(1.5);
  899. }
  900. .ring > .slider-knob > .slider-knob-inner {
  901. background-color: var(--paper-slider-knob-start-color, transparent);
  902. border: 2px solid var(--paper-slider-knob-start-border-color, var(--paper-grey-400));
  903. }
  904. .slider-knob-inner::before {
  905. background-color: var(--paper-slider-pin-color, var(--google-blue-700));
  906. }
  907. .pin > .slider-knob > .slider-knob-inner::before {
  908. content: "";
  909. position: absolute;
  910. top: 0;
  911. left: 50%;
  912. margin-left: -13px;
  913. width: 26px;
  914. height: 26px;
  915. border-radius: 50% 50% 50% 0;
  916. -webkit-transform: rotate(-45deg) scale(0) translate(0);
  917. transform: rotate(-45deg) scale(0) translate(0);
  918. }
  919. .slider-knob-inner::before,
  920. .slider-knob-inner::after {
  921. transition: -webkit-transform .18s ease, background-color .18s ease;
  922. transition: transform .18s ease, background-color .18s ease;
  923. }
  924. .pin.ring > .slider-knob > .slider-knob-inner::before {
  925. background-color: var(--paper-slider-pin-start-color, var(--paper-grey-400));
  926. }
  927. .pin.expand > .slider-knob > .slider-knob-inner::before {
  928. -webkit-transform: rotate(-45deg) scale(1) translate(17px, -17px);
  929. transform: rotate(-45deg) scale(1) translate(17px, -17px);
  930. }
  931. .pin > .slider-knob > .slider-knob-inner::after {
  932. content: attr(value);
  933. position: absolute;
  934. top: 0;
  935. left: 50%;
  936. margin-left: -16px;
  937. width: 32px;
  938. height: 26px;
  939. text-align: center;
  940. color: var(--paper-slider-font-color, #fff);
  941. font-size: 10px;
  942. -webkit-transform: scale(0) translate(0);
  943. transform: scale(0) translate(0);
  944. }
  945. .pin.expand > .slider-knob > .slider-knob-inner::after {
  946. -webkit-transform: scale(1) translate(0, -17px);
  947. transform: scale(1) translate(0, -17px);
  948. }
  949. /* paper-input */
  950. .slider-input {
  951. width: 50px;
  952. overflow: hidden;
  953. --paper-input-container-input: {
  954. text-align: center;
  955. @apply --paper-slider-input-container-input;
  956. };
  957. @apply --paper-slider-input;
  958. }
  959. /* disabled state */
  960. #sliderContainer.disabled {
  961. pointer-events: none;
  962. }
  963. .disabled > .slider-knob > .slider-knob-inner {
  964. background-color: var(--paper-slider-disabled-knob-color, var(--paper-grey-400));
  965. border: 2px solid var(--paper-slider-disabled-knob-color, var(--paper-grey-400));
  966. -webkit-transform: scale3d(0.75, 0.75, 1);
  967. transform: scale3d(0.75, 0.75, 1);
  968. }
  969. .disabled.ring > .slider-knob > .slider-knob-inner {
  970. background-color: var(--paper-slider-knob-start-color, transparent);
  971. border: 2px solid var(--paper-slider-knob-start-border-color, var(--paper-grey-400));
  972. }
  973. paper-ripple {
  974. color: var(--paper-slider-knob-color, var(--google-blue-700));
  975. }
  976. </style>
  977. <div id="sliderContainer" class\$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
  978. <div class="bar-container">
  979. <paper-progress disabled\$="[[disabled]]" id="sliderBar" aria-hidden="true" min="[[min]]" max="[[max]]" step="[[step]]" value="[[immediateValue]]" secondary-progress="[[secondaryProgress]]" on-down="_bardown" on-up="_resetKnob" on-track="_bartrack" on-tap="_barclick">
  980. </paper-progress>
  981. </div>
  982. <template is="dom-if" if="[[snaps]]">
  983. <div class="slider-markers">
  984. <template is="dom-repeat" items="[[markers]]">
  985. <div class="slider-marker"></div>
  986. </template>
  987. </div>
  988. </template>
  989. <div id="sliderKnob" class="slider-knob" on-down="_knobdown" on-up="_resetKnob" on-track="_onTrack" on-transitionend="_knobTransitionEnd">
  990. <div class="slider-knob-inner" value\$="[[immediateValue]]"></div>
  991. </div>
  992. </div>
  993. <template is="dom-if" if="[[editable]]">
  994. <paper-input id="input" type="number" step="[[step]]" min="[[min]]" max="[[max]]" class="slider-input" disabled\$="[[disabled]]" value="[[immediateValue]]" on-change="_changeValue" on-keydown="_inputKeyDown" no-label-float>
  995. </paper-input>
  996. </template>
  997. `;De.setAttribute("strip-whitespace",""),E({_template:De,is:"paper-slider",behaviors:[Ce,he,Ke,Be],properties:{value:{type:Number,value:0},snaps:{type:Boolean,value:!1,notify:!0},pin:{type:Boolean,value:!1,notify:!0},secondaryProgress:{type:Number,value:0,notify:!0,observer:"_secondaryProgressChanged"},editable:{type:Boolean,value:!1},immediateValue:{type:Number,value:0,readOnly:!0,notify:!0},maxMarkers:{type:Number,value:0,notify:!0},expand:{type:Boolean,value:!1,readOnly:!0},ignoreBarTouch:{type:Boolean,value:!1},dragging:{type:Boolean,value:!1,readOnly:!0,notify:!0},transiting:{type:Boolean,value:!1,readOnly:!0},markers:{type:Array,readOnly:!0,value:function(){return[]}}},observers:["_updateKnob(value, min, max, snaps, step)","_valueChanged(value)","_immediateValueChanged(immediateValue)","_updateMarkers(maxMarkers, min, max, snaps)"],hostAttributes:{role:"slider",tabindex:0},keyBindings:{left:"_leftKey",right:"_rightKey","down pagedown home":"_decrementKey","up pageup end":"_incrementKey"},ready:function(){this.ignoreBarTouch&&V(this.$.sliderBar,"auto")},increment:function(){this.value=this._clampValue(this.value+this.step)},decrement:function(){this.value=this._clampValue(this.value-this.step)},_updateKnob:function(e,t,i,a,n){this.setAttribute("aria-valuemin",t),this.setAttribute("aria-valuemax",i),this.setAttribute("aria-valuenow",e),this._positionKnob(100*this._calcRatio(e))},_valueChanged:function(){this.fire("value-change",{composed:!0})},_immediateValueChanged:function(){this.dragging?this.fire("immediate-value-change",{composed:!0}):this.value=this.immediateValue},_secondaryProgressChanged:function(){this.secondaryProgress=this._clampValue(this.secondaryProgress)},_expandKnob:function(){this._setExpand(!0)},_resetKnob:function(){this.cancelDebouncer("expandKnob"),this._setExpand(!1)},_positionKnob:function(e){this._setImmediateValue(this._calcStep(this._calcKnobPosition(e))),this._setRatio(100*this._calcRatio(this.immediateValue)),this.$.sliderKnob.style.left=this.ratio+"%",this.dragging&&(this._knobstartx=this.ratio*this._w/100,this.translate3d(0,0,0,this.$.sliderKnob))},_calcKnobPosition:function(e){return(this.max-this.min)*e/100+this.min},_onTrack:function(e){switch(e.stopPropagation(),e.detail.state){case"start":this._trackStart(e);break;case"track":this._trackX(e);break;case"end":this._trackEnd()}},_trackStart:function(e){this._setTransiting(!1),this._w=this.$.sliderBar.offsetWidth,this._x=this.ratio*this._w/100,this._startx=this._x,this._knobstartx=this._startx,this._minx=-this._startx,this._maxx=this._w-this._startx,this.$.sliderKnob.classList.add("dragging"),this._setDragging(!0)},_trackX:function(e){this.dragging||this._trackStart(e);var t=this._isRTL?-1:1,i=Math.min(this._maxx,Math.max(this._minx,e.detail.dx*t));this._x=this._startx+i;var a=this._calcStep(this._calcKnobPosition(this._x/this._w*100));this._setImmediateValue(a);var n=this._calcRatio(this.immediateValue)*this._w-this._knobstartx;this.translate3d(n+"px",0,0,this.$.sliderKnob)},_trackEnd:function(){var e=this.$.sliderKnob.style;this.$.sliderKnob.classList.remove("dragging"),this._setDragging(!1),this._resetKnob(),this.value=this.immediateValue,e.transform=e.webkitTransform="",this.fire("change",{composed:!0})},_knobdown:function(e){this._expandKnob(),e.preventDefault(),this.focus()},_bartrack:function(e){this._allowBarEvent(e)&&this._onTrack(e)},_barclick:function(e){this._w=this.$.sliderBar.offsetWidth;var t=this.$.sliderBar.getBoundingClientRect(),i=(e.detail.x-t.left)/this._w*100;this._isRTL&&(i=100-i);var a=this.ratio;this._setTransiting(!0),this._positionKnob(i),a===this.ratio&&this._setTransiting(!1),this.async((function(){this.fire("change",{composed:!0})})),e.preventDefault(),this.focus()},_bardown:function(e){this._allowBarEvent(e)&&(this.debounce("expandKnob",this._expandKnob,60),this._barclick(e))},_knobTransitionEnd:function(e){e.target===this.$.sliderKnob&&this._setTransiting(!1)},_updateMarkers:function(e,t,i,a){a||this._setMarkers([]);var n=Math.round((i-t)/this.step);n>e&&(n=e),(n<0||!isFinite(n))&&(n=0),this._setMarkers(new Array(n))},_mergeClasses:function(e){return Object.keys(e).filter((function(t){return e[t]})).join(" ")},_getClassNames:function(){return this._mergeClasses({disabled:this.disabled,pin:this.pin,snaps:this.snaps,ring:this.immediateValue<=this.min,expand:this.expand,dragging:this.dragging,transiting:this.transiting,editable:this.editable})},_allowBarEvent:function(e){return!this.ignoreBarTouch||e.detail.sourceEvent instanceof MouseEvent},get _isRTL(){return void 0===this.__isRTL&&(this.__isRTL="rtl"===window.getComputedStyle(this).direction),this.__isRTL},_leftKey:function(e){this._isRTL?this._incrementKey(e):this._decrementKey(e)},_rightKey:function(e){this._isRTL?this._decrementKey(e):this._incrementKey(e)},_incrementKey:function(e){this.disabled||("end"===e.detail.key?this.value=this.max:this.increment(),this.fire("change"),e.preventDefault())},_decrementKey:function(e){this.disabled||("home"===e.detail.key?this.value=this.min:this.decrement(),this.fire("change"),e.preventDefault())},_changeValue:function(e){this.value=e.target.value,this.fire("change",{composed:!0})},_inputKeyDown:function(e){e.stopPropagation()},_createRipple:function(){return this._rippleContainer=this.$.sliderKnob,Te._createRipple.call(this)},_focusedChanged:function(e){e&&this.ensureRipple(),this.hasRipple()&&(this._ripple.style.display=e?"":"none",this._ripple.holdDown=e)}});const Fe=customElements.get("paper-slider");let Oe;function He(e){return Array.isArray(e)?e[0]:e}function qe(e){return Array.isArray(e)?e[1]||e[0]:e}customElements.define("ha-slider",class extends Fe{static get template(){if(!Oe){Oe=Fe.template.cloneNode(!0);Oe.content.querySelector("style").appendChild(document.createTextNode('\n :host([dir="rtl"]) #sliderContainer.pin.expand > .slider-knob > .slider-knob-inner::after {\n -webkit-transform: scale(1) translate(0, -17px) scaleX(-1) !important;\n transform: scale(1) translate(0, -17px) scaleX(-1) !important;\n }\n\n .pin > .slider-knob > .slider-knob-inner {\n font-size: var(--ha-slider-pin-font-size, 15px);\n line-height: normal;\n cursor: pointer;\n }\n\n .disabled.ring > .slider-knob > .slider-knob-inner {\n background-color: var(--paper-slider-disabled-knob-color, var(--disabled-text-color));\n border: 2px solid var(--paper-slider-disabled-knob-color, var(--disabled-text-color));\n }\n\n .pin > .slider-knob > .slider-knob-inner::before {\n top: unset;\n margin-left: unset;\n\n bottom: calc(15px + var(--calculated-paper-slider-height)/2);\n left: 50%;\n width: 2.6em;\n height: 2.6em;\n\n -webkit-transform-origin: left bottom;\n transform-origin: left bottom;\n -webkit-transform: rotate(-45deg) scale(0) translate(0);\n transform: rotate(-45deg) scale(0) translate(0);\n }\n\n .pin.expand > .slider-knob > .slider-knob-inner::before {\n -webkit-transform: rotate(-45deg) scale(1) translate(7px, -7px);\n transform: rotate(-45deg) scale(1) translate(7px, -7px);\n }\n\n .pin > .slider-knob > .slider-knob-inner::after {\n top: unset;\n font-size: unset;\n\n bottom: calc(15px + var(--calculated-paper-slider-height)/2);\n left: 50%;\n margin-left: -1.3em;\n width: 2.6em;\n height: 2.5em;\n\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n -webkit-transform: scale(0) translate(0);\n transform: scale(0) translate(0);\n }\n\n .pin.expand > .slider-knob > .slider-knob-inner::after {\n -webkit-transform: scale(1) translate(0, -10px);\n transform: scale(1) translate(0, -10px);\n }\n\n .slider-input {\n width: 54px;\n }\n '))}return Oe}_setImmediateValue(e){super._setImmediateValue(this.step>=1?Math.round(e):Math.round(100*e)/100)}_calcStep(e){if(!this.step)return parseFloat(e);const t=Math.round((e-this.min)/this.step),i=this.step.toString(),a=i.indexOf(".");if(-1!==a){const e=10**(i.length-a-1);return Math.round((t*this.step+this.min)*e)/e}return t*this.step+this.min}}),e([l("ha-form-integer")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[x("ha-textfield ha-slider")],key:"_input",value:void 0},{kind:"field",key:"_lastValue",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){var e;return void 0!==this.schema.valueMin&&void 0!==this.schema.valueMax&&this.schema.valueMax-this.schema.valueMin<256?a`
  998. <div>
  999. ${this.label}
  1000. <div class="flex">
  1001. ${this.schema.required?"":a`
  1002. <ha-checkbox
  1003. @change=${this._handleCheckboxChange}
  1004. .checked=${void 0!==this.data}
  1005. .disabled=${this.disabled}
  1006. ></ha-checkbox>
  1007. `}
  1008. <ha-slider
  1009. pin
  1010. ignore-bar-touch
  1011. .value=${this._value}
  1012. .min=${this.schema.valueMin}
  1013. .max=${this.schema.valueMax}
  1014. .disabled=${this.disabled||void 0===this.data&&!this.schema.required}
  1015. @change=${this._valueChanged}
  1016. ></ha-slider>
  1017. </div>
  1018. </div>
  1019. `:a`
  1020. <ha-textfield
  1021. type="number"
  1022. inputMode="numeric"
  1023. .label=${this.label}
  1024. .value=${void 0!==this.data?this.data:""}
  1025. .disabled=${this.disabled}
  1026. .required=${this.schema.required}
  1027. .autoValidate=${this.schema.required}
  1028. .suffix=${null===(e=this.schema.description)||void 0===e?void 0:e.suffix}
  1029. .validationMessage=${this.schema.required?"Required":void 0}
  1030. @input=${this._valueChanged}
  1031. ></ha-textfield>
  1032. `}},{kind:"method",key:"updated",value:function(e){e.has("schema")&&this.toggleAttribute("own-margin",!("valueMin"in this.schema&&"valueMax"in this.schema||!this.schema.required))}},{kind:"get",key:"_value",value:function(){var e,t;return void 0!==this.data?this.data:this.schema.required?void 0!==(null===(e=this.schema.description)||void 0===e?void 0:e.suggested_value)&&null!==(null===(t=this.schema.description)||void 0===t?void 0:t.suggested_value)||this.schema.default||this.schema.valueMin||0:this.schema.valueMin||0}},{kind:"method",key:"_handleCheckboxChange",value:function(e){let t;if(e.target.checked)for(const e of[this._lastValue,null===(i=this.schema.description)||void 0===i?void 0:i.suggested_value,this.schema.default,0]){var i;if(void 0!==e){t=e;break}}else this._lastValue=this.data;o(this,"value-changed",{value:t})}},{kind:"method",key:"_valueChanged",value:function(e){const t=e.target,i=t.value;let a;if(""!==i&&(a=parseInt(String(i))),this.data!==a)o(this,"value-changed",{value:a});else{const e=void 0===a?"":String(a);t.value!==e&&(t.value=e)}}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  1033. :host([own-margin]) {
  1034. margin-bottom: 5px;
  1035. }
  1036. .flex {
  1037. display: flex;
  1038. }
  1039. ha-slider {
  1040. flex: 1;
  1041. }
  1042. ha-textfield {
  1043. display: block;
  1044. }
  1045. `}}]}}),t),e([l("ha-formfield")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"_labelClick",value:function(){const e=this.input;if(e)switch(e.focus(),e.tagName){case"HA-CHECKBOX":case"HA-RADIO":if(e.disabled)break;e.checked=!e.checked,o(e,"change");break;default:e.click()}}},{kind:"field",static:!0,key:"styles",value:()=>[ae,s`
  1046. :host(:not([alignEnd])) ::slotted(ha-switch) {
  1047. margin-right: 10px;
  1048. margin-inline-end: 10px;
  1049. margin-inline-start: inline;
  1050. }
  1051. .mdc-form-field > label {
  1052. direction: var(--direction);
  1053. margin-inline-start: 0;
  1054. margin-inline-end: auto;
  1055. padding-inline-start: 4px;
  1056. padding-inline-end: 0;
  1057. }
  1058. `]}]}}),ie);e([l("ha-form-multi_select")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i()],key:"schema",value:void 0},{kind:"field",decorators:[i()],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[M()],key:"_opened",value:()=>!1},{kind:"field",decorators:[x("ha-button-menu")],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){const e=Array.isArray(this.schema.options)?this.schema.options:Object.entries(this.schema.options),t=this.data||[];return e.length<6?a`<div>
  1059. ${this.label}${e.map((e=>{const i=He(e);return a`
  1060. <ha-formfield .label=${qe(e)}>
  1061. <ha-checkbox
  1062. .checked=${t.includes(i)}
  1063. .value=${i}
  1064. .disabled=${this.disabled}
  1065. @change=${this._valueChanged}
  1066. ></ha-checkbox>
  1067. </ha-formfield>
  1068. `}))}
  1069. </div> `:a`
  1070. <ha-button-menu
  1071. .disabled=${this.disabled}
  1072. fixed
  1073. corner="BOTTOM_START"
  1074. @opened=${this._handleOpen}
  1075. @closed=${this._handleClose}
  1076. multi
  1077. activatable
  1078. >
  1079. <ha-textfield
  1080. slot="trigger"
  1081. .label=${this.label}
  1082. .value=${t.map((e=>this.schema.options[e]||e)).join(", ")}
  1083. .disabled=${this.disabled}
  1084. tabindex="-1"
  1085. ></ha-textfield>
  1086. <ha-svg-icon
  1087. slot="trigger"
  1088. .path=${this._opened?I:L}
  1089. ></ha-svg-icon>
  1090. ${e.map((e=>{const i=He(e),n=t.includes(i);return a`<ha-check-list-item
  1091. left
  1092. .selected=${n}
  1093. .activated=${n}
  1094. @request-selected=${this._selectedChanged}
  1095. .value=${i}
  1096. .disabled=${this.disabled}
  1097. >
  1098. ${qe(e)}
  1099. </ha-check-list-item>`}))}
  1100. </ha-button-menu>
  1101. `}},{kind:"method",key:"firstUpdated",value:function(){this.updateComplete.then((()=>{var e;const{formElement:t,mdcRoot:i}=(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("ha-textfield"))||{};t&&(t.style.textOverflow="ellipsis"),i&&(i.style.cursor="pointer")}))}},{kind:"method",key:"updated",value:function(e){e.has("schema")&&this.toggleAttribute("own-margin",Object.keys(this.schema.options).length>=6&&!!this.schema.required)}},{kind:"method",key:"_selectedChanged",value:function(e){e.stopPropagation(),"property"!==e.detail.source&&this._handleValueChanged(e.target.value,e.detail.selected)}},{kind:"method",key:"_valueChanged",value:function(e){const{value:t,checked:i}=e.target;this._handleValueChanged(t,i)}},{kind:"method",key:"_handleValueChanged",value:function(e,t){let i;if(t)if(this.data){if(this.data.includes(e))return;i=[...this.data,e]}else i=[e];else{if(!this.data.includes(e))return;i=this.data.filter((t=>t!==e))}o(this,"value-changed",{value:i})}},{kind:"method",key:"_handleOpen",value:function(e){e.stopPropagation(),this._opened=!0,this.toggleAttribute("opened",!0)}},{kind:"method",key:"_handleClose",value:function(e){e.stopPropagation(),this._opened=!1,this.toggleAttribute("opened",!1)}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  1102. :host([own-margin]) {
  1103. margin-bottom: 5px;
  1104. }
  1105. ha-button-menu {
  1106. display: block;
  1107. cursor: pointer;
  1108. }
  1109. ha-formfield {
  1110. display: block;
  1111. padding-right: 16px;
  1112. padding-inline-end: 16px;
  1113. padding-inline-start: initial;
  1114. direction: var(--direction);
  1115. }
  1116. ha-textfield {
  1117. display: block;
  1118. pointer-events: none;
  1119. }
  1120. ha-svg-icon {
  1121. color: var(--input-dropdown-icon-color);
  1122. position: absolute;
  1123. right: 1em;
  1124. top: 1em;
  1125. cursor: pointer;
  1126. inset-inline-end: 1em;
  1127. inset-inline-start: initial;
  1128. direction: var(--direction);
  1129. }
  1130. :host([opened]) ha-svg-icon {
  1131. color: var(--primary-color);
  1132. }
  1133. :host([opened]) ha-button-menu {
  1134. --mdc-text-field-idle-line-color: var(--input-hover-line-color);
  1135. --mdc-text-field-label-ink-color: var(--primary-color);
  1136. }
  1137. `}}]}}),t),e([l("ha-input-helper-text")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"render",value:function(){return a`<slot></slot>`}},{kind:"field",static:!0,key:"styles",value:()=>s`
  1138. :host {
  1139. display: block;
  1140. color: var(--mdc-text-field-label-ink-color, rgba(0, 0, 0, 0.6));
  1141. font-size: 0.75rem;
  1142. padding-left: 16px;
  1143. padding-right: 16px;
  1144. }
  1145. `}]}}),t),e([l("ha-base-time-input")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i()],key:"helper",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"autoValidate",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[i({type:Number})],key:"format",value:()=>12},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[i({type:Number})],key:"days",value:()=>0},{kind:"field",decorators:[i({type:Number})],key:"hours",value:()=>0},{kind:"field",decorators:[i({type:Number})],key:"minutes",value:()=>0},{kind:"field",decorators:[i({type:Number})],key:"seconds",value:()=>0},{kind:"field",decorators:[i({type:Number})],key:"milliseconds",value:()=>0},{kind:"field",decorators:[i()],key:"dayLabel",value:()=>""},{kind:"field",decorators:[i()],key:"hourLabel",value:()=>""},{kind:"field",decorators:[i()],key:"minLabel",value:()=>""},{kind:"field",decorators:[i()],key:"secLabel",value:()=>""},{kind:"field",decorators:[i()],key:"millisecLabel",value:()=>""},{kind:"field",decorators:[i({type:Boolean})],key:"enableSecond",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"enableMillisecond",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"enableDay",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"noHoursLimit",value:()=>!1},{kind:"field",decorators:[i()],key:"amPm",value:()=>"AM"},{kind:"method",key:"render",value:function(){return a`
  1146. ${this.label?a`<label>${this.label}${this.required?" *":""}</label>`:""}
  1147. <div class="time-input-wrap">
  1148. ${this.enableDay?a`
  1149. <ha-textfield
  1150. id="day"
  1151. type="number"
  1152. inputmode="numeric"
  1153. .value=${this.days.toFixed()}
  1154. .label=${this.dayLabel}
  1155. name="days"
  1156. @change=${this._valueChanged}
  1157. @focusin=${this._onFocus}
  1158. no-spinner
  1159. .required=${this.required}
  1160. .autoValidate=${this.autoValidate}
  1161. min="0"
  1162. .disabled=${this.disabled}
  1163. suffix=":"
  1164. class="hasSuffix"
  1165. >
  1166. </ha-textfield>
  1167. `:""}
  1168. <ha-textfield
  1169. id="hour"
  1170. type="number"
  1171. inputmode="numeric"
  1172. .value=${this.hours.toFixed()}
  1173. .label=${this.hourLabel}
  1174. name="hours"
  1175. @change=${this._valueChanged}
  1176. @focusin=${this._onFocus}
  1177. no-spinner
  1178. .required=${this.required}
  1179. .autoValidate=${this.autoValidate}
  1180. maxlength="2"
  1181. max=${P(this._hourMax)}
  1182. min="0"
  1183. .disabled=${this.disabled}
  1184. suffix=":"
  1185. class="hasSuffix"
  1186. >
  1187. </ha-textfield>
  1188. <ha-textfield
  1189. id="min"
  1190. type="number"
  1191. inputmode="numeric"
  1192. .value=${this._formatValue(this.minutes)}
  1193. .label=${this.minLabel}
  1194. @change=${this._valueChanged}
  1195. @focusin=${this._onFocus}
  1196. name="minutes"
  1197. no-spinner
  1198. .required=${this.required}
  1199. .autoValidate=${this.autoValidate}
  1200. maxlength="2"
  1201. max="59"
  1202. min="0"
  1203. .disabled=${this.disabled}
  1204. .suffix=${this.enableSecond?":":""}
  1205. class=${this.enableSecond?"has-suffix":""}
  1206. >
  1207. </ha-textfield>
  1208. ${this.enableSecond?a`<ha-textfield
  1209. id="sec"
  1210. type="number"
  1211. inputmode="numeric"
  1212. .value=${this._formatValue(this.seconds)}
  1213. .label=${this.secLabel}
  1214. @change=${this._valueChanged}
  1215. @focusin=${this._onFocus}
  1216. name="seconds"
  1217. no-spinner
  1218. .required=${this.required}
  1219. .autoValidate=${this.autoValidate}
  1220. maxlength="2"
  1221. max="59"
  1222. min="0"
  1223. .disabled=${this.disabled}
  1224. .suffix=${this.enableMillisecond?":":""}
  1225. class=${this.enableMillisecond?"has-suffix":""}
  1226. >
  1227. </ha-textfield>`:""}
  1228. ${this.enableMillisecond?a`<ha-textfield
  1229. id="millisec"
  1230. type="number"
  1231. .value=${this._formatValue(this.milliseconds,3)}
  1232. .label=${this.millisecLabel}
  1233. @change=${this._valueChanged}
  1234. @focusin=${this._onFocus}
  1235. name="milliseconds"
  1236. no-spinner
  1237. .required=${this.required}
  1238. .autoValidate=${this.autoValidate}
  1239. maxlength="3"
  1240. max="999"
  1241. min="0"
  1242. .disabled=${this.disabled}
  1243. >
  1244. </ha-textfield>`:""}
  1245. ${24===this.format?"":a`<ha-select
  1246. .required=${this.required}
  1247. .value=${this.amPm}
  1248. .disabled=${this.disabled}
  1249. name="amPm"
  1250. naturalMenuWidth
  1251. fixedMenuPosition
  1252. @selected=${this._valueChanged}
  1253. @closed=${U}
  1254. >
  1255. <mwc-list-item value="AM">AM</mwc-list-item>
  1256. <mwc-list-item value="PM">PM</mwc-list-item>
  1257. </ha-select>`}
  1258. </div>
  1259. ${this.helper?a`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`:""}
  1260. `}},{kind:"method",key:"_valueChanged",value:function(e){const t=e.currentTarget;this[t.name]="amPm"===t.name?t.value:Number(t.value);const i={hours:this.hours,minutes:this.minutes,seconds:this.seconds,milliseconds:this.milliseconds};12===this.format&&(i.amPm=this.amPm),o(this,"value-changed",{value:i})}},{kind:"method",key:"_onFocus",value:function(e){e.currentTarget.select()}},{kind:"method",key:"_formatValue",value:function(e,t=2){return e.toString().padStart(t,"0")}},{kind:"get",key:"_hourMax",value:function(){if(!this.noHoursLimit)return 12===this.format?12:23}},{kind:"field",static:!0,key:"styles",value:()=>s`
  1261. :host {
  1262. display: block;
  1263. }
  1264. .time-input-wrap {
  1265. display: flex;
  1266. border-radius: var(--mdc-shape-small, 4px) var(--mdc-shape-small, 4px) 0 0;
  1267. overflow: hidden;
  1268. position: relative;
  1269. direction: ltr;
  1270. }
  1271. ha-textfield {
  1272. width: 40px;
  1273. text-align: center;
  1274. --mdc-shape-small: 0;
  1275. --text-field-appearance: none;
  1276. --text-field-padding: 0 4px;
  1277. --text-field-suffix-padding-left: 2px;
  1278. --text-field-suffix-padding-right: 0;
  1279. --text-field-text-align: center;
  1280. }
  1281. ha-textfield.hasSuffix {
  1282. --text-field-padding: 0 0 0 4px;
  1283. }
  1284. ha-textfield:first-child {
  1285. --text-field-border-top-left-radius: var(--mdc-shape-medium);
  1286. }
  1287. ha-textfield:last-child {
  1288. --text-field-border-top-right-radius: var(--mdc-shape-medium);
  1289. }
  1290. ha-select {
  1291. --mdc-shape-small: 0;
  1292. width: 85px;
  1293. }
  1294. label {
  1295. -moz-osx-font-smoothing: grayscale;
  1296. -webkit-font-smoothing: antialiased;
  1297. font-family: var(
  1298. --mdc-typography-body2-font-family,
  1299. var(--mdc-typography-font-family, Roboto, sans-serif)
  1300. );
  1301. font-size: var(--mdc-typography-body2-font-size, 0.875rem);
  1302. line-height: var(--mdc-typography-body2-line-height, 1.25rem);
  1303. font-weight: var(--mdc-typography-body2-font-weight, 400);
  1304. letter-spacing: var(
  1305. --mdc-typography-body2-letter-spacing,
  1306. 0.0178571429em
  1307. );
  1308. text-decoration: var(--mdc-typography-body2-text-decoration, inherit);
  1309. text-transform: var(--mdc-typography-body2-text-transform, inherit);
  1310. color: var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));
  1311. padding-left: 4px;
  1312. }
  1313. `}]}}),t),e([l("ha-duration-input")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i()],key:"helper",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"enableMillisecond",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"enableDay",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[x("paper-time-input",!0)],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){return a`
  1314. <ha-base-time-input
  1315. .label=${this.label}
  1316. .helper=${this.helper}
  1317. .required=${this.required}
  1318. .autoValidate=${this.required}
  1319. .disabled=${this.disabled}
  1320. errorMessage="Required"
  1321. enableSecond
  1322. .enableMillisecond=${this.enableMillisecond}
  1323. .enableDay=${this.enableDay}
  1324. format="24"
  1325. .days=${this._days}
  1326. .hours=${this._hours}
  1327. .minutes=${this._minutes}
  1328. .seconds=${this._seconds}
  1329. .milliseconds=${this._milliseconds}
  1330. @value-changed=${this._durationChanged}
  1331. noHoursLimit
  1332. dayLabel="dd"
  1333. hourLabel="hh"
  1334. minLabel="mm"
  1335. secLabel="ss"
  1336. millisecLabel="ms"
  1337. ></ha-base-time-input>
  1338. `}},{kind:"get",key:"_days",value:function(){var e;return null!==(e=this.data)&&void 0!==e&&e.days?Number(this.data.days):0}},{kind:"get",key:"_hours",value:function(){var e;return null!==(e=this.data)&&void 0!==e&&e.hours?Number(this.data.hours):0}},{kind:"get",key:"_minutes",value:function(){var e;return null!==(e=this.data)&&void 0!==e&&e.minutes?Number(this.data.minutes):0}},{kind:"get",key:"_seconds",value:function(){var e;return null!==(e=this.data)&&void 0!==e&&e.seconds?Number(this.data.seconds):0}},{kind:"get",key:"_milliseconds",value:function(){var e;return null!==(e=this.data)&&void 0!==e&&e.milliseconds?Number(this.data.milliseconds):0}},{kind:"method",key:"_durationChanged",value:function(e){e.stopPropagation();const t={...e.detail.value};var i;(this.enableMillisecond||t.milliseconds?t.milliseconds>999&&(t.seconds+=Math.floor(t.milliseconds/1e3),t.milliseconds%=1e3):delete t.milliseconds,t.seconds>59&&(t.minutes+=Math.floor(t.seconds/60),t.seconds%=60),t.minutes>59&&(t.hours+=Math.floor(t.minutes/60),t.minutes%=60),this.enableDay&&t.hours>24)&&(t.days=(null!==(i=t.days)&&void 0!==i?i:0)+Math.floor(t.hours/24),t.hours%=24);o(this,"value-changed",{value:t})}}]}}),t),e([l("ha-form-positive_time_period_dict")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[x("ha-time-input",!0)],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){return a`
  1339. <ha-duration-input
  1340. .label=${this.label}
  1341. ?required=${this.schema.required}
  1342. .data=${this.data}
  1343. .disabled=${this.disabled}
  1344. ></ha-duration-input>
  1345. `}}]}}),t),e([l("ha-chip-set")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"render",value:function(){return a`
  1346. <div class="mdc-chip-set">
  1347. <slot></slot>
  1348. </div>
  1349. `}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  1350. ${T(G)}
  1351. slot::slotted(ha-chip) {
  1352. margin: 4px 4px 4px 0;
  1353. }
  1354. `}}]}}),t);const Ne=Symbol("selection controller");class ze{constructor(){this.selected=null,this.ordered=null,this.set=new Set}}class je{constructor(e){this.sets={},this.focusedSet=null,this.mouseIsDown=!1,this.updating=!1,e.addEventListener("keydown",(e=>{this.keyDownHandler(e)})),e.addEventListener("mousedown",(()=>{this.mousedownHandler()})),e.addEventListener("mouseup",(()=>{this.mouseupHandler()}))}static getController(e){const t=!("global"in e)||"global"in e&&e.global?document:e.getRootNode();let i=t[Ne];return void 0===i&&(i=new je(t),t[Ne]=i),i}keyDownHandler(e){const t=e.target;"checked"in t&&this.has(t)&&("ArrowRight"==e.key||"ArrowDown"==e.key?this.selectNext(t):"ArrowLeft"!=e.key&&"ArrowUp"!=e.key||this.selectPrevious(t))}mousedownHandler(){this.mouseIsDown=!0}mouseupHandler(){this.mouseIsDown=!1}has(e){return this.getSet(e.name).set.has(e)}selectPrevious(e){const t=this.getOrdered(e),i=t.indexOf(e),a=t[i-1]||t[t.length-1];return this.select(a),a}selectNext(e){const t=this.getOrdered(e),i=t.indexOf(e),a=t[i+1]||t[0];return this.select(a),a}select(e){e.click()}focus(e){if(this.mouseIsDown)return;const t=this.getSet(e.name),i=this.focusedSet;this.focusedSet=t,i!=t&&t.selected&&t.selected!=e&&t.selected.focus()}isAnySelected(e){const t=this.getSet(e.name);for(const e of t.set)if(e.checked)return!0;return!1}getOrdered(e){const t=this.getSet(e.name);return t.ordered||(t.ordered=Array.from(t.set),t.ordered.sort(((e,t)=>e.compareDocumentPosition(t)==Node.DOCUMENT_POSITION_PRECEDING?1:0))),t.ordered}getSet(e){return this.sets[e]||(this.sets[e]=new ze),this.sets[e]}register(e){const t=e.name||e.getAttribute("name")||"",i=this.getSet(t);i.set.add(e),i.ordered=null}unregister(e){const t=this.getSet(e.name);t.set.delete(e),t.ordered=null,t.selected==e&&(t.selected=null)}update(e){if(this.updating)return;this.updating=!0;const t=this.getSet(e.name);if(e.checked){for(const i of t.set)i!=e&&(i.checked=!1);t.selected=e}if(this.isAnySelected(e))for(const e of t.set){if(void 0===e.formElementTabIndex)break;e.formElementTabIndex=e.checked?0:-1}this.updating=!1}}var Ue={NATIVE_CONTROL_SELECTOR:".mdc-radio__native-control"},Xe={DISABLED:"mdc-radio--disabled",ROOT:"mdc-radio"},We=function(e){function t(i){return e.call(this,g(g({},t.defaultAdapter),i))||this}return y(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return Xe},enumerable:!1,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return Ue},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},setNativeControlDisabled:function(){}}},enumerable:!1,configurable:!0}),t.prototype.setDisabled=function(e){var i=t.cssClasses.DISABLED;this.adapter.setNativeControlDisabled(e),e?this.adapter.addClass(i):this.adapter.removeClass(i)},t}(_);class Ge extends j{constructor(){super(...arguments),this._checked=!1,this.useStateLayerCustomProperties=!1,this.global=!1,this.disabled=!1,this.value="on",this.name="",this.reducedTouchTarget=!1,this.mdcFoundationClass=We,this.formElementTabIndex=0,this.focused=!1,this.shouldRenderRipple=!1,this.rippleElement=null,this.rippleHandlers=new O((()=>(this.shouldRenderRipple=!0,this.ripple.then((e=>{this.rippleElement=e})),this.ripple)))}get checked(){return this._checked}set checked(e){var t,i;const a=this._checked;e!==a&&(this._checked=e,this.formElement&&(this.formElement.checked=e),null===(t=this._selectionController)||void 0===t||t.update(this),!1===e&&(null===(i=this.formElement)||void 0===i||i.blur()),this.requestUpdate("checked",a),this.dispatchEvent(new Event("checked",{bubbles:!0,composed:!0})))}_handleUpdatedValue(e){this.formElement.value=e}renderRipple(){return this.shouldRenderRipple?a`<mwc-ripple unbounded accent
  1355. .internalUseStateLayerCustomProperties="${this.useStateLayerCustomProperties}"
  1356. .disabled="${this.disabled}"></mwc-ripple>`:""}get isRippleActive(){var e;return(null===(e=this.rippleElement)||void 0===e?void 0:e.isActive)||!1}connectedCallback(){super.connectedCallback(),this._selectionController=je.getController(this),this._selectionController.register(this),this._selectionController.update(this)}disconnectedCallback(){this._selectionController.unregister(this),this._selectionController=void 0}focus(){this.formElement.focus()}createAdapter(){return Object.assign(Object.assign({},H(this.mdcRoot)),{setNativeControlDisabled:e=>{this.formElement.disabled=e}})}handleFocus(){this.focused=!0,this.handleRippleFocus()}handleClick(){this.formElement.focus()}handleBlur(){this.focused=!1,this.formElement.blur(),this.rippleHandlers.endFocus()}setFormData(e){this.name&&this.checked&&e.append(this.name,this.value)}render(){const e={"mdc-radio--touch":!this.reducedTouchTarget,"mdc-ripple-upgraded--background-focused":this.focused,"mdc-radio--disabled":this.disabled};return a`
  1357. <div class="mdc-radio ${n(e)}">
  1358. <input
  1359. tabindex="${this.formElementTabIndex}"
  1360. class="mdc-radio__native-control"
  1361. type="radio"
  1362. name="${this.name}"
  1363. aria-label="${P(this.ariaLabel)}"
  1364. aria-labelledby="${P(this.ariaLabelledBy)}"
  1365. .checked="${this.checked}"
  1366. .value="${this.value}"
  1367. ?disabled="${this.disabled}"
  1368. @change="${this.changeHandler}"
  1369. @focus="${this.handleFocus}"
  1370. @click="${this.handleClick}"
  1371. @blur="${this.handleBlur}"
  1372. @mousedown="${this.handleRippleMouseDown}"
  1373. @mouseenter="${this.handleRippleMouseEnter}"
  1374. @mouseleave="${this.handleRippleMouseLeave}"
  1375. @touchstart="${this.handleRippleTouchStart}"
  1376. @touchend="${this.handleRippleDeactivate}"
  1377. @touchcancel="${this.handleRippleDeactivate}">
  1378. <div class="mdc-radio__background">
  1379. <div class="mdc-radio__outer-circle"></div>
  1380. <div class="mdc-radio__inner-circle"></div>
  1381. </div>
  1382. ${this.renderRipple()}
  1383. </div>`}handleRippleMouseDown(e){const t=()=>{window.removeEventListener("mouseup",t),this.handleRippleDeactivate()};window.addEventListener("mouseup",t),this.rippleHandlers.startPress(e)}handleRippleTouchStart(e){this.rippleHandlers.startPress(e)}handleRippleDeactivate(){this.rippleHandlers.endPress()}handleRippleMouseEnter(){this.rippleHandlers.startHover()}handleRippleMouseLeave(){this.rippleHandlers.endHover()}handleRippleFocus(){this.rippleHandlers.startFocus()}changeHandler(){this.checked=this.formElement.checked}}k([x(".mdc-radio")],Ge.prototype,"mdcRoot",void 0),k([x("input")],Ge.prototype,"formElement",void 0),k([M()],Ge.prototype,"useStateLayerCustomProperties",void 0),k([i({type:Boolean})],Ge.prototype,"global",void 0),k([i({type:Boolean,reflect:!0})],Ge.prototype,"checked",null),k([i({type:Boolean}),X((function(e){this.mdcFoundation.setDisabled(e)}))],Ge.prototype,"disabled",void 0),k([i({type:String}),X((function(e){this._handleUpdatedValue(e)}))],Ge.prototype,"value",void 0),k([i({type:String})],Ge.prototype,"name",void 0),k([i({type:Boolean})],Ge.prototype,"reducedTouchTarget",void 0),k([i({type:Number})],Ge.prototype,"formElementTabIndex",void 0),k([M()],Ge.prototype,"focused",void 0),k([M()],Ge.prototype,"shouldRenderRipple",void 0),k([K("mwc-ripple")],Ge.prototype,"ripple",void 0),k([D,i({attribute:"aria-label"})],Ge.prototype,"ariaLabel",void 0),k([D,i({attribute:"aria-labelledby"})],Ge.prototype,"ariaLabelledBy",void 0),k([F({passive:!0})],Ge.prototype,"handleRippleTouchStart",null);const Ye=s`.mdc-touch-target-wrapper{display:inline}.mdc-radio{padding:calc((40px - 20px) / 2)}.mdc-radio .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0, 0, 0, 0.54)}.mdc-radio .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__native-control:enabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0, 0, 0, 0.38)}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0, 0, 0, 0.38)}.mdc-radio [aria-disabled=true] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:rgba(0, 0, 0, 0.38)}.mdc-radio .mdc-radio__background::before{background-color:#018786;background-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__background::before{top:calc(-1 * (40px - 20px) / 2);left:calc(-1 * (40px - 20px) / 2);width:40px;height:40px}.mdc-radio .mdc-radio__native-control{top:calc((40px - 40px) / 2);right:calc((40px - 40px) / 2);left:calc((40px - 40px) / 2);width:40px;height:40px}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-radio [aria-disabled=true] .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:GrayText}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:GrayText}.mdc-radio [aria-disabled=true] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:GrayText}}.mdc-radio{display:inline-block;position:relative;flex:0 0 auto;box-sizing:content-box;width:20px;height:20px;cursor:pointer;will-change:opacity,transform,border-color,color}.mdc-radio__background{display:inline-block;position:relative;box-sizing:border-box;width:20px;height:20px}.mdc-radio__background::before{position:absolute;transform:scale(0, 0);border-radius:50%;opacity:0;pointer-events:none;content:"";transition:opacity 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1),transform 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-radio__outer-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:50%;transition:border-color 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-radio__inner-circle{position:absolute;top:0;left:0;box-sizing:border-box;width:100%;height:100%;transform:scale(0, 0);border-width:10px;border-style:solid;border-radius:50%;transition:transform 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1),border-color 120ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-radio__native-control{position:absolute;margin:0;padding:0;opacity:0;cursor:inherit;z-index:1}.mdc-radio--touch{margin-top:4px;margin-bottom:4px;margin-right:4px;margin-left:4px}.mdc-radio--touch .mdc-radio__native-control{top:calc((40px - 48px) / 2);right:calc((40px - 48px) / 2);left:calc((40px - 48px) / 2);width:48px;height:48px}.mdc-radio__native-control:checked+.mdc-radio__background,.mdc-radio__native-control:disabled+.mdc-radio__background{transition:opacity 120ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__outer-circle{transition:border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{transition:transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1),border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio--disabled{cursor:default;pointer-events:none}.mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__inner-circle{transform:scale(0.5);transition:transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1),border-color 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-radio__native-control:disabled+.mdc-radio__background,[aria-disabled=true] .mdc-radio__native-control+.mdc-radio__background{cursor:default}.mdc-radio__native-control:focus+.mdc-radio__background::before{transform:scale(1);opacity:.12;transition:opacity 120ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 120ms 0ms cubic-bezier(0, 0, 0.2, 1)}:host{display:inline-block;outline:none}.mdc-radio{vertical-align:bottom}.mdc-radio .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-unchecked-color, rgba(0, 0, 0, 0.54))}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-color, rgba(0, 0, 0, 0.38))}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:var(--mdc-radio-disabled-color, rgba(0, 0, 0, 0.38))}.mdc-radio [aria-disabled=true] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:var(--mdc-radio-disabled-color, rgba(0, 0, 0, 0.38))}`;e([l("ha-radio")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",static:!0,key:"styles",value:()=>[Ye,s`
  1384. :host {
  1385. --mdc-theme-secondary: var(--primary-color);
  1386. }
  1387. `]}]}}),Ge);let Je=e([l("ha-selector-select")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"selector",value:void 0},{kind:"field",decorators:[i()],key:"value",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i()],key:"helper",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[i({type:Boolean})],key:"required",value:()=>!0},{kind:"field",decorators:[x("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_filter",value:()=>""},{kind:"method",key:"render",value:function(){const e=this.selector.select.options.map((e=>"object"==typeof e?e:{value:e,label:e}));if(!this.selector.select.custom_value&&"list"===this._mode)return this.selector.select.multiple?a`
  1388. <div>
  1389. ${this.label}
  1390. ${e.map((e=>{var t;return a`
  1391. <ha-formfield .label=${e.label}>
  1392. <ha-checkbox
  1393. .checked=${null===(t=this.value)||void 0===t?void 0:t.includes(e.value)}
  1394. .value=${e.value}
  1395. .disabled=${e.disabled||this.disabled}
  1396. @change=${this._checkboxChanged}
  1397. ></ha-checkbox>
  1398. </ha-formfield>
  1399. `}))}
  1400. </div>
  1401. ${this._renderHelper()}
  1402. `:a`
  1403. <div>
  1404. ${this.label}
  1405. ${e.map((e=>a`
  1406. <ha-formfield .label=${e.label}>
  1407. <ha-radio
  1408. .checked=${e.value===this.value}
  1409. .value=${e.value}
  1410. .disabled=${e.disabled||this.disabled}
  1411. @change=${this._valueChanged}
  1412. ></ha-radio>
  1413. </ha-formfield>
  1414. `))}
  1415. </div>
  1416. ${this._renderHelper()}
  1417. `;if(this.selector.select.multiple){const t=this.value&&""!==this.value?this.value:[];return a`
  1418. <ha-chip-set>
  1419. ${null==t?void 0:t.map(((t,i)=>{var n;return a`
  1420. <ha-chip hasTrailingIcon>
  1421. ${(null===(n=e.find((e=>e.value===t)))||void 0===n?void 0:n.label)||t}
  1422. <ha-svg-icon
  1423. slot="trailing-icon"
  1424. .path=${r}
  1425. .idx=${i}
  1426. @click=${this._removeItem}
  1427. ></ha-svg-icon>
  1428. </ha-chip>
  1429. `}))}
  1430. </ha-chip-set>
  1431. <ha-combo-box
  1432. item-value-path="value"
  1433. item-label-path="label"
  1434. .hass=${this.hass}
  1435. .label=${this.label}
  1436. .helper=${this.helper}
  1437. .disabled=${this.disabled}
  1438. .required=${this.required&&!t.length}
  1439. .value=${this._filter}
  1440. .items=${e.filter((e=>!(e.disabled||null!=t&&t.includes(e.value))))}
  1441. @filter-changed=${this._filterChanged}
  1442. @value-changed=${this._comboBoxValueChanged}
  1443. ></ha-combo-box>
  1444. `}return this.selector.select.custom_value?(void 0===this.value||e.find((e=>e.value===this.value))||e.unshift({value:this.value,label:this.value}),a`
  1445. <ha-combo-box
  1446. item-value-path="value"
  1447. item-label-path="label"
  1448. .hass=${this.hass}
  1449. .label=${this.label}
  1450. .helper=${this.helper}
  1451. .disabled=${this.disabled}
  1452. .required=${this.required}
  1453. .items=${e.filter((e=>!e.disabled))}
  1454. .value=${this.value}
  1455. @filter-changed=${this._filterChanged}
  1456. @value-changed=${this._comboBoxValueChanged}
  1457. ></ha-combo-box>
  1458. `):a`
  1459. <ha-select
  1460. fixedMenuPosition
  1461. naturalMenuWidth
  1462. .label=${this.label}
  1463. .value=${this.value}
  1464. .helper=${this.helper}
  1465. .disabled=${this.disabled}
  1466. @closed=${U}
  1467. @selected=${this._valueChanged}
  1468. >
  1469. ${e.map((e=>a`
  1470. <mwc-list-item .value=${e.value} .disabled=${e.disabled}
  1471. >${e.label}</mwc-list-item
  1472. >
  1473. `))}
  1474. </ha-select>
  1475. `}},{kind:"method",key:"_renderHelper",value:function(){return this.helper?a`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`:""}},{kind:"get",key:"_mode",value:function(){return this.selector.select.mode||(this.selector.select.options.length<6?"list":"dropdown")}},{kind:"method",key:"_valueChanged",value:function(e){var t;e.stopPropagation();const i=(null===(t=e.detail)||void 0===t?void 0:t.value)||e.target.value;!this.disabled&&i&&o(this,"value-changed",{value:i})}},{kind:"method",key:"_checkboxChanged",value:function(e){if(e.stopPropagation(),this.disabled)return;let t;const i=e.target.value;if(e.target.checked)if(this.value){if(this.value.includes(i))return;t=[...this.value,i]}else t=[i];else{var a;if(null===(a=this.value)||void 0===a||!a.includes(i))return;t=this.value.filter((e=>e!==i))}o(this,"value-changed",{value:t})}},{kind:"method",key:"_removeItem",value:async function(e){const t=[...this.value];t.splice(e.target.idx,1),o(this,"value-changed",{value:t}),await this.updateComplete,this._filterChanged()}},{kind:"method",key:"_comboBoxValueChanged",value:function(e){var t;e.stopPropagation();const i=e.detail.value;if(this.disabled||""===i)return;if(!this.selector.select.multiple)return void o(this,"value-changed",{value:i});if(void 0!==i&&null!==(t=this.value)&&void 0!==t&&t.includes(i))return;setTimeout((()=>{this._filterChanged(),this.comboBox.setInputValue("")}),0);const a=this.value&&""!==this.value?this.value:[];o(this,"value-changed",{value:[...a,i]})}},{kind:"method",key:"_filterChanged",value:function(e){var t;this._filter=(null==e?void 0:e.detail.value)||"";const i=null===(t=this.comboBox.items)||void 0===t?void 0:t.filter((e=>{var t,i;if(this.selector.select.multiple&&null!==(t=this.value)&&void 0!==t&&t.includes(e.value))return!1;return(e.label||e.value).toLowerCase().includes(null===(i=this._filter)||void 0===i?void 0:i.toLowerCase())}));this._filter&&this.selector.select.custom_value&&(null==i||i.unshift({label:this._filter,value:this._filter})),this.comboBox.filteredItems=i}},{kind:"field",static:!0,key:"styles",value:()=>s`
  1476. ha-select,
  1477. mwc-formfield,
  1478. ha-formfield {
  1479. display: block;
  1480. }
  1481. mwc-list-item[disabled] {
  1482. --mdc-theme-text-primary-on-background: var(--disabled-text-color);
  1483. }
  1484. `}]}}),t);var Qe=Object.freeze({__proto__:null,HaSelectSelector:Je});e([l("ha-form-select")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i()],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",key:"_selectSchema",value:()=>q((e=>({select:{options:e.map((e=>({value:e[0],label:e[1]})))}})))},{kind:"method",key:"render",value:function(){return a`
  1485. <ha-selector-select
  1486. .hass=${this.hass}
  1487. .schema=${this.schema}
  1488. .value=${this.data}
  1489. .label=${this.label}
  1490. .disabled=${this.disabled}
  1491. .required=${this.schema.required}
  1492. .selector=${this._selectSchema(this.schema.options)}
  1493. @value-changed=${this._valueChanged}
  1494. ></ha-selector-select>
  1495. `}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();let t=e.detail.value;t!==this.data&&(""===t&&(t=void 0),o(this,"value-changed",{value:t}))}}]}}),t);const Ze=["password","secret","token"];e([l("ha-form-string")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[i()],key:"schema",value:void 0},{kind:"field",decorators:[i()],key:"data",value:void 0},{kind:"field",decorators:[i()],key:"label",value:void 0},{kind:"field",decorators:[i()],key:"helper",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[M()],key:"_unmaskedPassword",value:()=>!1},{kind:"field",decorators:[x("ha-textfield")],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){var e;const t=Ze.some((e=>this.schema.name.includes(e)));return a`
  1496. <ha-textfield
  1497. .type=${t?this._unmaskedPassword?"text":"password":this._stringType}
  1498. .label=${this.label}
  1499. .value=${this.data||""}
  1500. .helper=${this.helper}
  1501. helperPersistent
  1502. .disabled=${this.disabled}
  1503. .required=${this.schema.required}
  1504. .autoValidate=${this.schema.required}
  1505. .suffix=${t?a`<div style="width: 24px"></div>`:null===(e=this.schema.description)||void 0===e?void 0:e.suffix}
  1506. .validationMessage=${this.schema.required?"Required":void 0}
  1507. @input=${this._valueChanged}
  1508. ></ha-textfield>
  1509. ${t?a`<ha-icon-button
  1510. toggles
  1511. .label=${(this._unmaskedPassword?"Hide":"Show")+" password"}
  1512. @click=${this._toggleUnmaskedPassword}
  1513. .path=${this._unmaskedPassword?N:z}
  1514. ></ha-icon-button>`:""}
  1515. `}},{kind:"method",key:"updated",value:function(e){e.has("schema")&&this.toggleAttribute("own-margin",!!this.schema.required)}},{kind:"method",key:"_toggleUnmaskedPassword",value:function(){this._unmaskedPassword=!this._unmaskedPassword}},{kind:"method",key:"_valueChanged",value:function(e){let t=e.target.value;this.data!==t&&(""!==t||this.schema.required||(t=void 0),o(this,"value-changed",{value:t}))}},{kind:"get",key:"_stringType",value:function(){if(this.schema.format){if(["email","url"].includes(this.schema.format))return this.schema.format;if("fqdnurl"===this.schema.format)return"url"}return"text"}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  1516. :host {
  1517. display: block;
  1518. position: relative;
  1519. }
  1520. :host([own-margin]) {
  1521. margin-bottom: 5px;
  1522. }
  1523. ha-textfield {
  1524. display: block;
  1525. }
  1526. ha-icon-button {
  1527. position: absolute;
  1528. top: 1em;
  1529. right: 12px;
  1530. --mdc-icon-button-size: 24px;
  1531. color: var(--secondary-text-color);
  1532. }
  1533. ha-icon-button {
  1534. inset-inline-start: initial;
  1535. inset-inline-end: 12px;
  1536. direction: var(--direction);
  1537. }
  1538. `}}]}}),t);const et=(e,t)=>e?t.name?e[t.name]:e:null;e([l("ha-form")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[i({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[i({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[i()],key:"error",value:void 0},{kind:"field",decorators:[i({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[i()],key:"computeError",value:void 0},{kind:"field",decorators:[i()],key:"computeLabel",value:void 0},{kind:"field",decorators:[i()],key:"computeHelper",value:void 0},{kind:"method",key:"focus",value:function(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".root");if(t)for(const e of t.children)if("HA-ALERT"!==e.tagName){e.focus();break}}},{kind:"method",key:"render",value:function(){return a`
  1539. <div class="root" part="root">
  1540. ${this.error&&this.error.base?a`
  1541. <ha-alert alert-type="error">
  1542. ${this._computeError(this.error.base,this.schema)}
  1543. </ha-alert>
  1544. `:""}
  1545. ${this.schema.map((e=>{const t=((e,t)=>e&&t.name?e[t.name]:null)(this.error,e);return a`
  1546. ${t?a`
  1547. <ha-alert own-margin alert-type="error">
  1548. ${this._computeError(t,e)}
  1549. </ha-alert>
  1550. `:""}
  1551. ${"selector"in e?a`<ha-selector
  1552. .schema=${e}
  1553. .hass=${this.hass}
  1554. .selector=${e.selector}
  1555. .value=${et(this.data,e)}
  1556. .label=${this._computeLabel(e,this.data)}
  1557. .disabled=${this.disabled}
  1558. .helper=${this._computeHelper(e)}
  1559. .required=${e.required||!1}
  1560. .context=${this._generateContext(e)}
  1561. ></ha-selector>`:J(`ha-form-${e.type}`,{schema:e,data:et(this.data,e),label:this._computeLabel(e,this.data),disabled:this.disabled,hass:this.hass,computeLabel:this.computeLabel,computeHelper:this.computeHelper,context:this._generateContext(e)})}
  1562. `}))}
  1563. </div>
  1564. `}},{kind:"method",key:"_generateContext",value:function(e){if(!e.context)return;const t={};for(const[i,a]of Object.entries(e.context))t[i]=this.data[a];return t}},{kind:"method",key:"createRenderRoot",value:function(){const e=$(C(n.prototype),"createRenderRoot",this).call(this);return e.addEventListener("value-changed",(e=>{e.stopPropagation();const t=e.target.schema,i=t.name?{[t.name]:e.detail.value}:e.detail.value;o(this,"value-changed",{value:{...this.data,...i}})})),e}},{kind:"method",key:"_computeLabel",value:function(e,t){return this.computeLabel?this.computeLabel(e,t):e?e.name:""}},{kind:"method",key:"_computeHelper",value:function(e){return this.computeHelper?this.computeHelper(e):""}},{kind:"method",key:"_computeError",value:function(e,t){return this.computeError?this.computeError(e,t):e}},{kind:"get",static:!0,key:"styles",value:function(){return s`
  1565. .root {
  1566. margin-bottom: -24px;
  1567. overflow: clip visible;
  1568. }
  1569. .root > * {
  1570. display: block;
  1571. }
  1572. .root > *:not([own-margin]) {
  1573. margin-bottom: 24px;
  1574. }
  1575. ha-alert[own-margin] {
  1576. margin-bottom: 4px;
  1577. }
  1578. `}}]}}),t);export{J as d};