Socket
Socket
Sign inDemoInstall

typeit

Package Overview
Dependencies
0
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.0 to 6.1.1

12

dist/typeit.min.js
/*!
*
* typeit - The most versatile animated typing utility on the planet.
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.0
* URL: https://typeitjs.com
* License: GPL-2.0
* TypeIt - The most versatile animated typing utility on the planet.
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.1
* License: GPL-2.0
* URL: https://typeitjs.com
*
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TypeIt=e():t.TypeIt=e()}(this,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var i={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:null,html:!0,waitUntilVisible:!1,beforeString:!1,afterString:!1,beforeStep:!1,afterStep:!1,afterComplete:!1};function r(t){var e=t.getBoundingClientRect();return!(e.right>window.innerWidth||e.bottom>window.innerHeight)&&!(e.top<0||e.left<0)}function o(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))}var u=function(t,e){for(var n=Object(t),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}return n},s=function(t){return["textarea","input"].indexOf(t.tagName.toLowerCase())>-1},a=function(t){return Array.isArray(t)?t.slice(0):t.split("<br>")},l=function(t){return[].slice.call(t)};function c(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f=function(t){var e;return(e=[]).concat.apply(e,c(t))},h=function(t){return(new DOMParser).parseFromString(t,"text/html").body},p=function(t){return l(t.attributes).map((function(t){return{name:t.name,value:t.nodeValue}}))},d=function(t){return l(t.childNodes).map((function(t){return 3===t.nodeType?t.nodeValue.split(""):t}))},y=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n={ancestorTree:e,attributes:p(t),content:""},i=d(t).map((function(n,i){return Array.isArray(n)?n.map((function(n,i){return{ancestorTree:e,attributes:p(t),content:n}})):n}));return i.unshift(n),f(i)},v=function(t){return t instanceof HTMLElement&&"BR"!==t.tagName},g=function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e.map((function(t){if(v(t)){if(!n)return l(t.childNodes);for(var e=t.parentNode,i=[t.tagName];["BODY","HTML"].indexOf(e.tagName)<0;)i.push(e.tagName),e=e.parentNode;return y(t,i)}return t}));return(i=f(i)).some((function(t){return v(t)}))?t(i,n):i};function m(t){var e=h(t),n=d(e);return g(n)}var b=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")};function w(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function S(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var k=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.executed=[],this.waiting=e,!e.length&&n&&this.add(n)}var e,n,i;return e=t,(n=[{key:"add",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.waiting[e?"unshift":"push"](t),this}},{key:"delete",value:function(t){return this.waiting.splice(t,1),this}},{key:"reset",value:function(){return this.waiting=[].concat(w(this.executed),w(this.waiting)),this.executed=[],this}}])&&S(e.prototype,n),i&&S(e,i),t}(),q=function(t){t.parentNode.removeChild(t)},A=function(t){return 3!==t.nodeType&&("BR"!==t.tagName&&!t.firstChild)},T=function(t){return t.some((function(t){return A(t)}))},P=function(t){for(var e=l(t.querySelectorAll("*")),n=T(e);e.length&&n;){var i=!1;e.forEach((function(t){A(t)&&(q(t),i=!0)})),i&&(e=l(t.querySelectorAll("*"))),n=T(e)}return e},j=function(t,e){var n=t.nextSibling;return!!n&&!n.isEqualNode(e)};function x(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function $(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var C=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.typeIt,r=e.element,o=e.id,l=e.options,c=e.queue,f=void 0===c?[]:c,h=e.isAReset,p=void 0!==h&&h;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.typeIt=n,this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.timeouts=[],this.id=o,this.$c=null,this.$e=r,this.isInput=s(r),this.opts=u({},i,l),this.opts.strings=a(this.opts.strings),this.opts.html=!this.isInput&&this.opts.html,this.queue=new k(f,[this.pause,this.opts.startDelay]),b(r,this.isInput),this.prepareDelay("nextStringDelay"),this.prepareDelay("loopDelay"),this.prepDOM(),this.handleHardCoded(),this.opts.strings=this.opts.strings.map((function(t){return t.replace(/<\!--.*?-->/g,"")})),this.opts.strings.length&&!p&&this.generateQueue()}var e,n,c;return e=t,(n=[{key:"reset",value:function(){return this.queue.reset(),new t({element:this.$e,id:this.id,options:this.opts,queue:this.queue.waiting,isAReset:!0})}},{key:"init",value:function(){var t=this;if(!this.status.started){if(this.cursor(),!this.opts.waitUntilVisible||r(this.$e))return this.status.started=!0,this.fire();window.addEventListener("scroll",(function e(){r(t.$e)&&!t.status.started&&(t.fire(),window.removeEventListener("scroll",e))}))}}},{key:"fire",value:function(){for(var t=this,e=this.queue.waiting.slice(),n=Promise.resolve(),i=function(i){var r=e[i],o=[r,t.queue,t.typeIt];n=n.then((function(){return new Promise((function(e,n){if(t.status.frozen)return n();var i,u;t.setPace(),r[2]&&r[2].isFirst&&t.opts.beforeString&&(i=t.opts).beforeString.apply(i,o),t.opts.beforeStep&&(u=t.opts).beforeStep.apply(u,o),r[0].call(t,r[1],r[2]).then((function(){var n,i,u=t.queue.waiting.shift();return r[2]&&r[2].isPhantom?e():(r[2]&&r[2].isLast&&t.opts.afterString&&(n=t.opts).afterString.apply(n,o),t.opts.afterStep&&(i=t.opts).afterStep.apply(i,o),t.queue.executed.push(u),e())}))}))}))},r=0;r<e.length;r++)i(r);n.then((function(){if(t.opts.loop){var e=t.opts.loopDelay?t.opts.loopDelay:t.opts.nextStringDelay;t.wait((function(){t.loopify(e),t.fire()}),e.after)}t.status.completed=!0,t.opts.afterComplete&&t.opts.afterComplete(t.typeIt)})).catch((function(){}))}},{key:"loopify",value:function(t){this.queue.reset().delete(0).add([this.pause,t.before],!0);for(var e=0;e<this.getAllChars().length;e++)this.queue.add([this.delete,null,{isPhantom:!0}],!0)}},{key:"prepDOM",value:function(){this.isInput||this.$e.setAttribute("data-typeit-id",this.id)}},{key:"setContents",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.isInput?this.$e.value=t:this.$e[this.opts.html?"innerHTML":"innerText"]=t}},{key:"getAllChars",value:function(){var t=this,e=l(this.$e.childNodes).filter((function(e){return!e.isEqualNode(t.$c)}));return g(e,!1)}},{key:"prepareDelay",value:function(t){var e=this.opts[t];if(e){var n=Array.isArray(e),i=n?null:e/2;this.opts[t]={before:n?e[0]:i,after:n?e[1]:i,total:n?e[0]+e[1]:e}}}},{key:"generateQueue",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e&&this.queue.add(e),this.opts.strings.forEach((function(e,n){t.queueString(e);var i=t.queue.waiting.length;if(n+1!==t.opts.strings.length){if(t.opts.breakLines)return t.queue.add([t.type,document.createElement("BR")]),void t.addSplitPause(i);t.queueDeletions(e),t.addSplitPause(i,e.length)}}))}},{key:"queueDeletions",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e="string"==typeof t?this.maybeNoderize(t).length:t,n=0;n<e;n++)this.queue.add([this.delete])}},{key:"maybeNoderize",value:function(t){return this.opts.html?m(t):t.split("")}},{key:"queueString",value:function(t){var e=this,n=(t=this.maybeNoderize(t)).length;t.forEach((function(t,i){var r=[e.type,t];0===i&&r.push({isFirst:!0}),i+1===n&&r.push({isLast:!0}),e.queue.add(r)}))}},{key:"addSplitPause",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.queue.waiting.splice(t,0,[this.pause,this.opts.nextStringDelay.before]),this.queue.waiting.splice(t+e+1,0,[this.pause,this.opts.nextStringDelay.after])}},{key:"cursor",value:function(){!this.isInput&&this.opts.cursor&&(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=document.createElement("style");n.id=e,n.appendChild(document.createTextNode(t)),document.head.appendChild(n)}("@keyframes blink-".concat(this.id," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(this.id,"'] .ti-cursor { animation: blink-").concat(this.id," ").concat(this.opts.cursorSpeed/1e3,"s infinite; }"),this.id),this.$e.insertAdjacentHTML("beforeend",'<span style="'.concat("display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;",'" class="ti-cursor">').concat(this.opts.cursorChar,"</span>")),this.$c=this.$e.querySelector(".ti-cursor"))}},{key:"insert",value:function(t){var e=t;if(this.isInput)this.$e.value="".concat(this.$e.value).concat(e);else{var n=this.$e;if("object"===O(t)&&!(t instanceof HTMLElement)){var i=x(t.ancestorTree).reverse().join(" "),r=l(n.querySelectorAll("".concat(i))),o=r[r.length-1];if(o&&function(t,e){if(!t)return!1;for(var n=!1,i=[],r=t;!n;)i.push(j(r,e)),(r=r.parentNode)&&!r.hasAttribute("data-typeit-id")||(n=!0);return!i.some((function(t){return t}))}(o,this.$c))n=o,e=t.content;else if(e=function(t){var e=t.tag,n=t.attributes,i=void 0===n?[]:n,r=t.content,o=void 0===r?"":r,u=document.createElement(e);return void 0!==i&&i.forEach((function(t){u.setAttribute(t.name,t.value)})),o&&(u.innerHTML=o),u}({tag:t.ancestorTree[0],attributes:t.attributes,content:t.content}),t.ancestorTree.length>1){var u=l(n.querySelectorAll(t.ancestorTree[1]));n=u[u.length-1]}}e="object"===O(e)?e:document.createTextNode(e),this.$c&&n.hasAttribute("data-typeit-id")?n.insertBefore(e,this.$c):n.appendChild(e)}}},{key:"handleHardCoded",value:function(){var t=this,e=this.$e.innerHTML;if(e){if(this.$e.innerHTML="",this.opts.startDelete)return m(e).forEach((function(e){t.insert(e)})),this.queue.add([this.delete,!0]),void this.addSplitPause(1);this.opts.strings=[].concat(x(a(e.trim())),x(this.opts.strings))}}},{key:"wait",value:function(t,e){this.timeouts.push(setTimeout(t,e))}},{key:"setPace",value:function(){var t=this.opts.speed,e=null!==this.opts.deleteSpeed?this.opts.deleteSpeed:this.opts.speed/3,n=t/2,i=e/2;this.typePace=this.opts.lifeLike?o(t,n):t,this.deletePace=this.opts.lifeLike?o(e,i):e}},{key:"pause",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n,i){t.wait((function(){return n()}),e||t.opts.nextStringDelay.total)}))}},{key:"type",value:function(t){var e=this;return"object"!==O(t)||t.content?new Promise((function(n,i){e.wait((function(){return e.insert(t),n()}),e.typePace)})):(this.insert(t),Promise.resolve())}},{key:"empty",value:function(){var t=this;return new Promise((function(e){return t.setContents(""),e()}))}},{key:"delete",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n){t.wait((function(){var i=t.getAllChars();return i.length&&q(i[i.length-1]),P(t.$e),e&&i.length-1>0?t.delete(!0).then((function(){return n()})):n()}),t.deletePace)}))}},{key:"setOptions",value:function(t){var e=this;return new Promise((function(n){return e.opts=u({},e.opts,t),n()}))}}])&&$(e.prototype,n),c&&$(e,c),t}(),D=function(t){return"string"==typeof t?t=document.querySelectorAll(t):t instanceof NodeList||(t=[t]),[].slice.call(t)};function E(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}n.d(e,"default",(function(){return N}));var N=function(){function t(e,n){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.instances=D(e).map((function(t){return new C({typeIt:i,element:t,id:Math.random().toString(36).substring(2,15),options:n,queue:[]})}))}var e,n,i;return e=t,(n=[{key:"each",value:function(t){var e=this;this.instances.forEach((function(n){t.call(e,n)}))}},{key:"queueUp",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.each((function(r){for(var o="string"!=typeof t,u=o?t:r[t],s=o?e:n,a=0;a<i;a++)r.queue.add([u,s])}))}},{key:"is",value:function(t){return e=this.instances,n=t,i=!0,!!e.length&&!e.some((function(t){return t.status[n]!==i}));var e,n,i}},{key:"freeze",value:function(){this.each((function(t){t.status.frozen=!0}))}},{key:"unfreeze",value:function(){this.each((function(t){t.status.frozen&&(t.status.frozen=!1,t.fire())}))}},{key:"type",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.each((function(e){return e.queueString(t)})),this}},{key:"delete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.queueUp("delete",null===t,null===t?1:t),this}},{key:"pause",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.queueUp("pause",t),this}},{key:"break",value:function(){return this.queueUp("type",document.createElement("BR")),this}},{key:"options",value:function(t){return this.queueUp("setOptions",t),this}},{key:"exec",value:function(t){return this.queueUp(t),this}},{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.each((function(e){if(e.timeouts.forEach((function(t){clearTimeout(t)})),e.timeouts=[],t){var n=e.isInput?null:e.$e.querySelector(".ti-cursor");n&&e.$e.removeChild(n)}e.status.destroyed=!0}))}},{key:"empty",value:function(){return this.queueUp("empty"),this}},{key:"reset",value:function(){return this.destroy(),this.instances=this.instances.map((function(t){return t.reset()})),this}},{key:"go",value:function(){return this.each((function(t){t.init()})),this}}])&&E(e.prototype,n),i&&E(e,i),t}()}]).default}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TypeIt=e():t.TypeIt=e()}(this,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var i={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:750,html:!0,waitUntilVisible:!1,beforeString:function(){},afterString:function(){},beforeStep:function(){},afterStep:function(){},afterComplete:function(){}},r=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.insert=function(e,n){t.waiting.splice(e,0,n)},this.add=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e[0])?(t.waiting=t.waiting.concat(e),t):(t.waiting[n?"unshift":"push"](e),t)},this.delete=function(e){return t.waiting.splice(e,1),t},this.reset=function(){return t.waiting=t.executed.concat(t.waiting),t.executed=[],t},this.executed=[],this.waiting=e,!e.length&&n&&this.add(n)},o=function(t){return document.createElement(t)};function u(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=o("style");n.id=e,n.appendChild(document.createTextNode(t)),document.head.appendChild(n)}var a=function(t){return["textarea","input"].indexOf(t.tagName.toLowerCase())>-1},c=function(t){return Array.isArray(t)?t:[t]},f=function(t){return[].slice.call(t)},l=function(t,e){var n=t.nextSibling;return!!n&&!n.isEqualNode(e)};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var h=function(t,e){var n=e;if(a(t))t.value="".concat(t.value).concat(n);else{var i=f(t.childNodes).filter((function(t){return t.classList&&t.classList.contains("ti-cursor")}));if(i=i.length?i[0]:null,"object"===p(e)&&!(e instanceof HTMLElement)){var r=e.ancestorTree.slice(0).reverse().join(" "),u=f(t.querySelectorAll("".concat(r))),s=u[u.length-1];if(s&&function(t,e){if(!t)return!1;for(var n=!1,i=[],r=t;!n;)i.push(l(r,e)),(r=r.parentNode)&&!r.hasAttribute("data-typeit-id")||(n=!0);return!i.some((function(t){return t}))}(s,i))t=s,n=e.content;else if(n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=o(t);return e.forEach((function(t){i.setAttribute(t.name,t.value)})),i.innerHTML=n,i}(e.ancestorTree[0],e.attributes,e.content),e.ancestorTree.length>1){var c=f(t.querySelectorAll(e.ancestorTree[1]));t=c[c.length-1]}}n="object"===p(n)?n:document.createTextNode(n),t.insertBefore(n,i&&t.hasAttribute("data-typeit-id")?i:null)}},d=function(t){var e=[];return e.concat.apply(e,t)},y=function(t){var e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body},v=function(t){return f(t.childNodes).map((function(t){return 3===t.nodeType?t.nodeValue.split(""):t}))},m=function(t,e,n){return{ancestorTree:e,attributes:(i=t,f(i.attributes).map((function(t){return{name:t.name,value:t.nodeValue}}))),content:n};var i},g=function(t,e){var n=m(t,e,""),i=v(t).map((function(n,i){return Array.isArray(n)?n.map((function(n,i){return m(t,e,n)})):n}));return i.unshift(n),d(i)},b=function(t){return t instanceof HTMLElement&&"BR"!==t.tagName},S=function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=e.map((function(t){if(b(t)){if(!n)return f(t.childNodes);for(var e=t.parentNode,i=[t.tagName];["BODY","HTML"].indexOf(e.tagName)<0;)i.push(e.tagName),e=e.parentNode;return g(t,i)}return t}));return(i=d(i)).some((function(t){return b(t)}))?t(i,n):i};function w(t){var e=y(t),n=v(e);return S(n)}function q(t){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?w(t):t.split("")}var x=function(t,e){e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")},T=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!Array.isArray(t),r=t.length;return(t=i?new Array(t).fill(0):t).map((function(t,o){if(i)return e;var u=[e,t];return n&&(0===o&&u.push({isFirst:!0}),o+1===r&&u.push({isLast:!0})),u}))},A=function(t){t.parentNode.removeChild(t)},N=function(t){return 3!==t.nodeType&&"BR"!==t.tagName&&!t.firstChild},L=function(t){return t.some((function(t){return N(t)}))},M=function(t){for(var e=f(t.querySelectorAll("*")),n=L(e);e.length&&n;){var i=!1;e.forEach((function(t){N(t)&&(A(t),i=!0)})),i&&(e=f(t.querySelectorAll("*"))),n=L(e)}return e},D=function(t){return Array.isArray(t)||(t=[t/2,t/2]),{before:t[0],after:t[1],total:t[0]+t[1]}},$=function(t,e,n){var i=(e=null!==e?e:t/3)/2;return n?[u(t,t/2),u(e,i)]:[t,e]};function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function E(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.typeIt,u=e.element,l=e.id,p=e.options,d=e.queue,v=void 0===d?[]:d,m=e.isAReset,g=void 0!==m&&m,b=function(){var e=f(t.$e.childNodes).filter((function(t){return!t.isEqualNode(L)}));return S(e,!1)},N=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=t.opts.nextStringDelay;t.queue.insert(e,[t.pause,i.before]),t.queue.insert(e+n+1,[t.pause,i.after])};this.wait=function(t,e){this.timeouts.push(setTimeout(t,e))};this.pause=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n,i){t.wait((function(){return n()}),e||t.opts.nextStringDelay.total)}))},this.reset=function(){return this.queue.reset(),new E({typeIt:n,element:this.$e,id:l,options:this.opts,queue:this.queue.waiting,isAReset:!0})},this.init=function(){var e=this;if(!this.status.started){if(!O&&t.opts.cursor&&(s("@keyframes blink-".concat(l," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(l,"'] .ti-cursor { animation: blink-").concat(l," ").concat(t.opts.cursorSpeed/1e3,"s infinite; }"),l),(L=o("span")).innerHTML=y(t.opts.cursorChar).innerHTML,L.className="ti-cursor",L.setAttribute("style","display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;"),t.$e.appendChild(L)),!this.opts.waitUntilVisible)return this.status.started=!0,this.fire();new IntersectionObserver((function(t,n){t.forEach((function(t){t.isIntersecting&&(e.fire(),n.unobserve(e.$e))}))}),{threshold:1}).observe(this.$e)}},this.fire=function(){for(var e=this,i=this.queue.waiting.slice(),r=Promise.resolve(),o=function(t){var o=i[t],u=[o,e.queue,n];r=r.then((function(){return new Promise((function(t,n){var i,r;if(e.status.frozen)return n();(e.pace=$(e.opts.speed,e.opts.deleteSpeed,e.opts.lifeLike),o[2]&&o[2].isFirst)&&(r=e.opts).beforeString.apply(r,u);(i=e.opts).beforeStep.apply(i,u),o[0].call(e,o[1],o[2]).then((function(){var n,i,r=e.queue.waiting.shift();if(o[2]&&o[2].isPhantom)return t();o[2]&&o[2].isLast&&(i=e.opts).afterString.apply(i,u);return(n=e.opts).afterStep.apply(n,u),e.queue.executed.push(r),t()}))}))}))},u=0;u<i.length;u++)o(u);r.then((function(){if(e.opts.loop){var i=e.opts.loopDelay?e.opts.loopDelay:e.opts.nextStringDelay;e.wait((function(){!function(e){t.queue.reset().delete(0).add([t.pause,e.before],!0);for(var n=0;n<b().length;n++)t.queue.add([t.delete,null,{isPhantom:!0}],!0)}(i),e.fire()}),i.after)}e.status.completed=!0,e.opts.afterComplete(n)})).catch((function(){}))},this.type=function(t){var e=this;return"object"!==j(t)||t.content?new Promise((function(n){e.wait((function(){return h(e.$e,t),n()}),e.pace[0])})):(h(this.$e,t),Promise.resolve())},this.empty=function(){var t=this;return new Promise((function(e){return O?t.$e.value="":f(t.$e.childNodes).forEach((function(t){L.isEqualNode(t)||A(t)})),e()}))},this.delete=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(n){t.wait((function(){var i=b();return i.length&&A(i[i.length-1]),M(t.$e),e&&i.length-1>0?t.delete(!0).then((function(){return n()})):n()}),t.pace[1])}))},this.setOptions=function(t){var e=this;return new Promise((function(n){return e.opts=Object.assign({},e.opts,t),n()}))};var L=null,O=a(u);this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.$e=u,this.timeouts=[],this.opts=Object.assign({},i,p),this.opts.html=!O&&this.opts.html,this.opts.nextStringDelay=D(this.opts.nextStringDelay),this.opts.loopDelay=D(this.opts.loopDelay),this.queue=new r(v,[this.pause,this.opts.startDelay]),this.$e.setAttribute("data-typeit-id",l),s("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}"),x(u,O);var P=c(this.opts.strings);P=function(e){var n=t.$e.innerHTML;return n?(t.$e.innerHTML="",t.opts.startDelete?(w(n).forEach((function(e){h(t.$e,e)})),t.queue.add([t.delete,!0]),N(1),e):[n.trim()].concat(e)):e}(P),this.opts.strings=P.map((function(t){return t.replace(/<\!--.*?-->/g,"")})),this.opts.strings.length&&!g&&t.opts.strings.forEach((function(e,n){var i=q(e,t.opts.html);t.queue.add(T(i,t.type,!0));var r=t.queue.waiting.length;if(n+1!==t.opts.strings.length){if(t.opts.breakLines)return t.queue.add([t.type,o("BR")]),void N(r);t.queue.add(T(i,t.delete)),N(r,e.length)}}))}var O=function(t,e,n){return!!t.length&&!t.some((function(t){return t.status[e]!==n}))},P=function(t){return"string"==typeof t?t=document.querySelectorAll(t):t.forEach||(t=[t]),f(t)};function C(t,e){var n=this;this.instances=P(t).map((function(t){return new E({typeIt:n,element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[],isAReset:!1})}));var i=function(t){n.instances.forEach((function(e){t.call(n,e)}))},r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;i((function(i){var o="string"!=typeof t,u=o?t:i[t],s=T(r,[u,o?n:e]);i.queue.add(s)}))};this.is=function(t){return O(this.instances,t,!0)},this.freeze=function(){i((function(t){t.status.frozen=!0}))},this.unfreeze=function(){i((function(t){t.status.frozen&&(t.status.frozen=!1,t.fire())}))},this.type=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return i((function(e){var n=q(t,e.opts.html);e.queue.add(T(n,e.type,!0))})),this},this.delete=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r("delete",null===t,null===t?1:t),this},this.pause=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return r("pause",t),this},this.break=function(){return r("type",o("BR")),this},this.options=function(t){return r("setOptions",t),this},this.exec=function(t){return r(t),this},this.destroy=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.instances=this.instances.map((function(e){if(e.timeouts.forEach((function(t){clearTimeout(t)})),e.timeouts=[],t){var n=e.isInput?null:e.$e.querySelector(".ti-cursor");n&&e.$e.removeChild(n)}return e.status.destroyed=!0,e}))},this.empty=function(){return r("empty"),this},this.reset=function(){return this.destroy(),this.instances=this.instances.map((function(t){return t.reset()})),this},this.go=function(){return i((function(t){t.init()})),this}}n.d(e,"default",(function(){return C}))}]).default}));
/*!
*
* typeit - The most versatile animated typing utility on the planet.
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.0
* URL: https://typeitjs.com
* License: GPL-2.0
* TypeIt - The most versatile animated typing utility on the planet.
* Author: Alex MacArthur <alex@macarthur.me> (https://macarthur.me)
* Version: v6.1.1
* License: GPL-2.0
* URL: https://typeitjs.com
*
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TypeIt=e():t.TypeIt=e()}(this,(function(){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(s,r,function(e){return t[e]}.bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";i.r(e);var s={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:null,html:!0,waitUntilVisible:!1,beforeString:!1,afterString:!1,beforeStep:!1,afterStep:!1,afterComplete:!1};function r(t){let e=t.getBoundingClientRect();return!(e.right>window.innerWidth||e.bottom>window.innerHeight)&&!(e.top<0||e.left<0)}function n(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))}var o=function(t,e){let i=Object(t);for(var s=1;s<arguments.length;s++){var r=arguments[s];if(null!=r)for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[n]=r[n])}return i},l=t=>["textarea","input"].indexOf(t.tagName.toLowerCase())>-1,h=t=>Array.isArray(t)?t.slice(0):t.split("<br>"),a=function(t){let{tag:e,attributes:i=[],content:s=""}=t,r=document.createElement(e);return void 0!==i&&i.forEach(t=>{r.setAttribute(t.name,t.value)}),s&&(r.innerHTML=s),r},u=t=>[].slice.call(t),p=t=>[].concat(...t),c=t=>{return(new DOMParser).parseFromString(t,"text/html").body};const d=t=>u(t.attributes).map(t=>({name:t.name,value:t.nodeValue})),f=t=>u(t.childNodes).map(t=>3===t.nodeType?t.nodeValue.split(""):t),g=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i={ancestorTree:e,attributes:d(t),content:""},s=f(t).map((i,s)=>Array.isArray(i)?i.map((i,s)=>({ancestorTree:e,attributes:d(t),content:i})):i);return s.unshift(i),p(s)},y=t=>t instanceof HTMLElement&&"BR"!==t.tagName,m=function t(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=e.map(t=>{if(y(t)){if(!i)return u(t.childNodes);let e=t.parentNode,s=[t.tagName];for(;["BODY","HTML"].indexOf(e.tagName)<0;)s.push(e.tagName),e=e.parentNode;return g(t,s)}return t});return(s=p(s)).some(t=>y(t))?t(s,i):s};function b(t){let e=c(t),i=f(e);return m(i)}var v=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")},S=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.executed=[],this.waiting=t,!t.length&&e&&this.add(e)}add(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.waiting[e?"unshift":"push"](t),this}delete(t){return this.waiting.splice(t,1),this}reset(){return this.waiting=[...this.executed,...this.waiting],this.executed=[],this}},q=t=>{t.parentNode.removeChild(t)};const w=t=>3!==t.nodeType&&("BR"!==t.tagName&&!t.firstChild),x=t=>t.some(t=>w(t));var P=t=>{let e=u(t.querySelectorAll("*")),i=x(e);for(;e.length&&i;){let s=!1;e.forEach(t=>{w(t)&&(q(t),s=!0)}),s&&(e=u(t.querySelectorAll("*"))),i=x(e)}return e};const T=(t,e)=>{let i=t.nextSibling;return!!i&&!i.isEqualNode(e)};var $=(t,e)=>{if(!t)return!1;let i=!1,s=[],r=t;for(;!i;)s.push(T(r,e)),(r=r.parentNode)&&!r.hasAttribute("data-typeit-id")||(i=!0);return!s.some(t=>t)};let D="display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;";class A{constructor(){let{typeIt:t,element:e,id:i,options:r,queue:n=[],isAReset:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.typeIt=t,this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.timeouts=[],this.id=i,this.$c=null,this.$e=e,this.isInput=l(e),this.opts=o({},s,r),this.opts.strings=h(this.opts.strings),this.opts.html=!this.isInput&&this.opts.html,this.queue=new S(n,[this.pause,this.opts.startDelay]),v(e,this.isInput),this.prepareDelay("nextStringDelay"),this.prepareDelay("loopDelay"),this.prepDOM(),this.handleHardCoded(),this.opts.strings=this.opts.strings.map(t=>t.replace(/<\!--.*?-->/g,"")),this.opts.strings.length&&!a&&this.generateQueue()}reset(){return this.queue.reset(),new A({element:this.$e,id:this.id,options:this.opts,queue:this.queue.waiting,isAReset:!0})}init(){if(this.status.started)return;if(this.cursor(),!this.opts.waitUntilVisible||r(this.$e))return this.status.started=!0,this.fire();const t=()=>{r(this.$e)&&!this.status.started&&(this.fire(),window.removeEventListener("scroll",t))};window.addEventListener("scroll",t)}fire(){let t=this.queue.waiting.slice(),e=Promise.resolve();for(let i=0;i<t.length;i++){let s=t[i],r=[s,this.queue,this.typeIt];e=e.then(()=>new Promise((t,e)=>{if(this.status.frozen)return e();this.setPace(),s[2]&&s[2].isFirst&&this.opts.beforeString&&this.opts.beforeString(...r),this.opts.beforeStep&&this.opts.beforeStep(...r),s[0].call(this,s[1],s[2]).then(()=>{let e=this.queue.waiting.shift();return s[2]&&s[2].isPhantom?t():(s[2]&&s[2].isLast&&this.opts.afterString&&this.opts.afterString(...r),this.opts.afterStep&&this.opts.afterStep(...r),this.queue.executed.push(e),t())})}))}e.then(()=>{if(this.opts.loop){let t=this.opts.loopDelay?this.opts.loopDelay:this.opts.nextStringDelay;this.wait(()=>{this.loopify(t),this.fire()},t.after)}this.status.completed=!0,this.opts.afterComplete&&this.opts.afterComplete(this.typeIt)}).catch(()=>{})}loopify(t){this.queue.reset().delete(0).add([this.pause,t.before],!0);for(let t=0;t<this.getAllChars().length;t++)this.queue.add([this.delete,null,{isPhantom:!0}],!0)}prepDOM(){this.isInput||this.$e.setAttribute("data-typeit-id",this.id)}setContents(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.isInput?this.$e.value=t:this.$e[this.opts.html?"innerHTML":"innerText"]=t}getAllChars(){let t=u(this.$e.childNodes).filter(t=>!t.isEqualNode(this.$c));return m(t,!1)}prepareDelay(t){let e=this.opts[t];if(!e)return;let i=Array.isArray(e),s=i?null:e/2;this.opts[t]={before:i?e[0]:s,after:i?e[1]:s,total:i?e[0]+e[1]:e}}generateQueue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t&&this.queue.add(t),this.opts.strings.forEach((t,e)=>{this.queueString(t);let i=this.queue.waiting.length;if(e+1!==this.opts.strings.length){if(this.opts.breakLines)return this.queue.add([this.type,document.createElement("BR")]),void this.addSplitPause(i);this.queueDeletions(t),this.addSplitPause(i,t.length)}})}queueDeletions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e="string"==typeof t?this.maybeNoderize(t).length:t;for(let t=0;t<e;t++)this.queue.add([this.delete])}maybeNoderize(t){return this.opts.html?b(t):t.split("")}queueString(t){let e=(t=this.maybeNoderize(t)).length;t.forEach((t,i)=>{let s=[this.type,t];0===i&&s.push({isFirst:!0}),i+1===e&&s.push({isLast:!0}),this.queue.add(s)})}addSplitPause(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.queue.waiting.splice(t,0,[this.pause,this.opts.nextStringDelay.before]),this.queue.waiting.splice(t+e+1,0,[this.pause,this.opts.nextStringDelay.after])}cursor(){!this.isInput&&this.opts.cursor&&(!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=document.createElement("style");i.id=e,i.appendChild(document.createTextNode(t)),document.head.appendChild(i)}("@keyframes blink-".concat(this.id," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(this.id,"'] .ti-cursor { animation: blink-").concat(this.id," ").concat(this.opts.cursorSpeed/1e3,"s infinite; }"),this.id),this.$e.insertAdjacentHTML("beforeend",'<span style="'.concat(D,'" class="ti-cursor">').concat(this.opts.cursorChar,"</span>")),this.$c=this.$e.querySelector(".ti-cursor"))}insert(t){let e=t;if(this.isInput)return void(this.$e.value="".concat(this.$e.value).concat(e));let i=this.$e;if("object"==typeof t&&!(t instanceof HTMLElement)){let s=[...t.ancestorTree].reverse().join(" "),r=u(i.querySelectorAll("".concat(s))),n=r[r.length-1];if(n&&$(n,this.$c))i=n,e=t.content;else if(e=a({tag:t.ancestorTree[0],attributes:t.attributes,content:t.content}),t.ancestorTree.length>1){let e=u(i.querySelectorAll(t.ancestorTree[1]));i=e[e.length-1]}}e="object"==typeof e?e:document.createTextNode(e),this.$c&&i.hasAttribute("data-typeit-id")?i.insertBefore(e,this.$c):i.appendChild(e)}handleHardCoded(){let t=this.$e.innerHTML;if(t){if(this.$e.innerHTML="",this.opts.startDelete)return b(t).forEach(t=>{this.insert(t)}),this.queue.add([this.delete,!0]),void this.addSplitPause(1);this.opts.strings=[...h(t.trim()),...this.opts.strings]}}wait(t,e){this.timeouts.push(setTimeout(t,e))}setPace(){let t=this.opts.speed,e=null!==this.opts.deleteSpeed?this.opts.deleteSpeed:this.opts.speed/3,i=t/2,s=e/2;this.typePace=this.opts.lifeLike?n(t,i):t,this.deletePace=this.opts.lifeLike?n(e,s):e}pause(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((e,i)=>{this.wait(()=>e(),t||this.opts.nextStringDelay.total)})}type(t){return"object"!=typeof t||t.content?new Promise((e,i)=>{this.wait(()=>(this.insert(t),e()),this.typePace)}):(this.insert(t),Promise.resolve())}empty(){return new Promise(t=>(this.setContents(""),t()))}delete(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(e=>{this.wait(()=>{let i=this.getAllChars();return i.length&&q(i[i.length-1]),P(this.$e),t&&i.length-1>0?this.delete(!0).then(()=>e()):e()},this.deletePace)})}setOptions(t){return new Promise(e=>(this.opts=o({},this.opts,t),e()))}}var N=function(t,e,i){return!!t.length&&!t.some((function(t){return t.status[e]!==i}))},C=function(t){return"string"==typeof t?t=document.querySelectorAll(t):t instanceof NodeList||(t=[t]),[].slice.call(t)};i.d(e,"default",(function(){return L}));class L{constructor(t,e){this.instances=C(t).map(t=>new A({typeIt:this,element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[]}))}each(t){this.instances.forEach(e=>{t.call(this,e)})}queueUp(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.each(s=>{let r="string"!=typeof t,n=r?t:s[t],o=r?this:e;for(let t=0;t<i;t++)s.queue.add([n,o])})}is(t){return N(this.instances,t,!0)}freeze(){this.each(t=>{t.status.frozen=!0})}unfreeze(){this.each(t=>{t.status.frozen&&(t.status.frozen=!1,t.fire())})}type(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.each(e=>e.queueString(t)),this}delete(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.queueUp("delete",null===t,null===t?1:t),this}pause(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.queueUp("pause",t),this}break(){return this.queueUp("type",document.createElement("BR")),this}options(t){return this.queueUp("setOptions",t),this}exec(t){return this.queueUp(t),this}destroy(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.each(e=>{if(e.timeouts.forEach(t=>{clearTimeout(t)}),e.timeouts=[],t){let t=e.isInput?null:e.$e.querySelector(".ti-cursor");t&&e.$e.removeChild(t)}e.status.destroyed=!0})}empty(){return this.queueUp("empty"),this}reset(){return this.destroy(),this.instances=this.instances.map(t=>t.reset()),this}go(){return this.each(t=>{t.init()}),this}}}]).default}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.TypeIt=e():t.TypeIt=e()}(this,(function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";i.r(e);var n={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:750,html:!0,waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}},s=function(){var t=this;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.insert=(t,e)=>{this.waiting.splice(t,0,e)},this.add=function(e){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(e[0])?(t.waiting=t.waiting.concat(e),t):(t.waiting[i?"unshift":"push"](e),t)},this.delete=t=>(this.waiting.splice(t,1),this),this.reset=()=>(this.waiting=this.executed.concat(this.waiting),this.executed=[],this),this.executed=[],this.waiting=e,!e.length&&i&&this.add(i)},r=t=>document.createElement(t);function o(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))}function u(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=r("style");i.id=e,i.appendChild(document.createTextNode(t)),document.head.appendChild(i)}var l=t=>["textarea","input"].indexOf(t.tagName.toLowerCase())>-1,a=t=>Array.isArray(t)?t:[t],h=t=>[].slice.call(t);const c=(t,e)=>{let i=t.nextSibling;return!!i&&!i.isEqualNode(e)};var p=(t,e)=>{let i=e;if(l(t))return void(t.value="".concat(t.value).concat(i));let n=h(t.childNodes).filter(t=>t.classList&&t.classList.contains("ti-cursor"));if(n=n.length?n[0]:null,"object"==typeof e&&!(e instanceof HTMLElement)){let s=e.ancestorTree.slice(0).reverse().join(" "),o=h(t.querySelectorAll("".concat(s))),u=o[o.length-1];if(u&&((t,e)=>{if(!t)return!1;let i=!1,n=[],s=t;for(;!i;)n.push(c(s,e)),(s=s.parentNode)&&!s.hasAttribute("data-typeit-id")||(i=!0);return!n.some(t=>t)})(u,n))t=u,i=e.content;else if(i=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r(t);return e.forEach(t=>{n.setAttribute(t.name,t.value)}),n.innerHTML=i,n}(e.ancestorTree[0],e.attributes,e.content),e.ancestorTree.length>1){let i=h(t.querySelectorAll(e.ancestorTree[1]));t=i[i.length-1]}}i="object"==typeof i?i:document.createTextNode(i),t.insertBefore(i,n&&t.hasAttribute("data-typeit-id")?n:null)},d=t=>{let e=[];return e.concat.apply(e,t)},f=t=>{let e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body};const y=t=>h(t.attributes).map(t=>({name:t.name,value:t.nodeValue})),g=t=>h(t.childNodes).map(t=>3===t.nodeType?t.nodeValue.split(""):t),m=(t,e,i)=>({ancestorTree:e,attributes:y(t),content:i}),b=(t,e)=>{let i=m(t,e,""),n=g(t).map((i,n)=>Array.isArray(i)?i.map((i,n)=>m(t,e,i)):i);return n.unshift(i),d(n)},v=t=>t instanceof HTMLElement&&"BR"!==t.tagName,w=function t(e){let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.map(t=>{if(v(t)){if(!i)return h(t.childNodes);let e=t.parentNode,n=[t.tagName];for(;["BODY","HTML"].indexOf(e.tagName)<0;)n.push(e.tagName),e=e.parentNode;return b(t,n)}return t});return(n=d(n)).some(t=>v(t))?t(n,i):n};function S(t){let e=f(t),i=g(e);return w(i)}function q(t){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?S(t):t.split("")}var x=(t,e)=>{e?t.value="":t.querySelector(".ti-cursor")&&(t.innerHTML="")},T=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!Array.isArray(t),s=t.length;return(t=n?new Array(t).fill(0):t).map((t,r)=>{if(n)return e;let o=[e,t];return i&&(0===r&&o.push({isFirst:!0}),r+1===s&&o.push({isLast:!0})),o})},A=t=>{t.parentNode.removeChild(t)};const N=t=>3!==t.nodeType&&"BR"!==t.tagName&&!t.firstChild,L=t=>t.some(t=>N(t));var M=t=>{let e=h(t.querySelectorAll("*")),i=L(e);for(;e.length&&i;){let n=!1;e.forEach(t=>{N(t)&&(A(t),n=!0)}),n&&(e=h(t.querySelectorAll("*"))),i=L(e)}return e},D=t=>(Array.isArray(t)||(t=[t/2,t/2]),{before:t[0],after:t[1],total:t[0]+t[1]}),$=function(t,e,i){let n=(e=null!==e?e:t/3)/2;return i?[o(t,t/2),o(e,n)]:[t,e]};function j(){var t=this;let{typeIt:e,element:i,id:o,options:c,queue:d=[],isAReset:y=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const g=()=>{let t=h(this.$e.childNodes).filter(t=>!t.isEqualNode(L));return w(t,!1)},m=function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=t.opts.nextStringDelay;t.queue.insert(e,[t.pause,n.before]),t.queue.insert(e+i+1,[t.pause,n.after])},b=()=>{!E&&this.opts.cursor&&(u("@keyframes blink-".concat(o," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} }[data-typeit-id='").concat(o,"'] .ti-cursor { animation: blink-").concat(o," ").concat(this.opts.cursorSpeed/1e3,"s infinite; }"),o),(L=r("span")).innerHTML=f(this.opts.cursorChar).innerHTML,L.className="ti-cursor",L.setAttribute("style","display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;"),this.$e.appendChild(L))};this.wait=function(t,e){this.timeouts.push(setTimeout(t,e))};const v=()=>{this.opts.strings.forEach((t,e)=>{let i=q(t,this.opts.html);this.queue.add(T(i,this.type,!0));let n=this.queue.waiting.length;if(e+1!==this.opts.strings.length){if(this.opts.breakLines)return this.queue.add([this.type,r("BR")]),void m(n);this.queue.add(T(i,this.delete)),m(n,t.length)}})},N=t=>{this.queue.reset().delete(0).add([this.pause,t.before],!0);for(let t=0;t<g().length;t++)this.queue.add([this.delete,null,{isPhantom:!0}],!0)};this.pause=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((e,i)=>{this.wait(()=>e(),t||this.opts.nextStringDelay.total)})},this.reset=function(){return this.queue.reset(),new j({typeIt:e,element:this.$e,id:o,options:this.opts,queue:this.queue.waiting,isAReset:!0})},this.init=function(){if(this.status.started)return;if(b(),!this.opts.waitUntilVisible)return this.status.started=!0,this.fire();new IntersectionObserver((t,e)=>{t.forEach(t=>{t.isIntersecting&&(this.fire(),e.unobserve(this.$e))})},{threshold:1}).observe(this.$e)},this.fire=function(){let t=this.queue.waiting.slice(),i=Promise.resolve();for(let n=0;n<t.length;n++){let s=t[n],r=[s,this.queue,e];i=i.then(()=>new Promise((t,e)=>{if(this.status.frozen)return e();this.pace=$(this.opts.speed,this.opts.deleteSpeed,this.opts.lifeLike),s[2]&&s[2].isFirst&&this.opts.beforeString(...r),this.opts.beforeStep(...r),s[0].call(this,s[1],s[2]).then(()=>{let e=this.queue.waiting.shift();return s[2]&&s[2].isPhantom?t():(s[2]&&s[2].isLast&&this.opts.afterString(...r),this.opts.afterStep(...r),this.queue.executed.push(e),t())})}))}i.then(()=>{if(this.opts.loop){let t=this.opts.loopDelay?this.opts.loopDelay:this.opts.nextStringDelay;this.wait(()=>{N(t),this.fire()},t.after)}this.status.completed=!0,this.opts.afterComplete(e)}).catch(()=>{})},this.type=function(t){return"object"!=typeof t||t.content?new Promise(e=>{this.wait(()=>(p(this.$e,t),e()),this.pace[0])}):(p(this.$e,t),Promise.resolve())},this.empty=function(){return new Promise(t=>(E?this.$e.value="":h(this.$e.childNodes).forEach(t=>{L.isEqualNode(t)||A(t)}),t()))},this.delete=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(e=>{this.wait(()=>{let i=g();return i.length&&A(i[i.length-1]),M(this.$e),t&&i.length-1>0?this.delete(!0).then(()=>e()):e()},this.pace[1])})},this.setOptions=function(t){return new Promise(e=>(this.opts=Object.assign({},this.opts,t),e()))};let L=null,E=l(i);this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.$e=i,this.timeouts=[],this.opts=Object.assign({},n,c),this.opts.html=!E&&this.opts.html,this.opts.nextStringDelay=D(this.opts.nextStringDelay),this.opts.loopDelay=D(this.opts.loopDelay),this.queue=new s(d,[this.pause,this.opts.startDelay]),this.$e.setAttribute("data-typeit-id",o),u("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}"),x(i,E);let O=a(this.opts.strings);O=(t=>{let e=this.$e.innerHTML;return e?(this.$e.innerHTML="",this.opts.startDelete?(S(e).forEach(t=>{p(this.$e,t)}),this.queue.add([this.delete,!0]),m(1),t):[e.trim()].concat(t)):t})(O),this.opts.strings=O.map(t=>t.replace(/<\!--.*?-->/g,"")),this.opts.strings.length&&!y&&v()}var E=function(t,e,i){return!!t.length&&!t.some((function(t){return t.status[e]!==i}))},O=function(t){return"string"==typeof t?t=document.querySelectorAll(t):t.forEach||(t=[t]),h(t)};function P(t,e){var i=this;this.instances=O(t).map(t=>new j({typeIt:this,element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[],isAReset:!1}));const n=t=>{this.instances.forEach(e=>{t.call(this,e)})},s=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;n(n=>{let r="string"!=typeof t,o=r?t:n[t],u=T(s,[o,r?i:e]);n.queue.add(u)})};this.is=function(t){return E(this.instances,t,!0)},this.freeze=function(){n(t=>{t.status.frozen=!0})},this.unfreeze=function(){n(t=>{t.status.frozen&&(t.status.frozen=!1,t.fire())})},this.type=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return n(e=>{let i=q(t,e.opts.html);e.queue.add(T(i,e.type,!0))}),this},this.delete=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return s("delete",null===t,null===t?1:t),this},this.pause=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return s("pause",t),this},this.break=function(){return s("type",r("BR")),this},this.options=function(t){return s("setOptions",t),this},this.exec=function(t){return s(t),this},this.destroy=function(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.instances=this.instances.map(e=>{if(e.timeouts.forEach(t=>{clearTimeout(t)}),e.timeouts=[],t){let t=e.isInput?null:e.$e.querySelector(".ti-cursor");t&&e.$e.removeChild(t)}return e.status.destroyed=!0,e})},this.empty=function(){return s("empty"),this},this.reset=function(){return this.destroy(),this.instances=this.instances.map(t=>t.reset()),this},this.go=function(){return n(t=>{t.init()}),this}}i.d(e,"default",(function(){return P}))}]).default}));
{
"name": "typeit",
"version": "6.1.0",
"version": "6.1.1",
"description": "The most versatile animated typing utility on the planet.",

@@ -5,0 +5,0 @@ "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",

@@ -47,2 +47,17 @@ # TypeIt

## Browser Support
Bundles exist for browsers that support ES2015+ (which accounts for a [very strong majority](https://caniuse.com/#feat=es6-class) of users), as well as for those that do not. If you're using IE11 or older, you'll also need the following polyfills:
- `Array.prototype.fill`
- `IntersectionObserver`
- `Object.assign`
- `Promise`
You can load all of these yourself, or just use the following pre-made bundle from [Polyfill.io](https://polyfill.io):
```html
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.fill%2CIntersectionObserver%2CObject.assign%2CPromise"></script>
```
## Contribute

@@ -49,0 +64,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc