@livetiles/reach-components-react 0.4.0-preview.218 → 0.4.0-preview.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm2.js CHANGED
@@ -1194,16 +1194,16 @@ var userAgent$5 = engineUserAgent$4;
1194
1194
  var process$7 = global$r.process;
1195
1195
  var versions$5 = process$7 && process$7.versions;
1196
1196
  var v8$4 = versions$5 && versions$5.v8;
1197
- var match$5, version$a;
1197
+ var match$7, version$a;
1198
1198
 
1199
1199
  if (v8$4) {
1200
- match$5 = v8$4.split('.');
1201
- version$a = match$5[0] + match$5[1];
1200
+ match$7 = v8$4.split('.');
1201
+ version$a = match$7[0] + match$7[1];
1202
1202
  } else if (userAgent$5) {
1203
- match$5 = userAgent$5.match(/Edge\/(\d+)/);
1204
- if (!match$5 || match$5[1] >= 74) {
1205
- match$5 = userAgent$5.match(/Chrome\/(\d+)/);
1206
- if (match$5) version$a = match$5[1];
1203
+ match$7 = userAgent$5.match(/Edge\/(\d+)/);
1204
+ if (!match$7 || match$7[1] >= 74) {
1205
+ match$7 = userAgent$5.match(/Chrome\/(\d+)/);
1206
+ if (match$7) version$a = match$7[1];
1207
1207
  }
1208
1208
  }
1209
1209
 
@@ -41498,17 +41498,17 @@ var userAgent$4 = engineUserAgent$3;
41498
41498
  var process$1$3 = global$2$3.process;
41499
41499
  var versions$3 = process$1$3 && process$1$3.versions;
41500
41500
  var v8$3 = versions$3 && versions$3.v8;
41501
- var match$4, version$7;
41501
+ var match$6, version$7;
41502
41502
 
41503
41503
  if (v8$3) {
41504
- match$4 = v8$3.split('.');
41505
- version$7 = match$4[0] + match$4[1];
41504
+ match$6 = v8$3.split('.');
41505
+ version$7 = match$6[0] + match$6[1];
41506
41506
  } else if (userAgent$4) {
41507
- match$4 = userAgent$4.match(/Edge\/(\d+)/);
41507
+ match$6 = userAgent$4.match(/Edge\/(\d+)/);
41508
41508
 
41509
- if (!match$4 || match$4[1] >= 74) {
41510
- match$4 = userAgent$4.match(/Chrome\/(\d+)/);
41511
- if (match$4) version$7 = match$4[1];
41509
+ if (!match$6 || match$6[1] >= 74) {
41510
+ match$6 = userAgent$4.match(/Chrome\/(\d+)/);
41511
+ if (match$6) version$7 = match$6[1];
41512
41512
  }
41513
41513
  }
41514
41514
 
@@ -49733,17 +49733,17 @@ var userAgent$3 = engineUserAgent$2;
49733
49733
  var process$2$2 = global$4$2.process;
49734
49734
  var versions$2 = process$2$2 && process$2$2.versions;
49735
49735
  var v8$2 = versions$2 && versions$2.v8;
49736
- var match$3, version$6;
49736
+ var match$5, version$6;
49737
49737
 
49738
49738
  if (v8$2) {
49739
- match$3 = v8$2.split('.');
49740
- version$6 = match$3[0] + match$3[1];
49739
+ match$5 = v8$2.split('.');
49740
+ version$6 = match$5[0] + match$5[1];
49741
49741
  } else if (userAgent$3) {
49742
- match$3 = userAgent$3.match(/Edge\/(\d+)/);
49742
+ match$5 = userAgent$3.match(/Edge\/(\d+)/);
49743
49743
 
49744
- if (!match$3 || match$3[1] >= 74) {
49745
- match$3 = userAgent$3.match(/Chrome\/(\d+)/);
49746
- if (match$3) version$6 = match$3[1];
49744
+ if (!match$5 || match$5[1] >= 74) {
49745
+ match$5 = userAgent$3.match(/Chrome\/(\d+)/);
49746
+ if (match$5) version$6 = match$5[1];
49747
49747
  }
49748
49748
  }
49749
49749
 
@@ -66234,7 +66234,7 @@ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
66234
66234
  var booleanValueOf = Boolean.prototype.valueOf;
66235
66235
  var objectToString = Object.prototype.toString;
66236
66236
  var functionToString$2 = Function.prototype.toString;
66237
- var match$2 = String.prototype.match;
66237
+ var match$4 = String.prototype.match;
66238
66238
  var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
66239
66239
  var gOPS = Object.getOwnPropertySymbols;
66240
66240
  var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
@@ -66410,7 +66410,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
66410
66410
  if (isString$1(obj)) {
66411
66411
  return markBoxed(inspect(String(obj)));
66412
66412
  }
66413
- if (!isDate(obj) && !isRegExp$8(obj)) {
66413
+ if (!isDate$1(obj) && !isRegExp$8(obj)) {
66414
66414
  var ys = arrObjKeys(obj, inspect);
66415
66415
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
66416
66416
  var protoTag = obj instanceof Object ? '' : 'null prototype';
@@ -66436,7 +66436,7 @@ function quote(s) {
66436
66436
  }
66437
66437
 
66438
66438
  function isArray$8(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66439
- function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66439
+ function isDate$1(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66440
66440
  function isRegExp$8(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66441
66441
  function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
66442
66442
  function isString$1(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
@@ -66483,7 +66483,7 @@ function toStr(obj) {
66483
66483
 
66484
66484
  function nameOf(f) {
66485
66485
  if (f.name) { return f.name; }
66486
- var m = match$2.call(functionToString$2.call(f), /^function\s*([\w$]+)/);
66486
+ var m = match$4.call(functionToString$2.call(f), /^function\s*([\w$]+)/);
66487
66487
  if (m) { return m[1]; }
66488
66488
  return null;
66489
66489
  }
@@ -71018,7 +71018,7 @@ var clipboardToIE11Formatting = {
71018
71018
 
71019
71019
  var defaultMessage = "Copy to clipboard: #{key}, Enter";
71020
71020
 
71021
- function format(message) {
71021
+ function format$1(message) {
71022
71022
  var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
71023
71023
  return message.replace(/#{\s*key\s*}/g, copyKey);
71024
71024
  }
@@ -71097,7 +71097,7 @@ function copy(text, options) {
71097
71097
  } catch (err) {
71098
71098
  debug && console.error("unable to copy using clipboardData: ", err);
71099
71099
  debug && console.error("falling back to prompt");
71100
- message = format("message" in options ? options.message : defaultMessage);
71100
+ message = format$1("message" in options ? options.message : defaultMessage);
71101
71101
  window.prompt(message, text);
71102
71102
  }
71103
71103
  } finally {
@@ -80314,17 +80314,17 @@ var userAgent$2 = engineUserAgent$1;
80314
80314
  var process$2$1 = global$2$1.process;
80315
80315
  var versions$1 = process$2$1 && process$2$1.versions;
80316
80316
  var v8$1 = versions$1 && versions$1.v8;
80317
- var match$1, version$2;
80317
+ var match$3, version$2;
80318
80318
 
80319
80319
  if (v8$1) {
80320
- match$1 = v8$1.split('.');
80321
- version$2 = match$1[0] + match$1[1];
80320
+ match$3 = v8$1.split('.');
80321
+ version$2 = match$3[0] + match$3[1];
80322
80322
  } else if (userAgent$2) {
80323
- match$1 = userAgent$2.match(/Edge\/(\d+)/);
80323
+ match$3 = userAgent$2.match(/Edge\/(\d+)/);
80324
80324
 
80325
- if (!match$1 || match$1[1] >= 74) {
80326
- match$1 = userAgent$2.match(/Chrome\/(\d+)/);
80327
- if (match$1) version$2 = match$1[1];
80325
+ if (!match$3 || match$3[1] >= 74) {
80326
+ match$3 = userAgent$2.match(/Chrome\/(\d+)/);
80327
+ if (match$3) version$2 = match$3[1];
80328
80328
  }
80329
80329
  }
80330
80330
 
@@ -87472,9 +87472,9 @@ var AuthenticationContextProvider = function AuthenticationContextProvider(_a) {
87472
87472
  }), void 0);
87473
87473
  };
87474
87474
 
87475
- var version$1 = "0.4.0-preview.218";
87476
- var buildId = "98536";
87477
- var commitId = "53d1e2e7ca6cdb579383c5337dad032ea701dfec";
87475
+ var version$1 = "0.4.0-preview.221";
87476
+ var buildId = "98613";
87477
+ var commitId = "e126a46daeb03a10fdd9718bf8ee26750837ef4b";
87478
87478
  var isCustomerBuild = false;
87479
87479
  var buildInfo = {
87480
87480
  version: version$1,
@@ -131619,7 +131619,7 @@ promise=Promise$1.resolve(undefined);then=promise.then;notify$1=function(){then.
131619
131619
  // - setTimeout
131620
131620
  }else {notify$1=function(){// strange IE + webpack dev server bug - use .call(global)
131621
131621
  macrotask.call(global$6,flush);};}}var microtask$1=queueMicrotask||function(fn){var task={fn:fn,next:undefined};if(last)last.next=task;if(!head){head=task;notify$1();}last=task;};var newPromiseCapability$2={};var aFunction$4=aFunction$7;var PromiseCapability=function(C){var resolve,reject;this.promise=new C(function($$resolve,$$reject){if(resolve!==undefined||reject!==undefined)throw TypeError('Bad Promise constructor');resolve=$$resolve;reject=$$reject;});this.resolve=aFunction$4(resolve);this.reject=aFunction$4(reject);};// 25.4.1.5 NewPromiseCapability(C)
131622
- newPromiseCapability$2.f=function(C){return new PromiseCapability(C);};var anObject$2$1=anObject$h;var isObject$3=isObject$c;var newPromiseCapability$1=newPromiseCapability$2;var promiseResolve$1=function(C,x){anObject$2$1(C);if(isObject$3(x)&&x.constructor===C)return x;var promiseCapability=newPromiseCapability$1.f(C);var resolve=promiseCapability.resolve;resolve(x);return promiseCapability.promise;};var global$5=global$m;var hostReportErrors$1=function(a,b){var console=global$5.console;if(console&&console.error){arguments.length===1?console.error(a):console.error(a,b);}};var perform$1=function(exec){try{return {error:false,value:exec()};}catch(error){return {error:true,value:error};}};var global$4=global$m;var userAgent=engineUserAgent;var process$1=global$4.process;var versions=process$1&&process$1.versions;var v8=versions&&versions.v8;var match,version;if(v8){match=v8.split('.');version=match[0]+match[1];}else if(userAgent){match=userAgent.match(/Edge\/(\d+)/);if(!match||match[1]>=74){match=userAgent.match(/Chrome\/(\d+)/);if(match)version=match[1];}}var engineV8Version=version&&+version;var $$9=_export;var global$3=global$m;var getBuiltIn=getBuiltIn$6;var NativePromise=nativePromiseConstructor;var redefine$a=redefine$9.exports;var redefineAll=redefineAll$2;var setToStringTag=setToStringTag$5;var setSpecies=setSpecies$2;var isObject$2=isObject$c;var aFunction$3=aFunction$7;var anInstance=anInstance$3;var classof$1=classofRaw$1;var inspectSource=inspectSource$3;var iterate=iterate$2.exports;var checkCorrectnessOfIteration=checkCorrectnessOfIteration$1;var speciesConstructor=speciesConstructor$2;var task=task$1.set;var microtask=microtask$1;var promiseResolve=promiseResolve$1;var hostReportErrors=hostReportErrors$1;var newPromiseCapabilityModule=newPromiseCapability$2;var perform=perform$1;var InternalStateModule=internalState;var isForced=isForced_1;var wellKnownSymbol$2=wellKnownSymbol$l;var V8_VERSION=engineV8Version;var SPECIES$1=wellKnownSymbol$2('species');var PROMISE='Promise';var getInternalState=InternalStateModule.get;var setInternalState=InternalStateModule.set;var getInternalPromiseState=InternalStateModule.getterFor(PROMISE);var PromiseConstructor=NativePromise;var TypeError$1=global$3.TypeError;var document$1=global$3.document;var process$4=global$3.process;var $fetch=getBuiltIn('fetch');var newPromiseCapability=newPromiseCapabilityModule.f;var newGenericPromiseCapability=newPromiseCapability;var IS_NODE=classof$1(process$4)=='process';var DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$3.dispatchEvent);var UNHANDLED_REJECTION='unhandledrejection';var REJECTION_HANDLED='rejectionhandled';var PENDING=0;var FULFILLED=1;var REJECTED=2;var HANDLED=1;var UNHANDLED=2;var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen;var FORCED$2=isForced(PROMISE,function(){var GLOBAL_CORE_JS_PROMISE=inspectSource(PromiseConstructor)!==String(PromiseConstructor);if(!GLOBAL_CORE_JS_PROMISE){// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
131622
+ newPromiseCapability$2.f=function(C){return new PromiseCapability(C);};var anObject$2$1=anObject$h;var isObject$3=isObject$c;var newPromiseCapability$1=newPromiseCapability$2;var promiseResolve$1=function(C,x){anObject$2$1(C);if(isObject$3(x)&&x.constructor===C)return x;var promiseCapability=newPromiseCapability$1.f(C);var resolve=promiseCapability.resolve;resolve(x);return promiseCapability.promise;};var global$5=global$m;var hostReportErrors$1=function(a,b){var console=global$5.console;if(console&&console.error){arguments.length===1?console.error(a):console.error(a,b);}};var perform$1=function(exec){try{return {error:false,value:exec()};}catch(error){return {error:true,value:error};}};var global$4=global$m;var userAgent=engineUserAgent;var process$1=global$4.process;var versions=process$1&&process$1.versions;var v8=versions&&versions.v8;var match$2,version;if(v8){match$2=v8.split('.');version=match$2[0]+match$2[1];}else if(userAgent){match$2=userAgent.match(/Edge\/(\d+)/);if(!match$2||match$2[1]>=74){match$2=userAgent.match(/Chrome\/(\d+)/);if(match$2)version=match$2[1];}}var engineV8Version=version&&+version;var $$9=_export;var global$3=global$m;var getBuiltIn=getBuiltIn$6;var NativePromise=nativePromiseConstructor;var redefine$a=redefine$9.exports;var redefineAll=redefineAll$2;var setToStringTag=setToStringTag$5;var setSpecies=setSpecies$2;var isObject$2=isObject$c;var aFunction$3=aFunction$7;var anInstance=anInstance$3;var classof$1=classofRaw$1;var inspectSource=inspectSource$3;var iterate=iterate$2.exports;var checkCorrectnessOfIteration=checkCorrectnessOfIteration$1;var speciesConstructor=speciesConstructor$2;var task=task$1.set;var microtask=microtask$1;var promiseResolve=promiseResolve$1;var hostReportErrors=hostReportErrors$1;var newPromiseCapabilityModule=newPromiseCapability$2;var perform=perform$1;var InternalStateModule=internalState;var isForced=isForced_1;var wellKnownSymbol$2=wellKnownSymbol$l;var V8_VERSION=engineV8Version;var SPECIES$1=wellKnownSymbol$2('species');var PROMISE='Promise';var getInternalState=InternalStateModule.get;var setInternalState=InternalStateModule.set;var getInternalPromiseState=InternalStateModule.getterFor(PROMISE);var PromiseConstructor=NativePromise;var TypeError$1=global$3.TypeError;var document$1=global$3.document;var process$4=global$3.process;var $fetch=getBuiltIn('fetch');var newPromiseCapability=newPromiseCapabilityModule.f;var newGenericPromiseCapability=newPromiseCapability;var IS_NODE=classof$1(process$4)=='process';var DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$3.dispatchEvent);var UNHANDLED_REJECTION='unhandledrejection';var REJECTION_HANDLED='rejectionhandled';var PENDING=0;var FULFILLED=1;var REJECTED=2;var HANDLED=1;var UNHANDLED=2;var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen;var FORCED$2=isForced(PROMISE,function(){var GLOBAL_CORE_JS_PROMISE=inspectSource(PromiseConstructor)!==String(PromiseConstructor);if(!GLOBAL_CORE_JS_PROMISE){// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
131623
131623
  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
131624
131624
  // We can't detect it synchronously, so just check versions
131625
131625
  if(V8_VERSION===66)return true;// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
@@ -131661,7 +131661,7 @@ function search(regexp){var O=requireObjectCoercible$3(this);var searcher=regexp
131661
131661
  // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
131662
131662
  function(regexp){var res=maybeCallNative(nativeSearch,regexp,this);if(res.done)return res.value;var rx=anObject$1$1(regexp);var S=String(this);var previousLastIndex=rx.lastIndex;if(!sameValue(previousLastIndex,0))rx.lastIndex=0;var result=regExpExec$1(rx,S);if(!sameValue(rx.lastIndex,previousLastIndex))rx.lastIndex=previousLastIndex;return result===null?-1:result.index;}];});var $$8=_export;var assign=objectAssign;// `Object.assign` method
131663
131663
  // https://tc39.github.io/ecma262/#sec-object.assign
131664
- $$8({target:'Object',stat:true,forced:Object.assign!==assign},{assign:assign});var defaultPageSize$2=10;function fetchNewsItems(path,cacheKey,api,storage,paginationToken,filterDefinition,isArray){var _this=this;var _a,_b;if(isArray===void 0){isArray=false;}var hasSimpleFilters=filterDefinition.beforeDate!=null||((_a=filterDefinition.keywords)===null||_a===void 0?void 0:_a.length)>0||filterDefinition.author!=null||filterDefinition.owner!=null||filterDefinition.bookmarksOnly!=null||filterDefinition.source!=null||filterDefinition.state!=null||filterDefinition.groupId!=null||filterDefinition.includePromoted!=null||filterDefinition.unreadOnly!=null;var isSearchActive=filterDefinition.search&&filterDefinition.search.length>0;var hasChannels=((_b=filterDefinition===null||filterDefinition===void 0?void 0:filterDefinition.channels)===null||_b===void 0?void 0:_b.length)>0;var pageSize=filterDefinition.pageSize;var hasAnyFilteringApplied=hasChannels||hasSimpleFilters||isSearchActive;// Note: caching is done only for the first page (paginationToken == null)
131664
+ $$8({target:'Object',stat:true,forced:Object.assign!==assign},{assign:assign});var defaultPageSize$2=10;function fetchNewsItems(path,cacheKey,api,storage,paginationToken,filterDefinition,isArray){var _this=this;var _a,_b;if(isArray===void 0){isArray=false;}var hasSimpleFilters=filterDefinition.beforeDate!=null||filterDefinition.afterDate!=null||((_a=filterDefinition.keywords)===null||_a===void 0?void 0:_a.length)>0||filterDefinition.author!=null||filterDefinition.owner!=null||filterDefinition.bookmarksOnly!=null||filterDefinition.source!=null||filterDefinition.state!=null||filterDefinition.groupId!=null||filterDefinition.includePromoted!=null||filterDefinition.unreadOnly!=null;var isSearchActive=filterDefinition.search&&filterDefinition.search.length>0;var hasChannels=((_b=filterDefinition===null||filterDefinition===void 0?void 0:filterDefinition.channels)===null||_b===void 0?void 0:_b.length)>0;var pageSize=filterDefinition.pageSize;var hasAnyFilteringApplied=hasChannels||hasSimpleFilters||isSearchActive;// Note: caching is done only for the first page (paginationToken == null)
131665
131665
  var canCache=!hasAnyFilteringApplied&&paginationToken==null;if(isSearchActive){filterDefinition.search=filterDefinition.search.trim();}if(!hasAnyFilteringApplied){filterDefinition=null;}var params=Object.assign({},{token:paginationToken,pageSize:pageSize!==null&&pageSize!==void 0?pageSize:defaultPageSize$2},__assign(__assign(__assign({},filterDefinition),getCommaSeparatedChannelsString(filterDefinition===null||filterDefinition===void 0?void 0:filterDefinition.channels)),getCommaSeparatedKeywordsString(filterDefinition===null||filterDefinition===void 0?void 0:filterDefinition.keywords)));var endpoint=api.all(path);var apiLoader=isArray?endpoint.getAll(params).then(function(res){return {items:res.body().map(function(r){return r.data();})};}):endpoint.get('',params).then(function(res){return res.body().data();});if(!canCache){return from(apiLoader);}return new Observable(function(observer){(function(){return __awaiter(_this,void 0,void 0,function(){var cachedPage,apiPage_1,err_1;return __generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,3,,4]);return [4/*yield*/,storage.getObject(cacheKey)];case 1:cachedPage=_a.sent();if(cachedPage){validateFileAccessTokens(cachedPage,function(isTokenValid,item){if(!isTokenValid){// prevent executing requests resulting in 401 if we already know the token is not valid anymore
131666
131666
  item.fileAccessToken=null;}});observer.next(cachedPage);}return [4/*yield*/,apiLoader];case 2:apiPage_1=_a.sent();// no need to wait for updating the cache
131667
131667
  storage.set(cacheKey,apiPage_1).then(function(){return null;});if(!cachedPage){observer.next(apiPage_1);observer.complete();return [2/*return*/];}validateFileAccessTokens(cachedPage,function(isTokenValid,cachedItem){var apiItem=apiPage_1.items.find(function(i){return i.id===cachedItem.id;});if(apiItem&&isTokenValid){// prevent reload of the image if the old token is still valid
@@ -131795,7 +131795,7 @@ node.getAttribute('data-quote-authorname');var showAvatar=node.getAttribute('dat
131795
131795
  if(node.querySelector('blockquote[data-quote-text]')==null){node.innerHTML='';}}};var InlineVideo=function InlineVideo(_a){var _b=_a.blockProps,id=_b.id,source=_b.source,url=_b.url,isDirectUrl=_b.isDirectUrl;var user=useCurrentUser();var token=useCurrentToken();var getVideoThumbnailUrl=useVideosApi().getVideoThumbnailUrl;var onOpenExternalLink=useContext(LinkContext).onOpenExternalLink;var isStreamVideo=source===VideoSource.MicrosoftStream;if(isStreamVideo&&env.isAnyMobileApp){return jsx$1(StreamButton,__assign({onClick:handleMicrosoftStreamClick},{children:jsx$1(FormattedMessage$1,{id:"Generic.watchMicrosoftStream"},void 0)}),void 0);}return jsx$1(InlineVideoViewer,{videoInfo:{id:id,source:source,url:url,isDirectUrl:isDirectUrl},videoThumbnailUrl:isDirectUrl?getVideoThumbnailUrl(token,user.subscription.id,source,id):null},void 0);function handleMicrosoftStreamClick(){return __awaiter(this,void 0,void 0,function(){var url;return __generator(this,function(_a){switch(_a.label){case 0:url=getMicrosoftStreamVideoUrl(id);return [4/*yield*/,onOpenExternalLink(url,true)];case 1:_a.sent();return [2/*return*/];}});});}};var InlineVideoViewer=_styled(VideoWithThumbnailView).withConfig({displayName:"InlineVideo__InlineVideoViewer",componentId:"sc-12qdsy1-0"})(templateObject_1$1w||(templateObject_1$1w=__makeTemplateObject(["\n margin-bottom: ","px;\n"],["\n margin-bottom: ","px;\n"])),spacingS+5);var StreamButton=_styled(PrimaryButton).withConfig({displayName:"InlineVideo__StreamButton",componentId:"sc-12qdsy1-1"})(templateObject_2$U||(templateObject_2$U=__makeTemplateObject(["\n margin-bottom: ","px;\n"],["\n margin-bottom: ","px;\n"])),spacingS+5);var InlineVideoMapper={component:InlineVideo,type:EntityType.Video,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var videoId=node.getAttribute('data-video-id');if(videoId==null){return null;}var source=node.getAttribute('data-video-source');return {id:videoId,source:parseInt(source,10),url:node.getAttribute('data-video-url'),isDirectUrl:node.getAttribute('data-is-direct-video-url')==='true'};},prepareRootNode:function(node){if(node.childNodes.length>0){node.innerHTML='';}}};var templateObject_1$1w,templateObject_2$U;var InlinePageListViewer=function InlinePageListViewer(_a){var items=_a.items,baseRoute=_a.baseRoute,filterBaseUrl=_a.filterBaseUrl,isInitialLoading=_a.isInitialLoading;var theme=useTheme$2();if(!items||items.length===0){return null;}return jsx$1(PagesList,__assign({"data-inline-page-list":true},{children:items.map(function(item){var isPublished=!item.hasHiddenAncestor&&(item.isCurrentPublishedVersion||!!item.publishedVersionId);return jsx$1(StyledPageItemTile,{item:item,baseRoute:baseRoute,filterBaseUrl:filterBaseUrl,styleDefinition:{backgroundColor:theme.palette.neutralLighter,bannerDefaultWidth:70,height:70,applyRoundedCorners:true,titleFontSize:fontSizeSmall,titleMargin:'0',contentPadding:spacingS-2+"px "+(spacingM-5)+"px"},additionalContent:jsx$1(StyledDocumentDownloadButton$2,{page:item},void 0),showBannerPlaceholder:true,isVisible:isPublished||isInitialLoading},item.id);})}),void 0);};var PagesList=_styled.div.withConfig({displayName:"InlinePageListViewer__PagesList",componentId:"sc-qn2xdx-0"})(templateObject_1$1v||(templateObject_1$1v=__makeTemplateObject(["\n a {\n &,\n :link,\n :visited {\n color: "," !important;\n text-decoration: none !important;\n }\n }\n\n > article:not(:first-child) {\n margin-top: ","px;\n }\n"],["\n a {\n &,\n :link,\n :visited {\n color: "," !important;\n text-decoration: none !important;\n }\n }\n\n > article:not(:first-child) {\n margin-top: ","px;\n }\n"])),function(p){return p.theme.textColors.default;},spacingS);var StyledPageItemTile=_styled(PageItemTile).withConfig({displayName:"InlinePageListViewer__StyledPageItemTile",componentId:"sc-qn2xdx-1"})(templateObject_2$T||(templateObject_2$T=__makeTemplateObject(["\n opacity: ",";\n"],["\n opacity: ",";\n"])),function(p){return p.isVisible?'1':'0.3';});var StyledDocumentDownloadButton$2=_styled(DocumentDownloadButton).withConfig({displayName:"InlinePageListViewer__StyledDocumentDownloadButton",componentId:"sc-qn2xdx-2"})(templateObject_3$A||(templateObject_3$A=__makeTemplateObject(["\n margin-left: auto;\n z-index: 1;\n\n > button {\n width: 22px;\n height: 22px;\n i {\n margin: 0;\n }\n }\n"],["\n margin-left: auto;\n z-index: 1;\n\n > button {\n width: 22px;\n height: 22px;\n i {\n margin: 0;\n }\n }\n"])));var templateObject_1$1v,templateObject_2$T,templateObject_3$A;var InlinePageListWithPaging=function InlinePageListWithPaging(_a){var pages=_a.pages,baseRoute=_a.baseRoute,_b=_a.pagingProps,getNextPage=_b.getNextPage,getFirstPage=_b.getFirstPage,getPrevPage=_b.getPrevPage,isFirstPage=_b.isFirstPage,isInitialLoading=_b.isInitialLoading,isLoadingNextPage=_b.isLoadingNextPage,hideNextButton=_b.hideNextButton,filterBaseUrl=_a.filterBaseUrl;return jsxs(Fragment,{children:[jsx$1(InlinePageListViewer,{items:pages,baseRoute:baseRoute,filterBaseUrl:filterBaseUrl,isInitialLoading:isInitialLoading},void 0),jsx$1(HorizontalPager,{onNextClick:getNextPage,onPrevClick:getPrevPage,onFirstClick:getFirstPage,hidePrevButton:isFirstPage||isInitialLoading,hideNextButton:hideNextButton,isLoadingNextPage:isLoadingNextPage},void 0)]},void 0);};function useItemLoaderByCurrentPage(currentPageId,pageSize,navigationContext,settings,getAllItemsHandler,deps){var _a=useState$2(getAllItems()),allItems=_a[0],setAllItems=_a[1];var allItemIdsString=allItems===null||allItems===void 0?void 0:allItems.map(function(i){return i.id;}).join(',');var _b=useItemLoaderWithPreFetch(pageSize,loadNextItems,[allItemIdsString]),items=_b.items,pagingProps=__rest(_b,["items"]);useEffect$1(function(){setAllItems(getAllItems());},__spreadArray([],deps||[]));var skeletonItems=getNextItems();var pageItems=pagingProps.isInitialLoading?skeletonItems:items;var hideNextButton=pagingProps.isInitialLoading?allItems.length<=pageSize:pagingProps.isLastPage;return {pageItems:pageItems,pagingProps:__assign(__assign({},pagingProps),{hideNextButton:hideNextButton})};function getAllItems(){var _a;var children=(_a=navigationContext===null||navigationContext===void 0?void 0:navigationContext.children)!==null&&_a!==void 0?_a:[];if(settings.showPages&&settings.showDocuments){return children;}var filteredChildren=children.filter(function(c){return c.pageType===(settings.showPages?PageType.Page:PageType.Document);});return filteredChildren;}function getNextItems(startIndex,paginationToken){if(startIndex===void 0){startIndex=0;}if(paginationToken===void 0){paginationToken=pageSize;}return allItems.slice(startIndex,paginationToken);}function loadNextItems(pageSize,paginationToken){return __awaiter(this,void 0,void 0,function(){var showSubpagesAndDocuments,pageType,result_1,fullAllItems,token,newPaginationToken;return __generator(this,function(_a){switch(_a.label){case 0:if(!!paginationToken)return [3/*break*/,2];showSubpagesAndDocuments=settings.showPages&&settings.showDocuments;pageType=settings.showPages?PageType.Page:PageType.Document;return [4/*yield*/,getAllItemsHandler(currentPageId,showSubpagesAndDocuments?undefined:pageType)];case 1:result_1=_a.sent();fullAllItems=allItems.map(function(i){return result_1.find(function(r){return r.id===i.id;});});setAllItems(fullAllItems);return [2/*return*/,{items:fullAllItems.slice(0,pageSize),paginationToken:pageSize,nextItem:fullAllItems[pageSize]}];case 2:token=parseInt(paginationToken);newPaginationToken=token+pageSize;return [2/*return*/,{items:getNextItems(token,newPaginationToken),paginationToken:newPaginationToken,nextItem:allItems[newPaginationToken]}];}});});}}var InlinePageListSkeleton=function InlinePageListSkeleton(_a){var isDataLoaded=_a.isDataLoaded,_b=_a.pageSize,pageSize=_b===void 0?5:_b,children=_a.children;var items=Array.from(Array(pageSize).keys());var uniqueId=createId();var palette=useContext(ThemeContext$1).theme.palette;return jsx$1(Shimmer,__assign({isDataLoaded:isDataLoaded,shimmerColors:{shimmer:palette.neutralTertiaryAlt,shimmerWave:palette.neutralTertiary},customElementsGroup:jsx$1(Fragment,{children:items.map(function(i){return jsx$1(PageItemShimmer,{},uniqueId+"-"+i);})},void 0)},{children:children}),void 0);};var PageItemShimmer=function PageItemShimmer(){var palette=useContext(ThemeContext$1).theme.palette;return jsxs(Host$A,{children:[jsxs(Inner$2$1,{children:[jsx$1(ShimmerElementsGroup,{styles:{root:{backgroundColor:palette.accent,borderRadius:5}},width:'70px',shimmerElements:[{type:ShimmerElementType.line,height:70,width:70}]},void 0),jsx$1(ShimmerElementsGroup,{backgroundColor:palette.neutralLighter,width:"calc(100% - 70px)",flexWrap:true,shimmerElements:[{type:ShimmerElementType.gap,width:'100%',height:spacingS},{type:ShimmerElementType.gap,width:spacingM+"px",height:spacingS},{type:ShimmerElementType.line,width:"calc(20% - "+spacingM+"px)",height:spacingS},{type:ShimmerElementType.gap,width:'80%',height:spacingS},{type:ShimmerElementType.gap,width:'100%',height:spacingS},{type:ShimmerElementType.gap,width:spacingM+"px",height:spacingS},{type:ShimmerElementType.line,width:"calc(100% - "+2*spacingM+"px",height:spacingS},{type:ShimmerElementType.gap,width:spacingM+"px",height:spacingS},{type:ShimmerElementType.gap,width:'100%',height:spacingS},{type:ShimmerElementType.gap,width:spacingM+"px",height:spacingS},{type:ShimmerElementType.line,width:"calc(40% - "+spacingM+"px)",height:spacingS},{type:ShimmerElementType.gap,width:'60%',height:spacingS},{type:ShimmerElementType.gap,width:'100%',height:spacingS}]},void 0)]},void 0),jsx$1(ShimmerElementsGroup,{shimmerElements:[{type:ShimmerElementType.gap,width:'100%',height:spacingS}]},void 0)]},void 0);};var Host$A=_styled.div.withConfig({displayName:"InlinePageListSkeleton__Host",componentId:"sc-13wpgyn-0"})(templateObject_1$1u||(templateObject_1$1u=__makeTemplateObject([""],[""])));var Inner$2$1=_styled.div.withConfig({displayName:"InlinePageListSkeleton__Inner",componentId:"sc-13wpgyn-1"})(templateObject_2$S||(templateObject_2$S=__makeTemplateObject(["\n display: flex;\n"],["\n display: flex;\n"])));var templateObject_1$1u,templateObject_2$S;var InlineContact=function InlineContact(_a){var contact=__rest(_a.blockProps,[]);return jsx$1(InlineContactViewer,{contact:contact},void 0);};var InlineContactMapper={component:InlineContact,type:EntityType.Contact,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var contactId=node.getAttribute('data-contact-id');if(contactId==null){return null;}var properties={};Array.from(node.querySelectorAll('li')).forEach(function(childNode){var _a,_b;var propertyKey=childNode.getAttribute('data-contact-property');var shouldAutoLoad=(_a=childNode.getAttribute('data-auto-load'))!==null&&_a!==void 0?_a:childNode.getAttribute('data-from-directory');var propertyValue=(_b=childNode.getAttribute('data-contact-property-value'))!==null&&_b!==void 0?_b:childNode.innerText;properties[propertyKey]={value:propertyValue,shouldAutoLoad:shouldAutoLoad==='true'};});return {id:contactId,tenantId:node.getAttribute('data-contact-tenantid'),upn:node.getAttribute('data-contact-upn'),properties:properties};}};var InlineCodeViewer=function InlineCodeViewer(_a){var codeDetails=_a.codeDetails,showJsPlaceholder=_a.showJsPlaceholder,readOnly=_a.readOnly;var htmlContainerRef=useRef$1(null);var javascriptContainerRef=useRef$1(null);useEffect$1(function(){if(readOnly){return;}if(htmlContainerRef.current!=null){if(htmlContainerRef.current.innerHTML!==codeDetails.html){htmlContainerRef.current.innerHTML=codeDetails.html;refreshScripts(htmlContainerRef.current);}}if(javascriptContainerRef.current!=null){var oldScript=javascriptContainerRef.current.querySelector('script');var newScriptText=";\n (function() {\n try {\n "+codeDetails.javascript+";\n } catch (err) {\n console.error(err);\n }\n })();";if(!oldScript||oldScript.innerText!==newScriptText){oldScript===null||oldScript===void 0?void 0:oldScript.remove();var script=document.createElement('script');script.type='text/javascript';var scriptContent=document.createTextNode(newScriptText);script.appendChild(scriptContent);javascriptContainerRef.current.appendChild(script);}}// eslint-disable-next-line react-hooks/exhaustive-deps
131796
131796
  },[codeDetails.html,codeDetails.javascript]);if(readOnly){return jsxs(Host$z,{children:[jsx$1("div",{children:codeDetails.html&&JSON.stringify(codeDetails.html)},void 0),jsx$1("div",{children:codeDetails.javascript&&JSON.stringify(codeDetails.javascript)},void 0)]},void 0);}return jsxs(Host$z,{children:[codeDetails.html&&jsx$1("div",{ref:function(c){return htmlContainerRef.current=c;}},void 0),codeDetails.javascript&&jsx$1("div",__assign({ref:function(c){return javascriptContainerRef.current=c;}},{children:!codeDetails.html&&showJsPlaceholder&&jsx$1(JavascriptPlaceholder,{},void 0)}),void 0)]},void 0);};var Host$z=_styled.div.withConfig({displayName:"InlineCodeViewer__Host",componentId:"sc-q9v8du-0"})(templateObject_1$1t||(templateObject_1$1t=__makeTemplateObject(["\n /* Draft js is setting white-space: pre-wrap and it's causing extra spaces */\n /* fix: reset the white-space value (default one) */\n white-space: normal;\n"],["\n /* Draft js is setting white-space: pre-wrap and it's causing extra spaces */\n /* fix: reset the white-space value (default one) */\n white-space: normal;\n"])));var JavascriptPlaceholder=_styled.div.withConfig({displayName:"InlineCodeViewer__JavascriptPlaceholder",componentId:"sc-q9v8du-1"})(templateObject_2$R||(templateObject_2$R=__makeTemplateObject(["\n position: relative;\n height: 2em;\n\n &::before {\n position: absolute;\n content: '<!-- code -->';\n padding-top: 0.5em;\n padding-left: 1em;\n color: grey;\n }\n"],["\n position: relative;\n height: 2em;\n\n &::before {\n position: absolute;\n content: '<!-- code -->';\n padding-top: 0.5em;\n padding-left: 1em;\n color: grey;\n }\n"])));var templateObject_1$1t,templateObject_2$R;var InlineCode=function InlineCode(_a){var _b=_a.blockProps,id=_b.id,html=_b.html,javascript=_b.javascript;var features=useFeatures();if(!features.editorInlineMarkup){return null;}return jsx$1(InlineCodeViewer,{codeDetails:{id:id,html:html,javascript:javascript}},void 0);};var InlineCodeMapper={component:InlineCode,type:EntityType.InlineCode,getPropsFromHtml:function(nodeName,node){var _a,_b,_c,_d;if(nodeName!=='div'){return null;}var codeId=node.getAttribute('data-code-id');if(codeId==null){return null;}var html=(_b=(_a=node.querySelector('[data-code-html]'))===null||_a===void 0?void 0:_a.innerHTML)!==null&&_b!==void 0?_b:node.getAttribute('data-code-html');var javascript=(_d=(_c=node.querySelector('script[type="text/javascript"][data-code-javascript]'))===null||_c===void 0?void 0:_c.innerHTML)!==null&&_d!==void 0?_d:node.getAttribute('data-code-javascript');return {id:codeId,html:html,javascript:javascript};},prepareRootNode:function(node){// detect if we a have new (draftJS) content. If not remove innerHTML
131797
131797
  // in order to ensure parsing old blocks
131798
- if(node.querySelector('[data-code-html]')==null){node.innerHTML='';}}};var HeaderFormat=css$2(templateObject_1$1s||(templateObject_1$1s=__makeTemplateObject(["\n tr:first-child {\n td {\n border: solid 1px ",";\n }\n\n td,\n textarea {\n font-weight: bold;\n color: ",";\n background-color: ",";\n }\n }\n"],["\n tr:first-child {\n td {\n border: solid 1px ",";\n }\n\n td,\n textarea {\n font-weight: bold;\n color: ",";\n background-color: ",";\n }\n }\n"])),function(p){return p.theme.palette.neutralLight;},function(p){return p.theme.palette.neutralSecondaryAlt;},function(p){return p.theme.palette.neutralLight;});var FooterFormat=css$2(templateObject_2$Q||(templateObject_2$Q=__makeTemplateObject(["\n tr:last-child {\n background-color: ",";\n > td {\n border-bottom: solid 2px ",";\n }\n }\n\n tr:nth-last-child(2) {\n > td {\n border-bottom: solid 1px ",";\n }\n }\n"],["\n tr:last-child {\n background-color: ",";\n > td {\n border-bottom: solid 2px ",";\n }\n }\n\n tr:nth-last-child(2) {\n > td {\n border-bottom: solid 1px ",";\n }\n }\n"])),function(p){return p.theme.palette.white;},function(p){return p.theme.palette.neutralPrimary;},function(p){return p.theme.palette.neutralPrimary;});var Grid=css$2(templateObject_3$z||(templateObject_3$z=__makeTemplateObject(["\n && {\n tr > td {\n border-color: ",";\n border-style: solid;\n }\n }\n"],["\n && {\n tr > td {\n border-color: ",";\n border-style: solid;\n }\n }\n"])),function(p){return p.theme.palette.neutralLight;});var AlternateLines=css$2(templateObject_4$o||(templateObject_4$o=__makeTemplateObject(["\n tr:nth-child(odd) {\n background-color: ",";\n td {\n background-color: ",";\n }\n\n td,\n textarea {\n background-color: ",";\n }\n }\n"],["\n tr:nth-child(odd) {\n background-color: ",";\n td {\n background-color: ",";\n }\n\n td,\n textarea {\n background-color: ",";\n }\n }\n"])),function(p){return p.theme.palette.neutralLighter;},function(p){return p.theme.palette.neutralLighter;},function(p){return p.theme.palette.neutralLighter;});var Table=_styled.table.withConfig({displayName:"InlineTableStyles__Table",componentId:"sc-10dcamf-0"})(templateObject_5$m||(templateObject_5$m=__makeTemplateObject(["\n border-collapse: collapse;\n table-layout: fixed;\n width: 51px;\n\n tr {\n height: 43px;\n > td {\n border: solid 1px transparent;\n font-size: ","px;\n padding: 5px;\n vertical-align: top;\n\n &[data-multiline=\"true\"] {\n white-space: pre-wrap;\n }\n }\n\n textarea {\n font-size: ","px;\n border: none;\n padding: 0;\n }\n }\n }\n\n ","\n ","\n ","\n ","\n"],["\n border-collapse: collapse;\n table-layout: fixed;\n width: 51px;\n\n tr {\n height: 43px;\n > td {\n border: solid 1px transparent;\n font-size: ","px;\n padding: 5px;\n vertical-align: top;\n\n &[data-multiline=\"true\"] {\n white-space: pre-wrap;\n }\n }\n\n textarea {\n font-size: ","px;\n border: none;\n padding: 0;\n }\n }\n }\n\n ","\n ","\n ","\n ","\n"])),fontSizeNormal,fontSizeNormal,function(_a){var showGrid=_a.format.showGrid;return showGrid&&Grid;},function(_a){var alternateLines=_a.format.alternateLines;return alternateLines&&AlternateLines;},function(_a){var hasHeaderRow=_a.format.hasHeaderRow;return hasHeaderRow&&HeaderFormat;},function(_a){var hasFooterRow=_a.format.hasFooterRow;return hasFooterRow&&FooterFormat;});var templateObject_1$1s,templateObject_2$Q,templateObject_3$z,templateObject_4$o,templateObject_5$m;var TableViewer=function TableViewer(_a){var tableDefinition=_a.blockProps.tableDefinition;var lastRowIndex=tableDefinition.rows.length-1;return jsx$1(Host$y,{children:jsx$1(Table,__assign({format:tableDefinition.format},{children:jsx$1("tbody",{children:tableDefinition.rows.map(function(r,rowIndex){return jsx$1("tr",{children:r.cells.map(function(c,index){var _a,_b,_c;return jsx$1("td",__assign({style:__assign(__assign({},cellStyleToCssProps(c.style,tableDefinition.format.alternateLines||tableDefinition.format.hasHeaderRow&&rowIndex===0||tableDefinition.format.hasFooterRow&&rowIndex===lastRowIndex)),rowIndex===0&&{width:(_b=(_a=tableDefinition.columns)===null||_a===void 0?void 0:_a[index])===null||_b===void 0?void 0:_b.width}),title:c.value,"data-multiline":c.isMultiline},{children:c.url?jsx$1(TextLink,__assign({url:c.url,style:{color:(_c=c.style.fontColor)!==null&&_c!==void 0?_c:null}},{children:c.value}),void 0):c.value}),index);})},rowIndex);})},void 0)}),void 0)},void 0);};function cssPropsToCellStyle(style,alternateLines,isHeaderRow){if(style==null){return {};}return {isBold:style.fontWeight==='bold',isItalic:style.fontStyle==='italic',textAlign:style.textAlign==='left'||style.textAlign==='right'||style.textAlign==='center'?style.textAlign:null,fontColor:style.color,backgroundColor:!alternateLines&&!isHeaderRow?style.backgroundColor:null};}function cellStyleToCssProps(cellStyle,disableCustomColors){if(cellStyle==null){return {};}return __assign(__assign(__assign(__assign(__assign({},cellStyle.isBold&&{fontWeight:'bold'}),cellStyle.isItalic&&{fontStyle:'italic'}),cellStyle.textAlign&&{textAlign:cellStyle.textAlign}),cellStyle.fontColor&&!disableCustomColors&&{color:cellStyle.fontColor}),cellStyle.backgroundColor&&!disableCustomColors&&{backgroundColor:cellStyle.backgroundColor});}var InlineTable={component:TableViewer,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var tableId=node.getAttribute('data-table-id');if(tableId==null){return null;}var table=node.querySelector('table');var body=table===null||table===void 0?void 0:table.querySelector('tbody');if(body==null){return null;}var firstRow=body.querySelector('tr:first-child');return {tableId:tableId,tableDefinition:{columns:Array.from(firstRow.querySelectorAll('td')).map(function(c){var _a,_b;return {width:(_b=(_a=c.style)===null||_a===void 0?void 0:_a.width)!==null&&_b!==void 0?_b:null};}),rows:Array.from(body.querySelectorAll('tr')).map(function(row){return {rowId:createId(),cells:Array.from(row.querySelectorAll('td')).map(function(cell){var _a,_b;return {cellId:createId(),value:cell.innerText,style:cssPropsToCellStyle(cell.style,table.classList.contains('condense-table--alternateLines'),table.classList.contains('condense-table--hasHeader')&&row.rowIndex===0),isMultiline:cell.innerText.includes('\n'),url:(_b=(_a=cell.querySelector('a'))===null||_a===void 0?void 0:_a.getAttribute('href'))!==null&&_b!==void 0?_b:null};})};}),format:{showGrid:table.classList.contains('condense-table--showGrid'),alternateLines:table.classList.contains('condense-table--alternateLines'),hasHeaderRow:table.classList.contains('condense-table--hasHeader'),hasFooterRow:table.classList.contains('condense-table--hasFooter')}}};},type:EntityType.Table};var Host$y=_styled.div.withConfig({displayName:"InlineTable__Host",componentId:"sc-8db5xf-0"})(templateObject_1$1r||(templateObject_1$1r=__makeTemplateObject(["\n width: 100%;\n overflow-x: auto;\n"],["\n width: 100%;\n overflow-x: auto;\n"])));var templateObject_1$1r;var ItemBodyWrapper=function ItemBodyWrapper(_a){var className=_a.className,children=_a.children;return jsx$1(Host$x,__assign({className:className,"data-body-wrapper":true},{children:children}),void 0);};var Host$x=_styled.div.withConfig({displayName:"ItemBodyWrapper__Host",componentId:"sc-6adwhw-0"})(templateObject_1$1q||(templateObject_1$1q=__makeTemplateObject(["\n && {\n p,\n ul,\n ol,\n pre,\n blockquote,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n -webkit-margin-before: 0;\n -webkit-margin-end: 0;\n -webkit-margin-after: 0;\n -webkit-margin-start: 0;\n\n -webkit-padding-before: 0;\n -webkit-padding-end: 0;\n -webkit-padding-after: 0;\n -webkit-padding-start: 0;\n }\n\n h1 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n\n p,\n .paragraph,\n ul,\n ol {\n word-wrap: break-word;\n margin-bottom: 1em;\n line-height: 20px;\n }\n\n blockquote {\n line-height: 20px;\n }\n\n ul,\n ol {\n padding-left: 18px;\n }\n\n li {\n margin-bottom: 10px;\n }\n\n a {\n color: ",";\n text-decoration: underline;\n }\n\n .news-inline-file {\n position: relative;\n margin: 10px 3px;\n user-select: none;\n\n > a,\n button {\n max-width: 100%;\n display: inline-block;\n box-sizing: border-box;\n padding: 12px 20px;\n box-shadow: 0 2px 3px 2px #b7b7b7;\n width: auto;\n color: inherit;\n line-height: 1.5em;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n text-decoration: none;\n\n i {\n margin-right: 10px;\n font-size: 25px;\n vertical-align: bottom;\n }\n }\n }\n\n figure:not([data-inline-quote='true']) {\n margin: 0;\n }\n\n .news-inline-image {\n margin-bottom: 15px;\n\n figure {\n margin: 0;\n }\n\n figcaption {\n font-style: italic;\n }\n }\n\n /* news-inline-quote -\n required for backwards compatibility with old news */\n .news-inline-quote {\n max-width: 80%;\n\n figure {\n display: inline-block;\n\n blockquote {\n border-left: 0;\n font-size: 15px;\n }\n\n figcaption {\n text-align: right;\n margin-top: 10px;\n position: relative;\n\n > div {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n overflow: hidden;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50px, -15px);\n }\n }\n }\n }\n\n .video-view-container {\n margin-bottom: 15px;\n }\n\n @media (max-width: ","px) {\n .news-inline-quote {\n max-width: 100%;\n\n figcaption {\n margin-right: 10px;\n }\n }\n\n h1 {\n font-size: ","px;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n p,\n .paragraph,\n ul,\n ol,\n blockquote,\n figcaption,\n td {\n font-size: ","px;\n }\n }\n\n @media (min-width: ","px) {\n .news-inline-quote {\n figure {\n blockquote {\n font-size: 20px;\n }\n }\n }\n }\n }\n"],["\n && {\n p,\n ul,\n ol,\n pre,\n blockquote,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n -webkit-margin-before: 0;\n -webkit-margin-end: 0;\n -webkit-margin-after: 0;\n -webkit-margin-start: 0;\n\n -webkit-padding-before: 0;\n -webkit-padding-end: 0;\n -webkit-padding-after: 0;\n -webkit-padding-start: 0;\n }\n\n h1 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n\n p,\n .paragraph,\n ul,\n ol {\n word-wrap: break-word;\n margin-bottom: 1em;\n line-height: 20px;\n }\n\n blockquote {\n line-height: 20px;\n }\n\n ul,\n ol {\n padding-left: 18px;\n }\n\n li {\n margin-bottom: 10px;\n }\n\n a {\n color: ",";\n text-decoration: underline;\n }\n\n .news-inline-file {\n position: relative;\n margin: 10px 3px;\n user-select: none;\n\n > a,\n button {\n max-width: 100%;\n display: inline-block;\n box-sizing: border-box;\n padding: 12px 20px;\n box-shadow: 0 2px 3px 2px #b7b7b7;\n width: auto;\n color: inherit;\n line-height: 1.5em;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n text-decoration: none;\n\n i {\n margin-right: 10px;\n font-size: 25px;\n vertical-align: bottom;\n }\n }\n }\n\n figure:not([data-inline-quote='true']) {\n margin: 0;\n }\n\n .news-inline-image {\n margin-bottom: 15px;\n\n figure {\n margin: 0;\n }\n\n figcaption {\n font-style: italic;\n }\n }\n\n /* news-inline-quote -\n required for backwards compatibility with old news */\n .news-inline-quote {\n max-width: 80%;\n\n figure {\n display: inline-block;\n\n blockquote {\n border-left: 0;\n font-size: 15px;\n }\n\n figcaption {\n text-align: right;\n margin-top: 10px;\n position: relative;\n\n > div {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n overflow: hidden;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50px, -15px);\n }\n }\n }\n }\n\n .video-view-container {\n margin-bottom: 15px;\n }\n\n @media (max-width: ","px) {\n .news-inline-quote {\n max-width: 100%;\n\n figcaption {\n margin-right: 10px;\n }\n }\n\n h1 {\n font-size: ","px;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n p,\n .paragraph,\n ul,\n ol,\n blockquote,\n figcaption,\n td {\n font-size: ","px;\n }\n }\n\n @media (min-width: ","px) {\n .news-inline-quote {\n figure {\n blockquote {\n font-size: 20px;\n }\n }\n }\n }\n }\n"])),fontSizeLarge-1,spacingS+2,fontSizeLarge-3,fontSizeLarge-5,spacingS,function(p){return p.theme.palette.accent;},maxScreenSize.medium,fontSizeLarge-3,fontSizeLarge-5,fontSizeMedium,fontSizeSmall,minScreenSize.small);var templateObject_1$1q;var InlineFileList=function InlineFileList(_a){var fileBlock=_a.blockProps;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;var getFileUrlWithToken=useFileApi().getFileUrlWithToken;if(!fileBlock.files||fileBlock.files.length===0){return null;}var files=fileBlock.files.map(function(f){if(f.pageId){return __assign({},f);}var getFileUrl=function getFileUrl(token){var _a;return ((_a=f.getDownloadUrl)===null||_a===void 0?void 0:_a.call(f,token))||getFileUrlWithToken(token||item.fileAccessToken,item.id,undefined,f.fileId,f.fileName,resourceType);};return __assign(__assign({},f),{getDownloadUrl:getFileUrl,accessToken:item.fileAccessToken});});var audioFiles=files.filter(function(f){return isAudioFile(f.fileName);});var videoFiles=files.filter(function(f){return isVideoFile(f.fileName);});var otherFiles=files.filter(function(f){return !audioFiles.includes(f)&&!videoFiles.includes(f);});return jsxs(Fragment,{children:[videoFiles.length>0&&jsx$1(FileListHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:videoFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(VideoFileHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:jsx$1(VideoFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)}),void 0)},f.fileId);})}),void 0),audioFiles.length>0&&jsx$1(FileListHost,{children:audioFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(AudioFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)},f.fileId);})},void 0),otherFiles.length>0&&jsx$1(FileListHost,{children:otherFiles.map(function(f){return jsx$1(FileListItem,{children:f.pageId?jsx$1(InlinePageDocument,{file:f},void 0):jsx$1(InlineFileDownloadButton,{getFileUrl:f.getDownloadUrl,fileAccessToken:item.fileAccessToken,fileName:f.fileName,title:f.title},void 0)},f.fileId);})},void 0)]},void 0);};var InlinePageDocument=function InlinePageDocument(_a){var file=_a.file;var pageId=file.pageId;var loadPage=usePagesApi().loadPage;var page=usePromise$2(function(){return loadPage(pageId);},undefined,[pageId])[0];var _b=useInlinePageDocument(file,page),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsx$1(InlinePageDocumentDownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0);};var InlineFileMapper={component:InlineFileList,type:EntityType.File,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var blockId=node.getAttribute('data-file-block');if(!blockId){var fileId=node.getAttribute('data-file-id')||node.getAttribute('data-file-fileid');if(fileId==null){return null;}var title=node.getAttribute('data-file-title');var fileName=node.getAttribute('data-file-name');var pageId=node.getAttribute('data-inline-page-document-id');var extension=node.getAttribute('data-file-extension');return {blockId:createId(),files:[{fileId:fileId,title:title,fileName:fileName,pageId:pageId,extension:extension}]};}return {blockId:blockId,files:Array.from(node.querySelectorAll('[data-file-id], [data-file-fileid]')).map(function(fileNode){var _a;return {fileId:(_a=fileNode.getAttribute('data-file-id'))!==null&&_a!==void 0?_a:fileNode.getAttribute('data-file-fileid'),fileName:fileNode.getAttribute('data-file-name'),title:fileNode.getAttribute('data-file-title'),pageId:fileNode.getAttribute('data-inline-page-document-id'),extension:fileNode.getAttribute('data-file-extension')};})};}};var VideoFileHost=_styled.div.withConfig({displayName:"InlineFileList__VideoFileHost",componentId:"sc-16i3l51-0"})(templateObject_1$1p||(templateObject_1$1p=__makeTemplateObject(["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"],["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"])),videoAttachmentRoundedCornerSize);var templateObject_1$1p;var EventDetailViewPeopleInfo=function EventDetailViewPeopleInfo(){var item=useDetailViewContext().item;return jsx$1(StyledEventPeopleInfo,{item:item},void 0);};var StyledEventPeopleInfo=_styled(EventPeopleInfo).withConfig({displayName:"EventDetailViewPeopleInfo__StyledEventPeopleInfo",componentId:"sc-1d42bpm-0"})(templateObject_1$1o||(templateObject_1$1o=__makeTemplateObject(["\n margin: ","px 0;\n"],["\n margin: ","px 0;\n"])),spacingS);var templateObject_1$1o;var EventDetailViewLocationInfo=function EventDetailViewLocationInfo(){var item=useDetailViewContext().item;if(!item.locations||item.locations.length===0){return null;}return jsx$1(StyledEventLocationInfo,{locations:item.locations},void 0);};var StyledEventLocationInfo=_styled(EventLocationInfo).withConfig({displayName:"EventDetailViewLocationInfo__StyledEventLocationInfo",componentId:"sc-4kfe0w-0"})(templateObject_1$1n||(templateObject_1$1n=__makeTemplateObject(["\n margin: ","px 0;\n"],["\n margin: ","px 0;\n"])),spacingS);var templateObject_1$1n;var EventDetailViewMetaInfo=function EventDetailViewMetaInfo(_a){var allowFilterByChannels=_a.allowFilterByChannels;var _b=useDetailViewContext(),item=_b.item,userPreferredLanguage=_b.userPreferredLanguage;return jsxs(Fragment,{children:[jsx$1(EventDetailViewLocationInfo,{},void 0),jsx$1(EventDetailViewPeopleInfo,{},void 0),jsx$1(EventChannelsDisplay,{item:item,language:userPreferredLanguage,allowFilterByChannels:allowFilterByChannels},void 0)]},void 0);};var EventDetailViewDatesInfo=function EventDetailViewDatesInfo(_a){var className=_a.className;var item=useDetailViewContext().item;return jsx$1(Host$w,{children:jsx$1(DateTimeRange,{className:className,startDate:item.startDate,endDate:item.endDate},void 0)},void 0);};var Host$w=_styled.div.withConfig({displayName:"EventDetailViewDatesInfo__Host",componentId:"sc-3sblty-0"})(templateObject_1$1m||(templateObject_1$1m=__makeTemplateObject(["\n font-size: ","px;\n margin-bottom: ","px;\n font-weight: 500;\n"],["\n font-size: ","px;\n margin-bottom: ","px;\n font-weight: 500;\n"])),fontSizeSmall,spacingM);var templateObject_1$1m;var PollUserContext=/*#__PURE__*/createContext(null);var DetailViewPollsSubmitButton=function DetailViewPollsSubmitButton(_a){var isReadOnly=_a.isReadOnly;var formatMessage=useIntl().formatMessage;var _b=useContext(PollUserContext),submitPoll=_b.submitPoll,hasMissingUnsavedAnswer=_b.hasMissingUnsavedAnswer,hasMissingAnswers=_b.hasMissingAnswers,answers=_b.answers,resourceType=_b.resourceType,item=_b.item;var updatePollAnswers=useFeedbackApi().updatePollAnswers;if(!hasMissingUnsavedAnswer){return null;}return jsx$1("div",{children:jsx$1(PrimaryButton,{"data-poll-submit-button":true,onClick:function(){return submitPoll(function(){return updatePollAnswers(resourceType,item.id,answers);});},text:formatMessage({id:'Polls.display.submitButtonCaption'}),disabled:hasMissingAnswers||isReadOnly},void 0)},void 0);};var DetailViewCsvExportButton=function DetailViewCsvExportButton(_a){var path=_a.path,stringResource=_a.stringResource,className=_a.className;var user=useCurrentUser();var createApiUrl=useApiFactory().createApiUrl;var exchangeShortLivedToken=useFileAccessTokenApi().exchangeShortLivedToken;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;if(!hasMinRoleInSomeGroups(GroupRoles.Author,user,item)){return null;}return jsx$1(Host$v,__assign({className:className},{children:jsxs(DownloadButton$2,__assign({onClick:startDownload},{children:[jsx$1(LeftAlignedIcon,{iconName:"Download"},void 0),jsx$1(FormattedMessage$1,{id:stringResource},void 0)]}),void 0)}),void 0);function startDownload(){return __awaiter(this,void 0,void 0,function(){var token;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,exchangeShortLivedToken(item.fileAccessToken)];case 1:token=_a.sent();window.open(getFileUrlWithToken(item.id,token||item.fileAccessToken));return [2/*return*/];}});});}function getFileUrlWithToken(itemId,fileDownloadToken){return createApiUrl("/"+resourceType+"/"+itemId+"/"+path,{access_token:fileDownloadToken});}};var Host$v=_styled.div.withConfig({displayName:"DetailViewCsvExportButton__Host",componentId:"sc-n02scx-0"})(templateObject_1$1l||(templateObject_1$1l=__makeTemplateObject(["\n display: flex;\n"],["\n display: flex;\n"])));var DownloadButton$2=_styled(DefaultButton).withConfig({displayName:"DetailViewCsvExportButton__DownloadButton",componentId:"sc-n02scx-1"})(templateObject_2$P||(templateObject_2$P=__makeTemplateObject(["\n display: flex;\n align-items: center;\n align-self: flex-start;\n color: ",";\n border: 0;\n padding: 0;\n margin: 0;\n\n &:hover {\n background-color: initial;\n color: ",";\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"],["\n display: flex;\n align-items: center;\n align-self: flex-start;\n color: ",";\n border: 0;\n padding: 0;\n margin: 0;\n\n &:hover {\n background-color: initial;\n color: ",";\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"])),function(p){return p.theme.textColors.default;},function(p){return p.theme.textColors.default;},maxScreenSize.medium,fontSizeSmall);var LeftAlignedIcon=_styled(Icon).withConfig({displayName:"DetailViewCsvExportButton__LeftAlignedIcon",componentId:"sc-n02scx-2"})(templateObject_3$y||(templateObject_3$y=__makeTemplateObject(["\n margin-left: -2px; // remove the 2px space this icon has on the left side\n margin-right: 5px;\n color: ",";\n"],["\n margin-left: -2px; // remove the 2px space this icon has on the left side\n margin-right: 5px;\n color: ",";\n"])),function(p){return p.theme.textColors.default;});var templateObject_1$1l,templateObject_2$P,templateObject_3$y;var DetailViewPollExportButton=function DetailViewPollExportButton(_a){var className=_a.className;var features=useFeatures();if(!features.polls){return null;}return jsx$1(DetailViewCsvExportButton,{className:className,path:"feedback/poll/result/export",stringResource:"Polls.display.exportAsCsv"},void 0);};var PollTranslationContext=/*#__PURE__*/createContext(null);var PollTranslationContextProvider=function PollTranslationContextProvider(_a){var contents=_a.contents,language=_a.language,additionalTranslations=_a.additionalTranslations,children=_a.children;var user=useCurrentUser();var activeContents=Object.values(contents||{}).filter(function(c){return c.active;});var allLanguages=activeContents.map(function(c){return c.language;});var allTranslations=additionalTranslations||[];for(var _i=0,_b=activeContents.filter(function(c){return c.poll&&c.poll.questions;});_i<_b.length;_i++){var content=_b[_i];var language_1=content.language;for(var _c=0,_d=content.poll.questions;_c<_d.length;_c++){var question=_d[_c];allTranslations.push({language:language_1,id:question.questionId,text:question.text});for(var _e=0,_f=question.choices;_e<_f.length;_e++){var choice=_f[_e];allTranslations.push({language:language_1,id:choice.choiceId,text:choice.text});}}}return jsx$1(PollTranslationContext.Provider,__assign({value:{getAllTranslations:getAllTranslations,getTranslation:getTranslation}},{children:jsx$1(Fragment,{children:children},void 0)}),void 0);function getAllTranslations(id){return allTranslations.filter(function(t){return t.id===id&&t.text;});}function getTranslation(id){var preferredLanguage=NewsService.getUserPreferredLanguage(allLanguages,user);var translationItems=getAllTranslations(id);var translation=translationItems.find(function(t){return t.language===language;})||translationItems.find(function(t){return t.language===preferredLanguage;})||translationItems[0];return translation?translation.text:null;}};var PollUserInput=function PollUserInput(){var _a=useContext(PollUserContext),questions=_a.questions,getQuestionResult=_a.getQuestionResult,addAnswer=_a.addAnswer;return jsx$1("div",{children:questions.map(function(q){return jsx$1(QuestionInputItem,{question:q,onChange:function(choiceIds){return handleQuestionChange(q,choiceIds);},result:getQuestionResult(q.questionId)},q.questionId);})},void 0);function handleQuestionChange(question,choiceIds){addAnswer(question.questionId,choiceIds);}};var QuestionInput=function QuestionInput(_a){var question=_a.question,onChange=_a.onChange,result=_a.result,className=_a.className;var getTranslation=useContext(PollTranslationContext).getTranslation;var questionText=getTranslation(question.questionId);return jsxs("div",__assign({className:className,"data-question-id":question.questionId,"data-question-text":questionText},{children:[jsx$1(QuestionText,{children:questionText},void 0),question.isMultiChoice&&jsx$1(MultiChoiceQuestionInput,{question:question,onChange:onChange,result:result},void 0),!question.isMultiChoice&&jsx$1(SingleChoiceQuestionInput,{question:question,onChange:function(choiceId){return onChange([choiceId]);},result:result},void 0)]}),void 0);};var MultiChoiceQuestionInput=function MultiChoiceQuestionInput(_a){var question=_a.question,result=_a.result,onChange=_a.onChange;var getTranslation=useContext(PollTranslationContext).getTranslation;return jsx$1("div",{children:question.choices.map(function(c){return jsx$1(StyledCheckbox$1,{isResultMode:result.showResults,disabled:result.showResults||c.disabled,checked:result.userSelectedChoices.some(function(sc){return sc===c.choiceId;}),onChange:function(_,isChecked){return handleMultipleChoiceChange(c.choiceId,isChecked);},label:getTranslation(c.choiceId),onRenderLabel:function(_){return jsx$1(MultiChoiceLabel,{choice:c,result:result},void 0);}},c.choiceId);})},void 0);function handleMultipleChoiceChange(choiceId,isSelected){var choiceIds=result.userSelectedChoices.filter(function(c){return c!==choiceId;});if(isSelected){choiceIds.push(choiceId);}onChange(choiceIds);}};var SingleChoiceQuestionInput=function SingleChoiceQuestionInput(_a){var question=_a.question,onChange=_a.onChange,result=_a.result;var getTranslation=useContext(PollTranslationContext).getTranslation;return jsx$1(ChoiceInput,{isResultMode:result.showResults,selectedKey:result.userSelectedChoices[0],onChange:function(_,option){return onChange(option.key);},options:question.choices.map(function(c){return {key:c.choiceId,choiceId:c.choiceId,text:getTranslation(c.choiceId),disabled:result.showResults||c.disabled,onRenderLabel:function(_){return jsx$1(SingleChoiceLabel,{choice:c,result:result},void 0);}};})},void 0);};var ChoiceLabel=function ChoiceLabel(_a){var choice=_a.choice,result=_a.result,className=_a.className;var getTranslation=useContext(PollTranslationContext).getTranslation;var choiceText=getTranslation(choice.choiceId);return jsxs(ChoiceLabelHost,__assign({isResultMode:result.showResults,className:className,"data-choice-id":choice.choiceId,"data-choice-text":choiceText},{children:[choiceText,choice.description&&jsx$1(ChoiceLabelSecondaryText,__assign({"data-choice-secondary-text":true},{children:choice.description}),void 0),result.showResults&&jsx$1(ChoiceResult,{result:result,choiceId:choice.choiceId},void 0)]}),void 0);};var ChoiceResult=function ChoiceResult(_a){var choiceId=_a.choiceId,result=_a.result;var numberResult=result.choiceResults[choiceId]||0;var percent=numberResult/result.totalFeedbackCount;var palette=useContext(ThemeContext$1).theme.palette;return jsxs(ChoiceResultHost,__assign({"data-choice-result":numberResult},{children:[jsx$1(Bar,{percentComplete:percent,barHeight:10,styles:{progressBar:{backgroundColor:palette.accent}}},void 0),jsx$1("span",{children:jsx$1(FormattedNumber,{value:numberResult},void 0)},void 0)]}),void 0);};var ChoiceResultHost=_styled.div.withConfig({displayName:"PollUserInput__ChoiceResultHost",componentId:"sc-eeg1mx-0"})(templateObject_1$1k||(templateObject_1$1k=__makeTemplateObject(["\n display: flex;\n align-items: center;\n\n > span {\n padding-left: 10px;\n min-width: 44px;\n text-align: right;\n box-sizing: border-box;\n }\n"],["\n display: flex;\n align-items: center;\n\n > span {\n padding-left: 10px;\n min-width: 44px;\n text-align: right;\n box-sizing: border-box;\n }\n"])));var Bar=_styled(ProgressIndicator).withConfig({displayName:"PollUserInput__Bar",componentId:"sc-eeg1mx-1"})(templateObject_2$O||(templateObject_2$O=__makeTemplateObject(["\n flex: 1 0 auto;\n"],["\n flex: 1 0 auto;\n"])));var QuestionText=_styled.div.withConfig({displayName:"PollUserInput__QuestionText",componentId:"sc-eeg1mx-2"})(templateObject_3$x||(templateObject_3$x=__makeTemplateObject(["\n font-weight: bold;\n"],["\n font-weight: bold;\n"])));var QuestionInputItem=_styled(QuestionInput).withConfig({displayName:"PollUserInput__QuestionInputItem",componentId:"sc-eeg1mx-3"})(templateObject_4$n||(templateObject_4$n=__makeTemplateObject(["\n margin-bottom: ","px;\n"],["\n margin-bottom: ","px;\n"])),spacingL);var ChoiceLabelHost=_styled.span.withConfig({displayName:"PollUserInput__ChoiceLabelHost",componentId:"sc-eeg1mx-4"})(templateObject_5$l||(templateObject_5$l=__makeTemplateObject(["\n display: inline-block;\n ","\n ","\n"],["\n display: inline-block;\n ","\n ","\n"])),function(p){return p.isResultMode&&'max-width: 400px;';},function(p){return p.isResultMode&&'width: 100%;';});var ChoiceLabelSecondaryText=_styled.div.withConfig({displayName:"PollUserInput__ChoiceLabelSecondaryText",componentId:"sc-eeg1mx-5"})(templateObject_6$e||(templateObject_6$e=__makeTemplateObject(["\n opacity: 0.75;\n"],["\n opacity: 0.75;\n"])));var SingleChoiceLabel=_styled(ChoiceLabel).withConfig({displayName:"PollUserInput__SingleChoiceLabel",componentId:"sc-eeg1mx-6"})(templateObject_7$9||(templateObject_7$9=__makeTemplateObject(["\n padding-left: 30px;\n"],["\n padding-left: 30px;\n"])));var MultiChoiceLabel=_styled(ChoiceLabel).withConfig({displayName:"PollUserInput__MultiChoiceLabel",componentId:"sc-eeg1mx-7"})(templateObject_8$8||(templateObject_8$8=__makeTemplateObject(["\n padding-left: 5px;\n"],["\n padding-left: 5px;\n"])));var ChoiceInput=_styled(ChoiceGroup).withConfig({displayName:"PollUserInput__ChoiceInput",componentId:"sc-eeg1mx-8"})(templateObject_9$6||(templateObject_9$6=__makeTemplateObject(["\n .ms-ChoiceField-field,\n .ms-ChoiceField-wrapper {\n position: relative;\n flex: 1 1 auto;\n display: flex;\n }\n"],["\n .ms-ChoiceField-field,\n .ms-ChoiceField-wrapper {\n position: relative;\n flex: 1 1 auto;\n display: flex;\n }\n"])));var StyledCheckbox$1=_styled(Checkbox).withConfig({displayName:"PollUserInput__StyledCheckbox",componentId:"sc-eeg1mx-9"})(templateObject_10$5||(templateObject_10$5=__makeTemplateObject(["\n margin-top: 15px;\n .ms-Checkbox-label {\n display: flex;\n align-items: ",";\n flex: 1 1 auto;\n }\n"],["\n margin-top: 15px;\n .ms-Checkbox-label {\n display: flex;\n align-items: ",";\n flex: 1 1 auto;\n }\n"])),function(p){return p.isResultMode?'flex-start':'center';});var templateObject_1$1k,templateObject_2$O,templateObject_3$x,templateObject_4$n,templateObject_5$l,templateObject_6$e,templateObject_7$9,templateObject_8$8,templateObject_9$6,templateObject_10$5;var PollDisplay=function PollDisplay(_a){var children=_a.children,className=_a.className;var formatMessage=useIntl().formatMessage;return jsxs("section",__assign({className:className,"aria-label":formatMessage({id:'Polls.sectionLabel'}),"data-consumer-poll":true},{children:[jsx$1(PollUserInput,{},void 0),children]}),void 0);};var PollUserContextProvider=function PollUserContextProvider(_a){var _b;var item=_a.item,onBehalfOfUpn=_a.onBehalfOfUpn,resourceType=_a.resourceType,language=_a.language,getAdditionalQuestions=_a.getAdditionalQuestions,getAdditionalUserAnswers=_a.getAdditionalUserAnswers,getPollResults=_a.getPollResults,showResult=_a.showResult,children=_a.children;var poll=item.poll,itemId=item.id;var getFeedback=useFeedbackApi().getFeedback;var _c=useState$2(getAdditionalQuestions===null||getAdditionalQuestions===void 0?void 0:getAdditionalQuestions(null)),additionalQuestions=_c[0],setAdditionalQuestions=_c[1];var showError=useNotificationContext().showError;var questionDefinitions=(_b=poll===null||poll===void 0?void 0:poll.questions)!==null&&_b!==void 0?_b:[];var _d=usePromise$2(loadUserAnswers),userAnswers=_d[0],isLoading=_d[1],setUserAnswers=_d[3];var _e=useState$2([]),unsavedQuestionsIds=_e[0],setUnsavedQuestionsIds=_e[1];var _f=usePromise$2(function(){return getPollResults(itemId);},{answers:[]},[itemId]),pollResult=_f[0],isLoadingPollResult=_f[1],fetchPollResults=_f[5];useEffect$1(function(){var _a;if(isLoadingPollResult||!((_a=pollResult===null||pollResult===void 0?void 0:pollResult.answers)===null||_a===void 0?void 0:_a.length)){return;}getAdditionalQuestions&&setAdditionalQuestions(getAdditionalQuestions(pollResult));// eslint-disable-next-line react-hooks/exhaustive-deps
131798
+ if(node.querySelector('[data-code-html]')==null){node.innerHTML='';}}};var HeaderFormat=css$2(templateObject_1$1s||(templateObject_1$1s=__makeTemplateObject(["\n tr:first-child {\n td {\n border: solid 1px ",";\n }\n\n td,\n textarea {\n font-weight: bold;\n color: ",";\n background-color: ",";\n }\n }\n"],["\n tr:first-child {\n td {\n border: solid 1px ",";\n }\n\n td,\n textarea {\n font-weight: bold;\n color: ",";\n background-color: ",";\n }\n }\n"])),function(p){return p.theme.palette.neutralLight;},function(p){return p.theme.palette.neutralSecondaryAlt;},function(p){return p.theme.palette.neutralLight;});var FooterFormat=css$2(templateObject_2$Q||(templateObject_2$Q=__makeTemplateObject(["\n tr:last-child {\n background-color: ",";\n > td {\n border-bottom: solid 2px ",";\n }\n }\n\n tr:nth-last-child(2) {\n > td {\n border-bottom: solid 1px ",";\n }\n }\n"],["\n tr:last-child {\n background-color: ",";\n > td {\n border-bottom: solid 2px ",";\n }\n }\n\n tr:nth-last-child(2) {\n > td {\n border-bottom: solid 1px ",";\n }\n }\n"])),function(p){return p.theme.palette.white;},function(p){return p.theme.palette.neutralPrimary;},function(p){return p.theme.palette.neutralPrimary;});var Grid=css$2(templateObject_3$z||(templateObject_3$z=__makeTemplateObject(["\n && {\n tr > td {\n border-color: ",";\n border-style: solid;\n }\n }\n"],["\n && {\n tr > td {\n border-color: ",";\n border-style: solid;\n }\n }\n"])),function(p){return p.theme.palette.neutralLight;});var AlternateLines=css$2(templateObject_4$o||(templateObject_4$o=__makeTemplateObject(["\n tr:nth-child(odd) {\n background-color: ",";\n td {\n background-color: ",";\n }\n\n td,\n textarea {\n background-color: ",";\n }\n }\n"],["\n tr:nth-child(odd) {\n background-color: ",";\n td {\n background-color: ",";\n }\n\n td,\n textarea {\n background-color: ",";\n }\n }\n"])),function(p){return p.theme.palette.neutralLighter;},function(p){return p.theme.palette.neutralLighter;},function(p){return p.theme.palette.neutralLighter;});var Table=_styled.table.withConfig({displayName:"InlineTableStyles__Table",componentId:"sc-10dcamf-0"})(templateObject_5$m||(templateObject_5$m=__makeTemplateObject(["\n border-collapse: collapse;\n table-layout: fixed;\n width: 51px;\n\n tr {\n height: 43px;\n > td {\n border: solid 1px transparent;\n font-size: ","px;\n padding: 5px;\n vertical-align: top;\n\n &[data-multiline=\"true\"] {\n white-space: pre-wrap;\n }\n }\n\n textarea {\n font-size: ","px;\n border: none;\n padding: 0;\n }\n }\n }\n\n ","\n ","\n ","\n ","\n"],["\n border-collapse: collapse;\n table-layout: fixed;\n width: 51px;\n\n tr {\n height: 43px;\n > td {\n border: solid 1px transparent;\n font-size: ","px;\n padding: 5px;\n vertical-align: top;\n\n &[data-multiline=\"true\"] {\n white-space: pre-wrap;\n }\n }\n\n textarea {\n font-size: ","px;\n border: none;\n padding: 0;\n }\n }\n }\n\n ","\n ","\n ","\n ","\n"])),fontSizeNormal,fontSizeNormal,function(_a){var showGrid=_a.format.showGrid;return showGrid&&Grid;},function(_a){var alternateLines=_a.format.alternateLines;return alternateLines&&AlternateLines;},function(_a){var hasHeaderRow=_a.format.hasHeaderRow;return hasHeaderRow&&HeaderFormat;},function(_a){var hasFooterRow=_a.format.hasFooterRow;return hasFooterRow&&FooterFormat;});var templateObject_1$1s,templateObject_2$Q,templateObject_3$z,templateObject_4$o,templateObject_5$m;var TableViewer=function TableViewer(_a){var tableDefinition=_a.blockProps.tableDefinition;var lastRowIndex=tableDefinition.rows.length-1;return jsx$1(Host$y,{children:jsx$1(Table,__assign({format:tableDefinition.format},{children:jsx$1("tbody",{children:tableDefinition.rows.map(function(r,rowIndex){return jsx$1("tr",{children:r.cells.map(function(c,index){var _a,_b,_c;return jsx$1("td",__assign({style:__assign(__assign({},cellStyleToCssProps(c.style,tableDefinition.format.alternateLines||tableDefinition.format.hasHeaderRow&&rowIndex===0||tableDefinition.format.hasFooterRow&&rowIndex===lastRowIndex)),rowIndex===0&&{width:(_b=(_a=tableDefinition.columns)===null||_a===void 0?void 0:_a[index])===null||_b===void 0?void 0:_b.width}),title:c.value,"data-multiline":c.isMultiline},{children:c.url?jsx$1(TextLink,__assign({url:c.url,style:{color:(_c=c.style.fontColor)!==null&&_c!==void 0?_c:null}},{children:c.value}),void 0):c.value}),index);})},rowIndex);})},void 0)}),void 0)},void 0);};function cssPropsToCellStyle(style,alternateLines,isHeaderRow){if(style==null){return {};}return {isBold:style.fontWeight==='bold',isItalic:style.fontStyle==='italic',textAlign:style.textAlign==='left'||style.textAlign==='right'||style.textAlign==='center'?style.textAlign:null,fontColor:style.color,backgroundColor:!alternateLines&&!isHeaderRow?style.backgroundColor:null};}function cellStyleToCssProps(cellStyle,disableCustomColors){if(cellStyle==null){return {};}return __assign(__assign(__assign(__assign(__assign({},cellStyle.isBold&&{fontWeight:'bold'}),cellStyle.isItalic&&{fontStyle:'italic'}),cellStyle.textAlign&&{textAlign:cellStyle.textAlign}),cellStyle.fontColor&&!disableCustomColors&&{color:cellStyle.fontColor}),cellStyle.backgroundColor&&!disableCustomColors&&{backgroundColor:cellStyle.backgroundColor});}var InlineTable={component:TableViewer,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var tableId=node.getAttribute('data-table-id');if(tableId==null){return null;}var table=node.querySelector('table');var body=table===null||table===void 0?void 0:table.querySelector('tbody');if(body==null){return null;}var firstRow=body.querySelector('tr:first-child');return {tableId:tableId,tableDefinition:{columns:Array.from(firstRow.querySelectorAll('td')).map(function(c){var _a,_b;return {width:(_b=(_a=c.style)===null||_a===void 0?void 0:_a.width)!==null&&_b!==void 0?_b:null};}),rows:Array.from(body.querySelectorAll('tr')).map(function(row){return {rowId:createId(),cells:Array.from(row.querySelectorAll('td')).map(function(cell){var _a,_b;return {cellId:createId(),value:cell.innerText,style:cssPropsToCellStyle(cell.style,table.classList.contains('condense-table--alternateLines'),table.classList.contains('condense-table--hasHeader')&&row.rowIndex===0),isMultiline:cell.innerText.includes('\n'),url:(_b=(_a=cell.querySelector('a'))===null||_a===void 0?void 0:_a.getAttribute('href'))!==null&&_b!==void 0?_b:null};})};}),format:{showGrid:table.classList.contains('condense-table--showGrid'),alternateLines:table.classList.contains('condense-table--alternateLines'),hasHeaderRow:table.classList.contains('condense-table--hasHeader'),hasFooterRow:table.classList.contains('condense-table--hasFooter')}}};},type:EntityType.Table};var Host$y=_styled.div.withConfig({displayName:"InlineTable__Host",componentId:"sc-8db5xf-0"})(templateObject_1$1r||(templateObject_1$1r=__makeTemplateObject(["\n width: 100%;\n overflow-x: auto;\n"],["\n width: 100%;\n overflow-x: auto;\n"])));var templateObject_1$1r;var ItemBodyWrapper=function ItemBodyWrapper(_a){var className=_a.className,children=_a.children;return jsx$1(Host$x,__assign({className:className,"data-body-wrapper":true},{children:children}),void 0);};var Host$x=_styled.div.withConfig({displayName:"ItemBodyWrapper__Host",componentId:"sc-6adwhw-0"})(templateObject_1$1q||(templateObject_1$1q=__makeTemplateObject(["\n && {\n p,\n ul,\n ol,\n pre,\n blockquote,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n -webkit-margin-before: 0;\n -webkit-margin-end: 0;\n -webkit-margin-after: 0;\n -webkit-margin-start: 0;\n\n -webkit-padding-before: 0;\n -webkit-padding-end: 0;\n -webkit-padding-after: 0;\n -webkit-padding-start: 0;\n }\n\n h1 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n\n p,\n .paragraph,\n ul,\n ol {\n word-wrap: break-word;\n margin-bottom: 1em;\n line-height: 20px;\n }\n\n blockquote {\n line-height: 20px;\n }\n\n ul,\n ol {\n padding-left: 18px;\n }\n\n li {\n margin-bottom: 10px;\n }\n\n a {\n color: ",";\n text-decoration: underline;\n }\n\n .news-inline-file {\n position: relative;\n margin: 10px 3px;\n user-select: none;\n\n > a,\n button {\n max-width: 100%;\n display: inline-block;\n box-sizing: border-box;\n padding: 12px 20px;\n box-shadow: 0 2px 3px 2px #b7b7b7;\n width: auto;\n color: inherit;\n line-height: 1.5em;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n text-decoration: none;\n\n i {\n margin-right: 10px;\n font-size: 25px;\n vertical-align: bottom;\n }\n }\n }\n\n figure:not([data-inline-quote='true']) {\n margin: 0;\n }\n\n .news-inline-image {\n margin-bottom: 15px;\n\n figure {\n margin: 0;\n }\n\n figcaption {\n font-style: italic;\n }\n }\n\n /* news-inline-quote -\n required for backwards compatibility with old news */\n .news-inline-quote {\n max-width: 80%;\n\n figure {\n display: inline-block;\n\n blockquote {\n border-left: 0;\n font-size: 15px;\n }\n\n figcaption {\n text-align: right;\n margin-top: 10px;\n position: relative;\n\n > div {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n overflow: hidden;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50px, -15px);\n }\n }\n }\n }\n\n .video-view-container {\n margin-bottom: 15px;\n }\n\n @media (max-width: ","px) {\n figure[data-inline-quote='true'] {\n padding-left: 15px;\n }\n\n .news-inline-quote {\n max-width: 100%;\n\n figcaption {\n margin-right: 10px;\n }\n }\n\n h1 {\n font-size: ","px;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n p,\n .paragraph,\n ul,\n ol,\n blockquote,\n figcaption,\n td {\n font-size: ","px;\n }\n\n ul {\n padding-left: 14px;\n }\n ol {\n padding-left: 20px;\n }\n }\n\n @media (min-width: ","px) {\n .news-inline-quote {\n figure {\n blockquote {\n font-size: 20px;\n }\n }\n }\n }\n }\n"],["\n && {\n p,\n ul,\n ol,\n pre,\n blockquote,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n -webkit-margin-before: 0;\n -webkit-margin-end: 0;\n -webkit-margin-after: 0;\n -webkit-margin-start: 0;\n\n -webkit-padding-before: 0;\n -webkit-padding-end: 0;\n -webkit-padding-after: 0;\n -webkit-padding-start: 0;\n }\n\n h1 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n\n p,\n .paragraph,\n ul,\n ol {\n word-wrap: break-word;\n margin-bottom: 1em;\n line-height: 20px;\n }\n\n blockquote {\n line-height: 20px;\n }\n\n ul,\n ol {\n padding-left: 18px;\n }\n\n li {\n margin-bottom: 10px;\n }\n\n a {\n color: ",";\n text-decoration: underline;\n }\n\n .news-inline-file {\n position: relative;\n margin: 10px 3px;\n user-select: none;\n\n > a,\n button {\n max-width: 100%;\n display: inline-block;\n box-sizing: border-box;\n padding: 12px 20px;\n box-shadow: 0 2px 3px 2px #b7b7b7;\n width: auto;\n color: inherit;\n line-height: 1.5em;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n text-decoration: none;\n\n i {\n margin-right: 10px;\n font-size: 25px;\n vertical-align: bottom;\n }\n }\n }\n\n figure:not([data-inline-quote='true']) {\n margin: 0;\n }\n\n .news-inline-image {\n margin-bottom: 15px;\n\n figure {\n margin: 0;\n }\n\n figcaption {\n font-style: italic;\n }\n }\n\n /* news-inline-quote -\n required for backwards compatibility with old news */\n .news-inline-quote {\n max-width: 80%;\n\n figure {\n display: inline-block;\n\n blockquote {\n border-left: 0;\n font-size: 15px;\n }\n\n figcaption {\n text-align: right;\n margin-top: 10px;\n position: relative;\n\n > div {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n overflow: hidden;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50px, -15px);\n }\n }\n }\n }\n\n .video-view-container {\n margin-bottom: 15px;\n }\n\n @media (max-width: ","px) {\n figure[data-inline-quote='true'] {\n padding-left: 15px;\n }\n\n .news-inline-quote {\n max-width: 100%;\n\n figcaption {\n margin-right: 10px;\n }\n }\n\n h1 {\n font-size: ","px;\n }\n\n h2 {\n font-size: ","px;\n }\n\n h3 {\n font-size: ","px;\n }\n\n p,\n .paragraph,\n ul,\n ol,\n blockquote,\n figcaption,\n td {\n font-size: ","px;\n }\n\n ul {\n padding-left: 14px;\n }\n ol {\n padding-left: 20px;\n }\n }\n\n @media (min-width: ","px) {\n .news-inline-quote {\n figure {\n blockquote {\n font-size: 20px;\n }\n }\n }\n }\n }\n"])),fontSizeLarge-1,spacingS+2,fontSizeLarge-3,fontSizeLarge-5,spacingS,function(p){return p.theme.palette.accent;},maxScreenSize.medium,fontSizeLarge-3,fontSizeLarge-5,fontSizeMedium,fontSizeSmall,minScreenSize.small);var templateObject_1$1q;var InlineFileList=function InlineFileList(_a){var fileBlock=_a.blockProps;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;var getFileUrlWithToken=useFileApi().getFileUrlWithToken;if(!fileBlock.files||fileBlock.files.length===0){return null;}var files=fileBlock.files.map(function(f){if(f.pageId){return __assign({},f);}var getFileUrl=function getFileUrl(token){var _a;return ((_a=f.getDownloadUrl)===null||_a===void 0?void 0:_a.call(f,token))||getFileUrlWithToken(token||item.fileAccessToken,item.id,undefined,f.fileId,f.fileName,resourceType);};return __assign(__assign({},f),{getDownloadUrl:getFileUrl,accessToken:item.fileAccessToken});});var audioFiles=files.filter(function(f){return isAudioFile(f.fileName);});var videoFiles=files.filter(function(f){return isVideoFile(f.fileName);});var otherFiles=files.filter(function(f){return !audioFiles.includes(f)&&!videoFiles.includes(f);});return jsxs(Fragment,{children:[videoFiles.length>0&&jsx$1(FileListHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:videoFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(VideoFileHost,__assign({"data-preload-video":browserInfo.name==='safari'},{children:jsx$1(VideoFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)}),void 0)},f.fileId);})}),void 0),audioFiles.length>0&&jsx$1(FileListHost,{children:audioFiles.map(function(f){var _a;return jsx$1(FileListItem,{children:jsx$1(AudioFile,{fileName:(_a=f.title)!==null&&_a!==void 0?_a:f.fileName,url:f.getDownloadUrl()},void 0)},f.fileId);})},void 0),otherFiles.length>0&&jsx$1(FileListHost,{children:otherFiles.map(function(f){return jsx$1(FileListItem,{children:f.pageId?jsx$1(InlinePageDocument,{file:f},void 0):jsx$1(InlineFileDownloadButton,{getFileUrl:f.getDownloadUrl,fileAccessToken:item.fileAccessToken,fileName:f.fileName,title:f.title},void 0)},f.fileId);})},void 0)]},void 0);};var InlinePageDocument=function InlinePageDocument(_a){var file=_a.file;var pageId=file.pageId;var loadPage=usePagesApi().loadPage;var page=usePromise$2(function(){return loadPage(pageId);},undefined,[pageId])[0];var _b=useInlinePageDocument(file,page),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsx$1(InlinePageDocumentDownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0);};var InlineFileMapper={component:InlineFileList,type:EntityType.File,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var blockId=node.getAttribute('data-file-block');if(!blockId){var fileId=node.getAttribute('data-file-id')||node.getAttribute('data-file-fileid');if(fileId==null){return null;}var title=node.getAttribute('data-file-title');var fileName=node.getAttribute('data-file-name');var pageId=node.getAttribute('data-inline-page-document-id');var extension=node.getAttribute('data-file-extension');return {blockId:createId(),files:[{fileId:fileId,title:title,fileName:fileName,pageId:pageId,extension:extension}]};}return {blockId:blockId,files:Array.from(node.querySelectorAll('[data-file-id], [data-file-fileid]')).map(function(fileNode){var _a;return {fileId:(_a=fileNode.getAttribute('data-file-id'))!==null&&_a!==void 0?_a:fileNode.getAttribute('data-file-fileid'),fileName:fileNode.getAttribute('data-file-name'),title:fileNode.getAttribute('data-file-title'),pageId:fileNode.getAttribute('data-inline-page-document-id'),extension:fileNode.getAttribute('data-file-extension')};})};}};var VideoFileHost=_styled.div.withConfig({displayName:"InlineFileList__VideoFileHost",componentId:"sc-16i3l51-0"})(templateObject_1$1p||(templateObject_1$1p=__makeTemplateObject(["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"],["\n width: 100%;\n\n video {\n width: 100%;\n border-radius: ","px;\n overflow: hidden;\n }\n\n &[data-preload-video='true'] {\n video {\n box-shadow: inset 0 0 0 0.5px #707070, 0 0 0 0.5px #707070;\n background-color: #e4e4e4;\n }\n }\n"])),videoAttachmentRoundedCornerSize);var templateObject_1$1p;var EventDetailViewPeopleInfo=function EventDetailViewPeopleInfo(){var item=useDetailViewContext().item;return jsx$1(StyledEventPeopleInfo,{item:item},void 0);};var StyledEventPeopleInfo=_styled(EventPeopleInfo).withConfig({displayName:"EventDetailViewPeopleInfo__StyledEventPeopleInfo",componentId:"sc-1d42bpm-0"})(templateObject_1$1o||(templateObject_1$1o=__makeTemplateObject(["\n margin: ","px 0;\n"],["\n margin: ","px 0;\n"])),spacingS);var templateObject_1$1o;var EventDetailViewLocationInfo=function EventDetailViewLocationInfo(){var item=useDetailViewContext().item;if(!item.locations||item.locations.length===0){return null;}return jsx$1(StyledEventLocationInfo,{locations:item.locations},void 0);};var StyledEventLocationInfo=_styled(EventLocationInfo).withConfig({displayName:"EventDetailViewLocationInfo__StyledEventLocationInfo",componentId:"sc-4kfe0w-0"})(templateObject_1$1n||(templateObject_1$1n=__makeTemplateObject(["\n margin: ","px 0;\n"],["\n margin: ","px 0;\n"])),spacingS);var templateObject_1$1n;var EventDetailViewMetaInfo=function EventDetailViewMetaInfo(_a){var allowFilterByChannels=_a.allowFilterByChannels;var _b=useDetailViewContext(),item=_b.item,userPreferredLanguage=_b.userPreferredLanguage;return jsxs(Fragment,{children:[jsx$1(EventDetailViewLocationInfo,{},void 0),jsx$1(EventDetailViewPeopleInfo,{},void 0),jsx$1(EventChannelsDisplay,{item:item,language:userPreferredLanguage,allowFilterByChannels:allowFilterByChannels},void 0)]},void 0);};var EventDetailViewDatesInfo=function EventDetailViewDatesInfo(_a){var className=_a.className;var item=useDetailViewContext().item;return jsx$1(Host$w,{children:jsx$1(DateTimeRange,{className:className,startDate:item.startDate,endDate:item.endDate},void 0)},void 0);};var Host$w=_styled.div.withConfig({displayName:"EventDetailViewDatesInfo__Host",componentId:"sc-3sblty-0"})(templateObject_1$1m||(templateObject_1$1m=__makeTemplateObject(["\n font-size: ","px;\n margin-bottom: ","px;\n font-weight: 500;\n"],["\n font-size: ","px;\n margin-bottom: ","px;\n font-weight: 500;\n"])),fontSizeSmall,spacingM);var templateObject_1$1m;var PollUserContext=/*#__PURE__*/createContext(null);var DetailViewPollsSubmitButton=function DetailViewPollsSubmitButton(_a){var isReadOnly=_a.isReadOnly;var formatMessage=useIntl().formatMessage;var _b=useContext(PollUserContext),submitPoll=_b.submitPoll,hasMissingUnsavedAnswer=_b.hasMissingUnsavedAnswer,hasMissingAnswers=_b.hasMissingAnswers,answers=_b.answers,resourceType=_b.resourceType,item=_b.item;var updatePollAnswers=useFeedbackApi().updatePollAnswers;if(!hasMissingUnsavedAnswer){return null;}return jsx$1("div",{children:jsx$1(PrimaryButton,{"data-poll-submit-button":true,onClick:function(){return submitPoll(function(){return updatePollAnswers(resourceType,item.id,answers);});},text:formatMessage({id:'Polls.display.submitButtonCaption'}),disabled:hasMissingAnswers||isReadOnly},void 0)},void 0);};var DetailViewCsvExportButton=function DetailViewCsvExportButton(_a){var path=_a.path,stringResource=_a.stringResource,className=_a.className;var user=useCurrentUser();var createApiUrl=useApiFactory().createApiUrl;var exchangeShortLivedToken=useFileAccessTokenApi().exchangeShortLivedToken;var _b=useDetailViewContext(),item=_b.item,resourceType=_b.resourceType;if(!hasMinRoleInSomeGroups(GroupRoles.Author,user,item)){return null;}return jsx$1(Host$v,__assign({className:className},{children:jsxs(DownloadButton$2,__assign({onClick:startDownload},{children:[jsx$1(LeftAlignedIcon,{iconName:"Download"},void 0),jsx$1(FormattedMessage$1,{id:stringResource},void 0)]}),void 0)}),void 0);function startDownload(){return __awaiter(this,void 0,void 0,function(){var token;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,exchangeShortLivedToken(item.fileAccessToken)];case 1:token=_a.sent();window.open(getFileUrlWithToken(item.id,token||item.fileAccessToken));return [2/*return*/];}});});}function getFileUrlWithToken(itemId,fileDownloadToken){return createApiUrl("/"+resourceType+"/"+itemId+"/"+path,{access_token:fileDownloadToken});}};var Host$v=_styled.div.withConfig({displayName:"DetailViewCsvExportButton__Host",componentId:"sc-n02scx-0"})(templateObject_1$1l||(templateObject_1$1l=__makeTemplateObject(["\n display: flex;\n"],["\n display: flex;\n"])));var DownloadButton$2=_styled(DefaultButton).withConfig({displayName:"DetailViewCsvExportButton__DownloadButton",componentId:"sc-n02scx-1"})(templateObject_2$P||(templateObject_2$P=__makeTemplateObject(["\n display: flex;\n align-items: center;\n align-self: flex-start;\n color: ",";\n border: 0;\n padding: 0;\n margin: 0;\n\n &:hover {\n background-color: initial;\n color: ",";\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"],["\n display: flex;\n align-items: center;\n align-self: flex-start;\n color: ",";\n border: 0;\n padding: 0;\n margin: 0;\n\n &:hover {\n background-color: initial;\n color: ",";\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"])),function(p){return p.theme.textColors.default;},function(p){return p.theme.textColors.default;},maxScreenSize.medium,fontSizeSmall);var LeftAlignedIcon=_styled(Icon).withConfig({displayName:"DetailViewCsvExportButton__LeftAlignedIcon",componentId:"sc-n02scx-2"})(templateObject_3$y||(templateObject_3$y=__makeTemplateObject(["\n margin-left: -2px; // remove the 2px space this icon has on the left side\n margin-right: 5px;\n color: ",";\n"],["\n margin-left: -2px; // remove the 2px space this icon has on the left side\n margin-right: 5px;\n color: ",";\n"])),function(p){return p.theme.textColors.default;});var templateObject_1$1l,templateObject_2$P,templateObject_3$y;var DetailViewPollExportButton=function DetailViewPollExportButton(_a){var className=_a.className;var features=useFeatures();if(!features.polls){return null;}return jsx$1(DetailViewCsvExportButton,{className:className,path:"feedback/poll/result/export",stringResource:"Polls.display.exportAsCsv"},void 0);};var PollTranslationContext=/*#__PURE__*/createContext(null);var PollTranslationContextProvider=function PollTranslationContextProvider(_a){var contents=_a.contents,language=_a.language,additionalTranslations=_a.additionalTranslations,children=_a.children;var user=useCurrentUser();var activeContents=Object.values(contents||{}).filter(function(c){return c.active;});var allLanguages=activeContents.map(function(c){return c.language;});var allTranslations=additionalTranslations||[];for(var _i=0,_b=activeContents.filter(function(c){return c.poll&&c.poll.questions;});_i<_b.length;_i++){var content=_b[_i];var language_1=content.language;for(var _c=0,_d=content.poll.questions;_c<_d.length;_c++){var question=_d[_c];allTranslations.push({language:language_1,id:question.questionId,text:question.text});for(var _e=0,_f=question.choices;_e<_f.length;_e++){var choice=_f[_e];allTranslations.push({language:language_1,id:choice.choiceId,text:choice.text});}}}return jsx$1(PollTranslationContext.Provider,__assign({value:{getAllTranslations:getAllTranslations,getTranslation:getTranslation}},{children:jsx$1(Fragment,{children:children},void 0)}),void 0);function getAllTranslations(id){return allTranslations.filter(function(t){return t.id===id&&t.text;});}function getTranslation(id){var preferredLanguage=NewsService.getUserPreferredLanguage(allLanguages,user);var translationItems=getAllTranslations(id);var translation=translationItems.find(function(t){return t.language===language;})||translationItems.find(function(t){return t.language===preferredLanguage;})||translationItems[0];return translation?translation.text:null;}};var PollUserInput=function PollUserInput(){var _a=useContext(PollUserContext),questions=_a.questions,getQuestionResult=_a.getQuestionResult,addAnswer=_a.addAnswer;return jsx$1("div",{children:questions.map(function(q){return jsx$1(QuestionInputItem,{question:q,onChange:function(choiceIds){return handleQuestionChange(q,choiceIds);},result:getQuestionResult(q.questionId)},q.questionId);})},void 0);function handleQuestionChange(question,choiceIds){addAnswer(question.questionId,choiceIds);}};var QuestionInput=function QuestionInput(_a){var question=_a.question,onChange=_a.onChange,result=_a.result,className=_a.className;var getTranslation=useContext(PollTranslationContext).getTranslation;var questionText=getTranslation(question.questionId);return jsxs("div",__assign({className:className,"data-question-id":question.questionId,"data-question-text":questionText},{children:[jsx$1(QuestionText,{children:questionText},void 0),question.isMultiChoice&&jsx$1(MultiChoiceQuestionInput,{question:question,onChange:onChange,result:result},void 0),!question.isMultiChoice&&jsx$1(SingleChoiceQuestionInput,{question:question,onChange:function(choiceId){return onChange([choiceId]);},result:result},void 0)]}),void 0);};var MultiChoiceQuestionInput=function MultiChoiceQuestionInput(_a){var question=_a.question,result=_a.result,onChange=_a.onChange;var getTranslation=useContext(PollTranslationContext).getTranslation;return jsx$1("div",{children:question.choices.map(function(c){return jsx$1(StyledCheckbox$1,{isResultMode:result.showResults,disabled:result.showResults||c.disabled,checked:result.userSelectedChoices.some(function(sc){return sc===c.choiceId;}),onChange:function(_,isChecked){return handleMultipleChoiceChange(c.choiceId,isChecked);},label:getTranslation(c.choiceId),onRenderLabel:function(_){return jsx$1(MultiChoiceLabel,{choice:c,result:result},void 0);}},c.choiceId);})},void 0);function handleMultipleChoiceChange(choiceId,isSelected){var choiceIds=result.userSelectedChoices.filter(function(c){return c!==choiceId;});if(isSelected){choiceIds.push(choiceId);}onChange(choiceIds);}};var SingleChoiceQuestionInput=function SingleChoiceQuestionInput(_a){var question=_a.question,onChange=_a.onChange,result=_a.result;var getTranslation=useContext(PollTranslationContext).getTranslation;return jsx$1(ChoiceInput,{isResultMode:result.showResults,selectedKey:result.userSelectedChoices[0],onChange:function(_,option){return onChange(option.key);},options:question.choices.map(function(c){return {key:c.choiceId,choiceId:c.choiceId,text:getTranslation(c.choiceId),disabled:result.showResults||c.disabled,onRenderLabel:function(_){return jsx$1(SingleChoiceLabel,{choice:c,result:result},void 0);}};})},void 0);};var ChoiceLabel=function ChoiceLabel(_a){var choice=_a.choice,result=_a.result,className=_a.className;var getTranslation=useContext(PollTranslationContext).getTranslation;var choiceText=getTranslation(choice.choiceId);return jsxs(ChoiceLabelHost,__assign({isResultMode:result.showResults,className:className,"data-choice-id":choice.choiceId,"data-choice-text":choiceText},{children:[choiceText,choice.description&&jsx$1(ChoiceLabelSecondaryText,__assign({"data-choice-secondary-text":true},{children:choice.description}),void 0),result.showResults&&jsx$1(ChoiceResult,{result:result,choiceId:choice.choiceId},void 0)]}),void 0);};var ChoiceResult=function ChoiceResult(_a){var choiceId=_a.choiceId,result=_a.result;var numberResult=result.choiceResults[choiceId]||0;var percent=numberResult/result.totalFeedbackCount;var palette=useContext(ThemeContext$1).theme.palette;return jsxs(ChoiceResultHost,__assign({"data-choice-result":numberResult},{children:[jsx$1(Bar,{percentComplete:percent,barHeight:10,styles:{progressBar:{backgroundColor:palette.accent}}},void 0),jsx$1("span",{children:jsx$1(FormattedNumber,{value:numberResult},void 0)},void 0)]}),void 0);};var ChoiceResultHost=_styled.div.withConfig({displayName:"PollUserInput__ChoiceResultHost",componentId:"sc-eeg1mx-0"})(templateObject_1$1k||(templateObject_1$1k=__makeTemplateObject(["\n display: flex;\n align-items: center;\n\n > span {\n padding-left: 10px;\n min-width: 44px;\n text-align: right;\n box-sizing: border-box;\n }\n"],["\n display: flex;\n align-items: center;\n\n > span {\n padding-left: 10px;\n min-width: 44px;\n text-align: right;\n box-sizing: border-box;\n }\n"])));var Bar=_styled(ProgressIndicator).withConfig({displayName:"PollUserInput__Bar",componentId:"sc-eeg1mx-1"})(templateObject_2$O||(templateObject_2$O=__makeTemplateObject(["\n flex: 1 0 auto;\n"],["\n flex: 1 0 auto;\n"])));var QuestionText=_styled.div.withConfig({displayName:"PollUserInput__QuestionText",componentId:"sc-eeg1mx-2"})(templateObject_3$x||(templateObject_3$x=__makeTemplateObject(["\n font-weight: bold;\n"],["\n font-weight: bold;\n"])));var QuestionInputItem=_styled(QuestionInput).withConfig({displayName:"PollUserInput__QuestionInputItem",componentId:"sc-eeg1mx-3"})(templateObject_4$n||(templateObject_4$n=__makeTemplateObject(["\n margin-bottom: ","px;\n"],["\n margin-bottom: ","px;\n"])),spacingL);var ChoiceLabelHost=_styled.span.withConfig({displayName:"PollUserInput__ChoiceLabelHost",componentId:"sc-eeg1mx-4"})(templateObject_5$l||(templateObject_5$l=__makeTemplateObject(["\n display: inline-block;\n ","\n ","\n"],["\n display: inline-block;\n ","\n ","\n"])),function(p){return p.isResultMode&&'max-width: 400px;';},function(p){return p.isResultMode&&'width: 100%;';});var ChoiceLabelSecondaryText=_styled.div.withConfig({displayName:"PollUserInput__ChoiceLabelSecondaryText",componentId:"sc-eeg1mx-5"})(templateObject_6$e||(templateObject_6$e=__makeTemplateObject(["\n opacity: 0.75;\n"],["\n opacity: 0.75;\n"])));var SingleChoiceLabel=_styled(ChoiceLabel).withConfig({displayName:"PollUserInput__SingleChoiceLabel",componentId:"sc-eeg1mx-6"})(templateObject_7$9||(templateObject_7$9=__makeTemplateObject(["\n padding-left: 30px;\n"],["\n padding-left: 30px;\n"])));var MultiChoiceLabel=_styled(ChoiceLabel).withConfig({displayName:"PollUserInput__MultiChoiceLabel",componentId:"sc-eeg1mx-7"})(templateObject_8$8||(templateObject_8$8=__makeTemplateObject(["\n padding-left: 5px;\n"],["\n padding-left: 5px;\n"])));var ChoiceInput=_styled(ChoiceGroup).withConfig({displayName:"PollUserInput__ChoiceInput",componentId:"sc-eeg1mx-8"})(templateObject_9$6||(templateObject_9$6=__makeTemplateObject(["\n .ms-ChoiceField-field,\n .ms-ChoiceField-wrapper {\n position: relative;\n flex: 1 1 auto;\n display: flex;\n }\n"],["\n .ms-ChoiceField-field,\n .ms-ChoiceField-wrapper {\n position: relative;\n flex: 1 1 auto;\n display: flex;\n }\n"])));var StyledCheckbox$1=_styled(Checkbox).withConfig({displayName:"PollUserInput__StyledCheckbox",componentId:"sc-eeg1mx-9"})(templateObject_10$5||(templateObject_10$5=__makeTemplateObject(["\n margin-top: 15px;\n .ms-Checkbox-label {\n display: flex;\n align-items: ",";\n flex: 1 1 auto;\n }\n"],["\n margin-top: 15px;\n .ms-Checkbox-label {\n display: flex;\n align-items: ",";\n flex: 1 1 auto;\n }\n"])),function(p){return p.isResultMode?'flex-start':'center';});var templateObject_1$1k,templateObject_2$O,templateObject_3$x,templateObject_4$n,templateObject_5$l,templateObject_6$e,templateObject_7$9,templateObject_8$8,templateObject_9$6,templateObject_10$5;var PollDisplay=function PollDisplay(_a){var children=_a.children,className=_a.className;var formatMessage=useIntl().formatMessage;return jsxs("section",__assign({className:className,"aria-label":formatMessage({id:'Polls.sectionLabel'}),"data-consumer-poll":true},{children:[jsx$1(PollUserInput,{},void 0),children]}),void 0);};var PollUserContextProvider=function PollUserContextProvider(_a){var _b;var item=_a.item,onBehalfOfUpn=_a.onBehalfOfUpn,resourceType=_a.resourceType,language=_a.language,getAdditionalQuestions=_a.getAdditionalQuestions,getAdditionalUserAnswers=_a.getAdditionalUserAnswers,getPollResults=_a.getPollResults,showResult=_a.showResult,children=_a.children;var poll=item.poll,itemId=item.id;var getFeedback=useFeedbackApi().getFeedback;var _c=useState$2(getAdditionalQuestions===null||getAdditionalQuestions===void 0?void 0:getAdditionalQuestions(null)),additionalQuestions=_c[0],setAdditionalQuestions=_c[1];var showError=useNotificationContext().showError;var questionDefinitions=(_b=poll===null||poll===void 0?void 0:poll.questions)!==null&&_b!==void 0?_b:[];var _d=usePromise$2(loadUserAnswers),userAnswers=_d[0],isLoading=_d[1],setUserAnswers=_d[3];var _e=useState$2([]),unsavedQuestionsIds=_e[0],setUnsavedQuestionsIds=_e[1];var _f=usePromise$2(function(){return getPollResults(itemId);},{answers:[]},[itemId]),pollResult=_f[0],isLoadingPollResult=_f[1],fetchPollResults=_f[5];useEffect$1(function(){var _a;if(isLoadingPollResult||!((_a=pollResult===null||pollResult===void 0?void 0:pollResult.answers)===null||_a===void 0?void 0:_a.length)){return;}getAdditionalQuestions&&setAdditionalQuestions(getAdditionalQuestions(pollResult));// eslint-disable-next-line react-hooks/exhaustive-deps
131799
131799
  },[pollResult,isLoadingPollResult]);// If the pollResult and the choice input is rendered with showResults
131800
131800
  // at the same time, we miss the animation of the bars when they fill up
131801
131801
  // Delay the pollResult a bit so the users sees the animation
@@ -135371,6 +135371,36 @@ function addMonths(dirtyDate, dirtyAmount) {
135371
135371
  }
135372
135372
  }
