@livetiles/reach-components-react 0.4.0-preview.217 → 0.4.0-preview.220
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/en.async.esm.esm.js +2 -0
- package/index.esm2.js +2436 -46
- package/index.umd.js +2438 -46
- package/package.json +1 -1
package/index.umd.js
CHANGED
|
@@ -1214,16 +1214,16 @@
|
|
|
1214
1214
|
var process$7 = global$r.process;
|
|
1215
1215
|
var versions$5 = process$7 && process$7.versions;
|
|
1216
1216
|
var v8$4 = versions$5 && versions$5.v8;
|
|
1217
|
-
var match$
|
|
1217
|
+
var match$7, version$a;
|
|
1218
1218
|
|
|
1219
1219
|
if (v8$4) {
|
|
1220
|
-
match$
|
|
1221
|
-
version$a = match$
|
|
1220
|
+
match$7 = v8$4.split('.');
|
|
1221
|
+
version$a = match$7[0] + match$7[1];
|
|
1222
1222
|
} else if (userAgent$5) {
|
|
1223
|
-
match$
|
|
1224
|
-
if (!match$
|
|
1225
|
-
match$
|
|
1226
|
-
if (match$
|
|
1223
|
+
match$7 = userAgent$5.match(/Edge\/(\d+)/);
|
|
1224
|
+
if (!match$7 || match$7[1] >= 74) {
|
|
1225
|
+
match$7 = userAgent$5.match(/Chrome\/(\d+)/);
|
|
1226
|
+
if (match$7) version$a = match$7[1];
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
@@ -41518,17 +41518,17 @@
|
|
|
41518
41518
|
var process$1$3 = global$2$3.process;
|
|
41519
41519
|
var versions$3 = process$1$3 && process$1$3.versions;
|
|
41520
41520
|
var v8$3 = versions$3 && versions$3.v8;
|
|
41521
|
-
var match$
|
|
41521
|
+
var match$6, version$7;
|
|
41522
41522
|
|
|
41523
41523
|
if (v8$3) {
|
|
41524
|
-
match$
|
|
41525
|
-
version$7 = match$
|
|
41524
|
+
match$6 = v8$3.split('.');
|
|
41525
|
+
version$7 = match$6[0] + match$6[1];
|
|
41526
41526
|
} else if (userAgent$4) {
|
|
41527
|
-
match$
|
|
41527
|
+
match$6 = userAgent$4.match(/Edge\/(\d+)/);
|
|
41528
41528
|
|
|
41529
|
-
if (!match$
|
|
41530
|
-
match$
|
|
41531
|
-
if (match$
|
|
41529
|
+
if (!match$6 || match$6[1] >= 74) {
|
|
41530
|
+
match$6 = userAgent$4.match(/Chrome\/(\d+)/);
|
|
41531
|
+
if (match$6) version$7 = match$6[1];
|
|
41532
41532
|
}
|
|
41533
41533
|
}
|
|
41534
41534
|
|
|
@@ -49753,17 +49753,17 @@
|
|
|
49753
49753
|
var process$2$2 = global$4$2.process;
|
|
49754
49754
|
var versions$2 = process$2$2 && process$2$2.versions;
|
|
49755
49755
|
var v8$2 = versions$2 && versions$2.v8;
|
|
49756
|
-
var match$
|
|
49756
|
+
var match$5, version$6;
|
|
49757
49757
|
|
|
49758
49758
|
if (v8$2) {
|
|
49759
|
-
match$
|
|
49760
|
-
version$6 = match$
|
|
49759
|
+
match$5 = v8$2.split('.');
|
|
49760
|
+
version$6 = match$5[0] + match$5[1];
|
|
49761
49761
|
} else if (userAgent$3) {
|
|
49762
|
-
match$
|
|
49762
|
+
match$5 = userAgent$3.match(/Edge\/(\d+)/);
|
|
49763
49763
|
|
|
49764
|
-
if (!match$
|
|
49765
|
-
match$
|
|
49766
|
-
if (match$
|
|
49764
|
+
if (!match$5 || match$5[1] >= 74) {
|
|
49765
|
+
match$5 = userAgent$3.match(/Chrome\/(\d+)/);
|
|
49766
|
+
if (match$5) version$6 = match$5[1];
|
|
49767
49767
|
}
|
|
49768
49768
|
}
|
|
49769
49769
|
|
|
@@ -66092,7 +66092,7 @@
|
|
|
66092
66092
|
var booleanValueOf = Boolean.prototype.valueOf;
|
|
66093
66093
|
var objectToString = Object.prototype.toString;
|
|
66094
66094
|
var functionToString$2 = Function.prototype.toString;
|
|
66095
|
-
var match$
|
|
66095
|
+
var match$4 = String.prototype.match;
|
|
66096
66096
|
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
66097
66097
|
var gOPS = Object.getOwnPropertySymbols;
|
|
66098
66098
|
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
|
@@ -66268,7 +66268,7 @@
|
|
|
66268
66268
|
if (isString$1(obj)) {
|
|
66269
66269
|
return markBoxed(inspect(String(obj)));
|
|
66270
66270
|
}
|
|
66271
|
-
if (!isDate(obj) && !isRegExp$8(obj)) {
|
|
66271
|
+
if (!isDate$1(obj) && !isRegExp$8(obj)) {
|
|
66272
66272
|
var ys = arrObjKeys(obj, inspect);
|
|
66273
66273
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
66274
66274
|
var protoTag = obj instanceof Object ? '' : 'null prototype';
|
|
@@ -66294,7 +66294,7 @@
|
|
|
66294
66294
|
}
|
|
66295
66295
|
|
|
66296
66296
|
function isArray$8(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
66297
|
-
function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
66297
|
+
function isDate$1(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
66298
66298
|
function isRegExp$8(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
66299
66299
|
function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
66300
66300
|
function isString$1(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
@@ -66341,7 +66341,7 @@
|
|
|
66341
66341
|
|
|
66342
66342
|
function nameOf(f) {
|
|
66343
66343
|
if (f.name) { return f.name; }
|
|
66344
|
-
var m = match$
|
|
66344
|
+
var m = match$4.call(functionToString$2.call(f), /^function\s*([\w$]+)/);
|
|
66345
66345
|
if (m) { return m[1]; }
|
|
66346
66346
|
return null;
|
|
66347
66347
|
}
|
|
@@ -70876,7 +70876,7 @@
|
|
|
70876
70876
|
|
|
70877
70877
|
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
70878
70878
|
|
|
70879
|
-
function format(message) {
|
|
70879
|
+
function format$1(message) {
|
|
70880
70880
|
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
70881
70881
|
return message.replace(/#{\s*key\s*}/g, copyKey);
|
|
70882
70882
|
}
|
|
@@ -70955,7 +70955,7 @@
|
|
|
70955
70955
|
} catch (err) {
|
|
70956
70956
|
debug && console.error("unable to copy using clipboardData: ", err);
|
|
70957
70957
|
debug && console.error("falling back to prompt");
|
|
70958
|
-
message = format("message" in options ? options.message : defaultMessage);
|
|
70958
|
+
message = format$1("message" in options ? options.message : defaultMessage);
|
|
70959
70959
|
window.prompt(message, text);
|
|
70960
70960
|
}
|
|
70961
70961
|
} finally {
|
|
@@ -80172,17 +80172,17 @@
|
|
|
80172
80172
|
var process$2$1 = global$2$1.process;
|
|
80173
80173
|
var versions$1 = process$2$1 && process$2$1.versions;
|
|
80174
80174
|
var v8$1 = versions$1 && versions$1.v8;
|
|
80175
|
-
var match$
|
|
80175
|
+
var match$3, version$2;
|
|
80176
80176
|
|
|
80177
80177
|
if (v8$1) {
|
|
80178
|
-
match$
|
|
80179
|
-
version$2 = match$
|
|
80178
|
+
match$3 = v8$1.split('.');
|
|
80179
|
+
version$2 = match$3[0] + match$3[1];
|
|
80180
80180
|
} else if (userAgent$2) {
|
|
80181
|
-
match$
|
|
80181
|
+
match$3 = userAgent$2.match(/Edge\/(\d+)/);
|
|
80182
80182
|
|
|
80183
|
-
if (!match$
|
|
80184
|
-
match$
|
|
80185
|
-
if (match$
|
|
80183
|
+
if (!match$3 || match$3[1] >= 74) {
|
|
80184
|
+
match$3 = userAgent$2.match(/Chrome\/(\d+)/);
|
|
80185
|
+
if (match$3) version$2 = match$3[1];
|
|
80186
80186
|
}
|
|
80187
80187
|
}
|
|
80188
80188
|
|
|
@@ -87330,9 +87330,9 @@
|
|
|
87330
87330
|
}), void 0);
|
|
87331
87331
|
};
|
|
87332
87332
|
|
|
87333
|
-
var version$1 = "0.4.0-preview.
|
|
87334
|
-
var buildId = "
|
|
87335
|
-
var commitId = "
|
|
87333
|
+
var version$1 = "0.4.0-preview.220";
|
|
87334
|
+
var buildId = "98559";
|
|
87335
|
+
var commitId = "7ad59dc49b9a9178bb883160dd9f17eb211b740e";
|
|
87336
87336
|
var isCustomerBuild = false;
|
|
87337
87337
|
var buildInfo = {
|
|
87338
87338
|
version: version$1,
|
|
@@ -131493,7 +131493,7 @@
|
|
|
131493
131493
|
// - setTimeout
|
|
131494
131494
|
}else {notify$1=function(){// strange IE + webpack dev server bug - use .call(global)
|
|
131495
131495
|
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)
|
|
131496
|
-
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
|
|
131496
|
+
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
|
|
131497
131497
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
131498
131498
|
// We can't detect it synchronously, so just check versions
|
|
131499
131499
|
if(V8_VERSION===66)return true;// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
@@ -131535,7 +131535,7 @@
|
|
|
131535
131535
|
// https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
|
|
131536
131536
|
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
|
|
131537
131537
|
// https://tc39.github.io/ecma262/#sec-object.assign
|
|
131538
|
-
$$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)
|
|
131538
|
+
$$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)
|
|
131539
131539
|
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
|
|
131540
131540
|
item.fileAccessToken=null;}});observer.next(cachedPage);}return [4/*yield*/,apiLoader];case 2:apiPage_1=_a.sent();// no need to wait for updating the cache
|
|
131541
131541
|
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
|
|
@@ -131714,7 +131714,7 @@
|
|
|
131714
131714
|
// for this case the blockProps would be an empty object and
|
|
131715
131715
|
// we need to set the showPages and showDocuments to true
|
|
131716
131716
|
var InlinePageListByCurrentPage=function InlinePageListByCurrentPage(_a){var _b=_a.blockProps,props=_b===void 0?{showDocuments:true,showPages:true}:_b;var item=useDetailViewContext().item;var getSubpages=usePagesApi().getSubpages;var buildPath=useSubscriptionHandlePathBuilder().buildPath;var _c=useItemLoaderByCurrentPage(item.id,defaultPageSize,item.navigationContext,{showPages:props.showPages,showDocuments:props.showDocuments},getAllSubItems,[item===null||item===void 0?void 0:item.id]),items=_c.pageItems,pagingProps=_c.pagingProps;if(items.length===0){return null;}return jsxRuntime.jsx(InlinePageListWithPaging,{pages:items,pagingProps:pagingProps,baseRoute:buildPath('pages'),filterBaseUrl:buildPath('/pages/search')},void 0);function getAllSubItems(id,pageType){return __awaiter(this,void 0,void 0,function(){var result;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,getSubpages(id,{pageType:pageType})];case 1:result=_a.sent();return [2/*return*/,result.items];}});});}};var InlinePageList=function InlinePageList(_a){var blockProps=_a.blockProps;if(blockProps===null||blockProps===void 0?void 0:blockProps.keywords){return jsxRuntime.jsx(InlinePageListByKeywords,{keywords:blockProps.keywords.split(','),showPages:blockProps.showPages,showDocuments:blockProps.showDocuments},void 0);}if(blockProps===null||blockProps===void 0?void 0:blockProps.pageId){return jsxRuntime.jsx(InlinePageListByPageId,{pageId:blockProps.pageId,showPages:blockProps.showPages,showDocuments:blockProps.showDocuments},void 0);}return jsxRuntime.jsx(InlinePageListByCurrentPage,{blockProps:blockProps},void 0);};var InlinePageListMapper={component:InlinePageList,type:EntityType.InlinePageList,getPropsFromHtml:function(nodeName,node){if(nodeName!=='div'){return null;}var pageListId=node.getAttribute('data-page-list-id');if(pageListId==null){return null;}var showChildren=node.getAttribute('data-show-children')==='true';var showDocumentsAttribute=node.getAttribute('data-show-documents');var showPagesAttribute=node.getAttribute('data-show-pages');var pageId=node.getAttribute('data-page-id');var keywords=node.getAttribute('data-keywords');if(!showDocumentsAttribute&&!showPagesAttribute){// ensure backwards compatibility
|
|
131717
|
-
return {id:pageListId,showChildren:showChildren,showPages:true,showDocuments:false,pageId:pageId,keywords:keywords};}var showDocuments=showDocumentsAttribute==='true';var showPages=showPagesAttribute==='true';return {id:pageListId,showChildren:showChildren,showDocuments:showDocuments,showPages:showPages,pageId:pageId,keywords:keywords};}};var PageBreadcrumb=function PageBreadcrumb(_a){var page=_a.page,target=_a.target,languageOverride=_a.language,hideCurrentPageNode=_a.hideCurrentPageNode,className=_a.className;var user=useCurrentUser();var formatMessage=useIntl().formatMessage;var history=ReactRouterDom.useHistory();if(!page||!page.navigationContext){return null;}var _b=getBreadcrumbsItems(page,target,handleOnClick,function(page){return getTitle(page,user,formatMessage,languageOverride);},formatMessage,hideCurrentPageNode),parentNode=_b.parentNode,breadcrumbItems=_b.breadcrumbItems;return jsxRuntime.jsxs("div",__assign({className:className},{children:[jsxRuntime.jsx(LargeScreenBreadcrumb,{items:breadcrumbItems,onRenderItem:renderBreadcrumbItem,overflowIndex:1,"data-breadcrumb":true,overflowAriaLabel:formatMessage({id:'AriaLabel.otherPages'}),focusZoneProps:{handleTabKey:1}},void 0),jsxRuntime.jsx(MobileBreadcrumb,{target:target,parentNode:parentNode},void 0)]}),void 0);function renderBreadcrumbItem(item){if(item.key==='home'){return jsxRuntime.jsx(BreadcrumbHomeItem,__assign({to:item.href,"aria-label":item.text,"data-pages-home-icon":true},{children:jsxRuntime.jsx(HomeIcon,{iconName:"HomeSolid"},void 0)}),void 0);}if(item.isCurrentItem){return jsxRuntime.jsx(BreadcrumbCurrentItem,__assign({"aria-current":"page"},{children:item.text}),void 0);}return jsxRuntime.jsx(BreadcrumbItem,__assign({to:item.href,"data-page-breadcrumb-node":item.key},{children:item.text}),void 0);}function handleOnClick(e,item){e.stopPropagation();e.preventDefault();history.push({pathname:item.href});}};var MobileBreadcrumb=function MobileBreadcrumb(_a){var target=_a.target,parentNode=_a.parentNode;var formatMessage=useIntl().formatMessage;return jsxRuntime.jsxs(MobileBreadcrumbHost,__assign({"data-mobile-breadcrumb":true},{children:[jsxRuntime.jsx("li",{children:jsxRuntime.jsx(BreadcrumbHomeItem,__assign({to:target,"aria-label":formatMessage({id:'Generic.home'}),"data-pages-home-icon":true},{children:jsxRuntime.jsx(HomeIcon,{iconName:"HomeSolid"},void 0)}),void 0)},void 0),parentNode&&jsxRuntime.jsxs(ParentNode,{children:[jsxRuntime.jsx(LeftChevronIcon,{iconName:"ChevronLeft"},void 0),jsxRuntime.jsx(BreadcrumbItem,__assign({to:NewsService.getNewsRoute(target,parentNode.id,parentNode.title),"data-page-breadcrumb-parent-node":parentNode.id},{children:parentNode.title}),void 0)]},void 0)]}),void 0);};var MobileBreadcrumbHost=_styled__default["default"].ul.withConfig({displayName:"PageBreadcrumb__MobileBreadcrumbHost",componentId:"sc-1m4qq1d-0"})(templateObject_1$Q||(templateObject_1$Q=__makeTemplateObject(["\n display: none;\n align-items: center;\n padding: 0;\n margin: 0;\n list-style: none;\n font-size: ","px;\n\n @media (max-width: ","px) {\n display: flex;\n }\n"],["\n display: none;\n align-items: center;\n padding: 0;\n margin: 0;\n list-style: none;\n font-size: ","px;\n\n @media (max-width: ","px) {\n display: flex;\n }\n"])),fontSizeSmall,maxScreenSize.medium);var ParentNode=_styled__default["default"].li.withConfig({displayName:"PageBreadcrumb__ParentNode",componentId:"sc-1m4qq1d-1"})(templateObject_2$w||(templateObject_2$w=__makeTemplateObject(["\n margin: 0 ","px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ",";\n"],["\n margin: 0 ","px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ",";\n"])),spacingM,function(p){return p.theme.palette.accent;});var LeftChevronIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"PageBreadcrumb__LeftChevronIcon",componentId:"sc-1m4qq1d-2"})(templateObject_3$n||(templateObject_3$n=__makeTemplateObject(["\n font-size: 10px;\n font-weight: bold;\n color: ",";\n"],["\n font-size: 10px;\n font-weight: bold;\n color: ",";\n"])),function(p){return p.theme.palette.accent;});var LargeScreenBreadcrumb=_styled__default["default"](officeUiFabricReact.Breadcrumb).withConfig({displayName:"PageBreadcrumb__LargeScreenBreadcrumb",componentId:"sc-1m4qq1d-3"})(templateObject_4$e||(templateObject_4$e=__makeTemplateObject(["\n && {\n margin: 0;\n }\n\n .ms-Breadcrumb-chevron {\n font-weight: bold;\n }\n\n @media (max-width: ","px) {\n display: none;\n }\n"],["\n && {\n margin: 0;\n }\n\n .ms-Breadcrumb-chevron {\n font-weight: bold;\n }\n\n @media (max-width: ","px) {\n display: none;\n }\n"])),maxScreenSize.medium);var HomeIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"PageBreadcrumb__HomeIcon",componentId:"sc-1m4qq1d-4"})(templateObject_5$c||(templateObject_5$c=__makeTemplateObject(["\n padding-top: 1px;\n"],["\n padding-top: 1px;\n"])));var BreadcrumbItem=_styled__default["default"](ReactRouterDom.NavLink).withConfig({displayName:"PageBreadcrumb__BreadcrumbItem",componentId:"sc-1m4qq1d-5"})(templateObject_6$6$1||(templateObject_6$6$1=__makeTemplateObject(["\n padding: 0 ","px;\n color: ",";\n"],["\n padding: 0 ","px;\n color: ",";\n"])),spacingS,function(p){return p.theme.palette.accent;});var BreadcrumbHomeItem=_styled__default["default"](ReactRouterDom.NavLink).withConfig({displayName:"PageBreadcrumb__BreadcrumbHomeItem",componentId:"sc-1m4qq1d-6"})(templateObject_7$4$1||(templateObject_7$4$1=__makeTemplateObject(["\n color: ",";\n\n + i {\n padding-left: ","px;\n }\n"],["\n color: ",";\n\n + i {\n padding-left: ","px;\n }\n"])),function(p){return p.theme.palette.accent;},spacingS);var BreadcrumbCurrentItem=_styled__default["default"].div.withConfig({displayName:"PageBreadcrumb__BreadcrumbCurrentItem",componentId:"sc-1m4qq1d-7"})(templateObject_8$4$1||(templateObject_8$4$1=__makeTemplateObject(["\n padding-left: ","px;\n color: ",";\n"],["\n padding-left: ","px;\n color: ",";\n"])),spacingS,function(p){return p.theme.palette.neutralSecondaryAlt;});var templateObject_1$Q,templateObject_2$w,templateObject_3$n,templateObject_4$e,templateObject_5$c,templateObject_6$6$1,templateObject_7$4$1,templateObject_8$4$1;var DetailViewPageDocumentDownload=function DetailViewPageDocumentDownload(){var user=useCurrentUser();var _a=useDetailViewContext(),item=_a.item,preferredContent=_a.content;if(!item){return null;}var content=(preferredContent===null||preferredContent===void 0?void 0:preferredContent.fileInfo)?preferredContent:getContentForPage(item,user).content;if(!(content===null||content===void 0?void 0:content.fileInfo)){return null;}return jsxRuntime.jsx(PageDocumentDownloadButton,{item:item,content:content},void 0);};var PageDocumentDownloadButton=function PageDocumentDownloadButton(_a){var item=_a.item,content=_a.content,basePath=_a.basePath;var _b=useInlinePageDocument({pageId:item.id,fileId:content.fileInfo.fileId,extension:content.fileInfo.extension,title:content.title,fileName:content.fileInfo.fileName},item,basePath),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsxRuntime.jsxs(Host$k,{children:[jsxRuntime.jsx(FormattedMessage$1,{id:"Pages.documents.buttonDownloadInfo"},void 0),jsxRuntime.jsx(DownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0)]},void 0);};var Host$k=_styled__default["default"].div.withConfig({displayName:"DetailViewPageDocumentDownload__Host",componentId:"sc-1gtkslm-0"})(templateObject_1$P||(templateObject_1$P=__makeTemplateObject(["\n margin-top: ","px;\n"],["\n margin-top: ","px;\n"])),spacingM);var DownloadButton=_styled__default["default"](InlinePageDocumentDownloadButton).withConfig({displayName:"DetailViewPageDocumentDownload__DownloadButton",componentId:"sc-1gtkslm-1"})(templateObject_2$v||(templateObject_2$v=__makeTemplateObject(["\n margin-top: ","px;\n @media (min-width: ","px) {\n width: 50%;\n }\n"],["\n margin-top: ","px;\n @media (min-width: ","px) {\n width: 50%;\n }\n"])),spacingS,minScreenSize.medium);var templateObject_1$P,templateObject_2$v;_styled__default["default"](PublishableItemBanner).withConfig({displayName:"CardBanner__StyledBanner",componentId:"sc-mqzdnh-0"})(templateObject_1$O||(templateObject_1$O=__makeTemplateObject(["\n &.video-view-container {\n height: 100%; /* this is needed for not overlapping the card title */\n }\n"],["\n &.video-view-container {\n height: 100%; /* this is needed for not overlapping the card title */\n }\n"])));var templateObject_1$O;_styled__default["default"].div.withConfig({displayName:"Card__Host",componentId:"sc-1m8ygh-0"})(templateObject_1$N||(templateObject_1$N=__makeTemplateObject(["\n &.card {\n display: flex;\n background-color: white;\n box-shadow: 1px 1px 4px grey;\n box-sizing: border-box;\n\n width: 100%;\n\n margin-bottom: 10px;\n\n &[data-packed] {\n opacity: 1;\n }\n\n &.card-enter,\n &.card-appear {\n opacity: 0.01;\n }\n\n &.card-enter.card-enter-active,\n &.card-appear.card-appear-active {\n opacity: 1;\n transition: opacity 0.75s ease-in;\n }\n\n @media all and (min-width: ","px) {\n transition: opacity 0.75s ease-in;\n opacity: 0;\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n }\n"],["\n &.card {\n display: flex;\n background-color: white;\n box-shadow: 1px 1px 4px grey;\n box-sizing: border-box;\n\n width: 100%;\n\n margin-bottom: 10px;\n\n &[data-packed] {\n opacity: 1;\n }\n\n &.card-enter,\n &.card-appear {\n opacity: 0.01;\n }\n\n &.card-enter.card-enter-active,\n &.card-appear.card-appear-active {\n opacity: 1;\n transition: opacity 0.75s ease-in;\n }\n\n @media all and (min-width: ","px) {\n transition: opacity 0.75s ease-in;\n opacity: 0;\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n }\n"])),minScreenSize.small,cardWidthS,minScreenSize.medium,cardWidthM,minScreenSize.large,cardWidthL,minScreenSize.xLarge,cardWidthXL);_styled__default["default"].article.withConfig({displayName:"Card__Article",componentId:"sc-1m8ygh-1"})(templateObject_3$m||(templateObject_3$m=__makeTemplateObject(["\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n ","\n\n > .card-banner {\n height: calc(((100vw - ","px) * (1 / ",")));\n flex: 0 1 auto;\n }\n\n .card-title {\n margin-top: 7px;\n margin-bottom: 0;\n font-size: 1.1em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n\n .card-metaInfo {\n padding-top: ","px;\n color: #666;\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n .card-title {\n margin-top: 7px;\n font-size: 1.3em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n }\n"],["\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n ","\n\n > .card-banner {\n height: calc(((100vw - ","px) * (1 / ",")));\n flex: 0 1 auto;\n }\n\n .card-title {\n margin-top: 7px;\n margin-bottom: 0;\n font-size: 1.1em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n\n .card-metaInfo {\n padding-top: ","px;\n color: #666;\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n .card-title {\n margin-top: 7px;\n font-size: 1.3em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n }\n"])),function(p){return p.highlight&&_styled.css(templateObject_2$u||(templateObject_2$u=__makeTemplateObject(["\n &::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "],["\n &::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "])),spacingXs,function(p){return p.theme.palette.accent;});},spacingM,bannerAspectRatio,spacingM,minScreenSize.small,cardWidthS,bannerAspectRatio,minScreenSize.medium,cardWidthM,bannerAspectRatio,minScreenSize.large,cardWidthL,bannerAspectRatio,minScreenSize.xLarge,cardWidthXL,bannerAspectRatio);var templateObject_1$N,templateObject_2$u,templateObject_3$m;var LanguageSelector=function LanguageSelector(props){var history=ReactRouterDom.useHistory();var currentUser=useCurrentUser();var buildPath=useSubscriptionHandlePathBuilder().buildPath;var getAllLanguagesLocalized=useLanguageApi().getAllLanguagesLocalized;var intl=useIntl();var formatMessage=intl.formatMessage;var languageDefinitions=usePromise$2(function(){return getAllLanguagesLocalized(intl);})[0];var features=useFeatures();if(languageDefinitions==null){return null;}if(props.chromeless)return jsxRuntime.jsx(ActionButton,__assign({iconProps:{iconName:'World'},menuProps:{items:getContextualMenuItems(),className:'lt-reach-callout'},className:classNames(props.className,'header-button')},{children:formatMessage({id:"Generic.languages."+props.selectedLanguage})}),void 0);return jsxRuntime.jsx(Tooltip,__assign({resourceKey:"Generic.translate"},{children:jsxRuntime.jsx(LanguageSelectorButton,{menuIconProps:{iconName:'World'},menuProps:{items:getContextualMenuItems(),className:'lt-reach-callout',isBeakVisible:props.showBeak},className:classNames(props.className,'header-button'),"data-language-selector-button":true,ariaLabel:formatMessage({id:'AriaLabel.autoTranslation'})},void 0)}),void 0);function getContextualMenuItems(){if(props.languages==null){return [];}var menuItems=[];var preferredLanguageItem=getPreferredLanguageItem();if(preferredLanguageItem){menuItems.push(preferredLanguageItem);}var activeLanguagesItems=getActiveLanguagesItems();activeLanguagesItems.sort(function(a,b){return a.text.localeCompare(b.text);});menuItems=menuItems.concat(activeLanguagesItems);if(!props.hideEditLanguagePreferences){var editLanguagePreferencesItem={key:'edit',text:formatMessage({id:'Generic.editLanguagePreferences'}),iconProps:{iconName:'PlayerSettings'},onClick:handleEditLanguagePreferences,className:'lt-reach-languageselector-menu-item'};menuItems.push(editLanguagePreferencesItem);}return menuItems;}function handleEditLanguagePreferences(){if(props.onEditLanguagePreferencesClick){props.onEditLanguagePreferencesClick();}else {history.push(buildPath('/user'));}}function getActiveLanguagesItems(){return props.languages.map(function(l){var fullLanguage=languageDefinitions.find(function(ld){return ld.code===l;});return {key:l,text:fullLanguage.localizedName,iconProps:{iconName:'World'},onClick:function(){return props.onLanguageChange(l.toString());},className:classNames('lt-reach-languageselector-menu-item',l===props.selectedLanguage&&'selected')};});}function getPreferredLanguageItem(){if(!features.automaticTranslation){return null;}if(!props.onTranslateClick){return null;}var preferredContentLanguage=getPreferredContentLanguage(currentUser);var shouldAddPreferredContentLanguage=preferredContentLanguage!=null&&!contentLanguagesWithoutAutomaticTranslation.includes(preferredContentLanguage)&&allAvailableContentLanguages.includes(preferredContentLanguage)&&props.languages.indexOf(preferredContentLanguage)<0;if(!shouldAddPreferredContentLanguage){return null;}return {key:preferredContentLanguage,text:formatMessage({id:'Generic.automaticTranslation'},{language:formatMessage({id:"Generic.languages."+preferredContentLanguage})}),iconProps:{iconName:'Robot'},onClick:function(){return props.onTranslateClick(preferredContentLanguage);},className:classNames('lt-reach-languageselector-menu-item',preferredContentLanguage===props.selectedLanguage&&'selected')};}};var LanguageSelectorButton=_styled__default["default"](IconButton).withConfig({displayName:"LanguageSelector__LanguageSelectorButton",componentId:"sc-48zwek-0"})(templateObject_1$M||(templateObject_1$M=__makeTemplateObject(["\n && {\n height: 100%;\n margin: 0;\n background-color: transparent;\n }\n"],["\n && {\n height: 100%;\n margin: 0;\n background-color: transparent;\n }\n"])));var templateObject_1$M;_styled__default["default"].article.withConfig({displayName:"DetailViewArticle__Host",componentId:"sc-we2q7z-0"})(templateObject_1$L||(templateObject_1$L=__makeTemplateObject(["\n min-width: 300px;\n width: 100%;\n\n flex: 1 0 auto;\n display: flex;\n flex-flow: column nowrap;\n\n @media (min-width: ","px) {\n box-shadow: 1px 1px 4px grey;\n max-width: ","px;\n }\n"],["\n min-width: 300px;\n width: 100%;\n\n flex: 1 0 auto;\n display: flex;\n flex-flow: column nowrap;\n\n @media (min-width: ","px) {\n box-shadow: 1px 1px 4px grey;\n max-width: ","px;\n }\n"])),minScreenSize.large+1,maxContentWidth);var templateObject_1$L;var DetailViewBanner=function DetailViewBanner(){var _a=useDetailViewContext(),item=_a.item,resourceType=_a.resourceType,isEditorPreview=_a.isEditorPreview;if(!item.bannerInfo){return null;}return jsxRuntime.jsx(Banner$3,{itemId:item.id,token:item.fileAccessToken,bannerInfo:item.bannerInfo,useEditorRoutes:isEditorPreview,width:getMaxImageWidth(),canOpenImage:true,resourceType:resourceType},void 0);};var Banner$3=_styled__default["default"](PublishableItemBanner).withConfig({displayName:"DetailViewBanner__Banner",componentId:"sc-1wuqvtw-0"})(templateObject_1$K||(templateObject_1$K=__makeTemplateObject(["\n && {\n height: calc(100vw * (1 / ","));\n\n @media (min-width: ","px) {\n height: calc(\n (","px - (2 * ","px)) *\n (1 / ",")\n );\n }\n }\n"],["\n && {\n height: calc(100vw * (1 / ","));\n\n @media (min-width: ","px) {\n height: calc(\n (","px - (2 * ","px)) *\n (1 / ",")\n );\n }\n }\n"])),bannerAspectRatio,minScreenSize.large+1,minScreenSize.large,spacingM,bannerAspectRatio);var templateObject_1$K;var DetailViewIntro=function DetailViewIntro(){var content=useDetailViewContext().content;var hasIntro=content.intro&&content.intro.length>0;if(!hasIntro){return null;}return jsxRuntime.jsx(DetailIntro,{children:content.intro},void 0);};var DetailIntro=_styled__default["default"].p.withConfig({displayName:"DetailViewIntro__DetailIntro",componentId:"sc-1kubhyf-0"})(templateObject_1$J||(templateObject_1$J=__makeTemplateObject(["\n margin: 0;\n font-size: ","px;\n line-height: 26px;\n font-weight: normal;\n\n min-width: 100%;\n width: 100px;\n\n @media (min-width: ","px) {\n margin-top: ","px;\n margin-bottom: ","px;\n line-height: 24px;\n font-size: ","px;\n }\n"],["\n margin: 0;\n font-size: ","px;\n line-height: 26px;\n font-weight: normal;\n\n min-width: 100%;\n width: 100px;\n\n @media (min-width: ","px) {\n margin-top: ","px;\n margin-bottom: ","px;\n line-height: 24px;\n font-size: ","px;\n }\n"])),fontSizeNormal,minScreenSize.small,spacingS,spacingS+2,fontSizeMedium+2);var templateObject_1$J;var DetailMainSection=function DetailMainSection(_a){var children=_a.children;return jsxRuntime.jsx(DetailMainStyledSection,__assign({className:"detail-view-main"},{children:children}),void 0);};var DetailMainStyledSection=_styled__default["default"].section.withConfig({displayName:"DetailViewMainSection__DetailMainStyledSection",componentId:"sc-ifywhg-0"})(templateObject_1$I||(templateObject_1$I=__makeTemplateObject(["\n position: relative;\n flex: 1 0 auto;\n display: flex;\n flex-direction: column;\n padding: ","px ","px\n ","px;\n font-size: 16px;\n\n @media (min-width: ","px) {\n padding: ","px\n ","px ","px;\n }\n"],["\n position: relative;\n flex: 1 0 auto;\n display: flex;\n flex-direction: column;\n padding: ","px ","px\n ","px;\n font-size: 16px;\n\n @media (min-width: ","px) {\n padding: ","px\n ","px ","px;\n }\n"])),detailViewSectionPadding-5,detailViewSectionPadding,detailViewSectionPadding,minScreenSize.small,detailViewSectionPaddingLarge-10,detailViewSectionPaddingLarge,detailViewSectionPaddingLarge);var templateObject_1$I;var GutterMarkerIcon=function GutterMarkerIcon(_a){var iconName=_a.iconName,children=_a.children,isActive=_a.isActive,color=_a.color,tooltipResourceKey=_a.tooltipResourceKey,className=_a.className;return jsxRuntime.jsxs(Host$h$1,__assign({className:className},{children:[jsxRuntime.jsx(IconContainer$1,__assign({isActive:isActive,className:isActive?"ms-bgColor-"+color:'ms-bgColor-white'},{children:isActive&&jsxRuntime.jsx(StyledTooltip,__assign({resourceKey:tooltipResourceKey},{children:jsxRuntime.jsx(StyledIcon$2$1,{className:"ms-fontColor-white",iconName:iconName},void 0)}),void 0)}),void 0),isActive?jsxRuntime.jsx(ActiveContent,__assign({className:"ms-borderColor-"+color},{children:children}),void 0):jsxRuntime.jsx(Content$3,{children:children},void 0)]}),void 0);};var Host$h$1=_styled__default["default"].div.withConfig({displayName:"GutterMakerIcon__Host",componentId:"sc-aa2cf4-0"})(templateObject_1$H||(templateObject_1$H=__makeTemplateObject(["\n margin: 0;\n display: flex;\n align-content: center;\n"],["\n margin: 0;\n display: flex;\n align-content: center;\n"])));var StyledIcon$2$1=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"GutterMakerIcon__StyledIcon",componentId:"sc-aa2cf4-1"})(templateObject_2$t||(templateObject_2$t=__makeTemplateObject(["\n font-size: 25px;\n"],["\n font-size: 25px;\n"])));var Content$3=_styled__default["default"].div.withConfig({displayName:"GutterMakerIcon__Content",componentId:"sc-aa2cf4-2"})(templateObject_3$l||(templateObject_3$l=__makeTemplateObject(["\n flex: 1 1 auto;\n flex-basis: 100%; /*IE fix*/\n\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n"],["\n flex: 1 1 auto;\n flex-basis: 100%; /*IE fix*/\n\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n"])));var ActiveContent=_styled__default["default"](Content$3).withConfig({displayName:"GutterMakerIcon__ActiveContent",componentId:"sc-aa2cf4-3"})(templateObject_4$d$1||(templateObject_4$d$1=__makeTemplateObject(["\n padding-left: 10px;\n min-height: 50px;\n\n border-bottom-style: solid;\n border-bottom-width: 4px;\n"],["\n padding-left: 10px;\n min-height: 50px;\n\n border-bottom-style: solid;\n border-bottom-width: 4px;\n"])));var IconContainer$1=_styled__default["default"].div.withConfig({displayName:"GutterMakerIcon__IconContainer",componentId:"sc-aa2cf4-4"})(templateObject_5$b||(templateObject_5$b=__makeTemplateObject(["\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: ",";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n padding: 10px 0;\n"],["\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: ",";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n padding: 10px 0;\n"])),function(_a){var isActive=_a.isActive;return isActive?'50px':'auto';});var StyledTooltip=_styled__default["default"](Tooltip).withConfig({displayName:"GutterMakerIcon__StyledTooltip",componentId:"sc-aa2cf4-5"})(templateObject_6$5$1||(templateObject_6$5$1=__makeTemplateObject(["\n && {\n display: inherit;\n }\n"],["\n && {\n display: inherit;\n }\n"])));var templateObject_1$H,templateObject_2$t,templateObject_3$l,templateObject_4$d$1,templateObject_5$b,templateObject_6$5$1;var DetailViewTitle=function DetailViewTitle(){var _a=useDetailViewContext(),content=_a.content,item=_a.item;var hasAlert=hasFlag(item.knownState,KnownNewsState.Alert);return jsxRuntime.jsx(GutterMarkerIcon,__assign({iconName:"Warning",isActive:hasAlert,color:"red",tooltipResourceKey:"NewsArticle.alert"},{children:jsxRuntime.jsx(Title$4,__assign({"data-title":true},{children:content.title}),void 0)}),void 0);};var Title$4=_styled__default["default"].h1.withConfig({displayName:"DetailViewTitle__Title",componentId:"sc-1jbzvna-0"})(templateObject_1$G||(templateObject_1$G=__makeTemplateObject(["\n color: black;\n width: 100%;\n font-size: ","px;\n line-height: 29px;\n margin: 0;\n\n @media (min-width: ","px) {\n font-size: 2.2em;\n line-height: 42px;\n }\n"],["\n color: black;\n width: 100%;\n font-size: ","px;\n line-height: 29px;\n margin: 0;\n\n @media (min-width: ","px) {\n font-size: 2.2em;\n line-height: 42px;\n }\n"])),fontSizeLarge-1,minScreenSize.small);var templateObject_1$G;_styled__default["default"](ItemMetaInfo).withConfig({displayName:"NewsDetailViewMetaInfo__DetailMetaInfo",componentId:"sc-kib7we-0"})(templateObject_1$F||(templateObject_1$F=__makeTemplateObject(["\n display: flex;\n font-size: ","px;\n margin-top: 12px;\n"],["\n display: flex;\n font-size: ","px;\n margin-top: 12px;\n"])),fontSizeSmall);var templateObject_1$F;var mappers=[InlineImageMapper,InlineFileMapper,InlineQuoteMapper,InlineGalleryMapper,InlineCodeMapper,InlineVideoMapper,InlineTable,InlineContactMapper,InlinePageListMapper,InlineUrlPreviewMapper];var RichTextViewer=function RichTextViewer(_a){var html=_a.html;return jsxRuntime.jsx(TextViewer,{html:html,componentMappers:mappers},void 0);};var DetailViewBody=function DetailViewBody(){var _a=useDetailViewContext(),content=_a.content,resourceType=_a.resourceType;var bodyHtml=content&&content.body;return jsxRuntime.jsx(DetailBody$1,__assign({className:"lt-reach-detail-view-body","data-item-type":resourceType},{children:jsxRuntime.jsx(ItemBodyWrapper,{children:jsxRuntime.jsx(RichTextViewer,{html:bodyHtml},void 0)},void 0)}),void 0);};var DetailBody$1=_styled__default["default"].div.withConfig({displayName:"DetailViewBody__DetailBody",componentId:"sc-7b4trq-0"})(templateObject_1$E||(templateObject_1$E=__makeTemplateObject(["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n\n // So that headings have the correct semantics for accessibility (i.e. title is h1, subheadings start at h2),\n // but maintain the same visual design, this styles each heading to look one \"step\" larger\n // e.g. h2 looks like h1, etc.\n && {\n h2 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h4 {\n font-size: ","px;\n }\n\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n }\n"],["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n\n // So that headings have the correct semantics for accessibility (i.e. title is h1, subheadings start at h2),\n // but maintain the same visual design, this styles each heading to look one \"step\" larger\n // e.g. h2 looks like h1, etc.\n && {\n h2 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h4 {\n font-size: ","px;\n }\n\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n }\n"])),fontSizeLarge-1,spacingS+2,fontSizeLarge-3,fontSizeLarge-5,spacingS);var templateObject_1$E;var DetailViewKeywords=function DetailViewKeywords(_a){var filterBaseUrl=_a.filterBaseUrl;var features=useFeatures();var _b=useDetailViewContext(),item=_b.item,userPreferredLanguage=_b.userPreferredLanguage;var formatMessage=useIntl().formatMessage;if(!features.keywords){return null;}return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.keys(item.keywords).length>0&&jsxRuntime.jsx(KeywordsSection,__assign({"aria-label":formatMessage({id:'AriaLabel.section.keywords'})},{children:jsxRuntime.jsx(KeywordsInfo,{keywords:item.keywords,language:userPreferredLanguage,filterBaseUrl:filterBaseUrl},void 0)}),void 0)},void 0);};var KeywordsSection=_styled__default["default"].section.withConfig({displayName:"DetailViewKeywords__KeywordsSection",componentId:"sc-ltysu4-0"})(templateObject_1$D||(templateObject_1$D=__makeTemplateObject(["\n margin-top: 2em;\n display: flex;\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"],["\n margin-top: 2em;\n display: flex;\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"])),maxScreenSize.medium,fontSizeSmall);var templateObject_1$D;var ConfirmationBox=function ConfirmationBox(_a){var disabled=_a.disabled,checked=_a.checked,onChange=_a.onChange;var formatMessage=useIntl().formatMessage;return jsxRuntime.jsx(Host$g$1,{children:jsxRuntime.jsx(NeutralCheckBox,{disabled:disabled,checked:checked,onChange:function(_,value){return onChange(value);},label:formatMessage({id:checked?'NewsArticle.confirmed':'NewsArticle.confirm'})},void 0)},void 0);};var Host$g$1=_styled__default["default"].div.withConfig({displayName:"ConfirmationBox__Host",componentId:"sc-1m5alil-0"})(templateObject_1$C||(templateObject_1$C=__makeTemplateObject(["\n .ms-Checkbox-text {\n font-weight: bold;\n color: black;\n }\n"],["\n .ms-Checkbox-text {\n font-weight: bold;\n color: black;\n }\n"])));var templateObject_1$C;var ConfirmationSection=function ConfirmationSection(_a){var item=_a.item,showDescription=_a.showDescription,readOnly=_a.readOnly,className=_a.className;var refreshStatistics=useNewsApi().refreshStatistics;var _b=useNotificationContext(),dismissToast=_b.dismissToast,showToast=_b.showToast,showError=_b.showError;var _c=useFeedbackApi(),getFeedback=_c.getFeedback,setFeedback=_c.setFeedback,unsetFeedback=_c.unsetFeedback;var _d=usePromise$2(function(){return getFeedback(ItemResourceTypes.News,item.id);}),summary=_d[0],isLoading=_d[1];var _e=React$d.useState(null),userChecked=_e[0],setChecked=_e[1];var toastHandle=React$d.useRef(null);var checked=userChecked!==null?userChecked:summary!=null&&!!summary.records.find(function(r){return r.type==='confirm';});return jsxRuntime.jsxs(Host$f$1,__assign({isLoading:isLoading,className:className},{children:[showDescription&&jsxRuntime.jsx(FormattedMessage$1,{id:"NewsArticle.confirmationRequiredDescription",tagName:"p"},void 0),jsxRuntime.jsx(StyledGutterMarkerIcon,__assign({iconName:"Completed",isActive:!isLoading&&!checked,color:"green"},{children:readOnly?jsxRuntime.jsx(ConfirmationBox,{checked:checked,disabled:true},void 0):jsxRuntime.jsx(ConfirmationBox,{checked:checked,disabled:checked,onChange:handleClickConfirm},void 0)}),void 0)]}),void 0);function handleClickConfirm(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:setChecked(true);_a.label=1;case 1:_a.trys.push([1,4,,5]);return [4/*yield*/,setFeedback(ItemResourceTypes.News,item.id,'confirm')];case 2:_a.sent();toastHandle.current=showToast('NewsArticle.confirmationSuccessToast',{},jsxRuntime.jsx(officeUiFabricReact.DefaultButton,__assign({onClick:handleUndo},{children:jsxRuntime.jsx(FormattedMessage$1,{id:"Generic.undo"},void 0)}),void 0),{autoClose:false});return [4/*yield*/,refreshStatistics(item.id,{confirmationCount:1})];case 3:_a.sent();return [3/*break*/,5];case 4:error_1=_a.sent();logger.error(error_1);showError('Generic.error');setChecked(false);return [3/*break*/,5];case 5:return [2/*return*/];}});});}function handleUndo(){return __awaiter(this,void 0,void 0,function(){var error_2;return __generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,3,,4]);dismissToast(toastHandle.current);toastHandle.current=null;return [4/*yield*/,unsetFeedback(ItemResourceTypes.News,item.id,'confirm')];case 1:_a.sent();return [4/*yield*/,refreshStatistics(item.id,{confirmationCount:-1})];case 2:_a.sent();setChecked(false);return [3/*break*/,4];case 3:error_2=_a.sent();logger.error(error_2);showError('Generic.error');return [3/*break*/,4];case 4:return [2/*return*/];}});});}};var Host$f$1=_styled__default["default"].div.withConfig({displayName:"ConfirmationSection__Host",componentId:"sc-1g2fxdb-0"})(templateObject_1$B||(templateObject_1$B=__makeTemplateObject(["\n width: 100%;\n\n opacity: ",";\n\n > p {\n margin: 0 0 5px ","px;\n font-style: italic;\n }\n\n @media (min-width: ","px) {\n > p {\n margin: 0 0 ","px 0;\n }\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"],["\n width: 100%;\n\n opacity: ",";\n\n > p {\n margin: 0 0 5px ","px;\n font-style: italic;\n }\n\n @media (min-width: ","px) {\n > p {\n margin: 0 0 ","px 0;\n }\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"])),function(_a){var isLoading=_a.isLoading;return isLoading?0.4:1;},spacingM,minScreenSize.small,spacingS,maxScreenSize.medium,fontSizeSmall);var StyledGutterMarkerIcon=_styled__default["default"](GutterMarkerIcon).withConfig({displayName:"ConfirmationSection__StyledGutterMarkerIcon",componentId:"sc-1g2fxdb-1"})(templateObject_2$s||(templateObject_2$s=__makeTemplateObject(["\n @media (max-width: ","px) {\n margin: 0 ","px 0;\n }\n"],["\n @media (max-width: ","px) {\n margin: 0 ","px 0;\n }\n"])),maxScreenSize.small,spacingM);var templateObject_1$B,templateObject_2$s;var DetailViewConfirmations=function DetailViewConfirmations(){var features=useFeatures();var _a=useDetailViewContext(),item=_a.item,isEditorPreview=_a.isEditorPreview;var formatMessage=useIntl().formatMessage;if(!showConfirmationBox()){return null;}return jsxRuntime.jsx(ConfirmationHost,__assign({"aria-label":formatMessage({id:'NewsArticle.confirmation'})},{children:jsxRuntime.jsx(ConfirmationSection,{item:item,showDescription:true,readOnly:isEditorPreview},void 0)}),void 0);function showConfirmationBox(){return features.confirmation&&item.metadata&&item.metadata.feedbackSettings&&item.metadata.feedbackSettings.feedbackOptions.indexOf('confirm')>=0;}};var ConfirmationHost=_styled__default["default"].section.withConfig({displayName:"DetailViewConfirmations__ConfirmationHost",componentId:"sc-f8jogv-0"})(templateObject_1$A||(templateObject_1$A=__makeTemplateObject(["\n margin-bottom: ","px;\n\n @media (min-width: ","px) {\n padding: 0 ","px 0 ","px;\n }\n"],["\n margin-bottom: ","px;\n\n @media (min-width: ","px) {\n padding: 0 ","px 0 ","px;\n }\n"])),spacingL,minScreenSize.small,spacingXl,spacingXl);var templateObject_1$A;var DetailViewPageViewTracker=function DetailViewPageViewTracker(){var _a=useDetailViewContext(),resourceType=_a.resourceType,itemId=_a.itemId;usePageViewTracker(resourceType,itemId);return null;};var FeedbackButtonBookmark=function FeedbackButtonBookmark(_a){var isReadOnly=_a.isReadOnly;var _b=React$d.useContext(FeedbackButtonContext),item=_b.item,bookmarkCount=_b.statistics.bookmarkCount;return jsxRuntime.jsxs(CountButtonHost,{children:[jsxRuntime.jsx(BookmarkButton,{item:item,isReadOnly:isReadOnly},void 0),jsxRuntime.jsx(CountLabel,__assign({isDisabled:isReadOnly},{children:bookmarkCount}),void 0)]},void 0);};var NewsDetailViewFeedbackSection=function NewsDetailViewFeedbackSection(_a){var _b;var hideLikes=_a.hideLikes,hideComments=_a.hideComments,hideProfileUrl=_a.hideProfileUrl,disableLoginForPublicUser=_a.disableLoginForPublicUser;var _c=useDetailViewContext(),item=_c.item,resourceType=_c.resourceType,contentLanguage=_c.contentLanguage,isEditorPreview=_c.isEditorPreview;return jsxRuntime.jsxs(StyledFeedbackSection,__assign({item:item,language:contentLanguage,type:resourceType,feedbackSettings:(_b=item.metadata)===null||_b===void 0?void 0:_b.feedbackSettings,hideComments:hideComments,hideProfileUrl:hideProfileUrl,disableLoginForPublicUser:disableLoginForPublicUser,isReadOnly:isEditorPreview},{children:[!hideLikes&&jsxRuntime.jsx(FeedbackButtonLike,{isReadOnly:isEditorPreview},void 0),jsxRuntime.jsx(FeedbackButtonBookmark,{isReadOnly:isEditorPreview},void 0),!hideComments&&jsxRuntime.jsx(FeedbackButtonComments,{},void 0),jsxRuntime.jsx(FeedbackButtonViews,{},void 0),jsxRuntime.jsx(FeedbackButtonShare,{isReadOnly:isEditorPreview},void 0),jsxRuntime.jsx(FeedbackButtonConfirmations,{},void 0)]}),void 0);};var StyledFeedbackSection=_styled__default["default"](FeedbackSection).withConfig({displayName:"NewsDetailViewFeedbackSection__StyledFeedbackSection",componentId:"sc-pjpy6x-0"})(templateObject_1$z||(templateObject_1$z=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),DetailViewSectionPadding);var templateObject_1$z;var DetailViewBodyExternalContent=function DetailViewBodyExternalContent(_a){var itemType=_a.itemType;var content=useDetailViewContext().content;var externalUrl=content&&content.externalUrl;return jsxRuntime.jsx(DetailBody,__assign({className:"lt-reach-detail-view-body"},{children:jsxRuntime.jsx(ItemBodyWrapper,{children:jsxRuntime.jsx(FormattedMessageWithStyle,{id:"ExternalLink."+itemType+".navigateTo",tagName:"p",values:{url:jsxRuntime.jsx(ExternalLink$2,__assign({href:externalUrl,className:"ms-fontColor-accent",target:"_blank",rel:"noopener noreferrer"},{children:externalUrl}),void 0)}},void 0)},void 0)}),void 0);};var DetailBody=_styled__default["default"].div.withConfig({displayName:"DetailViewBodyExternalContent__DetailBody",componentId:"sc-1xjgw89-0"})(templateObject_1$y||(templateObject_1$y=__makeTemplateObject(["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n"],["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n"])));var templateObject_1$y;var DetailViewHeadline=function DetailViewHeadline(){var content=useDetailViewContext().content;var features=useFeatures();if(!features.contentHeadline||!content.headline){return null;}return jsxRuntime.jsx(Headline$1$1,__assign({"data-detail-view-headline":true},{children:content.headline}),void 0);};var Headline$1$1=_styled__default["default"].p.withConfig({displayName:"DetailViewHeadline__Headline",componentId:"sc-wsid06-0"})(templateObject_1$x||(templateObject_1$x=__makeTemplateObject(["\n width: 100%;\n font-weight: bold;\n font-size: ","px;\n line-height: 26px;\n margin: 0;\n\n @media (min-width: ","px) {\n line-height: 22px;\n font-size: ","px;\n margin-bottom: ","px;\n }\n"],["\n width: 100%;\n font-weight: bold;\n font-size: ","px;\n line-height: 26px;\n margin: 0;\n\n @media (min-width: ","px) {\n line-height: 22px;\n font-size: ","px;\n margin-bottom: ","px;\n }\n"])),fontSizeNormal,minScreenSize.small,fontSizeMedium,spacingS);var templateObject_1$x;var StateIcon=function StateIcon(_a){var status=_a.status,isActive=_a.isActive,_b=_a.width,width=_b===void 0?16:_b,activeColor=_a.activeColor;var textColors=React$d.useContext(ThemeContext$1).theme.textColors;if(status===WorkflowStatus.draft){return jsxRuntime.jsx(Draft,{width:width,color:isActive?activeColor||textColors.onSecondary:textColors.default},void 0);}else if(status===WorkflowStatus.rejected){return jsxRuntime.jsx(Draft,{width:width,color:isActive?activeColor:'#b90000'},void 0);}else if(status===WorkflowStatus.ready){return jsxRuntime.jsx(Ready,{width:width,color:isActive?activeColor||textColors.onSecondary:textColors.default},void 0);}return null;};var Draft=function Draft(_a){var color=_a.color,className=_a.className,_b=_a.width,width=_b===void 0?16.25:_b;var ratio=20/16.25;return jsxRuntime.jsx("svg",__assign({className:className,version:"1.1",id:"Layer_1",x:"0px",y:"0px",width:width+"px",height:width*ratio+"px",viewBox:"0 0 16.25 20",enableBackground:"new 0 0 16.25 20"},{children:jsxRuntime.jsx("path",{fill:color,d:"M10,6.25V0h0.89l5.36,5.361V6.25H10z M11.25,5h2.861L11.25,2.139V5z M10,0H9.25v1.25H10V0z M7.675,1.25H6.1\n\tV0h1.575V1.25z M4.525,1.25H2.95V0h1.575V1.25z M1.25,17.057H0v-1.567h1.25V17.057z M1.25,13.921H0v-1.568h1.25V13.921z\n\t M1.25,10.784H0V9.216h1.25V10.784z M1.25,7.647H0V6.08h1.25V7.647z M1.25,4.512H0V2.943h1.25V4.512z M13.375,\n\t 20h-1.5v-1.25h1.5V20z\n\t M10.375,20h-1.5v-1.25h1.5V20z M7.375,20h-1.5v-1.25h1.5V20z M4.375,20h-1.5v-1.25h1.5V20z M16.25,\n\t 16.964H15v-1.661h1.25V16.964z\n\t M16.25,13.643H15v-1.661h1.25V13.643z M16.25,10.321H15V8.66h1.25V10.321z M16.25,6.25H15V7h1.25V6.25z\n\t M1.25,18.75H0V20h1.25\n\tV18.75z M1.25,0H0v1.25h1.25V0z M16.25,18.75H15V20h1.25V18.75z"},void 0)}),void 0);};var Ready=function Ready(_a){var color=_a.color,className=_a.className,_b=_a.width,width=_b===void 0?18.564:_b;var ratio=20/18.564;return jsxRuntime.jsx("svg",__assign({className:className,version:"1.1",id:"Layer_1",x:"0px",y:"0px",width:width+"px",height:width*ratio+"px",viewBox:"0 0 18.564 20",enableBackground:"new 0 0 18.564 20"},{children:jsxRuntime.jsx("path",{fill:color,d:"M10,6.25v-5H1.25v17.5H10V20H0V0h10.889l5.361,5.361V12.5L15,13.75v-7.5H10z M18.564,14.551L13.125,20\n \tl-2.627-2.637l0.879-0.879l1.748,1.738l4.561-4.551L18.564,14.551z M11.25,5h2.861L11.25,2.139V5z"},void 0)}),void 0);};function useCommonEditorApi(){var api=useApi();return React$d.useMemo(function(){return {list:list,getTaskViewCounts:getTaskViewCounts};function list(type,filter,token,sortDefinition){var params=Object.assign({},__assign(__assign(__assign({},filter),getCommaSeparatedChannelsString(filter===null||filter===void 0?void 0:filter.channels)),getCommaSeparatedKeywordsString(filter===null||filter===void 0?void 0:filter.keywords)),{token:token},sortDefinition);return api.custom("editor/"+type+"?"+queryString.stringify(params)).get().then(function(res){return res.body().data();});}function getTaskViewCounts(type,groupId){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,api.custom("editor/"+type+"/taskcounts?"+queryString.stringify({groupId:groupId})).get(groupId)];case 1:response=_a.sent();return [4/*yield*/,response.body().data()];case 2:return [2/*return*/,_a.sent()];}});});}},[api]);}var SortFieldsDefinitionBuilder=/** @class */function(){function SortFieldsDefinitionBuilder(){this.sort=[];}SortFieldsDefinitionBuilder.prototype.addSortField=function(field,direction){this.sort.push(field+":"+SortFieldsDefinitionBuilder.getSortDirectionAsString(direction));return this;};SortFieldsDefinitionBuilder.getSortDirectionAsString=function(direction){return direction===SortDirection.asc?'asc':'desc';};return SortFieldsDefinitionBuilder;}();var EventSortFieldsDefinitionBuilder=/** @class */function(_super){__extends(EventSortFieldsDefinitionBuilder,_super);function EventSortFieldsDefinitionBuilder(){return _super!==null&&_super.apply(this,arguments)||this;}EventSortFieldsDefinitionBuilder.create=function(){return new EventSortFieldsDefinitionBuilder();};return EventSortFieldsDefinitionBuilder;}(SortFieldsDefinitionBuilder);EventSortFieldsDefinitionBuilder.create().addSortField('startDate',SortDirection.desc);EventSortFieldsDefinitionBuilder.create().addSortField('publishingDate',SortDirection.desc);var ItemType;(function(ItemType){ItemType[ItemType["None"]=0]="None";ItemType[ItemType["News"]=1]="News";ItemType[ItemType["Post"]=2]="Post";ItemType[ItemType["Page"]=4]="Page";ItemType[ItemType["Event"]=8]="Event";})(ItemType||(ItemType={}));var BaseFilterDefinitionImpl=/** @class */function(){function BaseFilterDefinitionImpl(){}return BaseFilterDefinitionImpl;}();__spreadArray(__spreadArray([],Object.keys(new BaseFilterDefinitionImpl())),['hideChrome','teams']);var KeywordPickerGroup=function KeywordPickerGroup(_a){var group=_a.group,keywords=_a.keywords,expanded=_a.expanded,selectedKeywords=_a.selectedKeywords,onChange=_a.onChange,mandatoryKeywordIds=_a.mandatoryKeywordIds;var _b=React$d.useState(null),isExpanded=_b[0],setIsExpanded=_b[1];var isSelected=!!selectedKeywords.find(function(k){return k.groupId===group.id;});var isCollapsed=!(isExpanded===true||expanded);return jsxRuntime.jsxs(Host$e$1,{children:[jsxRuntime.jsxs(GroupButton,__assign({onClick:toggle,iconProps:{iconName:isCollapsed?'CaretRightSolid8':'CaretDownSolid8'},"aria-expanded":!isCollapsed,"aria-controls":group.name+"-list"},{children:[isSelected&&jsxRuntime.jsx(CheckMarkIcon,{iconName:"CheckMark"},void 0),jsxRuntime.jsx(ButtonLabel,__assign({"data-keyword-group":group.name,isSelected:isSelected},{children:jsxRuntime.jsx(KeywordTitle,{groupName:group.name},void 0)}),void 0)]}),void 0),jsxRuntime.jsx(KeywordsList,__assign({id:group.name+"-list","data-keyword-picker-group-list":true,isCollapsed:isCollapsed},{children:keywords.map(function(k){var checked=isKeywordSelected(k);var disabled=isKeywordDisabled(k);return jsxRuntime.jsx(KeywordItem,__assign({"data-keyword":k.name,"data-is-checked":checked,"data-is-disabled":disabled},{children:jsxRuntime.jsx(officeUiFabricReact.Checkbox,{label:k.name,onRenderLabel:function(){return jsxRuntime.jsx(KeywordTitle,{groupName:group.name,keywordName:k.name},void 0);},checked:checked,onChange:function(_e,isChecked){return handleChange(isChecked,k);},disabled:disabled},k.id)}),k.name);})}),void 0)]},void 0);function toggle(){setIsExpanded(!isExpanded);}function isKeywordSelected(keyword){return !!selectedKeywords.find(function(k){return k.id===keyword.id;});}function isKeywordDisabled(keyword){return mandatoryKeywordIds===null||mandatoryKeywordIds===void 0?void 0:mandatoryKeywordIds.some(function(id){return id===keyword.id;});}function handleChange(add,keyword){if(onChange){var result=selectedKeywords.filter(function(k){return keyword.id!==k.id;});if(add){result.push(keyword);}onChange(result);}}};var Host$e$1=_styled__default["default"].div.withConfig({displayName:"KeywordPickerGroup__Host",componentId:"sc-pu16jm-0"})(templateObject_1$w||(templateObject_1$w=__makeTemplateObject(["\n margin-bottom: ","px;\n"],["\n margin-bottom: ","px;\n"])),spacingS);var GroupButton=_styled__default["default"](ActionButton).withConfig({displayName:"KeywordPickerGroup__GroupButton",componentId:"sc-pu16jm-1"})(templateObject_2$r||(templateObject_2$r=__makeTemplateObject(["\n && {\n height: auto;\n font-size: ","px;\n padding: 0;\n border: 0;\n\n i {\n font-size: ","px;\n\n &:first-child {\n margin: 0;\n }\n }\n }\n"],["\n && {\n height: auto;\n font-size: ","px;\n padding: 0;\n border: 0;\n\n i {\n font-size: ","px;\n\n &:first-child {\n margin: 0;\n }\n }\n }\n"])),fontSizeNormal,fontSizeSmall);var CheckMarkIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"KeywordPickerGroup__CheckMarkIcon",componentId:"sc-pu16jm-2"})(templateObject_3$k||(templateObject_3$k=__makeTemplateObject(["\n margin-right: 6px;\n margin-left: 12px;\n width: 15px;\n"],["\n margin-right: 6px;\n margin-left: 12px;\n width: 15px;\n"])));var ButtonLabel=_styled__default["default"].span.withConfig({displayName:"KeywordPickerGroup__ButtonLabel",componentId:"sc-pu16jm-3"})(templateObject_5$a$1||(templateObject_5$a$1=__makeTemplateObject(["\n display: inline-flex;\n flex: 1 0 auto;\n\n ","\n"],["\n display: inline-flex;\n flex: 1 0 auto;\n\n ","\n"])),function(p){return !p.isSelected&&_styled.css(templateObject_4$c$1||(templateObject_4$c$1=__makeTemplateObject(["\n margin-left: 33px; // checkmark icon space\n "],["\n margin-left: 33px; // checkmark icon space\n "])));});var KeywordsList=_styled__default["default"].ul.withConfig({displayName:"KeywordPickerGroup__KeywordsList",componentId:"sc-pu16jm-4"})(templateObject_7$3$1||(templateObject_7$3$1=__makeTemplateObject(["\n ","\n padding: 0;\n margin: 0 0 0 ","px;\n list-style: none;\n"],["\n ","\n padding: 0;\n margin: 0 0 0 ","px;\n list-style: none;\n"])),function(p){return p.isCollapsed&&_styled.css(templateObject_6$4$1||(templateObject_6$4$1=__makeTemplateObject(["\n display: none;\n "],["\n display: none;\n "])));},spacingX+10);var KeywordItem=_styled__default["default"].li.withConfig({displayName:"KeywordPickerGroup__KeywordItem",componentId:"sc-pu16jm-5"})(templateObject_8$3$1||(templateObject_8$3$1=__makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-top: 9px;\n"],["\n display: flex;\n align-items: center;\n margin-top: 9px;\n"])));var templateObject_1$w,templateObject_2$r,templateObject_3$k,templateObject_4$c$1,templateObject_5$a$1,templateObject_6$4$1,templateObject_7$3$1,templateObject_8$3$1;var KeywordPicker=function KeywordPicker(_a){var _b;var value=_a.value,onChange=_a.onChange,showSelectionToggle=_a.showSelectionToggle,incomingAvailableKeywords=_a.availableKeywords,mandatoryKeywordIds=_a.mandatoryKeywordIds,className=_a.className;var formatMessage=useIntl().formatMessage;var user=useCurrentUser();var _c=React$d.useContext(LazySubscriptionContext),allKeywords=_c.allKeywords,selectedKeywordGroups=_c.selectedKeywordGroups;var _d=React$d.useState(null),searchedKeywords=_d[0],setSearchedKeywords=_d[1];var _e=React$d.useState(null),searchText=_e[0],setSearchText=_e[1];var selectedKeywords=getSelectedKeywords();var availableKeywords=incomingAvailableKeywords!==null&&incomingAvailableKeywords!==void 0?incomingAvailableKeywords:allKeywords;var visibleKeywords=(_b=searchedKeywords!==null&&searchedKeywords!==void 0?searchedKeywords:availableKeywords)!==null&&_b!==void 0?_b:[];var mandatoryKeywords=mandatoryKeywordIds?availableKeywords.filter(function(k){return mandatoryKeywordIds.includes(k.id);}):[];var noKeywordGroups=(selectedKeywordGroups===null||selectedKeywordGroups===void 0?void 0:selectedKeywordGroups.length)===0;var noAvailableKeywords=!noKeywordGroups&&(availableKeywords===null||availableKeywords===void 0?void 0:availableKeywords.length)===0;var isEmpty=visibleKeywords.length===0;return jsxRuntime.jsxs(Host$d$1,__assign({className:"keyword-picker"},{children:[(noKeywordGroups||noAvailableKeywords)&&jsxRuntime.jsx("span",__assign({className:"keyword-picker-empty"},{children:jsxRuntime.jsx(FormattedMessage$1,{id:noKeywordGroups?'KeywordPicker.noGroupsDefined':'KeywordPicker.noAvailableKeywordsForGroup'},void 0)}),void 0),!noKeywordGroups&&!noAvailableKeywords&&jsxRuntime.jsxs("div",__assign({className:className},{children:[jsxRuntime.jsxs(SearchHost,__assign({className:"keyword-picker-search","data-keyword-picker-search":true},{children:[jsxRuntime.jsx(officeUiFabricReact.TextField,{onChange:handleSearch,value:searchText||'',placeholder:formatMessage({id:'KeywordPicker.search'})},void 0),searchText&&jsxRuntime.jsx(SearchCancelButton,{iconProps:{iconName:'Cancel'},onClick:function(){return handleSearch(null,null);},"aria-hidden":"true"},void 0)]}),void 0),showSelectionToggle&&jsxRuntime.jsx(StyledToggleAllButtons,{toggleAll:handleToggleAll},void 0),jsxRuntime.jsxs(KeywordPickerTree,__assign({className:"keyword-picker-tree"},{children:[isEmpty&&jsxRuntime.jsx(FormattedMessage$1,{id:"KeywordPicker.emptySearch"},void 0),!isEmpty&&selectedKeywordGroups&&selectedKeywordGroups.sort(function(a,b){return a.name.localeCompare(b.name);}).map(function(g){var keywords=visibleKeywords.filter(function(k){return k.groupId===g.id;});return keywords.length===0?null:jsxRuntime.jsx(KeywordPickerGroup,{expanded:!!searchText,group:g,keywords:keywords,selectedKeywords:selectedKeywords,onChange:onChange,mandatoryKeywordIds:mandatoryKeywordIds},g.id);})]}),void 0)]}),void 0)]}),void 0);function getSelectedKeywords(){if(value==null||allKeywords==null){return [];}return value.map(function(k){return typeof k==='string'?allKeywords.find(function(a){return a.id===k;}):k;}).filter(function(k){return k;});}function handleSearch(_,text){var hasSearch=text&&text.length;var keywords=hasSearch?availableKeywords.filter(function(k){return getKeywordTitle(user,k.translations,k.name).toLocaleLowerCase().indexOf(text.toLocaleLowerCase())>=0;}):availableKeywords;setSearchedKeywords(keywords);setSearchText(hasSearch?text:null);}function handleToggleAll(checkAll){onChange(checkAll?availableKeywords:mandatoryKeywords);}};var KeywordPickerTree=_styled__default["default"].div.withConfig({displayName:"KeywordPicker__KeywordPickerTree",componentId:"sc-1ejjfwa-0"})(templateObject_1$v||(templateObject_1$v=__makeTemplateObject(["\n padding-left: 4px;\n"],["\n padding-left: 4px;\n"])));var StyledToggleAllButtons=_styled__default["default"](ToggleAllButtons).withConfig({displayName:"KeywordPicker__StyledToggleAllButtons",componentId:"sc-1ejjfwa-1"})(templateObject_2$q||(templateObject_2$q=__makeTemplateObject(["\n padding-left: 4px;\n"],["\n padding-left: 4px;\n"])));var Host$d$1=_styled__default["default"].div.withConfig({displayName:"KeywordPicker__Host",componentId:"sc-1ejjfwa-2"})(templateObject_3$j||(templateObject_3$j=__makeTemplateObject(["\n overflow-x: hidden;\n overflow-y: auto;\n\n .ms-TextField-fieldGroup {\n background: none;\n }\n"],["\n overflow-x: hidden;\n overflow-y: auto;\n\n .ms-TextField-fieldGroup {\n background: none;\n }\n"])));var SearchHost=_styled__default["default"].div.withConfig({displayName:"KeywordPicker__SearchHost",componentId:"sc-1ejjfwa-3"})(templateObject_4$b$1||(templateObject_4$b$1=__makeTemplateObject(["\n position: relative;\n margin-bottom: 8px;\n"],["\n position: relative;\n margin-bottom: 8px;\n"])));var SearchCancelButton=_styled__default["default"](IconButton).withConfig({displayName:"KeywordPicker__SearchCancelButton",componentId:"sc-1ejjfwa-4"})(templateObject_5$9$1||(templateObject_5$9$1=__makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n z-index: 10;\n\n &&&:focus::after {\n outline-offset: -2px;\n }\n"],["\n position: absolute;\n top: 0;\n right: 0;\n z-index: 10;\n\n &&&:focus::after {\n outline-offset: -2px;\n }\n"])));var templateObject_1$v,templateObject_2$q,templateObject_3$j,templateObject_4$b$1,templateObject_5$9$1;var $$2=_export;var requireObjectCoercible$1$1=requireObjectCoercible$c;var isRegExp=isRegexp;var getRegExpFlags=regexpFlags$1$1;var wellKnownSymbol$1=wellKnownSymbol$l;var REPLACE$2=wellKnownSymbol$1('replace');var RegExpPrototype$3=RegExp.prototype;// `String.prototype.replaceAll` method
|
|
131717
|
+
return {id:pageListId,showChildren:showChildren,showPages:true,showDocuments:false,pageId:pageId,keywords:keywords};}var showDocuments=showDocumentsAttribute==='true';var showPages=showPagesAttribute==='true';return {id:pageListId,showChildren:showChildren,showDocuments:showDocuments,showPages:showPages,pageId:pageId,keywords:keywords};}};var PageBreadcrumb=function PageBreadcrumb(_a){var page=_a.page,target=_a.target,languageOverride=_a.language,hideCurrentPageNode=_a.hideCurrentPageNode,className=_a.className;var user=useCurrentUser();var formatMessage=useIntl().formatMessage;var history=ReactRouterDom.useHistory();if(!page||!page.navigationContext){return null;}var _b=getBreadcrumbsItems(page,target,handleOnClick,function(page){return getTitle(page,user,formatMessage,languageOverride);},formatMessage,hideCurrentPageNode),parentNode=_b.parentNode,breadcrumbItems=_b.breadcrumbItems;return jsxRuntime.jsxs("div",__assign({className:className},{children:[jsxRuntime.jsx(LargeScreenBreadcrumb,{items:breadcrumbItems,onRenderItem:renderBreadcrumbItem,overflowIndex:1,"data-breadcrumb":true,overflowAriaLabel:formatMessage({id:'AriaLabel.otherPages'}),focusZoneProps:{handleTabKey:1}},void 0),jsxRuntime.jsx(MobileBreadcrumb,{target:target,parentNode:parentNode},void 0)]}),void 0);function renderBreadcrumbItem(item){if(item.key==='home'){return jsxRuntime.jsx(BreadcrumbHomeItem,__assign({to:item.href,"aria-label":item.text,"data-pages-home-icon":true},{children:jsxRuntime.jsx(HomeIcon,{iconName:"HomeSolid"},void 0)}),void 0);}if(item.isCurrentItem){return jsxRuntime.jsx(BreadcrumbCurrentItem,__assign({"aria-current":"page"},{children:item.text}),void 0);}return jsxRuntime.jsx(BreadcrumbItem,__assign({to:item.href,"data-page-breadcrumb-node":item.key},{children:item.text}),void 0);}function handleOnClick(e,item){e.stopPropagation();e.preventDefault();history.push({pathname:item.href});}};var MobileBreadcrumb=function MobileBreadcrumb(_a){var target=_a.target,parentNode=_a.parentNode;var formatMessage=useIntl().formatMessage;return jsxRuntime.jsxs(MobileBreadcrumbHost,__assign({"data-mobile-breadcrumb":true},{children:[jsxRuntime.jsx("li",{children:jsxRuntime.jsx(BreadcrumbHomeItem,__assign({to:target,"aria-label":formatMessage({id:'Generic.home'}),"data-pages-home-icon":true},{children:jsxRuntime.jsx(HomeIcon,{iconName:"HomeSolid"},void 0)}),void 0)},void 0),parentNode&&jsxRuntime.jsxs(ParentNode,{children:[jsxRuntime.jsx(LeftChevronIcon,{iconName:"ChevronLeft"},void 0),jsxRuntime.jsx(BreadcrumbItem,__assign({to:NewsService.getNewsRoute(target,parentNode.id,parentNode.title),"data-page-breadcrumb-parent-node":parentNode.id},{children:parentNode.title}),void 0)]},void 0)]}),void 0);};var MobileBreadcrumbHost=_styled__default["default"].ul.withConfig({displayName:"PageBreadcrumb__MobileBreadcrumbHost",componentId:"sc-1m4qq1d-0"})(templateObject_1$Q||(templateObject_1$Q=__makeTemplateObject(["\n display: none;\n align-items: center;\n padding: 0;\n margin: 0;\n list-style: none;\n font-size: ","px;\n\n @media (max-width: ","px) {\n display: flex;\n }\n"],["\n display: none;\n align-items: center;\n padding: 0;\n margin: 0;\n list-style: none;\n font-size: ","px;\n\n @media (max-width: ","px) {\n display: flex;\n }\n"])),fontSizeSmall,maxScreenSize.medium);var ParentNode=_styled__default["default"].li.withConfig({displayName:"PageBreadcrumb__ParentNode",componentId:"sc-1m4qq1d-1"})(templateObject_2$w||(templateObject_2$w=__makeTemplateObject(["\n margin: 0 ","px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ",";\n"],["\n margin: 0 ","px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ",";\n"])),spacingM,function(p){return p.theme.palette.accent;});var LeftChevronIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"PageBreadcrumb__LeftChevronIcon",componentId:"sc-1m4qq1d-2"})(templateObject_3$n||(templateObject_3$n=__makeTemplateObject(["\n font-size: 10px;\n font-weight: bold;\n color: ",";\n"],["\n font-size: 10px;\n font-weight: bold;\n color: ",";\n"])),function(p){return p.theme.palette.accent;});var LargeScreenBreadcrumb=_styled__default["default"](officeUiFabricReact.Breadcrumb).withConfig({displayName:"PageBreadcrumb__LargeScreenBreadcrumb",componentId:"sc-1m4qq1d-3"})(templateObject_4$e||(templateObject_4$e=__makeTemplateObject(["\n && {\n margin: 0;\n }\n\n .ms-Breadcrumb-chevron {\n font-weight: bold;\n }\n\n @media (max-width: ","px) {\n display: none;\n }\n"],["\n && {\n margin: 0;\n }\n\n .ms-Breadcrumb-chevron {\n font-weight: bold;\n }\n\n @media (max-width: ","px) {\n display: none;\n }\n"])),maxScreenSize.medium);var HomeIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"PageBreadcrumb__HomeIcon",componentId:"sc-1m4qq1d-4"})(templateObject_5$c||(templateObject_5$c=__makeTemplateObject(["\n padding-top: 1px;\n"],["\n padding-top: 1px;\n"])));var BreadcrumbItem=_styled__default["default"](ReactRouterDom.NavLink).withConfig({displayName:"PageBreadcrumb__BreadcrumbItem",componentId:"sc-1m4qq1d-5"})(templateObject_6$6$1||(templateObject_6$6$1=__makeTemplateObject(["\n padding: 0 ","px;\n color: ",";\n"],["\n padding: 0 ","px;\n color: ",";\n"])),spacingS,function(p){return p.theme.palette.accent;});var BreadcrumbHomeItem=_styled__default["default"](ReactRouterDom.NavLink).withConfig({displayName:"PageBreadcrumb__BreadcrumbHomeItem",componentId:"sc-1m4qq1d-6"})(templateObject_7$4$1||(templateObject_7$4$1=__makeTemplateObject(["\n color: ",";\n\n + i {\n padding-left: ","px;\n }\n"],["\n color: ",";\n\n + i {\n padding-left: ","px;\n }\n"])),function(p){return p.theme.palette.accent;},spacingS);var BreadcrumbCurrentItem=_styled__default["default"].div.withConfig({displayName:"PageBreadcrumb__BreadcrumbCurrentItem",componentId:"sc-1m4qq1d-7"})(templateObject_8$4$1||(templateObject_8$4$1=__makeTemplateObject(["\n padding-left: ","px;\n color: ",";\n"],["\n padding-left: ","px;\n color: ",";\n"])),spacingS,function(p){return p.theme.palette.neutralSecondaryAlt;});var templateObject_1$Q,templateObject_2$w,templateObject_3$n,templateObject_4$e,templateObject_5$c,templateObject_6$6$1,templateObject_7$4$1,templateObject_8$4$1;var DetailViewPageDocumentDownload=function DetailViewPageDocumentDownload(){var user=useCurrentUser();var _a=useDetailViewContext(),item=_a.item,preferredContent=_a.content;if(!item){return null;}var content=(preferredContent===null||preferredContent===void 0?void 0:preferredContent.fileInfo)?preferredContent:getContentForPage(item,user).content;if(!(content===null||content===void 0?void 0:content.fileInfo)){return null;}return jsxRuntime.jsx(PageDocumentDownloadButton,{item:item,content:content},void 0);};var PageDocumentDownloadButton=function PageDocumentDownloadButton(_a){var item=_a.item,content=_a.content,basePath=_a.basePath;var _b=useInlinePageDocument({pageId:item.id,fileId:content.fileInfo.fileId,extension:content.fileInfo.extension,title:content.title,fileName:content.fileInfo.fileName},item,basePath),fileUrl=_b.fileUrl,iconName=_b.iconName,title=_b.title,fileName=_b.fileName,onPageDocumentDownloadClick=_b.onPageDocumentDownloadClick;return jsxRuntime.jsxs(Host$k,{children:[jsxRuntime.jsx(FormattedMessage$1,{id:"Pages.documents.buttonDownloadInfo"},void 0),jsxRuntime.jsx(DownloadButton,{fileUrl:fileUrl,fileName:fileName,title:title,fileIconName:iconName,onClick:onPageDocumentDownloadClick},void 0)]},void 0);};var Host$k=_styled__default["default"].div.withConfig({displayName:"DetailViewPageDocumentDownload__Host",componentId:"sc-1gtkslm-0"})(templateObject_1$P||(templateObject_1$P=__makeTemplateObject(["\n margin-top: ","px;\n"],["\n margin-top: ","px;\n"])),spacingM);var DownloadButton=_styled__default["default"](InlinePageDocumentDownloadButton).withConfig({displayName:"DetailViewPageDocumentDownload__DownloadButton",componentId:"sc-1gtkslm-1"})(templateObject_2$v||(templateObject_2$v=__makeTemplateObject(["\n margin-top: ","px;\n @media (min-width: ","px) {\n width: 50%;\n }\n"],["\n margin-top: ","px;\n @media (min-width: ","px) {\n width: 50%;\n }\n"])),spacingS,minScreenSize.medium);var templateObject_1$P,templateObject_2$v;_styled__default["default"](PublishableItemBanner).withConfig({displayName:"CardBanner__StyledBanner",componentId:"sc-mqzdnh-0"})(templateObject_1$O||(templateObject_1$O=__makeTemplateObject(["\n &.video-view-container {\n height: 100%; /* this is needed for not overlapping the card title */\n }\n"],["\n &.video-view-container {\n height: 100%; /* this is needed for not overlapping the card title */\n }\n"])));var templateObject_1$O;_styled__default["default"].div.withConfig({displayName:"Card__Host",componentId:"sc-1m8ygh-0"})(templateObject_1$N||(templateObject_1$N=__makeTemplateObject(["\n &.card {\n display: flex;\n background-color: white;\n box-shadow: 1px 1px 4px grey;\n box-sizing: border-box;\n\n width: 100%;\n\n margin-bottom: 10px;\n\n &[data-packed] {\n opacity: 1;\n }\n\n &.card-enter,\n &.card-appear {\n opacity: 0.01;\n }\n\n &.card-enter.card-enter-active,\n &.card-appear.card-appear-active {\n opacity: 1;\n transition: opacity 0.75s ease-in;\n }\n\n @media all and (min-width: ","px) {\n transition: opacity 0.75s ease-in;\n opacity: 0;\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n }\n"],["\n &.card {\n display: flex;\n background-color: white;\n box-shadow: 1px 1px 4px grey;\n box-sizing: border-box;\n\n width: 100%;\n\n margin-bottom: 10px;\n\n &[data-packed] {\n opacity: 1;\n }\n\n &.card-enter,\n &.card-appear {\n opacity: 0.01;\n }\n\n &.card-enter.card-enter-active,\n &.card-appear.card-appear-active {\n opacity: 1;\n transition: opacity 0.75s ease-in;\n }\n\n @media all and (min-width: ","px) {\n transition: opacity 0.75s ease-in;\n opacity: 0;\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n\n @media all and (min-width: ","px) {\n width: ","px;\n }\n }\n"])),minScreenSize.small,cardWidthS,minScreenSize.medium,cardWidthM,minScreenSize.large,cardWidthL,minScreenSize.xLarge,cardWidthXL);_styled__default["default"].article.withConfig({displayName:"Card__Article",componentId:"sc-1m8ygh-1"})(templateObject_3$m||(templateObject_3$m=__makeTemplateObject(["\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n ","\n\n > .card-banner {\n height: calc(((100vw - ","px) * (1 / ",")));\n flex: 0 1 auto;\n }\n\n .card-title {\n margin-top: 7px;\n margin-bottom: 0;\n font-size: 1.1em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n\n .card-metaInfo {\n padding-top: ","px;\n color: #666;\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n .card-title {\n margin-top: 7px;\n font-size: 1.3em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n }\n"],["\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n\n ","\n\n > .card-banner {\n height: calc(((100vw - ","px) * (1 / ",")));\n flex: 0 1 auto;\n }\n\n .card-title {\n margin-top: 7px;\n margin-bottom: 0;\n font-size: 1.1em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n\n .card-metaInfo {\n padding-top: ","px;\n color: #666;\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n .card-title {\n margin-top: 7px;\n font-size: 1.3em;\n }\n\n .card-metaInfo {\n font-size: 0.9em;\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n\n @media all and (min-width: ","px) {\n > .card-banner {\n height: calc(","px * (1 / ","));\n }\n }\n }\n"])),function(p){return p.highlight&&_styled.css(templateObject_2$u||(templateObject_2$u=__makeTemplateObject(["\n &::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "],["\n &::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n width: ","px;\n display: block;\n background-color: ",";\n }\n "])),spacingXs,function(p){return p.theme.palette.accent;});},spacingM,bannerAspectRatio,spacingM,minScreenSize.small,cardWidthS,bannerAspectRatio,minScreenSize.medium,cardWidthM,bannerAspectRatio,minScreenSize.large,cardWidthL,bannerAspectRatio,minScreenSize.xLarge,cardWidthXL,bannerAspectRatio);var templateObject_1$N,templateObject_2$u,templateObject_3$m;var LanguageSelector=function LanguageSelector(props){var history=ReactRouterDom.useHistory();var currentUser=useCurrentUser();var buildPath=useSubscriptionHandlePathBuilder().buildPath;var getAllLanguagesLocalized=useLanguageApi().getAllLanguagesLocalized;var intl=useIntl();var formatMessage=intl.formatMessage;var languageDefinitions=usePromise$2(function(){return getAllLanguagesLocalized(intl);})[0];var features=useFeatures();if(languageDefinitions==null){return null;}if(props.chromeless)return jsxRuntime.jsx(ActionButton,__assign({iconProps:{iconName:'World'},menuProps:{items:getContextualMenuItems(),className:'lt-reach-callout'},className:classNames(props.className,'header-button')},{children:formatMessage({id:"Generic.languages."+props.selectedLanguage})}),void 0);return jsxRuntime.jsx(Tooltip,__assign({resourceKey:"Generic.translate"},{children:jsxRuntime.jsx(LanguageSelectorButton,{menuIconProps:{iconName:'World'},menuProps:{items:getContextualMenuItems(),className:'lt-reach-callout',isBeakVisible:props.showBeak},className:classNames(props.className,'header-button'),"data-language-selector-button":true,ariaLabel:formatMessage({id:'AriaLabel.autoTranslation'})},void 0)}),void 0);function getContextualMenuItems(){if(props.languages==null){return [];}var menuItems=[];var preferredLanguageItem=getPreferredLanguageItem();if(preferredLanguageItem){menuItems.push(preferredLanguageItem);}var activeLanguagesItems=getActiveLanguagesItems();activeLanguagesItems.sort(function(a,b){return a.text.localeCompare(b.text);});menuItems=menuItems.concat(activeLanguagesItems);if(!props.hideEditLanguagePreferences){var editLanguagePreferencesItem={key:'edit',text:formatMessage({id:'Generic.editLanguagePreferences'}),iconProps:{iconName:'PlayerSettings'},onClick:handleEditLanguagePreferences,className:'lt-reach-languageselector-menu-item'};menuItems.push(editLanguagePreferencesItem);}return menuItems;}function handleEditLanguagePreferences(){if(props.onEditLanguagePreferencesClick){props.onEditLanguagePreferencesClick();}else {history.push(buildPath('/user'));}}function getActiveLanguagesItems(){return props.languages.map(function(l){var fullLanguage=languageDefinitions.find(function(ld){return ld.code===l;});return {key:l,text:fullLanguage.localizedName,iconProps:{iconName:'World'},onClick:function(){return props.onLanguageChange(l.toString());},className:classNames('lt-reach-languageselector-menu-item',l===props.selectedLanguage&&'selected')};});}function getPreferredLanguageItem(){if(!features.automaticTranslation){return null;}if(!props.onTranslateClick){return null;}var preferredContentLanguage=getPreferredContentLanguage(currentUser);var shouldAddPreferredContentLanguage=preferredContentLanguage!=null&&!contentLanguagesWithoutAutomaticTranslation.includes(preferredContentLanguage)&&allAvailableContentLanguages.includes(preferredContentLanguage)&&props.languages.indexOf(preferredContentLanguage)<0;if(!shouldAddPreferredContentLanguage){return null;}return {key:preferredContentLanguage,text:formatMessage({id:'Generic.automaticTranslation'},{language:formatMessage({id:"Generic.languages."+preferredContentLanguage})}),iconProps:{iconName:'Robot'},onClick:function(){return props.onTranslateClick(preferredContentLanguage);},className:classNames('lt-reach-languageselector-menu-item',preferredContentLanguage===props.selectedLanguage&&'selected')};}};var LanguageSelectorButton=_styled__default["default"](IconButton).withConfig({displayName:"LanguageSelector__LanguageSelectorButton",componentId:"sc-48zwek-0"})(templateObject_1$M||(templateObject_1$M=__makeTemplateObject(["\n && {\n height: 100%;\n margin: 0;\n background-color: transparent;\n }\n"],["\n && {\n height: 100%;\n margin: 0;\n background-color: transparent;\n }\n"])));var templateObject_1$M;_styled__default["default"].article.withConfig({displayName:"DetailViewArticle__Host",componentId:"sc-we2q7z-0"})(templateObject_1$L||(templateObject_1$L=__makeTemplateObject(["\n min-width: 300px;\n width: 100%;\n\n flex: 1 0 auto;\n display: flex;\n flex-flow: column nowrap;\n\n @media (min-width: ","px) {\n box-shadow: 1px 1px 4px grey;\n max-width: ","px;\n }\n"],["\n min-width: 300px;\n width: 100%;\n\n flex: 1 0 auto;\n display: flex;\n flex-flow: column nowrap;\n\n @media (min-width: ","px) {\n box-shadow: 1px 1px 4px grey;\n max-width: ","px;\n }\n"])),minScreenSize.large+1,maxContentWidth);var templateObject_1$L;var DetailViewBanner=function DetailViewBanner(){var _a=useDetailViewContext(),item=_a.item,resourceType=_a.resourceType,isEditorPreview=_a.isEditorPreview;if(!item.bannerInfo){return null;}return jsxRuntime.jsx(Banner$3,{itemId:item.id,token:item.fileAccessToken,bannerInfo:item.bannerInfo,useEditorRoutes:isEditorPreview,width:getMaxImageWidth(),canOpenImage:true,resourceType:resourceType},void 0);};var Banner$3=_styled__default["default"](PublishableItemBanner).withConfig({displayName:"DetailViewBanner__Banner",componentId:"sc-1wuqvtw-0"})(templateObject_1$K||(templateObject_1$K=__makeTemplateObject(["\n && {\n height: calc(100vw * (1 / ","));\n\n @media (min-width: ","px) {\n height: calc(\n (","px - (2 * ","px)) *\n (1 / ",")\n );\n }\n }\n"],["\n && {\n height: calc(100vw * (1 / ","));\n\n @media (min-width: ","px) {\n height: calc(\n (","px - (2 * ","px)) *\n (1 / ",")\n );\n }\n }\n"])),bannerAspectRatio,minScreenSize.large+1,minScreenSize.large,spacingM,bannerAspectRatio);var templateObject_1$K;var DetailViewIntro=function DetailViewIntro(){var content=useDetailViewContext().content;var hasIntro=content.intro&&content.intro.length>0;if(!hasIntro){return null;}return jsxRuntime.jsx(DetailIntro,{children:content.intro},void 0);};var DetailIntro=_styled__default["default"].p.withConfig({displayName:"DetailViewIntro__DetailIntro",componentId:"sc-1kubhyf-0"})(templateObject_1$J||(templateObject_1$J=__makeTemplateObject(["\n margin: 0;\n font-size: ","px;\n line-height: 26px;\n font-weight: normal;\n\n min-width: 100%;\n width: 100px;\n\n @media (min-width: ","px) {\n margin-top: ","px;\n margin-bottom: ","px;\n line-height: 24px;\n font-size: ","px;\n }\n"],["\n margin: 0;\n font-size: ","px;\n line-height: 26px;\n font-weight: normal;\n\n min-width: 100%;\n width: 100px;\n\n @media (min-width: ","px) {\n margin-top: ","px;\n margin-bottom: ","px;\n line-height: 24px;\n font-size: ","px;\n }\n"])),fontSizeNormal,minScreenSize.small,spacingS,spacingS+2,fontSizeMedium+2);var templateObject_1$J;var DetailMainSection=function DetailMainSection(_a){var children=_a.children;return jsxRuntime.jsx(DetailMainStyledSection,__assign({className:"detail-view-main"},{children:children}),void 0);};var DetailMainStyledSection=_styled__default["default"].section.withConfig({displayName:"DetailViewMainSection__DetailMainStyledSection",componentId:"sc-ifywhg-0"})(templateObject_1$I||(templateObject_1$I=__makeTemplateObject(["\n position: relative;\n flex: 1 0 auto;\n display: flex;\n flex-direction: column;\n padding: ","px ","px\n ","px;\n font-size: 16px;\n\n @media (min-width: ","px) {\n padding: ","px\n ","px ","px;\n }\n"],["\n position: relative;\n flex: 1 0 auto;\n display: flex;\n flex-direction: column;\n padding: ","px ","px\n ","px;\n font-size: 16px;\n\n @media (min-width: ","px) {\n padding: ","px\n ","px ","px;\n }\n"])),detailViewSectionPadding-5,detailViewSectionPadding,detailViewSectionPadding,minScreenSize.small,detailViewSectionPaddingLarge-10,detailViewSectionPaddingLarge,detailViewSectionPaddingLarge);var templateObject_1$I;var GutterMarkerIcon=function GutterMarkerIcon(_a){var iconName=_a.iconName,children=_a.children,isActive=_a.isActive,color=_a.color,tooltipResourceKey=_a.tooltipResourceKey,className=_a.className;return jsxRuntime.jsxs(Host$h$1,__assign({className:className},{children:[jsxRuntime.jsx(IconContainer$1,__assign({isActive:isActive,className:isActive?"ms-bgColor-"+color:'ms-bgColor-white'},{children:isActive&&jsxRuntime.jsx(StyledTooltip,__assign({resourceKey:tooltipResourceKey},{children:jsxRuntime.jsx(StyledIcon$2$1,{className:"ms-fontColor-white",iconName:iconName},void 0)}),void 0)}),void 0),isActive?jsxRuntime.jsx(ActiveContent,__assign({className:"ms-borderColor-"+color},{children:children}),void 0):jsxRuntime.jsx(Content$3,{children:children},void 0)]}),void 0);};var Host$h$1=_styled__default["default"].div.withConfig({displayName:"GutterMakerIcon__Host",componentId:"sc-aa2cf4-0"})(templateObject_1$H||(templateObject_1$H=__makeTemplateObject(["\n margin: 0;\n display: flex;\n align-content: center;\n"],["\n margin: 0;\n display: flex;\n align-content: center;\n"])));var StyledIcon$2$1=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"GutterMakerIcon__StyledIcon",componentId:"sc-aa2cf4-1"})(templateObject_2$t||(templateObject_2$t=__makeTemplateObject(["\n font-size: 25px;\n"],["\n font-size: 25px;\n"])));var Content$3=_styled__default["default"].div.withConfig({displayName:"GutterMakerIcon__Content",componentId:"sc-aa2cf4-2"})(templateObject_3$l||(templateObject_3$l=__makeTemplateObject(["\n flex: 1 1 auto;\n flex-basis: 100%; /*IE fix*/\n\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n"],["\n flex: 1 1 auto;\n flex-basis: 100%; /*IE fix*/\n\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n"])));var ActiveContent=_styled__default["default"](Content$3).withConfig({displayName:"GutterMakerIcon__ActiveContent",componentId:"sc-aa2cf4-3"})(templateObject_4$d$1||(templateObject_4$d$1=__makeTemplateObject(["\n padding-left: 10px;\n min-height: 50px;\n\n border-bottom-style: solid;\n border-bottom-width: 4px;\n"],["\n padding-left: 10px;\n min-height: 50px;\n\n border-bottom-style: solid;\n border-bottom-width: 4px;\n"])));var IconContainer$1=_styled__default["default"].div.withConfig({displayName:"GutterMakerIcon__IconContainer",componentId:"sc-aa2cf4-4"})(templateObject_5$b||(templateObject_5$b=__makeTemplateObject(["\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: ",";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n padding: 10px 0;\n"],["\n flex-grow: 0;\n flex-shrink: 0;\n flex-basis: ",";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n padding: 10px 0;\n"])),function(_a){var isActive=_a.isActive;return isActive?'50px':'auto';});var StyledTooltip=_styled__default["default"](Tooltip).withConfig({displayName:"GutterMakerIcon__StyledTooltip",componentId:"sc-aa2cf4-5"})(templateObject_6$5$1||(templateObject_6$5$1=__makeTemplateObject(["\n && {\n display: inherit;\n }\n"],["\n && {\n display: inherit;\n }\n"])));var templateObject_1$H,templateObject_2$t,templateObject_3$l,templateObject_4$d$1,templateObject_5$b,templateObject_6$5$1;var DetailViewTitle=function DetailViewTitle(){var _a=useDetailViewContext(),content=_a.content,item=_a.item;var hasAlert=hasFlag(item.knownState,KnownNewsState.Alert);return jsxRuntime.jsx(GutterMarkerIcon,__assign({iconName:"Warning",isActive:hasAlert,color:"red",tooltipResourceKey:"NewsArticle.alert"},{children:jsxRuntime.jsx(Title$4,__assign({"data-title":true},{children:content.title}),void 0)}),void 0);};var Title$4=_styled__default["default"].h1.withConfig({displayName:"DetailViewTitle__Title",componentId:"sc-1jbzvna-0"})(templateObject_1$G||(templateObject_1$G=__makeTemplateObject(["\n color: black;\n width: 100%;\n font-size: ","px;\n line-height: 29px;\n margin: 0;\n\n @media (min-width: ","px) {\n font-size: 2.2em;\n line-height: 42px;\n }\n"],["\n color: black;\n width: 100%;\n font-size: ","px;\n line-height: 29px;\n margin: 0;\n\n @media (min-width: ","px) {\n font-size: 2.2em;\n line-height: 42px;\n }\n"])),fontSizeLarge-1,minScreenSize.small);var templateObject_1$G;_styled__default["default"](ItemMetaInfo).withConfig({displayName:"NewsDetailViewMetaInfo__DetailMetaInfo",componentId:"sc-kib7we-0"})(templateObject_1$F||(templateObject_1$F=__makeTemplateObject(["\n display: flex;\n font-size: ","px;\n margin-top: 12px;\n"],["\n display: flex;\n font-size: ","px;\n margin-top: 12px;\n"])),fontSizeSmall);var templateObject_1$F;var mappers=[InlineImageMapper,InlineFileMapper,InlineQuoteMapper,InlineGalleryMapper,InlineCodeMapper,InlineVideoMapper,InlineTable,InlineContactMapper,InlinePageListMapper,InlineUrlPreviewMapper];var RichTextViewer=function RichTextViewer(_a){var html=_a.html;return jsxRuntime.jsx(TextViewer,{html:html,componentMappers:mappers},void 0);};var DetailViewBody=function DetailViewBody(){var _a=useDetailViewContext(),content=_a.content,resourceType=_a.resourceType;var bodyHtml=content&&content.body;return jsxRuntime.jsx(DetailBody$1,__assign({className:"lt-reach-detail-view-body","data-item-type":resourceType},{children:jsxRuntime.jsx(ItemBodyWrapper,{children:jsxRuntime.jsx(RichTextViewer,{html:bodyHtml},void 0)},void 0)}),void 0);};var DetailBody$1=_styled__default["default"].div.withConfig({displayName:"DetailViewBody__DetailBody",componentId:"sc-7b4trq-0"})(templateObject_1$E||(templateObject_1$E=__makeTemplateObject(["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n\n // So that headings have the correct semantics for accessibility (i.e. title is h1, subheadings start at h2),\n // but maintain the same visual design, this styles each heading to look one \"step\" larger\n // e.g. h2 looks like h1, etc.\n && {\n h2 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h4 {\n font-size: ","px;\n }\n\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n }\n"],["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n\n // So that headings have the correct semantics for accessibility (i.e. title is h1, subheadings start at h2),\n // but maintain the same visual design, this styles each heading to look one \"step\" larger\n // e.g. h2 looks like h1, etc.\n && {\n h2 {\n font-size: ","px;\n margin: ","px 0;\n }\n\n h3 {\n font-size: ","px;\n }\n\n h4 {\n font-size: ","px;\n }\n\n h3,\n h4,\n h5,\n h6 {\n margin: ","px 0;\n }\n }\n"])),fontSizeLarge-1,spacingS+2,fontSizeLarge-3,fontSizeLarge-5,spacingS);var templateObject_1$E;var DetailViewKeywords=function DetailViewKeywords(_a){var filterBaseUrl=_a.filterBaseUrl;var features=useFeatures();var _b=useDetailViewContext(),item=_b.item,userPreferredLanguage=_b.userPreferredLanguage;var formatMessage=useIntl().formatMessage;if(!features.keywords){return null;}return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.keys(item.keywords).length>0&&jsxRuntime.jsx(KeywordsSection,__assign({"aria-label":formatMessage({id:'AriaLabel.section.keywords'})},{children:jsxRuntime.jsx(KeywordsInfo,{keywords:item.keywords,language:userPreferredLanguage,filterBaseUrl:filterBaseUrl},void 0)}),void 0)},void 0);};var KeywordsSection=_styled__default["default"].section.withConfig({displayName:"DetailViewKeywords__KeywordsSection",componentId:"sc-ltysu4-0"})(templateObject_1$D||(templateObject_1$D=__makeTemplateObject(["\n margin-top: 2em;\n display: flex;\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"],["\n margin-top: 2em;\n display: flex;\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"])),maxScreenSize.medium,fontSizeSmall);var templateObject_1$D;var ConfirmationBox=function ConfirmationBox(_a){var disabled=_a.disabled,checked=_a.checked,onChange=_a.onChange;var formatMessage=useIntl().formatMessage;return jsxRuntime.jsx(Host$g$1,{children:jsxRuntime.jsx(NeutralCheckBox,{disabled:disabled,checked:checked,onChange:function(_,value){return onChange(value);},label:formatMessage({id:checked?'NewsArticle.confirmed':'NewsArticle.confirm'})},void 0)},void 0);};var Host$g$1=_styled__default["default"].div.withConfig({displayName:"ConfirmationBox__Host",componentId:"sc-1m5alil-0"})(templateObject_1$C||(templateObject_1$C=__makeTemplateObject(["\n .ms-Checkbox-text {\n font-weight: bold;\n color: black;\n }\n"],["\n .ms-Checkbox-text {\n font-weight: bold;\n color: black;\n }\n"])));var templateObject_1$C;var ConfirmationSection=function ConfirmationSection(_a){var item=_a.item,showDescription=_a.showDescription,readOnly=_a.readOnly,className=_a.className;var refreshStatistics=useNewsApi().refreshStatistics;var _b=useNotificationContext(),dismissToast=_b.dismissToast,showToast=_b.showToast,showError=_b.showError;var _c=useFeedbackApi(),getFeedback=_c.getFeedback,setFeedback=_c.setFeedback,unsetFeedback=_c.unsetFeedback;var _d=usePromise$2(function(){return getFeedback(ItemResourceTypes.News,item.id);}),summary=_d[0],isLoading=_d[1];var _e=React$d.useState(null),userChecked=_e[0],setChecked=_e[1];var toastHandle=React$d.useRef(null);var checked=userChecked!==null?userChecked:summary!=null&&!!summary.records.find(function(r){return r.type==='confirm';});return jsxRuntime.jsxs(Host$f$1,__assign({isLoading:isLoading,className:className},{children:[showDescription&&jsxRuntime.jsx(FormattedMessage$1,{id:"NewsArticle.confirmationRequiredDescription",tagName:"p"},void 0),jsxRuntime.jsx(StyledGutterMarkerIcon,__assign({iconName:"Completed",isActive:!isLoading&&!checked,color:"green"},{children:readOnly?jsxRuntime.jsx(ConfirmationBox,{checked:checked,disabled:true},void 0):jsxRuntime.jsx(ConfirmationBox,{checked:checked,disabled:checked,onChange:handleClickConfirm},void 0)}),void 0)]}),void 0);function handleClickConfirm(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:setChecked(true);_a.label=1;case 1:_a.trys.push([1,4,,5]);return [4/*yield*/,setFeedback(ItemResourceTypes.News,item.id,'confirm')];case 2:_a.sent();toastHandle.current=showToast('NewsArticle.confirmationSuccessToast',{},jsxRuntime.jsx(officeUiFabricReact.DefaultButton,__assign({onClick:handleUndo},{children:jsxRuntime.jsx(FormattedMessage$1,{id:"Generic.undo"},void 0)}),void 0),{autoClose:false});return [4/*yield*/,refreshStatistics(item.id,{confirmationCount:1})];case 3:_a.sent();return [3/*break*/,5];case 4:error_1=_a.sent();logger.error(error_1);showError('Generic.error');setChecked(false);return [3/*break*/,5];case 5:return [2/*return*/];}});});}function handleUndo(){return __awaiter(this,void 0,void 0,function(){var error_2;return __generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,3,,4]);dismissToast(toastHandle.current);toastHandle.current=null;return [4/*yield*/,unsetFeedback(ItemResourceTypes.News,item.id,'confirm')];case 1:_a.sent();return [4/*yield*/,refreshStatistics(item.id,{confirmationCount:-1})];case 2:_a.sent();setChecked(false);return [3/*break*/,4];case 3:error_2=_a.sent();logger.error(error_2);showError('Generic.error');return [3/*break*/,4];case 4:return [2/*return*/];}});});}};var Host$f$1=_styled__default["default"].div.withConfig({displayName:"ConfirmationSection__Host",componentId:"sc-1g2fxdb-0"})(templateObject_1$B||(templateObject_1$B=__makeTemplateObject(["\n width: 100%;\n\n opacity: ",";\n\n > p {\n margin: 0 0 5px ","px;\n font-style: italic;\n }\n\n @media (min-width: ","px) {\n > p {\n margin: 0 0 ","px 0;\n }\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"],["\n width: 100%;\n\n opacity: ",";\n\n > p {\n margin: 0 0 5px ","px;\n font-style: italic;\n }\n\n @media (min-width: ","px) {\n > p {\n margin: 0 0 ","px 0;\n }\n }\n\n @media (max-width: ","px) {\n font-size: ","px;\n }\n"])),function(_a){var isLoading=_a.isLoading;return isLoading?0.4:1;},spacingM,minScreenSize.small,spacingS,maxScreenSize.medium,fontSizeSmall);var StyledGutterMarkerIcon=_styled__default["default"](GutterMarkerIcon).withConfig({displayName:"ConfirmationSection__StyledGutterMarkerIcon",componentId:"sc-1g2fxdb-1"})(templateObject_2$s||(templateObject_2$s=__makeTemplateObject(["\n @media (max-width: ","px) {\n margin: 0 ","px 0;\n }\n"],["\n @media (max-width: ","px) {\n margin: 0 ","px 0;\n }\n"])),maxScreenSize.small,spacingM);var templateObject_1$B,templateObject_2$s;var DetailViewConfirmations=function DetailViewConfirmations(){var features=useFeatures();var _a=useDetailViewContext(),item=_a.item,isEditorPreview=_a.isEditorPreview;var formatMessage=useIntl().formatMessage;if(!showConfirmationBox()){return null;}return jsxRuntime.jsx(ConfirmationHost,__assign({"aria-label":formatMessage({id:'NewsArticle.confirmation'})},{children:jsxRuntime.jsx(ConfirmationSection,{item:item,showDescription:true,readOnly:isEditorPreview},void 0)}),void 0);function showConfirmationBox(){return features.confirmation&&item.metadata&&item.metadata.feedbackSettings&&item.metadata.feedbackSettings.feedbackOptions.indexOf('confirm')>=0;}};var ConfirmationHost=_styled__default["default"].section.withConfig({displayName:"DetailViewConfirmations__ConfirmationHost",componentId:"sc-f8jogv-0"})(templateObject_1$A||(templateObject_1$A=__makeTemplateObject(["\n margin-bottom: ","px;\n\n @media (min-width: ","px) {\n padding: 0 ","px 0 ","px;\n }\n"],["\n margin-bottom: ","px;\n\n @media (min-width: ","px) {\n padding: 0 ","px 0 ","px;\n }\n"])),spacingL,minScreenSize.small,spacingXl,spacingXl);var templateObject_1$A;var DetailViewPageViewTracker=function DetailViewPageViewTracker(){var _a=useDetailViewContext(),resourceType=_a.resourceType,itemId=_a.itemId;usePageViewTracker(resourceType,itemId);return null;};var FeedbackButtonBookmark=function FeedbackButtonBookmark(_a){var isReadOnly=_a.isReadOnly;var _b=React$d.useContext(FeedbackButtonContext),item=_b.item,bookmarkCount=_b.statistics.bookmarkCount;return jsxRuntime.jsxs(CountButtonHost,{children:[jsxRuntime.jsx(BookmarkButton,{item:item,isReadOnly:isReadOnly},void 0),jsxRuntime.jsx(CountLabel,__assign({isDisabled:isReadOnly},{children:bookmarkCount}),void 0)]},void 0);};var NewsDetailViewFeedbackSection=function NewsDetailViewFeedbackSection(_a){var _b;var hideLikes=_a.hideLikes,hideComments=_a.hideComments,hideProfileUrl=_a.hideProfileUrl,disableLoginForPublicUser=_a.disableLoginForPublicUser;var _c=useDetailViewContext(),item=_c.item,resourceType=_c.resourceType,contentLanguage=_c.contentLanguage,isEditorPreview=_c.isEditorPreview;return jsxRuntime.jsxs(StyledFeedbackSection,__assign({item:item,language:contentLanguage,type:resourceType,feedbackSettings:(_b=item.metadata)===null||_b===void 0?void 0:_b.feedbackSettings,hideComments:hideComments,hideProfileUrl:hideProfileUrl,disableLoginForPublicUser:disableLoginForPublicUser,isReadOnly:isEditorPreview},{children:[!hideLikes&&jsxRuntime.jsx(FeedbackButtonLike,{isReadOnly:isEditorPreview},void 0),jsxRuntime.jsx(FeedbackButtonBookmark,{isReadOnly:isEditorPreview},void 0),!hideComments&&jsxRuntime.jsx(FeedbackButtonComments,{},void 0),jsxRuntime.jsx(FeedbackButtonViews,{},void 0),jsxRuntime.jsx(FeedbackButtonShare,{isReadOnly:isEditorPreview},void 0),jsxRuntime.jsx(FeedbackButtonConfirmations,{},void 0)]}),void 0);};var StyledFeedbackSection=_styled__default["default"](FeedbackSection).withConfig({displayName:"NewsDetailViewFeedbackSection__StyledFeedbackSection",componentId:"sc-pjpy6x-0"})(templateObject_1$z||(templateObject_1$z=__makeTemplateObject(["\n ","\n"],["\n ","\n"])),DetailViewSectionPadding);var templateObject_1$z;var DetailViewBodyExternalContent=function DetailViewBodyExternalContent(_a){var itemType=_a.itemType;var content=useDetailViewContext().content;var externalUrl=content&&content.externalUrl;return jsxRuntime.jsx(DetailBody,__assign({className:"lt-reach-detail-view-body"},{children:jsxRuntime.jsx(ItemBodyWrapper,{children:jsxRuntime.jsx(FormattedMessageWithStyle,{id:"ExternalLink."+itemType+".navigateTo",tagName:"p",values:{url:jsxRuntime.jsx(ExternalLink$2,__assign({href:externalUrl,className:"ms-fontColor-accent",target:"_blank",rel:"noopener noreferrer"},{children:externalUrl}),void 0)}},void 0)},void 0)}),void 0);};var DetailBody=_styled__default["default"].div.withConfig({displayName:"DetailViewBodyExternalContent__DetailBody",componentId:"sc-1xjgw89-0"})(templateObject_1$y||(templateObject_1$y=__makeTemplateObject(["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n"],["\n flex: 1 0 auto;\n box-sizing: border-box;\n min-width: 100%;\n width: 100px;\n margin-top: 35px;\n"])));var templateObject_1$y;var DetailViewHeadline=function DetailViewHeadline(){var content=useDetailViewContext().content;var features=useFeatures();if(!features.contentHeadline||!content.headline){return null;}return jsxRuntime.jsx(Headline$1$1,__assign({"data-detail-view-headline":true},{children:content.headline}),void 0);};var Headline$1$1=_styled__default["default"].p.withConfig({displayName:"DetailViewHeadline__Headline",componentId:"sc-wsid06-0"})(templateObject_1$x||(templateObject_1$x=__makeTemplateObject(["\n width: 100%;\n font-weight: bold;\n font-size: ","px;\n line-height: 26px;\n margin: 0;\n\n @media (min-width: ","px) {\n line-height: 22px;\n font-size: ","px;\n margin-bottom: ","px;\n }\n"],["\n width: 100%;\n font-weight: bold;\n font-size: ","px;\n line-height: 26px;\n margin: 0;\n\n @media (min-width: ","px) {\n line-height: 22px;\n font-size: ","px;\n margin-bottom: ","px;\n }\n"])),fontSizeNormal,minScreenSize.small,fontSizeMedium,spacingS);var templateObject_1$x;var StateIcon=function StateIcon(_a){var status=_a.status,isActive=_a.isActive,_b=_a.width,width=_b===void 0?16:_b,activeColor=_a.activeColor;var textColors=React$d.useContext(ThemeContext$1).theme.textColors;if(status===WorkflowStatus.draft){return jsxRuntime.jsx(Draft,{width:width,color:isActive?activeColor||textColors.onSecondary:textColors.default},void 0);}else if(status===WorkflowStatus.rejected){return jsxRuntime.jsx(Draft,{width:width,color:isActive?activeColor:'#b90000'},void 0);}else if(status===WorkflowStatus.ready){return jsxRuntime.jsx(Ready,{width:width,color:isActive?activeColor||textColors.onSecondary:textColors.default},void 0);}return null;};var Draft=function Draft(_a){var color=_a.color,className=_a.className,_b=_a.width,width=_b===void 0?16.25:_b;var ratio=20/16.25;return jsxRuntime.jsx("svg",__assign({className:className,version:"1.1",id:"Layer_1",x:"0px",y:"0px",width:width+"px",height:width*ratio+"px",viewBox:"0 0 16.25 20",enableBackground:"new 0 0 16.25 20"},{children:jsxRuntime.jsx("path",{fill:color,d:"M10,6.25V0h0.89l5.36,5.361V6.25H10z M11.25,5h2.861L11.25,2.139V5z M10,0H9.25v1.25H10V0z M7.675,1.25H6.1\n\tV0h1.575V1.25z M4.525,1.25H2.95V0h1.575V1.25z M1.25,17.057H0v-1.567h1.25V17.057z M1.25,13.921H0v-1.568h1.25V13.921z\n\t M1.25,10.784H0V9.216h1.25V10.784z M1.25,7.647H0V6.08h1.25V7.647z M1.25,4.512H0V2.943h1.25V4.512z M13.375,\n\t 20h-1.5v-1.25h1.5V20z\n\t M10.375,20h-1.5v-1.25h1.5V20z M7.375,20h-1.5v-1.25h1.5V20z M4.375,20h-1.5v-1.25h1.5V20z M16.25,\n\t 16.964H15v-1.661h1.25V16.964z\n\t M16.25,13.643H15v-1.661h1.25V13.643z M16.25,10.321H15V8.66h1.25V10.321z M16.25,6.25H15V7h1.25V6.25z\n\t M1.25,18.75H0V20h1.25\n\tV18.75z M1.25,0H0v1.25h1.25V0z M16.25,18.75H15V20h1.25V18.75z"},void 0)}),void 0);};var Ready=function Ready(_a){var color=_a.color,className=_a.className,_b=_a.width,width=_b===void 0?18.564:_b;var ratio=20/18.564;return jsxRuntime.jsx("svg",__assign({className:className,version:"1.1",id:"Layer_1",x:"0px",y:"0px",width:width+"px",height:width*ratio+"px",viewBox:"0 0 18.564 20",enableBackground:"new 0 0 18.564 20"},{children:jsxRuntime.jsx("path",{fill:color,d:"M10,6.25v-5H1.25v17.5H10V20H0V0h10.889l5.361,5.361V12.5L15,13.75v-7.5H10z M18.564,14.551L13.125,20\n \tl-2.627-2.637l0.879-0.879l1.748,1.738l4.561-4.551L18.564,14.551z M11.25,5h2.861L11.25,2.139V5z"},void 0)}),void 0);};function useCommonEditorApi(){var api=useApi();return React$d.useMemo(function(){return {list:list,getTaskViewCounts:getTaskViewCounts};function list(type,filter,token,sortDefinition){var params=Object.assign({},__assign(__assign(__assign({},filter),getCommaSeparatedChannelsString(filter===null||filter===void 0?void 0:filter.channels)),getCommaSeparatedKeywordsString(filter===null||filter===void 0?void 0:filter.keywords)),{token:token},sortDefinition);return api.custom("editor/"+type+"?"+queryString.stringify(params)).get().then(function(res){return res.body().data();});}function getTaskViewCounts(type,groupId){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return [4/*yield*/,api.custom("editor/"+type+"/taskcounts?"+queryString.stringify({groupId:groupId})).get(groupId)];case 1:response=_a.sent();return [4/*yield*/,response.body().data()];case 2:return [2/*return*/,_a.sent()];}});});}},[api]);}var SortFieldsDefinitionBuilder=/** @class */function(){function SortFieldsDefinitionBuilder(){this.sort=[];}SortFieldsDefinitionBuilder.prototype.addSortField=function(field,direction){this.sort.push(field+":"+SortFieldsDefinitionBuilder.getSortDirectionAsString(direction));return this;};SortFieldsDefinitionBuilder.getSortDirectionAsString=function(direction){return direction===SortDirection.asc?'asc':'desc';};return SortFieldsDefinitionBuilder;}();var EventSortFieldsDefinitionBuilder=/** @class */function(_super){__extends(EventSortFieldsDefinitionBuilder,_super);function EventSortFieldsDefinitionBuilder(){return _super!==null&&_super.apply(this,arguments)||this;}EventSortFieldsDefinitionBuilder.create=function(){return new EventSortFieldsDefinitionBuilder();};return EventSortFieldsDefinitionBuilder;}(SortFieldsDefinitionBuilder);EventSortFieldsDefinitionBuilder.create().addSortField('startDate',SortDirection.desc);EventSortFieldsDefinitionBuilder.create().addSortField('publishingDate',SortDirection.desc);var ItemType;(function(ItemType){ItemType[ItemType["None"]=0]="None";ItemType[ItemType["News"]=1]="News";ItemType[ItemType["Post"]=2]="Post";ItemType[ItemType["Page"]=4]="Page";ItemType[ItemType["Event"]=8]="Event";})(ItemType||(ItemType={}));var BaseFilterDefinitionImpl=/** @class */function(){function BaseFilterDefinitionImpl(){}return BaseFilterDefinitionImpl;}();__spreadArray(__spreadArray([],Object.keys(new BaseFilterDefinitionImpl())),['hideChrome','teams']);var KeywordPickerGroup=function KeywordPickerGroup(_a){var group=_a.group,keywords=_a.keywords,expanded=_a.expanded,selectedKeywords=_a.selectedKeywords,onChange=_a.onChange,mandatoryKeywordIds=_a.mandatoryKeywordIds;var _b=React$d.useState(null),isExpanded=_b[0],setIsExpanded=_b[1];var isSelected=!!selectedKeywords.find(function(k){return k.groupId===group.id;});var isCollapsed=!(isExpanded===true||expanded);return jsxRuntime.jsxs(Host$e$1,{children:[jsxRuntime.jsxs(GroupButton,__assign({onClick:toggle,iconProps:{iconName:isCollapsed?'CaretRightSolid8':'CaretDownSolid8'},"aria-expanded":!isCollapsed,"aria-controls":group.name+"-list"},{children:[isSelected&&jsxRuntime.jsx(CheckMarkIcon,{iconName:"CheckMark"},void 0),jsxRuntime.jsx(ButtonLabel,__assign({"data-keyword-group":group.name,isSelected:isSelected},{children:jsxRuntime.jsx(KeywordTitle,{groupName:group.name},void 0)}),void 0)]}),void 0),jsxRuntime.jsx(KeywordsList,__assign({id:group.name+"-list","data-keyword-picker-group-list":true,isCollapsed:isCollapsed},{children:keywords.map(function(k){var checked=isKeywordSelected(k);var disabled=isKeywordDisabled(k);return jsxRuntime.jsx(KeywordItem,__assign({"data-keyword":k.name,"data-is-checked":checked,"data-is-disabled":disabled},{children:jsxRuntime.jsx(officeUiFabricReact.Checkbox,{label:k.name,onRenderLabel:function(){return jsxRuntime.jsx(KeywordTitle,{groupName:group.name,keywordName:k.name},void 0);},checked:checked,onChange:function(_e,isChecked){return handleChange(isChecked,k);},disabled:disabled},k.id)}),k.name);})}),void 0)]},void 0);function toggle(){setIsExpanded(!isExpanded);}function isKeywordSelected(keyword){return !!selectedKeywords.find(function(k){return k.id===keyword.id;});}function isKeywordDisabled(keyword){return mandatoryKeywordIds===null||mandatoryKeywordIds===void 0?void 0:mandatoryKeywordIds.some(function(id){return id===keyword.id;});}function handleChange(add,keyword){if(onChange){var result=selectedKeywords.filter(function(k){return keyword.id!==k.id;});if(add){result.push(keyword);}onChange(result);}}};var Host$e$1=_styled__default["default"].div.withConfig({displayName:"KeywordPickerGroup__Host",componentId:"sc-pu16jm-0"})(templateObject_1$w||(templateObject_1$w=__makeTemplateObject(["\n margin-bottom: ","px;\n"],["\n margin-bottom: ","px;\n"])),spacingS);var GroupButton=_styled__default["default"](ActionButton).withConfig({displayName:"KeywordPickerGroup__GroupButton",componentId:"sc-pu16jm-1"})(templateObject_2$r||(templateObject_2$r=__makeTemplateObject(["\n && {\n height: auto;\n font-size: ","px;\n padding: 0;\n border: 0;\n\n i {\n font-size: ","px;\n\n &:first-child {\n margin: 0;\n }\n }\n }\n"],["\n && {\n height: auto;\n font-size: ","px;\n padding: 0;\n border: 0;\n\n i {\n font-size: ","px;\n\n &:first-child {\n margin: 0;\n }\n }\n }\n"])),fontSizeNormal,fontSizeSmall);var CheckMarkIcon=_styled__default["default"](officeUiFabricReact.Icon).withConfig({displayName:"KeywordPickerGroup__CheckMarkIcon",componentId:"sc-pu16jm-2"})(templateObject_3$k||(templateObject_3$k=__makeTemplateObject(["\n margin-right: 6px;\n margin-left: 12px;\n width: 15px;\n"],["\n margin-right: 6px;\n margin-left: 12px;\n width: 15px;\n"])));var ButtonLabel=_styled__default["default"].span.withConfig({displayName:"KeywordPickerGroup__ButtonLabel",componentId:"sc-pu16jm-3"})(templateObject_5$a$1||(templateObject_5$a$1=__makeTemplateObject(["\n display: inline-flex;\n flex: 1 0 auto;\n\n ","\n"],["\n display: inline-flex;\n flex: 1 0 auto;\n\n ","\n"])),function(p){return !p.isSelected&&_styled.css(templateObject_4$c$1||(templateObject_4$c$1=__makeTemplateObject(["\n margin-left: 33px; // checkmark icon space\n "],["\n margin-left: 33px; // checkmark icon space\n "])));});var KeywordsList=_styled__default["default"].ul.withConfig({displayName:"KeywordPickerGroup__KeywordsList",componentId:"sc-pu16jm-4"})(templateObject_7$3$1||(templateObject_7$3$1=__makeTemplateObject(["\n ","\n padding: 0;\n margin: 0 0 0 ","px;\n list-style: none;\n"],["\n ","\n padding: 0;\n margin: 0 0 0 ","px;\n list-style: none;\n"])),function(p){return p.isCollapsed&&_styled.css(templateObject_6$4$1||(templateObject_6$4$1=__makeTemplateObject(["\n display: none;\n "],["\n display: none;\n "])));},spacingX+10);var KeywordItem=_styled__default["default"].li.withConfig({displayName:"KeywordPickerGroup__KeywordItem",componentId:"sc-pu16jm-5"})(templateObject_8$3$1||(templateObject_8$3$1=__makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-top: 9px;\n"],["\n display: flex;\n align-items: center;\n margin-top: 9px;\n"])));var templateObject_1$w,templateObject_2$r,templateObject_3$k,templateObject_4$c$1,templateObject_5$a$1,templateObject_6$4$1,templateObject_7$3$1,templateObject_8$3$1;var KeywordPicker=function KeywordPicker(_a){var _b;var value=_a.value,onChange=_a.onChange,showSelectionToggle=_a.showSelectionToggle,incomingAvailableKeywords=_a.availableKeywords,mandatoryKeywordIds=_a.mandatoryKeywordIds,className=_a.className;var formatMessage=useIntl().formatMessage;var user=useCurrentUser();var _c=React$d.useContext(LazySubscriptionContext),allKeywords=_c.allKeywords,selectedKeywordGroups=_c.selectedKeywordGroups;var _d=React$d.useState(null),searchedKeywords=_d[0],setSearchedKeywords=_d[1];var _e=React$d.useState(null),searchText=_e[0],setSearchText=_e[1];var selectedKeywords=getSelectedKeywords();var availableKeywords=incomingAvailableKeywords!==null&&incomingAvailableKeywords!==void 0?incomingAvailableKeywords:allKeywords;var visibleKeywords=(_b=searchedKeywords!==null&&searchedKeywords!==void 0?searchedKeywords:availableKeywords)!==null&&_b!==void 0?_b:[];var mandatoryKeywords=mandatoryKeywordIds?availableKeywords.filter(function(k){return mandatoryKeywordIds.includes(k.id);}):[];var noKeywordGroups=(selectedKeywordGroups===null||selectedKeywordGroups===void 0?void 0:selectedKeywordGroups.length)===0;var noAvailableKeywords=!noKeywordGroups&&(availableKeywords===null||availableKeywords===void 0?void 0:availableKeywords.length)===0;var isEmpty=visibleKeywords.length===0;return jsxRuntime.jsxs(Host$d$1,__assign({className:classNames('keyword-picker',className)},{children:[(noKeywordGroups||noAvailableKeywords)&&jsxRuntime.jsx("span",__assign({className:"keyword-picker-empty"},{children:jsxRuntime.jsx(FormattedMessage$1,{id:noKeywordGroups?'KeywordPicker.noGroupsDefined':'KeywordPicker.noAvailableKeywordsForGroup'},void 0)}),void 0),!noKeywordGroups&&!noAvailableKeywords&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs(SearchHost,__assign({className:"keyword-picker-search","data-keyword-picker-search":true},{children:[jsxRuntime.jsx(officeUiFabricReact.TextField,{onChange:handleSearch,value:searchText||'',placeholder:formatMessage({id:'KeywordPicker.search'})},void 0),searchText&&jsxRuntime.jsx(SearchCancelButton,{iconProps:{iconName:'Cancel'},onClick:function(){return handleSearch(null,null);},"aria-hidden":"true"},void 0)]}),void 0),showSelectionToggle&&jsxRuntime.jsx(StyledToggleAllButtons,{toggleAll:handleToggleAll},void 0),jsxRuntime.jsxs(KeywordPickerTree,__assign({className:"keyword-picker-tree"},{children:[isEmpty&&jsxRuntime.jsx(FormattedMessage$1,{id:"KeywordPicker.emptySearch"},void 0),!isEmpty&&selectedKeywordGroups&&selectedKeywordGroups.sort(function(a,b){return a.name.localeCompare(b.name);}).map(function(g){var keywords=visibleKeywords.filter(function(k){return k.groupId===g.id;});return keywords.length===0?null:jsxRuntime.jsx(KeywordPickerGroup,{expanded:!!searchText,group:g,keywords:keywords,selectedKeywords:selectedKeywords,onChange:onChange,mandatoryKeywordIds:mandatoryKeywordIds},g.id);})]}),void 0)]},void 0)]}),void 0);function getSelectedKeywords(){if(value==null||allKeywords==null){return [];}return value.map(function(k){return typeof k==='string'?allKeywords.find(function(a){return a.id===k;}):k;}).filter(function(k){return k;});}function handleSearch(_,text){var hasSearch=text&&text.length;var keywords=hasSearch?availableKeywords.filter(function(k){return getKeywordTitle(user,k.translations,k.name).toLocaleLowerCase().indexOf(text.toLocaleLowerCase())>=0;}):availableKeywords;setSearchedKeywords(keywords);setSearchText(hasSearch?text:null);}function handleToggleAll(checkAll){onChange(checkAll?availableKeywords:mandatoryKeywords);}};var KeywordPickerTree=_styled__default["default"].div.withConfig({displayName:"KeywordPicker__KeywordPickerTree",componentId:"sc-1ejjfwa-0"})(templateObject_1$v||(templateObject_1$v=__makeTemplateObject(["\n padding-left: 4px;\n"],["\n padding-left: 4px;\n"])));var StyledToggleAllButtons=_styled__default["default"](ToggleAllButtons).withConfig({displayName:"KeywordPicker__StyledToggleAllButtons",componentId:"sc-1ejjfwa-1"})(templateObject_2$q||(templateObject_2$q=__makeTemplateObject(["\n padding-left: 4px;\n"],["\n padding-left: 4px;\n"])));var Host$d$1=_styled__default["default"].div.withConfig({displayName:"KeywordPicker__Host",componentId:"sc-1ejjfwa-2"})(templateObject_3$j||(templateObject_3$j=__makeTemplateObject(["\n overflow-x: hidden;\n overflow-y: auto;\n\n .ms-TextField-fieldGroup {\n background: none;\n }\n"],["\n overflow-x: hidden;\n overflow-y: auto;\n\n .ms-TextField-fieldGroup {\n background: none;\n }\n"])));var SearchHost=_styled__default["default"].div.withConfig({displayName:"KeywordPicker__SearchHost",componentId:"sc-1ejjfwa-3"})(templateObject_4$b$1||(templateObject_4$b$1=__makeTemplateObject(["\n position: relative;\n margin-bottom: 8px;\n"],["\n position: relative;\n margin-bottom: 8px;\n"])));var SearchCancelButton=_styled__default["default"](IconButton).withConfig({displayName:"KeywordPicker__SearchCancelButton",componentId:"sc-1ejjfwa-4"})(templateObject_5$9$1||(templateObject_5$9$1=__makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n z-index: 10;\n\n &&&:focus::after {\n outline-offset: -2px;\n }\n"],["\n position: absolute;\n top: 0;\n right: 0;\n z-index: 10;\n\n &&&:focus::after {\n outline-offset: -2px;\n }\n"])));var templateObject_1$v,templateObject_2$q,templateObject_3$j,templateObject_4$b$1,templateObject_5$9$1;var $$2=_export;var requireObjectCoercible$1$1=requireObjectCoercible$c;var isRegExp=isRegexp;var getRegExpFlags=regexpFlags$1$1;var wellKnownSymbol$1=wellKnownSymbol$l;var REPLACE$2=wellKnownSymbol$1('replace');var RegExpPrototype$3=RegExp.prototype;// `String.prototype.replaceAll` method
|
|
131718
131718
|
// https://github.com/tc39/proposal-string-replace-all
|
|
131719
131719
|
$$2({target:'String',proto:true},{replaceAll:function replaceAll(searchValue,replaceValue){var O=requireObjectCoercible$1$1(this);var IS_REG_EXP,flags,replacer,string,searchString,template,result,position,index;if(searchValue!=null){IS_REG_EXP=isRegExp(searchValue);if(IS_REG_EXP){flags=String(requireObjectCoercible$1$1('flags'in RegExpPrototype$3?searchValue.flags:getRegExpFlags.call(searchValue)));if(!~flags.indexOf('g'))throw TypeError('`.replaceAll` does not allow non-global regexes');}replacer=searchValue[REPLACE$2];if(replacer!==undefined){return replacer.call(searchValue,O,replaceValue);}}string=String(O);searchString=String(searchValue);if(searchString==='')return replaceAll.call(string,/(?:)/g,replaceValue);template=string.split(searchString);if(typeof replaceValue!=='function'){return template.join(String(replaceValue));}result=template[0];position=result.length;for(index=1;index<template.length;index++){result+=String(replaceValue(searchString,position,string));position+=searchString.length+template[index].length;result+=template[index];}return result;}});_styled__default["default"].div.withConfig({displayName:"Textarea__Host",componentId:"sc-170lrb4-0"})(templateObject_1$u||(templateObject_1$u=__makeTemplateObject(["\n display: flex;\n align-items: flex-end;\n position: relative;\n"],["\n display: flex;\n align-items: flex-end;\n position: relative;\n"])));_styled__default["default"].textarea.withConfig({displayName:"Textarea__StyledTextarea",componentId:"sc-170lrb4-1"})(templateObject_2$p||(templateObject_2$p=__makeTemplateObject(["\n flex: 1 0 auto;\n justify-content: space-between;\n overflow: hidden;\n resize: none;\n min-height: 5px;\n\n ","\n"],["\n flex: 1 0 auto;\n justify-content: space-between;\n overflow: hidden;\n resize: none;\n min-height: 5px;\n\n ","\n"])),InputPlaceholder('font-style: italic'));_styled__default["default"](officeUiFabricReact.IconButton).withConfig({displayName:"Textarea__StyledIconButton",componentId:"sc-170lrb4-2"})(templateObject_3$i||(templateObject_3$i=__makeTemplateObject(["\n position: absolute;\n bottom: 2px;\n right: 2px;\n"],["\n position: absolute;\n bottom: 2px;\n right: 2px;\n"])));var templateObject_1$u,templateObject_2$p,templateObject_3$i;var InsertFilesDialogHost=_styled__default["default"].div.withConfig({displayName:"InsertFilesButton__InsertFilesDialogHost",componentId:"sc-1q7gx3n-0"})(templateObject_2$o||(templateObject_2$o=__makeTemplateObject(["\n ","\n\n position: relative;\n padding: ","px;\n text-align: center;\n\n > div {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n"],["\n ","\n\n position: relative;\n padding: ","px;\n text-align: center;\n\n > div {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n"])),function(p){return p.isActive&&_styled.css(templateObject_1$t||(templateObject_1$t=__makeTemplateObject(["\n &::after {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n\n border: 2px black dashed;\n }\n "],["\n &::after {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n\n border: 2px black dashed;\n }\n "])));},spacingM);_styled__default["default"].p.withConfig({displayName:"InsertFilesButton__DragAndDropText",componentId:"sc-1q7gx3n-1"})(templateObject_3$h||(templateObject_3$h=__makeTemplateObject(["\n font-size: ","px;\n margin: ","px auto 0 auto;\n"],["\n font-size: ","px;\n margin: ","px auto 0 auto;\n"])),fontSizeSmall,spacingS);_styled__default["default"](officeUiFabricReact.DefaultButton).withConfig({displayName:"InsertFilesButton__SelectFileButton",componentId:"sc-1q7gx3n-2"})(templateObject_4$a$1||(templateObject_4$a$1=__makeTemplateObject(["\n margin-top: ","px;\n\n span {\n font-weight: normal;\n }\n"],["\n margin-top: ","px;\n\n span {\n font-weight: normal;\n }\n"])),spacingM);_styled__default["default"].div.withConfig({displayName:"InsertFilesButton__ButtonsContainer",componentId:"sc-1q7gx3n-3"})(templateObject_5$8$1||(templateObject_5$8$1=__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"],["\n display: flex;\n flex-direction: column;\n"])));var templateObject_1$t,templateObject_2$o,templateObject_3$h,templateObject_4$a$1,templateObject_5$8$1;_styled__default["default"](InsertFilesDialogHost).withConfig({displayName:"InsertImagesButton__Host",componentId:"sc-63tjy6-0"})(templateObject_1$s||(templateObject_1$s=__makeTemplateObject(["\n cursor: pointer;\n"],["\n cursor: pointer;\n"])));_styled__default["default"](officeUiFabricReact.PrimaryButton).withConfig({displayName:"InsertImagesButton__StyledButton",componentId:"sc-63tjy6-1"})(templateObject_2$n||(templateObject_2$n=__makeTemplateObject(["\n && {\n display: block;\n margin: 10px auto;\n background-color: transparent;\n color: inherit;\n font-size: large;\n line-height: 2em;\n border: none;\n\n &:hover {\n background-color: transparent;\n color: inherit;\n border: 0;\n }\n }\n"],["\n && {\n display: block;\n margin: 10px auto;\n background-color: transparent;\n color: inherit;\n font-size: large;\n line-height: 2em;\n border: none;\n\n &:hover {\n background-color: transparent;\n color: inherit;\n border: 0;\n }\n }\n"])));_styled__default["default"].div.withConfig({displayName:"InsertImagesButton__Text",componentId:"sc-63tjy6-2"})(templateObject_3$g||(templateObject_3$g=__makeTemplateObject(["\n max-width: 100%;\n font-size: large;\n"],["\n max-width: 100%;\n font-size: large;\n"])));var templateObject_1$s,templateObject_2$n,templateObject_3$g;_styled__default["default"].div.withConfig({displayName:"InsertVideoDialog__VideoHost",componentId:"sc-12gp7sa-0"})(templateObject_1$r||(templateObject_1$r=__makeTemplateObject(["\n width: 100%;\n margin-top: ","px;\n\n .video-view-container--youtube {\n &:after {\n padding-bottom: calc(9 / 16 * 100%);\n }\n }\n"],["\n width: 100%;\n margin-top: ","px;\n\n .video-view-container--youtube {\n &:after {\n padding-bottom: calc(9 / 16 * 100%);\n }\n }\n"])),spacingS);_styled__default["default"](officeUiFabricReact.TextField).withConfig({displayName:"InsertVideoDialog__StyledTextField",componentId:"sc-12gp7sa-1"})(templateObject_2$m||(templateObject_2$m=__makeTemplateObject(["\n width: 510px;\n\n label {\n font-weight: normal;\n }\n"],["\n width: 510px;\n\n label {\n font-weight: normal;\n }\n"])));var templateObject_1$r,templateObject_2$m;var DateTimePicker=function DateTimePicker(props){var timeField=React$d.useRef();var formatMessage=useIntl().formatMessage;var _a=React$d.useState(getTime(props.date)),time=_a[0],setTime=_a[1];var _b=React$d.useState(false),timeHasFocus=_b[0],setTimeHasFocus=_b[1];var _c=React$d.useState(null),timeErrorMessageResourceKey=_c[0],setTimeErrorMessageResourceKey=_c[1];var momentMonths=['January','February','March','April','May','June','July','August','September','October','November','December'];var momentWeekdays=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];React$d.useEffect(function(){// do not update if the user is typing time
|
|
131720
131720
|
if(!timeHasFocus){// We might not know that the time field has the focus after an onBlur from the date field.
|
|
@@ -135245,6 +135245,36 @@
|
|
|
135245
135245
|
}
|
|
135246
135246
|
}
|
|
135247
135247
|
|
|
135248
|
+
/**
|
|
135249
|
+
* @name addMilliseconds
|
|
135250
|
+
* @category Millisecond Helpers
|
|
135251
|
+
* @summary Add the specified number of milliseconds to the given date.
|
|
135252
|
+
*
|
|
135253
|
+
* @description
|
|
135254
|
+
* Add the specified number of milliseconds to the given date.
|
|
135255
|
+
*
|
|
135256
|
+
* ### v2.0.0 breaking changes:
|
|
135257
|
+
*
|
|
135258
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
135259
|
+
*
|
|
135260
|
+
* @param {Date|Number} date - the date to be changed
|
|
135261
|
+
* @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`.
|
|
135262
|
+
* @returns {Date} the new date with the milliseconds added
|
|
135263
|
+
* @throws {TypeError} 2 arguments required
|
|
135264
|
+
*
|
|
135265
|
+
* @example
|
|
135266
|
+
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
|
|
135267
|
+
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
135268
|
+
* //=> Thu Jul 10 2014 12:45:30.750
|
|
135269
|
+
*/
|
|
135270
|
+
|
|
135271
|
+
function addMilliseconds(dirtyDate, dirtyAmount) {
|
|
135272
|
+
requiredArgs(2, arguments);
|
|
135273
|
+
var timestamp = toDate(dirtyDate).getTime();
|
|
135274
|
+
var amount = toInteger(dirtyAmount);
|
|
135275
|
+
return new Date(timestamp + amount);
|
|
135276
|
+
}
|
|
135277
|
+
|
|
135248
135278
|
/**
|
|
135249
135279
|
* @name startOfWeek
|
|
135250
135280
|
* @category Week Helpers
|
|
@@ -135297,6 +135327,23 @@
|
|
|
135297
135327
|
return date;
|
|
135298
135328
|
}
|
|
135299
135329
|
|
|
135330
|
+
/**
|
|
135331
|
+
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
135332
|
+
* They usually appear for dates that denote time before the timezones were introduced
|
|
135333
|
+
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
135334
|
+
* and GMT+01:00:00 after that date)
|
|
135335
|
+
*
|
|
135336
|
+
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
135337
|
+
* which would lead to incorrect calculations.
|
|
135338
|
+
*
|
|
135339
|
+
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
135340
|
+
*/
|
|
135341
|
+
function getTimezoneOffsetInMilliseconds(date) {
|
|
135342
|
+
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
|
|
135343
|
+
utcDate.setUTCFullYear(date.getFullYear());
|
|
135344
|
+
return date.getTime() - utcDate.getTime();
|
|
135345
|
+
}
|
|
135346
|
+
|
|
135300
135347
|
/**
|
|
135301
135348
|
* @name startOfDay
|
|
135302
135349
|
* @category Day Helpers
|
|
@@ -135327,6 +135374,117 @@
|
|
|
135327
135374
|
return date;
|
|
135328
135375
|
}
|
|
135329
135376
|
|
|
135377
|
+
/**
|
|
135378
|
+
* @name isDate
|
|
135379
|
+
* @category Common Helpers
|
|
135380
|
+
* @summary Is the given value a date?
|
|
135381
|
+
*
|
|
135382
|
+
* @description
|
|
135383
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
135384
|
+
*
|
|
135385
|
+
* ### v2.0.0 breaking changes:
|
|
135386
|
+
*
|
|
135387
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
135388
|
+
*
|
|
135389
|
+
* @param {*} value - the value to check
|
|
135390
|
+
* @returns {boolean} true if the given value is a date
|
|
135391
|
+
* @throws {TypeError} 1 arguments required
|
|
135392
|
+
*
|
|
135393
|
+
* @example
|
|
135394
|
+
* // For a valid date:
|
|
135395
|
+
* const result = isDate(new Date())
|
|
135396
|
+
* //=> true
|
|
135397
|
+
*
|
|
135398
|
+
* @example
|
|
135399
|
+
* // For an invalid date:
|
|
135400
|
+
* const result = isDate(new Date(NaN))
|
|
135401
|
+
* //=> true
|
|
135402
|
+
*
|
|
135403
|
+
* @example
|
|
135404
|
+
* // For some value:
|
|
135405
|
+
* const result = isDate('2014-02-31')
|
|
135406
|
+
* //=> false
|
|
135407
|
+
*
|
|
135408
|
+
* @example
|
|
135409
|
+
* // For an object:
|
|
135410
|
+
* const result = isDate({})
|
|
135411
|
+
* //=> false
|
|
135412
|
+
*/
|
|
135413
|
+
|
|
135414
|
+
function isDate(value) {
|
|
135415
|
+
requiredArgs(1, arguments);
|
|
135416
|
+
return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
|
|
135417
|
+
}
|
|
135418
|
+
|
|
135419
|
+
/**
|
|
135420
|
+
* @name isValid
|
|
135421
|
+
* @category Common Helpers
|
|
135422
|
+
* @summary Is the given date valid?
|
|
135423
|
+
*
|
|
135424
|
+
* @description
|
|
135425
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
135426
|
+
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
|
|
135427
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
135428
|
+
*
|
|
135429
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
135430
|
+
*
|
|
135431
|
+
* ### v2.0.0 breaking changes:
|
|
135432
|
+
*
|
|
135433
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
135434
|
+
*
|
|
135435
|
+
* - Now `isValid` doesn't throw an exception
|
|
135436
|
+
* if the first argument is not an instance of Date.
|
|
135437
|
+
* Instead, argument is converted beforehand using `toDate`.
|
|
135438
|
+
*
|
|
135439
|
+
* Examples:
|
|
135440
|
+
*
|
|
135441
|
+
* | `isValid` argument | Before v2.0.0 | v2.0.0 onward |
|
|
135442
|
+
* |---------------------------|---------------|---------------|
|
|
135443
|
+
* | `new Date()` | `true` | `true` |
|
|
135444
|
+
* | `new Date('2016-01-01')` | `true` | `true` |
|
|
135445
|
+
* | `new Date('')` | `false` | `false` |
|
|
135446
|
+
* | `new Date(1488370835081)` | `true` | `true` |
|
|
135447
|
+
* | `new Date(NaN)` | `false` | `false` |
|
|
135448
|
+
* | `'2016-01-01'` | `TypeError` | `false` |
|
|
135449
|
+
* | `''` | `TypeError` | `false` |
|
|
135450
|
+
* | `1488370835081` | `TypeError` | `true` |
|
|
135451
|
+
* | `NaN` | `TypeError` | `false` |
|
|
135452
|
+
*
|
|
135453
|
+
* We introduce this change to make *date-fns* consistent with ECMAScript behavior
|
|
135454
|
+
* that try to coerce arguments to the expected type
|
|
135455
|
+
* (which is also the case with other *date-fns* functions).
|
|
135456
|
+
*
|
|
135457
|
+
* @param {*} date - the date to check
|
|
135458
|
+
* @returns {Boolean} the date is valid
|
|
135459
|
+
* @throws {TypeError} 1 argument required
|
|
135460
|
+
*
|
|
135461
|
+
* @example
|
|
135462
|
+
* // For the valid date:
|
|
135463
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
135464
|
+
* //=> true
|
|
135465
|
+
*
|
|
135466
|
+
* @example
|
|
135467
|
+
* // For the value, convertable into a date:
|
|
135468
|
+
* const result = isValid(1393804800000)
|
|
135469
|
+
* //=> true
|
|
135470
|
+
*
|
|
135471
|
+
* @example
|
|
135472
|
+
* // For the invalid date:
|
|
135473
|
+
* const result = isValid(new Date(''))
|
|
135474
|
+
* //=> false
|
|
135475
|
+
*/
|
|
135476
|
+
|
|
135477
|
+
function isValid(dirtyDate) {
|
|
135478
|
+
requiredArgs(1, arguments);
|
|
135479
|
+
|
|
135480
|
+
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
|
|
135481
|
+
return false;
|
|
135482
|
+
}
|
|
135483
|
+
|
|
135484
|
+
var date = toDate(dirtyDate);
|
|
135485
|
+
return !isNaN(Number(date));
|
|
135486
|
+
}
|
|
135487
|
+
|
|
135330
135488
|
/**
|
|
135331
135489
|
* @name endOfDay
|
|
135332
135490
|
* @category Day Helpers
|
|
@@ -135471,6 +135629,2200 @@
|
|
|
135471
135629
|
return date;
|
|
135472
135630
|
}
|
|
135473
135631
|
|
|
135632
|
+
var formatDistanceLocale = {
|
|
135633
|
+
lessThanXSeconds: {
|
|
135634
|
+
one: 'less than a second',
|
|
135635
|
+
other: 'less than {{count}} seconds'
|
|
135636
|
+
},
|
|
135637
|
+
xSeconds: {
|
|
135638
|
+
one: '1 second',
|
|
135639
|
+
other: '{{count}} seconds'
|
|
135640
|
+
},
|
|
135641
|
+
halfAMinute: 'half a minute',
|
|
135642
|
+
lessThanXMinutes: {
|
|
135643
|
+
one: 'less than a minute',
|
|
135644
|
+
other: 'less than {{count}} minutes'
|
|
135645
|
+
},
|
|
135646
|
+
xMinutes: {
|
|
135647
|
+
one: '1 minute',
|
|
135648
|
+
other: '{{count}} minutes'
|
|
135649
|
+
},
|
|
135650
|
+
aboutXHours: {
|
|
135651
|
+
one: 'about 1 hour',
|
|
135652
|
+
other: 'about {{count}} hours'
|
|
135653
|
+
},
|
|
135654
|
+
xHours: {
|
|
135655
|
+
one: '1 hour',
|
|
135656
|
+
other: '{{count}} hours'
|
|
135657
|
+
},
|
|
135658
|
+
xDays: {
|
|
135659
|
+
one: '1 day',
|
|
135660
|
+
other: '{{count}} days'
|
|
135661
|
+
},
|
|
135662
|
+
aboutXWeeks: {
|
|
135663
|
+
one: 'about 1 week',
|
|
135664
|
+
other: 'about {{count}} weeks'
|
|
135665
|
+
},
|
|
135666
|
+
xWeeks: {
|
|
135667
|
+
one: '1 week',
|
|
135668
|
+
other: '{{count}} weeks'
|
|
135669
|
+
},
|
|
135670
|
+
aboutXMonths: {
|
|
135671
|
+
one: 'about 1 month',
|
|
135672
|
+
other: 'about {{count}} months'
|
|
135673
|
+
},
|
|
135674
|
+
xMonths: {
|
|
135675
|
+
one: '1 month',
|
|
135676
|
+
other: '{{count}} months'
|
|
135677
|
+
},
|
|
135678
|
+
aboutXYears: {
|
|
135679
|
+
one: 'about 1 year',
|
|
135680
|
+
other: 'about {{count}} years'
|
|
135681
|
+
},
|
|
135682
|
+
xYears: {
|
|
135683
|
+
one: '1 year',
|
|
135684
|
+
other: '{{count}} years'
|
|
135685
|
+
},
|
|
135686
|
+
overXYears: {
|
|
135687
|
+
one: 'over 1 year',
|
|
135688
|
+
other: 'over {{count}} years'
|
|
135689
|
+
},
|
|
135690
|
+
almostXYears: {
|
|
135691
|
+
one: 'almost 1 year',
|
|
135692
|
+
other: 'almost {{count}} years'
|
|
135693
|
+
}
|
|
135694
|
+
};
|
|
135695
|
+
|
|
135696
|
+
var formatDistance = function (token, count, options) {
|
|
135697
|
+
var result;
|
|
135698
|
+
var tokenValue = formatDistanceLocale[token];
|
|
135699
|
+
|
|
135700
|
+
if (typeof tokenValue === 'string') {
|
|
135701
|
+
result = tokenValue;
|
|
135702
|
+
} else if (count === 1) {
|
|
135703
|
+
result = tokenValue.one;
|
|
135704
|
+
} else {
|
|
135705
|
+
result = tokenValue.other.replace('{{count}}', count.toString());
|
|
135706
|
+
}
|
|
135707
|
+
|
|
135708
|
+
if (options !== null && options !== void 0 && options.addSuffix) {
|
|
135709
|
+
if (options.comparison && options.comparison > 0) {
|
|
135710
|
+
return 'in ' + result;
|
|
135711
|
+
} else {
|
|
135712
|
+
return result + ' ago';
|
|
135713
|
+
}
|
|
135714
|
+
}
|
|
135715
|
+
|
|
135716
|
+
return result;
|
|
135717
|
+
};
|
|
135718
|
+
|
|
135719
|
+
var formatDistance$1 = formatDistance;
|
|
135720
|
+
|
|
135721
|
+
function buildFormatLongFn(args) {
|
|
135722
|
+
return function () {
|
|
135723
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
135724
|
+
// TODO: Remove String()
|
|
135725
|
+
var width = options.width ? String(options.width) : args.defaultWidth;
|
|
135726
|
+
var format = args.formats[width] || args.formats[args.defaultWidth];
|
|
135727
|
+
return format;
|
|
135728
|
+
};
|
|
135729
|
+
}
|
|
135730
|
+
|
|
135731
|
+
var dateFormats = {
|
|
135732
|
+
full: 'EEEE, MMMM do, y',
|
|
135733
|
+
long: 'MMMM do, y',
|
|
135734
|
+
medium: 'MMM d, y',
|
|
135735
|
+
short: 'MM/dd/yyyy'
|
|
135736
|
+
};
|
|
135737
|
+
var timeFormats = {
|
|
135738
|
+
full: 'h:mm:ss a zzzz',
|
|
135739
|
+
long: 'h:mm:ss a z',
|
|
135740
|
+
medium: 'h:mm:ss a',
|
|
135741
|
+
short: 'h:mm a'
|
|
135742
|
+
};
|
|
135743
|
+
var dateTimeFormats = {
|
|
135744
|
+
full: "{{date}} 'at' {{time}}",
|
|
135745
|
+
long: "{{date}} 'at' {{time}}",
|
|
135746
|
+
medium: '{{date}}, {{time}}',
|
|
135747
|
+
short: '{{date}}, {{time}}'
|
|
135748
|
+
};
|
|
135749
|
+
var formatLong = {
|
|
135750
|
+
date: buildFormatLongFn({
|
|
135751
|
+
formats: dateFormats,
|
|
135752
|
+
defaultWidth: 'full'
|
|
135753
|
+
}),
|
|
135754
|
+
time: buildFormatLongFn({
|
|
135755
|
+
formats: timeFormats,
|
|
135756
|
+
defaultWidth: 'full'
|
|
135757
|
+
}),
|
|
135758
|
+
dateTime: buildFormatLongFn({
|
|
135759
|
+
formats: dateTimeFormats,
|
|
135760
|
+
defaultWidth: 'full'
|
|
135761
|
+
})
|
|
135762
|
+
};
|
|
135763
|
+
var formatLong$1 = formatLong;
|
|
135764
|
+
|
|
135765
|
+
var formatRelativeLocale = {
|
|
135766
|
+
lastWeek: "'last' eeee 'at' p",
|
|
135767
|
+
yesterday: "'yesterday at' p",
|
|
135768
|
+
today: "'today at' p",
|
|
135769
|
+
tomorrow: "'tomorrow at' p",
|
|
135770
|
+
nextWeek: "eeee 'at' p",
|
|
135771
|
+
other: 'P'
|
|
135772
|
+
};
|
|
135773
|
+
|
|
135774
|
+
var formatRelative = function (token, _date, _baseDate, _options) {
|
|
135775
|
+
return formatRelativeLocale[token];
|
|
135776
|
+
};
|
|
135777
|
+
|
|
135778
|
+
var formatRelative$1 = formatRelative;
|
|
135779
|
+
|
|
135780
|
+
function buildLocalizeFn(args) {
|
|
135781
|
+
return function (dirtyIndex, dirtyOptions) {
|
|
135782
|
+
var options = dirtyOptions || {};
|
|
135783
|
+
var context = options.context ? String(options.context) : 'standalone';
|
|
135784
|
+
var valuesArray;
|
|
135785
|
+
|
|
135786
|
+
if (context === 'formatting' && args.formattingValues) {
|
|
135787
|
+
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
135788
|
+
var width = options.width ? String(options.width) : defaultWidth;
|
|
135789
|
+
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
135790
|
+
} else {
|
|
135791
|
+
var _defaultWidth = args.defaultWidth;
|
|
135792
|
+
|
|
135793
|
+
var _width = options.width ? String(options.width) : args.defaultWidth;
|
|
135794
|
+
|
|
135795
|
+
valuesArray = args.values[_width] || args.values[_defaultWidth];
|
|
135796
|
+
}
|
|
135797
|
+
|
|
135798
|
+
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!
|
|
135799
|
+
|
|
135800
|
+
return valuesArray[index];
|
|
135801
|
+
};
|
|
135802
|
+
}
|
|
135803
|
+
|
|
135804
|
+
var eraValues = {
|
|
135805
|
+
narrow: ['B', 'A'],
|
|
135806
|
+
abbreviated: ['BC', 'AD'],
|
|
135807
|
+
wide: ['Before Christ', 'Anno Domini']
|
|
135808
|
+
};
|
|
135809
|
+
var quarterValues = {
|
|
135810
|
+
narrow: ['1', '2', '3', '4'],
|
|
135811
|
+
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
135812
|
+
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
|
|
135813
|
+
}; // Note: in English, the names of days of the week and months are capitalized.
|
|
135814
|
+
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
|
|
135815
|
+
// Generally, formatted dates should look like they are in the middle of a sentence,
|
|
135816
|
+
// e.g. in Spanish language the weekdays and months should be in the lowercase.
|
|
135817
|
+
|
|
135818
|
+
var monthValues = {
|
|
135819
|
+
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
|
|
135820
|
+
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
135821
|
+
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
|
135822
|
+
};
|
|
135823
|
+
var dayValues = {
|
|
135824
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
|
|
135825
|
+
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
135826
|
+
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
135827
|
+
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
135828
|
+
};
|
|
135829
|
+
var dayPeriodValues = {
|
|
135830
|
+
narrow: {
|
|
135831
|
+
am: 'a',
|
|
135832
|
+
pm: 'p',
|
|
135833
|
+
midnight: 'mi',
|
|
135834
|
+
noon: 'n',
|
|
135835
|
+
morning: 'morning',
|
|
135836
|
+
afternoon: 'afternoon',
|
|
135837
|
+
evening: 'evening',
|
|
135838
|
+
night: 'night'
|
|
135839
|
+
},
|
|
135840
|
+
abbreviated: {
|
|
135841
|
+
am: 'AM',
|
|
135842
|
+
pm: 'PM',
|
|
135843
|
+
midnight: 'midnight',
|
|
135844
|
+
noon: 'noon',
|
|
135845
|
+
morning: 'morning',
|
|
135846
|
+
afternoon: 'afternoon',
|
|
135847
|
+
evening: 'evening',
|
|
135848
|
+
night: 'night'
|
|
135849
|
+
},
|
|
135850
|
+
wide: {
|
|
135851
|
+
am: 'a.m.',
|
|
135852
|
+
pm: 'p.m.',
|
|
135853
|
+
midnight: 'midnight',
|
|
135854
|
+
noon: 'noon',
|
|
135855
|
+
morning: 'morning',
|
|
135856
|
+
afternoon: 'afternoon',
|
|
135857
|
+
evening: 'evening',
|
|
135858
|
+
night: 'night'
|
|
135859
|
+
}
|
|
135860
|
+
};
|
|
135861
|
+
var formattingDayPeriodValues = {
|
|
135862
|
+
narrow: {
|
|
135863
|
+
am: 'a',
|
|
135864
|
+
pm: 'p',
|
|
135865
|
+
midnight: 'mi',
|
|
135866
|
+
noon: 'n',
|
|
135867
|
+
morning: 'in the morning',
|
|
135868
|
+
afternoon: 'in the afternoon',
|
|
135869
|
+
evening: 'in the evening',
|
|
135870
|
+
night: 'at night'
|
|
135871
|
+
},
|
|
135872
|
+
abbreviated: {
|
|
135873
|
+
am: 'AM',
|
|
135874
|
+
pm: 'PM',
|
|
135875
|
+
midnight: 'midnight',
|
|
135876
|
+
noon: 'noon',
|
|
135877
|
+
morning: 'in the morning',
|
|
135878
|
+
afternoon: 'in the afternoon',
|
|
135879
|
+
evening: 'in the evening',
|
|
135880
|
+
night: 'at night'
|
|
135881
|
+
},
|
|
135882
|
+
wide: {
|
|
135883
|
+
am: 'a.m.',
|
|
135884
|
+
pm: 'p.m.',
|
|
135885
|
+
midnight: 'midnight',
|
|
135886
|
+
noon: 'noon',
|
|
135887
|
+
morning: 'in the morning',
|
|
135888
|
+
afternoon: 'in the afternoon',
|
|
135889
|
+
evening: 'in the evening',
|
|
135890
|
+
night: 'at night'
|
|
135891
|
+
}
|
|
135892
|
+
};
|
|
135893
|
+
|
|
135894
|
+
var ordinalNumber = function (dirtyNumber, _options) {
|
|
135895
|
+
var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
|
|
135896
|
+
// if they are different for different grammatical genders,
|
|
135897
|
+
// use `options.unit`.
|
|
135898
|
+
//
|
|
135899
|
+
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
|
|
135900
|
+
// 'day', 'hour', 'minute', 'second'.
|
|
135901
|
+
|
|
135902
|
+
var rem100 = number % 100;
|
|
135903
|
+
|
|
135904
|
+
if (rem100 > 20 || rem100 < 10) {
|
|
135905
|
+
switch (rem100 % 10) {
|
|
135906
|
+
case 1:
|
|
135907
|
+
return number + 'st';
|
|
135908
|
+
|
|
135909
|
+
case 2:
|
|
135910
|
+
return number + 'nd';
|
|
135911
|
+
|
|
135912
|
+
case 3:
|
|
135913
|
+
return number + 'rd';
|
|
135914
|
+
}
|
|
135915
|
+
}
|
|
135916
|
+
|
|
135917
|
+
return number + 'th';
|
|
135918
|
+
};
|
|
135919
|
+
|
|
135920
|
+
var localize = {
|
|
135921
|
+
ordinalNumber: ordinalNumber,
|
|
135922
|
+
era: buildLocalizeFn({
|
|
135923
|
+
values: eraValues,
|
|
135924
|
+
defaultWidth: 'wide'
|
|
135925
|
+
}),
|
|
135926
|
+
quarter: buildLocalizeFn({
|
|
135927
|
+
values: quarterValues,
|
|
135928
|
+
defaultWidth: 'wide',
|
|
135929
|
+
argumentCallback: function (quarter) {
|
|
135930
|
+
return quarter - 1;
|
|
135931
|
+
}
|
|
135932
|
+
}),
|
|
135933
|
+
month: buildLocalizeFn({
|
|
135934
|
+
values: monthValues,
|
|
135935
|
+
defaultWidth: 'wide'
|
|
135936
|
+
}),
|
|
135937
|
+
day: buildLocalizeFn({
|
|
135938
|
+
values: dayValues,
|
|
135939
|
+
defaultWidth: 'wide'
|
|
135940
|
+
}),
|
|
135941
|
+
dayPeriod: buildLocalizeFn({
|
|
135942
|
+
values: dayPeriodValues,
|
|
135943
|
+
defaultWidth: 'wide',
|
|
135944
|
+
formattingValues: formattingDayPeriodValues,
|
|
135945
|
+
defaultFormattingWidth: 'wide'
|
|
135946
|
+
})
|
|
135947
|
+
};
|
|
135948
|
+
var localize$1 = localize;
|
|
135949
|
+
|
|
135950
|
+
function buildMatchFn(args) {
|
|
135951
|
+
return function (string) {
|
|
135952
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
135953
|
+
var width = options.width;
|
|
135954
|
+
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
135955
|
+
var matchResult = string.match(matchPattern);
|
|
135956
|
+
|
|
135957
|
+
if (!matchResult) {
|
|
135958
|
+
return null;
|
|
135959
|
+
}
|
|
135960
|
+
|
|
135961
|
+
var matchedString = matchResult[0];
|
|
135962
|
+
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
135963
|
+
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
|
|
135964
|
+
return pattern.test(matchedString);
|
|
135965
|
+
}) : findKey(parsePatterns, function (pattern) {
|
|
135966
|
+
return pattern.test(matchedString);
|
|
135967
|
+
});
|
|
135968
|
+
var value;
|
|
135969
|
+
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
135970
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
135971
|
+
var rest = string.slice(matchedString.length);
|
|
135972
|
+
return {
|
|
135973
|
+
value: value,
|
|
135974
|
+
rest: rest
|
|
135975
|
+
};
|
|
135976
|
+
};
|
|
135977
|
+
}
|
|
135978
|
+
|
|
135979
|
+
function findKey(object, predicate) {
|
|
135980
|
+
for (var key in object) {
|
|
135981
|
+
if (object.hasOwnProperty(key) && predicate(object[key])) {
|
|
135982
|
+
return key;
|
|
135983
|
+
}
|
|
135984
|
+
}
|
|
135985
|
+
|
|
135986
|
+
return undefined;
|
|
135987
|
+
}
|
|
135988
|
+
|
|
135989
|
+
function findIndex(array, predicate) {
|
|
135990
|
+
for (var key = 0; key < array.length; key++) {
|
|
135991
|
+
if (predicate(array[key])) {
|
|
135992
|
+
return key;
|
|
135993
|
+
}
|
|
135994
|
+
}
|
|
135995
|
+
|
|
135996
|
+
return undefined;
|
|
135997
|
+
}
|
|
135998
|
+
|
|
135999
|
+
function buildMatchPatternFn(args) {
|
|
136000
|
+
return function (string) {
|
|
136001
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
136002
|
+
var matchResult = string.match(args.matchPattern);
|
|
136003
|
+
if (!matchResult) return null;
|
|
136004
|
+
var matchedString = matchResult[0];
|
|
136005
|
+
var parseResult = string.match(args.parsePattern);
|
|
136006
|
+
if (!parseResult) return null;
|
|
136007
|
+
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
136008
|
+
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
136009
|
+
var rest = string.slice(matchedString.length);
|
|
136010
|
+
return {
|
|
136011
|
+
value: value,
|
|
136012
|
+
rest: rest
|
|
136013
|
+
};
|
|
136014
|
+
};
|
|
136015
|
+
}
|
|
136016
|
+
|
|
136017
|
+
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
136018
|
+
var parseOrdinalNumberPattern = /\d+/i;
|
|
136019
|
+
var matchEraPatterns = {
|
|
136020
|
+
narrow: /^(b|a)/i,
|
|
136021
|
+
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
136022
|
+
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
136023
|
+
};
|
|
136024
|
+
var parseEraPatterns = {
|
|
136025
|
+
any: [/^b/i, /^(a|c)/i]
|
|
136026
|
+
};
|
|
136027
|
+
var matchQuarterPatterns = {
|
|
136028
|
+
narrow: /^[1234]/i,
|
|
136029
|
+
abbreviated: /^q[1234]/i,
|
|
136030
|
+
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
136031
|
+
};
|
|
136032
|
+
var parseQuarterPatterns = {
|
|
136033
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
136034
|
+
};
|
|
136035
|
+
var matchMonthPatterns = {
|
|
136036
|
+
narrow: /^[jfmasond]/i,
|
|
136037
|
+
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
136038
|
+
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
136039
|
+
};
|
|
136040
|
+
var parseMonthPatterns = {
|
|
136041
|
+
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],
|
|
136042
|
+
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]
|
|
136043
|
+
};
|
|
136044
|
+
var matchDayPatterns = {
|
|
136045
|
+
narrow: /^[smtwf]/i,
|
|
136046
|
+
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
136047
|
+
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
136048
|
+
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
136049
|
+
};
|
|
136050
|
+
var parseDayPatterns = {
|
|
136051
|
+
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
136052
|
+
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
136053
|
+
};
|
|
136054
|
+
var matchDayPeriodPatterns = {
|
|
136055
|
+
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
136056
|
+
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
136057
|
+
};
|
|
136058
|
+
var parseDayPeriodPatterns = {
|
|
136059
|
+
any: {
|
|
136060
|
+
am: /^a/i,
|
|
136061
|
+
pm: /^p/i,
|
|
136062
|
+
midnight: /^mi/i,
|
|
136063
|
+
noon: /^no/i,
|
|
136064
|
+
morning: /morning/i,
|
|
136065
|
+
afternoon: /afternoon/i,
|
|
136066
|
+
evening: /evening/i,
|
|
136067
|
+
night: /night/i
|
|
136068
|
+
}
|
|
136069
|
+
};
|
|
136070
|
+
var match = {
|
|
136071
|
+
ordinalNumber: buildMatchPatternFn({
|
|
136072
|
+
matchPattern: matchOrdinalNumberPattern,
|
|
136073
|
+
parsePattern: parseOrdinalNumberPattern,
|
|
136074
|
+
valueCallback: function (value) {
|
|
136075
|
+
return parseInt(value, 10);
|
|
136076
|
+
}
|
|
136077
|
+
}),
|
|
136078
|
+
era: buildMatchFn({
|
|
136079
|
+
matchPatterns: matchEraPatterns,
|
|
136080
|
+
defaultMatchWidth: 'wide',
|
|
136081
|
+
parsePatterns: parseEraPatterns,
|
|
136082
|
+
defaultParseWidth: 'any'
|
|
136083
|
+
}),
|
|
136084
|
+
quarter: buildMatchFn({
|
|
136085
|
+
matchPatterns: matchQuarterPatterns,
|
|
136086
|
+
defaultMatchWidth: 'wide',
|
|
136087
|
+
parsePatterns: parseQuarterPatterns,
|
|
136088
|
+
defaultParseWidth: 'any',
|
|
136089
|
+
valueCallback: function (index) {
|
|
136090
|
+
return index + 1;
|
|
136091
|
+
}
|
|
136092
|
+
}),
|
|
136093
|
+
month: buildMatchFn({
|
|
136094
|
+
matchPatterns: matchMonthPatterns,
|
|
136095
|
+
defaultMatchWidth: 'wide',
|
|
136096
|
+
parsePatterns: parseMonthPatterns,
|
|
136097
|
+
defaultParseWidth: 'any'
|
|
136098
|
+
}),
|
|
136099
|
+
day: buildMatchFn({
|
|
136100
|
+
matchPatterns: matchDayPatterns,
|
|
136101
|
+
defaultMatchWidth: 'wide',
|
|
136102
|
+
parsePatterns: parseDayPatterns,
|
|
136103
|
+
defaultParseWidth: 'any'
|
|
136104
|
+
}),
|
|
136105
|
+
dayPeriod: buildMatchFn({
|
|
136106
|
+
matchPatterns: matchDayPeriodPatterns,
|
|
136107
|
+
defaultMatchWidth: 'any',
|
|
136108
|
+
parsePatterns: parseDayPeriodPatterns,
|
|
136109
|
+
defaultParseWidth: 'any'
|
|
136110
|
+
})
|
|
136111
|
+
};
|
|
136112
|
+
var match$1 = match;
|
|
136113
|
+
|
|
136114
|
+
/**
|
|
136115
|
+
* @type {Locale}
|
|
136116
|
+
* @category Locales
|
|
136117
|
+
* @summary English locale (United States).
|
|
136118
|
+
* @language English
|
|
136119
|
+
* @iso-639-2 eng
|
|
136120
|
+
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
|
|
136121
|
+
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
|
|
136122
|
+
*/
|
|
136123
|
+
var locale = {
|
|
136124
|
+
code: 'en-US',
|
|
136125
|
+
formatDistance: formatDistance$1,
|
|
136126
|
+
formatLong: formatLong$1,
|
|
136127
|
+
formatRelative: formatRelative$1,
|
|
136128
|
+
localize: localize$1,
|
|
136129
|
+
match: match$1,
|
|
136130
|
+
options: {
|
|
136131
|
+
weekStartsOn: 0
|
|
136132
|
+
/* Sunday */
|
|
136133
|
+
,
|
|
136134
|
+
firstWeekContainsDate: 1
|
|
136135
|
+
}
|
|
136136
|
+
};
|
|
136137
|
+
var defaultLocale = locale;
|
|
136138
|
+
|
|
136139
|
+
/**
|
|
136140
|
+
* @name subMilliseconds
|
|
136141
|
+
* @category Millisecond Helpers
|
|
136142
|
+
* @summary Subtract the specified number of milliseconds from the given date.
|
|
136143
|
+
*
|
|
136144
|
+
* @description
|
|
136145
|
+
* Subtract the specified number of milliseconds from the given date.
|
|
136146
|
+
*
|
|
136147
|
+
* ### v2.0.0 breaking changes:
|
|
136148
|
+
*
|
|
136149
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
136150
|
+
*
|
|
136151
|
+
* @param {Date|Number} date - the date to be changed
|
|
136152
|
+
* @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`.
|
|
136153
|
+
* @returns {Date} the new date with the milliseconds subtracted
|
|
136154
|
+
* @throws {TypeError} 2 arguments required
|
|
136155
|
+
*
|
|
136156
|
+
* @example
|
|
136157
|
+
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
|
|
136158
|
+
* const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
|
|
136159
|
+
* //=> Thu Jul 10 2014 12:45:29.250
|
|
136160
|
+
*/
|
|
136161
|
+
|
|
136162
|
+
function subMilliseconds(dirtyDate, dirtyAmount) {
|
|
136163
|
+
requiredArgs(2, arguments);
|
|
136164
|
+
var amount = toInteger(dirtyAmount);
|
|
136165
|
+
return addMilliseconds(dirtyDate, -amount);
|
|
136166
|
+
}
|
|
136167
|
+
|
|
136168
|
+
function addLeadingZeros(number, targetLength) {
|
|
136169
|
+
var sign = number < 0 ? '-' : '';
|
|
136170
|
+
var output = Math.abs(number).toString();
|
|
136171
|
+
|
|
136172
|
+
while (output.length < targetLength) {
|
|
136173
|
+
output = '0' + output;
|
|
136174
|
+
}
|
|
136175
|
+
|
|
136176
|
+
return sign + output;
|
|
136177
|
+
}
|
|
136178
|
+
|
|
136179
|
+
/*
|
|
136180
|
+
* | | Unit | | Unit |
|
|
136181
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
136182
|
+
* | a | AM, PM | A* | |
|
|
136183
|
+
* | d | Day of month | D | |
|
|
136184
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
136185
|
+
* | m | Minute | M | Month |
|
|
136186
|
+
* | s | Second | S | Fraction of second |
|
|
136187
|
+
* | y | Year (abs) | Y | |
|
|
136188
|
+
*
|
|
136189
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
136190
|
+
*/
|
|
136191
|
+
|
|
136192
|
+
var formatters$2 = {
|
|
136193
|
+
// Year
|
|
136194
|
+
y: function (date, token) {
|
|
136195
|
+
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
|
|
136196
|
+
// | Year | y | yy | yyy | yyyy | yyyyy |
|
|
136197
|
+
// |----------|-------|----|-------|-------|-------|
|
|
136198
|
+
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
|
|
136199
|
+
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
|
|
136200
|
+
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
|
|
136201
|
+
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
|
|
136202
|
+
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
|
|
136203
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
136204
|
+
|
|
136205
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
136206
|
+
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
|
|
136207
|
+
},
|
|
136208
|
+
// Month
|
|
136209
|
+
M: function (date, token) {
|
|
136210
|
+
var month = date.getUTCMonth();
|
|
136211
|
+
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
136212
|
+
},
|
|
136213
|
+
// Day of the month
|
|
136214
|
+
d: function (date, token) {
|
|
136215
|
+
return addLeadingZeros(date.getUTCDate(), token.length);
|
|
136216
|
+
},
|
|
136217
|
+
// AM or PM
|
|
136218
|
+
a: function (date, token) {
|
|
136219
|
+
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
|
|
136220
|
+
|
|
136221
|
+
switch (token) {
|
|
136222
|
+
case 'a':
|
|
136223
|
+
case 'aa':
|
|
136224
|
+
return dayPeriodEnumValue.toUpperCase();
|
|
136225
|
+
|
|
136226
|
+
case 'aaa':
|
|
136227
|
+
return dayPeriodEnumValue;
|
|
136228
|
+
|
|
136229
|
+
case 'aaaaa':
|
|
136230
|
+
return dayPeriodEnumValue[0];
|
|
136231
|
+
|
|
136232
|
+
case 'aaaa':
|
|
136233
|
+
default:
|
|
136234
|
+
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
|
|
136235
|
+
}
|
|
136236
|
+
},
|
|
136237
|
+
// Hour [1-12]
|
|
136238
|
+
h: function (date, token) {
|
|
136239
|
+
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
|
|
136240
|
+
},
|
|
136241
|
+
// Hour [0-23]
|
|
136242
|
+
H: function (date, token) {
|
|
136243
|
+
return addLeadingZeros(date.getUTCHours(), token.length);
|
|
136244
|
+
},
|
|
136245
|
+
// Minute
|
|
136246
|
+
m: function (date, token) {
|
|
136247
|
+
return addLeadingZeros(date.getUTCMinutes(), token.length);
|
|
136248
|
+
},
|
|
136249
|
+
// Second
|
|
136250
|
+
s: function (date, token) {
|
|
136251
|
+
return addLeadingZeros(date.getUTCSeconds(), token.length);
|
|
136252
|
+
},
|
|
136253
|
+
// Fraction of second
|
|
136254
|
+
S: function (date, token) {
|
|
136255
|
+
var numberOfDigits = token.length;
|
|
136256
|
+
var milliseconds = date.getUTCMilliseconds();
|
|
136257
|
+
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
|
|
136258
|
+
return addLeadingZeros(fractionalSeconds, token.length);
|
|
136259
|
+
}
|
|
136260
|
+
};
|
|
136261
|
+
var formatters$3 = formatters$2;
|
|
136262
|
+
|
|
136263
|
+
var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
|
|
136264
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136265
|
+
|
|
136266
|
+
function getUTCDayOfYear(dirtyDate) {
|
|
136267
|
+
requiredArgs(1, arguments);
|
|
136268
|
+
var date = toDate(dirtyDate);
|
|
136269
|
+
var timestamp = date.getTime();
|
|
136270
|
+
date.setUTCMonth(0, 1);
|
|
136271
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
136272
|
+
var startOfYearTimestamp = date.getTime();
|
|
136273
|
+
var difference = timestamp - startOfYearTimestamp;
|
|
136274
|
+
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
|
|
136275
|
+
}
|
|
136276
|
+
|
|
136277
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136278
|
+
|
|
136279
|
+
function startOfUTCISOWeek(dirtyDate) {
|
|
136280
|
+
requiredArgs(1, arguments);
|
|
136281
|
+
var weekStartsOn = 1;
|
|
136282
|
+
var date = toDate(dirtyDate);
|
|
136283
|
+
var day = date.getUTCDay();
|
|
136284
|
+
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
136285
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
|
136286
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
136287
|
+
return date;
|
|
136288
|
+
}
|
|
136289
|
+
|
|
136290
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136291
|
+
|
|
136292
|
+
function getUTCISOWeekYear(dirtyDate) {
|
|
136293
|
+
requiredArgs(1, arguments);
|
|
136294
|
+
var date = toDate(dirtyDate);
|
|
136295
|
+
var year = date.getUTCFullYear();
|
|
136296
|
+
var fourthOfJanuaryOfNextYear = new Date(0);
|
|
136297
|
+
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
|
|
136298
|
+
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
136299
|
+
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
|
|
136300
|
+
var fourthOfJanuaryOfThisYear = new Date(0);
|
|
136301
|
+
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
|
|
136302
|
+
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
136303
|
+
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
|
|
136304
|
+
|
|
136305
|
+
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
136306
|
+
return year + 1;
|
|
136307
|
+
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
136308
|
+
return year;
|
|
136309
|
+
} else {
|
|
136310
|
+
return year - 1;
|
|
136311
|
+
}
|
|
136312
|
+
}
|
|
136313
|
+
|
|
136314
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136315
|
+
|
|
136316
|
+
function startOfUTCISOWeekYear(dirtyDate) {
|
|
136317
|
+
requiredArgs(1, arguments);
|
|
136318
|
+
var year = getUTCISOWeekYear(dirtyDate);
|
|
136319
|
+
var fourthOfJanuary = new Date(0);
|
|
136320
|
+
fourthOfJanuary.setUTCFullYear(year, 0, 4);
|
|
136321
|
+
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
|
|
136322
|
+
var date = startOfUTCISOWeek(fourthOfJanuary);
|
|
136323
|
+
return date;
|
|
136324
|
+
}
|
|
136325
|
+
|
|
136326
|
+
var MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.
|
|
136327
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136328
|
+
|
|
136329
|
+
function getUTCISOWeek(dirtyDate) {
|
|
136330
|
+
requiredArgs(1, arguments);
|
|
136331
|
+
var date = toDate(dirtyDate);
|
|
136332
|
+
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
|
|
136333
|
+
// because the number of milliseconds in a week is not constant
|
|
136334
|
+
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
136335
|
+
|
|
136336
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
|
|
136337
|
+
}
|
|
136338
|
+
|
|
136339
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136340
|
+
|
|
136341
|
+
function startOfUTCWeek(dirtyDate, dirtyOptions) {
|
|
136342
|
+
requiredArgs(1, arguments);
|
|
136343
|
+
var options = dirtyOptions || {};
|
|
136344
|
+
var locale = options.locale;
|
|
136345
|
+
var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
|
|
136346
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
|
136347
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
136348
|
+
|
|
136349
|
+
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
136350
|
+
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
136351
|
+
}
|
|
136352
|
+
|
|
136353
|
+
var date = toDate(dirtyDate);
|
|
136354
|
+
var day = date.getUTCDay();
|
|
136355
|
+
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
136356
|
+
date.setUTCDate(date.getUTCDate() - diff);
|
|
136357
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
136358
|
+
return date;
|
|
136359
|
+
}
|
|
136360
|
+
|
|
136361
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136362
|
+
|
|
136363
|
+
function getUTCWeekYear(dirtyDate, dirtyOptions) {
|
|
136364
|
+
requiredArgs(1, arguments);
|
|
136365
|
+
var date = toDate(dirtyDate, dirtyOptions);
|
|
136366
|
+
var year = date.getUTCFullYear();
|
|
136367
|
+
var options = dirtyOptions || {};
|
|
136368
|
+
var locale = options.locale;
|
|
136369
|
+
var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
|
|
136370
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
136371
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
136372
|
+
|
|
136373
|
+
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
136374
|
+
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
136375
|
+
}
|
|
136376
|
+
|
|
136377
|
+
var firstWeekOfNextYear = new Date(0);
|
|
136378
|
+
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
|
|
136379
|
+
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
|
|
136380
|
+
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);
|
|
136381
|
+
var firstWeekOfThisYear = new Date(0);
|
|
136382
|
+
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
136383
|
+
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
|
|
136384
|
+
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);
|
|
136385
|
+
|
|
136386
|
+
if (date.getTime() >= startOfNextYear.getTime()) {
|
|
136387
|
+
return year + 1;
|
|
136388
|
+
} else if (date.getTime() >= startOfThisYear.getTime()) {
|
|
136389
|
+
return year;
|
|
136390
|
+
} else {
|
|
136391
|
+
return year - 1;
|
|
136392
|
+
}
|
|
136393
|
+
}
|
|
136394
|
+
|
|
136395
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136396
|
+
|
|
136397
|
+
function startOfUTCWeekYear(dirtyDate, dirtyOptions) {
|
|
136398
|
+
requiredArgs(1, arguments);
|
|
136399
|
+
var options = dirtyOptions || {};
|
|
136400
|
+
var locale = options.locale;
|
|
136401
|
+
var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
|
|
136402
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
136403
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
|
|
136404
|
+
var year = getUTCWeekYear(dirtyDate, dirtyOptions);
|
|
136405
|
+
var firstWeek = new Date(0);
|
|
136406
|
+
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
|
|
136407
|
+
firstWeek.setUTCHours(0, 0, 0, 0);
|
|
136408
|
+
var date = startOfUTCWeek(firstWeek, dirtyOptions);
|
|
136409
|
+
return date;
|
|
136410
|
+
}
|
|
136411
|
+
|
|
136412
|
+
var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.
|
|
136413
|
+
// See issue: https://github.com/date-fns/date-fns/issues/376
|
|
136414
|
+
|
|
136415
|
+
function getUTCWeek(dirtyDate, options) {
|
|
136416
|
+
requiredArgs(1, arguments);
|
|
136417
|
+
var date = toDate(dirtyDate);
|
|
136418
|
+
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
|
|
136419
|
+
// because the number of milliseconds in a week is not constant
|
|
136420
|
+
// (e.g. it's different in the week of the daylight saving time clock shift)
|
|
136421
|
+
|
|
136422
|
+
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
|
|
136423
|
+
}
|
|
136424
|
+
|
|
136425
|
+
var dayPeriodEnum = {
|
|
136426
|
+
am: 'am',
|
|
136427
|
+
pm: 'pm',
|
|
136428
|
+
midnight: 'midnight',
|
|
136429
|
+
noon: 'noon',
|
|
136430
|
+
morning: 'morning',
|
|
136431
|
+
afternoon: 'afternoon',
|
|
136432
|
+
evening: 'evening',
|
|
136433
|
+
night: 'night'
|
|
136434
|
+
};
|
|
136435
|
+
/*
|
|
136436
|
+
* | | Unit | | Unit |
|
|
136437
|
+
* |-----|--------------------------------|-----|--------------------------------|
|
|
136438
|
+
* | a | AM, PM | A* | Milliseconds in day |
|
|
136439
|
+
* | b | AM, PM, noon, midnight | B | Flexible day period |
|
|
136440
|
+
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
|
|
136441
|
+
* | d | Day of month | D | Day of year |
|
|
136442
|
+
* | e | Local day of week | E | Day of week |
|
|
136443
|
+
* | f | | F* | Day of week in month |
|
|
136444
|
+
* | g* | Modified Julian day | G | Era |
|
|
136445
|
+
* | h | Hour [1-12] | H | Hour [0-23] |
|
|
136446
|
+
* | i! | ISO day of week | I! | ISO week of year |
|
|
136447
|
+
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
|
|
136448
|
+
* | k | Hour [1-24] | K | Hour [0-11] |
|
|
136449
|
+
* | l* | (deprecated) | L | Stand-alone month |
|
|
136450
|
+
* | m | Minute | M | Month |
|
|
136451
|
+
* | n | | N | |
|
|
136452
|
+
* | o! | Ordinal number modifier | O | Timezone (GMT) |
|
|
136453
|
+
* | p! | Long localized time | P! | Long localized date |
|
|
136454
|
+
* | q | Stand-alone quarter | Q | Quarter |
|
|
136455
|
+
* | r* | Related Gregorian year | R! | ISO week-numbering year |
|
|
136456
|
+
* | s | Second | S | Fraction of second |
|
|
136457
|
+
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
|
|
136458
|
+
* | u | Extended year | U* | Cyclic year |
|
|
136459
|
+
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
|
|
136460
|
+
* | w | Local week of year | W* | Week of month |
|
|
136461
|
+
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
|
|
136462
|
+
* | y | Year (abs) | Y | Local week-numbering year |
|
|
136463
|
+
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
|
|
136464
|
+
*
|
|
136465
|
+
* Letters marked by * are not implemented but reserved by Unicode standard.
|
|
136466
|
+
*
|
|
136467
|
+
* Letters marked by ! are non-standard, but implemented by date-fns:
|
|
136468
|
+
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
|
|
136469
|
+
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
|
|
136470
|
+
* i.e. 7 for Sunday, 1 for Monday, etc.
|
|
136471
|
+
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
|
|
136472
|
+
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
|
|
136473
|
+
* `R` is supposed to be used in conjunction with `I` and `i`
|
|
136474
|
+
* for universal ISO week-numbering date, whereas
|
|
136475
|
+
* `Y` is supposed to be used in conjunction with `w` and `e`
|
|
136476
|
+
* for week-numbering date specific to the locale.
|
|
136477
|
+
* - `P` is long localized date format
|
|
136478
|
+
* - `p` is long localized time format
|
|
136479
|
+
*/
|
|
136480
|
+
|
|
136481
|
+
var formatters = {
|
|
136482
|
+
// Era
|
|
136483
|
+
G: function (date, token, localize) {
|
|
136484
|
+
var era = date.getUTCFullYear() > 0 ? 1 : 0;
|
|
136485
|
+
|
|
136486
|
+
switch (token) {
|
|
136487
|
+
// AD, BC
|
|
136488
|
+
case 'G':
|
|
136489
|
+
case 'GG':
|
|
136490
|
+
case 'GGG':
|
|
136491
|
+
return localize.era(era, {
|
|
136492
|
+
width: 'abbreviated'
|
|
136493
|
+
});
|
|
136494
|
+
// A, B
|
|
136495
|
+
|
|
136496
|
+
case 'GGGGG':
|
|
136497
|
+
return localize.era(era, {
|
|
136498
|
+
width: 'narrow'
|
|
136499
|
+
});
|
|
136500
|
+
// Anno Domini, Before Christ
|
|
136501
|
+
|
|
136502
|
+
case 'GGGG':
|
|
136503
|
+
default:
|
|
136504
|
+
return localize.era(era, {
|
|
136505
|
+
width: 'wide'
|
|
136506
|
+
});
|
|
136507
|
+
}
|
|
136508
|
+
},
|
|
136509
|
+
// Year
|
|
136510
|
+
y: function (date, token, localize) {
|
|
136511
|
+
// Ordinal number
|
|
136512
|
+
if (token === 'yo') {
|
|
136513
|
+
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
136514
|
+
|
|
136515
|
+
var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
136516
|
+
return localize.ordinalNumber(year, {
|
|
136517
|
+
unit: 'year'
|
|
136518
|
+
});
|
|
136519
|
+
}
|
|
136520
|
+
|
|
136521
|
+
return formatters$3.y(date, token);
|
|
136522
|
+
},
|
|
136523
|
+
// Local week-numbering year
|
|
136524
|
+
Y: function (date, token, localize, options) {
|
|
136525
|
+
var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
|
|
136526
|
+
|
|
136527
|
+
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
|
|
136528
|
+
|
|
136529
|
+
if (token === 'YY') {
|
|
136530
|
+
var twoDigitYear = weekYear % 100;
|
|
136531
|
+
return addLeadingZeros(twoDigitYear, 2);
|
|
136532
|
+
} // Ordinal number
|
|
136533
|
+
|
|
136534
|
+
|
|
136535
|
+
if (token === 'Yo') {
|
|
136536
|
+
return localize.ordinalNumber(weekYear, {
|
|
136537
|
+
unit: 'year'
|
|
136538
|
+
});
|
|
136539
|
+
} // Padding
|
|
136540
|
+
|
|
136541
|
+
|
|
136542
|
+
return addLeadingZeros(weekYear, token.length);
|
|
136543
|
+
},
|
|
136544
|
+
// ISO week-numbering year
|
|
136545
|
+
R: function (date, token) {
|
|
136546
|
+
var isoWeekYear = getUTCISOWeekYear(date); // Padding
|
|
136547
|
+
|
|
136548
|
+
return addLeadingZeros(isoWeekYear, token.length);
|
|
136549
|
+
},
|
|
136550
|
+
// Extended year. This is a single number designating the year of this calendar system.
|
|
136551
|
+
// The main difference between `y` and `u` localizers are B.C. years:
|
|
136552
|
+
// | Year | `y` | `u` |
|
|
136553
|
+
// |------|-----|-----|
|
|
136554
|
+
// | AC 1 | 1 | 1 |
|
|
136555
|
+
// | BC 1 | 1 | 0 |
|
|
136556
|
+
// | BC 2 | 2 | -1 |
|
|
136557
|
+
// Also `yy` always returns the last two digits of a year,
|
|
136558
|
+
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
136559
|
+
u: function (date, token) {
|
|
136560
|
+
var year = date.getUTCFullYear();
|
|
136561
|
+
return addLeadingZeros(year, token.length);
|
|
136562
|
+
},
|
|
136563
|
+
// Quarter
|
|
136564
|
+
Q: function (date, token, localize) {
|
|
136565
|
+
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
|
136566
|
+
|
|
136567
|
+
switch (token) {
|
|
136568
|
+
// 1, 2, 3, 4
|
|
136569
|
+
case 'Q':
|
|
136570
|
+
return String(quarter);
|
|
136571
|
+
// 01, 02, 03, 04
|
|
136572
|
+
|
|
136573
|
+
case 'QQ':
|
|
136574
|
+
return addLeadingZeros(quarter, 2);
|
|
136575
|
+
// 1st, 2nd, 3rd, 4th
|
|
136576
|
+
|
|
136577
|
+
case 'Qo':
|
|
136578
|
+
return localize.ordinalNumber(quarter, {
|
|
136579
|
+
unit: 'quarter'
|
|
136580
|
+
});
|
|
136581
|
+
// Q1, Q2, Q3, Q4
|
|
136582
|
+
|
|
136583
|
+
case 'QQQ':
|
|
136584
|
+
return localize.quarter(quarter, {
|
|
136585
|
+
width: 'abbreviated',
|
|
136586
|
+
context: 'formatting'
|
|
136587
|
+
});
|
|
136588
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
136589
|
+
|
|
136590
|
+
case 'QQQQQ':
|
|
136591
|
+
return localize.quarter(quarter, {
|
|
136592
|
+
width: 'narrow',
|
|
136593
|
+
context: 'formatting'
|
|
136594
|
+
});
|
|
136595
|
+
// 1st quarter, 2nd quarter, ...
|
|
136596
|
+
|
|
136597
|
+
case 'QQQQ':
|
|
136598
|
+
default:
|
|
136599
|
+
return localize.quarter(quarter, {
|
|
136600
|
+
width: 'wide',
|
|
136601
|
+
context: 'formatting'
|
|
136602
|
+
});
|
|
136603
|
+
}
|
|
136604
|
+
},
|
|
136605
|
+
// Stand-alone quarter
|
|
136606
|
+
q: function (date, token, localize) {
|
|
136607
|
+
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
|
|
136608
|
+
|
|
136609
|
+
switch (token) {
|
|
136610
|
+
// 1, 2, 3, 4
|
|
136611
|
+
case 'q':
|
|
136612
|
+
return String(quarter);
|
|
136613
|
+
// 01, 02, 03, 04
|
|
136614
|
+
|
|
136615
|
+
case 'qq':
|
|
136616
|
+
return addLeadingZeros(quarter, 2);
|
|
136617
|
+
// 1st, 2nd, 3rd, 4th
|
|
136618
|
+
|
|
136619
|
+
case 'qo':
|
|
136620
|
+
return localize.ordinalNumber(quarter, {
|
|
136621
|
+
unit: 'quarter'
|
|
136622
|
+
});
|
|
136623
|
+
// Q1, Q2, Q3, Q4
|
|
136624
|
+
|
|
136625
|
+
case 'qqq':
|
|
136626
|
+
return localize.quarter(quarter, {
|
|
136627
|
+
width: 'abbreviated',
|
|
136628
|
+
context: 'standalone'
|
|
136629
|
+
});
|
|
136630
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
136631
|
+
|
|
136632
|
+
case 'qqqqq':
|
|
136633
|
+
return localize.quarter(quarter, {
|
|
136634
|
+
width: 'narrow',
|
|
136635
|
+
context: 'standalone'
|
|
136636
|
+
});
|
|
136637
|
+
// 1st quarter, 2nd quarter, ...
|
|
136638
|
+
|
|
136639
|
+
case 'qqqq':
|
|
136640
|
+
default:
|
|
136641
|
+
return localize.quarter(quarter, {
|
|
136642
|
+
width: 'wide',
|
|
136643
|
+
context: 'standalone'
|
|
136644
|
+
});
|
|
136645
|
+
}
|
|
136646
|
+
},
|
|
136647
|
+
// Month
|
|
136648
|
+
M: function (date, token, localize) {
|
|
136649
|
+
var month = date.getUTCMonth();
|
|
136650
|
+
|
|
136651
|
+
switch (token) {
|
|
136652
|
+
case 'M':
|
|
136653
|
+
case 'MM':
|
|
136654
|
+
return formatters$3.M(date, token);
|
|
136655
|
+
// 1st, 2nd, ..., 12th
|
|
136656
|
+
|
|
136657
|
+
case 'Mo':
|
|
136658
|
+
return localize.ordinalNumber(month + 1, {
|
|
136659
|
+
unit: 'month'
|
|
136660
|
+
});
|
|
136661
|
+
// Jan, Feb, ..., Dec
|
|
136662
|
+
|
|
136663
|
+
case 'MMM':
|
|
136664
|
+
return localize.month(month, {
|
|
136665
|
+
width: 'abbreviated',
|
|
136666
|
+
context: 'formatting'
|
|
136667
|
+
});
|
|
136668
|
+
// J, F, ..., D
|
|
136669
|
+
|
|
136670
|
+
case 'MMMMM':
|
|
136671
|
+
return localize.month(month, {
|
|
136672
|
+
width: 'narrow',
|
|
136673
|
+
context: 'formatting'
|
|
136674
|
+
});
|
|
136675
|
+
// January, February, ..., December
|
|
136676
|
+
|
|
136677
|
+
case 'MMMM':
|
|
136678
|
+
default:
|
|
136679
|
+
return localize.month(month, {
|
|
136680
|
+
width: 'wide',
|
|
136681
|
+
context: 'formatting'
|
|
136682
|
+
});
|
|
136683
|
+
}
|
|
136684
|
+
},
|
|
136685
|
+
// Stand-alone month
|
|
136686
|
+
L: function (date, token, localize) {
|
|
136687
|
+
var month = date.getUTCMonth();
|
|
136688
|
+
|
|
136689
|
+
switch (token) {
|
|
136690
|
+
// 1, 2, ..., 12
|
|
136691
|
+
case 'L':
|
|
136692
|
+
return String(month + 1);
|
|
136693
|
+
// 01, 02, ..., 12
|
|
136694
|
+
|
|
136695
|
+
case 'LL':
|
|
136696
|
+
return addLeadingZeros(month + 1, 2);
|
|
136697
|
+
// 1st, 2nd, ..., 12th
|
|
136698
|
+
|
|
136699
|
+
case 'Lo':
|
|
136700
|
+
return localize.ordinalNumber(month + 1, {
|
|
136701
|
+
unit: 'month'
|
|
136702
|
+
});
|
|
136703
|
+
// Jan, Feb, ..., Dec
|
|
136704
|
+
|
|
136705
|
+
case 'LLL':
|
|
136706
|
+
return localize.month(month, {
|
|
136707
|
+
width: 'abbreviated',
|
|
136708
|
+
context: 'standalone'
|
|
136709
|
+
});
|
|
136710
|
+
// J, F, ..., D
|
|
136711
|
+
|
|
136712
|
+
case 'LLLLL':
|
|
136713
|
+
return localize.month(month, {
|
|
136714
|
+
width: 'narrow',
|
|
136715
|
+
context: 'standalone'
|
|
136716
|
+
});
|
|
136717
|
+
// January, February, ..., December
|
|
136718
|
+
|
|
136719
|
+
case 'LLLL':
|
|
136720
|
+
default:
|
|
136721
|
+
return localize.month(month, {
|
|
136722
|
+
width: 'wide',
|
|
136723
|
+
context: 'standalone'
|
|
136724
|
+
});
|
|
136725
|
+
}
|
|
136726
|
+
},
|
|
136727
|
+
// Local week of year
|
|
136728
|
+
w: function (date, token, localize, options) {
|
|
136729
|
+
var week = getUTCWeek(date, options);
|
|
136730
|
+
|
|
136731
|
+
if (token === 'wo') {
|
|
136732
|
+
return localize.ordinalNumber(week, {
|
|
136733
|
+
unit: 'week'
|
|
136734
|
+
});
|
|
136735
|
+
}
|
|
136736
|
+
|
|
136737
|
+
return addLeadingZeros(week, token.length);
|
|
136738
|
+
},
|
|
136739
|
+
// ISO week of year
|
|
136740
|
+
I: function (date, token, localize) {
|
|
136741
|
+
var isoWeek = getUTCISOWeek(date);
|
|
136742
|
+
|
|
136743
|
+
if (token === 'Io') {
|
|
136744
|
+
return localize.ordinalNumber(isoWeek, {
|
|
136745
|
+
unit: 'week'
|
|
136746
|
+
});
|
|
136747
|
+
}
|
|
136748
|
+
|
|
136749
|
+
return addLeadingZeros(isoWeek, token.length);
|
|
136750
|
+
},
|
|
136751
|
+
// Day of the month
|
|
136752
|
+
d: function (date, token, localize) {
|
|
136753
|
+
if (token === 'do') {
|
|
136754
|
+
return localize.ordinalNumber(date.getUTCDate(), {
|
|
136755
|
+
unit: 'date'
|
|
136756
|
+
});
|
|
136757
|
+
}
|
|
136758
|
+
|
|
136759
|
+
return formatters$3.d(date, token);
|
|
136760
|
+
},
|
|
136761
|
+
// Day of year
|
|
136762
|
+
D: function (date, token, localize) {
|
|
136763
|
+
var dayOfYear = getUTCDayOfYear(date);
|
|
136764
|
+
|
|
136765
|
+
if (token === 'Do') {
|
|
136766
|
+
return localize.ordinalNumber(dayOfYear, {
|
|
136767
|
+
unit: 'dayOfYear'
|
|
136768
|
+
});
|
|
136769
|
+
}
|
|
136770
|
+
|
|
136771
|
+
return addLeadingZeros(dayOfYear, token.length);
|
|
136772
|
+
},
|
|
136773
|
+
// Day of week
|
|
136774
|
+
E: function (date, token, localize) {
|
|
136775
|
+
var dayOfWeek = date.getUTCDay();
|
|
136776
|
+
|
|
136777
|
+
switch (token) {
|
|
136778
|
+
// Tue
|
|
136779
|
+
case 'E':
|
|
136780
|
+
case 'EE':
|
|
136781
|
+
case 'EEE':
|
|
136782
|
+
return localize.day(dayOfWeek, {
|
|
136783
|
+
width: 'abbreviated',
|
|
136784
|
+
context: 'formatting'
|
|
136785
|
+
});
|
|
136786
|
+
// T
|
|
136787
|
+
|
|
136788
|
+
case 'EEEEE':
|
|
136789
|
+
return localize.day(dayOfWeek, {
|
|
136790
|
+
width: 'narrow',
|
|
136791
|
+
context: 'formatting'
|
|
136792
|
+
});
|
|
136793
|
+
// Tu
|
|
136794
|
+
|
|
136795
|
+
case 'EEEEEE':
|
|
136796
|
+
return localize.day(dayOfWeek, {
|
|
136797
|
+
width: 'short',
|
|
136798
|
+
context: 'formatting'
|
|
136799
|
+
});
|
|
136800
|
+
// Tuesday
|
|
136801
|
+
|
|
136802
|
+
case 'EEEE':
|
|
136803
|
+
default:
|
|
136804
|
+
return localize.day(dayOfWeek, {
|
|
136805
|
+
width: 'wide',
|
|
136806
|
+
context: 'formatting'
|
|
136807
|
+
});
|
|
136808
|
+
}
|
|
136809
|
+
},
|
|
136810
|
+
// Local day of week
|
|
136811
|
+
e: function (date, token, localize, options) {
|
|
136812
|
+
var dayOfWeek = date.getUTCDay();
|
|
136813
|
+
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
136814
|
+
|
|
136815
|
+
switch (token) {
|
|
136816
|
+
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
136817
|
+
case 'e':
|
|
136818
|
+
return String(localDayOfWeek);
|
|
136819
|
+
// Padded numerical value
|
|
136820
|
+
|
|
136821
|
+
case 'ee':
|
|
136822
|
+
return addLeadingZeros(localDayOfWeek, 2);
|
|
136823
|
+
// 1st, 2nd, ..., 7th
|
|
136824
|
+
|
|
136825
|
+
case 'eo':
|
|
136826
|
+
return localize.ordinalNumber(localDayOfWeek, {
|
|
136827
|
+
unit: 'day'
|
|
136828
|
+
});
|
|
136829
|
+
|
|
136830
|
+
case 'eee':
|
|
136831
|
+
return localize.day(dayOfWeek, {
|
|
136832
|
+
width: 'abbreviated',
|
|
136833
|
+
context: 'formatting'
|
|
136834
|
+
});
|
|
136835
|
+
// T
|
|
136836
|
+
|
|
136837
|
+
case 'eeeee':
|
|
136838
|
+
return localize.day(dayOfWeek, {
|
|
136839
|
+
width: 'narrow',
|
|
136840
|
+
context: 'formatting'
|
|
136841
|
+
});
|
|
136842
|
+
// Tu
|
|
136843
|
+
|
|
136844
|
+
case 'eeeeee':
|
|
136845
|
+
return localize.day(dayOfWeek, {
|
|
136846
|
+
width: 'short',
|
|
136847
|
+
context: 'formatting'
|
|
136848
|
+
});
|
|
136849
|
+
// Tuesday
|
|
136850
|
+
|
|
136851
|
+
case 'eeee':
|
|
136852
|
+
default:
|
|
136853
|
+
return localize.day(dayOfWeek, {
|
|
136854
|
+
width: 'wide',
|
|
136855
|
+
context: 'formatting'
|
|
136856
|
+
});
|
|
136857
|
+
}
|
|
136858
|
+
},
|
|
136859
|
+
// Stand-alone local day of week
|
|
136860
|
+
c: function (date, token, localize, options) {
|
|
136861
|
+
var dayOfWeek = date.getUTCDay();
|
|
136862
|
+
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
136863
|
+
|
|
136864
|
+
switch (token) {
|
|
136865
|
+
// Numerical value (same as in `e`)
|
|
136866
|
+
case 'c':
|
|
136867
|
+
return String(localDayOfWeek);
|
|
136868
|
+
// Padded numerical value
|
|
136869
|
+
|
|
136870
|
+
case 'cc':
|
|
136871
|
+
return addLeadingZeros(localDayOfWeek, token.length);
|
|
136872
|
+
// 1st, 2nd, ..., 7th
|
|
136873
|
+
|
|
136874
|
+
case 'co':
|
|
136875
|
+
return localize.ordinalNumber(localDayOfWeek, {
|
|
136876
|
+
unit: 'day'
|
|
136877
|
+
});
|
|
136878
|
+
|
|
136879
|
+
case 'ccc':
|
|
136880
|
+
return localize.day(dayOfWeek, {
|
|
136881
|
+
width: 'abbreviated',
|
|
136882
|
+
context: 'standalone'
|
|
136883
|
+
});
|
|
136884
|
+
// T
|
|
136885
|
+
|
|
136886
|
+
case 'ccccc':
|
|
136887
|
+
return localize.day(dayOfWeek, {
|
|
136888
|
+
width: 'narrow',
|
|
136889
|
+
context: 'standalone'
|
|
136890
|
+
});
|
|
136891
|
+
// Tu
|
|
136892
|
+
|
|
136893
|
+
case 'cccccc':
|
|
136894
|
+
return localize.day(dayOfWeek, {
|
|
136895
|
+
width: 'short',
|
|
136896
|
+
context: 'standalone'
|
|
136897
|
+
});
|
|
136898
|
+
// Tuesday
|
|
136899
|
+
|
|
136900
|
+
case 'cccc':
|
|
136901
|
+
default:
|
|
136902
|
+
return localize.day(dayOfWeek, {
|
|
136903
|
+
width: 'wide',
|
|
136904
|
+
context: 'standalone'
|
|
136905
|
+
});
|
|
136906
|
+
}
|
|
136907
|
+
},
|
|
136908
|
+
// ISO day of week
|
|
136909
|
+
i: function (date, token, localize) {
|
|
136910
|
+
var dayOfWeek = date.getUTCDay();
|
|
136911
|
+
var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
136912
|
+
|
|
136913
|
+
switch (token) {
|
|
136914
|
+
// 2
|
|
136915
|
+
case 'i':
|
|
136916
|
+
return String(isoDayOfWeek);
|
|
136917
|
+
// 02
|
|
136918
|
+
|
|
136919
|
+
case 'ii':
|
|
136920
|
+
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
136921
|
+
// 2nd
|
|
136922
|
+
|
|
136923
|
+
case 'io':
|
|
136924
|
+
return localize.ordinalNumber(isoDayOfWeek, {
|
|
136925
|
+
unit: 'day'
|
|
136926
|
+
});
|
|
136927
|
+
// Tue
|
|
136928
|
+
|
|
136929
|
+
case 'iii':
|
|
136930
|
+
return localize.day(dayOfWeek, {
|
|
136931
|
+
width: 'abbreviated',
|
|
136932
|
+
context: 'formatting'
|
|
136933
|
+
});
|
|
136934
|
+
// T
|
|
136935
|
+
|
|
136936
|
+
case 'iiiii':
|
|
136937
|
+
return localize.day(dayOfWeek, {
|
|
136938
|
+
width: 'narrow',
|
|
136939
|
+
context: 'formatting'
|
|
136940
|
+
});
|
|
136941
|
+
// Tu
|
|
136942
|
+
|
|
136943
|
+
case 'iiiiii':
|
|
136944
|
+
return localize.day(dayOfWeek, {
|
|
136945
|
+
width: 'short',
|
|
136946
|
+
context: 'formatting'
|
|
136947
|
+
});
|
|
136948
|
+
// Tuesday
|
|
136949
|
+
|
|
136950
|
+
case 'iiii':
|
|
136951
|
+
default:
|
|
136952
|
+
return localize.day(dayOfWeek, {
|
|
136953
|
+
width: 'wide',
|
|
136954
|
+
context: 'formatting'
|
|
136955
|
+
});
|
|
136956
|
+
}
|
|
136957
|
+
},
|
|
136958
|
+
// AM or PM
|
|
136959
|
+
a: function (date, token, localize) {
|
|
136960
|
+
var hours = date.getUTCHours();
|
|
136961
|
+
var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
|
|
136962
|
+
|
|
136963
|
+
switch (token) {
|
|
136964
|
+
case 'a':
|
|
136965
|
+
case 'aa':
|
|
136966
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
136967
|
+
width: 'abbreviated',
|
|
136968
|
+
context: 'formatting'
|
|
136969
|
+
});
|
|
136970
|
+
|
|
136971
|
+
case 'aaa':
|
|
136972
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
136973
|
+
width: 'abbreviated',
|
|
136974
|
+
context: 'formatting'
|
|
136975
|
+
}).toLowerCase();
|
|
136976
|
+
|
|
136977
|
+
case 'aaaaa':
|
|
136978
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
136979
|
+
width: 'narrow',
|
|
136980
|
+
context: 'formatting'
|
|
136981
|
+
});
|
|
136982
|
+
|
|
136983
|
+
case 'aaaa':
|
|
136984
|
+
default:
|
|
136985
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
136986
|
+
width: 'wide',
|
|
136987
|
+
context: 'formatting'
|
|
136988
|
+
});
|
|
136989
|
+
}
|
|
136990
|
+
},
|
|
136991
|
+
// AM, PM, midnight, noon
|
|
136992
|
+
b: function (date, token, localize) {
|
|
136993
|
+
var hours = date.getUTCHours();
|
|
136994
|
+
var dayPeriodEnumValue;
|
|
136995
|
+
|
|
136996
|
+
if (hours === 12) {
|
|
136997
|
+
dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
136998
|
+
} else if (hours === 0) {
|
|
136999
|
+
dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
137000
|
+
} else {
|
|
137001
|
+
dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
|
|
137002
|
+
}
|
|
137003
|
+
|
|
137004
|
+
switch (token) {
|
|
137005
|
+
case 'b':
|
|
137006
|
+
case 'bb':
|
|
137007
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137008
|
+
width: 'abbreviated',
|
|
137009
|
+
context: 'formatting'
|
|
137010
|
+
});
|
|
137011
|
+
|
|
137012
|
+
case 'bbb':
|
|
137013
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137014
|
+
width: 'abbreviated',
|
|
137015
|
+
context: 'formatting'
|
|
137016
|
+
}).toLowerCase();
|
|
137017
|
+
|
|
137018
|
+
case 'bbbbb':
|
|
137019
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137020
|
+
width: 'narrow',
|
|
137021
|
+
context: 'formatting'
|
|
137022
|
+
});
|
|
137023
|
+
|
|
137024
|
+
case 'bbbb':
|
|
137025
|
+
default:
|
|
137026
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137027
|
+
width: 'wide',
|
|
137028
|
+
context: 'formatting'
|
|
137029
|
+
});
|
|
137030
|
+
}
|
|
137031
|
+
},
|
|
137032
|
+
// in the morning, in the afternoon, in the evening, at night
|
|
137033
|
+
B: function (date, token, localize) {
|
|
137034
|
+
var hours = date.getUTCHours();
|
|
137035
|
+
var dayPeriodEnumValue;
|
|
137036
|
+
|
|
137037
|
+
if (hours >= 17) {
|
|
137038
|
+
dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
137039
|
+
} else if (hours >= 12) {
|
|
137040
|
+
dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
137041
|
+
} else if (hours >= 4) {
|
|
137042
|
+
dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
137043
|
+
} else {
|
|
137044
|
+
dayPeriodEnumValue = dayPeriodEnum.night;
|
|
137045
|
+
}
|
|
137046
|
+
|
|
137047
|
+
switch (token) {
|
|
137048
|
+
case 'B':
|
|
137049
|
+
case 'BB':
|
|
137050
|
+
case 'BBB':
|
|
137051
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137052
|
+
width: 'abbreviated',
|
|
137053
|
+
context: 'formatting'
|
|
137054
|
+
});
|
|
137055
|
+
|
|
137056
|
+
case 'BBBBB':
|
|
137057
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137058
|
+
width: 'narrow',
|
|
137059
|
+
context: 'formatting'
|
|
137060
|
+
});
|
|
137061
|
+
|
|
137062
|
+
case 'BBBB':
|
|
137063
|
+
default:
|
|
137064
|
+
return localize.dayPeriod(dayPeriodEnumValue, {
|
|
137065
|
+
width: 'wide',
|
|
137066
|
+
context: 'formatting'
|
|
137067
|
+
});
|
|
137068
|
+
}
|
|
137069
|
+
},
|
|
137070
|
+
// Hour [1-12]
|
|
137071
|
+
h: function (date, token, localize) {
|
|
137072
|
+
if (token === 'ho') {
|
|
137073
|
+
var hours = date.getUTCHours() % 12;
|
|
137074
|
+
if (hours === 0) hours = 12;
|
|
137075
|
+
return localize.ordinalNumber(hours, {
|
|
137076
|
+
unit: 'hour'
|
|
137077
|
+
});
|
|
137078
|
+
}
|
|
137079
|
+
|
|
137080
|
+
return formatters$3.h(date, token);
|
|
137081
|
+
},
|
|
137082
|
+
// Hour [0-23]
|
|
137083
|
+
H: function (date, token, localize) {
|
|
137084
|
+
if (token === 'Ho') {
|
|
137085
|
+
return localize.ordinalNumber(date.getUTCHours(), {
|
|
137086
|
+
unit: 'hour'
|
|
137087
|
+
});
|
|
137088
|
+
}
|
|
137089
|
+
|
|
137090
|
+
return formatters$3.H(date, token);
|
|
137091
|
+
},
|
|
137092
|
+
// Hour [0-11]
|
|
137093
|
+
K: function (date, token, localize) {
|
|
137094
|
+
var hours = date.getUTCHours() % 12;
|
|
137095
|
+
|
|
137096
|
+
if (token === 'Ko') {
|
|
137097
|
+
return localize.ordinalNumber(hours, {
|
|
137098
|
+
unit: 'hour'
|
|
137099
|
+
});
|
|
137100
|
+
}
|
|
137101
|
+
|
|
137102
|
+
return addLeadingZeros(hours, token.length);
|
|
137103
|
+
},
|
|
137104
|
+
// Hour [1-24]
|
|
137105
|
+
k: function (date, token, localize) {
|
|
137106
|
+
var hours = date.getUTCHours();
|
|
137107
|
+
if (hours === 0) hours = 24;
|
|
137108
|
+
|
|
137109
|
+
if (token === 'ko') {
|
|
137110
|
+
return localize.ordinalNumber(hours, {
|
|
137111
|
+
unit: 'hour'
|
|
137112
|
+
});
|
|
137113
|
+
}
|
|
137114
|
+
|
|
137115
|
+
return addLeadingZeros(hours, token.length);
|
|
137116
|
+
},
|
|
137117
|
+
// Minute
|
|
137118
|
+
m: function (date, token, localize) {
|
|
137119
|
+
if (token === 'mo') {
|
|
137120
|
+
return localize.ordinalNumber(date.getUTCMinutes(), {
|
|
137121
|
+
unit: 'minute'
|
|
137122
|
+
});
|
|
137123
|
+
}
|
|
137124
|
+
|
|
137125
|
+
return formatters$3.m(date, token);
|
|
137126
|
+
},
|
|
137127
|
+
// Second
|
|
137128
|
+
s: function (date, token, localize) {
|
|
137129
|
+
if (token === 'so') {
|
|
137130
|
+
return localize.ordinalNumber(date.getUTCSeconds(), {
|
|
137131
|
+
unit: 'second'
|
|
137132
|
+
});
|
|
137133
|
+
}
|
|
137134
|
+
|
|
137135
|
+
return formatters$3.s(date, token);
|
|
137136
|
+
},
|
|
137137
|
+
// Fraction of second
|
|
137138
|
+
S: function (date, token) {
|
|
137139
|
+
return formatters$3.S(date, token);
|
|
137140
|
+
},
|
|
137141
|
+
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
137142
|
+
X: function (date, token, _localize, options) {
|
|
137143
|
+
var originalDate = options._originalDate || date;
|
|
137144
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
137145
|
+
|
|
137146
|
+
if (timezoneOffset === 0) {
|
|
137147
|
+
return 'Z';
|
|
137148
|
+
}
|
|
137149
|
+
|
|
137150
|
+
switch (token) {
|
|
137151
|
+
// Hours and optional minutes
|
|
137152
|
+
case 'X':
|
|
137153
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
137154
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
137155
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
137156
|
+
// so this token always has the same output as `XX`
|
|
137157
|
+
|
|
137158
|
+
case 'XXXX':
|
|
137159
|
+
case 'XX':
|
|
137160
|
+
// Hours and minutes without `:` delimiter
|
|
137161
|
+
return formatTimezone(timezoneOffset);
|
|
137162
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
137163
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
137164
|
+
// so this token always has the same output as `XXX`
|
|
137165
|
+
|
|
137166
|
+
case 'XXXXX':
|
|
137167
|
+
case 'XXX': // Hours and minutes with `:` delimiter
|
|
137168
|
+
|
|
137169
|
+
default:
|
|
137170
|
+
return formatTimezone(timezoneOffset, ':');
|
|
137171
|
+
}
|
|
137172
|
+
},
|
|
137173
|
+
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
137174
|
+
x: function (date, token, _localize, options) {
|
|
137175
|
+
var originalDate = options._originalDate || date;
|
|
137176
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
137177
|
+
|
|
137178
|
+
switch (token) {
|
|
137179
|
+
// Hours and optional minutes
|
|
137180
|
+
case 'x':
|
|
137181
|
+
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
137182
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
137183
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
137184
|
+
// so this token always has the same output as `xx`
|
|
137185
|
+
|
|
137186
|
+
case 'xxxx':
|
|
137187
|
+
case 'xx':
|
|
137188
|
+
// Hours and minutes without `:` delimiter
|
|
137189
|
+
return formatTimezone(timezoneOffset);
|
|
137190
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
137191
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
137192
|
+
// so this token always has the same output as `xxx`
|
|
137193
|
+
|
|
137194
|
+
case 'xxxxx':
|
|
137195
|
+
case 'xxx': // Hours and minutes with `:` delimiter
|
|
137196
|
+
|
|
137197
|
+
default:
|
|
137198
|
+
return formatTimezone(timezoneOffset, ':');
|
|
137199
|
+
}
|
|
137200
|
+
},
|
|
137201
|
+
// Timezone (GMT)
|
|
137202
|
+
O: function (date, token, _localize, options) {
|
|
137203
|
+
var originalDate = options._originalDate || date;
|
|
137204
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
137205
|
+
|
|
137206
|
+
switch (token) {
|
|
137207
|
+
// Short
|
|
137208
|
+
case 'O':
|
|
137209
|
+
case 'OO':
|
|
137210
|
+
case 'OOO':
|
|
137211
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
137212
|
+
// Long
|
|
137213
|
+
|
|
137214
|
+
case 'OOOO':
|
|
137215
|
+
default:
|
|
137216
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
137217
|
+
}
|
|
137218
|
+
},
|
|
137219
|
+
// Timezone (specific non-location)
|
|
137220
|
+
z: function (date, token, _localize, options) {
|
|
137221
|
+
var originalDate = options._originalDate || date;
|
|
137222
|
+
var timezoneOffset = originalDate.getTimezoneOffset();
|
|
137223
|
+
|
|
137224
|
+
switch (token) {
|
|
137225
|
+
// Short
|
|
137226
|
+
case 'z':
|
|
137227
|
+
case 'zz':
|
|
137228
|
+
case 'zzz':
|
|
137229
|
+
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
|
|
137230
|
+
// Long
|
|
137231
|
+
|
|
137232
|
+
case 'zzzz':
|
|
137233
|
+
default:
|
|
137234
|
+
return 'GMT' + formatTimezone(timezoneOffset, ':');
|
|
137235
|
+
}
|
|
137236
|
+
},
|
|
137237
|
+
// Seconds timestamp
|
|
137238
|
+
t: function (date, token, _localize, options) {
|
|
137239
|
+
var originalDate = options._originalDate || date;
|
|
137240
|
+
var timestamp = Math.floor(originalDate.getTime() / 1000);
|
|
137241
|
+
return addLeadingZeros(timestamp, token.length);
|
|
137242
|
+
},
|
|
137243
|
+
// Milliseconds timestamp
|
|
137244
|
+
T: function (date, token, _localize, options) {
|
|
137245
|
+
var originalDate = options._originalDate || date;
|
|
137246
|
+
var timestamp = originalDate.getTime();
|
|
137247
|
+
return addLeadingZeros(timestamp, token.length);
|
|
137248
|
+
}
|
|
137249
|
+
};
|
|
137250
|
+
|
|
137251
|
+
function formatTimezoneShort(offset, dirtyDelimiter) {
|
|
137252
|
+
var sign = offset > 0 ? '-' : '+';
|
|
137253
|
+
var absOffset = Math.abs(offset);
|
|
137254
|
+
var hours = Math.floor(absOffset / 60);
|
|
137255
|
+
var minutes = absOffset % 60;
|
|
137256
|
+
|
|
137257
|
+
if (minutes === 0) {
|
|
137258
|
+
return sign + String(hours);
|
|
137259
|
+
}
|
|
137260
|
+
|
|
137261
|
+
var delimiter = dirtyDelimiter || '';
|
|
137262
|
+
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
137263
|
+
}
|
|
137264
|
+
|
|
137265
|
+
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
|
|
137266
|
+
if (offset % 60 === 0) {
|
|
137267
|
+
var sign = offset > 0 ? '-' : '+';
|
|
137268
|
+
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
137269
|
+
}
|
|
137270
|
+
|
|
137271
|
+
return formatTimezone(offset, dirtyDelimiter);
|
|
137272
|
+
}
|
|
137273
|
+
|
|
137274
|
+
function formatTimezone(offset, dirtyDelimiter) {
|
|
137275
|
+
var delimiter = dirtyDelimiter || '';
|
|
137276
|
+
var sign = offset > 0 ? '-' : '+';
|
|
137277
|
+
var absOffset = Math.abs(offset);
|
|
137278
|
+
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
|
|
137279
|
+
var minutes = addLeadingZeros(absOffset % 60, 2);
|
|
137280
|
+
return sign + hours + delimiter + minutes;
|
|
137281
|
+
}
|
|
137282
|
+
|
|
137283
|
+
var formatters$1 = formatters;
|
|
137284
|
+
|
|
137285
|
+
function dateLongFormatter(pattern, formatLong) {
|
|
137286
|
+
switch (pattern) {
|
|
137287
|
+
case 'P':
|
|
137288
|
+
return formatLong.date({
|
|
137289
|
+
width: 'short'
|
|
137290
|
+
});
|
|
137291
|
+
|
|
137292
|
+
case 'PP':
|
|
137293
|
+
return formatLong.date({
|
|
137294
|
+
width: 'medium'
|
|
137295
|
+
});
|
|
137296
|
+
|
|
137297
|
+
case 'PPP':
|
|
137298
|
+
return formatLong.date({
|
|
137299
|
+
width: 'long'
|
|
137300
|
+
});
|
|
137301
|
+
|
|
137302
|
+
case 'PPPP':
|
|
137303
|
+
default:
|
|
137304
|
+
return formatLong.date({
|
|
137305
|
+
width: 'full'
|
|
137306
|
+
});
|
|
137307
|
+
}
|
|
137308
|
+
}
|
|
137309
|
+
|
|
137310
|
+
function timeLongFormatter(pattern, formatLong) {
|
|
137311
|
+
switch (pattern) {
|
|
137312
|
+
case 'p':
|
|
137313
|
+
return formatLong.time({
|
|
137314
|
+
width: 'short'
|
|
137315
|
+
});
|
|
137316
|
+
|
|
137317
|
+
case 'pp':
|
|
137318
|
+
return formatLong.time({
|
|
137319
|
+
width: 'medium'
|
|
137320
|
+
});
|
|
137321
|
+
|
|
137322
|
+
case 'ppp':
|
|
137323
|
+
return formatLong.time({
|
|
137324
|
+
width: 'long'
|
|
137325
|
+
});
|
|
137326
|
+
|
|
137327
|
+
case 'pppp':
|
|
137328
|
+
default:
|
|
137329
|
+
return formatLong.time({
|
|
137330
|
+
width: 'full'
|
|
137331
|
+
});
|
|
137332
|
+
}
|
|
137333
|
+
}
|
|
137334
|
+
|
|
137335
|
+
function dateTimeLongFormatter(pattern, formatLong) {
|
|
137336
|
+
var matchResult = pattern.match(/(P+)(p+)?/);
|
|
137337
|
+
var datePattern = matchResult[1];
|
|
137338
|
+
var timePattern = matchResult[2];
|
|
137339
|
+
|
|
137340
|
+
if (!timePattern) {
|
|
137341
|
+
return dateLongFormatter(pattern, formatLong);
|
|
137342
|
+
}
|
|
137343
|
+
|
|
137344
|
+
var dateTimeFormat;
|
|
137345
|
+
|
|
137346
|
+
switch (datePattern) {
|
|
137347
|
+
case 'P':
|
|
137348
|
+
dateTimeFormat = formatLong.dateTime({
|
|
137349
|
+
width: 'short'
|
|
137350
|
+
});
|
|
137351
|
+
break;
|
|
137352
|
+
|
|
137353
|
+
case 'PP':
|
|
137354
|
+
dateTimeFormat = formatLong.dateTime({
|
|
137355
|
+
width: 'medium'
|
|
137356
|
+
});
|
|
137357
|
+
break;
|
|
137358
|
+
|
|
137359
|
+
case 'PPP':
|
|
137360
|
+
dateTimeFormat = formatLong.dateTime({
|
|
137361
|
+
width: 'long'
|
|
137362
|
+
});
|
|
137363
|
+
break;
|
|
137364
|
+
|
|
137365
|
+
case 'PPPP':
|
|
137366
|
+
default:
|
|
137367
|
+
dateTimeFormat = formatLong.dateTime({
|
|
137368
|
+
width: 'full'
|
|
137369
|
+
});
|
|
137370
|
+
break;
|
|
137371
|
+
}
|
|
137372
|
+
|
|
137373
|
+
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
|
|
137374
|
+
}
|
|
137375
|
+
|
|
137376
|
+
var longFormatters = {
|
|
137377
|
+
p: timeLongFormatter,
|
|
137378
|
+
P: dateTimeLongFormatter
|
|
137379
|
+
};
|
|
137380
|
+
var longFormatters$1 = longFormatters;
|
|
137381
|
+
|
|
137382
|
+
var protectedDayOfYearTokens = ['D', 'DD'];
|
|
137383
|
+
var protectedWeekYearTokens = ['YY', 'YYYY'];
|
|
137384
|
+
function isProtectedDayOfYearToken(token) {
|
|
137385
|
+
return protectedDayOfYearTokens.indexOf(token) !== -1;
|
|
137386
|
+
}
|
|
137387
|
+
function isProtectedWeekYearToken(token) {
|
|
137388
|
+
return protectedWeekYearTokens.indexOf(token) !== -1;
|
|
137389
|
+
}
|
|
137390
|
+
function throwProtectedError(token, format, input) {
|
|
137391
|
+
if (token === 'YYYY') {
|
|
137392
|
+
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
|
137393
|
+
} else if (token === 'YY') {
|
|
137394
|
+
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
|
|
137395
|
+
} else if (token === 'D') {
|
|
137396
|
+
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"));
|
|
137397
|
+
} else if (token === 'DD') {
|
|
137398
|
+
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"));
|
|
137399
|
+
}
|
|
137400
|
+
}
|
|
137401
|
+
|
|
137402
|
+
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
|
|
137403
|
+
// (one of the certain letters followed by `o`)
|
|
137404
|
+
// - (\w)\1* matches any sequences of the same letter
|
|
137405
|
+
// - '' matches two quote characters in a row
|
|
137406
|
+
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
|
|
137407
|
+
// except a single quote symbol, which ends the sequence.
|
|
137408
|
+
// Two quote characters do not end the sequence.
|
|
137409
|
+
// If there is no matching single quote
|
|
137410
|
+
// then the sequence will continue until the end of the string.
|
|
137411
|
+
// - . matches any single character unmatched by previous parts of the RegExps
|
|
137412
|
+
|
|
137413
|
+
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
|
|
137414
|
+
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
|
|
137415
|
+
|
|
137416
|
+
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
137417
|
+
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
137418
|
+
var doubleQuoteRegExp = /''/g;
|
|
137419
|
+
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
137420
|
+
/**
|
|
137421
|
+
* @name format
|
|
137422
|
+
* @category Common Helpers
|
|
137423
|
+
* @summary Format the date.
|
|
137424
|
+
*
|
|
137425
|
+
* @description
|
|
137426
|
+
* Return the formatted date string in the given format. The result may vary by locale.
|
|
137427
|
+
*
|
|
137428
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
137429
|
+
* > See: https://git.io/fxCyr
|
|
137430
|
+
*
|
|
137431
|
+
* The characters wrapped between two single quotes characters (') are escaped.
|
|
137432
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
137433
|
+
* (see the last example)
|
|
137434
|
+
*
|
|
137435
|
+
* Format of the string is based on Unicode Technical Standard #35:
|
|
137436
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
137437
|
+
* with a few additions (see note 7 below the table).
|
|
137438
|
+
*
|
|
137439
|
+
* Accepted patterns:
|
|
137440
|
+
* | Unit | Pattern | Result examples | Notes |
|
|
137441
|
+
* |---------------------------------|---------|-----------------------------------|-------|
|
|
137442
|
+
* | Era | G..GGG | AD, BC | |
|
|
137443
|
+
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
137444
|
+
* | | GGGGG | A, B | |
|
|
137445
|
+
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
137446
|
+
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
137447
|
+
* | | yy | 44, 01, 00, 17 | 5 |
|
|
137448
|
+
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
137449
|
+
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
137450
|
+
* | | yyyyy | ... | 3,5 |
|
|
137451
|
+
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
137452
|
+
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
137453
|
+
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
137454
|
+
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
137455
|
+
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
137456
|
+
* | | YYYYY | ... | 3,5 |
|
|
137457
|
+
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
137458
|
+
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
137459
|
+
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
137460
|
+
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
137461
|
+
* | | RRRRR | ... | 3,5,7 |
|
|
137462
|
+
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
137463
|
+
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
137464
|
+
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
137465
|
+
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
137466
|
+
* | | uuuuu | ... | 3,5 |
|
|
137467
|
+
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
137468
|
+
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
137469
|
+
* | | QQ | 01, 02, 03, 04 | |
|
|
137470
|
+
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
137471
|
+
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
137472
|
+
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
137473
|
+
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
137474
|
+
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
137475
|
+
* | | qq | 01, 02, 03, 04 | |
|
|
137476
|
+
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
137477
|
+
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
137478
|
+
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
137479
|
+
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
137480
|
+
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
137481
|
+
* | | MM | 01, 02, ..., 12 | |
|
|
137482
|
+
* | | MMM | Jan, Feb, ..., Dec | |
|
|
137483
|
+
* | | MMMM | January, February, ..., December | 2 |
|
|
137484
|
+
* | | MMMMM | J, F, ..., D | |
|
|
137485
|
+
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
137486
|
+
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
137487
|
+
* | | LL | 01, 02, ..., 12 | |
|
|
137488
|
+
* | | LLL | Jan, Feb, ..., Dec | |
|
|
137489
|
+
* | | LLLL | January, February, ..., December | 2 |
|
|
137490
|
+
* | | LLLLL | J, F, ..., D | |
|
|
137491
|
+
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
137492
|
+
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
137493
|
+
* | | ww | 01, 02, ..., 53 | |
|
|
137494
|
+
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
137495
|
+
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
137496
|
+
* | | II | 01, 02, ..., 53 | 7 |
|
|
137497
|
+
* | Day of month | d | 1, 2, ..., 31 | |
|
|
137498
|
+
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
137499
|
+
* | | dd | 01, 02, ..., 31 | |
|
|
137500
|
+
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
137501
|
+
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
137502
|
+
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
137503
|
+
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
137504
|
+
* | | DDDD | ... | 3 |
|
|
137505
|
+
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
137506
|
+
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
137507
|
+
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
137508
|
+
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
137509
|
+
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
137510
|
+
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
137511
|
+
* | | ii | 01, 02, ..., 07 | 7 |
|
|
137512
|
+
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
137513
|
+
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
137514
|
+
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
137515
|
+
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
137516
|
+
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
137517
|
+
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
137518
|
+
* | | ee | 02, 03, ..., 01 | |
|
|
137519
|
+
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
137520
|
+
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
137521
|
+
* | | eeeee | M, T, W, T, F, S, S | |
|
|
137522
|
+
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
137523
|
+
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
137524
|
+
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
137525
|
+
* | | cc | 02, 03, ..., 01 | |
|
|
137526
|
+
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
137527
|
+
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
137528
|
+
* | | ccccc | M, T, W, T, F, S, S | |
|
|
137529
|
+
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
137530
|
+
* | AM, PM | a..aa | AM, PM | |
|
|
137531
|
+
* | | aaa | am, pm | |
|
|
137532
|
+
* | | aaaa | a.m., p.m. | 2 |
|
|
137533
|
+
* | | aaaaa | a, p | |
|
|
137534
|
+
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
137535
|
+
* | | bbb | am, pm, noon, midnight | |
|
|
137536
|
+
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
137537
|
+
* | | bbbbb | a, p, n, mi | |
|
|
137538
|
+
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
137539
|
+
* | | BBBB | at night, in the morning, ... | 2 |
|
|
137540
|
+
* | | BBBBB | at night, in the morning, ... | |
|
|
137541
|
+
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
137542
|
+
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
137543
|
+
* | | hh | 01, 02, ..., 11, 12 | |
|
|
137544
|
+
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
137545
|
+
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
137546
|
+
* | | HH | 00, 01, 02, ..., 23 | |
|
|
137547
|
+
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
137548
|
+
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
137549
|
+
* | | KK | 01, 02, ..., 11, 00 | |
|
|
137550
|
+
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
137551
|
+
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
137552
|
+
* | | kk | 24, 01, 02, ..., 23 | |
|
|
137553
|
+
* | Minute | m | 0, 1, ..., 59 | |
|
|
137554
|
+
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
137555
|
+
* | | mm | 00, 01, ..., 59 | |
|
|
137556
|
+
* | Second | s | 0, 1, ..., 59 | |
|
|
137557
|
+
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
137558
|
+
* | | ss | 00, 01, ..., 59 | |
|
|
137559
|
+
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
137560
|
+
* | | SS | 00, 01, ..., 99 | |
|
|
137561
|
+
* | | SSS | 000, 001, ..., 999 | |
|
|
137562
|
+
* | | SSSS | ... | 3 |
|
|
137563
|
+
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
137564
|
+
* | | XX | -0800, +0530, Z | |
|
|
137565
|
+
* | | XXX | -08:00, +05:30, Z | |
|
|
137566
|
+
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
137567
|
+
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
137568
|
+
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
137569
|
+
* | | xx | -0800, +0530, +0000 | |
|
|
137570
|
+
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
137571
|
+
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
137572
|
+
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
137573
|
+
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
137574
|
+
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
137575
|
+
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
137576
|
+
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
137577
|
+
* | Seconds timestamp | t | 512969520 | 7 |
|
|
137578
|
+
* | | tt | ... | 3,7 |
|
|
137579
|
+
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
137580
|
+
* | | TT | ... | 3,7 |
|
|
137581
|
+
* | Long localized date | P | 04/29/1453 | 7 |
|
|
137582
|
+
* | | PP | Apr 29, 1453 | 7 |
|
|
137583
|
+
* | | PPP | April 29th, 1453 | 7 |
|
|
137584
|
+
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
137585
|
+
* | Long localized time | p | 12:00 AM | 7 |
|
|
137586
|
+
* | | pp | 12:00:00 AM | 7 |
|
|
137587
|
+
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
137588
|
+
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
137589
|
+
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
137590
|
+
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
137591
|
+
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
137592
|
+
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
137593
|
+
* Notes:
|
|
137594
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
137595
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
137596
|
+
* "Formatting" units are declined according to the rules of the language
|
|
137597
|
+
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
137598
|
+
*
|
|
137599
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
137600
|
+
*
|
|
137601
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
137602
|
+
*
|
|
137603
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
137604
|
+
* the single quote characters (see below).
|
|
137605
|
+
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
137606
|
+
* the output will be the same as default pattern for this unit, usually
|
|
137607
|
+
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
137608
|
+
* are marked with "2" in the last column of the table.
|
|
137609
|
+
*
|
|
137610
|
+
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
137611
|
+
*
|
|
137612
|
+
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
137613
|
+
*
|
|
137614
|
+
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
137615
|
+
*
|
|
137616
|
+
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
137617
|
+
*
|
|
137618
|
+
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
137619
|
+
*
|
|
137620
|
+
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
137621
|
+
* The output will be padded with zeros to match the length of the pattern.
|
|
137622
|
+
*
|
|
137623
|
+
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
137624
|
+
*
|
|
137625
|
+
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
137626
|
+
* These tokens represent the shortest form of the quarter.
|
|
137627
|
+
*
|
|
137628
|
+
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
137629
|
+
*
|
|
137630
|
+
* | Year | `y` | `u` |
|
|
137631
|
+
* |------|-----|-----|
|
|
137632
|
+
* | AC 1 | 1 | 1 |
|
|
137633
|
+
* | BC 1 | 1 | 0 |
|
|
137634
|
+
* | BC 2 | 2 | -1 |
|
|
137635
|
+
*
|
|
137636
|
+
* Also `yy` always returns the last two digits of a year,
|
|
137637
|
+
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
137638
|
+
*
|
|
137639
|
+
* | Year | `yy` | `uu` |
|
|
137640
|
+
* |------|------|------|
|
|
137641
|
+
* | 1 | 01 | 01 |
|
|
137642
|
+
* | 14 | 14 | 14 |
|
|
137643
|
+
* | 376 | 76 | 376 |
|
|
137644
|
+
* | 1453 | 53 | 1453 |
|
|
137645
|
+
*
|
|
137646
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
137647
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
137648
|
+
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
|
|
137649
|
+
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
|
|
137650
|
+
*
|
|
137651
|
+
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
137652
|
+
* so right now these tokens fall back to GMT timezones.
|
|
137653
|
+
*
|
|
137654
|
+
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
137655
|
+
* - `i`: ISO day of week
|
|
137656
|
+
* - `I`: ISO week of year
|
|
137657
|
+
* - `R`: ISO week-numbering year
|
|
137658
|
+
* - `t`: seconds timestamp
|
|
137659
|
+
* - `T`: milliseconds timestamp
|
|
137660
|
+
* - `o`: ordinal number modifier
|
|
137661
|
+
* - `P`: long localized date
|
|
137662
|
+
* - `p`: long localized time
|
|
137663
|
+
*
|
|
137664
|
+
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
137665
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
|
|
137666
|
+
*
|
|
137667
|
+
* 9. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
|
|
137668
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
|
|
137669
|
+
*
|
|
137670
|
+
* ### v2.0.0 breaking changes:
|
|
137671
|
+
*
|
|
137672
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
137673
|
+
*
|
|
137674
|
+
* - The second argument is now required for the sake of explicitness.
|
|
137675
|
+
*
|
|
137676
|
+
* ```javascript
|
|
137677
|
+
* // Before v2.0.0
|
|
137678
|
+
* format(new Date(2016, 0, 1))
|
|
137679
|
+
*
|
|
137680
|
+
* // v2.0.0 onward
|
|
137681
|
+
* format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")
|
|
137682
|
+
* ```
|
|
137683
|
+
*
|
|
137684
|
+
* - New format string API for `format` function
|
|
137685
|
+
* which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).
|
|
137686
|
+
* See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.
|
|
137687
|
+
*
|
|
137688
|
+
* - Characters are now escaped using single quote symbols (`'`) instead of square brackets.
|
|
137689
|
+
*
|
|
137690
|
+
* @param {Date|Number} date - the original date
|
|
137691
|
+
* @param {String} format - the string of tokens
|
|
137692
|
+
* @param {Object} [options] - an object with options.
|
|
137693
|
+
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
|
|
137694
|
+
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
|
|
137695
|
+
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
|
|
137696
|
+
* @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
|
|
137697
|
+
* see: https://git.io/fxCyr
|
|
137698
|
+
* @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
|
|
137699
|
+
* see: https://git.io/fxCyr
|
|
137700
|
+
* @returns {String} the formatted date string
|
|
137701
|
+
* @throws {TypeError} 2 arguments required
|
|
137702
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
137703
|
+
* @throws {RangeError} `options.locale` must contain `localize` property
|
|
137704
|
+
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
137705
|
+
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
|
|
137706
|
+
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
|
|
137707
|
+
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
|
|
137708
|
+
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
|
|
137709
|
+
* @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
|
|
137710
|
+
* @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
|
|
137711
|
+
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
|
137712
|
+
*
|
|
137713
|
+
* @example
|
|
137714
|
+
* // Represent 11 February 2014 in middle-endian format:
|
|
137715
|
+
* var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
137716
|
+
* //=> '02/11/2014'
|
|
137717
|
+
*
|
|
137718
|
+
* @example
|
|
137719
|
+
* // Represent 2 July 2014 in Esperanto:
|
|
137720
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
137721
|
+
* var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
137722
|
+
* locale: eoLocale
|
|
137723
|
+
* })
|
|
137724
|
+
* //=> '2-a de julio 2014'
|
|
137725
|
+
*
|
|
137726
|
+
* @example
|
|
137727
|
+
* // Escape string by single quote characters:
|
|
137728
|
+
* var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
137729
|
+
* //=> "3 o'clock"
|
|
137730
|
+
*/
|
|
137731
|
+
|
|
137732
|
+
function format(dirtyDate, dirtyFormatStr, dirtyOptions) {
|
|
137733
|
+
requiredArgs(2, arguments);
|
|
137734
|
+
var formatStr = String(dirtyFormatStr);
|
|
137735
|
+
var options = dirtyOptions || {};
|
|
137736
|
+
var locale = options.locale || defaultLocale;
|
|
137737
|
+
var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
|
|
137738
|
+
var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
|
|
137739
|
+
var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
|
|
137740
|
+
|
|
137741
|
+
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
|
|
137742
|
+
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
|
|
137743
|
+
}
|
|
137744
|
+
|
|
137745
|
+
var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
|
|
137746
|
+
var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
|
|
137747
|
+
var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
|
|
137748
|
+
|
|
137749
|
+
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
|
|
137750
|
+
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
|
|
137751
|
+
}
|
|
137752
|
+
|
|
137753
|
+
if (!locale.localize) {
|
|
137754
|
+
throw new RangeError('locale must contain localize property');
|
|
137755
|
+
}
|
|
137756
|
+
|
|
137757
|
+
if (!locale.formatLong) {
|
|
137758
|
+
throw new RangeError('locale must contain formatLong property');
|
|
137759
|
+
}
|
|
137760
|
+
|
|
137761
|
+
var originalDate = toDate(dirtyDate);
|
|
137762
|
+
|
|
137763
|
+
if (!isValid(originalDate)) {
|
|
137764
|
+
throw new RangeError('Invalid time value');
|
|
137765
|
+
} // Convert the date in system timezone to the same date in UTC+00:00 timezone.
|
|
137766
|
+
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
|
|
137767
|
+
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
|
|
137768
|
+
|
|
137769
|
+
|
|
137770
|
+
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
|
|
137771
|
+
var utcDate = subMilliseconds(originalDate, timezoneOffset);
|
|
137772
|
+
var formatterOptions = {
|
|
137773
|
+
firstWeekContainsDate: firstWeekContainsDate,
|
|
137774
|
+
weekStartsOn: weekStartsOn,
|
|
137775
|
+
locale: locale,
|
|
137776
|
+
_originalDate: originalDate
|
|
137777
|
+
};
|
|
137778
|
+
var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
|
|
137779
|
+
var firstCharacter = substring[0];
|
|
137780
|
+
|
|
137781
|
+
if (firstCharacter === 'p' || firstCharacter === 'P') {
|
|
137782
|
+
var longFormatter = longFormatters$1[firstCharacter];
|
|
137783
|
+
return longFormatter(substring, locale.formatLong, formatterOptions);
|
|
137784
|
+
}
|
|
137785
|
+
|
|
137786
|
+
return substring;
|
|
137787
|
+
}).join('').match(formattingTokensRegExp).map(function (substring) {
|
|
137788
|
+
// Replace two single quote characters with one single quote character
|
|
137789
|
+
if (substring === "''") {
|
|
137790
|
+
return "'";
|
|
137791
|
+
}
|
|
137792
|
+
|
|
137793
|
+
var firstCharacter = substring[0];
|
|
137794
|
+
|
|
137795
|
+
if (firstCharacter === "'") {
|
|
137796
|
+
return cleanEscapedString(substring);
|
|
137797
|
+
}
|
|
137798
|
+
|
|
137799
|
+
var formatter = formatters$1[firstCharacter];
|
|
137800
|
+
|
|
137801
|
+
if (formatter) {
|
|
137802
|
+
if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(substring)) {
|
|
137803
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
|
137804
|
+
}
|
|
137805
|
+
|
|
137806
|
+
if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(substring)) {
|
|
137807
|
+
throwProtectedError(substring, dirtyFormatStr, dirtyDate);
|
|
137808
|
+
}
|
|
137809
|
+
|
|
137810
|
+
return formatter(utcDate, substring, locale.localize, formatterOptions);
|
|
137811
|
+
}
|
|
137812
|
+
|
|
137813
|
+
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
137814
|
+
throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
|
|
137815
|
+
}
|
|
137816
|
+
|
|
137817
|
+
return substring;
|
|
137818
|
+
}).join('');
|
|
137819
|
+
return result;
|
|
137820
|
+
}
|
|
137821
|
+
|
|
137822
|
+
function cleanEscapedString(input) {
|
|
137823
|
+
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
|
137824
|
+
}
|
|
137825
|
+
|
|
135474
137826
|
var PublishingDateFilter = function PublishingDateFilter() {
|
|
135475
137827
|
var publishingDateRef = React$d.useRef();
|
|
135476
137828
|
var formatMessage = useIntl().formatMessage;
|
|
@@ -135486,6 +137838,7 @@
|
|
|
135486
137838
|
var today = new Date();
|
|
135487
137839
|
var startOfToday = startOfDay(today);
|
|
135488
137840
|
var endOfToday = endOfDay(today);
|
|
137841
|
+
var isActive = (filter === null || filter === void 0 ? void 0 : filter.beforeDate) || (filter === null || filter === void 0 ? void 0 : filter.afterDate);
|
|
135489
137842
|
return jsxRuntime.jsxs("div", __assign$g({
|
|
135490
137843
|
ref: publishingDateRef
|
|
135491
137844
|
}, {
|
|
@@ -135493,13 +137846,13 @@
|
|
|
135493
137846
|
iconProps: {
|
|
135494
137847
|
iconName: showDates ? 'ChevronUp' : 'ChevronDown'
|
|
135495
137848
|
},
|
|
135496
|
-
text: formatMessage({
|
|
137849
|
+
text: isActive ? getButtonText() : formatMessage({
|
|
135497
137850
|
id: 'FilterPanel.publishingDate'
|
|
135498
137851
|
}),
|
|
135499
137852
|
onClick: function () {
|
|
135500
137853
|
return setShowDates(!showDates);
|
|
135501
137854
|
},
|
|
135502
|
-
isActive:
|
|
137855
|
+
isActive: isActive
|
|
135503
137856
|
}, void 0), showDates && jsxRuntime.jsx(Callout, __assign$g({
|
|
135504
137857
|
target: publishingDateRef.current,
|
|
135505
137858
|
onDismiss: function () {
|
|
@@ -135533,8 +137886,7 @@
|
|
|
135533
137886
|
noDateResourceKey: "MetadataEditor.noDate",
|
|
135534
137887
|
selectDateResourceKey: "FilterPanel.publishingDatePlaceholder",
|
|
135535
137888
|
onChanged: handleEndDateChange,
|
|
135536
|
-
minDate: filter === null || filter === void 0 ? void 0 : filter.afterDate
|
|
135537
|
-
maxDate: today.toString()
|
|
137889
|
+
minDate: filter === null || filter === void 0 ? void 0 : filter.afterDate
|
|
135538
137890
|
}, void 0), jsxRuntime.jsxs(DateShortcuts, {
|
|
135539
137891
|
children: [jsxRuntime.jsx(FormattedMessage$1, {
|
|
135540
137892
|
id: "FilterPanel.publishingDateShortcuts"
|
|
@@ -135608,6 +137960,25 @@
|
|
|
135608
137960
|
afterDate: null
|
|
135609
137961
|
}));
|
|
135610
137962
|
}
|
|
137963
|
+
|
|
137964
|
+
function getButtonText() {
|
|
137965
|
+
var start = format(new Date(filter.afterDate), 'P');
|
|
137966
|
+
var end = format(new Date(filter.beforeDate), 'P');
|
|
137967
|
+
|
|
137968
|
+
if (!filter.afterDate) {
|
|
137969
|
+
return formatMessage({
|
|
137970
|
+
id: 'FilterPanel.publishingDateBefore'
|
|
137971
|
+
}) + " " + end;
|
|
137972
|
+
}
|
|
137973
|
+
|
|
137974
|
+
if (!filter.beforeDate) {
|
|
137975
|
+
return formatMessage({
|
|
137976
|
+
id: 'FilterPanel.publishingDateAfter'
|
|
137977
|
+
}) + " " + start;
|
|
137978
|
+
}
|
|
137979
|
+
|
|
137980
|
+
return start + " - " + end;
|
|
137981
|
+
}
|
|
135611
137982
|
};
|
|
135612
137983
|
|
|
135613
137984
|
var DateShortcutButton = function DateShortcutButton(_a) {
|
|
@@ -135689,7 +138060,7 @@
|
|
|
135689
138060
|
iconProps: {
|
|
135690
138061
|
iconName: showCallout ? 'ChevronUp' : 'ChevronDown'
|
|
135691
138062
|
},
|
|
135692
|
-
text: buttonText,
|
|
138063
|
+
text: !buttonContent ? buttonText : undefined,
|
|
135693
138064
|
onClick: function () {
|
|
135694
138065
|
return setShowCallout(!showCallout);
|
|
135695
138066
|
},
|
|
@@ -135754,6 +138125,7 @@
|
|
|
135754
138125
|
buttonText: formatMessage({
|
|
135755
138126
|
id: 'FilterPanel.keywordFilter'
|
|
135756
138127
|
}),
|
|
138128
|
+
buttonContent: getButtonContent(),
|
|
135757
138129
|
handleClearFilter: function () {
|
|
135758
138130
|
return onChange(__assign$g(__assign$g({}, filter), {
|
|
135759
138131
|
keywords: null
|
|
@@ -135771,12 +138143,30 @@
|
|
|
135771
138143
|
showSelectionToggle: true
|
|
135772
138144
|
}, void 0)
|
|
135773
138145
|
}), void 0);
|
|
138146
|
+
|
|
138147
|
+
function getButtonContent() {
|
|
138148
|
+
var _a;
|
|
138149
|
+
|
|
138150
|
+
var keywordsLength = (_a = filter === null || filter === void 0 ? void 0 : filter.keywords) === null || _a === void 0 ? void 0 : _a.length;
|
|
138151
|
+
|
|
138152
|
+
if (!keywordsLength) {
|
|
138153
|
+
return undefined;
|
|
138154
|
+
}
|
|
138155
|
+
|
|
138156
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
138157
|
+
children: [jsxRuntime.jsx(KeywordTitle, {
|
|
138158
|
+
keywordName: filter.keywords[0].name
|
|
138159
|
+
}, void 0), "\u00A0", keywordsLength > 1 && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
138160
|
+
children: ["(+", keywordsLength - 1, ")\u00A0"]
|
|
138161
|
+
}, void 0)]
|
|
138162
|
+
}, void 0);
|
|
138163
|
+
}
|
|
135774
138164
|
};
|
|
135775
138165
|
|
|
135776
138166
|
var StyledKeywordPicker = _styled__default["default"](KeywordPicker).withConfig({
|
|
135777
138167
|
displayName: "KeywordsFilter__StyledKeywordPicker",
|
|
135778
138168
|
componentId: "sc-1aoeg5i-0"
|
|
135779
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject$l(["\n margin-bottom: 20px;\n"], ["\n margin-bottom: 20px;\n"])));
|
|
138169
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject$l(["\n margin-bottom: 20px;\n\n .keyword-picker-tree div:last-child {\n margin-bottom: 0;\n }\n"], ["\n margin-bottom: 20px;\n\n .keyword-picker-tree div:last-child {\n margin-bottom: 0;\n }\n"])));
|
|
135780
138170
|
|
|
135781
138171
|
var templateObject_1;
|
|
135782
138172
|
|
|
@@ -152562,6 +154952,8 @@
|
|
|
152562
154952
|
"FilterPanel.publishingDate": "Publishing date",
|
|
152563
154953
|
"FilterPanel.publishingDateFrom": "From",
|
|
152564
154954
|
"FilterPanel.publishingDateTo": "To",
|
|
154955
|
+
"FilterPanel.publishingDateBefore": "Before",
|
|
154956
|
+
"FilterPanel.publishingDateAfter": "After",
|
|
152565
154957
|
"FilterPanel.publishingDatePlaceholder": "Date",
|
|
152566
154958
|
"FilterPanel.publishingDateShortcuts": "Date range shortcuts",
|
|
152567
154959
|
"FilterPanel.publishingDateShortcuts.yesterday": "Yesterday",
|