Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

glitched-writer

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glitched-writer - npm Package Compare versions

Comparing version 2.0.21 to 2.0.22

1

lib/cjs/char.js

@@ -169,2 +169,1 @@ "use strict";

}
//# sourceMappingURL=char.js.map

@@ -40,2 +40,1 @@ "use strict";

exports.default = default_1;
//# sourceMappingURL=emiter.js.map

13

lib/cjs/index.js

@@ -15,3 +15,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.wait = exports.glyphs = exports.presets = exports.glitchWrite = void 0;
exports.wait = exports.glyphs = exports.presets = exports.create = exports.glitchWrite = void 0;
// eslint-disable-next-line import/no-extraneous-dependencies

@@ -332,2 +332,11 @@ const options_1 = __importDefault(require("./options"));

exports.glitchWrite = glitchWrite;
//# sourceMappingURL=index.js.map
/**
* A way to create new Writer without having to rely on defult export.
* @param htmlElement HTML Element OR a Selector string (eg. '.text')
* @param options Options object (eg. { html: true, ... }) OR preset name (eg. 'zalgo').
* @param onStepCallback Callback, that will be triggered on every step. Params passed: string & writer data.
* @param onFinishCallback Callback, that will be triggered when each writing finishes. Params passed: string & writer data.
* @returns GlitchedWriter Class Instance
*/
const create = (htmlElement, options, onStepCallback, onFinishCallback) => new GlitchedWriter(htmlElement, options, onStepCallback, onFinishCallback);
exports.create = create;

@@ -72,2 +72,1 @@ "use strict";

exports.default = Options;
//# sourceMappingURL=options.js.map

@@ -43,9 +43,9 @@ "use strict";

typewriter: {
interval: [40, 100],
initialDelay: [0, 0],
steps: [0, 1],
changeChance: 1,
interval: [50, 150],
initialDelay: 0,
steps: 0,
changeChance: 0,
maxGhosts: 0,
glyphs: '',
glyphsFromString: true,
glyphsFromString: false,
oneAtATime: true,

@@ -102,2 +102,1 @@ fillSpace: false,

};
//# sourceMappingURL=presets.js.map

@@ -41,2 +41,1 @@ "use strict";

exports.default = State;
//# sourceMappingURL=state.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

@@ -134,2 +134,1 @@ "use strict";

exports.trim = trim;
//# sourceMappingURL=utils.js.map

@@ -166,2 +166,1 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
//# sourceMappingURL=char.js.map

@@ -37,2 +37,1 @@ import { filterHtml } from './utils';

}
//# sourceMappingURL=emiter.js.map

@@ -85,2 +85,11 @@ import Options from './options';

export declare function glitchWrite(string: string, htmlElement?: HTMLElement | Element | null | string, options?: ConstructorOptions | PresetName | null, onStepCallback?: Callback, onFinishCallback?: Callback): Promise<WriterDataResponse>;
/**
* A way to create new Writer without having to rely on defult export.
* @param htmlElement HTML Element OR a Selector string (eg. '.text')
* @param options Options object (eg. { html: true, ... }) OR preset name (eg. 'zalgo').
* @param onStepCallback Callback, that will be triggered on every step. Params passed: string & writer data.
* @param onFinishCallback Callback, that will be triggered when each writing finishes. Params passed: string & writer data.
* @returns GlitchedWriter Class Instance
*/
export declare const create: (htmlElement?: string | Element | HTMLElement | null | undefined, options?: "default" | "encrypted" | ConstructorOptions | "nier" | "typewriter" | "terminal" | "zalgo" | "neo" | null | undefined, onStepCallback?: Callback | undefined, onFinishCallback?: Callback | undefined) => GlitchedWriter;
export { presets, glyphs, wait, ConstructorOptions, WriterDataResponse, Callback, };

@@ -320,3 +320,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
/**
* A way to create new Writer without having to rely on defult export.
* @param htmlElement HTML Element OR a Selector string (eg. '.text')
* @param options Options object (eg. { html: true, ... }) OR preset name (eg. 'zalgo').
* @param onStepCallback Callback, that will be triggered on every step. Params passed: string & writer data.
* @param onFinishCallback Callback, that will be triggered when each writing finishes. Params passed: string & writer data.
* @returns GlitchedWriter Class Instance
*/
export const create = (htmlElement, options, onStepCallback, onFinishCallback) => new GlitchedWriter(htmlElement, options, onStepCallback, onFinishCallback);
export { presets, glyphs, wait, };
//# sourceMappingURL=index.js.map

@@ -69,2 +69,1 @@ // eslint-disable-next-line import/no-extraneous-dependencies

}
//# sourceMappingURL=options.js.map

@@ -40,9 +40,9 @@ export const glyphs = {

typewriter: {
interval: [40, 100],
initialDelay: [0, 0],
steps: [0, 1],
changeChance: 1,
interval: [50, 150],
initialDelay: 0,
steps: 0,
changeChance: 0,
maxGhosts: 0,
glyphs: '',
glyphsFromString: true,
glyphsFromString: false,
oneAtATime: true,

@@ -99,2 +99,1 @@ fillSpace: false,

};
//# sourceMappingURL=presets.js.map

@@ -38,2 +38,1 @@ import { animateWithClass } from './utils';

}
//# sourceMappingURL=state.js.map
export {};
//# sourceMappingURL=types.js.map

