jmini 0.0.111 → 0.0.112
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 +30 -10
- package/esm/core.js +1 -1
- package/esm/extension.js +1 -1
- package/esm/fetcher.d.ts +5 -5
- package/esm/fetcher.js +1 -1
- package/esm/index.d.ts +6 -0
- package/esm/index.js +1 -1
- package/esm/interval.js +1 -1
- package/esm/primitiveExtension.d.ts +2 -2
- package/esm/primitiveExtension.js +1 -1
- package/esm/server.js +1 -1
- package/esm/time.js +1 -1
- package/esm/useStore.d.ts +3 -3
- package/esm/useStore.js +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty,ne=Object.defineProperties,ie=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var j=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var L=Math.pow,X=(e,t,r)=>t in e?B(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(_)for(var r of _(t))G.call(t,r)&&X(e,r,t[r]);return e},N=(e,t)=>ne(e,se(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&&_)for(var i of _(e))t.indexOf(i)<0&&G.call(e,i)&&(r[i]=e[i]);return r};var oe=(e,t)=>{for(var r in t)B(e,r,{get:t[r],enumerable:!0})},le=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ae(t))!V.call(e,n)&&n!==r&&B(e,n,{get:()=>t[n],enumerable:!(i=ie(t,n))||i.enumerable});return e};var ue=e=>le(B({},"__esModule",{value:!0}),e);var p=(e,t,r)=>new Promise((i,n)=>{var s=u=>{try{l(r.next(u))}catch(h){n(h)}},o=u=>{try{l(r.throw(u))}catch(h){n(h)}},l=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);l((r=r.apply(e,t)).next())}),U=function(e,t){this[0]=e,this[1]=t},Z=(e,t,r)=>{var i=(o,l,u,h)=>{try{var d=r[o](l),g=(l=d.value)instanceof U,M=d.done;Promise.resolve(g?l[0]:l).then(f=>g?i(o==="return"?o:"next",l[1]?{done:f.done,value:f.value}:f,u,h):u({value:f,done:M})).catch(f=>i("throw",f,u,h))}catch(f){h(f)}},n=o=>s[o]=l=>new Promise((u,h)=>i(o,l,u,h)),s={};return r=r.apply(e,t),s[j("asyncIterator")]=()=>s,n("next"),n("throw"),n("return"),s};var ee=(e,t,r)=>(t=e[j("asyncIterator")])?t.call(e):(e=e[j("iterator")](),t={},r=(i,n)=>(n=e[i])&&(t[i]=s=>new Promise((o,l,u)=>(s=n.call(e,s),u=s.done,Promise.resolve(s.value).then(h=>o({value:h,done:u}),l)))),r("next"),r("return"),t);var De={};oe(De,{Fetcher:()=>c,Filer:()=>T,Server:()=>J,Time:()=>m,UUID:()=>w,default:()=>Te,useStore:()=>v});module.exports=ue(De);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){let t="";if(e.length==2){let[r,i]=e;t=[this.slice(0,r),i,this.slice(r+i.length)].join("")}if(e.length==3){let[r,i,n]=e;t=[this.slice(0,r),n,this.slice(r+i)].join("")}return t},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(){let e=this.replace(/[^\d.-]/g,"").replace(/(-)(?=.*\d)/g,"").replace(/(\d+)\.(\d+)\.(\d+)/g,"$1.$2$3");return Number(e)||0},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){let t=Number(this)<0,r=Math.abs(Number(this));return isNaN(r)?"":(t?"-":"")+String(r).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=L(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=L(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=L(10,e),r=Number(this);if(r<1e3)return String(this);let i=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/L(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=(r,...i)=>{var s;let n=r;for(let o of i){if(o!==(o!=null?o:!o))break;n=(s=(n||{})[o!=null?o:""])!=null?s:null}return n},t=r=>typeof r=="number"&&!isNaN(r);Array.prototype.toASC=function(r,i,n){let s=[];Array.isArray(r)?s.push(...r):r&&(s=[r]),s.length||(s=[""]);let o=[],l=[];for(let u of s){let h=String(u).match(/([^\.\[\]"]+)/g)||"";o.push(h),l.push(this.every(d=>t(Number(e(d,...h)))))}return this.sort((u,h)=>{for(let d=0;d<o.length;d++){let g=o[d]||"",M=l[d],f=e(u,...g),y=e(h,...g);if(M){if(Number(f)>Number(y))return 1;if(Number(f)<Number(y))return-1;continue}if(t(f)&&!t(y))return-1;if(!t(f)&&t(y))return 1;let b=String(f).replace(/(\d+),(\d+)/g,"$1$2").replace(/(\d+)/g,O=>O.padStart(10,"0")),E=String(y).replace(/(\d+),(\d+)/g,"$1$2").replace(/(\d+)/g,O=>O.padStart(10,"0")),I=b.localeCompare(E,i,n);if(I!=0)return I}return 0})},Array.prototype.toDESC=function(...r){return this.toASC(...r).reverse()},Array.prototype.getSum=function(...r){return this.reduce((i,n)=>i+(r?e(n,...r):Number(n)||0),0)},Array.prototype.getAve=function(...r){return this.getSum(...r)/this.length},Array.prototype.getMedian=function(...r){let i=this.map(s=>r?e(s,...r):Number(s)||0);i.sort((s,o)=>s-o);let n=Math.floor(i.length/2);return i.length%2===0?(i[n-1]+i[n])/2:i[n]},Array.prototype.getMin=function(...r){let i=this.map(n=>r?e(n,...r):Number(n)||0);return Math.min(...i)},Array.prototype.getMax=function(...r){let i=this.map(n=>r?e(n,...r):Number(n)||0);return Math.max(...i)},Array.prototype.chunk=function(r){let i=[];for(let n=0;n<this.length;n+=r)i.push(this.slice(n,n+r));return i},Array.prototype.forEachChunk=function(r,i,n){return p(this,null,function*(){let s=[],o=this.chunk(r);if(n)yield Promise.all(o.map((l,u)=>p(this,null,function*(){s[u]=D({ok:!0},yield i(l,u))})));else for(let l=0;l<o.length;l++)s.push(D({ok:!0},yield i(o[l],l)));return[s.every(l=>l.ok),s]})}}typeof File!="undefined"&&(File.prototype.convert=function(e){e=e||"dataURL";let t="readAs"+(e==null?void 0:e.toCapital());return new Promise((r,i)=>{let n=new FileReader;n.onload=s=>{r(n.result)},n.onerror=s=>i(n.error||s),n[t](this)})},File.prototype.clone=function(){return new File([this.slice(0,this.size,this.type)],this.name,{type:this.type,lastModified:this.lastModified})});var he=(e=24)=>Array.from({length:e}).map((t,r)=>{let i=r==0?25:35,n=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*i)][n?"toUpper":"toLower"]()}).join(""),w=he;w.get128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");w.get32Hex=(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};w.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 me=e=>new a.prototype.jmini(e),a=me;a.prototype={};a.extend=function(e,t=a){for(var[r,i]of Object.entries(e))t.prototype[r]=i};a.expando="__jmini_"+w();a.__classAlias="jmini";var C=(e,t)=>(e.queue.push(t),$(e),e),$=e=>p(void 0,null,function*(){if(e.queueProcess||!e.queue.length)return;e.queueProcess=!0;let t=e.queue.shift();t&&(yield t()),e.queueProcess=!1,$(e)}),F=(e,t)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,i]of Object.entries(t))r.match(/queue/)||(e[r]=i);return e},fe=(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,$(e),e};a.extend({constructor:a,__classAlias:a.__classAlias,jmini:function(e){return this.src=e,this.srcType=a.is.what(e),this.queueProcess=!0,this.queue=[],fe(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 l=[];for(let u=0;u<(n.length||0);u++)l.push(s(n[u],u));return o&&(l=l.filter(u=>u!=null)),l},t=n=>(n.for((s,o)=>{if(!(a.is.element(s)||a.is.shadowRoot(s)))return;let l=s.cloneNode(),u=s.parentNode;u&&u.replaceChild(l,s),n[o]=l}),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 l=0;l<n.length;l++)r(n[l],o)}}),s),i=(n,s,...o)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[s]||{p:"",s:""};return n.for(h=>{if(a.is.string(o[0]))h.insertAdjacentHTML(l,o[0]);else{if(!h.parentNode)return;a(o[0]).for(g=>{o[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[u]||h)})}}),n};a.extend({get:function(n){return n?this[0]:e(this,s=>s)},for:function(n,s=1){let o=e(this,(l,u)=>n(l,u),1);return s?o:[]},await:function(n){return C(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return C(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return C(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return C(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];a.is.element(s)&&s.click()}return this})},focus:function(){return C(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 C(this,()=>{let{eventType:s,eventID:o=w(),target:l,callback:u,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:g}=d[a.expando];if(l){let M=u;u=f=>{if(f.target){if(a.is.string(l)){let b=f.target.closest(l);b&&(!b||M.call(b,f))}else if(a.is.elements(l)){for(let y of l)if(f.target==y)return M.call(y,f)}}}}if(g[o]){let M=g[o];d.removeEventListener(M.eventType,M.callback,M.options)}g[o]={eventType:s,callback:u,options:h},d.addEventListener(s,u,h)}),this})},removeEvent:function(n){return C(this,()=>{let s=a.is.array(n)?n:[n];return this.for(o=>{let{events:l}=o[a.expando];for(let u of s){let h=l[u];h&&o.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(n){return C(this,()=>F(this,r(n,t(this))))},empty:function(){return C(this,()=>F(this,t(this)))},append:function(n){return C(this,()=>{r(n,this)})},remove:function(){return C(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 C(this,()=>F(this,i(this,"before",...n)))},after:function(...n){return C(this,()=>F(this,i(this,"after",...n)))},find:function(n){return C(this,()=>{let s=[],o=this[0];o||F(this,a()),(a.is.element(o)||a.is.shadowRoot(o))&&(a.is.string(n)?s=o.querySelectorAll(n):a.is.element(o)&&a(n).for(l=>{let u=o.childNodes;for(let h of u)if(h===l){s.push(h);break}else h.childNodes.length&&(s=[...s,...a(h).find(l).for(d=>d)])})),F(this,a(s))})},parent:function(n){return C(this,()=>{var o,l;let s=a(n?(o=this[0])==null?void 0:o.closest(n):(l=this[0])==null?void 0:l.parentNode);F(this,s)})},children:function(n){return C(this,()=>{let s=this[0].children;a.is.exist(n)&&(n=String(n).replace(/^ : /,""),s=n=="first"?s[0]:n=="last"?s[s.length-1]:s[Number(n)]);let o=a(s);return F(this,o)})},addClass:function(n){return C(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 C(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 C(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 C(this,()=>(this.for(s=>{if(a.is.element(s))for(let[o,l]of Object.entries(n)){if(a.is.number(l)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){s.style[o]=l+"px";continue}s.style[o]=String(l)}}),this))},getAttribute:function(n){return this[0].getAttribute(String(n))},setAttribute:function(n,s){return C(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.uniqueArray=(e,t)=>t?Array.from(new Map(e.map(r=>[a.getKeyValue(r,t||"0"),r])).values()):Array.from(new Set(e));a.getKeyValue=(e,t)=>{let r={},i=e;return t.split(".").forEach(n=>{i=i==null?void 0:i[n],r=i}),r};a.Arrayify=a.flatArray=(e,t)=>{if(!a.is.array(e))return[e];let r=[];for(let i of e)r.push(...t=="-R"?a.Arrayify(i,"-R"):[i]);return 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.SortifyObject=(e,t)=>{let r={};return!e||!a.is.array(e)&&!a.is.keyValueDictionary(e)?null:(Object.keys(e).sort().forEach(i=>{let n=e[i];if(t){if(a.is.keyValueDictionary(n)){r[i]=a.SortifyObject(n,t);return}if(a.is.array(n)){r[i]=n.map(s=>a.is.keyValueDictionary(s)||a.is.array(s)?a.SortifyObject(s,t):s);return}}r[i]=n}),r)};a.randomNumber=(e=0,t=100,r)=>{if(e>t)return NaN;let i=Math.round(Math.random()*(t-e))+e;return r&&r.length&&r.includes(i)?a.randomNumber(e,t,r):i};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 g;let{tag:t,className:r="",id:i,html:n,attr:s,style:o,parent:l}=e,u=document.createElement(t||"div");if(r&&u.classList.add(...r.split(" ")),i&&(u.id=i),s)for(let M of Object.entries(s)){let f=M[0],y=(g=M[1])!=null?g:"";if(f=="data"&&a.is.keyValueDictionary(y))for(let[b,E]of Object.entries(y))u.dataset[b]=E;else f=="for"?f="htmlFor":f=="tabindex"?f="tabIndex":f=="aria-label"&&(f="ariaLabel"),u[f]=y}if(n&&a(u).append(n),o)for(var[h,d]of Object.entries(o))u.style[h]=d;return l&&a(l).append(u),u};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:l=!1}=e,u=`${r}=${i}max-age=${n}path=${s}domain=${o}`;l&&(u+=" Secure"),document.cookie=u};a.getCookie=e=>{let t=document.cookie.match(new RegExp(e+"=[^]*"));return t?t[0].replace(new RegExp(e+"="),""):""};a.localStorage={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()),l=Number(a(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:t,pageHeight:e-o-l,scrollY:r,scrollX:i,pageXOffset:n,pageYOffset:s,safeAreaTop:o,safeAreaBottom:l}};a.getCursor=e=>{var i,n,s,o,l,u,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=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?h:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:t,y:r}};a.pending=(e,t)=>{var i;let r=(i=t||Number(e))!=null?i:-1;return new Promise((n,s)=>{a.is.function(e)&&e(n),!(r<0)&&setTimeout(()=>{n(!0)},r)})};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.url={path:{get:e=>{let r=new URL(e||location.href).pathname||"";return r=r.replace(/^\//,"").replace(/\/$/,""),r.split("/")},set:(e,t)=>{let r=new URL(t||location.href);if(a.is.string(e))r.pathname=e;else{let i=a.url.path.get();Object.entries(e).forEach(([n,s])=>{i[Number(n)]=s}),r.pathname="/"+i.filter(n=>n!=null).join("/")}return t||history.replaceState({},"",r.pathname+r.search),r.toString()}},search:{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.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){var t,r;return((t=e||{})==null?void 0:t.constructor)===a||((r=e||{})==null?void 0:r.__classAlias)===a.__classAlias},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 Array.isArray(e)||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())},inRange:function(e,t,r,i=!0){return i?t<=e&&e<=r:t<e&&e<r},oneOf:function(e,...t){return t==null?void 0:t.includes(e)}};var x={},v={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{let s=x[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),x[i]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([i,n])=>{var o;let s=x[i]||{};s&&s.privateKey&&s.privateKey!=t&&(r=!1),x[i]=N(D({},x[i]),{value:D(D({},(o=x[i])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=x[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=x[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete x[e],!0)}};var te=-new Date().getTimezoneOffset(),ce=(e,t)=>new m.prototype.Time(e,t),m=ce;m.prototype={};m.__classAlias="jmini.Time";var de=function(e,t){if(t&&(this.localTimezoneOffset=t),m.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0?e=new Date:e===0&&(e=new Date(0))),e&&(a.is.number(e)&&(e=new Date(e)),a.is.string(e)&&(e=String(e).trim().replace(/\//g,"-").replace(/ +|\s+/g," ").replace(/\-+/g,"-"),e=e.replace(/^(\d{4}-\d{2}-\d{2})$/,"$1T00:00:00").replace(/^(\d{4}-\d{2}-\d{2})\s+/,"$1T").replace(/^(\d{4}-\d{2}-\d{2}T\d{2})(:?|:+)$/,"$1:00").replace(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(:?|:+)$/,"$1:00"),e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d{1,3})?$/)))){let i=this.getLocalTimezoneOffset(),n=Math.floor(i/60),s=i%60;n>=0&&(e+="+"),e+=n.zeroEmbed(2),e+=":"+s.zeroEmbed(2)}let r=new Date(String(e));return this.set(r)};a.extend({constructor:m,Time:de,__classAlias:m.__classAlias,value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,warekiYear:-1,wareki:"",warekiLabel:"",year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,localTimezoneOffset:void 0,getLocalTimezoneOffset:function(){var e,t;return(t=(e=this.localTimezoneOffset)!=null?e:v.get("jmini/time/env/localTimezoneOffset"))!=null?t:te},setLocalTimezoneOffset:function(e,t){return this.localTimezoneOffset=e,t&&v.set({"jmini/time/env/localTimezoneOffset":e}),this.set(this.value)},clone:function(){return m(this,this.localTimezoneOffset)},set:function(e){var n;this.value=e;let t=a.is.date(e);if(this.validate=t,a.is.nullish(this.localTimezoneOffset)&&(this.localTimezoneOffset=(n=v.get("jmini/time/env/localTimezoneOffset"))!=null?n:te),!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;let r=e.getTime()+e.getTimezoneOffset()*6e4,i=new Date(r+this.getLocalTimezoneOffset()*60*1e3);this.ms=e.getTime(),this.year=i.getFullYear(),this.month=i.getMonth()+1,this.date=i.getDate(),this.weekday=i.getDay(),this.hours=i.getHours(),this.minutes=i.getMinutes(),this.seconds=i.getSeconds();{let s=this.year||0,o=this.month||0,l=this.date||0,u=Number(s+o.zeroEmbed(2)+l.zeroEmbed(2));u>=20190501?(this.warekiYear=s-2018,this.wareki="REIWA",this.warekiLabel="\u4EE4\u548C"):u>=19890108?(this.warekiYear=s-1988,this.wareki="HEISEI",this.warekiLabel="\u5E73\u6210"):u>=19261225?(this.warekiYear=s-1925,this.wareki="SHOUWA",this.warekiLabel="\u662D\u548C"):u>=19120730?(this.warekiYear=s-1911,this.wareki="TAISHO",this.warekiLabel="\u5927\u6B63"):u>=19680125?(this.warekiYear=s-1867,this.wareki="MEIJI",this.warekiLabel="\u660E\u6CBB"):(this.warekiYear=0,this.wareki="",this.warekiLabel="")}{let s=new Date(this.year,0,1),o=new Date(s.valueOf());o.setDate(o.getDate()-(s.getDay()+1));let l=this.ms-o.getTime(),u=Math.ceil(l/(1e3*60*60*24));this.weekInYear=Math.ceil(u/7)}{let s=new Date(this.year,this.month-1,1),o=new Date(s.valueOf());o.setDate(o.getDate()-(s.getDay()+1));let l=this.ms-o.getTime(),u=Math.ceil(l/(1e3*60*60*24)),h=Math.ceil(u/7);this.weekInMonth=h}{let s=new Date(this.year,this.month,0),o=s.getDay(),l=new Date(new Date(s).setDate(s.getDate()-o));this.isLastWeekInMonth=this.date>=l.getDate()}return 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},isInRange:function(e,t){return!this.validate||!e.validate||!t.validate?!1:this.value>=e.value&&this.value<=t.value},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()),r=t.getDate();t.setDate(1),t.setMonth(e-1);let i=m(t).getLastDayOfMonth();return t.setDate(Math.min(r,i.date)),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,t){if(!this.validate)return"";let r=this;return a.is.exist(t)&&(r=r.clone(),r.setLocalTimezoneOffset(t||0)),e.replace(/\%y/ig,r.year.zeroEmbed(4)).replace(/\%m/ig,r.month.zeroEmbed(2)).replace(/\%d/ig,r.date.zeroEmbed(2)).replace(/\%w/ig,r.weekInYear.zeroEmbed(2)).replace(/\%h/ig,r.hours.zeroEmbed(2)).replace(/\%i/ig,r.minutes.zeroEmbed(2)).replace(/\%s/ig,r.seconds.zeroEmbed(2))},toFormatISO:function(){return this.value.toISOString()},toFormatabbrYMD:function(e,t){if(!this.validate)return"";let r=this.isSameYear(m()),i="%Y/%M/%D";return r&&(i="%M/%D"),e=="JP"&&(i="%Y\u5E74%M\u6708%D\u65E5",r&&(i="%M\u6708%D\u65E5")),this.toFormat(i,t)},toFormatYMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t):""},toFormatYM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708",t):this.toFormat("%Y/%M",t):""},toFormatMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):""},toFormatHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206",t):this.toFormat("%h:%i",t):""},toFormatHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206%s\u79D2",t):this.toFormat("%h:%i:%s",t):""},toFormatYMDHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\u5206",t):this.toFormat("%Y/%M/%D %h:%i",t):""},toFormatYMDHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2",t):this.toFormat("%Y/%M/%D %h:%i:%s",t):""},toLangYMD:function(e,t){if(!this.validate)return"";let r=m(),i=r.diff(this);return i.dates==0?"\u4ECA\u65E5":i.dates==1?"\u6628\u65E5":i.dates>=-7&&i.dates<0?-1*i.dates+"\u65E5\u5F8C":i.dates<=7&&i.dates>0?i.dates+"\u65E5\u524D":this.isSameYear(r)?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t)},setFirstOfDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfDay: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)},getFirstDayOfYear:function(){return m(new Date(this.value.getFullYear(),0,1))},getLastDayOfYear:function(){return m(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfMonth:function(){return m(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfMonth:function(){return m(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfWeek:function(){let e=m(this.value);return e.addDate(-e.weekday)},getLastDayOfWeek: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().setFirstOfDay(),i=e.clone().setFirstOfDay();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,r;return((t=e||{})==null?void 0:t.constructor)===m||((r=e||{})==null?void 0:r.__classAlias)===m.__classAlias};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(e=="year"?n=m(n).setMonth(1).setDate(1).setFirstOfDay():e=="month"?n=m(n).setDate(1):e=="week"?n=m(n).getFirstDayOfWeek():e=="day"?n=m(n).setFirstOfDay():e=="hours"?n=m(n).setMinutes(0).setSeconds(0).setMilliseconds(0):e=="minutes"?n=m(n).setSeconds(0).setMilliseconds(0):e=="seconds"&&(n=m(n).setMilliseconds(0));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 pe=(...[e,t,r])=>new S.prototype.Interval(e,t,r),S=pe;S.prototype={};var ye=function(...[e,t,r]){return this.fn=e,this.ms=t,this.key=r,this.isFinished=!1,S.abort(this.key),this.store(),this};a.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:ye,store:function(){v.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 S.abort(this.timeoutIndex),this},setState:function(e){return Object.entries(e).forEach(([t,r])=>{this.hasOwnProperty(t)&&(this[t]=r)}),this.store(),this}},S);S.abort=e=>{if(a.is.number(e))return clearInterval(e);let t=v.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};S.get=e=>v.get("Interval_"+e);S.once=(e,t,r)=>S(e,t,r).once();S.series=(e,t)=>p(void 0,null,function*(){return new Promise(r=>{let i=S.get(e);if(i&&!i.isFinished)return r(null);let n=()=>{S.abort(e)};r(n),t&&S(n,t,e).once()})});S.start=(e,t,r)=>S(e,t,r).start();S.prototype.Interval.prototype=S.prototype;var ge=(e,t)=>new c.prototype.Fetcher(e,t),c=ge;c.prototype={};c.waitList=[];c.setDefaultTrafficControl=0;c.setDefaultTimeout=1e3*60*10;c.abort=e=>{let t="fetcher.abortController."+e,r=v.get(t);console.log(r),r&&r.abort()};c.toFlatQuery=e=>{let t={};return Object.entries(e).forEach(([r,i])=>{if(a.is.array(i)){t[r]=i.join(",");return}else if(a.is.keyValueDictionary(i)){Object.entries(c.toFlatQuery(i)).forEach(([n,s])=>{t[`${r}.${n}`]=s});return}t[r]=i}),t};c.isReadableStream=e=>e instanceof ReadableStream;c.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;c.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!c.isReadableStreamReader(r))return{ok:!1,done:!0,data:null};if(!r)return{ok:!1,done:!0,data:null};let i=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),n=yield r.read();return{ok:!0,done:n.done,data:i.decode(n.value)}}catch(r){return{ok:!1,done:!0,data:r}}});var be=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:w(),response_format:"json",timeout:c.setDefaultTimeout,trafficControl:c.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:D(D({"Content-Type":"application/json"},c.setDefaultHeaders&&c.setDefaultHeaders()),t.headers),body:r}),this};a.extend({Fetcher:be,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,l=this,u=function(){return Z(this,null,function*(){if(!t.ok){a.scope(()=>p(this,null,function*(){let{ok:y,done:b,data:E}=yield c.streamToContext(o,{reader:n,decoder:s});y&&r(E)}));return}let f=!1;for(;!f;){let{ok:y,done:b,data:E}=yield new U(c.streamToContext(o,{reader:n,decoder:s}));l.streamStatus=="abort"?(l.streamStatus="closed",n.cancel(),b=!0):l.streamStatus=="closed"&&(b=!0),b&&(f=b,n.releaseLock()),i(E,b)}})};try{for(var h=ee(u()),d,g,M;d=!(g=yield h.next()).done;d=!1){let f=g.value;;}}catch(g){M=[g]}finally{try{d&&(g=h.return)&&(yield g.call(h))}finally{if(M)throw M[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return p(this,null,function*(){var W;let e=this.params,t=performance.now(),q=e,{key:r,response_format:i,trafficControl:n=0,preventMultiRequest:s,timeout:o,queries:l}=q,u=Q(q,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);u.method=this.method;let h=[this.method,r].join("."),d=c.waitList.includes(h);c.waitList=[...c.waitList,h];let g=!1,M=!1,f=!1,y=500,b="InternalServerError",E={},I=null,O=null;n>0&&(O=a.pending(n));let P=new AbortController,re=setTimeout(()=>{P.abort(),console.log("timeout",o)},e.timeout);u.signal=P.signal,this.abortController=P;let K="fetcher.abortController."+this.params.key;v.set({[K]:P});let H=()=>{g=!0},z=()=>(P.abort(),c.waitList=c.waitList.filter(R=>R!=h),{isCancelled:g,isAborted:M,ok:!1,status:0,statusText:"CANCELLED",body:E,requestTime:0,rawData:null});try{if(c.setDefaultOnStart&&(yield c.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),g)return z();if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),g)return z();if(s)throw y=429,new Error("TooManyRequests")}let R=a.url.search.set(D({},c.toFlatQuery(l||{})),String(this.url)),Y=yield fetch(R,u).then(k=>p(this,null,function*(){return f=k.ok,y=k.status,b=k.statusText,I=k,i=="none"||i=="stream"?k:k[i]()})).catch(k=>{throw new Error(k)});v.delete(K),E=Y}catch(R){y==200&&(y=500,f=!1),y==429&&(b="TooManyRequests"),P.signal.aborted&&(y=408,b="Timeout",M=!0),y==500&&(b=String(R)||b),E={errorCode:String(R)}}finally{clearTimeout(re)}let A={isCancelled:g,isAborted:M,ok:f,status:y,statusText:b,body:E,additionalBody:this.extraBody,requestTime:performance.now()-t,rawData:I};if(!f){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let R=yield this.onRetryCB(A.body,this.params,this);if(R)return c.waitList=c.waitList.filter(Y=>Y!=h),this.params=R,this.send()}this.onErrorCB&&this.onErrorCB(A.body)}if(f&&this.onStreamCB&&e.response_format=="stream"){let R=(W=I.body)==null?void 0:W.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:A,reader:R,decoder:new TextDecoder("utf-8")})}return yield O,A.requestTime=performance.now()-t,f&&this.onCompleteCB&&this.onCompleteCB(A.body),this.onResultCB&&this.onResultCB(A,e),c.setDefaultOnEnd&&c.setDefaultOnEnd(A,e),c.waitList=c.waitList.filter(R=>R!=h),A})},abortStream:function(){this.streamStatus="abort"}},c);c.prototype.Fetcher.prototype=c.prototype;var Ce=e=>new T.prototype.Filer(e),T=Ce;T.prototype={};var Me=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:Me,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*(){return yield this.file.convert("dataURL")})},toAarrayBuffer:function(){return p(this,null,function*(){return yield this.file.convert("arrayBuffer")})},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}},T);T.fromFile=e=>T(e);T.fromBlob=(e,t)=>{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 T(n)};T.fromArrayBuffer=(e,t)=>T.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t);T.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield c(e,{response_format:"blob"}).get();return r.ok?T.fromBlob(r.body,t):T({})});T.fromDataURL=(e,t)=>{let r=e.toBlob((t==null?void 0:t.mimeType)||"");return r?T.fromBlob(r,t):T({})};T.prototype.Filer.prototype=T.prototype;var Se=function(e){let t=e,r=null;return t.use((i,n,s)=>{let o=n;o.return=l=>{let{ok:u,status:h,body:d={},bodyStringify:g=!0}=l||{};h=h!=null?h:(u!=null?u:!0)&&200||403;let M=d;return g&&!a.is.string(d)&&(M=a.Stringify(d)),n.status(h).end(M)},s()}),t.onPathRouter=function(i){return r=i,this},t.pathRouter=function(i){if(!r)return;let n=r(i);return n.route(i),t.use(i,n),n},t.exception=function(i){return t.use(i),this},t},J=Se;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)=>{let r;return new Promise((i,n)=>{r=t||new Image,r.onload=()=>i(r),r.onerror=s=>n(s),r.crossOrigin="anonymous",r.src=e})};a.formatCharacter={postal:{JP:e=>{let t="";return e=String(e).replace(/\D/ig,""),e.length==7&&(t=e.replace(/^(\d{3})(.*)/,"$1-$2")),t}},tel:{_:e=>{let t=e;return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t},mobile:e=>{let t="";return e=String(e).removeLetters(),e.length==11&&(t=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),t},fixed:e=>{let t="";return e=String(e).removeLetters(),e.length==10&&(t=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),t}}};a.transformer={weekday:{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:l,name:u}=s;if(o<=e&&e<=l){let h=e-o+1;h==1&&(i=!0,h="\u5143"),r.push(u+h+"\u5E74"),t.push(u)}}),{era:t,value:r,gap:i}}};a.interval=S;c.setDefaultHeaders=()=>({});var Te=a;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
|
|
1
|
+
"use strict";var N=Object.defineProperty,ne=Object.defineProperties,se=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var j=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var L=Math.pow,X=(e,t,r)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))U.call(t,r)&&X(e,r,t[r]);if(_)for(var r of _(t))G.call(t,r)&&X(e,r,t[r]);return e},B=(e,t)=>ne(e,ie(t));var Q=(e,t)=>{var r={};for(var s in e)U.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&_)for(var s of _(e))t.indexOf(s)<0&&G.call(e,s)&&(r[s]=e[s]);return r};var oe=(e,t)=>{for(var r in t)N(e,r,{get:t[r],enumerable:!0})},le=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ae(t))!U.call(e,n)&&n!==r&&N(e,n,{get:()=>t[n],enumerable:!(s=se(t,n))||s.enumerable});return e};var ue=e=>le(N({},"__esModule",{value:!0}),e);var p=(e,t,r)=>new Promise((s,n)=>{var a=u=>{try{l(r.next(u))}catch(h){n(h)}},o=u=>{try{l(r.throw(u))}catch(h){n(h)}},l=u=>u.done?s(u.value):Promise.resolve(u.value).then(a,o);l((r=r.apply(e,t)).next())}),$=function(e,t){this[0]=e,this[1]=t},Z=(e,t,r)=>{var s=(o,l,u,h)=>{try{var d=r[o](l),g=(l=d.value)instanceof $,R=d.done;Promise.resolve(g?l[0]:l).then(f=>g?s(o==="return"?o:"next",l[1]?{done:f.done,value:f.value}:f,u,h):u({value:f,done:R})).catch(f=>s("throw",f,u,h))}catch(f){h(f)}},n=o=>a[o]=l=>new Promise((u,h)=>s(o,l,u,h)),a={};return r=r.apply(e,t),a[j("asyncIterator")]=()=>a,n("next"),n("throw"),n("return"),a};var ee=(e,t,r)=>(t=e[j("asyncIterator")])?t.call(e):(e=e[j("iterator")](),t={},r=(s,n)=>(n=e[s])&&(t[s]=a=>new Promise((o,l,u)=>(a=n.call(e,a),u=a.done,Promise.resolve(a.value).then(h=>o({value:h,done:u}),l)))),r("next"),r("return"),t);var Te={};oe(Te,{Fetcher:()=>c,Filer:()=>E,Server:()=>J,Time:()=>m,UUID:()=>x,default:()=>Ee,useStore:()=>M});module.exports=ue(Te);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){let t="";if(e.length==2){let[r,s]=e;t=[this.slice(0,r),s,this.slice(r+s.length)].join("")}if(e.length==3){let[r,s,n]=e;t=[this.slice(0,r),n,this.slice(r+s)].join("")}return t},String.prototype.toBlob=function(e){let t=atob(this.replace(/^.*,/,"")),r=new Uint8Array(t.length);for(var s=0;s<t.length;s++)r[s]=t.charCodeAt(s);try{var n=new Blob([r.buffer],{type:e})}catch(a){return!1}return n},String.prototype.toNumber=function(){let e=this.replace(/[^\d.-]/g,"").replace(/(-)(?=.*\d)/g,"").replace(/(\d+)\.(\d+)\.(\d+)/g,"$1.$2$3");return Number(e)||0},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){let t=Number(this)<0,r=Math.abs(Number(this));return isNaN(r)?"":(t?"-":"")+String(r).padStart(e||2,"0")},Number.prototype.ratio=function(e,t=2){let r=L(10,t);return Math.round(this/e*r*100)/r},Number.prototype.rate=function(e,t=2){let r=L(10,t);return Math.round(this/e*r)/r},Number.prototype.rank=function(e=1){let t=L(10,e),r=Number(this);if(r<1e3)return String(this);let s=r.toLocaleString().replace(/\d/ig,"").length;return Math.round(r/L(1e3,s)*t)/t+("KMGTPEZY"[s-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),s=t.slice(4,6),n=t.slice(6,8),a=[];return r.length!=4||a.push(r),s.length!=2||a.push(s),n.length!=2||a.push(n),a.join(e)});if(typeof Array!="undefined"){let e=(r,...s)=>{var a;let n=r;for(let o of s){if(o!==(o!=null?o:!o))break;n=(a=(n||{})[o!=null?o:""])!=null?a:null}return n},t=r=>typeof r=="number"&&!isNaN(r);Array.prototype.toASC=function(r,s,n){let a=[];Array.isArray(r)?a.push(...r):r&&(a=[r]),a.length||(a=[""]);let o=[],l=[];for(let u of a){let h=String(u).match(/([^\.\[\]"]+)/g)||"";o.push(h),l.push(this.every(d=>t(Number(e(d,...h)))))}return this.sort((u,h)=>{for(let d=0;d<o.length;d++){let g=o[d]||"",R=l[d],f=e(u,...g),y=e(h,...g);if(R){if(Number(f)>Number(y))return 1;if(Number(f)<Number(y))return-1;continue}if(t(f)&&!t(y))return-1;if(!t(f)&&t(y))return 1;let b=String(f).replace(/(\d+),(\d+)/g,"$1$2").replace(/(\d+)/g,O=>O.padStart(10,"0")),w=String(y).replace(/(\d+),(\d+)/g,"$1$2").replace(/(\d+)/g,O=>O.padStart(10,"0")),I=b.localeCompare(w,s,n);if(I!=0)return I}return 0})},Array.prototype.toDESC=function(...r){return this.toASC(...r).reverse()},Array.prototype.getSum=function(...r){return this.reduce((s,n)=>s+(r?e(n,...r):Number(n)||0),0)},Array.prototype.getAve=function(...r){return this.getSum(...r)/this.length},Array.prototype.getMedian=function(...r){let s=this.map(a=>r?e(a,...r):Number(a)||0);s.sort((a,o)=>a-o);let n=Math.floor(s.length/2);return s.length%2===0?(s[n-1]+s[n])/2:s[n]},Array.prototype.getMin=function(...r){let s=this.map(n=>r?e(n,...r):Number(n)||0);return Math.min(...s)},Array.prototype.getMax=function(...r){let s=this.map(n=>r?e(n,...r):Number(n)||0);return Math.max(...s)},Array.prototype.chunk=function(r){let s=[];for(let n=0;n<this.length;n+=r)s.push(this.slice(n,n+r));return s},Array.prototype.forEachChunk=function(r,s,n){return p(this,null,function*(){let a=[],o=this.chunk(r);if(n)yield Promise.all(o.map((l,u)=>p(this,null,function*(){a[u]=T({ok:!0},yield s(l,u))})));else for(let l=0;l<o.length;l++)a.push(T({ok:!0},yield s(o[l],l)));return[a.every(l=>l.ok),a]})}}typeof File!="undefined"&&(File.prototype.convert=function(e){e=e||"dataURL";let t="readAs"+(e==null?void 0:e.toCapital());return new Promise((r,s)=>{let n=new FileReader;n.onload=a=>{r(n.result)},n.onerror=a=>s(n.error||a),n[t](this)})},File.prototype.clone=function(){return new File([this.slice(0,this.size,this.type)],this.name,{type:this.type,lastModified:this.lastModified})});var he=(e=24)=>Array.from({length:e}).map((t,r)=>{let s=r==0?25:35,n=Math.round(Math.random());return"abcdefghijkrmnopqrstuvwxyz0123456789"[Math.round(Math.random()*s)][n?"toUpper":"toLower"]()}).join(""),x=he;x.get128Binary=()=>Array.from({length:128}).map((e,t)=>"01"[Math.round(Math.random()*1)]).join("");x.get32Hex=(e="Formatted",t="-")=>{let r=Array.from({length:32}).map((s,n)=>"0123456789abcdef"[Math.round(Math.random()*15)]).join("").toUpper();return e=="Formatted"&&(r=[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,20),r.slice(20,32)].join(t)),r};x.to32Format=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20,32)].join("-").toUpper();var me=e=>new i.prototype.jmini(e),i=me;i.prototype={};i.extend=function(e,t=i){for(var[r,s]of Object.entries(e))t.prototype[r]=s};i.expando="__jmini_"+x();i.__classAlias="jmini";var C=(e,t)=>(e.queue.push(t),q(e),e),q=e=>p(void 0,null,function*(){if(e.queueProcess||!e.queue.length)return;e.queueProcess=!0;let t=e.queue.shift();t&&(yield t()),e.queueProcess=!1,q(e)}),k=(e,t)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,s]of Object.entries(t))r.match(/queue/)||(e[r]=s);return e},fe=(e,t)=>{if(t.length){for(var r=0;r<t.length;r++){let s=t[r];s&&(s[i.expando]||(i.isElement(s)||i.isShadowRoot(s))&&(s[i.expando]={events:{}})),e[r]=s}e.length=t.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,q(e),e};i.extend({constructor:i,__classAlias:i.__classAlias,jmini:function(e){return this.src=e,this.srcType=i.isWhat(e),this.queueProcess=!0,this.queue=[],fe(this,i.isJmini(e)?e.get():i.isElement(e)?[e]:i.isElements(e)?e:i.isShadowRoot(e)?[e]:i.isString(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}});i.prototype[String(Symbol.iterator)]=[][Symbol.iterator];i.prototype.jmini.prototype=i.prototype;{let e=function(n,a,o){let l=[];for(let u=0;u<(n.length||0);u++)l.push(a(n[u],u));return o&&(l=l.filter(u=>u!=null)),l},t=n=>(n.for((a,o)=>{if(!(i.isElement(a)||i.isShadowRoot(a)))return;let l=a.cloneNode(),u=a.parentNode;u&&u.replaceChild(l,a),n[o]=l}),n),r=(n,a)=>(i(a).for(o=>{if(n&&(i.isElement(o)||i.isShadowRoot(o)))if(i.isString(n)||i.isNumber(n))n=String(n),o.insertAdjacentHTML("beforeend",String(n));else if(i.isElement(n))o.appendChild(n);else{i.isJmini(n)?n=n.get():i.isElement(n)?n=[n]:i.isRecord(n)&&(n=[i(n)]);for(var l=0;l<n.length;l++)r(n[l],o)}}),a),s=(n,a,...o)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[a]||{p:"",s:""};return n.for(h=>{if(i.isString(o[0]))h.insertAdjacentHTML(l,o[0]);else{if(!h.parentNode)return;i(o[0]).for(g=>{o[1]&&(g=g.cloneNode(!0)),h.parentNode.insertBefore(g,h[u]||h)})}}),n};i.extend({get:function(n){return n?this[0]:e(this,a=>a)},for:function(n,a=1){let o=e(this,(l,u)=>n(l,u),1);return a?o:[]},await:function(n){return C(this,()=>new Promise((a,o)=>{setTimeout(()=>{a(this)},n)}))},abort:function(){return C(this,()=>p(this,null,function*(){return this.queue=[],this}))},callback:function(n){return C(this,()=>p(this,null,function*(){return yield n(this),this}))},click:function(){return C(this,()=>{for(var n=0;n<this.length;n++){let a=this[n];i.isElement(a)&&a.click()}return this})},focus:function(){return C(this,()=>{for(var n=0;n<this.length;n++){let a=this[n];i.isElement(a)&&a.focus()}return this})},addEvent:function(n){return C(this,()=>{let{eventType:a,eventID:o=x(),target:l,callback:u,options:h}=n;return h=T({passive:!0,capture:!1},h),this.for(d=>{if(!(i.isElement(d)||i.isShadowRoot(d)))return;let{events:g}=d[i.expando];if(l){let R=u;u=f=>{if(f.target){if(i.isString(l)){let b=f.target.closest(l);b&&(!b||R.call(b,f))}else if(i.isElements(l)){for(let y of l)if(f.target==y)return R.call(y,f)}}}}if(g[o]){let R=g[o];d.removeEventListener(R.eventType,R.callback,R.options)}g[o]={eventType:a,callback:u,options:h},d.addEventListener(a,u,h)}),this})},removeEvent:function(n){return C(this,()=>{let a=i.isArray(n)?n:[n];return this.for(o=>{let{events:l}=o[i.expando];for(let u of a){let h=l[u];h&&o.removeEventListener(h.eventType,h.callback,h.options)}}),this})},html:function(n){return C(this,()=>k(this,r(n,t(this))))},empty:function(){return C(this,()=>k(this,t(this)))},append:function(n){return C(this,()=>{r(n,this)})},remove:function(){return C(this,()=>(this.for((n,a)=>{n&&i.isElement(n)&&(n.remove(),delete this[a])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...n){return C(this,()=>k(this,s(this,"before",...n)))},after:function(...n){return C(this,()=>k(this,s(this,"after",...n)))},find:function(n){return C(this,()=>{let a=[],o=this[0];o||k(this,i()),(i.isElement(o)||i.isShadowRoot(o))&&(i.isString(n)?a=o.querySelectorAll(n):i.isElement(o)&&i(n).for(l=>{let u=o.childNodes;for(let h of u)if(h===l){a.push(h);break}else h.childNodes.length&&(a=[...a,...i(h).find(l).for(d=>d)])})),k(this,i(a))})},parent:function(n){return C(this,()=>{var o,l;let a=i(n?(o=this[0])==null?void 0:o.closest(n):(l=this[0])==null?void 0:l.parentNode);k(this,a)})},children:function(n){return C(this,()=>{let a=this[0].children;i.isExist(n)&&(n=String(n).replace(/^ : /,""),a=n=="first"?a[0]:n=="last"?a[a.length-1]:a[Number(n)]);let o=i(a);return k(this,o)})},addClass:function(n){return C(this,()=>(n&&this.for(a=>{let o=i.isString(n)?n.split(" "):n;a&&i.isElement(a)&&a.classList.add(...o)}),this))},removeClass:function(n){return C(this,()=>(n&&this.for(a=>{let o=i.isString(n)?n.split(" "):n;a&&i.isElement(a)&&a.classList.remove(...o)}),this))},toggleClass:function(n){return C(this,()=>(n&&this.for(a=>{a.classList.toggle(n)}),this))},hasClass:function(n=""){if(this[0])return this[0].classList.contains(n.replace(/^\./,""))},findClass:function(n){let a=[];return this[0]&&(a=[...this[0].classList].filter(o=>o.match(n))),a},css:function(n){return C(this,()=>(this.for(a=>{if(i.isElement(a))for(let[o,l]of Object.entries(n)){if(i.isNumber(l)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){a.style[o]=l+"px";continue}a.style[o]=String(l)}}),this))},getAttribute:function(n){return this[0].getAttribute(String(n))},setAttribute:function(n,a){return C(this,()=>(this.for(o=>o.setAttribute(n,a)),this))},getStyleProperty:function(n){let a=this[0];return a&&i.isElement(a)?getComputedStyle(a).getPropertyValue(n):""},setStyleProperty:function(n,a){let o=this[0];return o&&i.isElement(o)&&o.style.setProperty(n,a),this},val:function(){var a;let n=this[0];return(n==null?void 0:n.value)||((a=n==null?void 0:n.dataset)==null?void 0:a.value)},position:function(){return i.isElement(this[0])?this[0].getBoundingClientRect():{}}})}i.uniqueArray=(e,t)=>t?Array.from(new Map(e.map(r=>[i.getRecord(r,t||"0"),r])).values()):Array.from(new Set(e));i.getRecord=(e,t)=>{let r={},s=e;return t.split(".").forEach(n=>{s=s==null?void 0:s[n],r=s}),r};i.Arrayify=i.flatArray=(e,t)=>{if(!i.isArray(e))return[e];let r=[];for(let s of e)r.push(...t=="-R"?i.Arrayify(s,"-R"):[s]);return r};i.Stringify=(...e)=>{let[t,r,s]=e;return JSON.stringify(t,r!=null?r:(()=>{let n=new WeakSet;return(a,o)=>{if(typeof o=="object"&&o!==null){if(n.has(o))return"[Circular Reference]";n.add(o)}return o}})(),s)};i.Objectify=(e,t)=>{try{return JSON.parse(e)}catch(r){return t!=null?t:null}};i.SortifyObject=(e,t)=>{let r={};return!e||!i.isArray(e)&&!i.isRecord(e)?null:(Object.keys(e).sort().forEach(s=>{let n=e[s];if(t){if(i.isRecord(n)){r[s]=i.SortifyObject(n,t);return}if(i.isArray(n)){r[s]=n.map(a=>i.isRecord(a)||i.isArray(a)?i.SortifyObject(a,t):a);return}}r[s]=n}),r)};i.randomNumber=(e=0,t=100,r)=>{if(e>t)return NaN;let s=Math.round(Math.random()*(t-e))+e;return r&&r.length&&r.includes(s)?i.randomNumber(e,t,r):s};i.try=e=>{try{return[e(),!0]}catch(t){return[t,!1]}};i.trySync=e=>p(void 0,null,function*(){try{return[yield e(),!0]}catch(t){return[t,!1]}});i.scope=e=>e();i.scopeSync=e=>p(void 0,null,function*(){return yield e()});i.createElement=function(e){var g;let{tag:t,className:r="",id:s,html:n,attr:a,style:o,parent:l}=e,u=document.createElement(t||"div");if(r&&u.classList.add(...r.split(" ")),s&&(u.id=s),a)for(let R of Object.entries(a)){let f=R[0],y=(g=R[1])!=null?g:"";if(f=="data"&&i.isRecord(y))for(let[b,w]of Object.entries(y))u.dataset[b]=w;else f=="for"?f="htmlFor":f=="tabindex"?f="tabIndex":f=="aria-label"&&(f="ariaLabel"),u[f]=y}if(n&&i(u).append(n),o)for(var[h,d]of Object.entries(o))u.style[h]=d;return l&&i(l).append(u),u};i.setCookie=e=>{let{hostname:t}=new URL(location.toString()),{name:r,value:s="",age:n=60*60*24*365,path:a="/",domain:o=t,secure:l=!1}=e,u=`${r}=${s}max-age=${n}path=${a}domain=${o}`;l&&(u+=" Secure"),document.cookie=u};i.getCookie=e=>{let t=document.cookie.match(new RegExp(e+"=[^]*"));return t?t[0].replace(new RegExp(e+"="),""):""};i.localStorage={set:(e,t)=>{localStorage.setItem(e,i.Stringify(t))},get:e=>{let t=localStorage.getItem(e);return i.Objectify(t,t)}};i.deleteCookie=e=>{document.cookie=e+"=max-age=0"};i.getScreenSize=()=>{let{innerHeight:e,innerWidth:t,scrollY:r,scrollX:s,pageXOffset:n,pageYOffset:a}=window,o=Number(i(document.body).getStyleProperty("--sat").removeLetters()),l=Number(i(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:t,pageHeight:e-o-l,scrollY:r,scrollX:s,pageXOffset:n,pageYOffset:a,safeAreaTop:o,safeAreaBottom:l}};i.getCursor=e=>{var s,n,a,o,l,u,h,d;let t=(o=e.pageX)!=null?o:(a=(s=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:s.pageX)!=null?a:(((n=e==null?void 0:e.originalEvent)==null?void 0:n.touches)||[])[0].pageX,r=(d=e.pageY)!=null?d:(h=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?h:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:t,y:r}};i.pending=(e,t)=>{var s;let r=(s=t||Number(e))!=null?s:-1;return new Promise((n,a)=>{i.isFunction(e)&&e(n),!(r<0)&&setTimeout(()=>{n(!0)},r)})};i.deepMerge=(e,...t)=>{if(!t.length)return e;let r=t.shift();if(i.isRecord(e)&&i.isRecord(r))for(let s in r)i.isRecord(r[s])?(e[s]||Object.assign(e,{[s]:{}}),i.deepMerge(e[s],r[s])):Object.assign(e,{[s]:r[s]});return i.deepMerge(e,...t)};i.deepCopy=e=>{if(i.isArray(e))return e.map(t=>i.deepCopy(t));if(i.isRecord(e)){let t={};return Object.entries(e).forEach(([r,s])=>{t[r]=i.deepCopy(s)}),t}return e};i.url={path:{get:e=>{let r=new URL(e||location.href).pathname||"";return r=r.replace(/^\//,"").replace(/\/$/,""),r.split("/")},set:(e,t)=>{let r=new URL(t||location.href);if(i.isString(e))r.pathname=e;else{let s=i.url.path.get();Object.entries(e).forEach(([n,a])=>{s[Number(n)]=a}),r.pathname="/"+s.filter(n=>n!=null).join("/")}return t||history.replaceState({},"",r.pathname+r.search),r.toString()}},search:{get:e=>{let t=new URL(e||location.href),r={};return t.searchParams.forEach((s,n)=>r[n]=s),r},set:(e,t)=>{let r=new URL(t||location.href);return Object.entries(e).forEach(([s,n])=>{r.searchParams.set(s,String(n))}),t||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,t)=>{let r=new URL(t||location.href);return e.forEach(s=>{r.searchParams.delete(s)}),t||history.replaceState({},"",r.pathname+r.search),r.toString()}}};i.queryParams={get:e=>{let t=new URL(e||location.href),r={};return t.searchParams.forEach((s,n)=>r[n]=s),r},set:(e,t)=>{let r=new URL(t||location.href);return Object.entries(e).forEach(([s,n])=>{r.searchParams.set(s,String(n))}),t||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,t)=>{let r=new URL(t||location.href);return e.forEach(s=>{r.searchParams.delete(s)}),t||history.replaceState({},"",r.pathname+r.search),r.toString()}};i.ellipsisText=(e,t)=>{let r=String(e);return r.length>t&&(r=r.slice(0,t)+" ..."),r};i.isEqual=(e,t,r)=>r==null||r?i.Stringify(e)===i.Stringify(t):e===t,i.isExist=e=>e===(e!=null?e:!e),i.isNullish=e=>!i.isExist(e),i.isJmini=e=>{var t,r;return((t=e||{})==null?void 0:t.constructor)===i||((r=e||{})==null?void 0:r.__classAlias)===i.__classAlias},i.isString=e=>typeof e=="string",i.isBoolean=e=>typeof e=="boolean",i.isNumber=e=>!isNaN(e)&&typeof e=="number",i.isArray=e=>{let t={}.toString.call(e);return Array.isArray(e)||e instanceof Array||t=="[object NodeList]"||t=="[object HTMLCollection]"},i.isFunction=e=>typeof e=="function",i.isRecord=e=>({}).toString.call(e)==="[object Object]"&&!i.isJmini(e),i.isElement=e=>e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e)),i.isElements=e=>{let t={}.toString.call(e),r=Number(!!e&&!i.isString(e)&&i.isArray(e)&&t!=="[object Text]");if(r&&i.isArray(e)&&t!=="[object NodeList]")for(var s of e)r&=Number(i.isElement(s));return!!r},i.isShadowRoot=e=>e instanceof ShadowRoot,i.isDate=e=>i.isNumber(new Date(e).getTime()),i.isInRange=(e,t,r,s=!0)=>s?t<=e&&e<=r:t<e&&e<r,i.isOneOf=(e,...t)=>{let r=i.isArray(t),s=i.isRecord(t);return r||s?t.some(n=>i.isEqual(e,n)):t==null?void 0:t.includes(e)},i.isWhat=e=>{let t="other";return i.isJmini(e)?t="jmini":i.isElement(e)?t="element":i.isElements(e)?t="elements":i.isShadowRoot(e)?t="shadowRoot":i.isString(e)?t="string":i.isNumber(e)?t="number":i.isArray(e)?t="array":i.isFunction(e)?t="function":i.isDate(e)?t="date":typeof e=="undefined"?t="undefined":i.isRecord(e)?t="record":e==null?t="null":isNaN(e)&&(t="NaN"),t};i.is={equal:i.isEqual,exist:i.isExist,nullish:i.isNullish,jmini:i.isJmini,string:i.isString,boolean:i.isBoolean,number:i.isNumber,array:i.isArray,function:i.isFunction,record:i.isRecord,element:i.isElement,elements:i.isElements,shadowRoot:i.isShadowRoot,date:i.isDate,inRange:i.isInRange,oneOf:i.isOneOf,what:i.isWhat};var A={},M={set:(e,t)=>{let r=!0;return Object.entries(e).forEach(([s,n])=>{let a=A[s]||{};a&&a.privateKey&&a.privateKey!=t&&(r=!1),A[s]={privateKey:t,value:n}}),r},update:(e,t)=>{let r=!0;return Object.entries(e).forEach(([s,n])=>{var o;let a=A[s]||{};a&&a.privateKey&&a.privateKey!=t&&(r=!1),A[s]=B(T({},A[s]),{value:T(T({},(o=A[s])==null?void 0:o.value),n)})}),r},get:(e,t)=>{let r=A[e];if(!(r&&r.privateKey&&r.privateKey!=t))return r==null?void 0:r.value},delete:(e,t)=>{let r=A[e];return r&&r.privateKey&&r.privateKey!=t?!1:(delete A[e],!0)}};var te=-new Date().getTimezoneOffset(),ce=(e,t)=>new m.prototype.Time(e,t),m=ce;m.prototype={};m.__classAlias="jmini.Time";var de=function(e,t){if(t&&(this.localTimezoneOffset=t),m.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0?e=new Date:e===0&&(e=new Date(0))),e&&(i.isNumber(e)&&(e=new Date(e)),i.isString(e)&&(e=String(e).trim().replace(/\//g,"-").replace(/ +|\s+/g," ").replace(/\-+/g,"-"),e=e.replace(/^(\d{4}-\d{2}-\d{2})$/,"$1T00:00:00").replace(/^(\d{4}-\d{2}-\d{2})\s+/,"$1T").replace(/^(\d{4}-\d{2}-\d{2}T\d{2})(:?|:+)$/,"$1:00").replace(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(:?|:+)$/,"$1:00"),e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d{1,3})?$/)))){let s=this.getLocalTimezoneOffset(),n=Math.floor(s/60),a=s%60;n>=0&&(e+="+"),e+=n.zeroEmbed(2),e+=":"+a.zeroEmbed(2)}let r=new Date(String(e));return this.set(r)};i.extend({constructor:m,Time:de,__classAlias:m.__classAlias,value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,warekiYear:-1,wareki:"",warekiLabel:"",year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,localTimezoneOffset:void 0,getLocalTimezoneOffset:function(){var e,t;return(t=(e=this.localTimezoneOffset)!=null?e:M.get("jmini/time/env/localTimezoneOffset"))!=null?t:te},setLocalTimezoneOffset:function(e,t){return this.localTimezoneOffset=e,t&&M.set({"jmini/time/env/localTimezoneOffset":e}),this.set(this.value)},clone:function(){return m(this,this.localTimezoneOffset)},set:function(e){var n;this.value=e;let t=i.isDate(e);if(this.validate=t,i.isNullish(this.localTimezoneOffset)&&(this.localTimezoneOffset=(n=M.get("jmini/time/env/localTimezoneOffset"))!=null?n:te),!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;let r=e.getTime()+e.getTimezoneOffset()*6e4,s=new Date(r+this.getLocalTimezoneOffset()*60*1e3);this.ms=e.getTime(),this.year=s.getFullYear(),this.month=s.getMonth()+1,this.date=s.getDate(),this.weekday=s.getDay(),this.hours=s.getHours(),this.minutes=s.getMinutes(),this.seconds=s.getSeconds();{let a=this.year||0,o=this.month||0,l=this.date||0,u=Number(a+o.zeroEmbed(2)+l.zeroEmbed(2));u>=20190501?(this.warekiYear=a-2018,this.wareki="REIWA",this.warekiLabel="\u4EE4\u548C"):u>=19890108?(this.warekiYear=a-1988,this.wareki="HEISEI",this.warekiLabel="\u5E73\u6210"):u>=19261225?(this.warekiYear=a-1925,this.wareki="SHOUWA",this.warekiLabel="\u662D\u548C"):u>=19120730?(this.warekiYear=a-1911,this.wareki="TAISHO",this.warekiLabel="\u5927\u6B63"):u>=19680125?(this.warekiYear=a-1867,this.wareki="MEIJI",this.warekiLabel="\u660E\u6CBB"):(this.warekiYear=0,this.wareki="",this.warekiLabel="")}{let a=new Date(this.year,0,1),o=new Date(a.valueOf());o.setDate(o.getDate()-(a.getDay()+1));let l=this.ms-o.getTime(),u=Math.ceil(l/(1e3*60*60*24));this.weekInYear=Math.ceil(u/7)}{let a=new Date(this.year,this.month-1,1),o=new Date(a.valueOf());o.setDate(o.getDate()-(a.getDay()+1));let l=this.ms-o.getTime(),u=Math.ceil(l/(1e3*60*60*24)),h=Math.ceil(u/7);this.weekInMonth=h}{let a=new Date(this.year,this.month,0),o=a.getDay(),l=new Date(new Date(a).setDate(a.getDate()-o));this.isLastWeekInMonth=this.date>=l.getDate()}return 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},isInRange:function(e,t){return!this.validate||!e.validate||!t.validate?!1:this.value>=e.value&&this.value<=t.value},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()),r=t.getDate();t.setDate(1),t.setMonth(e-1);let s=m(t).getLastDayOfMonth();return t.setDate(Math.min(r,s.date)),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,t){if(!this.validate)return"";let r=this;return i.isExist(t)&&(r=r.clone(),r.setLocalTimezoneOffset(t||0)),e.replace(/\%y/ig,r.year.zeroEmbed(4)).replace(/\%m/ig,r.month.zeroEmbed(2)).replace(/\%d/ig,r.date.zeroEmbed(2)).replace(/\%w/ig,r.weekInYear.zeroEmbed(2)).replace(/\%h/ig,r.hours.zeroEmbed(2)).replace(/\%i/ig,r.minutes.zeroEmbed(2)).replace(/\%s/ig,r.seconds.zeroEmbed(2))},toFormatISO:function(){return this.value.toISOString()},toFormatabbrYMD:function(e,t){if(!this.validate)return"";let r=this.isSameYear(m()),s="%Y/%M/%D";return r&&(s="%M/%D"),e=="JP"&&(s="%Y\u5E74%M\u6708%D\u65E5",r&&(s="%M\u6708%D\u65E5")),this.toFormat(s,t)},toFormatYMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t):""},toFormatYM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708",t):this.toFormat("%Y/%M",t):""},toFormatMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):""},toFormatHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206",t):this.toFormat("%h:%i",t):""},toFormatHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206%s\u79D2",t):this.toFormat("%h:%i:%s",t):""},toFormatYMDHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\u5206",t):this.toFormat("%Y/%M/%D %h:%i",t):""},toFormatYMDHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2",t):this.toFormat("%Y/%M/%D %h:%i:%s",t):""},toLangYMD:function(e,t){if(!this.validate)return"";let r=m(),s=r.diff(this);return s.dates==0?"\u4ECA\u65E5":s.dates==1?"\u6628\u65E5":s.dates>=-7&&s.dates<0?-1*s.dates+"\u65E5\u5F8C":s.dates<=7&&s.dates>0?s.dates+"\u65E5\u524D":this.isSameYear(r)?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t)},setFirstOfDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfDay: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,s]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(r)),n.setMinutes(Number(s)),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,s,n]=t.split(":"),a=new Date(this.value.valueOf());return a.setHours(Number(r)),a.setMinutes(Number(s)),a.setSeconds(Number(n)),this.set(a)},getFirstDayOfYear:function(){return m(new Date(this.value.getFullYear(),0,1))},getLastDayOfYear:function(){return m(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfMonth:function(){return m(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfMonth:function(){return m(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfWeek:function(){let e=m(this.value);return e.addDate(-e.weekday)},getLastDayOfWeek: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:i.scope(()=>{let t=864e5,r=this.clone().setFirstOfDay(),s=e.clone().setFirstOfDay();return Math.floor((r.ms-s.ms)/t)}),hours:i.scope(()=>{let t=36e5,r=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),s=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-s.ms)/t)}),minutes:i.scope(()=>{let t=6e4,r=this.clone().setSeconds(0).setMilliseconds(0),s=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((r.ms-s.ms)/t)}),seconds:i.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,r;return((t=e||{})==null?void 0:t.constructor)===m||((r=e||{})==null?void 0:r.__classAlias)===m.__classAlias};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="",s="";return e.year==t.year&&e.year==m().year?r=e.toFormatMD():r=e.toFormatYMD(),e.year!=t.year?s=t.toFormatYMD():s=t.toFormatMD(),[r,s]};m.getPeriodArray=(e,t,r)=>{let s=[],n=t;if(!t.validate||!r.validate)return s;for(e=="year"?n=m(n).setMonth(1).setDate(1).setFirstOfDay():e=="month"?n=m(n).setDate(1):e=="week"?n=m(n).getFirstDayOfWeek():e=="day"?n=m(n).setFirstOfDay():e=="hours"?n=m(n).setMinutes(0).setSeconds(0).setMilliseconds(0):e=="minutes"?n=m(n).setSeconds(0).setMilliseconds(0):e=="seconds"&&(n=m(n).setMilliseconds(0));n.toFormatYMDHMS().toNumber()<=r.toFormatYMDHMS().toNumber();)s.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 s};m.prototype.Time.prototype=m.prototype;var pe=(...[e,t,r])=>new S.prototype.Interval(e,t,r),S=pe;S.prototype={};var ye=function(...[e,t,r]){return this.fn=e,this.ms=t,this.key=r,this.isFinished=!1,S.abort(this.key),this.store(),this};i.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:ye,store:function(){M.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 S.abort(this.timeoutIndex),this},setState:function(e){return Object.entries(e).forEach(([t,r])=>{this.hasOwnProperty(t)&&(this[t]=r)}),this.store(),this}},S);S.abort=e=>{if(i.isNumber(e))return clearInterval(e);let t=M.get("Interval_"+e);t&&(t&&clearInterval(t.timeoutIndex),t.setState({isFinished:!0}))};S.get=e=>M.get("Interval_"+e);S.once=(e,t,r)=>S(e,t,r).once();S.series=(e,t)=>p(void 0,null,function*(){return new Promise(r=>{let s=S.get(e);if(s&&!s.isFinished)return r(null);let n=()=>{S.abort(e)};r(n),t&&S(n,t,e).once()})});S.start=(e,t,r)=>S(e,t,r).start();S.prototype.Interval.prototype=S.prototype;var ge=(e,t)=>new c.prototype.Fetcher(e,t),c=ge;c.prototype={};c.waitList=[];c.setDefaultTrafficControl=0;c.setDefaultTimeout=1e3*60*10;c.abort=e=>{let t="fetcher.abortController."+e,r=M.get(t);console.log(r),r&&r.abort()};c.safetyRecords=e=>{let t={};return Object.entries(e).forEach(([r,s])=>{if(i.isArray(s)){t[r]=s.join(",");return}else if(i.isRecord(s)){Object.entries(c.safetyRecords(s)).forEach(([n,a])=>{t[`${r}.${n}`]=a});return}t[r]=s}),t};c.isReadableStream=e=>e instanceof ReadableStream;c.isReadableStreamReader=e=>e instanceof ReadableStreamDefaultReader;c.streamToContext=(e,t)=>p(void 0,null,function*(){try{let r=(t==null?void 0:t.reader)||e.getReader();if(!c.isReadableStreamReader(r))return{ok:!1,done:!0,data:null};if(!r)return{ok:!1,done:!0,data:null};let s=(t==null?void 0:t.decoder)||new TextDecoder("utf-8"),n=yield r.read();return{ok:!0,done:n.done,data:s.decode(n.value)}}catch(r){return{ok:!1,done:!0,data:r}}});var be=function(e,t){var n;t=t||{};let r=t.body;t.body&&!i.isString(t.body)&&((n=t.bodyStringify)==null||n)&&(r=i.Stringify(t.body||{}));let s=e;return i.isString(e)&&!e.match(/https?:/)&&(s=location.origin+"/"+e.replace(/^\//,"")),this.url=s,this.method=t.method||"get",this.streamStatus="open",this.params=B(T({key:x(),response_format:"json",timeout:c.setDefaultTimeout,trafficControl:c.setDefaultTrafficControl,preventMultiRequest:!0},t),{headers:T(T({"Content-Type":"application/json"},c.setDefaultHeaders&&c.setDefaultHeaders()),t.headers),body:r}),this};i.extend({Fetcher:be,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=T(T({},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:s,reader:n,decoder:a}=e,o=t.body,l=this,u=function(){return Z(this,null,function*(){if(!t.ok){i.scope(()=>p(this,null,function*(){let{ok:y,done:b,data:w}=yield c.streamToContext(o,{reader:n,decoder:a});y&&r(w)}));return}let f=!1;for(;!f;){let{ok:y,done:b,data:w}=yield new $(c.streamToContext(o,{reader:n,decoder:a}));l.streamStatus=="abort"?(l.streamStatus="closed",n.cancel(),b=!0):l.streamStatus=="closed"&&(b=!0),b&&(f=b,n.releaseLock()),s(w,b)}})};try{for(var h=ee(u()),d,g,R;d=!(g=yield h.next()).done;d=!1){let f=g.value;;}}catch(g){R=[g]}finally{try{d&&(g=h.return)&&(yield g.call(h))}finally{if(R)throw R[0]}}})},get:function(){return this.method="GET",this.send()},head:function(){return this.method="HEAD",this.send()},post:function(){return this.method="POST",this.send()},put:function(){return this.method="PUT",this.send()},delete:function(){return this.method="DELETE",this.send()},patch:function(){return this.method="PATCH",this.send()},options:function(){return this.method="OPTIONS",this.send()},send:function(){return p(this,null,function*(){var V;let e=this.params,t=performance.now(),K=e,{key:r,response_format:s,trafficControl:n=0,preventMultiRequest:a,timeout:o,queries:l}=K,u=Q(K,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);u.method=this.method;let h=[this.method,r].join("."),d=c.waitList.includes(h);c.waitList=[...c.waitList,h];let g=!1,R=!1,f=!1,y=500,b="InternalServerError",w={},I=null,O=null;n>0&&(O=i.pending(n));let P=new AbortController,re=setTimeout(()=>{P.abort(),console.log("timeout",o)},e.timeout);u.signal=P.signal,this.abortController=P;let z="fetcher.abortController."+this.params.key;M.set({[z]:P});let H=()=>{g=!0},W=()=>(P.abort(),c.waitList=c.waitList.filter(v=>v!=h),{isCancelled:g,isAborted:R,ok:!1,status:0,statusText:"CANCELLED",body:w,requestTime:0,rawData:null});try{if(c.setDefaultOnStart&&(yield c.setDefaultOnStart(e,H)),this.onStartCB&&(yield this.onStartCB(e,H)),g)return W();if(d){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(H)),g)return W();if(a)throw y=429,new Error("TooManyRequests")}let v=i.url.search.set(T({},c.safetyRecords(l||{})),String(this.url)),Y=yield fetch(v,u).then(F=>p(this,null,function*(){return f=F.ok,y=F.status,b=F.statusText,I=F,s=="none"||s=="stream"?F:F[s]()})).catch(F=>{throw new Error(F)});M.delete(z),w=Y}catch(v){y==200&&(y=500,f=!1),y==429&&(b="TooManyRequests"),P.signal.aborted&&(y=408,b="Timeout",R=!0),y==500&&(b=String(v)||b),w={errorCode:String(v)}}finally{clearTimeout(re)}let D={isCancelled:g,isAborted:R,ok:f,status:y,statusText:b,body:w,additionalBody:this.extraBody,requestTime:performance.now()-t,rawData:I};if(!f){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let v=yield this.onRetryCB(D.body,this.params,this);if(v)return c.waitList=c.waitList.filter(Y=>Y!=h),this.params=v,this.send()}this.onErrorCB&&this.onErrorCB(D.body)}if(f&&this.onStreamCB&&e.response_format=="stream"){let v=(V=I.body)==null?void 0:V.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:D,reader:v,decoder:new TextDecoder("utf-8")})}return yield O,D.requestTime=performance.now()-t,f&&this.onCompleteCB&&this.onCompleteCB(D.body),this.onResultCB&&this.onResultCB(D,e),c.setDefaultOnEnd&&c.setDefaultOnEnd(D,e),c.waitList=c.waitList.filter(v=>v!=h),D})},abortStream:function(){this.streamStatus="abort"}},c);c.prototype.Fetcher.prototype=c.prototype;var Ce=e=>new E.prototype.Filer(e),E=Ce;E.prototype={};var Re=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};i.extend({ok:!1,extension:"",type:"",file:{},fileName:"",Filer:Re,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*(){return yield this.file.convert("dataURL")})},toAarrayBuffer:function(){return p(this,null,function*(){return yield this.file.convert("arrayBuffer")})},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}},E);E.fromFile=e=>E(e);E.fromBlob=(e,t)=>{let r=(t==null?void 0:t.fileName)||"file",s=(t==null?void 0:t.extension)||"",n=new File([e],r+"."+s,{type:t==null?void 0:t.mimeType});return E(n)};E.fromArrayBuffer=(e,t)=>E.fromBlob(new Blob([e],{type:(t==null?void 0:t.mimeType)||""}),t);E.fromObjectURL=(e,t)=>p(void 0,null,function*(){let r=yield c(e,{response_format:"blob"}).get();return r.ok?E.fromBlob(r.body,t):E({})});E.fromDataURL=(e,t)=>{let r=e.toBlob((t==null?void 0:t.mimeType)||"");return r?E.fromBlob(r,t):E({})};E.prototype.Filer.prototype=E.prototype;var Se=function(e){let t=e,r=null;return t.use((s,n,a)=>{let o=n;o.return=l=>{let{ok:u,status:h,body:d={},bodyStringify:g=!0}=l||{};h=h!=null?h:(u!=null?u:!0)&&200||403;let R=d;return g&&!i.isString(d)&&(R=i.Stringify(d)),n.status(h).end(R)},a()}),t.onPathRouter=function(s){return r=s,this},t.pathRouter=function(s){if(!r)return;let n=r(s);return n.route(s),t.use(s,n),n},t.exception=function(s){return t.use(s),this},t},J=Se;J.getLocalIP=e=>{let t="";return i.scope(()=>{if(!e)return;let r=e.networkInterfaces();for(let[s,n]of Object.entries(r))n.forEach(a=>{!a.internal&&a.family==="IPv4"&&!a.address.match(/^(169|127)/)&&(t=a.address)})}),t};J.getIP=function(e){var s;return(((e==null?void 0:e.headers["x-forwarded-for"])||((s=e==null?void 0:e.socket)==null?void 0:s.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"UNKNOWN IP"};i.copyToClipboard=e=>p(void 0,null,function*(){let t="";i.isString(e)?t=e:i.isFunction(e)&&(t=e());let r={ok:!1,body:"NotSupported"};return yield p(void 0,null,function*(){let s;if(navigator.clipboard){if(s=yield navigator.clipboard.writeText(t).then(()=>!0,()=>!1),!s)return}else{let n=document.createElement("input");if(i(document.body).append(n),n.value=t,n.select(),s=document.execCommand("copy"),document.body.removeChild(n),!s)return}r={ok:!0,body:""}}),r});i.ImageLoader=(e,t)=>{let r;return new Promise((s,n)=>{r=t||new Image,r.onload=()=>s(r),r.onerror=a=>n(a),r.crossOrigin="anonymous",r.src=e})};i.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}}};i.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=[],s=!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(a=>{let{From:o,To:l,name:u}=a;if(o<=e&&e<=l){let h=e-o+1;h==1&&(s=!0,h="\u5143"),r.push(u+h+"\u5E74"),t.push(u)}}),{era:t,value:r,gap:s}}};i.interval=S;c.setDefaultHeaders=()=>({});var Ee=i;0&&(module.exports={Fetcher,Filer,Server,Time,UUID,useStore});
|
package/esm/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Records, IFEXIST } from '.';
|
|
2
2
|
import './primitiveExtension';
|
|
3
3
|
declare global {
|
|
4
4
|
interface JminiExtension {
|
|
@@ -29,7 +29,7 @@ declare namespace Jmini {
|
|
|
29
29
|
className?: string;
|
|
30
30
|
id?: string;
|
|
31
31
|
html?: ElementableValue;
|
|
32
|
-
attr?:
|
|
32
|
+
attr?: Records;
|
|
33
33
|
parent?: ElementableValue;
|
|
34
34
|
style?: React.CSSProperties;
|
|
35
35
|
};
|
|
@@ -89,7 +89,7 @@ declare namespace Jmini {
|
|
|
89
89
|
prototype: Chains;
|
|
90
90
|
(v?: Args): Chains;
|
|
91
91
|
__classAlias: string;
|
|
92
|
-
extend<T =
|
|
92
|
+
extend<T = Records>(v: IFEXIST<T>, t?: any): void;
|
|
93
93
|
createElement: (v: CreateElementInput) => HTMLElement;
|
|
94
94
|
setCookie(props: {
|
|
95
95
|
name: string;
|
|
@@ -113,7 +113,7 @@ declare namespace Jmini {
|
|
|
113
113
|
}, url?: string): string;
|
|
114
114
|
};
|
|
115
115
|
search: {
|
|
116
|
-
get(url?: string):
|
|
116
|
+
get(url?: string): Records;
|
|
117
117
|
set(searchParams: {
|
|
118
118
|
[key: string]: string | number;
|
|
119
119
|
}, url?: string): string;
|
|
@@ -121,7 +121,7 @@ declare namespace Jmini {
|
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
queryParams: {
|
|
124
|
-
get(url?: string):
|
|
124
|
+
get(url?: string): Records;
|
|
125
125
|
set(searchParams: {
|
|
126
126
|
[key: string]: string | number;
|
|
127
127
|
}, url?: string): string;
|
|
@@ -146,9 +146,11 @@ declare namespace Jmini {
|
|
|
146
146
|
safeAreaTop: number;
|
|
147
147
|
safeAreaBottom: number;
|
|
148
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated. Use isEqual,isWhat, ... instead.
|
|
151
|
+
*/
|
|
149
152
|
is: {
|
|
150
153
|
equal(a: any, b: any, stringify?: boolean): boolean;
|
|
151
|
-
what(v: any): string;
|
|
152
154
|
exist(v: any): boolean;
|
|
153
155
|
nullish(val: any): boolean;
|
|
154
156
|
jmini(v: any): v is Methods & Chains;
|
|
@@ -157,28 +159,46 @@ declare namespace Jmini {
|
|
|
157
159
|
number(v: any): v is number;
|
|
158
160
|
array(v: any): v is any[];
|
|
159
161
|
function(v: any): v is Function;
|
|
160
|
-
|
|
162
|
+
record(v: any): v is Records;
|
|
161
163
|
element(v: any): v is HTMLElement;
|
|
162
164
|
elements(v: any): v is HTMLElement[];
|
|
163
165
|
shadowRoot(v: any): v is ShadowRoot;
|
|
164
166
|
date(v: any): v is Date;
|
|
167
|
+
what(v: any): string;
|
|
165
168
|
inRange(v: any, min: any, max: any, equal?: boolean): boolean;
|
|
166
169
|
oneOf<T = any>(v: T, c1: NoInfer<T>, ...cN: NoInfer<T>[]): boolean;
|
|
167
170
|
};
|
|
171
|
+
isEqual(a: any, b: any, stringify?: boolean): boolean;
|
|
172
|
+
isExist(v: any): boolean;
|
|
173
|
+
isNullish(val: any): boolean;
|
|
174
|
+
isJmini(v: any): v is Methods & Chains;
|
|
175
|
+
isString(v: any): v is string;
|
|
176
|
+
isBoolean(v: any): v is boolean;
|
|
177
|
+
isNumber(v: any): v is number;
|
|
178
|
+
isArray(v: any): v is any[];
|
|
179
|
+
isFunction(v: any): v is Function;
|
|
180
|
+
isRecord(v: any): v is Records;
|
|
181
|
+
isElement(v: any): v is HTMLElement;
|
|
182
|
+
isElements(v: any): v is HTMLElement[];
|
|
183
|
+
isShadowRoot(v: any): v is ShadowRoot;
|
|
184
|
+
isDate(v: any): v is Date;
|
|
185
|
+
isWhat(v: any): string;
|
|
186
|
+
isInRange(v: any, min: any, max: any, equal?: boolean): boolean;
|
|
187
|
+
isOneOf<T = any>(v: T, c1: NoInfer<T>, ...cN: NoInfer<T>[]): boolean;
|
|
168
188
|
ellipsisText(value: string, length: number): string;
|
|
169
|
-
|
|
189
|
+
getRecord<T = any>(object: Records, keys: string): T;
|
|
170
190
|
uniqueArray<T = any>(v: T[], key?: keyof T): T[];
|
|
171
191
|
deepMerge<T = any>(target: T, ...args: T[]): T;
|
|
172
192
|
deepCopy<T = any>(target: T): T;
|
|
173
193
|
randomNumber(min?: number, max?: number, notIn?: number[]): number;
|
|
174
194
|
/**
|
|
175
|
-
* deprecated. use Arrayify
|
|
195
|
+
* @deprecated. use Arrayify instead.
|
|
176
196
|
*/
|
|
177
197
|
flatArray<T = any>(v: T, regression?: '-R'): (T extends readonly (infer U)[] ? U : T)[];
|
|
178
198
|
Arrayify<T = any>(v: T, regression?: '-R'): (T extends readonly (infer U)[] ? U : T)[];
|
|
179
199
|
Stringify(value: any, replacer?: ((this: any, key: string, value: any) => any) | (number | string)[] | null, space?: string | number): string;
|
|
180
200
|
Objectify<T = any>(value: any, OnError?: any): T;
|
|
181
|
-
SortifyObject<T =
|
|
201
|
+
SortifyObject<T = Records>(value: T, recursive?: boolean): T;
|
|
182
202
|
try<T = any>(fn: {
|
|
183
203
|
(): T;
|
|
184
204
|
}): [T, boolean];
|
package/esm/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as T,e as b}from"./chunk-ABA72NWU.js";import{UUID as S}from"./uuid";import"./primitiveExtension";const w=e=>new n.prototype.jmini(e),n=w;n.prototype={},n.extend=function(e,i=n){for(var[r,a]of Object.entries(e))i.prototype[r]=a},n.expando="__jmini_"+S(),n.__classAlias="jmini";const h=(e,i)=>(e.queue.push(i),E(e),e),E=e=>b(void 0,null,function*(){if(e.queueProcess||!e.queue.length)return;e.queueProcess=!0;let i=e.queue.shift();i&&(yield i()),e.queueProcess=!1,E(e)}),p=(e,i)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,a]of Object.entries(i))r.match(/queue/)||(e[r]=a);return e},v=(e,i)=>{if(i.length){for(var r=0;r<i.length;r++){let a=i[r];a&&(a[n.expando]||(n.is.element(a)||n.is.shadowRoot(a))&&(a[n.expando]={events:{}})),e[r]=a}e.length=i.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,E(e),e};n.extend({constructor:n,__classAlias:n.__classAlias,jmini:function(e){return this.src=e,this.srcType=n.is.what(e),this.queueProcess=!0,this.queue=[],v(this,n.is.jmini(e)?e.get():n.is.element(e)?[e]:n.is.elements(e)?e:n.is.shadowRoot(e)?[e]:n.is.string(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}}),n.prototype[String(Symbol.iterator)]=[][Symbol.iterator],n.prototype.jmini.prototype=n.prototype;{const e=function(t,s,o){let l=[];for(let u=0;u<(t.length||0);u++)l.push(s(t[u],u));return o&&(l=l.filter(u=>u!=null)),l},i=t=>(t.for((s,o)=>{if(!(n.is.element(s)||n.is.shadowRoot(s)))return;let l=s.cloneNode(),u=s.parentNode;u&&u.replaceChild(l,s),t[o]=l}),t),r=(t,s)=>(n(s).for(o=>{if(t&&(n.is.element(o)||n.is.shadowRoot(o)))if(n.is.string(t)||n.is.number(t))t=String(t),o.insertAdjacentHTML("beforeend",String(t));else if(n.is.element(t))o.appendChild(t);else{n.is.jmini(t)?t=t.get():n.is.element(t)?t=[t]:n.is.keyValueDictionary(t)&&(t=[n(t)]);for(var l=0;l<t.length;l++)r(t[l],o)}}),s),a=(t,s,...o)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[s]||{p:"",s:""};return t.for(c=>{if(n.is.string(o[0]))c.insertAdjacentHTML(l,o[0]);else{if(!c.parentNode)return;n(o[0]).for(y=>{o[1]&&(y=y.cloneNode(!0)),c.parentNode.insertBefore(y,c[u]||c)})}}),t};n.extend({get:function(t){return t?this[0]:e(this,s=>s)},for:function(t,s=1){let o=e(this,(l,u)=>t(l,u),1);return s?o:[]},await:function(t){return h(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},t)}))},abort:function(){return h(this,()=>b(this,null,function*(){return this.queue=[],this}))},callback:function(t){return h(this,()=>b(this,null,function*(){return yield t(this),this}))},click:function(){return h(this,()=>{for(var t=0;t<this.length;t++){let s=this[t];n.is.element(s)&&s.click()}return this})},focus:function(){return h(this,()=>{for(var t=0;t<this.length;t++){let s=this[t];n.is.element(s)&&s.focus()}return this})},addEvent:function(t){return h(this,()=>{let{eventType:s,eventID:o=S(),target:l,callback:u,options:c}=t;return c=T({passive:!0,capture:!1},c),this.for(m=>{if(!(n.is.element(m)||n.is.shadowRoot(m)))return;let{events:y}=m[n.expando];if(l){let g=u;u=f=>{if(f.target){if(n.is.string(l)){let C=f.target.closest(l);C&&(!C||g.call(C,f))}else if(n.is.elements(l)){for(let d of l)if(f.target==d)return g.call(d,f)}}}}if(y[o]){let g=y[o];m.removeEventListener(g.eventType,g.callback,g.options)}y[o]={eventType:s,callback:u,options:c},m.addEventListener(s,u,c)}),this})},removeEvent:function(t){return h(this,()=>{let s=n.is.array(t)?t:[t];return this.for(o=>{let{events:l}=o[n.expando];for(let u of s){let c=l[u];c&&o.removeEventListener(c.eventType,c.callback,c.options)}}),this})},html:function(t){return h(this,()=>p(this,r(t,i(this))))},empty:function(){return h(this,()=>p(this,i(this)))},append:function(t){return h(this,()=>{r(t,this)})},remove:function(){return h(this,()=>(this.for((t,s)=>{t&&n.is.element(t)&&(t.remove(),delete this[s])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...t){return h(this,()=>p(this,a(this,"before",...t)))},after:function(...t){return h(this,()=>p(this,a(this,"after",...t)))},find:function(t){return h(this,()=>{let s=[],o=this[0];o||p(this,n()),(n.is.element(o)||n.is.shadowRoot(o))&&(n.is.string(t)?s=o.querySelectorAll(t):n.is.element(o)&&n(t).for(l=>{let u=o.childNodes;for(let c of u)if(c===l){s.push(c);break}else c.childNodes.length&&(s=[...s,...n(c).find(l).for(m=>m)])})),p(this,n(s))})},parent:function(t){return h(this,()=>{var o,l;let s=n(t?(o=this[0])==null?void 0:o.closest(t):(l=this[0])==null?void 0:l.parentNode);p(this,s)})},children:function(t){return h(this,()=>{let s=this[0].children;n.is.exist(t)&&(t=String(t).replace(/^ : /,""),s=t=="first"?s[0]:t=="last"?s[s.length-1]:s[Number(t)]);let o=n(s);return p(this,o)})},addClass:function(t){return h(this,()=>(t&&this.for(s=>{let o=n.is.string(t)?t.split(" "):t;s&&n.is.element(s)&&s.classList.add(...o)}),this))},removeClass:function(t){return h(this,()=>(t&&this.for(s=>{let o=n.is.string(t)?t.split(" "):t;s&&n.is.element(s)&&s.classList.remove(...o)}),this))},toggleClass:function(t){return h(this,()=>(t&&this.for(s=>{s.classList.toggle(t)}),this))},hasClass:function(t=""){if(this[0])return this[0].classList.contains(t.replace(/^\./,""))},findClass:function(t){let s=[];return this[0]&&(s=[...this[0].classList].filter(o=>o.match(t))),s},css:function(t){return h(this,()=>(this.for(s=>{if(n.is.element(s))for(let[o,l]of Object.entries(t)){if(n.is.number(l)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){s.style[o]=l+"px";continue}s.style[o]=String(l)}}),this))},getAttribute:function(t){return this[0].getAttribute(String(t))},setAttribute:function(t,s){return h(this,()=>(this.for(o=>o.setAttribute(t,s)),this))},getStyleProperty:function(t){let s=this[0];return s&&n.is.element(s)?getComputedStyle(s).getPropertyValue(t):""},setStyleProperty:function(t,s){let o=this[0];return o&&n.is.element(o)&&o.style.setProperty(t,s),this},val:function(){var s;let t=this[0];return(t==null?void 0:t.value)||((s=t==null?void 0:t.dataset)==null?void 0:s.value)},position:function(){return n.is.element(this[0])?this[0].getBoundingClientRect():{}}})}n.uniqueArray=(e,i)=>i?Array.from(new Map(e.map(r=>[n.getKeyValue(r,i||"0"),r])).values()):Array.from(new Set(e)),n.getKeyValue=(e,i)=>{let r={},a=e;return i.split(".").forEach(t=>{a=a==null?void 0:a[t],r=a}),r},n.Arrayify=n.flatArray=(e,i)=>{if(!n.is.array(e))return[e];let r=[];for(let a of e)r.push(...i=="-R"?n.Arrayify(a,"-R"):[a]);return r},n.Stringify=(...e)=>{let[i,r,a]=e;return JSON.stringify(i,r!=null?r:(()=>{const t=new WeakSet;return(s,o)=>{if(typeof o=="object"&&o!==null){if(t.has(o))return"[Circular Reference]";t.add(o)}return o}})(),a)},n.Objectify=(e,i)=>{try{return JSON.parse(e)}catch(r){return i!=null?i:null}},n.SortifyObject=(e,i)=>{let r={};return!e||!n.is.array(e)&&!n.is.keyValueDictionary(e)?null:(Object.keys(e).sort().forEach(a=>{let t=e[a];if(i){if(n.is.keyValueDictionary(t)){r[a]=n.SortifyObject(t,i);return}if(n.is.array(t)){r[a]=t.map(s=>n.is.keyValueDictionary(s)||n.is.array(s)?n.SortifyObject(s,i):s);return}}r[a]=t}),r)},n.randomNumber=(e=0,i=100,r)=>{if(e>i)return NaN;let a=Math.round(Math.random()*(i-e))+e;return r&&r.length&&r.includes(a)?n.randomNumber(e,i,r):a},n.try=e=>{try{return[e(),!0]}catch(i){return[i,!1]}},n.trySync=e=>b(void 0,null,function*(){try{return[yield e(),!0]}catch(i){return[i,!1]}}),n.scope=e=>e(),n.scopeSync=e=>b(void 0,null,function*(){return yield e()}),n.createElement=function(e){var y;let{tag:i,className:r="",id:a,html:t,attr:s,style:o,parent:l}=e,u=document.createElement(i||"div");if(r&&u.classList.add(...r.split(" ")),a&&(u.id=a),s)for(let g of Object.entries(s)){let f=g[0],d=(y=g[1])!=null?y:"";if(f=="data"&&n.is.keyValueDictionary(d))for(let[C,J]of Object.entries(d))u.dataset[C]=J;else f=="for"?f="htmlFor":f=="tabindex"?f="tabIndex":f=="aria-label"&&(f="ariaLabel"),u[f]=d}if(t&&n(u).append(t),o)for(var[c,m]of Object.entries(o))u.style[c]=m;return l&&n(l).append(u),u},n.setCookie=e=>{let{hostname:i}=new URL(location.toString()),{name:r,value:a="",age:t=60*60*24*365,path:s="/",domain:o=i,secure:l=!1}=e,u=`${r}=${a}max-age=${t}path=${s}domain=${o}`;l&&(u+=" Secure"),document.cookie=u},n.getCookie=e=>{let i=document.cookie.match(new RegExp(e+"=[^]*"));return i?i[0].replace(new RegExp(e+"="),""):""},n.localStorage={set:(e,i)=>{localStorage.setItem(e,n.Stringify(i))},get:e=>{let i=localStorage.getItem(e);return n.Objectify(i,i)}},n.deleteCookie=e=>{document.cookie=e+"=max-age=0"},n.getScreenSize=()=>{let{innerHeight:e,innerWidth:i,scrollY:r,scrollX:a,pageXOffset:t,pageYOffset:s}=window,o=Number(n(document.body).getStyleProperty("--sat").removeLetters()),l=Number(n(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:i,pageHeight:e-o-l,scrollY:r,scrollX:a,pageXOffset:t,pageYOffset:s,safeAreaTop:o,safeAreaBottom:l}},n.getCursor=e=>{var a,t,s,o,l,u,c,m;let i=(o=e.pageX)!=null?o:(s=(a=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:a.pageX)!=null?s:(((t=e==null?void 0:e.originalEvent)==null?void 0:t.touches)||[])[0].pageX,r=(m=e.pageY)!=null?m:(c=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?c:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:i,y:r}},n.pending=(e,i)=>{var a;let r=(a=i||Number(e))!=null?a:-1;return new Promise((t,s)=>{n.is.function(e)&&e(t),!(r<0)&&setTimeout(()=>{t(!0)},r)})},n.deepMerge=(e,...i)=>{if(!i.length)return e;const r=i.shift();if(n.is.keyValueDictionary(e)&&n.is.keyValueDictionary(r))for(const a in r)n.is.keyValueDictionary(r[a])?(e[a]||Object.assign(e,{[a]:{}}),n.deepMerge(e[a],r[a])):Object.assign(e,{[a]:r[a]});return n.deepMerge(e,...i)},n.deepCopy=e=>{if(n.is.array(e))return e.map(i=>n.deepCopy(i));if(n.is.keyValueDictionary(e)){let i={};return Object.entries(e).forEach(([r,a])=>{i[r]=n.deepCopy(a)}),i}return e},n.url={path:{get:e=>{let r=new URL(e||location.href).pathname||"";return r=r.replace(/^\//,"").replace(/\/$/,""),r.split("/")},set:(e,i)=>{const r=new URL(i||location.href);if(n.is.string(e))r.pathname=e;else{let a=n.url.path.get();Object.entries(e).forEach(([t,s])=>{a[Number(t)]=s}),r.pathname="/"+a.filter(t=>t!=null).join("/")}return i||history.replaceState({},"",r.pathname+r.search),r.toString()}},search:{get:e=>{let i=new URL(e||location.href),r={};return i.searchParams.forEach((a,t)=>r[t]=a),r},set:(e,i)=>{const r=new URL(i||location.href);return Object.entries(e).forEach(([a,t])=>{r.searchParams.set(a,String(t))}),i||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,i)=>{const r=new URL(i||location.href);return e.forEach(a=>{r.searchParams.delete(a)}),i||history.replaceState({},"",r.pathname+r.search),r.toString()}}},n.queryParams={get:e=>{let i=new URL(e||location.href),r={};return i.searchParams.forEach((a,t)=>r[t]=a),r},set:(e,i)=>{const r=new URL(i||location.href);return Object.entries(e).forEach(([a,t])=>{r.searchParams.set(a,String(t))}),i||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,i)=>{const r=new URL(i||location.href);return e.forEach(a=>{r.searchParams.delete(a)}),i||history.replaceState({},"",r.pathname+r.search),r.toString()}},n.ellipsisText=(e,i)=>{let r=String(e);return r.length>i&&(r=r.slice(0,i)+" ..."),r},n.is={equal:function(e,i,r){return r==null||r?n.Stringify(e)===n.Stringify(i):e===i},what:function(e){let i="other";return this.jmini(e)?i="jmini":this.element(e)?i="element":this.elements(e)?i="elements":this.shadowRoot(e)?i="shadowRoot":this.string(e)?i="string":this.number(e)?i="number":this.array(e)?i="array":this.function(e)?i="function":this.date(e)?i="date":typeof e=="undefined"?i="undefined":this.keyValueDictionary(e)?i="keyValueDictionary":e==null?i="null":isNaN(e)&&(i="NaN"),i},exist:function(e){return e===(e!=null?e:!e)},nullish:function(e){return!this.exist(e)},jmini:function(e){var i,r;return((i=e||{})==null?void 0:i.constructor)===n||((r=e||{})==null?void 0:r.__classAlias)===n.__classAlias},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 i={}.toString.call(e);return Array.isArray(e)||e instanceof Array||i=="[object NodeList]"||i=="[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 i={}.toString.call(e),r=Number(!!e&&typeof e!="string"&&this.array(e)&&i!=="[object Text]");if(r&&i!=="[object NodeList]")for(var a of e)r&=Number(this.element(a));return!!r},shadowRoot:function(e){return e instanceof ShadowRoot},date:function(e){return this.number(new Date(e).getTime())},inRange:function(e,i,r,a=!0){return a?i<=e&&e<=r:i<e&&e<r},oneOf:function(e,...i){return i==null?void 0:i.includes(e)}};export{n as Jmini,n as default};
|
|
1
|
+
import{b as T,e as b}from"./chunk-ABA72NWU.js";import{UUID as S}from"./uuid";import"./primitiveExtension";const R=e=>new t.prototype.jmini(e),t=R;t.prototype={},t.extend=function(e,i=t){for(var[r,a]of Object.entries(e))i.prototype[r]=a},t.expando="__jmini_"+S(),t.__classAlias="jmini";const h=(e,i)=>(e.queue.push(i),C(e),e),C=e=>b(void 0,null,function*(){if(e.queueProcess||!e.queue.length)return;e.queueProcess=!0;let i=e.queue.shift();i&&(yield i()),e.queueProcess=!1,C(e)}),d=(e,i)=>{for(let r=0;r<e.length;r++)e[r]=null;for(let[r,a]of Object.entries(i))r.match(/queue/)||(e[r]=a);return e},J=(e,i)=>{if(i.length){for(var r=0;r<i.length;r++){let a=i[r];a&&(a[t.expando]||(t.isElement(a)||t.isShadowRoot(a))&&(a[t.expando]={events:{}})),e[r]=a}e.length=i.length}else e.warn="No Argument(s).",e.length=0;return e.queueProcess=!1,C(e),e};t.extend({constructor:t,__classAlias:t.__classAlias,jmini:function(e){return this.src=e,this.srcType=t.isWhat(e),this.queueProcess=!0,this.queue=[],J(this,t.isJmini(e)?e.get():t.isElement(e)?[e]:t.isElements(e)?e:t.isShadowRoot(e)?[e]:t.isString(e)?e.match(/^#[^\.\s]*$/)?[document.getElementById(e.replace(/#/,""))]:document.querySelectorAll(e):[])}}),t.prototype[String(Symbol.iterator)]=[][Symbol.iterator],t.prototype.jmini.prototype=t.prototype;{const e=function(n,s,o){let l=[];for(let u=0;u<(n.length||0);u++)l.push(s(n[u],u));return o&&(l=l.filter(u=>u!=null)),l},i=n=>(n.for((s,o)=>{if(!(t.isElement(s)||t.isShadowRoot(s)))return;let l=s.cloneNode(),u=s.parentNode;u&&u.replaceChild(l,s),n[o]=l}),n),r=(n,s)=>(t(s).for(o=>{if(n&&(t.isElement(o)||t.isShadowRoot(o)))if(t.isString(n)||t.isNumber(n))n=String(n),o.insertAdjacentHTML("beforeend",String(n));else if(t.isElement(n))o.appendChild(n);else{t.isJmini(n)?n=n.get():t.isElement(n)?n=[n]:t.isRecord(n)&&(n=[t(n)]);for(var l=0;l<n.length;l++)r(n[l],o)}}),s),a=(n,s,...o)=>{let{p:l,s:u}={before:{p:"beforebegin",s:""},after:{p:"afterend",s:"nextSibling"}}[s]||{p:"",s:""};return n.for(c=>{if(t.isString(o[0]))c.insertAdjacentHTML(l,o[0]);else{if(!c.parentNode)return;t(o[0]).for(y=>{o[1]&&(y=y.cloneNode(!0)),c.parentNode.insertBefore(y,c[u]||c)})}}),n};t.extend({get:function(n){return n?this[0]:e(this,s=>s)},for:function(n,s=1){let o=e(this,(l,u)=>n(l,u),1);return s?o:[]},await:function(n){return h(this,()=>new Promise((s,o)=>{setTimeout(()=>{s(this)},n)}))},abort:function(){return h(this,()=>b(this,null,function*(){return this.queue=[],this}))},callback:function(n){return h(this,()=>b(this,null,function*(){return yield n(this),this}))},click:function(){return h(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];t.isElement(s)&&s.click()}return this})},focus:function(){return h(this,()=>{for(var n=0;n<this.length;n++){let s=this[n];t.isElement(s)&&s.focus()}return this})},addEvent:function(n){return h(this,()=>{let{eventType:s,eventID:o=S(),target:l,callback:u,options:c}=n;return c=T({passive:!0,capture:!1},c),this.for(m=>{if(!(t.isElement(m)||t.isShadowRoot(m)))return;let{events:y}=m[t.expando];if(l){let g=u;u=f=>{if(f.target){if(t.isString(l)){let E=f.target.closest(l);E&&(!E||g.call(E,f))}else if(t.isElements(l)){for(let p of l)if(f.target==p)return g.call(p,f)}}}}if(y[o]){let g=y[o];m.removeEventListener(g.eventType,g.callback,g.options)}y[o]={eventType:s,callback:u,options:c},m.addEventListener(s,u,c)}),this})},removeEvent:function(n){return h(this,()=>{let s=t.isArray(n)?n:[n];return this.for(o=>{let{events:l}=o[t.expando];for(let u of s){let c=l[u];c&&o.removeEventListener(c.eventType,c.callback,c.options)}}),this})},html:function(n){return h(this,()=>d(this,r(n,i(this))))},empty:function(){return h(this,()=>d(this,i(this)))},append:function(n){return h(this,()=>{r(n,this)})},remove:function(){return h(this,()=>(this.for((n,s)=>{n&&t.isElement(n)&&(n.remove(),delete this[s])}),this.length=0,this.warn="Object(s?) were all removed.",this))},before:function(...n){return h(this,()=>d(this,a(this,"before",...n)))},after:function(...n){return h(this,()=>d(this,a(this,"after",...n)))},find:function(n){return h(this,()=>{let s=[],o=this[0];o||d(this,t()),(t.isElement(o)||t.isShadowRoot(o))&&(t.isString(n)?s=o.querySelectorAll(n):t.isElement(o)&&t(n).for(l=>{let u=o.childNodes;for(let c of u)if(c===l){s.push(c);break}else c.childNodes.length&&(s=[...s,...t(c).find(l).for(m=>m)])})),d(this,t(s))})},parent:function(n){return h(this,()=>{var o,l;let s=t(n?(o=this[0])==null?void 0:o.closest(n):(l=this[0])==null?void 0:l.parentNode);d(this,s)})},children:function(n){return h(this,()=>{let s=this[0].children;t.isExist(n)&&(n=String(n).replace(/^ : /,""),s=n=="first"?s[0]:n=="last"?s[s.length-1]:s[Number(n)]);let o=t(s);return d(this,o)})},addClass:function(n){return h(this,()=>(n&&this.for(s=>{let o=t.isString(n)?n.split(" "):n;s&&t.isElement(s)&&s.classList.add(...o)}),this))},removeClass:function(n){return h(this,()=>(n&&this.for(s=>{let o=t.isString(n)?n.split(" "):n;s&&t.isElement(s)&&s.classList.remove(...o)}),this))},toggleClass:function(n){return h(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 h(this,()=>(this.for(s=>{if(t.isElement(s))for(let[o,l]of Object.entries(n)){if(t.isNumber(l)&&o.match(/width|height|top|right|bottom|left|padding|margin|gap|border-.*radius/)){s.style[o]=l+"px";continue}s.style[o]=String(l)}}),this))},getAttribute:function(n){return this[0].getAttribute(String(n))},setAttribute:function(n,s){return h(this,()=>(this.for(o=>o.setAttribute(n,s)),this))},getStyleProperty:function(n){let s=this[0];return s&&t.isElement(s)?getComputedStyle(s).getPropertyValue(n):""},setStyleProperty:function(n,s){let o=this[0];return o&&t.isElement(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 t.isElement(this[0])?this[0].getBoundingClientRect():{}}})}t.uniqueArray=(e,i)=>i?Array.from(new Map(e.map(r=>[t.getRecord(r,i||"0"),r])).values()):Array.from(new Set(e)),t.getRecord=(e,i)=>{let r={},a=e;return i.split(".").forEach(n=>{a=a==null?void 0:a[n],r=a}),r},t.Arrayify=t.flatArray=(e,i)=>{if(!t.isArray(e))return[e];let r=[];for(let a of e)r.push(...i=="-R"?t.Arrayify(a,"-R"):[a]);return r},t.Stringify=(...e)=>{let[i,r,a]=e;return JSON.stringify(i,r!=null?r:(()=>{const n=new WeakSet;return(s,o)=>{if(typeof o=="object"&&o!==null){if(n.has(o))return"[Circular Reference]";n.add(o)}return o}})(),a)},t.Objectify=(e,i)=>{try{return JSON.parse(e)}catch(r){return i!=null?i:null}},t.SortifyObject=(e,i)=>{let r={};return!e||!t.isArray(e)&&!t.isRecord(e)?null:(Object.keys(e).sort().forEach(a=>{let n=e[a];if(i){if(t.isRecord(n)){r[a]=t.SortifyObject(n,i);return}if(t.isArray(n)){r[a]=n.map(s=>t.isRecord(s)||t.isArray(s)?t.SortifyObject(s,i):s);return}}r[a]=n}),r)},t.randomNumber=(e=0,i=100,r)=>{if(e>i)return NaN;let a=Math.round(Math.random()*(i-e))+e;return r&&r.length&&r.includes(a)?t.randomNumber(e,i,r):a},t.try=e=>{try{return[e(),!0]}catch(i){return[i,!1]}},t.trySync=e=>b(void 0,null,function*(){try{return[yield e(),!0]}catch(i){return[i,!1]}}),t.scope=e=>e(),t.scopeSync=e=>b(void 0,null,function*(){return yield e()}),t.createElement=function(e){var y;let{tag:i,className:r="",id:a,html:n,attr:s,style:o,parent:l}=e,u=document.createElement(i||"div");if(r&&u.classList.add(...r.split(" ")),a&&(u.id=a),s)for(let g of Object.entries(s)){let f=g[0],p=(y=g[1])!=null?y:"";if(f=="data"&&t.isRecord(p))for(let[E,v]of Object.entries(p))u.dataset[E]=v;else f=="for"?f="htmlFor":f=="tabindex"?f="tabIndex":f=="aria-label"&&(f="ariaLabel"),u[f]=p}if(n&&t(u).append(n),o)for(var[c,m]of Object.entries(o))u.style[c]=m;return l&&t(l).append(u),u},t.setCookie=e=>{let{hostname:i}=new URL(location.toString()),{name:r,value:a="",age:n=60*60*24*365,path:s="/",domain:o=i,secure:l=!1}=e,u=`${r}=${a}max-age=${n}path=${s}domain=${o}`;l&&(u+=" Secure"),document.cookie=u},t.getCookie=e=>{let i=document.cookie.match(new RegExp(e+"=[^]*"));return i?i[0].replace(new RegExp(e+"="),""):""},t.localStorage={set:(e,i)=>{localStorage.setItem(e,t.Stringify(i))},get:e=>{let i=localStorage.getItem(e);return t.Objectify(i,i)}},t.deleteCookie=e=>{document.cookie=e+"=max-age=0"},t.getScreenSize=()=>{let{innerHeight:e,innerWidth:i,scrollY:r,scrollX:a,pageXOffset:n,pageYOffset:s}=window,o=Number(t(document.body).getStyleProperty("--sat").removeLetters()),l=Number(t(document.body).getStyleProperty("--sab").removeLetters());return{height:e,width:i,pageHeight:e-o-l,scrollY:r,scrollX:a,pageXOffset:n,pageYOffset:s,safeAreaTop:o,safeAreaBottom:l}},t.getCursor=e=>{var a,n,s,o,l,u,c,m;let i=(o=e.pageX)!=null?o:(s=(a=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:a.pageX)!=null?s:(((n=e==null?void 0:e.originalEvent)==null?void 0:n.touches)||[])[0].pageX,r=(m=e.pageY)!=null?m:(c=(l=((e==null?void 0:e.changedTouches)||[])[0])==null?void 0:l.pageY)!=null?c:(((u=e==null?void 0:e.originalEvent)==null?void 0:u.touches)||[])[0].pageY;return{x:i,y:r}},t.pending=(e,i)=>{var a;let r=(a=i||Number(e))!=null?a:-1;return new Promise((n,s)=>{t.isFunction(e)&&e(n),!(r<0)&&setTimeout(()=>{n(!0)},r)})},t.deepMerge=(e,...i)=>{if(!i.length)return e;const r=i.shift();if(t.isRecord(e)&&t.isRecord(r))for(const a in r)t.isRecord(r[a])?(e[a]||Object.assign(e,{[a]:{}}),t.deepMerge(e[a],r[a])):Object.assign(e,{[a]:r[a]});return t.deepMerge(e,...i)},t.deepCopy=e=>{if(t.isArray(e))return e.map(i=>t.deepCopy(i));if(t.isRecord(e)){let i={};return Object.entries(e).forEach(([r,a])=>{i[r]=t.deepCopy(a)}),i}return e},t.url={path:{get:e=>{let r=new URL(e||location.href).pathname||"";return r=r.replace(/^\//,"").replace(/\/$/,""),r.split("/")},set:(e,i)=>{const r=new URL(i||location.href);if(t.isString(e))r.pathname=e;else{let a=t.url.path.get();Object.entries(e).forEach(([n,s])=>{a[Number(n)]=s}),r.pathname="/"+a.filter(n=>n!=null).join("/")}return i||history.replaceState({},"",r.pathname+r.search),r.toString()}},search:{get:e=>{let i=new URL(e||location.href),r={};return i.searchParams.forEach((a,n)=>r[n]=a),r},set:(e,i)=>{const r=new URL(i||location.href);return Object.entries(e).forEach(([a,n])=>{r.searchParams.set(a,String(n))}),i||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,i)=>{const r=new URL(i||location.href);return e.forEach(a=>{r.searchParams.delete(a)}),i||history.replaceState({},"",r.pathname+r.search),r.toString()}}},t.queryParams={get:e=>{let i=new URL(e||location.href),r={};return i.searchParams.forEach((a,n)=>r[n]=a),r},set:(e,i)=>{const r=new URL(i||location.href);return Object.entries(e).forEach(([a,n])=>{r.searchParams.set(a,String(n))}),i||history.replaceState({},"",r.pathname+r.search),r.toString()},delete:(e,i)=>{const r=new URL(i||location.href);return e.forEach(a=>{r.searchParams.delete(a)}),i||history.replaceState({},"",r.pathname+r.search),r.toString()}},t.ellipsisText=(e,i)=>{let r=String(e);return r.length>i&&(r=r.slice(0,i)+" ..."),r},t.isEqual=(e,i,r)=>r==null||r?t.Stringify(e)===t.Stringify(i):e===i,t.isExist=e=>e===(e!=null?e:!e),t.isNullish=e=>!t.isExist(e),t.isJmini=e=>{var i,r;return((i=e||{})==null?void 0:i.constructor)===t||((r=e||{})==null?void 0:r.__classAlias)===t.__classAlias},t.isString=e=>typeof e=="string",t.isBoolean=e=>typeof e=="boolean",t.isNumber=e=>!isNaN(e)&&typeof e=="number",t.isArray=e=>{let i={}.toString.call(e);return Array.isArray(e)||e instanceof Array||i=="[object NodeList]"||i=="[object HTMLCollection]"},t.isFunction=e=>typeof e=="function",t.isRecord=e=>({}).toString.call(e)==="[object Object]"&&!t.isJmini(e),t.isElement=e=>e&&(e.nodeType==1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"||[window,document].includes(e)),t.isElements=e=>{let i={}.toString.call(e),r=Number(!!e&&!t.isString(e)&&t.isArray(e)&&i!=="[object Text]");if(r&&t.isArray(e)&&i!=="[object NodeList]")for(var a of e)r&=Number(t.isElement(a));return!!r},t.isShadowRoot=e=>e instanceof ShadowRoot,t.isDate=e=>t.isNumber(new Date(e).getTime()),t.isInRange=(e,i,r,a=!0)=>a?i<=e&&e<=r:i<e&&e<r,t.isOneOf=(e,...i)=>{let r=t.isArray(i),a=t.isRecord(i);return r||a?i.some(n=>t.isEqual(e,n)):i==null?void 0:i.includes(e)},t.isWhat=e=>{let i="other";return t.isJmini(e)?i="jmini":t.isElement(e)?i="element":t.isElements(e)?i="elements":t.isShadowRoot(e)?i="shadowRoot":t.isString(e)?i="string":t.isNumber(e)?i="number":t.isArray(e)?i="array":t.isFunction(e)?i="function":t.isDate(e)?i="date":typeof e=="undefined"?i="undefined":t.isRecord(e)?i="record":e==null?i="null":isNaN(e)&&(i="NaN"),i},t.is={equal:t.isEqual,exist:t.isExist,nullish:t.isNullish,jmini:t.isJmini,string:t.isString,boolean:t.isBoolean,number:t.isNumber,array:t.isArray,function:t.isFunction,record:t.isRecord,element:t.isElement,elements:t.isElements,shadowRoot:t.isShadowRoot,date:t.isDate,inRange:t.isInRange,oneOf:t.isOneOf,what:t.isWhat};export{t as Jmini,t as default};
|
package/esm/extension.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m}from"./chunk-ABA72NWU.js";import o from"./core";o.copyToClipboard=e=>m(void 0,null,function*(){let r="";o.
|
|
1
|
+
import{e as m}from"./chunk-ABA72NWU.js";import o from"./core";o.copyToClipboard=e=>m(void 0,null,function*(){let r="";o.isString(e)?r=e:o.isFunction(e)&&(r=e());let t={ok:!1,body:"NotSupported"};return yield m(void 0,null,function*(){let n;if(navigator.clipboard){if(n=yield navigator.clipboard.writeText(r).then(()=>!0,()=>!1),!n)return}else{let a=document.createElement("input");if(o(document.body).append(a),a.value=r,a.select(),n=document.execCommand("copy"),document.body.removeChild(a),!n)return}t={ok:!0,body:""}}),t}),o.ImageLoader=(e,r)=>{let t;return new Promise((n,a)=>{t=r||new Image,t.onload=()=>n(t),t.onerror=i=>a(i),t.crossOrigin="anonymous",t.src=e})},o.formatCharacter={postal:{JP:e=>{let r="";return e=String(e).replace(/\D/ig,""),e.length==7&&(r=e.replace(/^(\d{3})(.*)/,"$1-$2")),r}},tel:{_:e=>{let r=e;return e=String(e).removeLetters(),e.length==11&&(r=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),e.length==10&&(r=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),r},mobile:e=>{let r="";return e=String(e).removeLetters(),e.length==11&&(r=e.replace(/^(\d{3})(\d{4})(\d{4})/,"$1-$2-$3")),r},fixed:e=>{let r="";return e=String(e).removeLetters(),e.length==10&&(r=e.replace(/^(\d{2})(\d{4})(\d{4})/,"$1-$2-$3")),r}}},o.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 r=[],t=[],n=!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(i=>{let{From:l,To:g,name:d}=i;if(l<=e&&e<=g){let s=e-l+1;s==1&&(n=!0,s="\u5143"),t.push(d+s+"\u5E74"),r.push(d)}}),{era:r,value:t,gap:n}}};
|
package/esm/fetcher.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Records } from 'src';
|
|
2
2
|
declare namespace Fetcher {
|
|
3
3
|
type urlInput = string | URL | globalThis.Request;
|
|
4
4
|
type Input = Omit<RequestInit, 'body'> & {
|
|
@@ -17,7 +17,7 @@ declare namespace Fetcher {
|
|
|
17
17
|
statusText: string;
|
|
18
18
|
requestTime: number;
|
|
19
19
|
rawData: Response;
|
|
20
|
-
additionalBody?:
|
|
20
|
+
additionalBody?: Records<A>;
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
} & ({
|
|
23
23
|
status: 200;
|
|
@@ -45,7 +45,7 @@ declare namespace Fetcher {
|
|
|
45
45
|
onResultCB?(result: Output<any>, params: Input): void;
|
|
46
46
|
onCompleteCB?(result: any): void;
|
|
47
47
|
onRetryCB?(result: any, current_params: Input, _this: Chains): Promise<Input | null>;
|
|
48
|
-
extraBody?:
|
|
48
|
+
extraBody?: Records;
|
|
49
49
|
isRetry: boolean;
|
|
50
50
|
onErrorCB(error: any): void;
|
|
51
51
|
Fetcher: {
|
|
@@ -65,7 +65,7 @@ declare namespace Fetcher {
|
|
|
65
65
|
delete<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
66
66
|
patch<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
67
67
|
options<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E, _A>>;
|
|
68
|
-
setExtraBody(body:
|
|
68
|
+
setExtraBody(body: Records): Chains<R, E, A>;
|
|
69
69
|
send<_R = R, _E = E, _A = A>(): Promise<Output<_R, _E>>;
|
|
70
70
|
abortStream(): void;
|
|
71
71
|
onKeyDuplicate(cb: (retry: Function) => Promise<void>): Chains<R, E, A>;
|
|
@@ -87,7 +87,7 @@ declare namespace Fetcher {
|
|
|
87
87
|
setDefaultTrafficControl: number;
|
|
88
88
|
setDefaultTimeout: number;
|
|
89
89
|
setDefaultHeaders?: () => HeadersInit;
|
|
90
|
-
|
|
90
|
+
safetyRecords(records: Records): Records;
|
|
91
91
|
setDefaultOnStart?: (params: Input, abort: Function) => void;
|
|
92
92
|
setDefaultOnEnd?: (result: Output<any>, params: Input) => void;
|
|
93
93
|
isReadableStream(v: any): boolean;
|
package/esm/fetcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as y,c as O,d as F,e as R,f as k,g as q,h as L}from"./chunk-ABA72NWU.js";import d from"./core";import{UUID as M}from"./uuid";import{useStore as w}from"./useStore";const U=(t,r)=>new e.prototype.Fetcher(t,r),e=U;e.prototype={},e.waitList=[],e.setDefaultTrafficControl=0,e.setDefaultTimeout=1e3*60*10,e.abort=t=>{let r="fetcher.abortController."+t,o=w.get(r);console.log(o),o&&o.abort()},e.safetyRecords=t=>{let r={};return Object.entries(t).forEach(([o,a])=>{if(d.isArray(a)){r[o]=a.join(",");return}else if(d.isRecord(a)){Object.entries(e.safetyRecords(a)).forEach(([n,p])=>{r[`${o}.${n}`]=p});return}r[o]=a}),r},e.isReadableStream=t=>t instanceof ReadableStream,e.isReadableStreamReader=t=>t instanceof ReadableStreamDefaultReader,e.streamToContext=(t,r)=>R(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 a=(r==null?void 0:r.decoder)||new TextDecoder("utf-8");let n=yield o.read();return{ok:!0,done:n.done,data:a.decode(n.value)}}catch(o){return{ok:!1,done:!0,data:o}}});const H=function(t,r){var n;r=r||{};let o=r.body;r.body&&!d.isString(r.body)&&((n=r.bodyStringify)==null||n)&&(o=d.Stringify(r.body||{}));let a=t;return d.isString(t)&&!t.match(/https?:/)&&(a=location.origin+"/"+t.replace(/^\//,"")),this.url=a,this.method=r.method||"get",this.streamStatus="open",this.params=O(y({key:M(),response_format:"json",timeout:e.setDefaultTimeout,trafficControl:e.setDefaultTrafficControl,preventMultiRequest:!0},r),{headers:y(y({"Content-Type":"application/json"},e.setDefaultHeaders&&e.setDefaultHeaders()),r.headers),body:o}),this};d.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=y(y({},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 R(this,null,function*(){let{response:r,errorCB:o,streamCB:a,reader:n,decoder:p}=t,A=r.body,C=this;const b=function(){return q(this,null,function*(){if(!r.ok){d.scope(()=>R(this,null,function*(){let{ok:u,done:s,data:c}=yield e.streamToContext(A,{reader:n,decoder:p});u&&o(c)}));return}let l=!1;for(;!l;){let{ok:u,done:s,data:c}=yield new k(e.streamToContext(A,{reader:n,decoder:p}));C.streamStatus=="abort"?(C.streamStatus="closed",n.cancel(),s=!0):C.streamStatus=="closed"&&(s=!0),s&&(l=s,n.releaseLock()),a(c,s)}})};try{for(var _=L(b()),K,E,S;K=!(E=yield _.next()).done;K=!1){let l=E.value;;}}catch(E){S=[E]}finally{try{K&&(E=_.return)&&(yield E.call(_))}finally{if(S)throw S[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 R(this,null,function*(){var I;let t=this.params,r=performance.now(),v=t,{key:o,response_format:a,trafficControl:n=0,preventMultiRequest:p,timeout:A,queries:C}=v,b=F(v,["key","response_format","trafficControl","preventMultiRequest","timeout","queries"]);b.method=this.method;let _=[this.method,o].join("."),K=e.waitList.includes(_);e.waitList=[...e.waitList,_];let E=!1,S=!1,l=!1,u=500,s="InternalServerError",c={},B=null,g=null;n>0&&(g=d.pending(n));let f=new AbortController,j=setTimeout(()=>{f.abort(),console.log("timeout",A)},t.timeout);b.signal=f.signal,this.abortController=f;let x="fetcher.abortController."+this.params.key;w.set({[x]:f});const D=()=>{E=!0},P=()=>(f.abort(),e.waitList=e.waitList.filter(i=>i!=_),{isCancelled:E,isAborted:S,ok:!1,status:0,statusText:"CANCELLED",body:c,requestTime:0,rawData:null});try{if(e.setDefaultOnStart&&(yield e.setDefaultOnStart(t,D)),this.onStartCB&&(yield this.onStartCB(t,D)),E)return P();if(K){if(this.onKeyDuplicateCB&&(yield this.onKeyDuplicateCB(D)),E)return P();if(p)throw u=429,new Error("TooManyRequests")}let i=d.url.search.set(y({},e.safetyRecords(C||{})),String(this.url));const T=yield fetch(i,b).then(m=>R(this,null,function*(){return l=m.ok,u=m.status,s=m.statusText,B=m,a=="none"||a=="stream"?m:m[a]()})).catch(m=>{throw new Error(m)});w.delete(x),c=T}catch(i){u==200&&(u=500,l=!1),u==429&&(s="TooManyRequests"),f.signal.aborted&&(u=408,s="Timeout",S=!0),u==500&&(s=String(i)||s),c={errorCode:String(i)}}finally{clearTimeout(j)}let h={isCancelled:E,isAborted:S,ok:l,status:u,statusText:s,body:c,additionalBody:this.extraBody,requestTime:performance.now()-r,rawData:B};if(!l){if(this.onRetryCB&&!this.isRetry){this.isRetry=!0;let i=yield this.onRetryCB(h.body,this.params,this);if(i)return e.waitList=e.waitList.filter(T=>T!=_),this.params=i,this.send()}this.onErrorCB&&this.onErrorCB(h.body)}if(l&&this.onStreamCB&&t.response_format=="stream"){let i=(I=B.body)==null?void 0:I.getReader();this.onStreamProcess({errorCB:this.onErrorCB,streamCB:this.onStreamCB,response:h,reader:i,decoder:new TextDecoder("utf-8")})}return yield g,h.requestTime=performance.now()-r,l&&this.onCompleteCB&&this.onCompleteCB(h.body),this.onResultCB&&this.onResultCB(h,t),e.setDefaultOnEnd&&e.setDefaultOnEnd(h,t),e.waitList=e.waitList.filter(i=>i!=_),h})},abortStream:function(){this.streamStatus="abort"}},e),e.prototype.Fetcher.prototype=e.prototype;export{e as Fetcher,e as default};
|
package/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export type IFEXIST<T = any> = T extends infer V ? V : any;
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use Records instead.
|
|
4
|
+
*/
|
|
2
5
|
export interface KeyValueDict<T = any> {
|
|
3
6
|
[key: string]: T | void;
|
|
4
7
|
}
|
|
8
|
+
export interface Records<T = any> {
|
|
9
|
+
[key: string]: T | void;
|
|
10
|
+
}
|
|
5
11
|
import './primitiveExtension';
|
|
6
12
|
import Jmini from './core';
|
|
7
13
|
import { UUID } from './uuid';
|
package/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-ABA72NWU.js";import"./primitiveExtension";import
|
|
1
|
+
import"./chunk-ABA72NWU.js";import"./primitiveExtension";import e from"./core";import{UUID as t}from"./uuid";import{Time as o}from"./time";import{Interval as i}from"./interval";import{Fetcher as r}from"./fetcher";import{Filer as m}from"./filer";import{Server as n}from"./server";import{useStore as a}from"./useStore";export*from"./extension";e.interval=i,r.setDefaultHeaders=()=>({});var v=e;export{r as Fetcher,m as Filer,n as Server,o as Time,t as UUID,v as default,a as useStore};
|
package/esm/interval.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./chunk-ABA72NWU.js";import{useStore as s}from"./useStore";import u from"./core";const h=(...[t,n,r])=>new e.prototype.Interval(t,n,r),e=h;e.prototype={};const p=function(...[t,n,r]){return this.fn=t,this.ms=n,this.key=r,this.isFinished=!1,e.abort(this.key),this.store(),this};u.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:p,store:function(){s.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let t=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(t,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return e.abort(this.timeoutIndex),this},setState:function(t){return Object.entries(t).forEach(([n,r])=>{this.hasOwnProperty(n)&&(this[n]=r)}),this.store(),this}},e),e.abort=t=>{if(u.
|
|
1
|
+
import{e as a}from"./chunk-ABA72NWU.js";import{useStore as s}from"./useStore";import u from"./core";const h=(...[t,n,r])=>new e.prototype.Interval(t,n,r),e=h;e.prototype={};const p=function(...[t,n,r]){return this.fn=t,this.ms=n,this.key=r,this.isFinished=!1,e.abort(this.key),this.store(),this};u.extend({key:"",ms:0,timeoutIndex:-1,fn:null,isFinished:!1,Interval:p,store:function(){s.set({["Interval_"+this.key]:this})},once:function(){if(this.fn){let t=()=>{this.fn&&this.fn(),this.isFinished=!0,this.store()};this.timeoutIndex=setTimeout(t,this.ms)}return this.store(),this},start:function(){return this.fn&&(this.timeoutIndex=setInterval(this.fn,this.ms)),this.store(),this},abort:function(){return e.abort(this.timeoutIndex),this},setState:function(t){return Object.entries(t).forEach(([n,r])=>{this.hasOwnProperty(n)&&(this[n]=r)}),this.store(),this}},e),e.abort=t=>{if(u.isNumber(t))return clearInterval(t);let n=s.get("Interval_"+t);n&&(n&&clearInterval(n.timeoutIndex),n.setState({isFinished:!0}))},e.get=t=>s.get("Interval_"+t),e.once=(t,n,r)=>e(t,n,r).once(),e.series=(t,n)=>a(void 0,null,function*(){return new Promise(r=>{let i=e.get(t);if(i&&!i.isFinished)return r(null);let o=()=>{e.abort(t)};r(o),n&&e(o,n,t).once()})}),e.start=(t,n,r)=>e(t,n,r).start(),e.prototype.Interval.prototype=e.prototype;export{e as Interval,e as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
import {
|
|
2
|
+
import { Records } from '.';
|
|
3
3
|
import { FileReadAsType } from '.';
|
|
4
4
|
declare global {
|
|
5
5
|
interface HTMLElement {
|
|
@@ -41,7 +41,7 @@ declare global {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
declare global {
|
|
44
|
-
interface Array<T =
|
|
44
|
+
interface Array<T = Records> {
|
|
45
45
|
toASC(keys?: keyof T | (keyof T)[] | string[], locales?: Intl.LocalesArgument, localeCompareOptions?: Intl.CollatorOptions): Array<T>;
|
|
46
46
|
toDESC(keys?: keyof T | (keyof T)[] | (string)[], locales?: Intl.LocalesArgument, localeCompareOptions?: Intl.CollatorOptions): Array<T>;
|
|
47
47
|
getSum(...args: (keyof T)[]): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,b as
|
|
1
|
+
import{a as g,b as m,e as b}from"./chunk-ABA72NWU.js";if(typeof HTMLElement!="undefined"&&(HTMLElement.prototype.position=function(){return this.getBoundingClientRect()}),typeof String!="undefined"&&(String.prototype.compress=function(){return this.trim().replace(/(\s|\n|\t)/ig,"")},String.prototype.encode=function(){return encodeURIComponent(this)},String.prototype.decode=function(){return decodeURIComponent(this)},String.prototype.toUpper=function(){return this.toLocaleUpperCase()},String.prototype.toLower=function(){return this.toLocaleLowerCase()},String.prototype.toCapital=function(){let t=this;return t&&(t=t.replace(/^./,this[0].toUpper()).replace(/(\s|_|-)[a-z]{1}/ig,n=>n[1].toUpper())),t},String.prototype.clip=function(t,n){return this.slice(t,n)},String.prototype.partReplace=function(...t){let n="";if(t.length==2){let[e,r]=t;n=[this.slice(0,e),r,this.slice(e+r.length)].join("")}if(t.length==3){let[e,r,i]=t;n=[this.slice(0,e),i,this.slice(e+r)].join("")}return n},String.prototype.toBlob=function(t){let n=atob(this.replace(/^.*,/,"")),e=new Uint8Array(n.length);for(var r=0;r<n.length;r++)e[r]=n.charCodeAt(r);try{var i=new Blob([e.buffer],{type:t})}catch(o){return!1}return i},String.prototype.toNumber=function(){let t=this.replace(/[^\d.-]/g,"").replace(/(-)(?=.*\d)/g,"").replace(/(\d+)\.(\d+)\.(\d+)/g,"$1.$2$3");return Number(t)||0},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(t){return String.fromCharCode(t.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(t){let n=Number(this)<0,e=Math.abs(Number(this));return isNaN(e)?"":(n?"-":"")+String(e).padStart(t||2,"0")},Number.prototype.ratio=function(t,n=2){let e=g(10,n);return Math.round(this/t*e*100)/e},Number.prototype.rate=function(t,n=2){let e=g(10,n);return Math.round(this/t*e)/e},Number.prototype.rank=function(t=1){let n=g(10,t),e=Number(this);if(e<1e3)return String(this);let r=e.toLocaleString().replace(/\d/ig,"").length;return Math.round(e/g(1e3,r)*n)/n+("KMGTPEZY"[r-1]||"")},Number.prototype.rankJp=function(){let t=Number(this),n="";return t>=1e12?n=`${t/1e12}\u5146`:t>=1e8?n=`${t/1e8}\u5104`:t>=1e4?n=`${t/1e4}\u4E07`:t>=1e3?n=`${t/1e3}\u5343`:n=`${t.toLocaleString()}`,n},Number.prototype.toDate=function(t="/"){let n=String(this),e=n.slice(0,4),r=n.slice(4,6),i=n.slice(6,8),o=[];return e.length!=4||o.push(e),r.length!=2||o.push(r),i.length!=2||o.push(i),o.join(t)}),typeof Array!="undefined"){const t=(e,...r)=>{var o;let i=e;for(let s of r){if(s!==(s!=null?s:!s))break;i=(o=(i||{})[s!=null?s:""])!=null?o:null}return i},n=e=>typeof e=="number"&&!isNaN(e);Array.prototype.toASC=function(e,r,i){let o=[];Array.isArray(e)?o.push(...e):e&&(o=[e]),o.length||(o=[""]);let s=[],a=[];for(let l of o){let f=String(l).match(/([^\.\[\]"]+)/g)||"";s.push(f),a.push(this.every(u=>n(Number(t(u,...f)))))}return this.sort((l,f)=>{for(let u=0;u<s.length;u++){let y=s[u]||"",S=a[u],p=t(l,...y),c=t(f,...y);if(S){if(Number(p)>Number(c))return 1;if(Number(p)<Number(c))return-1;continue}if(n(p)&&!n(c))return-1;if(!n(p)&&n(c))return 1;let N=String(p).replace(/(\d+),(\d+)/g,"$1$2").replace(/(\d+)/g,h=>h.padStart(10,"0")),k=String(c).replace(/(\d+),(\d+)/g,"$1$2").replace(/(\d+)/g,h=>h.padStart(10,"0")),d=N.localeCompare(k,r,i);if(d!=0)return d}return 0})},Array.prototype.toDESC=function(...e){return this.toASC(...e).reverse()},Array.prototype.getSum=function(...e){return this.reduce((r,i)=>r+(e?t(i,...e):Number(i)||0),0)},Array.prototype.getAve=function(...e){return this.getSum(...e)/this.length},Array.prototype.getMedian=function(...e){let r=this.map(o=>e?t(o,...e):Number(o)||0);r.sort((o,s)=>o-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(...e){let r=this.map(i=>e?t(i,...e):Number(i)||0);return Math.min(...r)},Array.prototype.getMax=function(...e){let r=this.map(i=>e?t(i,...e):Number(i)||0);return Math.max(...r)},Array.prototype.chunk=function(e){let r=[];for(let i=0;i<this.length;i+=e)r.push(this.slice(i,i+e));return r},Array.prototype.forEachChunk=function(e,r,i){return b(this,null,function*(){let o=[],s=this.chunk(e);if(i)yield Promise.all(s.map((a,l)=>b(this,null,function*(){o[l]=m({ok:!0},yield r(a,l))})));else for(let a=0;a<s.length;a++)o.push(m({ok:!0},yield r(s[a],a)));return[o.every(a=>a.ok),o]})}}typeof File!="undefined"&&(File.prototype.convert=function(t){t=t||"dataURL";let n="readAs"+(t==null?void 0:t.toCapital());return new Promise((e,r)=>{let i=new FileReader;i.onload=o=>{e(i.result)},i.onerror=o=>r(i.error||o),i[n](this)})},File.prototype.clone=function(){return new File([this.slice(0,this.size,this.type)],this.name,{type:this.type,lastModified:this.lastModified})});
|
package/esm/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-ABA72NWU.js";import i from"./core";const A=function(t){let s=t,n=null;return s.use((e,r,o)=>{let h=r;h.return=c=>{let{ok:u,status:a,body:d={},bodyStringify:x=!0}=c||{};a=a!=null?a:(u!=null?u:!0)&&200||403;let R=d;return x&&!i.
|
|
1
|
+
import"./chunk-ABA72NWU.js";import i from"./core";const A=function(t){let s=t,n=null;return s.use((e,r,o)=>{let h=r;h.return=c=>{let{ok:u,status:a,body:d={},bodyStringify:x=!0}=c||{};a=a!=null?a:(u!=null?u:!0)&&200||403;let R=d;return x&&!i.isString(d)&&(R=i.Stringify(d)),r.status(a).end(R)},o()}),s.onPathRouter=function(e){return n=e,this},s.pathRouter=function(e){if(!n)return;let r=n(e);return r.route(e),s.use(e,r),r},s.exception=function(e){return s.use(e),this},s},p=A;p.getLocalIP=t=>{let s="";return i.scope(()=>{if(!t)return;let n=t.networkInterfaces();for(let[e,r]of Object.entries(n))r.forEach(o=>{!o.internal&&o.family==="IPv4"&&!o.address.match(/^(169|127)/)&&(s=o.address)})}),s},p.getIP=function(t){var e;return(((t==null?void 0:t.headers["x-forwarded-for"])||((e=t==null?void 0:t.socket)==null?void 0:e.remoteAddress)||"").toString().match(new RegExp(/(::ffff:)?(\d+\.\d+.\d+\.\d+(:\d+)?)/))||[])[2]||"UNKNOWN IP"};export{p as Server,p as default};
|
package/esm/time.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-ABA72NWU.js";import l from"./core";import{useStore as m}from"./useStore";let f=-new Date().getTimezoneOffset();const c=(e,t)=>new s.prototype.Time(e,t),s=c;s.prototype={},s.__classAlias="jmini.Time";const D=function(e,t){if(t&&(this.localTimezoneOffset=t),s.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0?e=new Date:e===0&&(e=new Date(0))),e&&(l.is.number(e)&&(e=new Date(e)),l.is.string(e)&&(e=String(e).trim().replace(/\//g,"-").replace(/ +|\s+/g," ").replace(/\-+/g,"-"),e=e.replace(/^(\d{4}-\d{2}-\d{2})$/,"$1T00:00:00").replace(/^(\d{4}-\d{2}-\d{2})\s+/,"$1T").replace(/^(\d{4}-\d{2}-\d{2}T\d{2})(:?|:+)$/,"$1:00").replace(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(:?|:+)$/,"$1:00"),e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d{1,3})?$/)))){let a=this.getLocalTimezoneOffset(),n=Math.floor(a/60),r=a%60;n>=0&&(e+="+"),e+=n.zeroEmbed(2),e+=":"+r.zeroEmbed(2)}let i=new Date(String(e));return this.set(i)};l.extend({constructor:s,Time:D,__classAlias:s.__classAlias,value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,warekiYear:-1,wareki:"",warekiLabel:"",year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,localTimezoneOffset:void 0,getLocalTimezoneOffset:function(){var e,t;return(t=(e=this.localTimezoneOffset)!=null?e:m.get("jmini/time/env/localTimezoneOffset"))!=null?t:f},setLocalTimezoneOffset:function(e,t){return this.localTimezoneOffset=e,t&&m.set({"jmini/time/env/localTimezoneOffset":e}),this.set(this.value)},clone:function(){return s(this,this.localTimezoneOffset)},set:function(e){var n;this.value=e;let t=l.is.date(e);if(this.validate=t,l.is.nullish(this.localTimezoneOffset)&&(this.localTimezoneOffset=(n=m.get("jmini/time/env/localTimezoneOffset"))!=null?n:f),!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;let i=e.getTime()+e.getTimezoneOffset()*6e4,a=new Date(i+this.getLocalTimezoneOffset()*60*1e3);this.ms=e.getTime(),this.year=a.getFullYear(),this.month=a.getMonth()+1,this.date=a.getDate(),this.weekday=a.getDay(),this.hours=a.getHours(),this.minutes=a.getMinutes(),this.seconds=a.getSeconds();{let r=this.year||0,o=this.month||0,h=this.date||0,u=Number(r+o.zeroEmbed(2)+h.zeroEmbed(2));u>=20190501?(this.warekiYear=r-2018,this.wareki="REIWA",this.warekiLabel="\u4EE4\u548C"):u>=19890108?(this.warekiYear=r-1988,this.wareki="HEISEI",this.warekiLabel="\u5E73\u6210"):u>=19261225?(this.warekiYear=r-1925,this.wareki="SHOUWA",this.warekiLabel="\u662D\u548C"):u>=19120730?(this.warekiYear=r-1911,this.wareki="TAISHO",this.warekiLabel="\u5927\u6B63"):u>=19680125?(this.warekiYear=r-1867,this.wareki="MEIJI",this.warekiLabel="\u660E\u6CBB"):(this.warekiYear=0,this.wareki="",this.warekiLabel="")}{let r=new Date(this.year,0,1),o=new Date(r.valueOf());o.setDate(o.getDate()-(r.getDay()+1));let h=this.ms-o.getTime(),u=Math.ceil(h/(1e3*60*60*24));this.weekInYear=Math.ceil(u/7)}{let r=new Date(this.year,this.month-1,1),o=new Date(r.valueOf());o.setDate(o.getDate()-(r.getDay()+1));let h=this.ms-o.getTime(),u=Math.ceil(h/(1e3*60*60*24)),d=Math.ceil(u/7);this.weekInMonth=d}{let r=new Date(this.year,this.month,0),o=r.getDay(),h=new Date(new Date(r).setDate(r.getDate()-o));this.isLastWeekInMonth=this.date>=h.getDate()}return this},isPast:function(){let e=s();return this.value.valueOf()<e.value.valueOf()},isSameYear:function(e){let t=s(e);return this.year==t.year},isSameMonth:function(e){let t=s(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=s(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=s(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},isInRange:function(e,t){return!this.validate||!e.validate||!t.validate?!1:this.value>=e.value&&this.value<=t.value},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()),i=t.getDate();t.setDate(1),t.setMonth(e-1);let a=s(t).getLastDayOfMonth();return t.setDate(Math.min(i,a.date)),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,t){if(!this.validate)return"";let i=this;return l.is.exist(t)&&(i=i.clone(),i.setLocalTimezoneOffset(t||0)),e.replace(/\%y/ig,i.year.zeroEmbed(4)).replace(/\%m/ig,i.month.zeroEmbed(2)).replace(/\%d/ig,i.date.zeroEmbed(2)).replace(/\%w/ig,i.weekInYear.zeroEmbed(2)).replace(/\%h/ig,i.hours.zeroEmbed(2)).replace(/\%i/ig,i.minutes.zeroEmbed(2)).replace(/\%s/ig,i.seconds.zeroEmbed(2))},toFormatISO:function(){return this.value.toISOString()},toFormatabbrYMD:function(e,t){if(!this.validate)return"";let i=this.isSameYear(s()),a="%Y/%M/%D";return i&&(a="%M/%D"),e=="JP"&&(a="%Y\u5E74%M\u6708%D\u65E5",i&&(a="%M\u6708%D\u65E5")),this.toFormat(a,t)},toFormatYMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t):""},toFormatYM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708",t):this.toFormat("%Y/%M",t):""},toFormatMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):""},toFormatHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206",t):this.toFormat("%h:%i",t):""},toFormatHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206%s\u79D2",t):this.toFormat("%h:%i:%s",t):""},toFormatYMDHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\u5206",t):this.toFormat("%Y/%M/%D %h:%i",t):""},toFormatYMDHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2",t):this.toFormat("%Y/%M/%D %h:%i:%s",t):""},toLangYMD:function(e,t){if(!this.validate)return"";let i=s(),a=i.diff(this);return a.dates==0?"\u4ECA\u65E5":a.dates==1?"\u6628\u65E5":a.dates>=-7&&a.dates<0?-1*a.dates+"\u65E5\u5F8C":a.dates<=7&&a.dates>0?a.dates+"\u65E5\u524D":this.isSameYear(i)?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t)},setFirstOfDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfDay: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"),[i,a]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(i)),n.setMinutes(Number(a)),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"),[i,a,n]=t.split(":"),r=new Date(this.value.valueOf());return r.setHours(Number(i)),r.setMinutes(Number(a)),r.setSeconds(Number(n)),this.set(r)},getFirstDayOfYear:function(){return s(new Date(this.value.getFullYear(),0,1))},getLastDayOfYear:function(){return s(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfMonth:function(){return s(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfMonth:function(){return s(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfWeek:function(){let e=s(this.value);return e.addDate(-e.weekday)},getLastDayOfWeek:function(){let e=s(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:l.scope(()=>{let t=864e5,i=this.clone().setFirstOfDay(),a=e.clone().setFirstOfDay();return Math.floor((i.ms-a.ms)/t)}),hours:l.scope(()=>{let t=36e5,i=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),a=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((i.ms-a.ms)/t)}),minutes:l.scope(()=>{let t=6e4,i=this.clone().setSeconds(0).setMilliseconds(0),a=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((i.ms-a.ms)/t)}),seconds:l.scope(()=>{let t=this.clone().setMilliseconds(0),i=e.clone().setMilliseconds(0);return Math.floor((t.ms-i.ms)/1e3)}),ms:this.ms-e.ms}},getAge:function(e){let t=e||s(),i=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&i--,i}},s),s.isTimeObject=e=>{var t,i;return((t=e||{})==null?void 0:t.constructor)===s||((i=e||{})==null?void 0:i.__classAlias)===s.__classAlias},s.getFromNumberYYYYMMDD=e=>{let t=Number(e).zeroEmbed(8).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return s(t+" 00:00:00")},s.getShortYMDs=(e,t)=>{let i="",a="";return e.year==t.year&&e.year==s().year?i=e.toFormatMD():i=e.toFormatYMD(),e.year!=t.year?a=t.toFormatYMD():a=t.toFormatMD(),[i,a]},s.getPeriodArray=(e,t,i)=>{let a=[],n=t;if(!t.validate||!i.validate)return a;for(e=="year"?n=s(n).setMonth(1).setDate(1).setFirstOfDay():e=="month"?n=s(n).setDate(1):e=="week"?n=s(n).getFirstDayOfWeek():e=="day"?n=s(n).setFirstOfDay():e=="hours"?n=s(n).setMinutes(0).setSeconds(0).setMilliseconds(0):e=="minutes"?n=s(n).setSeconds(0).setMilliseconds(0):e=="seconds"&&(n=s(n).setMilliseconds(0));n.toFormatYMDHMS().toNumber()<=i.toFormatYMDHMS().toNumber();)a.push(n),e=="year"?n=s(n).addYear(1):e=="month"?n=s(n).addMonth(1):e=="week"?n=s(n).addWeek(1):e=="day"?n=s(n).addDate(1):e=="hours"?n=s(n).addHours(1):e=="minutes"?n=s(n).addMinutes(1):e=="seconds"&&(n=s(n).addSeconds(1));return a},s.prototype.Time.prototype=s.prototype;export{s as Time,s as default};
|
|
1
|
+
import"./chunk-ABA72NWU.js";import l from"./core";import{useStore as m}from"./useStore";let f=-new Date().getTimezoneOffset();const c=(e,t)=>new s.prototype.Time(e,t),s=c;s.prototype={},s.__classAlias="jmini.Time";const D=function(e,t){if(t&&(this.localTimezoneOffset=t),s.isTimeObject(e)&&(e=e.value),e||(e===null?e=void 0:e===void 0?e=new Date:e===0&&(e=new Date(0))),e&&(l.isNumber(e)&&(e=new Date(e)),l.isString(e)&&(e=String(e).trim().replace(/\//g,"-").replace(/ +|\s+/g," ").replace(/\-+/g,"-"),e=e.replace(/^(\d{4}-\d{2}-\d{2})$/,"$1T00:00:00").replace(/^(\d{4}-\d{2}-\d{2})\s+/,"$1T").replace(/^(\d{4}-\d{2}-\d{2}T\d{2})(:?|:+)$/,"$1:00").replace(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(:?|:+)$/,"$1:00"),e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d{1,3})?$/)))){let a=this.getLocalTimezoneOffset(),n=Math.floor(a/60),r=a%60;n>=0&&(e+="+"),e+=n.zeroEmbed(2),e+=":"+r.zeroEmbed(2)}let i=new Date(String(e));return this.set(i)};l.extend({constructor:s,Time:D,__classAlias:s.__classAlias,value:new Date,validate:!1,ms:-1,weekday:-1,weekInMonth:-1,weekInYear:-1,isLastWeekInMonth:!1,warekiYear:-1,wareki:"",warekiLabel:"",year:-1,month:-1,date:-1,hours:-1,minutes:-1,seconds:-1,localTimezoneOffset:void 0,getLocalTimezoneOffset:function(){var e,t;return(t=(e=this.localTimezoneOffset)!=null?e:m.get("jmini/time/env/localTimezoneOffset"))!=null?t:f},setLocalTimezoneOffset:function(e,t){return this.localTimezoneOffset=e,t&&m.set({"jmini/time/env/localTimezoneOffset":e}),this.set(this.value)},clone:function(){return s(this,this.localTimezoneOffset)},set:function(e){var n;this.value=e;let t=l.isDate(e);if(this.validate=t,l.isNullish(this.localTimezoneOffset)&&(this.localTimezoneOffset=(n=m.get("jmini/time/env/localTimezoneOffset"))!=null?n:f),!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;let i=e.getTime()+e.getTimezoneOffset()*6e4,a=new Date(i+this.getLocalTimezoneOffset()*60*1e3);this.ms=e.getTime(),this.year=a.getFullYear(),this.month=a.getMonth()+1,this.date=a.getDate(),this.weekday=a.getDay(),this.hours=a.getHours(),this.minutes=a.getMinutes(),this.seconds=a.getSeconds();{let r=this.year||0,o=this.month||0,h=this.date||0,u=Number(r+o.zeroEmbed(2)+h.zeroEmbed(2));u>=20190501?(this.warekiYear=r-2018,this.wareki="REIWA",this.warekiLabel="\u4EE4\u548C"):u>=19890108?(this.warekiYear=r-1988,this.wareki="HEISEI",this.warekiLabel="\u5E73\u6210"):u>=19261225?(this.warekiYear=r-1925,this.wareki="SHOUWA",this.warekiLabel="\u662D\u548C"):u>=19120730?(this.warekiYear=r-1911,this.wareki="TAISHO",this.warekiLabel="\u5927\u6B63"):u>=19680125?(this.warekiYear=r-1867,this.wareki="MEIJI",this.warekiLabel="\u660E\u6CBB"):(this.warekiYear=0,this.wareki="",this.warekiLabel="")}{let r=new Date(this.year,0,1),o=new Date(r.valueOf());o.setDate(o.getDate()-(r.getDay()+1));let h=this.ms-o.getTime(),u=Math.ceil(h/(1e3*60*60*24));this.weekInYear=Math.ceil(u/7)}{let r=new Date(this.year,this.month-1,1),o=new Date(r.valueOf());o.setDate(o.getDate()-(r.getDay()+1));let h=this.ms-o.getTime(),u=Math.ceil(h/(1e3*60*60*24)),d=Math.ceil(u/7);this.weekInMonth=d}{let r=new Date(this.year,this.month,0),o=r.getDay(),h=new Date(new Date(r).setDate(r.getDate()-o));this.isLastWeekInMonth=this.date>=h.getDate()}return this},isPast:function(){let e=s();return this.value.valueOf()<e.value.valueOf()},isSameYear:function(e){let t=s(e);return this.year==t.year},isSameMonth:function(e){let t=s(e);return this.year==t.year&&this.month==t.month},isSameWeek:function(e){let t=s(e);return this.year==t.year&&this.weekInYear==t.weekInYear},isSameDate:function(e){let t=s(e);return this.year==t.year&&this.month==t.month&&this.date==t.date},isInRange:function(e,t){return!this.validate||!e.validate||!t.validate?!1:this.value>=e.value&&this.value<=t.value},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()),i=t.getDate();t.setDate(1),t.setMonth(e-1);let a=s(t).getLastDayOfMonth();return t.setDate(Math.min(i,a.date)),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,t){if(!this.validate)return"";let i=this;return l.isExist(t)&&(i=i.clone(),i.setLocalTimezoneOffset(t||0)),e.replace(/\%y/ig,i.year.zeroEmbed(4)).replace(/\%m/ig,i.month.zeroEmbed(2)).replace(/\%d/ig,i.date.zeroEmbed(2)).replace(/\%w/ig,i.weekInYear.zeroEmbed(2)).replace(/\%h/ig,i.hours.zeroEmbed(2)).replace(/\%i/ig,i.minutes.zeroEmbed(2)).replace(/\%s/ig,i.seconds.zeroEmbed(2))},toFormatISO:function(){return this.value.toISOString()},toFormatabbrYMD:function(e,t){if(!this.validate)return"";let i=this.isSameYear(s()),a="%Y/%M/%D";return i&&(a="%M/%D"),e=="JP"&&(a="%Y\u5E74%M\u6708%D\u65E5",i&&(a="%M\u6708%D\u65E5")),this.toFormat(a,t)},toFormatYMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t):""},toFormatYM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708",t):this.toFormat("%Y/%M",t):""},toFormatMD:function(e,t){return this.validate?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):""},toFormatHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206",t):this.toFormat("%h:%i",t):""},toFormatHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%h\u6642%i\u5206%s\u79D2",t):this.toFormat("%h:%i:%s",t):""},toFormatYMDHM:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%i\u5206",t):this.toFormat("%Y/%M/%D %h:%i",t):""},toFormatYMDHMS:function(e,t){return this.validate?e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5%h\u6642%m\u5206%s\u79D2",t):this.toFormat("%Y/%M/%D %h:%i:%s",t):""},toLangYMD:function(e,t){if(!this.validate)return"";let i=s(),a=i.diff(this);return a.dates==0?"\u4ECA\u65E5":a.dates==1?"\u6628\u65E5":a.dates>=-7&&a.dates<0?-1*a.dates+"\u65E5\u5F8C":a.dates<=7&&a.dates>0?a.dates+"\u65E5\u524D":this.isSameYear(i)?e=="JP"?this.toFormat("%M\u6708%D\u65E5",t):this.toFormat("%M/%D",t):e=="JP"?this.toFormat("%Y\u5E74%M\u6708%D\u65E5",t):this.toFormat("%Y/%M/%D",t)},setFirstOfDay:function(){let e=new Date(this.value.valueOf());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),this.set(e)},setLastOfDay: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"),[i,a]=t.split(":"),n=new Date(this.value.valueOf());return n.setHours(Number(i)),n.setMinutes(Number(a)),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"),[i,a,n]=t.split(":"),r=new Date(this.value.valueOf());return r.setHours(Number(i)),r.setMinutes(Number(a)),r.setSeconds(Number(n)),this.set(r)},getFirstDayOfYear:function(){return s(new Date(this.value.getFullYear(),0,1))},getLastDayOfYear:function(){return s(new Date(this.value.getFullYear()+1,0,0))},getFirstDayOfMonth:function(){return s(new Date(this.value.getFullYear(),this.month-1,1))},getLastDayOfMonth:function(){return s(new Date(this.value.getFullYear(),this.month,0))},getFirstDayOfWeek:function(){let e=s(this.value);return e.addDate(-e.weekday)},getLastDayOfWeek:function(){let e=s(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:l.scope(()=>{let t=864e5,i=this.clone().setFirstOfDay(),a=e.clone().setFirstOfDay();return Math.floor((i.ms-a.ms)/t)}),hours:l.scope(()=>{let t=36e5,i=this.clone().setMinutes(0).setSeconds(0).setMilliseconds(0),a=e.clone().setMinutes(0).setSeconds(0).setMilliseconds(0);return Math.floor((i.ms-a.ms)/t)}),minutes:l.scope(()=>{let t=6e4,i=this.clone().setSeconds(0).setMilliseconds(0),a=e.clone().setSeconds(0).setMilliseconds(0);return Math.floor((i.ms-a.ms)/t)}),seconds:l.scope(()=>{let t=this.clone().setMilliseconds(0),i=e.clone().setMilliseconds(0);return Math.floor((t.ms-i.ms)/1e3)}),ms:this.ms-e.ms}},getAge:function(e){let t=e||s(),i=t.year-this.year;return(this.month>t.month||this.month==t.month&&t.date<this.date)&&i--,i}},s),s.isTimeObject=e=>{var t,i;return((t=e||{})==null?void 0:t.constructor)===s||((i=e||{})==null?void 0:i.__classAlias)===s.__classAlias},s.getFromNumberYYYYMMDD=e=>{let t=Number(e).zeroEmbed(8).replace(/(\d{4})(\d{2})(\d{2})/,"$1/$2/$3");return s(t+" 00:00:00")},s.getShortYMDs=(e,t)=>{let i="",a="";return e.year==t.year&&e.year==s().year?i=e.toFormatMD():i=e.toFormatYMD(),e.year!=t.year?a=t.toFormatYMD():a=t.toFormatMD(),[i,a]},s.getPeriodArray=(e,t,i)=>{let a=[],n=t;if(!t.validate||!i.validate)return a;for(e=="year"?n=s(n).setMonth(1).setDate(1).setFirstOfDay():e=="month"?n=s(n).setDate(1):e=="week"?n=s(n).getFirstDayOfWeek():e=="day"?n=s(n).setFirstOfDay():e=="hours"?n=s(n).setMinutes(0).setSeconds(0).setMilliseconds(0):e=="minutes"?n=s(n).setSeconds(0).setMilliseconds(0):e=="seconds"&&(n=s(n).setMilliseconds(0));n.toFormatYMDHMS().toNumber()<=i.toFormatYMDHMS().toNumber();)a.push(n),e=="year"?n=s(n).addYear(1):e=="month"?n=s(n).addMonth(1):e=="week"?n=s(n).addWeek(1):e=="day"?n=s(n).addDate(1):e=="hours"?n=s(n).addHours(1):e=="minutes"?n=s(n).addMinutes(1):e=="seconds"&&(n=s(n).addSeconds(1));return a},s.prototype.Time.prototype=s.prototype;export{s as Time,s as default};
|
package/esm/useStore.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Records } from '.';
|
|
2
2
|
declare namespace useStore {
|
|
3
3
|
type Methods = {
|
|
4
|
-
set(p:
|
|
5
|
-
update(p:
|
|
4
|
+
set(p: Records, privateKey?: string): boolean;
|
|
5
|
+
update(p: Records, privateKey?: string): boolean;
|
|
6
6
|
get<T = any>(key: string, privateKey?: string): T | undefined;
|
|
7
7
|
delete(key: string, privateKey?: string): boolean;
|
|
8
8
|
};
|
package/esm/useStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as
|
|
1
|
+
import{b as n,c as l}from"./chunk-ABA72NWU.js";const t={},u={set:(r,s)=>{let e=!0;return Object.entries(r).forEach(([a,o])=>{let i=t[a]||{};i&&i.privateKey&&i.privateKey!=s&&(e=!1),t[a]={privateKey:s,value:o}}),e},update:(r,s)=>{let e=!0;return Object.entries(r).forEach(([a,o])=>{var p;let i=t[a]||{};i&&i.privateKey&&i.privateKey!=s&&(e=!1),t[a]=l(n({},t[a]),{value:n(n({},(p=t[a])==null?void 0:p.value),o)})}),e},get:(r,s)=>{let e=t[r];if(!(e&&e.privateKey&&e.privateKey!=s))return e==null?void 0:e.value},delete:(r,s)=>{let e=t[r];return e&&e.privateKey&&e.privateKey!=s?!1:(delete t[r],!0)}};export{u as default,u as useStore};
|