jmini 0.0.63 → 0.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +1 -1
- package/esm/core.d.ts +174 -0
- package/esm/extension.d.ts +34 -0
- package/esm/fetcher.d.ts +105 -0
- package/esm/fetcher.js +1 -1
- package/esm/filer.d.ts +40 -0
- package/esm/index.d.ts +21 -0
- package/esm/interval.d.ts +39 -0
- package/esm/primitiveExtension.d.ts +57 -0
- package/esm/server.d.ts +49 -0
- package/esm/time.d.ts +84 -0
- package/esm/useStore.d.ts +11 -0
- package/esm/uuid.d.ts +13 -0
- package/package.json +4 -1
package/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var O=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var Y=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var k=Math.pow,X=(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)&&X(e,r,t[r]);if(L)for(var r of L(t))G.call(t,r)&&X(e,r,t[r]);return e},N=(e,t)=>re(e,ie(t));var Q=(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&&G.call(e,i)&&(r[i]=e[i]);return r};var ae=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},oe=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!V.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(i=ne(t,n))||i.enumerable});return e};var ue=e=>oe(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},Z=(e,t,r)=>{var i=(o,u,l,h)=>{try{var d=r[o](u),y=(u=d.value)instanceof j,v=d.done;Promise.resolve(y?u[0]:u).then(c=>y?i(o==="return"?o:"next",u[1]?{done:c.done,value:c.value}:c,l,h):l({value:c,done:v})).catch(c=>i("throw",c,l,h))}catch(c){h(c)}},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 ee=(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 Se={};ae(Se,{Fetcher:()=>f,Filer:()=>M,Server:()=>J,Time:()=>m,UUID:()=>R,default:()=>ve,useStore:()=>E});module.exports=ue(Se);typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()});typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let e=this;return e&&(e=e.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,t=>t[1].toUpper())),e},String.prototype.clip=function(e,t){return this.slice(e,t)},String.prototype.partReplace=function(e,t){return this.slice(0,e)+t+this.slice(e+t.length)},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),r=new Uint8Array(t.length);for(var i=0;i<t.length;i++)r[i]=t.charCodeAt(i);try{var n=new Blob([r.buffer],{type:e})}catch(s){return!1}return n},String.prototype.toNumber=function(){return Number(this.removeLetters())},String.prototype.removeLetters=function(){return this.replace(/[\D]/ig,"")},String.prototype.removeSpecifics=function(){return this.replace(/[^\w\s\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]|_/uig,"")},String.prototype.removeJP=function(){return this.replace(/[\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]+/uig,"")},String.prototype.zen2hanNumber=function(){return this.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,"-").replace(/¥/,"\xA5").replace(/、/,",").replace(/(/,"(").replace(/)/,")").replace(/+/,"+")},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=k(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=k(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=k(10,e),r=Number(this);if(r<1e3)return String(this);let i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/k(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!==(s!=null?s:!s))break;i=(n=(i||{})[s!=null?s:""])!=null?n:null}return i};Array.prototype.toASC=function(...t){return t!=null&&t.length||(t=[""]),this.sort((r,i)=>{let n=this.every(u=>{let l=Number(e(u,...t));return typeof l=="number"&&!isNaN(l)}),s=e(r,...t),o=e(i,...t);if(n){if(s=Number(s),o=Number(o),s>o)return 1;if(s<o)return-1}else{if(s=String(s).replace(/(\d+)/g,u=>u.padStart(18,"0")),o=String(o).replace(/(\d+)/g,u=>u.padStart(18,"0")),s>o)return 1;if(s<o)return-1}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()},Array.prototype.getSum=function(...t){return this.reduce((r,i)=>r+(t?e(i,...t):Number(i)||0),0)},Array.prototype.getAve=function(...t){return this.getSum(...t)/this.length},Array.prototype.getMedian=function(...t){let r=this.map(n=>t?e(n,...t):Number(n)||0);r.sort((n,s)=>n-s);let i=Math.floor(r.length/2);return r.length%2===0?(r[i-1]+r[i])/2:r[i]},Array.prototype.getMin=function(...t){let r=this.map(i=>t?e(i,...t):Number(i)||0);return Math.min(...r)},Array.prototype.getMax=function(...t){let r=this.map(i=>t?e(i,...t):Number(i)||0);return Math.max(...r)}}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 le=(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(""),R=le;R.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");R.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};R.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 he=e=>new a.prototype.jmini(e),a=he;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+R();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)}}),P=(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},me=(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=[],me(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=R(),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 v=l;l=c=>{if(c.target){if(a.is.string(u)){let g=c.target.closest(u);g&&(!g||v.call(g,c))}else if(a.is.elements(u)){for(let T of u)if(c.target==T)return v.call(T,c)}}}}if(y[o]){let v=y[o];d.removeEventListener(v.eventType,v.callback,v.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,()=>P(this,r(n,t(this))))},empty:function(){return b(this,()=>P(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,()=>P(this,i(this,"before",...n)))},after:function(...n){return b(this,()=>P(this,i(this,"after",...n)))},find:function(n){return b(this,()=>{let s=[],o=this[0];o||P(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)])})),P(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);P(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 P(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 v of Object.entries(s)){let c=v[0],T=(y=v[1])!=null?y:"";if(c=="data"&&a.is.keyValueDictionary(T))for(let[g,x]of Object.entries(T))l.dataset[g]=x;else c=="for"?c="htmlFor":c=="tabindex"?c="tabIndex":c=="aria-label"&&(c="ariaLabel"),l[c]=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 fe=e=>new m.prototype.Time(e),m=fe;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 w={},E={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{let s=w[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),w[i]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{var o;let s=w[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),w[i]=N(D({},w[i]),{value:D(D({},(o=w[i])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=w[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=w[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete w[e],!0)}};var pe=(...[e,t,r])=>new C.prototype.Interval(e,t,r),C=pe;C.prototype={};var de=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:de,store:function(){E.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=E.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};C.get=e=>E.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 ye=(e,t)=>new f.prototype.Fetcher(e,t),f=ye;f.prototype={};f.waitList=[];f.setDefaultTrafficControl=0;f.setDefaultTimeout=1e3*60*10;f.abort=e=>{let t="fetcher.abortController."+e,r=E.get(t);r&&r.abort()};f.isReadableStream=e=>e instanceof ReadableStream;f.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;f.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!f.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 ge=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=N(D({key:R(),response_format:"json",timeout:f.setDefaultTimeout,trafficControl:f.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:D(D({"Content-Type":"application/json"},f.setDefaultHeaders&&f.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:ge,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:void 0,onKeyDuplicateCB:void 0,onCompleteCB:void 0,onRetryCB:void 0,isRetry:!1,extraBody:{},abortController:null,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 Z(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:T,done:g,data:x}=yield f.streamToContext(o,{reader:n,decoder:s});T&&r(x)}));return}let c=!1;for(;!c;){let{ok:T,done:g,data:x}=yield new j(f.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),g=!0):u.streamStatus=="closed"&&(g=!0),g&&(c=g,n.releaseLock()),i(x,g)}})};try{for(var h=ee(l()),d,y,v;d=!(y=yield h.next()).done;d=!1){let c=y.value;;}}catch(y){v=[y]}finally{try{d&&(y=h.return)&&(yield y.call(h))}finally{if(v)throw v[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 W;let e=this.params,t=performance.now(),q=e,{key:r,response_format:i,trafficControl:n,preventMultiRequest:s,timeout:o,queries:u}=q,l=Q(q,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);l.method=this.method;let h=[this.method,r].join("."),d=f.waitList.includes(h);f.waitList=[...f.waitList,h];let y=!1,v=!1,c=!1,T=0,g=500,x="InternalServerError",B={},_=null,I=new AbortController,te=setTimeout(()=>{I.abort()},e.timeout);e.signal=I.signal,this.abortController=I;let U="fetcher.abortController."+this.params.key;E.set({[U]:I});let H=()=>{y=!0},$=()=>(I.abort(),f.waitList=f.waitList.filter(S=>S!=h),{isCancelled:y,isAborted:v,ok:!1,status:0,statusText:"CANCELLED",body:B,requestTime:0,rawData:null});try{if(f.setDefaultOnStart&&(yield f.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),y)return $();if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),y)return $();if(s)throw g=429,new Error("TooManyRequests")}let S=a.queryParams.set(D({},u),String(this.url));B=yield fetch(S,l).then(F=>p(this,null,function*(){return c=F.ok,g=F.status,x=F.statusText,_=F,i=="none"||i=="stream"?F:F[i]()})).catch(F=>{throw new Error(F)})}catch(S){g==200&&(g=500,c=!1),g==429&&(x="TooManyRequests"),I.signal.aborted&&(g=408,x="Timeout",v=!0),g==500&&(x=String(S)||x),B={errorCode:String(S)}}finally{clearTimeout(te),T=performance.now()-t}let A={isCancelled:y,isAborted:v,ok:c,status:g,statusText:x,body:B,additionalBody:this.extraBody,requestTime:T,rawData:_};if(!c){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let S=yield this.onRetryCB(A.body,this.params,this);if(S)return f.waitList=f.waitList.filter(z=>z!=h),this.params=S,this.send()}this.onErrorCB&&this.onErrorCB(A.body)}if(c&&this.onStreamCB&&e.response_format=="stream"){let S=(W=_.body)==null?void 0:W.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:A,reader:S,decoder:new TextDecoder("utf-8")})}if(e.trafficControl){let S=e.trafficControl-Math.round(T);S>0&&(yield a.pending(()=>{},S),A.requestTime=e.trafficControl)}return c&&this.onCompleteCB&&this.onCompleteCB(A.body),this.onResultCB&&this.onResultCB(A,e),f.setDefaultOnEnd&&f.setDefaultOnEnd(A,e),f.waitList=f.waitList.filter(S=>S!=h),E.delete(U),A})},abortStream:function(){this.streamStatus="abort"}},f);f.prototype.Fetcher.prototype=f.prototype;var be=e=>new M.prototype.Filer(e),M=be;M.prototype={};var Ce=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:Ce,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}},M);M.fromFile=e=>p(void 0,null,function*(){return M(e)});M.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 M(n)});M.fromArrayBuffer=(e,t)=>p(void 0,null,function*(){return M.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});M.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield f(e,{response_format:"blob"}).get();return r.ok?M.fromBlob(r.body,t):M({})});M.fromDataURL=(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?M.fromBlob(r,t):M({})});M.prototype.Filer.prototype=M.prototype;var Me=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 v=d;return y&&!a.is.string(d)&&(v=a.Stringify(d)),n.status(h).end(v)},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},J=Me;J.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};J.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;f.setDefaultHeaders=()=>({});var ve=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
|
|
1
|
+
"use strict";var O=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var V=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var k=Math.pow,X=(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={}))j.call(t,r)&&X(e,r,t[r]);if(L)for(var r of L(t))G.call(t,r)&&X(e,r,t[r]);return e},N=(e,t)=>re(e,ie(t));var Q=(e,t)=>{var r={};for(var i in e)j.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&&G.call(e,i)&&(r[i]=e[i]);return r};var ae=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},oe=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!j.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(i=ne(t,n))||i.enumerable});return e};var ue=e=>oe(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())}),K=function(e,t){this[0]=e,this[1]=t},Z=(e,t,r)=>{var i=(o,u,l,h)=>{try{var d=r[o](u),y=(u=d.value)instanceof K,v=d.done;Promise.resolve(y?u[0]:u).then(c=>y?i(o==="return"?o:"next",u[1]?{done:c.done,value:c.value}:c,l,h):l({value:c,done:v})).catch(c=>i("throw",c,l,h))}catch(c){h(c)}},n=o=>s[o]=u=>new Promise((l,h)=>i(o,u,l,h)),s={};return r=r.apply(e,t),s[V("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var ee=(e,t,r)=>(t=e[V("asyncIterator")])?t.call(e):(e=e[V("iterator")](),t={},r=(i,n)=>(n=e[i])&&(t[i]=s=>new Promise((o,u,l)=>(s=n.call(e,s),l=s.done,Promise.resolve(s.value).then(h=>o({value:h,done:l}),u)))),r("next"),r("return"),t);var Se={};ae(Se,{Fetcher:()=>f,Filer:()=>M,Server:()=>J,Time:()=>m,UUID:()=>R,default:()=>ve,useStore:()=>E});module.exports=ue(Se);typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()});typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let e=this;return e&&(e=e.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,t=>t[1].toUpper())),e},String.prototype.clip=function(e,t){return this.slice(e,t)},String.prototype.partReplace=function(e,t){return this.slice(0,e)+t+this.slice(e+t.length)},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),r=new Uint8Array(t.length);for(var i=0;i<t.length;i++)r[i]=t.charCodeAt(i);try{var n=new Blob([r.buffer],{type:e})}catch(s){return!1}return n},String.prototype.toNumber=function(){return Number(this.removeLetters())},String.prototype.removeLetters=function(){return this.replace(/[\D]/ig,"")},String.prototype.removeSpecifics=function(){return this.replace(/[^\w\s\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]|_/uig,"")},String.prototype.removeJP=function(){return this.replace(/[\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Han}]+/uig,"")},String.prototype.zen2hanNumber=function(){return this.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}).replace(/[--﹣−‐⁃‑‒–—﹘―⎯⏤ーー─━]/g,"-").replace(/¥/,"\xA5").replace(/、/,",").replace(/(/,"(").replace(/)/,")").replace(/+/,"+")},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=k(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=k(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=k(10,e),r=Number(this);if(r<1e3)return String(this);let i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/k(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!==(s!=null?s:!s))break;i=(n=(i||{})[s!=null?s:""])!=null?n:null}return i};Array.prototype.toASC=function(...t){return t!=null&&t.length||(t=[""]),this.sort((r,i)=>{let n=this.every(u=>{let l=Number(e(u,...t));return typeof l=="number"&&!isNaN(l)}),s=e(r,...t),o=e(i,...t);if(n){if(s=Number(s),o=Number(o),s>o)return 1;if(s<o)return-1}else{if(s=String(s).replace(/(\d+)/g,u=>u.padStart(18,"0")),o=String(o).replace(/(\d+)/g,u=>u.padStart(18,"0")),s>o)return 1;if(s<o)return-1}return 0})},Array.prototype.toDESC=function(...t){return this.toASC(...t).reverse()},Array.prototype.getSum=function(...t){return this.reduce((r,i)=>r+(t?e(i,...t):Number(i)||0),0)},Array.prototype.getAve=function(...t){return this.getSum(...t)/this.length},Array.prototype.getMedian=function(...t){let r=this.map(n=>t?e(n,...t):Number(n)||0);r.sort((n,s)=>n-s);let i=Math.floor(r.length/2);return r.length%2===0?(r[i-1]+r[i])/2:r[i]},Array.prototype.getMin=function(...t){let r=this.map(i=>t?e(i,...t):Number(i)||0);return Math.min(...r)},Array.prototype.getMax=function(...t){let r=this.map(i=>t?e(i,...t):Number(i)||0);return Math.max(...r)}}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 le=(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(""),R=le;R.gen128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");R.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};R.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 he=e=>new a.prototype.jmini(e),a=he;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+R();var b=(e,t)=>(e.queue.push(t),U(e),e),U=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,U(e)}}),P=(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},me=(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,U(e),e};a.extend({constructor:a,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],me(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=R(),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 v=l;l=c=>{if(c.target){if(a.is.string(u)){let g=c.target.closest(u);g&&(!g||v.call(g,c))}else if(a.is.elements(u)){for(let T of u)if(c.target==T)return v.call(T,c)}}}}if(y[o]){let v=y[o];d.removeEventListener(v.eventType,v.callback,v.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,()=>P(this,r(n,t(this))))},empty:function(){return b(this,()=>P(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,()=>P(this,i(this,"before",...n)))},after:function(...n){return b(this,()=>P(this,i(this,"after",...n)))},find:function(n){return b(this,()=>{let s=[],o=this[0];o||P(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)])})),P(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);P(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 P(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 v of Object.entries(s)){let c=v[0],T=(y=v[1])!=null?y:"";if(c=="data"&&a.is.keyValueDictionary(T))for(let[g,x]of Object.entries(T))l.dataset[g]=x;else c=="for"?c="htmlFor":c=="tabindex"?c="tabIndex":c=="aria-label"&&(c="ariaLabel"),l[c]=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 fe=e=>new m.prototype.Time(e),m=fe;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 w={},E={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{let s=w[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),w[i]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{var o;let s=w[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),w[i]=N(D({},w[i]),{value:D(D({},(o=w[i])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=w[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=w[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete w[e],!0)}};var pe=(...[e,t,r])=>new C.prototype.Interval(e,t,r),C=pe;C.prototype={};var de=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:de,store:function(){E.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=E.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};C.get=e=>E.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 ye=(e,t)=>new f.prototype.Fetcher(e,t),f=ye;f.prototype={};f.waitList=[];f.setDefaultTrafficControl=0;f.setDefaultTimeout=1e3*60*10;f.abort=e=>{let t="fetcher.abortController."+e,r=E.get(t);console.log(r),r&&r.abort()};f.isReadableStream=e=>e instanceof ReadableStream;f.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;f.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!f.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 ge=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=N(D({key:R(),response_format:"json",timeout:f.setDefaultTimeout,trafficControl:f.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:D(D({"Content-Type":"application/json"},f.setDefaultHeaders&&f.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:ge,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:void 0,onKeyDuplicateCB:void 0,onCompleteCB:void 0,onRetryCB:void 0,isRetry:!1,extraBody:{},abortController:null,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 Z(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:T,done:g,data:x}=yield f.streamToContext(o,{reader:n,decoder:s});T&&r(x)}));return}let c=!1;for(;!c;){let{ok:T,done:g,data:x}=yield new K(f.streamToContext(o,{reader:n,decoder:s}));u.streamStatus=="abort"?(u.streamStatus="closed",n.cancel(),g=!0):u.streamStatus=="closed"&&(g=!0),g&&(c=g,n.releaseLock()),i(x,g)}})};try{for(var h=ee(l()),d,y,v;d=!(y=yield h.next()).done;d=!1){let c=y.value;;}}catch(y){v=[y]}finally{try{d&&(y=h.return)&&(yield y.call(h))}finally{if(v)throw v[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 z;let e=this.params,t=performance.now(),W=e,{key:r,response_format:i,trafficControl:n,preventMultiRequest:s,timeout:o,queries:u}=W,l=Q(W,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);l.method=this.method;let h=[this.method,r].join("."),d=f.waitList.includes(h);f.waitList=[...f.waitList,h];let y=!1,v=!1,c=!1,T=0,g=500,x="InternalServerError",B={},_=null,I=new AbortController,te=setTimeout(()=>{I.abort(),console.log("timeout",o)},e.timeout);l.signal=I.signal,this.abortController=I;let $="fetcher.abortController."+this.params.key;E.set({[$]:I});let H=()=>{y=!0},q=()=>(I.abort(),f.waitList=f.waitList.filter(S=>S!=h),{isCancelled:y,isAborted:v,ok:!1,status:0,statusText:"CANCELLED",body:B,requestTime:0,rawData:null});try{if(f.setDefaultOnStart&&(yield f.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),y)return q();if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),y)return q();if(s)throw g=429,new Error("TooManyRequests")}let S=a.queryParams.set(D({},u),String(this.url)),Y=yield fetch(S,l).then(F=>p(this,null,function*(){return c=F.ok,g=F.status,x=F.statusText,_=F,i=="none"||i=="stream"?F:F[i]()})).catch(F=>{throw new Error(F)});E.delete($),B=Y}catch(S){g==200&&(g=500,c=!1),g==429&&(x="TooManyRequests"),I.signal.aborted&&(g=408,x="Timeout",v=!0),g==500&&(x=String(S)||x),B={errorCode:String(S)}}finally{clearTimeout(te),T=performance.now()-t}let A={isCancelled:y,isAborted:v,ok:c,status:g,statusText:x,body:B,additionalBody:this.extraBody,requestTime:T,rawData:_};if(!c){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let S=yield this.onRetryCB(A.body,this.params,this);if(S)return f.waitList=f.waitList.filter(Y=>Y!=h),this.params=S,this.send()}this.onErrorCB&&this.onErrorCB(A.body)}if(c&&this.onStreamCB&&e.response_format=="stream"){let S=(z=_.body)==null?void 0:z.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:A,reader:S,decoder:new TextDecoder("utf-8")})}if(e.trafficControl){let S=e.trafficControl-Math.round(T);S>0&&(yield a.pending(()=>{},S),A.requestTime=e.trafficControl)}return c&&this.onCompleteCB&&this.onCompleteCB(A.body),this.onResultCB&&this.onResultCB(A,e),f.setDefaultOnEnd&&f.setDefaultOnEnd(A,e),f.waitList=f.waitList.filter(S=>S!=h),A})},abortStream:function(){this.streamStatus="abort"}},f);f.prototype.Fetcher.prototype=f.prototype;var be=e=>new M.prototype.Filer(e),M=be;M.prototype={};var Ce=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:Ce,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}},M);M.fromFile=e=>p(void 0,null,function*(){return M(e)});M.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 M(n)});M.fromArrayBuffer=(e,t)=>p(void 0,null,function*(){return M.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t)});M.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield f(e,{response_format:"blob"}).get();return r.ok?M.fromBlob(r.body,t):M({})});M.fromDataURL=(e,t)=>p(void 0,null,function*(){let r=yield e.toBlob((t==null?void 0:t.mimeType)||"");return r?M.fromBlob(r,t):M({})});M.prototype.Filer.prototype=M.prototype;var Me=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 v=d;return y&&!a.is.string(d)&&(v=a.Stringify(d)),n.status(h).end(v)},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},J=Me;J.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};J.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;f.setDefaultHeaders=()=>({});var ve=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
|
package/esm/core.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { KeyValueDict, IFEXIST } from '.';
|
|
2
|
+
import './primitiveExtension';
|
|
3
|
+
declare global {
|
|
4
|
+
interface JminiExtension {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare namespace Jmini {
|
|
8
|
+
type Args = any;
|
|
9
|
+
type ElementableValue = any;
|
|
10
|
+
type ForFunction = {
|
|
11
|
+
(element: HTMLElement, index: number): void;
|
|
12
|
+
};
|
|
13
|
+
namespace Events {
|
|
14
|
+
type CustomEventListener<K extends keyof WindowEventMap> = {
|
|
15
|
+
(this: HTMLElement, event: WindowEventMap[K]): void;
|
|
16
|
+
};
|
|
17
|
+
type EventType = keyof WindowEventMap;
|
|
18
|
+
type AddEventInput<K extends keyof WindowEventMap> = {
|
|
19
|
+
eventType: K;
|
|
20
|
+
eventID?: string;
|
|
21
|
+
target?: string | Chains | HTMLElement;
|
|
22
|
+
callback: CustomEventListener<K>;
|
|
23
|
+
options?: AddEventListenerOptions;
|
|
24
|
+
};
|
|
25
|
+
type RemoveEventInput = string | string[];
|
|
26
|
+
}
|
|
27
|
+
type CreateElementInput = {
|
|
28
|
+
tag?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
id?: string;
|
|
31
|
+
html?: ElementableValue;
|
|
32
|
+
attr?: KeyValueDict;
|
|
33
|
+
parent?: ElementableValue;
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
};
|
|
36
|
+
type Chains = {
|
|
37
|
+
[Symbol.iterator](): void;
|
|
38
|
+
[index: number]: HTMLElement;
|
|
39
|
+
length: number;
|
|
40
|
+
queue: Function[];
|
|
41
|
+
queueProcess: boolean;
|
|
42
|
+
synchronous: boolean;
|
|
43
|
+
warn?: string;
|
|
44
|
+
src?: Args;
|
|
45
|
+
srcType?: string;
|
|
46
|
+
get(v?: number): HTMLElement | HTMLElement[];
|
|
47
|
+
for(v: {
|
|
48
|
+
(element: HTMLElement, index: number): void;
|
|
49
|
+
}, n?: number): any[];
|
|
50
|
+
await(time: number): Chains;
|
|
51
|
+
abort(): Chains;
|
|
52
|
+
callback: {
|
|
53
|
+
(fn: {
|
|
54
|
+
(jmini: Chains): void;
|
|
55
|
+
}): Chains;
|
|
56
|
+
};
|
|
57
|
+
click(): Chains;
|
|
58
|
+
focus(): Chains;
|
|
59
|
+
addEvent<K extends keyof WindowEventMap>(args: Events.AddEventInput<K>): Chains;
|
|
60
|
+
removeEvent(args: Events.RemoveEventInput): Chains;
|
|
61
|
+
html(v: ElementableValue): Chains;
|
|
62
|
+
empty(): Chains;
|
|
63
|
+
append(v: ElementableValue): Chains;
|
|
64
|
+
remove(): Chains;
|
|
65
|
+
before(...v: ElementableValue[]): Chains;
|
|
66
|
+
after(...v: ElementableValue[]): Chains;
|
|
67
|
+
find(v: ElementableValue): Chains;
|
|
68
|
+
parent(v?: string): Chains;
|
|
69
|
+
children(v?: string | 'first' | 'last' | number): Chains;
|
|
70
|
+
addClass(v: string | string[]): Chains;
|
|
71
|
+
removeClass(v: string | string[]): Chains;
|
|
72
|
+
toggleClass(v: string): Chains;
|
|
73
|
+
hasClass(v: string): boolean;
|
|
74
|
+
findClass(v: RegExp): string[];
|
|
75
|
+
css(v: React.CSSProperties): Chains;
|
|
76
|
+
getAttribute(key: string): string;
|
|
77
|
+
setAttribute(key: string, value: string): Chains;
|
|
78
|
+
getStyleProperty(property: string): string;
|
|
79
|
+
setStyleProperty(property: string, value: string): Chains;
|
|
80
|
+
val(): string;
|
|
81
|
+
position(): DOMRect;
|
|
82
|
+
jmini: {
|
|
83
|
+
new (v?: Args): Chains;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
type Methods = {
|
|
87
|
+
expando: string;
|
|
88
|
+
prototype: Chains;
|
|
89
|
+
(v?: Args): Chains;
|
|
90
|
+
extend<T = KeyValueDict>(v: IFEXIST<T>, t?: any): void;
|
|
91
|
+
createElement: (v: CreateElementInput) => HTMLElement;
|
|
92
|
+
setCookie(props: {
|
|
93
|
+
name: string;
|
|
94
|
+
value: string;
|
|
95
|
+
age?: number;
|
|
96
|
+
path?: string;
|
|
97
|
+
domain?: string;
|
|
98
|
+
secure?: boolean;
|
|
99
|
+
}): void;
|
|
100
|
+
getCookie(name: string): string;
|
|
101
|
+
deleteCookie(name: string): void;
|
|
102
|
+
localStrage: {
|
|
103
|
+
set(key: string, value: any): any;
|
|
104
|
+
get<T = any>(key: string): T | null;
|
|
105
|
+
};
|
|
106
|
+
queryParams: {
|
|
107
|
+
get(url?: string): KeyValueDict;
|
|
108
|
+
set(searchParams: {
|
|
109
|
+
[key: string]: string | number;
|
|
110
|
+
}, url?: string): string;
|
|
111
|
+
delete(keys: string[], url?: string): string;
|
|
112
|
+
};
|
|
113
|
+
pending(callback: {
|
|
114
|
+
(resolve: {
|
|
115
|
+
(result: boolean): void;
|
|
116
|
+
}): void;
|
|
117
|
+
}, ms?: number): Promise<boolean>;
|
|
118
|
+
getCursor(event: Event): {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
};
|
|
122
|
+
getScreenSize(): {
|
|
123
|
+
height: number;
|
|
124
|
+
width: number;
|
|
125
|
+
pageHeight: number;
|
|
126
|
+
scrollY: number;
|
|
127
|
+
scrollX: number;
|
|
128
|
+
pageYOffset: number;
|
|
129
|
+
pageXOffset: number;
|
|
130
|
+
safeAreaTop: number;
|
|
131
|
+
safeAreaBottom: number;
|
|
132
|
+
};
|
|
133
|
+
is: {
|
|
134
|
+
equal(a: any, b: any, stringify?: boolean): boolean;
|
|
135
|
+
what(v: any): string;
|
|
136
|
+
exist(v: any): boolean;
|
|
137
|
+
nullish(val: any): boolean;
|
|
138
|
+
jmini(v: any): v is Methods & Chains;
|
|
139
|
+
string(v: any): v is string;
|
|
140
|
+
boolean(v: any): v is boolean;
|
|
141
|
+
number(v: any): v is number;
|
|
142
|
+
array(v: any): v is any[];
|
|
143
|
+
function(v: any): v is Function;
|
|
144
|
+
keyValueDictionary(v: any): v is KeyValueDict;
|
|
145
|
+
element(v: any): v is HTMLElement;
|
|
146
|
+
elements(v: any): v is HTMLElement[];
|
|
147
|
+
shadowRoot(v: any): v is ShadowRoot;
|
|
148
|
+
date(v: any): v is Date;
|
|
149
|
+
};
|
|
150
|
+
ellipsisText(value: string, length: number): string;
|
|
151
|
+
flatArray<T = any>(v: any, regression?: '-R'): T[];
|
|
152
|
+
uniqueArray<T = any>(v: T[], key?: string): T[];
|
|
153
|
+
getKeyValue<T = any>(object: KeyValueDict, keys: string): T;
|
|
154
|
+
deepMerge<T = any>(target: T, ...args: T[]): T;
|
|
155
|
+
deepCopy<T = any>(target: T): T;
|
|
156
|
+
randomNumber(min?: number, max?: number, notIn?: number[]): number;
|
|
157
|
+
Stringify(value: any, replacer?: ((this: any, key: string, value: any) => any) | (number | string)[] | null, space?: string | number): string;
|
|
158
|
+
Objectify<T = any>(value: any, OnError?: any): T;
|
|
159
|
+
try<T = any>(fn: {
|
|
160
|
+
(): T;
|
|
161
|
+
}): [T, boolean];
|
|
162
|
+
trySync<T = any>(fn: {
|
|
163
|
+
(): Promise<T>;
|
|
164
|
+
}): Promise<[T, boolean]>;
|
|
165
|
+
scope<T = any>(fn: {
|
|
166
|
+
(): T;
|
|
167
|
+
}): T;
|
|
168
|
+
scopeSync<T = any>(fn: {
|
|
169
|
+
(): Promise<T>;
|
|
170
|
+
}): Promise<T>;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
declare const Jmini: Jmini.Methods & JminiExtension;
|
|
174
|
+
export { Jmini, Jmini as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface JminiExtension {
|
|
3
|
+
formatCharacter: {
|
|
4
|
+
postal: {
|
|
5
|
+
JP(params: string): string;
|
|
6
|
+
};
|
|
7
|
+
tel: {
|
|
8
|
+
_(params: string): string;
|
|
9
|
+
mobile(params: string): string;
|
|
10
|
+
fixed(params: string): string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
transformer: {
|
|
14
|
+
weekday: {
|
|
15
|
+
ENG(params: number): string;
|
|
16
|
+
JP(params: number): string;
|
|
17
|
+
shortJP(params: number): string;
|
|
18
|
+
};
|
|
19
|
+
wareki(value: number): {
|
|
20
|
+
era: string[];
|
|
21
|
+
value: string[];
|
|
22
|
+
gap: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
ImageLoader: {
|
|
26
|
+
(dataUrl: string, img?: HTMLImageElement): Promise<HTMLImageElement>;
|
|
27
|
+
};
|
|
28
|
+
copyToClipboard(data: any): Promise<{
|
|
29
|
+
ok: boolean;
|
|
30
|
+
body: any;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export type FileReadAsType = 'dataURL' | 'arrayBuffer' | 'binaryString' | 'text';
|
package/esm/fetcher.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { KeyValueDict } from 'src';
|
|
2
|
+
declare namespace Fetcher {
|
|
3
|
+
type urlInput = string | URL | globalThis.Request;
|
|
4
|
+
type Input = Omit<RequestInit, 'body'> & {
|
|
5
|
+
key?: string;
|
|
6
|
+
body?: any;
|
|
7
|
+
bodyStringify?: boolean;
|
|
8
|
+
queries?: Record<string, string | number>;
|
|
9
|
+
response_format?: 'text' | 'json' | 'formData' | 'blob' | 'arrayBuffer' | 'stream' | 'none';
|
|
10
|
+
preventMultiRequest?: boolean;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
trafficControl?: number;
|
|
13
|
+
};
|
|
14
|
+
type Output<R = any, E = any, A = any> = {
|
|
15
|
+
isCancelled: boolean;
|
|
16
|
+
isAborted: boolean;
|
|
17
|
+
statusText: string;
|
|
18
|
+
requestTime: number;
|
|
19
|
+
rawData: Response;
|
|
20
|
+
additionalBody?: KeyValueDict<A>;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
} & ({
|
|
23
|
+
status: 200;
|
|
24
|
+
ok: true;
|
|
25
|
+
body: R;
|
|
26
|
+
} | {
|
|
27
|
+
status: number;
|
|
28
|
+
ok: false;
|
|
29
|
+
body: E;
|
|
30
|
+
});
|
|
31
|
+
namespace onStream {
|
|
32
|
+
type ProcessArgs = {
|
|
33
|
+
response: Output<any>;
|
|
34
|
+
errorCB: (...params: any) => void;
|
|
35
|
+
streamCB: (...params: any) => void;
|
|
36
|
+
reader: ReadableStreamDefaultReader<Uint8Array>;
|
|
37
|
+
decoder: TextDecoder;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
type SystemMethods = {
|
|
41
|
+
onStreamProcess(params: onStream.ProcessArgs): void;
|
|
42
|
+
onStartCB?(params: Input, abort: Function): Promise<void>;
|
|
43
|
+
onKeyDuplicateCB?(retry: Function): Promise<void>;
|
|
44
|
+
onStreamCB?(data: any, done: boolean): void;
|
|
45
|
+
onResultCB?(result: Output<any>, params: Input): void;
|
|
46
|
+
onCompleteCB?(result: any): void;
|
|
47
|
+
onRetryCB?(result: any, current_params: Input, _this: Chains): Promise<Input | null>;
|
|
48
|
+
extraBody?: KeyValueDict;
|
|
49
|
+
isRetry: boolean;
|
|
50
|
+
onErrorCB(error: any): void;
|
|
51
|
+
Fetcher: {
|
|
52
|
+
new <R = any, E = any, A = any>(url: urlInput, v?: Input): Chains<R, E, A>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type Chains<R = any, E = any, A = any> = {
|
|
56
|
+
params: Input;
|
|
57
|
+
url: urlInput;
|
|
58
|
+
method: string;
|
|
59
|
+
abortController: AbortController | null;
|
|
60
|
+
streamStatus: 'open' | 'abort' | 'closed';
|
|
61
|
+
get<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
62
|
+
head<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
63
|
+
post<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
64
|
+
put<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
65
|
+
delete<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
66
|
+
patch<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
67
|
+
options<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
68
|
+
setExtraBody(body: KeyValueDict): Chains<R, E, A>;
|
|
69
|
+
send<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E>>;
|
|
70
|
+
abortStream(): void;
|
|
71
|
+
onKeyDuplicate(cb: (retry: Function) => Promise<void>): Chains<R, E, A>;
|
|
72
|
+
onStart(cb: (params: Input, abort: Function) => Promise<void>): Chains<R, E, A>;
|
|
73
|
+
onStream<T = any>(callback: (data: T, done: boolean) => void, options?: {
|
|
74
|
+
decoder?: TextDecoder;
|
|
75
|
+
}): Chains<R, E, A>;
|
|
76
|
+
onResult<_R = R, _E = E, _A = A>(cb: (result: Output<_R, _E, _A>, params: Input) => void): Chains<_R, _E, _A>;
|
|
77
|
+
onComplete<_R = R, _E = E, _A = A>(cb: (result: _R) => void): Chains<_R, _E, _A>;
|
|
78
|
+
onRetry<_R = R, _E = E, _A = A>(cb: (result: _E, current_params: Input, _this: Chains<_R, _E, _A>) => Promise<Input | null>): Chains<_R, _E, _A>;
|
|
79
|
+
onError<_R = R, _E = E, _A = A>(cb: (error: _E) => void): Chains<_R, _E, _A>;
|
|
80
|
+
};
|
|
81
|
+
type Property = SystemMethods & Chains;
|
|
82
|
+
type Methods = {
|
|
83
|
+
prototype: Property;
|
|
84
|
+
<R = any, E = any, A = any>(url: urlInput, v?: Input): Chains<R, E, A>;
|
|
85
|
+
waitList: string[];
|
|
86
|
+
abort(key: string): void;
|
|
87
|
+
setDefaultTrafficControl: number;
|
|
88
|
+
setDefaultTimeout: number;
|
|
89
|
+
setDefaultHeaders?: () => HeadersInit;
|
|
90
|
+
setDefaultOnStart?: (params: Input, abort: Function) => void;
|
|
91
|
+
setDefaultOnEnd?: (result: Output<any>, params: Input) => void;
|
|
92
|
+
isReadableStream(v: any): boolean;
|
|
93
|
+
isReadableStreamReader(v: any): boolean;
|
|
94
|
+
streamToContext(streamData: ReadableStream<Uint8Array>, options?: {
|
|
95
|
+
reader?: ReadableStreamDefaultReader<Uint8Array>;
|
|
96
|
+
decoder?: TextDecoder;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
ok: boolean;
|
|
99
|
+
done: boolean;
|
|
100
|
+
data: any;
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
declare const Fetcher: Fetcher.Methods;
|
|
105
|
+
export { Fetcher, Fetcher as default };
|
package/esm/fetcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h,c as O,d as F,e as f,f as k,g as q,h as L}from"./chunk-ABA72NWU.js";import m from"./core";import{UUID as U}from"./uuid";import{useStore as
|
|
1
|
+
import{b as h,c as O,d as F,e as f,f as k,g as q,h as L}from"./chunk-ABA72NWU.js";import m from"./core";import{UUID as U}from"./uuid";import{useStore as g}from"./useStore";const j=(t,r)=>new e.prototype.Fetcher(t,r),e=j;e.prototype={},e.waitList=[],e.setDefaultTrafficControl=0,e.setDefaultTimeout=1e3*60*10,e.abort=t=>{let r="fetcher.abortController."+t,o=g.get(r);console.log(o),o&&o.abort()},e.isReadableStream=t=>t instanceof ReadableStream,e.isReadableStreamReader=t=>t instanceof ReadableStreamDefaultReader,e.streamToContext=(t,r)=>f(void 0,null,function*(){try{const o=(r==null?void 0:r.reader)||t.getReader();if(!e.isReadableStreamReader(o))return{ok:!1,done:!0,data:null};if(!o)return{ok:!1,done:!0,data:null};const i=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let s=yield o.read();return{ok:!0,done:s.done,data:i.decode(s.value)}}catch(o){return{ok:!1,done:!0,data:o}}});const H=function(t,r){var s;r=r||{};let o=r.body;r.body&&!m.is.string(r.body)&&((s=r.bodyStringify)==null||s)&&(o=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=O(h({key:U(),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:o}),this};m.extend({Fetcher:H,params:{},url:"",method:"GET",streamStatus:"closed",onStartCB:void 0,onKeyDuplicateCB:void 0,onCompleteCB:void 0,onRetryCB:void 0,isRetry:!1,extraBody:{},abortController:null,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 f(this,null,function*(){let{response:r,errorCB:o,streamCB:i,reader:s,decoder:E}=t,A=r.body,R=this;const C=function(){return q(this,null,function*(){if(!r.ok){m.scope(()=>f(this,null,function*(){let{ok:y,done:n,data:l}=yield e.streamToContext(A,{reader:s,decoder:E});y&&o(l)}));return}let u=!1;for(;!u;){let{ok:y,done:n,data:l}=yield new k(e.streamToContext(A,{reader:s,decoder:E}));R.streamStatus=="abort"?(R.streamStatus="closed",s.cancel(),n=!0):R.streamStatus=="closed"&&(n=!0),n&&(u=n,s.releaseLock()),i(l,n)}})};try{for(var _=L(C()),K,b,B;K=!(b=yield _.next()).done;K=!1){let u=b.value;;}}catch(b){B=[b]}finally{try{K&&(b=_.return)&&(yield b.call(_))}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 f(this,null,function*(){var I;let t=this.params,r=performance.now(),v=t,{key:o,response_format:i,trafficControl:s,preventMultiRequest:E,timeout:A,queries:R}=v,C=F(v,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);C.method=this.method;let _=[this.method,o].join("."),K=e.waitList.includes(_);e.waitList=[...e.waitList,_];let b=!1,B=!1,u=!1,y=0,n=500,l="InternalServerError",S={},D=null,p=new AbortController,M=setTimeout(()=>{p.abort(),console.log("timeout",A)},t.timeout);C.signal=p.signal,this.abortController=p;let P="fetcher.abortController."+this.params.key;g.set({[P]:p});const T=()=>{b=!0},x=()=>(p.abort(),e.waitList=e.waitList.filter(a=>a!=_),{isCancelled:b,isAborted:B,ok:!1,status:0,statusText:"CANCELLED",body:S,requestTime:0,rawData:null});try{if(e.setDefaultOnStart&&(yield e.setDefaultOnStart(t,T)),this.onStartCB&&(yield this.onStartCB(t,T)),b)return x();if(K){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(T)),b)return x();if(E)throw n=429,new Error("TooManyRequests")}let a=m.queryParams.set(h({},R),String(this.url));const w=yield fetch(a,C).then(c=>f(this,null,function*(){return u=c.ok,n=c.status,l=c.statusText,D=c,i=="none"||i=="stream"?c:c[i]()})).catch(c=>{throw new Error(c)});g.delete(P),S=w}catch(a){n==200&&(n=500,u=!1),n==429&&(l="TooManyRequests"),p.signal.aborted&&(n=408,l="Timeout",B=!0),n==500&&(l=String(a)||l),S={errorCode:String(a)}}finally{clearTimeout(M),y=performance.now()-r}let d={isCancelled:b,isAborted:B,ok:u,status:n,statusText:l,body:S,additionalBody:this.extraBody,requestTime:y,rawData:D};if(!u){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let a=yield this.onRetryCB(d.body,this.params,this);if(a)return e.waitList=e.waitList.filter(w=>w!=_),this.params=a,this.send()}this.onErrorCB&&this.onErrorCB(d.body)}if(u&&this.onStreamCB&&t.response_format=="stream"){let a=(I=D.body)==null?void 0:I.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:d,reader:a,decoder:new TextDecoder("utf-8")})}if(t.trafficControl){let a=t.trafficControl-Math.round(y);a>0&&(yield m.pending(()=>{},a),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(a=>a!=_),d})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.Fetcher.prototype=e.prototype;export{e as Fetcher,e as default};
|
package/esm/filer.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare namespace Filer {
|
|
2
|
+
type FileType = 'dataURL' | 'blob' | 'arrayBuffer' | 'objectURL';
|
|
3
|
+
type Options = {
|
|
4
|
+
fileName?: string;
|
|
5
|
+
extension?: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
};
|
|
8
|
+
type SystemMethods = {
|
|
9
|
+
Filer: {
|
|
10
|
+
new (v: any): any;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
type Chains = {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
extension: string;
|
|
16
|
+
type: string;
|
|
17
|
+
file: File;
|
|
18
|
+
fileName: string;
|
|
19
|
+
toBlob(): Promise<Blob>;
|
|
20
|
+
toDataURL(): Promise<string>;
|
|
21
|
+
toAarrayBuffer(): Promise<ArrayBuffer>;
|
|
22
|
+
toObjectURL(): Promise<string>;
|
|
23
|
+
isValid(): boolean;
|
|
24
|
+
updateFileName(fileName: string): void;
|
|
25
|
+
updateMimeType(mimeType: string): void;
|
|
26
|
+
updateExtension(extension: string): void;
|
|
27
|
+
};
|
|
28
|
+
type Property = SystemMethods & Chains;
|
|
29
|
+
type Methods = {
|
|
30
|
+
prototype: Property;
|
|
31
|
+
(v: any): Chains;
|
|
32
|
+
fromFile(file: File): Promise<Chains>;
|
|
33
|
+
fromBlob(file: Blob, options?: Options): Promise<Chains>;
|
|
34
|
+
fromDataURL(dataURL: string, options?: Options): Promise<Chains>;
|
|
35
|
+
fromArrayBuffer(arrayBuffer: ArrayBuffer, options?: Options): Promise<Chains>;
|
|
36
|
+
fromObjectURL(objectURL: string, options?: Options): Promise<Chains>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
declare const Filer: Filer.Methods;
|
|
40
|
+
export { Filer, Filer as default };
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type IFEXIST<T = any> = T extends infer V ? V : any;
|
|
2
|
+
export interface KeyValueDict<T = any> {
|
|
3
|
+
[key: string]: T | void;
|
|
4
|
+
}
|
|
5
|
+
import './primitiveExtension';
|
|
6
|
+
import Jmini from './core';
|
|
7
|
+
import { UUID } from './uuid';
|
|
8
|
+
import { Time } from './time';
|
|
9
|
+
import { Interval } from './interval';
|
|
10
|
+
import { Fetcher } from './fetcher';
|
|
11
|
+
import { Filer } from './filer';
|
|
12
|
+
import { Server } from './server';
|
|
13
|
+
import { useStore } from './useStore';
|
|
14
|
+
export * from './extension';
|
|
15
|
+
declare global {
|
|
16
|
+
interface JminiExtension {
|
|
17
|
+
interval: Interval.Methods;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { Time, Fetcher, Filer, Server, useStore, UUID };
|
|
21
|
+
export default Jmini;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare namespace Interval {
|
|
2
|
+
type InputArray = [Function, number, string | void];
|
|
3
|
+
type Input = {
|
|
4
|
+
fn: Function;
|
|
5
|
+
ms: number;
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
8
|
+
type SystemMethods = {
|
|
9
|
+
Interval: {
|
|
10
|
+
new (...args: InputArray): Chains;
|
|
11
|
+
};
|
|
12
|
+
store(): void;
|
|
13
|
+
setState(p: Partial<Columns>): void;
|
|
14
|
+
};
|
|
15
|
+
type Columns = {
|
|
16
|
+
key: string;
|
|
17
|
+
ms: number;
|
|
18
|
+
isFinished: boolean;
|
|
19
|
+
timeoutIndex: number;
|
|
20
|
+
fn: Function | null;
|
|
21
|
+
};
|
|
22
|
+
type Chains = Columns & {
|
|
23
|
+
once(): Chains;
|
|
24
|
+
start(): Chains;
|
|
25
|
+
abort(): Chains;
|
|
26
|
+
};
|
|
27
|
+
type Property = SystemMethods & Chains;
|
|
28
|
+
type Methods = {
|
|
29
|
+
prototype: Property;
|
|
30
|
+
(...args: InputArray): Chains;
|
|
31
|
+
once(...args: InputArray): Chains;
|
|
32
|
+
start(...args: InputArray): Chains;
|
|
33
|
+
series(key: string, ms?: number): Promise<Function | null>;
|
|
34
|
+
abort(key: number | string): void;
|
|
35
|
+
get(key: string): Chains | undefined;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
declare const Interval: Interval.Methods;
|
|
39
|
+
export { Interval, Interval as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
import { KeyValueDict } from '.';
|
|
3
|
+
import { FileReadAsType } from '.';
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElement {
|
|
6
|
+
[index: string]: any;
|
|
7
|
+
style: {
|
|
8
|
+
[index: string]: string;
|
|
9
|
+
};
|
|
10
|
+
position(): DOMRect;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface String {
|
|
15
|
+
compress(): string;
|
|
16
|
+
encode(): string;
|
|
17
|
+
decode(): string;
|
|
18
|
+
toLower(): string;
|
|
19
|
+
toUpper(): string;
|
|
20
|
+
toCapital(): string;
|
|
21
|
+
clip(from: number, to?: number): string;
|
|
22
|
+
partReplace(begin: number, string: string): string;
|
|
23
|
+
toBlob(mimeType: any): Blob | false;
|
|
24
|
+
toNumber(): number;
|
|
25
|
+
removeLetters(): string;
|
|
26
|
+
removeSpecifics(): string;
|
|
27
|
+
removeJP(): string;
|
|
28
|
+
zen2hanNumber(): string;
|
|
29
|
+
escapeRegExChar(): string;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
declare global {
|
|
33
|
+
interface Number {
|
|
34
|
+
zeroEmbed(digit: number): string;
|
|
35
|
+
ratio(base: number, floatings?: number): number;
|
|
36
|
+
rate(base: number, floatings?: number): number;
|
|
37
|
+
rank(floatings?: number): string;
|
|
38
|
+
rankJp(): string;
|
|
39
|
+
toDate(separate?: string): string;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
declare global {
|
|
43
|
+
interface Array<T = KeyValueDict> {
|
|
44
|
+
toASC(...args: (keyof T)[]): Array<T>;
|
|
45
|
+
toDESC(...args: (keyof T)[]): Array<T>;
|
|
46
|
+
getSum(...args: (keyof T)[]): number;
|
|
47
|
+
getAve(...args: (keyof T)[]): number;
|
|
48
|
+
getMedian(...args: (keyof T)[]): number;
|
|
49
|
+
getMin(...args: (keyof T)[]): number;
|
|
50
|
+
getMax(...args: (keyof T)[]): number;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
declare global {
|
|
54
|
+
interface File {
|
|
55
|
+
convert(readAs?: FileReadAsType): Promise<ProgressEvent<FileReader>>;
|
|
56
|
+
}
|
|
57
|
+
}
|
package/esm/server.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
declare namespace Server {
|
|
3
|
+
interface Request extends express.Request {
|
|
4
|
+
}
|
|
5
|
+
interface Response extends express.Response {
|
|
6
|
+
return(p?: ReturnInput): Response;
|
|
7
|
+
}
|
|
8
|
+
type Path = string | RegExp;
|
|
9
|
+
type Callback<A = Request, B = Response> = (req: A, res: B, next: express.NextFunction, error: Error) => void;
|
|
10
|
+
type RestArgs<A = Request, B = Response> = [path: Path, ...fns: Callback<A, B>[]];
|
|
11
|
+
type SetInput = [string, any];
|
|
12
|
+
type UseInput<A = Request, B = Response> = [Path] | [Path, any] | RestArgs<A, B> | [Callback<A, B>];
|
|
13
|
+
type ReturnInput<T = any> = {
|
|
14
|
+
status?: number;
|
|
15
|
+
ok?: boolean;
|
|
16
|
+
body?: T;
|
|
17
|
+
bodyStringify?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type PathRouterOmits = 'onPathRouter' | 'pathRouter' | 'exception';
|
|
20
|
+
type CustomExpress = Omit<express.Express, keyof RestMethods>;
|
|
21
|
+
type RestMethods<A = Request, B = Response> = {
|
|
22
|
+
set(...args: SetInput): InstanceMethods<A, B>;
|
|
23
|
+
use(...args: UseInput<A, B>): InstanceMethods<A, B>;
|
|
24
|
+
get(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
25
|
+
post(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
26
|
+
put(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
27
|
+
patch(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
28
|
+
delete(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
29
|
+
options(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
30
|
+
all(...args: RestArgs<A, B>): InstanceMethods<A, B>;
|
|
31
|
+
};
|
|
32
|
+
type InstanceMethods<A = Request, B = Response> = CustomExpress & RestMethods<A, B> & {
|
|
33
|
+
onPathRouter(getRouter: (path: string) => express.Router): InstanceMethods<A, B>;
|
|
34
|
+
pathRouter(path: string): Omit<RestMethods<A, B>, PathRouterOmits>;
|
|
35
|
+
exception(fn: (err: any, req: A, res: B, next: express.NextFunction) => void): InstanceMethods<A, B>;
|
|
36
|
+
};
|
|
37
|
+
namespace Methods {
|
|
38
|
+
type FN = {
|
|
39
|
+
<A = Request, B = Response>(express: express.Express): InstanceMethods<A, B>;
|
|
40
|
+
};
|
|
41
|
+
type SubMethods = {
|
|
42
|
+
getLocalIP(os: any): string;
|
|
43
|
+
getIP(req: any): string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
type Methods = Methods.FN & Methods.SubMethods;
|
|
47
|
+
}
|
|
48
|
+
declare const Server: Server.Methods;
|
|
49
|
+
export { Server, Server as default };
|
package/esm/time.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
declare namespace Time {
|
|
2
|
+
type Input = any;
|
|
3
|
+
type DateTrimTypes = 'Y' | 'M' | 'W' | 'D' | 'H' | 'I' | 'S';
|
|
4
|
+
type SystemMethods = {
|
|
5
|
+
Time: {
|
|
6
|
+
new (v: Input): Chains;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type Chains = {
|
|
10
|
+
value: Date;
|
|
11
|
+
validate: boolean;
|
|
12
|
+
ms: number;
|
|
13
|
+
weekday: number;
|
|
14
|
+
weekInMonth: number;
|
|
15
|
+
weekInYear: number;
|
|
16
|
+
isLastWeekInMonth: boolean;
|
|
17
|
+
year: number;
|
|
18
|
+
month: number;
|
|
19
|
+
date: number;
|
|
20
|
+
hours: number;
|
|
21
|
+
minutes: number;
|
|
22
|
+
seconds: number;
|
|
23
|
+
clone(): Chains;
|
|
24
|
+
set(date: Date): Chains;
|
|
25
|
+
isPast(): boolean;
|
|
26
|
+
isSameYear(v: any): boolean;
|
|
27
|
+
isSameMonth(v: any): boolean;
|
|
28
|
+
isSameWeek(v: any): boolean;
|
|
29
|
+
isSameDate(v: any): boolean;
|
|
30
|
+
setYear(v: number): Chains;
|
|
31
|
+
setMonth(v: number): Chains;
|
|
32
|
+
setDate(v: number): Chains;
|
|
33
|
+
setHours(v: number): Chains;
|
|
34
|
+
setMinutes(v: number): Chains;
|
|
35
|
+
setSeconds(v: number): Chains;
|
|
36
|
+
setMilliseconds(v: number): Chains;
|
|
37
|
+
addYear(v: number): Chains;
|
|
38
|
+
addMonth(v: number): Chains;
|
|
39
|
+
addWeek(v: number): Chains;
|
|
40
|
+
addDate(v: number): Chains;
|
|
41
|
+
addHours(v: number): Chains;
|
|
42
|
+
addMinutes(v: number): Chains;
|
|
43
|
+
addSeconds(v: number): Chains;
|
|
44
|
+
toFormat(format: string): string;
|
|
45
|
+
toFormatYMD(lang?: 'JP'): string;
|
|
46
|
+
toFormatYM(lang?: 'JP'): string;
|
|
47
|
+
toFormatMD(lang?: 'JP'): string;
|
|
48
|
+
toFormatHM(lang?: 'JP'): string;
|
|
49
|
+
toFormatYMDHM(lang?: 'JP'): string;
|
|
50
|
+
toFormatYMDHMS(lang?: 'JP'): string;
|
|
51
|
+
toLangYMD(lang?: 'JP'): string;
|
|
52
|
+
setFirstOfTheDay(): Chains;
|
|
53
|
+
setLastOfTheDay(): Chains;
|
|
54
|
+
setFromFormatHHMM(v: string | number): Chains;
|
|
55
|
+
setFromFormatHHMMSS(v: string | number): Chains;
|
|
56
|
+
getFirstDayOfTheYear(): Chains;
|
|
57
|
+
getLastDayOfTheYear(): Chains;
|
|
58
|
+
getFirstDayOfTheMonth(): Chains;
|
|
59
|
+
getLastDayOfTheMonth(): Chains;
|
|
60
|
+
getFirstDayOfTheWeek(): Chains;
|
|
61
|
+
getLastDayOfTheWeek(): Chains;
|
|
62
|
+
diff(v: Chains): {
|
|
63
|
+
years: number;
|
|
64
|
+
months: number;
|
|
65
|
+
dates: number;
|
|
66
|
+
hours: number;
|
|
67
|
+
minutes: number;
|
|
68
|
+
seconds: number;
|
|
69
|
+
ms: number;
|
|
70
|
+
};
|
|
71
|
+
getAge(date?: Time.Chains): number;
|
|
72
|
+
};
|
|
73
|
+
type Property = SystemMethods & Chains;
|
|
74
|
+
type Methods = {
|
|
75
|
+
prototype: Property;
|
|
76
|
+
(v?: Time.Input): Chains;
|
|
77
|
+
isTimeObject(v: any): boolean;
|
|
78
|
+
getFromNumberYYYYMMDD(v: number): Time.Chains;
|
|
79
|
+
getShortYMDs(startAt: Chains, endAt: Chains): [string, string];
|
|
80
|
+
getPeriodArray(type: 'seconds' | 'minutes' | 'hours' | 'day' | 'week' | 'month' | 'year', from: Time.Chains, to: Time.Chains): Time.Chains[];
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
declare const Time: Time.Methods;
|
|
84
|
+
export { Time, Time as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KeyValueDict } from '.';
|
|
2
|
+
declare namespace useStore {
|
|
3
|
+
type Methods = {
|
|
4
|
+
set(p: KeyValueDict, privateKey?: string): boolean;
|
|
5
|
+
update(p: KeyValueDict, privateKey?: string): boolean;
|
|
6
|
+
get<T = any>(key: string, privateKey?: string): T | undefined;
|
|
7
|
+
delete(key: string, privateKey?: string): boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare const useStore: useStore.Methods;
|
|
11
|
+
export { useStore, useStore as default };
|
package/esm/uuid.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare namespace UUID {
|
|
2
|
+
namespace Methods {
|
|
3
|
+
type FN = (length?: number) => string;
|
|
4
|
+
type Chains = {
|
|
5
|
+
gen128Binary(): string;
|
|
6
|
+
gen32Hex(type?: 'Formatted' | 'None', separate?: string): string;
|
|
7
|
+
to32Format(v: string, separate?: string): string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
type Methods = Methods.FN & Methods.Chains;
|
|
11
|
+
}
|
|
12
|
+
declare const UUID: UUID.Methods;
|
|
13
|
+
export { UUID, UUID as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jmini",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"description": "minified JavaScript Framework",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -47,5 +47,8 @@
|
|
|
47
47
|
"ts-node": "^10.9.2",
|
|
48
48
|
"ts-node-dev": "^2.0.0",
|
|
49
49
|
"typescript": "^5.5.4"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"jmini": "^0.0.63"
|
|
50
53
|
}
|
|
51
54
|
}
|