@esmalley/ts-utils 6.3.7 → 6.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/types/Dates.d.ts +2 -1
- package/dist/types/Dates.d.ts.map +1 -1
- package/dist/types/Timezones.d.ts +2 -0
- package/dist/types/Timezones.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ne=(c,t,e)=>t in c?$(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var re=(c,t)=>{for(var e in t)$(c,e,{get:t[e],enumerable:!0})},se=(c,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ee(t))!te.call(c,n)&&n!==e&&$(c,n,{get:()=>t[n],enumerable:!(r=Q(t,n))||r.enumerable});return c};var ie=c=>se($({},"__esModule",{value:!0}),c);var b=(c,t,e)=>ne(c,typeof t!="symbol"?t+"":t,e);var ce={};re(ce,{Arithmetic:()=>P,Arrayifier:()=>G,CSV:()=>H,Color:()=>U,Dates:()=>W,Kontororu:()=>_,Objector:()=>z,Sorter:()=>
|
|
2
|
-
`),o=new Blob([s],{type:"text/csv"}),i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download="srating-data.csv",document.body.appendChild(a),a.click(),URL.revokeObjectURL(i),a.remove()}};var U=class c{static lerpColor(t,e,r){let n=+t.replace("#","0x"),s=n>>16,o=n>>8&255,i=n&255,a=+e.replace("#","0x"),l=a>>16,p=a>>8&255,g=a&255,f=s+r*(l-s),d=o+r*(p-o),x=i+r*(g-i);return`#${((1<<24)+(f<<16)+(d<<8)+x|0).toString(16).slice(1)}`}static getTextColor(t,e,r=!1){let[n,s,o]=c.hexToRgb(t),[i,a,l]=c.hexToRgb(e),p=4.5;if(r&&console.log("Color.getContrastRatio([r, g, b], [br, bg, bb])",c.getContrastRatio([n,s,o],[i,a,l])),c.getContrastRatio([n,s,o],[i,a,l])>=p)return c.rgbToHex(n,s,o);let g=c.getContrastRatio([0,0,0],[i,a,l]),f=c.getContrastRatio([255,255,255],[i,a,l]),d=f>g?"lighter":"darker";r&&(console.log("contrastToBlack",g),console.log("contrastToWhite",f),console.log("direction",d));let x=(S,M)=>M?Math.min(255,S+10):Math.max(0,S-10);for(let S=0;S<25&&(n=x(n,d==="lighter"),s=x(s,d==="lighter"),o=x(o,d==="lighter"),r&&console.log("Color.getContrastRatio([r, g, b], [br, bg, bb]) 2",c.getContrastRatio([n,s,o],[i,a,l])),!(c.getContrastRatio([n,s,o],[i,a,l])>=p));S++);return c.rgbToHex(n,s,o)}static getContrastRatio(t,e){let r=(o,i,a)=>{let l=[o,i,a].map(p=>(p/=255,p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4)));return l[0]*.2126+l[1]*.7152+l[2]*.0722},n=r(...t)+.05,s=r(...e)+.05;return n>s?n/s:s/n}static darken(t,e=.1){let[r,n,s]=this.hexToRgb(t),o=1-e,i=Math.round(r*o),a=Math.round(n*o),l=Math.round(s*o);return this.rgbToHex(i,a,l)}static lighten(t,e=.1){let[r,n,s]=this.hexToRgb(t),o=Math.round(r+(255-r)*e),i=Math.round(n+(255-n)*e),a=Math.round(s+(255-s)*e);return this.rgbToHex(o,i,a)}static shadeColor(t,e){let[r,n,s]=c.hexToRgb(t);return r=Math.min(255,Math.max(0,Math.round(r+r*(e/100)))),n=Math.min(255,Math.max(0,Math.round(n+n*(e/100)))),s=Math.min(255,Math.max(0,Math.round(s+s*(e/100)))),c.rgbToHex(r,n,s)}static areColorsSimilar(t,e,r=50){return c.colorDistance(t,e)<r}static invertColor(t){let[e,r,n]=c.hexToRgb(t),s=255-e,o=255-r,i=255-n;return c.rgbToHex(s,o,i)}static alphaColor(t,e){let[r,n,s]=this.hexToRgb(t);return`rgba(${r}, ${n}, ${s}, ${e})`}static getAnalogousColors(t){let[e,r,n]=c.hexToRgb(t),[s,o,i]=c.rgbToHsl(e,r,n),a=[],l=30;for(let p=-1;p<=1;p++)if(p!==0){let g=(s+p*l+360)%360,[f,d,x]=c.hslToRgb(g,o,i);a.push(c.rgbToHex(f,d,x))}return a}static hexToRgb(t){let e=t.replace(/^#/,"");if(e.length===3&&(e=e.split("").map(i=>i+i).join("")),e.length!==6)throw new Error(`Invalid hex color format: ${t}`);let r=parseInt(e,16),n=r>>16&255,s=r>>8&255,o=r&255;return[n,s,o]}static rgbToHex(t,e,r){return`#${((1<<24)+(t<<16)+(e<<8)+r).toString(16).slice(1).toUpperCase()}`}static rgbToHsl(t,e,r){t/=255,e/=255,r/=255;let n=Math.max(t,e,r),s=Math.min(t,e,r),o=0,i=0,a=(n+s)/2;if(n===s)o=i=0;else{let l=n-s;switch(i=a>.5?l/(2-n-s):l/(n+s),n){case t:o=(e-r)/l+(e<r?6:0);break;case e:o=(r-t)/l+2;break;case r:o=(t-e)/l+4;break}o/=6}return[o*360,i*100,a*100]}static hslToRgb(t,e,r){let n,s,o;if(t/=360,e/=100,r/=100,e===0)n=s=o=r;else{let i=(p,g,f)=>(f<0&&(f+=1),f>1&&(f-=1),f<.16666666666666666?p+(g-p)*6*f:f<.3333333333333333?g:f<.5?p+(g-p)*(.6666666666666666-f)*6:p),a=r<.5?r*(1+e):r+e-r*e,l=2*r-a;n=i(l,a,t+1/3),s=i(l,a,t),o=i(l,a,t-1/3)}return[Math.round(n*255),Math.round(s*255),Math.round(o*255)]}static calculateBrightness(t,e,r){return(t*299+e*587+r*114)/1e3}static colorDistance(t,e){let[r,n,s]=c.hexToRgb(t),[o,i,a]=c.hexToRgb(e),l=r-o,p=n-i,g=s-a;return Math.sqrt(l*l+p*p+g*g)}};var W=class{static parse(t,e=!1){if(!t)return new Date;if(t instanceof Date)return new Date(t.getTime());if(typeof t=="number")return new Date(t);if(typeof t=="string"){let r=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(r))return e?new Date(`${r}T00:00:00Z`):new Date(`${r}T00:00:00`);let n,s,o,i="",a=r.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(.*)$/),l=r.match(/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})(.*)$/);if(a)n=parseInt(a[1],10),s=parseInt(a[2],10)-1,o=parseInt(a[3],10),i=a[4];else if(l)n=parseInt(l[3],10),s=parseInt(l[1],10)-1,o=parseInt(l[2],10),i=l[4];else{let d=new Date(r);return isNaN(d.getTime())?new Date:d}let p=0,g=0,f=0;if(i&&i.trim().length>0){let d=i.match(/(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?\s*(am|pm|AM|PM)?/);if(d){p=parseInt(d[1],10),g=parseInt(d[2],10),f=d[3]?parseInt(d[3],10):0;let x=d[4]?d[4].toLowerCase():null;x==="pm"&&p<12&&(p+=12),x==="am"&&p===12&&(p=0)}}return e?new Date(Date.UTC(n,s,o,p,g,f)):new Date(n,s,o,p,g,f)}return new Date}static getMonthsShort(){return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}static getMonths(){return["January","February","March","April","May","June","July","August","September","October","November","December"]}static getDaysShort(){return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}static getDays(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}static format(t,e,r=!1){let n=this.parse(t),s=k=>String(k).padStart(2,"0"),o=this.getMonthsShort(),i=this.getMonths(),a=this.getDaysShort(),l=this.getDays(),p=r?n.getUTCFullYear():n.getFullYear(),g=String(p).slice(-2),f=r?n.getUTCMonth():n.getMonth(),d=r?n.getUTCDate():n.getDate(),x=r?n.getUTCDay():n.getDay(),S=r?n.getUTCHours():n.getHours(),M=r?n.getUTCMinutes():n.getMinutes(),I=r?n.getUTCSeconds():n.getSeconds(),R=r?"UTC":new Intl.DateTimeFormat("en-US",{timeZoneName:"short"}).format(n).split(", ").pop()||"",C=r?"UTC":new Intl.DateTimeFormat("en-US",{timeZoneName:"long"}).resolvedOptions().timeZone||"",v=k=>{let A=k%100;if(A>=11&&A<=13)return"th";switch(k%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},L={Y:String(p),y:g,m:s(f+1),n:String(f+1),M:o[f],F:i[f],d:s(d),j:String(d),D:a[x],l:l[x],w:String(x),N:String(x===0?7:x),S:v(d),H:s(S),G:String(S),h:s((S+11)%12+1),g:String((S+11)%12+1),i:s(M),s:s(I),A:S<12?"AM":"PM",a:S<12?"am":"pm",T:R,e:C};return e.replace(/\\(.)|([a-zA-Z])/g,(k,A,O)=>A||(L[O]??O))}static add(t,e,r){let n=this.parse(t);if(r==="years"){let s=n.getDate();n.setFullYear(n.getFullYear()+e),n.getDate()!==s&&n.setDate(0)}else if(r==="months"){let s=n.getDate();n.setMonth(n.getMonth()+e),n.getDate()!==s&&n.setDate(0)}else if(r==="days")n.setDate(n.getDate()+e);else{let s={hours:e*60*60*1e3,minutes:e*60*1e3};n.setTime(n.getTime()+s[r])}return n}static subtract(t,e,r){return this.add(t,-e,r)}static fromNow(t){let e=this.parse(t),r=Date.now()-e.getTime(),n=Math.floor(r/6e4);if(Math.abs(n)<1)return"just now";if(n<0)return"in the future";if(n<60)return`${n}m ago`;let s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}static getClosestDate(t,e){if(!e.length)return null;let r=this.parse(t).getTime(),n=null,s=1/0;for(let o of e){let i=this.parse(o).getTime(),a=Math.abs(i-r);a<s?(s=a,n=o):a===s&&i>r&&(n=o)}return n}static getTodayEST(){return this.format(new Date().toLocaleString("en-US",{timeZone:"America/New_York"}),"Y-m-d")}static getStartOfDay(t){let e=this.parse(t);return e.setHours(0,0,0,0),e}static getStartOfMonth(t){let e=this.parse(t);return e.setDate(1),e.setHours(0,0,0,0),e}static getStartOfGrid(t){let e=this.getStartOfMonth(t),r=e.getDay(),n=this.parse(e);return n.setDate(e.getDate()-r),n}static isSameDay(t,e){if(!t||!e)return!1;let r=this.parse(t),n=this.parse(e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate()}static isBeforeDay(t,e){return!t||!e?!1:this.getStartOfDay(t).getTime()<this.getStartOfDay(e).getTime()}static isAfterDay(t,e){return!t||!e?!1:this.getStartOfDay(t).getTime()>this.getStartOfDay(e).getTime()}static isDST(t){let e=this.parse(t),r=e.getFullYear(),n=new Date(r,0,1).getTimezoneOffset(),s=new Date(r,6,1).getTimezoneOffset(),o=Math.max(n,s);return e.getTimezoneOffset()<o}static getPartsInZone(t,e="America/New_York"){let r=this.parse(t);if(!Intl.supportedValuesOf("timeZone").includes(e))throw new Error("Unsupported timeZone.");let o=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"long",hourCycle:"h23"}).formatToParts(r),i=l=>parseInt(o.find(p=>p.type===l)?.value||"0",10),a=o.find(l=>l.type==="weekday")?.value||"";return{year:i("year"),month:i("month"),day:i("day"),hour:i("hour"),minute:i("minute"),second:i("second"),weekday:a}}};var _=class extends EventTarget{constructor(){super();b(this,"listeners");this.listeners={}}addEventListener(e,r){return super.addEventListener(e,r),this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r),this}removeEventListener(e,r){return super.removeEventListener(e,r),this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(n=>n!==r)),this}removeAllEventListeners(){for(let e in this.listeners)for(let r=0;r<=this.listeners[e].length;r++)this.removeEventListener(e,this.listeners[e][r])}getListeners(e){return this.listeners[e]||[]}};var T=!1,F=class extends _{constructor(){super();b(this,"config");b(this,"ws");b(this,"connection_state","connected");b(this,"session_id");b(this,"message_queue",[]);b(this,"reconnect_attempts",0);b(this,"should_reconnect",!0);b(this,"reconnect_timeout");b(this,"last_heartbeat_timestamp",Date.now());b(this,"HEARTBEAT_INTERVAL_MS",5e3);b(this,"SUSPENSION_THRESHOLD_MS",this.HEARTBEAT_INTERVAL_MS*2+1e3);b(this,"DISCONNECT_THRESHOLD_MS",this.HEARTBEAT_INTERVAL_MS*3+1e3);if(typeof document<"u"&&document.addEventListener("visibilitychange",e=>{document.visibilityState==="visible"&&this.check_staleness("tab_switch")}),typeof window<"u"){let e=()=>{let n=1,s=()=>{n>3||setTimeout(()=>{this.check_staleness("offline"),n++,s()},this.HEARTBEAT_INTERVAL_MS+500)};s()};window.addEventListener("online",()=>{window.removeEventListener("offline",e)}),window.addEventListener("offline",e)}}get_url(){if(!this.config)throw new Error("Socket not configured");let{hostname:e,port:r,path:n}=this.config;return`${typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol==="https:"?"wss:":"ws:"}//${e}${r?`:${r}`:""}/${n}`}connect(e,r){if(r&&(this.config=r),!e){console.warn("session_id required to open ws");return}this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)||(this.ws=new WebSocket(this.get_url()),T&&console.log("new websocket"),this.session_id=e,this.last_heartbeat_timestamp=Date.now(),this.ws.addEventListener("open",n=>this.handle_open(n)),this.ws.addEventListener("message",n=>this.handle_message(n)),this.ws.addEventListener("close",n=>this.handle_close(n)),this.ws.addEventListener("error",n=>this.handle_error(n)))}message({type:e,table:r,id:n}){let s={type:e,table:r,id:n};this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(s)):this.message_queue.push(s)}disconnect(){T&&console.log("websocket disconnect()"),this.update_connection_state("disconnected"),this.should_reconnect=!1,this.ws?.close(),this.ws=void 0,this.reconnect_timeout&&clearTimeout(this.reconnect_timeout)}update_connection_state(e){let r=this.connection_state;this.connection_state!==e&&(T&&console.log("update_connection_state",e),this.connection_state=e,T&&console.warn(`[Socket] State changed to: ${this.connection_state}`),this.dispatchEvent(new CustomEvent("connection_state",{detail:this.connection_state})),(e==="connected"||e==="reconnected")&&(r==="stale"||r==="disconnected")&&this.dispatchEvent(new CustomEvent("refresh",{bubbles:!0})))}check_staleness(e){let n=Date.now()-this.last_heartbeat_timestamp;if(T&&console.log("websocket check_staleness()",e,n),!this.ws||this.ws.readyState===this.ws.CLOSED||n>this.DISCONNECT_THRESHOLD_MS){this.update_connection_state("disconnected");return}n>this.SUSPENSION_THRESHOLD_MS?this.update_connection_state("stale"):this.update_connection_state("connected")}handle_open(e){for(T&&console.log("websocket handle open()"),this.ws&&this.ws.readyState===this.ws.OPEN&&this.update_connection_state("connected"),this.reconnect_timeout&&clearTimeout(this.reconnect_timeout),this.reconnect_attempts>0&&(T&&console.log("[Socket] Reconnected. Triggering refresh."),this.dispatchEvent(new CustomEvent("refresh",{bubbles:!0}))),this.reconnect_attempts=0,this.ws?.send(JSON.stringify({type:"session",table:"session",id:this.session_id}));this.message_queue.length>0;){let r=this.message_queue.shift();this.ws?.send(JSON.stringify(r))}}handle_message(e){T&&console.log("websocket handle message()");try{let r=JSON.parse(e.data);if(T&&console.log("data",r),r.type==="heartbeat"){this.check_staleness("heartbeat"),this.last_heartbeat_timestamp=Date.now();return}let n=new CustomEvent("message",{detail:JSON.parse(e.data),bubbles:!0});this.dispatchEvent(n)}catch{let n=new CustomEvent("message",{detail:e.data,bubbles:!0});this.dispatchEvent(n)}}handle_close(e){if(T&&console.log("websocket handle close()"),this.update_connection_state("disconnected"),this.should_reconnect){let r=Math.min(1e3*Math.pow(2,this.reconnect_attempts),3e4);T&&console.log(`Connection lost. Retrying in ${r}ms... (Attempt ${this.reconnect_attempts+1})`),this.reconnect_timeout=setTimeout(()=>{this.reconnect_attempts++,this.session_id&&this.connect(this.session_id)},r)}this.ws=void 0}handle_error(e){T&&console.log("websocket handle error()"),this.update_connection_state("disconnected"),console.error("WebSocket Error:",e),this.ws?.close()}},oe=new F;var z=class c{static deepClone(t,e=new WeakMap){if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){let s=new Map;return e.set(t,s),t.forEach((o,i)=>s.set(i,c.deepClone(o,e))),s}if(t instanceof Set){let s=new Set;for(let o of t)s.add(c.deepClone(o));return s}if(Array.isArray(t)){let s=t.map(o=>c.deepClone(o,e));return e.set(t,s),s}let r=Object.create(Object.getPrototypeOf(t));e.set(t,r);let n=t;return Object.keys(n).forEach(s=>{r[s]=c.deepClone(n[s],e)}),Object.getOwnPropertySymbols(n).forEach(s=>{Object.prototype.propertyIsEnumerable.call(n,s)&&(r[s]=c.deepClone(n[s],e))}),r}static extender(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");let r=Object(t);for(let n of e)if(n!=null){let s=n;for(let i of Object.keys(s))r[i]=c.deepClone(s[i]);let o=Object.getOwnPropertySymbols(s);for(let i of o)Object.prototype.propertyIsEnumerable.call(s,i)&&(r[i]=c.deepClone(s[i]))}return r}};var Y=class{static descendingComparator(t,e,r,n){if(r in t&&e[r]===null)return 1;if(t[r]===null&&r in e)return-1;let s=t[r],o=e[r],i=n||"lower";return o<s?i==="higher"?1:-1:o>s?i==="higher"?-1:1:0}static getComparator(t,e,r){return t==="desc"?(n,s)=>this.descendingComparator(n,s,e,r):(n,s)=>-this.descendingComparator(n,s,e,r)}};var E=class E{static getStyle(){return{zIndex:E.getZIndex()}}static getZIndex(){return{appBar:1100,drawer:1200,fab:1050,calendar:1e3,mobileStepper:1e3,modal:1300,toast:1400,speedDial:1050,tooltip:1500}}static getNavBar(){return{width:"100%",display:"flex",justifyContent:"center",zIndex:E.getZIndex().appBar,position:"fixed",overflowX:"scroll",overflowY:"hidden",scrollbarWidth:"none"}}static getShadow(t){let e=["none","0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)","0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)","0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)","0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)","0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)","0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)","0px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)","0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)","0px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)","0px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)","0px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)","0px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)","0px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)","0px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)","0px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)","0px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)","0px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)","0px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)","0px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)","0px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)","0px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)","0px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)","0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)","0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)"];if(t>e.length||t<0)throw new Error(`min depth is 0, max depth is ${e.length}. Sent ${t}`);return e[t]}static getStyleClassName(t,e=!1){e&&console.log("getStyleClassName",t);let r=`css-${this.hashCSS(t,e)}`;return this.injectStyle(r,t,e),r}static getMap(){return this.cssMap}static getCSS(){return console.warn("this does not work yet, in root layout need to add a context thing so it attaches css to style when streamed from server"),Array.from(this.cssMap.values()).join(`
|
|
1
|
+
"use strict";var $=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ne=(c,t,e)=>t in c?$(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var re=(c,t)=>{for(var e in t)$(c,e,{get:t[e],enumerable:!0})},se=(c,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ee(t))!te.call(c,n)&&n!==e&&$(c,n,{get:()=>t[n],enumerable:!(r=Q(t,n))||r.enumerable});return c};var ie=c=>se($({},"__esModule",{value:!0}),c);var b=(c,t,e)=>ne(c,typeof t!="symbol"?t+"":t,e);var ce={};re(ce,{Arithmetic:()=>P,Arrayifier:()=>G,CSV:()=>H,Color:()=>U,Dates:()=>W,Kontororu:()=>_,Objector:()=>z,Sorter:()=>Z,Style:()=>Y,Textor:()=>q,Theme:()=>J,Toaster:()=>j,socket:()=>oe,toast:()=>ae,toaster:()=>N});module.exports=ie(ce);var P=class{static clamp(t,e,r){return Math.max(e,Math.min(t,r))}};var G=class{static shuffle(t){let e=t.length,r;for(;e!==0;)r=Math.floor(Math.random()*e),e--,[t[e],t[r]]=[t[r],t[e]];return t}static combination(t,e,r,n,s,o,i){return n===r?(i.push(s.slice(0,r)),i):(o>=e||(s[n]=t[o],this.combination(t,e,r,n+1,s,o+1,i),this.combination(t,e,r,n,s,o+1,i)),i)}static getCombinations(t,e,r){let n=new Array(r),s=[];return s=this.combination(t,e,r,0,n,0,s),s}};var H=class{static download(t){let e=[],r=!1,n=[];for(let l in t){let p=t[l];r||(n=Object.keys(p),e.push(n.join(",")),r=!0);let g=n.map(f=>JSON.stringify(p[f]||""));e.push(g.join(","))}let s=e.join(`
|
|
2
|
+
`),o=new Blob([s],{type:"text/csv"}),i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download="srating-data.csv",document.body.appendChild(a),a.click(),URL.revokeObjectURL(i),a.remove()}};var U=class c{static lerpColor(t,e,r){let n=+t.replace("#","0x"),s=n>>16,o=n>>8&255,i=n&255,a=+e.replace("#","0x"),l=a>>16,p=a>>8&255,g=a&255,f=s+r*(l-s),d=o+r*(p-o),x=i+r*(g-i);return`#${((1<<24)+(f<<16)+(d<<8)+x|0).toString(16).slice(1)}`}static getTextColor(t,e,r=!1){let[n,s,o]=c.hexToRgb(t),[i,a,l]=c.hexToRgb(e),p=4.5;if(r&&console.log("Color.getContrastRatio([r, g, b], [br, bg, bb])",c.getContrastRatio([n,s,o],[i,a,l])),c.getContrastRatio([n,s,o],[i,a,l])>=p)return c.rgbToHex(n,s,o);let g=c.getContrastRatio([0,0,0],[i,a,l]),f=c.getContrastRatio([255,255,255],[i,a,l]),d=f>g?"lighter":"darker";r&&(console.log("contrastToBlack",g),console.log("contrastToWhite",f),console.log("direction",d));let x=(S,M)=>M?Math.min(255,S+10):Math.max(0,S-10);for(let S=0;S<25&&(n=x(n,d==="lighter"),s=x(s,d==="lighter"),o=x(o,d==="lighter"),r&&console.log("Color.getContrastRatio([r, g, b], [br, bg, bb]) 2",c.getContrastRatio([n,s,o],[i,a,l])),!(c.getContrastRatio([n,s,o],[i,a,l])>=p));S++);return c.rgbToHex(n,s,o)}static getContrastRatio(t,e){let r=(o,i,a)=>{let l=[o,i,a].map(p=>(p/=255,p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4)));return l[0]*.2126+l[1]*.7152+l[2]*.0722},n=r(...t)+.05,s=r(...e)+.05;return n>s?n/s:s/n}static darken(t,e=.1){let[r,n,s]=this.hexToRgb(t),o=1-e,i=Math.round(r*o),a=Math.round(n*o),l=Math.round(s*o);return this.rgbToHex(i,a,l)}static lighten(t,e=.1){let[r,n,s]=this.hexToRgb(t),o=Math.round(r+(255-r)*e),i=Math.round(n+(255-n)*e),a=Math.round(s+(255-s)*e);return this.rgbToHex(o,i,a)}static shadeColor(t,e){let[r,n,s]=c.hexToRgb(t);return r=Math.min(255,Math.max(0,Math.round(r+r*(e/100)))),n=Math.min(255,Math.max(0,Math.round(n+n*(e/100)))),s=Math.min(255,Math.max(0,Math.round(s+s*(e/100)))),c.rgbToHex(r,n,s)}static areColorsSimilar(t,e,r=50){return c.colorDistance(t,e)<r}static invertColor(t){let[e,r,n]=c.hexToRgb(t),s=255-e,o=255-r,i=255-n;return c.rgbToHex(s,o,i)}static alphaColor(t,e){let[r,n,s]=this.hexToRgb(t);return`rgba(${r}, ${n}, ${s}, ${e})`}static getAnalogousColors(t){let[e,r,n]=c.hexToRgb(t),[s,o,i]=c.rgbToHsl(e,r,n),a=[],l=30;for(let p=-1;p<=1;p++)if(p!==0){let g=(s+p*l+360)%360,[f,d,x]=c.hslToRgb(g,o,i);a.push(c.rgbToHex(f,d,x))}return a}static hexToRgb(t){let e=t.replace(/^#/,"");if(e.length===3&&(e=e.split("").map(i=>i+i).join("")),e.length!==6)throw new Error(`Invalid hex color format: ${t}`);let r=parseInt(e,16),n=r>>16&255,s=r>>8&255,o=r&255;return[n,s,o]}static rgbToHex(t,e,r){return`#${((1<<24)+(t<<16)+(e<<8)+r).toString(16).slice(1).toUpperCase()}`}static rgbToHsl(t,e,r){t/=255,e/=255,r/=255;let n=Math.max(t,e,r),s=Math.min(t,e,r),o=0,i=0,a=(n+s)/2;if(n===s)o=i=0;else{let l=n-s;switch(i=a>.5?l/(2-n-s):l/(n+s),n){case t:o=(e-r)/l+(e<r?6:0);break;case e:o=(r-t)/l+2;break;case r:o=(t-e)/l+4;break}o/=6}return[o*360,i*100,a*100]}static hslToRgb(t,e,r){let n,s,o;if(t/=360,e/=100,r/=100,e===0)n=s=o=r;else{let i=(p,g,f)=>(f<0&&(f+=1),f>1&&(f-=1),f<.16666666666666666?p+(g-p)*6*f:f<.3333333333333333?g:f<.5?p+(g-p)*(.6666666666666666-f)*6:p),a=r<.5?r*(1+e):r+e-r*e,l=2*r-a;n=i(l,a,t+1/3),s=i(l,a,t),o=i(l,a,t-1/3)}return[Math.round(n*255),Math.round(s*255),Math.round(o*255)]}static calculateBrightness(t,e,r){return(t*299+e*587+r*114)/1e3}static colorDistance(t,e){let[r,n,s]=c.hexToRgb(t),[o,i,a]=c.hexToRgb(e),l=r-o,p=n-i,g=s-a;return Math.sqrt(l*l+p*p+g*g)}};var W=class{static parse(t,e=!1){if(!t)return new Date;if(t instanceof Date)return new Date(t.getTime());if(typeof t=="number")return new Date(t);if(typeof t=="string"){let r=t.trim();if(/^\d{4}-\d{2}-\d{2}$/.test(r))return e?new Date(`${r}T00:00:00Z`):new Date(`${r}T00:00:00`);let n,s,o,i="",a=r.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(.*)$/),l=r.match(/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})(.*)$/);if(a)n=parseInt(a[1],10),s=parseInt(a[2],10)-1,o=parseInt(a[3],10),i=a[4];else if(l)n=parseInt(l[3],10),s=parseInt(l[1],10)-1,o=parseInt(l[2],10),i=l[4];else{let d=new Date(r);return isNaN(d.getTime())?new Date:d}let p=0,g=0,f=0;if(i&&i.trim().length>0){let d=i.match(/(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?\s*(am|pm|AM|PM)?/);if(d){p=parseInt(d[1],10),g=parseInt(d[2],10),f=d[3]?parseInt(d[3],10):0;let x=d[4]?d[4].toLowerCase():null;x==="pm"&&p<12&&(p+=12),x==="am"&&p===12&&(p=0)}}return e?new Date(Date.UTC(n,s,o,p,g,f)):new Date(n,s,o,p,g,f)}return new Date}static getMonthsShort(){return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}static getMonths(){return["January","February","March","April","May","June","July","August","September","October","November","December"]}static getDaysShort(){return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}static getDays(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}static format(t,e,r=!1){let n=this.parse(t),s=k=>String(k).padStart(2,"0"),o=this.getMonthsShort(),i=this.getMonths(),a=this.getDaysShort(),l=this.getDays(),p=r?n.getUTCFullYear():n.getFullYear(),g=String(p).slice(-2),f=r?n.getUTCMonth():n.getMonth(),d=r?n.getUTCDate():n.getDate(),x=r?n.getUTCDay():n.getDay(),S=r?n.getUTCHours():n.getHours(),M=r?n.getUTCMinutes():n.getMinutes(),I=r?n.getUTCSeconds():n.getSeconds(),R=r?"UTC":new Intl.DateTimeFormat("en-US",{timeZoneName:"short"}).format(n).split(", ").pop()||"",C=r?"UTC":new Intl.DateTimeFormat("en-US",{timeZoneName:"long"}).resolvedOptions().timeZone||"",v=k=>{let A=k%100;if(A>=11&&A<=13)return"th";switch(k%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},L={Y:String(p),y:g,m:s(f+1),n:String(f+1),M:o[f],F:i[f],d:s(d),j:String(d),D:a[x],l:l[x],w:String(x),N:String(x===0?7:x),S:v(d),H:s(S),G:String(S),h:s((S+11)%12+1),g:String((S+11)%12+1),i:s(M),s:s(I),A:S<12?"AM":"PM",a:S<12?"am":"pm",T:R,e:C};return e.replace(/\\(.)|([a-zA-Z])/g,(k,A,O)=>A||(L[O]??O))}static add(t,e,r){let n=this.parse(t);if(r==="years"){let s=n.getDate();n.setFullYear(n.getFullYear()+e),n.getDate()!==s&&n.setDate(0)}else if(r==="months"){let s=n.getDate();n.setMonth(n.getMonth()+e),n.getDate()!==s&&n.setDate(0)}else if(r==="days")n.setDate(n.getDate()+e);else{let s={hours:e*60*60*1e3,minutes:e*60*1e3};n.setTime(n.getTime()+s[r])}return n}static subtract(t,e,r){return this.add(t,-e,r)}static fromNow(t){let e=this.parse(t),r=Date.now()-e.getTime(),n=Math.floor(r/6e4);if(Math.abs(n)<1)return"just now";if(n<0)return"in the future";if(n<60)return`${n}m ago`;let s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}static getClosestDate(t,e){if(!e.length)return null;let r=this.parse(t).getTime(),n=null,s=1/0;for(let o of e){let i=this.parse(o).getTime(),a=Math.abs(i-r);a<s?(s=a,n=o):a===s&&i>r&&(n=o)}return n}static getTodayEST(){return this.format(new Date().toLocaleString("en-US",{timeZone:"America/New_York"}),"Y-m-d")}static getStartOfDay(t){let e=this.parse(t);return e.setHours(0,0,0,0),e}static getStartOfMonth(t){let e=this.parse(t);return e.setDate(1),e.setHours(0,0,0,0),e}static getStartOfGrid(t){let e=this.getStartOfMonth(t),r=e.getDay(),n=this.parse(e);return n.setDate(e.getDate()-r),n}static isSameDay(t,e){if(!t||!e)return!1;let r=this.parse(t),n=this.parse(e);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()&&r.getDate()===n.getDate()}static isBeforeDay(t,e){return!t||!e?!1:this.getStartOfDay(t).getTime()<this.getStartOfDay(e).getTime()}static isAfterDay(t,e){return!t||!e?!1:this.getStartOfDay(t).getTime()>this.getStartOfDay(e).getTime()}static isDST(t){let e=this.parse(t),r=e.getFullYear(),n=new Date(r,0,1).getTimezoneOffset(),s=new Date(r,6,1).getTimezoneOffset(),o=Math.max(n,s);return e.getTimezoneOffset()<o}static getPartsInZone(t,e="America/New_York"){let r=this.parse(t);if(!Intl.supportedValuesOf("timeZone").includes(e))throw new Error("Unsupported timeZone.");let o=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"long",hourCycle:"h23"}).formatToParts(r),i=l=>parseInt(o.find(p=>p.type===l)?.value||"0",10),a=o.find(l=>l.type==="weekday")?.value||"";return{year:i("year"),month:i("month"),day:i("day"),hour:i("hour"),minute:i("minute"),second:i("second"),weekday:a}}};var _=class extends EventTarget{constructor(){super();b(this,"listeners");this.listeners={}}addEventListener(e,r){return super.addEventListener(e,r),this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r),this}removeEventListener(e,r){return super.removeEventListener(e,r),this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(n=>n!==r)),this}removeAllEventListeners(){for(let e in this.listeners)for(let r=0;r<=this.listeners[e].length;r++)this.removeEventListener(e,this.listeners[e][r])}getListeners(e){return this.listeners[e]||[]}};var T=!1,F=class extends _{constructor(){super();b(this,"config");b(this,"ws");b(this,"connection_state","connected");b(this,"session_id");b(this,"message_queue",[]);b(this,"reconnect_attempts",0);b(this,"should_reconnect",!0);b(this,"reconnect_timeout");b(this,"last_heartbeat_timestamp",Date.now());b(this,"HEARTBEAT_INTERVAL_MS",5e3);b(this,"SUSPENSION_THRESHOLD_MS",this.HEARTBEAT_INTERVAL_MS*2+1e3);b(this,"DISCONNECT_THRESHOLD_MS",this.HEARTBEAT_INTERVAL_MS*3+1e3);if(typeof document<"u"&&document.addEventListener("visibilitychange",e=>{document.visibilityState==="visible"&&this.check_staleness("tab_switch")}),typeof window<"u"){let e=()=>{let n=1,s=()=>{n>3||setTimeout(()=>{this.check_staleness("offline"),n++,s()},this.HEARTBEAT_INTERVAL_MS+500)};s()};window.addEventListener("online",()=>{window.removeEventListener("offline",e)}),window.addEventListener("offline",e)}}get_url(){if(!this.config)throw new Error("Socket not configured");let{hostname:e,port:r,path:n}=this.config;return`${typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol==="https:"?"wss:":"ws:"}//${e}${r?`:${r}`:""}/${n}`}connect(e,r){if(r&&(this.config=r),!e){console.warn("session_id required to open ws");return}this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)||(this.ws=new WebSocket(this.get_url()),T&&console.log("new websocket"),this.session_id=e,this.last_heartbeat_timestamp=Date.now(),this.ws.addEventListener("open",n=>this.handle_open(n)),this.ws.addEventListener("message",n=>this.handle_message(n)),this.ws.addEventListener("close",n=>this.handle_close(n)),this.ws.addEventListener("error",n=>this.handle_error(n)))}message({type:e,table:r,id:n}){let s={type:e,table:r,id:n};this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(s)):this.message_queue.push(s)}disconnect(){T&&console.log("websocket disconnect()"),this.update_connection_state("disconnected"),this.should_reconnect=!1,this.ws?.close(),this.ws=void 0,this.reconnect_timeout&&clearTimeout(this.reconnect_timeout)}update_connection_state(e){let r=this.connection_state;this.connection_state!==e&&(T&&console.log("update_connection_state",e),this.connection_state=e,T&&console.warn(`[Socket] State changed to: ${this.connection_state}`),this.dispatchEvent(new CustomEvent("connection_state",{detail:this.connection_state})),(e==="connected"||e==="reconnected")&&(r==="stale"||r==="disconnected")&&this.dispatchEvent(new CustomEvent("refresh",{bubbles:!0})))}check_staleness(e){let n=Date.now()-this.last_heartbeat_timestamp;if(T&&console.log("websocket check_staleness()",e,n),!this.ws||this.ws.readyState===this.ws.CLOSED||n>this.DISCONNECT_THRESHOLD_MS){this.update_connection_state("disconnected");return}n>this.SUSPENSION_THRESHOLD_MS?this.update_connection_state("stale"):this.update_connection_state("connected")}handle_open(e){for(T&&console.log("websocket handle open()"),this.ws&&this.ws.readyState===this.ws.OPEN&&this.update_connection_state("connected"),this.reconnect_timeout&&clearTimeout(this.reconnect_timeout),this.reconnect_attempts>0&&(T&&console.log("[Socket] Reconnected. Triggering refresh."),this.dispatchEvent(new CustomEvent("refresh",{bubbles:!0}))),this.reconnect_attempts=0,this.ws?.send(JSON.stringify({type:"session",table:"session",id:this.session_id}));this.message_queue.length>0;){let r=this.message_queue.shift();this.ws?.send(JSON.stringify(r))}}handle_message(e){T&&console.log("websocket handle message()");try{let r=JSON.parse(e.data);if(T&&console.log("data",r),r.type==="heartbeat"){this.check_staleness("heartbeat"),this.last_heartbeat_timestamp=Date.now();return}let n=new CustomEvent("message",{detail:JSON.parse(e.data),bubbles:!0});this.dispatchEvent(n)}catch{let n=new CustomEvent("message",{detail:e.data,bubbles:!0});this.dispatchEvent(n)}}handle_close(e){if(T&&console.log("websocket handle close()"),this.update_connection_state("disconnected"),this.should_reconnect){let r=Math.min(1e3*Math.pow(2,this.reconnect_attempts),3e4);T&&console.log(`Connection lost. Retrying in ${r}ms... (Attempt ${this.reconnect_attempts+1})`),this.reconnect_timeout=setTimeout(()=>{this.reconnect_attempts++,this.session_id&&this.connect(this.session_id)},r)}this.ws=void 0}handle_error(e){T&&console.log("websocket handle error()"),this.update_connection_state("disconnected"),console.error("WebSocket Error:",e),this.ws?.close()}},oe=new F;var z=class c{static deepClone(t,e=new WeakMap){if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){let s=new Map;return e.set(t,s),t.forEach((o,i)=>s.set(i,c.deepClone(o,e))),s}if(t instanceof Set){let s=new Set;for(let o of t)s.add(c.deepClone(o));return s}if(Array.isArray(t)){let s=t.map(o=>c.deepClone(o,e));return e.set(t,s),s}let r=Object.create(Object.getPrototypeOf(t));e.set(t,r);let n=t;return Object.keys(n).forEach(s=>{r[s]=c.deepClone(n[s],e)}),Object.getOwnPropertySymbols(n).forEach(s=>{Object.prototype.propertyIsEnumerable.call(n,s)&&(r[s]=c.deepClone(n[s],e))}),r}static extender(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");let r=Object(t);for(let n of e)if(n!=null){let s=n;for(let i of Object.keys(s))r[i]=c.deepClone(s[i]);let o=Object.getOwnPropertySymbols(s);for(let i of o)Object.prototype.propertyIsEnumerable.call(s,i)&&(r[i]=c.deepClone(s[i]))}return r}};var Z=class{static descendingComparator(t,e,r,n){if(r in t&&e[r]===null)return 1;if(t[r]===null&&r in e)return-1;let s=t[r],o=e[r],i=n||"lower";return o<s?i==="higher"?1:-1:o>s?i==="higher"?-1:1:0}static getComparator(t,e,r){return t==="desc"?(n,s)=>this.descendingComparator(n,s,e,r):(n,s)=>-this.descendingComparator(n,s,e,r)}};var E=class E{static getStyle(){return{zIndex:E.getZIndex()}}static getZIndex(){return{appBar:1100,drawer:1200,fab:1050,calendar:1e3,mobileStepper:1e3,modal:1300,toast:1400,speedDial:1050,tooltip:1500}}static getNavBar(){return{width:"100%",display:"flex",justifyContent:"center",zIndex:E.getZIndex().appBar,position:"fixed",overflowX:"scroll",overflowY:"hidden",scrollbarWidth:"none"}}static getShadow(t){let e=["none","0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)","0px 3px 1px -2px rgba(0,0,0,0.2),0px 2px 2px 0px rgba(0,0,0,0.14),0px 1px 5px 0px rgba(0,0,0,0.12)","0px 3px 3px -2px rgba(0,0,0,0.2),0px 3px 4px 0px rgba(0,0,0,0.14),0px 1px 8px 0px rgba(0,0,0,0.12)","0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)","0px 3px 5px -1px rgba(0,0,0,0.2),0px 5px 8px 0px rgba(0,0,0,0.14),0px 1px 14px 0px rgba(0,0,0,0.12)","0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)","0px 4px 5px -2px rgba(0,0,0,0.2),0px 7px 10px 1px rgba(0,0,0,0.14),0px 2px 16px 1px rgba(0,0,0,0.12)","0px 5px 5px -3px rgba(0,0,0,0.2),0px 8px 10px 1px rgba(0,0,0,0.14),0px 3px 14px 2px rgba(0,0,0,0.12)","0px 5px 6px -3px rgba(0,0,0,0.2),0px 9px 12px 1px rgba(0,0,0,0.14),0px 3px 16px 2px rgba(0,0,0,0.12)","0px 6px 6px -3px rgba(0,0,0,0.2),0px 10px 14px 1px rgba(0,0,0,0.14),0px 4px 18px 3px rgba(0,0,0,0.12)","0px 6px 7px -4px rgba(0,0,0,0.2),0px 11px 15px 1px rgba(0,0,0,0.14),0px 4px 20px 3px rgba(0,0,0,0.12)","0px 7px 8px -4px rgba(0,0,0,0.2),0px 12px 17px 2px rgba(0,0,0,0.14),0px 5px 22px 4px rgba(0,0,0,0.12)","0px 7px 8px -4px rgba(0,0,0,0.2),0px 13px 19px 2px rgba(0,0,0,0.14),0px 5px 24px 4px rgba(0,0,0,0.12)","0px 7px 9px -4px rgba(0,0,0,0.2),0px 14px 21px 2px rgba(0,0,0,0.14),0px 5px 26px 4px rgba(0,0,0,0.12)","0px 8px 9px -5px rgba(0,0,0,0.2),0px 15px 22px 2px rgba(0,0,0,0.14),0px 6px 28px 5px rgba(0,0,0,0.12)","0px 8px 10px -5px rgba(0,0,0,0.2),0px 16px 24px 2px rgba(0,0,0,0.14),0px 6px 30px 5px rgba(0,0,0,0.12)","0px 8px 11px -5px rgba(0,0,0,0.2),0px 17px 26px 2px rgba(0,0,0,0.14),0px 6px 32px 5px rgba(0,0,0,0.12)","0px 9px 11px -5px rgba(0,0,0,0.2),0px 18px 28px 2px rgba(0,0,0,0.14),0px 7px 34px 6px rgba(0,0,0,0.12)","0px 9px 12px -6px rgba(0,0,0,0.2),0px 19px 29px 2px rgba(0,0,0,0.14),0px 7px 36px 6px rgba(0,0,0,0.12)","0px 10px 13px -6px rgba(0,0,0,0.2),0px 20px 31px 3px rgba(0,0,0,0.14),0px 8px 38px 7px rgba(0,0,0,0.12)","0px 10px 13px -6px rgba(0,0,0,0.2),0px 21px 33px 3px rgba(0,0,0,0.14),0px 8px 40px 7px rgba(0,0,0,0.12)","0px 10px 14px -6px rgba(0,0,0,0.2),0px 22px 35px 3px rgba(0,0,0,0.14),0px 8px 42px 7px rgba(0,0,0,0.12)","0px 11px 14px -7px rgba(0,0,0,0.2),0px 23px 36px 3px rgba(0,0,0,0.14),0px 9px 44px 8px rgba(0,0,0,0.12)","0px 11px 15px -7px rgba(0,0,0,0.2),0px 24px 38px 3px rgba(0,0,0,0.14),0px 9px 46px 8px rgba(0,0,0,0.12)"];if(t>e.length||t<0)throw new Error(`min depth is 0, max depth is ${e.length}. Sent ${t}`);return e[t]}static getStyleClassName(t,e=!1){e&&console.log("getStyleClassName",t);let r=`css-${this.hashCSS(t,e)}`;return this.injectStyle(r,t,e),r}static getMap(){return this.cssMap}static getCSS(){return console.warn("this does not work yet, in root layout need to add a context thing so it attaches css to style when streamed from server"),Array.from(this.cssMap.values()).join(`
|
|
3
3
|
`)}static flush(){this.styleCache.clear(),this.cssMap.clear()}static hashCSS(t,e=!1){let r=i=>{if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return i.map(r);let a=Object.keys(i).sort(),l={},p=i;for(let g of a)l[g]=r(p[g]);return l},s=(i=>{if(typeof i=="string")return i;if(typeof i=="object"&&i!==null){let a=r(i);return JSON.stringify(a)}return String(i)})(t);e&&console.log("normalizedInput",s);let o=5381;for(let i=0;i<s.length;i++)o=o*33^s.charCodeAt(i);return(o>>>0).toString(36)}static injectStyle(t,e,r=!1){if(this.styleCache.has(t))return;let n=this.processCSS(t,e,!1,r);if(typeof window>"u")this.cssMap.set(t,n);else{let s=document.createElement("style");s.textContent=n,document.head.appendChild(s)}this.styleCache.add(t),this.cssMap.set(t,n)}static processCSS(t,e,r=!1,n=!1){let s=u=>u.replace(/:$/g,""),o=u=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=u=>{if(u.length===0)return;let h=u.length-1,w=u[h],m=w.lastIndexOf("}");if(m!==-1){let y=w.substring(0,m)+w.substring(m+1);y.trim()?u[h]=y:u.pop()}},a=new Set(["content","quotes","cue","cue-before","cue-after","src"]),l=new Set(["width","height","top","left","right","bottom","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","border-width","border-radius","gap","column-gap","row-gap","min-width","min-height","max-width","max-height"]),p=["@keyframes","@-webkit-keyframes","@font-face","@counter-style"],g=u=>p.some(h=>u.startsWith(h)),f=(u,h)=>{if(!l.has(u))return h;if(typeof h=="number")return`${h}px`;if(typeof h=="string"){let w=h.trim();return/^-?\d+(\.\d+)?$/.test(w)?`${w}px`:w}return h},d=u=>{let h=u.indexOf(":");if(h===-1)return u;let w=u.slice(0,h).trim(),m=u.slice(h+1).trim(),y=o(w);m.endsWith(",")&&(m=m.slice(0,-1).trim()),a.has(y)||(m=m.split(",").map(X=>{let B=X.trim(),V=B.match(/^["'](.*)["']$/);if(V){let K=V[1];return K.includes(" ")?B:K}return B}).join(", ")),m=f(y,m);let D=`${y}: ${m}`;return D.endsWith(";")||(D+=";"),D},x=u=>{let h=[],w=u;for(let m in w){let y=w[m];if(typeof y=="object"&&y!==null){h.push(`${m} {`);let D=x(y);h.push(...D),h.push("}")}else{let D=typeof y=="string"?y:String(y);h.push(`${m}: ${D},`)}}return h},S=typeof e=="string"?e.trim().split(`
|
|
4
4
|
`).map(u=>u.trim()).filter(Boolean):x(e),M=[],I=[],R=[],C=null,v=null,L=[],k=0,A=[],O=0;for(let u of S){if(u.startsWith("@")||v){if(v||(v=u.split("{")[0].trim()),L.push(u),k+=(u.match(/{/g)||[]).length,k-=(u.match(/}/g)||[]).length,k===0){let h=L.join(`
|
|
5
5
|
`),w=h.substring(h.indexOf("{")+1,h.lastIndexOf("}")).trim();if(v.startsWith("@keyframes")){let m=w.split(`
|
|
6
|
-
`).map(y=>y.includes("{")||y.includes("}")?y:d(y)).join(" ");R.push(`${v} { ${m} }`)}else{let m=this.processCSS(t,w,!1,n);R.push(`${v} { ${m} }`)}v=null,L=[]}continue}if(u.includes("{")||C){if(C)u.includes("}")||A.push(d(u));else{C=u.split("{")[0].trim();let h=/::(selection|target-text|highlight|spelling-error|grammar-error)/.test(C);C.startsWith(":")&&!C.startsWith("&")&&!h&&(C=`&${C}`)}if(O+=(u.match(/{/g)||[]).length,O-=(u.match(/}/g)||[]).length,O===0){let w=/::(selection|target-text|highlight|spelling-error|grammar-error)/.test(C)?C:C.replace(/&/g,`.${t}`);I.push(`${w} { ${A.join(" ")} }`),C=null,A=[]}continue}M.push(d(u))}return`${!r&&M.length>0?`.${t} { ${M.join(" ")} }`:M.join(" ")} ${I.join(" ")} ${R.join(" ")}`.replace(/\s\s+/g," ").trim()}};b(E,"styleCache",new Set),b(E,"cssMap",new Map);var
|
|
6
|
+
`).map(y=>y.includes("{")||y.includes("}")?y:d(y)).join(" ");R.push(`${v} { ${m} }`)}else{let m=this.processCSS(t,w,!1,n);R.push(`${v} { ${m} }`)}v=null,L=[]}continue}if(u.includes("{")||C){if(C)u.includes("}")||A.push(d(u));else{C=u.split("{")[0].trim();let h=/::(selection|target-text|highlight|spelling-error|grammar-error)/.test(C);C.startsWith(":")&&!C.startsWith("&")&&!h&&(C=`&${C}`)}if(O+=(u.match(/{/g)||[]).length,O-=(u.match(/}/g)||[]).length,O===0){let w=/::(selection|target-text|highlight|spelling-error|grammar-error)/.test(C)?C:C.replace(/&/g,`.${t}`);I.push(`${w} { ${A.join(" ")} }`),C=null,A=[]}continue}M.push(d(u))}return`${!r&&M.length>0?`.${t} { ${M.join(" ")} }`:M.join(" ")} ${I.join(" ")} ${R.join(" ")}`.replace(/\s\s+/g," ").trim()}};b(E,"styleCache",new Set),b(E,"cssMap",new Map);var Y=E;var q=class{static levenshtein(t,e){let r=[];if(!t||!e)return 0;for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let s=1;s<=e.length;s++){let o=t[n-1]===e[s-1]?0:1;r[n][s]=Math.min(r[n-1][s]+1,r[n][s-1]+1,r[n-1][s-1]+o)}return r[t.length][e.length]}static toSentenceCase(t){if(!t)return"";let e=t.trim();return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}static generateLoremIpsum(t=3,e=5,r=!0){let n=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua","ut","enim","ad","minim","veniam","quis","nostrud","exercitation","ullamco","laboris","nisi","ut","aliquip","ex","ea","commodo","consequat","duis","aute","irure","dolor","in","reprehenderit","in","voluptate","velit","esse","cillum","dolore","eu","fugiat","nulla","pariatur","excepteur","sint","occaecat","cupidatat","non","proident","sunt","in","culpa","qui","officia","deserunt","mollit","anim","id","est","laborum"],s=()=>n[Math.floor(Math.random()*n.length)],o=(a=!1)=>{if(a&&r)return"Lorem ipsum dolor sit amet, consectetur adipiscing elit.";let l=Math.floor(Math.random()*11)+5,p=[];for(let f=0;f<l;f++)p.push(s());let g=p.join(" ");if(g=g.charAt(0).toUpperCase()+g.slice(1),l>8&&Math.random()>.8){let f=Math.floor(l/2),d=g.split(" ");d[f]+=",",g=d.join(" ")}return`${g}.`},i=[];for(let a=0;a<t;a++){let l=Math.max(3,Math.round(e+(Math.random()*4-2))),p=[];for(let g=0;g<l;g++){let f=a===0&&g===0;p.push(o(f))}i.push(p.join(" "))}return i.join(`
|
|
7
7
|
|
|
8
|
-
`)}};var J=class{constructor(t){b(this,"mode");if(this.mode=t,t!=="light"&&t!=="dark")throw new Error(`Unknown theme: ${t}`)}getTheme(){return this.mode==="light"?this.getLightTheme():this.getDarkTheme()}getDarkTheme(){return{mode:"dark",background:{main:"#121212"},header:{main:this.getGrey()[900]},primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5"},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc"},warning:{main:"#ffa726",light:"#ffb74d",dark:"#f57c00"},success:{main:"#66bb6a",light:"#81c784",dark:"#388e3c"},error:{main:"#f44336",dark:"#d32f2f",light:"#e57373"},info:{main:"#29b6f6",dark:"#0288d1",light:"#4fc3f7"},text:{primary:"#fff",secondary:"#B3B3B3",disabled:"#808080",icon:"#808080"},link:{primary:"#90caf9"},action:{active:"#fff",disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16},grey:this.getGrey(),red:this.getRed(),pink:this.getPink(),purple:this.getPurple(),deepPurple:this.getDeepPurple(),indigo:this.getIndigo(),blue:this.getBlue(),lightBlue:this.getLightBlue(),cyan:this.getCyan(),teal:this.getTeal(),green:this.getGreen(),lightGreen:this.getLightGreen(),lime:this.getLime(),yellow:this.getYellow(),amber:this.getAmber(),orange:this.getOrange(),deepOrange:this.getDeepOrange(),brown:this.getBrown()}}getLightTheme(){return{mode:"light",background:{main:"#efefef",light:"#fff"},header:{main:this.getBlue()[700]},primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0",contrastText:"#fff"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2",contrastText:"#fff"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},text:{primary:"#222222",secondary:"#666666",disabled:"#9E9E9E"},link:{primary:"#1976d2"},action:{active:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08},grey:this.getGrey(),red:this.getRed(),pink:this.getPink(),purple:this.getPurple(),deepPurple:this.getDeepPurple(),indigo:this.getIndigo(),blue:this.getBlue(),lightBlue:this.getLightBlue(),cyan:this.getCyan(),teal:this.getTeal(),green:this.getGreen(),lightGreen:this.getLightGreen(),lime:this.getLime(),yellow:this.getYellow(),amber:this.getAmber(),orange:this.getOrange(),deepOrange:this.getDeepOrange(),brown:this.getBrown()}}getGrey(){return{50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"}}getRed(){return{50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"}}getPink(){return{50:"#fce4ec",100:"#f8bbd0",200:"#f48fb1",300:"#f06292",400:"#ec407a",500:"#e91e63",600:"#d81b60",700:"#c2185b",800:"#ad1457",900:"#880e4f",A100:"#ff80ab",A200:"#ff4081",A400:"#f50057",A700:"#c51162"}}getPurple(){return{50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f8",A700:"#aa00ff"}}getDeepPurple(){return{50:"#ede7f6",100:"#d1c4e9",200:"#b39ddb",300:"#9575cd",400:"#7e57c2",500:"#673ab7",600:"#5e35b1",700:"#512da8",800:"#4527a0",900:"#311b92",A100:"#b388ff",A200:"#7c4dff",A400:"#651fff",A700:"#6200ea"}}getIndigo(){return{50:"#e8eaf6",100:"#c5cae9",200:"#9fa8da",300:"#7986cb",400:"#5c6bc0",500:"#3f51b5",600:"#3949ab",700:"#303f9f",800:"#283593",900:"#1a237e",A100:"#8c9eff",A200:"#536dfe",A400:"#3d5afe",A700:"#304ffe"}}getBlue(){return{50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"}}getLightBlue(){return{50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"}}getCyan(){return{50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"}}getTeal(){return{50:"#e0f2f1",100:"#b2dfdb",200:"#80cbc4",300:"#4db6ac",400:"#26a69a",500:"#009688",600:"#00897b",700:"#00796b",800:"#00695c",900:"#004d40",A100:"#a7ffeb",A200:"#64ffda",A400:"#1de9b6",A700:"#00bfa5"}}getGreen(){return{50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"}}getLightGreen(){return{50:"#f1f8e9",100:"#dcedc8",200:"#c5e1a5",300:"#aed581",400:"#9ccc65",500:"#8bc34a",600:"#7cb342",700:"#689f38",800:"#558b2f",900:"#33691e",A100:"#ccff90",A200:"#b2ff59",A400:"#76ff03",A700:"#64dd17"}}getLime(){return{50:"#f9fbe7",100:"#f0f4c3",200:"#e6ee9c",300:"#dce775",400:"#d4e157",500:"#cddc39",600:"#c0ca33",700:"#afb42b",800:"#9fa827",900:"#827717",A100:"#f4ff81",A200:"#eeff41",A400:"#c6ff00",A700:"#aeea00"}}getYellow(){return{50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"}}getAmber(){return{50:"#fff8e1",100:"#ffecb3",200:"#ffe082",300:"#ffd54f",400:"#ffca28",500:"#ffc107",600:"#ffb300",700:"#ffa000",800:"#ff8f00",900:"#ff6f00",A100:"#ffe57f",A200:"#ffd740",A400:"#ffc400",A700:"#ffab00"}}getOrange(){return{50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"}}getDeepOrange(){return{50:"#fbe9e7",100:"#ffccbc",200:"#ffab91",300:"#ff8a65",400:"#ff7043",500:"#ff5722",600:"#f4511e",700:"#e64a19",800:"#d84315",900:"#bf360c",A100:"#ff9e80",A200:"#ff6e40",A400:"#ff3d00",A700:"#dd2c00"}}getBrown(){return{50:"#efebe9",100:"#d7ccc8",200:"#bcaaa4",300:"#a1887f",400:"#8d6e63",500:"#795548",600:"#6d4c41",700:"#5d4037",800:"#4e342e",900:"#3e2723"}}};var
|
|
8
|
+
`)}};var J=class{constructor(t){b(this,"mode");if(this.mode=t,t!=="light"&&t!=="dark")throw new Error(`Unknown theme: ${t}`)}getTheme(){return this.mode==="light"?this.getLightTheme():this.getDarkTheme()}getDarkTheme(){return{mode:"dark",background:{main:"#121212"},header:{main:this.getGrey()[900]},primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5"},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc"},warning:{main:"#ffa726",light:"#ffb74d",dark:"#f57c00"},success:{main:"#66bb6a",light:"#81c784",dark:"#388e3c"},error:{main:"#f44336",dark:"#d32f2f",light:"#e57373"},info:{main:"#29b6f6",dark:"#0288d1",light:"#4fc3f7"},text:{primary:"#fff",secondary:"#B3B3B3",disabled:"#808080",icon:"#808080"},link:{primary:"#90caf9"},action:{active:"#fff",disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16},grey:this.getGrey(),red:this.getRed(),pink:this.getPink(),purple:this.getPurple(),deepPurple:this.getDeepPurple(),indigo:this.getIndigo(),blue:this.getBlue(),lightBlue:this.getLightBlue(),cyan:this.getCyan(),teal:this.getTeal(),green:this.getGreen(),lightGreen:this.getLightGreen(),lime:this.getLime(),yellow:this.getYellow(),amber:this.getAmber(),orange:this.getOrange(),deepOrange:this.getDeepOrange(),brown:this.getBrown()}}getLightTheme(){return{mode:"light",background:{main:"#efefef",light:"#fff"},header:{main:this.getBlue()[700]},primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0",contrastText:"#fff"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2",contrastText:"#fff"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},text:{primary:"#222222",secondary:"#666666",disabled:"#9E9E9E"},link:{primary:"#1976d2"},action:{active:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08},grey:this.getGrey(),red:this.getRed(),pink:this.getPink(),purple:this.getPurple(),deepPurple:this.getDeepPurple(),indigo:this.getIndigo(),blue:this.getBlue(),lightBlue:this.getLightBlue(),cyan:this.getCyan(),teal:this.getTeal(),green:this.getGreen(),lightGreen:this.getLightGreen(),lime:this.getLime(),yellow:this.getYellow(),amber:this.getAmber(),orange:this.getOrange(),deepOrange:this.getDeepOrange(),brown:this.getBrown()}}getGrey(){return{50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"}}getRed(){return{50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"}}getPink(){return{50:"#fce4ec",100:"#f8bbd0",200:"#f48fb1",300:"#f06292",400:"#ec407a",500:"#e91e63",600:"#d81b60",700:"#c2185b",800:"#ad1457",900:"#880e4f",A100:"#ff80ab",A200:"#ff4081",A400:"#f50057",A700:"#c51162"}}getPurple(){return{50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f8",A700:"#aa00ff"}}getDeepPurple(){return{50:"#ede7f6",100:"#d1c4e9",200:"#b39ddb",300:"#9575cd",400:"#7e57c2",500:"#673ab7",600:"#5e35b1",700:"#512da8",800:"#4527a0",900:"#311b92",A100:"#b388ff",A200:"#7c4dff",A400:"#651fff",A700:"#6200ea"}}getIndigo(){return{50:"#e8eaf6",100:"#c5cae9",200:"#9fa8da",300:"#7986cb",400:"#5c6bc0",500:"#3f51b5",600:"#3949ab",700:"#303f9f",800:"#283593",900:"#1a237e",A100:"#8c9eff",A200:"#536dfe",A400:"#3d5afe",A700:"#304ffe"}}getBlue(){return{50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"}}getLightBlue(){return{50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"}}getCyan(){return{50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"}}getTeal(){return{50:"#e0f2f1",100:"#b2dfdb",200:"#80cbc4",300:"#4db6ac",400:"#26a69a",500:"#009688",600:"#00897b",700:"#00796b",800:"#00695c",900:"#004d40",A100:"#a7ffeb",A200:"#64ffda",A400:"#1de9b6",A700:"#00bfa5"}}getGreen(){return{50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"}}getLightGreen(){return{50:"#f1f8e9",100:"#dcedc8",200:"#c5e1a5",300:"#aed581",400:"#9ccc65",500:"#8bc34a",600:"#7cb342",700:"#689f38",800:"#558b2f",900:"#33691e",A100:"#ccff90",A200:"#b2ff59",A400:"#76ff03",A700:"#64dd17"}}getLime(){return{50:"#f9fbe7",100:"#f0f4c3",200:"#e6ee9c",300:"#dce775",400:"#d4e157",500:"#cddc39",600:"#c0ca33",700:"#afb42b",800:"#9fa827",900:"#827717",A100:"#f4ff81",A200:"#eeff41",A400:"#c6ff00",A700:"#aeea00"}}getYellow(){return{50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"}}getAmber(){return{50:"#fff8e1",100:"#ffecb3",200:"#ffe082",300:"#ffd54f",400:"#ffca28",500:"#ffc107",600:"#ffb300",700:"#ffa000",800:"#ff8f00",900:"#ff6f00",A100:"#ffe57f",A200:"#ffd740",A400:"#ffc400",A700:"#ffab00"}}getOrange(){return{50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"}}getDeepOrange(){return{50:"#fbe9e7",100:"#ffccbc",200:"#ffab91",300:"#ff8a65",400:"#ff7043",500:"#ff5722",600:"#f4511e",700:"#e64a19",800:"#d84315",900:"#bf360c",A100:"#ff9e80",A200:"#ff6e40",A400:"#ff3d00",A700:"#dd2c00"}}getBrown(){return{50:"#efebe9",100:"#d7ccc8",200:"#bcaaa4",300:"#a1887f",400:"#8d6e63",500:"#795548",600:"#6d4c41",700:"#5d4037",800:"#4e342e",900:"#3e2723"}}};var j=class{constructor(){b(this,"listeners",[]);b(this,"toasts",[])}subscribe(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter(e=>e!==t)}}notify(){this.listeners.forEach(t=>t(this.toasts))}requestClose(t){this.toasts=this.toasts.map(e=>e.id===t?{...e,exiting:!0}:e),this.notify()}add(t,e="info"){let r=Date.now();this.toasts=[...this.toasts,{id:r,message:t,type:e}],this.notify(),setTimeout(()=>{this.requestClose(r)},4e3)}remove(t){this.toasts=this.toasts.filter(e=>e.id!==t),this.notify()}},N=new j,ae={info:c=>N.add(c,"info"),error:c=>N.add(c,"error"),success:c=>N.add(c,"success")};
|
|
9
9
|
//# sourceMappingURL=index.js.map
|