vue-pure-admin/dist/static/js/index-Cg9onxcG.js
2024-03-05 00:13:41 +08:00

2 lines
11 KiB
JavaScript

var Ce=Object.defineProperty,Ie=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable;var re=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t)=>{for(var n in t||(t={}))Pe.call(t,n)&&re(e,n,t[n]);if(te)for(var n of te(t))Ne.call(t,n)&&re(e,n,t[n]);return e},ne=(e,t)=>Ie(e,_e(t));var g=(e,t,n)=>new Promise((a,i)=>{var o=c=>{try{u(n.next(c))}catch(y){i(y)}},s=c=>{try{u(n.throw(c))}catch(y){i(y)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(o,s);u((n=n.apply(e,t)).next())});import{d as Ae,r as Le,o as ve,i as le}from"./index-Qzj1Lmwb.js";const de=e=>Array.isArray(e),fe=e=>de(e)?e:[e];let De=function(e){let t=function(p){return fe(p).forEach(w=>{var v;return h.set(Symbol((v=w.char)==null?void 0:v.innerText),i(Q({},w)))}),this},n=()=>c().filter(p=>p.typeable),a=function(p,w){let v=[...h.keys()];h.set(v[p],i(w))},i=p=>(p.shouldPauseCursor=function(){return!!(this.typeable||this.cursorable||this.deletable)},p),o=function(){h.forEach(p=>delete p.done)},s=function(){h=new Map,t(e)},u=()=>h,c=()=>Array.from(h.values()),y=p=>h.delete(p),I=(p=!1)=>p?c():c().filter(w=>!w.done),_=(p,w=!1)=>w?h.delete(p):h.get(p).done=!0,h=new Map;return t(e),{add:t,set:a,wipe:s,reset:o,destroy:y,done:_,getItems:I,getQueue:u,getTypeable:n}};const ce=e=>Array.from(e),X=e=>document.createTextNode(e);let G=e=>([...e.childNodes].forEach(t=>{if(t.nodeValue){[...t.nodeValue].forEach(n=>{t.parentNode.insertBefore(X(n),t)}),t.remove();return}G(t)}),e);const ye=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,G(t.body)},pe="data-typeit-id",L="ti-cursor",xe="END",Me={started:!1,completed:!1,frozen:!1,destroyed:!1},M={breakLines:!0,cursor:{autoPause:!0,autoPauseDelay:500,animation:{frames:[0,0,1].map(e=>({opacity:e})),options:{iterations:1/0,easing:"steps(2, start)",fill:"forwards"}}},cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}},ke=`[${pe}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`;function me(e,t=!1,n=!1){let a=e.querySelector(`.${L}`),i=document.createTreeWalker(e,NodeFilter.SHOW_ALL,{acceptNode:u=>{var c,y;if(a&&n){if((c=u.classList)!=null&&c.contains(L))return NodeFilter.FILTER_ACCEPT;if(a.contains(u))return NodeFilter.FILTER_REJECT}return(y=u.classList)!=null&&y.contains(L)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),o,s=[];for(;o=i.nextNode();)o.originalParent||(o.originalParent=o.parentNode),s.push(o);return t?s.reverse():s}function Re(e){return me(ye(e))}function $e(e,t=!0){return t?Re(e):ce(e).map(X)}const q=e=>document.createElement(e),he=(e,t="")=>{let n=q("style");n.id=t,n.appendChild(X(e)),document.head.appendChild(n)},ae=e=>(de(e)||(e=[e/2,e/2]),e),ie=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let oe=e=>e/2;function Fe(e){let{speed:t,deleteSpeed:n,lifeLike:a}=e;return n=n!==null?n:t/3,a?[ie(t,oe(t)),ie(n,oe(n))]:[t,n]}const He=e=>(e.forEach(clearTimeout),[]),Qe=()=>Math.random().toString().substring(2,9),K=e=>"value"in e;let Be=e=>K(e)?ce(e.value):me(e,!0).filter(t=>!(t.childNodes.length>0));const qe=(e,t)=>{new IntersectionObserver((a,i)=>{a.forEach(o=>{o.isIntersecting&&(t(),i.unobserve(e))})},{threshold:1}).observe(e)};let x=e=>typeof e=="function"?e():e;const be=e=>Number.isInteger(e);let O=(e,t=document,n=!1)=>t[`querySelector${n?"All":""}`](e),ze=e=>/body/i.test(e==null?void 0:e.tagName),Ue=(e,t)=>{if(K(e)){e.value=`${e.value}${t.textContent}`;return}t.innerHTML="";let n=ze(t.originalParent)?e:t.originalParent||e;n.insertBefore(t,O("."+L,n)||null)},Ve=(e,t,n)=>Math.min(Math.max(t+e,0),n.length);const k=(e,t)=>Object.assign({},e,t),je=(e,t)=>{if(!e)return;let n=e.parentNode;(n.childNodes.length>1||n.isSameNode(t)?e:n).remove()},We=(e,t,n)=>{let a=t[n-1],i=O(`.${L}`,e);e=(a==null?void 0:a.parentNode)||e,e.insertBefore(i,a||null)};function Je(e){return typeof e=="string"?O(e):e}const Xe=e=>/<(.+)>(.*?)<\/(.+)>/.test(e.outerHTML);let Ge=(e,t,n)=>new Promise(a=>{let i=()=>g(void 0,null,function*(){yield e(),a()});n.push(setTimeout(i,t||0))}),Ke={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"",transform:"translateX(-.125em)"},Oe=(e,t)=>{let a=`${`[${pe}='${e}']`} .${L}`,i=getComputedStyle(t),o=Object.entries(Ke).reduce((s,[u,c])=>`${s} ${u}: var(--ti-cursor-${u}, ${c||i[u]});`,"");he(`${a} { display: inline-block; width: 0; ${o} }`,e)};const B=(e,t)=>new Array(t).fill(e),se=({queueItems:e,selector:t,cursorPosition:n,to:a})=>{if(be(t))return t*-1;let i=new RegExp(xe,"i").test(a),o=t?[...e].reverse().findIndex(({char:u})=>{let c=u.parentElement,y=c.matches(t);return i&&y?!0:y&&c.firstChild.isSameNode(u)}):-1;o<0&&(o=i?0:e.length-1);let s=i?0:1;return o-n+s};let z=e=>new Promise(t=>{requestAnimationFrame(()=>g(void 0,null,function*(){t(yield e())}))}),ge=e=>e==null?void 0:e.getAnimations().find(t=>t.id===e.dataset.tiAnimationId),we=({cursor:e,frames:t,options:n})=>{let a=e.animate(t,n);return a.pause(),a.id=e.dataset.tiAnimationId,z(()=>{z(()=>{a.play()})}),a},Ye=({cursor:e,options:t,cursorOptions:n})=>{if(!e||!n)return;let a=ge(e),i;a&&(t.delay=a.effect.getComputedTiming().delay,i=a.currentTime,a.cancel());let o=we({cursor:e,frames:n.animation.frames,options:t});return i&&(o.currentTime=i),o},ue=e=>{var t;return(t=e.func)==null?void 0:t.call(null)},Ze=o=>g(void 0,[o],function*({index:e,queueItems:t,wait:n,cursor:a,cursorOptions:i}){let s=t[e][1],u=[],c=e,y=s,I=()=>y&&!y.delay,_=s.shouldPauseCursor()&&i.autoPause;for(;I();)u.push(y),I()&&c++,y=t[c]?t[c][1]:null;if(u.length)return yield z(()=>g(void 0,null,function*(){for(let w of u)yield ue(w)})),c-1;let h=ge(a),p;return h&&(p=ne(Q({},h.effect.getComputedTiming()),{delay:_?i.autoPauseDelay:0})),yield n(()=>g(void 0,null,function*(){h&&_&&h.cancel(),yield z(()=>{ue(s)})}),s.delay),yield Ye({cursor:a,options:p,cursorOptions:i}),e}),et=e=>{var t,n,a;if(typeof e=="object"){let i={},{frames:o,options:s}=M.cursor.animation;return i.animation=e.animation||{},i.animation.frames=((t=e.animation)==null?void 0:t.frames)||o,i.animation.options=k(s,((n=e.animation)==null?void 0:n.options)||{}),i.autoPause=(a=e.autoPause)!=null?a:M.cursor.autoPause,i.autoPauseDelay=e.autoPauseDelay||M.cursor.autoPauseDelay,i}return e===!0?M.cursor:e};const tt=function(e,t={}){var ee;let n=(r,l,f=!1)=>g(this,null,function*(){E.frozen&&(yield new Promise(m=>{this.unfreeze=()=>{E.frozen=!1,m()}})),f||(yield d.beforeStep(this)),yield Ge(r,l,V),f||(yield d.afterStep(this))}),a=(r,l)=>Ze({index:r,queueItems:l,wait:n,cursor:A,cursorOptions:d.cursor}),i=r=>je(r,b),o=()=>K(b),s=(r=0)=>Fe(d)[r],u=()=>Be(b),c=(r={})=>{let l=r.delay;l&&T.add({delay:l})},y=(r,l)=>(T.add(r),c(l),this),I=()=>H!=null?H:D,_=(r={})=>[{func:()=>$(r)},{func:()=>$(d)}],h=r=>{let l=d.nextStringDelay;T.add([{delay:l[0]},...r,{delay:l[1]}])},p=()=>{if(o())return;let r=q("span");return r.className=L,Z?(r.innerHTML=ye(d.cursorChar).innerHTML,r):(r.style.visibility="hidden",r)},w=()=>g(this,null,function*(){if(!o()&&A&&b.appendChild(A),Z){Oe(j,b),A.dataset.tiAnimationId=j;let{animation:r}=d.cursor,{frames:l,options:f}=r;we({frames:l,cursor:A,options:Q({duration:d.cursorSpeed},f)})}}),v=()=>{let r=d.strings.filter(l=>!!l);r.forEach((l,f)=>{if(this.type(l),f+1===r.length)return;let m=d.breakLines?[{func:()=>U(q("BR")),typeable:!0}]:B({func:F,delay:s(1)},T.getTypeable().length);h(m)})},Te=r=>g(this,null,function*(){let l=I();l&&(yield Y({value:l}));let f=u().map(m=>[Symbol(),{func:F,delay:s(1),deletable:!0,shouldPauseCursor:()=>!0}]);for(let m=0;m<f.length;m++)yield a(m,f);T.reset(),T.set(0,{delay:r})}),Se=r=>{let l=b.innerHTML;return l?(b.innerHTML="",d.startDelete?(b.innerHTML=l,G(b),h(B({func:F,delay:s(1),deletable:!0},u().length)),r):l.replace(/<!--(.+?)-->/g,"").trim().split(/<br(?:\s*?)(?:\/)?>/).concat(r)):r},R=(r=!0)=>g(this,null,function*(){E.started=!0;let l=f=>{T.done(f,!r)};try{let f=[...T.getQueue()];for(let S=0;S<f.length;S++){let[P,C]=f[S];if(!C.done){if(!C.deletable||C.deletable&&u().length){let N=yield a(S,f);Array(N-S).fill(S+1).map((W,J)=>W+J).forEach(W=>{let[J]=f[W];l(J)}),S=N}l(P)}}if(!r)return this;if(E.completed=!0,yield d.afterComplete(this),!d.loop)throw"";let m=d.loopDelay;n(()=>g(this,null,function*(){yield Te(m[0]),R()}),m[1])}catch(f){}return this}),Y=r=>g(this,null,function*(){D=Ve(r,D,u()),We(b,u(),D)}),U=r=>Ue(b,r),$=r=>g(this,null,function*(){return d=k(d,r)}),Ee=()=>g(this,null,function*(){if(o()){b.value="";return}u().forEach(i)}),F=()=>{let r=u();r.length&&(o()?b.value=b.value.slice(0,-1):i(r[D]))};this.break=function(r){return y({func:()=>U(q("BR")),typeable:!0},r)},this.delete=function(r=null,l={}){r=x(r);let f=_(l),m=r,{instant:S,to:P}=l,C=T.getTypeable(),N=m===null?C.length:be(m)?m:se({queueItems:C,selector:m,cursorPosition:I(),to:P});return y([f[0],...B({func:F,delay:S?0:s(1),deletable:!0},N),f[1]],l)},this.empty=function(r={}){return y({func:Ee},r)},this.exec=function(r,l={}){let f=_(l);return y([f[0],{func:()=>r(this)},f[1]],l)},this.move=function(r,l={}){r=x(r);let f=_(l),{instant:m,to:S}=l,P=se({queueItems:T.getTypeable(),selector:r===null?"":r,to:S,cursorPosition:I()}),C=P<0?-1:1;return H=I()+P,y([f[0],...B({func:()=>Y(C),delay:m?0:s(),cursorable:!0},Math.abs(P)),f[1]],l)},this.options=function(r,l={}){return r=x(r),$(r),y({},l)},this.pause=function(r,l={}){return y({delay:x(r)},l)},this.type=function(r,l={}){r=x(r);let{instant:f}=l,m=_(l),P=$e(r,d.html).map(N=>({func:()=>U(N),char:N,delay:f||Xe(N)?0:s(),typeable:N.nodeType===Node.TEXT_NODE})),C=[m[0],{func:()=>g(this,null,function*(){return yield d.beforeString(r,this)})},...P,{func:()=>g(this,null,function*(){return yield d.afterString(r,this)})},m[1]];return y(C,l)},this.is=function(r){return E[r]},this.destroy=function(r=!0){V=He(V),x(r)&&A&&i(A),E.destroyed=!0},this.freeze=function(){E.frozen=!0},this.unfreeze=()=>{},this.reset=function(r){!this.is("destroyed")&&this.destroy(),r?(T.wipe(),r(this)):T.reset(),D=0;for(let l in E)E[l]=!1;return b[o()?"value":"innerHTML"]="",this},this.go=function(){return E.started?this:(w(),d.waitUntilVisible?(qe(b,R.bind(this)),this):(R(),this))},this.flush=function(r=()=>{}){return w(),R(!1).then(r),this},this.getQueue=()=>T,this.getOptions=()=>d,this.updateOptions=r=>$(r),this.getElement=()=>b;let b=Je(e),V=[],D=0,H=null,E=k({},Me);t.cursor=et((ee=t.cursor)!=null?ee:M.cursor);let d=k(M,t);d=k(d,{html:!o()&&d.html,nextStringDelay:ae(d.nextStringDelay),loopDelay:ae(d.loopDelay)});let j=Qe(),T=De([{delay:d.startDelay}]);b.dataset.typeitId=j,he(ke);let Z=!!d.cursor&&!o(),A=p();d.strings=Se(fe(d.strings)),d.strings.length&&v()},rt=Ae({name:"TypeIt",props:{options:{type:Object,default:()=>({})}},setup(e,{slots:t,expose:n}){function a(s){throw new TypeError(s)}function i(){return navigator.language}const o=Le(null);return ve(()=>{const s=o.value.querySelector(".type-it");if(!s){const c=i()==="zh-CN"?"class 'type-it' ":"Please make sure that there is only one element with a Class attribute with 'type-it'";a(c)}const u=new tt(s,e.options).go();n({typeIt:u})}),()=>{var s,u;return le("div",{ref:o},[(u=(s=t.default)==null?void 0:s.call(t))!=null?u:le("span",{class:"type-it"},null)])}}}),at=rt;export{at as T};