jmini 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +1 -1
- package/declare/core.d.ts +14 -17
- package/declare/server.d.ts +23 -16
- package/esm/core.js +1 -1
- package/esm/fetcher.js +1 -1
- package/esm/server.js +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var A=Object.defineProperty,K=Object.defineProperties,z=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var L=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var E=Math.pow,I=(e,t,r)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))J.call(t,r)&&I(e,r,t[r]);if(F)for(var r of F(t))N.call(t,r)&&I(e,r,t[r]);return e},U=(e,t)=>K(e,X(t));var H=(e,t)=>{var r={};for(var i in e)J.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&F)for(var i of F(e))t.indexOf(i)<0&&N.call(e,i)&&(r[i]=e[i]);return r};var Q=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},Z=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of G(t))!J.call(e,n)&&n!==r&&A(e,n,{get:()=>t[n],enumerable:!(i=z(t,n))||i.enumerable});return e};var _=e=>Z(A({},"__esModule",{value:!0}),e);var p=(e,t,r)=>new Promise((i,n)=>{var s=l=>{try{u(r.next(l))}catch(h){n(h)}},o=l=>{try{u(r.throw(l))}catch(h){n(h)}},u=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,o);u((r=r.apply(e,t)).next())}),P=function(e,t){this[0]=e,this[1]=t},Y=(e,t,r)=>{var i=(o,u,l,h)=>{try{var f=r[o](u),g=(u=f.value)instanceof P,b=f.done;Promise.resolve(g?u[0]:u).then(m=>g?i(o==="return"?o:"next",u[1]?{done:m.done,value:m.value}:m,l,h):l({value:m,done:b})).catch(m=>i("throw",m,l,h))}catch(m){h(m)}},n=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return r=r.apply(e,t),s[L("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var j=(e,t,r)=>(t=e[L("asyncIterator")])?t.call(e):(e=e[L("iterator")](),t={},r=(i,n)=>(n=e[i])&&(t[i]=s=>new Promise((o,u,l)=>(s=n.call(e,s),l=s.done,Promise.resolve(s.value).then(h=>o({value:h,done:l}),u)))),r("next"),r("return"),t);var se={};Q(se,{Fetcher:()=>d,Filer:()=>k,Server:()=>V,Time:()=>c,UUID:()=>M,default:()=>ie});module.exports=_(se);typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()});typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let e=this;return e&&(e=e.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,t=>t[1].toUpper())),e},String.prototype.clip=function(e,t){return this.slice(e,t)},String.prototype.partReplace=function(e,t){return this.slice(0,e)+t+this.slice(e+t.length)},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),r=new Uint8Array(t.length);for(var i=0;i<t.length;i++)r[i]=t.charCodeAt(i);try{var n=new Blob([r.buffer],{type:e})}catch(s){return!1}return n},String.prototype.toNumber=function(){return Number(this.removeLetters())},String.prototype.removeLetters=function(){return this.replace(/[\D]/ig,"")},String.prototype.removeSpecifics=function(){return this.replace(/[^\w\s\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]|_/uig,"")},String.prototype.removeJP=function(){return this.replace(/[\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]+/uig,"")},String.prototype.zen2hanNumber=function(){return this.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,"-").replace(/¥/,"\xA5").replace(/、/,",").replace(/(/,"(").replace(/)/,")").replace(/+/,"+")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=E(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=E(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=E(10,e),r=Number(this),i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/E(1e3,i)*t)/t+("KMGTPEZY"[i-1]||"")},Number.prototype.rankJp=function(){let e=Number(this),t="";return e>=1e12?t=`${e/1e12}\u5146`:e>=1e8?t=`${e/1e8}\u5104`:e>=1e4?t=`${e/1e4}\u4E07`:e>=1e3?t=`${e/1e3}\u5343`:t=`${e.toLocaleString()}`,t},Number.prototype.toDate=function(e="/"){let t=String(this),r=t.slice(0,4),i=t.slice(4,6),n=t.slice(6,8),s=[];return r.length!=4||s.push(r),i.length!=2||s.push(i),n.length!=2||s.push(n),s.join(e)});if(typeof Array!="undefined"){let e=(t,r)=>{if(!t)return;let i=t;for(let n of r){if(!i)break;i=i[n]}return i};Array.prototype.order=function(t){let{direction:r="ASC",keys:i=[],numeral:n=!1}=t,s=[];return i.length?n?s=this.sort((o,u)=>+(Number(e(o,i))>Number(e(u,i)))*2-1):s=this.sort((o,u)=>{let l=String(e(o,i)).replace(/(\d+)/g,f=>f.padStart(18,"0")),h=String(e(u,i)).replace(/(\d+)/g,f=>f.padStart(18,"0"));return+(l>h)*2-1}):n?s=this.sort((o,u)=>+(o>u)*2-1):s=this.sort((o,u)=>{let l=String(o).replace(/(\d+)/g,f=>f.padStart(18,"0")),h=String(u).replace(/(\d+)/g,f=>f.padStart(18,"0"));return+(l>h)*2-1}),r=="DESC"&&(s=s.reverse()),s},Array.prototype.getLastChild=function(){let t=this.length-1;return this[t]}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,r)=>{let i=new FileReader;i.onload=s=>t(s),i.onerror=s=>r(s);let n="readAs"+(e==null?void 0:e.toCapital());i[n](this)})});var ee=(e=24)=>Array.from({length:e}).map((t,r)=>{let i=r==0?25:35,n=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*i)][n?"toUpper":"toLower"]()}).join(""),M=ee;M.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");M.gen32Hex=(e="Formatted",t="-")=>{let r=Array.from({length:32}).map((i,n)=>"0123456789abcdef"[Math.round(Math.random()*15)]).join("").toUpper();return e=="Formatted"&&(r=[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,20),r.slice(20,32)].join(t)),r};M.to32Format=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20,32)].join("-").toUpper();var te=e=>new a.prototype.jmini(e),a=te;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+M();var y=(e,t)=>(e.queue.push(t),B(e),e),B=e=>p(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let t=e.queue.shift();t&&(yield t()),e.queueProcess=!1,B(e)}}),v=(e,t)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,i]of Object.entries(t))r.match(/queue/)||(e[r]=i);return e},ne=(e,t)=>{if(t.length){for(var r=0;r<t.length;r++){let i=t[r];i&&(i[a.expando]||(a.is.element(i)||a.is.shadowRoot(i))&&(i[a.expando]={events:{}})),e[r]=i}e.length=t.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,B(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],ne(this,a.is.jmini(e)?e.get():a.is.element(e)?[e]:a.is.elements(e)?e:a.is.shadowRoot(e)?[e]:a.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}});a.prototype[String(Symbol.iterator)]=[][Symbol.iterator];a.prototype.jmini.prototype=a.prototype;{let e=function(n,s,o){let u=[];for(let l=0;l<(n.length||0);l++)u.push(s(n[l],l));return o&&(u=u.filter(l=>l!=null)),u},t=n=>(n.for((s,o)=>{if(!(a.is.element(s)||a.is.shadowRoot(s)))return;let u=s.cloneNode(),l=s.parentNode;l&&l.replaceChild(u,s),n[o]=u}),n),r=(n,s)=>(a(s).for(o=>{if(n&&(a.is.element(o)||a.is.shadowRoot(o)))if(a.is.string(n)||a.is.number(n))n=String(n),o.insertAdjacentHTML("beforeend",String(n));else if(a.is.element(n))o.appendChild(n);else{a.is.jmini(n)?n=n.get():a.is.element(n)?n=[n]:a.is.keyValueDictionary(n)&&(n=[a(n)]);for(var u=0;u<n.length;u++)r(n[u],o)}}),s),i=(n,s,...o)=>{let{p:u,s:l}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[s]||{p:"",s:""};return n.for(h=>{if(a.is.string(o[0]))h.insertAdjacentHTML(u,o[0]);else{if(!h.parentNode)return;a(o[0]).for(g=>{o[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[l]||h)})}}),n};a.extend({get:function(n){return n?this[0]:e(this,s=>s)},for:function(n,s=1){let o=e(this,(u,l)=>n(u,l),1);return s?o:[]},await:function(n){return y(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return y(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return y(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return y(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.click()}return this})},focus:function(){return y(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.focus()}return this})},addEvent:function(n){return y(this,()=>{let{eventType:s,eventID:o=M(),target:u,callback:l,options:h}=n;return h=R({passive:!0,capture:!1},h),this.for(f=>{if(!(a.is.element(f)||a.is.shadowRoot(f)))return;let{events:g}=f[a.expando];if(u){let b=l;l=m=>{if(m.target){if(a.is.string(u)){let T=m.target.closest(u);T&&(!T||b.call(T,m))}else if(a.is.elements(u)){for(let C of u)if(m.target==C)return b.call(C,m)}}}}if(g[o]){let b=g[o];f.removeEventListener(b.eventType,b.callback,b.options)}g[o]={eventType:s,callback:l,options:h},f.addEventListener(s,l,h)}),this})},removeEvent:function(n){return y(this,()=>{let s=a.is.array(n)?n:[n];return this.for(o=>{let{events:u}=o[a.expando];for(let l of s){let h=u[l];h&&o.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(n){return y(this,()=>v(this,r(n,t(this))))},empty:function(){return y(this,()=>v(this,t(this)))},append:function(n){return y(this,()=>{r(n,this)})},remove:function(){return y(this,()=>(this.for((n,s)=>{n&&a.is.element(n)&&(n.remove(),delete this[s])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...n){return y(this,()=>v(this,i(this,"before",...n)))},after:function(...n){return y(this,()=>v(this,i(this,"after",...n)))},find:function(n){return y(this,()=>{let s=[],o=this[0];o||v(this,a()),(a.is.element(o)||a.is.shadowRoot(o))&&(a.is.string(n)?s=o.querySelectorAll(n):a.is.element(o)&&a(n).for(u=>{let l=o.childNodes;for(let h of l)if(h===u){s.push(h);break}else h.childNodes.length&&(s=[...s,...a(h).find(u).for(f=>f)])})),v(this,a(s))})},parent:function(n){return y(this,()=>{var o,u;let s=a(n?(o=this[0])==null?void 0:o.closest(n):(u=this[0])==null?void 0:u.parentNode);v(this,s)})},children:function(n){return y(this,()=>{let s=this[0].children;a.is.exist(n)&&(n=String(n).replace(/^ : /,""),s=n=="first"?s[0]:n=="last"?s[s.length-1]:s[Number(n)]);let o=a(s);return v(this,o)})},addClass:function(n){return y(this,()=>(n&&this.for(s=>{let o=a.is.string(n)?n.split(" "):n;s&&a.is.element(s)&&s.classList.add(...o)}),this))},removeClass:function(n){return y(this,()=>(n&&this.for(s=>{let o=a.is.string(n)?n.split(" "):n;s&&a.is.element(s)&&s.classList.remove(...o)}),this))},toggleClass:function(n){return y(this,()=>(n&&this.for(s=>{s.classList.toggle(n)}),this))},hasClass:function(n=""){if(this[0])return this[0].classList.contains(n.replace(/^\./,""))},findClass:function(n){let s=[];return this[0]&&(s=[...this[0].classList].filter(o=>o.match(n))),s},css:function(n){return y(this,()=>(this.for(s=>{if(a.is.element(s))for(let[o,u]of Object.entries(n)){if(a.is.number(u)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){s.style[o]=u+"px";continue}s.style[o]=String(u)}}),this))},getAttribute:function(n){return this[0].getAttribute(String(n))},setAttribute:function(n,s){return y(this,()=>(this.for(o=>o.setAttribute(n,s)),this))},getStyleProperty:function(n){let s=this[0];return s&&a.is.element(s)?getComputedStyle(s).getPropertyValue(n):""},setStyleProperty:function(n,s){let o=this[0];return o&&a.is.element(o)&&o.style.setProperty(n,s),this},val:function(){var s;let n=this[0];return(n==null?void 0:n.value)||((s=n==null?void 0:n.dataset)==null?void 0:s.value)},position:function(){return a.is.element(this[0])?this[0].getBoundingClientRect():{}}})}{a.flatArray=(t,r)=>{if(!a.is.array(t))return[t];let i=[];for(let n of t)i.push(...r=="-R"?a.flatArray(n,"-R"):[n]);return i},a.JsonTo=t=>JSON.stringify(t),a.toJson=t=>{let r;try{r={ok:!0,body:JSON.parse(t)}}catch(i){r={ok:!1,body:i}}return r},a.scope=t=>t(),a.randomNumber=(t=0,r=100,i)=>{if(t>r)return NaN;let n=[],s=t;for(;s<=r;){if(i&&i.length&&i.includes(s)){s++;continue}n.push(s),s++}let o=Math.round(Math.random()*(n.length-1))+0;return n[o]};let e={};a.interval={standBy:(t,r,i)=>{e[t]=setTimeout(i,r)},clear:t=>{clearInterval(e[t])}}}a.createElement=function(e){var g;let{tag:t,className:r="",id:i,html:n,attr:s,style:o,parent:u}=e,l=document.createElement(t||"div");if(r&&l.classList.add(...r.split(" ")),i&&(l.id=i),s)for(let b of Object.entries(s)){let m=b[0],C=(g=b[1])!=null?g:"";if(m=="data"&&a.is.keyValueDictionary(C))for(let[T,w]of Object.entries(C))l.dataset[T]=w;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),l[m]=C}if(n&&a(l).append(n),o)for(var[h,f]of Object.entries(o))l.style[h]=f;return u&&a(u).append(l),l},a.setCookie=e=>{let{hostname:t}=new URL(location.toString()),{name:r,value:i="",age:n=60*60*24*365,path:s="/",domain:o=t,secure:u=!1}=e,l=`${r}=${i}max-age=${n}path=${s}domain=${o}`;u&&(l+=" Secure"),document.cookie=l},a.getCookie=e=>{let t=document.cookie.match(new RegExp(e+"=[^]*"));return t?t[0].replace(new RegExp(e+"="),""):""},a.setLocalStrageData=(e,t)=>{localStorage.setItem(e,JSON.stringify(t))},a.getLocalStrageData=e=>{let t=localStorage.getItem(e),r=a.toJson(t);return r.ok?r.body:t},a.deleteCookie=e=>{document.cookie=e+"=max-age=0"},a.getScreenSize=()=>{let{innerHeight:e,innerWidth:t,scrollY:r,scrollX:i,pageXOffset:n,pageYOffset:s}=window,o=Number(a(document.body).getStyleProperty("--sat").removeLetters()),u=Number(a(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:t,pageHeight:e-o-u,scrollY:r,scrollX:i,pageXOffset:n,pageYOffset:s,safeAreaTop:o,safeAreaBottom:u}},a.getCursor=e=>{var i,n,s,o,u,l,h,f;let t=(o=e.pageX)!=null?o:(s=(i=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:i.pageX)!=null?s:(((n=e==null?void 0:e.originalEvent)==null?void 0:n.touches)||[])[0].pageX,r=(f=e.pageY)!=null?f:(h=(u=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:u.pageY)!=null?h:(((l=e==null?void 0:e.originalEvent)==null?void 0:l.touches)||[])[0].pageY;return{x:t,y:r}},a.pending=(e,t)=>new Promise((r,i)=>{e(r),setTimeout(()=>{r(!0)},t)}),a.getLocalIP=e=>{let t="";return a.scope(()=>{if(!e)return;let r=e.networkInterfaces();for(let[i,n]of Object.entries(r))n.forEach(s=>{!s.internal&&s.family==="IPv4"&&!s.address.match(/^(169|127)/)&&(t=s.address)})}),t},a.getIp=function(e){var i;return(((e==null?void 0:e.headers["x-forwarded-for"])||((i=e==null?void 0:e.socket)==null?void 0:i.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"IP UNDEFINED"},a.deepMerge=(e,...t)=>{if(!t.length)return e;let r=t.shift();if(a.is.keyValueDictionary(e)&&a.is.keyValueDictionary(r))for(let i in r)a.is.keyValueDictionary(r[i])?(e[i]||Object.assign(e,{[i]:{}}),a.deepMerge(e[i],r[i])):Object.assign(e,{[i]:r[i]});return a.deepMerge(e,...t)},a.queryParams={get:e=>{let t=new URL(e||location.href),r={};return t.searchParams.forEach((i,n)=>r[n]=i),r},set:(e,t)=>{let r=new URL(t||location.href);return Object.entries(e).forEach(([i,n])=>{r.searchParams.set(i,String(n))}),t||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,t)=>{let r=new URL(t||location.href);return e.forEach(i=>{r.searchParams.delete(i)}),t||history.replaceState({},"",r.pathname+r.search),r.toString()}},a.ellipsisText=(e,t)=>{let r=String(e);return r.length>t&&(r=r.slice(0,t)+" ..."),r},a.is={what:function(e){let t="other";return this.jmini(e)?t="jmini":this.element(e)?t="element":this.elements(e)?t="elements":this.shadowRoot(e)?t="shadowRoot":this.string(e)?t="string":this.number(e)?t="number":this.array(e)?t="array":this.function(e)?t="function":this.date(e)?t="date":typeof e=="undefined"?t="undefined":this.keyValueDictionary(e)?t="keyValueDictionary":e==null?t="null":isNaN(e)&&(t="NaN"),t},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===a},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let t={}.toString.call(e);return e instanceof Array||t=="[object NodeList]"||t=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let t={}.toString.call(e),r=Number(!!e&&typeof e!="string"&&this.array(e)&&t!=="[object Text]");if(r&&t!=="[object NodeList]")for(var i of e)r&=Number(this.element(i));return!!r},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};var re=e=>new c.prototype.time(e),c=re;c.prototype={};var D=function(e,t){e.value=t;let r=a.is.date(t);if(e.validate=r,!r)return e.ms=-1,e.year=-1,e.month=-1,e.weekday=-1,e.weekInYear=-1,e.date=-1,e.hours=-1,e.minutes=-1,e.seconds=-1,e;e.ms=t.getTime(),e.weekday=t.getDay(),e.year=t.getFullYear(),e.month=t.getMonth()+1,e.date=t.getDate();{let i=new Date(e.year,0,1),n=new Date(i.valueOf());n.setDate(n.getDate()-(i.getDay()+1));let s=t.getTime()-n.getTime(),o=Math.ceil(s/(1e3*60*60*24));e.weekInYear=Math.ceil(o/7)}{let i=new Date(e.year,e.month-1,1),n=new Date(i.valueOf());n.setDate(n.getDate()-(i.getDay()+1));let s=t.getTime()-n.getTime(),o=Math.ceil(s/(1e3*60*60*24)),u=Math.ceil(o/7);e.weekInMonth=u}{let i=new Date(e.year,e.month,0),n=i.getDay(),s=new Date(new Date(i).setDate(i.getDate()-n));e.isLastWeekInMonth=e.date>=s.getDate()}return e.hours=t.getHours(),e.minutes=t.getMinutes(),e.seconds=t.getSeconds(),e};a.extend({constructor:c,time:function(e){c.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(e);return D(this,t)}},c);c.prototype.time.prototype=c.prototype;c.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===c};c.getFromNumberYYYYMMDD=e=>{let t=String(e).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return c(t+" 00:00")};c.getPeriodArray=(e,t,r)=>{let i=[],n=t;if(!t.validate||!r.validate)return i;for(;n.toFormatYMDHMS().toNumber()<=r.toFormatYMDHMS().toNumber();)i.push(n),e=="year"?n=c(n).addYear(1):e=="month"?n=c(n).addMonth(1):e=="week"?n=c(n).addWeek(1):e=="day"?n=c(n).addDate(1):e=="hours"?n=c(n).addHours(1):e=="minutes"?n=c(n).addMinutes(1):e=="seconds"&&(n=c(n).addSeconds(1));return i};a.extend({setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),D(this,t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),D(this,t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),D(this,t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),D(this,t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),D(this,t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),D(this,t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),D(this,t)},setMidnight:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),D(this,e)},addYear:function(e){return this.setYear(this.year+e)},addMonth:function(e){return this.setMonth(this.month+e)},addWeek:function(e){return this.addDate(7*e)},addDate:function(e){return this.setDate(this.date+e)},addHours:function(e){return this.setHours(this.hours+e)},addMinutes:function(e){return this.setMinutes(this.minutes+e)},addSeconds:function(e){return this.setSeconds(this.seconds+e)},isSameYear:function(e){let t=c(e);return this.year==t.year},isSameMonth:function(e){let t=c(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=c(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=c(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},toFormat:function(e){return this.validate?e.replace(/\%y/ig,this.year.zeroEmbed(4)).replace(/\%m/ig,this.month.zeroEmbed(2)).replace(/\%d/ig,this.date.zeroEmbed(2)).replace(/\%w/ig,this.weekInYear.zeroEmbed(2)).replace(/\%h/ig,this.hours.zeroEmbed(2)).replace(/\%i/ig,this.minutes.zeroEmbed(2)).replace(/\%s/ig,this.seconds.zeroEmbed(2)):""},toFormatYMD:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D"):""},toFormatYM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708"):this.toFormat("%Y/%M"):""},toFormatMD:function(e){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):""},toFormatHM:function(e){return this.validate?e=="JP"?this.toFormat("%h\u6642%m\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206"):this.toFormat("%Y/%M/%D %h:%i"):""},toFormatYMDHMS:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2"):this.toFormat("%Y/%M/%D %h:%i:%s"):""},getFirstDayOfTheYear:function(){return c(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return c(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return c(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return c(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=c(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=c(this.value);return e.addDate(6-e.weekday)},diff:function(e){let t=this.ms-e.ms;return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:Math.floor(t/(60*60*24*1e3)),hours:Math.floor(t/(60*60*1e3)),minutes:Math.floor(t/(60*1e3)),seconds:Math.floor(t/1e3)}},getAge:function(e){let t=e||c(),r=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&r--,r}},c);var d=(e,t)=>new d.prototype.instance(e,t);d.prototype={};d.waitList=[];d.setDefaultTrafficControl=0;d.setDefaultTimeout=1e3*60*10;d.isReadableStream=e=>e instanceof ReadableStream;d.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;d.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!d.isReadableStreamReader(r))return{ok:!1,done:!0,data:null};if(!r)return{ok:!1,done:!0,data:null};let i=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),n=yield r.read();return{ok:!0,done:n.done,data:i.decode(n.value)}}catch(r){return{ok:!1,done:!0,data:r}}});a.extend({constructor:d,instance:function(e,t){var n;t=t||{};let r=t.body;t.body&&!a.is.string(t.body)&&((n=t.bodyStringify)==null||n)&&(r=JSON.stringify(t.body||{}));let i=e;return a.is.string(e)&&!e.match(/https?:/)&&(i=location.origin+"/"+e.replace(/^\//,"")),this.url=i,this.method=t.method||"get",this.streamStatus="open",this.params=U(R({key:M(),response_format:"json",timeout:d.setDefaultTimeout,trafficControl:d.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:R(R({"Content-Type":"application/json"},d.setDefaultHeaders&&d.setDefaultHeaders()),t.headers),body:r}),this},onStart:function(e){return this.onStartCB=e,this},onStream:function(e){return this.onStreamCB=e,this},onResult:function(e){return this.onResultCB=e,this},onComplete:function(e){return this.onCompleteCB=e,this},onError:function(e){return this.onErrorCB=e,this},onStreamProcess:function(e){return p(this,null,function*(){let{response:t,errorCB:r,streamCB:i,reader:n,decoder:s}=e,o=t.body,u=this,l=function(){return Y(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:C,done:T,data:w}=yield d.streamToContext(o,{reader:n,decoder:s});C&&r(w)}));return}let m=!1;for(;!m;){let{ok:C,done:T,data:w}=yield new P(d.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),T=!0):u.streamStatus=="closed"&&(T=!0),T&&(m=T,n.releaseLock()),i(w,T)}})};try{for(var h=j(l()),f,g,b;f=!(g=yield h.next()).done;f=!1){let m=g.value;;}}catch(g){b=[g]}finally{try{f&&(g=h.return)&&(yield g.call(h))}finally{if(b)throw b[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return p(this,null,function*(){var b;let e=this.params,t=performance.now(),r=0,i=new AbortController,n=setTimeout(()=>{i.abort()},e.timeout);e.signal=i.signal;let s=!1,o=500,u="InternalServerError",l={},h=null;try{d.setDefaultOnStart&&d.setDefaultOnStart(e),this.onStartCB&&this.onStartCB(e);let g=e,{key:m,response_format:C,trafficControl:T,preventMultiRequest:w,timeout:ae,queries:q}=g,O=H(g,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);O.method=this.method;let $=d.waitList.includes(m);if(w&&$)throw o=429,new Error("TooManyRequests");d.waitList=[...d.waitList,m];let W=a.queryParams.set(R({},q),String(this.url));l=yield fetch(W,O).then(x=>p(this,null,function*(){return s=x.ok,o=x.status,u=x.statusText,h=x,C=="none"||C=="stream"?x:x[C]()})).catch(x=>{throw new Error(x)})}catch(m){o==200&&(o=500,s=!1),o==429&&(u="TooManyRequests"),i.signal.aborted&&(o=408,u="Timeout"),o==500&&(u=String(m)||u),l={errorCode:String(m)}}finally{clearTimeout(n),r=performance.now()-t}e.trafficControl&&(yield a.pending(()=>{},e.trafficControl)),d.waitList.splice(d.waitList.findIndex(m=>m==e.key),1);let f={ok:s,status:o,statusText:u,body:l,requestTime:r,rawData:h};if(!s&&this.onErrorCB&&this.onErrorCB(f.body),s&&this.onStreamCB&&e.response_format=="stream"){let m=(b=h.body)==null?void 0:b.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:f,reader:m,decoder:new TextDecoder("utf-8")})}return s&&this.onCompleteCB&&this.onCompleteCB(f.body),this.onResultCB&&this.onResultCB(f,e),d.setDefaultOnEnd&&d.setDefaultOnEnd(f,e),f})},abortStream:function(){this.streamStatus="abort"}},d);d.prototype.instance.prototype=d.prototype;var S=e=>new S.prototype.instance(e);S.prototype={};a.extend({constructor:S,instance:function(e){this.ok=!0;try{let[t,r]=e.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=e,this.extension=r,this.fileName=t,this.type=e.type}catch(t){console.log(t),this.ok=!1}return this},isValid:function(){return this.ok},toBlob:function(){return p(this,null,function*(){return new Blob([this.file,{type:this.type}])})},toDataURL:function(){return p(this,null,function*(){var e;return(e=(yield this.file.convert("dataURL")).target)==null?void 0:e.result})},toAarrayBuffer:function(){return p(this,null,function*(){var e;return(e=(yield this.file.convert("arrayBuffer")).target)==null?void 0:e.result})},toObjectURL:function(){return p(this,null,function*(){return URL.createObjectURL(this.file)})},updateFileName:function(e){let t=new File([this.file],e+"."+this.extension);return this.file=t,this.fileName=e,this},updateMimeType:function(e){return this.file=new File([this.file],this.fileName+"."+this.extension,{type:e}),this.type=e,this},updateExtension:function(e){let t=new File([this.file],this.fileName+"."+e);return this.file=t,this.extension=e,this}},S);S.prototype.instance.prototype=S.prototype;var k={fromFile:e=>p(void 0,null,function*(){return S(e)}),fromBlob:(e,t)=>p(void 0,null,function*(){let r=(t==null?void 0:t.fileName)||"file",i=(t==null?void 0:t.extension)||"",n=new File([e],r+"."+i,{type:t==null?void 0:t.mimeType});return S(n)}),fromArrayBuffer:(e,t)=>p(void 0,null,function*(){return k.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)}),fromObjectURL:(e,t)=>p(void 0,null,function*(){let r=yield d(e,{response_format:"blob"}).get();return r.ok?k.fromBlob(r.body,t):S({})}),fromDataURL:(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?k.fromBlob(r,t):S({})})};var V=function(e){let t=e,r=null;return t.use((i,n,s)=>{let o=n;o.return=u=>{let{status:l=200,body:h={},bodyStringify:f=!0}=u||{},g=h;return f&&(a.is.string(h)||(g=JSON.stringify(h))),n.status(l).end(g)},s()}),t.onPathRouter=function(i){return r=i,this},t.pathRouter=function(i){if(!r)return;let n=r(i);return n.route(i),t.use(i,n),n},t.exception=function(i){return t.use(i),this},t};a.copyToClipboard=e=>p(void 0,null,function*(){let t="";a.is.string(e)?t=e:a.is.function(e)&&(t=e());let r={ok:!1,body:"NotSupported"};return yield p(void 0,null,function*(){let i;if(navigator.clipboard){if(i=yield navigator.clipboard.writeText(t).then(()=>!0,()=>!1),!i)return}else{let n=document.createElement("input");if(a(document.body).append(n),n.value=t,n.select(),i=document.execCommand("copy"),document.body.removeChild(n),!i)return}r={ok:!0,body:""}}),r});a.ImageLoader=(e,t)=>new Promise((r,i)=>{let n=t||new Image;n.onload=()=>r(n),n.onerror=s=>i(s),n.src=e});a.formatCharacter={postal:{JP:e=>{let t="--";return e=String(e).replace(/\D/ig,""),e.length==7&&(t=e.replace(/^(\d{3})(.*)/,"$1-$2")),t}},tel:{_:e=>{let t=e;return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t},mobile:e=>{let t="--";return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),t},fixed:e=>{let t="--";return e=String(e).removeLetters(),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t}}};a.transformer={weekday:{JP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]+"\u66DC\u65E5",shortJP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]},wareki:e=>{let t=[],r=[],i=!1;return[{From:1868,To:1912,name:"\u660E\u6CBB"},{From:1912,To:1926,name:"\u5927\u6B63"},{From:1926,To:1989,name:"\u662D\u548C"},{From:1989,To:2019,name:"\u5E73\u6210"},{From:2019,To:1e5,name:"\u4EE4\u548C"}].forEach(s=>{let{From:o,To:u,name:l}=s;if(o<=e&&e<=u){let h=e-o+1;h==1&&(i=!0,h="\u5143"),r.push(l+h+"\u5E74"),t.push(l)}}),{era:t,value:r,gap:i}}};d.setDefaultHeaders=()=>({});var ie=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID});
|
|
1
|
+
"use strict";var A=Object.defineProperty,K=Object.defineProperties,z=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var P=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var E=Math.pow,N=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||(t={}))B.call(t,n)&&N(e,n,t[n]);if(F)for(var n of F(t))U.call(t,n)&&N(e,n,t[n]);return e},H=(e,t)=>K(e,X(t));var Y=(e,t)=>{var n={};for(var i in e)B.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&F)for(var i of F(e))t.indexOf(i)<0&&U.call(e,i)&&(n[i]=e[i]);return n};var Q=(e,t)=>{for(var n in t)A(e,n,{get:t[n],enumerable:!0})},Z=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!B.call(e,r)&&r!==n&&A(e,r,{get:()=>t[r],enumerable:!(i=z(t,r))||i.enumerable});return e};var _=e=>Z(A({},"__esModule",{value:!0}),e);var p=(e,t,n)=>new Promise((i,r)=>{var s=l=>{try{u(n.next(l))}catch(h){r(h)}},o=l=>{try{u(n.throw(l))}catch(h){r(h)}},u=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,o);u((n=n.apply(e,t)).next())}),J=function(e,t){this[0]=e,this[1]=t},j=(e,t,n)=>{var i=(o,u,l,h)=>{try{var f=n[o](u),g=(u=f.value)instanceof J,b=f.done;Promise.resolve(g?u[0]:u).then(m=>g?i(o==="return"?o:"next",u[1]?{done:m.done,value:m.value}:m,l,h):l({value:m,done:b})).catch(m=>i("throw",m,l,h))}catch(m){h(m)}},r=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return n=n.apply(e,t),s[P("asyncIterator")]=()=>s,r("next"),r("throw"),r("return"),s};var V=(e,t,n)=>(t=e[P("asyncIterator")])?t.call(e):(e=e[P("iterator")](),t={},n=(i,r)=>(r=e[i])&&(t[i]=s=>new Promise((o,u,l)=>(s=r.call(e,s),l=s.done,Promise.resolve(s.value).then(h=>o({value:h,done:l}),u)))),n("next"),n("return"),t);var ae={};Q(ae,{Fetcher:()=>d,Filer:()=>k,Server:()=>L,Time:()=>c,UUID:()=>S,default:()=>se});module.exports=_(ae);typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()});typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let e=this;return e&&(e=e.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,t=>t[1].toUpper())),e},String.prototype.clip=function(e,t){return this.slice(e,t)},String.prototype.partReplace=function(e,t){return this.slice(0,e)+t+this.slice(e+t.length)},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),n=new Uint8Array(t.length);for(var i=0;i<t.length;i++)n[i]=t.charCodeAt(i);try{var r=new Blob([n.buffer],{type:e})}catch(s){return!1}return r},String.prototype.toNumber=function(){return Number(this.removeLetters())},String.prototype.removeLetters=function(){return this.replace(/[\D]/ig,"")},String.prototype.removeSpecifics=function(){return this.replace(/[^\w\s\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]|_/uig,"")},String.prototype.removeJP=function(){return this.replace(/[\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]+/uig,"")},String.prototype.zen2hanNumber=function(){return this.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,"-").replace(/¥/,"\xA5").replace(/、/,",").replace(/(/,"(").replace(/)/,")").replace(/+/,"+")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let n=E(10,t);return Math.round(this/e*n*100)/n},Number.prototype.rate=function(e,t=2){let n=E(10,t);return Math.round(this/e*n)/n},Number.prototype.rank=function(e=1){let t=E(10,e),n=Number(this),i=n.toLocaleString().replace(/\d/ig,"").length;return Math.round(n/E(1e3,i)*t)/t+("KMGTPEZY"[i-1]||"")},Number.prototype.rankJp=function(){let e=Number(this),t="";return e>=1e12?t=`${e/1e12}\u5146`:e>=1e8?t=`${e/1e8}\u5104`:e>=1e4?t=`${e/1e4}\u4E07`:e>=1e3?t=`${e/1e3}\u5343`:t=`${e.toLocaleString()}`,t},Number.prototype.toDate=function(e="/"){let t=String(this),n=t.slice(0,4),i=t.slice(4,6),r=t.slice(6,8),s=[];return n.length!=4||s.push(n),i.length!=2||s.push(i),r.length!=2||s.push(r),s.join(e)});if(typeof Array!="undefined"){let e=(t,n)=>{if(!t)return;let i=t;for(let r of n){if(!i)break;i=i[r]}return i};Array.prototype.order=function(t){let{direction:n="ASC",keys:i=[],numeral:r=!1}=t,s=[];return i.length?r?s=this.sort((o,u)=>+(Number(e(o,i))>Number(e(u,i)))*2-1):s=this.sort((o,u)=>{let l=String(e(o,i)).replace(/(\d+)/g,f=>f.padStart(18,"0")),h=String(e(u,i)).replace(/(\d+)/g,f=>f.padStart(18,"0"));return+(l>h)*2-1}):r?s=this.sort((o,u)=>+(o>u)*2-1):s=this.sort((o,u)=>{let l=String(o).replace(/(\d+)/g,f=>f.padStart(18,"0")),h=String(u).replace(/(\d+)/g,f=>f.padStart(18,"0"));return+(l>h)*2-1}),n=="DESC"&&(s=s.reverse()),s},Array.prototype.getLastChild=function(){let t=this.length-1;return this[t]}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,n)=>{let i=new FileReader;i.onload=s=>t(s),i.onerror=s=>n(s);let r="readAs"+(e==null?void 0:e.toCapital());i[r](this)})});var ee=(e=24)=>Array.from({length:e}).map((t,n)=>{let i=n==0?25:35,r=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*i)][r?"toUpper":"toLower"]()}).join(""),S=ee;S.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");S.gen32Hex=(e="Formatted",t="-")=>{let n=Array.from({length:32}).map((i,r)=>"0123456789abcdef"[Math.round(Math.random()*15)]).join("").toUpper();return e=="Formatted"&&(n=[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20,32)].join(t)),n};S.to32Format=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20,32)].join("-").toUpper();var te=e=>new a.prototype.jmini(e),a=te;a.prototype={};a.extend=function(e,t=a){for(var[n,i]of Object.entries(e))t.prototype[n]=i};a.expando="__jmini_"+S();var y=(e,t)=>(e.queue.push(t),O(e),e),O=e=>p(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let t=e.queue.shift();t&&(yield t()),e.queueProcess=!1,O(e)}}),D=(e,t)=>{for(let n=0;n<e.length;n++)e[n]=null;for(let[n,i]of Object.entries(t))n.match(/queue/)||(e[n]=i);return e},re=(e,t)=>{if(t.length){for(var n=0;n<t.length;n++){let i=t[n];i&&(i[a.expando]||(a.is.element(i)||a.is.shadowRoot(i))&&(i[a.expando]={events:{}})),e[n]=i}e.length=t.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,O(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],re(this,a.is.jmini(e)?e.get():a.is.element(e)?[e]:a.is.elements(e)?e:a.is.shadowRoot(e)?[e]:a.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}});a.prototype[String(Symbol.iterator)]=[][Symbol.iterator];a.prototype.jmini.prototype=a.prototype;{let e=function(r,s,o){let u=[];for(let l=0;l<(r.length||0);l++)u.push(s(r[l],l));return o&&(u=u.filter(l=>l!=null)),u},t=r=>(r.for((s,o)=>{if(!(a.is.element(s)||a.is.shadowRoot(s)))return;let u=s.cloneNode(),l=s.parentNode;l&&l.replaceChild(u,s),r[o]=u}),r),n=(r,s)=>(a(s).for(o=>{if(r&&(a.is.element(o)||a.is.shadowRoot(o)))if(a.is.string(r)||a.is.number(r))r=String(r),o.insertAdjacentHTML("beforeend",String(r));else if(a.is.element(r))o.appendChild(r);else{a.is.jmini(r)?r=r.get():a.is.element(r)?r=[r]:a.is.keyValueDictionary(r)&&(r=[a(r)]);for(var u=0;u<r.length;u++)n(r[u],o)}}),s),i=(r,s,...o)=>{let{p:u,s:l}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[s]||{p:"",s:""};return r.for(h=>{if(a.is.string(o[0]))h.insertAdjacentHTML(u,o[0]);else{if(!h.parentNode)return;a(o[0]).for(g=>{o[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[l]||h)})}}),r};a.extend({get:function(r){return r?this[0]:e(this,s=>s)},for:function(r,s=1){let o=e(this,(u,l)=>r(u,l),1);return s?o:[]},await:function(r){return y(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},r)}))},abort:function(){return y(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(r){return y(this,()=>p(this,null,function*(){return yield r(this),this}))},click:function(){return y(this,()=>{for(var r=0;r<this.length;r++){let s=this[r];a.is.element(s)&&s.click()}return this})},focus:function(){return y(this,()=>{for(var r=0;r<this.length;r++){let s=this[r];a.is.element(s)&&s.focus()}return this})},addEvent:function(r){return y(this,()=>{let{eventType:s,eventID:o=S(),target:u,callback:l,options:h}=r;return h=R({passive:!0,capture:!1},h),this.for(f=>{if(!(a.is.element(f)||a.is.shadowRoot(f)))return;let{events:g}=f[a.expando];if(u){let b=l;l=m=>{if(m.target){if(a.is.string(u)){let T=m.target.closest(u);T&&(!T||b.call(T,m))}else if(a.is.elements(u)){for(let C of u)if(m.target==C)return b.call(C,m)}}}}if(g[o]){let b=g[o];f.removeEventListener(b.eventType,b.callback,b.options)}g[o]={eventType:s,callback:l,options:h},f.addEventListener(s,l,h)}),this})},removeEvent:function(r){return y(this,()=>{let s=a.is.array(r)?r:[r];return this.for(o=>{let{events:u}=o[a.expando];for(let l of s){let h=u[l];h&&o.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(r){return y(this,()=>D(this,n(r,t(this))))},empty:function(){return y(this,()=>D(this,t(this)))},append:function(r){return y(this,()=>{n(r,this)})},remove:function(){return y(this,()=>(this.for((r,s)=>{r&&a.is.element(r)&&(r.remove(),delete this[s])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...r){return y(this,()=>D(this,i(this,"before",...r)))},after:function(...r){return y(this,()=>D(this,i(this,"after",...r)))},find:function(r){return y(this,()=>{let s=[],o=this[0];o||D(this,a()),(a.is.element(o)||a.is.shadowRoot(o))&&(a.is.string(r)?s=o.querySelectorAll(r):a.is.element(o)&&a(r).for(u=>{let l=o.childNodes;for(let h of l)if(h===u){s.push(h);break}else h.childNodes.length&&(s=[...s,...a(h).find(u).for(f=>f)])})),D(this,a(s))})},parent:function(r){return y(this,()=>{var o,u;let s=a(r?(o=this[0])==null?void 0:o.closest(r):(u=this[0])==null?void 0:u.parentNode);D(this,s)})},children:function(r){return y(this,()=>{let s=this[0].children;a.is.exist(r)&&(r=String(r).replace(/^ : /,""),s=r=="first"?s[0]:r=="last"?s[s.length-1]:s[Number(r)]);let o=a(s);return D(this,o)})},addClass:function(r){return y(this,()=>(r&&this.for(s=>{let o=a.is.string(r)?r.split(" "):r;s&&a.is.element(s)&&s.classList.add(...o)}),this))},removeClass:function(r){return y(this,()=>(r&&this.for(s=>{let o=a.is.string(r)?r.split(" "):r;s&&a.is.element(s)&&s.classList.remove(...o)}),this))},toggleClass:function(r){return y(this,()=>(r&&this.for(s=>{s.classList.toggle(r)}),this))},hasClass:function(r=""){if(this[0])return this[0].classList.contains(r.replace(/^\./,""))},findClass:function(r){let s=[];return this[0]&&(s=[...this[0].classList].filter(o=>o.match(r))),s},css:function(r){return y(this,()=>(this.for(s=>{if(a.is.element(s))for(let[o,u]of Object.entries(r)){if(a.is.number(u)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){s.style[o]=u+"px";continue}s.style[o]=String(u)}}),this))},getAttribute:function(r){return this[0].getAttribute(String(r))},setAttribute:function(r,s){return y(this,()=>(this.for(o=>o.setAttribute(r,s)),this))},getStyleProperty:function(r){let s=this[0];return s&&a.is.element(s)?getComputedStyle(s).getPropertyValue(r):""},setStyleProperty:function(r,s){let o=this[0];return o&&a.is.element(o)&&o.style.setProperty(r,s),this},val:function(){var s;let r=this[0];return(r==null?void 0:r.value)||((s=r==null?void 0:r.dataset)==null?void 0:s.value)},position:function(){return a.is.element(this[0])?this[0].getBoundingClientRect():{}}})}{a.flatArray=(t,n)=>{if(!a.is.array(t))return[t];let i=[];for(let r of t)i.push(...n=="-R"?a.flatArray(r,"-R"):[r]);return i},a.Stringify=t=>JSON.stringify(t),a.Objectify=(t,n)=>{try{return JSON.parse(t)}catch(i){return n!=null?n:null}},a.scope=t=>t(),a.randomNumber=(t=0,n=100,i)=>{if(t>n)return NaN;let r=[],s=t;for(;s<=n;){if(i&&i.length&&i.includes(s)){s++;continue}r.push(s),s++}let o=Math.round(Math.random()*(r.length-1))+0;return r[o]};let e={};a.interval={standBy:(t,n,i)=>{e[t]=setTimeout(i,n)},clear:t=>{clearInterval(e[t])}}}a.createElement=function(e){var g;let{tag:t,className:n="",id:i,html:r,attr:s,style:o,parent:u}=e,l=document.createElement(t||"div");if(n&&l.classList.add(...n.split(" ")),i&&(l.id=i),s)for(let b of Object.entries(s)){let m=b[0],C=(g=b[1])!=null?g:"";if(m=="data"&&a.is.keyValueDictionary(C))for(let[T,w]of Object.entries(C))l.dataset[T]=w;else m=="for"?m="htmlFor":m=="tabindex"?m="tabIndex":m=="aria-label"&&(m="ariaLabel"),l[m]=C}if(r&&a(l).append(r),o)for(var[h,f]of Object.entries(o))l.style[h]=f;return u&&a(u).append(l),l},a.setCookie=e=>{let{hostname:t}=new URL(location.toString()),{name:n,value:i="",age:r=60*60*24*365,path:s="/",domain:o=t,secure:u=!1}=e,l=`${n}=${i}max-age=${r}path=${s}domain=${o}`;u&&(l+=" Secure"),document.cookie=l},a.getCookie=e=>{let t=document.cookie.match(new RegExp(e+"=[^]*"));return t?t[0].replace(new RegExp(e+"="),""):""},a.localStrage={set:(e,t)=>{localStorage.setItem(e,a.Stringify(t))},get:e=>{let t=localStorage.getItem(e);return a.Objectify(t,t)}},a.deleteCookie=e=>{document.cookie=e+"=max-age=0"},a.getScreenSize=()=>{let{innerHeight:e,innerWidth:t,scrollY:n,scrollX:i,pageXOffset:r,pageYOffset:s}=window,o=Number(a(document.body).getStyleProperty("--sat").removeLetters()),u=Number(a(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:t,pageHeight:e-o-u,scrollY:n,scrollX:i,pageXOffset:r,pageYOffset:s,safeAreaTop:o,safeAreaBottom:u}},a.getCursor=e=>{var i,r,s,o,u,l,h,f;let t=(o=e.pageX)!=null?o:(s=(i=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:i.pageX)!=null?s:(((r=e==null?void 0:e.originalEvent)==null?void 0:r.touches)||[])[0].pageX,n=(f=e.pageY)!=null?f:(h=(u=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:u.pageY)!=null?h:(((l=e==null?void 0:e.originalEvent)==null?void 0:l.touches)||[])[0].pageY;return{x:t,y:n}},a.pending=(e,t)=>new Promise((n,i)=>{e(n),setTimeout(()=>{n(!0)},t)}),a.deepMerge=(e,...t)=>{if(!t.length)return e;let n=t.shift();if(a.is.keyValueDictionary(e)&&a.is.keyValueDictionary(n))for(let i in n)a.is.keyValueDictionary(n[i])?(e[i]||Object.assign(e,{[i]:{}}),a.deepMerge(e[i],n[i])):Object.assign(e,{[i]:n[i]});return a.deepMerge(e,...t)},a.queryParams={get:e=>{let t=new URL(e||location.href),n={};return t.searchParams.forEach((i,r)=>n[r]=i),n},set:(e,t)=>{let n=new URL(t||location.href);return Object.entries(e).forEach(([i,r])=>{n.searchParams.set(i,String(r))}),t||history.replaceState({},"",n.pathname+n.search),n.toString()},delete:(e,t)=>{let n=new URL(t||location.href);return e.forEach(i=>{n.searchParams.delete(i)}),t||history.replaceState({},"",n.pathname+n.search),n.toString()}},a.ellipsisText=(e,t)=>{let n=String(e);return n.length>t&&(n=n.slice(0,t)+" ..."),n},a.is={what:function(e){let t="other";return this.jmini(e)?t="jmini":this.element(e)?t="element":this.elements(e)?t="elements":this.shadowRoot(e)?t="shadowRoot":this.string(e)?t="string":this.number(e)?t="number":this.array(e)?t="array":this.function(e)?t="function":this.date(e)?t="date":typeof e=="undefined"?t="undefined":this.keyValueDictionary(e)?t="keyValueDictionary":e==null?t="null":isNaN(e)&&(t="NaN"),t},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===a},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let t={}.toString.call(e);return e instanceof Array||t=="[object NodeList]"||t=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let t={}.toString.call(e),n=Number(!!e&&typeof e!="string"&&this.array(e)&&t!=="[object Text]");if(n&&t!=="[object NodeList]")for(var i of e)n&=Number(this.element(i));return!!n},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};var ne=e=>new c.prototype.time(e),c=ne;c.prototype={};var v=function(e,t){e.value=t;let n=a.is.date(t);if(e.validate=n,!n)return e.ms=-1,e.year=-1,e.month=-1,e.weekday=-1,e.weekInYear=-1,e.date=-1,e.hours=-1,e.minutes=-1,e.seconds=-1,e;e.ms=t.getTime(),e.weekday=t.getDay(),e.year=t.getFullYear(),e.month=t.getMonth()+1,e.date=t.getDate();{let i=new Date(e.year,0,1),r=new Date(i.valueOf());r.setDate(r.getDate()-(i.getDay()+1));let s=t.getTime()-r.getTime(),o=Math.ceil(s/(1e3*60*60*24));e.weekInYear=Math.ceil(o/7)}{let i=new Date(e.year,e.month-1,1),r=new Date(i.valueOf());r.setDate(r.getDate()-(i.getDay()+1));let s=t.getTime()-r.getTime(),o=Math.ceil(s/(1e3*60*60*24)),u=Math.ceil(o/7);e.weekInMonth=u}{let i=new Date(e.year,e.month,0),r=i.getDay(),s=new Date(new Date(i).setDate(i.getDate()-r));e.isLastWeekInMonth=e.date>=s.getDate()}return e.hours=t.getHours(),e.minutes=t.getMinutes(),e.seconds=t.getSeconds(),e};a.extend({constructor:c,time:function(e){c.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(e);return v(this,t)}},c);c.prototype.time.prototype=c.prototype;c.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===c};c.getFromNumberYYYYMMDD=e=>{let t=String(e).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return c(t+" 00:00")};c.getPeriodArray=(e,t,n)=>{let i=[],r=t;if(!t.validate||!n.validate)return i;for(;r.toFormatYMDHMS().toNumber()<=n.toFormatYMDHMS().toNumber();)i.push(r),e=="year"?r=c(r).addYear(1):e=="month"?r=c(r).addMonth(1):e=="week"?r=c(r).addWeek(1):e=="day"?r=c(r).addDate(1):e=="hours"?r=c(r).addHours(1):e=="minutes"?r=c(r).addMinutes(1):e=="seconds"&&(r=c(r).addSeconds(1));return i};a.extend({setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),v(this,t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),v(this,t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),v(this,t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),v(this,t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),v(this,t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),v(this,t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),v(this,t)},setMidnight:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),v(this,e)},addYear:function(e){return this.setYear(this.year+e)},addMonth:function(e){return this.setMonth(this.month+e)},addWeek:function(e){return this.addDate(7*e)},addDate:function(e){return this.setDate(this.date+e)},addHours:function(e){return this.setHours(this.hours+e)},addMinutes:function(e){return this.setMinutes(this.minutes+e)},addSeconds:function(e){return this.setSeconds(this.seconds+e)},isSameYear:function(e){let t=c(e);return this.year==t.year},isSameMonth:function(e){let t=c(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=c(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=c(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},toFormat:function(e){return this.validate?e.replace(/\%y/ig,this.year.zeroEmbed(4)).replace(/\%m/ig,this.month.zeroEmbed(2)).replace(/\%d/ig,this.date.zeroEmbed(2)).replace(/\%w/ig,this.weekInYear.zeroEmbed(2)).replace(/\%h/ig,this.hours.zeroEmbed(2)).replace(/\%i/ig,this.minutes.zeroEmbed(2)).replace(/\%s/ig,this.seconds.zeroEmbed(2)):""},toFormatYMD:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D"):""},toFormatYM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708"):this.toFormat("%Y/%M"):""},toFormatMD:function(e){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):""},toFormatHM:function(e){return this.validate?e=="JP"?this.toFormat("%h\u6642%m\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206"):this.toFormat("%Y/%M/%D %h:%i"):""},toFormatYMDHMS:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2"):this.toFormat("%Y/%M/%D %h:%i:%s"):""},getFirstDayOfTheYear:function(){return c(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return c(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return c(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return c(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=c(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=c(this.value);return e.addDate(6-e.weekday)},diff:function(e){let t=this.ms-e.ms;return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:Math.floor(t/(60*60*24*1e3)),hours:Math.floor(t/(60*60*1e3)),minutes:Math.floor(t/(60*1e3)),seconds:Math.floor(t/1e3)}},getAge:function(e){let t=e||c(),n=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&n--,n}},c);var d=(e,t)=>new d.prototype.instance(e,t);d.prototype={};d.waitList=[];d.setDefaultTrafficControl=0;d.setDefaultTimeout=1e3*60*10;d.isReadableStream=e=>e instanceof ReadableStream;d.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;d.streamToContext=(e,t)=>p(void 0,null,function*(){try{let n=(t==null?void 0:t.reader)||e.getReader();if(!d.isReadableStreamReader(n))return{ok:!1,done:!0,data:null};if(!n)return{ok:!1,done:!0,data:null};let i=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),r=yield n.read();return{ok:!0,done:r.done,data:i.decode(r.value)}}catch(n){return{ok:!1,done:!0,data:n}}});a.extend({constructor:d,instance:function(e,t){var r;t=t||{};let n=t.body;t.body&&!a.is.string(t.body)&&((r=t.bodyStringify)==null||r)&&(n=a.Stringify(t.body||{}));let i=e;return a.is.string(e)&&!e.match(/https?:/)&&(i=location.origin+"/"+e.replace(/^\//,"")),this.url=i,this.method=t.method||"get",this.streamStatus="open",this.params=H(R({key:S(),response_format:"json",timeout:d.setDefaultTimeout,trafficControl:d.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:R(R({"Content-Type":"application/json"},d.setDefaultHeaders&&d.setDefaultHeaders()),t.headers),body:n}),this},onStart:function(e){return this.onStartCB=e,this},onStream:function(e){return this.onStreamCB=e,this},onResult:function(e){return this.onResultCB=e,this},onComplete:function(e){return this.onCompleteCB=e,this},onError:function(e){return this.onErrorCB=e,this},onStreamProcess:function(e){return p(this,null,function*(){let{response:t,errorCB:n,streamCB:i,reader:r,decoder:s}=e,o=t.body,u=this,l=function(){return j(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:C,done:T,data:w}=yield d.streamToContext(o,{reader:r,decoder:s});C&&n(w)}));return}let m=!1;for(;!m;){let{ok:C,done:T,data:w}=yield new J(d.streamToContext(o,{reader:r,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",r.cancel(),T=!0):u.streamStatus=="closed"&&(T=!0),T&&(m=T,r.releaseLock()),i(w,T)}})};try{for(var h=V(l()),f,g,b;f=!(g=yield h.next()).done;f=!1){let m=g.value;;}}catch(g){b=[g]}finally{try{f&&(g=h.return)&&(yield g.call(h))}finally{if(b)throw b[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return p(this,null,function*(){var b;let e=this.params,t=performance.now(),n=0,i=new AbortController,r=setTimeout(()=>{i.abort()},e.timeout);e.signal=i.signal;let s=!1,o=500,u="InternalServerError",l={},h=null;try{d.setDefaultOnStart&&d.setDefaultOnStart(e),this.onStartCB&&this.onStartCB(e);let g=e,{key:m,response_format:C,trafficControl:T,preventMultiRequest:w,timeout:oe,queries:$}=g,I=Y(g,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);I.method=this.method;let q=d.waitList.includes(m);if(w&&q)throw o=429,new Error("TooManyRequests");d.waitList=[...d.waitList,m];let W=a.queryParams.set(R({},$),String(this.url));l=yield fetch(W,I).then(x=>p(this,null,function*(){return s=x.ok,o=x.status,u=x.statusText,h=x,C=="none"||C=="stream"?x:x[C]()})).catch(x=>{throw new Error(x)})}catch(m){o==200&&(o=500,s=!1),o==429&&(u="TooManyRequests"),i.signal.aborted&&(o=408,u="Timeout"),o==500&&(u=String(m)||u),l={errorCode:String(m)}}finally{clearTimeout(r),n=performance.now()-t}e.trafficControl&&(yield a.pending(()=>{},e.trafficControl)),d.waitList.splice(d.waitList.findIndex(m=>m==e.key),1);let f={ok:s,status:o,statusText:u,body:l,requestTime:n,rawData:h};if(!s&&this.onErrorCB&&this.onErrorCB(f.body),s&&this.onStreamCB&&e.response_format=="stream"){let m=(b=h.body)==null?void 0:b.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:f,reader:m,decoder:new TextDecoder("utf-8")})}return s&&this.onCompleteCB&&this.onCompleteCB(f.body),this.onResultCB&&this.onResultCB(f,e),d.setDefaultOnEnd&&d.setDefaultOnEnd(f,e),f})},abortStream:function(){this.streamStatus="abort"}},d);d.prototype.instance.prototype=d.prototype;var M=e=>new M.prototype.instance(e);M.prototype={};a.extend({constructor:M,instance:function(e){this.ok=!0;try{let[t,n]=e.name.replace(/\s/,"").replace(/(.*)\.(.*)$/,"$1 $2").split(" ");this.file=e,this.extension=n,this.fileName=t,this.type=e.type}catch(t){console.log(t),this.ok=!1}return this},isValid:function(){return this.ok},toBlob:function(){return p(this,null,function*(){return new Blob([this.file,{type:this.type}])})},toDataURL:function(){return p(this,null,function*(){var e;return(e=(yield this.file.convert("dataURL")).target)==null?void 0:e.result})},toAarrayBuffer:function(){return p(this,null,function*(){var e;return(e=(yield this.file.convert("arrayBuffer")).target)==null?void 0:e.result})},toObjectURL:function(){return p(this,null,function*(){return URL.createObjectURL(this.file)})},updateFileName:function(e){let t=new File([this.file],e+"."+this.extension);return this.file=t,this.fileName=e,this},updateMimeType:function(e){return this.file=new File([this.file],this.fileName+"."+this.extension,{type:e}),this.type=e,this},updateExtension:function(e){let t=new File([this.file],this.fileName+"."+e);return this.file=t,this.extension=e,this}},M);M.prototype.instance.prototype=M.prototype;var k={fromFile:e=>p(void 0,null,function*(){return M(e)}),fromBlob:(e,t)=>p(void 0,null,function*(){let n=(t==null?void 0:t.fileName)||"file",i=(t==null?void 0:t.extension)||"",r=new File([e],n+"."+i,{type:t==null?void 0:t.mimeType});return M(r)}),fromArrayBuffer:(e,t)=>p(void 0,null,function*(){return k.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)}),fromObjectURL:(e,t)=>p(void 0,null,function*(){let n=yield d(e,{response_format:"blob"}).get();return n.ok?k.fromBlob(n.body,t):M({})}),fromDataURL:(e,t)=>p(void 0,null,function*(){let n=yield e.toBlob((t==null?void 0:t.mimeType)||"");return n?k.fromBlob(n,t):M({})})};var ie=function(e){let t=e,n=null;return t.use((i,r,s)=>{let o=r;o.return=u=>{let{status:l=200,body:h={},bodyStringify:f=!0}=u||{},g=h;return f&&!a.is.string(h)&&(g=a.Stringify(h)),r.status(l).end(g)},s()}),t.onPathRouter=function(i){return n=i,this},t.pathRouter=function(i){if(!n)return;let r=n(i);return r.route(i),t.use(i,r),r},t.exception=function(i){return t.use(i),this},t},L=ie;L.getLocalIP=e=>{let t="";return a.scope(()=>{if(!e)return;let n=e.networkInterfaces();for(let[i,r]of Object.entries(n))r.forEach(s=>{!s.internal&&s.family==="IPv4"&&!s.address.match(/^(169|127)/)&&(t=s.address)})}),t};L.getIp=function(e){var i;return(((e==null?void 0:e.headers["x-forwarded-for"])||((i=e==null?void 0:e.socket)==null?void 0:i.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"UNKNOWN IP"};a.copyToClipboard=e=>p(void 0,null,function*(){let t="";a.is.string(e)?t=e:a.is.function(e)&&(t=e());let n={ok:!1,body:"NotSupported"};return yield p(void 0,null,function*(){let i;if(navigator.clipboard){if(i=yield navigator.clipboard.writeText(t).then(()=>!0,()=>!1),!i)return}else{let r=document.createElement("input");if(a(document.body).append(r),r.value=t,r.select(),i=document.execCommand("copy"),document.body.removeChild(r),!i)return}n={ok:!0,body:""}}),n});a.ImageLoader=(e,t)=>new Promise((n,i)=>{let r=t||new Image;r.onload=()=>n(r),r.onerror=s=>i(s),r.src=e});a.formatCharacter={postal:{JP:e=>{let t="--";return e=String(e).replace(/\D/ig,""),e.length==7&&(t=e.replace(/^(\d{3})(.*)/,"$1-$2")),t}},tel:{_:e=>{let t=e;return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t},mobile:e=>{let t="--";return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),t},fixed:e=>{let t="--";return e=String(e).removeLetters(),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t}}};a.transformer={weekday:{JP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]+"\u66DC\u65E5",shortJP:e=>["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][e]},wareki:e=>{let t=[],n=[],i=!1;return[{From:1868,To:1912,name:"\u660E\u6CBB"},{From:1912,To:1926,name:"\u5927\u6B63"},{From:1926,To:1989,name:"\u662D\u548C"},{From:1989,To:2019,name:"\u5E73\u6210"},{From:2019,To:1e5,name:"\u4EE4\u548C"}].forEach(s=>{let{From:o,To:u,name:l}=s;if(o<=e&&e<=u){let h=e-o+1;h==1&&(i=!0,h="\u5143"),n.push(l+h+"\u5E74"),t.push(l)}}),{era:t,value:n,gap:i}}};d.setDefaultHeaders=()=>({});var se=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID});
|
package/declare/core.d.ts
CHANGED
|
@@ -98,16 +98,23 @@ declare namespace Jmini {
|
|
|
98
98
|
secure?: boolean;
|
|
99
99
|
}): void;
|
|
100
100
|
getCookie(name: string): string;
|
|
101
|
-
setLocalStrageData(key: string, value: any): any;
|
|
102
|
-
getLocalStrageData(key: string): any;
|
|
103
101
|
deleteCookie(name: string): void;
|
|
102
|
+
localStrage: {
|
|
103
|
+
set(key: string, value: any): any;
|
|
104
|
+
get<T = any>(key: string): T;
|
|
105
|
+
};
|
|
106
|
+
queryParams: {
|
|
107
|
+
get(url?: string): KeyValueDict;
|
|
108
|
+
set(searchParams: {
|
|
109
|
+
[key: string]: string | number;
|
|
110
|
+
}, url?: string): string;
|
|
111
|
+
delete(keys: string[], url?: string): string;
|
|
112
|
+
};
|
|
104
113
|
pending(callback: {
|
|
105
114
|
(resolve: {
|
|
106
115
|
(result: boolean): void;
|
|
107
116
|
}): void;
|
|
108
117
|
}, seconds: number): Promise<boolean>;
|
|
109
|
-
getLocalIP(os: any): string;
|
|
110
|
-
getIp(req: any): string;
|
|
111
118
|
getCursor(event: Event): {
|
|
112
119
|
x: number;
|
|
113
120
|
y: number;
|
|
@@ -123,14 +130,6 @@ declare namespace Jmini {
|
|
|
123
130
|
safeAreaTop: number;
|
|
124
131
|
safeAreaBottom: number;
|
|
125
132
|
};
|
|
126
|
-
queryParams: {
|
|
127
|
-
get(url?: string): KeyValueDict;
|
|
128
|
-
set(searchParams: {
|
|
129
|
-
[key: string]: string | number;
|
|
130
|
-
}, url?: string): string;
|
|
131
|
-
delete(keys: string[], url?: string): string;
|
|
132
|
-
};
|
|
133
|
-
ellipsisText(value: string, length: number): string;
|
|
134
133
|
is: {
|
|
135
134
|
what(v: any): string;
|
|
136
135
|
exist(v: any): boolean;
|
|
@@ -147,13 +146,11 @@ declare namespace Jmini {
|
|
|
147
146
|
shadowRoot(v: any): v is ShadowRoot;
|
|
148
147
|
date(v: any): v is Date;
|
|
149
148
|
};
|
|
149
|
+
ellipsisText(value: string, length: number): string;
|
|
150
150
|
flatArray(v: any, regression?: '-R'): any[];
|
|
151
151
|
deepMerge<T>(target: T, ...args: T[]): T;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
ok: boolean;
|
|
155
|
-
body: T;
|
|
156
|
-
};
|
|
152
|
+
Stringify(value: any): string;
|
|
153
|
+
Objectify<T = any>(value: any, OnError?: any): T;
|
|
157
154
|
scope<T>(fn: {
|
|
158
155
|
(): T;
|
|
159
156
|
}): T;
|
package/declare/server.d.ts
CHANGED
|
@@ -16,26 +16,33 @@ declare namespace Server {
|
|
|
16
16
|
bodyStringify?: boolean;
|
|
17
17
|
};
|
|
18
18
|
type CustomMethods<A = Request, B = Response> = {
|
|
19
|
-
set(...args: SetInput):
|
|
20
|
-
use(...args: UseInput<A, B>):
|
|
21
|
-
get(...args: RestArgs<A, B>):
|
|
22
|
-
post(...args: RestArgs<A, B>):
|
|
23
|
-
put(...args: RestArgs<A, B>):
|
|
24
|
-
patch(...args: RestArgs<A, B>):
|
|
25
|
-
delete(...args: RestArgs<A, B>):
|
|
26
|
-
options(...args: RestArgs<A, B>):
|
|
27
|
-
all(...args: RestArgs<A, B>):
|
|
19
|
+
set(...args: SetInput): ServerMethods<A, B>;
|
|
20
|
+
use(...args: UseInput<A, B>): ServerMethods<A, B>;
|
|
21
|
+
get(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
22
|
+
post(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
23
|
+
put(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
24
|
+
patch(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
25
|
+
delete(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
26
|
+
options(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
27
|
+
all(...args: RestArgs<A, B>): ServerMethods<A, B>;
|
|
28
28
|
};
|
|
29
29
|
type PathRouterOmits = 'onPathRouter' | 'pathRouter' | 'exception';
|
|
30
30
|
type CustomExpress = Omit<express.Express, keyof CustomMethods>;
|
|
31
|
-
type
|
|
32
|
-
onPathRouter(getRouter: (path: string) => express.Router):
|
|
31
|
+
type ServerMethods<A = Request, B = Response> = CustomExpress & CustomMethods<A, B> & {
|
|
32
|
+
onPathRouter(getRouter: (path: string) => express.Router): ServerMethods<A, B>;
|
|
33
33
|
pathRouter(path: string): Omit<CustomMethods<A, B>, PathRouterOmits>;
|
|
34
|
-
exception(fn: (err: any, req: A, res: B, next: express.NextFunction) => void):
|
|
35
|
-
};
|
|
36
|
-
type FN = {
|
|
37
|
-
<A = Request, B = Response>(express: express.Express): Methods<A, B>;
|
|
34
|
+
exception(fn: (err: any, req: A, res: B, next: express.NextFunction) => void): ServerMethods<A, B>;
|
|
38
35
|
};
|
|
36
|
+
namespace Methods {
|
|
37
|
+
type FN = {
|
|
38
|
+
<A = Request, B = Response>(express: express.Express): ServerMethods<A, B>;
|
|
39
|
+
};
|
|
40
|
+
type SubMethods = {
|
|
41
|
+
getLocalIP(os: any): string;
|
|
42
|
+
getIp(req: any): string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
type Methods = Methods.FN & Methods.SubMethods;
|
|
39
46
|
}
|
|
40
|
-
declare const Server: Server.
|
|
47
|
+
declare const Server: Server.Methods;
|
|
41
48
|
export { Server, Server as default };
|
package/esm/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as J,e as C}from"./chunk-ABA72NWU.js";import{UUID as v}from"./uuid";import"./primitiveExtension";const T=e=>new n.prototype.jmini(e),n=T;n.prototype={},n.extend=function(e,r=n){for(var[s,o]of Object.entries(e))r.prototype[s]=o},n.expando="__jmini_"+v();const m=(e,r)=>(e.queue.push(r),E(e),e),E=e=>C(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let r=e.queue.shift();r&&(yield r()),e.queueProcess=!1,E(e)}}),y=(e,r)=>{for(let s=0;s<e.length;s++)e[s]=null;for(let[s,o]of Object.entries(r))s.match(/queue/)||(e[s]=o);return e},k=(e,r)=>{if(r.length){for(var s=0;s<r.length;s++){let o=r[s];o&&(o[n.expando]||(n.is.element(o)||n.is.shadowRoot(o))&&(o[n.expando]={events:{}})),e[s]=o}e.length=r.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,E(e),e};n.extend({constructor:n,jmini:function(e){return this.src=e,this.srcType=n.is.what(e),this.queueProcess=!0,this.queue=[],k(this,n.is.jmini(e)?e.get():n.is.element(e)?[e]:n.is.elements(e)?e:n.is.shadowRoot(e)?[e]:n.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}}),n.prototype[String(Symbol.iterator)]=[][Symbol.iterator],n.prototype.jmini.prototype=n.prototype;{const e=function(t,i,a){let l=[];for(let u=0;u<(t.length||0);u++)l.push(i(t[u],u));return a&&(l=l.filter(u=>u!=null)),l},r=t=>(t.for((i,a)=>{if(!(n.is.element(i)||n.is.shadowRoot(i)))return;let l=i.cloneNode(),u=i.parentNode;u&&u.replaceChild(l,i),t[a]=l}),t),s=(t,i)=>(n(i).for(a=>{if(t&&(n.is.element(a)||n.is.shadowRoot(a)))if(n.is.string(t)||n.is.number(t))t=String(t),a.insertAdjacentHTML("beforeend",String(t));else if(n.is.element(t))a.appendChild(t);else{n.is.jmini(t)?t=t.get():n.is.element(t)?t=[t]:n.is.keyValueDictionary(t)&&(t=[n(t)]);for(var l=0;l<t.length;l++)s(t[l],a)}}),i),o=(t,i,...a)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[i]||{p:"",s:""};return t.for(h=>{if(n.is.string(a[0]))h.insertAdjacentHTML(l,a[0]);else{if(!h.parentNode)return;n(a[0]).for(g=>{a[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[u]||h)})}}),t};n.extend({get:function(t){return t?this[0]:e(this,i=>i)},for:function(t,i=1){let a=e(this,(l,u)=>t(l,u),1);return i?a:[]},await:function(t){return m(this,()=>new Promise((i,a)=>{setTimeout(()=>{i(this)},t)}))},abort:function(){return m(this,()=>C(this,null,function*(){return this.queue=[],this}))},callback:function(t){return m(this,()=>C(this,null,function*(){return yield t(this),this}))},click:function(){return m(this,()=>{for(var t=0;t<this.length;t++){let i=this[t];n.is.element(i)&&i.click()}return this})},focus:function(){return m(this,()=>{for(var t=0;t<this.length;t++){let i=this[t];n.is.element(i)&&i.focus()}return this})},addEvent:function(t){return m(this,()=>{let{eventType:i,eventID:a=v(),target:l,callback:u,options:h}=t;return h=J({passive:!0,capture:!1},h),this.for(f=>{if(!(n.is.element(f)||n.is.shadowRoot(f)))return;let{events:g}=f[n.expando];if(l){let d=u;u=c=>{if(c.target){if(n.is.string(l)){let b=c.target.closest(l);b&&(!b||d.call(b,c))}else if(n.is.elements(l)){for(let p of l)if(c.target==p)return d.call(p,c)}}}}if(g[a]){let d=g[a];f.removeEventListener(d.eventType,d.callback,d.options)}g[a]={eventType:i,callback:u,options:h},f.addEventListener(i,u,h)}),this})},removeEvent:function(t){return m(this,()=>{let i=n.is.array(t)?t:[t];return this.for(a=>{let{events:l}=a[n.expando];for(let u of i){let h=l[u];h&&a.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(t){return m(this,()=>y(this,s(t,r(this))))},empty:function(){return m(this,()=>y(this,r(this)))},append:function(t){return m(this,()=>{s(t,this)})},remove:function(){return m(this,()=>(this.for((t,i)=>{t&&n.is.element(t)&&(t.remove(),delete this[i])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...t){return m(this,()=>y(this,o(this,"before",...t)))},after:function(...t){return m(this,()=>y(this,o(this,"after",...t)))},find:function(t){return m(this,()=>{let i=[],a=this[0];a||y(this,n()),(n.is.element(a)||n.is.shadowRoot(a))&&(n.is.string(t)?i=a.querySelectorAll(t):n.is.element(a)&&n(t).for(l=>{let u=a.childNodes;for(let h of u)if(h===l){i.push(h);break}else h.childNodes.length&&(i=[...i,...n(h).find(l).for(f=>f)])})),y(this,n(i))})},parent:function(t){return m(this,()=>{var a,l;let i=n(t?(a=this[0])==null?void 0:a.closest(t):(l=this[0])==null?void 0:l.parentNode);y(this,i)})},children:function(t){return m(this,()=>{let i=this[0].children;n.is.exist(t)&&(t=String(t).replace(/^ : /,""),i=t=="first"?i[0]:t=="last"?i[i.length-1]:i[Number(t)]);let a=n(i);return y(this,a)})},addClass:function(t){return m(this,()=>(t&&this.for(i=>{let a=n.is.string(t)?t.split(" "):t;i&&n.is.element(i)&&i.classList.add(...a)}),this))},removeClass:function(t){return m(this,()=>(t&&this.for(i=>{let a=n.is.string(t)?t.split(" "):t;i&&n.is.element(i)&&i.classList.remove(...a)}),this))},toggleClass:function(t){return m(this,()=>(t&&this.for(i=>{i.classList.toggle(t)}),this))},hasClass:function(t=""){if(this[0])return this[0].classList.contains(t.replace(/^\./,""))},findClass:function(t){let i=[];return this[0]&&(i=[...this[0].classList].filter(a=>a.match(t))),i},css:function(t){return m(this,()=>(this.for(i=>{if(n.is.element(i))for(let[a,l]of Object.entries(t)){if(n.is.number(l)&&a.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){i.style[a]=l+"px";continue}i.style[a]=String(l)}}),this))},getAttribute:function(t){return this[0].getAttribute(String(t))},setAttribute:function(t,i){return m(this,()=>(this.for(a=>a.setAttribute(t,i)),this))},getStyleProperty:function(t){let i=this[0];return i&&n.is.element(i)?getComputedStyle(i).getPropertyValue(t):""},setStyleProperty:function(t,i){let a=this[0];return a&&n.is.element(a)&&a.style.setProperty(t,i),this},val:function(){var i;let t=this[0];return(t==null?void 0:t.value)||((i=t==null?void 0:t.dataset)==null?void 0:i.value)},position:function(){return n.is.element(this[0])?this[0].getBoundingClientRect():{}}})}{n.flatArray=(r,s)=>{if(!n.is.array(r))return[r];let o=[];for(let t of r)o.push(...s=="-R"?n.flatArray(t,"-R"):[t]);return o},n.JsonTo=r=>JSON.stringify(r),n.toJson=r=>{let s;try{s={ok:!0,body:JSON.parse(r)}}catch(o){s={ok:!1,body:o}}return s},n.scope=r=>r(),n.randomNumber=(r=0,s=100,o)=>{if(r>s)return NaN;let t=[],i=r;for(;i<=s;){if(o&&o.length&&o.includes(i)){i++;continue}t.push(i),i++}let a=Math.round(Math.random()*(t.length-1))+0;return t[a]};let e={};n.interval={standBy:(r,s,o)=>{e[r]=setTimeout(o,s)},clear:r=>{clearInterval(e[r])}}}n.createElement=function(e){var g;let{tag:r,className:s="",id:o,html:t,attr:i,style:a,parent:l}=e,u=document.createElement(r||"div");if(s&&u.classList.add(...s.split(" ")),o&&(u.id=o),i)for(let d of Object.entries(i)){let c=d[0],p=(g=d[1])!=null?g:"";if(c=="data"&&n.is.keyValueDictionary(p))for(let[b,L]of Object.entries(p))u.dataset[b]=L;else c=="for"?c="htmlFor":c=="tabindex"?c="tabIndex":c=="aria-label"&&(c="ariaLabel"),u[c]=p}if(t&&n(u).append(t),a)for(var[h,f]of Object.entries(a))u.style[h]=f;return l&&n(l).append(u),u},n.setCookie=e=>{let{hostname:r}=new URL(location.toString()),{name:s,value:o="",age:t=60*60*24*365,path:i="/",domain:a=r,secure:l=!1}=e,u=`${s}=${o}max-age=${t}path=${i}domain=${a}`;l&&(u+=" Secure"),document.cookie=u},n.getCookie=e=>{let r=document.cookie.match(new RegExp(e+"=[^]*"));return r?r[0].replace(new RegExp(e+"="),""):""},n.setLocalStrageData=(e,r)=>{localStorage.setItem(e,JSON.stringify(r))},n.getLocalStrageData=e=>{let r=localStorage.getItem(e),s=n.toJson(r);return s.ok?s.body:r},n.deleteCookie=e=>{document.cookie=e+"=max-age=0"},n.getScreenSize=()=>{let{innerHeight:e,innerWidth:r,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:i}=window,a=Number(n(document.body).getStyleProperty("--sat").removeLetters()),l=Number(n(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:r,pageHeight:e-a-l,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:i,safeAreaTop:a,safeAreaBottom:l}},n.getCursor=e=>{var o,t,i,a,l,u,h,f;let r=(a=e.pageX)!=null?a:(i=(o=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:o.pageX)!=null?i:(((t=e==null?void 0:e.originalEvent)==null?void 0:t.touches)||[])[0].pageX,s=(f=e.pageY)!=null?f:(h=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?h:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:r,y:s}},n.pending=(e,r)=>new Promise((s,o)=>{e(s),setTimeout(()=>{s(!0)},r)}),n.getLocalIP=e=>{let r="";return n.scope(()=>{if(!e)return;let s=e.networkInterfaces();for(let[o,t]of Object.entries(s))t.forEach(i=>{!i.internal&&i.family==="IPv4"&&!i.address.match(/^(169|127)/)&&(r=i.address)})}),r},n.getIp=function(e){var o;return(((e==null?void 0:e.headers["x-forwarded-for"])||((o=e==null?void 0:e.socket)==null?void 0:o.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"IP UNDEFINED"},n.deepMerge=(e,...r)=>{if(!r.length)return e;const s=r.shift();if(n.is.keyValueDictionary(e)&&n.is.keyValueDictionary(s))for(const o in s)n.is.keyValueDictionary(s[o])?(e[o]||Object.assign(e,{[o]:{}}),n.deepMerge(e[o],s[o])):Object.assign(e,{[o]:s[o]});return n.deepMerge(e,...r)},n.queryParams={get:e=>{let r=new URL(e||location.href),s={};return r.searchParams.forEach((o,t)=>s[t]=o),s},set:(e,r)=>{const s=new URL(r||location.href);return Object.entries(e).forEach(([o,t])=>{s.searchParams.set(o,String(t))}),r||history.replaceState({},"",s.pathname+s.search),s.toString()},delete:(e,r)=>{const s=new URL(r||location.href);return e.forEach(o=>{s.searchParams.delete(o)}),r||history.replaceState({},"",s.pathname+s.search),s.toString()}},n.ellipsisText=(e,r)=>{let s=String(e);return s.length>r&&(s=s.slice(0,r)+" ..."),s},n.is={what:function(e){let r="other";return this.jmini(e)?r="jmini":this.element(e)?r="element":this.elements(e)?r="elements":this.shadowRoot(e)?r="shadowRoot":this.string(e)?r="string":this.number(e)?r="number":this.array(e)?r="array":this.function(e)?r="function":this.date(e)?r="date":typeof e=="undefined"?r="undefined":this.keyValueDictionary(e)?r="keyValueDictionary":e==null?r="null":isNaN(e)&&(r="NaN"),r},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===n},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let r={}.toString.call(e);return e instanceof Array||r=="[object NodeList]"||r=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let r={}.toString.call(e),s=Number(!!e&&typeof e!="string"&&this.array(e)&&r!=="[object Text]");if(s&&r!=="[object NodeList]")for(var o of e)s&=Number(this.element(o));return!!s},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};export{n as Jmini,n as default};
|
|
1
|
+
import{b as J,e as C}from"./chunk-ABA72NWU.js";import{UUID as v}from"./uuid";import"./primitiveExtension";const x=e=>new n.prototype.jmini(e),n=x;n.prototype={},n.extend=function(e,r=n){for(var[s,o]of Object.entries(e))r.prototype[s]=o},n.expando="__jmini_"+v();const m=(e,r)=>(e.queue.push(r),E(e),e),E=e=>C(void 0,null,function*(){if(!e.queueProcess&&e.queue.length){e.queueProcess=!0;let r=e.queue.shift();r&&(yield r()),e.queueProcess=!1,E(e)}}),d=(e,r)=>{for(let s=0;s<e.length;s++)e[s]=null;for(let[s,o]of Object.entries(r))s.match(/queue/)||(e[s]=o);return e},w=(e,r)=>{if(r.length){for(var s=0;s<r.length;s++){let o=r[s];o&&(o[n.expando]||(n.is.element(o)||n.is.shadowRoot(o))&&(o[n.expando]={events:{}})),e[s]=o}e.length=r.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,E(e),e};n.extend({constructor:n,jmini:function(e){return this.src=e,this.srcType=n.is.what(e),this.queueProcess=!0,this.queue=[],w(this,n.is.jmini(e)?e.get():n.is.element(e)?[e]:n.is.elements(e)?e:n.is.shadowRoot(e)?[e]:n.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}}),n.prototype[String(Symbol.iterator)]=[][Symbol.iterator],n.prototype.jmini.prototype=n.prototype;{const e=function(t,i,a){let l=[];for(let u=0;u<(t.length||0);u++)l.push(i(t[u],u));return a&&(l=l.filter(u=>u!=null)),l},r=t=>(t.for((i,a)=>{if(!(n.is.element(i)||n.is.shadowRoot(i)))return;let l=i.cloneNode(),u=i.parentNode;u&&u.replaceChild(l,i),t[a]=l}),t),s=(t,i)=>(n(i).for(a=>{if(t&&(n.is.element(a)||n.is.shadowRoot(a)))if(n.is.string(t)||n.is.number(t))t=String(t),a.insertAdjacentHTML("beforeend",String(t));else if(n.is.element(t))a.appendChild(t);else{n.is.jmini(t)?t=t.get():n.is.element(t)?t=[t]:n.is.keyValueDictionary(t)&&(t=[n(t)]);for(var l=0;l<t.length;l++)s(t[l],a)}}),i),o=(t,i,...a)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[i]||{p:"",s:""};return t.for(h=>{if(n.is.string(a[0]))h.insertAdjacentHTML(l,a[0]);else{if(!h.parentNode)return;n(a[0]).for(g=>{a[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[u]||h)})}}),t};n.extend({get:function(t){return t?this[0]:e(this,i=>i)},for:function(t,i=1){let a=e(this,(l,u)=>t(l,u),1);return i?a:[]},await:function(t){return m(this,()=>new Promise((i,a)=>{setTimeout(()=>{i(this)},t)}))},abort:function(){return m(this,()=>C(this,null,function*(){return this.queue=[],this}))},callback:function(t){return m(this,()=>C(this,null,function*(){return yield t(this),this}))},click:function(){return m(this,()=>{for(var t=0;t<this.length;t++){let i=this[t];n.is.element(i)&&i.click()}return this})},focus:function(){return m(this,()=>{for(var t=0;t<this.length;t++){let i=this[t];n.is.element(i)&&i.focus()}return this})},addEvent:function(t){return m(this,()=>{let{eventType:i,eventID:a=v(),target:l,callback:u,options:h}=t;return h=J({passive:!0,capture:!1},h),this.for(f=>{if(!(n.is.element(f)||n.is.shadowRoot(f)))return;let{events:g}=f[n.expando];if(l){let y=u;u=c=>{if(c.target){if(n.is.string(l)){let b=c.target.closest(l);b&&(!b||y.call(b,c))}else if(n.is.elements(l)){for(let p of l)if(c.target==p)return y.call(p,c)}}}}if(g[a]){let y=g[a];f.removeEventListener(y.eventType,y.callback,y.options)}g[a]={eventType:i,callback:u,options:h},f.addEventListener(i,u,h)}),this})},removeEvent:function(t){return m(this,()=>{let i=n.is.array(t)?t:[t];return this.for(a=>{let{events:l}=a[n.expando];for(let u of i){let h=l[u];h&&a.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(t){return m(this,()=>d(this,s(t,r(this))))},empty:function(){return m(this,()=>d(this,r(this)))},append:function(t){return m(this,()=>{s(t,this)})},remove:function(){return m(this,()=>(this.for((t,i)=>{t&&n.is.element(t)&&(t.remove(),delete this[i])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...t){return m(this,()=>d(this,o(this,"before",...t)))},after:function(...t){return m(this,()=>d(this,o(this,"after",...t)))},find:function(t){return m(this,()=>{let i=[],a=this[0];a||d(this,n()),(n.is.element(a)||n.is.shadowRoot(a))&&(n.is.string(t)?i=a.querySelectorAll(t):n.is.element(a)&&n(t).for(l=>{let u=a.childNodes;for(let h of u)if(h===l){i.push(h);break}else h.childNodes.length&&(i=[...i,...n(h).find(l).for(f=>f)])})),d(this,n(i))})},parent:function(t){return m(this,()=>{var a,l;let i=n(t?(a=this[0])==null?void 0:a.closest(t):(l=this[0])==null?void 0:l.parentNode);d(this,i)})},children:function(t){return m(this,()=>{let i=this[0].children;n.is.exist(t)&&(t=String(t).replace(/^ : /,""),i=t=="first"?i[0]:t=="last"?i[i.length-1]:i[Number(t)]);let a=n(i);return d(this,a)})},addClass:function(t){return m(this,()=>(t&&this.for(i=>{let a=n.is.string(t)?t.split(" "):t;i&&n.is.element(i)&&i.classList.add(...a)}),this))},removeClass:function(t){return m(this,()=>(t&&this.for(i=>{let a=n.is.string(t)?t.split(" "):t;i&&n.is.element(i)&&i.classList.remove(...a)}),this))},toggleClass:function(t){return m(this,()=>(t&&this.for(i=>{i.classList.toggle(t)}),this))},hasClass:function(t=""){if(this[0])return this[0].classList.contains(t.replace(/^\./,""))},findClass:function(t){let i=[];return this[0]&&(i=[...this[0].classList].filter(a=>a.match(t))),i},css:function(t){return m(this,()=>(this.for(i=>{if(n.is.element(i))for(let[a,l]of Object.entries(t)){if(n.is.number(l)&&a.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){i.style[a]=l+"px";continue}i.style[a]=String(l)}}),this))},getAttribute:function(t){return this[0].getAttribute(String(t))},setAttribute:function(t,i){return m(this,()=>(this.for(a=>a.setAttribute(t,i)),this))},getStyleProperty:function(t){let i=this[0];return i&&n.is.element(i)?getComputedStyle(i).getPropertyValue(t):""},setStyleProperty:function(t,i){let a=this[0];return a&&n.is.element(a)&&a.style.setProperty(t,i),this},val:function(){var i;let t=this[0];return(t==null?void 0:t.value)||((i=t==null?void 0:t.dataset)==null?void 0:i.value)},position:function(){return n.is.element(this[0])?this[0].getBoundingClientRect():{}}})}{n.flatArray=(r,s)=>{if(!n.is.array(r))return[r];let o=[];for(let t of r)o.push(...s=="-R"?n.flatArray(t,"-R"):[t]);return o},n.Stringify=r=>JSON.stringify(r),n.Objectify=(r,s)=>{try{return JSON.parse(r)}catch(o){return s!=null?s:null}},n.scope=r=>r(),n.randomNumber=(r=0,s=100,o)=>{if(r>s)return NaN;let t=[],i=r;for(;i<=s;){if(o&&o.length&&o.includes(i)){i++;continue}t.push(i),i++}let a=Math.round(Math.random()*(t.length-1))+0;return t[a]};let e={};n.interval={standBy:(r,s,o)=>{e[r]=setTimeout(o,s)},clear:r=>{clearInterval(e[r])}}}n.createElement=function(e){var g;let{tag:r,className:s="",id:o,html:t,attr:i,style:a,parent:l}=e,u=document.createElement(r||"div");if(s&&u.classList.add(...s.split(" ")),o&&(u.id=o),i)for(let y of Object.entries(i)){let c=y[0],p=(g=y[1])!=null?g:"";if(c=="data"&&n.is.keyValueDictionary(p))for(let[b,T]of Object.entries(p))u.dataset[b]=T;else c=="for"?c="htmlFor":c=="tabindex"?c="tabIndex":c=="aria-label"&&(c="ariaLabel"),u[c]=p}if(t&&n(u).append(t),a)for(var[h,f]of Object.entries(a))u.style[h]=f;return l&&n(l).append(u),u},n.setCookie=e=>{let{hostname:r}=new URL(location.toString()),{name:s,value:o="",age:t=60*60*24*365,path:i="/",domain:a=r,secure:l=!1}=e,u=`${s}=${o}max-age=${t}path=${i}domain=${a}`;l&&(u+=" Secure"),document.cookie=u},n.getCookie=e=>{let r=document.cookie.match(new RegExp(e+"=[^]*"));return r?r[0].replace(new RegExp(e+"="),""):""},n.localStrage={set:(e,r)=>{localStorage.setItem(e,n.Stringify(r))},get:e=>{let r=localStorage.getItem(e);return n.Objectify(r,r)}},n.deleteCookie=e=>{document.cookie=e+"=max-age=0"},n.getScreenSize=()=>{let{innerHeight:e,innerWidth:r,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:i}=window,a=Number(n(document.body).getStyleProperty("--sat").removeLetters()),l=Number(n(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:r,pageHeight:e-a-l,scrollY:s,scrollX:o,pageXOffset:t,pageYOffset:i,safeAreaTop:a,safeAreaBottom:l}},n.getCursor=e=>{var o,t,i,a,l,u,h,f;let r=(a=e.pageX)!=null?a:(i=(o=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:o.pageX)!=null?i:(((t=e==null?void 0:e.originalEvent)==null?void 0:t.touches)||[])[0].pageX,s=(f=e.pageY)!=null?f:(h=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?h:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:r,y:s}},n.pending=(e,r)=>new Promise((s,o)=>{e(s),setTimeout(()=>{s(!0)},r)}),n.deepMerge=(e,...r)=>{if(!r.length)return e;const s=r.shift();if(n.is.keyValueDictionary(e)&&n.is.keyValueDictionary(s))for(const o in s)n.is.keyValueDictionary(s[o])?(e[o]||Object.assign(e,{[o]:{}}),n.deepMerge(e[o],s[o])):Object.assign(e,{[o]:s[o]});return n.deepMerge(e,...r)},n.queryParams={get:e=>{let r=new URL(e||location.href),s={};return r.searchParams.forEach((o,t)=>s[t]=o),s},set:(e,r)=>{const s=new URL(r||location.href);return Object.entries(e).forEach(([o,t])=>{s.searchParams.set(o,String(t))}),r||history.replaceState({},"",s.pathname+s.search),s.toString()},delete:(e,r)=>{const s=new URL(r||location.href);return e.forEach(o=>{s.searchParams.delete(o)}),r||history.replaceState({},"",s.pathname+s.search),s.toString()}},n.ellipsisText=(e,r)=>{let s=String(e);return s.length>r&&(s=s.slice(0,r)+" ..."),s},n.is={what:function(e){let r="other";return this.jmini(e)?r="jmini":this.element(e)?r="element":this.elements(e)?r="elements":this.shadowRoot(e)?r="shadowRoot":this.string(e)?r="string":this.number(e)?r="number":this.array(e)?r="array":this.function(e)?r="function":this.date(e)?r="date":typeof e=="undefined"?r="undefined":this.keyValueDictionary(e)?r="keyValueDictionary":e==null?r="null":isNaN(e)&&(r="NaN"),r},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){return(e||{}).constructor===n},string:function(e){return typeof e=="string"},boolean:function(e){return typeof e=="boolean"},number:function(e){return!isNaN(e)&&typeof e=="number"},array:function(e){let r={}.toString.call(e);return e instanceof Array||r=="[object NodeList]"||r=="[object HTMLCollection]"},function:function(e){return typeof e=="function"},keyValueDictionary:function(e){return{}.toString.call(e)==="[object Object]"&&!this.jmini(e)},element:function(e){return e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e))},elements:function(e){let r={}.toString.call(e),s=Number(!!e&&typeof e!="string"&&this.array(e)&&r!=="[object Text]");if(s&&r!=="[object NodeList]")for(var o of e)s&=Number(this.element(o));return!!s},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())}};export{n as Jmini,n as default};
|
package/esm/fetcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as T,c as B,d as D,e as
|
|
1
|
+
import{b as T,c as B,d as D,e as p,f as w,g as x,h as v}from"./chunk-ABA72NWU.js";import c from"./core";import{UUID as F}from"./uuid";const e=(t,r)=>new e.prototype.instance(t,r);e.prototype={},e.waitList=[],e.setDefaultTrafficControl=0,e.setDefaultTimeout=1e3*60*10,e.isReadableStream=t=>t instanceof ReadableStream,e.isReadableStreamReader=t=>t instanceof ReadableStreamDefaultReader,e.streamToContext=(t,r)=>p(void 0,null,function*(){try{const a=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(a))return{ok:!1,done:!0,data:null};if(!a)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let o=yield a.read();return{ok:!0,done:o.done,data:i.decode(o.value)}}catch(a){return{ok:!1,done:!0,data:a}}}),c.extend({constructor:e,instance:function(t,r){var o;r=r||{};let a=r.body;r.body&&!c.is.string(r.body)&&((o=r.bodyStringify)==null||o)&&(a=c.Stringify(r.body||{}));let i=t;return c.is.string(t)&&!t.match(/https?:/)&&(i=location.origin+"/"+t.replace(/^\//,"")),this.url=i,this.method=r.method||"get",this.streamStatus="open",this.params=B(T({key:F(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:T(T({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:a}),this},onStart:function(t){return this.onStartCB=t,this},onStream:function(t){return this.onStreamCB=t,this},onResult:function(t){return this.onResultCB=t,this},onComplete:function(t){return this.onCompleteCB=t,this},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return p(this,null,function*(){let{response:r,errorCB:a,streamCB:i,reader:o,decoder:d}=t,s=r.body,u=this;const y=function(){return x(this,null,function*(){if(!r.ok){c.scope(()=>p(this,null,function*(){let{ok:f,done:h,data:C}=yield e.streamToContext(s,{reader:o,decoder:d});f&&a(C)}));return}let n=!1;for(;!n;){let{ok:f,done:h,data:C}=yield new w(e.streamToContext(s,{reader:o,decoder:d}));u.streamStatus=="abort"?(u.streamStatus="closed",o.cancel(),h=!0):u.streamStatus=="closed"&&(h=!0),h&&(n=h,o.releaseLock()),i(C,h)}})};try{for(var b=v(y()),m,S,R;m=!(S=yield b.next()).done;m=!1){let n=S.value;;}}catch(S){R=[S]}finally{try{m&&(S=b.return)&&(yield S.call(b))}finally{if(R)throw R[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return p(this,null,function*(){var R;let t=this.params,r=performance.now(),a=0,i=new AbortController,o=setTimeout(()=>{i.abort()},t.timeout);t.signal=i.signal;let d=!1,s=500,u="InternalServerError",y={},b=null;try{e.setDefaultOnStart&&e.setDefaultOnStart(t),this.onStartCB&&this.onStartCB(t);let S=t,{key:n,response_format:f,trafficControl:h,preventMultiRequest:C,timeout:k,queries:O}=S,g=D(S,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);g.method=this.method;let I=e.waitList.includes(n);if(C&&I)throw s=429,new Error("TooManyRequests");e.waitList=[...e.waitList,n];let P=c.queryParams.set(T({},O),String(this.url));y=yield fetch(P,g).then(l=>p(this,null,function*(){return d=l.ok,s=l.status,u=l.statusText,b=l,f=="none"||f=="stream"?l:l[f]()})).catch(l=>{throw new Error(l)})}catch(n){s==200&&(s=500,d=!1),s==429&&(u="TooManyRequests"),i.signal.aborted&&(s=408,u="Timeout"),s==500&&(u=String(n)||u),y={errorCode:String(n)}}finally{clearTimeout(o),a=performance.now()-r}t.trafficControl&&(yield c.pending(()=>{},t.trafficControl)),e.waitList.splice(e.waitList.findIndex(n=>n==t.key),1);let m={ok:d,status:s,statusText:u,body:y,requestTime:a,rawData:b};if(!d&&this.onErrorCB&&this.onErrorCB(m.body),d&&this.onStreamCB&&t.response_format=="stream"){let n=(R=b.body)==null?void 0:R.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:m,reader:n,decoder:new TextDecoder("utf-8")})}return d&&this.onCompleteCB&&this.onCompleteCB(m.body),this.onResultCB&&this.onResultCB(m,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(m,t),m})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.instance.prototype=e.prototype;export{e as Fetcher,e as default};
|
package/esm/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-ABA72NWU.js";import
|
|
1
|
+
import"./chunk-ABA72NWU.js";import u from"./core";const A=function(t){let s=t,o=null;return s.use((e,r,n)=>{let i=r;i.return=h=>{let{status:R=200,body:a={},bodyStringify:x=!0}=h||{},d=a;return x&&!u.is.string(a)&&(d=u.Stringify(a)),r.status(R).end(d)},n()}),s.onPathRouter=function(e){return o=e,this},s.pathRouter=function(e){if(!o)return;let r=o(e);return r.route(e),s.use(e,r),r},s.exception=function(e){return s.use(e),this},s},p=A;p.getLocalIP=t=>{let s="";return u.scope(()=>{if(!t)return;let o=t.networkInterfaces();for(let[e,r]of Object.entries(o))r.forEach(n=>{!n.internal&&n.family==="IPv4"&&!n.address.match(/^(169|127)/)&&(s=n.address)})}),s},p.getIp=function(t){var e;return(((t==null?void 0:t.headers["x-forwarded-for"])||((e=t==null?void 0:t.socket)==null?void 0:e.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"UNKNOWN IP"};export{p as Server,p as default};
|