135373
135373
 
135374
+ /**
135375
+ * @name addMilliseconds
135376
+ * @category Millisecond Helpers
135377
+ * @summary Add the specified number of milliseconds to the given date.
135378
+ *
135379
+ * @description
135380
+ * Add the specified number of milliseconds to the given date.
135381
+ *
135382
+ * ### v2.0.0 breaking changes:
135383
+ *
135384
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
135385
+ *
135386
+ * @param {Date|Number} date - the date to be changed
135387
+ * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
135388
+ * @returns {Date} the new date with the milliseconds added
135389
+ * @throws {TypeError} 2 arguments required
135390
+ *
135391
+ * @example
135392
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
135393
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
135394
+ * //=> Thu Jul 10 2014 12:45:30.750
135395
+ */
135396
+
135397
+ function addMilliseconds(dirtyDate, dirtyAmount) {
135398
+ requiredArgs(2, arguments);
135399
+ var timestamp = toDate(dirtyDate).getTime();
135400
+ var amount = toInteger(dirtyAmount);
135401
+ return new Date(timestamp + amount);
135402
+ }
135403
+
135374
135404
  /**
135375
135405
  * @name startOfWeek
135376
135406
  * @category Week Helpers
@@ -135423,6 +135453,23 @@ function startOfWeek(dirtyDate, dirtyOptions) {
135423
135453
  return date;
135424
135454
  }
135425
135455
 
135456
+ /**
135457
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
135458
+ * They usually appear for dates that denote time before the timezones were introduced
135459
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
135460
+ * and GMT+01:00:00 after that date)
135461
+ *
135462
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
135463
+ * which would lead to incorrect calculations.
135464
+ *
135465
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
135466
+ */
135467
+ function getTimezoneOffsetInMilliseconds(date) {
135468
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
135469
+ utcDate.setUTCFullYear(date.getFullYear());
135470
+ return date.getTime() - utcDate.getTime();
135471
+ }
135472
+
135426
135473
  /**
135427
135474
  * @name startOfDay
135428
135475
  * @category Day Helpers
@@ -135453,6 +135500,117 @@ function startOfDay(dirtyDate) {
135453
135500
  return date;
135454
135501
  }
135455
135502
 
135503
+ /**
135504
+ * @name isDate
135505
+ * @category Common Helpers
135506
+ * @summary Is the given value a date?
135507
+ *
135508
+ * @description
135509
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
135510
+ *
135511
+ * ### v2.0.0 breaking changes:
135512
+ *
135513
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
135514
+ *
135515
+ * @param {*} value - the value to check
135516
+ * @returns {boolean} true if the given value is a date
135517
+ * @throws {TypeError} 1 arguments required
135518
+ *
135519
+ * @example
135520
+ * // For a valid date:
135521
+ * const result = isDate(new Date())
135522
+ * //=> true
135523
+ *
135524
+ * @example
135525
+ * // For an invalid date:
135526
+ * const result = isDate(new Date(NaN))
135527
+ * //=> true
135528
+ *
135529
+ * @example
135530
+ * // For some value:
135531
+ * const result = isDate('2014-02-31')
135532
+ * //=> false
135533
+ *
135534
+ * @example
135535
+ * // For an object:
135536
+ * const result = isDate({})
135537
+ * //=> false
135538
+ */
135539
+
135540
+ function isDate(value) {
135541
+ requiredArgs(1, arguments);
135542
+ return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
135543
+ }
135544
+
135545
+ /**
135546
+ * @name isValid
135547
+ * @category Common Helpers
135548
+ * @summary Is the given date valid?
135549
+ *
135550
+ * @description
135551
+ * Returns false if argument is Invalid Date and true otherwise.
135552
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
135553
+ * Invalid Date is a Date, whose time value is NaN.
135554
+ *
135555
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
135556
+ *
135557
+ * ### v2.0.0 breaking changes:
135558
+ *
135559
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
135560
+ *
135561
+ * - Now `isValid` doesn't throw an exception
135562
+ * if the first argument is not an instance of Date.
135563
+ * Instead, argument is converted beforehand using `toDate`.
135564
+ *
135565
+ * Examples:
135566
+ *
135567
+ * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
135568
+ * |---------------------------|---------------|---------------|
135569
+ * | `new Date()` | `true` | `true` |
135570
+ * | `new Date('2016-01-01')` | `true` | `true` |
135571
+ * | `new Date('')` | `false` | `false` |
135572
+ * | `new Date(1488370835081)` | `true` | `true` |
135573
+ * | `new Date(NaN)` | `false` | `false` |
135574
+ * | `'2016-01-01'` | `TypeError` | `false` |
135575
+ * | `''` | `TypeError` | `false` |
135576
+ * | `1488370835081` | `TypeError` | `true` |
135577
+ * | `NaN` | `TypeError` | `false` |
135578
+ *
135579
+ * We introduce this change to make *date-fns* consistent with ECMAScript behavior
135580
+ * that try to coerce arguments to the expected type
135581
+ * (which is also the case with other *date-fns* functions).
135582
+ *
135583
+ * @param {*} date - the date to check
135584
+ * @returns {Boolean} the date is valid
135585
+ * @throws {TypeError} 1 argument required
135586
+ *
135587
+ * @example
135588
+ * // For the valid date:
135589
+ * const result = isValid(new Date(2014, 1, 31))
135590
+ * //=> true
135591
+ *
135592
+ * @example
135593
+ * // For the value, convertable into a date:
135594
+ * const result = isValid(1393804800000)
135595
+ * //=> true
135596
+ *
135597
+ * @example
135598
+ * // For the invalid date:
135599
+ * const result = isValid(new Date(''))
135600
+ * //=> false
135601
+ */
135602
+
135603
+ function isValid(dirtyDate) {
135604
+ requiredArgs(1, arguments);
135605
+
135606
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
135607
+ return false;
135608
+ }
135609
+
135610
+ var date = toDate(dirtyDate);
135611
+ return !isNaN(Number(date));
135612
+ }
135613
+
135456
135614
  /**
135457
135615
  * @name endOfDay
135458
135616
  * @category Day Helpers
@@ -135597,6 +135755,2200 @@ function endOfWeek(dirtyDate, dirtyOptions) {
135597
135755
  return date;
135598
135756
  }
135599
135757
 
135758
+ var formatDistanceLocale = {
135759
+ lessThanXSeconds: {
135760
+ one: 'less than a second',
135761
+ other: 'less than {{count}} seconds'
135762
+ },
135763
+ xSeconds: {
135764
+ one: '1 second',
135765
+ other: '{{count}} seconds'
135766
+ },
135767
+ halfAMinute: 'half a minute',
135768
+ lessThanXMinutes: {
135769
+ one: 'less than a minute',
135770
+ other: 'less than {{count}} minutes'
135771
+ },
135772
+ xMinutes: {
135773
+ one: '1 minute',
135774
+ other: '{{count}} minutes'
135775
+ },
135776
+ aboutXHours: {
135777
+ one: 'about 1 hour',
135778
+ other: 'about {{count}} hours'
135779
+ },
135780
+ xHours: {
135781
+ one: '1 hour',
135782
+ other: '{{count}} hours'
135783
+ },
135784
+ xDays: {
135785
+ one: '1 day',
135786
+ other: '{{count}} days'
135787
+ },
135788
+ aboutXWeeks: {
135789
+ one: 'about 1 week',
135790
+ other: 'about {{count}} weeks'
135791
+ },
135792
+ xWeeks: {
135793
+ one: '1 week',
135794
+ other: '{{count}} weeks'
135795
+ },
135796
+ aboutXMonths: {
135797
+ one: 'about 1 month',
135798
+ other: 'about {{count}} months'
135799
+ },
135800
+ xMonths: {
135801
+ one: '1 month',
135802
+ other: '{{count}} months'
135803
+ },
135804
+ aboutXYears: {
135805
+ one: 'about 1 year',
135806
+ other: 'about {{count}} years'
135807
+ },
135808
+ xYears: {
135809
+ one: '1 year',
135810
+ other: '{{count}} years'
135811
+ },
135812
+ overXYears: {
135813
+ one: 'over 1 year',
135814
+ other: 'over {{count}} years'
135815
+ },
135816
+ almostXYears: {
135817
+ one: 'almost 1 year',
135818
+ other: 'almost {{count}} years'
135819
+ }
135820
+ };
135821
+
135822
+ var formatDistance = function (token, count, options) {
135823
+ var result;
135824
+ var tokenValue = formatDistanceLocale[token];
135825
+
135826
+ if (typeof tokenValue === 'string') {
135827
+ result = tokenValue;
135828
+ } else if (count === 1) {
135829
+ result = tokenValue.one;
135830
+ } else {
135831
+ result = tokenValue.other.replace('{{count}}', count.toString());
135832
+ }
135833
+
135834
+ if (options !== null && options !== void 0 && options.addSuffix) {
135835
+ if (options.comparison && options.comparison > 0) {
135836
+ return 'in ' + result;
135837
+ } else {
135838
+ return result + ' ago';
135839
+ }
135840
+ }
135841
+
135842
+ return result;
135843
+ };
135844
+
135845
+ var formatDistance$1 = formatDistance;
135846
+
135847
+ function buildFormatLongFn(args) {
135848
+ return function () {
135849
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
135850
+ // TODO: Remove String()
135851
+ var width = options.width ? String(options.width) : args.defaultWidth;
135852
+ var format = args.formats[width] || args.formats[args.defaultWidth];
135853
+ return format;
135854
+ };
135855
+ }
135856
+
135857
+ var dateFormats = {
135858
+ full: 'EEEE, MMMM do, y',
135859
+ long: 'MMMM do, y',
135860
+ medium: 'MMM d, y',
135861
+ short: 'MM/dd/yyyy'
135862
+ };
135863
+ var timeFormats = {
135864
+ full: 'h:mm:ss a zzzz',
135865
+ long: 'h:mm:ss a z',
135866
+ medium: 'h:mm:ss a',
135867
+ short: 'h:mm a'
135868
+ };
135869
+ var dateTimeFormats = {
135870
+ full: "{{date}} 'at' {{time}}",
135871
+ long: "{{date}} 'at' {{time}}",
135872
+ medium: '{{date}}, {{time}}',
135873
+ short: '{{date}}, {{time}}'
135874
+ };
135875
+ var formatLong = {
135876
+ date: buildFormatLongFn({
135877
+ formats: dateFormats,
135878
+ defaultWidth: 'full'
135879
+ }),
135880
+ time: buildFormatLongFn({
135881
+ formats: timeFormats,
135882
+ defaultWidth: 'full'
135883
+ }),
135884
+ dateTime: buildFormatLongFn({
135885
+ formats: dateTimeFormats,
135886
+ defaultWidth: 'full'
135887
+ })
135888
+ };
135889
+ var formatLong$1 = formatLong;
135890
+
135891
+ var formatRelativeLocale = {
135892
+ lastWeek: "'last' eeee 'at' p",
135893
+ yesterday: "'yesterday at' p",
135894
+ today: "'today at' p",
135895
+ tomorrow: "'tomorrow at' p",
135896
+ nextWeek: "eeee 'at' p",
135897
+ other: 'P'
135898
+ };
135899
+
135900
+ var formatRelative = function (token, _date, _baseDate, _options) {
135901
+ return formatRelativeLocale[token];
135902
+ };
135903
+
135904
+ var formatRelative$1 = formatRelative;
135905
+
135906
+ function buildLocalizeFn(args) {
135907
+ return function (dirtyIndex, dirtyOptions) {
135908
+ var options = dirtyOptions || {};
135909
+ var context = options.context ? String(options.context) : 'standalone';
135910
+ var valuesArray;
135911
+
135912
+ if (context === 'formatting' && args.formattingValues) {
135913
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
135914
+ var width = options.width ? String(options.width) : defaultWidth;
135915
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
135916
+ } else {
135917
+ var _defaultWidth = args.defaultWidth;
135918
+
135919
+ var _width = options.width ? String(options.width) : args.defaultWidth;
135920
+
135921
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
135922
+ }
135923
+
135924
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challange you to try to remove it!
135925
+
135926
+ return valuesArray[index];
135927
+ };
135928
+ }
135929
+
135930
+ var eraValues = {
135931
+ narrow: ['B', 'A'],
135932
+ abbreviated: ['BC', 'AD'],
135933
+ wide: ['Before Christ', 'Anno Domini']
135934
+ };
135935
+ var quarterValues = {
135936
+ narrow: ['1', '2', '3', '4'],
135937
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
135938
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
135939
+ }; // Note: in English, the names of days of the week and months are capitalized.
135940
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
135941
+ // Generally, formatted dates should look like they are in the middle of a sentence,
135942
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
135943
+
135944
+ var monthValues = {
135945
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
135946
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
135947
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
135948
+ };
135949
+ var dayValues = {
135950
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
135951
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
135952
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
135953
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
135954
+ };
135955
+ var dayPeriodValues = {
135956
+ narrow: {
135957
+ am: 'a',
135958
+ pm: 'p',
135959
+ midnight: 'mi',
135960
+ noon: 'n',
135961
+ morning: 'morning',
135962
+ afternoon: 'afternoon',
135963
+ evening: 'evening',
135964
+ night: 'night'
135965
+ },
135966
+ abbreviated: {
135967
+ am: 'AM',
135968
+ pm: 'PM',
135969
+ midnight: 'midnight',
135970
+ noon: 'noon',
135971
+ morning: 'morning',
135972
+ afternoon: 'afternoon',
135973
+ evening: 'evening',
135974
+ night: 'night'
135975
+ },
135976
+ wide: {
135977
+ am: 'a.m.',
135978
+ pm: 'p.m.',
135979
+ midnight: 'midnight',
135980
+ noon: 'noon',
135981
+ morning: 'morning',
135982
+ afternoon: 'afternoon',
135983
+ evening: 'evening',
135984
+ night: 'night'
135985
+ }
135986
+ };
135987
+ var formattingDayPeriodValues = {
135988
+ narrow: {
135989
+ am: 'a',
135990
+ pm: 'p',
135991
+ midnight: 'mi',
135992
+ noon: 'n',
135993
+ morning: 'in the morning',
135994
+ afternoon: 'in the afternoon',
135995
+ evening: 'in the evening',
135996
+ night: 'at night'
135997
+ },
135998
+ abbreviated: {
135999
+ am: 'AM',
136000
+ pm: 'PM',
136001
+ midnight: 'midnight',
136002
+ noon: 'noon',
136003
+ morning: 'in the morning',
136004
+ afternoon: 'in the afternoon',
136005
+ evening: 'in the evening',
136006
+ night: 'at night'
136007
+ },
136008
+ wide: {
136009
+ am: 'a.m.',
136010
+ pm: 'p.m.',
136011
+ midnight: 'midnight',
136012
+ noon: 'noon',
136013
+ morning: 'in the morning',
136014
+ afternoon: 'in the afternoon',
136015
+ evening: 'in the evening',
136016
+ night: 'at night'
136017
+ }
136018
+ };
136019
+
136020
+ var ordinalNumber = function (dirtyNumber, _options) {
136021
+ var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
136022
+ // if they are different for different grammatical genders,
136023
+ // use `options.unit`.
136024
+ //
136025
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
136026
+ // 'day', 'hour', 'minute', 'second'.
136027
+
136028
+ var rem100 = number % 100;
136029
+
136030
+ if (rem100 > 20 || rem100 < 10) {
136031
+ switch (rem100 % 10) {
136032
+ case 1:
136033
+ return number + 'st';
136034
+
136035
+ case 2:
136036
+ return number + 'nd';
136037
+
136038
+ case 3:
136039
+ return number + 'rd';
136040
+ }
136041
+ }
136042
+
136043
+ return number + 'th';
136044
+ };
136045
+
136046
+ var localize = {
136047
+ ordinalNumber: ordinalNumber,
136048
+ era: buildLocalizeFn({
136049
+ values: eraValues,
136050
+ defaultWidth: 'wide'
136051
+ }),
136052
+ quarter: buildLocalizeFn({
136053
+ values: quarterValues,
136054
+ defaultWidth: 'wide',
136055
+ argumentCallback: function (quarter) {
136056
+ return quarter - 1;
136057
+ }
136058
+ }),
136059
+ month: buildLocalizeFn({
136060
+ values: monthValues,
136061
+ defaultWidth: 'wide'
136062
+ }),
136063
+ day: buildLocalizeFn({
136064
+ values: dayValues,
136065
+ defaultWidth: 'wide'
136066
+ }),
136067
+ dayPeriod: buildLocalizeFn({
136068
+ values: dayPeriodValues,
136069
+ defaultWidth: 'wide',
136070
+ formattingValues: formattingDayPeriodValues,
136071
+ defaultFormattingWidth: 'wide'
136072
+ })
136073
+ };
136074
+ var localize$1 = localize;
136075
+
136076
+ function buildMatchFn(args) {
136077
+ return function (string) {
136078
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
136079
+ var width = options.width;
136080
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
136081
+ var matchResult = string.match(matchPattern);
136082
+
136083
+ if (!matchResult) {
136084
+ return null;
136085
+ }
136086
+
136087
+ var matchedString = matchResult[0];
136088
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
136089
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
136090
+ return pattern.test(matchedString);
136091
+ }) : findKey(parsePatterns, function (pattern) {
136092
+ return pattern.test(matchedString);
136093
+ });
136094
+ var value;
136095
+ value = args.valueCallback ? args.valueCallback(key) : key;
136096
+ value = options.valueCallback ? options.valueCallback(value) : value;
136097
+ var rest = string.slice(matchedString.length);
136098
+ return {
136099
+ value: value,
136100
+ rest: rest
136101
+ };
136102
+ };
136103
+ }
136104
+
136105
+ function findKey(object, predicate) {
136106
+ for (var key in object) {
136107
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
136108
+ return key;
136109
+ }
136110
+ }
136111
+
136112
+ return undefined;
136113
+ }
136114
+
136115
+ function findIndex(array, predicate) {
136116
+ for (var key = 0; key < array.length; key++) {
136117
+ if (predicate(array[key])) {
136118
+ return key;
136119
+ }
136120
+ }
136121
+
136122
+ return undefined;
136123
+ }
136124
+
136125
+ function buildMatchPatternFn(args) {
136126
+ return function (string) {
136127
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
136128
+ var matchResult = string.match(args.matchPattern);
136129
+ if (!matchResult) return null;
136130
+ var matchedString = matchResult[0];
136131
+ var parseResult = string.match(args.parsePattern);
136132
+ if (!parseResult) return null;
136133
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
136134
+ value = options.valueCallback ? options.valueCallback(value) : value;
136135
+ var rest = string.slice(matchedString.length);
136136
+ return {
136137
+ value: value,
136138
+ rest: rest
136139
+ };
136140
+ };
136141
+ }
136142
+
136143
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
136144
+ var parseOrdinalNumberPattern = /\d+/i;
136145
+ var matchEraPatterns = {
136146
+ narrow: /^(b|a)/i,
136147
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
136148
+ wide: /^(before christ|before common era|anno domini|common era)/i
136149
+ };
136150
+ var parseEraPatterns = {
136151
+ any: [/^b/i, /^(a|c)/i]
136152
+ };
136153
+ var matchQuarterPatterns = {
136154
+ narrow: /^[1234]/i,
136155
+ abbreviated: /^q[1234]/i,
136156
+ wide: /^[1234](th|st|nd|rd)? quarter/i
136157
+ };
136158
+ var parseQuarterPatterns = {
136159
+ any: [/1/i, /2/i, /3/i, /4/i]
136160
+ };
136161
+ var matchMonthPatterns = {
136162
+ narrow: /^[jfmasond]/i,
136163
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
136164
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
136165
+ };
136166
+ var parseMonthPatterns = {
136167
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
136168
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
136169
+ };
136170
+ var matchDayPatterns = {
136171
+ narrow: /^[smtwf]/i,
136172
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
136173
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
136174
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
136175
+ };
136176
+ var parseDayPatterns = {
136177
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
136178
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
136179
+ };
136180
+ var matchDayPeriodPatterns = {
136181
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
136182
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
136183
+ };
136184
+ var parseDayPeriodPatterns = {
136185
+ any: {
136186
+ am: /^a/i,
136187
+ pm: /^p/i,
136188
+ midnight: /^mi/i,
136189
+ noon: /^no/i,
136190
+ morning: /morning/i,
136191
+ afternoon: /afternoon/i,
136192
+ evening: /evening/i,
136193
+ night: /night/i
136194
+ }
136195
+ };
136196
+ var match = {
136197
+ ordinalNumber: buildMatchPatternFn({
136198
+ matchPattern: matchOrdinalNumberPattern,
136199
+ parsePattern: parseOrdinalNumberPattern,
136200
+ valueCallback: function (value) {
136201
+ return parseInt(value, 10);
136202
+ }
136203
+ }),
136204
+ era: buildMatchFn({
136205
+ matchPatterns: matchEraPatterns,
136206
+ defaultMatchWidth: 'wide',
136207
+ parsePatterns: parseEraPatterns,
136208
+ defaultParseWidth: 'any'
136209
+ }),
136210
+ quarter: buildMatchFn({
136211
+ matchPatterns: matchQuarterPatterns,
136212
+ defaultMatchWidth: 'wide',
136213
+ parsePatterns: parseQuarterPatterns,
136214
+ defaultParseWidth: 'any',
136215
+ valueCallback: function (index) {
136216
+ return index + 1;
136217
+ }
136218
+ }),
136219
+ month: buildMatchFn({
136220
+ matchPatterns: matchMonthPatterns,
136221
+ defaultMatchWidth: 'wide',
136222
+ parsePatterns: parseMonthPatterns,
136223
+ defaultParseWidth: 'any'
136224
+ }),
136225
+ day: buildMatchFn({
136226
+ matchPatterns: matchDayPatterns,
136227
+ defaultMatchWidth: 'wide',
136228
+ parsePatterns: parseDayPatterns,
136229
+ defaultParseWidth: 'any'
136230
+ }),
136231
+ dayPeriod: buildMatchFn({
136232
+ matchPatterns: matchDayPeriodPatterns,
136233
+ defaultMatchWidth: 'any',
136234
+ parsePatterns: parseDayPeriodPatterns,
136235
+ defaultParseWidth: 'any'
136236
+ })
136237
+ };
136238
+ var match$1 = match;
136239
+
136240
+ /**
136241
+ * @type {Locale}
136242
+ * @category Locales
136243
+ * @summary English locale (United States).
136244
+ * @language English
136245
+ * @iso-639-2 eng
136246
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
136247
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
136248
+ */
136249
+ var locale = {
136250
+ code: 'en-US',
136251
+ formatDistance: formatDistance$1,
136252
+ formatLong: formatLong$1,
136253
+ formatRelative: formatRelative$1,
136254
+ localize: localize$1,
136255
+ match: match$1,
136256
+ options: {
136257
+ weekStartsOn: 0
136258
+ /* Sunday */
136259
+ ,
136260
+ firstWeekContainsDate: 1
136261
+ }
136262
+ };
136263
+ var defaultLocale = locale;
136264
+
136265
+ /**
136266
+ * @name subMilliseconds
136267
+ * @category Millisecond Helpers
136268
+ * @summary Subtract the specified number of milliseconds from the given date.
136269
+ *
136270
+ * @description
136271
+ * Subtract the specified number of milliseconds from the given date.
136272
+ *
136273
+ * ### v2.0.0 breaking changes:
136274
+ *
136275
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
136276
+ *
136277
+ * @param {Date|Number} date - the date to be changed
136278
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
136279
+ * @returns {Date} the new date with the milliseconds subtracted
136280
+ * @throws {TypeError} 2 arguments required
136281
+ *
136282
+ * @example
136283
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
136284
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
136285
+ * //=> Thu Jul 10 2014 12:45:29.250
136286
+ */
136287
+
136288
+ function subMilliseconds(dirtyDate, dirtyAmount) {
136289
+ requiredArgs(2, arguments);
136290
+ var amount = toInteger(dirtyAmount);
136291
+ return addMilliseconds(dirtyDate, -amount);
136292
+ }
136293
+
136294
+ function addLeadingZeros(number, targetLength) {
136295
+ var sign = number < 0 ? '-' : '';
136296
+ var output = Math.abs(number).toString();
136297
+
136298
+ while (output.length < targetLength) {
136299
+ output = '0' + output;
136300
+ }
136301
+
136302
+ return sign + output;
136303
+ }
136304
+
136305
+ /*
136306
+ * | | Unit | | Unit |
136307
+ * |-----|--------------------------------|-----|--------------------------------|
136308
+ * | a | AM, PM | A* | |
136309
+ * | d | Day of month | D | |
136310
+ * | h | Hour [1-12] | H | Hour [0-23] |
136311
+ * | m | Minute | M | Month |
136312
+ * | s | Second | S | Fraction of second |
136313
+ * | y | Year (abs) | Y | |
136314
+ *
136315
+ * Letters marked by * are not implemented but reserved by Unicode standard.
136316
+ */
136317
+
136318
+ var formatters$2 = {
136319
+ // Year
136320
+ y: function (date, token) {
136321
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
136322
+ // | Year | y | yy | yyy | yyyy | yyyyy |
136323
+ // |----------|-------|----|-------|-------|-------|
136324
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
136325
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
136326
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
136327
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
136328
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
136329
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
136330
+
136331
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
136332
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
136333
+ },
136334
+ // Month
136335
+ M: function (date, token) {
136336
+ var month = date.getUTCMonth();
136337
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
136338
+ },
136339
+ // Day of the month
136340
+ d: function (date, token) {
136341
+ return addLeadingZeros(date.getUTCDate(), token.length);
136342
+ },
136343
+ // AM or PM
136344
+ a: function (date, token) {
136345
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
136346
+
136347
+ switch (token) {
136348
+ case 'a':
136349
+ case 'aa':
136350
+ return dayPeriodEnumValue.toUpperCase();
136351
+
136352
+ case 'aaa':
136353
+ return dayPeriodEnumValue;
136354
+
136355
+ case 'aaaaa':
136356
+ return dayPeriodEnumValue[0];
136357
+
136358
+ case 'aaaa':
136359
+ default:
136360
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
136361
+ }
136362
+ },
136363
+ // Hour [1-12]
136364
+ h: function (date, token) {
136365
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
136366
+ },
136367
+ // Hour [0-23]
136368
+ H: function (date, token) {
136369
+ return addLeadingZeros(date.getUTCHours(), token.length);
136370
+ },
136371
+ // Minute
136372
+ m: function (date, token) {
136373
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
136374
+ },
136375
+ // Second
136376
+ s: function (date, token) {
136377
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
136378
+ },
136379
+ // Fraction of second
136380
+ S: function (date, token) {
136381
+ var numberOfDigits = token.length;
136382
+ var milliseconds = date.getUTCMilliseconds();
136383
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
136384
+ return addLeadingZeros(fractionalSeconds, token.length);
136385
+ }
136386
+ };
136387
+ var formatters$3 = formatters$2;
136388
+
136389
+ var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
136390
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136391
+
136392
+ function getUTCDayOfYear(dirtyDate) {
136393
+ requiredArgs(1, arguments);
136394
+ var date = toDate(dirtyDate);
136395
+ var timestamp = date.getTime();
136396
+ date.setUTCMonth(0, 1);
136397
+ date.setUTCHours(0, 0, 0, 0);
136398
+ var startOfYearTimestamp = date.getTime();
136399
+ var difference = timestamp - startOfYearTimestamp;
136400
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
136401
+ }
136402
+
136403
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136404
+
136405
+ function startOfUTCISOWeek(dirtyDate) {
136406
+ requiredArgs(1, arguments);
136407
+ var weekStartsOn = 1;
136408
+ var date = toDate(dirtyDate);
136409
+ var day = date.getUTCDay();
136410
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
136411
+ date.setUTCDate(date.getUTCDate() - diff);
136412
+ date.setUTCHours(0, 0, 0, 0);
136413
+ return date;
136414
+ }
136415
+
136416
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136417
+
136418
+ function getUTCISOWeekYear(dirtyDate) {
136419
+ requiredArgs(1, arguments);
136420
+ var date = toDate(dirtyDate);
136421
+ var year = date.getUTCFullYear();
136422
+ var fourthOfJanuaryOfNextYear = new Date(0);
136423
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
136424
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
136425
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
136426
+ var fourthOfJanuaryOfThisYear = new Date(0);
136427
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
136428
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
136429
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
136430
+
136431
+ if (date.getTime() >= startOfNextYear.getTime()) {
136432
+ return year + 1;
136433
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
136434
+ return year;
136435
+ } else {
136436
+ return year - 1;
136437
+ }
136438
+ }
136439
+
136440
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136441
+
136442
+ function startOfUTCISOWeekYear(dirtyDate) {
136443
+ requiredArgs(1, arguments);
136444
+ var year = getUTCISOWeekYear(dirtyDate);
136445
+ var fourthOfJanuary = new Date(0);
136446
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
136447
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
136448
+ var date = startOfUTCISOWeek(fourthOfJanuary);
136449
+ return date;
136450
+ }
136451
+
136452
+ var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
136453
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136454
+
136455
+ function getUTCISOWeek(dirtyDate) {
136456
+ requiredArgs(1, arguments);
136457
+ var date = toDate(dirtyDate);
136458
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
136459
+ // because the number of milliseconds in a week is not constant
136460
+ // (e.g. it's different in the week of the daylight saving time clock shift)
136461
+
136462
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
136463
+ }
136464
+
136465
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136466
+
136467
+ function startOfUTCWeek(dirtyDate, dirtyOptions) {
136468
+ requiredArgs(1, arguments);
136469
+ var options = dirtyOptions || {};
136470
+ var locale = options.locale;
136471
+ var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
136472
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
136473
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
136474
+
136475
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
136476
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
136477
+ }
136478
+
136479
+ var date = toDate(dirtyDate);
136480
+ var day = date.getUTCDay();
136481
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
136482
+ date.setUTCDate(date.getUTCDate() - diff);
136483
+ date.setUTCHours(0, 0, 0, 0);
136484
+ return date;
136485
+ }
136486
+
136487
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136488
+
136489
+ function getUTCWeekYear(dirtyDate, dirtyOptions) {
136490
+ requiredArgs(1, arguments);
136491
+ var date = toDate(dirtyDate, dirtyOptions);
136492
+ var year = date.getUTCFullYear();
136493
+ var options = dirtyOptions || {};
136494
+ var locale = options.locale;
136495
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
136496
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
136497
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
136498
+
136499
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
136500
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
136501
+ }
136502
+
136503
+ var firstWeekOfNextYear = new Date(0);
136504
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
136505
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
136506
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
136507
+ var firstWeekOfThisYear = new Date(0);
136508
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
136509
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
136510
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
136511
+
136512
+ if (date.getTime() >= startOfNextYear.getTime()) {
136513
+ return year + 1;
136514
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
136515
+ return year;
136516
+ } else {
136517
+ return year - 1;
136518
+ }
136519
+ }
136520
+
136521
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136522
+
136523
+ function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
136524
+ requiredArgs(1, arguments);
136525
+ var options = dirtyOptions || {};
136526
+ var locale = options.locale;
136527
+ var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
136528
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
136529
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
136530
+ var year = getUTCWeekYear(dirtyDate, dirtyOptions);
136531
+ var firstWeek = new Date(0);
136532
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
136533
+ firstWeek.setUTCHours(0, 0, 0, 0);
136534
+ var date = startOfUTCWeek(firstWeek, dirtyOptions);
136535
+ return date;
136536
+ }
136537
+
136538
+ var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
136539
+ // See issue: https://github.com/date-fns/date-fns/issues/376
136540
+
136541
+ function getUTCWeek(dirtyDate, options) {
136542
+ requiredArgs(1, arguments);
136543
+ var date = toDate(dirtyDate);
136544
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
136545
+ // because the number of milliseconds in a week is not constant
136546
+ // (e.g. it's different in the week of the daylight saving time clock shift)
136547
+
136548
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
136549
+ }
136550
+
136551
+ var dayPeriodEnum = {
136552
+ am: 'am',
136553
+ pm: 'pm',
136554
+ midnight: 'midnight',
136555
+ noon: 'noon',
136556
+ morning: 'morning',
136557
+ afternoon: 'afternoon',
136558
+ evening: 'evening',
136559
+ night: 'night'
136560
+ };
136561
+ /*
136562
+ * | | Unit | | Unit |
136563
+ * |-----|--------------------------------|-----|--------------------------------|
136564
+ * | a | AM, PM | A* | Milliseconds in day |
136565
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
136566
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
136567
+ * | d | Day of month | D | Day of year |
136568
+ * | e | Local day of week | E | Day of week |
136569
+ * | f | | F* | Day of week in month |
136570
+ * | g* | Modified Julian day | G | Era |
136571
+ * | h | Hour [1-12] | H | Hour [0-23] |
136572
+ * | i! | ISO day of week | I! | ISO week of year |
136573
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
136574
+ * | k | Hour [1-24] | K | Hour [0-11] |
136575
+ * | l* | (deprecated) | L | Stand-alone month |
136576
+ * | m | Minute | M | Month |
136577
+ * | n | | N | |
136578
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
136579
+ * | p! | Long localized time | P! | Long localized date |
136580
+ * | q | Stand-alone quarter | Q | Quarter |
136581
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
136582
+ * | s | Second | S | Fraction of second |
136583
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
136584
+ * | u | Extended year | U* | Cyclic year |
136585
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
136586
+ * | w | Local week of year | W* | Week of month |
136587
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
136588
+ * | y | Year (abs) | Y | Local week-numbering year |
136589
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
136590
+ *
136591
+ * Letters marked by * are not implemented but reserved by Unicode standard.
136592
+ *
136593
+ * Letters marked by ! are non-standard, but implemented by date-fns:
136594
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
136595
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
136596
+ * i.e. 7 for Sunday, 1 for Monday, etc.
136597
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
136598
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
136599
+ * `R` is supposed to be used in conjunction with `I` and `i`
136600
+ * for universal ISO week-numbering date, whereas
136601
+ * `Y` is supposed to be used in conjunction with `w` and `e`
136602
+ * for week-numbering date specific to the locale.
136603
+ * - `P` is long localized date format
136604
+ * - `p` is long localized time format
136605
+ */
136606
+
136607
+ var formatters = {
136608
+ // Era
136609
+ G: function (date, token, localize) {
136610
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
136611
+
136612
+ switch (token) {
136613
+ // AD, BC
136614
+ case 'G':
136615
+ case 'GG':
136616
+ case 'GGG':
136617
+ return localize.era(era, {
136618
+ width: 'abbreviated'
136619
+ });
136620
+ // A, B
136621
+
136622
+ case 'GGGGG':
136623
+ return localize.era(era, {
136624
+ width: 'narrow'
136625
+ });
136626
+ // Anno Domini, Before Christ
136627
+
136628
+ case 'GGGG':
136629
+ default:
136630
+ return localize.era(era, {
136631
+ width: 'wide'
136632
+ });
136633
+ }
136634
+ },
136635
+ // Year
136636
+ y: function (date, token, localize) {
136637
+ // Ordinal number
136638
+ if (token === 'yo') {
136639
+ var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
136640
+
136641
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
136642
+ return localize.ordinalNumber(year, {
136643
+ unit: 'year'
136644
+ });
136645
+ }
136646
+
136647
+ return formatters$3.y(date, token);
136648
+ },
136649
+ // Local week-numbering year
136650
+ Y: function (date, token, localize, options) {
136651
+ var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
136652
+
136653
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
136654
+
136655
+ if (token === 'YY') {
136656
+ var twoDigitYear = weekYear % 100;
136657
+ return addLeadingZeros(twoDigitYear, 2);
136658
+ } // Ordinal number
136659
+
136660
+
136661
+ if (token === 'Yo') {
136662
+ return localize.ordinalNumber(weekYear, {
136663
+ unit: 'year'
136664
+ });
136665
+ } // Padding
136666
+
136667
+
136668
+ return addLeadingZeros(weekYear, token.length);
136669
+ },
136670
+ // ISO week-numbering year
136671
+ R: function (date, token) {
136672
+ var isoWeekYear = getUTCISOWeekYear(date); // Padding
136673
+
136674
+ return addLeadingZeros(isoWeekYear, token.length);
136675
+ },
136676
+ // Extended year. This is a single number designating the year of this calendar system.
136677
+ // The main difference between `y` and `u` localizers are B.C. years:
136678
+ // | Year | `y` | `u` |
136679
+ // |------|-----|-----|
136680
+ // | AC 1 | 1 | 1 |
136681
+ // | BC 1 | 1 | 0 |
136682
+ // | BC 2 | 2 | -1 |
136683
+ // Also `yy` always returns the last two digits of a year,
136684
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
136685
+ u: function (date, token) {
136686
+ var year = date.getUTCFullYear();
136687
+ return addLeadingZeros(year, token.length);
136688
+ },
136689
+ // Quarter
136690
+ Q: function (date, token, localize) {
136691
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
136692
+
136693
+ switch (token) {
136694
+ // 1, 2, 3, 4
136695
+ case 'Q':
136696
+ return String(quarter);
136697
+ // 01, 02, 03, 04
136698
+
136699
+ case 'QQ':
136700
+ return addLeadingZeros(quarter, 2);
136701
+ // 1st, 2nd, 3rd, 4th
136702
+
136703
+ case 'Qo':
136704
+ return localize.ordinalNumber(quarter, {
136705
+ unit: 'quarter'
136706
+ });
136707
+ // Q1, Q2, Q3, Q4
136708
+
136709
+ case 'QQQ':
136710
+ return localize.quarter(quarter, {
136711
+ width: 'abbreviated',
136712
+ context: 'formatting'
136713
+ });
136714
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
136715
+
136716
+ case 'QQQQQ':
136717
+ return localize.quarter(quarter, {
136718
+ width: 'narrow',
136719
+ context: 'formatting'
136720
+ });
136721
+ // 1st quarter, 2nd quarter, ...
136722
+
136723
+ case 'QQQQ':
136724
+ default:
136725
+ return localize.quarter(quarter, {
136726
+ width: 'wide',
136727
+ context: 'formatting'
136728
+ });
136729
+ }
136730
+ },
136731
+ // Stand-alone quarter
136732
+ q: function (date, token, localize) {
136733
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
136734
+
136735
+ switch (token) {
136736
+ // 1, 2, 3, 4
136737
+ case 'q':
136738
+ return String(quarter);
136739
+ // 01, 02, 03, 04
136740
+
136741
+ case 'qq':
136742
+ return addLeadingZeros(quarter, 2);
136743
+ // 1st, 2nd, 3rd, 4th
136744
+
136745
+ case 'qo':
136746
+ return localize.ordinalNumber(quarter, {
136747
+ unit: 'quarter'
136748
+ });
136749
+ // Q1, Q2, Q3, Q4
136750
+
136751
+ case 'qqq':
136752
+ return localize.quarter(quarter, {
136753
+ width: 'abbreviated',
136754
+ context: 'standalone'
136755
+ });
136756
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
136757
+
136758
+ case 'qqqqq':
136759
+ return localize.quarter(quarter, {
136760
+ width: 'narrow',
136761
+ context: 'standalone'
136762
+ });
136763
+ // 1st quarter, 2nd quarter, ...
136764
+
136765
+ case 'qqqq':
136766
+ default:
136767
+ return localize.quarter(quarter, {
136768
+ width: 'wide',
136769
+ context: 'standalone'
136770
+ });
136771
+ }
136772
+ },
136773
+ // Month
136774
+ M: function (date, token, localize) {
136775
+ var month = date.getUTCMonth();
136776
+
136777
+ switch (token) {
136778
+ case 'M':
136779
+ case 'MM':
136780
+ return formatters$3.M(date, token);
136781
+ // 1st, 2nd, ..., 12th
136782
+
136783
+ case 'Mo':
136784
+ return localize.ordinalNumber(month + 1, {
136785
+ unit: 'month'
136786
+ });
136787
+ // Jan, Feb, ..., Dec
136788
+
136789
+ case 'MMM':
136790
+ return localize.month(month, {
136791
+ width: 'abbreviated',
136792
+ context: 'formatting'
136793
+ });
136794
+ // J, F, ..., D
136795
+
136796
+ case 'MMMMM':
136797
+ return localize.month(month, {
136798
+ width: 'narrow',
136799
+ context: 'formatting'
136800
+ });
136801
+ // January, February, ..., December
136802
+
136803
+ case 'MMMM':
136804
+ default:
136805
+ return localize.month(month, {
136806
+ width: 'wide',
136807
+ context: 'formatting'
136808
+ });
136809
+ }
136810
+ },
136811
+ // Stand-alone month
136812
+ L: function (date, token, localize) {
136813
+ var month = date.getUTCMonth();
136814
+
136815
+ switch (token) {
136816
+ // 1, 2, ..., 12
136817
+ case 'L':
136818
+ return String(month + 1);
136819
+ // 01, 02, ..., 12
136820
+
136821
+ case 'LL':
136822
+ return addLeadingZeros(month + 1, 2);
136823
+ // 1st, 2nd, ..., 12th
136824
+
136825
+ case 'Lo':
136826
+ return localize.ordinalNumber(month + 1, {
136827
+ unit: 'month'
136828
+ });
136829
+ // Jan, Feb, ..., Dec
136830
+
136831
+ case 'LLL':
136832
+ return localize.month(month, {
136833
+ width: 'abbreviated',
136834
+ context: 'standalone'
136835
+ });
136836
+ // J, F, ..., D
136837
+
136838
+ case 'LLLLL':
136839
+ return localize.month(month, {
136840
+ width: 'narrow',
136841
+ context: 'standalone'
136842
+ });
136843
+ // January, February, ..., December
136844
+
136845
+ case 'LLLL':
136846
+ default:
136847
+ return localize.month(month, {
136848
+ width: 'wide',
136849
+ context: 'standalone'
136850
+ });
136851
+ }
136852
+ },
136853
+ // Local week of year
136854
+ w: function (date, token, localize, options) {
136855
+ var week = getUTCWeek(date, options);
136856
+
136857
+ if (token === 'wo') {
136858
+ return localize.ordinalNumber(week, {
136859
+ unit: 'week'
136860
+ });
136861
+ }
136862
+
136863
+ return addLeadingZeros(week, token.length);
136864
+ },
136865
+ // ISO week of year
136866
+ I: function (date, token, localize) {
136867
+ var isoWeek = getUTCISOWeek(date);
136868
+
136869
+ if (token === 'Io') {
136870
+ return localize.ordinalNumber(isoWeek, {
136871
+ unit: 'week'
136872
+ });
136873
+ }
136874
+
136875
+ return addLeadingZeros(isoWeek, token.length);
136876
+ },
136877
+ // Day of the month
136878
+ d: function (date, token, localize) {
136879
+ if (token === 'do') {
136880
+ return localize.ordinalNumber(date.getUTCDate(), {
136881
+ unit: 'date'
136882
+ });
136883
+ }
136884
+
136885
+ return formatters$3.d(date, token);
136886
+ },
136887
+ // Day of year
136888
+ D: function (date, token, localize) {
136889
+ var dayOfYear = getUTCDayOfYear(date);
136890
+
136891
+ if (token === 'Do') {
136892
+ return localize.ordinalNumber(dayOfYear, {
136893
+ unit: 'dayOfYear'
136894
+ });
136895
+ }
136896
+
136897
+ return addLeadingZeros(dayOfYear, token.length);
136898
+ },
136899
+ // Day of week
136900
+ E: function (date, token, localize) {
136901
+ var dayOfWeek = date.getUTCDay();
136902
+
136903
+ switch (token) {
136904
+ // Tue
136905
+ case 'E':
136906
+ case 'EE':
136907
+ case 'EEE':
136908
+ return localize.day(dayOfWeek, {
136909
+ width: 'abbreviated',
136910
+ context: 'formatting'
136911
+ });
136912
+ // T
136913
+
136914
+ case 'EEEEE':
136915
+ return localize.day(dayOfWeek, {
136916
+ width: 'narrow',
136917
+ context: 'formatting'
136918
+ });
136919
+ // Tu
136920
+
136921
+ case 'EEEEEE':
136922
+ return localize.day(dayOfWeek, {
136923
+ width: 'short',
136924
+ context: 'formatting'
136925
+ });
136926
+ // Tuesday
136927
+
136928
+ case 'EEEE':
136929
+ default:
136930
+ return localize.day(dayOfWeek, {
136931
+ width: 'wide',
136932
+ context: 'formatting'
136933
+ });
136934
+ }
136935
+ },
136936
+ // Local day of week
136937
+ e: function (date, token, localize, options) {
136938
+ var dayOfWeek = date.getUTCDay();
136939
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
136940
+
136941
+ switch (token) {
136942
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
136943
+ case 'e':
136944
+ return String(localDayOfWeek);
136945
+ // Padded numerical value
136946
+
136947
+ case 'ee':
136948
+ return addLeadingZeros(localDayOfWeek, 2);
136949
+ // 1st, 2nd, ..., 7th
136950
+
136951
+ case 'eo':
136952
+ return localize.ordinalNumber(localDayOfWeek, {
136953
+ unit: 'day'
136954
+ });
136955
+
136956
+ case 'eee':
136957
+ return localize.day(dayOfWeek, {
136958
+ width: 'abbreviated',
136959
+ context: 'formatting'
136960
+ });
136961
+ // T
136962
+
136963
+ case 'eeeee':
136964
+ return localize.day(dayOfWeek, {
136965
+ width: 'narrow',
136966
+ context: 'formatting'
136967
+ });
136968
+ // Tu
136969
+
136970
+ case 'eeeeee':
136971
+ return localize.day(dayOfWeek, {
136972
+ width: 'short',
136973
+ context: 'formatting'
136974
+ });
136975
+ // Tuesday
136976
+
136977
+ case 'eeee':
136978
+ default:
136979
+ return localize.day(dayOfWeek, {
136980
+ width: 'wide',
136981
+ context: 'formatting'
136982
+ });
136983
+ }
136984
+ },
136985
+ // Stand-alone local day of week
136986
+ c: function (date, token, localize, options) {
136987
+ var dayOfWeek = date.getUTCDay();
136988
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
136989
+
136990
+ switch (token) {
136991
+ // Numerical value (same as in `e`)
136992
+ case 'c':
136993
+ return String(localDayOfWeek);
136994
+ // Padded numerical value
136995
+
136996
+ case 'cc':
136997
+ return addLeadingZeros(localDayOfWeek, token.length);
136998
+ // 1st, 2nd, ..., 7th
136999
+
137000
+ case 'co':
137001
+ return localize.ordinalNumber(localDayOfWeek, {
137002
+ unit: 'day'
137003
+ });
137004
+
137005
+ case 'ccc':
137006
+ return localize.day(dayOfWeek, {
137007
+ width: 'abbreviated',
137008
+ context: 'standalone'
137009
+ });
137010
+ // T
137011
+
137012
+ case 'ccccc':
137013
+ return localize.day(dayOfWeek, {
137014
+ width: 'narrow',
137015
+ context: 'standalone'
137016
+ });
137017
+ // Tu
137018
+
137019
+ case 'cccccc':
137020
+ return localize.day(dayOfWeek, {
137021
+ width: 'short',
137022
+ context: 'standalone'
137023
+ });
137024
+ // Tuesday
137025
+
137026
+ case 'cccc':
137027
+ default:
137028
+ return localize.day(dayOfWeek, {
137029
+ width: 'wide',
137030
+ context: 'standalone'
137031
+ });
137032
+ }
137033
+ },
137034
+ // ISO day of week
137035
+ i: function (date, token, localize) {
137036
+ var dayOfWeek = date.getUTCDay();
137037
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
137038
+
137039
+ switch (token) {
137040
+ // 2
137041
+ case 'i':
137042
+ return String(isoDayOfWeek);
137043
+ // 02
137044
+
137045
+ case 'ii':
137046
+ return addLeadingZeros(isoDayOfWeek, token.length);
137047
+ // 2nd
137048
+
137049
+ case 'io':
137050
+ return localize.ordinalNumber(isoDayOfWeek, {
137051
+ unit: 'day'
137052
+ });
137053
+ // Tue
137054
+
137055
+ case 'iii':
137056
+ return localize.day(dayOfWeek, {
137057
+ width: 'abbreviated',
137058
+ context: 'formatting'
137059
+ });
137060
+ // T
137061
+
137062
+ case 'iiiii':
137063
+ return localize.day(dayOfWeek, {
137064
+ width: 'narrow',
137065
+ context: 'formatting'
137066
+ });
137067
+ // Tu
137068
+
137069
+ case 'iiiiii':
137070
+ return localize.day(dayOfWeek, {
137071
+ width: 'short',
137072
+ context: 'formatting'
137073
+ });
137074
+ // Tuesday
137075
+
137076
+ case 'iiii':
137077
+ default:
137078
+ return localize.day(dayOfWeek, {
137079
+ width: 'wide',
137080
+ context: 'formatting'
137081
+ });
137082
+ }
137083
+ },
137084
+ // AM or PM
137085
+ a: function (date, token, localize) {
137086
+ var hours = date.getUTCHours();
137087
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
137088
+
137089
+ switch (token) {
137090
+ case 'a':
137091
+ case 'aa':
137092
+ return localize.dayPeriod(dayPeriodEnumValue, {
137093
+ width: 'abbreviated',
137094
+ context: 'formatting'
137095
+ });
137096
+
137097
+ case 'aaa':
137098
+ return localize.dayPeriod(dayPeriodEnumValue, {
137099
+ width: 'abbreviated',
137100
+ context: 'formatting'
137101
+ }).toLowerCase();
137102
+
137103
+ case 'aaaaa':
137104
+ return localize.dayPeriod(dayPeriodEnumValue, {
137105
+ width: 'narrow',
137106
+ context: 'formatting'
137107
+ });
137108
+
137109
+ case 'aaaa':
137110
+ default:
137111
+ return localize.dayPeriod(dayPeriodEnumValue, {
137112
+ width: 'wide',
137113
+ context: 'formatting'
137114
+ });
137115
+ }
137116
+ },
137117
+ // AM, PM, midnight, noon
137118
+ b: function (date, token, localize) {
137119
+ var hours = date.getUTCHours();
137120
+ var dayPeriodEnumValue;
137121
+
137122
+ if (hours === 12) {
137123
+ dayPeriodEnumValue = dayPeriodEnum.noon;
137124
+ } else if (hours === 0) {
137125
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
137126
+ } else {
137127
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
137128
+ }
137129
+
137130
+ switch (token) {
137131
+ case 'b':
137132
+ case 'bb':
137133
+ return localize.dayPeriod(dayPeriodEnumValue, {
137134
+ width: 'abbreviated',
137135
+ context: 'formatting'
137136
+ });
137137
+
137138
+ case 'bbb':
137139
+ return localize.dayPeriod(dayPeriodEnumValue, {
137140
+ width: 'abbreviated',
137141
+ context: 'formatting'
137142
+ }).toLowerCase();
137143
+
137144
+ case 'bbbbb':
137145
+ return localize.dayPeriod(dayPeriodEnumValue, {
137146
+ width: 'narrow',
137147
+ context: 'formatting'
137148
+ });
137149
+
137150
+ case 'bbbb':
137151
+ default:
137152
+ return localize.dayPeriod(dayPeriodEnumValue, {
137153
+ width: 'wide',
137154
+ context: 'formatting'
137155
+ });
137156
+ }
137157
+ },
137158
+ // in the morning, in the afternoon, in the evening, at night
137159
+ B: function (date, token, localize) {
137160
+ var hours = date.getUTCHours();
137161
+ var dayPeriodEnumValue;
137162
+
137163
+ if (hours >= 17) {
137164
+ dayPeriodEnumValue = dayPeriodEnum.evening;
137165
+ } else if (hours >= 12) {
137166
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
137167
+ } else if (hours >= 4) {
137168
+ dayPeriodEnumValue = dayPeriodEnum.morning;
137169
+ } else {
137170
+ dayPeriodEnumValue = dayPeriodEnum.night;
137171
+ }
137172
+
137173
+ switch (token) {
137174
+ case 'B':
137175
+ case 'BB':
137176
+ case 'BBB':
137177
+ return localize.dayPeriod(dayPeriodEnumValue, {
137178
+ width: 'abbreviated',
137179
+ context: 'formatting'
137180
+ });
137181
+
137182
+ case 'BBBBB':
137183
+ return localize.dayPeriod(dayPeriodEnumValue, {
137184
+ width: 'narrow',
137185
+ context: 'formatting'
137186
+ });
137187
+
137188
+ case 'BBBB':
137189
+ default:
137190
+ return localize.dayPeriod(dayPeriodEnumValue, {
137191
+ width: 'wide',
137192
+ context: 'formatting'
137193
+ });
137194
+ }
137195
+ },
137196
+ // Hour [1-12]
137197
+ h: function (date, token, localize) {
137198
+ if (token === 'ho') {
137199
+ var hours = date.getUTCHours() % 12;
137200
+ if (hours === 0) hours = 12;
137201
+ return localize.ordinalNumber(hours, {
137202
+ unit: 'hour'
137203
+ });
137204
+ }
137205
+
137206
+ return formatters$3.h(date, token);
137207
+ },
137208
+ // Hour [0-23]
137209
+ H: function (date, token, localize) {
137210
+ if (token === 'Ho') {
137211
+ return localize.ordinalNumber(date.getUTCHours(), {
137212
+ unit: 'hour'
137213
+ });
137214
+ }
137215
+
137216
+ return formatters$3.H(date, token);
137217
+ },
137218
+ // Hour [0-11]
137219
+ K: function (date, token, localize) {
137220
+ var hours = date.getUTCHours() % 12;
137221
+
137222
+ if (token === 'Ko') {
137223
+ return localize.ordinalNumber(hours, {
137224
+ unit: 'hour'
137225
+ });
137226
+ }
137227
+
137228
+ return addLeadingZeros(hours, token.length);
137229
+ },
137230
+ // Hour [1-24]
137231
+ k: function (date, token, localize) {
137232
+ var hours = date.getUTCHours();
137233
+ if (hours === 0) hours = 24;
137234
+
137235
+ if (token === 'ko') {
137236
+ return localize.ordinalNumber(hours, {
137237
+ unit: 'hour'
137238
+ });
137239
+ }
137240
+
137241
+ return addLeadingZeros(hours, token.length);
137242
+ },
137243
+ // Minute
137244
+ m: function (date, token, localize) {
137245
+ if (token === 'mo') {
137246
+ return localize.ordinalNumber(date.getUTCMinutes(), {
137247
+ unit: 'minute'
137248
+ });
137249
+ }
137250
+
137251
+ return formatters$3.m(date, token);
137252
+ },
137253
+ // Second
137254
+ s: function (date, token, localize) {
137255
+ if (token === 'so') {
137256
+ return localize.ordinalNumber(date.getUTCSeconds(), {
137257
+ unit: 'second'
137258
+ });
137259
+ }
137260
+
137261
+ return formatters$3.s(date, token);
137262
+ },
137263
+ // Fraction of second
137264
+ S: function (date, token) {
137265
+ return formatters$3.S(date, token);
137266
+ },
137267
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
137268
+ X: function (date, token, _localize, options) {
137269
+ var originalDate = options._originalDate || date;
137270
+ var timezoneOffset = originalDate.getTimezoneOffset();
137271
+
137272
+ if (timezoneOffset === 0) {
137273
+ return 'Z';
137274
+ }
137275
+
137276
+ switch (token) {
137277
+ // Hours and optional minutes
137278
+ case 'X':
137279
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
137280
+ // Hours, minutes and optional seconds without `:` delimiter
137281
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137282
+ // so this token always has the same output as `XX`
137283
+
137284
+ case 'XXXX':
137285
+ case 'XX':
137286
+ // Hours and minutes without `:` delimiter
137287
+ return formatTimezone(timezoneOffset);
137288
+ // Hours, minutes and optional seconds with `:` delimiter
137289
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137290
+ // so this token always has the same output as `XXX`
137291
+
137292
+ case 'XXXXX':
137293
+ case 'XXX': // Hours and minutes with `:` delimiter
137294
+
137295
+ default:
137296
+ return formatTimezone(timezoneOffset, ':');
137297
+ }
137298
+ },
137299
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
137300
+ x: function (date, token, _localize, options) {
137301
+ var originalDate = options._originalDate || date;
137302
+ var timezoneOffset = originalDate.getTimezoneOffset();
137303
+
137304
+ switch (token) {
137305
+ // Hours and optional minutes
137306
+ case 'x':
137307
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
137308
+ // Hours, minutes and optional seconds without `:` delimiter
137309
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137310
+ // so this token always has the same output as `xx`
137311
+
137312
+ case 'xxxx':
137313
+ case 'xx':
137314
+ // Hours and minutes without `:` delimiter
137315
+ return formatTimezone(timezoneOffset);
137316
+ // Hours, minutes and optional seconds with `:` delimiter
137317
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
137318
+ // so this token always has the same output as `xxx`
137319
+
137320
+ case 'xxxxx':
137321
+ case 'xxx': // Hours and minutes with `:` delimiter
137322
+
137323
+ default:
137324
+ return formatTimezone(timezoneOffset, ':');
137325
+ }
137326
+ },
137327
+ // Timezone (GMT)
137328
+ O: function (date, token, _localize, options) {
137329
+ var originalDate = options._originalDate || date;
137330
+ var timezoneOffset = originalDate.getTimezoneOffset();
137331
+
137332
+ switch (token) {
137333
+ // Short
137334
+ case 'O':
137335
+ case 'OO':
137336
+ case 'OOO':
137337
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
137338
+ // Long
137339
+
137340
+ case 'OOOO':
137341
+ default:
137342
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
137343
+ }
137344
+ },
137345
+ // Timezone (specific non-location)
137346
+ z: function (date, token, _localize, options) {
137347
+ var originalDate = options._originalDate || date;
137348
+ var timezoneOffset = originalDate.getTimezoneOffset();
137349
+
137350
+ switch (token) {
137351
+ // Short
137352
+ case 'z':
137353
+ case 'zz':
137354
+ case 'zzz':
137355
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
137356
+ // Long
137357
+
137358
+ case 'zzzz':
137359
+ default:
137360
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
137361
+ }
137362
+ },
137363
+ // Seconds timestamp
137364
+ t: function (date, token, _localize, options) {
137365
+ var originalDate = options._originalDate || date;
137366
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
137367
+ return addLeadingZeros(timestamp, token.length);
137368
+ },
137369
+ // Milliseconds timestamp
137370
+ T: function (date, token, _localize, options) {
137371
+ var originalDate = options._originalDate || date;
137372
+ var timestamp = originalDate.getTime();
137373
+ return addLeadingZeros(timestamp, token.length);
137374
+ }
137375
+ };
137376
+
137377
+ function formatTimezoneShort(offset, dirtyDelimiter) {
137378
+ var sign = offset > 0 ? '-' : '+';
137379
+ var absOffset = Math.abs(offset);
137380
+ var hours = Math.floor(absOffset / 60);
137381
+ var minutes = absOffset % 60;
137382
+
137383
+ if (minutes === 0) {
137384
+ return sign + String(hours);
137385
+ }
137386
+
137387
+ var delimiter = dirtyDelimiter || '';
137388
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
137389
+ }
137390
+
137391
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
137392
+ if (offset % 60 === 0) {
137393
+ var sign = offset > 0 ? '-' : '+';
137394
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
137395
+ }
137396
+
137397
+ return formatTimezone(offset, dirtyDelimiter);
137398
+ }
137399
+
137400
+ function formatTimezone(offset, dirtyDelimiter) {
137401
+ var delimiter = dirtyDelimiter || '';
137402
+ var sign = offset > 0 ? '-' : '+';
137403
+ var absOffset = Math.abs(offset);
137404
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
137405
+ var minutes = addLeadingZeros(absOffset % 60, 2);
137406
+ return sign + hours + delimiter + minutes;
137407
+ }
137408
+
137409
+ var formatters$1 = formatters;
137410
+
137411
+ function dateLongFormatter(pattern, formatLong) {
137412
+ switch (pattern) {
137413
+ case 'P':
137414
+ return formatLong.date({
137415
+ width: 'short'
137416
+ });
137417
+
137418
+ case 'PP':
137419
+ return formatLong.date({
137420
+ width: 'medium'
137421
+ });
137422
+
137423
+ case 'PPP':
137424
+ return formatLong.date({
137425
+ width: 'long'
137426
+ });
137427
+
137428
+ case 'PPPP':
137429
+ default:
137430
+ return formatLong.date({
137431
+ width: 'full'
137432
+ });
137433
+ }
137434
+ }
137435
+
137436
+ function timeLongFormatter(pattern, formatLong) {
137437
+ switch (pattern) {
137438
+ case 'p':
137439
+ return formatLong.time({
137440
+ width: 'short'
137441
+ });
137442
+
137443
+ case 'pp':
137444
+ return formatLong.time({
137445
+ width: 'medium'
137446
+ });
137447
+
137448
+ case 'ppp':
137449
+ return formatLong.time({
137450
+ width: 'long'
137451
+ });
137452
+
137453
+ case 'pppp':
137454
+ default:
137455
+ return formatLong.time({
137456
+ width: 'full'
137457
+ });
137458
+ }
137459
+ }
137460
+
137461
+ function dateTimeLongFormatter(pattern, formatLong) {
137462
+ var matchResult = pattern.match(/(P+)(p+)?/);
137463
+ var datePattern = matchResult[1];
137464
+ var timePattern = matchResult[2];
137465
+
137466
+ if (!timePattern) {
137467
+ return dateLongFormatter(pattern, formatLong);
137468
+ }
137469
+
137470
+ var dateTimeFormat;
137471
+
137472
+ switch (datePattern) {
137473
+ case 'P':
137474
+ dateTimeFormat = formatLong.dateTime({
137475
+ width: 'short'
137476
+ });
137477
+ break;
137478
+
137479
+ case 'PP':
137480
+ dateTimeFormat = formatLong.dateTime({
137481
+ width: 'medium'
137482
+ });
137483
+ break;
137484
+
137485
+ case 'PPP':
137486
+ dateTimeFormat = formatLong.dateTime({
137487
+ width: 'long'
137488
+ });
137489
+ break;
137490
+
137491
+ case 'PPPP':
137492
+ default:
137493
+ dateTimeFormat = formatLong.dateTime({
137494
+ width: 'full'
137495
+ });
137496
+ break;
137497
+ }
137498
+
137499
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
137500
+ }
137501
+
137502
+ var longFormatters = {
137503
+ p: timeLongFormatter,
137504
+ P: dateTimeLongFormatter
137505
+ };
137506
+ var longFormatters$1 = longFormatters;
137507
+
137508
+ var protectedDayOfYearTokens = ['D', 'DD'];
137509
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
137510
+ function isProtectedDayOfYearToken(token) {
137511
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
137512
+ }
137513
+ function isProtectedWeekYearToken(token) {
137514
+ return protectedWeekYearTokens.indexOf(token) !== -1;
137515
+ }
137516
+ function throwProtectedError(token, format, input) {
137517
+ if (token === 'YYYY') {
137518
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137519
+ } else if (token === 'YY') {
137520
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137521
+ } else if (token === 'D') {
137522
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137523
+ } else if (token === 'DD') {
137524
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
137525
+ }
137526
+ }
137527
+
137528
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
137529
+ // (one of the certain letters followed by `o`)
137530
+ // - (\w)\1* matches any sequences of the same letter
137531
+ // - '' matches two quote characters in a row
137532
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
137533
+ // except a single quote symbol, which ends the sequence.
137534
+ // Two quote characters do not end the sequence.
137535
+ // If there is no matching single quote
137536
+ // then the sequence will continue until the end of the string.
137537
+ // - . matches any single character unmatched by previous parts of the RegExps
137538
+
137539
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
137540
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
137541
+
137542
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
137543
+ var escapedStringRegExp = /^'([^]*?)'?$/;
137544
+ var doubleQuoteRegExp = /''/g;
137545
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
137546
+ /**
137547
+ * @name format
137548
+ * @category Common Helpers
137549
+ * @summary Format the date.
137550
+ *
137551
+ * @description
137552
+ * Return the formatted date string in the given format. The result may vary by locale.
137553
+ *
137554
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
137555
+ * > See: https://git.io/fxCyr
137556
+ *
137557
+ * The characters wrapped between two single quotes characters (') are escaped.
137558
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
137559
+ * (see the last example)
137560
+ *
137561
+ * Format of the string is based on Unicode Technical Standard #35:
137562
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
137563
+ * with a few additions (see note 7 below the table).
137564
+ *
137565
+ * Accepted patterns:
137566
+ * | Unit | Pattern | Result examples | Notes |
137567
+ * |---------------------------------|---------|-----------------------------------|-------|
137568
+ * | Era | G..GGG | AD, BC | |
137569
+ * | | GGGG | Anno Domini, Before Christ | 2 |
137570
+ * | | GGGGG | A, B | |
137571
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
137572
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
137573
+ * | | yy | 44, 01, 00, 17 | 5 |
137574
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
137575
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
137576
+ * | | yyyyy | ... | 3,5 |
137577
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
137578
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
137579
+ * | | YY | 44, 01, 00, 17 | 5,8 |
137580
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
137581
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
137582
+ * | | YYYYY | ... | 3,5 |
137583
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
137584
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
137585
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
137586
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
137587
+ * | | RRRRR | ... | 3,5,7 |
137588
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
137589
+ * | | uu | -43, 01, 1900, 2017 | 5 |
137590
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
137591
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
137592
+ * | | uuuuu | ... | 3,5 |
137593
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
137594
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
137595
+ * | | QQ | 01, 02, 03, 04 | |
137596
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
137597
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
137598
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
137599
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
137600
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
137601
+ * | | qq | 01, 02, 03, 04 | |
137602
+ * | | qqq | Q1, Q2, Q3, Q4 | |
137603
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
137604
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
137605
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
137606
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
137607
+ * | | MM | 01, 02, ..., 12 | |
137608
+ * | | MMM | Jan, Feb, ..., Dec | |
137609
+ * | | MMMM | January, February, ..., December | 2 |
137610
+ * | | MMMMM | J, F, ..., D | |
137611
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
137612
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
137613
+ * | | LL | 01, 02, ..., 12 | |
137614
+ * | | LLL | Jan, Feb, ..., Dec | |
137615
+ * | | LLLL | January, February, ..., December | 2 |
137616
+ * | | LLLLL | J, F, ..., D | |
137617
+ * | Local week of year | w | 1, 2, ..., 53 | |
137618
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
137619
+ * | | ww | 01, 02, ..., 53 | |
137620
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
137621
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
137622
+ * | | II | 01, 02, ..., 53 | 7 |
137623
+ * | Day of month | d | 1, 2, ..., 31 | |
137624
+ * | | do | 1st, 2nd, ..., 31st | 7 |
137625
+ * | | dd | 01, 02, ..., 31 | |
137626
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
137627
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
137628
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
137629
+ * | | DDD | 001, 002, ..., 365, 366 | |
137630
+ * | | DDDD | ... | 3 |
137631
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
137632
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
137633
+ * | | EEEEE | M, T, W, T, F, S, S | |
137634
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
137635
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
137636
+ * | | io | 1st, 2nd, ..., 7th | 7 |
137637
+ * | | ii | 01, 02, ..., 07 | 7 |
137638
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
137639
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
137640
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
137641
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
137642
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
137643
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
137644
+ * | | ee | 02, 03, ..., 01 | |
137645
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
137646
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
137647
+ * | | eeeee | M, T, W, T, F, S, S | |
137648
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
137649
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
137650
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
137651
+ * | | cc | 02, 03, ..., 01 | |
137652
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
137653
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
137654
+ * | | ccccc | M, T, W, T, F, S, S | |
137655
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
137656
+ * | AM, PM | a..aa | AM, PM | |
137657
+ * | | aaa | am, pm | |
137658
+ * | | aaaa | a.m., p.m. | 2 |
137659
+ * | | aaaaa | a, p | |
137660
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
137661
+ * | | bbb | am, pm, noon, midnight | |
137662
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
137663
+ * | | bbbbb | a, p, n, mi | |
137664
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
137665
+ * | | BBBB | at night, in the morning, ... | 2 |
137666
+ * | | BBBBB | at night, in the morning, ... | |
137667
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
137668
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
137669
+ * | | hh | 01, 02, ..., 11, 12 | |
137670
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
137671
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
137672
+ * | | HH | 00, 01, 02, ..., 23 | |
137673
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
137674
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
137675
+ * | | KK | 01, 02, ..., 11, 00 | |
137676
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
137677
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
137678
+ * | | kk | 24, 01, 02, ..., 23 | |
137679
+ * | Minute | m | 0, 1, ..., 59 | |
137680
+ * | | mo | 0th, 1st, ..., 59th | 7 |
137681
+ * | | mm | 00, 01, ..., 59 | |
137682
+ * | Second | s | 0, 1, ..., 59 | |
137683
+ * | | so | 0th, 1st, ..., 59th | 7 |
137684
+ * | | ss | 00, 01, ..., 59 | |
137685
+ * | Fraction of second | S | 0, 1, ..., 9 | |
137686
+ * | | SS | 00, 01, ..., 99 | |
137687
+ * | | SSS | 000, 001, ..., 999 | |
137688
+ * | | SSSS | ... | 3 |
137689
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
137690
+ * | | XX | -0800, +0530, Z | |
137691
+ * | | XXX | -08:00, +05:30, Z | |
137692
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
137693
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
137694
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
137695
+ * | | xx | -0800, +0530, +0000 | |
137696
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
137697
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
137698
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
137699
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
137700
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
137701
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
137702
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
137703
+ * | Seconds timestamp | t | 512969520 | 7 |
137704
+ * | | tt | ... | 3,7 |
137705
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
137706
+ * | | TT | ... | 3,7 |
137707
+ * | Long localized date | P | 04/29/1453 | 7 |
137708
+ * | | PP | Apr 29, 1453 | 7 |
137709
+ * | | PPP | April 29th, 1453 | 7 |
137710
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
137711
+ * | Long localized time | p | 12:00 AM | 7 |
137712
+ * | | pp | 12:00:00 AM | 7 |
137713
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
137714
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
137715
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
137716
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
137717
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
137718
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
137719
+ * Notes:
137720
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
137721
+ * are the same as "stand-alone" units, but are different in some languages.
137722
+ * "Formatting" units are declined according to the rules of the language
137723
+ * in the context of a date. "Stand-alone" units are always nominative singular:
137724
+ *
137725
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
137726
+ *
137727
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
137728
+ *
137729
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
137730
+ * the single quote characters (see below).
137731
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
137732
+ * the output will be the same as default pattern for this unit, usually
137733
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
137734
+ * are marked with "2" in the last column of the table.
137735
+ *
137736
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
137737
+ *
137738
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
137739
+ *
137740
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
137741
+ *
137742
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
137743
+ *
137744
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
137745
+ *
137746
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
137747
+ * The output will be padded with zeros to match the length of the pattern.
137748
+ *
137749
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
137750
+ *
137751
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
137752
+ * These tokens represent the shortest form of the quarter.
137753
+ *
137754
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
137755
+ *
137756
+ * | Year | `y` | `u` |
137757
+ * |------|-----|-----|
137758
+ * | AC 1 | 1 | 1 |
137759
+ * | BC 1 | 1 | 0 |
137760
+ * | BC 2 | 2 | -1 |
137761
+ *
137762
+ * Also `yy` always returns the last two digits of a year,
137763
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
137764
+ *
137765
+ * | Year | `yy` | `uu` |
137766
+ * |------|------|------|
137767
+ * | 1 | 01 | 01 |
137768
+ * | 14 | 14 | 14 |
137769
+ * | 376 | 76 | 376 |
137770
+ * | 1453 | 53 | 1453 |
137771
+ *
137772
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
137773
+ * except local week-numbering years are dependent on `options.weekStartsOn`
137774
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
137775
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
137776
+ *
137777
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
137778
+ * so right now these tokens fall back to GMT timezones.
137779
+ *
137780
+ * 7. These patterns are not in the Unicode Technical Standard #35:
137781
+ * - `i`: ISO day of week
137782
+ * - `I`: ISO week of year
137783
+ * - `R`: ISO week-numbering year
137784
+ * - `t`: seconds timestamp
137785
+ * - `T`: milliseconds timestamp
137786
+ * - `o`: ordinal number modifier
137787
+ * - `P`: long localized date
137788
+ * - `p`: long localized time
137789
+ *
137790
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
137791
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
137792
+ *
137793
+ * 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
137794
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
137795
+ *
137796
+ * ### v2.0.0 breaking changes:
137797
+ *
137798
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
137799
+ *
137800
+ * - The second argument is now required for the sake of explicitness.
137801
+ *
137802
+ * ```javascript
137803
+ * // Before v2.0.0
137804
+ * format(new Date(2016, 0, 1))
137805
+ *
137806
+ * // v2.0.0 onward
137807
+ * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
137808
+ * ```
137809
+ *
137810
+ * - New format string API for `format` function
137811
+ * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
137812
+ * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
137813
+ *
137814
+ * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
137815
+ *
137816
+ * @param {Date|Number} date - the original date
137817
+ * @param {String} format - the string of tokens
137818
+ * @param {Object} [options] - an object with options.
137819
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
137820
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
137821
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
137822
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
137823
+ * see: https://git.io/fxCyr
137824
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
137825
+ * see: https://git.io/fxCyr
137826
+ * @returns {String} the formatted date string
137827
+ * @throws {TypeError} 2 arguments required
137828
+ * @throws {RangeError} `date` must not be Invalid Date
137829
+ * @throws {RangeError} `options.locale` must contain `localize` property
137830
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
137831
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
137832
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
137833
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137834
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137835
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137836
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
137837
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
137838
+ *
137839
+ * @example
137840
+ * // Represent 11 February 2014 in middle-endian format:
137841
+ * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
137842
+ * //=> '02/11/2014'
137843
+ *
137844
+ * @example
137845
+ * // Represent 2 July 2014 in Esperanto:
137846
+ * import { eoLocale } from 'date-fns/locale/eo'
137847
+ * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
137848
+ * locale: eoLocale
137849
+ * })
137850
+ * //=> '2-a de julio 2014'
137851
+ *
137852
+ * @example
137853
+ * // Escape string by single quote characters:
137854
+ * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
137855
+ * //=> "3 o'clock"
137856
+ */
137857
+
137858
+ function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
137859
+ requiredArgs(2, arguments);
137860
+ var formatStr = String(dirtyFormatStr);
137861
+ var options = dirtyOptions || {};
137862
+ var locale = options.locale || defaultLocale;
137863
+ var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
137864
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
137865
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
137866
+
137867
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
137868
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
137869
+ }
137870
+
137871
+ var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
137872
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
137873
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
137874
+
137875
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
137876
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
137877
+ }
137878
+
137879
+ if (!locale.localize) {
137880
+ throw new RangeError('locale must contain localize property');
137881
+ }
137882
+
137883
+ if (!locale.formatLong) {
137884
+ throw new RangeError('locale must contain formatLong property');
137885
+ }
137886
+
137887
+ var originalDate = toDate(dirtyDate);
137888
+
137889
+ if (!isValid(originalDate)) {
137890
+ throw new RangeError('Invalid time value');
137891
+ } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
137892
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
137893
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
137894
+
137895
+
137896
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
137897
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
137898
+ var formatterOptions = {
137899
+ firstWeekContainsDate: firstWeekContainsDate,
137900
+ weekStartsOn: weekStartsOn,
137901
+ locale: locale,
137902
+ _originalDate: originalDate
137903
+ };
137904
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
137905
+ var firstCharacter = substring[0];
137906
+
137907
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
137908
+ var longFormatter = longFormatters$1[firstCharacter];
137909
+ return longFormatter(substring, locale.formatLong, formatterOptions);
137910
+ }
137911
+
137912
+ return substring;
137913
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
137914
+ // Replace two single quote characters with one single quote character
137915
+ if (substring === "''") {
137916
+ return "'";
137917
+ }
137918
+
137919
+ var firstCharacter = substring[0];
137920
+
137921
+ if (firstCharacter === "'") {
137922
+ return cleanEscapedString(substring);
137923
+ }
137924
+
137925
+ var formatter = formatters$1[firstCharacter];
137926
+
137927
+ if (formatter) {
137928
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
137929
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
137930
+ }
137931
+
137932
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
137933
+ throwProtectedError(substring, dirtyFormatStr, dirtyDate);
137934
+ }
137935
+
137936
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
137937
+ }
137938
+
137939
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
137940
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
137941
+ }
137942
+
137943
+ return substring;
137944
+ }).join('');
137945
+ return result;
137946
+ }
137947
+
137948
+ function cleanEscapedString(input) {
137949
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
137950
+ }
137951
+
135600
137952
  var PublishingDateFilter = function PublishingDateFilter() {
135601
137953
  var publishingDateRef = useRef$1();
135602
137954
  var formatMessage = useIntl().formatMessage;
@@ -135612,6 +137964,7 @@ var PublishingDateFilter = function PublishingDateFilter() {
135612
137964
  var today = new Date();
135613
137965
  var startOfToday = startOfDay(today);
135614
137966
  var endOfToday = endOfDay(today);
137967
+ var isActive = (filter === null || filter === void 0 ? void 0 : filter.beforeDate) || (filter === null || filter === void 0 ? void 0 : filter.afterDate);
135615
137968
  return jsxs("div", __assign$g({
135616
137969
  ref: publishingDateRef
135617
137970
  }, {
@@ -135619,13 +137972,13 @@ var PublishingDateFilter = function PublishingDateFilter() {
135619
137972
  iconProps: {
135620
137973
  iconName: showDates ? 'ChevronUp' : 'ChevronDown'
135621
137974
  },
135622
- text: formatMessage({
137975
+ text: isActive ? getButtonText() : formatMessage({
135623
137976
  id: 'FilterPanel.publishingDate'
135624
137977
  }),
135625
137978
  onClick: function () {
135626
137979
  return setShowDates(!showDates);
135627
137980
  },
135628
- isActive: (filter === null || filter === void 0 ? void 0 : filter.beforeDate) || (filter === null || filter === void 0 ? void 0 : filter.afterDate)
137981
+ isActive: isActive
135629
137982
  }, void 0), showDates && jsx$1(Callout, __assign$g({
135630
137983
  target: publishingDateRef.current,
135631
137984
  onDismiss: function () {
@@ -135659,8 +138012,7 @@ var PublishingDateFilter = function PublishingDateFilter() {
135659
138012
  noDateResourceKey: "MetadataEditor.noDate",
135660
138013
  selectDateResourceKey: "FilterPanel.publishingDatePlaceholder",
135661
138014
  onChanged: handleEndDateChange,
135662
- minDate: filter === null || filter === void 0 ? void 0 : filter.afterDate,
135663
- maxDate: today.toString()
138015
+ minDate: filter === null || filter === void 0 ? void 0 : filter.afterDate
135664
138016
  }, void 0), jsxs(DateShortcuts, {
135665
138017
  children: [jsx$1(FormattedMessage$1, {
135666
138018
  id: "FilterPanel.publishingDateShortcuts"
@@ -135734,6 +138086,25 @@ var PublishingDateFilter = function PublishingDateFilter() {
135734
138086
  afterDate: null
135735
138087
  }));
135736
138088
  }
138089
+
138090
+ function getButtonText() {
138091
+ var start = format(new Date(filter.afterDate), 'P');
138092
+ var end = format(new Date(filter.beforeDate), 'P');
138093
+
138094
+ if (!filter.afterDate) {
138095
+ return formatMessage({
138096
+ id: 'FilterPanel.publishingDateBefore'
138097
+ }) + " " + end;
138098
+ }
138099
+
138100
+ if (!filter.beforeDate) {
138101
+ return formatMessage({
138102
+ id: 'FilterPanel.publishingDateAfter'
138103
+ }) + " " + start;
138104
+ }
138105
+
138106
+ return start + " - " + end;
138107
+ }
135737
138108
  };
135738
138109
 
135739
138110
  var DateShortcutButton = function DateShortcutButton(_a) {