cotomy 0.1.1 → 0.1.3
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/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export { CotomyInvalidFormDataBodyException, CotomyResponseJsonParseException, CotomyRestApi, CotomyRestApiResponse, CotomyViewRenderer } from "./api";
|
|
2
|
+
export { CotomyActionEvent, CotomyApiForm, CotomyFillApiForm, CotomyFormBase, CotomyQueryForm } from "./form";
|
|
3
|
+
export { CotomyPageController, CotomyUrl } from "./page";
|
|
4
|
+
export { CotomyElement, CotomyMetaElement, CotomyWindow } from "./view";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Cotomy=t():e.Cotomy=t()}(this,()=>(()=>{"use strict";var e={};return e.default})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Cotomy=e():t.Cotomy=e()}(this,()=>(()=>{var t={48:t=>{var e,n="undefined"!=typeof window&&(window.crypto||window.msCrypto)||"undefined"!=typeof self&&self.crypto;if(n){var r=Math.pow(2,32)-1;e=function(){return Math.abs(n.getRandomValues(new Uint32Array(1))[0]/r)}}else e=Math.random;t.exports=e},146:(t,e,n)=>{var r=n(473),i="object"==typeof window?window:self,s=Object.keys(i).length,a=r(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+s.toString(36),4);t.exports=function(){return a}},353:function(t){t.exports=function(){"use strict";var t=6e4,e=36e5,n="millisecond",r="second",i="minute",s="hour",a="day",o="week",l="month",u="quarter",h="year",E="date",c="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},g=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},p={s:g,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+g(r,2,"0")+":"+g(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,l),s=n-i<0,a=e.clone().add(r+(s?-1:1),l);return+(-(r+(n-i)/(s?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:l,y:h,w:o,d:a,D:E,h:s,m:i,s:r,ms:n,Q:u}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},R="en",f={};f[R]=T;var A="$isDayjsObject",O=function(t){return t instanceof N||!(!t||!t[A])},D=function t(e,n,r){var i;if(!e)return R;if("string"==typeof e){var s=e.toLowerCase();f[s]&&(i=s),n&&(f[s]=n,i=s);var a=e.split("-");if(!i&&a.length>1)return t(a[0])}else{var o=e.name;f[o]=e,i=o}return!r&&i&&(R=i),i||!r&&R},S=function(t,e){if(O(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new N(n)},_=p;_.l=D,_.i=O,_.w=function(t,e){return S(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var N=function(){function T(t){this.$L=D(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[A]=!0}var g=T.prototype;return g.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(_.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(d);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},g.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},g.$utils=function(){return _},g.isValid=function(){return!(this.$d.toString()===c)},g.isSame=function(t,e){var n=S(t);return this.startOf(e)<=n&&n<=this.endOf(e)},g.isAfter=function(t,e){return S(t)<this.startOf(e)},g.isBefore=function(t,e){return this.endOf(e)<S(t)},g.$g=function(t,e,n){return _.u(t)?this[e]:this.set(n,t)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(t,e){var n=this,u=!!_.u(e)||e,c=_.p(t),d=function(t,e){var r=_.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return u?r:r.endOf(a)},m=function(t,e){return _.w(n.toDate()[t].apply(n.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},T=this.$W,g=this.$M,p=this.$D,R="set"+(this.$u?"UTC":"");switch(c){case h:return u?d(1,0):d(31,11);case l:return u?d(1,g):d(0,g+1);case o:var f=this.$locale().weekStart||0,A=(T<f?T+7:T)-f;return d(u?p-A:p+(6-A),g);case a:case E:return m(R+"Hours",0);case s:return m(R+"Minutes",1);case i:return m(R+"Seconds",2);case r:return m(R+"Milliseconds",3);default:return this.clone()}},g.endOf=function(t){return this.startOf(t,!1)},g.$set=function(t,e){var o,u=_.p(t),c="set"+(this.$u?"UTC":""),d=(o={},o[a]=c+"Date",o[E]=c+"Date",o[l]=c+"Month",o[h]=c+"FullYear",o[s]=c+"Hours",o[i]=c+"Minutes",o[r]=c+"Seconds",o[n]=c+"Milliseconds",o)[u],m=u===a?this.$D+(e-this.$W):e;if(u===l||u===h){var T=this.clone().set(E,1);T.$d[d](m),T.init(),this.$d=T.set(E,Math.min(this.$D,T.daysInMonth())).$d}else d&&this.$d[d](m);return this.init(),this},g.set=function(t,e){return this.clone().$set(t,e)},g.get=function(t){return this[_.p(t)]()},g.add=function(n,u){var E,c=this;n=Number(n);var d=_.p(u),m=function(t){var e=S(c);return _.w(e.date(e.date()+Math.round(t*n)),c)};if(d===l)return this.set(l,this.$M+n);if(d===h)return this.set(h,this.$y+n);if(d===a)return m(1);if(d===o)return m(7);var T=(E={},E[i]=t,E[s]=e,E[r]=1e3,E)[d]||1,g=this.$d.getTime()+n*T;return _.w(g,this)},g.subtract=function(t,e){return this.add(-1*t,e)},g.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||c;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=_.z(this),s=this.$H,a=this.$m,o=this.$M,l=n.weekdays,u=n.months,h=n.meridiem,E=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return _.s(s%12||12,t,"0")},T=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return _.s(e.$y,4,"0");case"M":return o+1;case"MM":return _.s(o+1,2,"0");case"MMM":return E(n.monthsShort,o,u,3);case"MMMM":return E(u,o);case"D":return e.$D;case"DD":return _.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return E(n.weekdaysMin,e.$W,l,2);case"ddd":return E(n.weekdaysShort,e.$W,l,3);case"dddd":return l[e.$W];case"H":return String(s);case"HH":return _.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return T(s,a,!0);case"A":return T(s,a,!1);case"m":return String(a);case"mm":return _.s(a,2,"0");case"s":return String(e.$s);case"ss":return _.s(e.$s,2,"0");case"SSS":return _.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")})},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(n,E,c){var d,m=this,T=_.p(E),g=S(n),p=(g.utcOffset()-this.utcOffset())*t,R=this-g,f=function(){return _.m(m,g)};switch(T){case h:d=f()/12;break;case l:d=f();break;case u:d=f()/3;break;case o:d=(R-p)/6048e5;break;case a:d=(R-p)/864e5;break;case s:d=R/e;break;case i:d=R/t;break;case r:d=R/1e3;break;default:d=R}return c?d:_.a(d)},g.daysInMonth=function(){return this.endOf(l).$D},g.$locale=function(){return f[this.$L]},g.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=D(t,e,!0);return r&&(n.$L=r),n},g.clone=function(){return _.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},T}(),I=N.prototype;return S.prototype=I,[["$ms",n],["$s",r],["$m",i],["$H",s],["$W",a],["$M",l],["$y",h],["$D",E]].forEach(function(t){I[t[1]]=function(e){return this.$g(e,t[0],t[1])}}),S.extend=function(t,e){return t.$i||(t(e,N,S),t.$i=!0),S},S.locale=D,S.isDayjs=O,S.unix=function(t){return S(1e3*t)},S.en=f[R],S.Ls=f,S.p={},S}()},473:t=>{t.exports=function(t,e){var n="000000000"+t;return n.substr(n.length-e)}},584:(t,e,n)=>{var r=n(146),i=n(473),s=n(48),a=0,o=Math.pow(36,4);function l(){return i((s()*o|0).toString(36),4)}function u(){return a=a<o?a:0,++a-1}function h(){return"c"+(new Date).getTime().toString(36)+i(u().toString(36),4)+r()+(l()+l())}h.slug=function(){var t=(new Date).getTime().toString(36),e=u().toString(36).slice(-4),n=r().slice(0,1)+r().slice(-1),i=l().slice(-2);return t.slice(-2)+e+n+i},h.isCuid=function(t){return"string"==typeof t&&!!t.startsWith("c")},h.isSlug=function(t){if("string"!=typeof t)return!1;var e=t.length;return e>=7&&e<=10},h.fingerprint=r,t.exports=h},831:t=>{t.exports={AD:"EUR",AE:"AED",AF:"AFN",AG:"XCD",AI:"XCD",AL:"ALL",AM:"AMD",AO:"AOA",AQ:"EUR",AR:"ARS",AS:"USD",AT:"EUR",AU:"AUD",AW:"AWG",AX:"EUR",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BF:"XOF",BG:"BGN",BH:"BHD",BI:"BIF",BJ:"XOF",BL:"EUR",BM:"BMD",BN:"BND",BO:"BOB",BQ:"USD",BR:"BRL",BS:"BSD",BT:"BTN",BV:"NOK",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CC:"AUD",CD:"CDF",CF:"XAF",CG:"XAF",CH:"CHF",CI:"XOF",CK:"NZD",CL:"CLP",CM:"XAF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CW:"ANG",CX:"AUD",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DM:"XCD",DO:"DOP",DZ:"DZD",EC:"USD",EE:"EUR",EG:"EGP",EH:"MAD",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FM:"USD",FO:"DKK",FR:"EUR",GA:"XAF",GB:"GBP",GD:"XCD",GE:"GEL",GF:"EUR",GG:"GBP",GH:"GHS",GI:"GIP",GL:"DKK",GM:"GMD",GN:"GNF",GP:"EUR",GQ:"XAF",GR:"EUR",GS:"GBP",GT:"GTQ",GU:"USD",GW:"XOF",GY:"GYD",HK:"HKD",HM:"AUD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IM:"GBP",IN:"INR",IO:"USD",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JE:"GBP",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KI:"AUD",KM:"KMF",KN:"XCD",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LC:"XCD",LI:"CHF",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MF:"EUR",MG:"MGA",MH:"USD",MK:"MKD",ML:"XOF",MM:"MMK",MN:"MNT",MO:"MOP",MP:"USD",MQ:"EUR",MR:"MRU",MS:"XCD",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NC:"XPF",NE:"XOF",NF:"AUD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NR:"AUD",NU:"NZD",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PF:"XPF",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PM:"EUR",PN:"NZD",PR:"USD",PS:"ILS",PT:"EUR",PW:"USD",PY:"PYG",QA:"QAR",RE:"EUR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SJ:"NOK",SK:"EUR",SL:"SLE",SM:"EUR",SN:"XOF",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"SVC",SX:"ANG",SY:"SYP",SZ:"SZL",TC:"USD",TD:"XAF",TF:"EUR",TG:"XOF",TH:"THB",TJ:"TJS",TK:"NZD",TL:"USD",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TV:"AUD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",UM:"USD",US:"USD",UY:"UYU",UZ:"UZS",VA:"EUR",VC:"XCD",VE:"VED",VG:"USD",VI:"USD",VN:"VND",VU:"VUV",WF:"XPF",WS:"WST",YE:"YER",YT:"EUR",ZA:"ZAR",ZM:"ZMW",ZW:"ZWG"}},869:(t,e,n)=>{var r=n(831);e.getCurrency=function(t){var e,n,i=(e=t,n=e.split("_"),2==n.length||2==(n=e.split("-")).length?n.pop():e).toUpperCase();return i in r?r[i]:null},e.getLocales=function(t){t=t.toUpperCase();var e=[];for(var n in r)r[n]===t&&e.push(n);return e}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var s=e[r]={exports:{}};return t[r].call(s.exports,s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};return(()=>{"use strict";var t,e=n(353),r=n.n(e);!function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLY_HINTS=103]="EARLY_HINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",t[t.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.IM_A_TEAPOT=418]="IM_A_TEAPOT",t[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",t[t.METHOD_FAILURE=420]="METHOD_FAILURE",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"}(t||(t={})),n(869);var i=n(584),s=n.n(i);class a{static createHTMLElement(t){const e=(new DOMParser).parseFromString(t,"text/html");if(0===e.body.childNodes.length)throw new Error("Invalid HTML string provided.");return e.body.firstChild}static create(t,e=a){return new e(a.createHTMLElement(t))}static first(t,e=a){const n=document.querySelector(t);return n?new e(n):a.empty(e)}static find(t,e=a){const n=document.querySelectorAll(t);return Array.from(n).map(t=>new e(t))}static byId(t,e=a){return a.first(`#${t}`,e)}static contains(t){return null!==document.querySelector(t)}static empty(t=a){return new t(document.createElement("div")).setAttribute("data-empty","").setElementStyle("display","none")}constructor(t,e=null){this._parentElement=null,this._removed=!1,this._scopeId=null,this._element=t instanceof HTMLElement?t:a.createHTMLElement(t),this.removed(()=>{this._element=document.createElement("div")}),e&&this.useScopedCss(e)}get scopeId(){return this._scopeId||(this._scopeId=`_${s()()}`,this.setAttribute(this._scopeId,"")),this._scopeId}get scopedSelector(){return`[${this.scopeId}]`}get stylable(){return!["script","style","link","meta"].includes(this.tagname)}useScopedCss(t){if(t&&this.stylable){const e=`css-${this.scopeId}`;a.find(`#${e}`).forEach(t=>t.remove());const n=document.createElement("style"),r=t.replace(/\[scope\]/g,`[${this.scopeId}]`),i=document.createTextNode(r);n.appendChild(i),n.id=e,a.first("head").append(new a(n)),this.removed(()=>{a.find(`#${e}`).forEach(t=>t.remove())})}return this}listenLayoutEvents(){return this.setAttribute(a.LISTEN_LAYOUT_EVENTS_ATTRIBUTE,""),this}get id(){return this.attribute("id")}setId(t){return this.setAttribute("id",t),this}get element(){return this._element}get tagname(){return this.element.tagName.toLowerCase()}is(t){const e=t.split(/\s+(?![^\[]*\])|(?<=\>)\s+/);let n=this.element;for(let t=e.length-1;t>=0;t--){let r=e[t].trim(),i=!1;if(r.startsWith(">")&&(i=!0,r=r.slice(1).trim()),!n||!n.matches(r))return!1;if(i)n=n.parentElement;else if(t>0)for(;n&&!n.matches(e[t-1].trim());)n=n.parentElement}return!0}get empty(){return this.hasAttribute("data-empty")}get attached(){return document.contains(this.element)}get readonly(){return"readOnly"in this.element?this.element.readOnly:this.element.hasAttribute("readonly")}set readonly(t){"readOnly"in this.element?this.element.readOnly=t:t?this.setAttribute("readonly","readonly"):this.removeAttribute("readonly")}get value(){return"value"in this.element?this.element.value:this.attribute("data-value")??""}set value(t){"value"in this.element?this.element.value=t:this.setAttribute("data-value",t)}get text(){return this.element.textContent??""}set text(t){this.element.textContent=t??""}get html(){return this.element.innerHTML}set html(t){this.element.innerHTML=t}convertUtcToLocal(t="YYYY-MM-DD HH:mm",e=!0){if(this.hasClass("utc")){if(""===this.text.trim())return this;const e=/[+-]\d{2}:\d{2}$/.test(this.text),n=new Date(this.text+(e?"":"Z"));this.text=isNaN(n.getTime())?"":r()(n).format(t),this.removeClass("utc")}if("datetime-local"===this.attribute("type")){const e=/[+-]\d{2}:\d{2}$/.test(this.value),n=new Date(this.value+(e?"":"Z"));this.value=isNaN(n.getTime())?"":r()(n).format(t)}return e&&this.find(".utc").forEach(n=>{n.convertUtcToLocal(t,e)}),this}setFocus(){this.element.focus()}get visible(){if(!this.attached)return!1;if(!this.element.offsetParent&&!document.contains(this.element))return!1;const t=this.element.getBoundingClientRect();if(t.width>0&&t.height>0){const t=this.computedStyle;return"none"!==t.display&&"hidden"!==t.visibility&&"collapse"!==t.visibility}return!1}get enabled(){return!(this.element.hasAttribute("disabled")&&null!==this.element.getAttribute("disabled"))}set enabled(t){t?this.element.removeAttribute("disabled"):this.element.setAttribute("disabled","disabled")}remove(){this._removed||(this._element.remove(),this._element=document.createElement("div"))}clone(){return new a(document.createElement(this.tagname))}clean(){this.find("*").forEach(t=>t.remove())}get width(){return this.element.offsetWidth}set width(t){let e=t.toString()+"px";this.setElementStyle("width",e)}get height(){return this.element.offsetHeight}set height(t){let e=t.toString()+"px";this.setElementStyle("height",e)}get innerWidth(){return this.element.clientWidth}get innerHeight(){return this.element.clientHeight}get outerWidth(){const t=parseFloat(this.computedStyle.marginLeft)+parseFloat(this.computedStyle.marginRight);return this.element.offsetWidth+t}get outerHeight(){const t=this.computedStyle,e=parseFloat(t.marginTop)+parseFloat(t.marginBottom);return this.element.offsetHeight+e}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get scrollTop(){return this.element.scrollTop}get position(){const t=this.element.getBoundingClientRect();return{top:t.top,left:t.left}}get absolutePosition(){const t=this.element.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX}}get screenPosition(){const t=this.element.getBoundingClientRect();return{top:t.top,left:t.left}}get rect(){const t=this.element.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}get innerRect(){const t=this.element.getBoundingClientRect(),e=this.computedStyle,n=parseFloat(e.paddingTop),r=parseFloat(e.paddingRight),i=parseFloat(e.paddingBottom),s=parseFloat(e.paddingLeft);return{top:t.top+n,left:t.left+s,width:t.width-s-r,height:t.height-n-i}}get outerRect(){const t=this.element.getBoundingClientRect(),e=this.computedStyle,n=parseFloat(e.marginTop),r=parseFloat(e.marginRight),i=parseFloat(e.marginBottom),s=parseFloat(e.marginLeft);return{top:t.top-n,left:t.left-s,width:t.width+s+r,height:t.height+n+i}}get padding(){const t=this.computedStyle;return{top:parseFloat(t.paddingTop),right:parseFloat(t.paddingRight),bottom:parseFloat(t.paddingBottom),left:parseFloat(t.paddingLeft)}}get margin(){const t=this.computedStyle;return{top:parseFloat(t.marginTop),right:parseFloat(t.marginRight),bottom:parseFloat(t.marginBottom),left:parseFloat(t.marginLeft)}}get inViewport(){const t=this.element.getBoundingClientRect();return t.top<window.innerHeight&&t.bottom>0}get isAboveViewport(){return this.element.getBoundingClientRect().bottom<0}get isBelowViewport(){return this.element.getBoundingClientRect().top>window.innerHeight}get isLeftViewport(){return this.element.getBoundingClientRect().right<0}get isRightViewport(){return this.element.getBoundingClientRect().left>window.innerWidth}hasAttribute(t){return this.element.hasAttribute(t)}attribute(t){return this.element.hasAttribute(t)?this.element.getAttribute(t):void 0}setAttribute(t,e=void 0){return this.element.setAttribute(t,e?.toString()??""),this}removeAttribute(t){this.element.removeAttribute(t)}hasClass(t){return this.element.classList.contains(t)}addClass(t){return this.element.classList.add(t),this}removeClass(t){return this.element.classList.remove(t),this}setElementStyle(t,e){return this.element.style.setProperty(t,e),this}removeElementStyle(t){return this.element.style.removeProperty(t),this}get computedStyle(){return window.getComputedStyle(this.element)}style(t){return this.computedStyle.getPropertyValue(t)}get parent(){return null==this._parentElement&&null!==this.element.parentElement&&(this._parentElement=new a(this.element.parentElement)),this._parentElement??a.empty()}get parents(){let t=[],e=this.element.parentElement;for(;null!==e;)t.push(new a(e)),e=e.parentElement;return t}hasChildren(t="*"){return null!==this.element.querySelector(t)}children(t="*",e=a){return Array.from(this.element.querySelectorAll(t)).filter(t=>t.parentElement===this.element).filter(t=>t instanceof HTMLElement).map(t=>new e(t))}firstChild(t="*",e=a){return this.children(t,e).shift()??a.empty(e)}lastChild(t="*",e=a){return this.children(t,e).pop()??a.empty(e)}closest(t,e=a){const n=this.element.closest(t);return null!==n&&n instanceof HTMLElement?new e(n):a.empty(e)}find(t,e=a){return Array.from(this.element.querySelectorAll(t)).map(t=>new e(t))}first(t="*",e=a){return this.find(t,e).shift()??a.empty(e)}prepend(t){return this._element.prepend(t.element),this}append(t){return this.element.append(t.element),this}appends(t){return t.forEach(t=>this.append(t)),this}appendTo(t){return t.element.append(this.element),this}appendBefore(t){return this.element.before(t.element),this}appendAfter(t){return this.element.after(t.element),this}trigger(t,e=null){return this.element.dispatchEvent(e??new Event(t)),this}on(t,e){return this.element.addEventListener(t,e),this}once(t,e){return this.element.addEventListener(t,e,{once:!0}),this}off(t,e){return this.element.removeEventListener(t,e),this}click(t=null){return t?this.element.addEventListener("click",async e=>await t(e)):this.trigger("click"),this}dblclick(t=null){return t?this.element.addEventListener("dblclick",async e=>await t(e)):this.trigger("dblclick"),this}mouseover(t=null){return t?this.element.addEventListener("mouseover",async e=>await t(e)):this.trigger("mouseover"),this}mouseout(t=null){return t?this.element.addEventListener("mouseout",async e=>await t(e)):this.trigger("mouseout"),this}mousedown(t=null){return t?this.element.addEventListener("mousedown",async e=>await t(e)):this.trigger("mousedown"),this}mouseup(t=null){return t?this.element.addEventListener("mouseup",async e=>await t(e)):this.trigger("mouseup"),this}mousemove(t=null){return t?this.element.addEventListener("mousemove",async e=>await t(e)):this.trigger("mousemove"),this}mouseenter(t=null){return t?this.element.addEventListener("mouseenter",async e=>await t(e)):this.trigger("mouseenter"),this}mouseleave(t=null){return t?this.element.addEventListener("mouseleave",async e=>await t(e)):this.trigger("mouseleave"),this}dragstart(t=null){return t?this.element.addEventListener("dragstart",async e=>await t(e)):this.trigger("dragstart"),this}dragend(t=null){return t?this.element.addEventListener("dragend",async e=>await t(e)):this.trigger("dragend"),this}dragover(t=null){return t?this.element.addEventListener("dragover",async e=>await t(e)):this.trigger("dragover"),this}dragenter(t=null){return t?this.element.addEventListener("dragenter",async e=>await t(e)):this.trigger("dragenter"),this}dragleave(t=null){return t?this.element.addEventListener("dragleave",async e=>await t(e)):this.trigger("dragleave"),this}drop(t=null){return t?this.element.addEventListener("drop",async e=>await t(e)):this.trigger("drop"),this}drag(t=null){return t?this.element.addEventListener("drag",async e=>await t(e)):this.trigger("drag"),this}removed(t){return this.element.addEventListener("removed",async e=>await t(e)),this}keydown(t=null){return t?this.element.addEventListener("keydown",async e=>await t(e)):this.trigger("keydown"),this}keyup(t=null){return t?this.element.addEventListener("keyup",async e=>await t(e)):this.trigger("keyup"),this}keypress(t=null){return t?this.element.addEventListener("keypress",async e=>await t(e)):this.trigger("keypress"),this}change(t=null){return t?this.element.addEventListener("change",async e=>await t(e)):this.trigger("change"),this}input(t=null){return t?this.element.addEventListener("input",async e=>await t(e)):this.trigger("input"),this}static get intersectionObserver(){return a._intersectionObserver=a._intersectionObserver??new IntersectionObserver(t=>{t.filter(t=>t.isIntersecting).forEach(t=>t.target.dispatchEvent(new Event("inview"))),t.filter(t=>!t.isIntersecting).forEach(t=>t.target.dispatchEvent(new Event("outview")))})}inview(t=null){return t?(a.intersectionObserver.observe(this.element),this.element.addEventListener("inview",async e=>await t(e))):this.trigger("inview"),this}outview(t=null){return t?(a.intersectionObserver.observe(this.element),this.element.addEventListener("outview",async e=>await t(e))):this.trigger("outview"),this}focus(t=null){return t?this.element.addEventListener("focus",async e=>await t(e)):this.trigger("focus"),this}blur(t=null){return t?this.element.addEventListener("blur",async e=>await t(e)):this.trigger("blur"),this}focusin(t=null){return t?this.element.addEventListener("focusin",async e=>await t(e)):this.trigger("focusin"),this}focusout(t=null){return t?this.element.addEventListener("focusout",async e=>await t(e)):this.trigger("focusout"),this}filedrop(t){return this.element.addEventListener("drop",async e=>{e.preventDefault();const n=e.dataTransfer;n&&n.files&&await t(Array.from(n.files))}),this}resize(t=null){return this.listenLayoutEvents(),t?this.element.addEventListener("app:resize",async e=>await t(e)):this.trigger("app:resize"),this}scroll(t=null){return this.listenLayoutEvents(),t?this.element.addEventListener("app:scroll",async e=>await t(e)):this.trigger("app:scroll"),this}changelayout(t=null){return this.listenLayoutEvents(),t?this.element.addEventListener("app:changelayout",async e=>await t(e)):this.trigger("app:changelayout"),this}}a.LISTEN_LAYOUT_EVENTS_ATTRIBUTE="data-layout",a._intersectionObserver=null;class o{constructor(){this._body=a.empty(),this._mutationObserver=null}static get instance(){return o._instance??(o._instance=new o)}initialize(){this.initialized||(this._body=a.first("body"),["resize","scroll","orientationchange","fullscreenchange","app:ready"].forEach(t=>{window.addEventListener(t,()=>{const t=new CustomEvent("app:changelayout");window.dispatchEvent(t)},{passive:!0})}),document.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault()}),document.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault()}),this.resize(()=>{document.querySelectorAll(`[${a.LISTEN_LAYOUT_EVENTS_ATTRIBUTE}]`).forEach(t=>{t.dispatchEvent(new CustomEvent("app:resize"))})}),this.scroll(()=>{document.querySelectorAll(`[${a.LISTEN_LAYOUT_EVENTS_ATTRIBUTE}]`).forEach(t=>{t.dispatchEvent(new CustomEvent("app:scroll"))})}),this.changeLayout(()=>{document.querySelectorAll(`[${a.LISTEN_LAYOUT_EVENTS_ATTRIBUTE}]`).forEach(t=>{t.dispatchEvent(new CustomEvent("app:changelayout"))})}),this._mutationObserver=new MutationObserver(t=>{t.forEach(t=>{t.removedNodes.forEach(t=>{t instanceof HTMLElement&&new a(t).trigger("removed")})})}),this._mutationObserver.observe(this.body.element,{childList:!0,subtree:!0}))}get initialized(){return this._body.attached}get body(){return this._body}append(t){this._body.append(t)}moveNext(t,e=!1){const n=Array.from(this.body.element.querySelectorAll("input, a, select, button, textarea")).map(t=>new a(t)).filter(t=>t.width>0&&t.height>0&&t.visible&&t.enabled&&!t.hasAttribute("readonly"));let r=n.map(t=>t.element).indexOf(t.element)+(e?-1:1);r>=n.length?r=0:r<0&&(r=n.length-1),n[r]&&n[r].setFocus()}trigger(t){window.dispatchEvent(new Event(t))}load(t){window.addEventListener("load",async e=>await t(e))}ready(t){window.addEventListener("app:ready",async e=>await t(e))}on(t,e){window.addEventListener(t,async t=>await e(t))}resize(t=null){t?window.addEventListener("resize",async e=>await t(e)):this.trigger("resize")}scroll(t=null){t?window.addEventListener("scroll",async e=>await t(e)):this.trigger("scroll")}changeLayout(t=null){t?window.addEventListener("app:changelayout",async e=>await t(e)):this.trigger("app:changelayout")}pageshow(t=null){t?window.addEventListener("pageshow",async e=>await t(e)):this.trigger("pageshow")}get scrollTop(){return window.scrollY||document.documentElement.scrollTop}get scrollLeft(){return window.scrollX||document.documentElement.scrollLeft}get width(){return window.innerWidth}get height(){return window.innerHeight}get documentWidth(){return document.documentElement.scrollWidth}get documentHeight(){return document.documentElement.scrollHeight}}o._instance=null,Error,Error;class l{}l.GET="GET",l.POST="POST",l.PUT="PUT",l.PATCH="PATCH",l.DELETE="DELETE",l.HEAD="HEAD",l.OPTIONS="OPTIONS",l.TRACE="TRACE",l.CONNECT="CONNECT";t.BAD_REQUEST,t.UNAUTHORIZED,t.FORBIDDEN,t.NOT_FOUND,t.METHOD_NOT_ALLOWED,t.NOT_ACCEPTABLE,t.PROXY_AUTHENTICATION_REQUIRED,t.REQUEST_TIMEOUT,t.CONFLICT,t.PAYMENT_REQUIRED,t.GONE,t.LENGTH_REQUIRED,t.PRECONDITION_FAILED,t.UNSUPPORTED_MEDIA_TYPE,t.EXPECTATION_FAILED,t.MISDIRECTED_REQUEST,t.UNPROCESSABLE_ENTITY,t.LOCKED,t.FAILED_DEPENDENCY,t.UPGRADE_REQUIRED,t.PRECONDITION_REQUIRED,t.TOO_MANY_REQUESTS,t.REQUEST_HEADER_FIELDS_TOO_LARGE,t.INTERNAL_SERVER_ERROR,t.BAD_GATEWAY,t.SERVICE_UNAVAILABLE,t.GATEWAY_TIMEOUT,t.HTTP_VERSION_NOT_SUPPORTED,t.NOT_IMPLEMENTED,t.INSUFFICIENT_STORAGE,t.NETWORK_AUTHENTICATION_REQUIRED,Event;class u{static location(){return new u}constructor(t=null){this._url=t??this.current()}current(){const{pathname:t,search:e}=location;return`${t}${e}`}get url(){return this._url}get path(){return this._url.split("?")[0]}get segments(){return this.path.split("/").filter(t=>t.length>0).filter(t=>t.length>0)}get query(){return this._url.split("?")[1]??""}get parameters(){const t=(this._url.split("?")[1]??"").split("&").map(t=>t.split("=")),e={};return t.forEach(([t,n])=>e[t]=n),e}redirect(){window.location.href=this.url}}class h{static set(t){if(this._instance)throw new Error("PageController is already initialized.");return this._instance=new t,o.instance.load(async()=>{o.instance.initialize(),await h._instance.initializeAsync(),o.instance.trigger("app:ready")}),this._instance}setForm(t){return t.build()}async initializeAsync(){this.body.convertUtcToLocal()}get body(){return o.instance.body}get uri(){return new u}}h._instance=null})(),r.default})());
|