mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2026-03-21 09:13:10 +00:00
3 lines
13 KiB
JavaScript
3 lines
13 KiB
JavaScript
function ve(w,G){for(var j=0;j<G.length;j++){const T=G[j];if(typeof T!="string"&&!Array.isArray(T)){for(const d in T)if(d!=="default"&&!(d in w)){const x=Object.getOwnPropertyDescriptor(T,d);x&&Object.defineProperty(w,d,x.get?x:{enumerable:!0,get:()=>T[d]})}}}return Object.freeze(Object.defineProperty(w,Symbol.toStringTag,{value:"Module"}))}var me=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function he(w){return w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w.default:w}var ne={exports:{}};(function(w,G){(function(j,T){w.exports=T()})(typeof self<"u"?self:me,()=>(()=>{var j={3146:(s,c,p)=>{for(var C=p(3491),h=typeof window>"u"?p.g:window,b=["moz","webkit"],y="AnimationFrame",f=h["request"+y],L=h["cancel"+y]||h["cancelRequest"+y],D=0;!f&&D<b.length;D++)f=h[b[D]+"Request"+y],L=h[b[D]+"Cancel"+y]||h[b[D]+"CancelRequest"+y];if(!f||!L){var R=0,P=0,A=[],Q=1e3/60;f=function(g){if(A.length===0){var S=C(),M=Math.max(0,Q-(S-R));R=M+S,setTimeout(function(){var k=A.slice(0);A.length=0;for(var _=0;_<k.length;_++)if(!k[_].cancelled)try{k[_].callback(R)}catch(O){setTimeout(function(){throw O},0)}},Math.round(M))}return A.push({handle:++P,callback:g,cancelled:!1}),P},L=function(g){for(var S=0;S<A.length;S++)A[S].handle===g&&(A[S].cancelled=!0)}}s.exports=function(g){return f.call(h,g)},s.exports.cancel=function(){L.apply(h,arguments)},s.exports.polyfill=function(g){g||(g=h),g.requestAnimationFrame=f,g.cancelAnimationFrame=L}},3491:function(s){(function(){var c,p,C,h,b,y;typeof performance<"u"&&performance!==null&&performance.now?s.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(s.exports=function(){return(c()-b)/1e6},p=process.hrtime,h=(c=function(){var f;return 1e9*(f=p())[0]+f[1]})(),y=1e9*process.uptime(),b=h-y):Date.now?(s.exports=function(){return Date.now()-C},C=Date.now()):(s.exports=function(){return new Date().getTime()-C},C=new Date().getTime())}).call(this)}},T={};function d(s){var c=T[s];if(c!==void 0)return c.exports;var p=T[s]={exports:{}};return j[s].call(p.exports,p,p.exports,d),p.exports}d.n=s=>{var c=s&&s.__esModule?()=>s.default:()=>s;return d.d(c,{a:c}),c},d.d=(s,c)=>{for(var p in c)d.o(c,p)&&!d.o(s,p)&&Object.defineProperty(s,p,{enumerable:!0,get:c[p]})},d.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),d.o=(s,c)=>Object.prototype.hasOwnProperty.call(s,c);var x={};return(()=>{d.d(x,{default:()=>ae});var s=d(3146),c=d.n(s);const p=function(o){return new RegExp(/<[a-z][\s\S]*>/i).test(o)},C=function(o,t){return Math.floor(Math.random()*(t-o+1))+o};var h="TYPE_CHARACTER",b="REMOVE_CHARACTER",y="REMOVE_ALL",f="REMOVE_LAST_VISIBLE_NODE",L="PAUSE_FOR",D="CALL_FUNCTION",R="ADD_HTML_TAG_ELEMENT",P="CHANGE_DELETE_SPEED",A="CHANGE_DELAY",Q="CHANGE_CURSOR",g="PASTE_STRING",S="HTML_TAG";function M(o){return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(o)}function k(o,t){var a=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);t&&(r=r.filter(function(N){return Object.getOwnPropertyDescriptor(o,N).enumerable})),a.push.apply(a,r)}return a}function _(o){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?k(Object(a),!0).forEach(function(r){u(o,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):k(Object(a)).forEach(function(r){Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(a,r))})}return o}function O(o){return function(t){if(Array.isArray(t))return V(t)}(o)||function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}(o)||function(t,a){if(t){if(typeof t=="string")return V(t,a);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?V(t,a):void 0}}(o)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function V(o,t){(t==null||t>o.length)&&(t=o.length);for(var a=0,r=Array(t);a<t;a++)r[a]=o[a];return r}function oe(o,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(o,B(r.key),r)}}function u(o,t,a){return(t=B(t))in o?Object.defineProperty(o,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[t]=a,o}function B(o){var t=function(a){if(M(a)!="object"||!a)return a;var r=a[Symbol.toPrimitive];if(r!==void 0){var N=r.call(a,"string");if(M(N)!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(a)}(o);return M(t)=="symbol"?t:t+""}const ae=function(){function o(r,N){var e=this;if(function(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}(this,o),u(this,"state",{cursorAnimation:null,lastFrameTime:null,pauseUntil:null,eventQueue:[],eventLoop:null,eventLoopPaused:!1,reverseCalledEvents:[],calledEvents:[],visibleNodes:[],initialOptions:null,elements:{container:null,wrapper:document.createElement("span"),cursor:document.createElement("span")}}),u(this,"options",{strings:null,cursor:"|",delay:"natural",pauseFor:1500,deleteSpeed:"natural",loop:!1,autoStart:!1,devMode:!1,skipAddStyles:!1,wrapperClassName:"Typewriter__wrapper",cursorClassName:"Typewriter__cursor",stringSplitter:null,onCreateTextNode:null,onRemoveNode:null}),u(this,"setupWrapperElement",function(){e.state.elements.container&&(e.state.elements.wrapper.className=e.options.wrapperClassName,e.state.elements.cursor.className=e.options.cursorClassName,e.state.elements.cursor.innerHTML=e.options.cursor,e.state.elements.container.innerHTML="",e.state.elements.container.appendChild(e.state.elements.wrapper),e.state.elements.container.appendChild(e.state.elements.cursor))}),u(this,"start",function(){return e.state.eventLoopPaused=!1,e.runEventLoop(),e}),u(this,"pause",function(){return e.state.eventLoopPaused=!0,e}),u(this,"stop",function(){return e.state.eventLoop&&((0,s.cancel)(e.state.eventLoop),e.state.eventLoop=null),e}),u(this,"pauseFor",function(n){return e.addEventToQueue(L,{ms:n}),e}),u(this,"typeOutAllStrings",function(){return typeof e.options.strings=="string"?(e.typeString(e.options.strings).pauseFor(e.options.pauseFor),e):(e.options.strings.forEach(function(n){e.typeString(n).pauseFor(e.options.pauseFor).deleteAll(e.options.deleteSpeed)}),e)}),u(this,"typeString",function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(p(n))return e.typeOutHTMLString(n,i);if(n){var v=(e.options||{}).stringSplitter,m=typeof v=="function"?v(n):n.split("");e.typeCharacters(m,i)}return e}),u(this,"pasteString",function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return p(n)?e.typeOutHTMLString(n,i,!0):(n&&e.addEventToQueue(g,{character:n,node:i}),e)}),u(this,"typeOutHTMLString",function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,v=arguments.length>2?arguments[2]:void 0,m=function(H){var I=document.createElement("div");return I.innerHTML=H,I.childNodes}(n);if(m.length>0)for(var l=0;l<m.length;l++){var E=m[l],F=E.innerHTML;E&&E.nodeType!==3?(E.innerHTML="",e.addEventToQueue(R,{node:E,parentNode:i}),v?e.pasteString(F,E):e.typeString(F,E)):E.textContent&&(v?e.pasteString(E.textContent,i):e.typeString(E.textContent,i))}return e}),u(this,"deleteAll",function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"natural";return e.addEventToQueue(y,{speed:n}),e}),u(this,"changeDeleteSpeed",function(n){if(!n)throw new Error("Must provide new delete speed");return e.addEventToQueue(P,{speed:n}),e}),u(this,"changeDelay",function(n){if(!n)throw new Error("Must provide new delay");return e.addEventToQueue(A,{delay:n}),e}),u(this,"changeCursor",function(n){if(!n)throw new Error("Must provide new cursor");return e.addEventToQueue(Q,{cursor:n}),e}),u(this,"deleteChars",function(n){if(!n)throw new Error("Must provide amount of characters to delete");for(var i=0;i<n;i++)e.addEventToQueue(b);return e}),u(this,"callFunction",function(n,i){if(!n||typeof n!="function")throw new Error("Callback must be a function");return e.addEventToQueue(D,{cb:n,thisArg:i}),e}),u(this,"typeCharacters",function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!n||!Array.isArray(n))throw new Error("Characters must be an array");return n.forEach(function(v){e.addEventToQueue(h,{character:v,node:i})}),e}),u(this,"removeCharacters",function(n){if(!n||!Array.isArray(n))throw new Error("Characters must be an array");return n.forEach(function(){e.addEventToQueue(b)}),e}),u(this,"addEventToQueue",function(n,i){var v=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return e.addEventToStateProperty(n,i,v,"eventQueue")}),u(this,"addReverseCalledEvent",function(n,i){var v=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return e.options.loop?e.addEventToStateProperty(n,i,v,"reverseCalledEvents"):e}),u(this,"addEventToStateProperty",function(n,i){var v=arguments.length>2&&arguments[2]!==void 0&&arguments[2],m=arguments.length>3?arguments[3]:void 0,l={eventName:n,eventArgs:i||{}};return e.state[m]=v?[l].concat(O(e.state[m])):[].concat(O(e.state[m]),[l]),e}),u(this,"runEventLoop",function(){e.state.lastFrameTime||(e.state.lastFrameTime=Date.now());var n=Date.now(),i=n-e.state.lastFrameTime;if(!e.state.eventQueue.length){if(!e.options.loop)return;e.state.eventQueue=O(e.state.calledEvents),e.state.calledEvents=[],e.options=_({},e.state.initialOptions)}if(e.state.eventLoop=c()(e.runEventLoop),!e.state.eventLoopPaused){if(e.state.pauseUntil){if(n<e.state.pauseUntil)return;e.state.pauseUntil=null}var v,m=O(e.state.eventQueue),l=m.shift();if(!(i<=(v=l.eventName===f||l.eventName===b?e.options.deleteSpeed==="natural"?C(40,80):e.options.deleteSpeed:e.options.delay==="natural"?C(120,160):e.options.delay))){var E=l.eventName,F=l.eventArgs;switch(e.logInDevMode({currentEvent:l,state:e.state,delay:v}),E){case g:case h:var H=F.character,I=F.node,K=document.createTextNode(H),U=K;e.options.onCreateTextNode&&typeof e.options.onCreateTextNode=="function"&&(U=e.options.onCreateTextNode(H,K)),U&&(I?I.appendChild(U):e.state.elements.wrapper.appendChild(U)),e.state.visibleNodes=[].concat(O(e.state.visibleNodes),[{type:"TEXT_NODE",character:H,node:U}]);break;case b:m.unshift({eventName:f,eventArgs:{removingCharacterNode:!0}});break;case L:var se=l.eventArgs.ms;e.state.pauseUntil=Date.now()+parseInt(se);break;case D:var Z=l.eventArgs,ie=Z.cb,ue=Z.thisArg;ie.call(ue,{elements:e.state.elements});break;case R:var ee=l.eventArgs,W=ee.node,z=ee.parentNode;z?z.appendChild(W):e.state.elements.wrapper.appendChild(W),e.state.visibleNodes=[].concat(O(e.state.visibleNodes),[{type:S,node:W,parentNode:z||e.state.elements.wrapper}]);break;case y:var le=e.state.visibleNodes,$=F.speed,q=[];$&&q.push({eventName:P,eventArgs:{speed:$,temp:!0}});for(var te=0,ce=le.length;te<ce;te++)q.push({eventName:f,eventArgs:{removingCharacterNode:!1}});$&&q.push({eventName:P,eventArgs:{speed:e.options.deleteSpeed,temp:!0}}),m.unshift.apply(m,q);break;case f:var pe=l.eventArgs.removingCharacterNode;if(e.state.visibleNodes.length){var J=e.state.visibleNodes.pop(),de=J.type,Y=J.node,fe=J.character;e.options.onRemoveNode&&typeof e.options.onRemoveNode=="function"&&e.options.onRemoveNode({node:Y,character:fe}),Y&&Y.parentNode.removeChild(Y),de===S&&pe&&m.unshift({eventName:f,eventArgs:{}})}break;case P:e.options.deleteSpeed=l.eventArgs.speed;break;case A:e.options.delay=l.eventArgs.delay;break;case Q:e.options.cursor=l.eventArgs.cursor,e.state.elements.cursor.innerHTML=l.eventArgs.cursor}e.options.loop&&(l.eventName===f||l.eventArgs&&l.eventArgs.temp||(e.state.calledEvents=[].concat(O(e.state.calledEvents),[l]))),e.state.eventQueue=m,e.state.lastFrameTime=n}}}),r)if(typeof r=="string"){var X=document.querySelector(r);if(!X)throw new Error("Could not find container element");this.state.elements.container=X}else this.state.elements.container=r;N&&(this.options=_(_({},this.options),N)),this.state.initialOptions=_({},this.options),this.init()}var t,a;return t=o,(a=[{key:"init",value:function(){var r,N;this.setupWrapperElement(),this.addEventToQueue(Q,{cursor:this.options.cursor},!0),this.addEventToQueue(y,null,!0),!window||window.___TYPEWRITER_JS_STYLES_ADDED___||this.options.skipAddStyles||(r=".Typewriter__cursor{-webkit-animation:Typewriter-cursor 1s infinite;animation:Typewriter-cursor 1s infinite;margin-left:1px}@-webkit-keyframes Typewriter-cursor{0%{opacity:0}50%{opacity:1}100%{opacity:0}}@keyframes Typewriter-cursor{0%{opacity:0}50%{opacity:1}100%{opacity:0}}",(N=document.createElement("style")).appendChild(document.createTextNode(r)),document.head.appendChild(N),window.___TYPEWRITER_JS_STYLES_ADDED___=!0),this.options.autoStart===!0&&this.options.strings&&this.typeOutAllStrings().start()}},{key:"logInDevMode",value:function(r){this.options.devMode&&console.log(r)}}])&&oe(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),o}()})(),x.default})())})(ne);var re=ne.exports;const ye=he(re),ge=ve({__proto__:null,default:ye},[re]);export{ge as c};
|