@ngrdt/utils 0.0.17 → 0.0.18

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # ngrdt utils
2
-
3
- - string utils
1
+ # ngrdt utils
2
+
3
+ - string utils
package/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("rxjs");function e(t){return{name:t,className:(s=t,e=a(s),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:a(t),constantName:n(t),fileName:r(t)};var e,s}function a(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,((t,e,a)=>a?a.toUpperCase():"")).replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,(t=>t.toLowerCase()))}function n(t){return r(a(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function r(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const s=["je","lze"];function i(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class o{static tokenize(t){return t?t.split(/\W+/).filter((t=>!!t)):[]}static joinPaths(t,e){const a=t.endsWith("/"),n=e.startsWith("/");return a&&n?t.slice(0,-1)+e:a||n?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=o.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),a=e&&e.index||t.length,n=a-("/"===t[a-1]?1:0);return t.slice(0,n)+t.slice(a)}static createAbsoluteUrl(t,e){return o.joinPaths(e,t)}static appendQueryParams(t,e){if(e&&0!==Object.keys(e).length){return`${t}?${new URLSearchParams(e)}`}return t}static localeCompare(t,e,a="asc"){const n="asc"===a?1:-1;return t==e?0:null==t?-n:null==e?n:t.localeCompare(e)*n}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,a){return e<0||a<0||e>=t.length||a>=t.length?t:(a<e&&([e,a]=[a,e]),t.slice(0,e)+t[a]+t.slice(e+1,a)+t[e]+t.slice(a+1))}static insertAt(t,e,a){return t.slice(0,e)+a+t.slice(e)}static getDataTestId(t,e,a){var n;let r=null==(n=t.toLowerCase())?void 0:n.replace(/ /g,"-");return e&&(r=`${e}__${r}`),a&&(r=`${r}--${a}`),o.removeAccents(r)}}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},l.apply(this,arguments)}const p={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},c={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:p},u=l({},c,{SPACEBAR:"Space"}),d=Array.from(Array(26)).map(((t,e)=>e+65)).map((t=>String.fromCharCode(t))),g=d.map((t=>`Key${t.toUpperCase()}`));class m{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const a=t.offsetLeft,n=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=a,o=a-r+n;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class h{static getDays(t,e){return h.getDayOffset(new Date(t))-h.getDayOffset(new Date(e))}static checkDate(t,e,a){const n=new Date(t,e-1,a);return n.getFullYear()===t&&n.getMonth()+1===e&&n.getDate()===a}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-h.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(h.isValidDate(e)){const t=e.getFullYear(),a=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${a}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(h.hhMmSsMsRegex.test(t)){const a=t.match(h.hhMmSsMsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),s=parseInt(a[4]);return e.setHours(t,n,r,s),e}}else if(h.hhMmSsRegex.test(t)){const a=t.match(h.hhMmSsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]);return e.setHours(t,n,r),e}}else if(h.hhMmRegex.test(t)){const a=t.match(h.hhMmRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]);return e.setHours(t,n),e}}return null}static setTime(t,e){const a=new Date(t),n=h.timeToDate(e);return n&&a.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),a}static getTime(t,e=!0){const a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");if(e){return`${a}:${n}:${t.getSeconds().toString().padStart(2,"0")}`}return`${a}:${n}`}static parseToDate(t){if(t instanceof Date)return h.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return h.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return h.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,a=t.getMonth()+1,n=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return h.isLeapYear(e+1)?365*e+r+h.daysUpToMonthLeapYear[a-1]+n-1:365*e+r+h.daysUpToMonth[a-1]+n-1}static doubleDigitYearToPast(t){const e=h.getCurrentYear(),a=e%100;return t<=a?t+e-a:t+e-a-100}static doubleDigitYearToFuture(t){const e=h.getCurrentYear(),a=e%100;return t>=a?t+e-a:t+e-a+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const a=new Date(t),n=new Date(e);let r=n.getFullYear()-a.getFullYear();const s=n.getMonth()-a.getMonth(),i=n.getDate()-a.getDate();return(s<0||0===s&&i<0)&&r--,r}}var f,x,M;h.MS=1,h.SECOND=1e3*h.MS,h.MINUTE=60*h.SECOND,h.HOUR=60*h.MINUTE,h.DAY=24*h.HOUR,h.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,h.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,h.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,h.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],h.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],exports.Month=void 0,(f=exports.Month||(exports.Month={}))[f.January=0]="January",f[f.February=1]="February",f[f.March=2]="March",f[f.April=3]="April",f[f.May=4]="May",f[f.June=5]="June",f[f.July=6]="July",f[f.August=7]="August",f[f.September=8]="September",f[f.October=9]="October",f[f.November=10]="November",f[f.December=11]="December",exports.RdtMimeType=void 0,(x=exports.RdtMimeType||(exports.RdtMimeType={})).DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",x.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",x.PDF="application/pdf",x.TXT="text/plain",x.CSV="text/csv",x.ZIP="application/zip",x.JPG="image/jpeg",x.PNG="image/png",x.GIF="image/gif",x.SVG="image/svg+xml",x.HTML="text/html",x.XML="application/xml",x.JSON="application/json",x.MP3="audio/mpeg",x.MP4="video/mp4",x.OGG="audio/ogg",x.WEBM="video/webm",x.WAV="audio/wav",x.AVI="video/x-msvideo",x.MPEG="video/mpeg",x.WEBP="image/webp",x.ICO="image/x-icon",x.TTF="font/ttf",x.WOFF="font/woff",x.WOFF2="font/woff2",x.EOT="application/vnd.ms-fontobject",x.OTF="font/otf",x.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",x.PPT="application/vnd.ms-powerpoint",x.XLS="application/vnd.ms-excel",x.DOC="application/msword",x.ODT="application/vnd.oasis.opendocument.text",x.ODS="application/vnd.oasis.opendocument.spreadsheet",x.ODP="application/vnd.oasis.opendocument.presentation",x.ODF="application/vnd.oasis.opendocument.formula",x.RAR="application/vnd.rar",x.TAR="application/x-tar",x.GZIP="application/gzip",x.BZIP2="application/x-bzip2",x.XZ="application/x-xz",x.SEVENZ="application/x-7z-compressed",x.RAR5="application/x-rar-compressed",x.WMA="audio/x-ms-wma",x.WMV="video/x-ms-wmv",x.FLV="video/x-flv",x.OGV="video/ogg",x.BIN="application/octet-stream",x.UNKNOWN="unknown",exports.RdtCombinedMimeType=void 0,(M=exports.RdtCombinedMimeType||(exports.RdtCombinedMimeType={})).IMAGE="image/*",M.AUDIO="audio/*",M.VIDEO="video/*",M.FONT="font/*",M.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",M.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",M.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",M.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed";const y={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin",unknown:"unknown"},v={};for(const[t,e]of Object.entries(y))v[e]=t;var w,D;exports.RdtMsOfficeAction=void 0,(w=exports.RdtMsOfficeAction||(exports.RdtMsOfficeAction={})).Edit="ofe|u|",w.View="ofv|u|",exports.RdtMsOfficeApp=void 0,(D=exports.RdtMsOfficeApp||(exports.RdtMsOfficeApp={})).Word="ms-word",D.Excel="ms-excel",D.PowerPoint="ms-powerpoint";const b=exports.RdtMimeType.UNKNOWN,O="ofv|u|";var R;exports.FileSizeUnit=void 0,(R=exports.FileSizeUnit||(exports.FileSizeUnit={})).B="B",R.KB="KB",R.MB="MB",R.GB="GB",R.TB="TB",R.PB="PB",R.EB="EB",R.ZB="ZB",R.YB="YB";const I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class T{static getMsOfficeLink(t,e){var a;const n=null!=(a=e.app)?a:T.getMsOfficeAppByMimeType(e.mimeType);if(n){var r;return`${n}:${null!=(r=e.action)?r:O}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(T.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const a=T.getBase64Link(t,e);window.open(a,"_blank")}static fileAsArrayBuffer(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsArrayBuffer(t)}))}static fileAsText(t,e){return new Promise(((a,n)=>{t||n(null);const r=new FileReader;r.onload=()=>a(r.result),r.onerror=n,r.readAsText(t,e)}))}static downloadFileFromData(t,e,a){var n;a=null!=(n=null!=a?a:T.getMimeTypeFromFileName(e))?n:T.getMimeTypeFromBase64(t);const r=T.getBase64Link(t,a);this.downloadFileFromRemoteUrl(r,e,a)}static downloadFileFromRemoteUrl(t,e,a){a=null!=a?a:T.getMimeTypeFromFileName(e);const n=document.createElement("a");n.href=t,n.download=T.getFileName(e,a),n.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();return v[e]}static getFileName(t,e){if(e&&e!==exports.RdtMimeType.UNKNOWN){const a=y[e];return t.endsWith(`.${a}`)?t:`${t}.${a}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?e===exports.RdtMimeType.UNKNOWN?`data:${exports.RdtMimeType.BIN};base64,${t}`:`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,a,n,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(n=r.split("filename="))||null==(a=n[1])||null==(e=a.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise(((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsDataURL(t)}))}static convertFromBytes(t,e=2){if(0===t)return"0 B";const a=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,a)).toFixed(e))+" "+I[a]}static convertToBytes(t,e){const a=I.indexOf(e);return t*Math.pow(1024,a)}static fileSizeToBytes(t){const[e,a]=t.split(" "),n=parseFloat(e),r=a;return isNaN(n)||-1===I.indexOf(r)?null:T.convertToBytes(n,r)}static getMsOfficeAppByMimeType(t){switch(t){case exports.RdtMimeType.DOC:case exports.RdtMimeType.DOCX:case exports.RdtMimeType.ODT:return"ms-word";case exports.RdtMimeType.XLS:case exports.RdtMimeType.XLSX:case exports.RdtMimeType.ODS:return"ms-excel";case exports.RdtMimeType.PPT:case exports.RdtMimeType.PPTX:case exports.RdtMimeType.ODP:return"ms-powerpoint";default:return null}}}class S{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?S.normalizeHex(e):this.isRgbColor(e)?S.normalizeRgb(e):this.isRgbaColor(e)?S.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(S.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(S.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(S.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return S.rgbRegex.test(t)}static isHexColor(t){return S.hexRegex.test(t)}static isRgbaColor(t){return S.rgbaRegex.test(t)}}var _;S.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,S.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,S.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(_||(_={}));var N,F,A,C,E;exports.RdtInsertMode=void 0,(N=exports.RdtInsertMode||(exports.RdtInsertMode={}))[N.Overwrite=0]="Overwrite",N[N.Shift=1]="Shift",exports.RdtPasteMode=void 0,(F=exports.RdtPasteMode||(exports.RdtPasteMode={}))[F.Replace=0]="Replace",F[F.Insert=1]="Insert",exports.RdtYearInputMode=void 0,(A=exports.RdtYearInputMode||(exports.RdtYearInputMode={}))[A.FourDigit=1]="FourDigit",A[A.TwoDigit=2]="TwoDigit",A[A.Both=3]="Both",exports.RdtLeadingZeroInputMode=void 0,(C=exports.RdtLeadingZeroInputMode||(exports.RdtLeadingZeroInputMode={}))[C.NoLeadingZero=1]="NoLeadingZero",C[C.LeadingZero=2]="LeadingZero",C[C.Both=3]="Both";exports.RdtEncoding=void 0,(E=exports.RdtEncoding||(exports.RdtEncoding={})).UTF_8="utf-8",E.IBM_866="ibm866",E.ISO_8859_2="iso-8859-2",E.ISO_8859_3="iso-8859-3",E.ISO_8859_4="iso-8859-4",E.ISO_8859_5="iso-8859-5",E.ISO_8859_6="iso-8859-6",E.ISO_8859_7="iso-8859-7",E.ISO_8859_8="iso-8859-8",E.ISO_8859_8_I="iso-8859-8-i",E.ISO_8859_10="iso-8859-10",E.ISO_8859_13="iso-8859-13",E.ISO_8859_14="iso-8859-14",E.ISO_8859_15="iso-8859-15",E.ISO_8859_16="iso-8859-16",E.KOI8_R="koi8-r",E.MACINTOSH="macintosh",E.WINDOWS_874="windows-874",E.WINDOWS_1250="windows-1250",E.WINDOWS_1251="windows-1251",E.WINDOWS_1252="windows-1252",E.WINDOWS_1253="windows-1253",E.WINDOWS_1254="windows-1254",E.WINDOWS_1255="windows-1255",E.WINDOWS_1256="windows-1256",E.WINDOWS_1257="windows-1257",E.WINDOWS_1258="windows-1258",E.X_MAC_CYRILLIC="x-mac-cyrillic",E.GBK="gbk",E.GB18030="gb18030",E.BIG5="big5",E.EUC_JP="euc-jp",E.ISO_2022_JP="iso-2022-jp",E.SHIFT_JIS="shift-jis",E.EUC_KR="euc-kr",E.HZ_GB_2312="hz-gb-2312",E.ISO_2022_CN="iso-2022-cn",E.ISO_2022_CN_EXT="iso-2022-cn-ext",E.ISO_2022_KR="iso-2022-kr",E.UTF_16="utf-16",E.X_USER_DEFINED="x-user-defined",exports.ALPHABET_KB_KEYS=d,exports.ARROW=p,exports.EXTENSION_BY_MIME_TYPE=y,exports.FileUtils=T,exports.KB_ALPHABET_CODES=g,exports.KB_CODE=u,exports.KB_KEY=c,exports.MIME_TYPE_BY_EXTENSION=v,exports.PRIMENG_DATE_FORMAT_META={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}},exports.RDT_DEFAULT_MIME_TYPE=b,exports.RDT_DEFAULT_MS_OFFICE_ACTION=O,exports.RdtArrayUtils=class{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,a){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),a,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every((t=>e.indexOf(t)>-1)):!t==!e}},exports.RdtCssUtils=S,exports.RdtDateParser=class{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get leadingZeroMode(){return this.cfg.leadingZeroMode}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get yearInputMode(){return this.cfg.yearInputMode}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get insertMode(){return this.cfg.insertMode}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var a;this.caretPosition=null!=(a=e.selectionStart)?a:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,a=e.value;var n;const r=null!=(n=e.selectionStart)?n:a.length-1,s=this.parse(a,r);e.value=s.prettyInput,m.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach((a=>{switch(a.type){case"constant":e+=a.value;break;case"day":e+=`${t.getDate()}`.padStart(a.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(a.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**a.maxLength).padStart(a.minLength,"0")}})),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,a=this.deleting){let n=t,r=null,s=null,i=null,l="",p=e,c=!0,u=!1;for(let d=0;d<this._parsedFormat.length&&0!==n.length;d++){const g=this._parsedFormat[d],m=n.search(/\d/);if("constant"===g.type){if(m>0){const e=a?n.substring(0,g.value.length):n.substring(0,m);if(a&&e!==g.value){if(n.length===t.length)continue;p-=g.value.length-e.length}n=n.substring(m)}l+=g.value}else{if(m<0)break;if(p>l.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(n.match(/^\d{3,4}/)||n.match(/^\d{2}$/)&&d!==this._parsedFormat.length-1))if(!a&&0===this.cfg.insertMode&&n.match(/^\d{5}/)&&e<n.length&&e-l.length<=5&&o.isNumericCharacter(n[e])&&(n=n.substring(0,e)+n.substring(e+1)),n.match(/^\d{4}/)){const t=n.substring(0,4);i=parseInt(t),n=n.substring(4),l+=t,a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a))}else n.match(/^\d{3}/)?(l+=n.substring(0,3),n=n.substring(3),l.length<=p&&(c=!1)):(l=n.substring(0,2),n=n.substring(2),l.length<=p&&(c=!1));else if(2&this.cfg.yearInputMode&&n.match(/^\d{2}/)&&(this.containsNonNumericCharacters(n.substring(2))||d===this._parsedFormat.length-1)){const t=n.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?h.doubleDigitYearToPast(e):h.doubleDigitYearToFuture(e),n=n.substring(2),a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),l+=t,1&this.cfg.yearInputMode&&d===this._parsedFormat.length-1&&(u=!0)}else n.match(/^\d/)&&(l+=n[0],n=n.substring(1),l.length<=p&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}}}let d=null;if(null!==i&&null!==s&&null!==r&&(d=new Date(i,s-1,r),d.getMonth()!==s-1&&(d=null)),p=Math.min(p,l.length+1),a)d||(l=t,p=e);else if(e===t.length)p=l.length;else if(c)for(;p>0&&l.length>p&&!o.isNumericCharacter(l[p]);)p++;return{prettyInput:l,date:d,complete:null!==d,caret:p,ambiguous:u||null===d}}readNumber(t,e,a,n,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",p=!1;if(1&this.cfg.leadingZeroMode){var c,u;let r=null!=(u=null==(c=n.match(/^\d+/))?void 0:c[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}a+=r,n=n.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);n.match(t)&&(l=n.substring(0,i),a+=l,n=n.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(p=l.length===i||10*o>e,({rest:n,targetCaret:r}=this.useUpNumbersUntilNextSeparator(n,r,p&&!s,s)),{value:o,complete:p,output:a,rest:n,targetCaret:r}):{value:null,complete:!1,output:a,rest:n,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort(((t,e)=>e.length-t.length));let a=t.format;const n=[];for(;a.length>0;){const r=e.map((t=>a.indexOf(t))),s=r.indexOf(Math.min(...r.filter((t=>t>=0)))),i=r[s],o=e[s];i>0?(n.push({type:"constant",value:a.substring(0,i)}),a=a.substring(i)):i<0?(n.push({type:"constant",value:a}),a=""):(n.push(t.symbolMeta[o]),a=a.substring(i+o.length))}return n}useUpNumbersUntilNextSeparator(t,e,a,n){let r=0;for(;r<t.length&&o.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(n?r:0)}:a?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}},exports.RdtDateUtils=h,exports.RdtHTMLUtils=m,exports.RdtModelUtils=class{static inferPropertyInfo(t,a){const n=e(a).fileName.split("-"),r={};n.forEach((t=>r[t]=1));let i=0,o="";t.forEach((({key:t})=>{const a=e(t).fileName.split("-");let n=0;a.forEach((t=>{var e;return n+=null!=(e=r[t])?e:0}));const s=a.includes("id");n>i&&s?(i=n,o=t):n===i&&s&&t.length<o.length&&(o=t)}));return t.map((t=>{const a=e(t.key).fileName.split("-"),n=a.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===o,foreignKey:n&&t.key!==o,probablyBoolean:s.includes(a[0])&&"number"===t.type}}))}static names(t){return e(t)}},exports.RdtObjectUtils=class{static pluck(t,e){if(!t)return;const a=Array.isArray(e)?e:e.split(".");let n=t;for(const t of a){if(null==n)return;n=Array.isArray(n)&&"string"==typeof t?n[parseInt(t)]:n[t]}return n}static notNullGuard(t){return null!=t}static expandKey(t,e){const a=t.split(".");if(0===a.length)return e;const n=i(a[0]);let r=n;for(let t=1;t<a.length;t++){const e=i(a[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,n.obj}},exports.RdtRandomUtils=class{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}},exports.RdtRxUtils=class{static repeatLatestWhen(e){return a=>t.combineLatest([a,e.pipe(t.startWith(null))]).pipe(t.map((([t])=>t)))}static completeIfNull(e){return e.pipe(t.switchMap((e=>null==e?t.EMPTY:t.of(e))))}static makeObservable(e){return e instanceof t.Observable?e:t.of(e)}},exports.RdtStringUtils=o;
1
+ "use strict";var t=require("rxjs");function e(t){return{name:t,className:(s=t,e=a(s),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:a(t),constantName:n(t),fileName:r(t)};var e,s}function a(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,(t,e,a)=>a?a.toUpperCase():"").replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,t=>t.toLowerCase())}function n(t){return r(a(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function r(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const s=["je","lze"];function i(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class o{static tokenize(t){return t?t.split(/\W+/).filter(t=>!!t):[]}static joinPaths(t,e){const a=t.endsWith("/"),n=e.startsWith("/");return a&&n?t.slice(0,-1)+e:a||n?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=o.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),a=e&&e.index||t.length,n=a-("/"===t[a-1]?1:0);return t.slice(0,n)+t.slice(a)}static createAbsoluteUrl(t,e){return o.joinPaths(e,t)}static appendQueryParams(t,e){if(e&&0!==Object.keys(e).length){return`${t}?${new URLSearchParams(e)}`}return t}static localeCompare(t,e,a="asc"){const n="asc"===a?1:-1;return t==e?0:null==t?-n:null==e?n:t.localeCompare(e)*n}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,a){return e<0||a<0||e>=t.length||a>=t.length?t:(a<e&&([e,a]=[a,e]),t.slice(0,e)+t[a]+t.slice(e+1,a)+t[e]+t.slice(a+1))}static insertAt(t,e,a){return t.slice(0,e)+a+t.slice(e)}static getDataTestId(t,e,a){var n;let r=null==(n=t.toLowerCase())?void 0:n.replace(/ /g,"-");return e&&(r=`${e}__${r}`),a&&(r=`${r}--${a}`),o.removeAccents(r)}}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},l.apply(this,arguments)}const p={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},c={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:p},u=l({},c,{SPACEBAR:"Space"}),d=Array.from(Array(26)).map((t,e)=>e+65).map(t=>String.fromCharCode(t)),g=d.map(t=>`Key${t.toUpperCase()}`);class m{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const a=t.offsetLeft,n=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=a,o=a-r+n;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class h{static getDays(t,e){return h.getDayOffset(new Date(t))-h.getDayOffset(new Date(e))}static checkDate(t,e,a){const n=new Date(t,e-1,a);return n.getFullYear()===t&&n.getMonth()+1===e&&n.getDate()===a}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-h.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(h.isValidDate(e)){const t=e.getFullYear(),a=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${a}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(h.hhMmSsMsRegex.test(t)){const a=t.match(h.hhMmSsMsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]),s=parseInt(a[4]);return e.setHours(t,n,r,s),e}}else if(h.hhMmSsRegex.test(t)){const a=t.match(h.hhMmSsRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]),r=parseInt(a[3]);return e.setHours(t,n,r),e}}else if(h.hhMmRegex.test(t)){const a=t.match(h.hhMmRegex);if(a){const t=parseInt(a[1]),n=parseInt(a[2]);return e.setHours(t,n),e}}return null}static setTime(t,e){const a=new Date(t),n=h.timeToDate(e);return n&&a.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),a}static getTime(t,e=!0){const a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0");if(e){return`${a}:${n}:${t.getSeconds().toString().padStart(2,"0")}`}return`${a}:${n}`}static parseToDate(t){if(t instanceof Date)return h.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return h.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(h.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return h.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,a=t.getMonth()+1,n=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return h.isLeapYear(e+1)?365*e+r+h.daysUpToMonthLeapYear[a-1]+n-1:365*e+r+h.daysUpToMonth[a-1]+n-1}static doubleDigitYearToPast(t){const e=h.getCurrentYear(),a=e%100;return t<=a?t+e-a:t+e-a-100}static doubleDigitYearToFuture(t){const e=h.getCurrentYear(),a=e%100;return t>=a?t+e-a:t+e-a+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const a=new Date(t),n=new Date(e);let r=n.getFullYear()-a.getFullYear();const s=n.getMonth()-a.getMonth(),i=n.getDate()-a.getDate();return(s<0||0===s&&i<0)&&r--,r}}var f,x,M;h.MS=1,h.SECOND=1e3*h.MS,h.MINUTE=60*h.SECOND,h.HOUR=60*h.MINUTE,h.DAY=24*h.HOUR,h.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,h.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,h.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,h.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],h.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],exports.Month=void 0,(f=exports.Month||(exports.Month={}))[f.January=0]="January",f[f.February=1]="February",f[f.March=2]="March",f[f.April=3]="April",f[f.May=4]="May",f[f.June=5]="June",f[f.July=6]="July",f[f.August=7]="August",f[f.September=8]="September",f[f.October=9]="October",f[f.November=10]="November",f[f.December=11]="December",exports.RdtMimeType=void 0,(x=exports.RdtMimeType||(exports.RdtMimeType={})).DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",x.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",x.PDF="application/pdf",x.TXT="text/plain",x.CSV="text/csv",x.ZIP="application/zip",x.JPG="image/jpeg",x.PNG="image/png",x.GIF="image/gif",x.SVG="image/svg+xml",x.HTML="text/html",x.XML="application/xml",x.JSON="application/json",x.MP3="audio/mpeg",x.MP4="video/mp4",x.OGG="audio/ogg",x.WEBM="video/webm",x.WAV="audio/wav",x.AVI="video/x-msvideo",x.MPEG="video/mpeg",x.WEBP="image/webp",x.ICO="image/x-icon",x.TTF="font/ttf",x.WOFF="font/woff",x.WOFF2="font/woff2",x.EOT="application/vnd.ms-fontobject",x.OTF="font/otf",x.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",x.PPT="application/vnd.ms-powerpoint",x.XLS="application/vnd.ms-excel",x.DOC="application/msword",x.ODT="application/vnd.oasis.opendocument.text",x.ODS="application/vnd.oasis.opendocument.spreadsheet",x.ODP="application/vnd.oasis.opendocument.presentation",x.ODF="application/vnd.oasis.opendocument.formula",x.RAR="application/vnd.rar",x.TAR="application/x-tar",x.GZIP="application/gzip",x.BZIP2="application/x-bzip2",x.XZ="application/x-xz",x.SEVENZ="application/x-7z-compressed",x.RAR5="application/x-rar-compressed",x.WMA="audio/x-ms-wma",x.WMV="video/x-ms-wmv",x.FLV="video/x-flv",x.OGV="video/ogg",x.BIN="application/octet-stream",x.UNKNOWN="unknown",exports.RdtCombinedMimeType=void 0,(M=exports.RdtCombinedMimeType||(exports.RdtCombinedMimeType={})).IMAGE="image/*",M.AUDIO="audio/*",M.VIDEO="video/*",M.FONT="font/*",M.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",M.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",M.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",M.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed";const y={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin",unknown:"unknown"},v={};for(const[t,e]of Object.entries(y))v[e]=t;var w,D;exports.RdtMsOfficeAction=void 0,(w=exports.RdtMsOfficeAction||(exports.RdtMsOfficeAction={})).Edit="ofe|u|",w.View="ofv|u|",exports.RdtMsOfficeApp=void 0,(D=exports.RdtMsOfficeApp||(exports.RdtMsOfficeApp={})).Word="ms-word",D.Excel="ms-excel",D.PowerPoint="ms-powerpoint";const b=exports.RdtMimeType.UNKNOWN,R="ofv|u|";var O;exports.RdtFileSizeUnit=void 0,(O=exports.RdtFileSizeUnit||(exports.RdtFileSizeUnit={})).B="B",O.KB="KB",O.MB="MB",O.GB="GB",O.TB="TB",O.PB="PB",O.EB="EB",O.ZB="ZB",O.YB="YB";const I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class T{static getMsOfficeLink(t,e){var a;const n=null!=(a=e.app)?a:T.getMsOfficeAppByMimeType(e.mimeType);if(n){var r;return`${n}:${null!=(r=e.action)?r:R}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(T.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const a=T.getBase64Link(t,e);window.open(a,"_blank")}static fileAsArrayBuffer(t){return new Promise((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsArrayBuffer(t)})}static fileAsText(t,e){return new Promise((a,n)=>{t||n(null);const r=new FileReader;r.onload=()=>a(r.result),r.onerror=n,r.readAsText(t,e)})}static downloadFileFromData(t,e,a){var n;a=null!=(n=null!=a?a:T.getMimeTypeFromFileName(e))?n:T.getMimeTypeFromBase64(t);const r=T.getBase64Link(t,a);this.downloadFileFromRemoteUrl(r,e,a)}static downloadFileFromRemoteUrl(t,e,a){a=null!=a?a:T.getMimeTypeFromFileName(e);const n=document.createElement("a");n.href=t,n.download=T.getFileName(e,a),n.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();return v[e]}static getFileName(t,e){if(e&&e!==exports.RdtMimeType.UNKNOWN){const a=y[e];return t.endsWith(`.${a}`)?t:`${t}.${a}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?e===exports.RdtMimeType.UNKNOWN?`data:${exports.RdtMimeType.BIN};base64,${t}`:`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,a,n,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(n=r.split("filename="))||null==(a=n[1])||null==(e=a.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise((e,a)=>{t||a(null);const n=new FileReader;n.onload=()=>e(n.result),n.onerror=a,n.readAsDataURL(t)})}static convertFromBytes(t,e=2){if(0===t)return"0 B";const a=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,a)).toFixed(e))+" "+I[a]}static convertToBytes(t,e){const a=I.indexOf(e);return t*Math.pow(1024,a)}static fileSizeToBytes(t){const[e,a]=t.split(" "),n=parseFloat(e),r=a;return isNaN(n)||-1===I.indexOf(r)?null:T.convertToBytes(n,r)}static getMsOfficeAppByMimeType(t){switch(t){case exports.RdtMimeType.DOC:case exports.RdtMimeType.DOCX:case exports.RdtMimeType.ODT:return"ms-word";case exports.RdtMimeType.XLS:case exports.RdtMimeType.XLSX:case exports.RdtMimeType.ODS:return"ms-excel";case exports.RdtMimeType.PPT:case exports.RdtMimeType.PPTX:case exports.RdtMimeType.ODP:return"ms-powerpoint";default:return null}}}class S{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?S.normalizeHex(e):this.isRgbColor(e)?S.normalizeRgb(e):this.isRgbaColor(e)?S.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(S.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(S.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(S.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return S.rgbRegex.test(t)}static isHexColor(t){return S.hexRegex.test(t)}static isRgbaColor(t){return S.rgbaRegex.test(t)}}var _;S.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,S.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,S.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(_||(_={}));var N,F,A,C,E;exports.RdtInsertMode=void 0,(N=exports.RdtInsertMode||(exports.RdtInsertMode={}))[N.Overwrite=0]="Overwrite",N[N.Shift=1]="Shift",exports.RdtPasteMode=void 0,(F=exports.RdtPasteMode||(exports.RdtPasteMode={}))[F.Replace=0]="Replace",F[F.Insert=1]="Insert",exports.RdtYearInputMode=void 0,(A=exports.RdtYearInputMode||(exports.RdtYearInputMode={}))[A.FourDigit=1]="FourDigit",A[A.TwoDigit=2]="TwoDigit",A[A.Both=3]="Both",exports.RdtLeadingZeroInputMode=void 0,(C=exports.RdtLeadingZeroInputMode||(exports.RdtLeadingZeroInputMode={}))[C.NoLeadingZero=1]="NoLeadingZero",C[C.LeadingZero=2]="LeadingZero",C[C.Both=3]="Both";exports.RdtEncoding=void 0,(E=exports.RdtEncoding||(exports.RdtEncoding={})).UTF_8="utf-8",E.IBM_866="ibm866",E.ISO_8859_2="iso-8859-2",E.ISO_8859_3="iso-8859-3",E.ISO_8859_4="iso-8859-4",E.ISO_8859_5="iso-8859-5",E.ISO_8859_6="iso-8859-6",E.ISO_8859_7="iso-8859-7",E.ISO_8859_8="iso-8859-8",E.ISO_8859_8_I="iso-8859-8-i",E.ISO_8859_10="iso-8859-10",E.ISO_8859_13="iso-8859-13",E.ISO_8859_14="iso-8859-14",E.ISO_8859_15="iso-8859-15",E.ISO_8859_16="iso-8859-16",E.KOI8_R="koi8-r",E.MACINTOSH="macintosh",E.WINDOWS_874="windows-874",E.WINDOWS_1250="windows-1250",E.WINDOWS_1251="windows-1251",E.WINDOWS_1252="windows-1252",E.WINDOWS_1253="windows-1253",E.WINDOWS_1254="windows-1254",E.WINDOWS_1255="windows-1255",E.WINDOWS_1256="windows-1256",E.WINDOWS_1257="windows-1257",E.WINDOWS_1258="windows-1258",E.X_MAC_CYRILLIC="x-mac-cyrillic",E.GBK="gbk",E.GB18030="gb18030",E.BIG5="big5",E.EUC_JP="euc-jp",E.ISO_2022_JP="iso-2022-jp",E.SHIFT_JIS="shift-jis",E.EUC_KR="euc-kr",E.HZ_GB_2312="hz-gb-2312",E.ISO_2022_CN="iso-2022-cn",E.ISO_2022_CN_EXT="iso-2022-cn-ext",E.ISO_2022_KR="iso-2022-kr",E.UTF_16="utf-16",E.X_USER_DEFINED="x-user-defined",exports.ALPHABET_KB_KEYS=d,exports.ARROW=p,exports.EXTENSION_BY_MIME_TYPE=y,exports.KB_ALPHABET_CODES=g,exports.KB_CODE=u,exports.KB_KEY=c,exports.MIME_TYPE_BY_EXTENSION=v,exports.PRIMENG_DATE_FORMAT_META={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}},exports.RDT_DEFAULT_MIME_TYPE=b,exports.RDT_DEFAULT_MS_OFFICE_ACTION=R,exports.RdtArrayUtils=class{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,a){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),a,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every(t=>e.indexOf(t)>-1):!t==!e}},exports.RdtCssUtils=S,exports.RdtDateParser=class{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get leadingZeroMode(){return this.cfg.leadingZeroMode}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get yearInputMode(){return this.cfg.yearInputMode}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get insertMode(){return this.cfg.insertMode}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var a;this.caretPosition=null!=(a=e.selectionStart)?a:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,a=e.value;var n;const r=null!=(n=e.selectionStart)?n:a.length-1,s=this.parse(a,r);e.value=s.prettyInput,m.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach(a=>{switch(a.type){case"constant":e+=a.value;break;case"day":e+=`${t.getDate()}`.padStart(a.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(a.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**a.maxLength).padStart(a.minLength,"0")}}),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,a=this.deleting){let n=t,r=null,s=null,i=null,l="",p=e,c=!0,u=!1;for(let d=0;d<this._parsedFormat.length&&0!==n.length;d++){const g=this._parsedFormat[d],m=n.search(/\d/);if("constant"===g.type){if(m>0){const e=a?n.substring(0,g.value.length):n.substring(0,m);if(a&&e!==g.value){if(n.length===t.length)continue;p-=g.value.length-e.length}n=n.substring(m)}l+=g.value}else{if(m<0)break;if(p>l.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(n.match(/^\d{3,4}/)||n.match(/^\d{2}$/)&&d!==this._parsedFormat.length-1))if(!a&&0===this.cfg.insertMode&&n.match(/^\d{5}/)&&e<n.length&&e-l.length<=5&&o.isNumericCharacter(n[e])&&(n=n.substring(0,e)+n.substring(e+1)),n.match(/^\d{4}/)){const t=n.substring(0,4);i=parseInt(t),n=n.substring(4),l+=t,a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a))}else n.match(/^\d{3}/)?(l+=n.substring(0,3),n=n.substring(3),l.length<=p&&(c=!1)):(l=n.substring(0,2),n=n.substring(2),l.length<=p&&(c=!1));else if(2&this.cfg.yearInputMode&&n.match(/^\d{2}/)&&(this.containsNonNumericCharacters(n.substring(2))||d===this._parsedFormat.length-1)){const t=n.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?h.doubleDigitYearToPast(e):h.doubleDigitYearToFuture(e),n=n.substring(2),a||({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),l+=t,1&this.cfg.yearInputMode&&d===this._parsedFormat.length-1&&(u=!0)}else n.match(/^\d/)&&(l+=n[0],n=n.substring(1),l.length<=p&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,l,n,p,a);l=t.output,n=t.rest,p=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!a&&({rest:n,targetCaret:p}=this.useUpNumbersUntilNextSeparator(n,p,!0,a)),!t.complete&&l.length<=p&&(c=!1))}}}let d=null;if(null!==i&&null!==s&&null!==r&&(d=new Date(i,s-1,r),d.getMonth()!==s-1&&(d=null)),p=Math.min(p,l.length+1),a)d||(l=t,p=e);else if(e===t.length)p=l.length;else if(c)for(;p>0&&l.length>p&&!o.isNumericCharacter(l[p]);)p++;return{prettyInput:l,date:d,complete:null!==d,caret:p,ambiguous:u||null===d}}readNumber(t,e,a,n,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",p=!1;if(1&this.cfg.leadingZeroMode){var c,u;let r=null!=(u=null==(c=n.match(/^\d+/))?void 0:c[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}a+=r,n=n.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);n.match(t)&&(l=n.substring(0,i),a+=l,n=n.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(p=l.length===i||10*o>e,({rest:n,targetCaret:r}=this.useUpNumbersUntilNextSeparator(n,r,p&&!s,s)),{value:o,complete:p,output:a,rest:n,targetCaret:r}):{value:null,complete:!1,output:a,rest:n,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort((t,e)=>e.length-t.length);let a=t.format;const n=[];for(;a.length>0;){const r=e.map(t=>a.indexOf(t)),s=r.indexOf(Math.min(...r.filter(t=>t>=0))),i=r[s],o=e[s];i>0?(n.push({type:"constant",value:a.substring(0,i)}),a=a.substring(i)):i<0?(n.push({type:"constant",value:a}),a=""):(n.push(t.symbolMeta[o]),a=a.substring(i+o.length))}return n}useUpNumbersUntilNextSeparator(t,e,a,n){let r=0;for(;r<t.length&&o.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(n?r:0)}:a?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}},exports.RdtDateUtils=h,exports.RdtFileUtils=T,exports.RdtHTMLUtils=m,exports.RdtModelUtils=class{static inferPropertyInfo(t,a){const n=e(a).fileName.split("-"),r={};n.forEach(t=>r[t]=1);let i=0,o="";t.forEach(({key:t})=>{const a=e(t).fileName.split("-");let n=0;a.forEach(t=>{var e;return n+=null!=(e=r[t])?e:0});const s=a.includes("id");n>i&&s?(i=n,o=t):n===i&&s&&t.length<o.length&&(o=t)});return t.map(t=>{const a=e(t.key).fileName.split("-"),n=a.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===o,foreignKey:n&&t.key!==o,probablyBoolean:s.includes(a[0])&&"number"===t.type}})}static names(t){return e(t)}},exports.RdtObjectUtils=class{static pluck(t,e){if(!t)return;const a=Array.isArray(e)?e:e.split(".");let n=t;for(const t of a){if(null==n)return;n=Array.isArray(n)&&"string"==typeof t?n[parseInt(t)]:n[t]}return n}static notNullGuard(t){return null!=t}static expandKey(t,e){const a=t.split(".");if(0===a.length)return e;const n=i(a[0]);let r=n;for(let t=1;t<a.length;t++){const e=i(a[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,n.obj}},exports.RdtRandomUtils=class{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}},exports.RdtRxUtils=class{static repeatLatestWhen(e){return a=>t.combineLatest([a,e.pipe(t.startWith(null))]).pipe(t.map(([t])=>t))}static completeIfNull(e){return e.pipe(t.switchMap(e=>null==e?t.EMPTY:t.of(e)))}static makeObservable(e){return e instanceof t.Observable?e:t.of(e)}},exports.RdtStringUtils=o;
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.esm.js CHANGED
@@ -1 +1 @@
1
- import{combineLatest as t,startWith as e,map as n,switchMap as a,EMPTY as r,of as s,Observable as i}from"rxjs";function o(t){return{name:t,className:(n=t,e=l(n),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:l(t),constantName:c(t),fileName:p(t)};var e,n}function l(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,((t,e,n)=>n?n.toUpperCase():"")).replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,(t=>t.toLowerCase()))}function c(t){return p(l(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function p(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const u=["je","lze"];class g{static inferPropertyInfo(t,e){const n=o(e).fileName.split("-"),a={};n.forEach((t=>a[t]=1));let r=0,s="";t.forEach((({key:t})=>{const e=o(t).fileName.split("-");let n=0;e.forEach((t=>{var e;return n+=null!=(e=a[t])?e:0}));const i=e.includes("id");n>r&&i?(r=n,s=t):n===r&&i&&t.length<s.length&&(s=t)}));return t.map((t=>{const e=o(t.key).fileName.split("-"),n=e.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===s,foreignKey:n&&t.key!==s,probablyBoolean:u.includes(e[0])&&"number"===t.type}}))}static names(t){return o(t)}}class m{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,n){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),n,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every((t=>e.indexOf(t)>-1)):!t==!e}}class d{static pluck(t,e){if(!t)return;const n=Array.isArray(e)?e:e.split(".");let a=t;for(const t of n){if(null==a)return;a=Array.isArray(a)&&"string"==typeof t?a[parseInt(t)]:a[t]}return a}static notNullGuard(t){return null!=t}static expandKey(t,e){const n=t.split(".");if(0===n.length)return e;const a=h(n[0]);let r=a;for(let t=1;t<n.length;t++){const e=h(n[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,a.obj}}function h(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class f{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}}class w{static repeatLatestWhen(a){return r=>t([r,a.pipe(e(null))]).pipe(n((([t])=>t)))}static completeIfNull(t){return t.pipe(a((t=>null==t?r:s(t))))}static makeObservable(t){return t instanceof i?t:s(t)}}class y{static tokenize(t){return t?t.split(/\W+/).filter((t=>!!t)):[]}static joinPaths(t,e){const n=t.endsWith("/"),a=e.startsWith("/");return n&&a?t.slice(0,-1)+e:n||a?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=y.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),n=e&&e.index||t.length,a=n-("/"===t[n-1]?1:0);return t.slice(0,a)+t.slice(n)}static createAbsoluteUrl(t,e){return y.joinPaths(e,t)}static appendQueryParams(t,e){if(e&&0!==Object.keys(e).length){return`${t}?${new URLSearchParams(e)}`}return t}static localeCompare(t,e,n="asc"){const a="asc"===n?1:-1;return t==e?0:null==t?-a:null==e?a:t.localeCompare(e)*a}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,n){return e<0||n<0||e>=t.length||n>=t.length?t:(n<e&&([e,n]=[n,e]),t.slice(0,e)+t[n]+t.slice(e+1,n)+t[e]+t.slice(n+1))}static insertAt(t,e,n){return t.slice(0,e)+n+t.slice(e)}static getDataTestId(t,e,n){var a;let r=null==(a=t.toLowerCase())?void 0:a.replace(/ /g,"-");return e&&(r=`${e}__${r}`),n&&(r=`${r}--${n}`),y.removeAccents(r)}}function D(){return D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},D.apply(this,arguments)}const v={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},x={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:v},b=D({},x,{SPACEBAR:"Space"}),M=Array.from(Array(26)).map(((t,e)=>e+65)).map((t=>String.fromCharCode(t))),O=M.map((t=>`Key${t.toUpperCase()}`));class S{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const n=t.offsetLeft,a=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=n,o=n-r+a;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class I{static getDays(t,e){return I.getDayOffset(new Date(t))-I.getDayOffset(new Date(e))}static checkDate(t,e,n){const a=new Date(t,e-1,n);return a.getFullYear()===t&&a.getMonth()+1===e&&a.getDate()===n}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-I.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(I.isValidDate(e)){const t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${n}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(I.hhMmSsMsRegex.test(t)){const n=t.match(I.hhMmSsMsRegex);if(n){const t=parseInt(n[1]),a=parseInt(n[2]),r=parseInt(n[3]),s=parseInt(n[4]);return e.setHours(t,a,r,s),e}}else if(I.hhMmSsRegex.test(t)){const n=t.match(I.hhMmSsRegex);if(n){const t=parseInt(n[1]),a=parseInt(n[2]),r=parseInt(n[3]);return e.setHours(t,a,r),e}}else if(I.hhMmRegex.test(t)){const n=t.match(I.hhMmRegex);if(n){const t=parseInt(n[1]),a=parseInt(n[2]);return e.setHours(t,a),e}}return null}static setTime(t,e){const n=new Date(t),a=I.timeToDate(e);return a&&n.setHours(a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()),n}static getTime(t,e=!0){const n=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");if(e){return`${n}:${a}:${t.getSeconds().toString().padStart(2,"0")}`}return`${n}:${a}`}static parseToDate(t){if(t instanceof Date)return I.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return I.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return I.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,n=t.getMonth()+1,a=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return I.isLeapYear(e+1)?365*e+r+I.daysUpToMonthLeapYear[n-1]+a-1:365*e+r+I.daysUpToMonth[n-1]+a-1}static doubleDigitYearToPast(t){const e=I.getCurrentYear(),n=e%100;return t<=n?t+e-n:t+e-n-100}static doubleDigitYearToFuture(t){const e=I.getCurrentYear(),n=e%100;return t>=n?t+e-n:t+e-n+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const n=new Date(t),a=new Date(e);let r=a.getFullYear()-n.getFullYear();const s=a.getMonth()-n.getMonth(),i=a.getDate()-n.getDate();return(s<0||0===s&&i<0)&&r--,r}}var N,F,_;I.MS=1,I.SECOND=1e3*I.MS,I.MINUTE=60*I.SECOND,I.HOUR=60*I.MINUTE,I.DAY=24*I.HOUR,I.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,I.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,I.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,I.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],I.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],function(t){t[t.January=0]="January",t[t.February=1]="February",t[t.March=2]="March",t[t.April=3]="April",t[t.May=4]="May",t[t.June=5]="June",t[t.July=6]="July",t[t.August=7]="August",t[t.September=8]="September",t[t.October=9]="October",t[t.November=10]="November",t[t.December=11]="December"}(N||(N={})),function(t){t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.ZIP="application/zip",t.JPG="image/jpeg",t.PNG="image/png",t.GIF="image/gif",t.SVG="image/svg+xml",t.HTML="text/html",t.XML="application/xml",t.JSON="application/json",t.MP3="audio/mpeg",t.MP4="video/mp4",t.OGG="audio/ogg",t.WEBM="video/webm",t.WAV="audio/wav",t.AVI="video/x-msvideo",t.MPEG="video/mpeg",t.WEBP="image/webp",t.ICO="image/x-icon",t.TTF="font/ttf",t.WOFF="font/woff",t.WOFF2="font/woff2",t.EOT="application/vnd.ms-fontobject",t.OTF="font/otf",t.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",t.PPT="application/vnd.ms-powerpoint",t.XLS="application/vnd.ms-excel",t.DOC="application/msword",t.ODT="application/vnd.oasis.opendocument.text",t.ODS="application/vnd.oasis.opendocument.spreadsheet",t.ODP="application/vnd.oasis.opendocument.presentation",t.ODF="application/vnd.oasis.opendocument.formula",t.RAR="application/vnd.rar",t.TAR="application/x-tar",t.GZIP="application/gzip",t.BZIP2="application/x-bzip2",t.XZ="application/x-xz",t.SEVENZ="application/x-7z-compressed",t.RAR5="application/x-rar-compressed",t.WMA="audio/x-ms-wma",t.WMV="video/x-ms-wmv",t.FLV="video/x-flv",t.OGV="video/ogg",t.BIN="application/octet-stream",t.UNKNOWN="unknown"}(F||(F={})),function(t){t.IMAGE="image/*",t.AUDIO="audio/*",t.VIDEO="video/*",t.FONT="font/*",t.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",t.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",t.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",t.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed"}(_||(_={}));const T={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin",unknown:"unknown"},C={};for(const[t,e]of Object.entries(T))C[e]=t;var A,R;!function(t){t.Edit="ofe|u|",t.View="ofv|u|"}(A||(A={})),function(t){t.Word="ms-word",t.Excel="ms-excel",t.PowerPoint="ms-powerpoint"}(R||(R={}));const $=F.UNKNOWN,B="ofv|u|";var L;!function(t){t.B="B",t.KB="KB",t.MB="MB",t.GB="GB",t.TB="TB",t.PB="PB",t.EB="EB",t.ZB="ZB",t.YB="YB"}(L||(L={}));const W=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class E{static getMsOfficeLink(t,e){var n;const a=null!=(n=e.app)?n:E.getMsOfficeAppByMimeType(e.mimeType);if(a){var r;return`${a}:${null!=(r=e.action)?r:B}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(E.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const n=E.getBase64Link(t,e);window.open(n,"_blank")}static fileAsArrayBuffer(t){return new Promise(((e,n)=>{t||n(null);const a=new FileReader;a.onload=()=>e(a.result),a.onerror=n,a.readAsArrayBuffer(t)}))}static fileAsText(t,e){return new Promise(((n,a)=>{t||a(null);const r=new FileReader;r.onload=()=>n(r.result),r.onerror=a,r.readAsText(t,e)}))}static downloadFileFromData(t,e,n){var a;n=null!=(a=null!=n?n:E.getMimeTypeFromFileName(e))?a:E.getMimeTypeFromBase64(t);const r=E.getBase64Link(t,n);this.downloadFileFromRemoteUrl(r,e,n)}static downloadFileFromRemoteUrl(t,e,n){n=null!=n?n:E.getMimeTypeFromFileName(e);const a=document.createElement("a");a.href=t,a.download=E.getFileName(e,n),a.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();return C[e]}static getFileName(t,e){if(e&&e!==F.UNKNOWN){const n=T[e];return t.endsWith(`.${n}`)?t:`${t}.${n}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?e===F.UNKNOWN?`data:${F.BIN};base64,${t}`:`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,n,a,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(a=r.split("filename="))||null==(n=a[1])||null==(e=n.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise(((e,n)=>{t||n(null);const a=new FileReader;a.onload=()=>e(a.result),a.onerror=n,a.readAsDataURL(t)}))}static convertFromBytes(t,e=2){if(0===t)return"0 B";const n=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,n)).toFixed(e))+" "+W[n]}static convertToBytes(t,e){const n=W.indexOf(e);return t*Math.pow(1024,n)}static fileSizeToBytes(t){const[e,n]=t.split(" "),a=parseFloat(e),r=n;return isNaN(a)||-1===W.indexOf(r)?null:E.convertToBytes(a,r)}static getMsOfficeAppByMimeType(t){switch(t){case F.DOC:case F.DOCX:case F.ODT:return"ms-word";case F.XLS:case F.XLSX:case F.ODS:return"ms-excel";case F.PPT:case F.PPTX:case F.ODP:return"ms-powerpoint";default:return null}}}class P{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?P.normalizeHex(e):this.isRgbColor(e)?P.normalizeRgb(e):this.isRgbaColor(e)?P.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(P.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(P.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(P.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return P.rgbRegex.test(t)}static isHexColor(t){return P.hexRegex.test(t)}static isRgbaColor(t){return P.rgbaRegex.test(t)}}var U;P.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,P.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,P.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(U||(U={}));const Y={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}};var k,z,H,j,V;!function(t){t[t.Overwrite=0]="Overwrite",t[t.Shift=1]="Shift"}(k||(k={})),function(t){t[t.Replace=0]="Replace",t[t.Insert=1]="Insert"}(z||(z={})),function(t){t[t.FourDigit=1]="FourDigit",t[t.TwoDigit=2]="TwoDigit",t[t.Both=3]="Both"}(H||(H={})),function(t){t[t.NoLeadingZero=1]="NoLeadingZero",t[t.LeadingZero=2]="LeadingZero",t[t.Both=3]="Both"}(j||(j={}));class Z{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get leadingZeroMode(){return this.cfg.leadingZeroMode}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get yearInputMode(){return this.cfg.yearInputMode}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get insertMode(){return this.cfg.insertMode}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var n;this.caretPosition=null!=(n=e.selectionStart)?n:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,n=e.value;var a;const r=null!=(a=e.selectionStart)?a:n.length-1,s=this.parse(n,r);e.value=s.prettyInput,S.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach((n=>{switch(n.type){case"constant":e+=n.value;break;case"day":e+=`${t.getDate()}`.padStart(n.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(n.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**n.maxLength).padStart(n.minLength,"0")}})),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,n=this.deleting){let a=t,r=null,s=null,i=null,o="",l=e,c=!0,p=!1;for(let u=0;u<this._parsedFormat.length&&0!==a.length;u++){const g=this._parsedFormat[u],m=a.search(/\d/);if("constant"===g.type){if(m>0){const e=n?a.substring(0,g.value.length):a.substring(0,m);if(n&&e!==g.value){if(a.length===t.length)continue;l-=g.value.length-e.length}a=a.substring(m)}o+=g.value}else{if(m<0)break;if(l>o.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(a.match(/^\d{3,4}/)||a.match(/^\d{2}$/)&&u!==this._parsedFormat.length-1))if(!n&&0===this.cfg.insertMode&&a.match(/^\d{5}/)&&e<a.length&&e-o.length<=5&&y.isNumericCharacter(a[e])&&(a=a.substring(0,e)+a.substring(e+1)),a.match(/^\d{4}/)){const t=a.substring(0,4);i=parseInt(t),a=a.substring(4),o+=t,n||({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n))}else a.match(/^\d{3}/)?(o+=a.substring(0,3),a=a.substring(3),o.length<=l&&(c=!1)):(o=a.substring(0,2),a=a.substring(2),o.length<=l&&(c=!1));else if(2&this.cfg.yearInputMode&&a.match(/^\d{2}/)&&(this.containsNonNumericCharacters(a.substring(2))||u===this._parsedFormat.length-1)){const t=a.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?I.doubleDigitYearToPast(e):I.doubleDigitYearToFuture(e),a=a.substring(2),n||({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n)),o+=t,1&this.cfg.yearInputMode&&u===this._parsedFormat.length-1&&(p=!0)}else a.match(/^\d/)&&(o+=a[0],a=a.substring(1),o.length<=l&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,o,a,l,n);o=t.output,a=t.rest,l=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!n&&({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n)),!t.complete&&o.length<=l&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,o,a,l,n);o=t.output,a=t.rest,l=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!n&&({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n)),!t.complete&&o.length<=l&&(c=!1))}}}let u=null;if(null!==i&&null!==s&&null!==r&&(u=new Date(i,s-1,r),u.getMonth()!==s-1&&(u=null)),l=Math.min(l,o.length+1),n)u||(o=t,l=e);else if(e===t.length)l=o.length;else if(c)for(;l>0&&o.length>l&&!y.isNumericCharacter(o[l]);)l++;return{prettyInput:o,date:u,complete:null!==u,caret:l,ambiguous:p||null===u}}readNumber(t,e,n,a,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",c=!1;if(1&this.cfg.leadingZeroMode){var p,u;let r=null!=(u=null==(p=a.match(/^\d+/))?void 0:p[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}n+=r,a=a.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);a.match(t)&&(l=a.substring(0,i),n+=l,a=a.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(c=l.length===i||10*o>e,({rest:a,targetCaret:r}=this.useUpNumbersUntilNextSeparator(a,r,c&&!s,s)),{value:o,complete:c,output:n,rest:a,targetCaret:r}):{value:null,complete:!1,output:n,rest:a,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort(((t,e)=>e.length-t.length));let n=t.format;const a=[];for(;n.length>0;){const r=e.map((t=>n.indexOf(t))),s=r.indexOf(Math.min(...r.filter((t=>t>=0)))),i=r[s],o=e[s];i>0?(a.push({type:"constant",value:n.substring(0,i)}),n=n.substring(i)):i<0?(a.push({type:"constant",value:n}),n=""):(a.push(t.symbolMeta[o]),n=n.substring(i+o.length))}return a}useUpNumbersUntilNextSeparator(t,e,n,a){let r=0;for(;r<t.length&&y.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(a?r:0)}:n?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}}!function(t){t.UTF_8="utf-8",t.IBM_866="ibm866",t.ISO_8859_2="iso-8859-2",t.ISO_8859_3="iso-8859-3",t.ISO_8859_4="iso-8859-4",t.ISO_8859_5="iso-8859-5",t.ISO_8859_6="iso-8859-6",t.ISO_8859_7="iso-8859-7",t.ISO_8859_8="iso-8859-8",t.ISO_8859_8_I="iso-8859-8-i",t.ISO_8859_10="iso-8859-10",t.ISO_8859_13="iso-8859-13",t.ISO_8859_14="iso-8859-14",t.ISO_8859_15="iso-8859-15",t.ISO_8859_16="iso-8859-16",t.KOI8_R="koi8-r",t.MACINTOSH="macintosh",t.WINDOWS_874="windows-874",t.WINDOWS_1250="windows-1250",t.WINDOWS_1251="windows-1251",t.WINDOWS_1252="windows-1252",t.WINDOWS_1253="windows-1253",t.WINDOWS_1254="windows-1254",t.WINDOWS_1255="windows-1255",t.WINDOWS_1256="windows-1256",t.WINDOWS_1257="windows-1257",t.WINDOWS_1258="windows-1258",t.X_MAC_CYRILLIC="x-mac-cyrillic",t.GBK="gbk",t.GB18030="gb18030",t.BIG5="big5",t.EUC_JP="euc-jp",t.ISO_2022_JP="iso-2022-jp",t.SHIFT_JIS="shift-jis",t.EUC_KR="euc-kr",t.HZ_GB_2312="hz-gb-2312",t.ISO_2022_CN="iso-2022-cn",t.ISO_2022_CN_EXT="iso-2022-cn-ext",t.ISO_2022_KR="iso-2022-kr",t.UTF_16="utf-16",t.X_USER_DEFINED="x-user-defined"}(V||(V={}));export{M as ALPHABET_KB_KEYS,v as ARROW,T as EXTENSION_BY_MIME_TYPE,L as FileSizeUnit,E as FileUtils,O as KB_ALPHABET_CODES,b as KB_CODE,x as KB_KEY,C as MIME_TYPE_BY_EXTENSION,N as Month,Y as PRIMENG_DATE_FORMAT_META,$ as RDT_DEFAULT_MIME_TYPE,B as RDT_DEFAULT_MS_OFFICE_ACTION,m as RdtArrayUtils,_ as RdtCombinedMimeType,P as RdtCssUtils,Z as RdtDateParser,I as RdtDateUtils,V as RdtEncoding,S as RdtHTMLUtils,k as RdtInsertMode,j as RdtLeadingZeroInputMode,F as RdtMimeType,g as RdtModelUtils,A as RdtMsOfficeAction,R as RdtMsOfficeApp,d as RdtObjectUtils,z as RdtPasteMode,f as RdtRandomUtils,w as RdtRxUtils,y as RdtStringUtils,H as RdtYearInputMode};
1
+ import{combineLatest as t,startWith as e,map as n,switchMap as a,EMPTY as r,of as s,Observable as i}from"rxjs";function o(t){return{name:t,className:(n=t,e=l(n),e.charAt(0).toUpperCase()+e.slice(1)),propertyName:l(t),constantName:c(t),fileName:p(t)};var e,n}function l(t){return t.replace(/([^a-zA-Z0-9])+(.)?/g,(t,e,n)=>n?n.toUpperCase():"").replace(/[^a-zA-Z\d]/g,"").replace(/^([A-Z])/,t=>t.toLowerCase())}function c(t){return p(l(t.toUpperCase()===t?t.toLowerCase():t)).replace(/([^a-zA-Z0-9])/g,"_").toUpperCase()}function p(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase().replace(/(?!^_)[ _]/g,"-")}const u=["je","lze"];class g{static inferPropertyInfo(t,e){const n=o(e).fileName.split("-"),a={};n.forEach(t=>a[t]=1);let r=0,s="";t.forEach(({key:t})=>{const e=o(t).fileName.split("-");let n=0;e.forEach(t=>{var e;return n+=null!=(e=a[t])?e:0});const i=e.includes("id");n>r&&i?(r=n,s=t):n===r&&i&&t.length<s.length&&(s=t)});return t.map(t=>{const e=o(t.key).fileName.split("-"),n=e.includes("id");return{key:t.key,type:t.type,required:!0,formControlType:"date"===t.type?"string":t.type,primaryKey:t.key===s,foreignKey:n&&t.key!==s,probablyBoolean:u.includes(e[0])&&"number"===t.type}})}static names(t){return o(t)}}class m{static removeAt(t,e){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),...t.slice(e+1)]}static insertAt(t,e,n){if(e<0||e>t.length)throw new Error(`Out of bounds! Array length: ${t.length}, index: ${e}`);return[...t.slice(0,e),n,...t.slice(e)]}static isEqual(t,e){return t&&e?t.length===e.length&&t.every(t=>e.indexOf(t)>-1):!t==!e}}class d{static pluck(t,e){if(!t)return;const n=Array.isArray(e)?e:e.split(".");let a=t;for(const t of n){if(null==a)return;a=Array.isArray(a)&&"string"==typeof t?a[parseInt(t)]:a[t]}return a}static notNullGuard(t){return null!=t}static expandKey(t,e){const n=t.split(".");if(0===n.length)return e;const a=h(n[0]);let r=a;for(let t=1;t<n.length;t++){const e=h(n[t]);r.obj[r.key]=e.obj,r=e}return r.obj[r.key]=e,a.obj}}function h(t){const e=parseInt(t);return isNaN(e)?{obj:{},key:t}:{obj:[],key:e}}class f{static randomId(){return Math.random().toString(36).substring(2)}static trueFalse(){return Math.random()<.5}}class w{static repeatLatestWhen(a){return r=>t([r,a.pipe(e(null))]).pipe(n(([t])=>t))}static completeIfNull(t){return t.pipe(a(t=>null==t?r:s(t)))}static makeObservable(t){return t instanceof i?t:s(t)}}class y{static tokenize(t){return t?t.split(/\W+/).filter(t=>!!t):[]}static joinPaths(t,e){const n=t.endsWith("/"),a=e.startsWith("/");return n&&a?t.slice(0,-1)+e:n||a?t+e:t+"/"+e}static isAlphabetCharacter(t){return!(t.length>1)&&t.toLocaleLowerCase()!==t.toLocaleUpperCase()}static isNumericCharacter(t){return!isNaN(parseInt(t))}static capitalize(t){return t.charAt(0).toLocaleUpperCase()+t.slice(1)}static toDataTestId(t){var e;return null==(e=y.removeAccents(t).toLowerCase())?void 0:e.replace(/ /g,"-")}static removeAccents(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static stripTrailingSlash(t){const e=t.match(/#|\?|$/),n=e&&e.index||t.length,a=n-("/"===t[n-1]?1:0);return t.slice(0,a)+t.slice(n)}static createAbsoluteUrl(t,e){return y.joinPaths(e,t)}static appendQueryParams(t,e){if(e&&0!==Object.keys(e).length){return`${t}?${new URLSearchParams(e)}`}return t}static localeCompare(t,e,n="asc"){const a="asc"===n?1:-1;return t==e?0:null==t?-a:null==e?a:t.localeCompare(e)*a}static komixcomlocalReplaceString(t){const e=location.hostname;return{replaceString:t.includes("komix.com")?"komix.com":"komix.local",toReplace:e.includes("komix.com")?"komix.com":"komix.local"}}static swapChars(t,e,n){return e<0||n<0||e>=t.length||n>=t.length?t:(n<e&&([e,n]=[n,e]),t.slice(0,e)+t[n]+t.slice(e+1,n)+t[e]+t.slice(n+1))}static insertAt(t,e,n){return t.slice(0,e)+n+t.slice(e)}static getDataTestId(t,e,n){var a;let r=null==(a=t.toLowerCase())?void 0:a.replace(/ /g,"-");return e&&(r=`${e}__${r}`),n&&(r=`${r}--${n}`),y.removeAccents(r)}}function D(){return D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},D.apply(this,arguments)}const v={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight"},x={SPACEBAR:" ",ENTER:"Enter",ESCAPE:"Escape",HOME:"Home",END:"End",TAB:"Tab",ARROW:v},b=D({},x,{SPACEBAR:"Space"}),M=Array.from(Array(26)).map((t,e)=>e+65).map(t=>String.fromCharCode(t)),O=M.map(t=>`Key${t.toUpperCase()}`);class S{static scrollIntoViewHorizontallyWithinParent(t){const e=t.parentElement;if(!e)return;const n=t.offsetLeft,a=t.offsetWidth,r=e.offsetWidth,s=e.scrollLeft,i=n,o=n-r+a;s>i?e.scrollLeft=i:s<o&&(e.scrollLeft=o)}static setCaretPosition(t,e){t.focus(),t.setSelectionRange(e,e)}}class I{static getDays(t,e){return I.getDayOffset(new Date(t))-I.getDayOffset(new Date(e))}static checkDate(t,e,n){const a=new Date(t,e-1,n);return a.getFullYear()===t&&a.getMonth()+1===e&&a.getDate()===n}static isValidDate(t){return null!=t&&(t instanceof Date?!isNaN(t.getTime()):!isNaN(new Date(t).getTime()))}static startOfDay(t){const e=new Date(t);return e.setHours(0,0,0,0),e}static endOfDay(t){const e=new Date(t);return e.setHours(23,59,59),e}static startOfMonth(t){const e=new Date(t);return e.setHours(0,0,0,0),e.setDate(1),e}static endOfMonth(t){const e=new Date(t);return e.setHours(23,59,59),e.setDate(0),e}static startOfYear(t){return new Date(t,0,1)}static endOfYear(t){return new Date(t,11,31)}static beginningOfNextMonth(){const t=new Date;return 11===t.getMonth()?new Date(t.getFullYear()+1,0,1):new Date(t.getFullYear(),t.getMonth()+1,1)}static endOfNextMonth(){const t=new Date;if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,0,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+2,1);return this.minusOneDay(e)}}static beginningOfInThreeMonths(){const t=new Date;return 10===t.getMonth()?new Date(t.getFullYear()+1,1,1):11===t.getMonth()?new Date(t.getFullYear()+1,2,1):new Date(t.getFullYear(),t.getMonth()+3,1)}static endOfInNextThreeMonths(){const t=new Date;if(9===t.getMonth()){const e=new Date(t.getFullYear()+1,1,1);return this.minusOneDay(e)}if(10===t.getMonth()){const e=new Date(t.getFullYear()+1,2,1);return this.minusOneDay(e)}if(11===t.getMonth()){const e=new Date(t.getFullYear()+1,3,1);return this.minusOneDay(e)}{const e=new Date(t.getFullYear(),t.getMonth()+4,1);return this.minusOneDay(e)}}static minusOneDay(t){return new Date(t.getTime()-I.DAY)}static toISOLocal(t){return`${t.getFullYear()}-${`${t.getMonth()+1}`.padStart(2,"0")}-${`${t.getDate()}`.padStart(2,"0")}T${`${t.getHours()}`.padStart(2,"0")}:${`${t.getMinutes()}`.padStart(2,"0")}:${`${t.getSeconds()}`.padStart(2,"0")}`}static formatDate(t){if(null==t||""===t)return"";const e=t instanceof Date?t:new Date(t);if(I.isValidDate(e)){const t=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0");return`${`${e.getDate()}`.padStart(2,"0")}.${n}.${t}`}return""}static timeToDate(t){const e=new Date(0);if(I.hhMmSsMsRegex.test(t)){const n=t.match(I.hhMmSsMsRegex);if(n){const t=parseInt(n[1]),a=parseInt(n[2]),r=parseInt(n[3]),s=parseInt(n[4]);return e.setHours(t,a,r,s),e}}else if(I.hhMmSsRegex.test(t)){const n=t.match(I.hhMmSsRegex);if(n){const t=parseInt(n[1]),a=parseInt(n[2]),r=parseInt(n[3]);return e.setHours(t,a,r),e}}else if(I.hhMmRegex.test(t)){const n=t.match(I.hhMmRegex);if(n){const t=parseInt(n[1]),a=parseInt(n[2]);return e.setHours(t,a),e}}return null}static setTime(t,e){const n=new Date(t),a=I.timeToDate(e);return a&&n.setHours(a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()),n}static getTime(t,e=!0){const n=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");if(e){return`${n}:${a}:${t.getSeconds().toString().padStart(2,"0")}`}return`${n}:${a}`}static parseToDate(t){if(t instanceof Date)return I.isValidDate(t)?t:null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e}return null}static parse(t){if(t instanceof Date)return I.isValidDate(t)?t.getTime():null;if("string"==typeof t){const e=new Date(t);if(I.isValidDate(e))return e.getTime()}return null}static isEqual(t,e){return t===e||!(!t||!e)&&t.getTime()===e.getTime()}static isLeapYear(t){return 29===new Date(t,1,29).getDate()}static getDaysInYear(t){return I.isLeapYear(t)?366:365}static getDayOffset(t){const e=t.getFullYear()-1,n=t.getMonth()+1,a=t.getDate(),r=Math.trunc(e/4)-Math.trunc(e/100)+Math.trunc(e/400);return I.isLeapYear(e+1)?365*e+r+I.daysUpToMonthLeapYear[n-1]+a-1:365*e+r+I.daysUpToMonth[n-1]+a-1}static doubleDigitYearToPast(t){const e=I.getCurrentYear(),n=e%100;return t<=n?t+e-n:t+e-n-100}static doubleDigitYearToFuture(t){const e=I.getCurrentYear(),n=e%100;return t>=n?t+e-n:t+e-n+100}static getCurrentYear(){return(new Date).getFullYear()}static calculateAge(t,e){const n=new Date(t),a=new Date(e);let r=a.getFullYear()-n.getFullYear();const s=a.getMonth()-n.getMonth(),i=a.getDate()-n.getDate();return(s<0||0===s&&i<0)&&r--,r}}var N,F,_;I.MS=1,I.SECOND=1e3*I.MS,I.MINUTE=60*I.SECOND,I.HOUR=60*I.MINUTE,I.DAY=24*I.HOUR,I.hhMmRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*$/,I.hhMmSsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*$/,I.hhMmSsMsRegex=/^\s*([0-9]|0[0-9]|1[0-9]|2[0-3])\s*\W+\s*([0-5]?[0-9])\s*\W+\s*([0-5]?\d)\s*[\W|\s]\s*(\d{1,3})\s*$/,I.daysUpToMonth=[0,31,59,90,120,151,181,212,243,273,304,334],I.daysUpToMonthLeapYear=[0,31,60,91,121,152,182,213,244,274,305,335],function(t){t[t.January=0]="January",t[t.February=1]="February",t[t.March=2]="March",t[t.April=3]="April",t[t.May=4]="May",t[t.June=5]="June",t[t.July=6]="July",t[t.August=7]="August",t[t.September=8]="September",t[t.October=9]="October",t[t.November=10]="November",t[t.December=11]="December"}(N||(N={})),function(t){t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.ZIP="application/zip",t.JPG="image/jpeg",t.PNG="image/png",t.GIF="image/gif",t.SVG="image/svg+xml",t.HTML="text/html",t.XML="application/xml",t.JSON="application/json",t.MP3="audio/mpeg",t.MP4="video/mp4",t.OGG="audio/ogg",t.WEBM="video/webm",t.WAV="audio/wav",t.AVI="video/x-msvideo",t.MPEG="video/mpeg",t.WEBP="image/webp",t.ICO="image/x-icon",t.TTF="font/ttf",t.WOFF="font/woff",t.WOFF2="font/woff2",t.EOT="application/vnd.ms-fontobject",t.OTF="font/otf",t.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",t.PPT="application/vnd.ms-powerpoint",t.XLS="application/vnd.ms-excel",t.DOC="application/msword",t.ODT="application/vnd.oasis.opendocument.text",t.ODS="application/vnd.oasis.opendocument.spreadsheet",t.ODP="application/vnd.oasis.opendocument.presentation",t.ODF="application/vnd.oasis.opendocument.formula",t.RAR="application/vnd.rar",t.TAR="application/x-tar",t.GZIP="application/gzip",t.BZIP2="application/x-bzip2",t.XZ="application/x-xz",t.SEVENZ="application/x-7z-compressed",t.RAR5="application/x-rar-compressed",t.WMA="audio/x-ms-wma",t.WMV="video/x-ms-wmv",t.FLV="video/x-flv",t.OGV="video/ogg",t.BIN="application/octet-stream",t.UNKNOWN="unknown"}(F||(F={})),function(t){t.IMAGE="image/*",t.AUDIO="audio/*",t.VIDEO="video/*",t.FONT="font/*",t.DOCUMENT="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,application/pdf,text/plain,text/csv",t.SPREADSHEET="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet",t.PRESENTATION="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.oasis.opendocument.presentation",t.ARCHIVE="application/zip,application/vnd.rar,application/x-tar,application/gzip,application/x-bzip2,application/x-xz,application/x-7z-compressed,application/x-rar-compressed"}(_||(_={}));const T={"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/pdf":"pdf","text/plain":"txt","text/csv":"csv","application/zip":"zip","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","text/html":"html","application/xml":"xml","application/json":"json","audio/mpeg":"mp3","video/mp4":"mp4","audio/ogg":"ogg","video/webm":"webm","audio/wav":"wav","video/x-msvideo":"avi","video/mpeg":"mpeg","image/webp":"webp","image/x-icon":"ico","font/ttf":"ttf","font/woff":"woff","font/woff2":"woff2","application/vnd.ms-fontobject":"eot","font/otf":"otf","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-excel":"xls","application/msword":"doc","application/vnd.oasis.opendocument.text":"odt","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.formula":"odf","application/vnd.rar":"rar","application/x-tar":"tar","application/gzip":"gz","application/x-bzip2":"bz2","application/x-xz":"xz","application/x-7z-compressed":"7z","application/x-rar-compressed":"rar","audio/x-ms-wma":"wma","video/x-ms-wmv":"wmv","video/x-flv":"flv","video/ogg":"ogv","application/octet-stream":"bin",unknown:"unknown"},C={};for(const[t,e]of Object.entries(T))C[e]=t;var A,R;!function(t){t.Edit="ofe|u|",t.View="ofv|u|"}(A||(A={})),function(t){t.Word="ms-word",t.Excel="ms-excel",t.PowerPoint="ms-powerpoint"}(R||(R={}));const $=F.UNKNOWN,B="ofv|u|";var L;!function(t){t.B="B",t.KB="KB",t.MB="MB",t.GB="GB",t.TB="TB",t.PB="PB",t.EB="EB",t.ZB="ZB",t.YB="YB"}(L||(L={}));const W=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];class E{static getMsOfficeLink(t,e){var n;const a=null!=(n=e.app)?n:E.getMsOfficeAppByMimeType(e.mimeType);if(a){var r;return`${a}:${null!=(r=e.action)?r:B}${t}`}return t}static openFileFromRemoteUrl(t,e){window.open(E.getMsOfficeLink(t,e))}static openFileInBrowser(t,e){const n=E.getBase64Link(t,e);window.open(n,"_blank")}static fileAsArrayBuffer(t){return new Promise((e,n)=>{t||n(null);const a=new FileReader;a.onload=()=>e(a.result),a.onerror=n,a.readAsArrayBuffer(t)})}static fileAsText(t,e){return new Promise((n,a)=>{t||a(null);const r=new FileReader;r.onload=()=>n(r.result),r.onerror=a,r.readAsText(t,e)})}static downloadFileFromData(t,e,n){var a;n=null!=(a=null!=n?n:E.getMimeTypeFromFileName(e))?a:E.getMimeTypeFromBase64(t);const r=E.getBase64Link(t,n);this.downloadFileFromRemoteUrl(r,e,n)}static downloadFileFromRemoteUrl(t,e,n){n=null!=n?n:E.getMimeTypeFromFileName(e);const a=document.createElement("a");a.href=t,a.download=E.getFileName(e,n),a.click()}static getMimeTypeFromBase64(t){var e;return null==(e=t.match(/data:(.*?);base64/))?void 0:e[1]}static getMimeTypeFromFileName(t){const e=null==t?void 0:t.split(".").pop();return C[e]}static getFileName(t,e){if(e&&e!==F.UNKNOWN){const n=T[e];return t.endsWith(`.${n}`)?t:`${t}.${n}`}return t}static getBase64Link(t,e){return t.startsWith("data:")?t:e?e===F.UNKNOWN?`data:${F.BIN};base64,${t}`:`data:${e};base64,${t}`:(console.error("Missing mime type for base64 data."),"")}static getMimeTypeFromResponse(t){var e;return null==(e=t.body)?void 0:e.type}static getFileNameFromResponse(t){var e,n,a,r,s;return null!=(s=null==(r=t.headers.get("content-disposition"))||null==(a=r.split("filename="))||null==(n=a[1])||null==(e=n.split(";"))?void 0:e[0])?s:""}static async blobToDataUrl(t){return new Promise((e,n)=>{t||n(null);const a=new FileReader;a.onload=()=>e(a.result),a.onerror=n,a.readAsDataURL(t)})}static convertFromBytes(t,e=2){if(0===t)return"0 B";const n=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,n)).toFixed(e))+" "+W[n]}static convertToBytes(t,e){const n=W.indexOf(e);return t*Math.pow(1024,n)}static fileSizeToBytes(t){const[e,n]=t.split(" "),a=parseFloat(e),r=n;return isNaN(a)||-1===W.indexOf(r)?null:E.convertToBytes(a,r)}static getMsOfficeAppByMimeType(t){switch(t){case F.DOC:case F.DOCX:case F.ODT:return"ms-word";case F.XLS:case F.XLSX:case F.ODS:return"ms-excel";case F.PPT:case F.PPTX:case F.ODP:return"ms-powerpoint";default:return null}}}class P{static normalizeColor(t){const e=t.trim();return this.isHexColor(e)?P.normalizeHex(e):this.isRgbColor(e)?P.normalizeRgb(e):this.isRgbaColor(e)?P.normalizeRgba(e):null}static normalizeHex(t){const e=t.match(P.hexRegex);return e?`#${e[2]}`:null}static normalizeRgb(t){const e=t.match(P.rgbRegex);return e?`rgb(${e[2]},${e[3]},${e[4]})`:null}static normalizeRgba(t){const e=t.match(P.rgbaRegex);return e?`rgba(${e[2]},${e[3]},${e[4]},${e[5]})`:null}static isRgbColor(t){return P.rgbRegex.test(t)}static isHexColor(t){return P.hexRegex.test(t)}static isRgbaColor(t){return P.rgbaRegex.test(t)}}var U;P.rgbRegex=/^(rgb)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)?$/,P.rgbaRegex=/^(rgba)?\(?\s*([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+([01]?\d\d?|2[0-4]\d|25[0-5])\W+((0(\.\d+)?)|(1(\.0)?))\s*\)?$/,P.hexRegex=/^(#?)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,function(t){t.Day="day",t.Month="month",t.Year="year",t.Constant="constant"}(U||(U={}));const Y={d:{type:"day",minLength:1,maxLength:2},dd:{type:"day",minLength:2,maxLength:2},m:{type:"month",minLength:1,maxLength:2},mm:{type:"month",minLength:2,maxLength:2},y:{type:"year",minLength:2,maxLength:2},yy:{type:"year",minLength:4,maxLength:4}};var k,z,H,j,V;!function(t){t[t.Overwrite=0]="Overwrite",t[t.Shift=1]="Shift"}(k||(k={})),function(t){t[t.Replace=0]="Replace",t[t.Insert=1]="Insert"}(z||(z={})),function(t){t[t.FourDigit=1]="FourDigit",t[t.TwoDigit=2]="TwoDigit",t[t.Both=3]="Both"}(H||(H={})),function(t){t[t.NoLeadingZero=1]="NoLeadingZero",t[t.LeadingZero=2]="LeadingZero",t[t.Both=3]="Both"}(j||(j={}));class Z{set leadingZeroMode(t){this.cfg.leadingZeroMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get leadingZeroMode(){return this.cfg.leadingZeroMode}set yearInputMode(t){this.cfg.yearInputMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get yearInputMode(){return this.cfg.yearInputMode}set twoDigitYearInputStrategy(t){this.cfg.twoDigitYearInputStrategy=t,this._parsedFormat=this.parseFormat(this.cfg)}get twoDigitYearInputStrategy(){return this.cfg.twoDigitYearInputStrategy}set insertMode(t){this.cfg.insertMode=t,this._parsedFormat=this.parseFormat(this.cfg)}get insertMode(){return this.cfg.insertMode}set format(t){this.cfg.format=t,this._parsedFormat=this.parseFormat(this.cfg)}get format(){return this.cfg.format}onKeyDown(t){"Backspace"===t.key&&(this.deleting=!0);const e=t.target;var n;this.caretPosition=null!=(n=e.selectionStart)?n:e.value.length-1}onKeyUp(t){"Backspace"===t.key&&(this.deleting=!1)}onInput(t){const e=t.target,n=e.value;var a;const r=null!=(a=e.selectionStart)?a:n.length-1,s=this.parse(n,r);e.value=s.prettyInput,S.setCaretPosition(e,s.caret),this._value=s.date,this._inputValue=s.prettyInput,this.caretPosition=s.caret}get value(){return this._value}set value(t){if(!(t instanceof Date))return this._value=null,void(this._inputValue="");let e="";this._parsedFormat.forEach(n=>{switch(n.type){case"constant":e+=n.value;break;case"day":e+=`${t.getDate()}`.padStart(n.minLength,"0");break;case"month":e+=`${t.getMonth()+1}`.padStart(n.minLength,"0");break;case"year":e+=(""+t.getFullYear()%10**n.maxLength).padStart(n.minLength,"0")}}),this._value=t,this._inputValue=e}set inputValue(t){this._inputValue=t}get inputValue(){return this._inputValue}parse(t,e=this.caretPosition,n=this.deleting){let a=t,r=null,s=null,i=null,o="",l=e,c=!0,p=!1;for(let u=0;u<this._parsedFormat.length&&0!==a.length;u++){const g=this._parsedFormat[u],m=a.search(/\d/);if("constant"===g.type){if(m>0){const e=n?a.substring(0,g.value.length):a.substring(0,m);if(n&&e!==g.value){if(a.length===t.length)continue;l-=g.value.length-e.length}a=a.substring(m)}o+=g.value}else{if(m<0)break;if(l>o.length&&(c=!0),"year"===g.type)if(1&this.cfg.yearInputMode&&(a.match(/^\d{3,4}/)||a.match(/^\d{2}$/)&&u!==this._parsedFormat.length-1))if(!n&&0===this.cfg.insertMode&&a.match(/^\d{5}/)&&e<a.length&&e-o.length<=5&&y.isNumericCharacter(a[e])&&(a=a.substring(0,e)+a.substring(e+1)),a.match(/^\d{4}/)){const t=a.substring(0,4);i=parseInt(t),a=a.substring(4),o+=t,n||({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n))}else a.match(/^\d{3}/)?(o+=a.substring(0,3),a=a.substring(3),o.length<=l&&(c=!1)):(o=a.substring(0,2),a=a.substring(2),o.length<=l&&(c=!1));else if(2&this.cfg.yearInputMode&&a.match(/^\d{2}/)&&(this.containsNonNumericCharacters(a.substring(2))||u===this._parsedFormat.length-1)){const t=a.substring(0,2),e=parseInt(t);i="past"===this.cfg.twoDigitYearInputStrategy?I.doubleDigitYearToPast(e):I.doubleDigitYearToFuture(e),a=a.substring(2),n||({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n)),o+=t,1&this.cfg.yearInputMode&&u===this._parsedFormat.length-1&&(p=!0)}else a.match(/^\d/)&&(o+=a[0],a=a.substring(1),o.length<=l&&(c=!1));else if("month"===g.type){const t=this.readNumber(1,12,o,a,l,n);o=t.output,a=t.rest,l=t.targetCaret,null!==t.value&&(s=t.value,t.complete&&!n&&({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n)),!t.complete&&o.length<=l&&(c=!1))}else if("day"===g.type){const t=this.readNumber(1,31,o,a,l,n);o=t.output,a=t.rest,l=t.targetCaret,null!==t.value&&(r=t.value,t.complete&&!n&&({rest:a,targetCaret:l}=this.useUpNumbersUntilNextSeparator(a,l,!0,n)),!t.complete&&o.length<=l&&(c=!1))}}}let u=null;if(null!==i&&null!==s&&null!==r&&(u=new Date(i,s-1,r),u.getMonth()!==s-1&&(u=null)),l=Math.min(l,o.length+1),n)u||(o=t,l=e);else if(e===t.length)l=o.length;else if(c)for(;l>0&&o.length>l&&!y.isNumericCharacter(o[l]);)l++;return{prettyInput:o,date:u,complete:null!==u,caret:l,ambiguous:p||null===u}}readNumber(t,e,n,a,r,s){const i=function(t){return Math.log10(t)+1|0}(e);let o=null,l="",c=!1;if(1&this.cfg.leadingZeroMode){var p,u;let r=null!=(u=null==(p=a.match(/^\d+/))?void 0:p[0])?u:"";if(r.length>0){if(r=r.slice(0,i),o=parseInt(r),o<t){o=null;let e="9";for(;r.length+1>i||parseInt(r+e)<t;)r=r.slice(0,-1),e+="9"}else{for(;o>e&&r.length>0;)r=r.slice(0,-1),o=parseInt(r);0===r.length&&(o=null)}"0"!==r[0]||0===t||2&this.cfg.leadingZeroMode||(o=null,r="")}n+=r,a=a.substring(r.length),l=r}else{const t=new RegExp(`^\\d{${i}}`);a.match(t)&&(l=a.substring(0,i),n+=l,a=a.substring(i),o=parseInt(l))}return null!==o&&o>=t&&o<=e?(c=l.length===i||10*o>e,({rest:a,targetCaret:r}=this.useUpNumbersUntilNextSeparator(a,r,c&&!s,s)),{value:o,complete:c,output:n,rest:a,targetCaret:r}):{value:null,complete:!1,output:n,rest:a,targetCaret:r}}parseFormat(t){const e=Object.keys(t.symbolMeta);e.sort((t,e)=>e.length-t.length);let n=t.format;const a=[];for(;n.length>0;){const r=e.map(t=>n.indexOf(t)),s=r.indexOf(Math.min(...r.filter(t=>t>=0))),i=r[s],o=e[s];i>0?(a.push({type:"constant",value:n.substring(0,i)}),n=n.substring(i)):i<0?(a.push({type:"constant",value:n}),n=""):(a.push(t.symbolMeta[o]),n=n.substring(i+o.length))}return a}useUpNumbersUntilNextSeparator(t,e,n,a){let r=0;for(;r<t.length&&y.isNumericCharacter(t[r]);)r++;return r!==t.length?{rest:t.substring(r),targetCaret:e-(a?r:0)}:n?{rest:" "+t,targetCaret:e}:{rest:t,targetCaret:e}}containsNonNumericCharacters(t){return t.search(/\D/)>=0}constructor(t){this.cfg=t,this._inputValue="",this._value=null,this._parsedFormat=this.parseFormat(t),this.deleting=!1,this.caretPosition=0}}!function(t){t.UTF_8="utf-8",t.IBM_866="ibm866",t.ISO_8859_2="iso-8859-2",t.ISO_8859_3="iso-8859-3",t.ISO_8859_4="iso-8859-4",t.ISO_8859_5="iso-8859-5",t.ISO_8859_6="iso-8859-6",t.ISO_8859_7="iso-8859-7",t.ISO_8859_8="iso-8859-8",t.ISO_8859_8_I="iso-8859-8-i",t.ISO_8859_10="iso-8859-10",t.ISO_8859_13="iso-8859-13",t.ISO_8859_14="iso-8859-14",t.ISO_8859_15="iso-8859-15",t.ISO_8859_16="iso-8859-16",t.KOI8_R="koi8-r",t.MACINTOSH="macintosh",t.WINDOWS_874="windows-874",t.WINDOWS_1250="windows-1250",t.WINDOWS_1251="windows-1251",t.WINDOWS_1252="windows-1252",t.WINDOWS_1253="windows-1253",t.WINDOWS_1254="windows-1254",t.WINDOWS_1255="windows-1255",t.WINDOWS_1256="windows-1256",t.WINDOWS_1257="windows-1257",t.WINDOWS_1258="windows-1258",t.X_MAC_CYRILLIC="x-mac-cyrillic",t.GBK="gbk",t.GB18030="gb18030",t.BIG5="big5",t.EUC_JP="euc-jp",t.ISO_2022_JP="iso-2022-jp",t.SHIFT_JIS="shift-jis",t.EUC_KR="euc-kr",t.HZ_GB_2312="hz-gb-2312",t.ISO_2022_CN="iso-2022-cn",t.ISO_2022_CN_EXT="iso-2022-cn-ext",t.ISO_2022_KR="iso-2022-kr",t.UTF_16="utf-16",t.X_USER_DEFINED="x-user-defined"}(V||(V={}));export{M as ALPHABET_KB_KEYS,v as ARROW,T as EXTENSION_BY_MIME_TYPE,O as KB_ALPHABET_CODES,b as KB_CODE,x as KB_KEY,C as MIME_TYPE_BY_EXTENSION,N as Month,Y as PRIMENG_DATE_FORMAT_META,$ as RDT_DEFAULT_MIME_TYPE,B as RDT_DEFAULT_MS_OFFICE_ACTION,m as RdtArrayUtils,_ as RdtCombinedMimeType,P as RdtCssUtils,Z as RdtDateParser,I as RdtDateUtils,V as RdtEncoding,L as RdtFileSizeUnit,E as RdtFileUtils,S as RdtHTMLUtils,k as RdtInsertMode,j as RdtLeadingZeroInputMode,F as RdtMimeType,g as RdtModelUtils,A as RdtMsOfficeAction,R as RdtMsOfficeApp,d as RdtObjectUtils,z as RdtPasteMode,f as RdtRandomUtils,w as RdtRxUtils,y as RdtStringUtils,H as RdtYearInputMode};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrdt/utils",
3
- "version": "v0.0.17",
3
+ "version": "v0.0.18",
4
4
  "peerDependencies": {
5
5
  "rxjs": ">=7.0.0",
6
6
  "@angular/common": ">=18.2.0",
@@ -1,5 +1,5 @@
1
1
  import { HttpResponse } from '@angular/common/http';
2
- import { RdtEncoding } from '../types/encodings';
2
+ import { AllEncodingAliases } from '../types/encodings';
3
3
  import { RdtMimeType } from '../types/mime-types';
4
4
  import { Nullable } from '../types/type';
5
5
  export declare enum RdtMsOfficeAction {
@@ -16,7 +16,7 @@ export interface RdtMsOfficeConfig {
16
16
  app?: RdtMsOfficeApp;
17
17
  action?: RdtMsOfficeAction;
18
18
  }
19
- export interface RdtDocumentFile<T = string> {
19
+ export interface RdtFile<T = string> {
20
20
  fileName: string;
21
21
  content?: T;
22
22
  url?: string;
@@ -35,7 +35,7 @@ export interface DokumentProtokol {
35
35
  }
36
36
  export declare const RDT_DEFAULT_MIME_TYPE = RdtMimeType.UNKNOWN;
37
37
  export declare const RDT_DEFAULT_MS_OFFICE_ACTION = RdtMsOfficeAction.View;
38
- export declare enum FileSizeUnit {
38
+ export declare enum RdtFileSizeUnit {
39
39
  B = "B",
40
40
  KB = "KB",
41
41
  MB = "MB",
@@ -46,13 +46,13 @@ export declare enum FileSizeUnit {
46
46
  ZB = "ZB",
47
47
  YB = "YB"
48
48
  }
49
- export type RdtFileSize = `${number} ${FileSizeUnit}`;
50
- export declare class FileUtils {
49
+ export type RdtFileSize = `${number} ${RdtFileSizeUnit}`;
50
+ export declare class RdtFileUtils {
51
51
  static getMsOfficeLink(url: string, config: RdtMsOfficeConfig): string;
52
52
  static openFileFromRemoteUrl(url: string, config: RdtMsOfficeConfig): void;
53
53
  static openFileInBrowser(stringData: string, mimeType?: RdtMimeType): void;
54
54
  static fileAsArrayBuffer(file: Blob): Promise<ArrayBuffer>;
55
- static fileAsText(file: Blob, encoding?: RdtEncoding): Promise<string>;
55
+ static fileAsText(file: Blob, encoding?: AllEncodingAliases): Promise<string>;
56
56
  static downloadFileFromData(stringData: string, filename: string, mimeType?: RdtMimeType): void;
57
57
  static downloadFileFromRemoteUrl(url: string, filename: string, mimeType?: RdtMimeType): void;
58
58
  static getMimeTypeFromBase64(base64Data: string): RdtMimeType | undefined;
@@ -63,7 +63,7 @@ export declare class FileUtils {
63
63
  static getFileNameFromResponse(resp: HttpResponse<Blob>): string;
64
64
  static blobToDataUrl(file: Blob): Promise<string>;
65
65
  static convertFromBytes(bytes: number, decimals?: number): string;
66
- static convertToBytes(amount: number, unit: FileSizeUnit): number;
66
+ static convertToBytes(amount: number, unit: RdtFileSizeUnit): number;
67
67
  static fileSizeToBytes(fileSize: RdtFileSize): number | null;
68
68
  static getMsOfficeAppByMimeType(mimeType: RdtMimeType | undefined): RdtMsOfficeApp | null;
69
69
  }
package/index.cjs.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src\\index";
package/index.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src\\index";