@@ -112,2 +112,1 @@ /* eslint-disable no-unused-vars */

}
//# sourceMappingURL=utils.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["glitched-writer"]=e():t["glitched-writer"]=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function s(t,e,s){const i=Math.random()*(e-t)+t;if(s)switch(s){case"floor":return Math.floor(i);case"round":return Math.round(i);case"ceil":return Math.ceil(i)}return i}t.r(e),t.d(e,{default:()=>E,glitchWrite:()=>S,glyphs:()=>p,presets:()=>d,wait:()=>n});const i=t=>t.splice(s(0,t.length,"floor"),1).length>0,n=t=>new Promise((e=>setTimeout((()=>e(t)),t)));function r(t,e){const s=()=>t()?e().then(s):Promise.resolve();return s()}const h=(t,e)=>new Array(e).fill(t);function o(t,e=!0){return"number"==typeof t?t:s(...t,e?"round":void 0)}const l=(t=.5)=>Math.random()<t,a=t=>({value:t}),c=t=>[...t].map(a),g="(&(?:[a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});)|(<style.+?>.+?</style>|<script.+?>.+?<\/script>|<(?:!|/?[a-zA-Z]+).*?/?>)";function u(t){const e=new RegExp(g,"g");return t.replace(e,"")}const p={nier:"一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何",full:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơư一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何ĂÂÊÔƠƯăâêôơư1234567890‘?’“!”(%)[#]{@}/\\&<-+÷×=>$€£¥¢:;,.*•°·…±†‡æ«»¦¯—–~˜¨_øÞ¿▬▭▮▯┐└╛░▒▓○‼⁇⁈⁉‽ℴℵℶℷℸℲ℮ℯ⅁⅂⅃⅄₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₶₷₸₹₺₻₼₽₾₿ ",letterlike:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơưĂÂÊÔƠƯăâêôơư1234567890",zalgo:"̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚ͅ ͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ͘͜͟͢͝͞͠͡͏҉",neo:"!<>-_\\/[]{}—=+*^?#________",uppercase:"1234567890QWERTYUIOPASDFGHJKLZXCVBNM#$%"},d={default:{steps:[1,8],interval:[60,170],initialDelay:[0,2e3],changeChance:.6,ghostChance:.2,maxGhosts:.2,glyphs:p.full+p.zalgo,glyphsFromString:!1,oneAtATime:0,html:!1,fillSpace:!0,letterize:!1,endless:!1,startFrom:"matching"},nier:{maxGhosts:0,ghostChance:0,changeChance:.8,steps:2,interval:10,initialDelay:0,glyphs:p.nier,oneAtATime:!0,fillSpace:!1,startFrom:"erase",glyphsFromString:!0},typewriter:{interval:[40,100],initialDelay:[0,0],steps:[0,1],changeChance:1,maxGhosts:0,glyphs:"",glyphsFromString:!0,oneAtATime:!0,fillSpace:!1,startFrom:"erase"},terminal:{interval:[25,30],initialDelay:[0,0],steps:0,changeChance:.5,maxGhosts:0,glyphs:"",oneAtATime:!0,fillSpace:!1,glyphsFromString:!1,startFrom:"erase"},zalgo:{initialDelay:[0,3e3],interval:[10,35],steps:[0,30],maxGhosts:4.6,changeChance:.5,ghostChance:.7,glyphs:p.zalgo,glyphsFromString:!0,fillSpace:!1},neo:{glyphs:p.neo,maxGhosts:0,ghostChance:0,changeChance:1,interval:[30,100],initialDelay:[0,1300],steps:[4,7],startFrom:"previous",letterize:!0},encrypted:{glyphs:p.uppercase,maxGhosts:0,ghostChance:0,changeChance:1,interval:[50,90],initialDelay:[0,1300],steps:[5,8],startFrom:"previous",fillSpace:!1,letterize:!0}};class f{constructor(t,e){var s,i,n,r,h,o,l,a,c,g,u,p,f;this.steps=null!==(s=e.steps)&&void 0!==s?s:d.default.steps,this.interval=null!==(i=e.interval)&&void 0!==i?i:d.default.interval,this.initialDelay=null!==(n=e.initialDelay)&&void 0!==n?n:d.default.initialDelay,this.changeChance=null!==(r=e.changeChance)&&void 0!==r?r:d.default.changeChance,this.ghostChance=null!==(h=e.ghostChance)&&void 0!==h?h:d.default.ghostChance,this.maxGhosts=null!==(o=e.maxGhosts)&&void 0!==o?o:d.default.maxGhosts,this.glyphs=null!==(l=e.glyphs)&&void 0!==l?l:d.default.glyphs,this.glyphsFromString=null!==(a=e.glyphsFromString)&&void 0!==a?a:d.default.glyphsFromString,Number.isInteger(e.oneAtATime)?this.oneAtATime=e.oneAtATime:this.oneAtATime=e.oneAtATime?1:0,this.html=null!==(c=e.html)&&void 0!==c?c:d.default.html,this.letterize=null!==(g=e.letterize)&&void 0!==g?g:d.default.letterize,"undefined"==typeof document&&(this.letterize=!1),this.endless=null!==(u=e.endless)&&void 0!==u?u:d.default.endless,this.startFrom=null!==(p=e.startFrom)&&void 0!==p?p:d.default.startFrom,this.writer=t,this.fillSpace=null!==(f=e.fillSpace)&&void 0!==f?f:d.default.fillSpace}set glyphs(t){this.glyphsString=function(t){let e;return e="string"==typeof t?t:t.length?t.join(""):Array.from(t).join(""),e}(t),this.setCharset()}set fillSpace(t){this.space=t?" ":""}get stepsLeft(){return o(this.steps)}get genInterval(){return o(this.interval)}get genInitDelay(){return o(this.initialDelay)}get genMaxGhosts(){if(Number.isInteger(this.maxGhosts))return this.maxGhosts;let t;return t=this.writer.options.html?u(this.writer.goalString).length:this.writer.goalString.length,Math.round((t||20)*this.maxGhosts)}get ghost(){var t,e;return null!==(t=(e=this.ghostCharset)[s(0,e.length,"floor")])&&void 0!==t?t:""}setCharset(){let t=this.glyphsString;this.glyphsFromString&&(t+=function(t){const e="string"==typeof t,s=[];return new Set(t).forEach((t=>s.push(t))),e?s.join(""):s}(this.writer.previousString+(this.writer.options.html?u(this.writer.goalString):this.writer.goalString))),this.ghostCharset=[...t].filter((t=>!["\t","\n","\r","\f","\v"].includes(t)))}}class m{constructor(t){this.nGhosts=0,this.isTyping=!1,this.isPaused=!1,this.finished=!1,this.writer=t,this.maxGhosts=this.writer.options.genMaxGhosts}get ghostsInLimit(){return this.nGhosts<this.maxGhosts}play(){this.isTyping=!0,this.isPaused=!1,this.finished=!1,this.toggleClass(!0),this.maxGhosts=this.writer.options.genMaxGhosts}pause(){this.isTyping=!1,this.isPaused=!0,this.toggleClass(!1)}finish(){this.isTyping=!1,this.finished=!0,this.toggleClass(!1)}toggleClass(t){const e=this.writer.htmlElement,s="gw-writing";e&&(t?((t,e)=>{t.classList.remove(e),t.offsetWidth,t.classList.add(e)})(e,s):e.classList.remove(s))}}var v=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function h(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class y{constructor(t,e,s,i="",n=!1){this.ghostsBefore=[],this.ghostsAfter=[],this.stop=!1,this.isTag=!1,this.isWhitespace=!1,this.afterGlitchChance=0,this.writer=t,this.setProps(e,s,i,n),t.options.letterize&&(this.els={ghostsBeforeEl:document.createElement("span"),letterEl:document.createElement("span"),ghostsAfterEl:document.createElement("span")},this.els.ghostsBeforeEl.className="gw-ghosts",this.els.ghostsAfterEl.className="gw-ghosts",this.els.letterEl.className="gw-letter")}setProps(t,e,s="",i=!1){const{options:n}=this.writer;this.l=t,this.gl=e,this.isTag=i,this.ghostsBefore=[...s],this.writer.state.nGhosts+=s.length,this.stepsLeft=n.stepsLeft,i&&(this.stepsLeft=0),this.isWhitespace=(t=>["\t","\n","\r","\f","\v",""," "].includes(t))(e),this.afterGlitchChance=(n.ghostChance+n.changeChance)/3.7}reset(t,e,s="",i=!1){this.setProps(t,e,s,i),this.els&&(this.els.letterEl.className="gw-letter")}get string(){const{l:t,ghostsAfter:e,ghostsBefore:s}=this;return s.join("")+t+e.join("")}get finished(){const{l:t,gl:e,ghostsBefore:s,ghostsAfter:i}=this;return t===e&&0===s.length&&0===i.length||this.isTag}get interval(){let t=this.writer.options.genInterval;return this.isWhitespace&&(t/=2),t}writeToElement(){if(!this.els)return;const{ghostsBeforeEl:t,ghostsAfterEl:e,letterEl:s}=this.els;s.innerHTML=this.l,t.textContent=this.ghostsBefore.join(""),e.textContent=this.ghostsAfter.join("")}set spanElement(t){this.els&&(this.els.charEl=t,this.appendChildren())}appendChildren(){var t,e;null===(e=null===(t=this.els)||void 0===t?void 0:t.charEl)||void 0===e||e.append(this.els.ghostsBeforeEl,this.els.letterEl,this.els.ghostsAfterEl),this.writeToElement()}type(){var t,e,s;return v(this,void 0,void 0,(function*(){const{writer:i}=this;return this.isTag?(this.l=this.gl,i.emiter.call("step"),!0):(yield n(i.options.genInitDelay),yield r((()=>(!this.finished||i.options.endless)&&!i.state.isPaused&&!this.stop),(()=>v(this,void 0,void 0,(function*(){yield n(this.interval);const t=this.string;this.step(),t!==this.string&&(i.emiter.call("step"),this.writeToElement()),!i.options.endless&&this.stepsLeft--})))),this.finished&&(null===(e=null===(t=this.els)||void 0===t?void 0:t.charEl)||void 0===e||e.classList.add("gw-finished"),null===(s=this.els)||void 0===s||s.letterEl.classList.remove("gw-glitched")),this.finished)}))}step(){var t,e;const{writer:s}=this;if(this.stepsLeft>0&&this.l!==this.gl||l(this.afterGlitchChance)&&!this.isWhitespace||s.options.endless){const{ghostChance:e,changeChance:i}=s.options;l(e)&&(s.state.ghostsInLimit?this.addGhost():this.removeGhost()),l(i)&&(null===(t=this.els)||void 0===t||t.letterEl.classList.add("gw-glitched"),this.l=s.options.ghost)}else this.finished||(null===(e=this.els)||void 0===e||e.letterEl.classList.remove("gw-glitched"),this.l=this.gl,this.removeGhost())}addGhost(){const t=this.writer.options.ghost;this.writer.state.nGhosts++,l()?w(this.ghostsBefore,t):w(this.ghostsAfter,t)}removeGhost(){(l()&&this.ghostsBefore.length>0?i(this.ghostsBefore):i(this.ghostsAfter))&&this.writer.state.nGhosts--}}function w(t,e){const{length:i}=t;t.splice(s(0,i,"floor"),0,e)}var C=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function h(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class E{constructor(t,e,s,i){var n;this.charTable=[],this.goalString="",this.string="",this.htmlElement="string"==typeof t?null!==(n=document.querySelector(t))&&void 0!==n?n:void 0:null!=t?t:void 0,this.htmlElement&&(this.htmlElement.$writer=this),"string"==typeof e?this.preset=e:this.setOptions(null!=e?e:{}),this.state=new m(this),this.emiter=new class{constructor(t,e,s){this.onStepCallback=e,this.onFinishCallback=s,this.writer=t}call(t){var e,s;this.writer.updateString();const{htmlElement:i,writerData:n,string:r}=this.writer;i&&!this.writer.options.letterize&&(this.writer.options.html?i.innerHTML=r:i.textContent=r),null==i||i.setAttribute("data-gw-string",this.writer.options.html?u(r):r),"finish"===t?(this.writer.state.finish(),null===(e=this.onFinishCallback)||void 0===e||e.call(this,r,n),this.emitEvent()):null===(s=this.onStepCallback)||void 0===s||s.call(this,r,n)}emitEvent(){const{htmlElement:t,writerData:e}=this.writer;t&&"undefined"!=typeof CustomEvent&&(null==t||t.dispatchEvent(new CustomEvent("gw-finished",{detail:e})))}}(this,s,i),this.string=this.previousString}extendOptions(t){this.setOptions(Object.assign(Object.assign({},this.options),t))}setOptions(t){this.options=new f(this,t)}set preset(t){this.options=new f(this,d[t])}updateString(){this.string=this.charTable.map((t=>t.string)).join("")}get previousString(){var t;let e=null===(t=this.htmlElement)||void 0===t?void 0:t.textContent;return"string"!=typeof e&&(e=this.options.html?u(this.string):this.string),e=e.trim(),e}get writerData(){const{options:t,state:e,string:s}=this;return{string:s,writer:this,options:t,state:e}}write(t,e){return C(this,void 0,void 0,(function*(){return"erase"!==this.options.startFrom||(null==e?void 0:e.erase)||(yield this.write(this.genGoalStringToErase(t),{erase:!0})),this.goalString=t,this.state.nGhosts=0,this.options.setCharset(),"matching"===this.options.startFrom?this.createMatchingCharTable():this.createPreviousCharTable(),this.letterize(),this.pause(),this.play({reverse:0!==this.options.oneAtATime&&(null==e?void 0:e.erase)})}))}add(t){return C(this,void 0,void 0,(function*(){const{previousString:e}=this;return this.write(e+t)}))}remove(t){return C(this,void 0,void 0,(function*(){const{previousString:e}=this,s=Array.from(e);return s.splice(-t),this.write(s.join(""),{erase:!0})}))}play(t){var e;return C(this,void 0,void 0,(function*(){const s=[],{charTable:i}=this;if(this.state.isTyping)return this.getWriterData("ERROR",`The writer is already typing "${this.goalString}".`);if(this.state.play(),this.options.oneAtATime>0){const n=null!==(e=null==t?void 0:t.reverse)&&void 0!==e&&e?[...i]:[...i].reverse(),h=()=>C(this,void 0,void 0,(function*(){let t=!0,e=!1;return yield r((()=>!e&&t&&!this.state.isPaused),(()=>C(this,void 0,void 0,(function*(){var s;const i=n.pop();i?t=null!==(s=yield i.type())&&void 0!==s&&s:e=!0})))),t}));for(let t=0;t<this.options.oneAtATime;t++)s.push(h())}else i.forEach((t=>s.push(t.type())));try{const t=(yield Promise.all(s)).every((t=>t));return this.returnResult(t)}catch(t){return this.getWriterData("ERROR","Writer encountered an error.",t)}}))}pause(){this.state.pause()}returnResult(t){return t?this.emiter.call("finish"):this.emiter.call("step"),t?this.getWriterData("SUCCESS","The writer finished typing."):this.getWriterData("ERROR","Writer failed to finish typing.")}createMatchingCharTable(){const{goalStringArray:t,previousString:e}=this,s=Math.min(Math.ceil(this.options.genMaxGhosts/2),5);let i=-1;t.forEach(((t,n)=>{if(i++,"tag"===t.type)return i--,void this.setChar(n,"",t);const r=""!==t.value?e.indexOf(t.value,i):-1;if(-1!==r&&r-i<=s){const s=e.substring(i,r);this.setChar(n,t.value,t,s),i=r}else this.setChar(n,e[i],t)})),this.removeExtraChars(t.length)}createPreviousCharTable(){const{goalStringArray:t,previousString:e}=this;let s=-1;t.forEach(((t,i)=>{if(s++,"tag"===t.type)return s--,void this.setChar(i,"",t);this.setChar(i,e[s],t)})),this.removeExtraChars(t.length)}letterize(){if(!this.options.letterize||!this.htmlElement)return;const t=this.charTable.map((({isTag:t,gl:e})=>t?e:'<span class="gw-char"></span>')).join("");this.htmlElement.innerHTML=t;const e=this.htmlElement.querySelectorAll("span.gw-char");let s=0;this.charTable.forEach((t=>{t.isTag||(t.spanElement=e[s],s++)}))}removeExtraChars(t){const{charTable:e}=this;e.splice(t,e.length-t)}setChar(t,e,s,i){const{charTable:n}=this,r=n[t];r?r.reset(null!=e?e:"",s.value||this.options.space,i,"tag"===s.type):n.push(new y(this,null!=e?e:"",s.value||this.options.space,i,"tag"===s.type))}get goalStringArray(){const{goalString:t,options:e,previousString:s}=this,i=e.html?function(t){const e=new RegExp(g,"gi"),s=[];let i,n=0;for(;i=e.exec(t);){const r=i.index,h=e.lastIndex,o=t.slice(n,r);n=h,o&&s.push(...c(o));const l={value:i[0],type:void 0!==i[1]?"html_entity":"tag"};s.push(l)}return t.length>n&&s.push(...c(t.slice(n))),s}(t):c(t),n=Math.max(0,s.length-i.length);if(this.options.oneAtATime)return i.concat(c(h("",n)));const r=Math.ceil(n/2),o=Math.floor(n/2);return c(h("",r)).concat(i,c(h("",o)))}getWriterData(t,e,s){const{writerData:i}=this;return Object.assign(Object.assign({},i),{status:t,message:e,error:s})}genGoalStringToErase(t){var e;const{previousString:s}=this;let i="";for(let n=0;n<t.length;n++){const r=t[n],h=null!==(e=s[n])&&void 0!==e?e:"";if(r!==h)break;i+=h}const n=Math.max(t.length-i.length,0);return n>0&&" "===this.options.space&&(i=i.padEnd(n+i.length," ")),i}}function S(t,e,s,i,n){return C(this,void 0,void 0,(function*(){return new E(e,s,i,n).write(t)}))}return e})()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GlitchedWriter=e():t.GlitchedWriter=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function s(t,e,s){const i=Math.random()*(e-t)+t;if(s)switch(s){case"floor":return Math.floor(i);case"round":return Math.round(i);case"ceil":return Math.ceil(i)}return i}t.r(e),t.d(e,{create:()=>T,default:()=>E,glitchWrite:()=>S,glyphs:()=>p,presets:()=>d,wait:()=>n});const i=t=>t.splice(s(0,t.length,"floor"),1).length>0,n=t=>new Promise((e=>setTimeout((()=>e(t)),t)));function r(t,e){const s=()=>t()?e().then(s):Promise.resolve();return s()}const h=(t,e)=>new Array(e).fill(t);function o(t,e=!0){return"number"==typeof t?t:s(...t,e?"round":void 0)}const l=(t=.5)=>Math.random()<t,a=t=>({value:t}),c=t=>[...t].map(a),g="(&(?:[a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});)|(<style.+?>.+?</style>|<script.+?>.+?<\/script>|<(?:!|/?[a-zA-Z]+).*?/?>)";function u(t){const e=new RegExp(g,"g");return t.replace(e,"")}const p={nier:"一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何",full:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơư一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何ĂÂÊÔƠƯăâêôơư1234567890‘?’“!”(%)[#]{@}/\\&<-+÷×=>$€£¥¢:;,.*•°·…±†‡æ«»¦¯—–~˜¨_øÞ¿▬▭▮▯┐└╛░▒▓○‼⁇⁈⁉‽ℴℵℶℷℸℲ℮ℯ⅁⅂⅃⅄₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₶₷₸₹₺₻₼₽₾₿ ",letterlike:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơưĂÂÊÔƠƯăâêôơư1234567890",zalgo:"̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚ͅ ͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ͘͜͟͢͝͞͠͡͏҉",neo:"!<>-_\\/[]{}—=+*^?#________",uppercase:"1234567890QWERTYUIOPASDFGHJKLZXCVBNM#$%"},d={default:{steps:[1,8],interval:[60,170],initialDelay:[0,2e3],changeChance:.6,ghostChance:.2,maxGhosts:.2,glyphs:p.full+p.zalgo,glyphsFromString:!1,oneAtATime:0,html:!1,fillSpace:!0,letterize:!1,endless:!1,startFrom:"matching"},nier:{maxGhosts:0,ghostChance:0,changeChance:.8,steps:2,interval:10,initialDelay:0,glyphs:p.nier,oneAtATime:!0,fillSpace:!1,startFrom:"erase",glyphsFromString:!0},typewriter:{interval:[50,150],initialDelay:0,steps:0,changeChance:0,maxGhosts:0,glyphs:"",glyphsFromString:!1,oneAtATime:!0,fillSpace:!1,startFrom:"erase"},terminal:{interval:[25,30],initialDelay:[0,0],steps:0,changeChance:.5,maxGhosts:0,glyphs:"",oneAtATime:!0,fillSpace:!1,glyphsFromString:!1,startFrom:"erase"},zalgo:{initialDelay:[0,3e3],interval:[10,35],steps:[0,30],maxGhosts:4.6,changeChance:.5,ghostChance:.7,glyphs:p.zalgo,glyphsFromString:!0,fillSpace:!1},neo:{glyphs:p.neo,maxGhosts:0,ghostChance:0,changeChance:1,interval:[30,100],initialDelay:[0,1300],steps:[4,7],startFrom:"previous",letterize:!0},encrypted:{glyphs:p.uppercase,maxGhosts:0,ghostChance:0,changeChance:1,interval:[50,90],initialDelay:[0,1300],steps:[5,8],startFrom:"previous",fillSpace:!1,letterize:!0}};class f{constructor(t,e){var s,i,n,r,h,o,l,a,c,g,u,p,f;this.steps=null!==(s=e.steps)&&void 0!==s?s:d.default.steps,this.interval=null!==(i=e.interval)&&void 0!==i?i:d.default.interval,this.initialDelay=null!==(n=e.initialDelay)&&void 0!==n?n:d.default.initialDelay,this.changeChance=null!==(r=e.changeChance)&&void 0!==r?r:d.default.changeChance,this.ghostChance=null!==(h=e.ghostChance)&&void 0!==h?h:d.default.ghostChance,this.maxGhosts=null!==(o=e.maxGhosts)&&void 0!==o?o:d.default.maxGhosts,this.glyphs=null!==(l=e.glyphs)&&void 0!==l?l:d.default.glyphs,this.glyphsFromString=null!==(a=e.glyphsFromString)&&void 0!==a?a:d.default.glyphsFromString,Number.isInteger(e.oneAtATime)?this.oneAtATime=e.oneAtATime:this.oneAtATime=e.oneAtATime?1:0,this.html=null!==(c=e.html)&&void 0!==c?c:d.default.html,this.letterize=null!==(g=e.letterize)&&void 0!==g?g:d.default.letterize,"undefined"==typeof document&&(this.letterize=!1),this.endless=null!==(u=e.endless)&&void 0!==u?u:d.default.endless,this.startFrom=null!==(p=e.startFrom)&&void 0!==p?p:d.default.startFrom,this.writer=t,this.fillSpace=null!==(f=e.fillSpace)&&void 0!==f?f:d.default.fillSpace}set glyphs(t){this.glyphsString=function(t){let e;return e="string"==typeof t?t:t.length?t.join(""):Array.from(t).join(""),e}(t),this.setCharset()}set fillSpace(t){this.space=t?" ":""}get stepsLeft(){return o(this.steps)}get genInterval(){return o(this.interval)}get genInitDelay(){return o(this.initialDelay)}get genMaxGhosts(){if(Number.isInteger(this.maxGhosts))return this.maxGhosts;let t;return t=this.writer.options.html?u(this.writer.goalString).length:this.writer.goalString.length,Math.round((t||20)*this.maxGhosts)}get ghost(){var t,e;return null!==(t=(e=this.ghostCharset)[s(0,e.length,"floor")])&&void 0!==t?t:""}setCharset(){let t=this.glyphsString;this.glyphsFromString&&(t+=function(t){const e="string"==typeof t,s=[];return new Set(t).forEach((t=>s.push(t))),e?s.join(""):s}(this.writer.previousString+(this.writer.options.html?u(this.writer.goalString):this.writer.goalString))),this.ghostCharset=[...t].filter((t=>!["\t","\n","\r","\f","\v"].includes(t)))}}class m{constructor(t){this.nGhosts=0,this.isTyping=!1,this.isPaused=!1,this.finished=!1,this.writer=t,this.maxGhosts=this.writer.options.genMaxGhosts}get ghostsInLimit(){return this.nGhosts<this.maxGhosts}play(){this.isTyping=!0,this.isPaused=!1,this.finished=!1,this.toggleClass(!0),this.maxGhosts=this.writer.options.genMaxGhosts}pause(){this.isTyping=!1,this.isPaused=!0,this.toggleClass(!1)}finish(){this.isTyping=!1,this.finished=!0,this.toggleClass(!1)}toggleClass(t){const e=this.writer.htmlElement,s="gw-writing";e&&(t?((t,e)=>{t.classList.remove(e),t.offsetWidth,t.classList.add(e)})(e,s):e.classList.remove(s))}}var v=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function h(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class y{constructor(t,e,s,i="",n=!1){this.ghostsBefore=[],this.ghostsAfter=[],this.stop=!1,this.isTag=!1,this.isWhitespace=!1,this.afterGlitchChance=0,this.writer=t,this.setProps(e,s,i,n),t.options.letterize&&(this.els={ghostsBeforeEl:document.createElement("span"),letterEl:document.createElement("span"),ghostsAfterEl:document.createElement("span")},this.els.ghostsBeforeEl.className="gw-ghosts",this.els.ghostsAfterEl.className="gw-ghosts",this.els.letterEl.className="gw-letter")}setProps(t,e,s="",i=!1){const{options:n}=this.writer;this.l=t,this.gl=e,this.isTag=i,this.ghostsBefore=[...s],this.writer.state.nGhosts+=s.length,this.stepsLeft=n.stepsLeft,i&&(this.stepsLeft=0),this.isWhitespace=(t=>["\t","\n","\r","\f","\v",""," "].includes(t))(e),this.afterGlitchChance=(n.ghostChance+n.changeChance)/3.7}reset(t,e,s="",i=!1){this.setProps(t,e,s,i),this.els&&(this.els.letterEl.className="gw-letter")}get string(){const{l:t,ghostsAfter:e,ghostsBefore:s}=this;return s.join("")+t+e.join("")}get finished(){const{l:t,gl:e,ghostsBefore:s,ghostsAfter:i}=this;return t===e&&0===s.length&&0===i.length||this.isTag}get interval(){let t=this.writer.options.genInterval;return this.isWhitespace&&(t/=2),t}writeToElement(){if(!this.els)return;const{ghostsBeforeEl:t,ghostsAfterEl:e,letterEl:s}=this.els;s.innerHTML=this.l,t.textContent=this.ghostsBefore.join(""),e.textContent=this.ghostsAfter.join("")}set spanElement(t){this.els&&(this.els.charEl=t,this.appendChildren())}appendChildren(){var t,e;null===(e=null===(t=this.els)||void 0===t?void 0:t.charEl)||void 0===e||e.append(this.els.ghostsBeforeEl,this.els.letterEl,this.els.ghostsAfterEl),this.writeToElement()}type(){var t,e,s;return v(this,void 0,void 0,(function*(){const{writer:i}=this;return this.isTag?(this.l=this.gl,i.emiter.call("step"),!0):(yield n(i.options.genInitDelay),yield r((()=>(!this.finished||i.options.endless)&&!i.state.isPaused&&!this.stop),(()=>v(this,void 0,void 0,(function*(){yield n(this.interval);const t=this.string;this.step(),t!==this.string&&(i.emiter.call("step"),this.writeToElement()),!i.options.endless&&this.stepsLeft--})))),this.finished&&(null===(e=null===(t=this.els)||void 0===t?void 0:t.charEl)||void 0===e||e.classList.add("gw-finished"),null===(s=this.els)||void 0===s||s.letterEl.classList.remove("gw-glitched")),this.finished)}))}step(){var t,e;const{writer:s}=this;if(this.stepsLeft>0&&this.l!==this.gl||l(this.afterGlitchChance)&&!this.isWhitespace||s.options.endless){const{ghostChance:e,changeChance:i}=s.options;l(e)&&(s.state.ghostsInLimit?this.addGhost():this.removeGhost()),l(i)&&(null===(t=this.els)||void 0===t||t.letterEl.classList.add("gw-glitched"),this.l=s.options.ghost)}else this.finished||(null===(e=this.els)||void 0===e||e.letterEl.classList.remove("gw-glitched"),this.l=this.gl,this.removeGhost())}addGhost(){const t=this.writer.options.ghost;this.writer.state.nGhosts++,l()?w(this.ghostsBefore,t):w(this.ghostsAfter,t)}removeGhost(){(l()&&this.ghostsBefore.length>0?i(this.ghostsBefore):i(this.ghostsAfter))&&this.writer.state.nGhosts--}}function w(t,e){const{length:i}=t;t.splice(s(0,i,"floor"),0,e)}var C=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function h(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class E{constructor(t,e,s,i){var n;this.charTable=[],this.goalString="",this.string="",this.htmlElement="string"==typeof t?null!==(n=document.querySelector(t))&&void 0!==n?n:void 0:null!=t?t:void 0,this.htmlElement&&(this.htmlElement.$writer=this),"string"==typeof e?this.preset=e:this.setOptions(null!=e?e:{}),this.state=new m(this),this.emiter=new class{constructor(t,e,s){this.onStepCallback=e,this.onFinishCallback=s,this.writer=t}call(t){var e,s;this.writer.updateString();const{htmlElement:i,writerData:n,string:r}=this.writer;i&&!this.writer.options.letterize&&(this.writer.options.html?i.innerHTML=r:i.textContent=r),null==i||i.setAttribute("data-gw-string",this.writer.options.html?u(r):r),"finish"===t?(this.writer.state.finish(),null===(e=this.onFinishCallback)||void 0===e||e.call(this,r,n),this.emitEvent()):null===(s=this.onStepCallback)||void 0===s||s.call(this,r,n)}emitEvent(){const{htmlElement:t,writerData:e}=this.writer;t&&"undefined"!=typeof CustomEvent&&(null==t||t.dispatchEvent(new CustomEvent("gw-finished",{detail:e})))}}(this,s,i),this.string=this.previousString}extendOptions(t){this.setOptions(Object.assign(Object.assign({},this.options),t))}setOptions(t){this.options=new f(this,t)}set preset(t){this.options=new f(this,d[t])}updateString(){this.string=this.charTable.map((t=>t.string)).join("")}get previousString(){var t;let e=null===(t=this.htmlElement)||void 0===t?void 0:t.textContent;return"string"!=typeof e&&(e=this.options.html?u(this.string):this.string),e=e.trim(),e}get writerData(){const{options:t,state:e,string:s}=this;return{string:s,writer:this,options:t,state:e}}write(t,e){return C(this,void 0,void 0,(function*(){return"erase"!==this.options.startFrom||(null==e?void 0:e.erase)||(yield this.write(this.genGoalStringToErase(t),{erase:!0})),this.goalString=t,this.state.nGhosts=0,this.options.setCharset(),"matching"===this.options.startFrom?this.createMatchingCharTable():this.createPreviousCharTable(),this.letterize(),this.pause(),this.play({reverse:0!==this.options.oneAtATime&&(null==e?void 0:e.erase)})}))}add(t){return C(this,void 0,void 0,(function*(){const{previousString:e}=this;return this.write(e+t)}))}remove(t){return C(this,void 0,void 0,(function*(){const{previousString:e}=this,s=Array.from(e);return s.splice(-t),this.write(s.join(""),{erase:!0})}))}play(t){var e;return C(this,void 0,void 0,(function*(){const s=[],{charTable:i}=this;if(this.state.isTyping)return this.getWriterData("ERROR",`The writer is already typing "${this.goalString}".`);if(this.state.play(),this.options.oneAtATime>0){const n=null!==(e=null==t?void 0:t.reverse)&&void 0!==e&&e?[...i]:[...i].reverse(),h=()=>C(this,void 0,void 0,(function*(){let t=!0,e=!1;return yield r((()=>!e&&t&&!this.state.isPaused),(()=>C(this,void 0,void 0,(function*(){var s;const i=n.pop();i?t=null!==(s=yield i.type())&&void 0!==s&&s:e=!0})))),t}));for(let t=0;t<this.options.oneAtATime;t++)s.push(h())}else i.forEach((t=>s.push(t.type())));try{const t=(yield Promise.all(s)).every((t=>t));return this.returnResult(t)}catch(t){return this.getWriterData("ERROR","Writer encountered an error.",t)}}))}pause(){this.state.pause()}returnResult(t){return t?this.emiter.call("finish"):this.emiter.call("step"),t?this.getWriterData("SUCCESS","The writer finished typing."):this.getWriterData("ERROR","Writer failed to finish typing.")}createMatchingCharTable(){const{goalStringArray:t,previousString:e}=this,s=Math.min(Math.ceil(this.options.genMaxGhosts/2),5);let i=-1;t.forEach(((t,n)=>{if(i++,"tag"===t.type)return i--,void this.setChar(n,"",t);const r=""!==t.value?e.indexOf(t.value,i):-1;if(-1!==r&&r-i<=s){const s=e.substring(i,r);this.setChar(n,t.value,t,s),i=r}else this.setChar(n,e[i],t)})),this.removeExtraChars(t.length)}createPreviousCharTable(){const{goalStringArray:t,previousString:e}=this;let s=-1;t.forEach(((t,i)=>{if(s++,"tag"===t.type)return s--,void this.setChar(i,"",t);this.setChar(i,e[s],t)})),this.removeExtraChars(t.length)}letterize(){if(!this.options.letterize||!this.htmlElement)return;const t=this.charTable.map((({isTag:t,gl:e})=>t?e:'<span class="gw-char"></span>')).join("");this.htmlElement.innerHTML=t;const e=this.htmlElement.querySelectorAll("span.gw-char");let s=0;this.charTable.forEach((t=>{t.isTag||(t.spanElement=e[s],s++)}))}removeExtraChars(t){const{charTable:e}=this;e.splice(t,e.length-t)}setChar(t,e,s,i){const{charTable:n}=this,r=n[t];r?r.reset(null!=e?e:"",s.value||this.options.space,i,"tag"===s.type):n.push(new y(this,null!=e?e:"",s.value||this.options.space,i,"tag"===s.type))}get goalStringArray(){const{goalString:t,options:e,previousString:s}=this,i=e.html?function(t){const e=new RegExp(g,"gi"),s=[];let i,n=0;for(;i=e.exec(t);){const r=i.index,h=e.lastIndex,o=t.slice(n,r);n=h,o&&s.push(...c(o));const l={value:i[0],type:void 0!==i[1]?"html_entity":"tag"};s.push(l)}return t.length>n&&s.push(...c(t.slice(n))),s}(t):c(t),n=Math.max(0,s.length-i.length);if(this.options.oneAtATime)return i.concat(c(h("",n)));const r=Math.ceil(n/2),o=Math.floor(n/2);return c(h("",r)).concat(i,c(h("",o)))}getWriterData(t,e,s){const{writerData:i}=this;return Object.assign(Object.assign({},i),{status:t,message:e,error:s})}genGoalStringToErase(t){var e;const{previousString:s}=this;let i="";for(let n=0;n<t.length;n++){const r=t[n],h=null!==(e=s[n])&&void 0!==e?e:"";if(r!==h)break;i+=h}const n=Math.max(t.length-i.length,0);return n>0&&" "===this.options.space&&(i=i.padEnd(n+i.length," ")),i}}function S(t,e,s,i,n){return C(this,void 0,void 0,(function*(){return new E(e,s,i,n).write(t)}))}const T=(t,e,s,i)=>new E(t,e,s,i);return e})()}));
//# sourceMappingURL=index.min.map
{
"name": "glitched-writer",
"version": "2.0.21",
"version": "2.0.22",
"description": "Glitched, text writing module. Highly customizable settings. Decoding, decrypting, scrambling, or simply spelling out text.",

@@ -13,3 +13,3 @@ "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",

"main": "./lib/cjs/index.js",
"types": "./lib/cjs/index.d.ts",
"types": "./lib/esm/index.d.ts",
"jsdelivr": "lib/index.min.js",

@@ -16,0 +16,0 @@ "unpkg": "lin/index.min.js",

@@ -299,3 +299,3 @@ # Glitched Writer

- **typewriter** - One letter at a time, only slightly glitched.
- **[typewriter](https://codepen.io/thetarnav/pen/qBRpQpQ)** - One letter at a time, only slightly glitched.

@@ -308,3 +308,3 @@ - **[terminal](https://codepen.io/thetarnav/pen/mdRyqga)** - Imitating being typed by a machine or a computer.

- **encrypted** - Simple Text Scramble effect, suits well displaying secret data, like passwords or card numbers.
- **[encrypted](https://codepen.io/thetarnav/pen/oNBLpxb)** - Simple Text Scramble effect, suits well displaying secret data, like passwords or card numbers.

@@ -311,0 +311,0 @@ ```js

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc