@xiboplayer/pwa 0.6.7 → 0.6.9

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.
Files changed (42) hide show
  1. package/dist/assets/{chunk-config-CMYzO4ev.js → chunk-config-BSm6sFoD.js} +2 -2
  2. package/dist/assets/{chunk-config-CMYzO4ev.js.map → chunk-config-BSm6sFoD.js.map} +1 -1
  3. package/dist/assets/{index-B4UaMMuB.js → index-6FLcQXcE.js} +2 -2
  4. package/dist/assets/{index-B4UaMMuB.js.map → index-6FLcQXcE.js.map} +1 -1
  5. package/dist/assets/{index-BiE2GyDb.js → index-BHE8ih2g.js} +2 -2
  6. package/dist/assets/{index-BiE2GyDb.js.map → index-BHE8ih2g.js.map} +1 -1
  7. package/dist/assets/{index-CoXIC_UQ.js → index-BMhlHsbi.js} +2 -2
  8. package/dist/assets/{index-CoXIC_UQ.js.map → index-BMhlHsbi.js.map} +1 -1
  9. package/dist/assets/index-BRE_VCVi.js +5 -0
  10. package/dist/assets/index-BRE_VCVi.js.map +1 -0
  11. package/dist/assets/{index-zrbMnYCP.js → index-BuocQahX.js} +2 -2
  12. package/dist/assets/{index-zrbMnYCP.js.map → index-BuocQahX.js.map} +1 -1
  13. package/dist/assets/{index-C6c64mN7.js → index-DZOh1YLo.js} +2 -2
  14. package/dist/assets/{index-C6c64mN7.js.map → index-DZOh1YLo.js.map} +1 -1
  15. package/dist/assets/{index-DWFw5MRg.js → index-DimwXyZl.js} +2 -2
  16. package/dist/assets/{index-DWFw5MRg.js.map → index-DimwXyZl.js.map} +1 -1
  17. package/dist/assets/index-DkW-FYJj.js +2 -0
  18. package/dist/assets/{index-Dq09PEOq.js.map → index-DkW-FYJj.js.map} +1 -1
  19. package/dist/assets/{index-QY9h_RMM.js → index-Dmo4yflq.js} +2 -2
  20. package/dist/assets/{index-QY9h_RMM.js.map → index-Dmo4yflq.js.map} +1 -1
  21. package/dist/assets/index-g0-Ukhyg.js +2 -0
  22. package/dist/assets/{index-CeAXY0eG.js.map → index-g0-Ukhyg.js.map} +1 -1
  23. package/dist/assets/main-qr-4qqAC.js +736 -0
  24. package/dist/assets/main-qr-4qqAC.js.map +1 -0
  25. package/dist/assets/{protocol-detector-CMqseOWd.js → protocol-detector-BHOdZSCQ.js} +2 -2
  26. package/dist/assets/{protocol-detector-CMqseOWd.js.map → protocol-detector-BHOdZSCQ.js.map} +1 -1
  27. package/dist/assets/{setup-CCFV4NIF.js → setup-Dqc80b-h.js} +2 -2
  28. package/dist/assets/{setup-CCFV4NIF.js.map → setup-Dqc80b-h.js.map} +1 -1
  29. package/dist/assets/{sync-manager-xXxwbg-u.js → sync-manager-wzy5P26A.js} +2 -2
  30. package/dist/assets/{sync-manager-xXxwbg-u.js.map → sync-manager-wzy5P26A.js.map} +1 -1
  31. package/dist/assets/{widget-html-CU4UQJdo.js → widget-html-Dthb_t6h.js} +2 -2
  32. package/dist/assets/{widget-html-CU4UQJdo.js.map → widget-html-Dthb_t6h.js.map} +1 -1
  33. package/dist/index.html +3 -3
  34. package/dist/setup.html +3 -3
  35. package/dist/sw-pwa.js +1 -1
  36. package/package.json +13 -13
  37. package/dist/assets/index-CeAXY0eG.js +0 -2
  38. package/dist/assets/index-D0tCWHJB.js +0 -5
  39. package/dist/assets/index-D0tCWHJB.js.map +0 -1
  40. package/dist/assets/index-Dq09PEOq.js +0 -2
  41. package/dist/assets/main-D0VeRPw5.js +0 -736
  42. package/dist/assets/main-D0VeRPw5.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{createLogger as l,PLAYER_API as d}from"./index-D0tCWHJB.js";const o=(()=>{var t;return typeof self<"u"&&((t=self.registration)!=null&&t.scope)?new URL(self.registration.scope).pathname.replace(/\/$/,""):"/player/pwa"})();class h{constructor(s){this.downloadManager=s,this.log=l("SW")}async handleRequest(s){const e=new URL(s.request.url);return e.pathname===o+"/"||e.pathname===o+"/index.html"||e.pathname===o+"/setup.html"||e.pathname.startsWith(d+"/")?fetch(s.request):null}}const u=t=>(t.path||"").split("?")[0].replace(/^\/+/,"")||`${t.type||"media"}/${t.id}`;class p{constructor(s,e){this.downloadManager=s,this.config=e,this.log=l("SW Message")}async handleMessage(s){const{type:e,data:a}=s.data;switch(this.log.info("Received:",e),e){case"PING":return this.log.info("PING received, broadcasting SW_READY"),(await self.clients.matchAll()).forEach(r=>{r.postMessage({type:"SW_READY"})}),{success:!0};case"DELETE_FILES":return await this.handleDeleteFiles(a.files);case"GET_ALL_FILES":return await this.handleGetAllFiles();case"CLEAR_CACHE":return{success:!0};default:return this.log.warn("Unknown message type:",e),{success:!1,error:"Unknown message type"}}}async handleDeleteFiles(s){if(!s||!Array.isArray(s))return{success:!1,error:"No files provided"};try{const e=s.map(r=>({...r,key:u(r)})),n=await(await fetch("/store/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:e})})).json();return this.log.info(`Purge complete: ${n.deleted}/${n.total} files deleted`),{success:!0,deleted:n.deleted,total:n.total}}catch(e){return this.log.error("Delete failed:",e.message),{success:!1,error:e.message}}}async handleGetAllFiles(){try{return{success:!0,files:(await(await fetch("/store/list")).json()).files||[]}}catch(s){return this.log.error("Failed to list files:",s.message),{success:!0,files:[]}}}}function m(t){t||(t=l("ChunkConfig"));const s=typeof navigator<"u"&&navigator.deviceMemory||null;let e=4;if(s)e=s,t.info("Detected device memory:",s,"GB");else if(typeof navigator<"u"){const i=navigator.userAgent.toLowerCase();i.includes("raspberry pi")||i.includes("armv6")?(e=.5,t.info("Detected Pi Zero (512 MB RAM estimated)")):i.includes("armv7")?(e=1,t.info("Detected ARM device (1 GB RAM estimated)")):t.info("Using default RAM estimate:",e,"GB")}let a,n,r,c;return e<=.5?(a=10*1024*1024,n=25,r=25*1024*1024,c=1,t.info("Low-memory config: 10 MB chunks, 25 MB cache, 1 concurrent download")):e<=1?(a=20*1024*1024,n=50,r=50*1024*1024,c=2,t.info("1GB-RAM config: 20 MB chunks, 50 MB cache, 2 concurrent downloads")):e<=2?(a=30*1024*1024,n=100,r=75*1024*1024,c=2,t.info("2GB-RAM config: 30 MB chunks, 100 MB cache, 2 concurrent downloads")):e<=4?(a=50*1024*1024,n=200,r=100*1024*1024,c=4,t.info("4GB-RAM config: 50 MB chunks, 200 MB cache, 4 concurrent downloads")):(a=100*1024*1024,n=500,r=200*1024*1024,c=4,t.info("High-RAM config: 100 MB chunks, 500 MB cache, 4 concurrent downloads")),{chunkSize:a,blobCacheSize:n,threshold:r,concurrency:c}}export{o as B,p as M,h as R,m as c};
2
- //# sourceMappingURL=chunk-config-CMYzO4ev.js.map
1
+ import{createLogger as l,PLAYER_API as d}from"./index-BRE_VCVi.js";const o=(()=>{var t;return typeof self<"u"&&((t=self.registration)!=null&&t.scope)?new URL(self.registration.scope).pathname.replace(/\/$/,""):"/player/pwa"})();class h{constructor(s){this.downloadManager=s,this.log=l("SW")}async handleRequest(s){const e=new URL(s.request.url);return e.pathname===o+"/"||e.pathname===o+"/index.html"||e.pathname===o+"/setup.html"||e.pathname.startsWith(d+"/")?fetch(s.request):null}}const u=t=>(t.path||"").split("?")[0].replace(/^\/+/,"")||`${t.type||"media"}/${t.id}`;class p{constructor(s,e){this.downloadManager=s,this.config=e,this.log=l("SW Message")}async handleMessage(s){const{type:e,data:a}=s.data;switch(this.log.info("Received:",e),e){case"PING":return this.log.info("PING received, broadcasting SW_READY"),(await self.clients.matchAll()).forEach(r=>{r.postMessage({type:"SW_READY"})}),{success:!0};case"DELETE_FILES":return await this.handleDeleteFiles(a.files);case"GET_ALL_FILES":return await this.handleGetAllFiles();case"CLEAR_CACHE":return{success:!0};default:return this.log.warn("Unknown message type:",e),{success:!1,error:"Unknown message type"}}}async handleDeleteFiles(s){if(!s||!Array.isArray(s))return{success:!1,error:"No files provided"};try{const e=s.map(r=>({...r,key:u(r)})),n=await(await fetch("/store/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:e})})).json();return this.log.info(`Purge complete: ${n.deleted}/${n.total} files deleted`),{success:!0,deleted:n.deleted,total:n.total}}catch(e){return this.log.error("Delete failed:",e.message),{success:!1,error:e.message}}}async handleGetAllFiles(){try{return{success:!0,files:(await(await fetch("/store/list")).json()).files||[]}}catch(s){return this.log.error("Failed to list files:",s.message),{success:!0,files:[]}}}}function m(t){t||(t=l("ChunkConfig"));const s=typeof navigator<"u"&&navigator.deviceMemory||null;let e=4;if(s)e=s,t.info("Detected device memory:",s,"GB");else if(typeof navigator<"u"){const i=navigator.userAgent.toLowerCase();i.includes("raspberry pi")||i.includes("armv6")?(e=.5,t.info("Detected Pi Zero (512 MB RAM estimated)")):i.includes("armv7")?(e=1,t.info("Detected ARM device (1 GB RAM estimated)")):t.info("Using default RAM estimate:",e,"GB")}let a,n,r,c;return e<=.5?(a=10*1024*1024,n=25,r=25*1024*1024,c=1,t.info("Low-memory config: 10 MB chunks, 25 MB cache, 1 concurrent download")):e<=1?(a=20*1024*1024,n=50,r=50*1024*1024,c=2,t.info("1GB-RAM config: 20 MB chunks, 50 MB cache, 2 concurrent downloads")):e<=2?(a=30*1024*1024,n=100,r=75*1024*1024,c=2,t.info("2GB-RAM config: 30 MB chunks, 100 MB cache, 2 concurrent downloads")):e<=4?(a=50*1024*1024,n=200,r=100*1024*1024,c=4,t.info("4GB-RAM config: 50 MB chunks, 200 MB cache, 4 concurrent downloads")):(a=100*1024*1024,n=500,r=200*1024*1024,c=4,t.info("High-RAM config: 100 MB chunks, 500 MB cache, 4 concurrent downloads")),{chunkSize:a,blobCacheSize:n,threshold:r,concurrency:c}}export{o as B,p as M,h as R,m as c};
2
+ //# sourceMappingURL=chunk-config-BSm6sFoD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-config-CMYzO4ev.js","sources":["../../../sw/src/sw-utils.js","../../../sw/src/request-handler.js","../../../sw/src/message-handler.js","../../../sw/src/chunk-config.js"],"sourcesContent":["/**\n * Service Worker Utility Functions\n * Shared helpers to eliminate code duplication and improve maintainability\n */\n\n/**\n * Dynamic base path derived from the Service Worker's registration scope.\n * Allows the same build to serve /player/pwa/, /player/pwa-xmds/, /player/pwa-xlr/.\n */\nexport const BASE = (() => {\n if (typeof self !== 'undefined' && self.registration?.scope) {\n return new URL(self.registration.scope).pathname.replace(/\\/$/, '');\n }\n return '/player/pwa'; // fallback\n})();\n\n/**\n * Format byte size to human-readable string\n * @param {number} bytes - Size in bytes\n * @param {number} decimals - Decimal places (default: 1)\n * @returns {string} Formatted size (e.g., \"1.5 MB\", \"512.0 KB\")\n */\nexport function formatBytes(bytes, decimals = 1) {\n if (bytes === 0) return '0 Bytes';\n if (bytes < 1024) return `${bytes} Bytes`;\n\n const kb = bytes / 1024;\n if (kb < 1024) return `${kb.toFixed(decimals)} KB`;\n\n const mb = kb / 1024;\n if (mb < 1024) return `${mb.toFixed(decimals)} MB`;\n\n const gb = mb / 1024;\n return `${gb.toFixed(decimals)} GB`;\n}\n\n/**\n * Parse HTTP Range header\n * @param {string} rangeHeader - Range header value (e.g., \"bytes=0-1000\")\n * @param {number} totalSize - Total file size\n * @returns {{ start: number, end: number }} Byte range\n */\nexport function parseRangeHeader(rangeHeader, totalSize) {\n const parts = rangeHeader.replace(/bytes=/, '').split('-');\n const start = parseInt(parts[0], 10);\n const end = parts[1] ? parseInt(parts[1], 10) : totalSize - 1;\n\n return { start, end };\n}\n\n/**\n * Create standardized response headers for media files\n * @param {Object} options - Header options\n * @param {string} options.contentType - Content-Type header\n * @param {number|string} options.contentLength - Content-Length header\n * @param {boolean} options.includeCache - Include Cache-Control header\n * @param {string} options.contentRange - Content-Range for 206 responses\n * @returns {Object} Response headers\n */\nexport function createMediaHeaders({\n contentType = 'application/octet-stream',\n contentLength = null,\n includeCache = false,\n contentRange = null\n}) {\n const headers = {\n 'Content-Type': contentType,\n 'Accept-Ranges': 'bytes',\n 'Access-Control-Allow-Origin': '*'\n };\n\n if (contentLength !== null) {\n headers['Content-Length'] = String(contentLength);\n }\n\n if (includeCache) {\n headers['Cache-Control'] = 'public, max-age=31536000';\n }\n\n if (contentRange) {\n headers['Content-Range'] = contentRange;\n }\n\n return headers;\n}\n\n/**\n * Create error response with consistent format\n * @param {string} message - Error message\n * @param {number} status - HTTP status code\n * @returns {Response}\n */\nexport function createErrorResponse(message, status = 500) {\n const statusTexts = {\n 404: 'Not Found',\n 500: 'Internal Server Error',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable'\n };\n\n return new Response(message, {\n status,\n statusText: statusTexts[status] || 'Error',\n headers: { 'Content-Type': 'text/plain' }\n });\n}\n\n/**\n * HTTP Status Codes\n */\nexport const HTTP_STATUS = {\n OK: 200,\n PARTIAL_CONTENT: 206,\n NOT_FOUND: 404,\n INTERNAL_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503\n};\n\n/**\n * Timeouts (milliseconds)\n */\nexport const TIMEOUTS = {\n SW_CLAIM_WAIT: 100, // Wait for SW to claim page\n SW_FETCH_READY: 200, // Wait for SW fetch handler\n SW_READY_MAX: 10000, // Max wait for SW ready\n DOWNLOAD_CHECK: 1000 // Download progress check interval\n};\n\n/**\n * Calculate chunk boundaries\n * @param {number} chunkIndex - Chunk index\n * @param {number} chunkSize - Size per chunk\n * @param {number} totalSize - Total file size\n * @returns {{ start: number, end: number, size: number }}\n */\nexport function getChunkBoundaries(chunkIndex, chunkSize, totalSize) {\n const start = chunkIndex * chunkSize;\n const end = Math.min(start + chunkSize, totalSize);\n return { start, end, size: end - start };\n}\n\n/**\n * Calculate which chunks contain a byte range\n * @param {number} rangeStart - Range start byte\n * @param {number} rangeEnd - Range end byte\n * @param {number} chunkSize - Size per chunk\n * @returns {{ startChunk: number, endChunk: number, count: number }}\n */\nexport function getChunksForRange(rangeStart, rangeEnd, chunkSize) {\n const startChunk = Math.floor(rangeStart / chunkSize);\n const endChunk = Math.floor(rangeEnd / chunkSize);\n return {\n startChunk,\n endChunk,\n count: endChunk - startChunk + 1\n };\n}\n\n/**\n * Extract byte range from chunk blobs\n * @param {Blob[]} chunkBlobs - Array of chunk blobs\n * @param {number} rangeStart - Desired start byte (absolute position in file)\n * @param {number} rangeEnd - Desired end byte (absolute position in file)\n * @param {number} chunkSize - Size per chunk\n * @param {string} contentType - Content type for result blob\n * @returns {Blob} Extracted range\n */\nexport function extractRangeFromChunks(chunkBlobs, rangeStart, rangeEnd, chunkSize, contentType) {\n if (chunkBlobs.length === 1) {\n // Single chunk - simple slice\n const offset = rangeStart % chunkSize;\n const length = rangeEnd - rangeStart + 1;\n return chunkBlobs[0].slice(offset, offset + length);\n }\n\n // Multiple chunks - concatenate parts\n const parts = [];\n const firstChunkOffset = rangeStart % chunkSize;\n const lastChunkEnd = rangeEnd % chunkSize;\n\n // First chunk (partial from offset to end)\n parts.push(chunkBlobs[0].slice(firstChunkOffset));\n\n // Middle chunks (complete - use as-is)\n for (let i = 1; i < chunkBlobs.length - 1; i++) {\n parts.push(chunkBlobs[i]);\n }\n\n // Last chunk (partial from start to lastChunkEnd)\n if (chunkBlobs.length > 1) {\n parts.push(chunkBlobs[chunkBlobs.length - 1].slice(0, lastChunkEnd + 1));\n }\n\n return new Blob(parts, { type: contentType });\n}\n","/**\n * RequestHandler - Handles fetch events for cached content\n *\n * With CMS mirror routes on the proxy, the SW's role is minimal:\n * - ${PLAYER_API}/* requests pass through to Express (mirror routes serve them)\n * - Static pages pass through to network\n *\n * No URL translation needed — the proxy serves at CMS paths directly.\n * Widget HTML is served by the Express mirror route at ${PLAYER_API}/widgets/{L}/{R}/{M}.\n */\n\nimport { BASE } from './sw-utils.js';\nimport { createLogger, PLAYER_API } from '@xiboplayer/utils';\n\nexport class RequestHandler {\n /**\n * @param {Object} downloadManager - DownloadManager instance\n */\n constructor(downloadManager) {\n this.downloadManager = downloadManager;\n this.log = createLogger('SW');\n }\n\n /**\n * Handle fetch request\n */\n async handleRequest(event) {\n const url = new URL(event.request.url);\n\n // Static pages — pass through to Express\n if (url.pathname === BASE + '/' ||\n url.pathname === BASE + '/index.html' ||\n url.pathname === BASE + '/setup.html') {\n return fetch(event.request);\n }\n\n // Player API — pass through to Express mirror routes\n if (url.pathname.startsWith(PLAYER_API + '/')) {\n return fetch(event.request);\n }\n\n // Not a cache request — let browser handle\n return null;\n }\n}\n","/**\n * MessageHandler - Handles postMessage from client\n *\n * Lightweight SW message handler for lifecycle and file management.\n * Download orchestration has moved to the main thread (PwaPlayer).\n */\n\nimport { createLogger } from '@xiboplayer/utils';\n\n/** Store key = URL path without leading / and query params */\nconst storeKeyFrom = (f) => (f.path || '').split('?')[0].replace(/^\\/+/, '') || `${f.type || 'media'}/${f.id}`;\n\nexport class MessageHandler {\n /**\n * @param {Object} downloadManager - DownloadManager instance (kept for future SW-only mode)\n * @param {Object} config\n */\n constructor(downloadManager, config) {\n this.downloadManager = downloadManager;\n this.config = config;\n this.log = createLogger('SW Message');\n }\n\n /**\n * Handle message from client\n */\n async handleMessage(event) {\n const { type, data } = event.data;\n this.log.info('Received:', type);\n\n switch (type) {\n case 'PING': {\n this.log.info('PING received, broadcasting SW_READY');\n const clients = await self.clients.matchAll();\n clients.forEach(client => {\n client.postMessage({ type: 'SW_READY' });\n });\n return { success: true };\n }\n\n case 'DELETE_FILES':\n return await this.handleDeleteFiles(data.files);\n\n case 'GET_ALL_FILES':\n return await this.handleGetAllFiles();\n\n case 'CLEAR_CACHE':\n return { success: true };\n\n default:\n this.log.warn('Unknown message type:', type);\n return { success: false, error: 'Unknown message type' };\n }\n }\n\n /**\n * Handle DELETE_FILES message - purge obsolete files from ContentStore via proxy\n */\n async handleDeleteFiles(files) {\n if (!files || !Array.isArray(files)) {\n return { success: false, error: 'No files provided' };\n }\n\n try {\n const deleteFiles = files.map(f => ({\n ...f,\n key: storeKeyFrom(f),\n }));\n const resp = await fetch('/store/delete', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ files: deleteFiles }),\n });\n const result = await resp.json();\n this.log.info(`Purge complete: ${result.deleted}/${result.total} files deleted`);\n return { success: true, deleted: result.deleted, total: result.total };\n } catch (err) {\n this.log.error('Delete failed:', err.message);\n return { success: false, error: err.message };\n }\n }\n\n /**\n * Handle GET_ALL_FILES — list files from ContentStore via proxy\n */\n async handleGetAllFiles() {\n try {\n const resp = await fetch('/store/list');\n const data = await resp.json();\n return { success: true, files: data.files || [] };\n } catch (err) {\n this.log.error('Failed to list files:', err.message);\n return { success: true, files: [] };\n }\n }\n}\n","/**\n * Chunk configuration for Service Worker downloads\n */\n\nimport { createLogger } from '@xiboplayer/utils';\n\n/**\n * Calculate optimal chunk size based on available device memory.\n * Returns configuration for chunk streaming, blob caching, and download concurrency.\n *\n * @param {{ info: Function }} [log] - Optional logger (created internally if not provided)\n * @returns {{ chunkSize: number, blobCacheSize: number, threshold: number, concurrency: number }}\n */\nexport function calculateChunkConfig(log) {\n if (!log) log = createLogger('ChunkConfig');\n\n // Try to detect device memory (Chrome only for now)\n const deviceMemoryGB = (typeof navigator !== 'undefined' && navigator.deviceMemory) || null;\n\n // Fallback: estimate from user agent\n let estimatedRAM_GB = 4; // Default assumption\n\n if (deviceMemoryGB) {\n estimatedRAM_GB = deviceMemoryGB;\n log.info('Detected device memory:', deviceMemoryGB, 'GB');\n } else if (typeof navigator !== 'undefined') {\n // Parse user agent for hints\n const ua = navigator.userAgent.toLowerCase();\n if (ua.includes('raspberry pi') || ua.includes('armv6')) {\n estimatedRAM_GB = 0.5; // Pi Zero\n log.info('Detected Pi Zero (512 MB RAM estimated)');\n } else if (ua.includes('armv7')) {\n estimatedRAM_GB = 1; // Pi 3/4\n log.info('Detected ARM device (1 GB RAM estimated)');\n } else {\n log.info('Using default RAM estimate:', estimatedRAM_GB, 'GB');\n }\n }\n\n // Configure based on RAM - chunk size, cache, threshold, AND concurrency\n let chunkSize, blobCacheSize, threshold, concurrency;\n\n if (estimatedRAM_GB <= 0.5) {\n // Pi Zero (512 MB) - very conservative\n chunkSize = 10 * 1024 * 1024;\n blobCacheSize = 25;\n threshold = 25 * 1024 * 1024;\n concurrency = 1;\n log.info('Low-memory config: 10 MB chunks, 25 MB cache, 1 concurrent download');\n } else if (estimatedRAM_GB <= 1) {\n // 1 GB RAM (Pi 3) - conservative\n chunkSize = 20 * 1024 * 1024;\n blobCacheSize = 50;\n threshold = 50 * 1024 * 1024;\n concurrency = 2;\n log.info('1GB-RAM config: 20 MB chunks, 50 MB cache, 2 concurrent downloads');\n } else if (estimatedRAM_GB <= 2) {\n // 2 GB RAM - moderate\n chunkSize = 30 * 1024 * 1024;\n blobCacheSize = 100;\n threshold = 75 * 1024 * 1024;\n concurrency = 2;\n log.info('2GB-RAM config: 30 MB chunks, 100 MB cache, 2 concurrent downloads');\n } else if (estimatedRAM_GB <= 4) {\n // 4 GB RAM - default\n chunkSize = 50 * 1024 * 1024;\n blobCacheSize = 200;\n threshold = 100 * 1024 * 1024;\n concurrency = 4;\n log.info('4GB-RAM config: 50 MB chunks, 200 MB cache, 4 concurrent downloads');\n } else {\n // 8+ GB RAM - generous but heap-safe (100 MB × 4 = 400 MB peak, within 768 MB V8 heap)\n chunkSize = 100 * 1024 * 1024;\n blobCacheSize = 500;\n threshold = 200 * 1024 * 1024;\n concurrency = 4;\n log.info('High-RAM config: 100 MB chunks, 500 MB cache, 4 concurrent downloads');\n }\n\n return { chunkSize, blobCacheSize, threshold, concurrency };\n}\n"],"names":["BASE","_a","RequestHandler","downloadManager","createLogger","event","url","PLAYER_API","storeKeyFrom","f","MessageHandler","config","type","data","client","files","deleteFiles","result","err","calculateChunkConfig","log","deviceMemoryGB","estimatedRAM_GB","ua","chunkSize","blobCacheSize","threshold","concurrency"],"mappings":"mEASY,MAACA,GAAQ,IAAM,OACzB,OAAI,OAAO,KAAS,OAAeC,EAAA,KAAK,eAAL,MAAAA,EAAmB,OAC7C,IAAI,IAAI,KAAK,aAAa,KAAK,EAAE,SAAS,QAAQ,MAAO,EAAE,EAE7D,aACT,GAAC,ECAM,MAAMC,CAAe,CAI1B,YAAYC,EAAiB,CAC3B,KAAK,gBAAkBA,EACvB,KAAK,IAAMC,EAAa,IAAI,CAC9B,CAKA,MAAM,cAAcC,EAAO,CACzB,MAAMC,EAAM,IAAI,IAAID,EAAM,QAAQ,GAAG,EAUrC,OAPIC,EAAI,WAAaN,EAAO,KACxBM,EAAI,WAAaN,EAAO,eACxBM,EAAI,WAAaN,EAAO,eAKxBM,EAAI,SAAS,WAAWC,EAAa,GAAG,EACnC,MAAMF,EAAM,OAAO,EAIrB,IACT,CACF,CClCA,MAAMG,EAAgBC,IAAOA,EAAE,MAAQ,IAAI,MAAM,GAAG,EAAE,CAAC,EAAE,QAAQ,OAAQ,EAAE,GAAK,GAAGA,EAAE,MAAQ,OAAO,IAAIA,EAAE,EAAE,GAErG,MAAMC,CAAe,CAK1B,YAAYP,EAAiBQ,EAAQ,CACnC,KAAK,gBAAkBR,EACvB,KAAK,OAASQ,EACd,KAAK,IAAMP,EAAa,YAAY,CACtC,CAKA,MAAM,cAAcC,EAAO,CACzB,KAAM,CAAE,KAAAO,EAAM,KAAAC,CAAI,EAAKR,EAAM,KAG7B,OAFA,KAAK,IAAI,KAAK,YAAaO,CAAI,EAEvBA,EAAI,CACV,IAAK,OACH,YAAK,IAAI,KAAK,sCAAsC,GACpC,MAAM,KAAK,QAAQ,SAAQ,GACnC,QAAQE,GAAU,CACxBA,EAAO,YAAY,CAAE,KAAM,UAAU,CAAE,CACzC,CAAC,EACM,CAAE,QAAS,EAAI,EAGxB,IAAK,eACH,OAAO,MAAM,KAAK,kBAAkBD,EAAK,KAAK,EAEhD,IAAK,gBACH,OAAO,MAAM,KAAK,kBAAiB,EAErC,IAAK,cACH,MAAO,CAAE,QAAS,EAAI,EAExB,QACE,YAAK,IAAI,KAAK,wBAAyBD,CAAI,EACpC,CAAE,QAAS,GAAO,MAAO,sBAAsB,CAC9D,CACE,CAKA,MAAM,kBAAkBG,EAAO,CAC7B,GAAI,CAACA,GAAS,CAAC,MAAM,QAAQA,CAAK,EAChC,MAAO,CAAE,QAAS,GAAO,MAAO,mBAAmB,EAGrD,GAAI,CACF,MAAMC,EAAcD,EAAM,IAAIN,IAAM,CAClC,GAAGA,EACH,IAAKD,EAAaC,CAAC,CAC3B,EAAQ,EAMIQ,EAAS,MALF,MAAM,MAAM,gBAAiB,CACxC,OAAQ,OACR,QAAS,CAAE,eAAgB,kBAAkB,EAC7C,KAAM,KAAK,UAAU,CAAE,MAAOD,CAAW,CAAE,CACnD,CAAO,GACyB,KAAI,EAC9B,YAAK,IAAI,KAAK,mBAAmBC,EAAO,OAAO,IAAIA,EAAO,KAAK,gBAAgB,EACxE,CAAE,QAAS,GAAM,QAASA,EAAO,QAAS,MAAOA,EAAO,KAAK,CACtE,OAASC,EAAK,CACZ,YAAK,IAAI,MAAM,iBAAkBA,EAAI,OAAO,EACrC,CAAE,QAAS,GAAO,MAAOA,EAAI,OAAO,CAC7C,CACF,CAKA,MAAM,mBAAoB,CACxB,GAAI,CAGF,MAAO,CAAE,QAAS,GAAM,OADX,MADA,MAAM,MAAM,aAAa,GACd,KAAI,GACQ,OAAS,EAAE,CACjD,OAASA,EAAK,CACZ,YAAK,IAAI,MAAM,wBAAyBA,EAAI,OAAO,EAC5C,CAAE,QAAS,GAAM,MAAO,CAAA,CAAE,CACnC,CACF,CACF,CClFO,SAASC,EAAqBC,EAAK,CACnCA,IAAKA,EAAMhB,EAAa,aAAa,GAG1C,MAAMiB,EAAkB,OAAO,UAAc,KAAe,UAAU,cAAiB,KAGvF,IAAIC,EAAkB,EAEtB,GAAID,EACFC,EAAkBD,EAClBD,EAAI,KAAK,0BAA2BC,EAAgB,IAAI,UAC/C,OAAO,UAAc,IAAa,CAE3C,MAAME,EAAK,UAAU,UAAU,YAAW,EACtCA,EAAG,SAAS,cAAc,GAAKA,EAAG,SAAS,OAAO,GACpDD,EAAkB,GAClBF,EAAI,KAAK,yCAAyC,GACzCG,EAAG,SAAS,OAAO,GAC5BD,EAAkB,EAClBF,EAAI,KAAK,0CAA0C,GAEnDA,EAAI,KAAK,8BAA+BE,EAAiB,IAAI,CAEjE,CAGA,IAAIE,EAAWC,EAAeC,EAAWC,EAEzC,OAAIL,GAAmB,IAErBE,EAAY,GAAK,KAAO,KACxBC,EAAgB,GAChBC,EAAY,GAAK,KAAO,KACxBC,EAAc,EACdP,EAAI,KAAK,qEAAqE,GACrEE,GAAmB,GAE5BE,EAAY,GAAK,KAAO,KACxBC,EAAgB,GAChBC,EAAY,GAAK,KAAO,KACxBC,EAAc,EACdP,EAAI,KAAK,mEAAmE,GACnEE,GAAmB,GAE5BE,EAAY,GAAK,KAAO,KACxBC,EAAgB,IAChBC,EAAY,GAAK,KAAO,KACxBC,EAAc,EACdP,EAAI,KAAK,oEAAoE,GACpEE,GAAmB,GAE5BE,EAAY,GAAK,KAAO,KACxBC,EAAgB,IAChBC,EAAY,IAAM,KAAO,KACzBC,EAAc,EACdP,EAAI,KAAK,oEAAoE,IAG7EI,EAAY,IAAM,KAAO,KACzBC,EAAgB,IAChBC,EAAY,IAAM,KAAO,KACzBC,EAAc,EACdP,EAAI,KAAK,sEAAsE,GAG1E,CAAE,UAAAI,EAAW,cAAAC,EAAe,UAAAC,EAAW,YAAAC,CAAW,CAC3D"}
1
+ {"version":3,"file":"chunk-config-BSm6sFoD.js","sources":["../../../sw/src/sw-utils.js","../../../sw/src/request-handler.js","../../../sw/src/message-handler.js","../../../sw/src/chunk-config.js"],"sourcesContent":["/**\n * Service Worker Utility Functions\n * Shared helpers to eliminate code duplication and improve maintainability\n */\n\n/**\n * Dynamic base path derived from the Service Worker's registration scope.\n * Allows the same build to serve /player/pwa/, /player/pwa-xmds/, /player/pwa-xlr/.\n */\nexport const BASE = (() => {\n if (typeof self !== 'undefined' && self.registration?.scope) {\n return new URL(self.registration.scope).pathname.replace(/\\/$/, '');\n }\n return '/player/pwa'; // fallback\n})();\n\n/**\n * Format byte size to human-readable string\n * @param {number} bytes - Size in bytes\n * @param {number} decimals - Decimal places (default: 1)\n * @returns {string} Formatted size (e.g., \"1.5 MB\", \"512.0 KB\")\n */\nexport function formatBytes(bytes, decimals = 1) {\n if (bytes === 0) return '0 Bytes';\n if (bytes < 1024) return `${bytes} Bytes`;\n\n const kb = bytes / 1024;\n if (kb < 1024) return `${kb.toFixed(decimals)} KB`;\n\n const mb = kb / 1024;\n if (mb < 1024) return `${mb.toFixed(decimals)} MB`;\n\n const gb = mb / 1024;\n return `${gb.toFixed(decimals)} GB`;\n}\n\n/**\n * Parse HTTP Range header\n * @param {string} rangeHeader - Range header value (e.g., \"bytes=0-1000\")\n * @param {number} totalSize - Total file size\n * @returns {{ start: number, end: number }} Byte range\n */\nexport function parseRangeHeader(rangeHeader, totalSize) {\n const parts = rangeHeader.replace(/bytes=/, '').split('-');\n const start = parseInt(parts[0], 10);\n const end = parts[1] ? parseInt(parts[1], 10) : totalSize - 1;\n\n return { start, end };\n}\n\n/**\n * Create standardized response headers for media files\n * @param {Object} options - Header options\n * @param {string} options.contentType - Content-Type header\n * @param {number|string} options.contentLength - Content-Length header\n * @param {boolean} options.includeCache - Include Cache-Control header\n * @param {string} options.contentRange - Content-Range for 206 responses\n * @returns {Object} Response headers\n */\nexport function createMediaHeaders({\n contentType = 'application/octet-stream',\n contentLength = null,\n includeCache = false,\n contentRange = null\n}) {\n const headers = {\n 'Content-Type': contentType,\n 'Accept-Ranges': 'bytes',\n 'Access-Control-Allow-Origin': '*'\n };\n\n if (contentLength !== null) {\n headers['Content-Length'] = String(contentLength);\n }\n\n if (includeCache) {\n headers['Cache-Control'] = 'public, max-age=31536000';\n }\n\n if (contentRange) {\n headers['Content-Range'] = contentRange;\n }\n\n return headers;\n}\n\n/**\n * Create error response with consistent format\n * @param {string} message - Error message\n * @param {number} status - HTTP status code\n * @returns {Response}\n */\nexport function createErrorResponse(message, status = 500) {\n const statusTexts = {\n 404: 'Not Found',\n 500: 'Internal Server Error',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable'\n };\n\n return new Response(message, {\n status,\n statusText: statusTexts[status] || 'Error',\n headers: { 'Content-Type': 'text/plain' }\n });\n}\n\n/**\n * HTTP Status Codes\n */\nexport const HTTP_STATUS = {\n OK: 200,\n PARTIAL_CONTENT: 206,\n NOT_FOUND: 404,\n INTERNAL_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503\n};\n\n/**\n * Timeouts (milliseconds)\n */\nexport const TIMEOUTS = {\n SW_CLAIM_WAIT: 100, // Wait for SW to claim page\n SW_FETCH_READY: 200, // Wait for SW fetch handler\n SW_READY_MAX: 10000, // Max wait for SW ready\n DOWNLOAD_CHECK: 1000 // Download progress check interval\n};\n\n/**\n * Calculate chunk boundaries\n * @param {number} chunkIndex - Chunk index\n * @param {number} chunkSize - Size per chunk\n * @param {number} totalSize - Total file size\n * @returns {{ start: number, end: number, size: number }}\n */\nexport function getChunkBoundaries(chunkIndex, chunkSize, totalSize) {\n const start = chunkIndex * chunkSize;\n const end = Math.min(start + chunkSize, totalSize);\n return { start, end, size: end - start };\n}\n\n/**\n * Calculate which chunks contain a byte range\n * @param {number} rangeStart - Range start byte\n * @param {number} rangeEnd - Range end byte\n * @param {number} chunkSize - Size per chunk\n * @returns {{ startChunk: number, endChunk: number, count: number }}\n */\nexport function getChunksForRange(rangeStart, rangeEnd, chunkSize) {\n const startChunk = Math.floor(rangeStart / chunkSize);\n const endChunk = Math.floor(rangeEnd / chunkSize);\n return {\n startChunk,\n endChunk,\n count: endChunk - startChunk + 1\n };\n}\n\n/**\n * Extract byte range from chunk blobs\n * @param {Blob[]} chunkBlobs - Array of chunk blobs\n * @param {number} rangeStart - Desired start byte (absolute position in file)\n * @param {number} rangeEnd - Desired end byte (absolute position in file)\n * @param {number} chunkSize - Size per chunk\n * @param {string} contentType - Content type for result blob\n * @returns {Blob} Extracted range\n */\nexport function extractRangeFromChunks(chunkBlobs, rangeStart, rangeEnd, chunkSize, contentType) {\n if (chunkBlobs.length === 1) {\n // Single chunk - simple slice\n const offset = rangeStart % chunkSize;\n const length = rangeEnd - rangeStart + 1;\n return chunkBlobs[0].slice(offset, offset + length);\n }\n\n // Multiple chunks - concatenate parts\n const parts = [];\n const firstChunkOffset = rangeStart % chunkSize;\n const lastChunkEnd = rangeEnd % chunkSize;\n\n // First chunk (partial from offset to end)\n parts.push(chunkBlobs[0].slice(firstChunkOffset));\n\n // Middle chunks (complete - use as-is)\n for (let i = 1; i < chunkBlobs.length - 1; i++) {\n parts.push(chunkBlobs[i]);\n }\n\n // Last chunk (partial from start to lastChunkEnd)\n if (chunkBlobs.length > 1) {\n parts.push(chunkBlobs[chunkBlobs.length - 1].slice(0, lastChunkEnd + 1));\n }\n\n return new Blob(parts, { type: contentType });\n}\n","/**\n * RequestHandler - Handles fetch events for cached content\n *\n * With CMS mirror routes on the proxy, the SW's role is minimal:\n * - ${PLAYER_API}/* requests pass through to Express (mirror routes serve them)\n * - Static pages pass through to network\n *\n * No URL translation needed — the proxy serves at CMS paths directly.\n * Widget HTML is served by the Express mirror route at ${PLAYER_API}/widgets/{L}/{R}/{M}.\n */\n\nimport { BASE } from './sw-utils.js';\nimport { createLogger, PLAYER_API } from '@xiboplayer/utils';\n\nexport class RequestHandler {\n /**\n * @param {Object} downloadManager - DownloadManager instance\n */\n constructor(downloadManager) {\n this.downloadManager = downloadManager;\n this.log = createLogger('SW');\n }\n\n /**\n * Handle fetch request\n */\n async handleRequest(event) {\n const url = new URL(event.request.url);\n\n // Static pages — pass through to Express\n if (url.pathname === BASE + '/' ||\n url.pathname === BASE + '/index.html' ||\n url.pathname === BASE + '/setup.html') {\n return fetch(event.request);\n }\n\n // Player API — pass through to Express mirror routes\n if (url.pathname.startsWith(PLAYER_API + '/')) {\n return fetch(event.request);\n }\n\n // Not a cache request — let browser handle\n return null;\n }\n}\n","/**\n * MessageHandler - Handles postMessage from client\n *\n * Lightweight SW message handler for lifecycle and file management.\n * Download orchestration has moved to the main thread (PwaPlayer).\n */\n\nimport { createLogger } from '@xiboplayer/utils';\n\n/** Store key = URL path without leading / and query params */\nconst storeKeyFrom = (f) => (f.path || '').split('?')[0].replace(/^\\/+/, '') || `${f.type || 'media'}/${f.id}`;\n\nexport class MessageHandler {\n /**\n * @param {Object} downloadManager - DownloadManager instance (kept for future SW-only mode)\n * @param {Object} config\n */\n constructor(downloadManager, config) {\n this.downloadManager = downloadManager;\n this.config = config;\n this.log = createLogger('SW Message');\n }\n\n /**\n * Handle message from client\n */\n async handleMessage(event) {\n const { type, data } = event.data;\n this.log.info('Received:', type);\n\n switch (type) {\n case 'PING': {\n this.log.info('PING received, broadcasting SW_READY');\n const clients = await self.clients.matchAll();\n clients.forEach(client => {\n client.postMessage({ type: 'SW_READY' });\n });\n return { success: true };\n }\n\n case 'DELETE_FILES':\n return await this.handleDeleteFiles(data.files);\n\n case 'GET_ALL_FILES':\n return await this.handleGetAllFiles();\n\n case 'CLEAR_CACHE':\n return { success: true };\n\n default:\n this.log.warn('Unknown message type:', type);\n return { success: false, error: 'Unknown message type' };\n }\n }\n\n /**\n * Handle DELETE_FILES message - purge obsolete files from ContentStore via proxy\n */\n async handleDeleteFiles(files) {\n if (!files || !Array.isArray(files)) {\n return { success: false, error: 'No files provided' };\n }\n\n try {\n const deleteFiles = files.map(f => ({\n ...f,\n key: storeKeyFrom(f),\n }));\n const resp = await fetch('/store/delete', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ files: deleteFiles }),\n });\n const result = await resp.json();\n this.log.info(`Purge complete: ${result.deleted}/${result.total} files deleted`);\n return { success: true, deleted: result.deleted, total: result.total };\n } catch (err) {\n this.log.error('Delete failed:', err.message);\n return { success: false, error: err.message };\n }\n }\n\n /**\n * Handle GET_ALL_FILES — list files from ContentStore via proxy\n */\n async handleGetAllFiles() {\n try {\n const resp = await fetch('/store/list');\n const data = await resp.json();\n return { success: true, files: data.files || [] };\n } catch (err) {\n this.log.error('Failed to list files:', err.message);\n return { success: true, files: [] };\n }\n }\n}\n","/**\n * Chunk configuration for Service Worker downloads\n */\n\nimport { createLogger } from '@xiboplayer/utils';\n\n/**\n * Calculate optimal chunk size based on available device memory.\n * Returns configuration for chunk streaming, blob caching, and download concurrency.\n *\n * @param {{ info: Function }} [log] - Optional logger (created internally if not provided)\n * @returns {{ chunkSize: number, blobCacheSize: number, threshold: number, concurrency: number }}\n */\nexport function calculateChunkConfig(log) {\n if (!log) log = createLogger('ChunkConfig');\n\n // Try to detect device memory (Chrome only for now)\n const deviceMemoryGB = (typeof navigator !== 'undefined' && navigator.deviceMemory) || null;\n\n // Fallback: estimate from user agent\n let estimatedRAM_GB = 4; // Default assumption\n\n if (deviceMemoryGB) {\n estimatedRAM_GB = deviceMemoryGB;\n log.info('Detected device memory:', deviceMemoryGB, 'GB');\n } else if (typeof navigator !== 'undefined') {\n // Parse user agent for hints\n const ua = navigator.userAgent.toLowerCase();\n if (ua.includes('raspberry pi') || ua.includes('armv6')) {\n estimatedRAM_GB = 0.5; // Pi Zero\n log.info('Detected Pi Zero (512 MB RAM estimated)');\n } else if (ua.includes('armv7')) {\n estimatedRAM_GB = 1; // Pi 3/4\n log.info('Detected ARM device (1 GB RAM estimated)');\n } else {\n log.info('Using default RAM estimate:', estimatedRAM_GB, 'GB');\n }\n }\n\n // Configure based on RAM - chunk size, cache, threshold, AND concurrency\n let chunkSize, blobCacheSize, threshold, concurrency;\n\n if (estimatedRAM_GB <= 0.5) {\n // Pi Zero (512 MB) - very conservative\n chunkSize = 10 * 1024 * 1024;\n blobCacheSize = 25;\n threshold = 25 * 1024 * 1024;\n concurrency = 1;\n log.info('Low-memory config: 10 MB chunks, 25 MB cache, 1 concurrent download');\n } else if (estimatedRAM_GB <= 1) {\n // 1 GB RAM (Pi 3) - conservative\n chunkSize = 20 * 1024 * 1024;\n blobCacheSize = 50;\n threshold = 50 * 1024 * 1024;\n concurrency = 2;\n log.info('1GB-RAM config: 20 MB chunks, 50 MB cache, 2 concurrent downloads');\n } else if (estimatedRAM_GB <= 2) {\n // 2 GB RAM - moderate\n chunkSize = 30 * 1024 * 1024;\n blobCacheSize = 100;\n threshold = 75 * 1024 * 1024;\n concurrency = 2;\n log.info('2GB-RAM config: 30 MB chunks, 100 MB cache, 2 concurrent downloads');\n } else if (estimatedRAM_GB <= 4) {\n // 4 GB RAM - default\n chunkSize = 50 * 1024 * 1024;\n blobCacheSize = 200;\n threshold = 100 * 1024 * 1024;\n concurrency = 4;\n log.info('4GB-RAM config: 50 MB chunks, 200 MB cache, 4 concurrent downloads');\n } else {\n // 8+ GB RAM - generous but heap-safe (100 MB × 4 = 400 MB peak, within 768 MB V8 heap)\n chunkSize = 100 * 1024 * 1024;\n blobCacheSize = 500;\n threshold = 200 * 1024 * 1024;\n concurrency = 4;\n log.info('High-RAM config: 100 MB chunks, 500 MB cache, 4 concurrent downloads');\n }\n\n return { chunkSize, blobCacheSize, threshold, concurrency };\n}\n"],"names":["BASE","_a","RequestHandler","downloadManager","createLogger","event","url","PLAYER_API","storeKeyFrom","f","MessageHandler","config","type","data","client","files","deleteFiles","result","err","calculateChunkConfig","log","deviceMemoryGB","estimatedRAM_GB","ua","chunkSize","blobCacheSize","threshold","concurrency"],"mappings":"mEASY,MAACA,GAAQ,IAAM,OACzB,OAAI,OAAO,KAAS,OAAeC,EAAA,KAAK,eAAL,MAAAA,EAAmB,OAC7C,IAAI,IAAI,KAAK,aAAa,KAAK,EAAE,SAAS,QAAQ,MAAO,EAAE,EAE7D,aACT,GAAC,ECAM,MAAMC,CAAe,CAI1B,YAAYC,EAAiB,CAC3B,KAAK,gBAAkBA,EACvB,KAAK,IAAMC,EAAa,IAAI,CAC9B,CAKA,MAAM,cAAcC,EAAO,CACzB,MAAMC,EAAM,IAAI,IAAID,EAAM,QAAQ,GAAG,EAUrC,OAPIC,EAAI,WAAaN,EAAO,KACxBM,EAAI,WAAaN,EAAO,eACxBM,EAAI,WAAaN,EAAO,eAKxBM,EAAI,SAAS,WAAWC,EAAa,GAAG,EACnC,MAAMF,EAAM,OAAO,EAIrB,IACT,CACF,CClCA,MAAMG,EAAgBC,IAAOA,EAAE,MAAQ,IAAI,MAAM,GAAG,EAAE,CAAC,EAAE,QAAQ,OAAQ,EAAE,GAAK,GAAGA,EAAE,MAAQ,OAAO,IAAIA,EAAE,EAAE,GAErG,MAAMC,CAAe,CAK1B,YAAYP,EAAiBQ,EAAQ,CACnC,KAAK,gBAAkBR,EACvB,KAAK,OAASQ,EACd,KAAK,IAAMP,EAAa,YAAY,CACtC,CAKA,MAAM,cAAcC,EAAO,CACzB,KAAM,CAAE,KAAAO,EAAM,KAAAC,CAAI,EAAKR,EAAM,KAG7B,OAFA,KAAK,IAAI,KAAK,YAAaO,CAAI,EAEvBA,EAAI,CACV,IAAK,OACH,YAAK,IAAI,KAAK,sCAAsC,GACpC,MAAM,KAAK,QAAQ,SAAQ,GACnC,QAAQE,GAAU,CACxBA,EAAO,YAAY,CAAE,KAAM,UAAU,CAAE,CACzC,CAAC,EACM,CAAE,QAAS,EAAI,EAGxB,IAAK,eACH,OAAO,MAAM,KAAK,kBAAkBD,EAAK,KAAK,EAEhD,IAAK,gBACH,OAAO,MAAM,KAAK,kBAAiB,EAErC,IAAK,cACH,MAAO,CAAE,QAAS,EAAI,EAExB,QACE,YAAK,IAAI,KAAK,wBAAyBD,CAAI,EACpC,CAAE,QAAS,GAAO,MAAO,sBAAsB,CAC9D,CACE,CAKA,MAAM,kBAAkBG,EAAO,CAC7B,GAAI,CAACA,GAAS,CAAC,MAAM,QAAQA,CAAK,EAChC,MAAO,CAAE,QAAS,GAAO,MAAO,mBAAmB,EAGrD,GAAI,CACF,MAAMC,EAAcD,EAAM,IAAIN,IAAM,CAClC,GAAGA,EACH,IAAKD,EAAaC,CAAC,CAC3B,EAAQ,EAMIQ,EAAS,MALF,MAAM,MAAM,gBAAiB,CACxC,OAAQ,OACR,QAAS,CAAE,eAAgB,kBAAkB,EAC7C,KAAM,KAAK,UAAU,CAAE,MAAOD,CAAW,CAAE,CACnD,CAAO,GACyB,KAAI,EAC9B,YAAK,IAAI,KAAK,mBAAmBC,EAAO,OAAO,IAAIA,EAAO,KAAK,gBAAgB,EACxE,CAAE,QAAS,GAAM,QAASA,EAAO,QAAS,MAAOA,EAAO,KAAK,CACtE,OAASC,EAAK,CACZ,YAAK,IAAI,MAAM,iBAAkBA,EAAI,OAAO,EACrC,CAAE,QAAS,GAAO,MAAOA,EAAI,OAAO,CAC7C,CACF,CAKA,MAAM,mBAAoB,CACxB,GAAI,CAGF,MAAO,CAAE,QAAS,GAAM,OADX,MADA,MAAM,MAAM,aAAa,GACd,KAAI,GACQ,OAAS,EAAE,CACjD,OAASA,EAAK,CACZ,YAAK,IAAI,MAAM,wBAAyBA,EAAI,OAAO,EAC5C,CAAE,QAAS,GAAM,MAAO,CAAA,CAAE,CACnC,CACF,CACF,CClFO,SAASC,EAAqBC,EAAK,CACnCA,IAAKA,EAAMhB,EAAa,aAAa,GAG1C,MAAMiB,EAAkB,OAAO,UAAc,KAAe,UAAU,cAAiB,KAGvF,IAAIC,EAAkB,EAEtB,GAAID,EACFC,EAAkBD,EAClBD,EAAI,KAAK,0BAA2BC,EAAgB,IAAI,UAC/C,OAAO,UAAc,IAAa,CAE3C,MAAME,EAAK,UAAU,UAAU,YAAW,EACtCA,EAAG,SAAS,cAAc,GAAKA,EAAG,SAAS,OAAO,GACpDD,EAAkB,GAClBF,EAAI,KAAK,yCAAyC,GACzCG,EAAG,SAAS,OAAO,GAC5BD,EAAkB,EAClBF,EAAI,KAAK,0CAA0C,GAEnDA,EAAI,KAAK,8BAA+BE,EAAiB,IAAI,CAEjE,CAGA,IAAIE,EAAWC,EAAeC,EAAWC,EAEzC,OAAIL,GAAmB,IAErBE,EAAY,GAAK,KAAO,KACxBC,EAAgB,GAChBC,EAAY,GAAK,KAAO,KACxBC,EAAc,EACdP,EAAI,KAAK,qEAAqE,GACrEE,GAAmB,GAE5BE,EAAY,GAAK,KAAO,KACxBC,EAAgB,GAChBC,EAAY,GAAK,KAAO,KACxBC,EAAc,EACdP,EAAI,KAAK,mEAAmE,GACnEE,GAAmB,GAE5BE,EAAY,GAAK,KAAO,KACxBC,EAAgB,IAChBC,EAAY,GAAK,KAAO,KACxBC,EAAc,EACdP,EAAI,KAAK,oEAAoE,GACpEE,GAAmB,GAE5BE,EAAY,GAAK,KAAO,KACxBC,EAAgB,IAChBC,EAAY,IAAM,KAAO,KACzBC,EAAc,EACdP,EAAI,KAAK,oEAAoE,IAG7EI,EAAY,IAAM,KAAO,KACzBC,EAAgB,IAChBC,EAAY,IAAM,KAAO,KACzBC,EAAc,EACdP,EAAI,KAAK,sEAAsE,GAG1E,CAAE,UAAAI,EAAW,cAAAC,EAAe,UAAAC,EAAW,YAAAC,CAAW,CAC3D"}
@@ -1,2 +1,2 @@
1
- import{B as i,C as t,a as c,D as l,F as g,b as d,L as p,S as C,d as E,c as h,g as F,i as R}from"./widget-html-CU4UQJdo.js";import"./index-D0tCWHJB.js";const a="0.6.7",e={version:a},o=e.version;export{i as BARRIER,t as CacheAnalyzer,c as CacheManager,l as DownloadManager,g as FILE_TYPES,d as FileDownload,p as LayoutTaskBuilder,C as StoreClient,o as VERSION,E as cacheManager,h as cacheWidgetHtml,F as getFileTypeConfig,R as isUrlExpired};
2
- //# sourceMappingURL=index-B4UaMMuB.js.map
1
+ import{B as i,C as t,a as c,D as l,F as g,b as d,L as p,S as C,d as E,c as h,g as F,i as R}from"./widget-html-Dthb_t6h.js";import"./index-BRE_VCVi.js";const a="0.6.9",e={version:a},o=e.version;export{i as BARRIER,t as CacheAnalyzer,c as CacheManager,l as DownloadManager,g as FILE_TYPES,d as FileDownload,p as LayoutTaskBuilder,C as StoreClient,o as VERSION,E as cacheManager,h as cacheWidgetHtml,F as getFileTypeConfig,R as isUrlExpired};
2
+ //# sourceMappingURL=index-6FLcQXcE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-B4UaMMuB.js","sources":["../../../cache/src/index.js"],"sourcesContent":["// @xiboplayer/cache - Offline caching and downloads\nimport pkg from '../package.json' with { type: 'json' };\nexport const VERSION = pkg.version;\nexport { CacheManager, cacheManager } from './cache.js';\nexport { StoreClient } from './store-client.js';\nexport { DownloadManager, FileDownload, LayoutTaskBuilder, BARRIER, isUrlExpired } from './download-manager.js';\nexport { CacheAnalyzer } from './cache-analyzer.js';\nexport { cacheWidgetHtml } from './widget-html.js';\nexport { FILE_TYPES, getFileTypeConfig } from './file-types.js';\n"],"names":["VERSION","pkg"],"mappings":"qLAEaA,EAAUC,EAAI"}
1
+ {"version":3,"file":"index-6FLcQXcE.js","sources":["../../../cache/src/index.js"],"sourcesContent":["// @xiboplayer/cache - Offline caching and downloads\nimport pkg from '../package.json' with { type: 'json' };\nexport const VERSION = pkg.version;\nexport { CacheManager, cacheManager } from './cache.js';\nexport { StoreClient } from './store-client.js';\nexport { DownloadManager, FileDownload, LayoutTaskBuilder, BARRIER, isUrlExpired } from './download-manager.js';\nexport { CacheAnalyzer } from './cache-analyzer.js';\nexport { cacheWidgetHtml } from './widget-html.js';\nexport { FILE_TYPES, getFileTypeConfig } from './file-types.js';\n"],"names":["VERSION","pkg"],"mappings":"qLAEaA,EAAUC,EAAI"}
@@ -1,2 +1,2 @@
1
- import{createLogger as lr}from"./index-D0tCWHJB.js";const cr="0.6.7",fr={version:cr};function Dt(n,e,t,r,s,i,a){try{var o=n[i](a),u=o.value}catch(l){return void t(l)}o.done?e(u):Promise.resolve(u).then(r,s)}function et(n){return function(){var e=this,t=arguments;return new Promise(function(r,s){var i=n.apply(e,t);function a(u){Dt(i,r,s,a,o,"next",u)}function o(u){Dt(i,r,s,a,o,"throw",u)}a(void 0)})}}function dr(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function hr(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,on(r.key),r)}}function mr(n,e,t){return e&&hr(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function _(n,e,t){return(e=on(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oe(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var n,e,t=typeof Symbol=="function"?Symbol:{},r=t.iterator||"@@iterator",s=t.toStringTag||"@@toStringTag";function i(d,S,x,L){var X=S&&S.prototype instanceof o?S:o,B=Object.create(X.prototype);return W(B,"_invoke",function(Ce,Ke,Fe){var U,b,I,G=0,K=Fe||[],Q=!1,Y={p:0,n:0,v:n,a:We,f:We.bind(n,4),d:function(A,C){return U=A,b=0,I=n,Y.n=C,a}};function We(A,C){for(b=A,I=C,e=0;!Q&&G&&!ee&&e<K.length;e++){var ee,F=K[e],Qe=Y.p,Ve=F[2];A>3?(ee=Ve===C)&&(I=F[(b=F[4])?5:(b=3,3)],F[4]=F[5]=n):F[0]<=Qe&&((ee=A<2&&Qe<F[1])?(b=0,Y.v=C,Y.n=F[1]):Qe<Ve&&(ee=A<3||F[0]>C||C>Ve)&&(F[4]=A,F[5]=C,Y.n=Ve,b=0))}if(ee||A>1)return a;throw Q=!0,C}return function(A,C,ee){if(G>1)throw TypeError("Generator is already running");for(Q&&C===1&&We(C,ee),b=C,I=ee;(e=b<2?n:I)||!Q;){U||(b?b<3?(b>1&&(Y.n=-1),We(b,I)):Y.n=I:Y.v=I);try{if(G=2,U){if(b||(A="next"),e=U[A]){if(!(e=e.call(U,I)))throw TypeError("iterator result is not an object");if(!e.done)return e;I=e.value,b<2&&(b=0)}else b===1&&(e=U.return)&&e.call(U),b<2&&(I=TypeError("The iterator does not provide a '"+A+"' method"),b=1);U=n}else if((e=(Q=Y.n<0)?I:Ce.call(Ke,Y))!==a)break}catch(F){U=n,b=1,I=F}finally{G=1}}return{value:e,done:Q}}}(d,x,L),!0),B}var a={};function o(){}function u(){}function l(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(W(e={},r,function(){return this}),e),m=l.prototype=o.prototype=Object.create(f);function w(d){return Object.setPrototypeOf?Object.setPrototypeOf(d,l):(d.__proto__=l,W(d,s,"GeneratorFunction")),d.prototype=Object.create(m),d}return u.prototype=l,W(m,"constructor",l),W(l,"constructor",u),u.displayName="GeneratorFunction",W(l,s,"GeneratorFunction"),W(m),W(m,s,"Generator"),W(m,r,function(){return this}),W(m,"toString",function(){return"[object Generator]"}),(oe=function(){return{w:i,m:w}})()}function W(n,e,t,r){var s=Object.defineProperty;try{s({},"",{})}catch{s=0}W=function(i,a,o,u){function l(f,m){W(i,f,function(w){return this._invoke(f,m,w)})}a?s?s(i,a,{value:o,enumerable:!u,configurable:!u,writable:!u}):i[a]=o:(l("next",0),l("throw",1),l("return",2))},W(n,e,t,r)}function yr(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function on(n){var e=yr(n,"string");return typeof e=="symbol"?e:e+""}var gr=function(){return{emit:function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];for(var a=this.events[t]||[],o=0,u=a.length;o<u;o++)a[o].apply(a,s)},events:{},on:function(t,r){var s,i=this;return((s=this.events)[t]||(s[t]=[])).push(r),function(){var a;i.events[t]=(a=i.events[t])===null||a===void 0?void 0:a.filter(function(o){return r!==o})}}}};class le extends Error{}class wr extends le{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class pr extends le{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class kr extends le{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class he extends le{}class un extends le{constructor(e){super(`Invalid unit ${e}`)}}class N extends le{}class te extends le{constructor(){super("Zone is an abstract class")}}const c="numeric",P="short",V="long",He={year:c,month:c,day:c},ln={year:c,month:P,day:c},vr={year:c,month:P,day:c,weekday:P},cn={year:c,month:V,day:c},fn={year:c,month:V,day:c,weekday:V},dn={hour:c,minute:c},hn={hour:c,minute:c,second:c},mn={hour:c,minute:c,second:c,timeZoneName:P},yn={hour:c,minute:c,second:c,timeZoneName:V},gn={hour:c,minute:c,hourCycle:"h23"},wn={hour:c,minute:c,second:c,hourCycle:"h23"},pn={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:P},kn={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:V},vn={year:c,month:c,day:c,hour:c,minute:c},Sn={year:c,month:c,day:c,hour:c,minute:c,second:c},Tn={year:c,month:P,day:c,hour:c,minute:c},On={year:c,month:P,day:c,hour:c,minute:c,second:c},Sr={year:c,month:P,day:c,weekday:P,hour:c,minute:c},bn={year:c,month:V,day:c,hour:c,minute:c,timeZoneName:P},Mn={year:c,month:V,day:c,hour:c,minute:c,second:c,timeZoneName:P},Nn={year:c,month:V,day:c,weekday:V,hour:c,minute:c,timeZoneName:V},En={year:c,month:V,day:c,weekday:V,hour:c,minute:c,second:c,timeZoneName:V};class Ee{get type(){throw new te}get name(){throw new te}get ianaName(){return this.name}get isUniversal(){throw new te}offsetName(e,t){throw new te}formatOffset(e,t){throw new te}offset(e){throw new te}equals(e){throw new te}get isValid(){throw new te}}let tt=null;class _e extends Ee{static get instance(){return tt===null&&(tt=new _e),tt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return Zn(e,t,r)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const ct=new Map;function Tr(n){let e=ct.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ct.set(n,e)),e}const Or={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function br(n,e){const t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,a,o,u,l,f]=r;return[a,s,i,o,u,l,f]}function Mr(n,e){const t=n.formatToParts(e),r=[];for(let s=0;s<t.length;s++){const{type:i,value:a}=t[s],o=Or[i];i==="era"?r[o]=a:g(o)||(r[o]=parseInt(a,10))}return r}const nt=new Map;class J extends Ee{static create(e){let t=nt.get(e);return t===void 0&&nt.set(e,t=new J(e)),t}static resetCache(){nt.clear(),ct.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=J.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return Zn(e,t,r,this.name)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=Tr(this.name);let[s,i,a,o,u,l,f]=r.formatToParts?Mr(r,t):br(r,t);o==="BC"&&(s=-Math.abs(s)+1);const w=Je({year:s,month:i,day:a,hour:u===24?0:u,minute:l,second:f,millisecond:0});let d=+t;const S=d%1e3;return d-=S>=0?S:1e3+S,(w-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let xt={};function Nr(n,e={}){const t=JSON.stringify([n,e]);let r=xt[t];return r||(r=new Intl.ListFormat(n,e),xt[t]=r),r}const ft=new Map;function dt(n,e={}){const t=JSON.stringify([n,e]);let r=ft.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),ft.set(t,r)),r}const ht=new Map;function Er(n,e={}){const t=JSON.stringify([n,e]);let r=ht.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),ht.set(t,r)),r}const mt=new Map;function Ir(n,e={}){const{base:t,...r}=e,s=JSON.stringify([n,r]);let i=mt.get(s);return i===void 0&&(i=new Intl.RelativeTimeFormat(n,e),mt.set(s,i)),i}let Te=null;function Dr(){return Te||(Te=new Intl.DateTimeFormat().resolvedOptions().locale,Te)}const yt=new Map;function In(n){let e=yt.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),yt.set(n,e)),e}const gt=new Map;function xr(n){let e=gt.get(n);if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Dn,...e}),gt.set(n,e)}return e}function Cr(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let r,s;try{r=dt(n).resolvedOptions(),s=n}catch{const u=n.substring(0,t);r=dt(u).resolvedOptions(),s=u}const{numberingSystem:i,calendar:a}=r;return[s,i,a]}}function Fr(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function Wr(n){const e=[];for(let t=1;t<=12;t++){const r=y.utc(2009,t,1);e.push(n(r))}return e}function Vr(n){const e=[];for(let t=1;t<=7;t++){const r=y.utc(2016,11,13+t);e.push(n(r))}return e}function Le(n,e,t,r){const s=n.listingMode();return s==="error"?null:s==="en"?t(e):r(e)}function Lr(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||In(n.locale).numberingSystem==="latn"}class Ar{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:s,floor:i,...a}=r;if(!t||Object.keys(a).length>0){const o={useGrouping:!1,...r};r.padTo>0&&(o.minimumIntegerDigits=r.padTo),this.inf=Er(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Mt(e,3);return M(t,this.padTo)}}}class $r{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&J.create(o).valid?(s=o,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||s,this.dtf=dt(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Zr{constructor(e,t,r){this.opts={style:"long",...r},!t&&An()&&(this.rtf=Ir(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):as(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Dn={firstDay:1,minimalDays:4,weekend:[6,7]};class v{static fromOpts(e){return v.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,s,i=!1){const a=e||O.defaultLocale,o=a||(i?"en-US":Dr()),u=t||O.defaultNumberingSystem,l=r||O.defaultOutputCalendar,f=pt(s)||O.defaultWeekSettings;return new v(o,u,l,f,a)}static resetCache(){Te=null,ft.clear(),ht.clear(),mt.clear(),yt.clear(),gt.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:s}={}){return v.create(e,t,r,s)}constructor(e,t,r,s,i){const[a,o,u]=Cr(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=r||u||null,this.weekSettings=s,this.intl=Fr(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Lr(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:v.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,pt(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Le(this,e,zn,()=>{const r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;const s=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const a=r?o=>this.dtFormatter(o,s).format():o=>this.extract(o,s,"month");this.monthsCache[i][e]=Wr(a)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Le(this,e,Pn,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=Vr(i=>this.extract(i,r,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return Le(this,void 0,()=>Gn,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[y.utc(2016,11,13,9),y.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Le(this,e,Yn,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[y.utc(-40,1,1),y.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){const s=this.dtFormatter(e,t),i=s.formatToParts(),a=i.find(o=>o.type.toLowerCase()===r);return a?a.value:null}numberFormatter(e={}){return new Ar(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new $r(e,this.intl,t)}relFormatter(e={}){return new Zr(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Nr(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||In(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:$n()?xr(this.locale):Dn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let rt=null;class D extends Ee{static get utcInstance(){return rt===null&&(rt=new D(0)),rt}static instance(e){return e===0?D.utcInstance:new D(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new D(Xe(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Me(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Me(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Me(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Rr extends Ee{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function re(n,e){if(g(n)||n===null)return e;if(n instanceof Ee)return n;if(Gr(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?_e.instance:t==="utc"||t==="gmt"?D.utcInstance:D.parseSpecifier(t)||J.create(n)}else return se(n)?D.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new Rr(n)}const St={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Ct={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ur=St.hanidec.replace(/[\[|\]]/g,"").split("");function zr(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);if(n[t].search(St.hanidec)!==-1)e+=Ur.indexOf(n[t]);else for(const s in Ct){const[i,a]=Ct[s];r>=i&&r<=a&&(e+=r-i)}}return parseInt(e,10)}else return e}const wt=new Map;function qr(){wt.clear()}function z({numberingSystem:n},e=""){const t=n||"latn";let r=wt.get(t);r===void 0&&(r=new Map,wt.set(t,r));let s=r.get(e);return s===void 0&&(s=new RegExp(`${St[t]}${e}`),r.set(e,s)),s}let Ft=()=>Date.now(),Wt="system",Vt=null,Lt=null,At=null,$t=60,Zt,Rt=null;class O{static get now(){return Ft}static set now(e){Ft=e}static set defaultZone(e){Wt=e}static get defaultZone(){return re(Wt,_e.instance)}static get defaultLocale(){return Vt}static set defaultLocale(e){Vt=e}static get defaultNumberingSystem(){return Lt}static set defaultNumberingSystem(e){Lt=e}static get defaultOutputCalendar(){return At}static set defaultOutputCalendar(e){At=e}static get defaultWeekSettings(){return Rt}static set defaultWeekSettings(e){Rt=pt(e)}static get twoDigitCutoffYear(){return $t}static set twoDigitCutoffYear(e){$t=e%100}static get throwOnInvalid(){return Zt}static set throwOnInvalid(e){Zt=e}static resetCaches(){v.resetCache(),J.resetCache(),y.resetCache(),qr()}}class H{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xn=[0,31,59,90,120,151,181,212,243,273,304,334],Cn=[0,31,60,91,121,152,182,213,244,274,305,335];function Z(n,e){return new H("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Tt(n,e,t){const r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const s=r.getUTCDay();return s===0?7:s}function Fn(n,e,t){return t+(Ie(n)?Cn:xn)[e-1]}function Wn(n,e){const t=Ie(n)?Cn:xn,r=t.findIndex(i=>i<e),s=e-t[r];return{month:r+1,day:s}}function Ot(n,e){return(n-e+7)%7+1}function Pe(n,e=4,t=1){const{year:r,month:s,day:i}=n,a=Fn(r,s,i),o=Ot(Tt(r,s,i),t);let u=Math.floor((a-o+14-e)/7),l;return u<1?(l=r-1,u=Ne(l,e,t)):u>Ne(r,e,t)?(l=r+1,u=1):l=r,{weekYear:l,weekNumber:u,weekday:o,...Be(n)}}function Ut(n,e=4,t=1){const{weekYear:r,weekNumber:s,weekday:i}=n,a=Ot(Tt(r,1,e),t),o=me(r);let u=s*7+i-a-7+e,l;u<1?(l=r-1,u+=me(l)):u>o?(l=r+1,u-=me(r)):l=r;const{month:f,day:m}=Wn(l,u);return{year:l,month:f,day:m,...Be(n)}}function st(n){const{year:e,month:t,day:r}=n,s=Fn(e,t,r);return{year:e,ordinal:s,...Be(n)}}function zt(n){const{year:e,ordinal:t}=n,{month:r,day:s}=Wn(e,t);return{year:e,month:r,day:s,...Be(n)}}function qt(n,e){if(!g(n.localWeekday)||!g(n.localWeekNumber)||!g(n.localWeekYear)){if(!g(n.weekday)||!g(n.weekNumber)||!g(n.weekYear))throw new he("Cannot mix locale-based week fields with ISO-based week fields");return g(n.localWeekday)||(n.weekday=n.localWeekday),g(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),g(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Hr(n,e=4,t=1){const r=je(n.weekYear),s=R(n.weekNumber,1,Ne(n.weekYear,e,t)),i=R(n.weekday,1,7);return r?s?i?!1:Z("weekday",n.weekday):Z("week",n.weekNumber):Z("weekYear",n.weekYear)}function Pr(n){const e=je(n.year),t=R(n.ordinal,1,me(n.year));return e?t?!1:Z("ordinal",n.ordinal):Z("year",n.year)}function Vn(n){const e=je(n.year),t=R(n.month,1,12),r=R(n.day,1,Ge(n.year,n.month));return e?t?r?!1:Z("day",n.day):Z("month",n.month):Z("year",n.year)}function Ln(n){const{hour:e,minute:t,second:r,millisecond:s}=n,i=R(e,0,23)||e===24&&t===0&&r===0&&s===0,a=R(t,0,59),o=R(r,0,59),u=R(s,0,999);return i?a?o?u?!1:Z("millisecond",s):Z("second",r):Z("minute",t):Z("hour",e)}function g(n){return typeof n>"u"}function se(n){return typeof n=="number"}function je(n){return typeof n=="number"&&n%1===0}function Gr(n){return typeof n=="string"}function Yr(n){return Object.prototype.toString.call(n)==="[object Date]"}function An(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function $n(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function _r(n){return Array.isArray(n)?n:[n]}function Ht(n,e,t){if(n.length!==0)return n.reduce((r,s)=>{const i=[e(s),s];return r&&t(r[0],i[0])===r[0]?r:i},null)[1]}function jr(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function ge(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function pt(n){if(n==null)return null;if(typeof n!="object")throw new N("Week settings must be an object");if(!R(n.firstDay,1,7)||!R(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!R(e,1,7)))throw new N("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function R(n,e,t){return je(n)&&n>=e&&n<=t}function Jr(n,e){return n-e*Math.floor(n/e)}function M(n,e=2){const t=n<0;let r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function ne(n){if(!(g(n)||n===null||n===""))return parseInt(n,10)}function ie(n){if(!(g(n)||n===null||n===""))return parseFloat(n)}function bt(n){if(!(g(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Mt(n,e,t="round"){const r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Ie(n){return n%4===0&&(n%100!==0||n%400===0)}function me(n){return Ie(n)?366:365}function Ge(n,e){const t=Jr(e-1,12)+1,r=n+(e-t)/12;return t===2?Ie(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Je(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Pt(n,e,t){return-Ot(Tt(n,1,e),t)+e-1}function Ne(n,e=4,t=1){const r=Pt(n,e,t),s=Pt(n+1,e,t);return(me(n)-r+s)/7}function kt(n){return n>99?n:n>O.twoDigitCutoffYear?1900+n:2e3+n}function Zn(n,e,t,r=null){const s=new Date(n),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);const a={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,a).formatToParts(s).find(u=>u.type.toLowerCase()==="timezonename");return o?o.value:null}function Xe(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const r=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-r:r;return t*60+s}function Rn(n){const e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new N(`Invalid unit value ${n}`);return e}function Ye(n,e){const t={};for(const r in n)if(ge(n,r)){const s=n[r];if(s==null)continue;t[e(r)]=Rn(s)}return t}function Me(n,e){const t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),s=n>=0?"+":"-";switch(e){case"short":return`${s}${M(t,2)}:${M(r,2)}`;case"narrow":return`${s}${t}${r>0?`:${r}`:""}`;case"techie":return`${s}${M(t,2)}${M(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Be(n){return jr(n,["hour","minute","second","millisecond"])}const Xr=["January","February","March","April","May","June","July","August","September","October","November","December"],Un=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Br=["J","F","M","A","M","J","J","A","S","O","N","D"];function zn(n){switch(n){case"narrow":return[...Br];case"short":return[...Un];case"long":return[...Xr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const qn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Hn=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Kr=["M","T","W","T","F","S","S"];function Pn(n){switch(n){case"narrow":return[...Kr];case"short":return[...Hn];case"long":return[...qn];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gn=["AM","PM"],Qr=["Before Christ","Anno Domini"],es=["BC","AD"],ts=["B","A"];function Yn(n){switch(n){case"narrow":return[...ts];case"short":return[...es];case"long":return[...Qr];default:return null}}function ns(n){return Gn[n.hour<12?0:1]}function rs(n,e){return Pn(e)[n.weekday-1]}function ss(n,e){return zn(e)[n.month-1]}function is(n,e){return Yn(e)[n.year<0?0:1]}function as(n,e,t="always",r=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&i){const m=n==="days";switch(e){case 1:return m?"tomorrow":`next ${s[n][0]}`;case-1:return m?"yesterday":`last ${s[n][0]}`;case 0:return m?"today":`this ${s[n][0]}`}}const a=Object.is(e,-0)||e<0,o=Math.abs(e),u=o===1,l=s[n],f=r?u?l[1]:l[2]||l[1]:u?s[n][0]:n;return a?`${o} ${f} ago`:`in ${o} ${f}`}function Gt(n,e){let t="";for(const r of n)r.literal?t+=r.val:t+=e(r.val);return t}const os={D:He,DD:ln,DDD:cn,DDDD:fn,t:dn,tt:hn,ttt:mn,tttt:yn,T:gn,TT:wn,TTT:pn,TTTT:kn,f:vn,ff:Tn,fff:bn,ffff:Nn,F:Sn,FF:On,FFF:Mn,FFFF:En};class E{static create(e,t={}){return new E(e,t)}static parseFormat(e){let t=null,r="",s=!1;const i=[];for(let a=0;a<e.length;a++){const o=e.charAt(a);o==="'"?((r.length>0||s)&&i.push({literal:s||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",s=!s):s||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:s||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return os[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return M(e,t);const s={...this.opts};return t>0&&(s.padTo=t),r&&(s.signDisplay=r),this.loc.numberFormatter(s).format(e)}formatDateTimeFromString(e,t){const r=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(d,S)=>this.loc.extract(e,d,S),a=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",o=()=>r?ns(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(d,S)=>r?ss(e,d):i(S?{month:d}:{month:d,day:"numeric"},"month"),l=(d,S)=>r?rs(e,d):i(S?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),f=d=>{const S=E.macroTokenToFormatOpts(d);return S?this.formatWithSystemDefault(e,S):d},m=d=>r?is(e,d):i({era:d},"era"),w=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return s?i({day:"numeric"},"day"):this.num(e.day);case"dd":return s?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return s?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return s?i({month:"numeric"},"month"):this.num(e.month);case"MM":return s?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return s?i({year:"numeric"},"year"):this.num(e.year);case"yy":return s?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(d)}};return Gt(E.parseFormat(t),w)}formatDurationFromString(e,t){const r=this.opts.signMode==="negativeLargestOnly"?-1:1,s=f=>{switch(f[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(f,m)=>w=>{const d=s(w);if(d){const S=m.isNegativeDuration&&d!==m.largestUnit?r:1;let x;return this.opts.signMode==="negativeLargestOnly"&&d!==m.largestUnit?x="never":this.opts.signMode==="all"?x="always":x="auto",this.num(f.get(d)*S,w.length,x)}else return w},a=E.parseFormat(t),o=a.reduce((f,{literal:m,val:w})=>m?f:f.concat(w),[]),u=e.shiftTo(...o.map(s).filter(f=>f)),l={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return Gt(a,i(u,l))}}const _n=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function we(...n){const e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function pe(...n){return e=>n.reduce(([t,r,s],i)=>{const[a,o,u]=i(e,s);return[{...t,...a},o||r,u]},[{},null,1]).slice(0,2)}function ke(n,...e){if(n==null)return[null,null];for(const[t,r]of e){const s=t.exec(n);if(s)return r(s)}return[null,null]}function jn(...n){return(e,t)=>{const r={};let s;for(s=0;s<n.length;s++)r[n[s]]=ne(e[t+s]);return[r,null,t+s]}}const Jn=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,us=`(?:${Jn.source}?(?:\\[(${_n.source})\\])?)?`,Nt=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Xn=RegExp(`${Nt.source}${us}`),Et=RegExp(`(?:[Tt]${Xn.source})?`),ls=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,cs=/(\d{4})-?W(\d\d)(?:-?(\d))?/,fs=/(\d{4})-?(\d{3})/,ds=jn("weekYear","weekNumber","weekDay"),hs=jn("year","ordinal"),ms=/(\d{4})-(\d\d)-(\d\d)/,Bn=RegExp(`${Nt.source} ?(?:${Jn.source}|(${_n.source}))?`),ys=RegExp(`(?: ${Bn.source})?`);function ye(n,e,t){const r=n[e];return g(r)?t:ne(r)}function gs(n,e){return[{year:ye(n,e),month:ye(n,e+1,1),day:ye(n,e+2,1)},null,e+3]}function ve(n,e){return[{hours:ye(n,e,0),minutes:ye(n,e+1,0),seconds:ye(n,e+2,0),milliseconds:bt(n[e+3])},null,e+4]}function De(n,e){const t=!n[e]&&!n[e+1],r=Xe(n[e+1],n[e+2]),s=t?null:D.instance(r);return[{},s,e+3]}function xe(n,e){const t=n[e]?J.create(n[e]):null;return[{},t,e+1]}const ws=RegExp(`^T?${Nt.source}$`),ps=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function ks(n){const[e,t,r,s,i,a,o,u,l]=n,f=e[0]==="-",m=u&&u[0]==="-",w=(d,S=!1)=>d!==void 0&&(S||d&&f)?-d:d;return[{years:w(ie(t)),months:w(ie(r)),weeks:w(ie(s)),days:w(ie(i)),hours:w(ie(a)),minutes:w(ie(o)),seconds:w(ie(u),u==="-0"),milliseconds:w(bt(l),m)}]}const vs={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function It(n,e,t,r,s,i,a){const o={year:e.length===2?kt(ne(e)):ne(e),month:Un.indexOf(t)+1,day:ne(r),hour:ne(s),minute:ne(i)};return a&&(o.second=ne(a)),n&&(o.weekday=n.length>3?qn.indexOf(n)+1:Hn.indexOf(n)+1),o}const Ss=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ts(n){const[,e,t,r,s,i,a,o,u,l,f,m]=n,w=It(e,s,r,t,i,a,o);let d;return u?d=vs[u]:l?d=0:d=Xe(f,m),[w,new D(d)]}function Os(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const bs=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Ms=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ns=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Yt(n){const[,e,t,r,s,i,a,o]=n;return[It(e,s,r,t,i,a,o),D.utcInstance]}function Es(n){const[,e,t,r,s,i,a,o]=n;return[It(e,o,t,r,s,i,a),D.utcInstance]}const Is=we(ls,Et),Ds=we(cs,Et),xs=we(fs,Et),Cs=we(Xn),Kn=pe(gs,ve,De,xe),Fs=pe(ds,ve,De,xe),Ws=pe(hs,ve,De,xe),Vs=pe(ve,De,xe);function Ls(n){return ke(n,[Is,Kn],[Ds,Fs],[xs,Ws],[Cs,Vs])}function As(n){return ke(Os(n),[Ss,Ts])}function $s(n){return ke(n,[bs,Yt],[Ms,Yt],[Ns,Es])}function Zs(n){return ke(n,[ps,ks])}const Rs=pe(ve);function Us(n){return ke(n,[ws,Rs])}const zs=we(ms,ys),qs=we(Bn),Hs=pe(ve,De,xe);function Ps(n){return ke(n,[zs,Kn],[qs,Hs])}const _t="Invalid Duration",Qn={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Gs={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Qn},$=146097/400,ce=146097/4800,Ys={years:{quarters:4,months:12,weeks:$/7,days:$,hours:$*24,minutes:$*24*60,seconds:$*24*60*60,milliseconds:$*24*60*60*1e3},quarters:{months:3,weeks:$/28,days:$/4,hours:$*24/4,minutes:$*24*60/4,seconds:$*24*60*60/4,milliseconds:$*24*60*60*1e3/4},months:{weeks:ce/7,days:ce,hours:ce*24,minutes:ce*24*60,seconds:ce*24*60*60,milliseconds:ce*24*60*60*1e3},...Qn},ue=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_s=ue.slice(0).reverse();function j(n,e,t=!1){const r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new p(r)}function er(n,e){let t=e.milliseconds??0;for(const r of _s.slice(1))e[r]&&(t+=e[r]*n[r].milliseconds);return t}function jt(n,e){const t=er(n,e)<0?-1:1;ue.reduceRight((r,s)=>{if(g(e[s]))return r;if(r){const i=e[r]*t,a=n[s][r],o=Math.floor(i/a);e[s]+=o*t,e[r]-=o*a*t}return s},null),ue.reduce((r,s)=>{if(g(e[s]))return r;if(r){const i=e[r]%1;e[r]-=i,e[s]+=i*n[r][s]}return s},null)}function Jt(n){const e={};for(const[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}class p{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let r=t?Ys:Gs;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||v.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return p.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new N(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new p({values:Ye(e,p.normalizeUnit),loc:v.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(se(e))return p.fromMillis(e);if(p.isDuration(e))return e;if(typeof e=="object")return p.fromObject(e);throw new N(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=Zs(e);return r?p.fromObject(r,t):p.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=Us(e);return r?p.fromObject(r,t):p.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new N("need to specify a reason the Duration is invalid");const r=e instanceof H?e:new H(e,t);if(O.throwOnInvalid)throw new kr(r);return new p({invalid:r})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new un(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?E.create(this.loc,r).formatDurationFromString(this,e):_t}toHuman(e={}){if(!this.isValid)return _t;const t=e.showZeros!==!1,r=ue.map(s=>{const i=this.values[s];return g(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:s.slice(0,-1)}).format(i)}).filter(s=>s);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Mt(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},y.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?er(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e),r={};for(const s of ue)(ge(t.values,s)||ge(this.values,s))&&(r[s]=t.get(s)+this.get(s));return j(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=Rn(e(this.values[r],r));return j(this,{values:t},!0)}get(e){return this[p.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Ye(e,p.normalizeUnit)};return j(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:s}={}){const a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:r};return j(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return jt(this.matrix,e),j(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Jt(this.normalize().shiftToAll().toObject());return j(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>p.normalizeUnit(a));const t={},r={},s=this.toObject();let i;for(const a of ue)if(e.indexOf(a)>=0){i=a;let o=0;for(const l in r)o+=this.matrix[l][a]*r[l],r[l]=0;se(s[a])&&(o+=s[a]);const u=Math.trunc(o);t[a]=u,r[a]=(o*1e3-u*1e3)/1e3}else se(s[a])&&(r[a]=s[a]);for(const a in r)r[a]!==0&&(t[i]+=a===i?r[a]:r[a]/this.matrix[i][a]);return jt(this.matrix,t),j(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return j(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=Jt(this.values);return j(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,s){return r===void 0||r===0?s===void 0||s===0:r===s}for(const r of ue)if(!t(this.values[r],e.values[r]))return!1;return!0}}const fe="Invalid Interval";function js(n,e){return!n||!n.isValid?T.invalid("missing or invalid start"):!e||!e.isValid?T.invalid("missing or invalid end"):e<n?T.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class T{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new N("need to specify a reason the Interval is invalid");const r=e instanceof H?e:new H(e,t);if(O.throwOnInvalid)throw new pr(r);return new T({invalid:r})}static fromDateTimes(e,t){const r=Se(e),s=Se(t),i=js(r,s);return i??new T({start:r,end:s})}static after(e,t){const r=p.fromDurationLike(t),s=Se(e);return T.fromDateTimes(s,s.plus(r))}static before(e,t){const r=p.fromDurationLike(t),s=Se(e);return T.fromDateTimes(s.minus(r),s)}static fromISO(e,t){const[r,s]=(e||"").split("/",2);if(r&&s){let i,a;try{i=y.fromISO(r,t),a=i.isValid}catch{a=!1}let o,u;try{o=y.fromISO(s,t),u=o.isValid}catch{u=!1}if(a&&u)return T.fromDateTimes(i,o);if(a){const l=p.fromISO(s,t);if(l.isValid)return T.after(i,l)}else if(u){const l=p.fromISO(r,t);if(l.isValid)return T.before(o,l)}}return T.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const r=this.start.startOf(e,t);let s;return t!=null&&t.useLocaleWeeks?s=this.end.reconfigure({locale:r.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(r,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?T.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Se).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),r=[];let{s}=this,i=0;for(;s<this.e;){const a=t[i]||this.e,o=+a>+this.e?this.e:a;r.push(T.fromDateTimes(s,o)),s=o,i+=1}return r}splitBy(e){const t=p.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,s=1,i;const a=[];for(;r<this.e;){const o=this.start.plus(t.mapUnits(u=>u*s));i=+o>+this.e?this.e:o,a.push(T.fromDateTimes(r,i)),r=i,s+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:T.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return T.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((s,i)=>s.s-i.s).reduce(([s,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[s,i.union(a)]:[s.concat([i]),a]:[s,a],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const s=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),o=a.sort((u,l)=>u.time-l.time);for(const u of o)r+=u.type==="s"?1:-1,r===1?t=u.time:(t&&+t!=+u.time&&s.push(T.fromDateTimes(t,u.time)),t=null);return T.merge(s)}difference(...e){return T.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:fe}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=He,t={}){return this.isValid?E.create(this.s.loc.clone(t),e).formatInterval(this):fe}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:fe}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:fe}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:fe}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:fe}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):p.invalid(this.invalidReason)}mapEndpoints(e){return T.fromDateTimes(e(this.s),e(this.e))}}class Ae{static hasDST(e=O.defaultZone){const t=y.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return J.isValidZone(e)}static normalizeZone(e){return re(e,O.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||v.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||v.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||v.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||v.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||v.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null}={}){return(s||v.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null}={}){return(s||v.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return v.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return v.create(t,null,"gregory").eras(e)}static features(){return{relative:An(),localeWeek:$n()}}}function Xt(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(p.fromMillis(r).as("days"))}function Js(n,e,t){const r=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{const f=Xt(u,l);return(f-f%7)/7}],["days",Xt]],s={},i=n;let a,o;for(const[u,l]of r)t.indexOf(u)>=0&&(a=u,s[u]=l(n,e),o=i.plus(s),o>e?(s[u]--,n=i.plus(s),n>e&&(o=n,s[u]--,n=i.plus(s))):n=o);return[n,s,o,a]}function Xs(n,e,t,r){let[s,i,a,o]=Js(n,e,t);const u=e-s,l=t.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);l.length===0&&(a<e&&(a=s.plus({[o]:1})),a!==s&&(i[o]=(i[o]||0)+u/(a-s)));const f=p.fromObject(i,r);return l.length>0?p.fromMillis(u,r).shiftTo(...l).plus(f):f}const Bs="missing Intl.DateTimeFormat.formatToParts support";function k(n,e=t=>t){return{regex:n,deser:([t])=>e(zr(t))}}const Ks=" ",tr=`[ ${Ks}]`,nr=new RegExp(tr,"g");function Qs(n){return n.replace(/\./g,"\\.?").replace(nr,tr)}function Bt(n){return n.replace(/\./g,"").replace(nr," ").toLowerCase()}function q(n,e){return n===null?null:{regex:RegExp(n.map(Qs).join("|")),deser:([t])=>n.findIndex(r=>Bt(t)===Bt(r))+e}}function Kt(n,e){return{regex:n,deser:([,t,r])=>Xe(t,r),groups:e}}function $e(n){return{regex:n,deser:([e])=>e}}function ei(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ti(n,e){const t=z(e),r=z(e,"{2}"),s=z(e,"{3}"),i=z(e,"{4}"),a=z(e,"{6}"),o=z(e,"{1,2}"),u=z(e,"{1,3}"),l=z(e,"{1,6}"),f=z(e,"{1,9}"),m=z(e,"{2,4}"),w=z(e,"{4,6}"),d=L=>({regex:RegExp(ei(L.val)),deser:([X])=>X,literal:!0}),x=(L=>{if(n.literal)return d(L);switch(L.val){case"G":return q(e.eras("short"),0);case"GG":return q(e.eras("long"),0);case"y":return k(l);case"yy":return k(m,kt);case"yyyy":return k(i);case"yyyyy":return k(w);case"yyyyyy":return k(a);case"M":return k(o);case"MM":return k(r);case"MMM":return q(e.months("short",!0),1);case"MMMM":return q(e.months("long",!0),1);case"L":return k(o);case"LL":return k(r);case"LLL":return q(e.months("short",!1),1);case"LLLL":return q(e.months("long",!1),1);case"d":return k(o);case"dd":return k(r);case"o":return k(u);case"ooo":return k(s);case"HH":return k(r);case"H":return k(o);case"hh":return k(r);case"h":return k(o);case"mm":return k(r);case"m":return k(o);case"q":return k(o);case"qq":return k(r);case"s":return k(o);case"ss":return k(r);case"S":return k(u);case"SSS":return k(s);case"u":return $e(f);case"uu":return $e(o);case"uuu":return k(t);case"a":return q(e.meridiems(),0);case"kkkk":return k(i);case"kk":return k(m,kt);case"W":return k(o);case"WW":return k(r);case"E":case"c":return k(t);case"EEE":return q(e.weekdays("short",!1),1);case"EEEE":return q(e.weekdays("long",!1),1);case"ccc":return q(e.weekdays("short",!0),1);case"cccc":return q(e.weekdays("long",!0),1);case"Z":case"ZZ":return Kt(new RegExp(`([+-]${o.source})(?::(${r.source}))?`),2);case"ZZZ":return Kt(new RegExp(`([+-]${o.source})(${r.source})?`),2);case"z":return $e(/[a-z_+-/]{1,256}?/i);case" ":return $e(/[^\S\n\r]/);default:return d(L)}})(n)||{invalidReason:Bs};return x.token=n,x}const ni={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function ri(n,e,t){const{type:r,value:s}=n;if(r==="literal"){const u=/^\s+$/.test(s);return{literal:!u,val:u?" ":s}}const i=e[r];let a=r;r==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=ni[a];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}function si(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function ii(n,e,t){const r=n.match(e);if(r){const s={};let i=1;for(const a in t)if(ge(t,a)){const o=t[a],u=o.groups?o.groups+1:1;!o.literal&&o.token&&(s[o.token.val[0]]=o.deser(r.slice(i,i+u))),i+=u}return[r,s]}else return[r,{}]}function ai(n){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,r;return g(n.z)||(t=J.create(n.z)),g(n.Z)||(t||(t=new D(n.Z)),r=n.Z),g(n.q)||(n.M=(n.q-1)*3+1),g(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),g(n.u)||(n.S=bt(n.u)),[Object.keys(n).reduce((i,a)=>{const o=e(a);return o&&(i[o]=n[a]),i},{}),t,r]}let it=null;function oi(){return it||(it=y.fromMillis(1555555555555)),it}function ui(n,e){if(n.literal)return n;const t=E.macroTokenToFormatOpts(n.val),r=ar(t,e);return r==null||r.includes(void 0)?n:r}function rr(n,e){return Array.prototype.concat(...n.map(t=>ui(t,e)))}class sr{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=rr(E.parseFormat(t),e),this.units=this.tokens.map(r=>ti(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){const[r,s]=si(this.units);this.regex=RegExp(r,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){const[t,r]=ii(e,this.regex,this.handlers),[s,i,a]=r?ai(r):[null,null,void 0];if(ge(r,"a")&&ge(r,"H"))throw new he("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:s,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ir(n,e,t){return new sr(n,t).explainFromTokens(e)}function li(n,e,t){const{result:r,zone:s,specificOffset:i,invalidReason:a}=ir(n,e,t);return[r,s,i,a]}function ar(n,e){if(!n)return null;const r=E.create(e,n).dtFormatter(oi()),s=r.formatToParts(),i=r.resolvedOptions();return s.map(a=>ri(a,n,i))}const at="Invalid DateTime",Qt=864e13;function Oe(n){return new H("unsupported zone",`the zone "${n.name}" is not supported`)}function ot(n){return n.weekData===null&&(n.weekData=Pe(n.c)),n.weekData}function ut(n){return n.localWeekData===null&&(n.localWeekData=Pe(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ae(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new y({...t,...e,old:t})}function or(n,e,t){let r=n-e*60*1e3;const s=t.offset(r);if(e===s)return[r,e];r-=(s-e)*60*1e3;const i=t.offset(r);return s===i?[r,s]:[n-Math.min(s,i)*60*1e3,Math.max(s,i)]}function Ze(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Ue(n,e,t){return or(Je(n),e,t)}function en(n,e){const t=n.o,r=n.c.year+Math.trunc(e.years),s=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...n.c,year:r,month:s,day:Math.min(n.c.day,Ge(r,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=p.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Je(i);let[u,l]=or(o,t,n.zone);return a!==0&&(u+=a,l=n.zone.offset(u)),{ts:u,o:l}}function de(n,e,t,r,s,i){const{setZone:a,zone:o}=t;if(n&&Object.keys(n).length!==0||e){const u=e||o,l=y.fromObject(n,{...t,zone:u,specificOffset:i});return a?l:l.setZone(o)}else return y.invalid(new H("unparsable",`the input "${s}" can't be parsed as ${r}`))}function Re(n,e,t=!0){return n.isValid?E.create(v.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function lt(n,e,t){const r=n.c.year>9999||n.c.year<0;let s="";if(r&&n.c.year>=0&&(s+="+"),s+=M(n.c.year,r?6:4),t==="year")return s;if(e){if(s+="-",s+=M(n.c.month),t==="month")return s;s+="-"}else if(s+=M(n.c.month),t==="month")return s;return s+=M(n.c.day),s}function tn(n,e,t,r,s,i,a){let o=!t||n.c.millisecond!==0||n.c.second!==0,u="";switch(a){case"day":case"month":case"year":break;default:if(u+=M(n.c.hour),a==="hour")break;if(e){if(u+=":",u+=M(n.c.minute),a==="minute")break;o&&(u+=":",u+=M(n.c.second))}else{if(u+=M(n.c.minute),a==="minute")break;o&&(u+=M(n.c.second))}if(a==="second")break;o&&(!r||n.c.millisecond!==0)&&(u+=".",u+=M(n.c.millisecond,3))}return s&&(n.isOffsetFixed&&n.offset===0&&!i?u+="Z":n.o<0?(u+="-",u+=M(Math.trunc(-n.o/60)),u+=":",u+=M(Math.trunc(-n.o%60))):(u+="+",u+=M(Math.trunc(n.o/60)),u+=":",u+=M(Math.trunc(n.o%60)))),i&&(u+="["+n.zone.ianaName+"]"),u}const ur={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ci={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},fi={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ze=["year","month","day","hour","minute","second","millisecond"],di=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],hi=["year","ordinal","hour","minute","second","millisecond"];function qe(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new un(n);return e}function nn(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return qe(n)}}function mi(n){if(be===void 0&&(be=O.now()),n.type!=="iana")return n.offset(be);const e=n.name;let t=vt.get(e);return t===void 0&&(t=n.offset(be),vt.set(e,t)),t}function rn(n,e){const t=re(e.zone,O.defaultZone);if(!t.isValid)return y.invalid(Oe(t));const r=v.fromObject(e);let s,i;if(g(n.year))s=O.now();else{for(const u of ze)g(n[u])&&(n[u]=ur[u]);const a=Vn(n)||Ln(n);if(a)return y.invalid(a);const o=mi(t);[s,i]=Ue(n,o,t)}return new y({ts:s,zone:t,loc:r,o:i})}function sn(n,e,t){const r=g(t.round)?!0:t.round,s=g(t.rounding)?"trunc":t.rounding,i=(o,u)=>(o=Mt(o,r||t.calendary?0:2,t.calendary?"round":s),e.loc.clone(t).relFormatter(t).format(o,u)),a=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return i(a(t.unit),t.unit);for(const o of t.units){const u=a(o);if(Math.abs(u)>=1)return i(u,o)}return i(n>e?-0:0,t.units[t.units.length-1])}function an(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}let be;const vt=new Map;class y{constructor(e){const t=e.zone||O.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new H("invalid input"):null)||(t.isValid?null:Oe(t));this.ts=g(e.ts)?O.now():e.ts;let s=null,i=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,i]=[e.old.c,e.old.o];else{const o=se(e.o)&&!e.old?e.o:t.offset(this.ts);s=Ze(this.ts,o),r=Number.isNaN(s.year)?new H("invalid input"):null,s=r?null:s,i=r?null:o}this._zone=t,this.loc=e.loc||v.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=s,this.o=i,this.isLuxonDateTime=!0}static now(){return new y({})}static local(){const[e,t]=an(arguments),[r,s,i,a,o,u,l]=t;return rn({year:r,month:s,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static utc(){const[e,t]=an(arguments),[r,s,i,a,o,u,l]=t;return e.zone=D.utcInstance,rn({year:r,month:s,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static fromJSDate(e,t={}){const r=Yr(e)?e.valueOf():NaN;if(Number.isNaN(r))return y.invalid("invalid input");const s=re(t.zone,O.defaultZone);return s.isValid?new y({ts:r,zone:s,loc:v.fromObject(t)}):y.invalid(Oe(s))}static fromMillis(e,t={}){if(se(e))return e<-Qt||e>Qt?y.invalid("Timestamp out of range"):new y({ts:e,zone:re(t.zone,O.defaultZone),loc:v.fromObject(t)});throw new N(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(se(e))return new y({ts:e*1e3,zone:re(t.zone,O.defaultZone),loc:v.fromObject(t)});throw new N("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=re(t.zone,O.defaultZone);if(!r.isValid)return y.invalid(Oe(r));const s=v.fromObject(t),i=Ye(e,nn),{minDaysInFirstWeek:a,startOfWeek:o}=qt(i,s),u=O.now(),l=g(t.specificOffset)?r.offset(u):t.specificOffset,f=!g(i.ordinal),m=!g(i.year),w=!g(i.month)||!g(i.day),d=m||w,S=i.weekYear||i.weekNumber;if((d||f)&&S)throw new he("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(w&&f)throw new he("Can't mix ordinal dates with month/day");const x=S||i.weekday&&!d;let L,X,B=Ze(u,l);x?(L=di,X=ci,B=Pe(B,a,o)):f?(L=hi,X=fi,B=st(B)):(L=ze,X=ur);let Ce=!1;for(const K of L){const Q=i[K];g(Q)?Ce?i[K]=X[K]:i[K]=B[K]:Ce=!0}const Ke=x?Hr(i,a,o):f?Pr(i):Vn(i),Fe=Ke||Ln(i);if(Fe)return y.invalid(Fe);const U=x?Ut(i,a,o):f?zt(i):i,[b,I]=Ue(U,l,r),G=new y({ts:b,zone:r,o:I,loc:s});return i.weekday&&d&&e.weekday!==G.weekday?y.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${G.toISO()}`):G.isValid?G:y.invalid(G.invalid)}static fromISO(e,t={}){const[r,s]=Ls(e);return de(r,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,s]=As(e);return de(r,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,s]=$s(e);return de(r,s,t,"HTTP",t)}static fromFormat(e,t,r={}){if(g(e)||g(t))throw new N("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:i=null}=r,a=v.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0}),[o,u,l,f]=li(a,e,t);return f?y.invalid(f):de(o,u,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return y.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,s]=Ps(e);return de(r,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new N("need to specify a reason the DateTime is invalid");const r=e instanceof H?e:new H(e,t);if(O.throwOnInvalid)throw new wr(r);return new y({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=ar(e,v.fromObject(t));return r?r.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return rr(E.parseFormat(e),v.fromObject(t)).map(s=>s.val).join("")}static resetCache(){be=void 0,vt.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?ot(this).weekYear:NaN}get weekNumber(){return this.isValid?ot(this).weekNumber:NaN}get weekday(){return this.isValid?ot(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ut(this).weekday:NaN}get localWeekNumber(){return this.isValid?ut(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ut(this).weekYear:NaN}get ordinal(){return this.isValid?st(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ae.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ae.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ae.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ae.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=Je(this.c),s=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-s*t),o=this.zone.offset(r-i*t);if(a===o)return[this];const u=r-a*t,l=r-o*t,f=Ze(u,a),m=Ze(l,o);return f.hour===m.hour&&f.minute===m.minute&&f.second===m.second&&f.millisecond===m.millisecond?[ae(this,{ts:u}),ae(this,{ts:l})]:[this]}get isInLeapYear(){return Ie(this.year)}get daysInMonth(){return Ge(this.year,this.month)}get daysInYear(){return this.isValid?me(this.year):NaN}get weeksInWeekYear(){return this.isValid?Ne(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Ne(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:s}=E.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(D.instance(e),t)}toLocal(){return this.setZone(O.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=re(e,O.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||r){const i=e.offset(this.ts),a=this.toObject();[s]=Ue(a,i,e)}return ae(this,{ts:s,zone:e})}else return y.invalid(Oe(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return ae(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Ye(e,nn),{minDaysInFirstWeek:r,startOfWeek:s}=qt(t,this.loc),i=!g(t.weekYear)||!g(t.weekNumber)||!g(t.weekday),a=!g(t.ordinal),o=!g(t.year),u=!g(t.month)||!g(t.day),l=o||u,f=t.weekYear||t.weekNumber;if((l||a)&&f)throw new he("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new he("Can't mix ordinal dates with month/day");let m;i?m=Ut({...Pe(this.c,r,s),...t},r,s):g(t.ordinal)?(m={...this.toObject(),...t},g(t.day)&&(m.day=Math.min(Ge(m.year,m.month),m.day))):m=zt({...st(this.c),...t});const[w,d]=Ue(m,this.o,this.zone);return ae(this,{ts:w,o:d})}plus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e);return ae(this,en(this,t))}minus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e).negate();return ae(this,en(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},s=p.normalizeUnit(e);switch(s){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(s==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(r.weekNumber=this.weekNumber-1),r.weekday=i}else r.weekday=1;if(s==="quarters"){const i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?E.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):at}toLocaleString(e=He,t={}){return this.isValid?E.create(this.loc.clone(t),e).formatDateTime(this):at}toLocaleParts(e={}){return this.isValid?E.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:s=!0,extendedZone:i=!1,precision:a="milliseconds"}={}){if(!this.isValid)return null;a=qe(a);const o=e==="extended";let u=lt(this,o,a);return ze.indexOf(a)>=3&&(u+="T"),u+=tn(this,o,t,r,s,i,a),u}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?lt(this,e==="extended",qe(t)):null}toISOWeekDate(){return Re(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:s=!1,extendedZone:i=!1,format:a="extended",precision:o="milliseconds"}={}){return this.isValid?(o=qe(o),(s&&ze.indexOf(o)>=3?"T":"")+tn(this,a==="extended",t,e,r,i,o)):null}toRFC2822(){return Re(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Re(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?lt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(r&&(s+=" "),t?s+="z":e&&(s+="ZZ")),Re(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():at}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return p.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=_r(t).map(p.normalizeUnit),a=e.valueOf()>this.valueOf(),o=a?this:e,u=a?e:this,l=Xs(o,u,i,s);return a?l.negate():l}diffNow(e="milliseconds",t={}){return this.diff(y.now(),e,t)}until(e){return this.isValid?T.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const s=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=s&&s<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||y.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),sn(t,this.plus(r),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?sn(e.base||y.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(y.isDateTime))throw new N("min requires all arguments be DateTimes");return Ht(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(y.isDateTime))throw new N("max requires all arguments be DateTimes");return Ht(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:s=null,numberingSystem:i=null}=r,a=v.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});return ir(a,e,t)}static fromStringExplain(e,t,r={}){return y.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:s=null}=t,i=v.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0});return new sr(i,e)}static fromFormatParser(e,t,r={}){if(g(e)||g(t))throw new N("fromFormatParser requires an input string and a format parser");const{locale:s=null,numberingSystem:i=null}=r,a=v.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});if(!a.equals(t.locale))throw new N(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${t.locale}`);const{result:o,zone:u,specificOffset:l,invalidReason:f}=t.explainFromTokens(e);return f?y.invalid(f):de(o,u,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return He}static get DATE_MED(){return ln}static get DATE_MED_WITH_WEEKDAY(){return vr}static get DATE_FULL(){return cn}static get DATE_HUGE(){return fn}static get TIME_SIMPLE(){return dn}static get TIME_WITH_SECONDS(){return hn}static get TIME_WITH_SHORT_OFFSET(){return mn}static get TIME_WITH_LONG_OFFSET(){return yn}static get TIME_24_SIMPLE(){return gn}static get TIME_24_WITH_SECONDS(){return wn}static get TIME_24_WITH_SHORT_OFFSET(){return pn}static get TIME_24_WITH_LONG_OFFSET(){return kn}static get DATETIME_SHORT(){return vn}static get DATETIME_SHORT_WITH_SECONDS(){return Sn}static get DATETIME_MED(){return Tn}static get DATETIME_MED_WITH_SECONDS(){return On}static get DATETIME_MED_WITH_WEEKDAY(){return Sr}static get DATETIME_FULL(){return bn}static get DATETIME_FULL_WITH_SECONDS(){return Mn}static get DATETIME_HUGE(){return Nn}static get DATETIME_HUGE_WITH_SECONDS(){return En}}function Se(n){if(y.isDateTime(n))return n;if(n&&n.valueOf&&se(n.valueOf()))return y.fromJSDate(n);if(n&&typeof n=="object")return y.fromObject(n);throw new N(`Unknown datetime argument: ${n}, of type ${typeof n}`)}var yi=function(){function n(e){dr(this,n),_(this,"emitter",void 0),_(this,"url",void 0),_(this,"cmsKey",void 0),_(this,"channel",void 0),_(this,"socket",void 0),_(this,"isConnectionWanted",void 0),_(this,"isConnected",void 0),_(this,"lastMessageAt",void 0),_(this,"interval",void 0),this.emitter=gr(),this.url=null,this.cmsKey=null,this.channel=e,this.isConnected=!1,this.isConnectionWanted=!1,this.lastMessageAt=y.now().minus({year:1})}return mr(n,[{key:"on",value:function(t,r){return this.emitter.on(t,r)}},{key:"init",value:function(){var e=et(oe().m(function r(){var s=this;return oe().w(function(i){for(;;)switch(i.n){case 0:this.interval=setInterval(function(){s.isConnectionWanted&&!s.isActive()&&(console.debug("Xmr::setInterval: should be active"),s.start(s.url||"DISABLED",s.cmsKey||"n/a"))},6e4);case 1:return i.a(2)}},r,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"start",value:function(){var e=et(oe().m(function r(s,i){var a=this,o;return oe().w(function(u){for(;;)switch(u.p=u.n){case 0:if(!(!this.channel||this.channel==="unknown")){u.n=1;break}return console.error("Xmr::start: channel unknown, XMR will be disabled"),u.a(2);case 1:if(this.url!=="DISABLED"){u.n=2;break}return console.info("Xmr::start: XMR disabled"),this.isConnectionWanted=!1,this.isActive()&&stop(),u.a(2);case 2:if(this.isConnectionWanted=!0,!(this.isActive()&&this.url===s)){u.n=3;break}return console.debug("Xmr::start: already connected to this URL"),this.cmsKey=i,u.a(2);case 3:if(!this.isConnected){u.n=5;break}return console.debug("Xmr::start: already connected but not active, or a different URL"),u.n=4,this.stop();case 4:u.n=6;break;case 5:console.debug("Xmr::start: not connected yet");case 6:this.url=s,this.cmsKey=i,console.debug("Xmr::start: connecting to "+this.url),u.p=7,this.socket=new WebSocket(this.url),u.n=9;break;case 8:return u.p=8,o=u.v,console.debug("Xmr::start: failed connecting to "+this.url+", e = "+o),this.emitter.emit("error","Failed to connect"),u.a(2);case 9:this.socket.addEventListener("open",function(l){if(console.debug("Xmr::"+l.type),a.socket.readyState!==WebSocket.OPEN){console.info("Xmr::"+l.type+": not open yet");return}a.socket.send(JSON.stringify({type:"init",key:a.cmsKey,channel:a.channel})),a.isConnected=!0,a.emitter.emit("connected")}),this.socket.addEventListener("close",function(l){console.debug("Xmr::"+l.type),a.isConnected=!1,a.emitter.emit("disconnected")}),this.socket.addEventListener("error",function(l){console.debug("Xmr::"+l.type),a.emitter.emit("error","error")}),this.socket.addEventListener("message",function(l){if(console.debug(l),a.lastMessageAt=y.now(),a.emitter.emit("statusChange",a.lastMessageAt.toISO()||""),l.data==="H")console.debug("Xmr::message: Heartbeat...");else{var f=JSON.parse(l.data);console.debug("Xmr::message: action is "+f.action);var m=y.fromISO(f.createdDt).plus({seconds:parseInt(f.ttl)});if(m<y.now())console.debug("Xmr::message: message expired at "+m.toString());else if(f.action==="collectNow")a.emitter.emit("collectNow");else if(f.action==="screenShot")a.emitter.emit("screenShot");else if(f.action==="licenceCheck")a.emitter.emit("licenceCheck");else if(f.action=="commandAction"&&f.commandCode.startsWith("showStatusWindow")){var w=f.commandCode.split("|");a.emitter.emit("showStatusWindow",parseInt(w[1])||60)}else f.action=="commandAction"&&f.commandCode.startsWith("forceUpdateChromeOS")?a.emitter.emit("forceUpdateChromeOS"):f.action=="commandAction"&&f.commandCode.startsWith("currentGeoLocation")?a.emitter.emit("currentGeoLocation"):f.action=="criteriaUpdate"?a.emitter.emit("criteriaUpdate",f.criteriaUpdates):console.error("Xmr::message: unknown action: "+f.action)}});case 10:return u.a(2)}},r,this,[[7,8]])}));function t(r,s){return e.apply(this,arguments)}return t}()},{key:"stop",value:function(){var e=et(oe().m(function r(){return oe().w(function(s){for(;;)switch(s.n){case 0:console.debug("Xmr::stop"),this.socket&&(console.debug("Xmr::stop: closing active socket"),this.socket.close(),this.isConnected=!1);case 1:return s.a(2)}},r,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"isActive",value:function(){return console.debug("Xmr::isActive: lastMessageAt: "+this.lastMessageAt.toString()),this.isConnected&&this.lastMessageAt>y.now().minus({minute:15})}}])}();const h=lr("XMR");class wi{constructor(e,t){this.config=e,this.player=t,this.xmr=null,this.connected=!1}async start(e,t){try{if(!this.xmr){h.info("Initializing connection to:",e);const r=this.config.xmrChannel||`player-${this.config.hardwareKey}`;this.xmr=new yi(r),this.setupEventHandlers(),await this.xmr.init()}return await this.xmr.start(e,t),this.connected=!0,h.info("Connected successfully"),!0}catch(r){return h.warn("Failed to start:",r.message),h.info("Framework will retry automatically every 60s"),!1}}setupEventHandlers(){this.xmr&&(this.xmr.on("connected",()=>{var e,t;h.info("WebSocket connected"),this.connected=!0,(t=(e=this.player).emit)==null||t.call(e,"xmr-status",{connected:!0})}),this.xmr.on("disconnected",()=>{var e,t;h.warn("WebSocket disconnected (framework will reconnect)"),this.connected=!1,(t=(e=this.player).emit)==null||t.call(e,"xmr-status",{connected:!1})}),this.xmr.on("error",e=>{h.error("WebSocket error:",e)}),this.xmr.on("collectNow",async()=>{h.info("Received collectNow command from CMS");try{await this.player.collect(),h.debug("collectNow completed successfully")}catch(e){h.error("collectNow failed:",e)}}),this.xmr.on("screenShot",async()=>{h.info("Received screenShot command from CMS");try{await this.player.captureScreenshot(),h.debug("screenShot completed successfully")}catch(e){h.error("screenShot failed:",e)}}),this.xmr.on("licenceCheck",()=>{h.debug("Received licenceCheck (no-op for Linux client)")}),this.xmr.on("changeLayout",async e=>{const t=typeof e=="object"&&e.layoutId||e,r=typeof e=="object"&&parseInt(e.duration)||0,s=typeof e=="object"&&e.changeMode||"replace";h.info("Received changeLayout command:",t,r?`duration=${r}s`:"",s!=="replace"?`mode=${s}`:"");try{typeof e=="object"&&e.downloadRequired===!0&&(h.info("changeLayout: downloadRequired — triggering collection first"),await this.player.collect()),await this.player.changeLayout(t,{duration:r,changeMode:s}),h.debug("changeLayout completed successfully")}catch(i){h.error("changeLayout failed:",i)}}),this.xmr.on("overlayLayout",async e=>{const t=typeof e=="object"&&e.layoutId||e,r=typeof e=="object"&&parseInt(e.duration)||0;h.info("Received overlayLayout command:",t,r?`duration=${r}s`:"");try{typeof e=="object"&&e.downloadRequired===!0&&(h.info("overlayLayout: downloadRequired — triggering collection first"),await this.player.collect()),await this.player.overlayLayout(t,{duration:r}),h.debug("overlayLayout completed successfully")}catch(s){h.error("overlayLayout failed:",s)}}),this.xmr.on("revertToSchedule",async()=>{h.info("Received revertToSchedule command");try{await this.player.revertToSchedule(),h.debug("revertToSchedule completed successfully")}catch(e){h.error("revertToSchedule failed:",e)}}),this.xmr.on("purgeAll",async()=>{h.info("Received purgeAll command");try{await this.player.purgeAll(),h.debug("purgeAll completed successfully")}catch(e){h.error("purgeAll failed:",e)}}),this.xmr.on("commandAction",async e=>{const t=(e==null?void 0:e.commandCode)||e;h.info("Received commandAction command:",t);try{const r=this.player.displayCommands||(e==null?void 0:e.commands);await this.player.executeCommand(t,r),h.debug("commandAction completed successfully")}catch(r){h.error("commandAction failed:",r)}}),this.xmr.on("triggerWebhook",async e=>{h.info("Received triggerWebhook command:",e);try{this.player.triggerWebhook((e==null?void 0:e.triggerCode)||e),h.debug("triggerWebhook completed successfully")}catch(t){h.error("triggerWebhook failed:",t)}}),this.xmr.on("dataUpdate",async()=>{h.info("Received dataUpdate command");try{this.player.refreshDataConnectors(),h.debug("dataUpdate completed successfully")}catch(e){h.error("dataUpdate failed:",e)}}),this.xmr.on("rekeyAction",async()=>{h.info("Received rekeyAction command - rotating RSA key pair");try{this.config.data.xmrPubKey="",this.config.data.xmrPrivKey="",await this.config.ensureXmrKeyPair(),await this.player.collect(),h.info("RSA key pair rotated successfully")}catch(e){h.error("Key rotation failed:",e)}}),this.xmr.on("screenshot",async()=>{h.info("Received screenshot command from CMS");try{await this.player.captureScreenshot()}catch(e){h.error("screenshot failed:",e)}}),this.xmr.on("criteriaUpdate",async e=>{h.info("Received criteriaUpdate command:",e);try{await this.player.collect(),h.debug("criteriaUpdate completed successfully")}catch(t){h.error("criteriaUpdate failed:",t)}}),this.xmr.on("currentGeoLocation",async e=>{h.info("Received currentGeoLocation command:",e);try{e&&e.latitude!=null&&e.longitude!=null?this.player.reportGeoLocation?(this.player.reportGeoLocation(e),h.debug("currentGeoLocation: coordinates applied")):h.warn("Geo location reporting not implemented in player"):this.player.requestGeoLocation?(await this.player.requestGeoLocation(),h.debug("currentGeoLocation: browser location requested")):h.warn("Geo location request not implemented in player")}catch(t){h.error("currentGeoLocation failed:",t)}}))}async stop(){if(this.xmr)try{await this.xmr.stop(),this.connected=!1,this.xmr=null,h.info("Stopped")}catch(e){h.error("Error stopping:",e)}}isConnected(){return this.connected}async send(e,t){if(!this.connected||!this.xmr)return h.warn("Cannot send - not connected"),!1;try{return await this.xmr.send(e,t),!0}catch(r){return h.error("Error sending:",r),!1}}}const pi=fr.version;export{pi as VERSION,wi as XmrWrapper};
2
- //# sourceMappingURL=index-BiE2GyDb.js.map
1
+ import{createLogger as lr}from"./index-BRE_VCVi.js";const cr="0.6.9",fr={version:cr};function Dt(n,e,t,r,s,i,a){try{var o=n[i](a),u=o.value}catch(l){return void t(l)}o.done?e(u):Promise.resolve(u).then(r,s)}function et(n){return function(){var e=this,t=arguments;return new Promise(function(r,s){var i=n.apply(e,t);function a(u){Dt(i,r,s,a,o,"next",u)}function o(u){Dt(i,r,s,a,o,"throw",u)}a(void 0)})}}function dr(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function hr(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,on(r.key),r)}}function mr(n,e,t){return e&&hr(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function _(n,e,t){return(e=on(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oe(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var n,e,t=typeof Symbol=="function"?Symbol:{},r=t.iterator||"@@iterator",s=t.toStringTag||"@@toStringTag";function i(d,S,x,L){var X=S&&S.prototype instanceof o?S:o,B=Object.create(X.prototype);return W(B,"_invoke",function(Ce,Ke,Fe){var U,b,I,G=0,K=Fe||[],Q=!1,Y={p:0,n:0,v:n,a:We,f:We.bind(n,4),d:function(A,C){return U=A,b=0,I=n,Y.n=C,a}};function We(A,C){for(b=A,I=C,e=0;!Q&&G&&!ee&&e<K.length;e++){var ee,F=K[e],Qe=Y.p,Ve=F[2];A>3?(ee=Ve===C)&&(I=F[(b=F[4])?5:(b=3,3)],F[4]=F[5]=n):F[0]<=Qe&&((ee=A<2&&Qe<F[1])?(b=0,Y.v=C,Y.n=F[1]):Qe<Ve&&(ee=A<3||F[0]>C||C>Ve)&&(F[4]=A,F[5]=C,Y.n=Ve,b=0))}if(ee||A>1)return a;throw Q=!0,C}return function(A,C,ee){if(G>1)throw TypeError("Generator is already running");for(Q&&C===1&&We(C,ee),b=C,I=ee;(e=b<2?n:I)||!Q;){U||(b?b<3?(b>1&&(Y.n=-1),We(b,I)):Y.n=I:Y.v=I);try{if(G=2,U){if(b||(A="next"),e=U[A]){if(!(e=e.call(U,I)))throw TypeError("iterator result is not an object");if(!e.done)return e;I=e.value,b<2&&(b=0)}else b===1&&(e=U.return)&&e.call(U),b<2&&(I=TypeError("The iterator does not provide a '"+A+"' method"),b=1);U=n}else if((e=(Q=Y.n<0)?I:Ce.call(Ke,Y))!==a)break}catch(F){U=n,b=1,I=F}finally{G=1}}return{value:e,done:Q}}}(d,x,L),!0),B}var a={};function o(){}function u(){}function l(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(W(e={},r,function(){return this}),e),m=l.prototype=o.prototype=Object.create(f);function w(d){return Object.setPrototypeOf?Object.setPrototypeOf(d,l):(d.__proto__=l,W(d,s,"GeneratorFunction")),d.prototype=Object.create(m),d}return u.prototype=l,W(m,"constructor",l),W(l,"constructor",u),u.displayName="GeneratorFunction",W(l,s,"GeneratorFunction"),W(m),W(m,s,"Generator"),W(m,r,function(){return this}),W(m,"toString",function(){return"[object Generator]"}),(oe=function(){return{w:i,m:w}})()}function W(n,e,t,r){var s=Object.defineProperty;try{s({},"",{})}catch{s=0}W=function(i,a,o,u){function l(f,m){W(i,f,function(w){return this._invoke(f,m,w)})}a?s?s(i,a,{value:o,enumerable:!u,configurable:!u,writable:!u}):i[a]=o:(l("next",0),l("throw",1),l("return",2))},W(n,e,t,r)}function yr(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function on(n){var e=yr(n,"string");return typeof e=="symbol"?e:e+""}var gr=function(){return{emit:function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];for(var a=this.events[t]||[],o=0,u=a.length;o<u;o++)a[o].apply(a,s)},events:{},on:function(t,r){var s,i=this;return((s=this.events)[t]||(s[t]=[])).push(r),function(){var a;i.events[t]=(a=i.events[t])===null||a===void 0?void 0:a.filter(function(o){return r!==o})}}}};class le extends Error{}class wr extends le{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class pr extends le{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class kr extends le{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class he extends le{}class un extends le{constructor(e){super(`Invalid unit ${e}`)}}class N extends le{}class te extends le{constructor(){super("Zone is an abstract class")}}const c="numeric",P="short",V="long",He={year:c,month:c,day:c},ln={year:c,month:P,day:c},vr={year:c,month:P,day:c,weekday:P},cn={year:c,month:V,day:c},fn={year:c,month:V,day:c,weekday:V},dn={hour:c,minute:c},hn={hour:c,minute:c,second:c},mn={hour:c,minute:c,second:c,timeZoneName:P},yn={hour:c,minute:c,second:c,timeZoneName:V},gn={hour:c,minute:c,hourCycle:"h23"},wn={hour:c,minute:c,second:c,hourCycle:"h23"},pn={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:P},kn={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:V},vn={year:c,month:c,day:c,hour:c,minute:c},Sn={year:c,month:c,day:c,hour:c,minute:c,second:c},Tn={year:c,month:P,day:c,hour:c,minute:c},On={year:c,month:P,day:c,hour:c,minute:c,second:c},Sr={year:c,month:P,day:c,weekday:P,hour:c,minute:c},bn={year:c,month:V,day:c,hour:c,minute:c,timeZoneName:P},Mn={year:c,month:V,day:c,hour:c,minute:c,second:c,timeZoneName:P},Nn={year:c,month:V,day:c,weekday:V,hour:c,minute:c,timeZoneName:V},En={year:c,month:V,day:c,weekday:V,hour:c,minute:c,second:c,timeZoneName:V};class Ee{get type(){throw new te}get name(){throw new te}get ianaName(){return this.name}get isUniversal(){throw new te}offsetName(e,t){throw new te}formatOffset(e,t){throw new te}offset(e){throw new te}equals(e){throw new te}get isValid(){throw new te}}let tt=null;class _e extends Ee{static get instance(){return tt===null&&(tt=new _e),tt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return Zn(e,t,r)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const ct=new Map;function Tr(n){let e=ct.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ct.set(n,e)),e}const Or={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function br(n,e){const t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,a,o,u,l,f]=r;return[a,s,i,o,u,l,f]}function Mr(n,e){const t=n.formatToParts(e),r=[];for(let s=0;s<t.length;s++){const{type:i,value:a}=t[s],o=Or[i];i==="era"?r[o]=a:g(o)||(r[o]=parseInt(a,10))}return r}const nt=new Map;class J extends Ee{static create(e){let t=nt.get(e);return t===void 0&&nt.set(e,t=new J(e)),t}static resetCache(){nt.clear(),ct.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=J.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:r}){return Zn(e,t,r,this.name)}formatOffset(e,t){return Me(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const r=Tr(this.name);let[s,i,a,o,u,l,f]=r.formatToParts?Mr(r,t):br(r,t);o==="BC"&&(s=-Math.abs(s)+1);const w=Je({year:s,month:i,day:a,hour:u===24?0:u,minute:l,second:f,millisecond:0});let d=+t;const S=d%1e3;return d-=S>=0?S:1e3+S,(w-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let xt={};function Nr(n,e={}){const t=JSON.stringify([n,e]);let r=xt[t];return r||(r=new Intl.ListFormat(n,e),xt[t]=r),r}const ft=new Map;function dt(n,e={}){const t=JSON.stringify([n,e]);let r=ft.get(t);return r===void 0&&(r=new Intl.DateTimeFormat(n,e),ft.set(t,r)),r}const ht=new Map;function Er(n,e={}){const t=JSON.stringify([n,e]);let r=ht.get(t);return r===void 0&&(r=new Intl.NumberFormat(n,e),ht.set(t,r)),r}const mt=new Map;function Ir(n,e={}){const{base:t,...r}=e,s=JSON.stringify([n,r]);let i=mt.get(s);return i===void 0&&(i=new Intl.RelativeTimeFormat(n,e),mt.set(s,i)),i}let Te=null;function Dr(){return Te||(Te=new Intl.DateTimeFormat().resolvedOptions().locale,Te)}const yt=new Map;function In(n){let e=yt.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),yt.set(n,e)),e}const gt=new Map;function xr(n){let e=gt.get(n);if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Dn,...e}),gt.set(n,e)}return e}function Cr(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let r,s;try{r=dt(n).resolvedOptions(),s=n}catch{const u=n.substring(0,t);r=dt(u).resolvedOptions(),s=u}const{numberingSystem:i,calendar:a}=r;return[s,i,a]}}function Fr(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function Wr(n){const e=[];for(let t=1;t<=12;t++){const r=y.utc(2009,t,1);e.push(n(r))}return e}function Vr(n){const e=[];for(let t=1;t<=7;t++){const r=y.utc(2016,11,13+t);e.push(n(r))}return e}function Le(n,e,t,r){const s=n.listingMode();return s==="error"?null:s==="en"?t(e):r(e)}function Lr(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||In(n.locale).numberingSystem==="latn"}class Ar{constructor(e,t,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:s,floor:i,...a}=r;if(!t||Object.keys(a).length>0){const o={useGrouping:!1,...r};r.padTo>0&&(o.minimumIntegerDigits=r.padTo),this.inf=Er(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Mt(e,3);return M(t,this.padTo)}}}class $r{constructor(e,t,r){this.opts=r,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&J.create(o).valid?(s=o,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||s,this.dtf=dt(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:r}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class Zr{constructor(e,t,r){this.opts={style:"long",...r},!t&&An()&&(this.rtf=Ir(e,r))}format(e,t){return this.rtf?this.rtf.format(e,t):as(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Dn={firstDay:1,minimalDays:4,weekend:[6,7]};class v{static fromOpts(e){return v.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,r,s,i=!1){const a=e||O.defaultLocale,o=a||(i?"en-US":Dr()),u=t||O.defaultNumberingSystem,l=r||O.defaultOutputCalendar,f=pt(s)||O.defaultWeekSettings;return new v(o,u,l,f,a)}static resetCache(){Te=null,ft.clear(),ht.clear(),mt.clear(),yt.clear(),gt.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:r,weekSettings:s}={}){return v.create(e,t,r,s)}constructor(e,t,r,s,i){const[a,o,u]=Cr(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=r||u||null,this.weekSettings=s,this.intl=Fr(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Lr(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:v.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,pt(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Le(this,e,zn,()=>{const r=this.intl==="ja"||this.intl.startsWith("ja-");t&=!r;const s=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const a=r?o=>this.dtFormatter(o,s).format():o=>this.extract(o,s,"month");this.monthsCache[i][e]=Wr(a)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return Le(this,e,Pn,()=>{const r=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=Vr(i=>this.extract(i,r,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return Le(this,void 0,()=>Gn,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[y.utc(2016,11,13,9),y.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Le(this,e,Yn,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[y.utc(-40,1,1),y.utc(2017,1,1)].map(r=>this.extract(r,t,"era"))),this.eraCache[e]})}extract(e,t,r){const s=this.dtFormatter(e,t),i=s.formatToParts(),a=i.find(o=>o.type.toLowerCase()===r);return a?a.value:null}numberFormatter(e={}){return new Ar(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new $r(e,this.intl,t)}relFormatter(e={}){return new Zr(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Nr(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||In(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:$n()?xr(this.locale):Dn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let rt=null;class D extends Ee{static get utcInstance(){return rt===null&&(rt=new D(0)),rt}static instance(e){return e===0?D.utcInstance:new D(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new D(Xe(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Me(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Me(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Me(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Rr extends Ee{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function re(n,e){if(g(n)||n===null)return e;if(n instanceof Ee)return n;if(Gr(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?_e.instance:t==="utc"||t==="gmt"?D.utcInstance:D.parseSpecifier(t)||J.create(n)}else return se(n)?D.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new Rr(n)}const St={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Ct={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ur=St.hanidec.replace(/[\[|\]]/g,"").split("");function zr(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);if(n[t].search(St.hanidec)!==-1)e+=Ur.indexOf(n[t]);else for(const s in Ct){const[i,a]=Ct[s];r>=i&&r<=a&&(e+=r-i)}}return parseInt(e,10)}else return e}const wt=new Map;function qr(){wt.clear()}function z({numberingSystem:n},e=""){const t=n||"latn";let r=wt.get(t);r===void 0&&(r=new Map,wt.set(t,r));let s=r.get(e);return s===void 0&&(s=new RegExp(`${St[t]}${e}`),r.set(e,s)),s}let Ft=()=>Date.now(),Wt="system",Vt=null,Lt=null,At=null,$t=60,Zt,Rt=null;class O{static get now(){return Ft}static set now(e){Ft=e}static set defaultZone(e){Wt=e}static get defaultZone(){return re(Wt,_e.instance)}static get defaultLocale(){return Vt}static set defaultLocale(e){Vt=e}static get defaultNumberingSystem(){return Lt}static set defaultNumberingSystem(e){Lt=e}static get defaultOutputCalendar(){return At}static set defaultOutputCalendar(e){At=e}static get defaultWeekSettings(){return Rt}static set defaultWeekSettings(e){Rt=pt(e)}static get twoDigitCutoffYear(){return $t}static set twoDigitCutoffYear(e){$t=e%100}static get throwOnInvalid(){return Zt}static set throwOnInvalid(e){Zt=e}static resetCaches(){v.resetCache(),J.resetCache(),y.resetCache(),qr()}}class H{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xn=[0,31,59,90,120,151,181,212,243,273,304,334],Cn=[0,31,60,91,121,152,182,213,244,274,305,335];function Z(n,e){return new H("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Tt(n,e,t){const r=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const s=r.getUTCDay();return s===0?7:s}function Fn(n,e,t){return t+(Ie(n)?Cn:xn)[e-1]}function Wn(n,e){const t=Ie(n)?Cn:xn,r=t.findIndex(i=>i<e),s=e-t[r];return{month:r+1,day:s}}function Ot(n,e){return(n-e+7)%7+1}function Pe(n,e=4,t=1){const{year:r,month:s,day:i}=n,a=Fn(r,s,i),o=Ot(Tt(r,s,i),t);let u=Math.floor((a-o+14-e)/7),l;return u<1?(l=r-1,u=Ne(l,e,t)):u>Ne(r,e,t)?(l=r+1,u=1):l=r,{weekYear:l,weekNumber:u,weekday:o,...Be(n)}}function Ut(n,e=4,t=1){const{weekYear:r,weekNumber:s,weekday:i}=n,a=Ot(Tt(r,1,e),t),o=me(r);let u=s*7+i-a-7+e,l;u<1?(l=r-1,u+=me(l)):u>o?(l=r+1,u-=me(r)):l=r;const{month:f,day:m}=Wn(l,u);return{year:l,month:f,day:m,...Be(n)}}function st(n){const{year:e,month:t,day:r}=n,s=Fn(e,t,r);return{year:e,ordinal:s,...Be(n)}}function zt(n){const{year:e,ordinal:t}=n,{month:r,day:s}=Wn(e,t);return{year:e,month:r,day:s,...Be(n)}}function qt(n,e){if(!g(n.localWeekday)||!g(n.localWeekNumber)||!g(n.localWeekYear)){if(!g(n.weekday)||!g(n.weekNumber)||!g(n.weekYear))throw new he("Cannot mix locale-based week fields with ISO-based week fields");return g(n.localWeekday)||(n.weekday=n.localWeekday),g(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),g(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Hr(n,e=4,t=1){const r=je(n.weekYear),s=R(n.weekNumber,1,Ne(n.weekYear,e,t)),i=R(n.weekday,1,7);return r?s?i?!1:Z("weekday",n.weekday):Z("week",n.weekNumber):Z("weekYear",n.weekYear)}function Pr(n){const e=je(n.year),t=R(n.ordinal,1,me(n.year));return e?t?!1:Z("ordinal",n.ordinal):Z("year",n.year)}function Vn(n){const e=je(n.year),t=R(n.month,1,12),r=R(n.day,1,Ge(n.year,n.month));return e?t?r?!1:Z("day",n.day):Z("month",n.month):Z("year",n.year)}function Ln(n){const{hour:e,minute:t,second:r,millisecond:s}=n,i=R(e,0,23)||e===24&&t===0&&r===0&&s===0,a=R(t,0,59),o=R(r,0,59),u=R(s,0,999);return i?a?o?u?!1:Z("millisecond",s):Z("second",r):Z("minute",t):Z("hour",e)}function g(n){return typeof n>"u"}function se(n){return typeof n=="number"}function je(n){return typeof n=="number"&&n%1===0}function Gr(n){return typeof n=="string"}function Yr(n){return Object.prototype.toString.call(n)==="[object Date]"}function An(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function $n(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function _r(n){return Array.isArray(n)?n:[n]}function Ht(n,e,t){if(n.length!==0)return n.reduce((r,s)=>{const i=[e(s),s];return r&&t(r[0],i[0])===r[0]?r:i},null)[1]}function jr(n,e){return e.reduce((t,r)=>(t[r]=n[r],t),{})}function ge(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function pt(n){if(n==null)return null;if(typeof n!="object")throw new N("Week settings must be an object");if(!R(n.firstDay,1,7)||!R(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!R(e,1,7)))throw new N("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function R(n,e,t){return je(n)&&n>=e&&n<=t}function Jr(n,e){return n-e*Math.floor(n/e)}function M(n,e=2){const t=n<0;let r;return t?r="-"+(""+-n).padStart(e,"0"):r=(""+n).padStart(e,"0"),r}function ne(n){if(!(g(n)||n===null||n===""))return parseInt(n,10)}function ie(n){if(!(g(n)||n===null||n===""))return parseFloat(n)}function bt(n){if(!(g(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Mt(n,e,t="round"){const r=10**e;switch(t){case"expand":return n>0?Math.ceil(n*r)/r:Math.floor(n*r)/r;case"trunc":return Math.trunc(n*r)/r;case"round":return Math.round(n*r)/r;case"floor":return Math.floor(n*r)/r;case"ceil":return Math.ceil(n*r)/r;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function Ie(n){return n%4===0&&(n%100!==0||n%400===0)}function me(n){return Ie(n)?366:365}function Ge(n,e){const t=Jr(e-1,12)+1,r=n+(e-t)/12;return t===2?Ie(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Je(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Pt(n,e,t){return-Ot(Tt(n,1,e),t)+e-1}function Ne(n,e=4,t=1){const r=Pt(n,e,t),s=Pt(n+1,e,t);return(me(n)-r+s)/7}function kt(n){return n>99?n:n>O.twoDigitCutoffYear?1900+n:2e3+n}function Zn(n,e,t,r=null){const s=new Date(n),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);const a={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,a).formatToParts(s).find(u=>u.type.toLowerCase()==="timezonename");return o?o.value:null}function Xe(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const r=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-r:r;return t*60+s}function Rn(n){const e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new N(`Invalid unit value ${n}`);return e}function Ye(n,e){const t={};for(const r in n)if(ge(n,r)){const s=n[r];if(s==null)continue;t[e(r)]=Rn(s)}return t}function Me(n,e){const t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),s=n>=0?"+":"-";switch(e){case"short":return`${s}${M(t,2)}:${M(r,2)}`;case"narrow":return`${s}${t}${r>0?`:${r}`:""}`;case"techie":return`${s}${M(t,2)}${M(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Be(n){return jr(n,["hour","minute","second","millisecond"])}const Xr=["January","February","March","April","May","June","July","August","September","October","November","December"],Un=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Br=["J","F","M","A","M","J","J","A","S","O","N","D"];function zn(n){switch(n){case"narrow":return[...Br];case"short":return[...Un];case"long":return[...Xr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const qn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Hn=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Kr=["M","T","W","T","F","S","S"];function Pn(n){switch(n){case"narrow":return[...Kr];case"short":return[...Hn];case"long":return[...qn];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gn=["AM","PM"],Qr=["Before Christ","Anno Domini"],es=["BC","AD"],ts=["B","A"];function Yn(n){switch(n){case"narrow":return[...ts];case"short":return[...es];case"long":return[...Qr];default:return null}}function ns(n){return Gn[n.hour<12?0:1]}function rs(n,e){return Pn(e)[n.weekday-1]}function ss(n,e){return zn(e)[n.month-1]}function is(n,e){return Yn(e)[n.year<0?0:1]}function as(n,e,t="always",r=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&i){const m=n==="days";switch(e){case 1:return m?"tomorrow":`next ${s[n][0]}`;case-1:return m?"yesterday":`last ${s[n][0]}`;case 0:return m?"today":`this ${s[n][0]}`}}const a=Object.is(e,-0)||e<0,o=Math.abs(e),u=o===1,l=s[n],f=r?u?l[1]:l[2]||l[1]:u?s[n][0]:n;return a?`${o} ${f} ago`:`in ${o} ${f}`}function Gt(n,e){let t="";for(const r of n)r.literal?t+=r.val:t+=e(r.val);return t}const os={D:He,DD:ln,DDD:cn,DDDD:fn,t:dn,tt:hn,ttt:mn,tttt:yn,T:gn,TT:wn,TTT:pn,TTTT:kn,f:vn,ff:Tn,fff:bn,ffff:Nn,F:Sn,FF:On,FFF:Mn,FFFF:En};class E{static create(e,t={}){return new E(e,t)}static parseFormat(e){let t=null,r="",s=!1;const i=[];for(let a=0;a<e.length;a++){const o=e.charAt(a);o==="'"?((r.length>0||s)&&i.push({literal:s||/^\s+$/.test(r),val:r===""?"'":r}),t=null,r="",s=!s):s||o===t?r+=o:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=o,t=o)}return r.length>0&&i.push({literal:s||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return os[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,r=void 0){if(this.opts.forceSimple)return M(e,t);const s={...this.opts};return t>0&&(s.padTo=t),r&&(s.signDisplay=r),this.loc.numberFormatter(s).format(e)}formatDateTimeFromString(e,t){const r=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(d,S)=>this.loc.extract(e,d,S),a=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",o=()=>r?ns(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(d,S)=>r?ss(e,d):i(S?{month:d}:{month:d,day:"numeric"},"month"),l=(d,S)=>r?rs(e,d):i(S?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),f=d=>{const S=E.macroTokenToFormatOpts(d);return S?this.formatWithSystemDefault(e,S):d},m=d=>r?is(e,d):i({era:d},"era"),w=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return s?i({day:"numeric"},"day"):this.num(e.day);case"dd":return s?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return s?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return s?i({month:"numeric"},"month"):this.num(e.month);case"MM":return s?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return s?i({year:"numeric"},"year"):this.num(e.year);case"yy":return s?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return m("short");case"GG":return m("long");case"GGGGG":return m("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(d)}};return Gt(E.parseFormat(t),w)}formatDurationFromString(e,t){const r=this.opts.signMode==="negativeLargestOnly"?-1:1,s=f=>{switch(f[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(f,m)=>w=>{const d=s(w);if(d){const S=m.isNegativeDuration&&d!==m.largestUnit?r:1;let x;return this.opts.signMode==="negativeLargestOnly"&&d!==m.largestUnit?x="never":this.opts.signMode==="all"?x="always":x="auto",this.num(f.get(d)*S,w.length,x)}else return w},a=E.parseFormat(t),o=a.reduce((f,{literal:m,val:w})=>m?f:f.concat(w),[]),u=e.shiftTo(...o.map(s).filter(f=>f)),l={isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]};return Gt(a,i(u,l))}}const _n=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function we(...n){const e=n.reduce((t,r)=>t+r.source,"");return RegExp(`^${e}$`)}function pe(...n){return e=>n.reduce(([t,r,s],i)=>{const[a,o,u]=i(e,s);return[{...t,...a},o||r,u]},[{},null,1]).slice(0,2)}function ke(n,...e){if(n==null)return[null,null];for(const[t,r]of e){const s=t.exec(n);if(s)return r(s)}return[null,null]}function jn(...n){return(e,t)=>{const r={};let s;for(s=0;s<n.length;s++)r[n[s]]=ne(e[t+s]);return[r,null,t+s]}}const Jn=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,us=`(?:${Jn.source}?(?:\\[(${_n.source})\\])?)?`,Nt=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Xn=RegExp(`${Nt.source}${us}`),Et=RegExp(`(?:[Tt]${Xn.source})?`),ls=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,cs=/(\d{4})-?W(\d\d)(?:-?(\d))?/,fs=/(\d{4})-?(\d{3})/,ds=jn("weekYear","weekNumber","weekDay"),hs=jn("year","ordinal"),ms=/(\d{4})-(\d\d)-(\d\d)/,Bn=RegExp(`${Nt.source} ?(?:${Jn.source}|(${_n.source}))?`),ys=RegExp(`(?: ${Bn.source})?`);function ye(n,e,t){const r=n[e];return g(r)?t:ne(r)}function gs(n,e){return[{year:ye(n,e),month:ye(n,e+1,1),day:ye(n,e+2,1)},null,e+3]}function ve(n,e){return[{hours:ye(n,e,0),minutes:ye(n,e+1,0),seconds:ye(n,e+2,0),milliseconds:bt(n[e+3])},null,e+4]}function De(n,e){const t=!n[e]&&!n[e+1],r=Xe(n[e+1],n[e+2]),s=t?null:D.instance(r);return[{},s,e+3]}function xe(n,e){const t=n[e]?J.create(n[e]):null;return[{},t,e+1]}const ws=RegExp(`^T?${Nt.source}$`),ps=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function ks(n){const[e,t,r,s,i,a,o,u,l]=n,f=e[0]==="-",m=u&&u[0]==="-",w=(d,S=!1)=>d!==void 0&&(S||d&&f)?-d:d;return[{years:w(ie(t)),months:w(ie(r)),weeks:w(ie(s)),days:w(ie(i)),hours:w(ie(a)),minutes:w(ie(o)),seconds:w(ie(u),u==="-0"),milliseconds:w(bt(l),m)}]}const vs={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function It(n,e,t,r,s,i,a){const o={year:e.length===2?kt(ne(e)):ne(e),month:Un.indexOf(t)+1,day:ne(r),hour:ne(s),minute:ne(i)};return a&&(o.second=ne(a)),n&&(o.weekday=n.length>3?qn.indexOf(n)+1:Hn.indexOf(n)+1),o}const Ss=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ts(n){const[,e,t,r,s,i,a,o,u,l,f,m]=n,w=It(e,s,r,t,i,a,o);let d;return u?d=vs[u]:l?d=0:d=Xe(f,m),[w,new D(d)]}function Os(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const bs=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Ms=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ns=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Yt(n){const[,e,t,r,s,i,a,o]=n;return[It(e,s,r,t,i,a,o),D.utcInstance]}function Es(n){const[,e,t,r,s,i,a,o]=n;return[It(e,o,t,r,s,i,a),D.utcInstance]}const Is=we(ls,Et),Ds=we(cs,Et),xs=we(fs,Et),Cs=we(Xn),Kn=pe(gs,ve,De,xe),Fs=pe(ds,ve,De,xe),Ws=pe(hs,ve,De,xe),Vs=pe(ve,De,xe);function Ls(n){return ke(n,[Is,Kn],[Ds,Fs],[xs,Ws],[Cs,Vs])}function As(n){return ke(Os(n),[Ss,Ts])}function $s(n){return ke(n,[bs,Yt],[Ms,Yt],[Ns,Es])}function Zs(n){return ke(n,[ps,ks])}const Rs=pe(ve);function Us(n){return ke(n,[ws,Rs])}const zs=we(ms,ys),qs=we(Bn),Hs=pe(ve,De,xe);function Ps(n){return ke(n,[zs,Kn],[qs,Hs])}const _t="Invalid Duration",Qn={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Gs={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Qn},$=146097/400,ce=146097/4800,Ys={years:{quarters:4,months:12,weeks:$/7,days:$,hours:$*24,minutes:$*24*60,seconds:$*24*60*60,milliseconds:$*24*60*60*1e3},quarters:{months:3,weeks:$/28,days:$/4,hours:$*24/4,minutes:$*24*60/4,seconds:$*24*60*60/4,milliseconds:$*24*60*60*1e3/4},months:{weeks:ce/7,days:ce,hours:ce*24,minutes:ce*24*60,seconds:ce*24*60*60,milliseconds:ce*24*60*60*1e3},...Qn},ue=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_s=ue.slice(0).reverse();function j(n,e,t=!1){const r={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new p(r)}function er(n,e){let t=e.milliseconds??0;for(const r of _s.slice(1))e[r]&&(t+=e[r]*n[r].milliseconds);return t}function jt(n,e){const t=er(n,e)<0?-1:1;ue.reduceRight((r,s)=>{if(g(e[s]))return r;if(r){const i=e[r]*t,a=n[s][r],o=Math.floor(i/a);e[s]+=o*t,e[r]-=o*a*t}return s},null),ue.reduce((r,s)=>{if(g(e[s]))return r;if(r){const i=e[r]%1;e[r]-=i,e[s]+=i*n[r][s]}return s},null)}function Jt(n){const e={};for(const[t,r]of Object.entries(n))r!==0&&(e[t]=r);return e}class p{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let r=t?Ys:Gs;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||v.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,t){return p.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new N(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new p({values:Ye(e,p.normalizeUnit),loc:v.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(se(e))return p.fromMillis(e);if(p.isDuration(e))return e;if(typeof e=="object")return p.fromObject(e);throw new N(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[r]=Zs(e);return r?p.fromObject(r,t):p.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[r]=Us(e);return r?p.fromObject(r,t):p.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new N("need to specify a reason the Duration is invalid");const r=e instanceof H?e:new H(e,t);if(O.throwOnInvalid)throw new kr(r);return new p({invalid:r})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new un(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const r={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?E.create(this.loc,r).formatDurationFromString(this,e):_t}toHuman(e={}){if(!this.isValid)return _t;const t=e.showZeros!==!1,r=ue.map(s=>{const i=this.values[s];return g(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:s.slice(0,-1)}).format(i)}).filter(s=>s);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Mt(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},y.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?er(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e),r={};for(const s of ue)(ge(t.values,s)||ge(this.values,s))&&(r[s]=t.get(s)+this.get(s));return j(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const r of Object.keys(this.values))t[r]=Rn(e(this.values[r],r));return j(this,{values:t},!0)}get(e){return this[p.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Ye(e,p.normalizeUnit)};return j(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:r,matrix:s}={}){const a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:r};return j(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return jt(this.matrix,e),j(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Jt(this.normalize().shiftToAll().toObject());return j(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>p.normalizeUnit(a));const t={},r={},s=this.toObject();let i;for(const a of ue)if(e.indexOf(a)>=0){i=a;let o=0;for(const l in r)o+=this.matrix[l][a]*r[l],r[l]=0;se(s[a])&&(o+=s[a]);const u=Math.trunc(o);t[a]=u,r[a]=(o*1e3-u*1e3)/1e3}else se(s[a])&&(r[a]=s[a]);for(const a in r)r[a]!==0&&(t[i]+=a===i?r[a]:r[a]/this.matrix[i][a]);return jt(this.matrix,t),j(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return j(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=Jt(this.values);return j(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(r,s){return r===void 0||r===0?s===void 0||s===0:r===s}for(const r of ue)if(!t(this.values[r],e.values[r]))return!1;return!0}}const fe="Invalid Interval";function js(n,e){return!n||!n.isValid?T.invalid("missing or invalid start"):!e||!e.isValid?T.invalid("missing or invalid end"):e<n?T.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class T{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new N("need to specify a reason the Interval is invalid");const r=e instanceof H?e:new H(e,t);if(O.throwOnInvalid)throw new pr(r);return new T({invalid:r})}static fromDateTimes(e,t){const r=Se(e),s=Se(t),i=js(r,s);return i??new T({start:r,end:s})}static after(e,t){const r=p.fromDurationLike(t),s=Se(e);return T.fromDateTimes(s,s.plus(r))}static before(e,t){const r=p.fromDurationLike(t),s=Se(e);return T.fromDateTimes(s.minus(r),s)}static fromISO(e,t){const[r,s]=(e||"").split("/",2);if(r&&s){let i,a;try{i=y.fromISO(r,t),a=i.isValid}catch{a=!1}let o,u;try{o=y.fromISO(s,t),u=o.isValid}catch{u=!1}if(a&&u)return T.fromDateTimes(i,o);if(a){const l=p.fromISO(s,t);if(l.isValid)return T.after(i,l)}else if(u){const l=p.fromISO(r,t);if(l.isValid)return T.before(o,l)}}return T.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const r=this.start.startOf(e,t);let s;return t!=null&&t.useLocaleWeeks?s=this.end.reconfigure({locale:r.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(r,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?T.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Se).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),r=[];let{s}=this,i=0;for(;s<this.e;){const a=t[i]||this.e,o=+a>+this.e?this.e:a;r.push(T.fromDateTimes(s,o)),s=o,i+=1}return r}splitBy(e){const t=p.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:r}=this,s=1,i;const a=[];for(;r<this.e;){const o=this.start.plus(t.mapUnits(u=>u*s));i=+o>+this.e?this.e:o,a.push(T.fromDateTimes(r,i)),r=i,s+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return t>=r?null:T.fromDateTimes(t,r)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return T.fromDateTimes(t,r)}static merge(e){const[t,r]=e.sort((s,i)=>s.s-i.s).reduce(([s,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[s,i.union(a)]:[s.concat([i]),a]:[s,a],[[],null]);return r&&t.push(r),t}static xor(e){let t=null,r=0;const s=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),o=a.sort((u,l)=>u.time-l.time);for(const u of o)r+=u.type==="s"?1:-1,r===1?t=u.time:(t&&+t!=+u.time&&s.push(T.fromDateTimes(t,u.time)),t=null);return T.merge(s)}difference(...e){return T.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:fe}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=He,t={}){return this.isValid?E.create(this.s.loc.clone(t),e).formatInterval(this):fe}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:fe}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:fe}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:fe}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:fe}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):p.invalid(this.invalidReason)}mapEndpoints(e){return T.fromDateTimes(e(this.s),e(this.e))}}class Ae{static hasDST(e=O.defaultZone){const t=y.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return J.isValidZone(e)}static normalizeZone(e){return re(e,O.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||v.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||v.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||v.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||v.create(t,r,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null,outputCalendar:i="gregory"}={}){return(s||v.create(t,r,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null}={}){return(s||v.create(t,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:r=null,locObj:s=null}={}){return(s||v.create(t,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return v.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return v.create(t,null,"gregory").eras(e)}static features(){return{relative:An(),localeWeek:$n()}}}function Xt(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=t(e)-t(n);return Math.floor(p.fromMillis(r).as("days"))}function Js(n,e,t){const r=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{const f=Xt(u,l);return(f-f%7)/7}],["days",Xt]],s={},i=n;let a,o;for(const[u,l]of r)t.indexOf(u)>=0&&(a=u,s[u]=l(n,e),o=i.plus(s),o>e?(s[u]--,n=i.plus(s),n>e&&(o=n,s[u]--,n=i.plus(s))):n=o);return[n,s,o,a]}function Xs(n,e,t,r){let[s,i,a,o]=Js(n,e,t);const u=e-s,l=t.filter(m=>["hours","minutes","seconds","milliseconds"].indexOf(m)>=0);l.length===0&&(a<e&&(a=s.plus({[o]:1})),a!==s&&(i[o]=(i[o]||0)+u/(a-s)));const f=p.fromObject(i,r);return l.length>0?p.fromMillis(u,r).shiftTo(...l).plus(f):f}const Bs="missing Intl.DateTimeFormat.formatToParts support";function k(n,e=t=>t){return{regex:n,deser:([t])=>e(zr(t))}}const Ks=" ",tr=`[ ${Ks}]`,nr=new RegExp(tr,"g");function Qs(n){return n.replace(/\./g,"\\.?").replace(nr,tr)}function Bt(n){return n.replace(/\./g,"").replace(nr," ").toLowerCase()}function q(n,e){return n===null?null:{regex:RegExp(n.map(Qs).join("|")),deser:([t])=>n.findIndex(r=>Bt(t)===Bt(r))+e}}function Kt(n,e){return{regex:n,deser:([,t,r])=>Xe(t,r),groups:e}}function $e(n){return{regex:n,deser:([e])=>e}}function ei(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ti(n,e){const t=z(e),r=z(e,"{2}"),s=z(e,"{3}"),i=z(e,"{4}"),a=z(e,"{6}"),o=z(e,"{1,2}"),u=z(e,"{1,3}"),l=z(e,"{1,6}"),f=z(e,"{1,9}"),m=z(e,"{2,4}"),w=z(e,"{4,6}"),d=L=>({regex:RegExp(ei(L.val)),deser:([X])=>X,literal:!0}),x=(L=>{if(n.literal)return d(L);switch(L.val){case"G":return q(e.eras("short"),0);case"GG":return q(e.eras("long"),0);case"y":return k(l);case"yy":return k(m,kt);case"yyyy":return k(i);case"yyyyy":return k(w);case"yyyyyy":return k(a);case"M":return k(o);case"MM":return k(r);case"MMM":return q(e.months("short",!0),1);case"MMMM":return q(e.months("long",!0),1);case"L":return k(o);case"LL":return k(r);case"LLL":return q(e.months("short",!1),1);case"LLLL":return q(e.months("long",!1),1);case"d":return k(o);case"dd":return k(r);case"o":return k(u);case"ooo":return k(s);case"HH":return k(r);case"H":return k(o);case"hh":return k(r);case"h":return k(o);case"mm":return k(r);case"m":return k(o);case"q":return k(o);case"qq":return k(r);case"s":return k(o);case"ss":return k(r);case"S":return k(u);case"SSS":return k(s);case"u":return $e(f);case"uu":return $e(o);case"uuu":return k(t);case"a":return q(e.meridiems(),0);case"kkkk":return k(i);case"kk":return k(m,kt);case"W":return k(o);case"WW":return k(r);case"E":case"c":return k(t);case"EEE":return q(e.weekdays("short",!1),1);case"EEEE":return q(e.weekdays("long",!1),1);case"ccc":return q(e.weekdays("short",!0),1);case"cccc":return q(e.weekdays("long",!0),1);case"Z":case"ZZ":return Kt(new RegExp(`([+-]${o.source})(?::(${r.source}))?`),2);case"ZZZ":return Kt(new RegExp(`([+-]${o.source})(${r.source})?`),2);case"z":return $e(/[a-z_+-/]{1,256}?/i);case" ":return $e(/[^\S\n\r]/);default:return d(L)}})(n)||{invalidReason:Bs};return x.token=n,x}const ni={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function ri(n,e,t){const{type:r,value:s}=n;if(r==="literal"){const u=/^\s+$/.test(s);return{literal:!u,val:u?" ":s}}const i=e[r];let a=r;r==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=ni[a];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}function si(n){return[`^${n.map(t=>t.regex).reduce((t,r)=>`${t}(${r.source})`,"")}$`,n]}function ii(n,e,t){const r=n.match(e);if(r){const s={};let i=1;for(const a in t)if(ge(t,a)){const o=t[a],u=o.groups?o.groups+1:1;!o.literal&&o.token&&(s[o.token.val[0]]=o.deser(r.slice(i,i+u))),i+=u}return[r,s]}else return[r,{}]}function ai(n){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,r;return g(n.z)||(t=J.create(n.z)),g(n.Z)||(t||(t=new D(n.Z)),r=n.Z),g(n.q)||(n.M=(n.q-1)*3+1),g(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),g(n.u)||(n.S=bt(n.u)),[Object.keys(n).reduce((i,a)=>{const o=e(a);return o&&(i[o]=n[a]),i},{}),t,r]}let it=null;function oi(){return it||(it=y.fromMillis(1555555555555)),it}function ui(n,e){if(n.literal)return n;const t=E.macroTokenToFormatOpts(n.val),r=ar(t,e);return r==null||r.includes(void 0)?n:r}function rr(n,e){return Array.prototype.concat(...n.map(t=>ui(t,e)))}class sr{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=rr(E.parseFormat(t),e),this.units=this.tokens.map(r=>ti(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){const[r,s]=si(this.units);this.regex=RegExp(r,"i"),this.handlers=s}}explainFromTokens(e){if(this.isValid){const[t,r]=ii(e,this.regex,this.handlers),[s,i,a]=r?ai(r):[null,null,void 0];if(ge(r,"a")&&ge(r,"H"))throw new he("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:r,result:s,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ir(n,e,t){return new sr(n,t).explainFromTokens(e)}function li(n,e,t){const{result:r,zone:s,specificOffset:i,invalidReason:a}=ir(n,e,t);return[r,s,i,a]}function ar(n,e){if(!n)return null;const r=E.create(e,n).dtFormatter(oi()),s=r.formatToParts(),i=r.resolvedOptions();return s.map(a=>ri(a,n,i))}const at="Invalid DateTime",Qt=864e13;function Oe(n){return new H("unsupported zone",`the zone "${n.name}" is not supported`)}function ot(n){return n.weekData===null&&(n.weekData=Pe(n.c)),n.weekData}function ut(n){return n.localWeekData===null&&(n.localWeekData=Pe(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ae(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new y({...t,...e,old:t})}function or(n,e,t){let r=n-e*60*1e3;const s=t.offset(r);if(e===s)return[r,e];r-=(s-e)*60*1e3;const i=t.offset(r);return s===i?[r,s]:[n-Math.min(s,i)*60*1e3,Math.max(s,i)]}function Ze(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Ue(n,e,t){return or(Je(n),e,t)}function en(n,e){const t=n.o,r=n.c.year+Math.trunc(e.years),s=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...n.c,year:r,month:s,day:Math.min(n.c.day,Ge(r,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=p.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Je(i);let[u,l]=or(o,t,n.zone);return a!==0&&(u+=a,l=n.zone.offset(u)),{ts:u,o:l}}function de(n,e,t,r,s,i){const{setZone:a,zone:o}=t;if(n&&Object.keys(n).length!==0||e){const u=e||o,l=y.fromObject(n,{...t,zone:u,specificOffset:i});return a?l:l.setZone(o)}else return y.invalid(new H("unparsable",`the input "${s}" can't be parsed as ${r}`))}function Re(n,e,t=!0){return n.isValid?E.create(v.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function lt(n,e,t){const r=n.c.year>9999||n.c.year<0;let s="";if(r&&n.c.year>=0&&(s+="+"),s+=M(n.c.year,r?6:4),t==="year")return s;if(e){if(s+="-",s+=M(n.c.month),t==="month")return s;s+="-"}else if(s+=M(n.c.month),t==="month")return s;return s+=M(n.c.day),s}function tn(n,e,t,r,s,i,a){let o=!t||n.c.millisecond!==0||n.c.second!==0,u="";switch(a){case"day":case"month":case"year":break;default:if(u+=M(n.c.hour),a==="hour")break;if(e){if(u+=":",u+=M(n.c.minute),a==="minute")break;o&&(u+=":",u+=M(n.c.second))}else{if(u+=M(n.c.minute),a==="minute")break;o&&(u+=M(n.c.second))}if(a==="second")break;o&&(!r||n.c.millisecond!==0)&&(u+=".",u+=M(n.c.millisecond,3))}return s&&(n.isOffsetFixed&&n.offset===0&&!i?u+="Z":n.o<0?(u+="-",u+=M(Math.trunc(-n.o/60)),u+=":",u+=M(Math.trunc(-n.o%60))):(u+="+",u+=M(Math.trunc(n.o/60)),u+=":",u+=M(Math.trunc(n.o%60)))),i&&(u+="["+n.zone.ianaName+"]"),u}const ur={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ci={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},fi={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ze=["year","month","day","hour","minute","second","millisecond"],di=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],hi=["year","ordinal","hour","minute","second","millisecond"];function qe(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new un(n);return e}function nn(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return qe(n)}}function mi(n){if(be===void 0&&(be=O.now()),n.type!=="iana")return n.offset(be);const e=n.name;let t=vt.get(e);return t===void 0&&(t=n.offset(be),vt.set(e,t)),t}function rn(n,e){const t=re(e.zone,O.defaultZone);if(!t.isValid)return y.invalid(Oe(t));const r=v.fromObject(e);let s,i;if(g(n.year))s=O.now();else{for(const u of ze)g(n[u])&&(n[u]=ur[u]);const a=Vn(n)||Ln(n);if(a)return y.invalid(a);const o=mi(t);[s,i]=Ue(n,o,t)}return new y({ts:s,zone:t,loc:r,o:i})}function sn(n,e,t){const r=g(t.round)?!0:t.round,s=g(t.rounding)?"trunc":t.rounding,i=(o,u)=>(o=Mt(o,r||t.calendary?0:2,t.calendary?"round":s),e.loc.clone(t).relFormatter(t).format(o,u)),a=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return i(a(t.unit),t.unit);for(const o of t.units){const u=a(o);if(Math.abs(u)>=1)return i(u,o)}return i(n>e?-0:0,t.units[t.units.length-1])}function an(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}let be;const vt=new Map;class y{constructor(e){const t=e.zone||O.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new H("invalid input"):null)||(t.isValid?null:Oe(t));this.ts=g(e.ts)?O.now():e.ts;let s=null,i=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,i]=[e.old.c,e.old.o];else{const o=se(e.o)&&!e.old?e.o:t.offset(this.ts);s=Ze(this.ts,o),r=Number.isNaN(s.year)?new H("invalid input"):null,s=r?null:s,i=r?null:o}this._zone=t,this.loc=e.loc||v.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=s,this.o=i,this.isLuxonDateTime=!0}static now(){return new y({})}static local(){const[e,t]=an(arguments),[r,s,i,a,o,u,l]=t;return rn({year:r,month:s,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static utc(){const[e,t]=an(arguments),[r,s,i,a,o,u,l]=t;return e.zone=D.utcInstance,rn({year:r,month:s,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static fromJSDate(e,t={}){const r=Yr(e)?e.valueOf():NaN;if(Number.isNaN(r))return y.invalid("invalid input");const s=re(t.zone,O.defaultZone);return s.isValid?new y({ts:r,zone:s,loc:v.fromObject(t)}):y.invalid(Oe(s))}static fromMillis(e,t={}){if(se(e))return e<-Qt||e>Qt?y.invalid("Timestamp out of range"):new y({ts:e,zone:re(t.zone,O.defaultZone),loc:v.fromObject(t)});throw new N(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(se(e))return new y({ts:e*1e3,zone:re(t.zone,O.defaultZone),loc:v.fromObject(t)});throw new N("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const r=re(t.zone,O.defaultZone);if(!r.isValid)return y.invalid(Oe(r));const s=v.fromObject(t),i=Ye(e,nn),{minDaysInFirstWeek:a,startOfWeek:o}=qt(i,s),u=O.now(),l=g(t.specificOffset)?r.offset(u):t.specificOffset,f=!g(i.ordinal),m=!g(i.year),w=!g(i.month)||!g(i.day),d=m||w,S=i.weekYear||i.weekNumber;if((d||f)&&S)throw new he("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(w&&f)throw new he("Can't mix ordinal dates with month/day");const x=S||i.weekday&&!d;let L,X,B=Ze(u,l);x?(L=di,X=ci,B=Pe(B,a,o)):f?(L=hi,X=fi,B=st(B)):(L=ze,X=ur);let Ce=!1;for(const K of L){const Q=i[K];g(Q)?Ce?i[K]=X[K]:i[K]=B[K]:Ce=!0}const Ke=x?Hr(i,a,o):f?Pr(i):Vn(i),Fe=Ke||Ln(i);if(Fe)return y.invalid(Fe);const U=x?Ut(i,a,o):f?zt(i):i,[b,I]=Ue(U,l,r),G=new y({ts:b,zone:r,o:I,loc:s});return i.weekday&&d&&e.weekday!==G.weekday?y.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${G.toISO()}`):G.isValid?G:y.invalid(G.invalid)}static fromISO(e,t={}){const[r,s]=Ls(e);return de(r,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[r,s]=As(e);return de(r,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[r,s]=$s(e);return de(r,s,t,"HTTP",t)}static fromFormat(e,t,r={}){if(g(e)||g(t))throw new N("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:i=null}=r,a=v.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0}),[o,u,l,f]=li(a,e,t);return f?y.invalid(f):de(o,u,r,`format ${t}`,e,l)}static fromString(e,t,r={}){return y.fromFormat(e,t,r)}static fromSQL(e,t={}){const[r,s]=Ps(e);return de(r,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new N("need to specify a reason the DateTime is invalid");const r=e instanceof H?e:new H(e,t);if(O.throwOnInvalid)throw new wr(r);return new y({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const r=ar(e,v.fromObject(t));return r?r.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return rr(E.parseFormat(e),v.fromObject(t)).map(s=>s.val).join("")}static resetCache(){be=void 0,vt.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?ot(this).weekYear:NaN}get weekNumber(){return this.isValid?ot(this).weekNumber:NaN}get weekday(){return this.isValid?ot(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ut(this).weekday:NaN}get localWeekNumber(){return this.isValid?ut(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ut(this).weekYear:NaN}get ordinal(){return this.isValid?st(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ae.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ae.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ae.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ae.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,r=Je(this.c),s=this.zone.offset(r-e),i=this.zone.offset(r+e),a=this.zone.offset(r-s*t),o=this.zone.offset(r-i*t);if(a===o)return[this];const u=r-a*t,l=r-o*t,f=Ze(u,a),m=Ze(l,o);return f.hour===m.hour&&f.minute===m.minute&&f.second===m.second&&f.millisecond===m.millisecond?[ae(this,{ts:u}),ae(this,{ts:l})]:[this]}get isInLeapYear(){return Ie(this.year)}get daysInMonth(){return Ge(this.year,this.month)}get daysInYear(){return this.isValid?me(this.year):NaN}get weeksInWeekYear(){return this.isValid?Ne(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Ne(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:r,calendar:s}=E.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:r,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(D.instance(e),t)}toLocal(){return this.setZone(O.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:r=!1}={}){if(e=re(e,O.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||r){const i=e.offset(this.ts),a=this.toObject();[s]=Ue(a,i,e)}return ae(this,{ts:s,zone:e})}else return y.invalid(Oe(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:r}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:r});return ae(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Ye(e,nn),{minDaysInFirstWeek:r,startOfWeek:s}=qt(t,this.loc),i=!g(t.weekYear)||!g(t.weekNumber)||!g(t.weekday),a=!g(t.ordinal),o=!g(t.year),u=!g(t.month)||!g(t.day),l=o||u,f=t.weekYear||t.weekNumber;if((l||a)&&f)throw new he("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new he("Can't mix ordinal dates with month/day");let m;i?m=Ut({...Pe(this.c,r,s),...t},r,s):g(t.ordinal)?(m={...this.toObject(),...t},g(t.day)&&(m.day=Math.min(Ge(m.year,m.month),m.day))):m=zt({...st(this.c),...t});const[w,d]=Ue(m,this.o,this.zone);return ae(this,{ts:w,o:d})}plus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e);return ae(this,en(this,t))}minus(e){if(!this.isValid)return this;const t=p.fromDurationLike(e).negate();return ae(this,en(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const r={},s=p.normalizeUnit(e);switch(s){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(s==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(r.weekNumber=this.weekNumber-1),r.weekday=i}else r.weekday=1;if(s==="quarters"){const i=Math.ceil(this.month/3);r.month=(i-1)*3+1}return this.set(r)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?E.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):at}toLocaleString(e=He,t={}){return this.isValid?E.create(this.loc.clone(t),e).formatDateTime(this):at}toLocaleParts(e={}){return this.isValid?E.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:r=!1,includeOffset:s=!0,extendedZone:i=!1,precision:a="milliseconds"}={}){if(!this.isValid)return null;a=qe(a);const o=e==="extended";let u=lt(this,o,a);return ze.indexOf(a)>=3&&(u+="T"),u+=tn(this,o,t,r,s,i,a),u}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?lt(this,e==="extended",qe(t)):null}toISOWeekDate(){return Re(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:r=!0,includePrefix:s=!1,extendedZone:i=!1,format:a="extended",precision:o="milliseconds"}={}){return this.isValid?(o=qe(o),(s&&ze.indexOf(o)>=3?"T":"")+tn(this,a==="extended",t,e,r,i,o)):null}toRFC2822(){return Re(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Re(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?lt(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:r=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(r&&(s+=" "),t?s+="z":e&&(s+="ZZ")),Re(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():at}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",r={}){if(!this.isValid||!e.isValid)return p.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...r},i=_r(t).map(p.normalizeUnit),a=e.valueOf()>this.valueOf(),o=a?this:e,u=a?e:this,l=Xs(o,u,i,s);return a?l.negate():l}diffNow(e="milliseconds",t={}){return this.diff(y.now(),e,t)}until(e){return this.isValid?T.fromDateTimes(this,e):this}hasSame(e,t,r){if(!this.isValid)return!1;const s=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,r)<=s&&s<=i.endOf(t,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||y.fromObject({},{zone:this.zone}),r=e.padding?this<t?-e.padding:e.padding:0;let s=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(s=e.unit,i=void 0),sn(t,this.plus(r),{...e,numeric:"always",units:s,unit:i})}toRelativeCalendar(e={}){return this.isValid?sn(e.base||y.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(y.isDateTime))throw new N("min requires all arguments be DateTimes");return Ht(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(y.isDateTime))throw new N("max requires all arguments be DateTimes");return Ht(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,r={}){const{locale:s=null,numberingSystem:i=null}=r,a=v.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});return ir(a,e,t)}static fromStringExplain(e,t,r={}){return y.fromFormatExplain(e,t,r)}static buildFormatParser(e,t={}){const{locale:r=null,numberingSystem:s=null}=t,i=v.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0});return new sr(i,e)}static fromFormatParser(e,t,r={}){if(g(e)||g(t))throw new N("fromFormatParser requires an input string and a format parser");const{locale:s=null,numberingSystem:i=null}=r,a=v.fromOpts({locale:s,numberingSystem:i,defaultToEN:!0});if(!a.equals(t.locale))throw new N(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${t.locale}`);const{result:o,zone:u,specificOffset:l,invalidReason:f}=t.explainFromTokens(e);return f?y.invalid(f):de(o,u,r,`format ${t.format}`,e,l)}static get DATE_SHORT(){return He}static get DATE_MED(){return ln}static get DATE_MED_WITH_WEEKDAY(){return vr}static get DATE_FULL(){return cn}static get DATE_HUGE(){return fn}static get TIME_SIMPLE(){return dn}static get TIME_WITH_SECONDS(){return hn}static get TIME_WITH_SHORT_OFFSET(){return mn}static get TIME_WITH_LONG_OFFSET(){return yn}static get TIME_24_SIMPLE(){return gn}static get TIME_24_WITH_SECONDS(){return wn}static get TIME_24_WITH_SHORT_OFFSET(){return pn}static get TIME_24_WITH_LONG_OFFSET(){return kn}static get DATETIME_SHORT(){return vn}static get DATETIME_SHORT_WITH_SECONDS(){return Sn}static get DATETIME_MED(){return Tn}static get DATETIME_MED_WITH_SECONDS(){return On}static get DATETIME_MED_WITH_WEEKDAY(){return Sr}static get DATETIME_FULL(){return bn}static get DATETIME_FULL_WITH_SECONDS(){return Mn}static get DATETIME_HUGE(){return Nn}static get DATETIME_HUGE_WITH_SECONDS(){return En}}function Se(n){if(y.isDateTime(n))return n;if(n&&n.valueOf&&se(n.valueOf()))return y.fromJSDate(n);if(n&&typeof n=="object")return y.fromObject(n);throw new N(`Unknown datetime argument: ${n}, of type ${typeof n}`)}var yi=function(){function n(e){dr(this,n),_(this,"emitter",void 0),_(this,"url",void 0),_(this,"cmsKey",void 0),_(this,"channel",void 0),_(this,"socket",void 0),_(this,"isConnectionWanted",void 0),_(this,"isConnected",void 0),_(this,"lastMessageAt",void 0),_(this,"interval",void 0),this.emitter=gr(),this.url=null,this.cmsKey=null,this.channel=e,this.isConnected=!1,this.isConnectionWanted=!1,this.lastMessageAt=y.now().minus({year:1})}return mr(n,[{key:"on",value:function(t,r){return this.emitter.on(t,r)}},{key:"init",value:function(){var e=et(oe().m(function r(){var s=this;return oe().w(function(i){for(;;)switch(i.n){case 0:this.interval=setInterval(function(){s.isConnectionWanted&&!s.isActive()&&(console.debug("Xmr::setInterval: should be active"),s.start(s.url||"DISABLED",s.cmsKey||"n/a"))},6e4);case 1:return i.a(2)}},r,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"start",value:function(){var e=et(oe().m(function r(s,i){var a=this,o;return oe().w(function(u){for(;;)switch(u.p=u.n){case 0:if(!(!this.channel||this.channel==="unknown")){u.n=1;break}return console.error("Xmr::start: channel unknown, XMR will be disabled"),u.a(2);case 1:if(this.url!=="DISABLED"){u.n=2;break}return console.info("Xmr::start: XMR disabled"),this.isConnectionWanted=!1,this.isActive()&&stop(),u.a(2);case 2:if(this.isConnectionWanted=!0,!(this.isActive()&&this.url===s)){u.n=3;break}return console.debug("Xmr::start: already connected to this URL"),this.cmsKey=i,u.a(2);case 3:if(!this.isConnected){u.n=5;break}return console.debug("Xmr::start: already connected but not active, or a different URL"),u.n=4,this.stop();case 4:u.n=6;break;case 5:console.debug("Xmr::start: not connected yet");case 6:this.url=s,this.cmsKey=i,console.debug("Xmr::start: connecting to "+this.url),u.p=7,this.socket=new WebSocket(this.url),u.n=9;break;case 8:return u.p=8,o=u.v,console.debug("Xmr::start: failed connecting to "+this.url+", e = "+o),this.emitter.emit("error","Failed to connect"),u.a(2);case 9:this.socket.addEventListener("open",function(l){if(console.debug("Xmr::"+l.type),a.socket.readyState!==WebSocket.OPEN){console.info("Xmr::"+l.type+": not open yet");return}a.socket.send(JSON.stringify({type:"init",key:a.cmsKey,channel:a.channel})),a.isConnected=!0,a.emitter.emit("connected")}),this.socket.addEventListener("close",function(l){console.debug("Xmr::"+l.type),a.isConnected=!1,a.emitter.emit("disconnected")}),this.socket.addEventListener("error",function(l){console.debug("Xmr::"+l.type),a.emitter.emit("error","error")}),this.socket.addEventListener("message",function(l){if(console.debug(l),a.lastMessageAt=y.now(),a.emitter.emit("statusChange",a.lastMessageAt.toISO()||""),l.data==="H")console.debug("Xmr::message: Heartbeat...");else{var f=JSON.parse(l.data);console.debug("Xmr::message: action is "+f.action);var m=y.fromISO(f.createdDt).plus({seconds:parseInt(f.ttl)});if(m<y.now())console.debug("Xmr::message: message expired at "+m.toString());else if(f.action==="collectNow")a.emitter.emit("collectNow");else if(f.action==="screenShot")a.emitter.emit("screenShot");else if(f.action==="licenceCheck")a.emitter.emit("licenceCheck");else if(f.action=="commandAction"&&f.commandCode.startsWith("showStatusWindow")){var w=f.commandCode.split("|");a.emitter.emit("showStatusWindow",parseInt(w[1])||60)}else f.action=="commandAction"&&f.commandCode.startsWith("forceUpdateChromeOS")?a.emitter.emit("forceUpdateChromeOS"):f.action=="commandAction"&&f.commandCode.startsWith("currentGeoLocation")?a.emitter.emit("currentGeoLocation"):f.action=="criteriaUpdate"?a.emitter.emit("criteriaUpdate",f.criteriaUpdates):console.error("Xmr::message: unknown action: "+f.action)}});case 10:return u.a(2)}},r,this,[[7,8]])}));function t(r,s){return e.apply(this,arguments)}return t}()},{key:"stop",value:function(){var e=et(oe().m(function r(){return oe().w(function(s){for(;;)switch(s.n){case 0:console.debug("Xmr::stop"),this.socket&&(console.debug("Xmr::stop: closing active socket"),this.socket.close(),this.isConnected=!1);case 1:return s.a(2)}},r,this)}));function t(){return e.apply(this,arguments)}return t}()},{key:"isActive",value:function(){return console.debug("Xmr::isActive: lastMessageAt: "+this.lastMessageAt.toString()),this.isConnected&&this.lastMessageAt>y.now().minus({minute:15})}}])}();const h=lr("XMR");class wi{constructor(e,t){this.config=e,this.player=t,this.xmr=null,this.connected=!1}async start(e,t){try{if(!this.xmr){h.info("Initializing connection to:",e);const r=this.config.xmrChannel||`player-${this.config.hardwareKey}`;this.xmr=new yi(r),this.setupEventHandlers(),await this.xmr.init()}return await this.xmr.start(e,t),this.connected=!0,h.info("Connected successfully"),!0}catch(r){return h.warn("Failed to start:",r.message),h.info("Framework will retry automatically every 60s"),!1}}setupEventHandlers(){this.xmr&&(this.xmr.on("connected",()=>{var e,t;h.info("WebSocket connected"),this.connected=!0,(t=(e=this.player).emit)==null||t.call(e,"xmr-status",{connected:!0})}),this.xmr.on("disconnected",()=>{var e,t;h.warn("WebSocket disconnected (framework will reconnect)"),this.connected=!1,(t=(e=this.player).emit)==null||t.call(e,"xmr-status",{connected:!1})}),this.xmr.on("error",e=>{h.error("WebSocket error:",e)}),this.xmr.on("collectNow",async()=>{h.info("Received collectNow command from CMS");try{await this.player.collect(),h.debug("collectNow completed successfully")}catch(e){h.error("collectNow failed:",e)}}),this.xmr.on("screenShot",async()=>{h.info("Received screenShot command from CMS");try{await this.player.captureScreenshot(),h.debug("screenShot completed successfully")}catch(e){h.error("screenShot failed:",e)}}),this.xmr.on("licenceCheck",()=>{h.debug("Received licenceCheck (no-op for Linux client)")}),this.xmr.on("changeLayout",async e=>{const t=typeof e=="object"&&e.layoutId||e,r=typeof e=="object"&&parseInt(e.duration)||0,s=typeof e=="object"&&e.changeMode||"replace";h.info("Received changeLayout command:",t,r?`duration=${r}s`:"",s!=="replace"?`mode=${s}`:"");try{typeof e=="object"&&e.downloadRequired===!0&&(h.info("changeLayout: downloadRequired — triggering collection first"),await this.player.collect()),await this.player.changeLayout(t,{duration:r,changeMode:s}),h.debug("changeLayout completed successfully")}catch(i){h.error("changeLayout failed:",i)}}),this.xmr.on("overlayLayout",async e=>{const t=typeof e=="object"&&e.layoutId||e,r=typeof e=="object"&&parseInt(e.duration)||0;h.info("Received overlayLayout command:",t,r?`duration=${r}s`:"");try{typeof e=="object"&&e.downloadRequired===!0&&(h.info("overlayLayout: downloadRequired — triggering collection first"),await this.player.collect()),await this.player.overlayLayout(t,{duration:r}),h.debug("overlayLayout completed successfully")}catch(s){h.error("overlayLayout failed:",s)}}),this.xmr.on("revertToSchedule",async()=>{h.info("Received revertToSchedule command");try{await this.player.revertToSchedule(),h.debug("revertToSchedule completed successfully")}catch(e){h.error("revertToSchedule failed:",e)}}),this.xmr.on("purgeAll",async()=>{h.info("Received purgeAll command");try{await this.player.purgeAll(),h.debug("purgeAll completed successfully")}catch(e){h.error("purgeAll failed:",e)}}),this.xmr.on("commandAction",async e=>{const t=(e==null?void 0:e.commandCode)||e;h.info("Received commandAction command:",t);try{const r=this.player.displayCommands||(e==null?void 0:e.commands);await this.player.executeCommand(t,r),h.debug("commandAction completed successfully")}catch(r){h.error("commandAction failed:",r)}}),this.xmr.on("triggerWebhook",async e=>{h.info("Received triggerWebhook command:",e);try{this.player.triggerWebhook((e==null?void 0:e.triggerCode)||e),h.debug("triggerWebhook completed successfully")}catch(t){h.error("triggerWebhook failed:",t)}}),this.xmr.on("dataUpdate",async()=>{h.info("Received dataUpdate command");try{this.player.refreshDataConnectors(),h.debug("dataUpdate completed successfully")}catch(e){h.error("dataUpdate failed:",e)}}),this.xmr.on("rekeyAction",async()=>{h.info("Received rekeyAction command - rotating RSA key pair");try{this.config.data.xmrPubKey="",this.config.data.xmrPrivKey="",await this.config.ensureXmrKeyPair(),await this.player.collect(),h.info("RSA key pair rotated successfully")}catch(e){h.error("Key rotation failed:",e)}}),this.xmr.on("screenshot",async()=>{h.info("Received screenshot command from CMS");try{await this.player.captureScreenshot()}catch(e){h.error("screenshot failed:",e)}}),this.xmr.on("criteriaUpdate",async e=>{h.info("Received criteriaUpdate command:",e);try{await this.player.collect(),h.debug("criteriaUpdate completed successfully")}catch(t){h.error("criteriaUpdate failed:",t)}}),this.xmr.on("currentGeoLocation",async e=>{h.info("Received currentGeoLocation command:",e);try{e&&e.latitude!=null&&e.longitude!=null?this.player.reportGeoLocation?(this.player.reportGeoLocation(e),h.debug("currentGeoLocation: coordinates applied")):h.warn("Geo location reporting not implemented in player"):this.player.requestGeoLocation?(await this.player.requestGeoLocation(),h.debug("currentGeoLocation: browser location requested")):h.warn("Geo location request not implemented in player")}catch(t){h.error("currentGeoLocation failed:",t)}}))}async stop(){if(this.xmr)try{await this.xmr.stop(),this.connected=!1,this.xmr=null,h.info("Stopped")}catch(e){h.error("Error stopping:",e)}}isConnected(){return this.connected}async send(e,t){if(!this.connected||!this.xmr)return h.warn("Cannot send - not connected"),!1;try{return await this.xmr.send(e,t),!0}catch(r){return h.error("Error sending:",r),!1}}}const pi=fr.version;export{pi as VERSION,wi as XmrWrapper};
2
+ //# sourceMappingURL=index-BHE8ih2g.js.map