UNPKG

@fullcalendar/web-component

Version:
1,025 lines (855 loc) 831 kB
/*! FullCalendar Web Component v7.0.2 Docs & License: https://fullcalendar.io/docs/web-component (c) 2026 Adam Shaw */ var FullCalendar = (function (exports) { 'use strict'; var n$1,l$2,u$2,t$1,i$2,r$1,o$1,e$1,f$2,c$2,s$2,a$2,h,p$1,v$1,y,d={},w$1=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g$1=Array.isArray;function m$1(n,l){for(var u in l)n[u]=l[u];return n}function b(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function k$1(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n$1.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return x(l,e,i,r,null)}function x(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$2:o,__i:-1,__u:0};return null==o&&null!=l$2.vnode&&l$2.vnode(e),e}function M$1(){return {current:null}}function S(n){return n.children}function C(n,l){this.props=n,this.context=l;}function $$1(n,l){if(null==l)return n.__?$$1(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?$$1(n):null}function I(n){if(n.__P&&n.__d){var u=n.__v,t=u.__e,i=[],r=[],o=m$1({},u);o.__v=u.__v+1,l$2.vnode&&l$2.vnode(o),q$1(n.__P,o,u,n.__n,n.__P.namespaceURI,32&u.__u?[t]:null,i,null==t?$$1(u):t,!!(32&u.__u),r),o.__v=u.__v,o.__.__k[o.__i]=o,D(i,o,r),u.__e=u.__=null,o.__e!=t&&P$1(o);}}function P$1(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(l){if(null!=l&&null!=l.__e)return n.__e=n.__c.base=l.__e}),P$1(n)}function A(n){(!n.__d&&(n.__d=!0)&&i$2.push(n)&&!H$1.__r++||r$1!=l$2.debounceRendering)&&((r$1=l$2.debounceRendering)||o$1)(H$1);}function H$1(){try{for(var n,l=1;i$2.length;)i$2.length>l&&i$2.sort(e$1),n=i$2.shift(),l=i$2.length,I(n);}finally{i$2.length=H$1.__r=0;}}function L(n,l,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,_,g,m=t&&t.__k||w$1,b=l.length;for(f=T$1(u,l,m,f,b),a=0;a<b;a++)null!=(p=u.__k[a])&&(h=-1!=p.__i&&m[p.__i]||d,p.__i=a,_=q$1(n,p,h,i,r,o,e,f,c,s),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&J$1(h.ref,null,p),s.push(p.ref,p.__c||v,p)),null==y&&null!=v&&(y=v),(g=!!(4&p.__u))||h.__k===p.__k?(f=j$2(p,f,n,g),g&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==_?f=_:v&&(f=v.nextSibling),p.__u&=-7);return u.__e=y,f}function T$1(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=n.__k[r]=x(null,o,null,null,null):g$1(o)?o=n.__k[r]=x(S,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=n.__k[r]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=O$1(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>s?h--:i<s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=$$1(e)),K$1(e,e));return t}function j$2(n,l,u,t){var i,r;if("function"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=j$2(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=$$1(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function F(n,l){return l=l||[],null==n||"boolean"==typeof n||(g$1(n)?n.some(function(n){F(n,l);}):l.push(n)),l}function O$1(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],s=null!=c&&0==(2&c.__u);if(null===c&&null==e||s&&e==c.key&&f==c.type)return u;if(t>(s?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return -1}function z$1(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||_.test(l)?u:u+"px";}function N(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||z$1(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||z$1(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(a$2,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u[s$2]=t[s$2]:(u[s$2]=h,n.addEventListener(l,r?v$1:p$1,r)):n.removeEventListener(l,r?v$1:p$1,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function V$1(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u[c$2])u[c$2]=h++;else if(u[c$2]<t[s$2])return;return t(l$2.event?l$2.event(u):u)}}}function q$1(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,d,_,k,x,M,$,I,P,A,H,T=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l$2.__b)&&a(u);n:if("function"==typeof T)try{if(k=u.props,x=T.prototype&&T.prototype.render,M=(a=T.contextType)&&i[a.__c],$=a?M?M.props.value:a.__:i,t.__c?_=(h=u.__c=t.__c).__=h.__E:(x?u.__c=h=new T(k,$):(u.__c=h=new C(k,$),h.constructor=T,h.render=Q$1),M&&M.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),x&&null==h.__s&&(h.__s=h.state),x&&null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=m$1({},h.__s)),m$1(h.__s,T.getDerivedStateFromProps(k,h.__s))),v=h.props,y=h.state,h.__v=u,p)x&&null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),x&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(x&&null==T.getDerivedStateFromProps&&k!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(k,$),u.__v==t.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(k,h.__s,$)){u.__v!=t.__v&&(h.props=k,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),w$1.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(k,h.__s,$),x&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,d);});}if(h.context=$,h.props=k,h.__P=n,h.__e=!1,I=l$2.__r,P=0,x)h.state=h.__s,h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),w$1.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++P<25);h.state=h.__s,null!=h.getChildContext&&(i=m$1(m$1({},i),h.getChildContext())),x&&!p&&null!=h.getSnapshotBeforeUpdate&&(d=h.getSnapshotBeforeUpdate(v,y)),A=null!=a&&a.type===S&&null==a.key?E$1(a.props.children):a,f=L(n,g$1(A)?A:[A],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),_&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else {for(H=o.length;H--;)b(o[H]);B$2(u);}else u.__e=t.__e,u.__k=t.__k,n.then||B$2(u);l$2.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=G$1(t.__e,u,t,i,r,o,e,c,s);return (a=l$2.diffed)&&a(u),128&u.__u?void 0:f}function B$2(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(B$2));}function D(n,u,t){for(var i=0;i<t.length;i++)J$1(t[i],t[++i],t[++i]);l$2.__c&&l$2.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$2.__e(n,u.__v);}});}function E$1(n){return "object"!=typeof n||null==n||n.__b>0?n:g$1(n)?n.map(E$1):m$1({},n)}function G$1(u,t,i,r,o,e,f,c,s){var a,h,p,v,y,w,_,m=i.props||d,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((y=e[a])&&"setAttribute"in y==!!x&&(x?y.localName==x:3==y.nodeType)){u=y,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l$2.__m&&l$2.__m(t,e),c=!1),e=null;}if(null==x)m===k||c&&u.data==k||(u.data=k);else {if(e=e&&n$1.call(u.childNodes),!c&&null!=e)for(m={},a=0;a<u.attributes.length;a++)m[(y=u.attributes[a]).name]=y.value;for(a in m)y=m[a],"dangerouslySetInnerHTML"==a?p=y:"children"==a||a in k||"value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k||N(u,a,null,y,o);for(a in k)y=k[a],"children"==a?v=y:"dangerouslySetInnerHTML"==a?h=y:"value"==a?w=y:"checked"==a?_=y:c&&"function"!=typeof y||m[a]===y||N(u,a,y,m[a],o);if(h)c||p&&(h.__html==p.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(p&&(u.innerHTML=""),L("template"==t.type?u.content:u,g$1(v)?v:[v],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&$$1(i,0),c,s),null!=e)for(a=e.length;a--;)b(e[a]);c||(a="value","progress"==x&&null==w?u.removeAttribute("value"):null!=w&&(w!==u[a]||"progress"==x&&!w||"option"==x&&w!=m[a])&&N(u,a,w,m[a],o),a="checked",null!=_&&_!=u[a]&&N(u,a,_,m[a],o));}return u}function J$1(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l$2.__e(n,t);}}function K$1(n,u,t){var i,r;if(l$2.unmount&&l$2.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||J$1(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$2.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&K$1(i[r],u,t||"function"!=typeof n.type);t||b(n.__e),n.__c=n.__=n.__e=void 0;}function Q$1(n,l,u){return this.constructor(n,u)}function R(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l$2.__&&l$2.__(u,t),o=(r="function"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],q$1(t,u=(!r&&i||t).__k=k$1(S,null,[u]),o||d,d,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n$1.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),D(e,u,f);}function U$1(n,l){R(n,l,U$1);}function W$1(l,u,t){var i,r,o,e,f=m$1({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n$1.call(arguments,2):t),x(l.type,f,i||l.key,r||l.ref,null)}function X$1(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null;},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=!0,A(n);});},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n);};}),n.children}return l.__c="__cC"+y++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n$1=w$1.slice,l$2={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u$2=0,t$1=function(n){return null!=n&&void 0===n.constructor},C.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m$1({},this.state),"function"==typeof n&&(n=n(m$1({},u),this.props)),n&&m$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),A(this));},C.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),A(this));},C.prototype.render=S,i$2=[],o$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},H$1.__r=0,f$2=Math.random().toString(8),c$2="__d"+f$2,s$2="__a"+f$2,a$2=/(PointerCapture)$|Capture$/i,h=0,p$1=V$1(!1),v$1=V$1(!0),y=0; var preact = /*#__PURE__*/Object.freeze({ __proto__: null, Component: C, Fragment: S, cloneElement: W$1, createContext: X$1, createElement: k$1, createRef: M$1, h: k$1, hydrate: U$1, get isValidElement () { return t$1; }, get options () { return l$2; }, render: R, toChildArray: F }); var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1;}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f$1=0,i$1=Array.isArray;function u$1(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f$1,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return l$2.vnode&&l$2.vnode(l),l}function a$1(r){var t=u$1(S,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c$1={},p=/[A-Z]/g;function l$1(e,t){if(l$2.attr){var f=l$2.attr(e,t);if("string"==typeof f)return f}if(t=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(t),"ref"===e||"key"===e)return "";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c$1[u]||(c$1[u]=u.replace(p,"-$&").toLowerCase()),s=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(s="px;"),i=i+l+":"+a+s;}}return e+'="'+n(i)+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(""+t)+'"'}function s$1(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i$1(r)){for(var e=0;e<r.length;e++)r[e]=s$1(r[e]);return r}}return n(""+r)} var jsxRuntime = /*#__PURE__*/Object.freeze({ __proto__: null, jsx: u$1, jsxAttr: l$1, jsxDEV: u$1, jsxEscape: s$1, jsxTemplate: a$1, jsxs: u$1, Fragment: S }); const NativeTemporal = globalThis.Temporal; const expectedFinite = (entityName, num) => `Non-finite ${entityName}: ${num}`; const forbiddenBigIntToNumber = (entityName) => `Cannot convert bigint to ${entityName}`; const invalidObject = 'Invalid object'; const numberOutOfRange = (entityName, val, min, max) => invalidEntity$1(entityName, val) + `; must be between ${min}-${max}`; // Entity/Fields/Bags const invalidEntity$1 = (fieldName, val) => `Invalid ${fieldName}: ${val}`; const nanoInMicro$1 = 1_000; const nanoInMilli$1 = 1_000_000; const nanoInSec$1 = 1_000_000_000; const nanoInMinute$1 = 60_000_000_000; const nanoInHour$1 = 3_600_000_000_000; function normalizeOptions(options) { if (options === undefined) { return Object.create(null); } return requireObjectLike(options); } function toFiniteNumber(arg, entityName = 'number') { if (typeof arg === 'bigint') { throw new TypeError(forbiddenBigIntToNumber(entityName)); } arg = Number(arg); if (!Number.isFinite(arg)) { throw new RangeError(expectedFinite(entityName, arg)); } return arg; } function toIntegerWithTrunc(arg, entityName) { return Math.trunc(toFiniteNumber(arg, entityName)) || 0; // ensure no -0 } /* min/max are inclusive */ function constrainToRange$1(num, min, max) { return Math.min(Math.max(num, min), max); } function isObjectLike(arg) { return arg !== null && (typeof arg === 'object' || typeof arg === 'function'); } function requireObjectLike(arg) { if (!isObjectLike(arg)) { throw new TypeError(invalidObject); } return arg; } const invalidEntity = invalidEntity$1; const missingField = fieldName => `Missing ${fieldName}`; const invalidChoice = (fieldName, val, choiceMap) => invalidEntity$1(fieldName, val) + "; must be " + Object.keys(choiceMap).join(); const forbiddenValueOf$1 = "Cannot use valueOf"; const invalidCallingContext = "Invalid calling context"; const exoticCalendarRequired = (calendarId, remedy) => `Unknown calendar ${calendarId}; might need ${remedy}`; const invalidTimeZone = calendarId => invalidEntity$1("TimeZone", calendarId); const outOfBoundsDate = "Out-of-bounds date"; const invalidSubstring = substring => `Invalid substring: ${substring}`; const constrainToRange = constrainToRange$1; function throwRangeError(message) { throw new RangeError(message); } function throwTypeError(message) { throw new TypeError(message); } function clampProp(props, propName, min, max, overflow) { return clampEntity(propName, ((props, propName) => { const propVal = props[propName]; return void 0 === propVal && throwTypeError(missingField(propName)), propVal; })(props, propName), min, max, overflow); } function clampEntity(entityName, num, min, max, overflow, choices) { const clamped = constrainToRange(num, min, max); return overflow && num !== clamped && throwRangeError(((entityName, val, min, max, choices) => choices ? numberOutOfRange(entityName, choices[val], choices[min], choices[max]) : numberOutOfRange(entityName, val, min, max))(entityName, num, min, max, choices)), clamped; } function memoize$1(generator, MapClass = Map) { const map = new MapClass; return (key, ...otherArgs) => { if (map.has(key)) { return map.get(key); } const val = generator(key, ...otherArgs); return map.set(key, val), val; }; } const createNameDescriptors = name => createPropDescriptors({ name: name }, 1); const createPropDescriptors = (propVals, readonly) => mapProps(value => ({ value: value, configurable: 1, writable: !readonly }), propVals); const createStringTagDescriptors = value => ({ [Symbol.toStringTag]: { value: value, configurable: 1 } }); function mapProps(transformer, props) { const res = {}; for (const propName in props) { res[propName] = transformer(props[propName], propName); } return res; } function createPropGetters(propNames) { const getters = {}; for (const propName of propNames) { getters[propName] = slots => slots[propName]; } return getters; } function pluckProps(propNames, props, dest = Object.create(null)) { for (const propName of propNames) { dest[propName] = props[propName]; } return dest; } function bindArgs(f, ...boundArgs) { return (...dynamicArgs) => f(...boundArgs, ...dynamicArgs); } function noop() {} function capitalize(s) { return s[0].toUpperCase() + s.substring(1); } function createRegExp(meat) { return new RegExp(`^${meat}$`, "i"); } function parseSubsecNano(fracStr) { return parseInt(fracStr.padEnd(9, "0")); } function parseSign(s) { return s && "+" !== s ? -1 : 1; } function parseInt0(s) { return void 0 === s ? 0 : parseInt(s); } function padNumber(digits, num) { return String(num).padStart(digits, "0"); } const padNumber2 = /*@__PURE__*/ bindArgs(padNumber, 2); function compareNumbers$1(a, b) { return Math.sign(a - b); } function divFloorBigInt(num, denom) { const whole = num / denom; return num % denom < 0n ? whole - 1n : whole; } function divModFloorBigInt(num, divisor) { const quotient = divFloorBigInt(num, divisor); return [ quotient, num - quotient * divisor ]; } function divModFloor(num, divisor) { return [ Math.floor(num / divisor), modFloor(num, divisor) ]; } function modFloor(num, divisor) { return (num % divisor + divisor) % divisor; } function divTrunc(num, divisor) { return Math.trunc(num / divisor) || 0; } function hasHalf(num) { return .5 === Math.abs(num % 1); } function normalizeEraName(era) { const normalized = era.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g, ""); return "bc" === normalized || "b" === normalized ? "bce" : "ad" === normalized || "a" === normalized ? "ce" : normalized; } const isoCalendarImpl = void 0; function getCalendarSlotId(calendar) { return calendar === isoCalendarImpl ? "iso8601" : 0 === calendar ? "gregory" : calendar.id; } function formatMonthCode(monthCodeNumber, isLeapMonth) { return "M" + padNumber2(monthCodeNumber) + (isLeapMonth ? "L" : ""); } const unitNameMap = { nanosecond: 0, microsecond: 1, millisecond: 2, second: 3, minute: 4, hour: 5, day: 6, week: 7, month: 8, year: 9 }; const unitNamesAsc = /*@__PURE__*/ Object.keys(unitNameMap); const nanoInMicro = nanoInMicro$1; const nanoInMilli = nanoInMilli$1; const nanoInSec = nanoInSec$1; const nanoInMinute = nanoInMinute$1; const nanoInHour = nanoInHour$1; const nanoInUtcDay = 864e11; const bigNanoInMilli = /*@__PURE__*/ BigInt(nanoInMilli); const bigNanoInSec = /*@__PURE__*/ BigInt(nanoInSec); const bigNanoInUtcDay = /*@__PURE__*/ BigInt(nanoInUtcDay); const timeFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.slice(0, 6); const timeGetters$1 = /*@__PURE__*/ createPropGetters(timeFieldNamesAsc); const calendarDateFieldNamesAsc = [ "day", "month", "year" ]; function validateTimeFields(timeFields) { return constrainTimeFields(timeFields, 1), timeFields; } const maxValues = { hour: 23, minute: 59, second: 59 }; function constrainTimeFields(timeFields, overflow) { const constrainedFields = {}; for (const fieldName of timeFieldNamesAsc) { constrainedFields[fieldName] = clampEntity(fieldName, timeFields[fieldName], 0, maxValues[fieldName] || 999, overflow); } return constrainedFields; } function timeFieldsToNano(timeFields) { return timeFieldsToSec(timeFields) * nanoInSec + timeFieldsToSubsecNano(timeFields); } function timeFieldsToSec(timeFields) { return 3600 * timeFields.hour + 60 * timeFields.minute + timeFields.second; } function timeFieldsToSubsecNano(timeFields) { return timeFields.millisecond * nanoInMilli + timeFields.microsecond * nanoInMicro + timeFields.nanosecond; } function nanoToTimeFields(timeNano) { const [timeMilli, nanoAfterMilli] = divModFloor(timeNano, nanoInMilli); const [microsecond, nanosecond] = divModFloor(nanoAfterMilli, nanoInMicro); return milliToTimeFields(timeMilli, microsecond, nanosecond); } function milliToTimeFields(timeMilli, microsecond = 0, nanosecond = 0) { const [hour, milliAfterHour] = divModFloor(timeMilli, 36e5); const [minute, milliAfterMinute] = divModFloor(milliAfterHour, 6e4); const [second, millisecond] = divModFloor(milliAfterMinute, 1e3); return { hour: hour, minute: minute, second: second, millisecond: millisecond, microsecond: microsecond, nanosecond: nanosecond }; } function epochNanoToSecMod(epochNano) { const [epochSec, nano] = divModFloorBigInt(epochNano, bigNanoInSec); return [ Number(epochSec), Number(nano) ]; } function isoDateTimeToEpochNano(isoDateTime) { return isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime)); } function isoDateToEpochNano(isoDate) { return BigInt(isoDateToEpochDays(isoDate)) * bigNanoInUtcDay; } function isoDateToEpochDays(isoDate) { return isoArgsToEpochDays(isoDate.year, isoDate.month, isoDate.day); } function isoArgsToEpochDays(isoYear, isoMonth = 1, isoDay = 1) { const monthIndex = isoMonth - 1; return isoYear += Math.floor(monthIndex / 12), isoMonth = modFloor(monthIndex, 12), Date.UTC(isoYear % 400 - 400, isoMonth, 0) / 864e5 + 146097 * (divTrunc(isoYear, 400) + 1) + isoDay; } function epochNanoToIsoDateTime(epochNano) { const [epochDays, nanoAfterDay] = divModFloorBigInt(epochNano, bigNanoInUtcDay); return { ...epochDaysToIsoDate(Number(epochDays)), ...nanoToTimeFields(Number(nanoAfterDay)) }; } function epochDaysToIsoDate(epochDays) { const legacyDate = new Date(864e5 * modFloor(epochDays, 146097)); return { year: legacyDate.getUTCFullYear() + 400 * Math.floor(epochDays / 146097), month: legacyDate.getUTCMonth() + 1, day: legacyDate.getUTCDate() }; } function computeIsoMonthCodeParts(month) { return [ month, 0 ]; } function computeIsoFieldsFromParts(year, month, day) { return { year: year, month: month, day: day }; } function computeIsoDaysInMonth(year, month) { switch (month) { case 2: return computeIsoInLeapYear(year) ? 29 : 28; case 4: case 6: case 9: case 11: return 30; } return 31; } function computeIsoDaysInYear(year) { return computeIsoInLeapYear(year) ? 366 : 365; } function computeIsoInLeapYear(year) { return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } function computeIsoDayOfWeek(isoDateFields) { return modFloor(isoArgsToEpochDays(isoDateFields.year, isoDateFields.month, isoDateFields.day) + 4, 7) || 7; } function computeIsoDayOfYear(isoDateFields) { return isoArgsToEpochDays(isoDateFields.year, isoDateFields.month, isoDateFields.day) - isoArgsToEpochDays(isoDateFields.year) + 1; } function computeIsoWeekFields(isoDateFields) { let yearOfWeek = isoDateFields.year; let weekOfYear = Math.floor((computeIsoDayOfYear(isoDateFields) - computeIsoDayOfWeek(isoDateFields) + 10) / 7); let weeksInYear = computeIsoWeeksInYear(yearOfWeek); return weekOfYear < 1 ? weekOfYear = weeksInYear = computeIsoWeeksInYear(--yearOfWeek) : weekOfYear > weeksInYear && (weekOfYear = 1, weeksInYear = computeIsoWeeksInYear(++yearOfWeek)), { weekOfYear: weekOfYear, yearOfWeek: yearOfWeek, Ie: weeksInYear }; } function computeIsoWeeksInYear(year) { const y0DayOfWeek = computeIsoDayOfWeek({ year: year, month: 1, day: 1 }); return 4 === y0DayOfWeek || 3 === y0DayOfWeek && computeIsoInLeapYear(year) ? 53 : 52; } function computeGregoryEraFields({year: year}) { return year < 1 ? { era: "bce", eraYear: 1 - year } : { era: "ce", eraYear: year }; } function validateIsoDateTimeFields(isoDateTime) { return validateIsoDateFields(isoDateTime), validateTimeFields(isoDateTime); } function validateIsoDateFields(isoInternals) { return constrainIsoDateFields(isoInternals, 1), isoInternals; } function constrainIsoDateFields(isoDate, overflow) { const {year: year} = isoDate; const month = clampProp(isoDate, "month", 1, 12, overflow); return { year: year, month: month, day: clampProp(isoDate, "day", 1, computeIsoDaysInMonth(year, month), overflow) }; } function computeCalendarDateFields(calendar, isoDate) { return calendar ? calendar.ie(isoDate) : isoDate; } function computeCalendarMonthCodeParts(calendar, year, month) { return calendar ? calendar.O(year, month) : computeIsoMonthCodeParts(month); } function computeCalendarEraFields(calendar, isoDate) { return 0 === calendar ? computeGregoryEraFields(isoDate) : calendar ? calendar.h(isoDate) : {}; } function computeCalendarIsoFieldsFromParts(calendar, year, month, day) { return calendar ? calendar.je(year, month, day) : computeIsoFieldsFromParts(year, month, day); } function computeCalendarMonthsInYearForYear(calendar, year) { return calendar ? calendar.k(year) : 12; } function computeCalendarDaysInMonthForYearMonth(calendar, year, month) { return calendar ? calendar.p(year, month) : computeIsoDaysInMonth(year, month); } function computeCalendarMonthCode(calendar, isoDate) { const {year: year, month: month} = computeCalendarDateFields(calendar, isoDate); const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month); return formatMonthCode(monthCodeNumber, isLeapMonth); } function computeCalendarInLeapYear(calendar, isoDate) { const {year: year} = computeCalendarDateFields(calendar, isoDate); return calendar ? calendar.u(year) : computeIsoInLeapYear(year); } function computeCalendarMonthsInYear(calendar, isoDate) { const {year: year} = computeCalendarDateFields(calendar, isoDate); return computeCalendarMonthsInYearForYear(calendar, year); } function computeCalendarDaysInMonth(calendar, isoDate) { const {year: year, month: month} = computeCalendarDateFields(calendar, isoDate); return computeCalendarDaysInMonthForYearMonth(calendar, year, month); } function computeCalendarDaysInYear(calendar, isoDate) { const {year: year} = computeCalendarDateFields(calendar, isoDate); return calendar ? calendar.j(year) : computeIsoDaysInYear(year); } function computeCalendarDayOfYear(calendar, isoDate) { if (!calendar) { return computeIsoDayOfYear(isoDate); } const {year: year} = computeCalendarDateFields(calendar, isoDate); const yearStartIsoDate = computeCalendarIsoFieldsFromParts(calendar, year, 1, 1); return isoDateToEpochDays(isoDate) - isoDateToEpochDays(yearStartIsoDate) + 1; } function computeCalendarWeekOfYear(calendar, isoDate) { return calendar === isoCalendarImpl ? computeIsoWeekFields(isoDate).weekOfYear : void 0; } function computeCalendarYearOfWeek(calendar, isoDate) { return calendar === isoCalendarImpl ? computeIsoWeekFields(isoDate).yearOfWeek : void 0; } const requireString = /*@__PURE__*/ bindArgs(requireType, "string"); function requireType(typeName, arg, entityName = typeName) { return typeof arg !== typeName && throwTypeError(invalidEntity(entityName, arg)), arg; } function requireNumberIsInteger(num, entityName = "number") { return Number.isInteger(num) || throwRangeError(((entityName, num) => `Non-integer ${entityName}: ${num}`)(entityName, num)), num || 0; } function toString$3(arg) { return "symbol" == typeof arg && throwTypeError("Cannot convert Symbol to string"), String(arg); } function toStrictInteger(arg, entityName) { return requireNumberIsInteger(toFiniteNumber(arg, entityName), entityName); } const epochDisambigMap = { compatible: 0, reject: 1, earlier: 2, later: 3 }; const roundingModeFuncs = [ Math.floor, num => hasHalf(num) ? Math.floor(num) : Math.round(num), Math.ceil, num => hasHalf(num) ? Math.ceil(num) : Math.round(num), Math.trunc, num => hasHalf(num) ? Math.trunc(num) || 0 : Math.round(num), num => num < 0 ? Math.floor(num) : Math.ceil(num), num => Math.sign(num) * Math.round(Math.abs(num)) || 0, num => hasHalf(num) ? (num = Math.trunc(num) || 0) + num % 2 : Math.round(num) ]; function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0) { const enumArg = options[optionName]; if (void 0 === enumArg) { return defaultChoice; } const enumStr = toString$3(enumArg); const enumNum = enumNameMap[enumStr]; return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)), enumNum; } const coerceEpochDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap); const epochNanoMax = /*@__PURE__*/ BigInt(1e8) * bigNanoInUtcDay; const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay; const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay; function checkIsoDateTimeInBounds(isoDateTime) { const epochNano = isoDateToEpochNano(isoDateTime); return checkIsoDateEpochNanoInBounds(epochNano), epochNano !== plainDateEpochNanoMin || timeFieldsToNano(isoDateTime) || throwRangeError(outOfBoundsDate), isoDateTime; } function checkIsoDateEpochNanoInBounds(epochNano, allowPlainDateLowerEdge = 1) { (epochNano < (allowPlainDateLowerEdge ? plainDateEpochNanoMin : epochNanoMin) || epochNano > epochNanoMax) && throwRangeError(outOfBoundsDate); } function checkEpochNanoInBounds(epochNano) { return (epochNano < epochNanoMin || epochNano > epochNanoMax) && throwRangeError(outOfBoundsDate), epochNano; } function isoDateTimeAndOffsetToEpochNano(isoDateTime, offsetNano) { return checkEpochNanoInBounds(isoDateToEpochNano(isoDateTime) + BigInt(timeFieldsToNano(isoDateTime) - offsetNano)); } function createEpochNanoSlots(epochNano) { return { epochNanoseconds: epochNano }; } function createZonedEpochNanoSlots(epochNano, timeZone, calendar) { return { calendar: calendar, timeZone: timeZone, epochNanoseconds: epochNano }; } function createDateTimeSlots(isoDateTime, calendar) { return pluckProps(timeFieldNamesAsc, isoDateTime, createDateSlots(isoDateTime, calendar)); } function createDateSlots(isoDate, calendar) { return pluckProps(calendarDateFieldNamesAsc, isoDate, { calendar: calendar }); } function getEpochMilli(slots) { return epochNano = slots.epochNanoseconds, Number(divFloorBigInt(epochNano, bigNanoInMilli)); var epochNano; } function getEpochNano(slots) { return slots.epochNanoseconds; } function roundToMinute$4(offsetNano) { return roundNumberToInc(offsetNano, nanoInMinute, 7); } function roundNumberToInc(num, roundingInc, roundingMode) { return roundWithMode(num / roundingInc, roundingMode) * roundingInc; } function roundWithMode(num, roundingMode) { return roundingModeFuncs[roundingMode](num); } const zonedEpochSlotsToIso = /*@__PURE__*/ memoize$1(_zonedEpochSlotsToIso, WeakMap); function _zonedEpochSlotsToIso(slots) { const {epochNanoseconds: epochNanoseconds, timeZone: timeZone} = slots; const offsetNanoseconds = timeZone.C(epochNanoseconds); return { ...epochNanoToIsoDateTime(epochNanoseconds + BigInt(offsetNanoseconds)), offsetNanoseconds: offsetNanoseconds }; } function getSingleInstantFor(timeZone, isoDateTime, disambig = 0, possibleEpochNanos = timeZone.R(isoDateTime)) { if (1 === possibleEpochNanos.length) { return possibleEpochNanos[0]; } if (1 === disambig && throwRangeError("Ambiguous offset"), possibleEpochNanos.length) { return possibleEpochNanos[3 === disambig ? 1 : 0]; } const zonedEpochNano = isoDateTimeToEpochNano(isoDateTime); const gapNano = ((timeZone, zonedEpochNano) => { const startOffsetNano = timeZone.C(zonedEpochNano - bigNanoInUtcDay); return (gapNano => (gapNano > nanoInUtcDay && throwRangeError("Out-of-bounds TimeZone gap"), gapNano))(timeZone.C(zonedEpochNano + bigNanoInUtcDay) - startOffsetNano); })(timeZone, zonedEpochNano); const shiftedIsoDateTime = epochNanoToIsoDateTime(zonedEpochNano + BigInt(gapNano * (2 === disambig ? -1 : 1))); return (possibleEpochNanos = timeZone.R(shiftedIsoDateTime))[2 === disambig ? 0 : possibleEpochNanos.length - 1]; } const offsetRegExp = /*@__PURE__*/ createRegExp("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?"); function parseOffsetNanoMaybe(s, onlyHourMinute) { const parts = offsetRegExp.exec(s); if (parts && (s => (s => { "T" !== s[0] && "t" !== s[0] || (s = s.slice(1)); const fractionIndex = s.search(/[.,]/); const main = fractionIndex < 0 ? s : s.slice(0, fractionIndex); const parts = main.split(":"); return 1 === parts.length ? /^(?:\d{2}|\d{4}|\d{6})$/i.test(main) : (2 === parts.length || 3 === parts.length) && parts.every(part => 2 === part.length && /^\d{2}$/i.test(part)); })(s.slice(1)))(parts[0])) { return ((parts, onlyHourMinute) => { const firstSubMinutePart = parts[4] || parts[5]; onlyHourMinute && firstSubMinutePart && throwRangeError(invalidSubstring(firstSubMinutePart)); const offsetNanoPos = parseInt0(parts[2]) * nanoInHour + parseInt0(parts[3]) * nanoInMinute + parseInt0(parts[4]) * nanoInSec + parseSubsecNano(parts[5] || ""); return offsetNano = offsetNanoPos * parseSign(parts[1]), Math.abs(offsetNano) >= nanoInUtcDay && throwRangeError("Out-of-bounds offset"), offsetNano; var offsetNano; })(parts, onlyHourMinute); } } const RawDateTimeFormat = Intl.DateTimeFormat; function formatEpochMilliToPartsRecord(intlFormat, epochMilli) { epochMilli < -864e13 && throwRangeError(outOfBoundsDate); const parts = intlFormat.formatToParts(epochMilli); const hash = {}; for (const part of parts) { hash[part.type] = part.value; } return hash; } const timeZonePeriodDaysByName = { "El_Aaiun": 17, "Tucuman": 12, "Tirane": 11, "Riga": 10, "Simferopol": 9, "Vienna": 9, "Tunis": 8, "Boa_Vista": 6, "Fortaleza": 6, "Maceio": 6, "Noronha": 6, "Recife": 6, "Gaza": 6, "Hebron": 6, "DeNoronha": 6 }; const minPossibleTransitionSec = -388152e4; function formatInstantIsoAuto(instantSlots) { return formatIsoDateTimeFields(epochNanoToIsoDateTime(instantSlots.epochNanoseconds), void 0) + "Z"; } function formatZonedDateTimeIsoAuto(zonedDateTimeSlots) { const calendar = zonedDateTimeSlots.calendar; const timeZone = zonedDateTimeSlots.timeZone; const offsetNano = timeZone.C(zonedDateTimeSlots.epochNanoseconds); return formatIsoDateTimeFields(epochNanoToIsoDateTime(zonedDateTimeSlots.epochNanoseconds + BigInt(offsetNano)), void 0) + formatOffsetNano(roundToMinute$4(offsetNano)) + formatTimeZone(timeZone.id, 0) + (calendar === isoCalendarImpl ? "" : formatCalendarId(getCalendarSlotId(calendar), 0)); } function formatDateTimeIsoAuto(isoDateTimeSlots) { const calendar = isoDateTimeSlots.calendar; return formatIsoDateTimeFields(isoDateTimeSlots, void 0) + (calendar === isoCalendarImpl ? "" : formatCalendarId(getCalendarSlotId(calendar), 0)); } function formatIsoDateTimeFields(isoDateTime, subsecDigits) { return formatIsoDateFields(isoDateTime) + "T" + formatTimeFields(isoDateTime, subsecDigits); } function formatIsoDateFields(isoDateFields) { return formatIsoYearMonthFields(isoDateFields) + "-" + padNumber2(isoDateFields.day); } function formatIsoYearMonthFields(isoDateFields) { const {year: year} = isoDateFields; return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(isoDateFields.month); } function formatTimeFields(timeFields, subsecDigits) { const parts = [ padNumber2(timeFields.hour), padNumber2(timeFields.minute) ]; return -1 !== subsecDigits && parts.push(padNumber2(timeFields.second) + ((millisecond, microsecond, nanosecond, subsecDigits) => formatSubsecNano(millisecond * nanoInMilli + microsecond * nanoInMicro + nanosecond, subsecDigits))(timeFields.millisecond, timeFields.microsecond, timeFields.nanosecond, subsecDigits)), parts.join(":"); } function formatOffsetNano(offsetNano, offsetDisplay = 0) { if (1 === offsetDisplay) { return ""; } const [hour, nanoRemainder0] = divModFloor(Math.abs(offsetNano), nanoInHour); const [minute, nanoRemainder1] = divModFloor(nanoRemainder0, nanoInMinute); const [second, nanoRemainder2] = divModFloor(nanoRemainder1, nanoInSec); return getSignStr(offsetNano) + padNumber2(hour) + ":" + padNumber2(minute) + (second || nanoRemainder2 ? ":" + padNumber2(second) + formatSubsecNano(nanoRemainder2) : ""); } function formatTimeZone(timeZoneId, timeZoneDisplay) { return 1 !== timeZoneDisplay ? "[" + (2 === timeZoneDisplay ? "!" : "") + timeZoneId + "]" : ""; } function formatCalendarId(calendarId, isCritical) { return "[" + (isCritical ? "!" : "") + "u-ca=" + calendarId + "]"; } const trailingZerosRE = /0+$/; function formatSubsecNano(totalNano, subsecDigits) { let s = padNumber(9, totalNano); return s = void 0 === subsecDigits ? s.replace(trailingZerosRE, "") : s.slice(0, subsecDigits), s ? "." + s : ""; } function getSignStr(num) { return num < 0 ? "-" : "+"; } const icuRegExp = /^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/; const badCharactersRegExp = /[^\w\/:+-]+/; function refineTimeZoneId(rawId) { return resolveTimeZoneId(requireString(rawId)); } function resolveTimeZoneId(rawId) { return resolveTimeZoneRecord(rawId).id; } function resolveTimeZoneRecord(rawId) { const upperRawId = rawId.toUpperCase(); const offsetRecord = (upperRawId => { const offsetNano = parseOffsetNanoMaybe(upperRawId, 1); if (void 0 !== offsetNano) { return { id: formatOffsetNano(offsetNano), _: offsetNano, o: offsetNano }; } })(upperRawId); if (offsetRecord) { return { kind: "fixed", ...offsetRecord }; } const normId = "UTC" === upperRawId ? "UTC" : (rawId => (badCharactersRegExp.test(rawId) && throwRangeError(invalidTimeZone(rawId)), icuRegExp.test(rawId) && throwRangeError("Forbidden ICU TimeZone"), rawId.toLowerCase().split("/").map((part, partI) => (part.length <= 3 || /\d/.test(part)) && !/etc|yap/.test(part) ? part.toUpperCase() : part.replace(/baja|dumont|[a-z]+/g, (a, i) => a.length <= 2 && !partI || "in" === a || "chat" === a ? a.toUpperCase() : a.length > 2 || !i ? capitalize(a).replace(/island|noronha|murdo|rivadavia|urville/, capitalize) : a)).join("/")))(rawId); return queryNamedTimeZoneRecord(normId); } const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize$1(normId => { if ("UTC" === normId) { return { kind: "utc", id: normId, o: normId }; } const upperNormId = normId.toUpperCase(); const format = queryTimeZoneIntlFormat(upperNormId); return { kind: "named", id: normId, format: format, o: format.resolvedOptions().timeZone }; }); const queryTimeZoneIntlFormat = /*@__PURE__*/ memoize$1(upperNormId => new RawDateTimeFormat("en-u-hc-h23", { calendar: "iso8601", timeZone: upperNormId, era: "short", year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" })); function queryTimeZone(rawTimeZoneId) { const record = resolveTimeZoneRecord(rawTimeZoneId); return queryTimeZoneRecord(record.id, record); } const queryTimeZoneRecord = /*@__PURE__*/ memoize$1((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.o, record.format) : new FixedTimeZone(normTimeZoneId, record.o, "fixed" === record.kind ? record._ : 0)); class FixedTimeZone { constructor(id, compareKey, offsetNano) { this.id = id, this.o = compareKey, this._ = offsetNano; } C() { return this._; } R(isoDateTime) { return [ isoDateTimeAndOffsetToEpochNano(isoDateTime, this._) ]; } U() {} } class IntlTimeZone { constructor(id, compareKey, format) { this.id = id, this.o = compareKey, this.qe = ((computeOffsetSec, periodDays) => { const getSample = memoize$1(computeOffsetSec); const getSplit = memoize$1(createSplitTuple); const periodSec = 86400 * periodDays; function getOffsetSec(epochSec) { const [startEpochSec, endEpochSec] = computePeriod(epochSec, periodSec); const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec); const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec); const startOffsetSec = getSample(clampedStartEpochSec); const endOffsetSec = getSample(clampedEndEpochSec); return startOffsetSec === endOffsetSec ? startOffsetSec : pinch(getSplit(clampedStartEpochSec, clampedEndEpochSec), startOffsetSec, endOffsetSec, epochSec); } function pinch(split, startOffsetSec, endOffsetSec, forEpochSec) { let offsetSec; let splitDurSec; for (;(void 0 === forEpochSec || void 0 === (offsetSec = forEpochSec < split[0] ? startOffsetSec : forEpochSec >= split[1] ? endOffsetSec : void 0)) && (splitDurSec = split[1] - split[0]); ) { const middleEpochSec = split[0] + Math.floor(splitDurSec / 2); computeOffsetSec(middleEpochSec) === endOffsetSec ? split[1] = middleEpochSec : split[0] = middleEpochSec + 1; } return offsetSec; } return { Ee(zonedEpochSec) { const wideOffsetSec0 = getOffsetSec(zonedEpochSec - 86400); const wideOffsetSec1 = getOffsetSec(zonedEpochSec + 86400); const wideUtcEpochSec0 = zonedEpochSec - wideOffsetSec0; const wideUtcEpochSec1 = zonedEpochSec - wideOffsetSec1; if (wideOffsetSec0 === wideOffsetSec1) { return [ wideUtcEpochSec0 ]; } const narrowOffsetSec0 = getOffsetSec(wideUtcEpochSec0); return narrowOffsetSec0 === getOffsetSec(wideUtcEpochSec1) ? [ zonedEpochSec - narrowOffsetSec0 ] : wideOffsetSec0 > wideOffsetSec1 ? [ wideUtcEpochSec0, wideUtcEpochSec1 ] : []; }, De: getOffsetSec, U: function getTransition(epochSec, direction) { if (direction > 0 && epochSec >= 864e10) { return; } if (direction < 0) { if (epochSec <= minPossibleTransitionSec) { return; } const lookaheadEpochSec = getCurrentEpochSec() + 94867200; if (epochSec > lookaheadEpochSec) { return getTransition(lookaheadEpochSec, -1); } } const searchEpochSec = direction > 0 ? Math.max(epochSec, minPossibleTransitionSec) : epochSec; let [startEpochSec, endEpochSec] = computePeriod(searchEpochSec, periodSec); const inc = periodSec * direction; const searchLimit = direction > 0 ? Math.max(epochSec, getCurrentEpochSec()) + 94867200 : minPossibleTransitionSec; const inBounds = () => direction < 0 ? endEpochSec > searchLimit : startEpochSec < searchLimit; for (;inBounds(); ) { const clampedStartEpochSec = clampIntlSampleEpochSec(startEpochSec); const clampedEndEpochSec = clampIntlSampleEpochSec(endEpochSec); const startOffsetSec = getSample(clampedStartEpochSec); const endOffsetSec = getSample(clampedEndEpochSec); if (startOffsetSec !== endOffsetSec) { const split = getSplit(clampedStartEpochSec, clampedEndEpochSec); pinch(split, startOffsetSec, endOffsetSec); const transitionEpochSec = split[0]; if ((compareNumbers$1(transitionEpochSec, epochSec) || 1) === direction) { return transitionEpochSec; } } startEpochSec += inc, endEpochSec += inc; } } }; })((format => epochSec => { const intlParts = formatEpochMilliToPartsRecord(format, 1e3 * epochSec); return 86400 * isoArgsToEpochDays((intlParts => { const relatedYear = intlParts.relatedYear; if (void 0 !== relatedYear) { return parseInt(relatedYear); } const year = parseInt(intlParts.year); return void 0 !== intlParts.era && "bce" === normalizeEraName(intlParts.era) ? 1 - year : year; })(intlParts), parseInt(intlParts.month), parseInt(intlParts.day)) + 3600 * parseInt(intlParts.hour) + 60 * parseInt(intlParts.minute) + parseInt(intlParts.second) - epochSec; })(format), (timeZoneId => { const timeZoneName = timeZoneId.split("/").pop(); return timeZonePeriodDaysByName[timeZoneName] || 60; })(id)); } C(epochNano) { return this.qe.De((epochNano => epochNanoToSecMod(epochNano)[0])(epochNano)) * nanoInSec; } R(isoDateTime) { const zonedEpochSec = 86400 * isoDateToEpochDays(isoDateTime) + timeFieldsToSec(isoDateTime); const subsecNano = timeFieldsToSubsecNano(isoDateTime); return this.qe.Ee(zonedEpochSec).map(epochSec => checkEpochNanoInBounds(BigInt(epochSec) * bigNanoInSec + BigInt(subsecNano))); } U(epochNano, direction) { const [epochSec, subsecNano] = epochNanoToSecMod(epochNano); const resEpochSec = this.qe.U(epochSec + (direction > 0 || subsecNano ? 1 : 0), direction); if (void 0 !== resEpochSec) { return BigInt(resEpochSec) * bigNanoInSec; } } } function getCurrentEpochSec() { return Math.floor(Date.now() / 1e3); } function createSplitTuple(startEpochSec, endEpochSec) { return [ startEpochSec, endEpochSec ]; } function computePeriod(epochSec, periodSec) { const startEpochSec = Math.floor(epochSec / periodSec) * periodSec; return [ startEpochSec, startEpochSec + periodSec ]; } function clampIntlSampleEpochSec(epochSec) { return constrainToRange(epochSec, -1e10, 864e10); } function instantToZonedDateTime(instantSlots, timeZone, calendar) { return createZonedEpochNanoSlots(instantSlots.epochNanoseconds, timeZone, calendar); } function plainDateTimeToZonedDateTime(plainDateTimeSlots, timeZone, options) { const epochNano = ((timeZone, isoDateTime, options) => { const epochDisambig = (options => coerceEpochDisambig(normalizeOptions(options)))(options); return getSingleInstantFor(timeZone, isoDateTime, epochDisambig); })(timeZone, plainDateTimeSlots, options); return createZonedEpochNanoSlots(checkEpochNanoInBounds(epochNano), timeZone, plainDateTimeSlots.calendar); } function epochMilliToInstant(epochMilli) { return createEpochNanoSlots(checkEpochNanoInBounds(BigInt(toStrictInteger(epochMilli)) * bigNanoInMilli)); } const PlainDateTimeBranding = "Pl