import*as t from"lit";var e,o,r={9147(t,e,o){o.d(e,{l:()=>r});var r,i=o(7704),s=o(2927),n=o(8899),a=o(3517),p=function(t,e,o,r){var i,s=arguments.length,n=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(n=(s<3?i(n):s>3?i(e,o,n):i(e,o))||n);return s>3&&n&&Object.defineProperty(e,o,n),n};!function(t){let e=class extends((0,i.TS)(s.LitElement)){constructor(){super(...arguments),this.rel="",this.name="",this.action="",this.label="",this.method="get",this.target="_self",this.enctype="application/x-www-form-urlencoded",this.novalidate=!1,this.charset="UTF-8",this.isvalid=!1,this.token="on",this.allowRedirect=!1,this.autofillname="input-name",this.formElement=[],this.handleSubmit=t=>{t.preventDefault(),this.validated()&&this.submitForm()},this.handleFormSubmit=t=>{this.allowRedirect||t.preventDefault(),this.dispatchEvent(new CustomEvent("form-submitted",{composed:!0,bubbles:!0}))}}get formMethod(){return"GET"===this.method?"get":"POST"===this.method?"post":this.method}isSubmittable(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement}isDisabled(t){return t.hasAttribute("disabled")||"true"===t.getAttribute("aria-disabled")}findSubmittable(t,e){const o=Array.from(t.children);for(const t of o)if(!this.isDisabled(t))if(this.isSubmittable(t)&&e.add(t),t.shadowRoot)this.findSubmittable(t.shadowRoot,e);else if("SLOT"===t.tagName){const o=t.assignedElements();if(o.length){const{parentElement:t}=o[0];t&&this.findSubmittable(t,e)}}else this.findSubmittable(t,e);return[...e]}validated(){return!!this.novalidate||this.isvalid}submitForm(){const{form:t}=this;t.requestSubmit?t.requestSubmit():t.submit()}get submitButton(){return this.querySelector("button[type='submit']")||this.querySelector("input[type='submit']")||this.querySelector("md-button[type='submit']")}disconnectedCallback(){super.disconnectedCallback(),this.cleanupWrappedForms(),this.teardownEvents()}deleteWrappedForm(t){t.removeEventListener("submit",this.handleFormSubmit)}cleanupWrappedForms(){const{formElement:t}=this;if(t.length)for(const e of t)this.deleteWrappedForm(e);this.formElement=[]}createWrappedForm(t){const e=document.createElement("form");e.addEventListener("submit",this.handleFormSubmit);const{parentNode:o}=t;t.autocomplete=this.token,t.id||(t.id=this.autofillname),t.name||(t.name=this.autofillname),o&&(this.formElement.push(e),o.insertBefore(e,t),e.append(t))}teardownEvents(){this.submitButton&&this.submitButton.removeEventListener("click",this.handleSubmit)}setupEvents(){this.submitButton&&this.submitButton.addEventListener("click",this.handleSubmit)}setupSubmittable(){const t=this.findSubmittable(this.form,new Set);if(t.length)for(const e of t)this.createWrappedForm(e)}slottedChanged(){this.setupSubmittable(),this.setupEvents()}render(){return s.html`
        <form
          class="md-form"
          role="form"
          name=${(0,a.ifDefined)(this.name||void 0)}
          rel=${(0,a.ifDefined)(this.rel||void 0)}
          action=${(0,a.ifDefined)(this.action||void 0)}
          accept-charset=${this.charset}
          enctype=${this.enctype}
          aria-label=${(0,a.ifDefined)(this.label||void 0)}
          ?novalidate=${this.novalidate}
          method=${this.formMethod}
          target=${this.target}
          part="form"
          @submit=${this.handleFormSubmit}
        >
          <slot></slot>
        </form>
      `}};p([(0,n.property)({type:String})],e.prototype,"rel",void 0),p([(0,n.property)({type:String})],e.prototype,"name",void 0),p([(0,n.property)({type:String})],e.prototype,"action",void 0),p([(0,n.property)({type:String})],e.prototype,"label",void 0),p([(0,n.property)({type:String})],e.prototype,"method",void 0),p([(0,n.property)({type:String})],e.prototype,"target",void 0),p([(0,n.property)({type:String})],e.prototype,"enctype",void 0),p([(0,n.property)({type:Boolean,reflect:!0,attribute:"no-validate"})],e.prototype,"novalidate",void 0),p([(0,n.property)({type:String,reflect:!0,attribute:"accept-charset"})],e.prototype,"charset",void 0),p([(0,n.property)({type:Boolean,reflect:!0,attribute:"is-valid"})],e.prototype,"isvalid",void 0),p([(0,n.property)({type:String,attribute:"autofill-token"})],e.prototype,"token",void 0),p([(0,n.property)({type:Boolean,attribute:"allow-redirect"})],e.prototype,"allowRedirect",void 0),p([(0,n.property)({type:String,attribute:"autofill-name"})],e.prototype,"autofillname",void 0),p([(0,n.query)(".md-form")],e.prototype,"form",void 0),e=p([(0,i.wW)("md-form")],e),t.ELEMENT=e}(r||(r={}))},2927(e,o,r){var i,s;e.exports=(i={LitElement:()=>t.LitElement,html:()=>t.html},s={},r.d(s,i),s)}},i={};function s(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return r[t](o,o.exports,s),o.exports}s.m=r,e=[],s.O=(t,o,r,i)=>{if(!o){var n=1/0;for(l=0;l<e.length;l++){for(var[o,r,i]=e[l],a=!0,p=0;p<o.length;p++)(!1&i||n>=i)&&Object.keys(s.O).every(t=>s.O[t](o[p]))?o.splice(p--,1):(a=!1,i<n&&(n=i));if(a){e.splice(l--,1);var m=r();void 0!==m&&(t=m)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[o,r,i]},s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{s as __webpack_require__};o={546:0,2927:0,5308:0,6494:0,8165:0},s.C=t=>{var e,r,{__webpack_esm_ids__:i,__webpack_esm_modules__:n,__webpack_esm_runtime__:a}=t,p=0;for(e in n)s.o(n,e)&&(s.m[e]=n[e]);for(a&&a(s);p<i.length;p++)r=i[p],s.o(o,r)&&o[r]&&o[r][0](),o[i[p]]=0;s.O()},s.O.j=t=>0===o[t];import*as n from"../9609.js";s.C(n);import*as a from"../3517.js";s.C(a);import*as p from"../2364.js";s.C(p);import*as m from"../9938.js";s.C(m);import*as l from"../4781.js";s.C(l);import*as d from"../5201.js";s.C(d);import*as h from"../608.js";s.C(h);import*as u from"../8899.js";s.C(u);import*as f from"../3203.js";s.C(f);import*as c from"../5757.js";s.C(c);import*as b from"../8180.js";s.C(b);var v=s.O(void 0,[9609,3517,2364,9938,4781,5201,608,8899,3203,5757,8180],()=>s(9147));const y=(v=s.O(v)).l;export{y as Form};