/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a3, b3) => { for (var prop in b3 || (b3 = {})) if (__hasOwnProp.call(b3, prop)) __defNormalProp(a3, prop, b3[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b3)) { if (__propIsEnum.call(b3, prop)) __defNormalProp(a3, prop, b3[prop]); } return a3; }; var __spreadProps = (a3, b3) => __defProps(a3, __getOwnPropDescs(b3)); var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { __markAsModule(target); for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __reExport = (target, module2, desc) => { if (module2 && typeof module2 === "object" || typeof module2 === "function") { for (let key of __getOwnPropNames(module2)) if (!__hasOwnProp.call(target, key) && key !== "default") __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); } return target; }; var __toModule = (module2) => { return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); }; var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e3) { reject(e3); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e3) { reject(e3); } }; var step = (x3) => x3.done ? resolve(x3.value) : Promise.resolve(x3.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; // node_modules/tslib/tslib.js var require_tslib = __commonJS({ "node_modules/tslib/tslib.js"(exports, module2) { var __extends2; var __assign2; var __rest2; var __decorate2; var __param2; var __metadata2; var __awaiter2; var __generator2; var __exportStar2; var __values2; var __read2; var __spread2; var __spreadArrays2; var __spreadArray2; var __await2; var __asyncGenerator2; var __asyncDelegator2; var __asyncValues2; var __makeTemplateObject2; var __importStar2; var __importDefault2; var __classPrivateFieldGet2; var __classPrivateFieldSet2; var __createBinding2; (function(factory) { var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; if (typeof define === "function" && define.amd) { define("tslib", ["exports"], function(exports2) { factory(createExporter(root, createExporter(exports2))); }); } else if (typeof module2 === "object" && typeof module2.exports === "object") { factory(createExporter(root, createExporter(module2.exports))); } else { factory(createExporter(root)); } function createExporter(exports2, previous) { if (exports2 !== root) { if (typeof Object.create === "function") { Object.defineProperty(exports2, "__esModule", { value: true }); } else { exports2.__esModule = true; } } return function(id, v3) { return exports2[id] = previous ? previous(id, v3) : v3; }; } })(function(exporter) { var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { d3.__proto__ = b3; } || function(d3, b3) { for (var p3 in b3) if (Object.prototype.hasOwnProperty.call(b3, p3)) d3[p3] = b3[p3]; }; __extends2 = function(d3, b3) { if (typeof b3 !== "function" && b3 !== null) throw new TypeError("Class extends value " + String(b3) + " is not a constructor or null"); extendStatics(d3, b3); function __() { this.constructor = d3; } d3.prototype = b3 === null ? Object.create(b3) : (__.prototype = b3.prototype, new __()); }; __assign2 = Object.assign || function(t3) { for (var s3, i3 = 1, n2 = arguments.length; i3 < n2; i3++) { s3 = arguments[i3]; for (var p3 in s3) if (Object.prototype.hasOwnProperty.call(s3, p3)) t3[p3] = s3[p3]; } return t3; }; __rest2 = function(s3, e3) { var t3 = {}; for (var p3 in s3) if (Object.prototype.hasOwnProperty.call(s3, p3) && e3.indexOf(p3) < 0) t3[p3] = s3[p3]; if (s3 != null && typeof Object.getOwnPropertySymbols === "function") for (var i3 = 0, p3 = Object.getOwnPropertySymbols(s3); i3 < p3.length; i3++) { if (e3.indexOf(p3[i3]) < 0 && Object.prototype.propertyIsEnumerable.call(s3, p3[i3])) t3[p3[i3]] = s3[p3[i3]]; } return t3; }; __decorate2 = function(decorators, target, key, desc) { var c3 = arguments.length, r3 = c3 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d3; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc); else for (var i3 = decorators.length - 1; i3 >= 0; i3--) if (d3 = decorators[i3]) r3 = (c3 < 3 ? d3(r3) : c3 > 3 ? d3(target, key, r3) : d3(target, key)) || r3; return c3 > 3 && r3 && Object.defineProperty(target, key, r3), r3; }; __param2 = function(paramIndex, decorator) { return function(target, key) { decorator(target, key, paramIndex); }; }; __metadata2 = function(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); }; __awaiter2 = function(thisArg, _arguments, P3, generator) { function adopt(value) { return value instanceof P3 ? value : new P3(function(resolve) { resolve(value); }); } return new (P3 || (P3 = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e3) { reject(e3); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e3) { reject(e3); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; __generator2 = function(thisArg, body) { var _3 = { label: 0, sent: function() { if (t3[0] & 1) throw t3[1]; return t3[1]; }, trys: [], ops: [] }, f3, y3, t3, g3; return g3 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() { return this; }), g3; function verb(n2) { return function(v3) { return step([n2, v3]); }; } function step(op) { if (f3) throw new TypeError("Generator is already executing."); while (_3) try { if (f3 = 1, y3 && (t3 = op[0] & 2 ? y3["return"] : op[0] ? y3["throw"] || ((t3 = y3["return"]) && t3.call(y3), 0) : y3.next) && !(t3 = t3.call(y3, op[1])).done) return t3; if (y3 = 0, t3) op = [op[0] & 2, t3.value]; switch (op[0]) { case 0: case 1: t3 = op; break; case 4: _3.label++; return { value: op[1], done: false }; case 5: _3.label++; y3 = op[1]; op = [0]; continue; case 7: op = _3.ops.pop(); _3.trys.pop(); continue; default: if (!(t3 = _3.trys, t3 = t3.length > 0 && t3[t3.length - 1]) && (op[0] === 6 || op[0] === 2)) { _3 = 0; continue; } if (op[0] === 3 && (!t3 || op[1] > t3[0] && op[1] < t3[3])) { _3.label = op[1]; break; } if (op[0] === 6 && _3.label < t3[1]) { _3.label = t3[1]; t3 = op; break; } if (t3 && _3.label < t3[2]) { _3.label = t3[2]; _3.ops.push(op); break; } if (t3[2]) _3.ops.pop(); _3.trys.pop(); continue; } op = body.call(thisArg, _3); } catch (e3) { op = [6, e3]; y3 = 0; } finally { f3 = t3 = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; __exportStar2 = function(m2, o2) { for (var p3 in m2) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(o2, p3)) __createBinding2(o2, m2, p3); }; __createBinding2 = Object.create ? function(o2, m2, k2, k22) { if (k22 === void 0) k22 = k2; Object.defineProperty(o2, k22, { enumerable: true, get: function() { return m2[k2]; } }); } : function(o2, m2, k2, k22) { if (k22 === void 0) k22 = k2; o2[k22] = m2[k2]; }; __values2 = function(o2) { var s3 = typeof Symbol === "function" && Symbol.iterator, m2 = s3 && o2[s3], i3 = 0; if (m2) return m2.call(o2); if (o2 && typeof o2.length === "number") return { next: function() { if (o2 && i3 >= o2.length) o2 = void 0; return { value: o2 && o2[i3++], done: !o2 }; } }; throw new TypeError(s3 ? "Object is not iterable." : "Symbol.iterator is not defined."); }; __read2 = function(o2, n2) { var m2 = typeof Symbol === "function" && o2[Symbol.iterator]; if (!m2) return o2; var i3 = m2.call(o2), r3, ar = [], e3; try { while ((n2 === void 0 || n2-- > 0) && !(r3 = i3.next()).done) ar.push(r3.value); } catch (error) { e3 = { error }; } finally { try { if (r3 && !r3.done && (m2 = i3["return"])) m2.call(i3); } finally { if (e3) throw e3.error; } } return ar; }; __spread2 = function() { for (var ar = [], i3 = 0; i3 < arguments.length; i3++) ar = ar.concat(__read2(arguments[i3])); return ar; }; __spreadArrays2 = function() { for (var s3 = 0, i3 = 0, il = arguments.length; i3 < il; i3++) s3 += arguments[i3].length; for (var r3 = Array(s3), k2 = 0, i3 = 0; i3 < il; i3++) for (var a3 = arguments[i3], j4 = 0, jl = a3.length; j4 < jl; j4++, k2++) r3[k2] = a3[j4]; return r3; }; __spreadArray2 = function(to, from, pack) { if (pack || arguments.length === 2) for (var i3 = 0, l3 = from.length, ar; i3 < l3; i3++) { if (ar || !(i3 in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i3); ar[i3] = from[i3]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; __await2 = function(v3) { return this instanceof __await2 ? (this.v = v3, this) : new __await2(v3); }; __asyncGenerator2 = function(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g3 = generator.apply(thisArg, _arguments || []), i3, q3 = []; return i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { return this; }, i3; function verb(n2) { if (g3[n2]) i3[n2] = function(v3) { return new Promise(function(a3, b3) { q3.push([n2, v3, a3, b3]) > 1 || resume(n2, v3); }); }; } function resume(n2, v3) { try { step(g3[n2](v3)); } catch (e3) { settle(q3[0][3], e3); } } function step(r3) { r3.value instanceof __await2 ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle(q3[0][2], r3); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f3, v3) { if (f3(v3), q3.shift(), q3.length) resume(q3[0][0], q3[0][1]); } }; __asyncDelegator2 = function(o2) { var i3, p3; return i3 = {}, verb("next"), verb("throw", function(e3) { throw e3; }), verb("return"), i3[Symbol.iterator] = function() { return this; }, i3; function verb(n2, f3) { i3[n2] = o2[n2] ? function(v3) { return (p3 = !p3) ? { value: __await2(o2[n2](v3)), done: n2 === "return" } : f3 ? f3(v3) : v3; } : f3; } }; __asyncValues2 = function(o2) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m2 = o2[Symbol.asyncIterator], i3; return m2 ? m2.call(o2) : (o2 = typeof __values2 === "function" ? __values2(o2) : o2[Symbol.iterator](), i3 = {}, verb("next"), verb("throw"), verb("return"), i3[Symbol.asyncIterator] = function() { return this; }, i3); function verb(n2) { i3[n2] = o2[n2] && function(v3) { return new Promise(function(resolve, reject) { v3 = o2[n2](v3), settle(resolve, reject, v3.done, v3.value); }); }; } function settle(resolve, reject, d3, v3) { Promise.resolve(v3).then(function(v4) { resolve({ value: v4, done: d3 }); }, reject); } }; __makeTemplateObject2 = function(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? function(o2, v3) { Object.defineProperty(o2, "default", { enumerable: true, value: v3 }); } : function(o2, v3) { o2["default"] = v3; }; __importStar2 = function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { for (var k2 in mod) if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2)) __createBinding2(result, mod, k2); } __setModuleDefault(result, mod); return result; }; __importDefault2 = function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; __classPrivateFieldGet2 = function(receiver, state, kind, f3) { if (kind === "a" && !f3) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f3 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f3 : kind === "a" ? f3.call(receiver) : f3 ? f3.value : state.get(receiver); }; __classPrivateFieldSet2 = function(receiver, state, value, kind, f3) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f3) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f3 : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind === "a" ? f3.call(receiver, value) : f3 ? f3.value = value : state.set(receiver, value), value; }; exporter("__extends", __extends2); exporter("__assign", __assign2); exporter("__rest", __rest2); exporter("__decorate", __decorate2); exporter("__param", __param2); exporter("__metadata", __metadata2); exporter("__awaiter", __awaiter2); exporter("__generator", __generator2); exporter("__exportStar", __exportStar2); exporter("__createBinding", __createBinding2); exporter("__values", __values2); exporter("__read", __read2); exporter("__spread", __spread2); exporter("__spreadArrays", __spreadArrays2); exporter("__spreadArray", __spreadArray2); exporter("__await", __await2); exporter("__asyncGenerator", __asyncGenerator2); exporter("__asyncDelegator", __asyncDelegator2); exporter("__asyncValues", __asyncValues2); exporter("__makeTemplateObject", __makeTemplateObject2); exporter("__importStar", __importStar2); exporter("__importDefault", __importDefault2); exporter("__classPrivateFieldGet", __classPrivateFieldGet2); exporter("__classPrivateFieldSet", __classPrivateFieldSet2); }); } }); // node_modules/ical.js/build/ical.js var require_ical = __commonJS({ "node_modules/ical.js/build/ical.js"(exports, module2) { var ICAL3; (function() { if (typeof module2 === "object") { ICAL3 = module2.exports; } else if (typeof HTMLScriptElement !== "undefined" && "noModule" in HTMLScriptElement.prototype) { window.ICAL = ICAL3 = {}; } else if (typeof ICAL3 !== "object") { ICAL3 = {}; } })(); ICAL3.foldLength = 75; ICAL3.newLineChar = "\r\n"; ICAL3.helpers = { updateTimezones: function(vcal) { var allsubs, properties, vtimezones, reqTzid, i3, tzid; if (!vcal || vcal.name !== "vcalendar") { return vcal; } allsubs = vcal.getAllSubcomponents(); properties = []; vtimezones = {}; for (i3 = 0; i3 < allsubs.length; i3++) { if (allsubs[i3].name === "vtimezone") { tzid = allsubs[i3].getFirstProperty("tzid").getFirstValue(); vtimezones[tzid] = allsubs[i3]; } else { properties = properties.concat(allsubs[i3].getAllProperties()); } } reqTzid = {}; for (i3 = 0; i3 < properties.length; i3++) { if (tzid = properties[i3].getParameter("tzid")) { reqTzid[tzid] = true; } } for (i3 in vtimezones) { if (vtimezones.hasOwnProperty(i3) && !reqTzid[i3]) { vcal.removeSubcomponent(vtimezones[i3]); } } for (i3 in reqTzid) { if (reqTzid.hasOwnProperty(i3) && !vtimezones[i3] && ICAL3.TimezoneService.has(i3)) { vcal.addSubcomponent(ICAL3.TimezoneService.get(i3).component); } } return vcal; }, isStrictlyNaN: function(number) { return typeof number === "number" && isNaN(number); }, strictParseInt: function(string) { var result = parseInt(string, 10); if (ICAL3.helpers.isStrictlyNaN(result)) { throw new Error('Could not extract integer from "' + string + '"'); } return result; }, formatClassType: function formatClassType(data, type) { if (typeof data === "undefined") { return void 0; } if (data instanceof type) { return data; } return new type(data); }, unescapedIndexOf: function(buffer, search, pos) { while ((pos = buffer.indexOf(search, pos)) !== -1) { if (pos > 0 && buffer[pos - 1] === "\\") { pos += 1; } else { return pos; } } return -1; }, binsearchInsert: function(list, seekVal, cmpfunc) { if (!list.length) return 0; var low = 0, high = list.length - 1, mid, cmpval; while (low <= high) { mid = low + Math.floor((high - low) / 2); cmpval = cmpfunc(seekVal, list[mid]); if (cmpval < 0) high = mid - 1; else if (cmpval > 0) low = mid + 1; else break; } if (cmpval < 0) return mid; else if (cmpval > 0) return mid + 1; else return mid; }, dumpn: function() { if (!ICAL3.debug) { return; } if (typeof console !== "undefined" && "log" in console) { ICAL3.helpers.dumpn = function consoleDumpn(input) { console.log(input); }; } else { ICAL3.helpers.dumpn = function geckoDumpn(input) { dump(input + "\n"); }; } ICAL3.helpers.dumpn(arguments[0]); }, clone: function(aSrc, aDeep) { if (!aSrc || typeof aSrc != "object") { return aSrc; } else if (aSrc instanceof Date) { return new Date(aSrc.getTime()); } else if ("clone" in aSrc) { return aSrc.clone(); } else if (Array.isArray(aSrc)) { var arr = []; for (var i3 = 0; i3 < aSrc.length; i3++) { arr.push(aDeep ? ICAL3.helpers.clone(aSrc[i3], true) : aSrc[i3]); } return arr; } else { var obj = {}; for (var name in aSrc) { if (Object.prototype.hasOwnProperty.call(aSrc, name)) { if (aDeep) { obj[name] = ICAL3.helpers.clone(aSrc[name], true); } else { obj[name] = aSrc[name]; } } } return obj; } }, foldline: function foldline(aLine) { var result = ""; var line = aLine || "", pos = 0, line_length = 0; while (line.length) { var cp = line.codePointAt(pos); if (cp < 128) ++line_length; else if (cp < 2048) line_length += 2; else if (cp < 65536) line_length += 3; else line_length += 4; if (line_length < ICAL3.foldLength + 1) pos += cp > 65535 ? 2 : 1; else { result += ICAL3.newLineChar + " " + line.substring(0, pos); line = line.substring(pos); pos = line_length = 0; } } return result.substr(ICAL3.newLineChar.length + 1); }, pad2: function pad(data) { if (typeof data !== "string") { if (typeof data === "number") { data = parseInt(data); } data = String(data); } var len = data.length; switch (len) { case 0: return "00"; case 1: return "0" + data; default: return data; } }, trunc: function trunc(number) { return number < 0 ? Math.ceil(number) : Math.floor(number); }, inherits: function(base, child, extra) { function F2() { } F2.prototype = base.prototype; child.prototype = new F2(); if (extra) { ICAL3.helpers.extend(extra, child.prototype); } }, extend: function(source, target) { for (var key in source) { var descr = Object.getOwnPropertyDescriptor(source, key); if (descr && !Object.getOwnPropertyDescriptor(target, key)) { Object.defineProperty(target, key, descr); } } return target; } }; ICAL3.design = function() { "use strict"; var FROM_ICAL_NEWLINE = /\\\\|\\;|\\,|\\[Nn]/g; var TO_ICAL_NEWLINE = /\\|;|,|\n/g; var FROM_VCARD_NEWLINE = /\\\\|\\,|\\[Nn]/g; var TO_VCARD_NEWLINE = /\\|,|\n/g; function createTextType(fromNewline, toNewline) { var result = { matches: /.*/, fromICAL: function(aValue, structuredEscape) { return replaceNewline(aValue, fromNewline, structuredEscape); }, toICAL: function(aValue, structuredEscape) { var regEx = toNewline; if (structuredEscape) regEx = new RegExp(regEx.source + "|" + structuredEscape); return aValue.replace(regEx, function(str) { switch (str) { case "\\": return "\\\\"; case ";": return "\\;"; case ",": return "\\,"; case "\n": return "\\n"; default: return str; } }); } }; return result; } var DEFAULT_TYPE_TEXT = { defaultType: "text" }; var DEFAULT_TYPE_TEXT_MULTI = { defaultType: "text", multiValue: "," }; var DEFAULT_TYPE_TEXT_STRUCTURED = { defaultType: "text", structuredValue: ";" }; var DEFAULT_TYPE_INTEGER = { defaultType: "integer" }; var DEFAULT_TYPE_DATETIME_DATE = { defaultType: "date-time", allowedTypes: ["date-time", "date"] }; var DEFAULT_TYPE_DATETIME = { defaultType: "date-time" }; var DEFAULT_TYPE_URI = { defaultType: "uri" }; var DEFAULT_TYPE_UTCOFFSET = { defaultType: "utc-offset" }; var DEFAULT_TYPE_RECUR = { defaultType: "recur" }; var DEFAULT_TYPE_DATE_ANDOR_TIME = { defaultType: "date-and-or-time", allowedTypes: ["date-time", "date", "text"] }; function replaceNewlineReplace(string) { switch (string) { case "\\\\": return "\\"; case "\\;": return ";"; case "\\,": return ","; case "\\n": case "\\N": return "\n"; default: return string; } } function replaceNewline(value, newline, structuredEscape) { if (value.indexOf("\\") === -1) { return value; } if (structuredEscape) newline = new RegExp(newline.source + "|\\\\" + structuredEscape); return value.replace(newline, replaceNewlineReplace); } var commonProperties = { "categories": DEFAULT_TYPE_TEXT_MULTI, "url": DEFAULT_TYPE_URI, "version": DEFAULT_TYPE_TEXT, "uid": DEFAULT_TYPE_TEXT }; var commonValues = { "boolean": { values: ["TRUE", "FALSE"], fromICAL: function(aValue) { switch (aValue) { case "TRUE": return true; case "FALSE": return false; default: return false; } }, toICAL: function(aValue) { if (aValue) { return "TRUE"; } return "FALSE"; } }, float: { matches: /^[+-]?\d+\.\d+$/, fromICAL: function(aValue) { var parsed = parseFloat(aValue); if (ICAL3.helpers.isStrictlyNaN(parsed)) { return 0; } return parsed; }, toICAL: function(aValue) { return String(aValue); } }, integer: { fromICAL: function(aValue) { var parsed = parseInt(aValue); if (ICAL3.helpers.isStrictlyNaN(parsed)) { return 0; } return parsed; }, toICAL: function(aValue) { return String(aValue); } }, "utc-offset": { toICAL: function(aValue) { if (aValue.length < 7) { return aValue.substr(0, 3) + aValue.substr(4, 2); } else { return aValue.substr(0, 3) + aValue.substr(4, 2) + aValue.substr(7, 2); } }, fromICAL: function(aValue) { if (aValue.length < 6) { return aValue.substr(0, 3) + ":" + aValue.substr(3, 2); } else { return aValue.substr(0, 3) + ":" + aValue.substr(3, 2) + ":" + aValue.substr(5, 2); } }, decorate: function(aValue) { return ICAL3.UtcOffset.fromString(aValue); }, undecorate: function(aValue) { return aValue.toString(); } } }; var icalParams = { "cutype": { values: ["INDIVIDUAL", "GROUP", "RESOURCE", "ROOM", "UNKNOWN"], allowXName: true, allowIanaToken: true }, "delegated-from": { valueType: "cal-address", multiValue: ",", multiValueSeparateDQuote: true }, "delegated-to": { valueType: "cal-address", multiValue: ",", multiValueSeparateDQuote: true }, "encoding": { values: ["8BIT", "BASE64"] }, "fbtype": { values: ["FREE", "BUSY", "BUSY-UNAVAILABLE", "BUSY-TENTATIVE"], allowXName: true, allowIanaToken: true }, "member": { valueType: "cal-address", multiValue: ",", multiValueSeparateDQuote: true }, "partstat": { values: [ "NEEDS-ACTION", "ACCEPTED", "DECLINED", "TENTATIVE", "DELEGATED", "COMPLETED", "IN-PROCESS" ], allowXName: true, allowIanaToken: true }, "range": { values: ["THISANDFUTURE"] }, "related": { values: ["START", "END"] }, "reltype": { values: ["PARENT", "CHILD", "SIBLING"], allowXName: true, allowIanaToken: true }, "role": { values: [ "REQ-PARTICIPANT", "CHAIR", "OPT-PARTICIPANT", "NON-PARTICIPANT" ], allowXName: true, allowIanaToken: true }, "rsvp": { values: ["TRUE", "FALSE"] }, "sent-by": { valueType: "cal-address" }, "tzid": { matches: /^\// }, "value": { values: [ "binary", "boolean", "cal-address", "date", "date-time", "duration", "float", "integer", "period", "recur", "text", "time", "uri", "utc-offset" ], allowXName: true, allowIanaToken: true } }; var icalValues = ICAL3.helpers.extend(commonValues, { text: createTextType(FROM_ICAL_NEWLINE, TO_ICAL_NEWLINE), uri: {}, "binary": { decorate: function(aString) { return ICAL3.Binary.fromString(aString); }, undecorate: function(aBinary) { return aBinary.toString(); } }, "cal-address": {}, "date": { decorate: function(aValue, aProp) { if (design.strict) { return ICAL3.Time.fromDateString(aValue, aProp); } else { return ICAL3.Time.fromString(aValue, aProp); } }, undecorate: function(aValue) { return aValue.toString(); }, fromICAL: function(aValue) { if (!design.strict && aValue.length >= 15) { return icalValues["date-time"].fromICAL(aValue); } else { return aValue.substr(0, 4) + "-" + aValue.substr(4, 2) + "-" + aValue.substr(6, 2); } }, toICAL: function(aValue) { var len = aValue.length; if (len == 10) { return aValue.substr(0, 4) + aValue.substr(5, 2) + aValue.substr(8, 2); } else if (len >= 19) { return icalValues["date-time"].toICAL(aValue); } else { return aValue; } } }, "date-time": { fromICAL: function(aValue) { if (!design.strict && aValue.length == 8) { return icalValues.date.fromICAL(aValue); } else { var result = aValue.substr(0, 4) + "-" + aValue.substr(4, 2) + "-" + aValue.substr(6, 2) + "T" + aValue.substr(9, 2) + ":" + aValue.substr(11, 2) + ":" + aValue.substr(13, 2); if (aValue[15] && aValue[15] === "Z") { result += "Z"; } return result; } }, toICAL: function(aValue) { var len = aValue.length; if (len == 10 && !design.strict) { return icalValues.date.toICAL(aValue); } else if (len >= 19) { var result = aValue.substr(0, 4) + aValue.substr(5, 2) + aValue.substr(8, 5) + aValue.substr(14, 2) + aValue.substr(17, 2); if (aValue[19] && aValue[19] === "Z") { result += "Z"; } return result; } else { return aValue; } }, decorate: function(aValue, aProp) { if (design.strict) { return ICAL3.Time.fromDateTimeString(aValue, aProp); } else { return ICAL3.Time.fromString(aValue, aProp); } }, undecorate: function(aValue) { return aValue.toString(); } }, duration: { decorate: function(aValue) { return ICAL3.Duration.fromString(aValue); }, undecorate: function(aValue) { return aValue.toString(); } }, period: { fromICAL: function(string) { var parts = string.split("/"); parts[0] = icalValues["date-time"].fromICAL(parts[0]); if (!ICAL3.Duration.isValueString(parts[1])) { parts[1] = icalValues["date-time"].fromICAL(parts[1]); } return parts; }, toICAL: function(parts) { if (!design.strict && parts[0].length == 10) { parts[0] = icalValues.date.toICAL(parts[0]); } else { parts[0] = icalValues["date-time"].toICAL(parts[0]); } if (!ICAL3.Duration.isValueString(parts[1])) { if (!design.strict && parts[1].length == 10) { parts[1] = icalValues.date.toICAL(parts[1]); } else { parts[1] = icalValues["date-time"].toICAL(parts[1]); } } return parts.join("/"); }, decorate: function(aValue, aProp) { return ICAL3.Period.fromJSON(aValue, aProp, !design.strict); }, undecorate: function(aValue) { return aValue.toJSON(); } }, recur: { fromICAL: function(string) { return ICAL3.Recur._stringToData(string, true); }, toICAL: function(data) { var str = ""; for (var k2 in data) { if (!Object.prototype.hasOwnProperty.call(data, k2)) { continue; } var val = data[k2]; if (k2 == "until") { if (val.length > 10) { val = icalValues["date-time"].toICAL(val); } else { val = icalValues.date.toICAL(val); } } else if (k2 == "wkst") { if (typeof val === "number") { val = ICAL3.Recur.numericDayToIcalDay(val); } } else if (Array.isArray(val)) { val = val.join(","); } str += k2.toUpperCase() + "=" + val + ";"; } return str.substr(0, str.length - 1); }, decorate: function decorate(aValue) { return ICAL3.Recur.fromData(aValue); }, undecorate: function(aRecur) { return aRecur.toJSON(); } }, time: { fromICAL: function(aValue) { if (aValue.length < 6) { return aValue; } var result = aValue.substr(0, 2) + ":" + aValue.substr(2, 2) + ":" + aValue.substr(4, 2); if (aValue[6] === "Z") { result += "Z"; } return result; }, toICAL: function(aValue) { if (aValue.length < 8) { return aValue; } var result = aValue.substr(0, 2) + aValue.substr(3, 2) + aValue.substr(6, 2); if (aValue[8] === "Z") { result += "Z"; } return result; } } }); var icalProperties = ICAL3.helpers.extend(commonProperties, { "action": DEFAULT_TYPE_TEXT, "attach": { defaultType: "uri" }, "attendee": { defaultType: "cal-address" }, "calscale": DEFAULT_TYPE_TEXT, "class": DEFAULT_TYPE_TEXT, "comment": DEFAULT_TYPE_TEXT, "completed": DEFAULT_TYPE_DATETIME, "contact": DEFAULT_TYPE_TEXT, "created": DEFAULT_TYPE_DATETIME, "description": DEFAULT_TYPE_TEXT, "dtend": DEFAULT_TYPE_DATETIME_DATE, "dtstamp": DEFAULT_TYPE_DATETIME, "dtstart": DEFAULT_TYPE_DATETIME_DATE, "due": DEFAULT_TYPE_DATETIME_DATE, "duration": { defaultType: "duration" }, "exdate": { defaultType: "date-time", allowedTypes: ["date-time", "date"], multiValue: "," }, "exrule": DEFAULT_TYPE_RECUR, "freebusy": { defaultType: "period", multiValue: "," }, "geo": { defaultType: "float", structuredValue: ";" }, "last-modified": DEFAULT_TYPE_DATETIME, "location": DEFAULT_TYPE_TEXT, "method": DEFAULT_TYPE_TEXT, "organizer": { defaultType: "cal-address" }, "percent-complete": DEFAULT_TYPE_INTEGER, "priority": DEFAULT_TYPE_INTEGER, "prodid": DEFAULT_TYPE_TEXT, "related-to": DEFAULT_TYPE_TEXT, "repeat": DEFAULT_TYPE_INTEGER, "rdate": { defaultType: "date-time", allowedTypes: ["date-time", "date", "period"], multiValue: ",", detectType: function(string) { if (string.indexOf("/") !== -1) { return "period"; } return string.indexOf("T") === -1 ? "date" : "date-time"; } }, "recurrence-id": DEFAULT_TYPE_DATETIME_DATE, "resources": DEFAULT_TYPE_TEXT_MULTI, "request-status": DEFAULT_TYPE_TEXT_STRUCTURED, "rrule": DEFAULT_TYPE_RECUR, "sequence": DEFAULT_TYPE_INTEGER, "status": DEFAULT_TYPE_TEXT, "summary": DEFAULT_TYPE_TEXT, "transp": DEFAULT_TYPE_TEXT, "trigger": { defaultType: "duration", allowedTypes: ["duration", "date-time"] }, "tzoffsetfrom": DEFAULT_TYPE_UTCOFFSET, "tzoffsetto": DEFAULT_TYPE_UTCOFFSET, "tzurl": DEFAULT_TYPE_URI, "tzid": DEFAULT_TYPE_TEXT, "tzname": DEFAULT_TYPE_TEXT }); var vcardValues = ICAL3.helpers.extend(commonValues, { text: createTextType(FROM_VCARD_NEWLINE, TO_VCARD_NEWLINE), uri: createTextType(FROM_VCARD_NEWLINE, TO_VCARD_NEWLINE), date: { decorate: function(aValue) { return ICAL3.VCardTime.fromDateAndOrTimeString(aValue, "date"); }, undecorate: function(aValue) { return aValue.toString(); }, fromICAL: function(aValue) { if (aValue.length == 8) { return icalValues.date.fromICAL(aValue); } else if (aValue[0] == "-" && aValue.length == 6) { return aValue.substr(0, 4) + "-" + aValue.substr(4); } else { return aValue; } }, toICAL: function(aValue) { if (aValue.length == 10) { return icalValues.date.toICAL(aValue); } else if (aValue[0] == "-" && aValue.length == 7) { return aValue.substr(0, 4) + aValue.substr(5); } else { return aValue; } } }, time: { decorate: function(aValue) { return ICAL3.VCardTime.fromDateAndOrTimeString("T" + aValue, "time"); }, undecorate: function(aValue) { return aValue.toString(); }, fromICAL: function(aValue) { var splitzone = vcardValues.time._splitZone(aValue, true); var zone = splitzone[0], value = splitzone[1]; if (value.length == 6) { value = value.substr(0, 2) + ":" + value.substr(2, 2) + ":" + value.substr(4, 2); } else if (value.length == 4 && value[0] != "-") { value = value.substr(0, 2) + ":" + value.substr(2, 2); } else if (value.length == 5) { value = value.substr(0, 3) + ":" + value.substr(3, 2); } if (zone.length == 5 && (zone[0] == "-" || zone[0] == "+")) { zone = zone.substr(0, 3) + ":" + zone.substr(3); } return value + zone; }, toICAL: function(aValue) { var splitzone = vcardValues.time._splitZone(aValue); var zone = splitzone[0], value = splitzone[1]; if (value.length == 8) { value = value.substr(0, 2) + value.substr(3, 2) + value.substr(6, 2); } else if (value.length == 5 && value[0] != "-") { value = value.substr(0, 2) + value.substr(3, 2); } else if (value.length == 6) { value = value.substr(0, 3) + value.substr(4, 2); } if (zone.length == 6 && (zone[0] == "-" || zone[0] == "+")) { zone = zone.substr(0, 3) + zone.substr(4); } return value + zone; }, _splitZone: function(aValue, isFromIcal) { var lastChar = aValue.length - 1; var signChar = aValue.length - (isFromIcal ? 5 : 6); var sign = aValue[signChar]; var zone, value; if (aValue[lastChar] == "Z") { zone = aValue[lastChar]; value = aValue.substr(0, lastChar); } else if (aValue.length > 6 && (sign == "-" || sign == "+")) { zone = aValue.substr(signChar); value = aValue.substr(0, signChar); } else { zone = ""; value = aValue; } return [zone, value]; } }, "date-time": { decorate: function(aValue) { return ICAL3.VCardTime.fromDateAndOrTimeString(aValue, "date-time"); }, undecorate: function(aValue) { return aValue.toString(); }, fromICAL: function(aValue) { return vcardValues["date-and-or-time"].fromICAL(aValue); }, toICAL: function(aValue) { return vcardValues["date-and-or-time"].toICAL(aValue); } }, "date-and-or-time": { decorate: function(aValue) { return ICAL3.VCardTime.fromDateAndOrTimeString(aValue, "date-and-or-time"); }, undecorate: function(aValue) { return aValue.toString(); }, fromICAL: function(aValue) { var parts = aValue.split("T"); return (parts[0] ? vcardValues.date.fromICAL(parts[0]) : "") + (parts[1] ? "T" + vcardValues.time.fromICAL(parts[1]) : ""); }, toICAL: function(aValue) { var parts = aValue.split("T"); return vcardValues.date.toICAL(parts[0]) + (parts[1] ? "T" + vcardValues.time.toICAL(parts[1]) : ""); } }, timestamp: icalValues["date-time"], "language-tag": { matches: /^[a-zA-Z0-9-]+$/ } }); var vcardParams = { "type": { valueType: "text", multiValue: "," }, "value": { values: [ "text", "uri", "date", "time", "date-time", "date-and-or-time", "timestamp", "boolean", "integer", "float", "utc-offset", "language-tag" ], allowXName: true, allowIanaToken: true } }; var vcardProperties = ICAL3.helpers.extend(commonProperties, { "adr": { defaultType: "text", structuredValue: ";", multiValue: "," }, "anniversary": DEFAULT_TYPE_DATE_ANDOR_TIME, "bday": DEFAULT_TYPE_DATE_ANDOR_TIME, "caladruri": DEFAULT_TYPE_URI, "caluri": DEFAULT_TYPE_URI, "clientpidmap": DEFAULT_TYPE_TEXT_STRUCTURED, "email": DEFAULT_TYPE_TEXT, "fburl": DEFAULT_TYPE_URI, "fn": DEFAULT_TYPE_TEXT, "gender": DEFAULT_TYPE_TEXT_STRUCTURED, "geo": DEFAULT_TYPE_URI, "impp": DEFAULT_TYPE_URI, "key": DEFAULT_TYPE_URI, "kind": DEFAULT_TYPE_TEXT, "lang": { defaultType: "language-tag" }, "logo": DEFAULT_TYPE_URI, "member": DEFAULT_TYPE_URI, "n": { defaultType: "text", structuredValue: ";", multiValue: "," }, "nickname": DEFAULT_TYPE_TEXT_MULTI, "note": DEFAULT_TYPE_TEXT, "org": { defaultType: "text", structuredValue: ";" }, "photo": DEFAULT_TYPE_URI, "related": DEFAULT_TYPE_URI, "rev": { defaultType: "timestamp" }, "role": DEFAULT_TYPE_TEXT, "sound": DEFAULT_TYPE_URI, "source": DEFAULT_TYPE_URI, "tel": { defaultType: "uri", allowedTypes: ["uri", "text"] }, "title": DEFAULT_TYPE_TEXT, "tz": { defaultType: "text", allowedTypes: ["text", "utc-offset", "uri"] }, "xml": DEFAULT_TYPE_TEXT }); var vcard3Values = ICAL3.helpers.extend(commonValues, { binary: icalValues.binary, date: vcardValues.date, "date-time": vcardValues["date-time"], "phone-number": {}, uri: icalValues.uri, text: icalValues.text, time: icalValues.time, vcard: icalValues.text, "utc-offset": { toICAL: function(aValue) { return aValue.substr(0, 7); }, fromICAL: function(aValue) { return aValue.substr(0, 7); }, decorate: function(aValue) { return ICAL3.UtcOffset.fromString(aValue); }, undecorate: function(aValue) { return aValue.toString(); } } }); var vcard3Params = { "type": { valueType: "text", multiValue: "," }, "value": { values: [ "text", "uri", "date", "date-time", "phone-number", "time", "boolean", "integer", "float", "utc-offset", "vcard", "binary" ], allowXName: true, allowIanaToken: true } }; var vcard3Properties = ICAL3.helpers.extend(commonProperties, { fn: DEFAULT_TYPE_TEXT, n: { defaultType: "text", structuredValue: ";", multiValue: "," }, nickname: DEFAULT_TYPE_TEXT_MULTI, photo: { defaultType: "binary", allowedTypes: ["binary", "uri"] }, bday: { defaultType: "date-time", allowedTypes: ["date-time", "date"], detectType: function(string) { return string.indexOf("T") === -1 ? "date" : "date-time"; } }, adr: { defaultType: "text", structuredValue: ";", multiValue: "," }, label: DEFAULT_TYPE_TEXT, tel: { defaultType: "phone-number" }, email: DEFAULT_TYPE_TEXT, mailer: DEFAULT_TYPE_TEXT, tz: { defaultType: "utc-offset", allowedTypes: ["utc-offset", "text"] }, geo: { defaultType: "float", structuredValue: ";" }, title: DEFAULT_TYPE_TEXT, role: DEFAULT_TYPE_TEXT, logo: { defaultType: "binary", allowedTypes: ["binary", "uri"] }, agent: { defaultType: "vcard", allowedTypes: ["vcard", "text", "uri"] }, org: DEFAULT_TYPE_TEXT_STRUCTURED, note: DEFAULT_TYPE_TEXT_MULTI, prodid: DEFAULT_TYPE_TEXT, rev: { defaultType: "date-time", allowedTypes: ["date-time", "date"], detectType: function(string) { return string.indexOf("T") === -1 ? "date" : "date-time"; } }, "sort-string": DEFAULT_TYPE_TEXT, sound: { defaultType: "binary", allowedTypes: ["binary", "uri"] }, class: DEFAULT_TYPE_TEXT, key: { defaultType: "binary", allowedTypes: ["binary", "text"] } }); var icalSet = { value: icalValues, param: icalParams, property: icalProperties }; var vcardSet = { value: vcardValues, param: vcardParams, property: vcardProperties }; var vcard3Set = { value: vcard3Values, param: vcard3Params, property: vcard3Properties }; var design = { strict: true, defaultSet: icalSet, defaultType: "unknown", components: { vcard: vcardSet, vcard3: vcard3Set, vevent: icalSet, vtodo: icalSet, vjournal: icalSet, valarm: icalSet, vtimezone: icalSet, daylight: icalSet, standard: icalSet }, icalendar: icalSet, vcard: vcardSet, vcard3: vcard3Set, getDesignSet: function(componentName) { var isInDesign = componentName && componentName in design.components; return isInDesign ? design.components[componentName] : design.defaultSet; } }; return design; }(); ICAL3.stringify = function() { "use strict"; var LINE_ENDING = "\r\n"; var DEFAULT_VALUE_TYPE = "unknown"; var design = ICAL3.design; var helpers = ICAL3.helpers; function stringify(jCal) { if (typeof jCal[0] == "string") { jCal = [jCal]; } var i3 = 0; var len = jCal.length; var result = ""; for (; i3 < len; i3++) { result += stringify.component(jCal[i3]) + LINE_ENDING; } return result; } stringify.component = function(component, designSet) { var name = component[0].toUpperCase(); var result = "BEGIN:" + name + LINE_ENDING; var props = component[1]; var propIdx = 0; var propLen = props.length; var designSetName = component[0]; if (designSetName === "vcard" && component[1].length > 0 && !(component[1][0][0] === "version" && component[1][0][3] === "4.0")) { designSetName = "vcard3"; } designSet = designSet || design.getDesignSet(designSetName); for (; propIdx < propLen; propIdx++) { result += stringify.property(props[propIdx], designSet) + LINE_ENDING; } var comps = component[2] || []; var compIdx = 0; var compLen = comps.length; for (; compIdx < compLen; compIdx++) { result += stringify.component(comps[compIdx], designSet) + LINE_ENDING; } result += "END:" + name; return result; }; stringify.property = function(property, designSet, noFold) { var name = property[0].toUpperCase(); var jsName = property[0]; var params = property[1]; var line = name; var paramName; for (paramName in params) { var value = params[paramName]; if (params.hasOwnProperty(paramName)) { var multiValue = paramName in designSet.param && designSet.param[paramName].multiValue; if (multiValue && Array.isArray(value)) { if (designSet.param[paramName].multiValueSeparateDQuote) { multiValue = '"' + multiValue + '"'; } value = value.map(stringify._rfc6868Unescape); value = stringify.multiValue(value, multiValue, "unknown", null, designSet); } else { value = stringify._rfc6868Unescape(value); } line += ";" + paramName.toUpperCase(); line += "=" + stringify.propertyValue(value); } } if (property.length === 3) { return line + ":"; } var valueType = property[2]; if (!designSet) { designSet = design.defaultSet; } var propDetails; var multiValue = false; var structuredValue = false; var isDefault = false; if (jsName in designSet.property) { propDetails = designSet.property[jsName]; if ("multiValue" in propDetails) { multiValue = propDetails.multiValue; } if ("structuredValue" in propDetails && Array.isArray(property[3])) { structuredValue = propDetails.structuredValue; } if ("defaultType" in propDetails) { if (valueType === propDetails.defaultType) { isDefault = true; } } else { if (valueType === DEFAULT_VALUE_TYPE) { isDefault = true; } } } else { if (valueType === DEFAULT_VALUE_TYPE) { isDefault = true; } } if (!isDefault) { line += ";VALUE=" + valueType.toUpperCase(); } line += ":"; if (multiValue && structuredValue) { line += stringify.multiValue(property[3], structuredValue, valueType, multiValue, designSet, structuredValue); } else if (multiValue) { line += stringify.multiValue(property.slice(3), multiValue, valueType, null, designSet, false); } else if (structuredValue) { line += stringify.multiValue(property[3], structuredValue, valueType, null, designSet, structuredValue); } else { line += stringify.value(property[3], valueType, designSet, false); } return noFold ? line : ICAL3.helpers.foldline(line); }; stringify.propertyValue = function(value) { if (helpers.unescapedIndexOf(value, ",") === -1 && helpers.unescapedIndexOf(value, ":") === -1 && helpers.unescapedIndexOf(value, ";") === -1) { return value; } return '"' + value + '"'; }; stringify.multiValue = function(values, delim, type, innerMulti, designSet, structuredValue) { var result = ""; var len = values.length; var i3 = 0; for (; i3 < len; i3++) { if (innerMulti && Array.isArray(values[i3])) { result += stringify.multiValue(values[i3], innerMulti, type, null, designSet, structuredValue); } else { result += stringify.value(values[i3], type, designSet, structuredValue); } if (i3 !== len - 1) { result += delim; } } return result; }; stringify.value = function(value, type, designSet, structuredValue) { if (type in designSet.value && "toICAL" in designSet.value[type]) { return designSet.value[type].toICAL(value, structuredValue); } return value; }; stringify._rfc6868Unescape = function(val) { return val.replace(/[\n^"]/g, function(x3) { return RFC6868_REPLACE_MAP[x3]; }); }; var RFC6868_REPLACE_MAP = { '"': "^'", "\n": "^n", "^": "^^" }; return stringify; }(); ICAL3.parse = function() { "use strict"; var CHAR = /[^ \t]/; var MULTIVALUE_DELIMITER = ","; var VALUE_DELIMITER = ":"; var PARAM_DELIMITER = ";"; var PARAM_NAME_DELIMITER = "="; var DEFAULT_VALUE_TYPE = "unknown"; var DEFAULT_PARAM_TYPE = "text"; var design = ICAL3.design; var helpers = ICAL3.helpers; function ParserError(message) { this.message = message; this.name = "ParserError"; try { throw new Error(); } catch (e3) { if (e3.stack) { var split = e3.stack.split("\n"); split.shift(); this.stack = split.join("\n"); } } } ParserError.prototype = Error.prototype; function parser(input) { var state = {}; var root = state.component = []; state.stack = [root]; parser._eachLine(input, function(err, line) { parser._handleContentLine(line, state); }); if (state.stack.length > 1) { throw new ParserError("invalid ical body. component began but did not end"); } state = null; return root.length == 1 ? root[0] : root; } parser.property = function(str, designSet) { var state = { component: [[], []], designSet: designSet || design.defaultSet }; parser._handleContentLine(str, state); return state.component[1][0]; }; parser.component = function(str) { return parser(str); }; parser.ParserError = ParserError; parser._handleContentLine = function(line, state) { var valuePos = line.indexOf(VALUE_DELIMITER); var paramPos = line.indexOf(PARAM_DELIMITER); var lastParamIndex; var lastValuePos; var name; var value; var params = {}; if (paramPos !== -1 && valuePos !== -1) { if (paramPos > valuePos) { paramPos = -1; } } var parsedParams; if (paramPos !== -1) { name = line.substring(0, paramPos).toLowerCase(); parsedParams = parser._parseParameters(line.substring(paramPos), 0, state.designSet); if (parsedParams[2] == -1) { throw new ParserError("Invalid parameters in '" + line + "'"); } params = parsedParams[0]; lastParamIndex = parsedParams[1].length + parsedParams[2] + paramPos; if ((lastValuePos = line.substring(lastParamIndex).indexOf(VALUE_DELIMITER)) !== -1) { value = line.substring(lastParamIndex + lastValuePos + 1); } else { throw new ParserError("Missing parameter value in '" + line + "'"); } } else if (valuePos !== -1) { name = line.substring(0, valuePos).toLowerCase(); value = line.substring(valuePos + 1); if (name === "begin") { var newComponent = [value.toLowerCase(), [], []]; if (state.stack.length === 1) { state.component.push(newComponent); } else { state.component[2].push(newComponent); } state.stack.push(state.component); state.component = newComponent; if (!state.designSet) { state.designSet = design.getDesignSet(state.component[0]); } return; } else if (name === "end") { state.component = state.stack.pop(); return; } } else { throw new ParserError('invalid line (no token ";" or ":") "' + line + '"'); } var valueType; var multiValue = false; var structuredValue = false; var propertyDetails; if (name in state.designSet.property) { propertyDetails = state.designSet.property[name]; if ("multiValue" in propertyDetails) { multiValue = propertyDetails.multiValue; } if ("structuredValue" in propertyDetails) { structuredValue = propertyDetails.structuredValue; } if (value && "detectType" in propertyDetails) { valueType = propertyDetails.detectType(value); } } if (!valueType) { if (!("value" in params)) { if (propertyDetails) { valueType = propertyDetails.defaultType; } else { valueType = DEFAULT_VALUE_TYPE; } } else { valueType = params.value.toLowerCase(); } } delete params.value; var result; if (multiValue && structuredValue) { value = parser._parseMultiValue(value, structuredValue, valueType, [], multiValue, state.designSet, structuredValue); result = [name, params, valueType, value]; } else if (multiValue) { result = [name, params, valueType]; parser._parseMultiValue(value, multiValue, valueType, result, null, state.designSet, false); } else if (structuredValue) { value = parser._parseMultiValue(value, structuredValue, valueType, [], null, state.designSet, structuredValue); result = [name, params, valueType, value]; } else { value = parser._parseValue(value, valueType, state.designSet, false); result = [name, params, valueType, value]; } if (state.component[0] === "vcard" && state.component[1].length === 0 && !(name === "version" && value === "4.0")) { state.designSet = design.getDesignSet("vcard3"); } state.component[1].push(result); }; parser._parseValue = function(value, type, designSet, structuredValue) { if (type in designSet.value && "fromICAL" in designSet.value[type]) { return designSet.value[type].fromICAL(value, structuredValue); } return value; }; parser._parseParameters = function(line, start, designSet) { var lastParam = start; var pos = 0; var delim = PARAM_NAME_DELIMITER; var result = {}; var name, lcname; var value, valuePos = -1; var type, multiValue, mvdelim; while (pos !== false && (pos = helpers.unescapedIndexOf(line, delim, pos + 1)) !== -1) { name = line.substr(lastParam + 1, pos - lastParam - 1); if (name.length == 0) { throw new ParserError("Empty parameter name in '" + line + "'"); } lcname = name.toLowerCase(); mvdelim = false; multiValue = false; if (lcname in designSet.param && designSet.param[lcname].valueType) { type = designSet.param[lcname].valueType; } else { type = DEFAULT_PARAM_TYPE; } if (lcname in designSet.param) { multiValue = designSet.param[lcname].multiValue; if (designSet.param[lcname].multiValueSeparateDQuote) { mvdelim = parser._rfc6868Escape('"' + multiValue + '"'); } } var nextChar = line[pos + 1]; if (nextChar === '"') { valuePos = pos + 2; pos = helpers.unescapedIndexOf(line, '"', valuePos); if (multiValue && pos != -1) { var extendedValue = true; while (extendedValue) { if (line[pos + 1] == multiValue && line[pos + 2] == '"') { pos = helpers.unescapedIndexOf(line, '"', pos + 3); } else { extendedValue = false; } } } if (pos === -1) { throw new ParserError('invalid line (no matching double quote) "' + line + '"'); } value = line.substr(valuePos, pos - valuePos); lastParam = helpers.unescapedIndexOf(line, PARAM_DELIMITER, pos); if (lastParam === -1) { pos = false; } } else { valuePos = pos + 1; var nextPos = helpers.unescapedIndexOf(line, PARAM_DELIMITER, valuePos); var propValuePos = helpers.unescapedIndexOf(line, VALUE_DELIMITER, valuePos); if (propValuePos !== -1 && nextPos > propValuePos) { nextPos = propValuePos; pos = false; } else if (nextPos === -1) { if (propValuePos === -1) { nextPos = line.length; } else { nextPos = propValuePos; } pos = false; } else { lastParam = nextPos; pos = nextPos; } value = line.substr(valuePos, nextPos - valuePos); } value = parser._rfc6868Escape(value); if (multiValue) { var delimiter = mvdelim || multiValue; value = parser._parseMultiValue(value, delimiter, type, [], null, designSet); } else { value = parser._parseValue(value, type, designSet); } if (multiValue && lcname in result) { if (Array.isArray(result[lcname])) { result[lcname].push(value); } else { result[lcname] = [ result[lcname], value ]; } } else { result[lcname] = value; } } return [result, value, valuePos]; }; parser._rfc6868Escape = function(val) { return val.replace(/\^['n^]/g, function(x3) { return RFC6868_REPLACE_MAP[x3]; }); }; var RFC6868_REPLACE_MAP = { "^'": '"', "^n": "\n", "^^": "^" }; parser._parseMultiValue = function(buffer, delim, type, result, innerMulti, designSet, structuredValue) { var pos = 0; var lastPos = 0; var value; if (delim.length === 0) { return buffer; } while ((pos = helpers.unescapedIndexOf(buffer, delim, lastPos)) !== -1) { value = buffer.substr(lastPos, pos - lastPos); if (innerMulti) { value = parser._parseMultiValue(value, innerMulti, type, [], null, designSet, structuredValue); } else { value = parser._parseValue(value, type, designSet, structuredValue); } result.push(value); lastPos = pos + delim.length; } value = buffer.substr(lastPos); if (innerMulti) { value = parser._parseMultiValue(value, innerMulti, type, [], null, designSet, structuredValue); } else { value = parser._parseValue(value, type, designSet, structuredValue); } result.push(value); return result.length == 1 ? result[0] : result; }; parser._eachLine = function(buffer, callback) { var len = buffer.length; var lastPos = buffer.search(CHAR); var pos = lastPos; var line; var firstChar; var newlineOffset; do { pos = buffer.indexOf("\n", lastPos) + 1; if (pos > 1 && buffer[pos - 2] === "\r") { newlineOffset = 2; } else { newlineOffset = 1; } if (pos === 0) { pos = len; newlineOffset = 0; } firstChar = buffer[lastPos]; if (firstChar === " " || firstChar === " ") { line += buffer.substr(lastPos + 1, pos - lastPos - (newlineOffset + 1)); } else { if (line) callback(null, line); line = buffer.substr(lastPos, pos - lastPos - newlineOffset); } lastPos = pos; } while (pos !== len); line = line.trim(); if (line.length) callback(null, line); }; return parser; }(); ICAL3.Component = function() { "use strict"; var PROPERTY_INDEX = 1; var COMPONENT_INDEX = 2; var NAME_INDEX = 0; function Component5(jCal, parent) { if (typeof jCal === "string") { jCal = [jCal, [], []]; } this.jCal = jCal; this.parent = parent || null; } Component5.prototype = { _hydratedPropertyCount: 0, _hydratedComponentCount: 0, get name() { return this.jCal[NAME_INDEX]; }, get _designSet() { var parentDesign = this.parent && this.parent._designSet; return parentDesign || ICAL3.design.getDesignSet(this.name); }, _hydrateComponent: function(index) { if (!this._components) { this._components = []; this._hydratedComponentCount = 0; } if (this._components[index]) { return this._components[index]; } var comp = new Component5(this.jCal[COMPONENT_INDEX][index], this); this._hydratedComponentCount++; return this._components[index] = comp; }, _hydrateProperty: function(index) { if (!this._properties) { this._properties = []; this._hydratedPropertyCount = 0; } if (this._properties[index]) { return this._properties[index]; } var prop = new ICAL3.Property(this.jCal[PROPERTY_INDEX][index], this); this._hydratedPropertyCount++; return this._properties[index] = prop; }, getFirstSubcomponent: function(name) { if (name) { var i3 = 0; var comps = this.jCal[COMPONENT_INDEX]; var len = comps.length; for (; i3 < len; i3++) { if (comps[i3][NAME_INDEX] === name) { var result = this._hydrateComponent(i3); return result; } } } else { if (this.jCal[COMPONENT_INDEX].length) { return this._hydrateComponent(0); } } return null; }, getAllSubcomponents: function(name) { var jCalLen = this.jCal[COMPONENT_INDEX].length; var i3 = 0; if (name) { var comps = this.jCal[COMPONENT_INDEX]; var result = []; for (; i3 < jCalLen; i3++) { if (name === comps[i3][NAME_INDEX]) { result.push(this._hydrateComponent(i3)); } } return result; } else { if (!this._components || this._hydratedComponentCount !== jCalLen) { for (; i3 < jCalLen; i3++) { this._hydrateComponent(i3); } } return this._components || []; } }, hasProperty: function(name) { var props = this.jCal[PROPERTY_INDEX]; var len = props.length; var i3 = 0; for (; i3 < len; i3++) { if (props[i3][NAME_INDEX] === name) { return true; } } return false; }, getFirstProperty: function(name) { if (name) { var i3 = 0; var props = this.jCal[PROPERTY_INDEX]; var len = props.length; for (; i3 < len; i3++) { if (props[i3][NAME_INDEX] === name) { var result = this._hydrateProperty(i3); return result; } } } else { if (this.jCal[PROPERTY_INDEX].length) { return this._hydrateProperty(0); } } return null; }, getFirstPropertyValue: function(name) { var prop = this.getFirstProperty(name); if (prop) { return prop.getFirstValue(); } return null; }, getAllProperties: function(name) { var jCalLen = this.jCal[PROPERTY_INDEX].length; var i3 = 0; if (name) { var props = this.jCal[PROPERTY_INDEX]; var result = []; for (; i3 < jCalLen; i3++) { if (name === props[i3][NAME_INDEX]) { result.push(this._hydrateProperty(i3)); } } return result; } else { if (!this._properties || this._hydratedPropertyCount !== jCalLen) { for (; i3 < jCalLen; i3++) { this._hydrateProperty(i3); } } return this._properties || []; } }, _removeObjectByIndex: function(jCalIndex, cache, index) { cache = cache || []; if (cache[index]) { var obj = cache[index]; if ("parent" in obj) { obj.parent = null; } } cache.splice(index, 1); this.jCal[jCalIndex].splice(index, 1); }, _removeObject: function(jCalIndex, cache, nameOrObject) { var i3 = 0; var objects = this.jCal[jCalIndex]; var len = objects.length; var cached = this[cache]; if (typeof nameOrObject === "string") { for (; i3 < len; i3++) { if (objects[i3][NAME_INDEX] === nameOrObject) { this._removeObjectByIndex(jCalIndex, cached, i3); return true; } } } else if (cached) { for (; i3 < len; i3++) { if (cached[i3] && cached[i3] === nameOrObject) { this._removeObjectByIndex(jCalIndex, cached, i3); return true; } } } return false; }, _removeAllObjects: function(jCalIndex, cache, name) { var cached = this[cache]; var objects = this.jCal[jCalIndex]; var i3 = objects.length - 1; for (; i3 >= 0; i3--) { if (!name || objects[i3][NAME_INDEX] === name) { this._removeObjectByIndex(jCalIndex, cached, i3); } } }, addSubcomponent: function(component) { if (!this._components) { this._components = []; this._hydratedComponentCount = 0; } if (component.parent) { component.parent.removeSubcomponent(component); } var idx = this.jCal[COMPONENT_INDEX].push(component.jCal); this._components[idx - 1] = component; this._hydratedComponentCount++; component.parent = this; return component; }, removeSubcomponent: function(nameOrComp) { var removed = this._removeObject(COMPONENT_INDEX, "_components", nameOrComp); if (removed) { this._hydratedComponentCount--; } return removed; }, removeAllSubcomponents: function(name) { var removed = this._removeAllObjects(COMPONENT_INDEX, "_components", name); this._hydratedComponentCount = 0; return removed; }, addProperty: function(property) { if (!(property instanceof ICAL3.Property)) { throw new TypeError("must instance of ICAL.Property"); } if (!this._properties) { this._properties = []; this._hydratedPropertyCount = 0; } if (property.parent) { property.parent.removeProperty(property); } var idx = this.jCal[PROPERTY_INDEX].push(property.jCal); this._properties[idx - 1] = property; this._hydratedPropertyCount++; property.parent = this; return property; }, addPropertyWithValue: function(name, value) { var prop = new ICAL3.Property(name); prop.setValue(value); this.addProperty(prop); return prop; }, updatePropertyWithValue: function(name, value) { var prop = this.getFirstProperty(name); if (prop) { prop.setValue(value); } else { prop = this.addPropertyWithValue(name, value); } return prop; }, removeProperty: function(nameOrProp) { var removed = this._removeObject(PROPERTY_INDEX, "_properties", nameOrProp); if (removed) { this._hydratedPropertyCount--; } return removed; }, removeAllProperties: function(name) { var removed = this._removeAllObjects(PROPERTY_INDEX, "_properties", name); this._hydratedPropertyCount = 0; return removed; }, toJSON: function() { return this.jCal; }, toString: function() { return ICAL3.stringify.component(this.jCal, this._designSet); } }; Component5.fromString = function(str) { return new Component5(ICAL3.parse.component(str)); }; return Component5; }(); ICAL3.Property = function() { "use strict"; var NAME_INDEX = 0; var PROP_INDEX = 1; var TYPE_INDEX = 2; var VALUE_INDEX = 3; var design = ICAL3.design; function Property(jCal, parent) { this._parent = parent || null; if (typeof jCal === "string") { this.jCal = [jCal, {}, design.defaultType]; this.jCal[TYPE_INDEX] = this.getDefaultType(); } else { this.jCal = jCal; } this._updateType(); } Property.prototype = { get type() { return this.jCal[TYPE_INDEX]; }, get name() { return this.jCal[NAME_INDEX]; }, get parent() { return this._parent; }, set parent(p3) { var designSetChanged = !this._parent || p3 && p3._designSet != this._parent._designSet; this._parent = p3; if (this.type == design.defaultType && designSetChanged) { this.jCal[TYPE_INDEX] = this.getDefaultType(); this._updateType(); } return p3; }, get _designSet() { return this.parent ? this.parent._designSet : design.defaultSet; }, _updateType: function() { var designSet = this._designSet; if (this.type in designSet.value) { var designType = designSet.value[this.type]; if ("decorate" in designSet.value[this.type]) { this.isDecorated = true; } else { this.isDecorated = false; } if (this.name in designSet.property) { this.isMultiValue = "multiValue" in designSet.property[this.name]; this.isStructuredValue = "structuredValue" in designSet.property[this.name]; } } }, _hydrateValue: function(index) { if (this._values && this._values[index]) { return this._values[index]; } if (this.jCal.length <= VALUE_INDEX + index) { return null; } if (this.isDecorated) { if (!this._values) { this._values = []; } return this._values[index] = this._decorate(this.jCal[VALUE_INDEX + index]); } else { return this.jCal[VALUE_INDEX + index]; } }, _decorate: function(value) { return this._designSet.value[this.type].decorate(value, this); }, _undecorate: function(value) { return this._designSet.value[this.type].undecorate(value, this); }, _setDecoratedValue: function(value, index) { if (!this._values) { this._values = []; } if (typeof value === "object" && "icaltype" in value) { this.jCal[VALUE_INDEX + index] = this._undecorate(value); this._values[index] = value; } else { this.jCal[VALUE_INDEX + index] = value; this._values[index] = this._decorate(value); } }, getParameter: function(name) { if (name in this.jCal[PROP_INDEX]) { return this.jCal[PROP_INDEX][name]; } else { return void 0; } }, getFirstParameter: function(name) { var parameters = this.getParameter(name); if (Array.isArray(parameters)) { return parameters[0]; } return parameters; }, setParameter: function(name, value) { var lcname = name.toLowerCase(); if (typeof value === "string" && lcname in this._designSet.param && "multiValue" in this._designSet.param[lcname]) { value = [value]; } this.jCal[PROP_INDEX][name] = value; }, removeParameter: function(name) { delete this.jCal[PROP_INDEX][name]; }, getDefaultType: function() { var name = this.jCal[NAME_INDEX]; var designSet = this._designSet; if (name in designSet.property) { var details = designSet.property[name]; if ("defaultType" in details) { return details.defaultType; } } return design.defaultType; }, resetType: function(type) { this.removeAllValues(); this.jCal[TYPE_INDEX] = type; this._updateType(); }, getFirstValue: function() { return this._hydrateValue(0); }, getValues: function() { var len = this.jCal.length - VALUE_INDEX; if (len < 1) { return []; } var i3 = 0; var result = []; for (; i3 < len; i3++) { result[i3] = this._hydrateValue(i3); } return result; }, removeAllValues: function() { if (this._values) { this._values.length = 0; } this.jCal.length = 3; }, setValues: function(values) { if (!this.isMultiValue) { throw new Error(this.name + ": does not not support mulitValue.\noverride isMultiValue"); } var len = values.length; var i3 = 0; this.removeAllValues(); if (len > 0 && typeof values[0] === "object" && "icaltype" in values[0]) { this.resetType(values[0].icaltype); } if (this.isDecorated) { for (; i3 < len; i3++) { this._setDecoratedValue(values[i3], i3); } } else { for (; i3 < len; i3++) { this.jCal[VALUE_INDEX + i3] = values[i3]; } } }, setValue: function(value) { this.removeAllValues(); if (typeof value === "object" && "icaltype" in value) { this.resetType(value.icaltype); } if (this.isDecorated) { this._setDecoratedValue(value, 0); } else { this.jCal[VALUE_INDEX] = value; } }, toJSON: function() { return this.jCal; }, toICALString: function() { return ICAL3.stringify.property(this.jCal, this._designSet, true); } }; Property.fromString = function(str, designSet) { return new Property(ICAL3.parse.property(str, designSet)); }; return Property; }(); ICAL3.UtcOffset = function() { function UtcOffset(aData) { this.fromData(aData); } UtcOffset.prototype = { hours: 0, minutes: 0, factor: 1, icaltype: "utc-offset", clone: function() { return ICAL3.UtcOffset.fromSeconds(this.toSeconds()); }, fromData: function(aData) { if (aData) { for (var key in aData) { if (aData.hasOwnProperty(key)) { this[key] = aData[key]; } } } this._normalize(); }, fromSeconds: function(aSeconds) { var secs = Math.abs(aSeconds); this.factor = aSeconds < 0 ? -1 : 1; this.hours = ICAL3.helpers.trunc(secs / 3600); secs -= this.hours * 3600; this.minutes = ICAL3.helpers.trunc(secs / 60); return this; }, toSeconds: function() { return this.factor * (60 * this.minutes + 3600 * this.hours); }, compare: function icaltime_compare(other) { var a3 = this.toSeconds(); var b3 = other.toSeconds(); return (a3 > b3) - (b3 > a3); }, _normalize: function() { var secs = this.toSeconds(); var factor = this.factor; while (secs < -43200) { secs += 97200; } while (secs > 50400) { secs -= 97200; } this.fromSeconds(secs); if (secs == 0) { this.factor = factor; } }, toICALString: function() { return ICAL3.design.icalendar.value["utc-offset"].toICAL(this.toString()); }, toString: function toString() { return (this.factor == 1 ? "+" : "-") + ICAL3.helpers.pad2(this.hours) + ":" + ICAL3.helpers.pad2(this.minutes); } }; UtcOffset.fromString = function(aString) { var options = {}; options.factor = aString[0] === "+" ? 1 : -1; options.hours = ICAL3.helpers.strictParseInt(aString.substr(1, 2)); options.minutes = ICAL3.helpers.strictParseInt(aString.substr(4, 2)); return new ICAL3.UtcOffset(options); }; UtcOffset.fromSeconds = function(aSeconds) { var instance = new UtcOffset(); instance.fromSeconds(aSeconds); return instance; }; return UtcOffset; }(); ICAL3.Binary = function() { function Binary(aValue) { this.value = aValue; } Binary.prototype = { icaltype: "binary", decodeValue: function decodeValue() { return this._b64_decode(this.value); }, setEncodedValue: function setEncodedValue(aValue) { this.value = this._b64_encode(aValue); }, _b64_encode: function base64_encode(data) { var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h22, h3, h4, bits, i3 = 0, ac = 0, enc = "", tmp_arr = []; if (!data) { return data; } do { o1 = data.charCodeAt(i3++); o2 = data.charCodeAt(i3++); o3 = data.charCodeAt(i3++); bits = o1 << 16 | o2 << 8 | o3; h1 = bits >> 18 & 63; h22 = bits >> 12 & 63; h3 = bits >> 6 & 63; h4 = bits & 63; tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h22) + b64.charAt(h3) + b64.charAt(h4); } while (i3 < data.length); enc = tmp_arr.join(""); var r3 = data.length % 3; return (r3 ? enc.slice(0, r3 - 3) : enc) + "===".slice(r3 || 3); }, _b64_decode: function base64_decode(data) { var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h22, h3, h4, bits, i3 = 0, ac = 0, dec = "", tmp_arr = []; if (!data) { return data; } data += ""; do { h1 = b64.indexOf(data.charAt(i3++)); h22 = b64.indexOf(data.charAt(i3++)); h3 = b64.indexOf(data.charAt(i3++)); h4 = b64.indexOf(data.charAt(i3++)); bits = h1 << 18 | h22 << 12 | h3 << 6 | h4; o1 = bits >> 16 & 255; o2 = bits >> 8 & 255; o3 = bits & 255; if (h3 == 64) { tmp_arr[ac++] = String.fromCharCode(o1); } else if (h4 == 64) { tmp_arr[ac++] = String.fromCharCode(o1, o2); } else { tmp_arr[ac++] = String.fromCharCode(o1, o2, o3); } } while (i3 < data.length); dec = tmp_arr.join(""); return dec; }, toString: function() { return this.value; } }; Binary.fromString = function(aString) { return new Binary(aString); }; return Binary; }(); (function() { ICAL3.Period = function icalperiod(aData) { this.wrappedJSObject = this; if (aData && "start" in aData) { if (aData.start && !(aData.start instanceof ICAL3.Time)) { throw new TypeError(".start must be an instance of ICAL.Time"); } this.start = aData.start; } if (aData && aData.end && aData.duration) { throw new Error("cannot accept both end and duration"); } if (aData && "end" in aData) { if (aData.end && !(aData.end instanceof ICAL3.Time)) { throw new TypeError(".end must be an instance of ICAL.Time"); } this.end = aData.end; } if (aData && "duration" in aData) { if (aData.duration && !(aData.duration instanceof ICAL3.Duration)) { throw new TypeError(".duration must be an instance of ICAL.Duration"); } this.duration = aData.duration; } }; ICAL3.Period.prototype = { start: null, end: null, duration: null, icalclass: "icalperiod", icaltype: "period", clone: function() { return ICAL3.Period.fromData({ start: this.start ? this.start.clone() : null, end: this.end ? this.end.clone() : null, duration: this.duration ? this.duration.clone() : null }); }, getDuration: function duration() { if (this.duration) { return this.duration; } else { return this.end.subtractDate(this.start); } }, getEnd: function() { if (this.end) { return this.end; } else { var end = this.start.clone(); end.addDuration(this.duration); return end; } }, toString: function toString() { return this.start + "/" + (this.end || this.duration); }, toJSON: function() { return [this.start.toString(), (this.end || this.duration).toString()]; }, toICALString: function() { return this.start.toICALString() + "/" + (this.end || this.duration).toICALString(); } }; ICAL3.Period.fromString = function fromString(str, prop) { var parts = str.split("/"); if (parts.length !== 2) { throw new Error('Invalid string value: "' + str + '" must contain a "/" char.'); } var options = { start: ICAL3.Time.fromDateTimeString(parts[0], prop) }; var end = parts[1]; if (ICAL3.Duration.isValueString(end)) { options.duration = ICAL3.Duration.fromString(end); } else { options.end = ICAL3.Time.fromDateTimeString(end, prop); } return new ICAL3.Period(options); }; ICAL3.Period.fromData = function fromData(aData) { return new ICAL3.Period(aData); }; ICAL3.Period.fromJSON = function(aData, aProp, aLenient) { function fromDateOrDateTimeString(aValue, aProp2) { if (aLenient) { return ICAL3.Time.fromString(aValue, aProp2); } else { return ICAL3.Time.fromDateTimeString(aValue, aProp2); } } if (ICAL3.Duration.isValueString(aData[1])) { return ICAL3.Period.fromData({ start: fromDateOrDateTimeString(aData[0], aProp), duration: ICAL3.Duration.fromString(aData[1]) }); } else { return ICAL3.Period.fromData({ start: fromDateOrDateTimeString(aData[0], aProp), end: fromDateOrDateTimeString(aData[1], aProp) }); } }; })(); (function() { var DURATION_LETTERS = /([PDWHMTS]{1,1})/; ICAL3.Duration = function icalduration(data) { this.wrappedJSObject = this; this.fromData(data); }; ICAL3.Duration.prototype = { weeks: 0, days: 0, hours: 0, minutes: 0, seconds: 0, isNegative: false, icalclass: "icalduration", icaltype: "duration", clone: function clone() { return ICAL3.Duration.fromData(this); }, toSeconds: function toSeconds() { var seconds = this.seconds + 60 * this.minutes + 3600 * this.hours + 86400 * this.days + 7 * 86400 * this.weeks; return this.isNegative ? -seconds : seconds; }, fromSeconds: function fromSeconds(aSeconds) { var secs = Math.abs(aSeconds); this.isNegative = aSeconds < 0; this.days = ICAL3.helpers.trunc(secs / 86400); if (this.days % 7 == 0) { this.weeks = this.days / 7; this.days = 0; } else { this.weeks = 0; } secs -= (this.days + 7 * this.weeks) * 86400; this.hours = ICAL3.helpers.trunc(secs / 3600); secs -= this.hours * 3600; this.minutes = ICAL3.helpers.trunc(secs / 60); secs -= this.minutes * 60; this.seconds = secs; return this; }, fromData: function fromData(aData) { var propsToCopy = [ "weeks", "days", "hours", "minutes", "seconds", "isNegative" ]; for (var key in propsToCopy) { if (!propsToCopy.hasOwnProperty(key)) { continue; } var prop = propsToCopy[key]; if (aData && prop in aData) { this[prop] = aData[prop]; } else { this[prop] = 0; } } }, reset: function reset() { this.isNegative = false; this.weeks = 0; this.days = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; }, compare: function compare(aOther) { var thisSeconds = this.toSeconds(); var otherSeconds = aOther.toSeconds(); return (thisSeconds > otherSeconds) - (thisSeconds < otherSeconds); }, normalize: function normalize() { this.fromSeconds(this.toSeconds()); }, toString: function toString() { if (this.toSeconds() == 0) { return "PT0S"; } else { var str = ""; if (this.isNegative) str += "-"; str += "P"; if (this.weeks) str += this.weeks + "W"; if (this.days) str += this.days + "D"; if (this.hours || this.minutes || this.seconds) { str += "T"; if (this.hours) str += this.hours + "H"; if (this.minutes) str += this.minutes + "M"; if (this.seconds) str += this.seconds + "S"; } return str; } }, toICALString: function() { return this.toString(); } }; ICAL3.Duration.fromSeconds = function icalduration_from_seconds(aSeconds) { return new ICAL3.Duration().fromSeconds(aSeconds); }; function parseDurationChunk(letter, number, object) { var type; switch (letter) { case "P": if (number && number === "-") { object.isNegative = true; } else { object.isNegative = false; } break; case "D": type = "days"; break; case "W": type = "weeks"; break; case "H": type = "hours"; break; case "M": type = "minutes"; break; case "S": type = "seconds"; break; default: return 0; } if (type) { if (!number && number !== 0) { throw new Error('invalid duration value: Missing number before "' + letter + '"'); } var num = parseInt(number, 10); if (ICAL3.helpers.isStrictlyNaN(num)) { throw new Error('invalid duration value: Invalid number "' + number + '" before "' + letter + '"'); } object[type] = num; } return 1; } ICAL3.Duration.isValueString = function(string) { return string[0] === "P" || string[1] === "P"; }; ICAL3.Duration.fromString = function icalduration_from_string(aStr) { var pos = 0; var dict = Object.create(null); var chunks = 0; while ((pos = aStr.search(DURATION_LETTERS)) !== -1) { var type = aStr[pos]; var numeric = aStr.substr(0, pos); aStr = aStr.substr(pos + 1); chunks += parseDurationChunk(type, numeric, dict); } if (chunks < 2) { throw new Error('invalid duration value: Not enough duration components in "' + aStr + '"'); } return new ICAL3.Duration(dict); }; ICAL3.Duration.fromData = function icalduration_from_data(aData) { return new ICAL3.Duration(aData); }; })(); (function() { var OPTIONS = [ "tzid", "location", "tznames", "latitude", "longitude" ]; ICAL3.Timezone = function icaltimezone(data) { this.wrappedJSObject = this; this.fromData(data); }; ICAL3.Timezone.prototype = { tzid: "", location: "", tznames: "", latitude: 0, longitude: 0, component: null, expandedUntilYear: 0, icalclass: "icaltimezone", fromData: function fromData(aData) { this.expandedUntilYear = 0; this.changes = []; if (aData instanceof ICAL3.Component) { this.component = aData; } else { if (aData && "component" in aData) { if (typeof aData.component == "string") { var jCal = ICAL3.parse(aData.component); this.component = new ICAL3.Component(jCal); } else if (aData.component instanceof ICAL3.Component) { this.component = aData.component; } else { this.component = null; } } for (var key in OPTIONS) { if (OPTIONS.hasOwnProperty(key)) { var prop = OPTIONS[key]; if (aData && prop in aData) { this[prop] = aData[prop]; } } } } if (this.component instanceof ICAL3.Component && !this.tzid) { this.tzid = this.component.getFirstPropertyValue("tzid"); } return this; }, utcOffset: function utcOffset(tt) { if (this == ICAL3.Timezone.utcTimezone || this == ICAL3.Timezone.localTimezone) { return 0; } this._ensureCoverage(tt.year); if (!this.changes.length) { return 0; } var tt_change = { year: tt.year, month: tt.month, day: tt.day, hour: tt.hour, minute: tt.minute, second: tt.second }; var change_num = this._findNearbyChange(tt_change); var change_num_to_use = -1; var step = 1; for (; ; ) { var change = ICAL3.helpers.clone(this.changes[change_num], true); if (change.utcOffset < change.prevUtcOffset) { ICAL3.Timezone.adjust_change(change, 0, 0, 0, change.utcOffset); } else { ICAL3.Timezone.adjust_change(change, 0, 0, 0, change.prevUtcOffset); } var cmp = ICAL3.Timezone._compare_change_fn(tt_change, change); if (cmp >= 0) { change_num_to_use = change_num; } else { step = -1; } if (step == -1 && change_num_to_use != -1) { break; } change_num += step; if (change_num < 0) { return 0; } if (change_num >= this.changes.length) { break; } } var zone_change = this.changes[change_num_to_use]; var utcOffset_change = zone_change.utcOffset - zone_change.prevUtcOffset; if (utcOffset_change < 0 && change_num_to_use > 0) { var tmp_change = ICAL3.helpers.clone(zone_change, true); ICAL3.Timezone.adjust_change(tmp_change, 0, 0, 0, tmp_change.prevUtcOffset); if (ICAL3.Timezone._compare_change_fn(tt_change, tmp_change) < 0) { var prev_zone_change = this.changes[change_num_to_use - 1]; var want_daylight = false; if (zone_change.is_daylight != want_daylight && prev_zone_change.is_daylight == want_daylight) { zone_change = prev_zone_change; } } } return zone_change.utcOffset; }, _findNearbyChange: function icaltimezone_find_nearby_change(change) { var idx = ICAL3.helpers.binsearchInsert(this.changes, change, ICAL3.Timezone._compare_change_fn); if (idx >= this.changes.length) { return this.changes.length - 1; } return idx; }, _ensureCoverage: function(aYear) { if (ICAL3.Timezone._minimumExpansionYear == -1) { var today = ICAL3.Time.now(); ICAL3.Timezone._minimumExpansionYear = today.year; } var changesEndYear = aYear; if (changesEndYear < ICAL3.Timezone._minimumExpansionYear) { changesEndYear = ICAL3.Timezone._minimumExpansionYear; } changesEndYear += ICAL3.Timezone.EXTRA_COVERAGE; if (changesEndYear > ICAL3.Timezone.MAX_YEAR) { changesEndYear = ICAL3.Timezone.MAX_YEAR; } if (!this.changes.length || this.expandedUntilYear < aYear) { var subcomps = this.component.getAllSubcomponents(); var compLen = subcomps.length; var compIdx = 0; for (; compIdx < compLen; compIdx++) { this._expandComponent(subcomps[compIdx], changesEndYear, this.changes); } this.changes.sort(ICAL3.Timezone._compare_change_fn); this.expandedUntilYear = changesEndYear; } }, _expandComponent: function(aComponent, aYear, changes) { if (!aComponent.hasProperty("dtstart") || !aComponent.hasProperty("tzoffsetto") || !aComponent.hasProperty("tzoffsetfrom")) { return null; } var dtstart = aComponent.getFirstProperty("dtstart").getFirstValue(); var change; function convert_tzoffset(offset) { return offset.factor * (offset.hours * 3600 + offset.minutes * 60); } function init_changes() { var changebase = {}; changebase.is_daylight = aComponent.name == "daylight"; changebase.utcOffset = convert_tzoffset(aComponent.getFirstProperty("tzoffsetto").getFirstValue()); changebase.prevUtcOffset = convert_tzoffset(aComponent.getFirstProperty("tzoffsetfrom").getFirstValue()); return changebase; } if (!aComponent.hasProperty("rrule") && !aComponent.hasProperty("rdate")) { change = init_changes(); change.year = dtstart.year; change.month = dtstart.month; change.day = dtstart.day; change.hour = dtstart.hour; change.minute = dtstart.minute; change.second = dtstart.second; ICAL3.Timezone.adjust_change(change, 0, 0, 0, -change.prevUtcOffset); changes.push(change); } else { var props = aComponent.getAllProperties("rdate"); for (var rdatekey in props) { if (!props.hasOwnProperty(rdatekey)) { continue; } var rdate = props[rdatekey]; var time = rdate.getFirstValue(); change = init_changes(); change.year = time.year; change.month = time.month; change.day = time.day; if (time.isDate) { change.hour = dtstart.hour; change.minute = dtstart.minute; change.second = dtstart.second; if (dtstart.zone != ICAL3.Timezone.utcTimezone) { ICAL3.Timezone.adjust_change(change, 0, 0, 0, -change.prevUtcOffset); } } else { change.hour = time.hour; change.minute = time.minute; change.second = time.second; if (time.zone != ICAL3.Timezone.utcTimezone) { ICAL3.Timezone.adjust_change(change, 0, 0, 0, -change.prevUtcOffset); } } changes.push(change); } var rrule = aComponent.getFirstProperty("rrule"); if (rrule) { rrule = rrule.getFirstValue(); change = init_changes(); if (rrule.until && rrule.until.zone == ICAL3.Timezone.utcTimezone) { rrule.until.adjust(0, 0, 0, change.prevUtcOffset); rrule.until.zone = ICAL3.Timezone.localTimezone; } var iterator = rrule.iterator(dtstart); var occ; while (occ = iterator.next()) { change = init_changes(); if (occ.year > aYear || !occ) { break; } change.year = occ.year; change.month = occ.month; change.day = occ.day; change.hour = occ.hour; change.minute = occ.minute; change.second = occ.second; change.isDate = occ.isDate; ICAL3.Timezone.adjust_change(change, 0, 0, 0, -change.prevUtcOffset); changes.push(change); } } } return changes; }, toString: function toString() { return this.tznames ? this.tznames : this.tzid; } }; ICAL3.Timezone._compare_change_fn = function icaltimezone_compare_change_fn(a3, b3) { if (a3.year < b3.year) return -1; else if (a3.year > b3.year) return 1; if (a3.month < b3.month) return -1; else if (a3.month > b3.month) return 1; if (a3.day < b3.day) return -1; else if (a3.day > b3.day) return 1; if (a3.hour < b3.hour) return -1; else if (a3.hour > b3.hour) return 1; if (a3.minute < b3.minute) return -1; else if (a3.minute > b3.minute) return 1; if (a3.second < b3.second) return -1; else if (a3.second > b3.second) return 1; return 0; }; ICAL3.Timezone.convert_time = function icaltimezone_convert_time(tt, from_zone, to_zone) { if (tt.isDate || from_zone.tzid == to_zone.tzid || from_zone == ICAL3.Timezone.localTimezone || to_zone == ICAL3.Timezone.localTimezone) { tt.zone = to_zone; return tt; } var utcOffset = from_zone.utcOffset(tt); tt.adjust(0, 0, 0, -utcOffset); utcOffset = to_zone.utcOffset(tt); tt.adjust(0, 0, 0, utcOffset); return null; }; ICAL3.Timezone.fromData = function icaltimezone_fromData(aData) { var tt = new ICAL3.Timezone(); return tt.fromData(aData); }; ICAL3.Timezone.utcTimezone = ICAL3.Timezone.fromData({ tzid: "UTC" }); ICAL3.Timezone.localTimezone = ICAL3.Timezone.fromData({ tzid: "floating" }); ICAL3.Timezone.adjust_change = function icaltimezone_adjust_change(change, days, hours, minutes, seconds) { return ICAL3.Time.prototype.adjust.call(change, days, hours, minutes, seconds, change); }; ICAL3.Timezone._minimumExpansionYear = -1; ICAL3.Timezone.MAX_YEAR = 2035; ICAL3.Timezone.EXTRA_COVERAGE = 5; })(); ICAL3.TimezoneService = function() { var zones; var TimezoneService = { get count() { return Object.keys(zones).length; }, reset: function() { zones = Object.create(null); var utc = ICAL3.Timezone.utcTimezone; zones.Z = utc; zones.UTC = utc; zones.GMT = utc; }, has: function(tzid) { return !!zones[tzid]; }, get: function(tzid) { return zones[tzid]; }, register: function(name, timezone) { if (name instanceof ICAL3.Component) { if (name.name === "vtimezone") { timezone = new ICAL3.Timezone(name); name = timezone.tzid; } } if (timezone instanceof ICAL3.Timezone) { zones[name] = timezone; } else { throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component"); } }, remove: function(tzid) { return delete zones[tzid]; } }; TimezoneService.reset(); return TimezoneService; }(); (function() { ICAL3.Time = function icaltime(data, zone) { this.wrappedJSObject = this; var time = this._time = Object.create(null); time.year = 0; time.month = 1; time.day = 1; time.hour = 0; time.minute = 0; time.second = 0; time.isDate = false; this.fromData(data, zone); }; ICAL3.Time._dowCache = {}; ICAL3.Time._wnCache = {}; ICAL3.Time.prototype = { icalclass: "icaltime", _cachedUnixTime: null, get icaltype() { return this.isDate ? "date" : "date-time"; }, zone: null, _pendingNormalization: false, clone: function() { return new ICAL3.Time(this._time, this.zone); }, reset: function icaltime_reset() { this.fromData(ICAL3.Time.epochTime); this.zone = ICAL3.Timezone.utcTimezone; }, resetTo: function icaltime_resetTo(year, month, day, hour, minute, second, timezone) { this.fromData({ year, month, day, hour, minute, second, zone: timezone }); }, fromJSDate: function icaltime_fromJSDate(aDate, useUTC) { if (!aDate) { this.reset(); } else { if (useUTC) { this.zone = ICAL3.Timezone.utcTimezone; this.year = aDate.getUTCFullYear(); this.month = aDate.getUTCMonth() + 1; this.day = aDate.getUTCDate(); this.hour = aDate.getUTCHours(); this.minute = aDate.getUTCMinutes(); this.second = aDate.getUTCSeconds(); } else { this.zone = ICAL3.Timezone.localTimezone; this.year = aDate.getFullYear(); this.month = aDate.getMonth() + 1; this.day = aDate.getDate(); this.hour = aDate.getHours(); this.minute = aDate.getMinutes(); this.second = aDate.getSeconds(); } } this._cachedUnixTime = null; return this; }, fromData: function fromData(aData, aZone) { if (aData) { for (var key in aData) { if (Object.prototype.hasOwnProperty.call(aData, key)) { if (key === "icaltype") continue; this[key] = aData[key]; } } } if (aZone) { this.zone = aZone; } if (aData && !("isDate" in aData)) { this.isDate = !("hour" in aData); } else if (aData && "isDate" in aData) { this.isDate = aData.isDate; } if (aData && "timezone" in aData) { var zone = ICAL3.TimezoneService.get(aData.timezone); this.zone = zone || ICAL3.Timezone.localTimezone; } if (aData && "zone" in aData) { this.zone = aData.zone; } if (!this.zone) { this.zone = ICAL3.Timezone.localTimezone; } this._cachedUnixTime = null; return this; }, dayOfWeek: function icaltime_dayOfWeek(aWeekStart) { var firstDow = aWeekStart || ICAL3.Time.SUNDAY; var dowCacheKey = (this.year << 12) + (this.month << 8) + (this.day << 3) + firstDow; if (dowCacheKey in ICAL3.Time._dowCache) { return ICAL3.Time._dowCache[dowCacheKey]; } var q3 = this.day; var m2 = this.month + (this.month < 3 ? 12 : 0); var Y2 = this.year - (this.month < 3 ? 1 : 0); var h3 = q3 + Y2 + ICAL3.helpers.trunc((m2 + 1) * 26 / 10) + ICAL3.helpers.trunc(Y2 / 4); if (true) { h3 += ICAL3.helpers.trunc(Y2 / 100) * 6 + ICAL3.helpers.trunc(Y2 / 400); } else { h3 += 5; } h3 = (h3 + 7 - firstDow) % 7 + 1; ICAL3.Time._dowCache[dowCacheKey] = h3; return h3; }, dayOfYear: function dayOfYear() { var is_leap = ICAL3.Time.isLeapYear(this.year) ? 1 : 0; var diypm = ICAL3.Time.daysInYearPassedMonth; return diypm[is_leap][this.month - 1] + this.day; }, startOfWeek: function startOfWeek(aWeekStart) { var firstDow = aWeekStart || ICAL3.Time.SUNDAY; var result = this.clone(); result.day -= (this.dayOfWeek() + 7 - firstDow) % 7; result.isDate = true; result.hour = 0; result.minute = 0; result.second = 0; return result; }, endOfWeek: function endOfWeek(aWeekStart) { var firstDow = aWeekStart || ICAL3.Time.SUNDAY; var result = this.clone(); result.day += (7 - this.dayOfWeek() + firstDow - ICAL3.Time.SUNDAY) % 7; result.isDate = true; result.hour = 0; result.minute = 0; result.second = 0; return result; }, startOfMonth: function startOfMonth() { var result = this.clone(); result.day = 1; result.isDate = true; result.hour = 0; result.minute = 0; result.second = 0; return result; }, endOfMonth: function endOfMonth() { var result = this.clone(); result.day = ICAL3.Time.daysInMonth(result.month, result.year); result.isDate = true; result.hour = 0; result.minute = 0; result.second = 0; return result; }, startOfYear: function startOfYear() { var result = this.clone(); result.day = 1; result.month = 1; result.isDate = true; result.hour = 0; result.minute = 0; result.second = 0; return result; }, endOfYear: function endOfYear() { var result = this.clone(); result.day = 31; result.month = 12; result.isDate = true; result.hour = 0; result.minute = 0; result.second = 0; return result; }, startDoyWeek: function startDoyWeek(aFirstDayOfWeek) { var firstDow = aFirstDayOfWeek || ICAL3.Time.SUNDAY; var delta = this.dayOfWeek() - firstDow; if (delta < 0) delta += 7; return this.dayOfYear() - delta; }, getDominicalLetter: function() { return ICAL3.Time.getDominicalLetter(this.year); }, nthWeekDay: function icaltime_nthWeekDay(aDayOfWeek, aPos) { var daysInMonth = ICAL3.Time.daysInMonth(this.month, this.year); var weekday; var pos = aPos; var start = 0; var otherDay = this.clone(); if (pos >= 0) { otherDay.day = 1; if (pos != 0) { pos--; } start = otherDay.day; var startDow = otherDay.dayOfWeek(); var offset = aDayOfWeek - startDow; if (offset < 0) offset += 7; start += offset; start -= aDayOfWeek; weekday = aDayOfWeek; } else { otherDay.day = daysInMonth; var endDow = otherDay.dayOfWeek(); pos++; weekday = endDow - aDayOfWeek; if (weekday < 0) { weekday += 7; } weekday = daysInMonth - weekday; } weekday += pos * 7; return start + weekday; }, isNthWeekDay: function(aDayOfWeek, aPos) { var dow = this.dayOfWeek(); if (aPos === 0 && dow === aDayOfWeek) { return true; } var day = this.nthWeekDay(aDayOfWeek, aPos); if (day === this.day) { return true; } return false; }, weekNumber: function weekNumber(aWeekStart) { var wnCacheKey = (this.year << 12) + (this.month << 8) + (this.day << 3) + aWeekStart; if (wnCacheKey in ICAL3.Time._wnCache) { return ICAL3.Time._wnCache[wnCacheKey]; } var week1; var dt = this.clone(); dt.isDate = true; var isoyear = this.year; if (dt.month == 12 && dt.day > 25) { week1 = ICAL3.Time.weekOneStarts(isoyear + 1, aWeekStart); if (dt.compare(week1) < 0) { week1 = ICAL3.Time.weekOneStarts(isoyear, aWeekStart); } else { isoyear++; } } else { week1 = ICAL3.Time.weekOneStarts(isoyear, aWeekStart); if (dt.compare(week1) < 0) { week1 = ICAL3.Time.weekOneStarts(--isoyear, aWeekStart); } } var daysBetween = dt.subtractDate(week1).toSeconds() / 86400; var answer = ICAL3.helpers.trunc(daysBetween / 7) + 1; ICAL3.Time._wnCache[wnCacheKey] = answer; return answer; }, addDuration: function icaltime_add(aDuration) { var mult = aDuration.isNegative ? -1 : 1; var second = this.second; var minute = this.minute; var hour = this.hour; var day = this.day; second += mult * aDuration.seconds; minute += mult * aDuration.minutes; hour += mult * aDuration.hours; day += mult * aDuration.days; day += mult * 7 * aDuration.weeks; this.second = second; this.minute = minute; this.hour = hour; this.day = day; this._cachedUnixTime = null; }, subtractDate: function icaltime_subtract(aDate) { var unixTime = this.toUnixTime() + this.utcOffset(); var other = aDate.toUnixTime() + aDate.utcOffset(); return ICAL3.Duration.fromSeconds(unixTime - other); }, subtractDateTz: function icaltime_subtract_abs(aDate) { var unixTime = this.toUnixTime(); var other = aDate.toUnixTime(); return ICAL3.Duration.fromSeconds(unixTime - other); }, compare: function icaltime_compare(other) { var a3 = this.toUnixTime(); var b3 = other.toUnixTime(); if (a3 > b3) return 1; if (b3 > a3) return -1; return 0; }, compareDateOnlyTz: function icaltime_compareDateOnlyTz(other, tz) { function cmp(attr) { return ICAL3.Time._cmp_attr(a3, b3, attr); } var a3 = this.convertToZone(tz); var b3 = other.convertToZone(tz); var rc = 0; if ((rc = cmp("year")) != 0) return rc; if ((rc = cmp("month")) != 0) return rc; if ((rc = cmp("day")) != 0) return rc; return rc; }, convertToZone: function convertToZone(zone) { var copy = this.clone(); var zone_equals = this.zone.tzid == zone.tzid; if (!this.isDate && !zone_equals) { ICAL3.Timezone.convert_time(copy, this.zone, zone); } copy.zone = zone; return copy; }, utcOffset: function utc_offset() { if (this.zone == ICAL3.Timezone.localTimezone || this.zone == ICAL3.Timezone.utcTimezone) { return 0; } else { return this.zone.utcOffset(this); } }, toICALString: function() { var string = this.toString(); if (string.length > 10) { return ICAL3.design.icalendar.value["date-time"].toICAL(string); } else { return ICAL3.design.icalendar.value.date.toICAL(string); } }, toString: function toString() { var result = this.year + "-" + ICAL3.helpers.pad2(this.month) + "-" + ICAL3.helpers.pad2(this.day); if (!this.isDate) { result += "T" + ICAL3.helpers.pad2(this.hour) + ":" + ICAL3.helpers.pad2(this.minute) + ":" + ICAL3.helpers.pad2(this.second); if (this.zone === ICAL3.Timezone.utcTimezone) { result += "Z"; } } return result; }, toJSDate: function toJSDate() { if (this.zone == ICAL3.Timezone.localTimezone) { if (this.isDate) { return new Date(this.year, this.month - 1, this.day); } else { return new Date(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, 0); } } else { return new Date(this.toUnixTime() * 1e3); } }, _normalize: function icaltime_normalize() { var isDate = this._time.isDate; if (this._time.isDate) { this._time.hour = 0; this._time.minute = 0; this._time.second = 0; } this.adjust(0, 0, 0, 0); return this; }, adjust: function icaltime_adjust(aExtraDays, aExtraHours, aExtraMinutes, aExtraSeconds, aTime) { var minutesOverflow, hoursOverflow, daysOverflow = 0, yearsOverflow = 0; var second, minute, hour, day; var daysInMonth; var time = aTime || this._time; if (!time.isDate) { second = time.second + aExtraSeconds; time.second = second % 60; minutesOverflow = ICAL3.helpers.trunc(second / 60); if (time.second < 0) { time.second += 60; minutesOverflow--; } minute = time.minute + aExtraMinutes + minutesOverflow; time.minute = minute % 60; hoursOverflow = ICAL3.helpers.trunc(minute / 60); if (time.minute < 0) { time.minute += 60; hoursOverflow--; } hour = time.hour + aExtraHours + hoursOverflow; time.hour = hour % 24; daysOverflow = ICAL3.helpers.trunc(hour / 24); if (time.hour < 0) { time.hour += 24; daysOverflow--; } } if (time.month > 12) { yearsOverflow = ICAL3.helpers.trunc((time.month - 1) / 12); } else if (time.month < 1) { yearsOverflow = ICAL3.helpers.trunc(time.month / 12) - 1; } time.year += yearsOverflow; time.month -= 12 * yearsOverflow; day = time.day + aExtraDays + daysOverflow; if (day > 0) { for (; ; ) { daysInMonth = ICAL3.Time.daysInMonth(time.month, time.year); if (day <= daysInMonth) { break; } time.month++; if (time.month > 12) { time.year++; time.month = 1; } day -= daysInMonth; } } else { while (day <= 0) { if (time.month == 1) { time.year--; time.month = 12; } else { time.month--; } day += ICAL3.Time.daysInMonth(time.month, time.year); } } time.day = day; this._cachedUnixTime = null; return this; }, fromUnixTime: function fromUnixTime(seconds) { this.zone = ICAL3.Timezone.utcTimezone; var epoch = ICAL3.Time.epochTime.clone(); epoch.adjust(0, 0, 0, seconds); this.year = epoch.year; this.month = epoch.month; this.day = epoch.day; this.hour = epoch.hour; this.minute = epoch.minute; this.second = Math.floor(epoch.second); this._cachedUnixTime = null; }, toUnixTime: function toUnixTime() { if (this._cachedUnixTime !== null) { return this._cachedUnixTime; } var offset = this.utcOffset(); var ms = Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second - offset); this._cachedUnixTime = ms / 1e3; return this._cachedUnixTime; }, toJSON: function() { var copy = [ "year", "month", "day", "hour", "minute", "second", "isDate" ]; var result = Object.create(null); var i3 = 0; var len = copy.length; var prop; for (; i3 < len; i3++) { prop = copy[i3]; result[prop] = this[prop]; } if (this.zone) { result.timezone = this.zone.tzid; } return result; } }; (function setupNormalizeAttributes() { function defineAttr(attr) { Object.defineProperty(ICAL3.Time.prototype, attr, { get: function getTimeAttr() { if (this._pendingNormalization) { this._normalize(); this._pendingNormalization = false; } return this._time[attr]; }, set: function setTimeAttr(val) { if (attr === "isDate" && val && !this._time.isDate) { this.adjust(0, 0, 0, 0); } this._cachedUnixTime = null; this._pendingNormalization = true; this._time[attr] = val; return val; } }); } if ("defineProperty" in Object) { defineAttr("year"); defineAttr("month"); defineAttr("day"); defineAttr("hour"); defineAttr("minute"); defineAttr("second"); defineAttr("isDate"); } })(); ICAL3.Time.daysInMonth = function icaltime_daysInMonth(month, year) { var _daysInMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; var days = 30; if (month < 1 || month > 12) return days; days = _daysInMonth[month]; if (month == 2) { days += ICAL3.Time.isLeapYear(year); } return days; }; ICAL3.Time.isLeapYear = function isLeapYear(year) { if (year <= 1752) { return year % 4 == 0; } else { return year % 4 == 0 && year % 100 != 0 || year % 400 == 0; } }; ICAL3.Time.fromDayOfYear = function icaltime_fromDayOfYear(aDayOfYear, aYear) { var year = aYear; var doy = aDayOfYear; var tt = new ICAL3.Time(); tt.auto_normalize = false; var is_leap = ICAL3.Time.isLeapYear(year) ? 1 : 0; if (doy < 1) { year--; is_leap = ICAL3.Time.isLeapYear(year) ? 1 : 0; doy += ICAL3.Time.daysInYearPassedMonth[is_leap][12]; return ICAL3.Time.fromDayOfYear(doy, year); } else if (doy > ICAL3.Time.daysInYearPassedMonth[is_leap][12]) { is_leap = ICAL3.Time.isLeapYear(year) ? 1 : 0; doy -= ICAL3.Time.daysInYearPassedMonth[is_leap][12]; year++; return ICAL3.Time.fromDayOfYear(doy, year); } tt.year = year; tt.isDate = true; for (var month = 11; month >= 0; month--) { if (doy > ICAL3.Time.daysInYearPassedMonth[is_leap][month]) { tt.month = month + 1; tt.day = doy - ICAL3.Time.daysInYearPassedMonth[is_leap][month]; break; } } tt.auto_normalize = true; return tt; }; ICAL3.Time.fromStringv2 = function fromString(str) { return new ICAL3.Time({ year: parseInt(str.substr(0, 4), 10), month: parseInt(str.substr(5, 2), 10), day: parseInt(str.substr(8, 2), 10), isDate: true }); }; ICAL3.Time.fromDateString = function(aValue) { return new ICAL3.Time({ year: ICAL3.helpers.strictParseInt(aValue.substr(0, 4)), month: ICAL3.helpers.strictParseInt(aValue.substr(5, 2)), day: ICAL3.helpers.strictParseInt(aValue.substr(8, 2)), isDate: true }); }; ICAL3.Time.fromDateTimeString = function(aValue, prop) { if (aValue.length < 19) { throw new Error('invalid date-time value: "' + aValue + '"'); } var zone; if (aValue[19] && aValue[19] === "Z") { zone = "Z"; } else if (prop) { zone = prop.getParameter("tzid"); } var time = new ICAL3.Time({ year: ICAL3.helpers.strictParseInt(aValue.substr(0, 4)), month: ICAL3.helpers.strictParseInt(aValue.substr(5, 2)), day: ICAL3.helpers.strictParseInt(aValue.substr(8, 2)), hour: ICAL3.helpers.strictParseInt(aValue.substr(11, 2)), minute: ICAL3.helpers.strictParseInt(aValue.substr(14, 2)), second: ICAL3.helpers.strictParseInt(aValue.substr(17, 2)), timezone: zone }); return time; }; ICAL3.Time.fromString = function fromString(aValue, aProperty) { if (aValue.length > 10) { return ICAL3.Time.fromDateTimeString(aValue, aProperty); } else { return ICAL3.Time.fromDateString(aValue); } }; ICAL3.Time.fromJSDate = function fromJSDate(aDate, useUTC) { var tt = new ICAL3.Time(); return tt.fromJSDate(aDate, useUTC); }; ICAL3.Time.fromData = function fromData(aData, aZone) { var t3 = new ICAL3.Time(); return t3.fromData(aData, aZone); }; ICAL3.Time.now = function icaltime_now() { return ICAL3.Time.fromJSDate(new Date(), false); }; ICAL3.Time.weekOneStarts = function weekOneStarts(aYear, aWeekStart) { var t3 = ICAL3.Time.fromData({ year: aYear, month: 1, day: 1, isDate: true }); var dow = t3.dayOfWeek(); var wkst = aWeekStart || ICAL3.Time.DEFAULT_WEEK_START; if (dow > ICAL3.Time.THURSDAY) { t3.day += 7; } if (wkst > ICAL3.Time.THURSDAY) { t3.day -= 7; } t3.day -= dow - wkst; return t3; }; ICAL3.Time.getDominicalLetter = function(yr) { var LTRS = "GFEDCBA"; var dom = (yr + (yr / 4 | 0) + (yr / 400 | 0) - (yr / 100 | 0) - 1) % 7; var isLeap = ICAL3.Time.isLeapYear(yr); if (isLeap) { return LTRS[(dom + 6) % 7] + LTRS[dom]; } else { return LTRS[dom]; } }; ICAL3.Time.epochTime = ICAL3.Time.fromData({ year: 1970, month: 1, day: 1, hour: 0, minute: 0, second: 0, isDate: false, timezone: "Z" }); ICAL3.Time._cmp_attr = function _cmp_attr(a3, b3, attr) { if (a3[attr] > b3[attr]) return 1; if (a3[attr] < b3[attr]) return -1; return 0; }; ICAL3.Time.daysInYearPassedMonth = [ [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365], [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366] ]; ICAL3.Time.SUNDAY = 1; ICAL3.Time.MONDAY = 2; ICAL3.Time.TUESDAY = 3; ICAL3.Time.WEDNESDAY = 4; ICAL3.Time.THURSDAY = 5; ICAL3.Time.FRIDAY = 6; ICAL3.Time.SATURDAY = 7; ICAL3.Time.DEFAULT_WEEK_START = ICAL3.Time.MONDAY; })(); (function() { ICAL3.VCardTime = function(data, zone, icaltype) { this.wrappedJSObject = this; var time = this._time = Object.create(null); time.year = null; time.month = null; time.day = null; time.hour = null; time.minute = null; time.second = null; this.icaltype = icaltype || "date-and-or-time"; this.fromData(data, zone); }; ICAL3.helpers.inherits(ICAL3.Time, ICAL3.VCardTime, { icalclass: "vcardtime", icaltype: "date-and-or-time", zone: null, clone: function() { return new ICAL3.VCardTime(this._time, this.zone, this.icaltype); }, _normalize: function() { return this; }, utcOffset: function() { if (this.zone instanceof ICAL3.UtcOffset) { return this.zone.toSeconds(); } else { return ICAL3.Time.prototype.utcOffset.apply(this, arguments); } }, toICALString: function() { return ICAL3.design.vcard.value[this.icaltype].toICAL(this.toString()); }, toString: function toString() { var p22 = ICAL3.helpers.pad2; var y3 = this.year, m2 = this.month, d3 = this.day; var h3 = this.hour, mm = this.minute, s3 = this.second; var hasYear = y3 !== null, hasMonth = m2 !== null, hasDay = d3 !== null; var hasHour = h3 !== null, hasMinute = mm !== null, hasSecond = s3 !== null; var datepart = (hasYear ? p22(y3) + (hasMonth || hasDay ? "-" : "") : hasMonth || hasDay ? "--" : "") + (hasMonth ? p22(m2) : "") + (hasDay ? "-" + p22(d3) : ""); var timepart = (hasHour ? p22(h3) : "-") + (hasHour && hasMinute ? ":" : "") + (hasMinute ? p22(mm) : "") + (!hasHour && !hasMinute ? "-" : "") + (hasMinute && hasSecond ? ":" : "") + (hasSecond ? p22(s3) : ""); var zone; if (this.zone === ICAL3.Timezone.utcTimezone) { zone = "Z"; } else if (this.zone instanceof ICAL3.UtcOffset) { zone = this.zone.toString(); } else if (this.zone === ICAL3.Timezone.localTimezone) { zone = ""; } else if (this.zone instanceof ICAL3.Timezone) { var offset = ICAL3.UtcOffset.fromSeconds(this.zone.utcOffset(this)); zone = offset.toString(); } else { zone = ""; } switch (this.icaltype) { case "time": return timepart + zone; case "date-and-or-time": case "date-time": return datepart + (timepart == "--" ? "" : "T" + timepart + zone); case "date": return datepart; } return null; } }); ICAL3.VCardTime.fromDateAndOrTimeString = function(aValue, aIcalType) { function part(v3, s3, e3) { return v3 ? ICAL3.helpers.strictParseInt(v3.substr(s3, e3)) : null; } var parts = aValue.split("T"); var dt = parts[0], tmz = parts[1]; var splitzone = tmz ? ICAL3.design.vcard.value.time._splitZone(tmz) : []; var zone = splitzone[0], tm = splitzone[1]; var stoi = ICAL3.helpers.strictParseInt; var dtlen = dt ? dt.length : 0; var tmlen = tm ? tm.length : 0; var hasDashDate = dt && dt[0] == "-" && dt[1] == "-"; var hasDashTime = tm && tm[0] == "-"; var o2 = { year: hasDashDate ? null : part(dt, 0, 4), month: hasDashDate && (dtlen == 4 || dtlen == 7) ? part(dt, 2, 2) : dtlen == 7 ? part(dt, 5, 2) : dtlen == 10 ? part(dt, 5, 2) : null, day: dtlen == 5 ? part(dt, 3, 2) : dtlen == 7 && hasDashDate ? part(dt, 5, 2) : dtlen == 10 ? part(dt, 8, 2) : null, hour: hasDashTime ? null : part(tm, 0, 2), minute: hasDashTime && tmlen == 3 ? part(tm, 1, 2) : tmlen > 4 ? hasDashTime ? part(tm, 1, 2) : part(tm, 3, 2) : null, second: tmlen == 4 ? part(tm, 2, 2) : tmlen == 6 ? part(tm, 4, 2) : tmlen == 8 ? part(tm, 6, 2) : null }; if (zone == "Z") { zone = ICAL3.Timezone.utcTimezone; } else if (zone && zone[3] == ":") { zone = ICAL3.UtcOffset.fromString(zone); } else { zone = null; } return new ICAL3.VCardTime(o2, zone, aIcalType); }; })(); (function() { var DOW_MAP = { SU: ICAL3.Time.SUNDAY, MO: ICAL3.Time.MONDAY, TU: ICAL3.Time.TUESDAY, WE: ICAL3.Time.WEDNESDAY, TH: ICAL3.Time.THURSDAY, FR: ICAL3.Time.FRIDAY, SA: ICAL3.Time.SATURDAY }; var REVERSE_DOW_MAP = {}; for (var key in DOW_MAP) { if (DOW_MAP.hasOwnProperty(key)) { REVERSE_DOW_MAP[DOW_MAP[key]] = key; } } var COPY_PARTS = [ "BYSECOND", "BYMINUTE", "BYHOUR", "BYDAY", "BYMONTHDAY", "BYYEARDAY", "BYWEEKNO", "BYMONTH", "BYSETPOS" ]; ICAL3.Recur = function icalrecur(data) { this.wrappedJSObject = this; this.parts = {}; if (data && typeof data === "object") { this.fromData(data); } }; ICAL3.Recur.prototype = { parts: null, interval: 1, wkst: ICAL3.Time.MONDAY, until: null, count: null, freq: null, icalclass: "icalrecur", icaltype: "recur", iterator: function(aStart) { return new ICAL3.RecurIterator({ rule: this, dtstart: aStart }); }, clone: function clone() { return new ICAL3.Recur(this.toJSON()); }, isFinite: function isfinite() { return !!(this.count || this.until); }, isByCount: function isbycount() { return !!(this.count && !this.until); }, addComponent: function addPart(aType, aValue) { var ucname = aType.toUpperCase(); if (ucname in this.parts) { this.parts[ucname].push(aValue); } else { this.parts[ucname] = [aValue]; } }, setComponent: function setComponent(aType, aValues) { this.parts[aType.toUpperCase()] = aValues.slice(); }, getComponent: function getComponent(aType) { var ucname = aType.toUpperCase(); return ucname in this.parts ? this.parts[ucname].slice() : []; }, getNextOccurrence: function getNextOccurrence(aStartTime, aRecurrenceId) { var iter = this.iterator(aStartTime); var next, cdt; do { next = iter.next(); } while (next && next.compare(aRecurrenceId) <= 0); if (next && aRecurrenceId.zone) { next.zone = aRecurrenceId.zone; } return next; }, fromData: function(data) { for (var key2 in data) { var uckey = key2.toUpperCase(); if (uckey in partDesign) { if (Array.isArray(data[key2])) { this.parts[uckey] = data[key2]; } else { this.parts[uckey] = [data[key2]]; } } else { this[key2] = data[key2]; } } if (this.interval && typeof this.interval != "number") { optionDesign.INTERVAL(this.interval, this); } if (this.wkst && typeof this.wkst != "number") { this.wkst = ICAL3.Recur.icalDayToNumericDay(this.wkst); } if (this.until && !(this.until instanceof ICAL3.Time)) { this.until = ICAL3.Time.fromString(this.until); } }, toJSON: function() { var res = Object.create(null); res.freq = this.freq; if (this.count) { res.count = this.count; } if (this.interval > 1) { res.interval = this.interval; } for (var k2 in this.parts) { if (!this.parts.hasOwnProperty(k2)) { continue; } var kparts = this.parts[k2]; if (Array.isArray(kparts) && kparts.length == 1) { res[k2.toLowerCase()] = kparts[0]; } else { res[k2.toLowerCase()] = ICAL3.helpers.clone(this.parts[k2]); } } if (this.until) { res.until = this.until.toString(); } if ("wkst" in this && this.wkst !== ICAL3.Time.DEFAULT_WEEK_START) { res.wkst = ICAL3.Recur.numericDayToIcalDay(this.wkst); } return res; }, toString: function icalrecur_toString() { var str = "FREQ=" + this.freq; if (this.count) { str += ";COUNT=" + this.count; } if (this.interval > 1) { str += ";INTERVAL=" + this.interval; } for (var k2 in this.parts) { if (this.parts.hasOwnProperty(k2)) { str += ";" + k2 + "=" + this.parts[k2]; } } if (this.until) { str += ";UNTIL=" + this.until.toICALString(); } if ("wkst" in this && this.wkst !== ICAL3.Time.DEFAULT_WEEK_START) { str += ";WKST=" + ICAL3.Recur.numericDayToIcalDay(this.wkst); } return str; } }; function parseNumericValue(type, min, max, value) { var result = value; if (value[0] === "+") { result = value.substr(1); } result = ICAL3.helpers.strictParseInt(result); if (min !== void 0 && value < min) { throw new Error(type + ': invalid value "' + value + '" must be > ' + min); } if (max !== void 0 && value > max) { throw new Error(type + ': invalid value "' + value + '" must be < ' + min); } return result; } ICAL3.Recur.icalDayToNumericDay = function toNumericDay(string, aWeekStart) { var firstDow = aWeekStart || ICAL3.Time.SUNDAY; return (DOW_MAP[string] - firstDow + 7) % 7 + 1; }; ICAL3.Recur.numericDayToIcalDay = function toIcalDay(num, aWeekStart) { var firstDow = aWeekStart || ICAL3.Time.SUNDAY; var dow = num + firstDow - ICAL3.Time.SUNDAY; if (dow > 7) { dow -= 7; } return REVERSE_DOW_MAP[dow]; }; var VALID_DAY_NAMES = /^(SU|MO|TU|WE|TH|FR|SA)$/; var VALID_BYDAY_PART = /^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/; var ALLOWED_FREQ = [ "SECONDLY", "MINUTELY", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "YEARLY" ]; var optionDesign = { FREQ: function(value, dict, fmtIcal) { if (ALLOWED_FREQ.indexOf(value) !== -1) { dict.freq = value; } else { throw new Error('invalid frequency "' + value + '" expected: "' + ALLOWED_FREQ.join(", ") + '"'); } }, COUNT: function(value, dict, fmtIcal) { dict.count = ICAL3.helpers.strictParseInt(value); }, INTERVAL: function(value, dict, fmtIcal) { dict.interval = ICAL3.helpers.strictParseInt(value); if (dict.interval < 1) { dict.interval = 1; } }, UNTIL: function(value, dict, fmtIcal) { if (value.length > 10) { dict.until = ICAL3.design.icalendar.value["date-time"].fromICAL(value); } else { dict.until = ICAL3.design.icalendar.value.date.fromICAL(value); } if (!fmtIcal) { dict.until = ICAL3.Time.fromString(dict.until); } }, WKST: function(value, dict, fmtIcal) { if (VALID_DAY_NAMES.test(value)) { dict.wkst = ICAL3.Recur.icalDayToNumericDay(value); } else { throw new Error('invalid WKST value "' + value + '"'); } } }; var partDesign = { BYSECOND: parseNumericValue.bind(this, "BYSECOND", 0, 60), BYMINUTE: parseNumericValue.bind(this, "BYMINUTE", 0, 59), BYHOUR: parseNumericValue.bind(this, "BYHOUR", 0, 23), BYDAY: function(value) { if (VALID_BYDAY_PART.test(value)) { return value; } else { throw new Error('invalid BYDAY value "' + value + '"'); } }, BYMONTHDAY: parseNumericValue.bind(this, "BYMONTHDAY", -31, 31), BYYEARDAY: parseNumericValue.bind(this, "BYYEARDAY", -366, 366), BYWEEKNO: parseNumericValue.bind(this, "BYWEEKNO", -53, 53), BYMONTH: parseNumericValue.bind(this, "BYMONTH", 1, 12), BYSETPOS: parseNumericValue.bind(this, "BYSETPOS", -366, 366) }; ICAL3.Recur.fromString = function(string) { var data = ICAL3.Recur._stringToData(string, false); return new ICAL3.Recur(data); }; ICAL3.Recur.fromData = function(aData) { return new ICAL3.Recur(aData); }; ICAL3.Recur._stringToData = function(string, fmtIcal) { var dict = Object.create(null); var values = string.split(";"); var len = values.length; for (var i3 = 0; i3 < len; i3++) { var parts = values[i3].split("="); var ucname = parts[0].toUpperCase(); var lcname = parts[0].toLowerCase(); var name = fmtIcal ? lcname : ucname; var value = parts[1]; if (ucname in partDesign) { var partArr = value.split(","); var partArrIdx = 0; var partArrLen = partArr.length; for (; partArrIdx < partArrLen; partArrIdx++) { partArr[partArrIdx] = partDesign[ucname](partArr[partArrIdx]); } dict[name] = partArr.length == 1 ? partArr[0] : partArr; } else if (ucname in optionDesign) { optionDesign[ucname](value, dict, fmtIcal); } else { dict[lcname] = value; } } return dict; }; })(); ICAL3.RecurIterator = function() { function icalrecur_iterator(options) { this.fromData(options); } icalrecur_iterator.prototype = { completed: false, rule: null, dtstart: null, last: null, occurrence_number: 0, by_indices: null, initialized: false, by_data: null, days: null, days_index: 0, fromData: function(options) { this.rule = ICAL3.helpers.formatClassType(options.rule, ICAL3.Recur); if (!this.rule) { throw new Error("iterator requires a (ICAL.Recur) rule"); } this.dtstart = ICAL3.helpers.formatClassType(options.dtstart, ICAL3.Time); if (!this.dtstart) { throw new Error("iterator requires a (ICAL.Time) dtstart"); } if (options.by_data) { this.by_data = options.by_data; } else { this.by_data = ICAL3.helpers.clone(this.rule.parts, true); } if (options.occurrence_number) this.occurrence_number = options.occurrence_number; this.days = options.days || []; if (options.last) { this.last = ICAL3.helpers.formatClassType(options.last, ICAL3.Time); } this.by_indices = options.by_indices; if (!this.by_indices) { this.by_indices = { "BYSECOND": 0, "BYMINUTE": 0, "BYHOUR": 0, "BYDAY": 0, "BYMONTH": 0, "BYWEEKNO": 0, "BYMONTHDAY": 0 }; } this.initialized = options.initialized || false; if (!this.initialized) { this.init(); } }, init: function icalrecur_iterator_init() { this.initialized = true; this.last = this.dtstart.clone(); var parts = this.by_data; if ("BYDAY" in parts) { this.sort_byday_rules(parts.BYDAY); } if ("BYYEARDAY" in parts) { if ("BYMONTH" in parts || "BYWEEKNO" in parts || "BYMONTHDAY" in parts || "BYDAY" in parts) { throw new Error("Invalid BYYEARDAY rule"); } } if ("BYWEEKNO" in parts && "BYMONTHDAY" in parts) { throw new Error("BYWEEKNO does not fit to BYMONTHDAY"); } if (this.rule.freq == "MONTHLY" && ("BYYEARDAY" in parts || "BYWEEKNO" in parts)) { throw new Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear"); } if (this.rule.freq == "WEEKLY" && ("BYYEARDAY" in parts || "BYMONTHDAY" in parts)) { throw new Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear"); } if (this.rule.freq != "YEARLY" && "BYYEARDAY" in parts) { throw new Error("BYYEARDAY may only appear in YEARLY rules"); } this.last.second = this.setup_defaults("BYSECOND", "SECONDLY", this.dtstart.second); this.last.minute = this.setup_defaults("BYMINUTE", "MINUTELY", this.dtstart.minute); this.last.hour = this.setup_defaults("BYHOUR", "HOURLY", this.dtstart.hour); this.last.day = this.setup_defaults("BYMONTHDAY", "DAILY", this.dtstart.day); this.last.month = this.setup_defaults("BYMONTH", "MONTHLY", this.dtstart.month); if (this.rule.freq == "WEEKLY") { if ("BYDAY" in parts) { var bydayParts = this.ruleDayOfWeek(parts.BYDAY[0], this.rule.wkst); var pos = bydayParts[0]; var dow = bydayParts[1]; var wkdy = dow - this.last.dayOfWeek(this.rule.wkst); if (this.last.dayOfWeek(this.rule.wkst) < dow && wkdy >= 0 || wkdy < 0) { this.last.day += wkdy; } } else { var dayName = ICAL3.Recur.numericDayToIcalDay(this.dtstart.dayOfWeek()); parts.BYDAY = [dayName]; } } if (this.rule.freq == "YEARLY") { for (; ; ) { this.expand_year_days(this.last.year); if (this.days.length > 0) { break; } this.increment_year(this.rule.interval); } this._nextByYearDay(); } if (this.rule.freq == "MONTHLY" && this.has_by_data("BYDAY")) { var tempLast = null; var initLast = this.last.clone(); var daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); for (var i3 in this.by_data.BYDAY) { if (!this.by_data.BYDAY.hasOwnProperty(i3)) { continue; } this.last = initLast.clone(); var bydayParts = this.ruleDayOfWeek(this.by_data.BYDAY[i3]); var pos = bydayParts[0]; var dow = bydayParts[1]; var dayOfMonth = this.last.nthWeekDay(dow, pos); if (pos >= 6 || pos <= -6) { throw new Error("Malformed values in BYDAY part"); } if (dayOfMonth > daysInMonth || dayOfMonth <= 0) { if (tempLast && tempLast.month == initLast.month) { continue; } while (dayOfMonth > daysInMonth || dayOfMonth <= 0) { this.increment_month(); daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); dayOfMonth = this.last.nthWeekDay(dow, pos); } } this.last.day = dayOfMonth; if (!tempLast || this.last.compare(tempLast) < 0) { tempLast = this.last.clone(); } } this.last = tempLast.clone(); if (this.has_by_data("BYMONTHDAY")) { this._byDayAndMonthDay(true); } if (this.last.day > daysInMonth || this.last.day == 0) { throw new Error("Malformed values in BYDAY part"); } } else if (this.has_by_data("BYMONTHDAY")) { if (this.last.day < 0) { var daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); this.last.day = daysInMonth + this.last.day + 1; } } }, next: function icalrecur_iterator_next() { var before = this.last ? this.last.clone() : null; if (this.rule.count && this.occurrence_number >= this.rule.count || this.rule.until && this.last.compare(this.rule.until) > 0) { this.completed = true; return null; } if (this.occurrence_number == 0 && this.last.compare(this.dtstart) >= 0) { this.occurrence_number++; return this.last; } var valid; do { valid = 1; switch (this.rule.freq) { case "SECONDLY": this.next_second(); break; case "MINUTELY": this.next_minute(); break; case "HOURLY": this.next_hour(); break; case "DAILY": this.next_day(); break; case "WEEKLY": this.next_week(); break; case "MONTHLY": valid = this.next_month(); break; case "YEARLY": this.next_year(); break; default: return null; } } while (!this.check_contracting_rules() || this.last.compare(this.dtstart) < 0 || !valid); if (this.last.compare(before) == 0) { throw new Error("Same occurrence found twice, protecting you from death by recursion"); } if (this.rule.until && this.last.compare(this.rule.until) > 0) { this.completed = true; return null; } else { this.occurrence_number++; return this.last; } }, next_second: function next_second() { return this.next_generic("BYSECOND", "SECONDLY", "second", "minute"); }, increment_second: function increment_second(inc) { return this.increment_generic(inc, "second", 60, "minute"); }, next_minute: function next_minute() { return this.next_generic("BYMINUTE", "MINUTELY", "minute", "hour", "next_second"); }, increment_minute: function increment_minute(inc) { return this.increment_generic(inc, "minute", 60, "hour"); }, next_hour: function next_hour() { return this.next_generic("BYHOUR", "HOURLY", "hour", "monthday", "next_minute"); }, increment_hour: function increment_hour(inc) { this.increment_generic(inc, "hour", 24, "monthday"); }, next_day: function next_day() { var has_by_day = "BYDAY" in this.by_data; var this_freq = this.rule.freq == "DAILY"; if (this.next_hour() == 0) { return 0; } if (this_freq) { this.increment_monthday(this.rule.interval); } else { this.increment_monthday(1); } return 0; }, next_week: function next_week() { var end_of_data = 0; if (this.next_weekday_by_week() == 0) { return end_of_data; } if (this.has_by_data("BYWEEKNO")) { var idx = ++this.by_indices.BYWEEKNO; if (this.by_indices.BYWEEKNO == this.by_data.BYWEEKNO.length) { this.by_indices.BYWEEKNO = 0; end_of_data = 1; } this.last.month = 1; this.last.day = 1; var week_no = this.by_data.BYWEEKNO[this.by_indices.BYWEEKNO]; this.last.day += 7 * week_no; if (end_of_data) { this.increment_year(1); } } else { this.increment_monthday(7 * this.rule.interval); } return end_of_data; }, normalizeByMonthDayRules: function(year, month, rules) { var daysInMonth = ICAL3.Time.daysInMonth(month, year); var newRules = []; var ruleIdx = 0; var len = rules.length; var rule; for (; ruleIdx < len; ruleIdx++) { rule = rules[ruleIdx]; if (Math.abs(rule) > daysInMonth) { continue; } if (rule < 0) { rule = daysInMonth + (rule + 1); } else if (rule === 0) { continue; } if (newRules.indexOf(rule) === -1) { newRules.push(rule); } } return newRules.sort(function(a3, b3) { return a3 - b3; }); }, _byDayAndMonthDay: function(isInit) { var byMonthDay; var byDay = this.by_data.BYDAY; var date; var dateIdx = 0; var dateLen; var dayLen = byDay.length; var dataIsValid = 0; var daysInMonth; var self2 = this; var lastDay = this.last.day; function initMonth() { daysInMonth = ICAL3.Time.daysInMonth(self2.last.month, self2.last.year); byMonthDay = self2.normalizeByMonthDayRules(self2.last.year, self2.last.month, self2.by_data.BYMONTHDAY); dateLen = byMonthDay.length; while (byMonthDay[dateIdx] <= lastDay && !(isInit && byMonthDay[dateIdx] == lastDay) && dateIdx < dateLen - 1) { dateIdx++; } } function nextMonth() { lastDay = 0; self2.increment_month(); dateIdx = 0; initMonth(); } initMonth(); if (isInit) { lastDay -= 1; } var monthsCounter = 48; while (!dataIsValid && monthsCounter) { monthsCounter--; date = lastDay + 1; if (date > daysInMonth) { nextMonth(); continue; } var next = byMonthDay[dateIdx++]; if (next >= date) { lastDay = next; } else { nextMonth(); continue; } for (var dayIdx = 0; dayIdx < dayLen; dayIdx++) { var parts = this.ruleDayOfWeek(byDay[dayIdx]); var pos = parts[0]; var dow = parts[1]; this.last.day = lastDay; if (this.last.isNthWeekDay(dow, pos)) { dataIsValid = 1; break; } } if (!dataIsValid && dateIdx === dateLen) { nextMonth(); continue; } } if (monthsCounter <= 0) { throw new Error("Malformed values in BYDAY combined with BYMONTHDAY parts"); } return dataIsValid; }, next_month: function next_month() { var this_freq = this.rule.freq == "MONTHLY"; var data_valid = 1; if (this.next_hour() == 0) { return data_valid; } if (this.has_by_data("BYDAY") && this.has_by_data("BYMONTHDAY")) { data_valid = this._byDayAndMonthDay(); } else if (this.has_by_data("BYDAY")) { var daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); var setpos = 0; var setpos_total = 0; if (this.has_by_data("BYSETPOS")) { var last_day = this.last.day; for (var day = 1; day <= daysInMonth; day++) { this.last.day = day; if (this.is_day_in_byday(this.last)) { setpos_total++; if (day <= last_day) { setpos++; } } } this.last.day = last_day; } data_valid = 0; for (var day = this.last.day + 1; day <= daysInMonth; day++) { this.last.day = day; if (this.is_day_in_byday(this.last)) { if (!this.has_by_data("BYSETPOS") || this.check_set_position(++setpos) || this.check_set_position(setpos - setpos_total - 1)) { data_valid = 1; break; } } } if (day > daysInMonth) { this.last.day = 1; this.increment_month(); if (this.is_day_in_byday(this.last)) { if (!this.has_by_data("BYSETPOS") || this.check_set_position(1)) { data_valid = 1; } } else { data_valid = 0; } } } else if (this.has_by_data("BYMONTHDAY")) { this.by_indices.BYMONTHDAY++; if (this.by_indices.BYMONTHDAY >= this.by_data.BYMONTHDAY.length) { this.by_indices.BYMONTHDAY = 0; this.increment_month(); } var daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); var day = this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY]; if (day < 0) { day = daysInMonth + day + 1; } if (day > daysInMonth) { this.last.day = 1; data_valid = this.is_day_in_byday(this.last); } else { this.last.day = day; } } else { this.increment_month(); var daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); if (this.by_data.BYMONTHDAY[0] > daysInMonth) { data_valid = 0; } else { this.last.day = this.by_data.BYMONTHDAY[0]; } } return data_valid; }, next_weekday_by_week: function next_weekday_by_week() { var end_of_data = 0; if (this.next_hour() == 0) { return end_of_data; } if (!this.has_by_data("BYDAY")) { return 1; } for (; ; ) { var tt = new ICAL3.Time(); this.by_indices.BYDAY++; if (this.by_indices.BYDAY == Object.keys(this.by_data.BYDAY).length) { this.by_indices.BYDAY = 0; end_of_data = 1; } var coded_day = this.by_data.BYDAY[this.by_indices.BYDAY]; var parts = this.ruleDayOfWeek(coded_day); var dow = parts[1]; dow -= this.rule.wkst; if (dow < 0) { dow += 7; } tt.year = this.last.year; tt.month = this.last.month; tt.day = this.last.day; var startOfWeek = tt.startDoyWeek(this.rule.wkst); if (dow + startOfWeek < 1) { if (!end_of_data) { continue; } } var next = ICAL3.Time.fromDayOfYear(startOfWeek + dow, this.last.year); this.last.year = next.year; this.last.month = next.month; this.last.day = next.day; return end_of_data; } }, next_year: function next_year() { if (this.next_hour() == 0) { return 0; } if (++this.days_index == this.days.length) { this.days_index = 0; do { this.increment_year(this.rule.interval); this.expand_year_days(this.last.year); } while (this.days.length == 0); } this._nextByYearDay(); return 1; }, _nextByYearDay: function _nextByYearDay() { var doy = this.days[this.days_index]; var year = this.last.year; if (doy < 1) { doy += 1; year += 1; } var next = ICAL3.Time.fromDayOfYear(doy, year); this.last.day = next.day; this.last.month = next.month; }, ruleDayOfWeek: function ruleDayOfWeek(dow, aWeekStart) { var matches = dow.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/); if (matches) { var pos = parseInt(matches[1] || 0, 10); dow = ICAL3.Recur.icalDayToNumericDay(matches[2], aWeekStart); return [pos, dow]; } else { return [0, 0]; } }, next_generic: function next_generic(aRuleType, aInterval, aDateAttr, aFollowingAttr, aPreviousIncr) { var has_by_rule = aRuleType in this.by_data; var this_freq = this.rule.freq == aInterval; var end_of_data = 0; if (aPreviousIncr && this[aPreviousIncr]() == 0) { return end_of_data; } if (has_by_rule) { this.by_indices[aRuleType]++; var idx = this.by_indices[aRuleType]; var dta = this.by_data[aRuleType]; if (this.by_indices[aRuleType] == dta.length) { this.by_indices[aRuleType] = 0; end_of_data = 1; } this.last[aDateAttr] = dta[this.by_indices[aRuleType]]; } else if (this_freq) { this["increment_" + aDateAttr](this.rule.interval); } if (has_by_rule && end_of_data && this_freq) { this["increment_" + aFollowingAttr](1); } return end_of_data; }, increment_monthday: function increment_monthday(inc) { for (var i3 = 0; i3 < inc; i3++) { var daysInMonth = ICAL3.Time.daysInMonth(this.last.month, this.last.year); this.last.day++; if (this.last.day > daysInMonth) { this.last.day -= daysInMonth; this.increment_month(); } } }, increment_month: function increment_month() { this.last.day = 1; if (this.has_by_data("BYMONTH")) { this.by_indices.BYMONTH++; if (this.by_indices.BYMONTH == this.by_data.BYMONTH.length) { this.by_indices.BYMONTH = 0; this.increment_year(1); } this.last.month = this.by_data.BYMONTH[this.by_indices.BYMONTH]; } else { if (this.rule.freq == "MONTHLY") { this.last.month += this.rule.interval; } else { this.last.month++; } this.last.month--; var years = ICAL3.helpers.trunc(this.last.month / 12); this.last.month %= 12; this.last.month++; if (years != 0) { this.increment_year(years); } } }, increment_year: function increment_year(inc) { this.last.year += inc; }, increment_generic: function increment_generic(inc, aDateAttr, aFactor, aNextIncrement) { this.last[aDateAttr] += inc; var nextunit = ICAL3.helpers.trunc(this.last[aDateAttr] / aFactor); this.last[aDateAttr] %= aFactor; if (nextunit != 0) { this["increment_" + aNextIncrement](nextunit); } }, has_by_data: function has_by_data(aRuleType) { return aRuleType in this.rule.parts; }, expand_year_days: function expand_year_days(aYear) { var t3 = new ICAL3.Time(); this.days = []; var parts = {}; var rules = ["BYDAY", "BYWEEKNO", "BYMONTHDAY", "BYMONTH", "BYYEARDAY"]; for (var p3 in rules) { if (rules.hasOwnProperty(p3)) { var part = rules[p3]; if (part in this.rule.parts) { parts[part] = this.rule.parts[part]; } } } if ("BYMONTH" in parts && "BYWEEKNO" in parts) { var valid = 1; var validWeeks = {}; t3.year = aYear; t3.isDate = true; for (var monthIdx = 0; monthIdx < this.by_data.BYMONTH.length; monthIdx++) { var month = this.by_data.BYMONTH[monthIdx]; t3.month = month; t3.day = 1; var first_week = t3.weekNumber(this.rule.wkst); t3.day = ICAL3.Time.daysInMonth(month, aYear); var last_week = t3.weekNumber(this.rule.wkst); for (monthIdx = first_week; monthIdx < last_week; monthIdx++) { validWeeks[monthIdx] = 1; } } for (var weekIdx = 0; weekIdx < this.by_data.BYWEEKNO.length && valid; weekIdx++) { var weekno = this.by_data.BYWEEKNO[weekIdx]; if (weekno < 52) { valid &= validWeeks[weekIdx]; } else { valid = 0; } } if (valid) { delete parts.BYMONTH; } else { delete parts.BYWEEKNO; } } var partCount = Object.keys(parts).length; if (partCount == 0) { var t1 = this.dtstart.clone(); t1.year = this.last.year; this.days.push(t1.dayOfYear()); } else if (partCount == 1 && "BYMONTH" in parts) { for (var monthkey in this.by_data.BYMONTH) { if (!this.by_data.BYMONTH.hasOwnProperty(monthkey)) { continue; } var t22 = this.dtstart.clone(); t22.year = aYear; t22.month = this.by_data.BYMONTH[monthkey]; t22.isDate = true; this.days.push(t22.dayOfYear()); } } else if (partCount == 1 && "BYMONTHDAY" in parts) { for (var monthdaykey in this.by_data.BYMONTHDAY) { if (!this.by_data.BYMONTHDAY.hasOwnProperty(monthdaykey)) { continue; } var t32 = this.dtstart.clone(); var day_ = this.by_data.BYMONTHDAY[monthdaykey]; if (day_ < 0) { var daysInMonth = ICAL3.Time.daysInMonth(t32.month, aYear); day_ = day_ + daysInMonth + 1; } t32.day = day_; t32.year = aYear; t32.isDate = true; this.days.push(t32.dayOfYear()); } } else if (partCount == 2 && "BYMONTHDAY" in parts && "BYMONTH" in parts) { for (var monthkey in this.by_data.BYMONTH) { if (!this.by_data.BYMONTH.hasOwnProperty(monthkey)) { continue; } var month_ = this.by_data.BYMONTH[monthkey]; var daysInMonth = ICAL3.Time.daysInMonth(month_, aYear); for (var monthdaykey in this.by_data.BYMONTHDAY) { if (!this.by_data.BYMONTHDAY.hasOwnProperty(monthdaykey)) { continue; } var day_ = this.by_data.BYMONTHDAY[monthdaykey]; if (day_ < 0) { day_ = day_ + daysInMonth + 1; } t3.day = day_; t3.month = month_; t3.year = aYear; t3.isDate = true; this.days.push(t3.dayOfYear()); } } } else if (partCount == 1 && "BYWEEKNO" in parts) { } else if (partCount == 2 && "BYWEEKNO" in parts && "BYMONTHDAY" in parts) { } else if (partCount == 1 && "BYDAY" in parts) { this.days = this.days.concat(this.expand_by_day(aYear)); } else if (partCount == 2 && "BYDAY" in parts && "BYMONTH" in parts) { for (var monthkey in this.by_data.BYMONTH) { if (!this.by_data.BYMONTH.hasOwnProperty(monthkey)) { continue; } var month = this.by_data.BYMONTH[monthkey]; var daysInMonth = ICAL3.Time.daysInMonth(month, aYear); t3.year = aYear; t3.month = this.by_data.BYMONTH[monthkey]; t3.day = 1; t3.isDate = true; var first_dow = t3.dayOfWeek(); var doy_offset = t3.dayOfYear() - 1; t3.day = daysInMonth; var last_dow = t3.dayOfWeek(); if (this.has_by_data("BYSETPOS")) { var set_pos_counter = 0; var by_month_day = []; for (var day = 1; day <= daysInMonth; day++) { t3.day = day; if (this.is_day_in_byday(t3)) { by_month_day.push(day); } } for (var spIndex = 0; spIndex < by_month_day.length; spIndex++) { if (this.check_set_position(spIndex + 1) || this.check_set_position(spIndex - by_month_day.length)) { this.days.push(doy_offset + by_month_day[spIndex]); } } } else { for (var daycodedkey in this.by_data.BYDAY) { if (!this.by_data.BYDAY.hasOwnProperty(daycodedkey)) { continue; } var coded_day = this.by_data.BYDAY[daycodedkey]; var bydayParts = this.ruleDayOfWeek(coded_day); var pos = bydayParts[0]; var dow = bydayParts[1]; var month_day; var first_matching_day = (dow + 7 - first_dow) % 7 + 1; var last_matching_day = daysInMonth - (last_dow + 7 - dow) % 7; if (pos == 0) { for (var day = first_matching_day; day <= daysInMonth; day += 7) { this.days.push(doy_offset + day); } } else if (pos > 0) { month_day = first_matching_day + (pos - 1) * 7; if (month_day <= daysInMonth) { this.days.push(doy_offset + month_day); } } else { month_day = last_matching_day + (pos + 1) * 7; if (month_day > 0) { this.days.push(doy_offset + month_day); } } } } } this.days.sort(function(a3, b3) { return a3 - b3; }); } else if (partCount == 2 && "BYDAY" in parts && "BYMONTHDAY" in parts) { var expandedDays = this.expand_by_day(aYear); for (var daykey in expandedDays) { if (!expandedDays.hasOwnProperty(daykey)) { continue; } var day = expandedDays[daykey]; var tt = ICAL3.Time.fromDayOfYear(day, aYear); if (this.by_data.BYMONTHDAY.indexOf(tt.day) >= 0) { this.days.push(day); } } } else if (partCount == 3 && "BYDAY" in parts && "BYMONTHDAY" in parts && "BYMONTH" in parts) { var expandedDays = this.expand_by_day(aYear); for (var daykey in expandedDays) { if (!expandedDays.hasOwnProperty(daykey)) { continue; } var day = expandedDays[daykey]; var tt = ICAL3.Time.fromDayOfYear(day, aYear); if (this.by_data.BYMONTH.indexOf(tt.month) >= 0 && this.by_data.BYMONTHDAY.indexOf(tt.day) >= 0) { this.days.push(day); } } } else if (partCount == 2 && "BYDAY" in parts && "BYWEEKNO" in parts) { var expandedDays = this.expand_by_day(aYear); for (var daykey in expandedDays) { if (!expandedDays.hasOwnProperty(daykey)) { continue; } var day = expandedDays[daykey]; var tt = ICAL3.Time.fromDayOfYear(day, aYear); var weekno = tt.weekNumber(this.rule.wkst); if (this.by_data.BYWEEKNO.indexOf(weekno)) { this.days.push(day); } } } else if (partCount == 3 && "BYDAY" in parts && "BYWEEKNO" in parts && "BYMONTHDAY" in parts) { } else if (partCount == 1 && "BYYEARDAY" in parts) { this.days = this.days.concat(this.by_data.BYYEARDAY); } else { this.days = []; } return 0; }, expand_by_day: function expand_by_day(aYear) { var days_list = []; var tmp = this.last.clone(); tmp.year = aYear; tmp.month = 1; tmp.day = 1; tmp.isDate = true; var start_dow = tmp.dayOfWeek(); tmp.month = 12; tmp.day = 31; tmp.isDate = true; var end_dow = tmp.dayOfWeek(); var end_year_day = tmp.dayOfYear(); for (var daykey in this.by_data.BYDAY) { if (!this.by_data.BYDAY.hasOwnProperty(daykey)) { continue; } var day = this.by_data.BYDAY[daykey]; var parts = this.ruleDayOfWeek(day); var pos = parts[0]; var dow = parts[1]; if (pos == 0) { var tmp_start_doy = (dow + 7 - start_dow) % 7 + 1; for (var doy = tmp_start_doy; doy <= end_year_day; doy += 7) { days_list.push(doy); } } else if (pos > 0) { var first; if (dow >= start_dow) { first = dow - start_dow + 1; } else { first = dow - start_dow + 8; } days_list.push(first + (pos - 1) * 7); } else { var last; pos = -pos; if (dow <= end_dow) { last = end_year_day - end_dow + dow; } else { last = end_year_day - end_dow + dow - 7; } days_list.push(last - (pos - 1) * 7); } } return days_list; }, is_day_in_byday: function is_day_in_byday(tt) { for (var daykey in this.by_data.BYDAY) { if (!this.by_data.BYDAY.hasOwnProperty(daykey)) { continue; } var day = this.by_data.BYDAY[daykey]; var parts = this.ruleDayOfWeek(day); var pos = parts[0]; var dow = parts[1]; var this_dow = tt.dayOfWeek(); if (pos == 0 && dow == this_dow || tt.nthWeekDay(dow, pos) == tt.day) { return 1; } } return 0; }, check_set_position: function check_set_position(aPos) { if (this.has_by_data("BYSETPOS")) { var idx = this.by_data.BYSETPOS.indexOf(aPos); return idx !== -1; } return false; }, sort_byday_rules: function icalrecur_sort_byday_rules(aRules) { for (var i3 = 0; i3 < aRules.length; i3++) { for (var j4 = 0; j4 < i3; j4++) { var one = this.ruleDayOfWeek(aRules[j4], this.rule.wkst)[1]; var two = this.ruleDayOfWeek(aRules[i3], this.rule.wkst)[1]; if (one > two) { var tmp = aRules[i3]; aRules[i3] = aRules[j4]; aRules[j4] = tmp; } } } }, check_contract_restriction: function check_contract_restriction(aRuleType, v3) { var indexMapValue = icalrecur_iterator._indexMap[aRuleType]; var ruleMapValue = icalrecur_iterator._expandMap[this.rule.freq][indexMapValue]; var pass = false; if (aRuleType in this.by_data && ruleMapValue == icalrecur_iterator.CONTRACT) { var ruleType = this.by_data[aRuleType]; for (var bydatakey in ruleType) { if (ruleType.hasOwnProperty(bydatakey)) { if (ruleType[bydatakey] == v3) { pass = true; break; } } } } else { pass = true; } return pass; }, check_contracting_rules: function check_contracting_rules() { var dow = this.last.dayOfWeek(); var weekNo = this.last.weekNumber(this.rule.wkst); var doy = this.last.dayOfYear(); return this.check_contract_restriction("BYSECOND", this.last.second) && this.check_contract_restriction("BYMINUTE", this.last.minute) && this.check_contract_restriction("BYHOUR", this.last.hour) && this.check_contract_restriction("BYDAY", ICAL3.Recur.numericDayToIcalDay(dow)) && this.check_contract_restriction("BYWEEKNO", weekNo) && this.check_contract_restriction("BYMONTHDAY", this.last.day) && this.check_contract_restriction("BYMONTH", this.last.month) && this.check_contract_restriction("BYYEARDAY", doy); }, setup_defaults: function setup_defaults(aRuleType, req, deftime) { var indexMapValue = icalrecur_iterator._indexMap[aRuleType]; var ruleMapValue = icalrecur_iterator._expandMap[this.rule.freq][indexMapValue]; if (ruleMapValue != icalrecur_iterator.CONTRACT) { if (!(aRuleType in this.by_data)) { this.by_data[aRuleType] = [deftime]; } if (this.rule.freq != req) { return this.by_data[aRuleType][0]; } } return deftime; }, toJSON: function() { var result = Object.create(null); result.initialized = this.initialized; result.rule = this.rule.toJSON(); result.dtstart = this.dtstart.toJSON(); result.by_data = this.by_data; result.days = this.days; result.last = this.last.toJSON(); result.by_indices = this.by_indices; result.occurrence_number = this.occurrence_number; return result; } }; icalrecur_iterator._indexMap = { "BYSECOND": 0, "BYMINUTE": 1, "BYHOUR": 2, "BYDAY": 3, "BYMONTHDAY": 4, "BYYEARDAY": 5, "BYWEEKNO": 6, "BYMONTH": 7, "BYSETPOS": 8 }; icalrecur_iterator._expandMap = { "SECONDLY": [1, 1, 1, 1, 1, 1, 1, 1], "MINUTELY": [2, 1, 1, 1, 1, 1, 1, 1], "HOURLY": [2, 2, 1, 1, 1, 1, 1, 1], "DAILY": [2, 2, 2, 1, 1, 1, 1, 1], "WEEKLY": [2, 2, 2, 2, 3, 3, 1, 1], "MONTHLY": [2, 2, 2, 2, 2, 3, 3, 1], "YEARLY": [2, 2, 2, 2, 2, 2, 2, 2] }; icalrecur_iterator.UNKNOWN = 0; icalrecur_iterator.CONTRACT = 1; icalrecur_iterator.EXPAND = 2; icalrecur_iterator.ILLEGAL = 3; return icalrecur_iterator; }(); ICAL3.RecurExpansion = function() { function formatTime(item) { return ICAL3.helpers.formatClassType(item, ICAL3.Time); } function compareTime(a3, b3) { return a3.compare(b3); } function isRecurringComponent(comp) { return comp.hasProperty("rdate") || comp.hasProperty("rrule") || comp.hasProperty("recurrence-id"); } function RecurExpansion(options) { this.ruleDates = []; this.exDates = []; this.fromData(options); } RecurExpansion.prototype = { complete: false, ruleIterators: null, ruleDates: null, exDates: null, ruleDateInc: 0, exDateInc: 0, exDate: null, ruleDate: null, dtstart: null, last: null, fromData: function(options) { var start = ICAL3.helpers.formatClassType(options.dtstart, ICAL3.Time); if (!start) { throw new Error(".dtstart (ICAL.Time) must be given"); } else { this.dtstart = start; } if (options.component) { this._init(options.component); } else { this.last = formatTime(options.last) || start.clone(); if (!options.ruleIterators) { throw new Error(".ruleIterators or .component must be given"); } this.ruleIterators = options.ruleIterators.map(function(item) { return ICAL3.helpers.formatClassType(item, ICAL3.RecurIterator); }); this.ruleDateInc = options.ruleDateInc; this.exDateInc = options.exDateInc; if (options.ruleDates) { this.ruleDates = options.ruleDates.map(formatTime); this.ruleDate = this.ruleDates[this.ruleDateInc]; } if (options.exDates) { this.exDates = options.exDates.map(formatTime); this.exDate = this.exDates[this.exDateInc]; } if (typeof options.complete !== "undefined") { this.complete = options.complete; } } }, next: function() { var iter; var ruleOfDay; var next; var compare; var maxTries = 500; var currentTry = 0; while (true) { if (currentTry++ > maxTries) { throw new Error("max tries have occured, rule may be impossible to forfill."); } next = this.ruleDate; iter = this._nextRecurrenceIter(this.last); if (!next && !iter) { this.complete = true; break; } if (!next || iter && next.compare(iter.last) > 0) { next = iter.last.clone(); iter.next(); } if (this.ruleDate === next) { this._nextRuleDay(); } this.last = next; if (this.exDate) { compare = this.exDate.compare(this.last); if (compare < 0) { this._nextExDay(); } if (compare === 0) { this._nextExDay(); continue; } } return this.last; } }, toJSON: function() { function toJSON(item) { return item.toJSON(); } var result = Object.create(null); result.ruleIterators = this.ruleIterators.map(toJSON); if (this.ruleDates) { result.ruleDates = this.ruleDates.map(toJSON); } if (this.exDates) { result.exDates = this.exDates.map(toJSON); } result.ruleDateInc = this.ruleDateInc; result.exDateInc = this.exDateInc; result.last = this.last.toJSON(); result.dtstart = this.dtstart.toJSON(); result.complete = this.complete; return result; }, _extractDates: function(component, propertyName) { function handleProp(prop2) { idx = ICAL3.helpers.binsearchInsert(result, prop2, compareTime); result.splice(idx, 0, prop2); } var result = []; var props = component.getAllProperties(propertyName); var len = props.length; var i3 = 0; var prop; var idx; for (; i3 < len; i3++) { props[i3].getValues().forEach(handleProp); } return result; }, _init: function(component) { this.ruleIterators = []; this.last = this.dtstart.clone(); if (!isRecurringComponent(component)) { this.ruleDate = this.last.clone(); this.complete = true; return; } if (component.hasProperty("rdate")) { this.ruleDates = this._extractDates(component, "rdate"); if (this.ruleDates[0] && this.ruleDates[0].compare(this.dtstart) < 0) { this.ruleDateInc = 0; this.last = this.ruleDates[0].clone(); } else { this.ruleDateInc = ICAL3.helpers.binsearchInsert(this.ruleDates, this.last, compareTime); } this.ruleDate = this.ruleDates[this.ruleDateInc]; } if (component.hasProperty("rrule")) { var rules = component.getAllProperties("rrule"); var i3 = 0; var len = rules.length; var rule; var iter; for (; i3 < len; i3++) { rule = rules[i3].getFirstValue(); iter = rule.iterator(this.dtstart); this.ruleIterators.push(iter); iter.next(); } } if (component.hasProperty("exdate")) { this.exDates = this._extractDates(component, "exdate"); this.exDateInc = ICAL3.helpers.binsearchInsert(this.exDates, this.last, compareTime); this.exDate = this.exDates[this.exDateInc]; } }, _nextExDay: function() { this.exDate = this.exDates[++this.exDateInc]; }, _nextRuleDay: function() { this.ruleDate = this.ruleDates[++this.ruleDateInc]; }, _nextRecurrenceIter: function() { var iters = this.ruleIterators; if (iters.length === 0) { return null; } var len = iters.length; var iter; var iterTime; var iterIdx = 0; var chosenIter; for (; iterIdx < len; iterIdx++) { iter = iters[iterIdx]; iterTime = iter.last; if (iter.completed) { len--; if (iterIdx !== 0) { iterIdx--; } iters.splice(iterIdx, 1); continue; } if (!chosenIter || chosenIter.last.compare(iterTime) > 0) { chosenIter = iter; } } return chosenIter; } }; return RecurExpansion; }(); ICAL3.Event = function() { function Event3(component, options) { if (!(component instanceof ICAL3.Component)) { options = component; component = null; } if (component) { this.component = component; } else { this.component = new ICAL3.Component("vevent"); } this._rangeExceptionCache = Object.create(null); this.exceptions = Object.create(null); this.rangeExceptions = []; if (options && options.strictExceptions) { this.strictExceptions = options.strictExceptions; } if (options && options.exceptions) { options.exceptions.forEach(this.relateException, this); } else if (this.component.parent && !this.isRecurrenceException()) { this.component.parent.getAllSubcomponents("vevent").forEach(function(event) { if (event.hasProperty("recurrence-id")) { this.relateException(event); } }, this); } } Event3.prototype = { THISANDFUTURE: "THISANDFUTURE", exceptions: null, strictExceptions: false, relateException: function(obj) { if (this.isRecurrenceException()) { throw new Error("cannot relate exception to exceptions"); } if (obj instanceof ICAL3.Component) { obj = new ICAL3.Event(obj); } if (this.strictExceptions && obj.uid !== this.uid) { throw new Error("attempted to relate unrelated exception"); } var id = obj.recurrenceId.toString(); this.exceptions[id] = obj; if (obj.modifiesFuture()) { var item = [ obj.recurrenceId.toUnixTime(), id ]; var idx = ICAL3.helpers.binsearchInsert(this.rangeExceptions, item, compareRangeException); this.rangeExceptions.splice(idx, 0, item); } }, modifiesFuture: function() { if (!this.component.hasProperty("recurrence-id")) { return false; } var range = this.component.getFirstProperty("recurrence-id").getParameter("range"); return range === this.THISANDFUTURE; }, findRangeException: function(time) { if (!this.rangeExceptions.length) { return null; } var utc = time.toUnixTime(); var idx = ICAL3.helpers.binsearchInsert(this.rangeExceptions, [utc], compareRangeException); idx -= 1; if (idx < 0) { return null; } var rangeItem = this.rangeExceptions[idx]; if (utc < rangeItem[0]) { return null; } return rangeItem[1]; }, getOccurrenceDetails: function(occurrence) { var id = occurrence.toString(); var utcId = occurrence.convertToZone(ICAL3.Timezone.utcTimezone).toString(); var item; var result = { recurrenceId: occurrence }; if (id in this.exceptions) { item = result.item = this.exceptions[id]; result.startDate = item.startDate; result.endDate = item.endDate; result.item = item; } else if (utcId in this.exceptions) { item = this.exceptions[utcId]; result.startDate = item.startDate; result.endDate = item.endDate; result.item = item; } else { var rangeExceptionId = this.findRangeException(occurrence); var end; if (rangeExceptionId) { var exception = this.exceptions[rangeExceptionId]; result.item = exception; var startDiff = this._rangeExceptionCache[rangeExceptionId]; if (!startDiff) { var original = exception.recurrenceId.clone(); var newStart = exception.startDate.clone(); original.zone = newStart.zone; startDiff = newStart.subtractDate(original); this._rangeExceptionCache[rangeExceptionId] = startDiff; } var start = occurrence.clone(); start.zone = exception.startDate.zone; start.addDuration(startDiff); end = start.clone(); end.addDuration(exception.duration); result.startDate = start; result.endDate = end; } else { end = occurrence.clone(); end.addDuration(this.duration); result.endDate = end; result.startDate = occurrence; result.item = this; } } return result; }, iterator: function(startTime) { return new ICAL3.RecurExpansion({ component: this.component, dtstart: startTime || this.startDate }); }, isRecurring: function() { var comp = this.component; return comp.hasProperty("rrule") || comp.hasProperty("rdate"); }, isRecurrenceException: function() { return this.component.hasProperty("recurrence-id"); }, getRecurrenceTypes: function() { var rules = this.component.getAllProperties("rrule"); var i3 = 0; var len = rules.length; var result = Object.create(null); for (; i3 < len; i3++) { var value = rules[i3].getFirstValue(); result[value.freq] = true; } return result; }, get uid() { return this._firstProp("uid"); }, set uid(value) { this._setProp("uid", value); }, get startDate() { return this._firstProp("dtstart"); }, set startDate(value) { this._setTime("dtstart", value); }, get endDate() { var endDate = this._firstProp("dtend"); if (!endDate) { var duration = this._firstProp("duration"); endDate = this.startDate.clone(); if (duration) { endDate.addDuration(duration); } else if (endDate.isDate) { endDate.day += 1; } } return endDate; }, set endDate(value) { if (this.component.hasProperty("duration")) { this.component.removeProperty("duration"); } this._setTime("dtend", value); }, get duration() { var duration = this._firstProp("duration"); if (!duration) { return this.endDate.subtractDateTz(this.startDate); } return duration; }, set duration(value) { if (this.component.hasProperty("dtend")) { this.component.removeProperty("dtend"); } this._setProp("duration", value); }, get location() { return this._firstProp("location"); }, set location(value) { return this._setProp("location", value); }, get attendees() { return this.component.getAllProperties("attendee"); }, get summary() { return this._firstProp("summary"); }, set summary(value) { this._setProp("summary", value); }, get description() { return this._firstProp("description"); }, set description(value) { this._setProp("description", value); }, get color() { return this._firstProp("color"); }, set color(value) { this._setProp("color", value); }, get organizer() { return this._firstProp("organizer"); }, set organizer(value) { this._setProp("organizer", value); }, get sequence() { return this._firstProp("sequence"); }, set sequence(value) { this._setProp("sequence", value); }, get recurrenceId() { return this._firstProp("recurrence-id"); }, set recurrenceId(value) { this._setTime("recurrence-id", value); }, _setTime: function(propName, time) { var prop = this.component.getFirstProperty(propName); if (!prop) { prop = new ICAL3.Property(propName); this.component.addProperty(prop); } if (time.zone === ICAL3.Timezone.localTimezone || time.zone === ICAL3.Timezone.utcTimezone) { prop.removeParameter("tzid"); } else { prop.setParameter("tzid", time.zone.tzid); } prop.setValue(time); }, _setProp: function(name, value) { this.component.updatePropertyWithValue(name, value); }, _firstProp: function(name) { return this.component.getFirstPropertyValue(name); }, toString: function() { return this.component.toString(); } }; function compareRangeException(a3, b3) { if (a3[0] > b3[0]) return 1; if (b3[0] > a3[0]) return -1; return 0; } return Event3; }(); ICAL3.ComponentParser = function() { function ComponentParser(options) { if (typeof options === "undefined") { options = {}; } var key; for (key in options) { if (options.hasOwnProperty(key)) { this[key] = options[key]; } } } ComponentParser.prototype = { parseEvent: true, parseTimezone: true, oncomplete: function() { }, onerror: function(err) { }, ontimezone: function(component) { }, onevent: function(component) { }, process: function(ical) { if (typeof ical === "string") { ical = ICAL3.parse(ical); } if (!(ical instanceof ICAL3.Component)) { ical = new ICAL3.Component(ical); } var components = ical.getAllSubcomponents(); var i3 = 0; var len = components.length; var component; for (; i3 < len; i3++) { component = components[i3]; switch (component.name) { case "vtimezone": if (this.parseTimezone) { var tzid = component.getFirstPropertyValue("tzid"); if (tzid) { this.ontimezone(new ICAL3.Timezone({ tzid, component })); } } break; case "vevent": if (this.parseEvent) { this.onevent(new ICAL3.Event(component)); } break; default: continue; } } this.oncomplete(); } }; return ComponentParser; }(); } }); // node_modules/object-assign/index.js var require_object_assign = __commonJS({ "node_modules/object-assign/index.js"(exports, module2) { "use strict"; var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty2 = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === void 0) { throw new TypeError("Object.assign cannot be called with null or undefined"); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } var test1 = new String("abc"); test1[5] = "de"; if (Object.getOwnPropertyNames(test1)[0] === "5") { return false; } var test2 = {}; for (var i3 = 0; i3 < 10; i3++) { test2["_" + String.fromCharCode(i3)] = i3; } var order2 = Object.getOwnPropertyNames(test2).map(function(n2) { return test2[n2]; }); if (order2.join("") !== "0123456789") { return false; } var test3 = {}; "abcdefghijklmnopqrst".split("").forEach(function(letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") { return false; } return true; } catch (err) { return false; } } module2.exports = shouldUseNative() ? Object.assign : function(target, source) { var from; var to = toObject(target); var symbols; for (var s3 = 1; s3 < arguments.length; s3++) { from = Object(arguments[s3]); for (var key in from) { if (hasOwnProperty2.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i3 = 0; i3 < symbols.length; i3++) { if (propIsEnumerable.call(from, symbols[i3])) { to[symbols[i3]] = from[symbols[i3]]; } } } } return to; }; } }); // node_modules/react/cjs/react.development.js var require_react_development = __commonJS({ "node_modules/react/cjs/react.development.js"(exports) { "use strict"; if (true) { (function() { "use strict"; var _assign = require_object_assign(); var ReactVersion = "17.0.2"; var REACT_ELEMENT_TYPE = 60103; var REACT_PORTAL_TYPE = 60106; exports.Fragment = 60107; exports.StrictMode = 60108; exports.Profiler = 60114; var REACT_PROVIDER_TYPE = 60109; var REACT_CONTEXT_TYPE = 60110; var REACT_FORWARD_REF_TYPE = 60112; exports.Suspense = 60113; var REACT_SUSPENSE_LIST_TYPE = 60120; var REACT_MEMO_TYPE = 60115; var REACT_LAZY_TYPE = 60116; var REACT_BLOCK_TYPE = 60121; var REACT_SERVER_BLOCK_TYPE = 60122; var REACT_FUNDAMENTAL_TYPE = 60117; var REACT_SCOPE_TYPE = 60119; var REACT_OPAQUE_ID_TYPE = 60128; var REACT_DEBUG_TRACING_MODE_TYPE = 60129; var REACT_OFFSCREEN_TYPE = 60130; var REACT_LEGACY_HIDDEN_TYPE = 60131; if (typeof Symbol === "function" && Symbol.for) { var symbolFor = Symbol.for; REACT_ELEMENT_TYPE = symbolFor("react.element"); REACT_PORTAL_TYPE = symbolFor("react.portal"); exports.Fragment = symbolFor("react.fragment"); exports.StrictMode = symbolFor("react.strict_mode"); exports.Profiler = symbolFor("react.profiler"); REACT_PROVIDER_TYPE = symbolFor("react.provider"); REACT_CONTEXT_TYPE = symbolFor("react.context"); REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref"); exports.Suspense = symbolFor("react.suspense"); REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list"); REACT_MEMO_TYPE = symbolFor("react.memo"); REACT_LAZY_TYPE = symbolFor("react.lazy"); REACT_BLOCK_TYPE = symbolFor("react.block"); REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block"); REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental"); REACT_SCOPE_TYPE = symbolFor("react.scope"); REACT_OPAQUE_ID_TYPE = symbolFor("react.opaque.id"); REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode"); REACT_OFFSCREEN_TYPE = symbolFor("react.offscreen"); REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden"); } var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = "@@iterator"; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== "object") { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === "function") { return maybeIterator; } return null; } var ReactCurrentDispatcher = { current: null }; var ReactCurrentBatchConfig = { transition: 0 }; var ReactCurrentOwner = { current: null }; var ReactDebugCurrentFrame = {}; var currentExtraStackFrame = null; function setExtraStackFrame(stack) { { currentExtraStackFrame = stack; } } { ReactDebugCurrentFrame.setExtraStackFrame = function(stack) { { currentExtraStackFrame = stack; } }; ReactDebugCurrentFrame.getCurrentStack = null; ReactDebugCurrentFrame.getStackAddendum = function() { var stack = ""; if (currentExtraStackFrame) { stack += currentExtraStackFrame; } var impl = ReactDebugCurrentFrame.getCurrentStack; if (impl) { stack += impl() || ""; } return stack; }; } var IsSomeRendererActing = { current: false }; var ReactSharedInternals = { ReactCurrentDispatcher, ReactCurrentBatchConfig, ReactCurrentOwner, IsSomeRendererActing, assign: _assign }; { ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; } function warn(format) { { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } printWarning("warn", format, args); } } function error(format) { { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } printWarning("error", format, args); } } function printWarning(level, format, args) { { var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame2.getStackAddendum(); if (stack !== "") { format += "%s"; args = args.concat([stack]); } var argsWithFormat = args.map(function(item) { return "" + item; }); argsWithFormat.unshift("Warning: " + format); Function.prototype.apply.call(console[level], console, argsWithFormat); } } var didWarnStateUpdateForUnmountedComponent = {}; function warnNoop(publicInstance, callerName) { { var _constructor = publicInstance.constructor; var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass"; var warningKey = componentName + "." + callerName; if (didWarnStateUpdateForUnmountedComponent[warningKey]) { return; } error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName); didWarnStateUpdateForUnmountedComponent[warningKey] = true; } } var ReactNoopUpdateQueue = { isMounted: function(publicInstance) { return false; }, enqueueForceUpdate: function(publicInstance, callback, callerName) { warnNoop(publicInstance, "forceUpdate"); }, enqueueReplaceState: function(publicInstance, completeState, callback, callerName) { warnNoop(publicInstance, "replaceState"); }, enqueueSetState: function(publicInstance, partialState, callback, callerName) { warnNoop(publicInstance, "setState"); } }; var emptyObject = {}; { Object.freeze(emptyObject); } function Component5(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; } Component5.prototype.isReactComponent = {}; Component5.prototype.setState = function(partialState, callback) { if (!(typeof partialState === "object" || typeof partialState === "function" || partialState == null)) { { throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); } } this.updater.enqueueSetState(this, partialState, callback, "setState"); }; Component5.prototype.forceUpdate = function(callback) { this.updater.enqueueForceUpdate(this, callback, "forceUpdate"); }; { var deprecatedAPIs = { isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."], replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."] }; var defineDeprecationWarning = function(methodName, info) { Object.defineProperty(Component5.prototype, methodName, { get: function() { warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]); return void 0; } }); }; for (var fnName in deprecatedAPIs) { if (deprecatedAPIs.hasOwnProperty(fnName)) { defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); } } } function ComponentDummy() { } ComponentDummy.prototype = Component5.prototype; function PureComponent2(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; } var pureComponentPrototype = PureComponent2.prototype = new ComponentDummy(); pureComponentPrototype.constructor = PureComponent2; _assign(pureComponentPrototype, Component5.prototype); pureComponentPrototype.isPureReactComponent = true; function createRef2() { var refObject = { current: null }; { Object.seal(refObject); } return refObject; } function getWrappedName(outerType, innerType, wrapperName) { var functionName = innerType.displayName || innerType.name || ""; return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName); } function getContextName(type) { return type.displayName || "Context"; } function getComponentName(type) { if (type == null) { return null; } { if (typeof type.tag === "number") { error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."); } } if (typeof type === "function") { return type.displayName || type.name || null; } if (typeof type === "string") { return type; } switch (type) { case exports.Fragment: return "Fragment"; case REACT_PORTAL_TYPE: return "Portal"; case exports.Profiler: return "Profiler"; case exports.StrictMode: return "StrictMode"; case exports.Suspense: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + ".Consumer"; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + ".Provider"; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: return getComponentName(type.type); case REACT_BLOCK_TYPE: return getComponentName(type._render); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentName(init(payload)); } catch (x3) { return null; } } } } return null; } var hasOwnProperty2 = Object.prototype.hasOwnProperty; var RESERVED_PROPS = { key: true, ref: true, __self: true, __source: true }; var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; { didWarnAboutStringRefs = {}; } function hasValidRef(config2) { { if (hasOwnProperty2.call(config2, "ref")) { var getter = Object.getOwnPropertyDescriptor(config2, "ref").get; if (getter && getter.isReactWarning) { return false; } } } return config2.ref !== void 0; } function hasValidKey(config2) { { if (hasOwnProperty2.call(config2, "key")) { var getter = Object.getOwnPropertyDescriptor(config2, "key").get; if (getter && getter.isReactWarning) { return false; } } } return config2.key !== void 0; } function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function() { { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }; warnAboutAccessingKey.isReactWarning = true; Object.defineProperty(props, "key", { get: warnAboutAccessingKey, configurable: true }); } function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function() { { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }; warnAboutAccessingRef.isReactWarning = true; Object.defineProperty(props, "ref", { get: warnAboutAccessingRef, configurable: true }); } function warnIfStringRefCannotBeAutoConverted(config2) { { if (typeof config2.ref === "string" && ReactCurrentOwner.current && config2.__self && ReactCurrentOwner.current.stateNode !== config2.__self) { var componentName = getComponentName(ReactCurrentOwner.current.type); if (!didWarnAboutStringRefs[componentName]) { error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config2.ref); didWarnAboutStringRefs[componentName] = true; } } } } var ReactElement = function(type, key, ref, self2, source, owner, props) { var element = { $$typeof: REACT_ELEMENT_TYPE, type, key, ref, props, _owner: owner }; { element._store = {}; Object.defineProperty(element._store, "validated", { configurable: false, enumerable: false, writable: true, value: false }); Object.defineProperty(element, "_self", { configurable: false, enumerable: false, writable: false, value: self2 }); Object.defineProperty(element, "_source", { configurable: false, enumerable: false, writable: false, value: source }); if (Object.freeze) { Object.freeze(element.props); Object.freeze(element); } } return element; }; function createElement7(type, config2, children) { var propName; var props = {}; var key = null; var ref = null; var self2 = null; var source = null; if (config2 != null) { if (hasValidRef(config2)) { ref = config2.ref; { warnIfStringRefCannotBeAutoConverted(config2); } } if (hasValidKey(config2)) { key = "" + config2.key; } self2 = config2.__self === void 0 ? null : config2.__self; source = config2.__source === void 0 ? null : config2.__source; for (propName in config2) { if (hasOwnProperty2.call(config2, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config2[propName]; } } } var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i3 = 0; i3 < childrenLength; i3++) { childArray[i3] = arguments[i3 + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props); } function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; } function cloneElement(element, config2, children) { if (!!(element === null || element === void 0)) { { throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); } } var propName; var props = _assign({}, element.props); var key = element.key; var ref = element.ref; var self2 = element._self; var source = element._source; var owner = element._owner; if (config2 != null) { if (hasValidRef(config2)) { ref = config2.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config2)) { key = "" + config2.key; } var defaultProps; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config2) { if (hasOwnProperty2.call(config2, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config2[propName] === void 0 && defaultProps !== void 0) { props[propName] = defaultProps[propName]; } else { props[propName] = config2[propName]; } } } } var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i3 = 0; i3 < childrenLength; i3++) { childArray[i3] = arguments[i3 + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self2, source, owner, props); } function isValidElement(object) { return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } var SEPARATOR = "."; var SUBSEPARATOR = ":"; function escape2(key) { var escapeRegex = /[=:]/g; var escaperLookup = { "=": "=0", ":": "=2" }; var escapedString = key.replace(escapeRegex, function(match) { return escaperLookup[match]; }); return "$" + escapedString; } var didWarnAboutMaps = false; var userProvidedKeyEscapeRegex = /\/+/g; function escapeUserProvidedKey(text) { return text.replace(userProvidedKeyEscapeRegex, "$&/"); } function getElementKey(element, index) { if (typeof element === "object" && element !== null && element.key != null) { return escape2("" + element.key); } return index.toString(36); } function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { var type = typeof children; if (type === "undefined" || type === "boolean") { children = null; } var invokeCallback = false; if (children === null) { invokeCallback = true; } else { switch (type) { case "string": case "number": invokeCallback = true; break; case "object": switch (children.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: invokeCallback = true; } } } if (invokeCallback) { var _child = children; var mappedChild = callback(_child); var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; if (Array.isArray(mappedChild)) { var escapedChildKey = ""; if (childKey != null) { escapedChildKey = escapeUserProvidedKey(childKey) + "/"; } mapIntoArray(mappedChild, array, escapedChildKey, "", function(c3) { return c3; }); } else if (mappedChild != null) { if (isValidElement(mappedChild)) { mappedChild = cloneAndReplaceKey(mappedChild, escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey); } array.push(mappedChild); } return 1; } var child; var nextName; var subtreeCount = 0; var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR; if (Array.isArray(children)) { for (var i3 = 0; i3 < children.length; i3++) { child = children[i3]; nextName = nextNamePrefix + getElementKey(child, i3); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else { var iteratorFn = getIteratorFn(children); if (typeof iteratorFn === "function") { var iterableChildren = children; { if (iteratorFn === iterableChildren.entries) { if (!didWarnAboutMaps) { warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."); } didWarnAboutMaps = true; } } var iterator = iteratorFn.call(iterableChildren); var step; var ii = 0; while (!(step = iterator.next()).done) { child = step.value; nextName = nextNamePrefix + getElementKey(child, ii++); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else if (type === "object") { var childrenString = "" + children; { { throw Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead."); } } } } return subtreeCount; } function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; var count = 0; mapIntoArray(children, result, "", "", function(child) { return func.call(context, child, count++); }); return result; } function countChildren(children) { var n2 = 0; mapChildren(children, function() { n2++; }); return n2; } function forEachChildren(children, forEachFunc, forEachContext) { mapChildren(children, function() { forEachFunc.apply(this, arguments); }, forEachContext); } function toArray(children) { return mapChildren(children, function(child) { return child; }) || []; } function onlyChild(children) { if (!isValidElement(children)) { { throw Error("React.Children.only expected to receive a single React element child."); } } return children; } function createContext3(defaultValue, calculateChangedBits) { if (calculateChangedBits === void 0) { calculateChangedBits = null; } else { { if (calculateChangedBits !== null && typeof calculateChangedBits !== "function") { error("createContext: Expected the optional second argument to be a function. Instead received: %s", calculateChangedBits); } } } var context = { $$typeof: REACT_CONTEXT_TYPE, _calculateChangedBits: calculateChangedBits, _currentValue: defaultValue, _currentValue2: defaultValue, _threadCount: 0, Provider: null, Consumer: null }; context.Provider = { $$typeof: REACT_PROVIDER_TYPE, _context: context }; var hasWarnedAboutUsingNestedContextConsumers = false; var hasWarnedAboutUsingConsumerProvider = false; var hasWarnedAboutDisplayNameOnConsumer = false; { var Consumer = { $$typeof: REACT_CONTEXT_TYPE, _context: context, _calculateChangedBits: context._calculateChangedBits }; Object.defineProperties(Consumer, { Provider: { get: function() { if (!hasWarnedAboutUsingConsumerProvider) { hasWarnedAboutUsingConsumerProvider = true; error("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"); } return context.Provider; }, set: function(_Provider) { context.Provider = _Provider; } }, _currentValue: { get: function() { return context._currentValue; }, set: function(_currentValue) { context._currentValue = _currentValue; } }, _currentValue2: { get: function() { return context._currentValue2; }, set: function(_currentValue2) { context._currentValue2 = _currentValue2; } }, _threadCount: { get: function() { return context._threadCount; }, set: function(_threadCount) { context._threadCount = _threadCount; } }, Consumer: { get: function() { if (!hasWarnedAboutUsingNestedContextConsumers) { hasWarnedAboutUsingNestedContextConsumers = true; error("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"); } return context.Consumer; } }, displayName: { get: function() { return context.displayName; }, set: function(displayName) { if (!hasWarnedAboutDisplayNameOnConsumer) { warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName); hasWarnedAboutDisplayNameOnConsumer = true; } } } }); context.Consumer = Consumer; } { context._currentRenderer = null; context._currentRenderer2 = null; } return context; } var Uninitialized = -1; var Pending = 0; var Resolved = 1; var Rejected = 2; function lazyInitializer(payload) { if (payload._status === Uninitialized) { var ctor = payload._result; var thenable = ctor(); var pending = payload; pending._status = Pending; pending._result = thenable; thenable.then(function(moduleObject) { if (payload._status === Pending) { var defaultExport = moduleObject.default; { if (defaultExport === void 0) { error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); } } var resolved = payload; resolved._status = Resolved; resolved._result = defaultExport; } }, function(error2) { if (payload._status === Pending) { var rejected = payload; rejected._status = Rejected; rejected._result = error2; } }); } if (payload._status === Resolved) { return payload._result; } else { throw payload._result; } } function lazy(ctor) { var payload = { _status: -1, _result: ctor }; var lazyType = { $$typeof: REACT_LAZY_TYPE, _payload: payload, _init: lazyInitializer }; { var defaultProps; var propTypes; Object.defineProperties(lazyType, { defaultProps: { configurable: true, get: function() { return defaultProps; }, set: function(newDefaultProps) { error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."); defaultProps = newDefaultProps; Object.defineProperty(lazyType, "defaultProps", { enumerable: true }); } }, propTypes: { configurable: true, get: function() { return propTypes; }, set: function(newPropTypes) { error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."); propTypes = newPropTypes; Object.defineProperty(lazyType, "propTypes", { enumerable: true }); } } }); } return lazyType; } function forwardRef(render4) { { if (render4 != null && render4.$$typeof === REACT_MEMO_TYPE) { error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."); } else if (typeof render4 !== "function") { error("forwardRef requires a render function but was given %s.", render4 === null ? "null" : typeof render4); } else { if (render4.length !== 0 && render4.length !== 2) { error("forwardRef render functions accept exactly two parameters: props and ref. %s", render4.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."); } } if (render4 != null) { if (render4.defaultProps != null || render4.propTypes != null) { error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"); } } } var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render4 }; { var ownName; Object.defineProperty(elementType, "displayName", { enumerable: false, configurable: true, get: function() { return ownName; }, set: function(name) { ownName = name; if (render4.displayName == null) { render4.displayName = name; } } }); } return elementType; } var enableScopeAPI = false; function isValidElementType(type) { if (typeof type === "string" || typeof type === "function") { return true; } if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) { return true; } if (typeof type === "object" && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) { return true; } } return false; } function memo(type, compare) { { if (!isValidElementType(type)) { error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type); } } var elementType = { $$typeof: REACT_MEMO_TYPE, type, compare: compare === void 0 ? null : compare }; { var ownName; Object.defineProperty(elementType, "displayName", { enumerable: false, configurable: true, get: function() { return ownName; }, set: function(name) { ownName = name; if (type.displayName == null) { type.displayName = name; } } }); } return elementType; } function resolveDispatcher() { var dispatcher = ReactCurrentDispatcher.current; if (!(dispatcher !== null)) { { throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."); } } return dispatcher; } function useContext(Context, unstable_observedBits) { var dispatcher = resolveDispatcher(); { if (unstable_observedBits !== void 0) { error("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s", unstable_observedBits, typeof unstable_observedBits === "number" && Array.isArray(arguments[2]) ? "\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://reactjs.org/link/rules-of-hooks" : ""); } if (Context._context !== void 0) { var realContext = Context._context; if (realContext.Consumer === Context) { error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"); } else if (realContext.Provider === Context) { error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?"); } } } return dispatcher.useContext(Context, unstable_observedBits); } function useState4(initialState) { var dispatcher = resolveDispatcher(); return dispatcher.useState(initialState); } function useReducer(reducer, initialArg, init) { var dispatcher = resolveDispatcher(); return dispatcher.useReducer(reducer, initialArg, init); } function useRef2(initialValue) { var dispatcher = resolveDispatcher(); return dispatcher.useRef(initialValue); } function useEffect2(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useEffect(create, deps); } function useLayoutEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useLayoutEffect(create, deps); } function useCallback(callback, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useCallback(callback, deps); } function useMemo(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useMemo(create, deps); } function useImperativeHandle(ref, create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useImperativeHandle(ref, create, deps); } function useDebugValue(value, formatterFn) { { var dispatcher = resolveDispatcher(); return dispatcher.useDebugValue(value, formatterFn); } } var disabledDepth = 0; var prevLog; var prevInfo; var prevWarn; var prevError; var prevGroup; var prevGroupCollapsed; var prevGroupEnd; function disabledLog() { } disabledLog.__reactDisabledLog = true; function disableLogs() { { if (disabledDepth === 0) { prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); } disabledDepth++; } } function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { var props = { configurable: true, enumerable: true, writable: true }; Object.defineProperties(console, { log: _assign({}, props, { value: prevLog }), info: _assign({}, props, { value: prevInfo }), warn: _assign({}, props, { value: prevWarn }), error: _assign({}, props, { value: prevError }), group: _assign({}, props, { value: prevGroup }), groupCollapsed: _assign({}, props, { value: prevGroupCollapsed }), groupEnd: _assign({}, props, { value: prevGroupEnd }) }); } if (disabledDepth < 0) { error("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } } var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; var prefix; function describeBuiltInComponentFrame(name, source, ownerFn) { { if (prefix === void 0) { try { throw Error(); } catch (x3) { var match = x3.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ""; } } return "\n" + prefix + name; } } var reentry = false; var componentFrameCache; { var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; componentFrameCache = new PossiblyWeakMap(); } function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) { return ""; } { var frame = componentFrameCache.get(fn); if (frame !== void 0) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = null; disableLogs(); } try { if (construct) { var Fake = function() { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function() { throw Error(); } }); if (typeof Reflect === "object" && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x3) { control = x3; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x3) { control = x3; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x3) { control = x3; } fn(); } } catch (sample) { if (sample && control && typeof sample.stack === "string") { var sampleLines = sample.stack.split("\n"); var controlLines = control.stack.split("\n"); var s3 = sampleLines.length - 1; var c3 = controlLines.length - 1; while (s3 >= 1 && c3 >= 0 && sampleLines[s3] !== controlLines[c3]) { c3--; } for (; s3 >= 1 && c3 >= 0; s3--, c3--) { if (sampleLines[s3] !== controlLines[c3]) { if (s3 !== 1 || c3 !== 1) { do { s3--; c3--; if (c3 < 0 || sampleLines[s3] !== controlLines[c3]) { var _frame = "\n" + sampleLines[s3].replace(" at new ", " at "); { if (typeof fn === "function") { componentFrameCache.set(fn, _frame); } } return _frame; } } while (s3 >= 1 && c3 >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher$1.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } var name = fn ? fn.displayName || fn.name : ""; var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ""; { if (typeof fn === "function") { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; } function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } } function shouldConstruct(Component6) { var prototype = Component6.prototype; return !!(prototype && prototype.isReactComponent); } function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ""; } if (typeof type === "function") { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === "string") { return describeBuiltInComponentFrame(type); } switch (type) { case exports.Suspense: return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_BLOCK_TYPE: return describeFunctionComponentFrame(type._render); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x3) { } } } } return ""; } var loggedTypeFailures = {}; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame$1.setExtraStackFrame(null); } } } function checkPropTypes(typeSpecs, values, location, componentName, element) { { var has = Function.call.bind(Object.prototype.hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; try { if (typeof typeSpecs[typeSpecName] !== "function") { var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); err.name = "Invariant Violation"; throw err; } error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (ex) { error$1 = ex; } if (error$1 && !(error$1 instanceof Error)) { setCurrentlyValidatingElement(element); error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1); setCurrentlyValidatingElement(null); } if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { loggedTypeFailures[error$1.message] = true; setCurrentlyValidatingElement(element); error("Failed %s type: %s", location, error$1.message); setCurrentlyValidatingElement(null); } } } } } function setCurrentlyValidatingElement$1(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); setExtraStackFrame(stack); } else { setExtraStackFrame(null); } } } var propTypesMisspellWarningShown; { propTypesMisspellWarningShown = false; } function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = getComponentName(ReactCurrentOwner.current.type); if (name) { return "\n\nCheck the render method of `" + name + "`."; } } return ""; } function getSourceInfoErrorAddendum(source) { if (source !== void 0) { var fileName = source.fileName.replace(/^.*[\\\/]/, ""); var lineNumber = source.lineNumber; return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; } return ""; } function getSourceInfoErrorAddendumForProps(elementProps) { if (elementProps !== null && elementProps !== void 0) { return getSourceInfoErrorAddendum(elementProps.__source); } return ""; } var ownerHasKeyUseWarning = {}; function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name; if (parentName) { info = "\n\nCheck the top-level render call using <" + parentName + ">."; } } return info; } function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { return; } ownerHasKeyUseWarning[currentComponentErrorInfo] = true; var childOwner = ""; if (element && element._owner && element._owner !== ReactCurrentOwner.current) { childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; } { setCurrentlyValidatingElement$1(element); error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); setCurrentlyValidatingElement$1(null); } } function validateChildKeys(node, parentType) { if (typeof node !== "object") { return; } if (Array.isArray(node)) { for (var i3 = 0; i3 < node.length; i3++) { var child = node[i3]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (isValidElement(node)) { if (node._store) { node._store.validated = true; } } else if (node) { var iteratorFn = getIteratorFn(node); if (typeof iteratorFn === "function") { if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } } } function validatePropTypes(element) { { var type = element.type; if (type === null || type === void 0 || typeof type === "string") { return; } var propTypes; if (typeof type === "function") { propTypes = type.propTypes; } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) { propTypes = type.propTypes; } else { return; } if (propTypes) { var name = getComponentName(type); checkPropTypes(propTypes, element.props, "prop", name, element); } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) { propTypesMisspellWarningShown = true; var _name = getComponentName(type); error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown"); } if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) { error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } } function validateFragmentProps(fragment) { { var keys = Object.keys(fragment.props); for (var i3 = 0; i3 < keys.length; i3++) { var key = keys[i3]; if (key !== "children" && key !== "key") { setCurrentlyValidatingElement$1(fragment); error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key); setCurrentlyValidatingElement$1(null); break; } } if (fragment.ref !== null) { setCurrentlyValidatingElement$1(fragment); error("Invalid attribute `ref` supplied to `React.Fragment`."); setCurrentlyValidatingElement$1(null); } } } function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); if (!validType) { var info = ""; if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) { info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."; } var sourceInfo = getSourceInfoErrorAddendumForProps(props); if (sourceInfo) { info += sourceInfo; } else { info += getDeclarationErrorAddendum(); } var typeString; if (type === null) { typeString = "null"; } else if (Array.isArray(type)) { typeString = "array"; } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) { typeString = "<" + (getComponentName(type.type) || "Unknown") + " />"; info = " Did you accidentally export a JSX literal instead of a component?"; } else { typeString = typeof type; } { error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info); } } var element = createElement7.apply(this, arguments); if (element == null) { return element; } if (validType) { for (var i3 = 2; i3 < arguments.length; i3++) { validateChildKeys(arguments[i3], type); } } if (type === exports.Fragment) { validateFragmentProps(element); } else { validatePropTypes(element); } return element; } var didWarnAboutDeprecatedCreateFactory = false; function createFactoryWithValidation(type) { var validatedFactory = createElementWithValidation.bind(null, type); validatedFactory.type = type; { if (!didWarnAboutDeprecatedCreateFactory) { didWarnAboutDeprecatedCreateFactory = true; warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead."); } Object.defineProperty(validatedFactory, "type", { enumerable: false, get: function() { warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."); Object.defineProperty(this, "type", { value: type }); return type; } }); } return validatedFactory; } function cloneElementWithValidation(element, props, children) { var newElement = cloneElement.apply(this, arguments); for (var i3 = 2; i3 < arguments.length; i3++) { validateChildKeys(arguments[i3], newElement.type); } validatePropTypes(newElement); return newElement; } { try { var frozenObject = Object.freeze({}); new Map([[frozenObject, null]]); new Set([frozenObject]); } catch (e3) { } } var createElement$1 = createElementWithValidation; var cloneElement$1 = cloneElementWithValidation; var createFactory = createFactoryWithValidation; var Children = { map: mapChildren, forEach: forEachChildren, count: countChildren, toArray, only: onlyChild }; exports.Children = Children; exports.Component = Component5; exports.PureComponent = PureComponent2; exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; exports.cloneElement = cloneElement$1; exports.createContext = createContext3; exports.createElement = createElement$1; exports.createFactory = createFactory; exports.createRef = createRef2; exports.forwardRef = forwardRef; exports.isValidElement = isValidElement; exports.lazy = lazy; exports.memo = memo; exports.useCallback = useCallback; exports.useContext = useContext; exports.useDebugValue = useDebugValue; exports.useEffect = useEffect2; exports.useImperativeHandle = useImperativeHandle; exports.useLayoutEffect = useLayoutEffect; exports.useMemo = useMemo; exports.useReducer = useReducer; exports.useRef = useRef2; exports.useState = useState4; exports.version = ReactVersion; })(); } } }); // node_modules/react/index.js var require_react = __commonJS({ "node_modules/react/index.js"(exports, module2) { "use strict"; if (false) { module2.exports = null; } else { module2.exports = require_react_development(); } } }); // node_modules/scheduler/cjs/scheduler.development.js var require_scheduler_development = __commonJS({ "node_modules/scheduler/cjs/scheduler.development.js"(exports) { "use strict"; if (true) { (function() { "use strict"; var enableSchedulerDebugging = false; var enableProfiling = false; var requestHostCallback; var requestHostTimeout; var cancelHostTimeout; var requestPaint; var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function"; if (hasPerformanceNow) { var localPerformance = performance; exports.unstable_now = function() { return localPerformance.now(); }; } else { var localDate = Date; var initialTime = localDate.now(); exports.unstable_now = function() { return localDate.now() - initialTime; }; } if (typeof window === "undefined" || typeof MessageChannel !== "function") { var _callback = null; var _timeoutID = null; var _flushCallback = function() { if (_callback !== null) { try { var currentTime = exports.unstable_now(); var hasRemainingTime = true; _callback(hasRemainingTime, currentTime); _callback = null; } catch (e3) { setTimeout(_flushCallback, 0); throw e3; } } }; requestHostCallback = function(cb) { if (_callback !== null) { setTimeout(requestHostCallback, 0, cb); } else { _callback = cb; setTimeout(_flushCallback, 0); } }; requestHostTimeout = function(cb, ms) { _timeoutID = setTimeout(cb, ms); }; cancelHostTimeout = function() { clearTimeout(_timeoutID); }; exports.unstable_shouldYield = function() { return false; }; requestPaint = exports.unstable_forceFrameRate = function() { }; } else { var _setTimeout = window.setTimeout; var _clearTimeout = window.clearTimeout; if (typeof console !== "undefined") { var requestAnimationFrame2 = window.requestAnimationFrame; var cancelAnimationFrame2 = window.cancelAnimationFrame; if (typeof requestAnimationFrame2 !== "function") { console["error"]("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"); } if (typeof cancelAnimationFrame2 !== "function") { console["error"]("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"); } } var isMessageLoopRunning = false; var scheduledHostCallback = null; var taskTimeoutID = -1; var yieldInterval = 5; var deadline = 0; { exports.unstable_shouldYield = function() { return exports.unstable_now() >= deadline; }; requestPaint = function() { }; } exports.unstable_forceFrameRate = function(fps) { if (fps < 0 || fps > 125) { console["error"]("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"); return; } if (fps > 0) { yieldInterval = Math.floor(1e3 / fps); } else { yieldInterval = 5; } }; var performWorkUntilDeadline = function() { if (scheduledHostCallback !== null) { var currentTime = exports.unstable_now(); deadline = currentTime + yieldInterval; var hasTimeRemaining = true; try { var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); if (!hasMoreWork) { isMessageLoopRunning = false; scheduledHostCallback = null; } else { port.postMessage(null); } } catch (error) { port.postMessage(null); throw error; } } else { isMessageLoopRunning = false; } }; var channel = new MessageChannel(); var port = channel.port2; channel.port1.onmessage = performWorkUntilDeadline; requestHostCallback = function(callback) { scheduledHostCallback = callback; if (!isMessageLoopRunning) { isMessageLoopRunning = true; port.postMessage(null); } }; requestHostTimeout = function(callback, ms) { taskTimeoutID = _setTimeout(function() { callback(exports.unstable_now()); }, ms); }; cancelHostTimeout = function() { _clearTimeout(taskTimeoutID); taskTimeoutID = -1; }; } function push(heap, node) { var index = heap.length; heap.push(node); siftUp(heap, node, index); } function peek(heap) { var first = heap[0]; return first === void 0 ? null : first; } function pop(heap) { var first = heap[0]; if (first !== void 0) { var last = heap.pop(); if (last !== first) { heap[0] = last; siftDown(heap, last, 0); } return first; } else { return null; } } function siftUp(heap, node, i3) { var index = i3; while (true) { var parentIndex = index - 1 >>> 1; var parent = heap[parentIndex]; if (parent !== void 0 && compare(parent, node) > 0) { heap[parentIndex] = node; heap[index] = parent; index = parentIndex; } else { return; } } } function siftDown(heap, node, i3) { var index = i3; var length = heap.length; while (index < length) { var leftIndex = (index + 1) * 2 - 1; var left = heap[leftIndex]; var rightIndex = leftIndex + 1; var right = heap[rightIndex]; if (left !== void 0 && compare(left, node) < 0) { if (right !== void 0 && compare(right, left) < 0) { heap[index] = right; heap[rightIndex] = node; index = rightIndex; } else { heap[index] = left; heap[leftIndex] = node; index = leftIndex; } } else if (right !== void 0 && compare(right, node) < 0) { heap[index] = right; heap[rightIndex] = node; index = rightIndex; } else { return; } } } function compare(a3, b3) { var diff = a3.sortIndex - b3.sortIndex; return diff !== 0 ? diff : a3.id - b3.id; } var ImmediatePriority = 1; var UserBlockingPriority = 2; var NormalPriority = 3; var LowPriority = 4; var IdlePriority = 5; function markTaskErrored(task, ms) { } var maxSigned31BitInt = 1073741823; var IMMEDIATE_PRIORITY_TIMEOUT = -1; var USER_BLOCKING_PRIORITY_TIMEOUT = 250; var NORMAL_PRIORITY_TIMEOUT = 5e3; var LOW_PRIORITY_TIMEOUT = 1e4; var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; var taskQueue = []; var timerQueue = []; var taskIdCounter = 1; var currentTask = null; var currentPriorityLevel = NormalPriority; var isPerformingWork = false; var isHostCallbackScheduled = false; var isHostTimeoutScheduled = false; function advanceTimers(currentTime) { var timer = peek(timerQueue); while (timer !== null) { if (timer.callback === null) { pop(timerQueue); } else if (timer.startTime <= currentTime) { pop(timerQueue); timer.sortIndex = timer.expirationTime; push(taskQueue, timer); } else { return; } timer = peek(timerQueue); } } function handleTimeout(currentTime) { isHostTimeoutScheduled = false; advanceTimers(currentTime); if (!isHostCallbackScheduled) { if (peek(taskQueue) !== null) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } else { var firstTimer = peek(timerQueue); if (firstTimer !== null) { requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); } } } } function flushWork(hasTimeRemaining, initialTime2) { isHostCallbackScheduled = false; if (isHostTimeoutScheduled) { isHostTimeoutScheduled = false; cancelHostTimeout(); } isPerformingWork = true; var previousPriorityLevel = currentPriorityLevel; try { if (enableProfiling) { try { return workLoop(hasTimeRemaining, initialTime2); } catch (error) { if (currentTask !== null) { var currentTime = exports.unstable_now(); markTaskErrored(currentTask, currentTime); currentTask.isQueued = false; } throw error; } } else { return workLoop(hasTimeRemaining, initialTime2); } } finally { currentTask = null; currentPriorityLevel = previousPriorityLevel; isPerformingWork = false; } } function workLoop(hasTimeRemaining, initialTime2) { var currentTime = initialTime2; advanceTimers(currentTime); currentTask = peek(taskQueue); while (currentTask !== null && !enableSchedulerDebugging) { if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || exports.unstable_shouldYield())) { break; } var callback = currentTask.callback; if (typeof callback === "function") { currentTask.callback = null; currentPriorityLevel = currentTask.priorityLevel; var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; var continuationCallback = callback(didUserCallbackTimeout); currentTime = exports.unstable_now(); if (typeof continuationCallback === "function") { currentTask.callback = continuationCallback; } else { if (currentTask === peek(taskQueue)) { pop(taskQueue); } } advanceTimers(currentTime); } else { pop(taskQueue); } currentTask = peek(taskQueue); } if (currentTask !== null) { return true; } else { var firstTimer = peek(timerQueue); if (firstTimer !== null) { requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); } return false; } } function unstable_runWithPriority(priorityLevel, eventHandler) { switch (priorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: case LowPriority: case IdlePriority: break; default: priorityLevel = NormalPriority; } var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = priorityLevel; try { return eventHandler(); } finally { currentPriorityLevel = previousPriorityLevel; } } function unstable_next(eventHandler) { var priorityLevel; switch (currentPriorityLevel) { case ImmediatePriority: case UserBlockingPriority: case NormalPriority: priorityLevel = NormalPriority; break; default: priorityLevel = currentPriorityLevel; break; } var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = priorityLevel; try { return eventHandler(); } finally { currentPriorityLevel = previousPriorityLevel; } } function unstable_wrapCallback(callback) { var parentPriorityLevel = currentPriorityLevel; return function() { var previousPriorityLevel = currentPriorityLevel; currentPriorityLevel = parentPriorityLevel; try { return callback.apply(this, arguments); } finally { currentPriorityLevel = previousPriorityLevel; } }; } function unstable_scheduleCallback(priorityLevel, callback, options) { var currentTime = exports.unstable_now(); var startTime; if (typeof options === "object" && options !== null) { var delay = options.delay; if (typeof delay === "number" && delay > 0) { startTime = currentTime + delay; } else { startTime = currentTime; } } else { startTime = currentTime; } var timeout; switch (priorityLevel) { case ImmediatePriority: timeout = IMMEDIATE_PRIORITY_TIMEOUT; break; case UserBlockingPriority: timeout = USER_BLOCKING_PRIORITY_TIMEOUT; break; case IdlePriority: timeout = IDLE_PRIORITY_TIMEOUT; break; case LowPriority: timeout = LOW_PRIORITY_TIMEOUT; break; case NormalPriority: default: timeout = NORMAL_PRIORITY_TIMEOUT; break; } var expirationTime = startTime + timeout; var newTask = { id: taskIdCounter++, callback, priorityLevel, startTime, expirationTime, sortIndex: -1 }; if (startTime > currentTime) { newTask.sortIndex = startTime; push(timerQueue, newTask); if (peek(taskQueue) === null && newTask === peek(timerQueue)) { if (isHostTimeoutScheduled) { cancelHostTimeout(); } else { isHostTimeoutScheduled = true; } requestHostTimeout(handleTimeout, startTime - currentTime); } } else { newTask.sortIndex = expirationTime; push(taskQueue, newTask); if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } } return newTask; } function unstable_pauseExecution() { } function unstable_continueExecution() { if (!isHostCallbackScheduled && !isPerformingWork) { isHostCallbackScheduled = true; requestHostCallback(flushWork); } } function unstable_getFirstCallbackNode() { return peek(taskQueue); } function unstable_cancelCallback(task) { task.callback = null; } function unstable_getCurrentPriorityLevel() { return currentPriorityLevel; } var unstable_requestPaint = requestPaint; var unstable_Profiling = null; exports.unstable_IdlePriority = IdlePriority; exports.unstable_ImmediatePriority = ImmediatePriority; exports.unstable_LowPriority = LowPriority; exports.unstable_NormalPriority = NormalPriority; exports.unstable_Profiling = unstable_Profiling; exports.unstable_UserBlockingPriority = UserBlockingPriority; exports.unstable_cancelCallback = unstable_cancelCallback; exports.unstable_continueExecution = unstable_continueExecution; exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; exports.unstable_next = unstable_next; exports.unstable_pauseExecution = unstable_pauseExecution; exports.unstable_requestPaint = unstable_requestPaint; exports.unstable_runWithPriority = unstable_runWithPriority; exports.unstable_scheduleCallback = unstable_scheduleCallback; exports.unstable_wrapCallback = unstable_wrapCallback; })(); } } }); // node_modules/scheduler/index.js var require_scheduler = __commonJS({ "node_modules/scheduler/index.js"(exports, module2) { "use strict"; if (false) { module2.exports = null; } else { module2.exports = require_scheduler_development(); } } }); // node_modules/scheduler/cjs/scheduler-tracing.development.js var require_scheduler_tracing_development = __commonJS({ "node_modules/scheduler/cjs/scheduler-tracing.development.js"(exports) { "use strict"; if (true) { (function() { "use strict"; var DEFAULT_THREAD_ID = 0; var interactionIDCounter = 0; var threadIDCounter = 0; exports.__interactionsRef = null; exports.__subscriberRef = null; { exports.__interactionsRef = { current: new Set() }; exports.__subscriberRef = { current: null }; } function unstable_clear(callback) { var prevInteractions = exports.__interactionsRef.current; exports.__interactionsRef.current = new Set(); try { return callback(); } finally { exports.__interactionsRef.current = prevInteractions; } } function unstable_getCurrent() { { return exports.__interactionsRef.current; } } function unstable_getThreadID() { return ++threadIDCounter; } function unstable_trace(name, timestamp, callback) { var threadID = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : DEFAULT_THREAD_ID; var interaction = { __count: 1, id: interactionIDCounter++, name, timestamp }; var prevInteractions = exports.__interactionsRef.current; var interactions = new Set(prevInteractions); interactions.add(interaction); exports.__interactionsRef.current = interactions; var subscriber = exports.__subscriberRef.current; var returnValue; try { if (subscriber !== null) { subscriber.onInteractionTraced(interaction); } } finally { try { if (subscriber !== null) { subscriber.onWorkStarted(interactions, threadID); } } finally { try { returnValue = callback(); } finally { exports.__interactionsRef.current = prevInteractions; try { if (subscriber !== null) { subscriber.onWorkStopped(interactions, threadID); } } finally { interaction.__count--; if (subscriber !== null && interaction.__count === 0) { subscriber.onInteractionScheduledWorkCompleted(interaction); } } } } } return returnValue; } function unstable_wrap(callback) { var threadID = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_THREAD_ID; var wrappedInteractions = exports.__interactionsRef.current; var subscriber = exports.__subscriberRef.current; if (subscriber !== null) { subscriber.onWorkScheduled(wrappedInteractions, threadID); } wrappedInteractions.forEach(function(interaction) { interaction.__count++; }); var hasRun = false; function wrapped() { var prevInteractions = exports.__interactionsRef.current; exports.__interactionsRef.current = wrappedInteractions; subscriber = exports.__subscriberRef.current; try { var returnValue; try { if (subscriber !== null) { subscriber.onWorkStarted(wrappedInteractions, threadID); } } finally { try { returnValue = callback.apply(void 0, arguments); } finally { exports.__interactionsRef.current = prevInteractions; if (subscriber !== null) { subscriber.onWorkStopped(wrappedInteractions, threadID); } } } return returnValue; } finally { if (!hasRun) { hasRun = true; wrappedInteractions.forEach(function(interaction) { interaction.__count--; if (subscriber !== null && interaction.__count === 0) { subscriber.onInteractionScheduledWorkCompleted(interaction); } }); } } } wrapped.cancel = function cancel() { subscriber = exports.__subscriberRef.current; try { if (subscriber !== null) { subscriber.onWorkCanceled(wrappedInteractions, threadID); } } finally { wrappedInteractions.forEach(function(interaction) { interaction.__count--; if (subscriber && interaction.__count === 0) { subscriber.onInteractionScheduledWorkCompleted(interaction); } }); } }; return wrapped; } var subscribers = null; { subscribers = new Set(); } function unstable_subscribe(subscriber) { { subscribers.add(subscriber); if (subscribers.size === 1) { exports.__subscriberRef.current = { onInteractionScheduledWorkCompleted, onInteractionTraced, onWorkCanceled, onWorkScheduled, onWorkStarted, onWorkStopped }; } } } function unstable_unsubscribe(subscriber) { { subscribers.delete(subscriber); if (subscribers.size === 0) { exports.__subscriberRef.current = null; } } } function onInteractionTraced(interaction) { var didCatchError = false; var caughtError = null; subscribers.forEach(function(subscriber) { try { subscriber.onInteractionTraced(interaction); } catch (error) { if (!didCatchError) { didCatchError = true; caughtError = error; } } }); if (didCatchError) { throw caughtError; } } function onInteractionScheduledWorkCompleted(interaction) { var didCatchError = false; var caughtError = null; subscribers.forEach(function(subscriber) { try { subscriber.onInteractionScheduledWorkCompleted(interaction); } catch (error) { if (!didCatchError) { didCatchError = true; caughtError = error; } } }); if (didCatchError) { throw caughtError; } } function onWorkScheduled(interactions, threadID) { var didCatchError = false; var caughtError = null; subscribers.forEach(function(subscriber) { try { subscriber.onWorkScheduled(interactions, threadID); } catch (error) { if (!didCatchError) { didCatchError = true; caughtError = error; } } }); if (didCatchError) { throw caughtError; } } function onWorkStarted(interactions, threadID) { var didCatchError = false; var caughtError = null; subscribers.forEach(function(subscriber) { try { subscriber.onWorkStarted(interactions, threadID); } catch (error) { if (!didCatchError) { didCatchError = true; caughtError = error; } } }); if (didCatchError) { throw caughtError; } } function onWorkStopped(interactions, threadID) { var didCatchError = false; var caughtError = null; subscribers.forEach(function(subscriber) { try { subscriber.onWorkStopped(interactions, threadID); } catch (error) { if (!didCatchError) { didCatchError = true; caughtError = error; } } }); if (didCatchError) { throw caughtError; } } function onWorkCanceled(interactions, threadID) { var didCatchError = false; var caughtError = null; subscribers.forEach(function(subscriber) { try { subscriber.onWorkCanceled(interactions, threadID); } catch (error) { if (!didCatchError) { didCatchError = true; caughtError = error; } } }); if (didCatchError) { throw caughtError; } } exports.unstable_clear = unstable_clear; exports.unstable_getCurrent = unstable_getCurrent; exports.unstable_getThreadID = unstable_getThreadID; exports.unstable_subscribe = unstable_subscribe; exports.unstable_trace = unstable_trace; exports.unstable_unsubscribe = unstable_unsubscribe; exports.unstable_wrap = unstable_wrap; })(); } } }); // node_modules/scheduler/tracing.js var require_tracing = __commonJS({ "node_modules/scheduler/tracing.js"(exports, module2) { "use strict"; if (false) { module2.exports = null; } else { module2.exports = require_scheduler_tracing_development(); } } }); // node_modules/react-dom/cjs/react-dom.development.js var require_react_dom_development = __commonJS({ "node_modules/react-dom/cjs/react-dom.development.js"(exports) { "use strict"; if (true) { (function() { "use strict"; var React5 = require_react(); var _assign = require_object_assign(); var Scheduler = require_scheduler(); var tracing = require_tracing(); var ReactSharedInternals = React5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function warn(format) { { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } printWarning("warn", format, args); } } function error(format) { { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } printWarning("error", format, args); } } function printWarning(level, format, args) { { var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame2.getStackAddendum(); if (stack !== "") { format += "%s"; args = args.concat([stack]); } var argsWithFormat = args.map(function(item) { return "" + item; }); argsWithFormat.unshift("Warning: " + format); Function.prototype.apply.call(console[level], console, argsWithFormat); } } if (!React5) { { throw Error("ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM."); } } var FunctionComponent = 0; var ClassComponent = 1; var IndeterminateComponent = 2; var HostRoot = 3; var HostPortal = 4; var HostComponent = 5; var HostText = 6; var Fragment3 = 7; var Mode = 8; var ContextConsumer = 9; var ContextProvider = 10; var ForwardRef = 11; var Profiler = 12; var SuspenseComponent = 13; var MemoComponent = 14; var SimpleMemoComponent = 15; var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedFragment = 18; var SuspenseListComponent = 19; var FundamentalComponent = 20; var ScopeComponent = 21; var Block = 22; var OffscreenComponent = 23; var LegacyHiddenComponent = 24; var enableProfilerTimer = true; var enableFundamentalAPI = false; var enableNewReconciler = false; var warnAboutStringRefs = false; var allNativeEvents = new Set(); var registrationNameDependencies = {}; var possibleRegistrationNames = {}; function registerTwoPhaseEvent(registrationName, dependencies) { registerDirectEvent(registrationName, dependencies); registerDirectEvent(registrationName + "Capture", dependencies); } function registerDirectEvent(registrationName, dependencies) { { if (registrationNameDependencies[registrationName]) { error("EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.", registrationName); } } registrationNameDependencies[registrationName] = dependencies; { var lowerCasedName = registrationName.toLowerCase(); possibleRegistrationNames[lowerCasedName] = registrationName; if (registrationName === "onDoubleClick") { possibleRegistrationNames.ondblclick = registrationName; } } for (var i3 = 0; i3 < dependencies.length; i3++) { allNativeEvents.add(dependencies[i3]); } } var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"); var RESERVED = 0; var STRING = 1; var BOOLEANISH_STRING = 2; var BOOLEAN = 3; var OVERLOADED_BOOLEAN = 4; var NUMERIC = 5; var POSITIVE_NUMERIC = 6; var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; var ROOT_ATTRIBUTE_NAME = "data-reactroot"; var VALID_ATTRIBUTE_NAME_REGEX = new RegExp("^[" + ATTRIBUTE_NAME_START_CHAR + "][" + ATTRIBUTE_NAME_CHAR + "]*$"); var hasOwnProperty2 = Object.prototype.hasOwnProperty; var illegalAttributeNameCache = {}; var validatedAttributeNameCache = {}; function isAttributeNameSafe(attributeName) { if (hasOwnProperty2.call(validatedAttributeNameCache, attributeName)) { return true; } if (hasOwnProperty2.call(illegalAttributeNameCache, attributeName)) { return false; } if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { validatedAttributeNameCache[attributeName] = true; return true; } illegalAttributeNameCache[attributeName] = true; { error("Invalid attribute name: `%s`", attributeName); } return false; } function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { if (propertyInfo !== null) { return propertyInfo.type === RESERVED; } if (isCustomComponentTag) { return false; } if (name.length > 2 && (name[0] === "o" || name[0] === "O") && (name[1] === "n" || name[1] === "N")) { return true; } return false; } function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { if (propertyInfo !== null && propertyInfo.type === RESERVED) { return false; } switch (typeof value) { case "function": case "symbol": return true; case "boolean": { if (isCustomComponentTag) { return false; } if (propertyInfo !== null) { return !propertyInfo.acceptsBooleans; } else { var prefix2 = name.toLowerCase().slice(0, 5); return prefix2 !== "data-" && prefix2 !== "aria-"; } } default: return false; } } function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { if (value === null || typeof value === "undefined") { return true; } if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { return true; } if (isCustomComponentTag) { return false; } if (propertyInfo !== null) { switch (propertyInfo.type) { case BOOLEAN: return !value; case OVERLOADED_BOOLEAN: return value === false; case NUMERIC: return isNaN(value); case POSITIVE_NUMERIC: return isNaN(value) || value < 1; } } return false; } function getPropertyInfo(name) { return properties.hasOwnProperty(name) ? properties[name] : null; } function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL2, removeEmptyString) { this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; this.attributeName = attributeName; this.attributeNamespace = attributeNamespace; this.mustUseProperty = mustUseProperty; this.propertyName = name; this.type = type; this.sanitizeURL = sanitizeURL2; this.removeEmptyString = removeEmptyString; } var properties = {}; var reservedProps = [ "children", "dangerouslySetInnerHTML", "defaultValue", "defaultChecked", "innerHTML", "suppressContentEditableWarning", "suppressHydrationWarning", "style" ]; reservedProps.forEach(function(name) { properties[name] = new PropertyInfoRecord(name, RESERVED, false, name, null, false, false); }); [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(_ref) { var name = _ref[0], attributeName = _ref[1]; properties[name] = new PropertyInfoRecord(name, STRING, false, attributeName, null, false, false); }); ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, name.toLowerCase(), null, false, false); }); ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, name, null, false, false); }); [ "allowFullScreen", "async", "autoFocus", "autoPlay", "controls", "default", "defer", "disabled", "disablePictureInPicture", "disableRemotePlayback", "formNoValidate", "hidden", "loop", "noModule", "noValidate", "open", "playsInline", "readOnly", "required", "reversed", "scoped", "seamless", "itemScope" ].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, name.toLowerCase(), null, false, false); }); [ "checked", "multiple", "muted", "selected" ].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, name, null, false, false); }); [ "capture", "download" ].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, name, null, false, false); }); [ "cols", "rows", "size", "span" ].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, name, null, false, false); }); ["rowSpan", "start"].forEach(function(name) { properties[name] = new PropertyInfoRecord(name, NUMERIC, false, name.toLowerCase(), null, false, false); }); var CAMELIZE = /[\-\:]([a-z])/g; var capitalize = function(token) { return token[1].toUpperCase(); }; [ "accent-height", "alignment-baseline", "arabic-form", "baseline-shift", "cap-height", "clip-path", "clip-rule", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "dominant-baseline", "enable-background", "fill-opacity", "fill-rule", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "glyph-name", "glyph-orientation-horizontal", "glyph-orientation-vertical", "horiz-adv-x", "horiz-origin-x", "image-rendering", "letter-spacing", "lighting-color", "marker-end", "marker-mid", "marker-start", "overline-position", "overline-thickness", "paint-order", "panose-1", "pointer-events", "rendering-intent", "shape-rendering", "stop-color", "stop-opacity", "strikethrough-position", "strikethrough-thickness", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-anchor", "text-decoration", "text-rendering", "underline-position", "underline-thickness", "unicode-bidi", "unicode-range", "units-per-em", "v-alphabetic", "v-hanging", "v-ideographic", "v-mathematical", "vector-effect", "vert-adv-y", "vert-origin-x", "vert-origin-y", "word-spacing", "writing-mode", "xmlns:xlink", "x-height" ].forEach(function(attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, attributeName, null, false, false); }); [ "xlink:actuate", "xlink:arcrole", "xlink:role", "xlink:show", "xlink:title", "xlink:type" ].forEach(function(attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, attributeName, "http://www.w3.org/1999/xlink", false, false); }); [ "xml:base", "xml:lang", "xml:space" ].forEach(function(attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, attributeName, "http://www.w3.org/XML/1998/namespace", false, false); }); ["tabIndex", "crossOrigin"].forEach(function(attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, attributeName.toLowerCase(), null, false, false); }); var xlinkHref = "xlinkHref"; properties[xlinkHref] = new PropertyInfoRecord("xlinkHref", STRING, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false); ["src", "href", "action", "formAction"].forEach(function(attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, attributeName.toLowerCase(), null, true, true); }); var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; var didWarn = false; function sanitizeURL(url) { { if (!didWarn && isJavaScriptProtocol.test(url)) { didWarn = true; error("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.", JSON.stringify(url)); } } } function getValueForProperty(node, name, expected, propertyInfo) { { if (propertyInfo.mustUseProperty) { var propertyName = propertyInfo.propertyName; return node[propertyName]; } else { if (propertyInfo.sanitizeURL) { sanitizeURL("" + expected); } var attributeName = propertyInfo.attributeName; var stringValue = null; if (propertyInfo.type === OVERLOADED_BOOLEAN) { if (node.hasAttribute(attributeName)) { var value = node.getAttribute(attributeName); if (value === "") { return true; } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return value; } if (value === "" + expected) { return expected; } return value; } } else if (node.hasAttribute(attributeName)) { if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return node.getAttribute(attributeName); } if (propertyInfo.type === BOOLEAN) { return expected; } stringValue = node.getAttribute(attributeName); } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return stringValue === null ? expected : stringValue; } else if (stringValue === "" + expected) { return expected; } else { return stringValue; } } } } function getValueForAttribute(node, name, expected) { { if (!isAttributeNameSafe(name)) { return; } if (isOpaqueHydratingObject(expected)) { return expected; } if (!node.hasAttribute(name)) { return expected === void 0 ? void 0 : null; } var value = node.getAttribute(name); if (value === "" + expected) { return expected; } return value; } } function setValueForProperty(node, name, value, isCustomComponentTag) { var propertyInfo = getPropertyInfo(name); if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { return; } if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { value = null; } if (isCustomComponentTag || propertyInfo === null) { if (isAttributeNameSafe(name)) { var _attributeName = name; if (value === null) { node.removeAttribute(_attributeName); } else { node.setAttribute(_attributeName, "" + value); } } return; } var mustUseProperty = propertyInfo.mustUseProperty; if (mustUseProperty) { var propertyName = propertyInfo.propertyName; if (value === null) { var type = propertyInfo.type; node[propertyName] = type === BOOLEAN ? false : ""; } else { node[propertyName] = value; } return; } var attributeName = propertyInfo.attributeName, attributeNamespace = propertyInfo.attributeNamespace; if (value === null) { node.removeAttribute(attributeName); } else { var _type = propertyInfo.type; var attributeValue; if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { attributeValue = ""; } else { { attributeValue = "" + value; } if (propertyInfo.sanitizeURL) { sanitizeURL(attributeValue.toString()); } } if (attributeNamespace) { node.setAttributeNS(attributeNamespace, attributeName, attributeValue); } else { node.setAttribute(attributeName, attributeValue); } } } var REACT_ELEMENT_TYPE = 60103; var REACT_PORTAL_TYPE = 60106; var REACT_FRAGMENT_TYPE = 60107; var REACT_STRICT_MODE_TYPE = 60108; var REACT_PROFILER_TYPE = 60114; var REACT_PROVIDER_TYPE = 60109; var REACT_CONTEXT_TYPE = 60110; var REACT_FORWARD_REF_TYPE = 60112; var REACT_SUSPENSE_TYPE = 60113; var REACT_SUSPENSE_LIST_TYPE = 60120; var REACT_MEMO_TYPE = 60115; var REACT_LAZY_TYPE = 60116; var REACT_BLOCK_TYPE = 60121; var REACT_SERVER_BLOCK_TYPE = 60122; var REACT_FUNDAMENTAL_TYPE = 60117; var REACT_SCOPE_TYPE = 60119; var REACT_OPAQUE_ID_TYPE = 60128; var REACT_DEBUG_TRACING_MODE_TYPE = 60129; var REACT_OFFSCREEN_TYPE = 60130; var REACT_LEGACY_HIDDEN_TYPE = 60131; if (typeof Symbol === "function" && Symbol.for) { var symbolFor = Symbol.for; REACT_ELEMENT_TYPE = symbolFor("react.element"); REACT_PORTAL_TYPE = symbolFor("react.portal"); REACT_FRAGMENT_TYPE = symbolFor("react.fragment"); REACT_STRICT_MODE_TYPE = symbolFor("react.strict_mode"); REACT_PROFILER_TYPE = symbolFor("react.profiler"); REACT_PROVIDER_TYPE = symbolFor("react.provider"); REACT_CONTEXT_TYPE = symbolFor("react.context"); REACT_FORWARD_REF_TYPE = symbolFor("react.forward_ref"); REACT_SUSPENSE_TYPE = symbolFor("react.suspense"); REACT_SUSPENSE_LIST_TYPE = symbolFor("react.suspense_list"); REACT_MEMO_TYPE = symbolFor("react.memo"); REACT_LAZY_TYPE = symbolFor("react.lazy"); REACT_BLOCK_TYPE = symbolFor("react.block"); REACT_SERVER_BLOCK_TYPE = symbolFor("react.server.block"); REACT_FUNDAMENTAL_TYPE = symbolFor("react.fundamental"); REACT_SCOPE_TYPE = symbolFor("react.scope"); REACT_OPAQUE_ID_TYPE = symbolFor("react.opaque.id"); REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode"); REACT_OFFSCREEN_TYPE = symbolFor("react.offscreen"); REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden"); } var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = "@@iterator"; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== "object") { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === "function") { return maybeIterator; } return null; } var disabledDepth = 0; var prevLog; var prevInfo; var prevWarn; var prevError; var prevGroup; var prevGroupCollapsed; var prevGroupEnd; function disabledLog() { } disabledLog.__reactDisabledLog = true; function disableLogs() { { if (disabledDepth === 0) { prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); } disabledDepth++; } } function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { var props = { configurable: true, enumerable: true, writable: true }; Object.defineProperties(console, { log: _assign({}, props, { value: prevLog }), info: _assign({}, props, { value: prevInfo }), warn: _assign({}, props, { value: prevWarn }), error: _assign({}, props, { value: prevError }), group: _assign({}, props, { value: prevGroup }), groupCollapsed: _assign({}, props, { value: prevGroupCollapsed }), groupEnd: _assign({}, props, { value: prevGroupEnd }) }); } if (disabledDepth < 0) { error("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } } var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var prefix; function describeBuiltInComponentFrame(name, source, ownerFn) { { if (prefix === void 0) { try { throw Error(); } catch (x3) { var match = x3.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ""; } } return "\n" + prefix + name; } } var reentry = false; var componentFrameCache; { var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; componentFrameCache = new PossiblyWeakMap(); } function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) { return ""; } { var frame = componentFrameCache.get(fn); if (frame !== void 0) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher.current; ReactCurrentDispatcher.current = null; disableLogs(); } try { if (construct) { var Fake = function() { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function() { throw Error(); } }); if (typeof Reflect === "object" && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x3) { control = x3; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x3) { control = x3; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x3) { control = x3; } fn(); } } catch (sample) { if (sample && control && typeof sample.stack === "string") { var sampleLines = sample.stack.split("\n"); var controlLines = control.stack.split("\n"); var s3 = sampleLines.length - 1; var c3 = controlLines.length - 1; while (s3 >= 1 && c3 >= 0 && sampleLines[s3] !== controlLines[c3]) { c3--; } for (; s3 >= 1 && c3 >= 0; s3--, c3--) { if (sampleLines[s3] !== controlLines[c3]) { if (s3 !== 1 || c3 !== 1) { do { s3--; c3--; if (c3 < 0 || sampleLines[s3] !== controlLines[c3]) { var _frame = "\n" + sampleLines[s3].replace(" at new ", " at "); { if (typeof fn === "function") { componentFrameCache.set(fn, _frame); } } return _frame; } } while (s3 >= 1 && c3 >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } var name = fn ? fn.displayName || fn.name : ""; var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ""; { if (typeof fn === "function") { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; } function describeClassComponentFrame(ctor, source, ownerFn) { { return describeNativeComponentFrame(ctor, true); } } function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } } function shouldConstruct(Component5) { var prototype = Component5.prototype; return !!(prototype && prototype.isReactComponent); } function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ""; } if (typeof type === "function") { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === "string") { return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_BLOCK_TYPE: return describeFunctionComponentFrame(type._render); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x3) { } } } } return ""; } function describeFiber(fiber) { var owner = fiber._debugOwner ? fiber._debugOwner.type : null; var source = fiber._debugSource; switch (fiber.tag) { case HostComponent: return describeBuiltInComponentFrame(fiber.type); case LazyComponent: return describeBuiltInComponentFrame("Lazy"); case SuspenseComponent: return describeBuiltInComponentFrame("Suspense"); case SuspenseListComponent: return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); case ForwardRef: return describeFunctionComponentFrame(fiber.type.render); case Block: return describeFunctionComponentFrame(fiber.type._render); case ClassComponent: return describeClassComponentFrame(fiber.type); default: return ""; } } function getStackByFiberInDevAndProd(workInProgress2) { try { var info = ""; var node = workInProgress2; do { info += describeFiber(node); node = node.return; } while (node); return info; } catch (x3) { return "\nError generating stack: " + x3.message + "\n" + x3.stack; } } function getWrappedName(outerType, innerType, wrapperName) { var functionName = innerType.displayName || innerType.name || ""; return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName); } function getContextName(type) { return type.displayName || "Context"; } function getComponentName(type) { if (type == null) { return null; } { if (typeof type.tag === "number") { error("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."); } } if (typeof type === "function") { return type.displayName || type.name || null; } if (typeof type === "string") { return type; } switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: return "Portal"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + ".Consumer"; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + ".Provider"; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: return getComponentName(type.type); case REACT_BLOCK_TYPE: return getComponentName(type._render); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentName(init(payload)); } catch (x3) { return null; } } } } return null; } var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var current = null; var isRendering = false; function getCurrentFiberOwnerNameInDevOrNull() { { if (current === null) { return null; } var owner = current._debugOwner; if (owner !== null && typeof owner !== "undefined") { return getComponentName(owner.type); } } return null; } function getCurrentFiberStackInDev() { { if (current === null) { return ""; } return getStackByFiberInDevAndProd(current); } } function resetCurrentFiber() { { ReactDebugCurrentFrame.getCurrentStack = null; current = null; isRendering = false; } } function setCurrentFiber(fiber) { { ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; current = fiber; isRendering = false; } } function setIsRendering(rendering) { { isRendering = rendering; } } function getIsRendering() { { return isRendering; } } function toString(value) { return "" + value; } function getToStringValue(value) { switch (typeof value) { case "boolean": case "number": case "object": case "string": case "undefined": return value; default: return ""; } } var hasReadOnlyValue = { button: true, checkbox: true, image: true, hidden: true, radio: true, reset: true, submit: true }; function checkControlledValueProps(tagName, props) { { if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) { error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`."); } if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) { error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`."); } } } function isCheckable(elem) { var type = elem.type; var nodeName = elem.nodeName; return nodeName && nodeName.toLowerCase() === "input" && (type === "checkbox" || type === "radio"); } function getTracker(node) { return node._valueTracker; } function detachTracker(node) { node._valueTracker = null; } function getValueFromNode(node) { var value = ""; if (!node) { return value; } if (isCheckable(node)) { value = node.checked ? "true" : "false"; } else { value = node.value; } return value; } function trackValueOnNode(node) { var valueField = isCheckable(node) ? "checked" : "value"; var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); var currentValue = "" + node[valueField]; if (node.hasOwnProperty(valueField) || typeof descriptor === "undefined" || typeof descriptor.get !== "function" || typeof descriptor.set !== "function") { return; } var get2 = descriptor.get, set2 = descriptor.set; Object.defineProperty(node, valueField, { configurable: true, get: function() { return get2.call(this); }, set: function(value) { currentValue = "" + value; set2.call(this, value); } }); Object.defineProperty(node, valueField, { enumerable: descriptor.enumerable }); var tracker = { getValue: function() { return currentValue; }, setValue: function(value) { currentValue = "" + value; }, stopTracking: function() { detachTracker(node); delete node[valueField]; } }; return tracker; } function track(node) { if (getTracker(node)) { return; } node._valueTracker = trackValueOnNode(node); } function updateValueIfChanged(node) { if (!node) { return false; } var tracker = getTracker(node); if (!tracker) { return true; } var lastValue = tracker.getValue(); var nextValue = getValueFromNode(node); if (nextValue !== lastValue) { tracker.setValue(nextValue); return true; } return false; } function getActiveElement(doc) { doc = doc || (typeof document !== "undefined" ? document : void 0); if (typeof doc === "undefined") { return null; } try { return doc.activeElement || doc.body; } catch (e3) { return doc.body; } } var didWarnValueDefaultValue = false; var didWarnCheckedDefaultChecked = false; var didWarnControlledToUncontrolled = false; var didWarnUncontrolledToControlled = false; function isControlled(props) { var usesChecked = props.type === "checkbox" || props.type === "radio"; return usesChecked ? props.checked != null : props.value != null; } function getHostProps(element, props) { var node = element; var checked = props.checked; var hostProps = _assign({}, props, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: checked != null ? checked : node._wrapperState.initialChecked }); return hostProps; } function initWrapperState(element, props) { { checkControlledValueProps("input", props); if (props.checked !== void 0 && props.defaultChecked !== void 0 && !didWarnCheckedDefaultChecked) { error("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component", props.type); didWarnCheckedDefaultChecked = true; } if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValueDefaultValue) { error("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component", props.type); didWarnValueDefaultValue = true; } } var node = element; var defaultValue = props.defaultValue == null ? "" : props.defaultValue; node._wrapperState = { initialChecked: props.checked != null ? props.checked : props.defaultChecked, initialValue: getToStringValue(props.value != null ? props.value : defaultValue), controlled: isControlled(props) }; } function updateChecked(element, props) { var node = element; var checked = props.checked; if (checked != null) { setValueForProperty(node, "checked", checked, false); } } function updateWrapper(element, props) { var node = element; { var controlled = isControlled(props); if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { error("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"); didWarnUncontrolledToControlled = true; } if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { error("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"); didWarnControlledToUncontrolled = true; } } updateChecked(element, props); var value = getToStringValue(props.value); var type = props.type; if (value != null) { if (type === "number") { if (value === 0 && node.value === "" || node.value != value) { node.value = toString(value); } } else if (node.value !== toString(value)) { node.value = toString(value); } } else if (type === "submit" || type === "reset") { node.removeAttribute("value"); return; } { if (props.hasOwnProperty("value")) { setDefaultValue(node, props.type, value); } else if (props.hasOwnProperty("defaultValue")) { setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); } } { if (props.checked == null && props.defaultChecked != null) { node.defaultChecked = !!props.defaultChecked; } } } function postMountWrapper(element, props, isHydrating2) { var node = element; if (props.hasOwnProperty("value") || props.hasOwnProperty("defaultValue")) { var type = props.type; var isButton = type === "submit" || type === "reset"; if (isButton && (props.value === void 0 || props.value === null)) { return; } var initialValue = toString(node._wrapperState.initialValue); if (!isHydrating2) { { if (initialValue !== node.value) { node.value = initialValue; } } } { node.defaultValue = initialValue; } } var name = node.name; if (name !== "") { node.name = ""; } { node.defaultChecked = !node.defaultChecked; node.defaultChecked = !!node._wrapperState.initialChecked; } if (name !== "") { node.name = name; } } function restoreControlledState(element, props) { var node = element; updateWrapper(node, props); updateNamedCousins(node, props); } function updateNamedCousins(rootNode, props) { var name = props.name; if (props.type === "radio" && name != null) { var queryRoot = rootNode; while (queryRoot.parentNode) { queryRoot = queryRoot.parentNode; } var group = queryRoot.querySelectorAll("input[name=" + JSON.stringify("" + name) + '][type="radio"]'); for (var i3 = 0; i3 < group.length; i3++) { var otherNode = group[i3]; if (otherNode === rootNode || otherNode.form !== rootNode.form) { continue; } var otherProps = getFiberCurrentPropsFromNode(otherNode); if (!otherProps) { { throw Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported."); } } updateValueIfChanged(otherNode); updateWrapper(otherNode, otherProps); } } } function setDefaultValue(node, type, value) { if (type !== "number" || getActiveElement(node.ownerDocument) !== node) { if (value == null) { node.defaultValue = toString(node._wrapperState.initialValue); } else if (node.defaultValue !== toString(value)) { node.defaultValue = toString(value); } } } var didWarnSelectedSetOnOption = false; var didWarnInvalidChild = false; function flattenChildren(children) { var content = ""; React5.Children.forEach(children, function(child) { if (child == null) { return; } content += child; }); return content; } function validateProps(element, props) { { if (typeof props.children === "object" && props.children !== null) { React5.Children.forEach(props.children, function(child) { if (child == null) { return; } if (typeof child === "string" || typeof child === "number") { return; } if (typeof child.type !== "string") { return; } if (!didWarnInvalidChild) { didWarnInvalidChild = true; error("Only strings and numbers are supported as