Free javascript Hosting


amp-form-latest.js

Uploaded on Oct 20 2021 02:28 by jusjeruk8888

(self.AMP=self.AMP||[]).push({m:0,v:"2110082201001",n:"amp-form",ev:"0.1",l:true,f:function(AMP,_){"use strict";var m;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}var ca="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b};function da(a){for(var b=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global],c=0;c<b.length;++c){var d=b[c];if(d&&d.Math==Math)return}(function(){throw Error("Cannot find global object")})()}da(this);"function"===typeof Symbol&&Symbol("x");var fa;if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa;function p(a,b){a.prototype=ca(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.Ua=b.prototype}var la;function ma(){return la?la:la=Promise.resolve(void 0)}function na(){var a=this;this.promise=new Promise((function(b,c){a.resolve=b;a.reject=c}))}function oa(a){return new Promise((function(b){b(a())}))}function pa(){this.ba=new na;this.ja=0}pa.prototype.add=function(a){var b=this,c=++this.ja;a.then((function(d){b.ja===c&&b.ba.resolve(d)}),(function(d){b.ja===c&&b.ba.reject(d)}));return this.ba.promise};pa.prototype.then=function(a,b){return this.ba.promise.then(a,b)};function q(a){return a?Array.prototype.slice.call(a):[]}var qa=Array.isArray;var ra=Object.prototype,sa=ra.hasOwnProperty,ta=ra.toString;function r(){return Object.create(null)}function t(a){return a||{}}function ua(a,b){var c=[],d=[];for(d.push({t:a,s:b,d:0});0<d.length;){b=d.shift();var e=b.d;a=b.s;var f=b.t;if(c.includes(a))throw Error("Source object has a circular reference.");c.push(a);if(f!==a)if(10<e)Object.assign(f,a);else{b=ba(Object.keys(a));for(var g=b.next();!g.done;g=b.next()){g=g.value;var h=a[g];if(sa.call(f,g)){var k=f[g];if("[object Object]"===ta.call(h)&&"[object Object]"===ta.call(k)){d.push({t:k,s:h,d:e+1});continue}}f[g]=h}}}}function va(a){var b=a.documentElement;return["⚡4email","amp4email"].some((function(c){return b.hasAttribute(c)}))}function wa(a,b){try{return JSON.parse(a)}catch(c){return null==b||b(c),null}}
/* https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
var xa=/(\0)|^(-)$|([\x01-\x1f\x7f]|^-?[0-9])|([\x80-\uffff0-9a-zA-Z_-]+)|[^]/g;function ya(a,b,c,d,e){return e?e:b?"�":d?a.slice(0,-1)+"\\"+a.slice(-1).charCodeAt(0).toString(16)+" ":"\\"+a}var za;function Aa(a){return"> [i-amphtml-rendered]".replace(/^|,/g,"$&"+a+" ")}function Ba(a,b){for(var c=[],d=a.parentElement;d;d=d.parentElement)b(d)&&c.push(d);return c}function Ca(a){var b="fieldset";/^[\w-]+$/.test(b);b=b.toUpperCase();return Ba(a,(function(c){return c.tagName==b}))}function Da(a){var b;null==(b=a.parentElement)||b.removeChild(a)}function v(a,b){for(var c=a.length,d=0;d<c;d++)b(a[d],d)}function w(a){for(var b=a.elements,c={},d=/^(?:input|select|textarea)$/i,e=/^(?:submit|button|image|file|reset)$/i,f=/^(?:checkbox|radio)$/i,g={},h=0;h<b.length;g={I:g.I},h++){var k=b[h],l=k,n=l.checked,u=l.multiple;g.I=l.name;var J=l.options,x=l.tagName,C=l.type;l=l.value;!g.I||Ea(k)||!d.test(x)||e.test(C)||f.test(C)&&!n||(void 0===c[g.I]&&(c[g.I]=[]),u?v(J,function(ea){return function($a){$a.selected&&c[ea.I].push($a.value)}}(g)):c[g.I].push(l))}var D=Fa(a);if(null==D?0:D.name)a=D.name,b=D.value,void 0===c[a]&&(c[a]=[]),c[a].push(b);Object.keys(c).forEach((function(ea){0==c[ea].length&&delete c[ea]}));return c}function Fa(a){var b=a.ownerDocument.activeElement,c=q(a.elements).filter(Ga);return c.includes(b)?b:c[0]||null}function Ga(a){var b=a.type;return"BUTTON"==a.tagName||"submit"==b}function Ea(a){return a.disabled||Ca(a).some((function(b){return b.disabled}))}function Ha(a){switch(a.type){case"select-multiple":case"select-one":return q(a.options).every((function(b){return b.selected===b.defaultSelected}));case"checkbox":case"radio":return a.checked===a.defaultChecked;default:return a.value===a.defaultValue}}var Ia=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;function Ja(a,b){var c=b=void 0===b?"":b;try{return decodeURIComponent(a)}catch(d){return c}}function Ka(a){var b=r();if(!a)return b;for(var c;c=Ia.exec(a);){var d=Ja(c[1],c[1]);c=c[2]?Ja(c[2].replace(/\+/g," "),c[2]):"";b[d]=c}return b}var y=self.AMP_CONFIG||{},La=("string"==typeof y.cdnProxyRegex?new RegExp(y.cdnProxyRegex):y.cdnProxyRegex)||/^https:\/\/([a-zA-Z0-9_-]+\.)?cdn\.ampproject\.org$/;function Ma(a){if(!self.document||!self.document.head||self.location&&La.test(self.location.origin))return null;var b=self.document.head.querySelector('meta[name="'+a+'"]');return b&&b.getAttribute("content")||null}var Na={thirdParty:y.thirdPartyUrl||"https://3p.ampproject.net",thirdPartyFrameHost:y.thirdPartyFrameHost||"ampproject.net",thirdPartyFrameRegex:("string"==typeof y.thirdPartyFrameRegex?new RegExp(y.thirdPartyFrameRegex):y.thirdPartyFrameRegex)||/^d-\d+\.ampproject\.net$/,cdn:y.cdnUrl||Ma("runtime-host")||"https://cdn.ampproject.org",cdnProxyRegex:La,localhostRegex:/^https?:\/\/localhost(:\d+)?$/,errorReporting:y.errorReportingUrl||"https://us-central1-amp-error-reporting.cloudfunctions.net/r",betaErrorReporting:y.betaErrorReportingUrl||"https://us-central1-amp-error-reporting.cloudfunctions.net/r-beta",localDev:y.localDev||!1,trustedViewerHosts:[/(^|\.)google\.(com?|[a-z]{2}|com?\.[a-z]{2}|cat)$/,/(^|\.)gmail\.(com|dev)$/],geoApi:y.geoApiUrl||Ma("amp-geo-api")};function Oa(a,b){function c(g){f=null;e=a.setTimeout(d,100);b.apply(null,g)}function d(){e=0;f&&c(f)}var e=0,f=null;return function(g){for(var h=[],k=0;k<arguments.length;++k)h[k-0]=arguments[k];e?f=h:c(h)}}self.__AMP_LOG=self.__AMP_LOG||{user:null,dev:null,userForEmbed:null};var z=self.__AMP_LOG;function Pa(){throw Error("failed to call initLogConstructor")}function A(){z.user||(z.user=Pa());return z.user}function Qa(){return z.dev||(z.dev=Pa())}function B(a,b,c,d){A().assert(a,b,c,d,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}function E(a,b){a=a.__AMP_TOP||(a.__AMP_TOP=a);return F(a,b)}function G(a,b){var c=H(a);c=I(c);return F(c,b)}function K(a,b){a=H(a);a=I(a);return Ra(a,b)?F(a,b):null}function Sa(a,b){return Ta(I(a),b)}function H(a){return a.nodeType?E((a.ownerDocument||a).defaultView,"ampdoc").getAmpDoc(a):a}function I(a){a=H(a);return a.isSingleDoc()?a.win:a}function F(a,b){Ra(a,b);a=Ua(a)[b];a.obj||(a.obj=new a.ctor(a.context),a.context=null,a.resolve&&a.resolve(a.obj));return a.obj}function Va(a,b){var c=Ta(a,b);if(c)return c;a=Ua(a);a[b]=Wa();return a[b].promise}function Ta(a,b){var c=Ua(a)[b];if(c){if(c.promise)return c.promise;F(a,b);return c.promise=Promise.resolve(c.obj)}return null}function Ua(a){var b=a.__AMP_SERVICES;b||(b=a.__AMP_SERVICES={});return b}function Ra(a,b){a=a.__AMP_SERVICES&&a.__AMP_SERVICES[b];return!(!a||!a.ctor)}function Wa(){var a=new na,b=a.promise,c=a.reject;a=a.resolve;b.catch((function(){}));return{obj:null,promise:b,resolve:a,reject:c,context:null,ctor:null}}function Xa(a,b,c){var d=Sa(a,b);if(d)return d;var e=H(a);return e.whenExtensionsKnown().then((function(){var f=e.getExtensionVersion(c);return f?E(e.win,"extensions").waitForExtension(c,f):null})).then((function(f){return f?Va(I(a),b):null}))}function L(a){return G(a,"mutator")}function Ya(a,b,c){c=void 0===c?{}:c;var d=void 0===d?!0:d;var e=c;Xa(a,"amp-analytics-instrumentation","amp-analytics").then((function(f){f&&f.triggerEventForTarget(a,b,e,d)}))}var M;function Za(a,b,c){function d(h){try{return f(h)}catch(n){var k,l;null==(l=(k=self).__AMP_REPORT_ERROR)||l.call(k,n);throw n}}var e=a,f=c,g=ab();e.addEventListener(b,d,g?void 0:!1);return function(){var h;null==(h=e)||h.removeEventListener(b,d,g?void 0:!1);d=e=f=null}}function ab(){if(void 0!==M)return M;M=!1;try{var a={get capture(){M=!0}};self.addEventListener("test-options",null,a);self.removeEventListener("test-options",null,a)}catch(b){}return M}function bb(a,b,c,d){var e={detail:c};Object.assign(e,d);if("function"==typeof a.CustomEvent)return new a.CustomEvent(b,e);a=a.document.createEvent("CustomEvent");a.initCustomEvent(b,!!e.bubbles,!!e.cancelable,c);return a}function cb(a,b,c){return Za(a,b,c)}function db(a,b){var c=b,d=Za(a,"mouseup",(function(e){try{c(e)}finally{c=null,d()}}));return d}function eb(a){var b,c=new Promise((function(d){b=db(a,d)}));c.then(b,b);return c}function fb(a,b){var c=E(a,"platform");return c.isIos()&&11==c.getMajorVersion()?new gb(b):FormData.prototype.entries&&FormData.prototype.delete?new N(b):new O(b)}function O(a){this.G=a?w(a):r()}O.prototype.append=function(a,b){var c=String(a);this.G[c]=this.G[c]||[];this.G[c].push(String(b))};O.prototype.delete=function(a){delete this.G[a]};O.prototype.entries=function(){var a=this,b=[];Object.keys(this.G).forEach((function(d){a.G[d].forEach((function(e){return b.push([d,e])}))}));var c=0;return{next:function(){return c<b.length?{value:b[c++],done:!1}:{value:void 0,done:!0}}}};O.prototype.getFormData=function(){var a=this,b=new FormData;Object.keys(this.G).forEach((function(c){a.G[c].forEach((function(d){return b.append(c,d)}))}));return b};function N(a){this.H=new FormData(a);a&&(a=Fa(a))&&a.name&&this.append(a.name,a.value)}N.prototype.append=function(a,b){this.H.append(a,b)};N.prototype.delete=function(a){this.H.delete(a)};N.prototype.entries=function(){return this.H.entries()};N.prototype.getFormData=function(){return this.H};function gb(a){N.call(this,a);var b=this;a&&v(a.elements,(function(c){"file"==c.type&&0==c.files.length&&(b.H.delete(c.name),b.H.append(c.name,new Blob([]),""))}))}p(gb,N);gb.prototype.append=function(a,b,c){b&&"object"==typeof b&&""==b.name&&0==b.size?this.H.append(a,new Blob([]),c||""):this.H.append(a,b)};function hb(){this.Ga=100;this.ia=this.pa=0;this.aa=r()}hb.prototype.has=function(a){return!!this.aa[a]};hb.prototype.get=function(a){var b=this.aa[a];if(b)return b.access=++this.ia,b.payload};hb.prototype.put=function(a,b){this.has(a)||this.pa++;this.aa[a]={payload:b,access:this.ia};if(!(this.pa<=this.Ga)){a=this.aa;var d,c=this.ia+1;for(d in a){var e=a[d].access;if(e<c){c=e;var f=d}}void 0!==f&&(delete a[f],this.pa--)}};var jb,kb,ib=new Set(["c","v","a","ad"]);function lb(a){return"string"==typeof a?P(a):a}function P(a){jb||(jb=self.document.createElement("a"),kb=self.__AMP_URL_CACHE||(self.__AMP_URL_CACHE=new hb));var b=jb,c=kb;if(c&&c.has(a))a=c.get(a);else{b.href=a;b.protocol||(b.href=b.href);var d={href:b.href,protocol:b.protocol,host:b.host,hostname:b.hostname,port:"0"==b.port?"":b.port,pathname:b.pathname,search:b.search,hash:b.hash,origin:null};"/"!==d.pathname[0]&&(d.pathname="/"+d.pathname);if("http:"==d.protocol&&80==d.port||"https:"==d.protocol&&443==d.port)d.port="",d.host=d.hostname;d.origin=b.origin&&"null"!=b.origin?b.origin:"data:"!=d.protocol&&d.host?d.protocol+"//"+d.host:d.href;c&&c.put(a,d);a=d}return a}function mb(a,b,c){if(!b)return a;var d=a.split("#",2),e=d[0].split("?",2),f=e[0]+(e[1]?c?"?"+b+"&"+e[1]:"?"+e[1]+"&"+b:"?"+b);return f+=d[1]?"#"+d[1]:""}function nb(a){var c,b=[];for(c in a){var d=a[c];if(null!=d){d=qa(d)?d:[d];for(var e=0;e<d.length;e++){var f=b,g=f.push;var h=d[e];h=encodeURIComponent(c)+"="+encodeURIComponent(h);g.call(f,h)}}}return b.join("&")}var ob=["GET","POST"];var pb,qb="Webkit webkit Moz moz ms O o".split(" "),rb={getPropertyPriority:function(){return""},getPropertyValue:function(){return""}};function sb(a,b,c){var d=a.style;if(!b.startsWith("--")){pb||(pb=r());var e=pb[b];if(!e){e=b;if(void 0===d[b]){var f=b.charAt(0).toUpperCase()+b.slice(1);b:{for(var g=0;g<qb.length;g++){var h=qb[g]+f;if(void 0!==d[h]){f=h;break b}}f=""}void 0!==d[f]&&(e=f)}pb[b]=e}b=e}b&&(b.startsWith("--")?a.style.setProperty(b,c):a.style[b]=c)}function tb(a,b){void 0===b&&(b=a.hasAttribute("hidden"));b?a.removeAttribute("hidden"):a.setAttribute("hidden","")}function ub(a){var b=a.getRootNode();this.U=b.ownerDocument||b;this.j=this.U.defaultView;this.ra=G(a,"viewport");this.W=[];this.W.push(cb(b,"input",(function(e){e=e.target;"TEXTAREA"==e.tagName&&e.hasAttribute("autoexpand")&&vb(e)})));this.W.push(cb(b,"mousedown",(function(e){1==e.which&&(e=e.target,"TEXTAREA"==e.tagName&&wb(e))})));var c=b.querySelectorAll("textarea");this.W.push(cb(b,"amp:dom-update",(function(){c=b.querySelectorAll("textarea")})));var d=Oa(this.j,(function(e){e.relayoutAll&&xb(c)}));this.W.push(this.ra.onResize(d));yb(c)}function zb(a){function b(){var e=c.querySelector("textarea[autoexpand]");e&&!d?d=new ub(a):!e&&d&&(d.dispose(),d=null)}var c=a.getRootNode(),d=null;Za(c,"amp:dom-update",b);b()}ub.prototype.dispose=function(){this.W.forEach((function(a){return a()}))};function yb(a){Promise.all(q(a).map((function(b){return Ab(b).then((function(c){c&&(A().warn("AMP-FORM",'"textarea[autoexpand]" with initially scrolling content will not autoexpand.\nSee https://github.com/ampproject/amphtml/issues/20839'),b.removeAttribute("autoexpand"))}))})))}function Ab(a){return L(a).measureElement((function(){return a.scrollHeight>a.clientHeight}))}function xb(a){v(a,(function(b){"TEXTAREA"==b.tagName&&b.hasAttribute("autoexpand")&&vb(b)}))}function wb(a){var b=L(a);Promise.all([b.measureElement((function(){return a.scrollHeight})),eb(a)]).then((function(c){var d=c[0],e=0;return b.measureMutateElement(a,(function(){e=a.scrollHeight}),(function(){d!=e&&a.removeAttribute("autoexpand")}))}))}function vb(a){var b=L(a),c=a.ownerDocument.defaultView,d=0,e=0,f=0,g=Bb(a);b.measureMutateElement(a,(function(){var h=c.getComputedStyle(a)||rb;e=a.scrollHeight;var k=parseInt(h.getPropertyValue("max-height"),10);f=isNaN(k)?1/0:k;d="content-box"==h.getPropertyValue("box-sizing")?-parseInt(h.getPropertyValue("padding-top"),10)+-parseInt(h.getPropertyValue("padding-bottom"),10):parseInt(h.getPropertyValue("border-top-width"),10)+parseInt(h.getPropertyValue("border-bottom-width"),10)}),(function(){return g.then((function(h){a.classList.toggle("i-amphtml-textarea-max",h+d>f);var k="iAmphtmlHasExpanded"in a.dataset,l=/google/i.test(c.navigator.vendor)?3:0;if(k||e<=h+l)a.dataset.iAmphtmlHasExpanded="",sb(a,"height",h+d+"px")}))}))}function Bb(a){var b=a.ownerDocument,c=b.defaultView,d=b.body,e=L(a),f=a.cloneNode(!1);f.classList.add("i-amphtml-textarea-clone");var g=0,h=0,k=!1;return e.measureMutateElement(d,(function(){var l=c.getComputedStyle(a)||rb,n=parseInt(l.getPropertyValue("max-height"),10);g=parseInt(l.getPropertyValue("width"),10);k=isNaN(n)||a.scrollHeight<n}),(function(){k&&(a.scrollTop=0);sb(f,"width",g+"px");b.body.appendChild(f)})).then((function(){return e.measureMutateElement(d,(function(){h=f.scrollHeight}),(function(){Da(f)}))})).then((function(){return h}))}var Cb={INPUT:!0,SELECT:!0,TEXTAREA:!0};function Db(a,b){this.h=a;this.j=b;this.T=0;this.M=r();this.qa=null;this.Da=this.fa=!1;this.oa();for(a=0;a<this.h.elements.length;++a)Eb(this,this.h.elements[a]);Q(this)}m=Db.prototype;m.onSubmitting=function(){this.fa=!0;Q(this)};m.onSubmitError=function(){this.fa=!1;Q(this)};m.onSubmitSuccess=function(){this.fa=!1;this.qa=fb(this.j,this.h).getFormData();this.M=r();this.T=0;Q(this)};function Q(a){var b=0<a.T&&!a.fa;if(b!==a.Da){a.h.classList.toggle("amp-form-dirty",b);var c=bb(a.j,"amp:form-dirtiness-change",t({isDirty:b}),{bubbles:!0});a.h.dispatchEvent(c)}a.Da=b}m.oa=function(){this.h.addEventListener("input",this.xa.bind(this));this.h.addEventListener("reset",this.Ja.bind(this));this.h.addEventListener("amp:form-value-change",this.xa.bind(this))};m.xa=function(a){Eb(this,a.target);Q(this)};m.Ja=function(){this.M=r();this.T=0;Q(this)};function Eb(a,b){var c=b.hidden;if(Cb[b.tagName]&&b.name&&!c&&!Ea(b)){a:switch(b.tagName){case"INPUT":c="checkbox"==b.type||"radio"==b.type?!b.checked:!b.value;break a;case"TEXTAREA":c=!b.value;break a;case"SELECT":c=!1;break a;default:throw Error("isFieldEmpty: "+b.tagName+" is not a supported field element.")}(c=c||Ha(b))||(a.qa?(c=b.value,c=a.qa.get(b.name)===c):c=!1);c?(b=b.name,a.M[b]&&(a.M[b]=!1,--a.T)):(b=b.name,a.M[b]||(a.M[b]=!0,++a.T))}}function Fb(a){var b=a.ownerDocument.defaultView;b.FormProxy||(b.FormProxy=Gb(b));var c=new b.FormProxy(a);"action"in c||Hb(a,c);a.$p=c}function Gb(a){function b(f){this.h=f}var c=b.prototype,d=a.Object,e=d.prototype;[a.HTMLFormElement,a.EventTarget].reduce((function(f,g){for(g=g&&g.prototype;g&&g!==e&&!(0<=f.indexOf(g));)f.push(g),g=d.getPrototypeOf(g);return f}),[]).forEach((function(f){var h,g={};for(h in f){g.D=a.Object.getOwnPropertyDescriptor(f,h);if(g.D&&h.toUpperCase()!=h&&!h.startsWith("on")&&!e.hasOwnProperty.call(c,h))if("function"==typeof g.D.value)g.ha=g.D.value,c[h]=function(l){return function(){return l.ha.apply(this.h,arguments)}}(g);else{var k={};g.D.get&&(k.get=function(l){return function(){return l.D.get.call(this.h)}}(g));g.D.set&&(k.set=function(l){return function(n){return l.D.set.call(this.h,n)}}(g));a.Object.defineProperty(c,h,k)}g={ha:g.ha,D:g.D}}}));return b}function Hb(a,b){var e,c=a.ownerDocument.defaultView.HTMLFormElement.prototype.cloneNode.call(a,!1),d={};for(e in c){d.o=e;if(!(d.o in b||d.o.toUpperCase()==d.o||d.o.startsWith("on"))){d.A=Ib[d.o];var f=a[d.o];if(d.A)if(d.A.access==R){d.P=void 0;if(f&&f.nodeType){var g=c=f,h=g.nextSibling;g=g.parentNode;g.removeChild(c);try{d.P=a[d.o]}finally{g.insertBefore(c,h)}}else d.P=f;Object.defineProperty(b,d.o,{get:function(k){return function(){return k.P}}(d)})}else d.A.access==S&&(d.R=d.A.attr||d.o,Object.defineProperty(b,d.o,{get:function(k){return function(){var l=b.getAttribute(k.R);return null==l&&void 0!==k.A.def?k.A.def:k.A.type==Jb?"true"===l:k.A.type==Kb?null!=l:k.A.type==Lb?(l=l||"",K(a,"url").parse(l).href):l}}(d),set:function(k){return function(l){k.A.type==Kb&&(l=l?"":null);null!=l?b.setAttribute(k.R,l):b.removeAttribute(k.R)}}(d)}));else Object.defineProperty(b,d.o,{get:function(k){return function(){return a[k.o]}}(d),set:function(k){return function(l){a[k.o]=l}}(d)})}d={P:d.P,R:d.R,A:d.A,o:d.o}}}var S=1,R=2,Lb=1,Jb=2,Kb=3,Ib={acceptCharset:{access:S,attr:"accept-charset"},accessKey:{access:S,attr:"accesskey"},action:{access:S,type:Lb},attributes:{access:R},autocomplete:{access:S,def:"on"},children:{access:R},dataset:{access:R},dir:{access:S},draggable:{access:S,type:Jb,def:!1},elements:{access:R},encoding:{access:R},enctype:{access:S},hidden:{access:S,type:Kb,def:!1},id:{access:S,def:""},lang:{access:S},localName:{access:R},method:{access:S,def:"get"},name:{access:S},noValidate:{access:S,attr:"novalidate",type:Kb,def:!1},prefix:{access:R},spellcheck:{access:S},style:{access:R},target:{access:S,def:""},title:{access:S},translate:{access:S}};function Mb(){this.C=null}m=Mb.prototype;m.add=function(a){var b=this;this.C||(this.C=[]);this.C.push(a);return function(){b.remove(a)}};m.remove=function(a){if(this.C){var b=this.C;a=b.indexOf(a);-1!=a&&b.splice(a,1)}};m.removeAll=function(){this.C&&(this.C.length=0)};m.fire=function(a){if(this.C)for(var b=ba(this.C),c=b.next();!c.done;c=b.next())c=c.value,c(a)};m.getHandlerCount=function(){var a,b;return null!=(b=null==(a=this.C)?void 0:a.length)?b:0};function Nb(){this.wa=new Mb}Nb.prototype.beforeSubmit=function(a){return this.wa.add(a)};Nb.prototype.fire=function(a){this.wa.fire(a)};function Ob(a,b){this.na=b;this.ra=G(a,"viewport");this.Ca=E(a.win,"vsync");this.la=null;this.ka="";this.ga=!1;this.L=a.win.document.createElement("div");tb(this.L,!1);this.L.classList.add("i-amphtml-validation-bubble");this.L.__BUBBLE_OBJ=this;a.getBody().appendChild(this.L)}Ob.prototype.isActiveOn=function(a){return this.ga&&a==this.la};Ob.prototype.hide=function(){this.ga&&(this.ga=!1,this.la=null,this.ka="",this.Ca.run({measure:void 0,mutate:Pb},{bubbleElement:this.L}))};Ob.prototype.show=function(a,b){this.isActiveOn(a)&&b==this.ka||(this.ga=!0,this.la=a,this.ka=b,this.Ca.run({measure:Qb,mutate:Rb},{message:b,targetElement:a,bubbleElement:this.L,viewport:this.ra,id:this.na}))};function Pb(a){a.bubbleElement.removeAttribute("aria-alert");a.bubbleElement.removeAttribute("role");for(var b=a.bubbleElement;b.firstChild;)b.removeChild(b.firstChild);tb(a.bubbleElement,!1)}function Qb(a){a.targetRect=a.viewport.getLayoutRect(a.targetElement)}function Rb(a){for(var b=a.bubbleElement;b.firstChild;)b.removeChild(b.firstChild);var c=a.bubbleElement.ownerDocument.createElement("div");c.id="bubble-message-"+a.id;c.textContent=a.message;a.bubbleElement.setAttribute("aria-labeledby",c.id);a.bubbleElement.setAttribute("role","alert");a.bubbleElement.setAttribute("aria-live","assertive");a.bubbleElement.appendChild(c);tb(a.bubbleElement,!0);b=a.bubbleElement;a={top:a.targetRect.top-10+"px",left:a.targetRect.left+a.targetRect.width/2+"px"};for(var d in a)sb(b,d,a[d])}var Sb,Tb,Ub=0;function T(a){this.form=a;this.ampdoc=H(a);this.mutator=L(a);this.root=this.ampdoc.getRootNode();this.ea=null}m=T.prototype;m.report=function(){};m.onBlur=function(){};m.onInput=function(){};m.inputs=function(){return this.form.querySelectorAll("input,select,textarea")};m.checkInputValidity=function(a){if("TEXTAREA"===a.tagName&&a.hasAttribute("pattern")&&(a.checkValidity()||"Please match the requested format."===a.validationMessage)){var b=a.getAttribute("pattern"),c=new RegExp("^"+b+"$","m").test(a.value);a.setCustomValidity(c?"":"Please match the requested format.")}return a.checkValidity()};m.checkFormValidity=function(a){Vb(this,a);return a.checkValidity()};m.reportFormValidity=function(a){Vb(this,a);return a.reportValidity()};function Vb(a,b){v(b.elements,(function(c){"TEXTAREA"==c.tagName&&a.checkInputValidity(c)}))}m.fireValidityEventIfNecessary=function(){var a=this.ea;this.ea=this.checkFormValidity(this.form);if(a!==this.ea){var b=bb(this.form.ownerDocument.defaultView,this.ea?"valid":"invalid",null,{bubbles:!0});this.form.dispatchEvent(b)}};function Wb(){T.apply(this,arguments)}p(Wb,T);Wb.prototype.report=function(){this.reportFormValidity(this.form);this.fireValidityEventIfNecessary()};function U(a){T.call(this,a);var b="i-amphtml-validation-bubble-"+Ub++;this.X=new Ob(this.ampdoc,b)}p(U,T);U.prototype.report=function(){for(var a=this.inputs(),b=0;b<a.length;b++)if(!this.checkInputValidity(a[b])){a[b].focus();this.X.show(a[b],a[b].validationMessage);break}this.fireValidityEventIfNecessary()};U.prototype.onBlur=function(a){"submit"!=a.target.type&&this.X.hide()};U.prototype.onInput=function(a){a=a.target;this.X.isActiveOn(a)&&(this.checkInputValidity(a)?(a.removeAttribute("aria-invalid"),this.X.hide()):(a.setAttribute("aria-invalid","true"),this.X.show(a,a.validationMessage)))};function V(a){T.call(this,a);this.Oa=this.form.id?this.form.id:String(Date.now()+Math.floor(100*Math.random()));this.Fa=0}p(V,T);m=V.prototype;m.reportInput=function(a){var b=Xb(a);b&&this.showValidationFor(a,b)};m.hideAllValidations=function(){for(var a=this.inputs(),b=0;b<a.length;b++)this.hideValidationFor(a[b])};m.getValidationFor=function(a,b){if(!a.id)return null;var c=a.validationMessage;c="TEXTAREA"===a.tagName&&"customError"===b&&"Please match the requested format."===c?"patternMismatch":b;var d="__AMP_VALIDATION_"+c;d in a||(a[d]=this.root.querySelector("[visible-when-invalid="+c+"][validation-for="+a.id+"]"));return a[d]};m.showValidationFor=function(a,b){var c=this.getValidationFor(a,b);if(c){c.textContent.trim()||(c.textContent=a.validationMessage);a.__AMP_VISIBLE_VALIDATION=c;var d=c.getAttribute("id");d||(d="i-amphtml-aria-desc-"+this.Oa+"-"+this.Fa++,c.setAttribute("id",d));a.setAttribute("aria-invalid","true");a.setAttribute("aria-describedby",d);this.mutator.mutateElement(c,(function(){return c.classList.add("visible")}))}};m.hideValidationFor=function(a){var b=this.getVisibleValidationFor(a);b&&(delete a.__AMP_VISIBLE_VALIDATION,a.removeAttribute("aria-invalid"),a.removeAttribute("aria-describedby"),this.mutator.mutateElement(b,(function(){return b.classList.remove("visible")})))};m.getVisibleValidationFor=function(a){return a.__AMP_VISIBLE_VALIDATION};m.shouldValidateOnInteraction=function(){throw Error("Not Implemented")};m.onInteraction=function(a){a=a.target;var b=!!a.checkValidity&&this.shouldValidateOnInteraction(a);this.hideValidationFor(a);b&&!this.checkInputValidity(a)&&this.reportInput(a)};m.onBlur=function(a){this.onInteraction(a)};m.onInput=function(a){this.onInteraction(a)};function Yb(){V.apply(this,arguments)}p(Yb,V);Yb.prototype.report=function(){this.hideAllValidations();for(var a=this.inputs(),b=0;b<a.length;b++)if(!this.checkInputValidity(a[b])){this.reportInput(a[b]);a[b].focus();break}this.fireValidityEventIfNecessary()};Yb.prototype.shouldValidateOnInteraction=function(a){return!!this.getVisibleValidationFor(a)};function W(){V.apply(this,arguments)}p(W,V);W.prototype.report=function(){this.hideAllValidations();for(var a=null,b=this.inputs(),c=0;c<b.length;c++)this.checkInputValidity(b[c])||(a=a||b[c],this.reportInput(b[c]));a&&a.focus();this.fireValidityEventIfNecessary()};W.prototype.shouldValidateOnInteraction=function(a){return!!this.getVisibleValidationFor(a)};function Zb(){V.apply(this,arguments)}p(Zb,V);Zb.prototype.shouldValidateOnInteraction=function(){return!0};Zb.prototype.onInteraction=function(a){V.prototype.onInteraction.call(this,a);this.fireValidityEventIfNecessary()};function $b(){W.apply(this,arguments)}p($b,W);$b.prototype.shouldValidateOnInteraction=function(){return!0};$b.prototype.onInteraction=function(a){W.prototype.onInteraction.call(this,a);this.fireValidityEventIfNecessary()};function ac(a){switch(a.getAttribute("custom-validation-reporting")){case"as-you-go":return new Zb(a);case"show-all-on-submit":return new W(a);case"interact-and-submit":return new $b(a);case"show-first-on-submit":return new Yb(a)}a.ownerDocument&&void 0===Sb&&(Sb=!!document.createElement("form").reportValidity);return Sb?new Wb(a):new U(a)}function Xb(a){var b=["badInput"];for(c in a.validity)b.includes(c)||b.push(c);var c=b.filter((function(d){return!0===a.validity[d]}));return c.length?c[0]:null}function bc(a,b){return a.hasAttribute("verify-xhr")?new cc(a,b):new dc(a)}function X(a){this.h=a}X.prototype.onCommit=function(){ec(this);a:{var a=this.h.elements;for(var b=0;b<a.length;b++){var c=a[b];if(!c.disabled&&!Ha(c)){a=!0;break a}}a=!1}return a?this.Ba():Promise.resolve({updatedElements:[],errors:[]})};X.prototype.Ba=function(){return Promise.resolve({updatedElements:[],errors:[]})};function ec(a){(a=a.h.elements)&&v(a,(function(b){b.setCustomValidity("")}))}function dc(){X.apply(this,arguments)}p(dc,X);function cc(a,b){this.h=a;this.da=b;this.Z=null;this.ya=[]}p(cc,X);cc.prototype.Ba=function(){var a=this,b=this.da().then((function(){return[]}),(function(c){return fc(c)}));return gc(this,b).then((function(c){return hc(a,c)}))};function gc(a,b){if(!a.Z){a.Z=new pa;var c=function(){return a.Z=null};a.Z.then(c,c)}return a.Z.add(b)}function hc(a,b){var c=[],d=a.ya;a.ya=b;for(var e=0;e<b.length;e++){var f=b[e],g=A().assertString(f.name,"Verification errors must have a name property");f=A().assertString(f.message,"Verification errors must have a message property");g=A().assertElement(a.h.querySelector('[name="'+g+'"]'),"Verification error name property must match a field name");g.checkValidity()&&(g.setCustomValidity(f),c.push(g))}var h=d.filter((function(k){return b.every((function(l){return k.name!==l.name}))})).map((function(k){return a.h.querySelector('[name="'+k.name+'"]')}));return{updatedElements:c.concat(h),errors:b}}function fc(a){return(a=a.response)?a.json().then((function(b){return b.verifyErrors||[]}),(function(){return[]})):Promise.resolve([])}function Y(a,b){this.N=a;this.F=b;this.La="amp-form"}Y.prototype.isEnabled=function(){var a=this.N.getAmpDoc();return a.isSingleDoc()&&a.getRootNode().documentElement.hasAttribute("allow-viewer-render-template")?this.N.hasCapability("viewerRenderTemplate"):!1};Y.prototype.assertTrustedViewer=function(a){return this.N.isTrustedViewer().then((function(b){B(b,"Refused to attempt SSR in untrusted viewer: ",a)}))};Y.prototype.ssr=function(a,b,c,d){var e=this;c=void 0===c?null:c;d=void 0===d?{}:d;var h,f=c,g=d;f||(h=this.F.maybeFindTemplate(a));return this.assertTrustedViewer(a).then((function(){var k=e.N,l=k.sendMessageAwaitResponse,n=h;var u=g;var J=u=void 0===u?{}:u;u=t({type:e.La});(n=f&&f.successTemplate?f.successTemplate:n)&&(u.successTemplate={type:"amp-mustache",payload:n.innerHTML});(n=f&&f.errorTemplate?f.errorTemplate:null)&&(u.errorTemplate={type:"amp-mustache",payload:n.innerHTML});J&&Object.assign(u,J);J=b.xhrUrl;var x=b.fetchOpt;n=Object.assign({},x);var C=x.body;if(C&&"function"==typeof C.getFormData){x=x.body;n.headers["Content-Type"]="multipart/form-data;charset=utf-8";x=x.entries();C=[];for(var D=x.next();!D.done;D=x.next())C.push(D.value);n.body=C}u=t({originalRequest:{input:J,init:n},ampComponent:u});return l.call(k,"viewerRenderTemplate",u)}))};Y.prototype.applySsrOrCsrTemplate=function(a,b){var c=this;if(this.isEnabled()){B("string"===typeof b.html,"Skipping template rendering due to failed fetch");var d=this.assertTrustedViewer(a).then((function(){return c.F.findAndSetHtmlForTemplate(a,b.html)}))}else d=qa(b)?this.F.findAndRenderTemplateArray(a,b):this.F.findAndRenderTemplate(a,b);return d};function ic(a,b){var c=a.getHeadNode(),d=jc(c,kc(c));if(b){var e=a.getRootNode();if(lc(e,d))b(d);else var f=setInterval((function(){lc(e,d)&&(clearInterval(f),b(d))}),4)}}function jc(a,b){var c=a.__AMP_CSS_SM;c||(c=a.__AMP_CSS_SM=r());var d=mc(a,c,"amp-extension=amp-form");if(d)return d.textContent!==b&&(d.textContent=b),d;var e=(a.ownerDocument||a).createElement("style");e.textContent=b;e.setAttribute("amp-extension","amp-form");b=mc(a,c,"amp-runtime");(b=void 0===b?null:b)?a.insertBefore(e,b.nextSibling):a.insertBefore(e,a.firstChild);return c["amp-extension=amp-form"]=e}function mc(a,b,c){return b[c]?b[c]:(a=a.querySelector("style["+c+"]"))?b[c]=a:null}function kc(a){return(a=a.__AMP_CSS_TR)?a('form.amp-form-submit-error [submit-error],form.amp-form-submit-success [submit-success],form.amp-form-submitting [submitting]{display:block}textarea[autoexpand]:not(.i-amphtml-textarea-max){overflow:hidden!important}.i-amphtml-textarea-clone{visibility:hidden;position:absolute;top:-9999px;left:-9999px;height:0!important}.i-amphtml-validation-bubble{transform:translate(-50%,-100%);background-color:#fff;box-shadow:0 5px 15px 0 rgba(0,0,0,.5);max-width:200px;position:absolute;display:block;box-sizing:border-box;padding:10px;border-radius:5px}.i-amphtml-validation-bubble:after{content:" ";position:absolute;bottom:-8px;left:30px;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fff}[visible-when-invalid]{color:red}\n/*# sourceURL=/extensions/amp-form/0.1/amp-form.css*/'):'form.amp-form-submit-error [submit-error],form.amp-form-submit-success [submit-success],form.amp-form-submitting [submitting]{display:block}textarea[autoexpand]:not(.i-amphtml-textarea-max){overflow:hidden!important}.i-amphtml-textarea-clone{visibility:hidden;position:absolute;top:-9999px;left:-9999px;height:0!important}.i-amphtml-validation-bubble{transform:translate(-50%,-100%);background-color:#fff;box-shadow:0 5px 15px 0 rgba(0,0,0,.5);max-width:200px;position:absolute;display:block;box-sizing:border-box;padding:10px;border-radius:5px}.i-amphtml-validation-bubble:after{content:" ";position:absolute;bottom:-8px;left:30px;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fff}[visible-when-invalid]{color:red}\n/*# sourceURL=/extensions/amp-form/0.1/amp-form.css*/'}function lc(a,b){var c=a.styleSheets;for(a=0;a<c.length;a++)if(c[a].ownerNode==b)return!0;return!1}var nc=["amp-selector"];function oc(a,b){var c=this;try{Fb(a)}catch(f){Qa().error("amp-form","form proxy failed to install",f)}a.__AMP_FORM=this;this.na=b;this.U=a.ownerDocument;this.j=this.U.defaultView;this.Na=F(this.j,"timer");this.h=a;this.B=H(this.h);this.ma=null;this.Aa=K(this.B,"url-replace");this.F=G(this.B,"templates");this.sa=E(this.j,"xhr");this.S=K(this.B,"action");this.va=L(this.B);this.N=G(this.B,"viewer");this.V=new Y(this.N,this.F);this.J=(this.h.getAttribute("method")||"GET").toUpperCase();this.Ma=this.h.getAttribute("target");this.O=pc(this,"action-xhr");this.Sa=pc(this,"verify-xhr");this.Ha=qc(this);this.za=!this.h.hasAttribute("novalidate");this.h.setAttribute("novalidate","");this.za||this.h.setAttribute("amp-novalidate","");this.h.classList.add("i-amphtml-form");this.K="initial";b=this.h.elements;for(var d=0;d<b.length;d++){var e=b[d].name;B("__amp_source_origin"!=e&&"__amp_form_verify"!=e,"Illegal input name, %s found: %s",e,b[d])}this.ca=new Db(this.h,this.j);this.Y=ac(this.h);this.Pa=bc(this.h,(function(){return rc(c)}));this.S.addToAllowlist("FORM",["clear","submit"],["email"]);this.S.installActionHandler(this.h,this.Ea.bind(this));this.oa();sc(this);tc(this);this.ta=this.Ka=this.Ra=null;Va(I(a),"form-submit-service").then((function(f){c.ta=f}));this.Ia=this.U&&va(this.U)}function pc(a,b){var c=a.h.getAttribute(b);if(c){var d=K(a.B,"url");d.assertHttpsUrl(c,a.h,b);B(!d.isProxyOrigin(c),"form %s should not be on AMP CDN: %s",b,a.h)}return c}function qc(a){var b=a.h.getAttribute("enctype");if("application/x-www-form-urlencoded"===b||"multipart/form-data"===b)return b;null!==b&&A().warn("amp-form","Unexpected enctype: "+b+". Defaulting to 'multipart/form-data'.");return"multipart/form-data"}m=oc.prototype;m.getXssiPrefix=function(){return this.h.getAttribute("xssi-prefix")};m.requestForFormFetch=function(a,b,c,d){var e=t({Accept:"application/json"});if("GET"==b||"HEAD"==b){uc(this);var f=w(this.h);d&&d.forEach((function(l){return delete f[l]}));c&&ua(f,c);var g=mb(a,nb(f))}else{g=a;if("application/x-www-form-urlencoded"===this.Ha){var h=nb(w(this.h));e=t({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"})}else h=fb(this.j,this.h);d&&d.forEach((function(l){return h.delete(l)}));for(var k in c)h.append(k,c[k])}return{xhrUrl:g,fetchOpt:t({body:h,method:b,credentials:"include",headers:e})}};m.setXhrAction=function(a){this.O=a};m.Ea=function(a){var b=this;if(!a.satisfiesTrust(2))return null;if("submit"==a.method)return vc(this).then((function(){return"submitting"!=b.K&&wc(b)?xc(b,a.trust,null):Promise.resolve(null)}));"clear"===a.method&&yc(this);return null};function vc(a){if(a.ma)return a.ma;var b=a.h.querySelectorAll(nc.join(",")),c=q(b).map((function(d){return d.build()}));return a.ma=zc(a,c,2e3)}m.oa=function(){var a=this;this.B.whenNextVisible().then((function(){var b=a.h.querySelector("[autofocus]");if(b)try{b.focus()}catch(c){}}));this.h.addEventListener("submit",this.ua.bind(this),!0);this.h.addEventListener("blur",(function(b){Ac(b.target);a.Y.onBlur(b)}),!0);this.h.addEventListener("amp:form-value-change",(function(b){Ac(b.target);a.Y.onInput(b)}),!0);this.V.isEnabled()||this.h.addEventListener("change",(function(b){a.Pa.onCommit().then((function(c){var d=c.errors;c.updatedElements.forEach(Ac);a.Y.onBlur(b);"verifying"===a.K&&(d.length?(Z(a,"verify-error"),Bc(a,t({verifyErrors:d})).then((function(){Cc(a,"verify-error",d,2)}))):Z(a,"initial"))}))}));this.h.addEventListener("input",(function(b){Ac(b.target);a.Y.onInput(b)}))};function sc(a){Xa(a.B,"inputmask","amp-inputmask").then((function(b){b&&b.install()}))}function Dc(a,b){Ec(a,"Form analytics not supported");var e,c=t({}),d=w(a.h);for(e in d)Object.prototype.hasOwnProperty.call(d,e)&&(c["formFields["+e+"]"]=d[e].join(","));c.formId=a.h.id;try{Ya(a.h,b,c)}catch(f){Qa().error("amp-form","Sending analytics failed:",f)}}function yc(a){a.h.reset();Z(a,"initial");a.h.classList.remove("user-valid");a.h.classList.remove("user-invalid");var b=a.h.querySelectorAll(".user-valid, .user-invalid");v(b,(function(d){d.classList.remove("user-valid");d.classList.remove("user-invalid")}));var c=a.h.querySelectorAll(".visible[validation-for]");v(c,(function(d){d.classList.remove("visible")}));Fc(a.h)}m.ua=function(a){if("submitting"==this.K||!wc(this))return a.stopImmediatePropagation(),a.preventDefault(),Promise.resolve(null);(this.O||"POST"==this.J)&&a.preventDefault();return xc(this,3,a)};function xc(a,b,c){try{var d={form:a.h,actionXhrMutator:a.setXhrAction.bind(a)};a.ta.fire(d)}catch(k){Qa().error("amp-form","Form submit service failed: %s",k)}var e=Gc(a),f=a.h.getElementsByClassName("i-amphtml-async-input");a.ca.onSubmitting();if(!a.O&&"GET"==a.J){Ec(a,"Non-XHR GETs not supported.");uc(a);if(0===f.length){for(d=0;d<e.length;d++)a.Aa.expandInputValueSync(e[d]);Hc(a,!c);a.ca.onSubmitSuccess();return ma()}c&&c.preventDefault()}Z(a,"submitting");var g=[],h=[];h.push(Ic(a,e));v(f,(function(k){var l=Jc(a,k);k.classList.contains("i-async-require-action")?g.push(l):h.push(l)}));return Promise.all(g).then((function(){return zc(a,h,1e4).then((function(){if(a.O)var k=Kc(a,b);else"POST"==a.J?B(!1,"Only XHR based (via action-xhr attribute) submissions are supported for POST requests. %s",a.h):"GET"==a.J&&Hc(a,!0),k=ma();return k}),(function(k){return Lc(a,k,b)}))}),(function(k){return Lc(a,k,b)}))}function Lc(a,b,c){var d={};b&&b.message&&(d.error=b.message);return Mc(a,b,d,c)}function Gc(a){return a.h.querySelectorAll('[type="hidden"][data-amp-replace]')}function rc(a){if("submitting"===a.K)return ma();Z(a,"verifying");Cc(a,"verify",null,3);return Ic(a,Gc(a)).then((function(){return Nc(a)}))}function Kc(a,b){if(a.V.isEnabled())var c=Oc(a,b);else Pc(a,b),c=a.da(a.O,a.J).then((function(d){return Qc(a,d,b)}),(function(d){return Rc(a,d,b)}));return c}function Oc(a,b){var c=w(a.h);return Bc(a,c).then((function(){return a.S.trigger(a.h,"submit",null,b)})).then((function(){var d=a.requestForFormFetch(a.O,a.J),e=d.fetchOpt||{};var f=e.method;void 0===f?f="GET":(f=f.toUpperCase(),ob.includes(f));e.method=f;e.headers=e.headers||t({});d.fetchOpt=e;f=d.xhrUrl;e=(e=d.fetchOpt)||{};var g=a.j;g=g.origin||P(g.location.href).origin;f=P(f).origin;g==f&&(e.headers=e.headers||{},e.headers["AMP-Same-Origin"]="true");d.fetchOpt=e;f=a.j;e=d.xhrUrl;if(!1!==d.fetchOpt.ampCors){g=P(e);g=Ka(g.search);B(!("__amp_source_origin"in g),"Source origin is not allowed in %s",e);f=f.location.href;f=lb(f);if(Na.cdnProxyRegex.test(lb(f).origin)){g=f.pathname.split("/");B(ib.has(g[1]),"Unknown path prefix in url %s",f.href);var h=g[2],k="s"==h?"https://"+decodeURIComponent(g[3]):"http://"+decodeURIComponent(h);B(0<k.indexOf("."),"Expected a . in origin %s",k);g.splice(1,"s"==h?3:2);g=k+g.join("/");h=(h=f.search)&&"?"!=h?(h=h.replace(/[?&](amp_(js[^&=]*|gsa|r|kit)|usqp)\b[^&]*/g,"").replace(/^[?&]/,""))?"?"+h:"":"";f=g+h+(f.hash||"")}else f=f.href;f=P(f).origin;e=mb(e,encodeURIComponent("__amp_source_origin")+"="+encodeURIComponent(f),void 0)}d.xhrUrl=e;e=a.V;f=e.ssr;g=a.h;var l;(h=a.h.querySelector("[submit-success]"))&&(l=a.F.maybeFindTemplate(h));var n;(h=a.h.querySelector("[submit-error]"))&&(n=a.F.maybeFindTemplate(h));return f.call(e,g,d,{successTemplate:l,errorTemplate:n})})).then((function(d){return Sc(a,d,b)}),(function(d){var e={};d&&d.message&&(e.error=d.message);return Mc(a,d,e,b)}))}function Sc(a,b,c){var d=b.init,e=wa(b.body,(function(f){return A().error("amp-form","Failed to parse response JSON: %s",f)}));return d&&(d=d.status,300<=d)?Mc(a,d,b,c,e):Tc(a,b,c,e)}function Pc(a,b){Dc(a,"amp-form-submit");var c=w(a.h);Bc(a,c).then((function(){a.S.trigger(a.h,"submit",null,b)}))}function Ic(a,b){for(var c=[],d=0;d<b.length;d++)c.push(a.Aa.expandInputValueAsync(b[d]));return zc(a,c,100)}function Jc(a,b){return b.getImpl().then((function(c){return c.getValue()})).then((function(c){var d=b.getAttribute("name");d=a.h.querySelector("input[name="+String(d).replace(xa,ya)+"]");if(!d){d=t({name:b.getAttribute("name"),hidden:"true"});var f,e=a.j.document.createElement("input");for(f in d)e.setAttribute(f,d[f]);d=e}d.setAttribute("value",c);a.h.appendChild(d)}))}function Nc(a){var b=q(a.h.querySelectorAll("["+"no-verify".replace(xa,ya)+"]")).map((function(d){return d.name||d.id})),c={};return a.da(a.Sa,a.J,(c.__amp_form_verify=!0,c),b)}m.da=function(a,b,c,d){Ec(this,"XHRs should be proxied.");a=this.requestForFormFetch(a,b,c,d);return this.sa.fetch(a.xhrUrl,a.fetchOpt)};function Qc(a,b,c){return a.sa.xssiJson(b,a.getXssiPrefix()).then((function(d){return Tc(a,d,c)}),(function(d){return A().error("amp-form","Failed to parse response JSON: %s",d)})).then((function(){Dc(a,"amp-form-submit-success");Uc(a,b)}))}function Tc(a,b,c,d){Z(a,"submit-success");return oa((function(){Bc(a,b||{}).then((function(){Cc(a,"submit-success",void 0===d?b:d,c-1);a.ca.onSubmitSuccess()}))}))}function Rc(a,b,c){return(b&&b.response?a.sa.xssiJson(b.response,a.getXssiPrefix()).catch((function(){return null})):Promise.resolve(null)).then((function(d){Mc(a,b,d,c);Dc(a,"amp-form-submit-error");Uc(a,b.response)}))}function Mc(a,b,c,d,e){Z(a,"submit-error");A().error("amp-form","Form submission failed: %s",b);return oa((function(){Bc(a,c).then((function(){Cc(a,"submit-error",void 0===e?c:e,d-1);a.ca.onSubmitError()}))}))}function Hc(a,b){Dc(a,"amp-form-submit");b&&a.h.submit();Z(a,"initial")}function Ec(a,b){var c=a.V.isEnabled();B(!1===c,"[amp-form]: viewerRenderTemplate | %s",b)}function uc(a){var b=a.h.querySelectorAll("input[type=password],input[type=file]");B(0==b.length,"input[type=password] or input[type=file] may only appear in form[method=post]")}function wc(a){void 0===Tb&&(Tb=!!a.j.document.createElement("input").checkValidity);if(Tb){var b=Vc(a.h);if(a.za)return a.Y.report(),b}return!0}function Uc(a,b){Ec(a,"Redirects not supported.");if(b&&b.headers){var c=b.headers.get("AMP-Redirect-To");if(c){B(!a.Ia,"Redirects not supported in AMP4Email.",a.h);B("_blank"!=a.Ma,"Redirecting to target=_blank using AMP-Redirect-To is currently not supported, use target=_top instead. %s",a.h);try{var d=K(a.B,"url");d.assertAbsoluteHttpOrHttpsUrl(c);d.assertHttpsUrl(c,"AMP-Redirect-To","Url")}catch(e){B(!1,"The `AMP-Redirect-To` header value must be an absolute URL starting with https://. Found %s",c)}G(a.B,"navigation").navigateTo(a.j,c,"AMP-Redirect-To")}}}function Cc(a,b,c,d){c=bb(a.j,"amp-form."+b,t({response:c}));a.S.trigger(a.h,b,c,d)}function zc(a,b,c){return Promise.race([Promise.all(b),a.Na.promise(c)])}function Z(a,b){var c=a.K;a.h.classList.remove("amp-form-"+c);a.h.classList.add("amp-form-"+b);var d=a.h.querySelector("["+c+"]");if(d){/^[\w-]+$/.test("i-amphtml-rendered");if(void 0!==za)var e=za;else{try{var f=d.ownerDocument,g=f.createElement("div"),h=f.createElement("div");g.appendChild(h);e=g.querySelector(":scope div")===h}catch(k){e=!1}e=za=e}e?d=d.querySelector(Aa(":scope")):(d.classList.add("i-amphtml-scoped"),e=Aa(".i-amphtml-scoped"),e=d.querySelectorAll(e),d.classList.remove("i-amphtml-scoped"),d=void 0===e[0]?null:e[0]);d&&Da(d)}a.K=b}function Bc(a,b){qa(b)&&(b={},A().warn("amp-form","Unexpected data type: "+b+". Expected non JSON array."));var c=a.h.querySelector("["+a.K+"]"),d=ma();if(c){var e="rendered-message-"+a.na;c.setAttribute("role","alert");c.setAttribute("aria-labeledby",e);c.setAttribute("aria-live","assertive");a.F.hasTemplate(c)?d=a.V.applySsrOrCsrTemplate(c,b).then((function(f){if(qa(f))if(1===f.length)var g=f[0];else g=document.createElement("div"),f.forEach((function(h){return g.appendChild(h)}));else g=f;g.id=e;g.setAttribute("i-amphtml-rendered","");return a.va.mutateElement(c,(function(){c.appendChild(g);var h=bb(a.j,"amp:dom-update",null,{bubbles:!0});c.dispatchEvent(h)}))})):a.va.mutateElement(c,(function(){}))}return d}function tc(a){if(!Na.cdnProxyRegex.test(lb(a.j.location).origin)&&a.h.hasAttribute("data-initialize-from-url")){var b=["SELECT","TEXTAREA"],c="color date datetime-local email hidden month number range search tel text time url week".split(" "),d=["checkbox","radio"],e=function(g,h){if(!g.hasAttribute("data-amp-replace")&&g.hasAttribute("data-allow-initialization")){h=f[h]||"";var k=g.getAttribute("type")||"text",l=g.tagName;"INPUT"===l?c.includes(k.toLocaleLowerCase())?g.value!==h&&(g.value=h):d.includes(k)&&(h=g.value===h,g.checked!==h&&(g.checked=h)):b.includes(l)&&g.value!==h&&(g.value=h)}},f=Ka(a.j.location.search);Object.keys(f).forEach((function(g){var h=a.h.elements[g];h&&(h.nodeType===Node.ELEMENT_NODE?e(h,g):h.length&&v(h,(function(k){return e(k,g)})))}))}}m.Ta=function(){return this.Ka};m.Va=function(){return this.Ra};function Vc(a){var b=a.querySelectorAll("input,select,textarea,fieldset");v(b,(function(c){return Wc(c)}));return Wc(a)}function Fc(a){var d,b=document.createElement("input"),c={};for(d in b.validity){c.$=d;var e=a.querySelectorAll("."+String(c.$).replace(xa,ya));v(e,function(f){return function(g){g.classList.remove(f.$)}}(c));c={$:c.$}}}function Wc(a,b){var c=b=void 0===b?!1:b;if(!a.checkValidity)return!0;var d=!1;var e=a.classList.contains("user-valid")?"valid":a.classList.contains("user-invalid")?"invalid":"none";var f=a.checkValidity();"valid"!=e&&f?(a.classList.add("user-valid"),a.classList.remove("user-invalid"),d="invalid"==e):"invalid"==e||f||(a.classList.add("user-invalid"),a.classList.remove("user-valid"),d=!0);if(a.validity)for(var g in a.validity)a.classList.toggle(g,a.validity[g]);if(c&&d){e=Ca(a);for(g=0;g<e.length;g++)Wc(e[g]);a.form&&Wc(a.form)}return f}function Ac(a){Wc(a,!0)}function Xc(a){this.Qa=Yc(a).then((function(){return Zc(a)}))}Xc.prototype.whenInitialized=function(){return this.Qa};function Yc(a){var b=new na;ic(a,b.resolve);return b.promise}function Zc(a){return a.whenReady().then((function(){var b=a.getRootNode();$c(b.querySelectorAll("form"));zb(a);ad(b);bd(b)}))}function $c(a){a&&v(a,(function(b,c){b.__AMP_FORM||new oc(b,"amp-form-"+c)}))}function ad(a){a.addEventListener("amp:dom-update",(function(){$c(a.querySelectorAll("form"))}))}function bd(a){a.addEventListener("keydown",(function(b){if(!b.defaultPrevented&&"Enter"==b.key&&(b.ctrlKey||b.metaKey)&&"TEXTAREA"===b.target.tagName){var c=b.target.form,d=c?c.__AMP_FORM||null:null;d&&(d.ua(b),b.preventDefault())}}))}AMP.registerServiceForDoc("form-submit-service",Nb);AMP.registerServiceForDoc("amp-form",Xc)}});//# sourceMappingURL=amp-form-0.1.js.map

Back to list