-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstatickit.min.js
13 lines (13 loc) · 30.7 KB
/
statickit.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
var statickit=function(){"use strict";var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var t=function(t){return function(t){for(var n,r,o,i,a="",s=0,u=(t=String(t)).length%3;s<t.length;){if((r=t.charCodeAt(s++))>255||(o=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");a+=e.charAt((n=r<<16|o<<8|i)>>18&63)+e.charAt(n>>12&63)+e.charAt(n>>6&63)+e.charAt(63&n)}return u?a.slice(0,u-3)+"===".substring(u):a}(JSON.stringify(t))};var n=setTimeout;function r(e){return Boolean(e&&void 0!==e.length)}function o(){}function i(e){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(e,this)}function a(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,i._immediateFn((function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void u(t.promise,e)}s(t.promise,r)}else(1===e._state?s:u)(t.promise,e._value)}))):e._deferreds.push(t)}function s(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof i)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void l((r=n,o=t,function(){r.apply(o,arguments)}),e)}e._state=1,e._value=t,c(e)}catch(t){u(e,t)}var r,o}function u(e,t){e._state=2,e._value=t,c(e)}function c(e){2===e._state&&0===e._deferreds.length&&i._immediateFn((function(){e._handled||i._unhandledRejectionFn(e._value)}));for(var t=0,n=e._deferreds.length;t<n;t++)a(e,e._deferreds[t]);e._deferreds=null}function f(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function l(e,t){var n=!1;try{e((function(e){n||(n=!0,s(t,e))}),(function(e){n||(n=!0,u(t,e))}))}catch(e){if(n)return;n=!0,u(t,e)}}i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){var n=new this.constructor(o);return a(this,new f(e,t,n)),n},i.prototype.finally=function(e){var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){return t.reject(n)}))}))},i.all=function(e){return new i((function(t,n){if(!r(e))return n(new TypeError("Promise.all accepts an array"));var o=Array.prototype.slice.call(e);if(0===o.length)return t([]);var i=o.length;function a(e,r){try{if(r&&("object"==typeof r||"function"==typeof r)){var s=r.then;if("function"==typeof s)return void s.call(r,(function(t){a(e,t)}),n)}o[e]=r,0==--i&&t(o)}catch(e){n(e)}}for(var s=0;s<o.length;s++)a(s,o[s])}))},i.resolve=function(e){return e&&"object"==typeof e&&e.constructor===i?e:new i((function(t){t(e)}))},i.reject=function(e){return new i((function(t,n){n(e)}))},i.race=function(e){return new i((function(t,n){if(!r(e))return n(new TypeError("Promise.race accepts an array"));for(var o=0,a=e.length;o<a;o++)i.resolve(e[o]).then(t,n)}))},i._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){n(e,0)},i._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var d=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){!function(t){e.exports=function(e){var n=e&&e.Promise||t.Promise,r=e&&e.XMLHttpRequest||t.XMLHttpRequest,o=t;return function(){var e=Object.create(o,{fetch:{value:void 0,writable:!0}});return function(e){if(!e.fetch){var t="URLSearchParams"in e,o="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,s="ArrayBuffer"in e;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=function(e){return e&&DataView.prototype.isPrototypeOf(e)},f=ArrayBuffer.isView||function(e){return e&&u.indexOf(Object.prototype.toString.call(e))>-1};m.prototype.append=function(e,t){e=d(e),t=h(t);var n=this.map[e];this.map[e]=n?n+","+t:t},m.prototype.delete=function(e){delete this.map[d(e)]},m.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},m.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},m.prototype.set=function(e,t){this.map[d(e)]=h(t)},m.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},m.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),y(e)},m.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),y(e)},m.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),y(e)},o&&(m.prototype[Symbol.iterator]=m.prototype.entries);var l=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},S.call(_.prototype),S.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},x.error=function(){var e=new x(null,{status:0,statusText:""});return e.type="error",e};var p=[301,302,303,307,308];x.redirect=function(e,t){if(-1===p.indexOf(t))throw new RangeError("Invalid status code");return new x(null,{status:t,headers:{location:e}})},e.Headers=m,e.Request=_,e.Response=x,e.fetch=function(e,t){return new n((function(n,o){var a=new _(e,t),s=new r;s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new m,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new x(o,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),s.send(void 0===a._bodyInit?null:a._bodyInit)}))},e.fetch.polyfill=!0}function d(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function y(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function m(e){this.map={},e instanceof m?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function w(e){if(e.bodyUsed)return n.reject(new TypeError("Already read"));e.bodyUsed=!0}function b(e){return new n((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function v(e){var t=new FileReader,n=b(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(i&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(a&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(s&&i&&c(e))this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!s||!ArrayBuffer.prototype.isPrototypeOf(e)&&!f(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=g(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=w(this);if(e)return e;if(this._bodyBlob)return n.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return n.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return n.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||n.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var e,t,r,o=w(this);if(o)return o;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=b(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return n.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return n.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(E)}),this.json=function(){return this.text().then(JSON.parse)},this}function _(e,t){var n,r,o=(t=t||{}).body;if(e instanceof _){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new m(e.headers)),this.method=e.method,this.mode=e.mode,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new m(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),l.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function E(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function x(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new m(t.headers),this.url=t.url||"",this._initBody(e)}}(void 0!==e?e:this),{fetch:e.fetch,Headers:e.Headers,Request:e.Request,Response:e.Response}}()}}("undefined"!=typeof self?self:p)})),h=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/function w(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}})()&&Object.assign;var b=function(e){return e instanceof FormData?e:JSON.stringify(e)};function v(){this.session={loadedAt:1*new Date,webdriver:navigator.webdriver||document.documentElement.getAttribute("webdriver")||!!window.callPhantom||!!window._phantom}}v.prototype.teardown=function(){},v.prototype.submitForm=function(e){if(!(e.id||e.site&&e.form))throw new Error("You must set an `id` or `site` & `form` properties");var n,r,o,a=e.fetchImpl||d({Promise:i}).fetch,s=function(e){var t=e.id,n=e.site,r=e.form,o=e.endpoint||"https://api.statickit.com";return n&&r?"".concat(o,"/j/sites/").concat(n,"/forms/").concat(r,"/submissions"):"".concat(o,"/j/forms/").concat(t,"/submissions")}(e),u=e.data||{};n=u,r="_t",o=t(this.session),n instanceof FormData?n.append(r,o):n[r]=o;var c,f,l,p={method:"POST",mode:"cors",body:b(u),headers:{"StaticKit-Client":(c=e,f=c.clientName,l="@statickit/core@".concat("1.6.0"),f?"".concat(f," ").concat(l):l)}};return u instanceof FormData||(p.headers["Content-Type"]="application/json"),a(s,p).then((function(e){return e.json().then((function(t){return{body:t,response:e}}))}))};function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
/*!
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
* ECMAScript compliant, uniform cross-browser split method
*/
var S,_,E,x=(_=String.prototype.split,E=/()??/.exec("")[1]===S,function(e,t,n){if("[object RegExp]"!==Object.prototype.toString.call(t))return _.call(e,t,n);var r,o,i,a,s=[],u=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),c=0;for(t=new RegExp(t.source,u+"g"),e+="",E||(r=new RegExp("^"+t.source+"$(?!\\s)",u)),n=n===S?-1>>>0:n>>>0;(o=t.exec(e))&&!((i=o.index+o[0].length)>c&&(s.push(e.slice(c,o.index)),!E&&o.length>1&&o[0].replace(r,(function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===S&&(o[e]=S)})),o.length>1&&o.index<e.length&&Array.prototype.push.apply(s,o.slice(1)),a=o[0].length,c=i,s.length>=n));)t.lastIndex===o.index&&t.lastIndex++;return c===e.length?!a&&t.test("")||s.push(""):s.push(e.slice(c)),s.length>n?s.slice(0,n):s}),A=[].indexOf,O=function(e,t){if(A)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},j=function(e){var t=e.classList;if(t)return t;var n={add:r,remove:o,contains:i,toggle:function(e){return i(e)?(o(e),!1):(r(e),!0)},toString:function(){return e.className},length:0,item:function(e){return a()[e]||null}};return n;function r(e){var t=a();O(t,e)>-1||(t.push(e),s(t))}function o(e){var t=a(),n=O(t,e);-1!==n&&(t.splice(n,1),s(t))}function i(e){return O(a(),e)>-1}function a(){return function(e,t){for(var n=[],r=0;r<e.length;r++)t(e[r])&&n.push(e[r]);return n}(e.className.split(" "),L)}function s(t){var r=t.length;e.className=t.join(" "),n.length=r;for(var o=0;o<t.length;o++)n[o]=t[o];delete t[r]}};function L(e){return!!e}var T={className:"class",htmlFor:"for"},k={accept:new Set(["form","input"]),"accept-charset":new Set(["form"]),accesskey:"GLOBAL",action:new Set(["form"]),align:new Set(["applet","caption","col","colgroup","hr","iframe","img","table","tbody","td","tfoot","th","thead","tr"]),alt:new Set(["applet","area","img","input"]),async:new Set(["script"]),autocomplete:new Set(["form","input"]),autofocus:new Set(["button","input","keygen","select","textarea"]),autoplay:new Set(["audio","video"]),autosave:new Set(["input"]),bgcolor:new Set(["body","col","colgroup","marquee","table","tbody","tfoot","td","th","tr"]),border:new Set(["img","object","table"]),buffered:new Set(["audio","video"]),challenge:new Set(["keygen"]),charset:new Set(["meta","script"]),checked:new Set(["command","input"]),cite:new Set(["blockquote","del","ins","q"]),class:"GLOBAL",code:new Set(["applet"]),codebase:new Set(["applet"]),color:new Set(["basefont","font","hr"]),cols:new Set(["textarea"]),colspan:new Set(["td","th"]),content:new Set(["meta"]),contenteditable:"GLOBAL",contextmenu:"GLOBAL",controls:new Set(["audio","video"]),coords:new Set(["area"]),data:new Set(["object"]),datetime:new Set(["del","ins","time"]),default:new Set(["track"]),defer:new Set(["script"]),dir:"GLOBAL",dirname:new Set(["input","textarea"]),disabled:new Set(["button","command","fieldset","input","keygen","optgroup","option","select","textarea"]),download:new Set(["a","area"]),draggable:"GLOBAL",dropzone:"GLOBAL",enctype:new Set(["form"]),for:new Set(["label","output"]),form:new Set(["button","fieldset","input","keygen","label","meter","object","output","progress","select","textarea"]),formaction:new Set(["input","button"]),headers:new Set(["td","th"]),height:new Set(["canvas","embed","iframe","img","input","object","video"]),hidden:"GLOBAL",high:new Set(["meter"]),href:new Set(["a","area","base","link"]),hreflang:new Set(["a","area","link"]),"http-equiv":new Set(["meta"]),icon:new Set(["command"]),id:"GLOBAL",ismap:new Set(["img"]),itemprop:"GLOBAL",keytype:new Set(["keygen"]),kind:new Set(["track"]),label:new Set(["track"]),lang:"GLOBAL",language:new Set(["script"]),list:new Set(["input"]),loop:new Set(["audio","bgsound","marquee","video"]),low:new Set(["meter"]),manifest:new Set(["html"]),max:new Set(["input","meter","progress"]),maxlength:new Set(["input","textarea"]),maxlength:new Set(["input","textarea"]),media:new Set(["a","area","link","source","style"]),method:new Set(["form"]),min:new Set(["input","meter"]),multiple:new Set(["input","select"]),muted:new Set(["video"]),name:new Set(["button","form","fieldset","iframe","input","keygen","object","output","select","textarea","map","meta","param"]),novalidate:new Set(["form"]),open:new Set(["details"]),optimum:new Set(["meter"]),pattern:new Set(["input"]),ping:new Set(["a","area"]),placeholder:new Set(["input","textarea"]),poster:new Set(["video"]),preload:new Set(["audio","video"]),radiogroup:new Set(["command"]),readonly:new Set(["input","textarea"]),rel:new Set(["a","area","link"]),required:new Set(["input","select","textarea"]),reversed:new Set(["ol"]),rows:new Set(["textarea"]),rowspan:new Set(["td","th"]),sandbox:new Set(["iframe"]),scope:new Set(["th"]),scoped:new Set(["style"]),seamless:new Set(["iframe"]),selected:new Set(["option"]),shape:new Set(["a","area"]),size:new Set(["input","select"]),sizes:new Set(["img","link","source"]),span:new Set(["col","colgroup"]),spellcheck:"GLOBAL",src:new Set(["audio","embed","iframe","img","input","script","source","track","video"]),srcdoc:new Set(["iframe"]),srclang:new Set(["track"]),srcset:new Set(["img"]),start:new Set(["ol"]),step:new Set(["input"]),style:"GLOBAL",summary:new Set(["table"]),tabindex:"GLOBAL",target:new Set(["a","area","base","form"]),title:"GLOBAL",type:new Set(["button","input","command","embed","object","script","source","style","menu"]),usemap:new Set(["img","input","object"]),value:new Set(["button","option","input","li","meter","progress","param"]),width:new Set(["canvas","embed","iframe","img","input","object","video"]),wrap:new Set(["textarea"])};var B={isStandardAttribute:function(e,t){t=t.toLowerCase();var n=k[e.toLowerCase()];return!!n&&("GLOBAL"===n||n.has(t))},propToAttr:function(e){return T[e]||e}};function N(e,t){this.type=e,this.target=null,Object.keys(t||{}).forEach((function(e){this[e]=t[e]}),this)}function C(e,t){this._eventListeners=this._eventListeners||{},this._eventListeners[e]=this._eventListeners[e]||[];var n=this._eventListeners[e];-1===n.indexOf(t)&&n.push(t)}function P(e,t){var n=this._eventListeners&&this._eventListeners[e];if(n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}function R(e){e.target=this;var t=this._eventListeners&&this._eventListeners[e.type];return t&&t.forEach((function(t){t(e)})),!0}function F(){}function G(){}function I(e){this.el=e,this.styles=[]}function U(e,t){e&&(this.name=e,this.value=t||"")}function q(){var e=this;this.style=new I(this),this.classList=j(this),this.childNodes=[],this.attributes=[],this.dataset={},this.className="",this._setProperty=function(t,n,r,o){var i=e._getProperty(t,r);i?i.value=String(o):t.push("function"==typeof n?new n(r.toLowerCase(),String(o)):n)},this._getProperty=function(e,t){if(t){t=t.toLowerCase();for(var n=0;n<e.length;n++)if(t===e[n].name)return e[n]}}}function D(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function H(e){return D(e).replace(/"/g,""")}function M(){}function V(){}function z(e){e.__defineGetter__("parentNode",(function(){return this.parentElement}))}N.prototype.preventDefault=function(){},N.prototype.stopPropagation=function(){},N.prototype.stopImmediatePropagation=function(){},F.prototype.createTextNode=function(e){var t=new M;return t.textContent=e,t.nodeName="#text",t.nodeType=3,t},F.prototype.createElement=function(e){var t=new q;return t.nodeName=t.tagName=e,t},F.prototype.createComment=function(e){var t=new V;return t.data=e,t},F.prototype.addEventListener=C,F.prototype.removeEventListener=P,F.prototype.dispatchEvent=R,M.prototype=new G,q.prototype=new G,V.prototype=new G,I.prototype.setProperty=function(e,t){this.el._setProperty(this.styles,{name:e,value:t})},I.prototype.getProperty=function(e){return this.el._getProperty(this.styles,e)},I.prototype.__defineGetter__("cssText",(function(){var e="";return this.styles.forEach((function(t){e+=t.name+":"+t.value+";"})),e})),I.prototype.__defineSetter__("cssText",(function(e){this.styles.length=0,e.split(";").forEach((function(e){var t=e.indexOf(":");if(t){var n=e.slice(0,t).trim(),r=e.slice(t+1).trim();this.setProperty(n,r)}}),this)})),q.prototype.nodeType=1,q.prototype.appendChild=function(e){return e.parentElement=this,this.childNodes.push(e),e},q.prototype.setAttribute=function(e,t){"style"===e?this.style.cssText=t:this._setProperty(this.attributes,U,e,t)},q.prototype.getAttribute=function(e){if("style"===e)return this.style.cssText;var t=this._getProperty(this.attributes,e);return void 0!==t?t.value:null},q.prototype.removeAttribute=function(e){if("class"===e)delete this.className;else for(var t=0,n=this.attributes.length;t<n;t++)if(this.attributes[t].name===e){this.attributes.splice(t,1);break}},q.prototype.replaceChild=function(e,t){var n=this,r=!1;if(this.childNodes.forEach((function(o,i){o===t&&(n.childNodes[i]=e,e.parentElement=this,r=!0)})),r)return t},q.prototype.removeChild=function(e){var t=this,n=!0;if(this.childNodes.forEach((function(r,o){r===e&&(t.childNodes.splice(o,1),e.parentElement=null,n=!0)})),n)return e},q.prototype.insertBefore=function(e,t){var n=this.childNodes;if(null===t)n.push(e);else for(var r=0,o=n.length;r<o;r++){if(n[r]===t){0===r?n.unshift(e):n.splice(r,0,e);break}}return e.parentElement=this,e},q.prototype.addEventListener=C,q.prototype.removeEventListener=P,q.prototype.dispatchEvent=R,q.prototype.insertAdjacentHTML=function(e,t){},q.prototype.__defineGetter__("innerHTML",(function(){var e=this.childNodes.html||"";return this.childNodes.forEach((function(t){e+=t.outerHTML||t.textContent})),e})),q.prototype.__defineSetter__("innerHTML",(function(e){this.childNodes.length=0,this.childNodes.html=e})),q.prototype.__defineGetter__("outerHTML",(function(){var e=[],t=this;function n(e){var n,r=[];return e.forEach((function(e){n="style"!=e.name?e.value:t.style.cssText,r.push(e.name+'="'+H(n)+'"')})),r.length?" "+r.join(" "):""}function r(e,n){return!t.getAttribute(n)&&!("className"===e&&!t[e])}var o,i,a=this.style.cssText?this.attributes.concat([{name:"style"}]):this.attributes;return e.push("<"+this.nodeName+function(){var e=[];for(var o in t){var i=B.propToAttr(o);t.hasOwnProperty(o)&&-1!==["string","boolean","number"].indexOf(typeof t[o])&&B.isStandardAttribute(i,t.nodeName)&&r(o,i)&&e.push({name:i,value:t[o]})}return e?n(e):""}()+n(a)+(o=this.dataset,i=[],Object.keys(o).forEach((function(e){i.push("data-"+e+'="'+H(o[e])+'"')})),i.length?" "+i.join(" "):"")+">"),{AREA:!0,BASE:!0,BR:!0,COL:!0,EMBED:!0,HR:!0,IMG:!0,INPUT:!0,KEYGEN:!0,LINK:!0,META:!0,PARAM:!0,SOURCE:!0,TRACK:!0,WBR:!0}[this.nodeName.toUpperCase()]||(e.push(this.innerHTML),e.push("</"+this.nodeName+">")),e.join("")})),q.prototype.__defineGetter__("textContent",(function(){var e="";return this.childNodes.forEach((function(t){e+=t.textContent})),e})),q.prototype.__defineSetter__("textContent",(function(e){var t=new M;return t.textContent=e,this.childNodes=[t],e})),q.prototype.nodeValue=null,M.prototype.nodeType=3,M.prototype.nodeName="#text",M.prototype.__defineGetter__("textContent",(function(){return D(this.value||"")})),M.prototype.__defineSetter__("textContent",(function(e){this.value=e})),M.prototype.__defineGetter__("nodeValue",(function(){return D(this.value||"")})),M.prototype.__defineSetter__("nodeValue",(function(e){this.value=e})),M.prototype.__defineGetter__("length",(function(){return(this.value||"").length})),M.prototype.replaceData=function(e,t,n){this.value=this.value.slice(0,e)+n+this.value.slice(e+t)},V.prototype.nodeType=8,V.prototype.nodeName="#comment",V.prototype.__defineGetter__("data",(function(){return this.value})),V.prototype.__defineSetter__("data",(function(e){this.value=e})),V.prototype.__defineGetter__("outerHTML",(function(){return"\x3c!--"+D(this.value||"")+"--\x3e"})),V.prototype.__defineGetter__("nodeValue",(function(){return D(this.value||"")})),V.prototype.__defineSetter__("nodeValue",(function(e){this.value=e})),z(q.prototype),z(V.prototype),z(M.prototype),z(G.prototype);var K={Document:F,Node:G,Element:q,Comment:V,Text:M,document:new F,Event:N,CustomEvent:N},W=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t="undefined"==typeof window?K:window,n=t.document,r=t.Text;function o(){var e=[];function t(){var t=[].slice.call(arguments),o=null;function u(t){var c,f;if(null==t);else if("string"==typeof t)o?o.appendChild(c=n.createTextNode(t)):(f=x(t,/([\.#]?[^\s#.]+)/),/^\.|#/.test(f[1])&&(o=n.createElement("div")),a(f,(function(e){var t=e.substring(1,e.length);e&&(o?"."===e[0]?j(o).add(t):"#"===e[0]&&o.setAttribute("id",t):o=n.createElement(e))})));else if("number"==typeof t||"boolean"==typeof t||t instanceof Date||t instanceof RegExp)o.appendChild(c=n.createTextNode(t.toString()));else if(s(t))a(t,u);else if(i(t))o.appendChild(c=t);else if(t instanceof r)o.appendChild(c=t);else if("object"==typeof t)for(var l in t)if("function"==typeof t[l])/^on\w+/.test(l)?function(t,n){o.addEventListener?(o.addEventListener(t.substring(2),n[t],!1),e.push((function(){o.removeEventListener(t.substring(2),n[t],!1)}))):(o.attachEvent(t,n[t]),e.push((function(){o.detachEvent(t,n[t])})))}(l,t):(o[l]=t[l](),e.push(t[l]((function(e){o[l]=e}))));else if("style"===l)if("string"==typeof t[l])o.style.cssText=t[l];else for(var p in t[l])!function(n,r){if("function"==typeof r)o.style.setProperty(n,r()),e.push(r((function(e){o.style.setProperty(n,e)})));else var i=t[l][n].match(/(.*)\W+!important\W*$/);i?o.style.setProperty(n,i[1],"important"):o.style.setProperty(n,t[l][n])}(p,t[l][p]);else if("attrs"===l)for(var d in t[l])o.setAttribute(d,t[l][d]);else"data-"===l.substr(0,5)?o.setAttribute(l,t[l]):o[l]=t[l];else if("function"==typeof t){d=t();o.appendChild(c=i(d)?d:n.createTextNode(d)),e.push(t((function(e){i(e)&&c.parentElement?(c.parentElement.replaceChild(e,c),c=e):c.textContent=e})))}return c}for(;t.length;)u(t.shift());return o}return t.cleanup=function(){for(var t=0;t<e.length;t++)e[t]();e.length=0},t}function i(e){return e&&e.nodeName&&e.nodeType}function a(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n)}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}(e.exports=o()).context=o})),Y=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;function $(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var Q,Z=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=$(e),i=1;i<arguments.length;i++){for(var a in n=Object(arguments[i]))J.call(n,a)&&(o[a]=n[a]);if(Y){r=Y(n);for(var s=0;s<r.length;s++)X.call(n,r[s])&&(o[r[s]]=n[r[s]])}}return o},ee={h:W,onInit:function(){},onSubmit:function(){},onError:function(){},onFailure:function(){},onSuccess:function(e,t){var n=e.h,r=e.form,o=n("div",{},"Thank you!");r.parentNode.replaceChild(o,r)},enable:function(e){var t=e.form.querySelectorAll("[type='submit']:disabled");Array.from(t).forEach((function(e){e.disabled=!1}))},disable:function(e){var t=e.form.querySelectorAll("[type='submit']:enabled");Array.from(t).forEach((function(e){e.disabled=!0}))},renderErrors:function(e,t){var n=e.form.querySelectorAll("[data-sk-error]");Array.from(n).forEach((function(n){var r,o=(r=n.dataset.skError,t.find((function(e){return e.field==r})));if(o){var i=e.fields[o.field]||{},a=i.errorMessages||{},s=i.prettyName||"This field",u=a[(o.code||"").toLowerCase().replace(/([-_][a-z])/gi,(function(e){return e.toUpperCase().replace("-","").replace("_","")}))]||"".concat(s," ").concat(o.message);n.innerHTML=u}else n.innerHTML=""}))},endpoint:"https://api.statickit.com",data:{},fields:{},debug:!1},te=function(e){var t=e.form,n=e.onInit,r=e.enable;return e.debug&&console.log("Initializing form",e),t.addEventListener("submit",(function(t){return t.preventDefault(),function(e){var t=e.id,n=e.site,r=e.key,o=e.form,i=e.enable,a=e.disable,s=e.renderErrors,u=e.onSubmit,c=e.onSuccess,f=e.onFailure,l=e.onError,p=e.endpoint,d=e.data,h=e.client,y=new FormData(o);if("object"===g(d))for(var m in d)"function"==typeof d[m]?y.append(m,d[m].call(null,e)):y.append(m,d[m]);s(e,[]),a(e),u(e),e.debug&&console.log("Submitting",e),h.submitForm({id:t,site:n,form:r,endpoint:p,clientName:"@statickit/html@".concat("1.3.1"),data:y}).then((function(t){if(200==t.response.status)e.debug&&console.log("Submitted",t),c(e,t.body);else{var n=t.body.errors;e.debug&&console.log("Validation error",t),s(e,n),l(e,n)}})).catch((function(t){e.debug&&console.log("Unexpected error",t),f(e,t)})).finally((function(){i(e)}))}(e),!0})),r(e),n(e),!0},ne=function(e){if(!(e.id||e.site&&e.form))throw new Error("You must set an `id` or `site` & `form` properties");if(!e.element)throw new Error("You must set an `element` property");var t,n=e.form,r="FORM"==(t=e.element).tagName?t:document.querySelector(t);if(!r)throw new Error("Element `".concat(e.element,"` not found"));var o=Z({},ee,e,{form:r,key:n});return te(o)},re=new v,oe={form:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=n[0];switch(o.client||(o.client=re),e){case"init":return ne(o);default:return o.element=e,ne(o)}}},ie=function(e){var t=oe[e];if(!t)throw new Error("Method `".concat(e,"` does not exist"));for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.apply(null,r)};return window.sk=window.sk||function(){(sk.q=sk.q||[]).push(arguments)},Q=function(){var e=window.sk&&sk.q||[];window.sk=ie,e.forEach((function(e){ie.apply(null,e)}))},"loading"!=document.readyState?Q():document.addEventListener?document.addEventListener("DOMContentLoaded",Q):document.attachEvent("onreadystatechange",(function(){"loading"!=document.readyState&&Q()})),window.sk}();