jmini 0.0.55 → 0.0.57

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var O=Object.defineProperty,te=Object.defineProperties,re=Object.getOwnPropertyDescriptor,ne=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var Y=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var I=Math.pow,z=(e,t,r)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t)=>{for(var r in t||(t={}))V.call(t,r)&&z(e,r,t[r]);if(L)for(var r of L(t))X.call(t,r)&&z(e,r,t[r]);return e},J=(e,t)=>te(e,ne(t));var G=(e,t)=>{var r={};for(var i in e)V.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&L)for(var i of L(e))t.indexOf(i)<0&&X.call(e,i)&&(r[i]=e[i]);return r};var se=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},ae=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ie(t))!V.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(i=re(t,n))||i.enumerable});return e};var oe=e=>ae(O({},"__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())}),j=function(e,t){this[0]=e,this[1]=t},Q=(e,t,r)=>{var i=(o,u,l,h)=>{try{var d=r[o](u),y=(u=d.value)instanceof j,M=d.done;Promise.resolve(y?u[0]:u).then(f=>y?i(o==="return"?o:"next",u[1]?{done:f.done,value:f.value}:f,l,h):l({value:f,done:M})).catch(f=>i("throw",f,l,h))}catch(f){h(f)}},n=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return r=r.apply(e,t),s[Y("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var Z=(e,t,r)=>(t=e[Y("asyncIterator")])?t.call(e):(e=e[Y("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 Me={};se(Me,{Fetcher:()=>c,Filer:()=>v,Server:()=>_,Time:()=>m,UUID:()=>x,default:()=>ve,useStore:()=>P});module.exports=oe(Me);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(/+/,"+")},String.prototype.escapeRegExChar=function(){return this.replace(/\\/g,"\\\\").replace(/(\?|\^|\$|\.|\||\*|\+|\(|\)|\{|\}|\[|\])/g,"\\$1")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=I(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=I(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=I(10,e),r=Number(this),i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/I(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)=>{var n;let i=t;for(let s of r){if(!s)break;i=(n=(i||{})[s||""])!=null?n:null}return i};Array.prototype.toASC=function(...t){return(!t||!(t!=null&&t.length))&&(t=[""]),this.sort((r,i)=>{for(let n of t){let s=String(n||""),o=this.every(h=>{let d=Number(e(h,s.split(".")));return typeof d=="number"&&!isNaN(d)}),u=e(r,s.split(".")),l=e(i,s.split("."));if(o){if(u=Number(u),l=Number(l),u>l)return 1;if(u<l)return-1}else{if(u=String(u).replace(/(\d+)/g,h=>h.padStart(18,"0")),l=String(l).replace(/(\d+)/g,h=>h.padStart(18,"0")),u>l)return 1;if(u<l)return-1}}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()}}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 ue=(e=26)=>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(""),x=ue;x.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");x.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};x.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 le=e=>new a.prototype.jmini(e),a=le;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+x();var b=(e,t)=>(e.queue.push(t),K(e),e),K=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,K(e)}}),F=(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},he=(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,K(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],he(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(y=>{o[1]&&(y=y.cloneNode(!0)),h.parentNode.insertBefore(y,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 b(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return b(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return b(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return b(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.click()}return this})},focus:function(){return b(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 b(this,()=>{let{eventType:s,eventID:o=x(),target:u,callback:l,options:h}=n;return h=D({passive:!0,capture:!1},h),this.for(d=>{if(!(a.is.element(d)||a.is.shadowRoot(d)))return;let{events:y}=d[a.expando];if(u){let M=l;l=f=>{if(f.target){if(a.is.string(u)){let g=f.target.closest(u);g&&(!g||M.call(g,f))}else if(a.is.elements(u)){for(let T of u)if(f.target==T)return M.call(T,f)}}}}if(y[o]){let M=y[o];d.removeEventListener(M.eventType,M.callback,M.options)}y[o]={eventType:s,callback:l,options:h},d.addEventListener(s,l,h)}),this})},removeEvent:function(n){return b(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 b(this,()=>F(this,r(n,t(this))))},empty:function(){return b(this,()=>F(this,t(this)))},append:function(n){return b(this,()=>{r(n,this)})},remove:function(){return b(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 b(this,()=>F(this,i(this,"before",...n)))},after:function(...n){return b(this,()=>F(this,i(this,"after",...n)))},find:function(n){return b(this,()=>{let s=[],o=this[0];o||F(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(d=>d)])})),F(this,a(s))})},parent:function(n){return b(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);F(this,s)})},children:function(n){return b(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 F(this,o)})},addClass:function(n){return b(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 b(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 b(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 b(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 b(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=(e,t)=>{if(!a.is.array(e))return[e];let r=[];for(let i of e)r.push(...t=="-R"?a.flatArray(i,"-R"):[i]);return r};a.uniqueArray=(e,t)=>{let r=e;return t?r=Array.from(new Map(e.map(i=>[a.getKeyValue(i,t||"0"),i])).values()):r=Array.from(new Set(e)),r};a.getKeyValue=(e,t)=>{let r={},i=e;return t.split(".").forEach(n=>{i=i==null?void 0:i[n],r=i}),r};a.Stringify=(...e)=>{let[t,r,i]=e;return JSON.stringify(t,r!=null?r:(()=>{let n=new WeakSet;return(s,o)=>{if(typeof o=="object"&&o!==null){if(n.has(o))return"[Circular Reference]";n.add(o)}return o}})(),i)};a.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(r){return t!=null?t:null}};a.randomNumber=(e=0,t=100,r)=>{if(e>t)return NaN;let i=[],n=e;for(;n<=t;){if(r&&r.length&&r.includes(n)){n++;continue}i.push(n),n++}let s=Math.round(Math.random()*(i.length-1))+0;return i[s]};a.try=e=>{try{return[e(),!0]}catch(t){return[t,!1]}};a.trySync=e=>p(void 0,null,function*(){try{return[yield e(),!0]}catch(t){return[t,!1]}});a.scope=e=>e();a.scopeSync=e=>p(void 0,null,function*(){return yield e()});a.createElement=function(e){var y;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 M of Object.entries(s)){let f=M[0],T=(y=M[1])!=null?y:"";if(f=="data"&&a.is.keyValueDictionary(T))for(let[g,R]of Object.entries(T))l.dataset[g]=R;else f=="for"?f="htmlFor":f=="tabindex"?f="tabIndex":f=="aria-label"&&(f="ariaLabel"),l[f]=T}if(n&&a(l).append(n),o)for(var[h,d]of Object.entries(o))l.style[h]=d;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.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: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,d;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=(d=e.pageY)!=null?d:(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),t&&setTimeout(()=>{r(!0)},t)});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.deepCopy=e=>{if(a.is.array(e))return e.map(t=>a.deepCopy(t));if(a.is.keyValueDictionary(e)){let t={};return Object.entries(e).forEach(([r,i])=>{t[r]=a.deepCopy(i)}),t}return e};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={equal:function(e,t,r){return r==null||r?a.Stringify(e)===a.Stringify(t):e===t},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 me=e=>new m.prototype.Time(e),m=me;m.prototype={};var ce=function(e){m.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(String(e).replace(/\//g,"-"));return this.set(t)};a.extend({value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,constructor:m,Time:ce,clone:function(){return m(this)},set:function(e){this.value=e;let t=a.is.date(e);if(this.validate=t,!t)return this.ms=-1,this.year=-1,this.month=-1,this.weekday=-1,this.weekInYear=-1,this.date=-1,this.hours=-1,this.minutes=-1,this.seconds=-1,this;this.ms=e.getTime(),this.weekday=e.getDay(),this.year=e.getFullYear(),this.month=e.getMonth()+1,this.date=e.getDate();{let r=new Date(this.year,0,1),i=new Date(r.valueOf());i.setDate(i.getDate()-(r.getDay()+1));let n=e.getTime()-i.getTime(),s=Math.ceil(n/(1e3*60*60*24));this.weekInYear=Math.ceil(s/7)}{let r=new Date(this.year,this.month-1,1),i=new Date(r.valueOf());i.setDate(i.getDate()-(r.getDay()+1));let n=e.getTime()-i.getTime(),s=Math.ceil(n/(1e3*60*60*24)),o=Math.ceil(s/7);this.weekInMonth=o}{let r=new Date(this.year,this.month,0),i=r.getDay(),n=new Date(new Date(r).setDate(r.getDate()-i));this.isLastWeekInMonth=this.date>=n.getDate()}return this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds(),this},isPast:function(){let e=m();return this.value.valueOf()<e.value.valueOf()},isSameYear:function(e){let t=m(e);return this.year==t.year},isSameMonth:function(e){let t=m(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=m(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=m(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),this.set(t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),this.set(t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),this.set(t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),this.set(t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),this.set(t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),this.set(t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),this.set(t)},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)},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%i\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\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"):""},toLangYMD:function(e){if(!this.validate)return"";let t=m(),r=t.diff(this);return r.dates==0?"\u4ECA\u65E5":r.dates==1?"\u6628\u65E5":r.dates>=-7&&r.dates<0?-1*r.dates+"\u65E5\u5F8C":r.dates<=7&&r.dates>0?r.dates+"\u65E5\u524D":this.isSameYear(t)?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D")},setFirstOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(23),e.setMinutes(59),e.setSeconds(59),e.setMilliseconds(999),this.set(e)},setFromFormatHHMM:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(4).replace(/(\d{2})(\d{2})/,"$1:$2"),[r,i]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(r)),n.setMinutes(Number(i)),this.set(n)},setFromFormatHHMMSS:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(6).replace(/(\d{2})(\d{2})(\d{2})/,"$1:$2:$3"),[r,i,n]=t.split(":"),s=new Date(this.value.valueOf());return s.setHours(Number(r)),s.setMinutes(Number(i)),s.setSeconds(Number(n)),this.set(s)},getFirstDayOfTheYear:function(){return m(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return m(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return m(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return m(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=m(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=m(this.value);return e.addDate(6-e.weekday)},diff:function(e){return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:a.scope(()=>{let t=864e5,r=this.clone().setFirstOfTheDay(),i=e.clone().setFirstOfTheDay();return Math.floor((r.ms-i.ms)/t)}),hours:a.scope(()=>{let t=36e5,r=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),i=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-i.ms)/t)}),minutes:a.scope(()=>{let t=6e4,r=this.clone().setSeconds(0).setMilliseconds(0),i=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-i.ms)/t)}),seconds:a.scope(()=>{let t=this.clone().setMilliseconds(0),r=e.clone().setMilliseconds(0);return Math.floor((t.ms-r.ms)/1e3)}),ms:this.ms-e.ms}},getAge:function(e){let t=e||m(),r=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&r--,r}},m);m.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===m};m.getFromNumberYYYYMMDD=e=>{let t=Number(e).zeroEmbed(8).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return m(t+" 00:00:00")};m.getShortYMDs=(e,t)=>{let r="",i="";return e.year==t.year&&e.year==m().year?r=e.toFormatMD():r=e.toFormatYMD(),e.year!=t.year?i=t.toFormatYMD():i=t.toFormatMD(),[r,i]};m.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=m(n).addYear(1):e=="month"?n=m(n).addMonth(1):e=="week"?n=m(n).addWeek(1):e=="day"?n=m(n).addDate(1):e=="hours"?n=m(n).addHours(1):e=="minutes"?n=m(n).addMinutes(1):e=="seconds"&&(n=m(n).addSeconds(1));return i};m.prototype.Time.prototype=m.prototype;var E={},P={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{let s=E[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),E[i]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{var o;let s=E[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),E[i]=J(D({},E[i]),{value:D(D({},(o=E[i])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=E[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=E[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete E[e],!0)}};var fe=(...[e,t,r])=>new C.prototype.Interval(e,t,r),C=fe;C.prototype={};var pe=function(...[e,t,r]){return this.fn=e,this.ms=t,this.key=r,this.isFinished=!1,C.abort(this.key),this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:pe,store:function(){P.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let e=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(e,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return C.abort(this.timeoutIndex),this},setState:function(e){return Object.entries(e).forEach(([t,r])=>{this.hasOwnProperty(t)&&(this[t]=r)}),this.store(),this}},C);C.abort=e=>{if(a.is.number(e))return clearInterval(e);let t=P.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};C.get=e=>P.get("Interval_"+e);C.once=(e,t,r)=>C(e,t,r).once();C.series=(e,t)=>p(void 0,null,function*(){return new Promise(r=>{let i=C.get(e);if(i&&!i.isFinished)return r(null);let n=()=>{C.abort(e)};r(n),t&&C(n,t,e).once()})});C.start=(e,t,r)=>C(e,t,r).start();C.prototype.Interval.prototype=C.prototype;var de=(e,t)=>new c.prototype.Fetcher(e,t),c=de;c.prototype={};c.waitList=[];c.setDefaultTrafficControl=0;c.setDefaultTimeout=1e3*60*10;c.isReadableStream=e=>e instanceof ReadableStream;c.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;c.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!c.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}}});var ye=function(e,t){var n;t=t||{};let r=t.body;t.body&&!a.is.string(t.body)&&((n=t.bodyStringify)==null||n)&&(r=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=J(D({key:x(),response_format:"json",timeout:c.setDefaultTimeout,trafficControl:c.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:D(D({"Content-Type":"application/json"},c.setDefaultHeaders&&c.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:ye,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>p(void 0,null,function*(){}),onKeyDuplicateCB:()=>p(void 0,null,function*(){}),onCompleteCB:()=>{},onRetryCB:()=>p(void 0,null,function*(){return null}),isRetry:!1,extraBody:{},setExtraBody:function(e){return this.extraBody=D(D({},this.extraBody),e),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(e){return this.onStartCB=e,this},onKeyDuplicate:function(e){return this.onKeyDuplicateCB=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},onRetry:function(e){return this.onRetryCB=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 Q(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:T,done:g,data:R}=yield c.streamToContext(o,{reader:n,decoder:s});T&&r(R)}));return}let f=!1;for(;!f;){let{ok:T,done:g,data:R}=yield new j(c.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),g=!0):u.streamStatus=="closed"&&(g=!0),g&&(f=g,n.releaseLock()),i(R,g)}})};try{for(var h=Z(l()),d,y,M;d=!(y=yield h.next()).done;d=!1){let f=y.value;;}}catch(y){M=[y]}finally{try{d&&(y=h.return)&&(yield y.call(h))}finally{if(M)throw M[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 q;let e=this.params,t=performance.now(),$=e,{key:r,response_format:i,trafficControl:n,preventMultiRequest:s,timeout:o,queries:u}=$,l=G($,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);l.method=this.method;let h=[this.method,r].join("."),d=c.waitList.includes(h);c.waitList=[...c.waitList,h];let y=!1,M=!1,f=!1,T=0,g=500,R="InternalServerError",k={},N=null,B=new AbortController,ee=setTimeout(()=>{B.abort()},e.timeout);e.signal=B.signal;let H=()=>{y=!0},U=()=>(B.abort(),c.waitList=c.waitList.filter(S=>S!=h),{isCancelled:y,isAborted:M,ok:!1,status:0,statusText:"CANCELLED",body:k,requestTime:0,rawData:null});try{if(c.setDefaultOnStart&&(yield c.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),y)return U();if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),y)return U();if(s)throw g=429,new Error("TooManyRequests")}let S=a.queryParams.set(D({},u),String(this.url));k=yield fetch(S,l).then(A=>p(this,null,function*(){return f=A.ok,g=A.status,R=A.statusText,N=A,i=="none"||i=="stream"?A:A[i]()})).catch(A=>{throw new Error(A)})}catch(S){g==200&&(g=500,f=!1),g==429&&(R="TooManyRequests"),B.signal.aborted&&(g=408,R="Timeout",M=!0),g==500&&(R=String(S)||R),k={errorCode:String(S)}}finally{clearTimeout(ee),T=performance.now()-t}let w={isCancelled:y,isAborted:M,ok:f,status:g,statusText:R,body:k,additionalBody:this.extraBody,requestTime:T,rawData:N};if(!f){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let S=yield this.onRetryCB(w.body,this.params,this);if(S)return c.waitList=c.waitList.filter(W=>W!=h),this.params=S,this.send()}this.onErrorCB&&this.onErrorCB(w.body)}if(f&&this.onStreamCB&&e.response_format=="stream"){let S=(q=N.body)==null?void 0:q.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:w,reader:S,decoder:new TextDecoder("utf-8")})}if(e.trafficControl){let S=e.trafficControl-Math.round(T);S>0&&(yield a.pending(()=>{},S),w.requestTime=e.trafficControl)}return f&&this.onCompleteCB&&this.onCompleteCB(w.body),this.onResultCB&&this.onResultCB(w,e),c.setDefaultOnEnd&&c.setDefaultOnEnd(w,e),c.waitList=c.waitList.filter(S=>S!=h),w})},abortStream:function(){this.streamStatus="abort"}},c);c.prototype.Fetcher.prototype=c.prototype;var ge=e=>new v.prototype.Filer(e),v=ge;v.prototype={};var be=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};a.extend({ok:!1,extension:"",type:"",file:{},fileName:"",Filer:be,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 t;return(t=(yield this.file.convert("dataURL")).target)==null?void 0:t.result})},toAarrayBuffer:function(){return p(this,null,function*(){var t;return(t=(yield this.file.convert("arrayBuffer")).target)==null?void 0:t.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}},v);v.fromFile=e=>p(void 0,null,function*(){return v(e)});v.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 v(n)});v.fromArrayBuffer=(e,t)=>p(void 0,null,function*(){return v.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});v.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield c(e,{response_format:"blob"}).get();return r.ok?v.fromBlob(r.body,t):v({})});v.fromDataURL=(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?v.fromBlob(r,t):v({})});v.prototype.Filer.prototype=v.prototype;var Ce=function(e){let t=e,r=null;return t.use((i,n,s)=>{let o=n;o.return=u=>{let{ok:l,status:h,body:d={},bodyStringify:y=!0}=u||{};h=h!=null?h:(l!=null?l:!0)&&200||403;let M=d;return y&&!a.is.string(d)&&(M=a.Stringify(d)),n.status(h).end(M)},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},_=Ce;_.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};_.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 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:{ENG:e=>["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur"][e]+"day",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}}};a.interval=C;c.setDefaultHeaders=()=>({});var ve=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
1
+ "use strict";var O=Object.defineProperty,te=Object.defineProperties,re=Object.getOwnPropertyDescriptor,ne=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var Y=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var I=Math.pow,z=(e,t,r)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t)=>{for(var r in t||(t={}))V.call(t,r)&&z(e,r,t[r]);if(L)for(var r of L(t))X.call(t,r)&&z(e,r,t[r]);return e},J=(e,t)=>te(e,ne(t));var G=(e,t)=>{var r={};for(var i in e)V.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&L)for(var i of L(e))t.indexOf(i)<0&&X.call(e,i)&&(r[i]=e[i]);return r};var se=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},ae=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ie(t))!V.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(i=re(t,n))||i.enumerable});return e};var oe=e=>ae(O({},"__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())}),j=function(e,t){this[0]=e,this[1]=t},Q=(e,t,r)=>{var i=(o,u,l,h)=>{try{var d=r[o](u),y=(u=d.value)instanceof j,M=d.done;Promise.resolve(y?u[0]:u).then(f=>y?i(o==="return"?o:"next",u[1]?{done:f.done,value:f.value}:f,l,h):l({value:f,done:M})).catch(f=>i("throw",f,l,h))}catch(f){h(f)}},n=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return r=r.apply(e,t),s[Y("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var Z=(e,t,r)=>(t=e[Y("asyncIterator")])?t.call(e):(e=e[Y("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 Me={};se(Me,{Fetcher:()=>c,Filer:()=>v,Server:()=>_,Time:()=>m,UUID:()=>x,default:()=>ve,useStore:()=>P});module.exports=oe(Me);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(/+/,"+")},String.prototype.escapeRegExChar=function(){return this.replace(/\\/g,"\\\\").replace(/(\?|\^|\$|\.|\||\*|\+|\(|\)|\{|\}|\[|\])/g,"\\$1")});typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=I(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=I(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=I(10,e),r=Number(this);if(r<1e3)return String(this);let i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/I(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)=>{var n;let i=t;for(let s of r){if(!s)break;i=(n=(i||{})[s||""])!=null?n:null}return i};Array.prototype.toASC=function(...t){return(!t||!(t!=null&&t.length))&&(t=[""]),this.sort((r,i)=>{for(let n of t){let s=String(n||""),o=this.every(h=>{let d=Number(e(h,s.split(".")));return typeof d=="number"&&!isNaN(d)}),u=e(r,s.split(".")),l=e(i,s.split("."));if(o){if(u=Number(u),l=Number(l),u>l)return 1;if(u<l)return-1}else{if(u=String(u).replace(/(\d+)/g,h=>h.padStart(18,"0")),l=String(l).replace(/(\d+)/g,h=>h.padStart(18,"0")),u>l)return 1;if(u<l)return-1}}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()}}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 ue=(e=26)=>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(""),x=ue;x.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");x.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};x.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 le=e=>new a.prototype.jmini(e),a=le;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+x();var b=(e,t)=>(e.queue.push(t),K(e),e),K=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,K(e)}}),F=(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},he=(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,K(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],he(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(y=>{o[1]&&(y=y.cloneNode(!0)),h.parentNode.insertBefore(y,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 b(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return b(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return b(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return b(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.click()}return this})},focus:function(){return b(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 b(this,()=>{let{eventType:s,eventID:o=x(),target:u,callback:l,options:h}=n;return h=D({passive:!0,capture:!1},h),this.for(d=>{if(!(a.is.element(d)||a.is.shadowRoot(d)))return;let{events:y}=d[a.expando];if(u){let M=l;l=f=>{if(f.target){if(a.is.string(u)){let g=f.target.closest(u);g&&(!g||M.call(g,f))}else if(a.is.elements(u)){for(let T of u)if(f.target==T)return M.call(T,f)}}}}if(y[o]){let M=y[o];d.removeEventListener(M.eventType,M.callback,M.options)}y[o]={eventType:s,callback:l,options:h},d.addEventListener(s,l,h)}),this})},removeEvent:function(n){return b(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 b(this,()=>F(this,r(n,t(this))))},empty:function(){return b(this,()=>F(this,t(this)))},append:function(n){return b(this,()=>{r(n,this)})},remove:function(){return b(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 b(this,()=>F(this,i(this,"before",...n)))},after:function(...n){return b(this,()=>F(this,i(this,"after",...n)))},find:function(n){return b(this,()=>{let s=[],o=this[0];o||F(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(d=>d)])})),F(this,a(s))})},parent:function(n){return b(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);F(this,s)})},children:function(n){return b(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 F(this,o)})},addClass:function(n){return b(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 b(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 b(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 b(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 b(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=(e,t)=>{if(!a.is.array(e))return[e];let r=[];for(let i of e)r.push(...t=="-R"?a.flatArray(i,"-R"):[i]);return r};a.uniqueArray=(e,t)=>{let r=e;return t?r=Array.from(new Map(e.map(i=>[a.getKeyValue(i,t||"0"),i])).values()):r=Array.from(new Set(e)),r};a.getKeyValue=(e,t)=>{let r={},i=e;return t.split(".").forEach(n=>{i=i==null?void 0:i[n],r=i}),r};a.Stringify=(...e)=>{let[t,r,i]=e;return JSON.stringify(t,r!=null?r:(()=>{let n=new WeakSet;return(s,o)=>{if(typeof o=="object"&&o!==null){if(n.has(o))return"[Circular Reference]";n.add(o)}return o}})(),i)};a.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(r){return t!=null?t:null}};a.randomNumber=(e=0,t=100,r)=>{if(e>t)return NaN;let i=[],n=e;for(;n<=t;){if(r&&r.length&&r.includes(n)){n++;continue}i.push(n),n++}let s=Math.round(Math.random()*(i.length-1))+0;return i[s]};a.try=e=>{try{return[e(),!0]}catch(t){return[t,!1]}};a.trySync=e=>p(void 0,null,function*(){try{return[yield e(),!0]}catch(t){return[t,!1]}});a.scope=e=>e();a.scopeSync=e=>p(void 0,null,function*(){return yield e()});a.createElement=function(e){var y;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 M of Object.entries(s)){let f=M[0],T=(y=M[1])!=null?y:"";if(f=="data"&&a.is.keyValueDictionary(T))for(let[g,R]of Object.entries(T))l.dataset[g]=R;else f=="for"?f="htmlFor":f=="tabindex"?f="tabIndex":f=="aria-label"&&(f="ariaLabel"),l[f]=T}if(n&&a(l).append(n),o)for(var[h,d]of Object.entries(o))l.style[h]=d;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.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: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,d;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=(d=e.pageY)!=null?d:(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),t&&setTimeout(()=>{r(!0)},t)});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.deepCopy=e=>{if(a.is.array(e))return e.map(t=>a.deepCopy(t));if(a.is.keyValueDictionary(e)){let t={};return Object.entries(e).forEach(([r,i])=>{t[r]=a.deepCopy(i)}),t}return e};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={equal:function(e,t,r){return r==null||r?a.Stringify(e)===a.Stringify(t):e===t},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 me=e=>new m.prototype.Time(e),m=me;m.prototype={};var ce=function(e){m.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0&&(e=new Date));let t=new Date(String(e).replace(/\//g,"-"));return this.set(t)};a.extend({value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,constructor:m,Time:ce,clone:function(){return m(this)},set:function(e){this.value=e;let t=a.is.date(e);if(this.validate=t,!t)return this.ms=-1,this.year=-1,this.month=-1,this.weekday=-1,this.weekInYear=-1,this.date=-1,this.hours=-1,this.minutes=-1,this.seconds=-1,this;this.ms=e.getTime(),this.weekday=e.getDay(),this.year=e.getFullYear(),this.month=e.getMonth()+1,this.date=e.getDate();{let r=new Date(this.year,0,1),i=new Date(r.valueOf());i.setDate(i.getDate()-(r.getDay()+1));let n=e.getTime()-i.getTime(),s=Math.ceil(n/(1e3*60*60*24));this.weekInYear=Math.ceil(s/7)}{let r=new Date(this.year,this.month-1,1),i=new Date(r.valueOf());i.setDate(i.getDate()-(r.getDay()+1));let n=e.getTime()-i.getTime(),s=Math.ceil(n/(1e3*60*60*24)),o=Math.ceil(s/7);this.weekInMonth=o}{let r=new Date(this.year,this.month,0),i=r.getDay(),n=new Date(new Date(r).setDate(r.getDate()-i));this.isLastWeekInMonth=this.date>=n.getDate()}return this.hours=e.getHours(),this.minutes=e.getMinutes(),this.seconds=e.getSeconds(),this},isPast:function(){let e=m();return this.value.valueOf()<e.value.valueOf()},isSameYear:function(e){let t=m(e);return this.year==t.year},isSameMonth:function(e){let t=m(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=m(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=m(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},setYear:function(e){let t=new Date(this.value.valueOf());return t.setFullYear(e),this.set(t)},setMonth:function(e){let t=new Date(this.value.valueOf());return t.setMonth(e-1),this.set(t)},setDate:function(e){let t=new Date(this.value.valueOf());return t.setDate(e),this.set(t)},setHours:function(e){let t=new Date(this.value.valueOf());return t.setHours(e),this.set(t)},setMinutes:function(e){let t=new Date(this.value.valueOf());return t.setMinutes(e),this.set(t)},setSeconds:function(e){let t=new Date(this.value.valueOf());return t.setSeconds(e),this.set(t)},setMilliseconds:function(e){let t=new Date(this.value.valueOf());return t.setMilliseconds(e),this.set(t)},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)},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%i\u5206"):this.toFormat("%h:%i"):""},toFormatYMDHM:function(e){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\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"):""},toLangYMD:function(e){if(!this.validate)return"";let t=m(),r=t.diff(this);return r.dates==0?"\u4ECA\u65E5":r.dates==1?"\u6628\u65E5":r.dates>=-7&&r.dates<0?-1*r.dates+"\u65E5\u5F8C":r.dates<=7&&r.dates>0?r.dates+"\u65E5\u524D":this.isSameYear(t)?e=="JP"?this.toFormat("%M\u6708%D\u65E5"):this.toFormat("%M/%D"):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5"):this.toFormat("%Y/%M/%D")},setFirstOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfTheDay:function(){let e=new Date(this.value.valueOf());return e.setHours(23),e.setMinutes(59),e.setSeconds(59),e.setMilliseconds(999),this.set(e)},setFromFormatHHMM:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(4).replace(/(\d{2})(\d{2})/,"$1:$2"),[r,i]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(r)),n.setMinutes(Number(i)),this.set(n)},setFromFormatHHMMSS:function(e){let t=String(e).removeLetters().removeSpecifics().toNumber().zeroEmbed(6).replace(/(\d{2})(\d{2})(\d{2})/,"$1:$2:$3"),[r,i,n]=t.split(":"),s=new Date(this.value.valueOf());return s.setHours(Number(r)),s.setMinutes(Number(i)),s.setSeconds(Number(n)),this.set(s)},getFirstDayOfTheYear:function(){return m(new Date(this.value.getFullYear(),0,1))},getLastDayOfTheYear:function(){return m(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfTheMonth:function(){return m(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfTheMonth:function(){return m(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfTheWeek:function(){let e=m(this.value);return e.addDate(-e.weekday)},getLastDayOfTheWeek:function(){let e=m(this.value);return e.addDate(6-e.weekday)},diff:function(e){return{years:this.year-e.year,months:(this.year-e.year)*12+(this.month-e.month),dates:a.scope(()=>{let t=864e5,r=this.clone().setFirstOfTheDay(),i=e.clone().setFirstOfTheDay();return Math.floor((r.ms-i.ms)/t)}),hours:a.scope(()=>{let t=36e5,r=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),i=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-i.ms)/t)}),minutes:a.scope(()=>{let t=6e4,r=this.clone().setSeconds(0).setMilliseconds(0),i=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-i.ms)/t)}),seconds:a.scope(()=>{let t=this.clone().setMilliseconds(0),r=e.clone().setMilliseconds(0);return Math.floor((t.ms-r.ms)/1e3)}),ms:this.ms-e.ms}},getAge:function(e){let t=e||m(),r=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&r--,r}},m);m.isTimeObject=e=>{var t;return((t=e||{})==null?void 0:t.constructor)===m};m.getFromNumberYYYYMMDD=e=>{let t=Number(e).zeroEmbed(8).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return m(t+" 00:00:00")};m.getShortYMDs=(e,t)=>{let r="",i="";return e.year==t.year&&e.year==m().year?r=e.toFormatMD():r=e.toFormatYMD(),e.year!=t.year?i=t.toFormatYMD():i=t.toFormatMD(),[r,i]};m.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=m(n).addYear(1):e=="month"?n=m(n).addMonth(1):e=="week"?n=m(n).addWeek(1):e=="day"?n=m(n).addDate(1):e=="hours"?n=m(n).addHours(1):e=="minutes"?n=m(n).addMinutes(1):e=="seconds"&&(n=m(n).addSeconds(1));return i};m.prototype.Time.prototype=m.prototype;var E={},P={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{let s=E[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),E[i]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{var o;let s=E[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),E[i]=J(D({},E[i]),{value:D(D({},(o=E[i])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=E[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=E[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete E[e],!0)}};var fe=(...[e,t,r])=>new C.prototype.Interval(e,t,r),C=fe;C.prototype={};var pe=function(...[e,t,r]){return this.fn=e,this.ms=t,this.key=r,this.isFinished=!1,C.abort(this.key),this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:pe,store:function(){P.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let e=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(e,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return C.abort(this.timeoutIndex),this},setState:function(e){return Object.entries(e).forEach(([t,r])=>{this.hasOwnProperty(t)&&(this[t]=r)}),this.store(),this}},C);C.abort=e=>{if(a.is.number(e))return clearInterval(e);let t=P.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};C.get=e=>P.get("Interval_"+e);C.once=(e,t,r)=>C(e,t,r).once();C.series=(e,t)=>p(void 0,null,function*(){return new Promise(r=>{let i=C.get(e);if(i&&!i.isFinished)return r(null);let n=()=>{C.abort(e)};r(n),t&&C(n,t,e).once()})});C.start=(e,t,r)=>C(e,t,r).start();C.prototype.Interval.prototype=C.prototype;var de=(e,t)=>new c.prototype.Fetcher(e,t),c=de;c.prototype={};c.waitList=[];c.setDefaultTrafficControl=0;c.setDefaultTimeout=1e3*60*10;c.isReadableStream=e=>e instanceof ReadableStream;c.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;c.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!c.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}}});var ye=function(e,t){var n;t=t||{};let r=t.body;t.body&&!a.is.string(t.body)&&((n=t.bodyStringify)==null||n)&&(r=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=J(D({key:x(),response_format:"json",timeout:c.setDefaultTimeout,trafficControl:c.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:D(D({"Content-Type":"application/json"},c.setDefaultHeaders&&c.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:ye,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:void 0,onKeyDuplicateCB:void 0,onCompleteCB:void 0,onRetryCB:void 0,isRetry:!1,extraBody:{},setExtraBody:function(e){return this.extraBody=D(D({},this.extraBody),e),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(e){return this.onStartCB=e,this},onKeyDuplicate:function(e){return this.onKeyDuplicateCB=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},onRetry:function(e){return this.onRetryCB=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 Q(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:T,done:g,data:R}=yield c.streamToContext(o,{reader:n,decoder:s});T&&r(R)}));return}let f=!1;for(;!f;){let{ok:T,done:g,data:R}=yield new j(c.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),g=!0):u.streamStatus=="closed"&&(g=!0),g&&(f=g,n.releaseLock()),i(R,g)}})};try{for(var h=Z(l()),d,y,M;d=!(y=yield h.next()).done;d=!1){let f=y.value;;}}catch(y){M=[y]}finally{try{d&&(y=h.return)&&(yield y.call(h))}finally{if(M)throw M[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 q;let e=this.params,t=performance.now(),$=e,{key:r,response_format:i,trafficControl:n,preventMultiRequest:s,timeout:o,queries:u}=$,l=G($,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);l.method=this.method;let h=[this.method,r].join("."),d=c.waitList.includes(h);c.waitList=[...c.waitList,h];let y=!1,M=!1,f=!1,T=0,g=500,R="InternalServerError",k={},N=null,B=new AbortController,ee=setTimeout(()=>{B.abort()},e.timeout);e.signal=B.signal;let H=()=>{y=!0},U=()=>(B.abort(),c.waitList=c.waitList.filter(S=>S!=h),{isCancelled:y,isAborted:M,ok:!1,status:0,statusText:"CANCELLED",body:k,requestTime:0,rawData:null});try{if(c.setDefaultOnStart&&(yield c.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),y)return U();if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),y)return U();if(s)throw g=429,new Error("TooManyRequests")}let S=a.queryParams.set(D({},u),String(this.url));k=yield fetch(S,l).then(A=>p(this,null,function*(){return f=A.ok,g=A.status,R=A.statusText,N=A,i=="none"||i=="stream"?A:A[i]()})).catch(A=>{throw new Error(A)})}catch(S){g==200&&(g=500,f=!1),g==429&&(R="TooManyRequests"),B.signal.aborted&&(g=408,R="Timeout",M=!0),g==500&&(R=String(S)||R),k={errorCode:String(S)}}finally{clearTimeout(ee),T=performance.now()-t}let w={isCancelled:y,isAborted:M,ok:f,status:g,statusText:R,body:k,additionalBody:this.extraBody,requestTime:T,rawData:N};if(!f){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let S=yield this.onRetryCB(w.body,this.params,this);if(S)return c.waitList=c.waitList.filter(W=>W!=h),this.params=S,this.send()}this.onErrorCB&&this.onErrorCB(w.body)}if(f&&this.onStreamCB&&e.response_format=="stream"){let S=(q=N.body)==null?void 0:q.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:w,reader:S,decoder:new TextDecoder("utf-8")})}if(e.trafficControl){let S=e.trafficControl-Math.round(T);S>0&&(yield a.pending(()=>{},S),w.requestTime=e.trafficControl)}return f&&this.onCompleteCB&&this.onCompleteCB(w.body),this.onResultCB&&this.onResultCB(w,e),c.setDefaultOnEnd&&c.setDefaultOnEnd(w,e),c.waitList=c.waitList.filter(S=>S!=h),w})},abortStream:function(){this.streamStatus="abort"}},c);c.prototype.Fetcher.prototype=c.prototype;var ge=e=>new v.prototype.Filer(e),v=ge;v.prototype={};var be=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};a.extend({ok:!1,extension:"",type:"",file:{},fileName:"",Filer:be,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 t;return(t=(yield this.file.convert("dataURL")).target)==null?void 0:t.result})},toAarrayBuffer:function(){return p(this,null,function*(){var t;return(t=(yield this.file.convert("arrayBuffer")).target)==null?void 0:t.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}},v);v.fromFile=e=>p(void 0,null,function*(){return v(e)});v.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 v(n)});v.fromArrayBuffer=(e,t)=>p(void 0,null,function*(){return v.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});v.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield c(e,{response_format:"blob"}).get();return r.ok?v.fromBlob(r.body,t):v({})});v.fromDataURL=(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?v.fromBlob(r,t):v({})});v.prototype.Filer.prototype=v.prototype;var Ce=function(e){let t=e,r=null;return t.use((i,n,s)=>{let o=n;o.return=u=>{let{ok:l,status:h,body:d={},bodyStringify:y=!0}=u||{};h=h!=null?h:(l!=null?l:!0)&&200||403;let M=d;return y&&!a.is.string(d)&&(M=a.Stringify(d)),n.status(h).end(M)},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},_=Ce;_.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};_.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 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:{ENG:e=>["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur"][e]+"day",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}}};a.interval=C;c.setDefaultHeaders=()=>({});var ve=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
@@ -39,11 +39,11 @@ declare namespace Fetcher {
39
39
  }
40
40
  type SystemMethods = {
41
41
  onStreamProcess(params: onStream.ProcessArgs): void;
42
- onStartCB(params: Input, abort: Function): Promise<void>;
42
+ onStartCB?(params: Input, abort: Function): Promise<void>;
43
43
  onKeyDuplicateCB?(retry: Function): Promise<void>;
44
44
  onStreamCB?(data: any, done: boolean): void;
45
- onResultCB(result: Output<any>, params: Input): void;
46
- onCompleteCB(result: any): void;
45
+ onResultCB?(result: Output<any>, params: Input): void;
46
+ onCompleteCB?(result: any): void;
47
47
  onRetryCB?(result: any, current_params: Input, _this: Chains): Promise<Input | null>;
48
48
  extraBody?: KeyValueDict;
49
49
  isRetry: boolean;
package/esm/fetcher.js CHANGED
@@ -1 +1 @@
1
- import{b as m,c as I,d as v,e as d,f as O,g as F,h as k}from"./chunk-ABA72NWU.js";import y from"./core";import{UUID as K}from"./uuid";const M=(t,r)=>new e.prototype.Fetcher(t,r),e=M;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)=>d(void 0,null,function*(){try{const n=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(n))return{ok:!1,done:!0,data:null};if(!n)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let s=yield n.read();return{ok:!0,done:s.done,data:i.decode(s.value)}}catch(n){return{ok:!1,done:!0,data:n}}});const U=function(t,r){var s;r=r||{};let n=r.body;r.body&&!y.is.string(r.body)&&((s=r.bodyStringify)==null||s)&&(n=y.Stringify(r.body||{}));let i=t;return y.is.string(t)&&!t.match(/https?:/)&&(i=location.origin+"/"+t.replace(/^\//,"")),this.url=i,this.method=r.method||"get",this.streamStatus="open",this.params=I(m({key:K(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:m(m({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:n}),this};y.extend({Fetcher:U,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:()=>d(void 0,null,function*(){}),onKeyDuplicateCB:()=>d(void 0,null,function*(){}),onCompleteCB:()=>{},onRetryCB:()=>d(void 0,null,function*(){return null}),isRetry:!1,extraBody:{},setExtraBody:function(t){return this.extraBody=m(m({},this.extraBody),t),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(t){return this.onStartCB=t,this},onKeyDuplicate:function(t){return this.onKeyDuplicateCB=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},onRetry:function(t){return this.onRetryCB=t,this},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return d(this,null,function*(){let{response:r,errorCB:n,streamCB:i,reader:s,decoder:C}=t,S=r.body,f=this;const b=function(){return F(this,null,function*(){if(!r.ok){y.scope(()=>d(this,null,function*(){let{ok:p,done:o,data:l}=yield e.streamToContext(S,{reader:s,decoder:C});p&&n(l)}));return}let u=!1;for(;!u;){let{ok:p,done:o,data:l}=yield new O(e.streamToContext(S,{reader:s,decoder:C}));f.streamStatus=="abort"?(f.streamStatus="closed",s.cancel(),o=!0):f.streamStatus=="closed"&&(o=!0),o&&(u=o,s.releaseLock()),i(l,o)}})};try{for(var R=k(b()),q,_,B;q=!(_=yield R.next()).done;q=!1){let u=_.value;;}}catch(_){B=[_]}finally{try{q&&(_=R.return)&&(yield _.call(R))}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 d(this,null,function*(){var x;let t=this.params,r=performance.now(),P=t,{key:n,response_format:i,trafficControl:s,preventMultiRequest:C,timeout:S,queries:f}=P,b=v(P,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);b.method=this.method;let R=[this.method,n].join("."),q=e.waitList.includes(R);e.waitList=[...e.waitList,R];let _=!1,B=!1,u=!1,p=0,o=500,l="InternalServerError",E={},D=null,A=new AbortController,L=setTimeout(()=>{A.abort()},t.timeout);t.signal=A.signal;const T=()=>{_=!0},w=()=>(A.abort(),e.waitList=e.waitList.filter(a=>a!=R),{isCancelled:_,isAborted:B,ok:!1,status:0,statusText:"CANCELLED",body:E,requestTime:0,rawData:null});try{if(e.setDefaultOnStart&&(yield e.setDefaultOnStart(t,T)),this.onStartCB&&(yield this.onStartCB(t,T)),_)return w();if(q){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(T)),_)return w();if(C)throw o=429,new Error("TooManyRequests")}let a=y.queryParams.set(m({},f),String(this.url));E=yield fetch(a,b).then(h=>d(this,null,function*(){return u=h.ok,o=h.status,l=h.statusText,D=h,i=="none"||i=="stream"?h:h[i]()})).catch(h=>{throw new Error(h)})}catch(a){o==200&&(o=500,u=!1),o==429&&(l="TooManyRequests"),A.signal.aborted&&(o=408,l="Timeout",B=!0),o==500&&(l=String(a)||l),E={errorCode:String(a)}}finally{clearTimeout(L),p=performance.now()-r}let c={isCancelled:_,isAborted:B,ok:u,status:o,statusText:l,body:E,additionalBody:this.extraBody,requestTime:p,rawData:D};if(!u){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let a=yield this.onRetryCB(c.body,this.params,this);if(a)return e.waitList=e.waitList.filter(g=>g!=R),this.params=a,this.send()}this.onErrorCB&&this.onErrorCB(c.body)}if(u&&this.onStreamCB&&t.response_format=="stream"){let a=(x=D.body)==null?void 0:x.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:c,reader:a,decoder:new TextDecoder("utf-8")})}if(t.trafficControl){let a=t.trafficControl-Math.round(p);a>0&&(yield y.pending(()=>{},a),c.requestTime=t.trafficControl)}return u&&this.onCompleteCB&&this.onCompleteCB(c.body),this.onResultCB&&this.onResultCB(c,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(c,t),e.waitList=e.waitList.filter(a=>a!=R),c})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.Fetcher.prototype=e.prototype;export{e as Fetcher,e as default};
1
+ import{b as h,c as g,d as I,e as p,f as O,g as F,h as k}from"./chunk-ABA72NWU.js";import m from"./core";import{UUID as K}from"./uuid";const M=(t,r)=>new e.prototype.Fetcher(t,r),e=M;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 n=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(n))return{ok:!1,done:!0,data:null};if(!n)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let s=yield n.read();return{ok:!0,done:s.done,data:i.decode(s.value)}}catch(n){return{ok:!1,done:!0,data:n}}});const U=function(t,r){var s;r=r||{};let n=r.body;r.body&&!m.is.string(r.body)&&((s=r.bodyStringify)==null||s)&&(n=m.Stringify(r.body||{}));let i=t;return m.is.string(t)&&!t.match(/https?:/)&&(i=location.origin+"/"+t.replace(/^\//,"")),this.url=i,this.method=r.method||"get",this.streamStatus="open",this.params=g(h({key:K(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:h(h({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:n}),this};m.extend({Fetcher:U,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:void 0,onKeyDuplicateCB:void 0,onCompleteCB:void 0,onRetryCB:void 0,isRetry:!1,extraBody:{},setExtraBody:function(t){return this.extraBody=h(h({},this.extraBody),t),this},onErrorCB:()=>{},onResultCB:()=>{},onStreamCB:()=>{},onStart:function(t){return this.onStartCB=t,this},onKeyDuplicate:function(t){return this.onKeyDuplicateCB=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},onRetry:function(t){return this.onRetryCB=t,this},onError:function(t){return this.onErrorCB=t,this},onStreamProcess:function(t){return p(this,null,function*(){let{response:r,errorCB:n,streamCB:i,reader:s,decoder:C}=t,S=r.body,f=this;const b=function(){return F(this,null,function*(){if(!r.ok){m.scope(()=>p(this,null,function*(){let{ok:y,done:a,data:l}=yield e.streamToContext(S,{reader:s,decoder:C});y&&n(l)}));return}let u=!1;for(;!u;){let{ok:y,done:a,data:l}=yield new O(e.streamToContext(S,{reader:s,decoder:C}));f.streamStatus=="abort"?(f.streamStatus="closed",s.cancel(),a=!0):f.streamStatus=="closed"&&(a=!0),a&&(u=a,s.releaseLock()),i(l,a)}})};try{for(var R=k(b()),q,_,B;q=!(_=yield R.next()).done;q=!1){let u=_.value;;}}catch(_){B=[_]}finally{try{q&&(_=R.return)&&(yield _.call(R))}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 x;let t=this.params,r=performance.now(),P=t,{key:n,response_format:i,trafficControl:s,preventMultiRequest:C,timeout:S,queries:f}=P,b=I(P,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);b.method=this.method;let R=[this.method,n].join("."),q=e.waitList.includes(R);e.waitList=[...e.waitList,R];let _=!1,B=!1,u=!1,y=0,a=500,l="InternalServerError",E={},D=null,A=new AbortController,L=setTimeout(()=>{A.abort()},t.timeout);t.signal=A.signal;const T=()=>{_=!0},w=()=>(A.abort(),e.waitList=e.waitList.filter(o=>o!=R),{isCancelled:_,isAborted:B,ok:!1,status:0,statusText:"CANCELLED",body:E,requestTime:0,rawData:null});try{if(e.setDefaultOnStart&&(yield e.setDefaultOnStart(t,T)),this.onStartCB&&(yield this.onStartCB(t,T)),_)return w();if(q){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(T)),_)return w();if(C)throw a=429,new Error("TooManyRequests")}let o=m.queryParams.set(h({},f),String(this.url));E=yield fetch(o,b).then(c=>p(this,null,function*(){return u=c.ok,a=c.status,l=c.statusText,D=c,i=="none"||i=="stream"?c:c[i]()})).catch(c=>{throw new Error(c)})}catch(o){a==200&&(a=500,u=!1),a==429&&(l="TooManyRequests"),A.signal.aborted&&(a=408,l="Timeout",B=!0),a==500&&(l=String(o)||l),E={errorCode:String(o)}}finally{clearTimeout(L),y=performance.now()-r}let d={isCancelled:_,isAborted:B,ok:u,status:a,statusText:l,body:E,additionalBody:this.extraBody,requestTime:y,rawData:D};if(!u){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let o=yield this.onRetryCB(d.body,this.params,this);if(o)return e.waitList=e.waitList.filter(v=>v!=R),this.params=o,this.send()}this.onErrorCB&&this.onErrorCB(d.body)}if(u&&this.onStreamCB&&t.response_format=="stream"){let o=(x=D.body)==null?void 0:x.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:d,reader:o,decoder:new TextDecoder("utf-8")})}if(t.trafficControl){let o=t.trafficControl-Math.round(y);o>0&&(yield m.pending(()=>{},o),d.requestTime=t.trafficControl)}return u&&this.onCompleteCB&&this.onCompleteCB(d.body),this.onResultCB&&this.onResultCB(d,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(d,t),e.waitList=e.waitList.filter(o=>o!=R),d})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.Fetcher.prototype=e.prototype;export{e as Fetcher,e as default};
@@ -1 +1 @@
1
- import{a as u}from"./chunk-ABA72NWU.js";if(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 r=0;r<t.length;r++)n[r]=t.charCodeAt(r);try{var o=new Blob([n.buffer],{type:e})}catch(i){return!1}return o},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(/+/,"+")},String.prototype.escapeRegExChar=function(){return this.replace(/\\/g,"\\\\").replace(/(\?|\^|\$|\.|\||\*|\+|\(|\)|\{|\}|\[|\])/g,"\\$1")}),typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let n=u(10,t);return Math.round(this/e*n*100)/n},Number.prototype.rate=function(e,t=2){let n=u(10,t);return Math.round(this/e*n)/n},Number.prototype.rank=function(e=1){let t=u(10,e),n=Number(this),r=n.toLocaleString().replace(/\d/ig,"").length;return Math.round(n/u(1e3,r)*t)/t+("KMGTPEZY"[r-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),r=t.slice(4,6),o=t.slice(6,8),i=[];return n.length!=4||i.push(n),r.length!=2||i.push(r),o.length!=2||i.push(o),i.join(e)}),typeof Array!="undefined"){const e=(t,n)=>{var o;let r=t;for(let i of n){if(!i)break;r=(o=(r||{})[i||""])!=null?o:null}return r};Array.prototype.toASC=function(...t){return(!t||!(t!=null&&t.length))&&(t=[""]),this.sort((n,r)=>{for(let o of t){let i=String(o||""),g=this.every(p=>{let l=Number(e(p,i.split(".")));return typeof l=="number"&&!isNaN(l)}),s=e(n,i.split(".")),a=e(r,i.split("."));if(g){if(s=Number(s),a=Number(a),s>a)return 1;if(s<a)return-1}else{if(s=String(s).replace(/(\d+)/g,p=>p.padStart(18,"0")),a=String(a).replace(/(\d+)/g,p=>p.padStart(18,"0")),s>a)return 1;if(s<a)return-1}}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,n)=>{let r=new FileReader;r.onload=i=>t(i),r.onerror=i=>n(i);let o="readAs"+(e==null?void 0:e.toCapital());r[o](this)})});
1
+ import{a as u}from"./chunk-ABA72NWU.js";if(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 r=0;r<t.length;r++)n[r]=t.charCodeAt(r);try{var o=new Blob([n.buffer],{type:e})}catch(i){return!1}return o},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(/+/,"+")},String.prototype.escapeRegExChar=function(){return this.replace(/\\/g,"\\\\").replace(/(\?|\^|\$|\.|\||\*|\+|\(|\)|\{|\}|\[|\])/g,"\\$1")}),typeof Number!="undefined"&&(Number.prototype.zeroEmbed=function(e){return String(this).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let n=u(10,t);return Math.round(this/e*n*100)/n},Number.prototype.rate=function(e,t=2){let n=u(10,t);return Math.round(this/e*n)/n},Number.prototype.rank=function(e=1){let t=u(10,e),n=Number(this);if(n<1e3)return String(this);let r=n.toLocaleString().replace(/\d/ig,"").length;return Math.round(n/u(1e3,r)*t)/t+("KMGTPEZY"[r-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),r=t.slice(4,6),o=t.slice(6,8),i=[];return n.length!=4||i.push(n),r.length!=2||i.push(r),o.length!=2||i.push(o),i.join(e)}),typeof Array!="undefined"){const e=(t,n)=>{var o;let r=t;for(let i of n){if(!i)break;r=(o=(r||{})[i||""])!=null?o:null}return r};Array.prototype.toASC=function(...t){return(!t||!(t!=null&&t.length))&&(t=[""]),this.sort((n,r)=>{for(let o of t){let i=String(o||""),g=this.every(p=>{let l=Number(e(p,i.split(".")));return typeof l=="number"&&!isNaN(l)}),s=e(n,i.split(".")),a=e(r,i.split("."));if(g){if(s=Number(s),a=Number(a),s>a)return 1;if(s<a)return-1}else{if(s=String(s).replace(/(\d+)/g,p=>p.padStart(18,"0")),a=String(a).replace(/(\d+)/g,p=>p.padStart(18,"0")),s>a)return 1;if(s<a)return-1}}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()}}typeof File!="undefined"&&(File.prototype.convert=function(e){return e=e||"dataURL",new Promise((t,n)=>{let r=new FileReader;r.onload=i=>t(i),r.onerror=i=>n(i);let o="readAs"+(e==null?void 0:e.toCapital());r[o](this)})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmini",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "description": "minified JavaScript Framework",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",